summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ANSI_C_Programming/chapter1.ipynb398
-rw-r--r--ANSI_C_Programming/chapter10.ipynb1534
-rw-r--r--ANSI_C_Programming/chapter11.ipynb1065
-rw-r--r--ANSI_C_Programming/chapter12.ipynb2909
-rw-r--r--ANSI_C_Programming/chapter13.ipynb1421
-rw-r--r--ANSI_C_Programming/chapter14.ipynb812
-rw-r--r--ANSI_C_Programming/chapter15.ipynb1381
-rw-r--r--ANSI_C_Programming/chapter2.ipynb1563
-rw-r--r--ANSI_C_Programming/chapter3.ipynb3178
-rw-r--r--ANSI_C_Programming/chapter4.ipynb777
-rw-r--r--ANSI_C_Programming/chapter5.ipynb1939
-rw-r--r--ANSI_C_Programming/chapter6.ipynb3460
-rw-r--r--ANSI_C_Programming/chapter7.ipynb1531
-rw-r--r--ANSI_C_Programming/chapter8.ipynb2798
-rw-r--r--ANSI_C_Programming/chapter9.ipynb1914
-rw-r--r--A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter1.ipynb1005
-rw-r--r--A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter2.ipynb679
-rw-r--r--A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter3.ipynb1209
-rw-r--r--A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter4.ipynb2219
-rw-r--r--A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter5.ipynb2076
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch1.ipynb15
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch2.ipynb22
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch3.ipynb24
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb19
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch5.ipynb26
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch6.ipynb20
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch7.ipynb19
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch8.ipynb25
-rw-r--r--A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch9.ipynb83
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch1.ipynb177
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch10.ipynb269
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch11.ipynb385
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch12.ipynb430
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch13.ipynb217
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch14.ipynb22
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch2.ipynb300
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch4.ipynb392
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch5.ipynb794
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch6.ipynb393
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch7.ipynb1279
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch8.ipynb1134
-rw-r--r--Basic_Electronics_and_Linear_Circuits/ch9.ipynb524
-rw-r--r--Basic_Mechanical_Engineering/bme1.ipynb3003
-rw-r--r--Basic_Mechanical_Engineering/bme2.ipynb2876
-rw-r--r--Basic_Mechanical_Engineering/bme6.ipynb1862
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch1.ipynb19
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch10.ipynb18
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch11.ipynb13
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch13.ipynb6
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch15.ipynb4
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch19.ipynb14
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch2.ipynb36
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch20.ipynb7
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.ipynb12
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch22.ipynb13
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch23.ipynb18
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch24.ipynb20
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch25.ipynb20
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb15
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch27.ipynb17
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch28.ipynb10
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch29.ipynb14
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch3.ipynb15
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch4.ipynb9
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch5.ipynb16
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch6.ipynb12
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch7.ipynb11
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch8.ipynb23
-rw-r--r--Basic_Principles_And_Calculations_In_Chemical_Engineering/ch9.ipynb26
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter1.ipynb33
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter10.ipynb47
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter11.ipynb40
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter12.ipynb33
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter13.ipynb18
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter14.ipynb23
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter2.ipynb67
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter3.ipynb49
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter4.ipynb58
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter5.ipynb35
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter6.ipynb44
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter7.ipynb65
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter8.ipynb23
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter9.ipynb41
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter1.ipynb7
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter10.ipynb99
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter11.ipynb99
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter12.ipynb42
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter13.ipynb26
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter14.ipynb49
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter2.ipynb9
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter3.ipynb66
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter4.ipynb45
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter5.ipynb43
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter6.ipynb22
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter7.ipynb88
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter8.ipynb50
-rw-r--r--C++_Demystified:_A_Self-Teaching_Guide/chapter9.ipynb78
-rw-r--r--C++_from_the_Ground/Chapter_10(1).ipynb414
-rw-r--r--C++_from_the_Ground/Chapter_11(1).ipynb632
-rw-r--r--C++_from_the_Ground/Chapter_12(1).ipynb648
-rw-r--r--C++_from_the_Ground/Chapter_13(1).ipynb694
-rw-r--r--C++_from_the_Ground/Chapter_14(1).ipynb698
-rw-r--r--C++_from_the_Ground/Chapter_15(1).ipynb322
-rw-r--r--C++_from_the_Ground/Chapter_16(1).ipynb487
-rw-r--r--C++_from_the_Ground/Chapter_17(1).ipynb513
-rw-r--r--C++_from_the_Ground/Chapter_18(1).ipynb600
-rw-r--r--C++_from_the_Ground/Chapter_19(1).ipynb551
-rw-r--r--C++_from_the_Ground/Chapter_2(1).ipynb243
-rw-r--r--C++_from_the_Ground/Chapter_20(2).ipynb43
-rw-r--r--C++_from_the_Ground/Chapter_21(1).ipynb902
-rw-r--r--C++_from_the_Ground/Chapter_22(1).ipynb201
-rw-r--r--C++_from_the_Ground/Chapter_3(1).ipynb329
-rw-r--r--C++_from_the_Ground/Chapter_4(1).ipynb1063
-rw-r--r--C++_from_the_Ground/Chapter_5(1).ipynb731
-rw-r--r--C++_from_the_Ground/Chapter_6(1).ipynb355
-rw-r--r--C++_from_the_Ground/Chapter_7(1).ipynb591
-rw-r--r--C++_from_the_Ground/Chapter_8(1).ipynb1553
-rw-r--r--C++_from_the_Ground/Chapter_9(1).ipynb547
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch1.ipynb134
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch10.ipynb655
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch11.ipynb92
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch12.ipynb438
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch13.ipynb421
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch15.ipynb843
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch2.ipynb137
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch3.ipynb53
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch4.ipynb152
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch5.ipynb192
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch6.ipynb143
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch7.ipynb477
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch8.ipynb88
-rw-r--r--C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch9.ipynb129
-rw-r--r--Chemical_Engineering_Thermodynamics/ch10_1.ipynb79
-rw-r--r--Chemical_Engineering_Thermodynamics/ch11_1.ipynb18
-rw-r--r--Chemical_Engineering_Thermodynamics/ch12_1.ipynb21
-rw-r--r--Chemical_Engineering_Thermodynamics/ch13_1.ipynb9
-rw-r--r--Chemical_Engineering_Thermodynamics/ch14_1.ipynb34
-rw-r--r--Chemical_Engineering_Thermodynamics/ch15_1.ipynb78
-rw-r--r--Chemical_Engineering_Thermodynamics/ch16_1.ipynb35
-rw-r--r--Chemical_Engineering_Thermodynamics/ch17_1.ipynb57
-rw-r--r--Chemical_Engineering_Thermodynamics/ch18_1.ipynb22
-rw-r--r--Chemical_Engineering_Thermodynamics/ch1_2.ipynb44
-rw-r--r--Chemical_Engineering_Thermodynamics/ch2_2.ipynb59
-rw-r--r--Chemical_Engineering_Thermodynamics/ch3_2.ipynb76
-rw-r--r--Chemical_Engineering_Thermodynamics/ch4_2.ipynb67
-rw-r--r--Chemical_Engineering_Thermodynamics/ch5_2.ipynb36
-rw-r--r--Chemical_Engineering_Thermodynamics/ch6_2.ipynb43
-rw-r--r--Chemical_Engineering_Thermodynamics/ch7_2.ipynb76
-rw-r--r--Chemical_Engineering_Thermodynamics/ch8_2.ipynb40
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch1.ipynb8
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch10.ipynb209
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch11.ipynb419
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch12.ipynb412
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch13.ipynb430
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch14.ipynb314
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch2.ipynb374
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch3.ipynb24
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch4.ipynb704
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch5.ipynb981
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch6.ipynb505
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch7.ipynb430
-rw-r--r--Data_Structures_and_Algorithms_in_Java/ch8.ipynb246
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_10_2.ipynb14
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_12_2.ipynb20
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_13_2.ipynb55
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_14_2.ipynb20
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_15_2.ipynb20
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_2_2.ipynb8
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_3_2.ipynb6
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_4_2.ipynb86
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_5_2.ipynb54
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_6_2.ipynb21
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_7_2.ipynb41
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_8_2.ipynb40
-rw-r--r--Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_9_2.ipynb13
-rw-r--r--Electronic_Devices_/Chapter1.ipynb2
-rw-r--r--Electronic_Devices_/Chapter10.ipynb929
-rw-r--r--Electronic_Devices_/Chapter11.ipynb5
-rw-r--r--Electronic_Devices_/Chapter12.ipynb12
-rw-r--r--Electronic_Devices_/Chapter13.ipynb9
-rw-r--r--Electronic_Devices_/Chapter14.ipynb9
-rw-r--r--Electronic_Devices_/Chapter15.ipynb8
-rw-r--r--Electronic_Devices_/Chapter16.ipynb6
-rw-r--r--Electronic_Devices_/Chapter17.ipynb9
-rw-r--r--Electronic_Devices_/Chapter18.ipynb1
-rw-r--r--Electronic_Devices_/Chapter2.ipynb14
-rw-r--r--Electronic_Devices_/Chapter3.ipynb8
-rw-r--r--Electronic_Devices_/Chapter4.ipynb9
-rw-r--r--Electronic_Devices_/Chapter5.ipynb8
-rw-r--r--Electronic_Devices_/Chapter6.ipynb12
-rw-r--r--Electronic_Devices_/Chapter7.ipynb17
-rw-r--r--Electronic_Devices_/Chapter8.ipynb10
-rw-r--r--Electronic_Devices_/Chapter9.ipynb8
-rw-r--r--Electronic_Principles_/Chapter_10_New.ipynb45
-rw-r--r--Electronic_Principles_/Chapter_11_New.ipynb56
-rw-r--r--Electronic_Principles_/Chapter_12_New.ipynb68
-rw-r--r--Electronic_Principles_/Chapter_13_New.ipynb104
-rw-r--r--Electronic_Principles_/Chapter_14_New.ipynb82
-rw-r--r--Electronic_Principles_/Chapter_15_New.ipynb53
-rw-r--r--Electronic_Principles_/Chapter_16_New.ipynb113
-rw-r--r--Electronic_Principles_/Chapter_17_New.ipynb75
-rw-r--r--Electronic_Principles_/Chapter_18_New.ipynb73
-rw-r--r--Electronic_Principles_/Chapter_19_New.ipynb71
-rw-r--r--Electronic_Principles_/Chapter_1_New.ipynb31
-rw-r--r--Electronic_Principles_/Chapter_20_New.ipynb55
-rw-r--r--Electronic_Principles_/Chapter_21_New.ipynb66
-rw-r--r--Electronic_Principles_/Chapter_22_New.ipynb52
-rw-r--r--Electronic_Principles_/Chapter_23_New.ipynb79
-rw-r--r--Electronic_Principles_/Chapter_24_New.ipynb89
-rw-r--r--Electronic_Principles_/Chapter_2_New.ipynb17
-rw-r--r--Electronic_Principles_/Chapter_3_New.ipynb36
-rw-r--r--Electronic_Principles_/Chapter_4_New.ipynb51
-rw-r--r--Electronic_Principles_/Chapter_5_New.ipynb62
-rw-r--r--Electronic_Principles_/Chapter_6_New.ipynb62
-rw-r--r--Electronic_Principles_/Chapter_7_New.ipynb53
-rw-r--r--Electronic_Principles_/Chapter_8_New.ipynb31
-rw-r--r--Electronic_Principles_/Chapter_9_New.ipynb32
-rw-r--r--Elements_Of_Mass_Transfer_Part_1/ch2.ipynb148
-rw-r--r--Elements_Of_Mass_Transfer_Part_1/ch3.ipynb27
-rw-r--r--Elements_Of_Mass_Transfer_Part_1/ch5.ipynb47
-rw-r--r--Elements_Of_Mass_Transfer_Part_1/ch6.ipynb101
-rw-r--r--Elements_Of_Mass_Transfer_Part_1/ch7.ipynb58
-rw-r--r--Elements_of_Electromagnetics/chapter_1.ipynb799
-rw-r--r--Elements_of_Electromagnetics/chapter_10.ipynb1085
-rw-r--r--Elements_of_Electromagnetics/chapter_11.ipynb1284
-rw-r--r--Elements_of_Electromagnetics/chapter_12.ipynb869
-rw-r--r--Elements_of_Electromagnetics/chapter_13.ipynb816
-rw-r--r--Elements_of_Electromagnetics/chapter_14.ipynb330
-rw-r--r--Elements_of_Electromagnetics/chapter_2.ipynb615
-rw-r--r--Elements_of_Electromagnetics/chapter_3.ipynb757
-rw-r--r--Elements_of_Electromagnetics/chapter_4.ipynb1349
-rw-r--r--Elements_of_Electromagnetics/chapter_5.ipynb989
-rw-r--r--Elements_of_Electromagnetics/chapter_6.ipynb156
-rw-r--r--Elements_of_Electromagnetics/chapter_7.ipynb434
-rw-r--r--Elements_of_Electromagnetics/chapter_8.ipynb873
-rw-r--r--Elements_of_Electromagnetics/chapter_9.ipynb384
-rw-r--r--Engineering_Heat_Transfer/CHAPTER1.ipynb41
-rw-r--r--Engineering_Heat_Transfer/CHAPTER10.ipynb19
-rw-r--r--Engineering_Heat_Transfer/CHAPTER11.ipynb33
-rw-r--r--Engineering_Heat_Transfer/CHAPTER12.ipynb39
-rw-r--r--Engineering_Heat_Transfer/CHAPTER2.ipynb63
-rw-r--r--Engineering_Heat_Transfer/CHAPTER4.ipynb60
-rw-r--r--Engineering_Heat_Transfer/CHAPTER5.ipynb11
-rw-r--r--Engineering_Heat_Transfer/CHAPTER6.ipynb59
-rw-r--r--Engineering_Heat_Transfer/CHAPTER7.ipynb63
-rw-r--r--Engineering_Heat_Transfer/CHAPTER8.ipynb46
-rw-r--r--Engineering_Heat_Transfer/CHAPTER9.ipynb89
-rw-r--r--Engineering_Heat_Transfer/CHAPTER_3.ipynb38
-rw-r--r--Engineering_Physics/Chapter10_1.ipynb185
-rw-r--r--Engineering_Physics/Chapter11_1.ipynb210
-rw-r--r--Engineering_Physics/Chapter12_1.ipynb148
-rw-r--r--Engineering_Physics/Chapter13_1.ipynb213
-rw-r--r--Engineering_Physics/Chapter14_1.ipynb232
-rw-r--r--Engineering_Physics/Chapter15_1.ipynb191
-rw-r--r--Engineering_Physics/Chapter17_1.ipynb38
-rw-r--r--Engineering_Physics/Chapter18_1.ipynb182
-rw-r--r--Engineering_Physics/Chapter1_1.ipynb313
-rw-r--r--Engineering_Physics/Chapter2_1.ipynb159
-rw-r--r--Engineering_Physics/Chapter3_1.ipynb294
-rw-r--r--Engineering_Physics/Chapter4_1.ipynb325
-rw-r--r--Engineering_Physics/Chapter5_1.ipynb182
-rw-r--r--Engineering_Physics/Chapter6_1.ipynb435
-rw-r--r--Engineering_Physics/Chapter7_1.ipynb177
-rw-r--r--Engineering_Physics/Chapter8_1.ipynb430
-rw-r--r--Engineering_Physics/Chapter9_1.ipynb213
-rw-r--r--Engineering_Physics/Chapter_1.ipynb166
-rw-r--r--Engineering_Physics/Chapter_10.ipynb189
-rw-r--r--Engineering_Physics/Chapter_11.ipynb192
-rw-r--r--Engineering_Physics/Chapter_12.ipynb182
-rw-r--r--Engineering_Physics/Chapter_2.ipynb295
-rw-r--r--Engineering_Physics/Chapter_3.ipynb213
-rw-r--r--Engineering_Physics/Chapter_4.ipynb496
-rw-r--r--Engineering_Physics/Chapter_6.ipynb611
-rw-r--r--Engineering_Physics/Chapter_7.ipynb118
-rw-r--r--Engineering_Physics/Chapter_8.ipynb332
-rw-r--r--Engineering_Physics/Chapter_9.ipynb395
-rw-r--r--Engineering_Physics/chapter1_2.ipynb824
-rw-r--r--Engineering_Physics/chapter2_2.ipynb531
-rw-r--r--Engineering_Physics/chapter4_2.ipynb494
-rw-r--r--Engineering_Physics/chapter5_2.ipynb407
-rw-r--r--Engineering_Physics/chapter7_2.ipynb1042
-rw-r--r--Engineering_Physics/chapter8_2.ipynb156
-rw-r--r--Engineering_Physics_Aruldhas/Chapter10_1.ipynb188
-rw-r--r--Engineering_Physics_Aruldhas/Chapter11_1.ipynb214
-rw-r--r--Engineering_Physics_Aruldhas/Chapter12_1.ipynb151
-rw-r--r--Engineering_Physics_Aruldhas/Chapter13_1.ipynb214
-rw-r--r--Engineering_Physics_Aruldhas/Chapter14_1.ipynb238
-rw-r--r--Engineering_Physics_Aruldhas/Chapter15_1.ipynb197
-rw-r--r--Engineering_Physics_Aruldhas/Chapter17_1.ipynb39
-rw-r--r--Engineering_Physics_Aruldhas/Chapter18_1.ipynb188
-rw-r--r--Engineering_Physics_Aruldhas/Chapter1_1.ipynb318
-rw-r--r--Engineering_Physics_Aruldhas/Chapter2_1.ipynb162
-rw-r--r--Engineering_Physics_Aruldhas/Chapter3_1.ipynb304
-rw-r--r--Engineering_Physics_Aruldhas/Chapter4_1.ipynb333
-rw-r--r--Engineering_Physics_Aruldhas/Chapter5_1.ipynb186
-rw-r--r--Engineering_Physics_Aruldhas/Chapter6_1.ipynb445
-rw-r--r--Engineering_Physics_Aruldhas/Chapter7_1.ipynb183
-rw-r--r--Engineering_Physics_Aruldhas/Chapter8_1.ipynb439
-rw-r--r--Engineering_Physics_Aruldhas/Chapter9_1.ipynb219
-rw-r--r--Engineering_Physics_Marikani/Chapter_1.ipynb170
-rw-r--r--Engineering_Physics_Marikani/Chapter_10.ipynb192
-rw-r--r--Engineering_Physics_Marikani/Chapter_11.ipynb193
-rw-r--r--Engineering_Physics_Marikani/Chapter_12.ipynb188
-rw-r--r--Engineering_Physics_Marikani/Chapter_2.ipynb304
-rw-r--r--Engineering_Physics_Marikani/Chapter_3.ipynb219
-rw-r--r--Engineering_Physics_Marikani/Chapter_4.ipynb518
-rw-r--r--Engineering_Physics_Marikani/Chapter_6.ipynb625
-rw-r--r--Engineering_Physics_Marikani/Chapter_7.ipynb120
-rw-r--r--Engineering_Physics_Marikani/Chapter_8.ipynb338
-rw-r--r--Engineering_Physics_Marikani/Chapter_9.ipynb406
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb201
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch10.ipynb532
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch11.ipynb529
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch12.ipynb589
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch13.ipynb259
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch14.ipynb410
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch15.ipynb150
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch16.ipynb88
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch2.ipynb395
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch3.ipynb597
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch4.ipynb899
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch5.ipynb1058
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch6.ipynb675
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch7.ipynb394
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch8.ipynb599
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch9.ipynb224
-rw-r--r--Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_1_1.ipynb388
-rw-r--r--Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_2_1.ipynb253
-rw-r--r--Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_3_1.ipynb349
-rw-r--r--Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_4_1.ipynb38
-rw-r--r--Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_5_1.ipynb16
-rw-r--r--Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_6_1.ipynb258
-rw-r--r--Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_7_1.ipynb320
-rw-r--r--Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_8_1.ipynb442
-rw-r--r--Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_9_1.ipynb313
-rw-r--r--Fluid_Mechanics_/Chapter1.ipynb49
-rw-r--r--Fluid_Mechanics_/Chapter10.ipynb24
-rw-r--r--Fluid_Mechanics_/Chapter11.ipynb16
-rw-r--r--Fluid_Mechanics_/Chapter12.ipynb18
-rw-r--r--Fluid_Mechanics_/Chapter2.ipynb56
-rw-r--r--Fluid_Mechanics_/Chapter3.ipynb33
-rw-r--r--Fluid_Mechanics_/Chapter4.ipynb28
-rw-r--r--Fluid_Mechanics_/Chapter5.ipynb31
-rw-r--r--Fluid_Mechanics_/Chapter6.ipynb8
-rw-r--r--Fluid_Mechanics_/Chapter7.ipynb25
-rw-r--r--Fluid_Mechanics_/Chapter8.ipynb33
-rw-r--r--Fluid_Mechanics_/Chapter9.ipynb50
-rw-r--r--Fluidization_Engineering/ch10.ipynb10
-rw-r--r--Fluidization_Engineering/ch11.ipynb9
-rw-r--r--Fluidization_Engineering/ch12.ipynb11
-rw-r--r--Fluidization_Engineering/ch13.ipynb11
-rw-r--r--Fluidization_Engineering/ch14.ipynb9
-rw-r--r--Fluidization_Engineering/ch15.ipynb10
-rw-r--r--Fluidization_Engineering/ch16.ipynb9
-rw-r--r--Fluidization_Engineering/ch17.ipynb9
-rw-r--r--Fluidization_Engineering/ch18.ipynb7
-rw-r--r--Fluidization_Engineering/ch3.ipynb9
-rw-r--r--Fluidization_Engineering/ch4.ipynb9
-rw-r--r--Fluidization_Engineering/ch5.ipynb7
-rw-r--r--Fluidization_Engineering/ch6.ipynb13
-rw-r--r--Fluidization_Engineering/ch7.ipynb16
-rw-r--r--Fluidization_Engineering/ch9.ipynb9
-rw-r--r--Fundamental_of_Electronics_Devices/Ch1.ipynb46
-rw-r--r--Fundamental_of_Electronics_Devices/Ch2.ipynb176
-rw-r--r--Fundamental_of_Electronics_Devices/Ch3.ipynb39
-rw-r--r--Fundamental_of_Electronics_Devices/Ch4.ipynb122
-rw-r--r--Fundamental_of_Electronics_Devices/Ch5.ipynb21
-rw-r--r--Fundamental_of_Electronics_Devices/Ch6.ipynb91
-rw-r--r--Fundamental_of_Electronics_Devices/Ch7.ipynb49
-rw-r--r--Fundamental_of_Electronics_Devices/Ch8.ipynb21
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_10_2.ipynb74
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_11_2.ipynb106
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_12_2.ipynb186
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_13_2.ipynb220
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_14_2.ipynb77
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_1_2.ipynb2
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_2_2.ipynb44
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_3_2.ipynb70
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_4_2.ipynb82
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_5_2.ipynb16
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_6_2.ipynb122
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_7_2.ipynb120
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_8_2.ipynb156
-rw-r--r--Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_9_2.ipynb233
-rw-r--r--Fundamentals_of_Fluid_Mechanics/Ch_2.ipynb46
-rw-r--r--Fundamentals_of_Fluid_Mechanics/Ch_4.ipynb113
-rw-r--r--Fundamentals_of_Fluid_Mechanics/Ch_5.ipynb97
-rw-r--r--Fundamentals_of_Fluid_Mechanics/Ch_6.ipynb24
-rw-r--r--Fundamentals_of_Fluid_Mechanics/Ch_7.ipynb21
-rw-r--r--Fundamentals_of_Fluid_Mechanics/Ch_8.ipynb69
-rw-r--r--Fundamentals_of_Fluid_Mechanics/Ch_9.ipynb36
-rw-r--r--Fundamentals_of_Fluid_Mechanics/ch_1.ipynb9
-rw-r--r--Fundamentals_of_Fluid_Mechanics/ch_10.ipynb25
-rw-r--r--Fundamentals_of_Fluid_Mechanics/ch_11.ipynb59
-rw-r--r--Fundamentals_of_Fluid_Mechanics/ch_12.ipynb24
-rw-r--r--Fundamentals_of_Fluid_Mechanics/ch_3.ipynb42
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_1.ipynb15
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_10.ipynb13
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_11.ipynb16
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_12.ipynb23
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_13.ipynb13
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_14.ipynb5
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_2.ipynb8
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_3.ipynb29
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_4.ipynb9
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_5.ipynb27
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_6.ipynb21
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_7.ipynb26
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_8.ipynb27
-rw-r--r--Fundamentals_of_Heat_and_Mass_Transfer/Chapter_9.ipynb19
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_03.ipynb291
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_04.ipynb359
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_05.ipynb283
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_06.ipynb227
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_07.ipynb276
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_08.ipynb42
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_09.ipynb401
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_10.ipynb333
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_11.ipynb445
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_12.ipynb317
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_13.ipynb259
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_14.ipynb464
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_15.ipynb559
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_16.ipynb417
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_17.ipynb591
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_18.ipynb462
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_19.ipynb620
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_21.ipynb106
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_22.ipynb393
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_23.ipynb60
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_24.ipynb251
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_26.ipynb109
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_27.ipynb408
-rw-r--r--Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_28.ipynb80
-rw-r--r--Hydraulics/Chapter_1.ipynb57
-rw-r--r--Hydraulics/Chapter_2.ipynb17
-rw-r--r--Hydraulics/Chapter_3.ipynb41
-rw-r--r--Hydraulics/Chapter_4.ipynb34
-rw-r--r--Hydraulics/Chapter_5.ipynb56
-rw-r--r--Hydraulics/Chapter_6.ipynb45
-rw-r--r--Industrial_Instrumentation/Chapter_1.ipynb567
-rw-r--r--Industrial_Instrumentation/Chapter_2.ipynb871
-rw-r--r--Industrial_Instrumentation/Chapter_3.ipynb526
-rw-r--r--Industrial_Instrumentation/Chapter_4.ipynb798
-rw-r--r--Industrial_Instrumentation/Chapter_5.ipynb1206
-rw-r--r--Industrial_Instrumentation/Chapter_6.ipynb786
-rw-r--r--Industrial_Instrumentation/Chapter_7.ipynb799
-rw-r--r--Industrial_Instrumentation/Chapter_8.ipynb686
-rw-r--r--Industrial_Instrumentation/ch2.ipynb69
-rw-r--r--Industrial_Instrumentation/ch3.ipynb128
-rw-r--r--Industrial_Instrumentation/ch4.ipynb314
-rw-r--r--Industrial_Instrumentation/ch5.ipynb234
-rw-r--r--Industrial_Instrumentation/ch6.ipynb108
-rw-r--r--Industrial_Instrumentation/ch7.ipynb24
-rw-r--r--Industrial_Instrumentation/ch8.ipynb90
-rw-r--r--Industrial_Instrumentation/ch9.ipynb110
-rw-r--r--Introduction_To_Chemical_Engineering/ch1.ipynb70
-rw-r--r--Introduction_To_Chemical_Engineering/ch2.ipynb132
-rw-r--r--Introduction_To_Chemical_Engineering/ch3.ipynb129
-rw-r--r--Introduction_To_Chemical_Engineering/ch4.ipynb74
-rw-r--r--Introduction_To_Chemical_Engineering/ch5.ipynb67
-rw-r--r--Introduction_To_Chemical_Engineering/ch6.ipynb65
-rw-r--r--Introduction_To_Chemical_Engineering/ch7.ipynb36
-rw-r--r--Introduction_To_Chemical_Engineering/ch8.ipynb40
-rw-r--r--Introduction_To_Chemical_Engineering/ch9.ipynb10
-rw-r--r--Let_us_C/chapter-1.ipynb9
-rw-r--r--Let_us_C/chapter-10.ipynb16
-rw-r--r--Let_us_C/chapter-11.ipynb10
-rw-r--r--Let_us_C/chapter-12.ipynb17
-rw-r--r--Let_us_C/chapter-13.ipynb1
-rw-r--r--Let_us_C/chapter-14.ipynb9
-rw-r--r--Let_us_C/chapter-15.ipynb19
-rw-r--r--Let_us_C/chapter-16.ipynb1
-rw-r--r--Let_us_C/chapter-17.ipynb3
-rw-r--r--Let_us_C/chapter-18.ipynb6
-rw-r--r--Let_us_C/chapter-2.ipynb17
-rw-r--r--Let_us_C/chapter-20.ipynb6
-rw-r--r--Let_us_C/chapter-21.ipynb7
-rw-r--r--Let_us_C/chapter-3.ipynb11
-rw-r--r--Let_us_C/chapter-4.ipynb12
-rw-r--r--Let_us_C/chapter-5.ipynb27
-rw-r--r--Let_us_C/chapter-6.ipynb11
-rw-r--r--Let_us_C/chapter-7.ipynb4
-rw-r--r--Let_us_C/chapter-8.ipynb26
-rw-r--r--Let_us_C/chapter-9.ipynb17
-rw-r--r--Linear_Integrated_Circuits/Chapter_1.ipynb2
-rw-r--r--Linear_Integrated_Circuits/Chapter_10.ipynb7
-rw-r--r--Linear_Integrated_Circuits/Chapter_11.ipynb10
-rw-r--r--Linear_Integrated_Circuits/Chapter_2.ipynb9
-rw-r--r--Linear_Integrated_Circuits/Chapter_3.ipynb29
-rw-r--r--Linear_Integrated_Circuits/Chapter_4.ipynb11
-rw-r--r--Linear_Integrated_Circuits/Chapter_5.ipynb4
-rw-r--r--Linear_Integrated_Circuits/Chapter_6.ipynb14
-rw-r--r--Linear_Integrated_Circuits/Chapter_7.ipynb10
-rw-r--r--Linear_Integrated_Circuits/Chapter_8.ipynb8
-rw-r--r--Linear_Integrated_Circuits/Chapter_9.ipynb1
-rw-r--r--Materials_science_and_engineering_an_introduction/CH10.ipynb10
-rw-r--r--Materials_science_and_engineering_an_introduction/CH12.ipynb16
-rw-r--r--Materials_science_and_engineering_an_introduction/CH14.ipynb24
-rw-r--r--Materials_science_and_engineering_an_introduction/CH16.ipynb15
-rw-r--r--Materials_science_and_engineering_an_introduction/CH17.ipynb12
-rw-r--r--Materials_science_and_engineering_an_introduction/CH18.ipynb33
-rw-r--r--Materials_science_and_engineering_an_introduction/CH19.ipynb3
-rw-r--r--Materials_science_and_engineering_an_introduction/CH20.ipynb13
-rw-r--r--Materials_science_and_engineering_an_introduction/CH21.ipynb8
-rw-r--r--Materials_science_and_engineering_an_introduction/CH3.ipynb45
-rw-r--r--Materials_science_and_engineering_an_introduction/CH4.ipynb15
-rw-r--r--Materials_science_and_engineering_an_introduction/CH5.ipynb26
-rw-r--r--Materials_science_and_engineering_an_introduction/CH6.ipynb33
-rw-r--r--Materials_science_and_engineering_an_introduction/CH7.ipynb17
-rw-r--r--Materials_science_and_engineering_an_introduction/CH8.ipynb11
-rw-r--r--Materials_science_and_engineering_an_introduction/CH9.ipynb11
-rw-r--r--Mechanics_of_Materials/chapter1.ipynb32
-rw-r--r--Mechanics_of_Materials/chapter11.ipynb30
-rw-r--r--Mechanics_of_Materials/chapter12.ipynb14
-rw-r--r--Mechanics_of_Materials/chapter2.ipynb38
-rw-r--r--Mechanics_of_Materials/chapter3.ipynb42
-rw-r--r--Mechanics_of_Materials/chapter4.ipynb9
-rw-r--r--Mechanics_of_Materials/chapter5.ipynb58
-rw-r--r--Mechanics_of_Materials/chapter6.ipynb31
-rw-r--r--Mechanics_of_Materials/chapter7.ipynb29
-rw-r--r--Mechanics_of_Materials/chapter8.ipynb30
-rw-r--r--Mechanics_of_Materials/chapter9.ipynb10
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_10.ipynb19
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_11.ipynb606
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_3.ipynb13
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_4.ipynb30
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_5.ipynb4
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_6.ipynb16
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_7.ipynb4
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_8.ipynb30
-rw-r--r--Microwave_and_Radar_Engineering/Chapter_9.ipynb19
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch1.ipynb23
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch10.ipynb63
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb159
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch12.ipynb196
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch13.ipynb197
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch14.ipynb166
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch15.ipynb65
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch2.ipynb39
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb129
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch4.ipynb36
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch5.ipynb75
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb88
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb105
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch8.ipynb346
-rw-r--r--Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch9.ipynb131
-rw-r--r--Practical_C_Programming/Chapter_10_1.ipynb259
-rw-r--r--Practical_C_Programming/Chapter_11_1.ipynb77
-rw-r--r--Practical_C_Programming/Chapter_12_1.ipynb29
-rw-r--r--Practical_C_Programming/Chapter_13_1.ipynb348
-rw-r--r--Practical_C_Programming/Chapter_14_1.ipynb98
-rw-r--r--Practical_C_Programming/Chapter_15_1.ipynb232
-rw-r--r--Practical_C_Programming/Chapter_16_1.ipynb43
-rw-r--r--Practical_C_Programming/Chapter_17_1.ipynb128
-rw-r--r--Practical_C_Programming/Chapter_18_1.ipynb62
-rw-r--r--Practical_C_Programming/Chapter_19_1.ipynb106
-rw-r--r--Practical_C_Programming/Chapter_21_1.ipynb34
-rw-r--r--Practical_C_Programming/Chapter_23_1.ipynb28
-rw-r--r--Practical_C_Programming/Chapter_2_3.ipynb2292
-rw-r--r--Practical_C_Programming/Chapter_3_4.ipynb22
-rw-r--r--Practical_C_Programming/Chapter_4_4.ipynb137
-rw-r--r--Practical_C_Programming/Chapter_5_4.ipynb238
-rw-r--r--Practical_C_Programming/Chapter_6_4.ipynb148
-rw-r--r--Practical_C_Programming/Chapter_7_4.ipynb129
-rw-r--r--Practical_C_Programming/Chapter_8_4.ipynb252
-rw-r--r--Practical_C_Programming/Chapter_9_4.ipynb95
-rw-r--r--Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter1.ipynb241
-rw-r--r--Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter2.ipynb786
-rw-r--r--Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter3.ipynb503
-rw-r--r--Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter4.ipynb622
-rw-r--r--Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter5.ipynb604
-rw-r--r--Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter6.ipynb839
-rw-r--r--Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter7.ipynb956
-rw-r--r--Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter8.ipynb579
-rw-r--r--Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter9.ipynb526
-rw-r--r--Problems_In_Fluid_Flow/ch1.ipynb49
-rw-r--r--Problems_In_Fluid_Flow/ch10.ipynb32
-rw-r--r--Problems_In_Fluid_Flow/ch11.ipynb40
-rw-r--r--Problems_In_Fluid_Flow/ch12.ipynb16
-rw-r--r--Problems_In_Fluid_Flow/ch13.ipynb25
-rw-r--r--Problems_In_Fluid_Flow/ch2.ipynb39
-rw-r--r--Problems_In_Fluid_Flow/ch3.ipynb41
-rw-r--r--Problems_In_Fluid_Flow/ch4.ipynb42
-rw-r--r--Problems_In_Fluid_Flow/ch5.ipynb78
-rw-r--r--Problems_In_Fluid_Flow/ch6.ipynb34
-rw-r--r--Problems_In_Fluid_Flow/ch7.ipynb13
-rw-r--r--Problems_In_Fluid_Flow/ch8.ipynb39
-rw-r--r--Problems_In_Fluid_Flow/ch9.ipynb28
-rw-r--r--Programming_in_C/Chapter_03.ipynb116
-rw-r--r--Programming_in_C/Chapter_04.ipynb19
-rw-r--r--Programming_in_C/Chapter_05.ipynb41
-rw-r--r--Programming_in_C/Chapter_06.ipynb53
-rw-r--r--Programming_in_C/Chapter_07.ipynb46
-rw-r--r--Programming_in_C/Chapter_08.ipynb80
-rw-r--r--Programming_in_C/Chapter_09.ipynb37
-rw-r--r--Programming_in_C/Chapter_10.ipynb60
-rw-r--r--Programming_in_C/Chapter_11.ipynb68
-rw-r--r--Programming_in_C/Chapter_12.ipynb19
-rw-r--r--Programming_in_C/Chapter_13.ipynb18
-rw-r--r--Programming_in_C/Chapter_14.ipynb4
-rw-r--r--Programming_in_C/Chapter_16.ipynb16
-rw-r--r--Programming_in_C/Chapter_17.ipynb7
-rw-r--r--Programming_in_C/Chapter_18.ipynb36
-rw-r--r--Programming_in_C/Chapter_19.ipynb5
-rw-r--r--Satellite_Communication/chapter_2.ipynb18
-rw-r--r--Satellite_Communication/chapter_3.ipynb15
-rw-r--r--Satellite_Communication/chapter_4.ipynb14
-rw-r--r--Satellite_Communication/chapter_5.ipynb13
-rw-r--r--Satellite_Communication/chapter_6.ipynb7
-rw-r--r--Satellite_Communication/chapter_7.ipynb15
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch1.ipynb199
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch10.ipynb535
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch11.ipynb529
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch12.ipynb590
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch13.ipynb257
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch14.ipynb408
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch2.ipynb390
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch3.ipynb601
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch4.ipynb896
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch5.ipynb1055
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch6.ipynb676
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch7.ipynb392
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch8.ipynb594
-rw-r--r--Schaum's_Outlines_-_Programming_with_C++/ch9.ipynb220
-rw-r--r--Surveying_Volume_3/Chapter_1_.ipynb2837
-rw-r--r--Surveying_Volume_3/Chapter_2.ipynb684
-rw-r--r--Thermodynamics:_A_Core_Course/CH2.ipynb11
-rw-r--r--Thermodynamics:_A_Core_Course/CH3.ipynb113
-rw-r--r--Thermodynamics:_A_Core_Course/CH4.ipynb15
-rw-r--r--Thermodynamics:_A_Core_Course/CH5.ipynb210
-rw-r--r--Thermodynamics:_A_Core_Course/CH6.ipynb82
-rw-r--r--Thermodynamics:_A_Core_Course/CH7.ipynb66
-rw-r--r--Transport_Phenomena/ch1.ipynb7
-rw-r--r--Transport_Phenomena/ch10.ipynb32
-rw-r--r--Transport_Phenomena/ch11.ipynb22
-rw-r--r--Transport_Phenomena/ch12.ipynb47
-rw-r--r--Transport_Phenomena/ch13.ipynb24
-rw-r--r--Transport_Phenomena/ch14.ipynb36
-rw-r--r--Transport_Phenomena/ch15.ipynb9
-rw-r--r--Transport_Phenomena/ch2.ipynb31
-rw-r--r--Transport_Phenomena/ch3.ipynb16
-rw-r--r--Transport_Phenomena/ch4.ipynb10
-rw-r--r--Transport_Phenomena/ch5.ipynb18
-rw-r--r--Transport_Phenomena/ch6.ipynb22
-rw-r--r--Transport_Phenomena/ch7.ipynb34
-rw-r--r--Transport_Phenomena/ch9.ipynb11
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_10.ipynb131
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_11.ipynb289
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_12.ipynb560
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_14.ipynb570
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_15.ipynb456
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_16.ipynb578
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_2.ipynb855
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_3.ipynb895
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_4.ipynb313
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_5.ipynb694
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_6.ipynb258
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_7.ipynb451
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_8.ipynb563
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_9.ipynb540
-rw-r--r--_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_no_1.ipynb113
-rw-r--r--_Programming_With_C/chapter1.ipynb121
-rw-r--r--_Programming_With_C/chapter10.ipynb366
-rw-r--r--_Programming_With_C/chapter11.ipynb745
-rw-r--r--_Programming_With_C/chapter12.ipynb3
-rw-r--r--_Programming_With_C/chapter13.ipynb3
-rw-r--r--_Programming_With_C/chapter14.ipynb3
-rw-r--r--_Programming_With_C/chapter2.ipynb2
-rw-r--r--_Programming_With_C/chapter3.ipynb3
-rw-r--r--_Programming_With_C/chapter4.ipynb17
-rw-r--r--_Programming_With_C/chapter5.ipynb2
-rw-r--r--_Programming_With_C/chapter6.ipynb23
-rw-r--r--_Programming_With_C/chapter7.ipynb13
-rw-r--r--_Programming_With_C/chapter8.ipynb9
-rw-r--r--_Programming_With_C/chapter9.ipynb8
676 files changed, 106161 insertions, 62771 deletions
diff --git a/ANSI_C_Programming/chapter1.ipynb b/ANSI_C_Programming/chapter1.ipynb
index d5485e0e..1c3108fa 100644
--- a/ANSI_C_Programming/chapter1.ipynb
+++ b/ANSI_C_Programming/chapter1.ipynb
@@ -1,200 +1,200 @@
-{
- "metadata": {
- "name": "chapter1.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 1: GETTING STARTED"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:12"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculation of simple interest\n",
- "#Author gekay Date:25/08/2009\n",
- "p=1000\n",
- "n=3\n",
- "r=8.5\n",
- "si=p*n*r/100 #formula for simple interest\n",
- "print \"%f\\n\" % (si)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "255.000000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:17"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculation of simple interest\n",
- "#Author gekay Date 25/07/2008\n",
- "print \"Enter values of p,n,r\"\n",
- "p=eval(raw_input())\n",
- "n=eval(raw_input())\n",
- "r=eval(raw_input())\n",
- "si=p*n*r/100\n",
- "print \"%f\\n\" % (si)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter values of p,n,r\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1000\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "8.5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "255.000000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example on page:18"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Just for fun. Author.Bozo\n",
- "print \"Enter a number\"\n",
- "num=eval(raw_input()) #to take user input\n",
- "print \"Now I am letting you on a secret...\\n\"\n",
- "print \"You have just entered the number %d\\n\" % (num)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter a number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "30\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Now I am letting you on a secret...\n",
- "\n",
- "You have just entered the number 30\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:23"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#to find exponentiation of numbers\n",
- "a=pow(3,2) #(3**2) will also do the same operation\n",
- "print \"%d\" % (a)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "9\n"
- ]
- }
- ],
- "prompt_number": 4
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:a5caa773def394b4fd51c60fb4856df2fdb5f2105f126537a15f6520ea337bff"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 1: GETTING STARTED"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ " \n",
+ "p=1000\n",
+ "n=3\n",
+ "r=8.5\n",
+ "si=p*n*r/100 #formula for simple interest\n",
+ "print \"%f\\n\" % (si)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "255.000000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter values of p,n,r\"\n",
+ "p=eval(raw_input())\n",
+ "n=eval(raw_input())\n",
+ "r=eval(raw_input())\n",
+ "si=p*n*r/100\n",
+ "print \"%f\\n\" % (si)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter values of p,n,r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1000\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "8.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "255.000000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example on page:18"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter a number\"\n",
+ "num=eval(raw_input()) #to take user input\n",
+ "print \"Now I am letting you on a secret...\\n\"\n",
+ "print \"You have just entered the number %d\\n\" % (num)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "30\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Now I am letting you on a secret...\n",
+ "\n",
+ "You have just entered the number 30\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "a=pow(3,2) #(3**2) will also do the same operation\n",
+ "print \"%d\" % (a)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "9\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter10.ipynb b/ANSI_C_Programming/chapter10.ipynb
index 51080026..370cbcea 100644
--- a/ANSI_C_Programming/chapter10.ipynb
+++ b/ANSI_C_Programming/chapter10.ipynb
@@ -1,768 +1,768 @@
-{
- "metadata": {
- "name": "chapter10.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 10: STRUCTURES"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:342-343"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#storing & printing names,prices & pages of books\n",
- "name=[]\n",
- "price=[]\n",
- "pages=[]\n",
- "for i in range(3):\n",
- " name.append(\"\\0\")\n",
- " price.append(0)\n",
- " pages.append(0)\n",
- "print \"Enter names,prices and no. of pages of 3 books\\n\"\n",
- "for i in range(0,3,1):\n",
- " name[i]=raw_input()\n",
- " price[i]=eval(raw_input())\n",
- " pages[i]=eval(raw_input())\n",
- "print \"\\nAnd this is what you entered\\n\"\n",
- "for i in range(0,3,1):\n",
- " print \"%c %f %d\\n\" % (name[i],price[i],pages[i])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter names,prices and no. of pages of 3 books\n",
- "\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "A\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "100.00\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "354\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "C\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "256.50\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "682\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "F\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "233.70\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "512\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "And this is what you entered\n",
- "\n",
- "A 100.000000 354\n",
- "\n",
- "C 256.500000 682\n",
- "\n",
- "F 233.700000 512\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:343-344"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#storing & printing names,prices & pages of books using structure\n",
- "class book: #YOU CAN ALSO USE CTYPES FOR IMPLEMENTING STRUCTURES\n",
- " def __init__(self, **kwds):\n",
- " self.__dict__.update(kwds)\n",
- "b1=book()\n",
- "b2=book()\n",
- "b3=book()\n",
- "print \"Enter names,prices & no. of pages of 3 books\\n\"\n",
- "b1.name=raw_input()\n",
- "b1.price=eval(raw_input())\n",
- "b1.pages=eval(raw_input())\n",
- "b2.name=raw_input()\n",
- "b2.price=eval(raw_input())\n",
- "b2.pages=eval(raw_input())\n",
- "b3.name=raw_input()\n",
- "b3.price=eval(raw_input())\n",
- "b3.pages=eval(raw_input())\n",
- "print \"And this is what you entered\\n\"\n",
- "print \"%c %f %d\\n\" % (b1.name,b1.price,b1.pages)\n",
- "print \"%c %f %d\\n\" % (b2.name,b2.price,b2.pages)\n",
- "print \"%c %f %d\\n\" % (b3.name,b3.price,b3.pages)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter names,prices & no. of pages of 3 books\n",
- "\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "A\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "100.00\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "354\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "C\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "256.50\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "682\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "F\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "233.70\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "512\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "And this is what you entered\n",
- "\n",
- "A 100.000000 354\n",
- "\n",
- "C 256.500000 682\n",
- "\n",
- "F 233.700000 512\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:347"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Memory map of structure elements\n",
- "class book():\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "b1=book(name='B',price=130.00,pages=550)\n",
- "print \"Address of name=%u\\n\" % (id(b1.name))\n",
- "print \"Address of price=%u\\n\" % (id(b1.price))\n",
- "print \"Address of pages=%u\\n\" % (id(b1.pages))"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Address of name=20788864\n",
- "\n",
- "Address of price=88371144\n",
- "\n",
- "Address of pages=88859008\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:348-349"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Usage of an array of stuctures\n",
- "def linkfloat():\n",
- " a=0\n",
- " b=id(a) #cause emulator to be linked\n",
- "class book():\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "b=[]\n",
- "for i in range(3):\n",
- " b.append(0) #setting initial value as zero\n",
- "for i in range(0,3,1):\n",
- " b[i]=book()\n",
- "for i in range(0,3,1):\n",
- " print \"Enter name price and pages\"\n",
- " b[i].name=raw_input()\n",
- " b[i].price=eval(raw_input())\n",
- " b[i].pages=eval(raw_input())\n",
- "for i in range(0,3,1):\n",
- " print \"%c %f %d\\n\" % (b[i].name,b[i].price,b[i].pages)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name price and pages\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "A\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "100.00\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "354\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name price and pages\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "C\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "256.50\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "682\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name price and pages\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "F\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "233.70\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "512\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "A 100.000000 354\n",
- "\n",
- "C 256.500000 682\n",
- "\n",
- "F 233.700000 512\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:350-351"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Copying elements of an structure into another structure\n",
- "class employee():\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "e1=employee(name=\"Sanjay\",age=30,salary=5500.50)\n",
- "e2=employee()\n",
- "e3=employee()\n",
- "#piece-meal copying\n",
- "import copy\n",
- "e2.name=copy.copy(e1.name)\n",
- "e2.age=e1.age\n",
- "e2.salary=e1.salary\n",
- "#copying all elements at one go\n",
- "e3=e2\n",
- "print \"%s %d %f\\n\" % (e1.name,e1.age,e1.salary)\n",
- "print \"%s %d %f\\n\" % (e2.name,e2.age,e2.salary)\n",
- "print \"%s %d %f\\n\" % (e3.name,e3.age,e3.salary)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Sanjay 30 5500.500000\n",
- "\n",
- "Sanjay 30 5500.500000\n",
- "\n",
- "Sanjay 30 5500.500000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:351-352"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#declaring a structure inside another structure\n",
- "class address():\n",
- " def __init__(self, **kwds):\n",
- " self.__dict__.update(kwds)\n",
- "class emp():\n",
- " def __init__(self, **kwds):\n",
- " self.__dict__.update(kwds)\n",
- "a = address(phone=\"531046\", city=\"nagpur\", pin=10)\n",
- "e = emp(name=\"jeru\", address=a)\n",
- "print \"name=%s phone=%s\\n\" % (e.name,e.address.phone)\n",
- "print \"city=%s pin=%d\\n\" % (e.address.city,e.address.pin)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "name=jeru phone=531046\n",
- "\n",
- "city=nagpur pin=10\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:353"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#passing individual structure elements to a function\n",
- "class book():\n",
- " def __init__(self, **kwds):\n",
- " self.__dict__.update(kwds)\n",
- "def display(s,t,n):\n",
- " print \"%s %s %d\\n\" % (s,t,n)\n",
- "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n",
- "display(b1.name,b1.author,b1.callno)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Let us C YPK 101\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:353-354"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#passing whole structure to a function\n",
- "class book():\n",
- " def __init__(self, **kwds):\n",
- " self.__dict__.update(kwds)\n",
- "def display(b):\n",
- " print \"%s %s %d\\n\" % (b.name,b.author,b.callno)\n",
- "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n",
- "display(b1)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Let us C YPK 101\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:354-355"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing structure elements to a function\n",
- "class book():\n",
- " def __init__(self, **kwds):\n",
- " self.__dict__.update(kwds)\n",
- "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n",
- "ptr=book()\n",
- "ptr=b1\n",
- "print \"%s %s %d\\n\" % (b1.name,b1.author,b1.callno)\n",
- "print \"%s %s %d\\n\" % (ptr.name,ptr.author,ptr.callno)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Let us C YPK 101\n",
- "\n",
- "Let us C YPK 101\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:355-356"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#passing address of a structure variable\n",
- "class book():\n",
- " def __init__(self, **kwds):\n",
- " self.__dict__.update(kwds)\n",
- "def display(b):\n",
- " print \"%s %s %d\\n\" % (b.name,b.author,b.callno)\n",
- "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n",
- "display(b1)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Let us C YPK 101\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:356"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing address of elements of structure\n",
- "class emp():\n",
- " def __init__(self, **kwds):\n",
- " self.__dict__.update(kwds)\n",
- "e=emp(a=0,ch='\\0',s=0.0)\n",
- "print \"%u %u %u\\n\" % (id(e.a),id(e.ch),id(e.s))"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "20623060 20204312 88374024\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:357-358"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Implementation of structure\n",
- "#pragma directive is not present in python\n",
- "class emp():\n",
- " def __init__(self,a,ch,s): #Structure without using dictionary\n",
- " self.a=a\n",
- " self.ch=ch\n",
- " self.s=s\n",
- "e=emp(a=0,ch='\\0',s=0.0)\n",
- "print \"%u %u %u\\n\" % (id(e.a),id(e.ch),id(e.s))"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "20360916 19942168 88177544\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 10
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2551d4c0f797f2bbef63a528dde1d2dd1067208b3f54db92e7a20ac687ed39db"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 10: STRUCTURES"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:342-343"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "name=[]\n",
+ "price=[]\n",
+ "pages=[]\n",
+ "for i in range(3):\n",
+ " name.append(\"\\0\")\n",
+ " price.append(0)\n",
+ " pages.append(0)\n",
+ "print \"Enter names,prices and no. of pages of 3 books\\n\"\n",
+ "for i in range(0,3,1):\n",
+ " name[i]=raw_input()\n",
+ " price[i]=eval(raw_input())\n",
+ " pages[i]=eval(raw_input())\n",
+ "print \"\\nAnd this is what you entered\\n\"\n",
+ "for i in range(0,3,1):\n",
+ " print \"%c %f %d\\n\" % (name[i],price[i],pages[i])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter names,prices and no. of pages of 3 books\n",
+ "\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "100.00\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "354\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "C\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "256.50\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "682\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "F\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "233.70\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "512\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "And this is what you entered\n",
+ "\n",
+ "A 100.000000 354\n",
+ "\n",
+ "C 256.500000 682\n",
+ "\n",
+ "F 233.700000 512\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:343-344"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class book: #YOU CAN ALSO USE CTYPES FOR IMPLEMENTING STRUCTURES\n",
+ " def __init__(self, **kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "b1=book()\n",
+ "b2=book()\n",
+ "b3=book()\n",
+ "print \"Enter names,prices & no. of pages of 3 books\\n\"\n",
+ "b1.name=raw_input()\n",
+ "b1.price=eval(raw_input())\n",
+ "b1.pages=eval(raw_input())\n",
+ "b2.name=raw_input()\n",
+ "b2.price=eval(raw_input())\n",
+ "b2.pages=eval(raw_input())\n",
+ "b3.name=raw_input()\n",
+ "b3.price=eval(raw_input())\n",
+ "b3.pages=eval(raw_input())\n",
+ "print \"And this is what you entered\\n\"\n",
+ "print \"%c %f %d\\n\" % (b1.name,b1.price,b1.pages)\n",
+ "print \"%c %f %d\\n\" % (b2.name,b2.price,b2.pages)\n",
+ "print \"%c %f %d\\n\" % (b3.name,b3.price,b3.pages)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter names,prices & no. of pages of 3 books\n",
+ "\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "100.00\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "354\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "C\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "256.50\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "682\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "F\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "233.70\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "512\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "And this is what you entered\n",
+ "\n",
+ "A 100.000000 354\n",
+ "\n",
+ "C 256.500000 682\n",
+ "\n",
+ "F 233.700000 512\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:347"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class book():\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "b1=book(name='B',price=130.00,pages=550)\n",
+ "print \"Address of name=%u\\n\" % (id(b1.name))\n",
+ "print \"Address of price=%u\\n\" % (id(b1.price))\n",
+ "print \"Address of pages=%u\\n\" % (id(b1.pages))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Address of name=20788864\n",
+ "\n",
+ "Address of price=88371144\n",
+ "\n",
+ "Address of pages=88859008\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:348-349"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def linkfloat():\n",
+ " a=0\n",
+ " b=id(a) #cause emulator to be linked\n",
+ "class book():\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "b=[]\n",
+ "for i in range(3):\n",
+ " b.append(0) #setting initial value as zero\n",
+ "for i in range(0,3,1):\n",
+ " b[i]=book()\n",
+ "for i in range(0,3,1):\n",
+ " print \"Enter name price and pages\"\n",
+ " b[i].name=raw_input()\n",
+ " b[i].price=eval(raw_input())\n",
+ " b[i].pages=eval(raw_input())\n",
+ "for i in range(0,3,1):\n",
+ " print \"%c %f %d\\n\" % (b[i].name,b[i].price,b[i].pages)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name price and pages\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "100.00\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "354\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name price and pages\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "C\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "256.50\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "682\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name price and pages\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "F\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "233.70\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "512\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A 100.000000 354\n",
+ "\n",
+ "C 256.500000 682\n",
+ "\n",
+ "F 233.700000 512\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:350-351"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class employee():\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "e1=employee(name=\"Sanjay\",age=30,salary=5500.50)\n",
+ "e2=employee()\n",
+ "e3=employee()\n",
+ "#piece-meal copying\n",
+ "import copy\n",
+ "e2.name=copy.copy(e1.name)\n",
+ "e2.age=e1.age\n",
+ "e2.salary=e1.salary\n",
+ "#copying all elements at one go\n",
+ "e3=e2\n",
+ "print \"%s %d %f\\n\" % (e1.name,e1.age,e1.salary)\n",
+ "print \"%s %d %f\\n\" % (e2.name,e2.age,e2.salary)\n",
+ "print \"%s %d %f\\n\" % (e3.name,e3.age,e3.salary)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Sanjay 30 5500.500000\n",
+ "\n",
+ "Sanjay 30 5500.500000\n",
+ "\n",
+ "Sanjay 30 5500.500000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:351-352"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class address():\n",
+ " def __init__(self, **kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "class emp():\n",
+ " def __init__(self, **kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "a = address(phone=\"531046\", city=\"nagpur\", pin=10)\n",
+ "e = emp(name=\"jeru\", address=a)\n",
+ "print \"name=%s phone=%s\\n\" % (e.name,e.address.phone)\n",
+ "print \"city=%s pin=%d\\n\" % (e.address.city,e.address.pin)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "name=jeru phone=531046\n",
+ "\n",
+ "city=nagpur pin=10\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:353"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class book():\n",
+ " def __init__(self, **kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "def display(s,t,n):\n",
+ " print \"%s %s %d\\n\" % (s,t,n)\n",
+ "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n",
+ "display(b1.name,b1.author,b1.callno)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Let us C YPK 101\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:353-354"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class book():\n",
+ " def __init__(self, **kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "def display(b):\n",
+ " print \"%s %s %d\\n\" % (b.name,b.author,b.callno)\n",
+ "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n",
+ "display(b1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Let us C YPK 101\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:354-355"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class book():\n",
+ " def __init__(self, **kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n",
+ "ptr=book()\n",
+ "ptr=b1\n",
+ "print \"%s %s %d\\n\" % (b1.name,b1.author,b1.callno)\n",
+ "print \"%s %s %d\\n\" % (ptr.name,ptr.author,ptr.callno)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Let us C YPK 101\n",
+ "\n",
+ "Let us C YPK 101\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:355-356"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class book():\n",
+ " def __init__(self, **kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "def display(b):\n",
+ " print \"%s %s %d\\n\" % (b.name,b.author,b.callno)\n",
+ "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n",
+ "display(b1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Let us C YPK 101\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:356"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class emp():\n",
+ " def __init__(self, **kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "e=emp(a=0,ch='\\0',s=0.0)\n",
+ "print \"%u %u %u\\n\" % (id(e.a),id(e.ch),id(e.s))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "20623060 20204312 88374024\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:357-358"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class emp():\n",
+ " def __init__(self,a,ch,s): #Structure without using dictionary\n",
+ " self.a=a\n",
+ " self.ch=ch\n",
+ " self.s=s\n",
+ "e=emp(a=0,ch='\\0',s=0.0)\n",
+ "print \"%u %u %u\\n\" % (id(e.a),id(e.ch),id(e.s))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "20360916 19942168 88177544\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter11.ipynb b/ANSI_C_Programming/chapter11.ipynb
index 4d9a0fc1..f0dba284 100644
--- a/ANSI_C_Programming/chapter11.ipynb
+++ b/ANSI_C_Programming/chapter11.ipynb
@@ -1,533 +1,534 @@
-{
- "metadata": {
- "name": "chapter11.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 11: CONSOLE INPUT/OUTPUT"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:372"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program explaining the interpretation of contents of format string\n",
- "avg=346\n",
- "per=69.2\n",
- "print \"Average=%d\\nPercentage=%f\\n\" % (avg,per)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Average=346\n",
- "Percentage=69.200000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:374"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program explaining field-width of format specifiers\n",
- "weight=63\n",
- "print \"weight is %d kg\\n\" % (weight)\n",
- "print \"weight is %2d kg\\n\" % (weight)\n",
- "print \"weight is %4d kg\\n\" % (weight)\n",
- "print \"weight is %6d kg\\n\" % (weight)\n",
- "print \"weight is %-6d kg\\n\" % (weight)\n",
- "print \"weight is %1d kg\\n\" % (weight)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "weight is 63 kg\n",
- "\n",
- "weight is 63 kg\n",
- "\n",
- "weight is 63 kg\n",
- "\n",
- "weight is 63 kg\n",
- "\n",
- "weight is 63 kg\n",
- "\n",
- "weight is 63 kg\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:374-375"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program without using field-width\n",
- "print \"%f%f%f\\n\" % (5.0,13.5,133.9)\n",
- "print \"%f%f%f\\n\" % (305.0,1200.9,3005.3)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5.00000013.500000133.900000\n",
- "\n",
- "305.0000001200.9000003005.300000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:375"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program using field-width to line-up properly\n",
- "print \"%10.1f%10.1f%10.1f\\n\" % (5.0,13.5,133.9)\n",
- "print \"%10.1f%10.1f%10.1f\\n\" % (305.0,1200.9,3005.3)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " 5.0 13.5 133.9\n",
- "\n",
- " 305.0 1200.9 3005.3\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:375"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Formatting strings with printf()\n",
- "firstname1=\"Sandy\"\n",
- "surname1=\"Malya\"\n",
- "firstname2=\"AjayKumar\"\n",
- "surname2=\"Gurubaxani\"\n",
- "print \"%20s%20s\\n\" % (firstname1,surname1)\n",
- "print \"%20s%20s\\n\" % (firstname2,surname2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Sandy Malya\n",
- "\n",
- " AjayKumar Gurubaxani\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:376"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Use of escape sequences like tab and newlines\n",
- "print \"You\\tmust\\tbe\\tcrazy\\nto\\thate\\tthis\\tbook\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "You\tmust\tbe\tcrazy\n",
- "to\thate\tthis\tbook\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:377-378"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using different format specifiers in print function\n",
- "ch='z'\n",
- "i=125\n",
- "a=12.55\n",
- "s=\"hello there!\"\n",
- "print \"%c %d %f\\n\" % (ch,ord(ch),ord(ch))\n",
- "print \"%s\\n\" % (s) #here conversation not possible\n",
- "print \"%c %d %f\\n\" % (i,i,i)\n",
- "print \"%f %d\\n\" % (a,a)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "z 122 122.000000\n",
- "\n",
- "hello there!\n",
- "\n",
- "} 125 125.000000\n",
- "\n",
- "12.550000 12\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:379"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#assigning elements to an array\n",
- "i=10\n",
- "ch='A'\n",
- "a=3.14\n",
- "print \"%d %c %f\\n\" % (i,ch,a)\n",
- "str=[i,ch,a]\n",
- "print \"%s\\n\" % (str)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "10 A 3.140000\n",
- "\n",
- "[10, 'A', 3.14]\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:380"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#use of input function\n",
- "print \"Press any key to continue\"\n",
- "raw_input() #will echo the character\n",
- "print \"\\nType any character\"\n",
- "ch=raw_input() #will echo the character typed\n",
- "print \"\\nType any character\"\n",
- "raw_input() #will echo character\n",
- "print \"\\nContinue Y/N\"\n",
- "raw_input() #will echo character"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Press any key to continue\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " \n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Type any character\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "B\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Type any character\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "W\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Continue Y/N\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Y\n"
- ]
- },
- {
- "metadata": {},
- "output_type": "pyout",
- "prompt_number": 11,
- "text": [
- "'Y'"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:381"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Use of print function\n",
- "ch='A'\n",
- "print ch,\n",
- "print(ch),\n",
- "print ch,\n",
- "print 'Z',\n",
- "print('Z'),\n",
- "print'Z',"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "A A A Z Z Z\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:381"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program to input a string of characters\n",
- "print \"Enter name\"\n",
- "name=raw_input()\n",
- "print \"%s\\n\" % (name)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Jonty Rhodes\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Jonty Rhodes\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:382"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program to input a string of characters\n",
- "print \"Enter name\"\n",
- "footballer=raw_input() #sends base address of array\n",
- "print \"Happy footballing!\"\n",
- "print footballer"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Jonty Rhodes\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Happy footballing!\n",
- "Jonty Rhodes\n"
- ]
- }
- ],
- "prompt_number": 16
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b6a9263efd333c836685db4fb9578682414d12b2c46fafab1217faab10d2f61b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 11: CONSOLE INPUT/OUTPUT"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:372"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "avg=346\n",
+ "per=69.2\n",
+ "print \"Average=%d\\nPercentage=%f\\n\" % (avg,per)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Average=346\n",
+ "Percentage=69.200000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:374"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "weight=63\n",
+ "print \"weight is %d kg\\n\" % (weight)\n",
+ "print \"weight is %2d kg\\n\" % (weight)\n",
+ "print \"weight is %4d kg\\n\" % (weight)\n",
+ "print \"weight is %6d kg\\n\" % (weight)\n",
+ "print \"weight is %-6d kg\\n\" % (weight)\n",
+ "print \"weight is %1d kg\\n\" % (weight)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "weight is 63 kg\n",
+ "\n",
+ "weight is 63 kg\n",
+ "\n",
+ "weight is 63 kg\n",
+ "\n",
+ "weight is 63 kg\n",
+ "\n",
+ "weight is 63 kg\n",
+ "\n",
+ "weight is 63 kg\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:374-375"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"%f%f%f\\n\" % (5.0,13.5,133.9)\n",
+ "print \"%f%f%f\\n\" % (305.0,1200.9,3005.3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5.00000013.500000133.900000\n",
+ "\n",
+ "305.0000001200.9000003005.300000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:375"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"%10.1f%10.1f%10.1f\\n\" % (5.0,13.5,133.9)\n",
+ "print \"%10.1f%10.1f%10.1f\\n\" % (305.0,1200.9,3005.3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " 5.0 13.5 133.9\n",
+ "\n",
+ " 305.0 1200.9 3005.3\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:375"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "firstname1=\"Sandy\"\n",
+ "surname1=\"Malya\"\n",
+ "firstname2=\"AjayKumar\"\n",
+ "surname2=\"Gurubaxani\"\n",
+ "print \"%20s%20s\\n\" % (firstname1,surname1)\n",
+ "print \"%20s%20s\\n\" % (firstname2,surname2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Sandy Malya\n",
+ "\n",
+ " AjayKumar Gurubaxani\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:376"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"You\\tmust\\tbe\\tcrazy\\nto\\thate\\tthis\\tbook\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "You\tmust\tbe\tcrazy\n",
+ "to\thate\tthis\tbook\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:377-378"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "ch='z'\n",
+ "i=125\n",
+ "a=12.55\n",
+ "s=\"hello there!\"\n",
+ "print \"%c %d %f\\n\" % (ch,ord(ch),ord(ch))\n",
+ "print \"%s\\n\" % (s) #here conversation not possible\n",
+ "print \"%c %d %f\\n\" % (i,i,i)\n",
+ "print \"%f %d\\n\" % (a,a)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "z 122 122.000000\n",
+ "\n",
+ "hello there!\n",
+ "\n",
+ "} 125 125.000000\n",
+ "\n",
+ "12.550000 12\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:379"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=10\n",
+ "ch='A'\n",
+ "a=3.14\n",
+ "print \"%d %c %f\\n\" % (i,ch,a)\n",
+ "str=[i,ch,a]\n",
+ "print \"%s\\n\" % (str)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "10 A 3.140000\n",
+ "\n",
+ "[10, 'A', 3.14]\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:380"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Press any key to continue\"\n",
+ "raw_input() #will echo the character\n",
+ "print \"\\nType any character\"\n",
+ "ch=raw_input() #will echo the character typed\n",
+ "print \"\\nType any character\"\n",
+ "raw_input() #will echo character\n",
+ "print \"\\nContinue Y/N\"\n",
+ "raw_input() #will echo character"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Press any key to continue\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " \n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Type any character\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "B\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Type any character\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "W\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Continue Y/N\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Y\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 11,
+ "text": [
+ "'Y'"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:381"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "ch='A'\n",
+ "print ch,\n",
+ "print(ch),\n",
+ "print ch,\n",
+ "print 'Z',\n",
+ "print('Z'),\n",
+ "print'Z',"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A A A Z Z Z\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:381"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter name\"\n",
+ "name=raw_input()\n",
+ "print \"%s\\n\" % (name)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Jonty Rhodes\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Jonty Rhodes\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:382"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter name\"\n",
+ "footballer=raw_input() #sends base address of array\n",
+ "print \"Happy footballing!\"\n",
+ "print footballer"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Jonty Rhodes\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Happy footballing!\n",
+ "Jonty Rhodes\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter12.ipynb b/ANSI_C_Programming/chapter12.ipynb
index 1c8b157f..8bab1a13 100644
--- a/ANSI_C_Programming/chapter12.ipynb
+++ b/ANSI_C_Programming/chapter12.ipynb
@@ -1,1455 +1,1456 @@
-{
- "metadata": {
- "name": "chapter12.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 12:FILE INPUT/OUTPUT"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:391"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Reads strings from the file and displays them on screen\n",
- "fp=open('PR1.txt','r') #open the file for reading\n",
- "ch=fp.readlines() #ch will store all content of file\n",
- "print \"%s\" % (' '.join(ch)) #prints content of file\n",
- "print \"\\n\"\n",
- "fp.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "site:http://www.bzu.edu.pk/\n",
- " user:siteuser@localhost\n",
- " version:5.5.32-0ubuntu0.12.04.1\n",
- " db: bzu\n",
- " tables:\n",
- " username:web,webadmin,webadministrator23\n",
- " pass:71dc9f7af599450b23a3b5d54bc665c7,\t49fa1a081c8d5c8dcfa05d730803251a,\t*E8665C4049F515D836A3C8704D0543C6DA0FE96D\n",
- "\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:394"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Showing error in opening a file\n",
- "try:\n",
- " fp=open('yoyo.txt','r')\n",
- " for line in fin:\n",
- " print line\n",
- " fp.close()\n",
- "except:\n",
- " print 'cannot open file'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "cannot open file\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:395"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Count chars, spaces, tabs and newlines in a file\n",
- "nol=0\n",
- "nom=0\n",
- "nob=0\n",
- "noc=0\n",
- "fp=open('H4CK3R.txt','r')\n",
- "while True:\n",
- " ch=fp.read(1)\n",
- " if not ch:\n",
- " break\n",
- " noc+=1\n",
- " if ch==' ':\n",
- " nob+=1\n",
- " if ch=='\\n':\n",
- " nol+=1\n",
- " if ch=='\\t':\n",
- " nom+=1\n",
- "fp.close()\n",
- "print \"\\n\"\n",
- "fp.close()\n",
- "print \"Number of characters=%d\\n\" % (noc)\n",
- "print \"Number of blanks=%d\\n\" % (nob)\n",
- "print \"Number of tabs=%d\\n\" % (nom)\n",
- "print \"Number of lines=%d\\n\" % (nol)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "\n",
- "Number of characters=162\n",
- "\n",
- "Number of blanks=21\n",
- "\n",
- "Number of tabs=3\n",
- "\n",
- "Number of lines=4\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:396-397"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Program that copies the content of one file into another\n",
- "import sys\n",
- "try:\n",
- " fs=open('H4CK3R.txt','r')\n",
- "except:\n",
- " print \"Cannot open file\"\n",
- " sys.exit(1)\n",
- "try:\n",
- " ft=open('python.txt','w')\n",
- "except:\n",
- " print \"Cannot open file\"\n",
- " fs.close()\n",
- " sys.exit(2)\n",
- "ch=fs.readlines()\n",
- "ft.writelines(ch)\n",
- "fs.close()\n",
- "ft.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:399"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Receives strings from keyboard and writes them to file\n",
- "try:\n",
- " fp=open('POEM.txt','w')\n",
- "except:\n",
- " print 'cannot open file'\n",
- "print \"\\nEnter a few lines of text:\\n\"\n",
- "s=' '\n",
- "while (len(s)>0):\n",
- " s=raw_input()\n",
- " fp.writelines(s)\n",
- " fp.writelines(\"\\n\")\n",
- "fp.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter a few lines of text:\n",
- "\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Shining and bright,they are forever,\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "so true about diamonds,\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "more so of memories,\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "especially yours!\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:400"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Reads strings from the file and displays them on screen\n",
- "try:\n",
- " fp=open('POEM.txt','r')\n",
- "except:\n",
- " print 'cannot open file'\n",
- "s=fp.read(99)\n",
- "print \"%s\" % (s)\n",
- "print \"\\n\"\n",
- "fp.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Shining and bright,they are forever,\n",
- "so true about diamonds,\n",
- "more so of memories,\n",
- "especially yours!\n",
- "\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:401-402"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Writes records to a file using structure\n",
- "class emp():\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "another='Y'\n",
- "e=emp()\n",
- "try:\n",
- " fp=open('EMPLOYEE.txt','w')\n",
- "except:\n",
- " print 'cannot open file'\n",
- "while another=='Y':\n",
- " print \"\\nEnter name,age and basic salary:\"\n",
- " e.name=raw_input()\n",
- " e.age=eval(raw_input())\n",
- " e.bs=eval(raw_input())\n",
- " ch=\"%s %d %f\" % (e.name,e.age,e.bs)\n",
- " fp.writelines(ch)\n",
- " fp.writelines(\"\\n\")\n",
- " print \"Add another record(Y/N)\"\n",
- " another=raw_input()\n",
- "fp.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name,age and basic salary:\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Sunil\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "34\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1250.50\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Add another record(Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Y\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name,age and basic salary:\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Sameer\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "21\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1300.50\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Add another record(Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Y\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name,age and basic salary:\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Rahul\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "34\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1400.55\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Add another record(Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "n\n"
- ]
- }
- ],
- "prompt_number": 17
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:403-404"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Read records from a file using structure\n",
- "class emp():\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "e=emp()\n",
- "try:\n",
- " fp=open('EMPLOYEE.txt','r') # open the file for reading\n",
- "except:\n",
- " print 'cannot open file'\n",
- "for line in fp: # iterate over each line\n",
- " e.name, e.age, e.bs = line.split() # split it by whitespace\n",
- " e.age = int(e.age) # convert age from string to int\n",
- " e.bs = float(e.bs) # convert bs from string to float\n",
- " print \"%s %d %f\\n\" %(e.name, e.age, e.bs)\n",
- "fp.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Sunil 34 1250.500000\n",
- "\n",
- "Sameer 21 1300.500000\n",
- "\n",
- "Rahul 34 1400.550000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 18
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:404-405"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program to copy text as well as binary files\n",
- "import sys #for exit()\n",
- "try:\n",
- " fs=open('H4CK3R.txt','rb') # open the file for reading\n",
- "except:\n",
- " print 'cannot open file'\n",
- " sys.exit(1)\n",
- "try:\n",
- " ft=open('python.txt','wb') # open the file for writing\n",
- "except:\n",
- " print 'cannot open file'\n",
- " fs.close()\n",
- " sys.exit(2)\n",
- "ch=fs.readlines()\n",
- "ft.writelines(ch)\n",
- "fs.close()\n",
- "ft.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [],
- "prompt_number": 20
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:407-408"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Receives records from keyboard and writes them to a file in binary mode\n",
- "class emp():\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "another='Y'\n",
- "e=emp()\n",
- "try:\n",
- " fp=open('EMP.txt','wb') # open the file for reading\n",
- "except:\n",
- " print 'cannot open file' \n",
- "while another=='Y':\n",
- " print \"\\nEnter name,age and basic salary:\"\n",
- " e.name=raw_input()\n",
- " e.age=eval(raw_input())\n",
- " e.bs=eval(raw_input())\n",
- " ch=\"%s %d %f\" % (e.name,e.age,e.bs)\n",
- " fp.writelines(ch)\n",
- " print \"Add another record (Y/N)\"\n",
- " another=raw_input()\n",
- " if another=='Y':\n",
- " fp.writelines(\"\\n\")\n",
- "fp.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name,age and basic salary:\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Suresh\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "24\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1250.50\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Add another record (Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Y\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name,age and basic salary:\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Ranjan\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "21\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1300.60\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Add another record (Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Y\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name,age and basic salary:\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Harish\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "28\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1400.70\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Add another record (Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "N\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:409"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Read records from binary file and displays them on VDU\n",
- "class emp():\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "e=emp()\n",
- "try:\n",
- " fp=open('EMP.txt','rb')\n",
- "except:\n",
- " print \"Cannot open file\"\n",
- "for line in fp:\n",
- " e.name, e.age, e.bs = line.split() # split it by whitespace\n",
- " e.age = int(e.age) # convert age from string to int\n",
- " e.bs = float(e.bs) # convert bs from string to float\n",
- " print \"%s %d %f\\n\" %(e.name, e.age, e.bs)\n",
- "fp.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Suresh 24 1250.500000\n",
- "\n",
- "Ranjan 21 1300.600000\n",
- "\n",
- "Harish 28 1400.700000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 22
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:411-414"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#A menu-driven program for elementary database management\n",
- "class emp():\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "e=emp()\n",
- "try:\n",
- " fp=open('EMP.txt','rb+') # open the file for reading\n",
- "except:\n",
- " try:\n",
- " fp=open('EMP.txt','wb+') # open the file for writing\n",
- " except:\n",
- " print 'cannot open file'\n",
- "while 1:\n",
- " print \"1.Add Records\"\n",
- " print \"2.List Records\"\n",
- " print \"3.Modify Records\"\n",
- " print \"4.Delete Records\"\n",
- " print \"0.Exit\"\n",
- " print \"Your choice\"\n",
- " choice=eval(raw_input())\n",
- " def add():\n",
- " import os\n",
- " fp.seek(0,os.SEEK_END)\n",
- " another='Y'\n",
- " while another=='Y':\n",
- " print \"\\nEnter name,age and basic salary:\"\n",
- " e.name=raw_input()\n",
- " e.age=eval(raw_input())\n",
- " e.bs=eval(raw_input())\n",
- " ch=\"%s %d %f\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" % (e.name,e.age,e.bs)\n",
- " fp.writelines(\"\\n\")\n",
- " fp.writelines(ch)\n",
- " print \"Add another record(Y/N)\"\n",
- " another=raw_input()\n",
- " def list():\n",
- " import os\n",
- " fp.seek(0,os.SEEK_SET)\n",
- " for line in fp: # iterate over each line\n",
- " if len(line)>10:\n",
- " e.name, e.age, e.bs = line.split() # split it by whitespace\n",
- " e.age = int(e.age) # convert age from string to int\n",
- " e.bs = float(e.bs) # convert bs from string to float\n",
- " print \"%s %d %f\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" %(e.name, e.age, e.bs)\n",
- " def modify():\n",
- " another='Y'\n",
- " while another=='Y':\n",
- " print \"\\nEnter name of employee to modify\"\n",
- " empname=raw_input()\n",
- " import os\n",
- " fp.seek(0,os.SEEK_SET)\n",
- " for line in iter(fp.readline, ''):\n",
- " if len(line)>10:\n",
- " e.name, e.age, e.bs=line.split()\n",
- " e.age = int(e.age) # convert age from string to int\n",
- " e.bs = float(e.bs)\n",
- " if(cmp(e.name,empname)==0):\n",
- " c=len(line)\n",
- " print \"\\nEnter new name,age & bs\"\n",
- " e.name=raw_input()\n",
- " e.age=eval(raw_input())\n",
- " e.bs=eval(raw_input())\n",
- " import os\n",
- " fp.seek(-c,os.SEEK_CUR)\n",
- " ch=\"%s %d %f\" % (e.name,e.age,e.bs)\n",
- " fp.writelines(\"\\n\")\n",
- " fp.writelines(ch)\n",
- " fp.writelines(\"\\n\")\n",
- " break\n",
- " print \"\\nModify another Record(Y/N)\"\n",
- " another=raw_input()\n",
- " def delete():\n",
- " another='Y'\n",
- " global fp\n",
- " while another=='Y':\n",
- " print \"\\nEnter name of employee to delete\"\n",
- " empname=raw_input()\n",
- " ft=open('TEMP.txt','wb')\n",
- " import os\n",
- " fp.seek(0,os.SEEK_SET)\n",
- " for line in fp:\n",
- " if len(line)>10:\n",
- " e.name, e.age, e.bs=line.split()\n",
- " e.age = int(e.age) # convert age from string to int\n",
- " e.bs = float(e.bs)\n",
- " if(cmp(e.name,empname)!=0):\n",
- " ch=\"%s %d %f\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" % (e.name,e.age,e.bs)\n",
- " ft.writelines(ch)\n",
- " ft.writelines(\"\\n\")\n",
- " fp.close()\n",
- " ft.close()\n",
- " import os\n",
- " os.remove(\"EMP.txt\") # Delete file EMP.txt\n",
- " os.rename( \"TEMP.txt\", \"D:/EMP.txt\" ) # Rename a file from TEMP.txt to EMP.txt\n",
- " fp=open('EMP.txt','rb+')\n",
- " print \"Delete another record(Y/N)\"\n",
- " another=raw_input()\n",
- " def exit():\n",
- " import sys\n",
- " fp.close()\n",
- " sys.exit(0)\n",
- " def switch(c):\n",
- " return {1: add,\n",
- " 2: list,\n",
- " 3: modify,\n",
- " 4: delete,\n",
- " 0: exit,\n",
- " }[c]()\n",
- " switch(choice)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
- "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
- "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name,age and basic salary:\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Ram\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "20\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5000\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Add another record(Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Y\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name,age and basic salary:\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "GOPAL\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "19\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "6755.5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Add another record(Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "N\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
- "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
- "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
- "Ram 20 5000.000000\t\t\t\t\t\t\t\t\t\t\n",
- "GOPAL 19 6755.500000\t\t\t\t\t\t\t\t\t\t\n",
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name of employee to modify\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Ram\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter new name,age & bs\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Radhey\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "15\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "4687.66\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Modify another Record(Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "N\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
- "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
- "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
- "Radhey 15 4687.660000\t\t\t\t\t\t\t\t\t\t\n",
- "GOPAL 19 6755.500000\t\t\t\t\t\t\t\t\t\t\n",
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "4\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name of employee to delete\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Radhey\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Delete another record(Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "N\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
- "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
- "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
- "GOPAL 19 6755.500000\t\t\t\t\t\t\t\t\t\t\n",
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "4\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter name of employee to delete\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "GOPAL\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Delete another record(Y/N)\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "N\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
- "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
- "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
- "1.Add Records\n",
- "2.List Records\n",
- "3.Modify Records\n",
- "4.Delete Records\n",
- "0.Exit\n",
- "Your choice\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "0\n"
- ]
- },
- {
- "ename": "SystemExit",
- "evalue": "0",
- "output_type": "pyerr",
- "traceback": [
- "An exception has occurred, use %tb to see the full traceback.\n",
- "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 0\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stderr",
- "text": [
- "To exit: use 'exit', 'quit', or Ctrl-D.\n"
- ]
- }
- ],
- "prompt_number": 23
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:416-417"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#File-copy program which copies text,.com and .exe files\n",
- "from StringIO import StringIO\n",
- "buffer = StringIO()\n",
- "print \"\\nEnter source file name\"\n",
- "source=raw_input()\n",
- "try:\n",
- " inhandle=open(source,'rb')\n",
- "except:\n",
- " print \"Cannot open file\"\n",
- "print \"Enter target file name\"\n",
- "target=raw_input()\n",
- "try:\n",
- " outhandle=open(target,'wb')\n",
- "except:\n",
- " print \"Cannot open file\"\n",
- " inhandle.close()\n",
- "bytes=inhandle.readlines()\n",
- "buffer.write(bytes)\n",
- "outhandle.writelines(buffer.getvalue())\n",
- "buffer.close()\n",
- "inhandle.close()\n",
- "outhandle.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Enter source file name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "H4CK3R.txt\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter target file name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "python.txt\n"
- ]
- }
- ],
- "prompt_number": 24
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:a886cf212382fa732d2b3df088bbcba9a65ba4a31cbe899c80e912ac04c2747f"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 12:FILE INPUT/OUTPUT"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:391"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "fp=open('PR1.txt','r') #open the file for reading\n",
+ "ch=fp.readlines() #ch will store all content of file\n",
+ "print \"%s\" % (' '.join(ch)) #prints content of file\n",
+ "print \"\\n\"\n",
+ "fp.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "site:http://www.bzu.edu.pk/\n",
+ " user:siteuser@localhost\n",
+ " version:5.5.32-0ubuntu0.12.04.1\n",
+ " db: bzu\n",
+ " tables:\n",
+ " username:web,webadmin,webadministrator23\n",
+ " pass:71dc9f7af599450b23a3b5d54bc665c7,\t49fa1a081c8d5c8dcfa05d730803251a,\t*E8665C4049F515D836A3C8704D0543C6DA0FE96D\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:394"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "try:\n",
+ " fp=open('yoyo.txt','r')\n",
+ " for line in fin:\n",
+ " print line\n",
+ " fp.close()\n",
+ "except:\n",
+ " print 'cannot open file'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "cannot open file\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:395"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "nol=0\n",
+ "nom=0\n",
+ "nob=0\n",
+ "noc=0\n",
+ "fp=open('H4CK3R.txt','r')\n",
+ "while True:\n",
+ " ch=fp.read(1)\n",
+ " if not ch:\n",
+ " break\n",
+ " noc+=1\n",
+ " if ch==' ':\n",
+ " nob+=1\n",
+ " if ch=='\\n':\n",
+ " nol+=1\n",
+ " if ch=='\\t':\n",
+ " nom+=1\n",
+ "fp.close()\n",
+ "print \"\\n\"\n",
+ "fp.close()\n",
+ "print \"Number of characters=%d\\n\" % (noc)\n",
+ "print \"Number of blanks=%d\\n\" % (nob)\n",
+ "print \"Number of tabs=%d\\n\" % (nom)\n",
+ "print \"Number of lines=%d\\n\" % (nol)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ "Number of characters=162\n",
+ "\n",
+ "Number of blanks=21\n",
+ "\n",
+ "Number of tabs=3\n",
+ "\n",
+ "Number of lines=4\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:396-397"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import sys\n",
+ "try:\n",
+ " fs=open('H4CK3R.txt','r')\n",
+ "except:\n",
+ " print \"Cannot open file\"\n",
+ " sys.exit(1)\n",
+ "try:\n",
+ " ft=open('python.txt','w')\n",
+ "except:\n",
+ " print \"Cannot open file\"\n",
+ " fs.close()\n",
+ " sys.exit(2)\n",
+ "ch=fs.readlines()\n",
+ "ft.writelines(ch)\n",
+ "fs.close()\n",
+ "ft.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:399"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "try:\n",
+ " fp=open('POEM.txt','w')\n",
+ "except:\n",
+ " print 'cannot open file'\n",
+ "print \"\\nEnter a few lines of text:\\n\"\n",
+ "s=' '\n",
+ "while (len(s)>0):\n",
+ " s=raw_input()\n",
+ " fp.writelines(s)\n",
+ " fp.writelines(\"\\n\")\n",
+ "fp.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter a few lines of text:\n",
+ "\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Shining and bright,they are forever,\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "so true about diamonds,\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "more so of memories,\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "especially yours!\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:400"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "try:\n",
+ " fp=open('POEM.txt','r')\n",
+ "except:\n",
+ " print 'cannot open file'\n",
+ "s=fp.read(99)\n",
+ "print \"%s\" % (s)\n",
+ "print \"\\n\"\n",
+ "fp.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Shining and bright,they are forever,\n",
+ "so true about diamonds,\n",
+ "more so of memories,\n",
+ "especially yours!\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:401-402"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class emp():\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "another='Y'\n",
+ "e=emp()\n",
+ "try:\n",
+ " fp=open('EMPLOYEE.txt','w')\n",
+ "except:\n",
+ " print 'cannot open file'\n",
+ "while another=='Y':\n",
+ " print \"\\nEnter name,age and basic salary:\"\n",
+ " e.name=raw_input()\n",
+ " e.age=eval(raw_input())\n",
+ " e.bs=eval(raw_input())\n",
+ " ch=\"%s %d %f\" % (e.name,e.age,e.bs)\n",
+ " fp.writelines(ch)\n",
+ " fp.writelines(\"\\n\")\n",
+ " print \"Add another record(Y/N)\"\n",
+ " another=raw_input()\n",
+ "fp.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name,age and basic salary:\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Sunil\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "34\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1250.50\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Add another record(Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Y\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name,age and basic salary:\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Sameer\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "21\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1300.50\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Add another record(Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Y\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name,age and basic salary:\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rahul\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "34\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1400.55\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Add another record(Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "n\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:403-404"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class emp():\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "e=emp()\n",
+ "try:\n",
+ " fp=open('EMPLOYEE.txt','r') # open the file for reading\n",
+ "except:\n",
+ " print 'cannot open file'\n",
+ "for line in fp: # iterate over each line\n",
+ " e.name, e.age, e.bs = line.split() # split it by whitespace\n",
+ " e.age = int(e.age) # convert age from string to int\n",
+ " e.bs = float(e.bs) # convert bs from string to float\n",
+ " print \"%s %d %f\\n\" %(e.name, e.age, e.bs)\n",
+ "fp.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Sunil 34 1250.500000\n",
+ "\n",
+ "Sameer 21 1300.500000\n",
+ "\n",
+ "Rahul 34 1400.550000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:404-405"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import sys #for exit()\n",
+ "try:\n",
+ " fs=open('H4CK3R.txt','rb') # open the file for reading\n",
+ "except:\n",
+ " print 'cannot open file'\n",
+ " sys.exit(1)\n",
+ "try:\n",
+ " ft=open('python.txt','wb') # open the file for writing\n",
+ "except:\n",
+ " print 'cannot open file'\n",
+ " fs.close()\n",
+ " sys.exit(2)\n",
+ "ch=fs.readlines()\n",
+ "ft.writelines(ch)\n",
+ "fs.close()\n",
+ "ft.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:407-408"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class emp():\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "another='Y'\n",
+ "e=emp()\n",
+ "try:\n",
+ " fp=open('EMP.txt','wb') # open the file for reading\n",
+ "except:\n",
+ " print 'cannot open file' \n",
+ "while another=='Y':\n",
+ " print \"\\nEnter name,age and basic salary:\"\n",
+ " e.name=raw_input()\n",
+ " e.age=eval(raw_input())\n",
+ " e.bs=eval(raw_input())\n",
+ " ch=\"%s %d %f\" % (e.name,e.age,e.bs)\n",
+ " fp.writelines(ch)\n",
+ " print \"Add another record (Y/N)\"\n",
+ " another=raw_input()\n",
+ " if another=='Y':\n",
+ " fp.writelines(\"\\n\")\n",
+ "fp.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name,age and basic salary:\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Suresh\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "24\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1250.50\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Add another record (Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Y\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name,age and basic salary:\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ranjan\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "21\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1300.60\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Add another record (Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Y\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name,age and basic salary:\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Harish\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "28\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1400.70\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Add another record (Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "N\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:409"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class emp():\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "e=emp()\n",
+ "try:\n",
+ " fp=open('EMP.txt','rb')\n",
+ "except:\n",
+ " print \"Cannot open file\"\n",
+ "for line in fp:\n",
+ " e.name, e.age, e.bs = line.split() # split it by whitespace\n",
+ " e.age = int(e.age) # convert age from string to int\n",
+ " e.bs = float(e.bs) # convert bs from string to float\n",
+ " print \"%s %d %f\\n\" %(e.name, e.age, e.bs)\n",
+ "fp.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Suresh 24 1250.500000\n",
+ "\n",
+ "Ranjan 21 1300.600000\n",
+ "\n",
+ "Harish 28 1400.700000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:411-414"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "class emp():\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "e=emp()\n",
+ "try:\n",
+ " fp=open('EMP.txt','rb+') # open the file for reading\n",
+ "except:\n",
+ " try:\n",
+ " fp=open('EMP.txt','wb+') # open the file for writing\n",
+ " except:\n",
+ " print 'cannot open file'\n",
+ "while 1:\n",
+ " print \"1.Add Records\"\n",
+ " print \"2.List Records\"\n",
+ " print \"3.Modify Records\"\n",
+ " print \"4.Delete Records\"\n",
+ " print \"0.Exit\"\n",
+ " print \"Your choice\"\n",
+ " choice=eval(raw_input())\n",
+ " def add():\n",
+ " import os\n",
+ " fp.seek(0,os.SEEK_END)\n",
+ " another='Y'\n",
+ " while another=='Y':\n",
+ " print \"\\nEnter name,age and basic salary:\"\n",
+ " e.name=raw_input()\n",
+ " e.age=eval(raw_input())\n",
+ " e.bs=eval(raw_input())\n",
+ " ch=\"%s %d %f\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" % (e.name,e.age,e.bs)\n",
+ " fp.writelines(\"\\n\")\n",
+ " fp.writelines(ch)\n",
+ " print \"Add another record(Y/N)\"\n",
+ " another=raw_input()\n",
+ " def list():\n",
+ " import os\n",
+ " fp.seek(0,os.SEEK_SET)\n",
+ " for line in fp: # iterate over each line\n",
+ " if len(line)>10:\n",
+ " e.name, e.age, e.bs = line.split() # split it by whitespace\n",
+ " e.age = int(e.age) # convert age from string to int\n",
+ " e.bs = float(e.bs) # convert bs from string to float\n",
+ " print \"%s %d %f\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" %(e.name, e.age, e.bs)\n",
+ " def modify():\n",
+ " another='Y'\n",
+ " while another=='Y':\n",
+ " print \"\\nEnter name of employee to modify\"\n",
+ " empname=raw_input()\n",
+ " import os\n",
+ " fp.seek(0,os.SEEK_SET)\n",
+ " for line in iter(fp.readline, ''):\n",
+ " if len(line)>10:\n",
+ " e.name, e.age, e.bs=line.split()\n",
+ " e.age = int(e.age) # convert age from string to int\n",
+ " e.bs = float(e.bs)\n",
+ " if(cmp(e.name,empname)==0):\n",
+ " c=len(line)\n",
+ " print \"\\nEnter new name,age & bs\"\n",
+ " e.name=raw_input()\n",
+ " e.age=eval(raw_input())\n",
+ " e.bs=eval(raw_input())\n",
+ " import os\n",
+ " fp.seek(-c,os.SEEK_CUR)\n",
+ " ch=\"%s %d %f\" % (e.name,e.age,e.bs)\n",
+ " fp.writelines(\"\\n\")\n",
+ " fp.writelines(ch)\n",
+ " fp.writelines(\"\\n\")\n",
+ " break\n",
+ " print \"\\nModify another Record(Y/N)\"\n",
+ " another=raw_input()\n",
+ " def delete():\n",
+ " another='Y'\n",
+ " global fp\n",
+ " while another=='Y':\n",
+ " print \"\\nEnter name of employee to delete\"\n",
+ " empname=raw_input()\n",
+ " ft=open('TEMP.txt','wb')\n",
+ " import os\n",
+ " fp.seek(0,os.SEEK_SET)\n",
+ " for line in fp:\n",
+ " if len(line)>10:\n",
+ " e.name, e.age, e.bs=line.split()\n",
+ " e.age = int(e.age) # convert age from string to int\n",
+ " e.bs = float(e.bs)\n",
+ " if(cmp(e.name,empname)!=0):\n",
+ " ch=\"%s %d %f\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" % (e.name,e.age,e.bs)\n",
+ " ft.writelines(ch)\n",
+ " ft.writelines(\"\\n\")\n",
+ " fp.close()\n",
+ " ft.close()\n",
+ " import os\n",
+ " os.remove(\"EMP.txt\") # Delete file EMP.txt\n",
+ " os.rename( \"TEMP.txt\", \"D:/EMP.txt\" ) # Rename a file from TEMP.txt to EMP.txt\n",
+ " fp=open('EMP.txt','rb+')\n",
+ " print \"Delete another record(Y/N)\"\n",
+ " another=raw_input()\n",
+ " def exit():\n",
+ " import sys\n",
+ " fp.close()\n",
+ " sys.exit(0)\n",
+ " def switch(c):\n",
+ " return {1: add,\n",
+ " 2: list,\n",
+ " 3: modify,\n",
+ " 4: delete,\n",
+ " 0: exit,\n",
+ " }[c]()\n",
+ " switch(choice)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
+ "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
+ "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name,age and basic salary:\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ram\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "20\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5000\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Add another record(Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Y\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name,age and basic salary:\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "GOPAL\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "19\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "6755.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Add another record(Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "N\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
+ "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
+ "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
+ "Ram 20 5000.000000\t\t\t\t\t\t\t\t\t\t\n",
+ "GOPAL 19 6755.500000\t\t\t\t\t\t\t\t\t\t\n",
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name of employee to modify\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ram\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter new name,age & bs\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Radhey\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "15\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "4687.66\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Modify another Record(Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "N\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
+ "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
+ "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
+ "Radhey 15 4687.660000\t\t\t\t\t\t\t\t\t\t\n",
+ "GOPAL 19 6755.500000\t\t\t\t\t\t\t\t\t\t\n",
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "4\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name of employee to delete\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Radhey\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Delete another record(Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "N\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
+ "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
+ "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
+ "GOPAL 19 6755.500000\t\t\t\t\t\t\t\t\t\t\n",
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "4\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter name of employee to delete\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "GOPAL\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Delete another record(Y/N)\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "N\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n",
+ "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n",
+ "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n",
+ "1.Add Records\n",
+ "2.List Records\n",
+ "3.Modify Records\n",
+ "4.Delete Records\n",
+ "0.Exit\n",
+ "Your choice\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0\n"
+ ]
+ },
+ {
+ "ename": "SystemExit",
+ "evalue": "0",
+ "output_type": "pyerr",
+ "traceback": [
+ "An exception has occurred, use %tb to see the full traceback.\n",
+ "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 0\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stderr",
+ "text": [
+ "To exit: use 'exit', 'quit', or Ctrl-D.\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:416-417"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "from StringIO import StringIO\n",
+ "buffer = StringIO()\n",
+ "print \"\\nEnter source file name\"\n",
+ "source=raw_input()\n",
+ "try:\n",
+ " inhandle=open(source,'rb')\n",
+ "except:\n",
+ " print \"Cannot open file\"\n",
+ "print \"Enter target file name\"\n",
+ "target=raw_input()\n",
+ "try:\n",
+ " outhandle=open(target,'wb')\n",
+ "except:\n",
+ " print \"Cannot open file\"\n",
+ " inhandle.close()\n",
+ "bytes=inhandle.readlines()\n",
+ "buffer.write(bytes)\n",
+ "outhandle.writelines(buffer.getvalue())\n",
+ "buffer.close()\n",
+ "inhandle.close()\n",
+ "outhandle.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Enter source file name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "H4CK3R.txt\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter target file name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "python.txt\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter13.ipynb b/ANSI_C_Programming/chapter13.ipynb
index a481e2c4..b37b75e4 100644
--- a/ANSI_C_Programming/chapter13.ipynb
+++ b/ANSI_C_Programming/chapter13.ipynb
@@ -1,712 +1,711 @@
-{
- "metadata": {
- "name": "chapter13.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 13: MORE ISSUES IN INPUT/OUTPUT"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:434-435"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using argc & argv to copy one file into another\n",
- "import sys\n",
- "if(len(sys.argv)!=3):\n",
- " print \"Improper number of arguments\\n\"\n",
- " sys.exit(0)\n",
- "try:\n",
- " fs=open(sys.argv[1], \"r\")\n",
- "except:\n",
- " sys.exit(\"Cannot open source file\\n\")\n",
- "try:\n",
- " ft=open(sys.argv[2], \"w\")\n",
- "except:\n",
- " fs.close()\n",
- " sys.exit(\"Cannot open source file\\n\")\n",
- "ch=fs.readlines()\n",
- "ft.writelines(ch)\n",
- "fs.close()\n",
- "ft.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:437-438"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Detecting errors in reading/writing\n",
- "try:\n",
- " fp=open('python.txt','w')\n",
- " while True:\n",
- " ch=fp.read(1)\n",
- " if not ch:\n",
- " break;\n",
- " print \"%c\" % (ch)\n",
- "except:\n",
- " print \"Error in reading file\\n\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Error in reading file\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:439"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Prints file contents on printer\n",
- "#there is no standard way to print using Python on all platforms\n",
- "#It will work on windows platform\n",
- "import tempfile\n",
- "import win32api\n",
- "import win32print\n",
- "import sys\n",
- "\n",
- "try:\n",
- " fp=open('poem.txt','r') #No need to open it\n",
- "except:\n",
- " sys.exit(\"Cannot open file\\n\")\n",
- "win32api.ShellExecute (\n",
- " 0,\n",
- " \"print\",\n",
- " \"poem.txt\",\n",
- " '/d:\"%s\"' % win32print.GetDefaultPrinter (),\n",
- " \".\",\n",
- " 0\n",
- ")\n",
- "fp.close()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "metadata": {},
- "output_type": "pyout",
- "prompt_number": 3,
- "text": [
- "42"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:440-441"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#redirecting the output from the screen to a file\n",
- "import sys\n",
- "ch = sys.stdin.read(1)\n",
- "while (len(ch)>0):\n",
- " sys.stdout.write(ch)\n",
- " ch = sys.stdin.read(1)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:442"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program for generating the ASCII table on screen\n",
- "for ch in range(0,256,1):\n",
- " print \"%d %c\\n\" % (ch,ch)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "0 \u0000\n",
- "\n",
- "1 \u0001\n",
- "\n",
- "2 \u0002\n",
- "\n",
- "3 \u0003\n",
- "\n",
- "4 \u0004\n",
- "\n",
- "5 \u0005\n",
- "\n",
- "6 \u0006\n",
- "\n",
- "7 \u0007\n",
- "\n",
- "8 \b\n",
- "\n",
- "9 \t\n",
- "\n",
- "10 \n",
- "\n",
- "\n",
- "11 \u000b",
- "\n",
- "\n",
- "12 \f",
- "\n",
- "\n",
- "13 \r\n",
- "\n",
- "14 \u000e\n",
- "\n",
- "15 \u000f\n",
- "\n",
- "16 \u0010\n",
- "\n",
- "17 \u0011\n",
- "\n",
- "18 \u0012\n",
- "\n",
- "19 \u0013\n",
- "\n",
- "20 \u0014\n",
- "\n",
- "21 \u0015\n",
- "\n",
- "22 \u0016\n",
- "\n",
- "23 \u0017\n",
- "\n",
- "24 \u0018\n",
- "\n",
- "25 \u0019\n",
- "\n",
- "26 \u001a\n",
- "\n",
- "27 \u001b\n",
- "\n",
- "28 \u001c",
- "\n",
- "\n",
- "29 \u001d",
- "\n",
- "\n",
- "30 \u001e",
- "\n",
- "\n",
- "31 \u001f\n",
- "\n",
- "32 \n",
- "\n",
- "33 !\n",
- "\n",
- "34 \"\n",
- "\n",
- "35 #\n",
- "\n",
- "36 $\n",
- "\n",
- "37 %\n",
- "\n",
- "38 &\n",
- "\n",
- "39 '\n",
- "\n",
- "40 (\n",
- "\n",
- "41 )\n",
- "\n",
- "42 *\n",
- "\n",
- "43 +\n",
- "\n",
- "44 ,\n",
- "\n",
- "45 -\n",
- "\n",
- "46 .\n",
- "\n",
- "47 /\n",
- "\n",
- "48 0\n",
- "\n",
- "49 1\n",
- "\n",
- "50 2\n",
- "\n",
- "51 3\n",
- "\n",
- "52 4\n",
- "\n",
- "53 5\n",
- "\n",
- "54 6\n",
- "\n",
- "55 7\n",
- "\n",
- "56 8\n",
- "\n",
- "57 9\n",
- "\n",
- "58 :\n",
- "\n",
- "59 ;\n",
- "\n",
- "60 <\n",
- "\n",
- "61 =\n",
- "\n",
- "62 >\n",
- "\n",
- "63 ?\n",
- "\n",
- "64 @\n",
- "\n",
- "65 A\n",
- "\n",
- "66 B\n",
- "\n",
- "67 C\n",
- "\n",
- "68 D\n",
- "\n",
- "69 E\n",
- "\n",
- "70 F\n",
- "\n",
- "71 G\n",
- "\n",
- "72 H\n",
- "\n",
- "73 I\n",
- "\n",
- "74 J\n",
- "\n",
- "75 K\n",
- "\n",
- "76 L\n",
- "\n",
- "77 M\n",
- "\n",
- "78 N\n",
- "\n",
- "79 O\n",
- "\n",
- "80 P\n",
- "\n",
- "81 Q\n",
- "\n",
- "82 R\n",
- "\n",
- "83 S\n",
- "\n",
- "84 T\n",
- "\n",
- "85 U\n",
- "\n",
- "86 V\n",
- "\n",
- "87 W\n",
- "\n",
- "88 X\n",
- "\n",
- "89 Y\n",
- "\n",
- "90 Z\n",
- "\n",
- "91 [\n",
- "\n",
- "92 \\\n",
- "\n",
- "93 ]\n",
- "\n",
- "94 ^\n",
- "\n",
- "95 _\n",
- "\n",
- "96 `\n",
- "\n",
- "97 a\n",
- "\n",
- "98 b\n",
- "\n",
- "99 c\n",
- "\n",
- "100 d\n",
- "\n",
- "101 e\n",
- "\n",
- "102 f\n",
- "\n",
- "103 g\n",
- "\n",
- "104 h\n",
- "\n",
- "105 i\n",
- "\n",
- "106 j\n",
- "\n",
- "107 k\n",
- "\n",
- "108 l\n",
- "\n",
- "109 m\n",
- "\n",
- "110 n\n",
- "\n",
- "111 o\n",
- "\n",
- "112 p\n",
- "\n",
- "113 q\n",
- "\n",
- "114 r\n",
- "\n",
- "115 s\n",
- "\n",
- "116 t\n",
- "\n",
- "117 u\n",
- "\n",
- "118 v\n",
- "\n",
- "119 w\n",
- "\n",
- "120 x\n",
- "\n",
- "121 y\n",
- "\n",
- "122 z\n",
- "\n",
- "123 {\n",
- "\n",
- "124 |\n",
- "\n",
- "125 }\n",
- "\n",
- "126 ~\n",
- "\n",
- "127 \u007f\n",
- "\n",
- "128 \ufffd\n",
- "\n",
- "129 \ufffd\n",
- "\n",
- "130 \ufffd\n",
- "\n",
- "131 \ufffd\n",
- "\n",
- "132 \ufffd\n",
- "\n",
- "133 \ufffd\n",
- "\n",
- "134 \ufffd\n",
- "\n",
- "135 \ufffd\n",
- "\n",
- "136 \ufffd\n",
- "\n",
- "137 \ufffd\n",
- "\n",
- "138 \ufffd\n",
- "\n",
- "139 \ufffd\n",
- "\n",
- "140 \ufffd\n",
- "\n",
- "141 \ufffd\n",
- "\n",
- "142 \ufffd\n",
- "\n",
- "143 \ufffd\n",
- "\n",
- "144 \ufffd\n",
- "\n",
- "145 \ufffd\n",
- "\n",
- "146 \ufffd\n",
- "\n",
- "147 \ufffd\n",
- "\n",
- "148 \ufffd\n",
- "\n",
- "149 \ufffd\n",
- "\n",
- "150 \ufffd\n",
- "\n",
- "151 \ufffd\n",
- "\n",
- "152 \ufffd\n",
- "\n",
- "153 \ufffd\n",
- "\n",
- "154 \ufffd\n",
- "\n",
- "155 \ufffd\n",
- "\n",
- "156 \ufffd\n",
- "\n",
- "157 \ufffd\n",
- "\n",
- "158 \ufffd\n",
- "\n",
- "159 \ufffd\n",
- "\n",
- "160 \ufffd\n",
- "\n",
- "161 \ufffd\n",
- "\n",
- "162 \ufffd\n",
- "\n",
- "163 \ufffd\n",
- "\n",
- "164 \ufffd\n",
- "\n",
- "165 \ufffd\n",
- "\n",
- "166 \ufffd\n",
- "\n",
- "167 \ufffd\n",
- "\n",
- "168 \ufffd\n",
- "\n",
- "169 \ufffd\n",
- "\n",
- "170 \ufffd\n",
- "\n",
- "171 \ufffd\n",
- "\n",
- "172 \ufffd\n",
- "\n",
- "173 \ufffd\n",
- "\n",
- "174 \ufffd\n",
- "\n",
- "175 \ufffd\n",
- "\n",
- "176 \ufffd\n",
- "\n",
- "177 \ufffd\n",
- "\n",
- "178 \ufffd\n",
- "\n",
- "179 \ufffd\n",
- "\n",
- "180 \ufffd\n",
- "\n",
- "181 \ufffd\n",
- "\n",
- "182 \ufffd\n",
- "\n",
- "183 \ufffd\n",
- "\n",
- "184 \ufffd\n",
- "\n",
- "185 \ufffd\n",
- "\n",
- "186 \ufffd\n",
- "\n",
- "187 \ufffd\n",
- "\n",
- "188 \ufffd\n",
- "\n",
- "189 \ufffd\n",
- "\n",
- "190 \ufffd\n",
- "\n",
- "191 \ufffd\n",
- "\n",
- "192 \ufffd\n",
- "\n",
- "193 \ufffd\n",
- "\n",
- "194 \ufffd\n",
- "\n",
- "195 \ufffd\n",
- "\n",
- "196 \ufffd\n",
- "\n",
- "197 \ufffd\n",
- "\n",
- "198 \ufffd\n",
- "\n",
- "199 \ufffd\n",
- "\n",
- "200 \ufffd\n",
- "\n",
- "201 \ufffd\n",
- "\n",
- "202 \ufffd\n",
- "\n",
- "203 \ufffd\n",
- "\n",
- "204 \ufffd\n",
- "\n",
- "205 \ufffd\n",
- "\n",
- "206 \ufffd\n",
- "\n",
- "207 \ufffd\n",
- "\n",
- "208 \ufffd\n",
- "\n",
- "209 \ufffd\n",
- "\n",
- "210 \ufffd\n",
- "\n",
- "211 \ufffd\n",
- "\n",
- "212 \ufffd\n",
- "\n",
- "213 \ufffd\n",
- "\n",
- "214 \ufffd\n",
- "\n",
- "215 \ufffd\n",
- "\n",
- "216 \ufffd\n",
- "\n",
- "217 \ufffd\n",
- "\n",
- "218 \ufffd\n",
- "\n",
- "219 \ufffd\n",
- "\n",
- "220 \ufffd\n",
- "\n",
- "221 \ufffd\n",
- "\n",
- "222 \ufffd\n",
- "\n",
- "223 \ufffd\n",
- "\n",
- "224 \ufffd\n",
- "\n",
- "225 \ufffd\n",
- "\n",
- "226 \ufffd\n",
- "\n",
- "227 \ufffd\n",
- "\n",
- "228 \ufffd\n",
- "\n",
- "229 \ufffd\n",
- "\n",
- "230 \ufffd\n",
- "\n",
- "231 \ufffd\n",
- "\n",
- "232 \ufffd\n",
- "\n",
- "233 \ufffd\n",
- "\n",
- "234 \ufffd\n",
- "\n",
- "235 \ufffd\n",
- "\n",
- "236 \ufffd\n",
- "\n",
- "237 \ufffd\n",
- "\n",
- "238 \ufffd\n",
- "\n",
- "239 \ufffd\n",
- "\n",
- "240 \ufffd\n",
- "\n",
- "241 \ufffd\n",
- "\n",
- "242 \ufffd\n",
- "\n",
- "243 \ufffd\n",
- "\n",
- "244 \ufffd\n",
- "\n",
- "245 \ufffd\n",
- "\n",
- "246 \ufffd\n",
- "\n",
- "247 \ufffd\n",
- "\n",
- "248 \ufffd\n",
- "\n",
- "249 \ufffd\n",
- "\n",
- "250 \ufffd\n",
- "\n",
- "251 \ufffd\n",
- "\n",
- "252 \ufffd\n",
- "\n",
- "253 \ufffd\n",
- "\n",
- "254 \ufffd\n",
- "\n",
- "255 \ufffd\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:af78c3ae74c9d65bb5213be5077524875e7de56ebf2616c80d19baf13507c5b4"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 13: MORE ISSUES IN INPUT/OUTPUT"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:434-435"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import sys\n",
+ "if(len(sys.argv)!=3):\n",
+ " print \"Improper number of arguments\\n\"\n",
+ " sys.exit(0)\n",
+ "try:\n",
+ " fs=open(sys.argv[1], \"r\")\n",
+ "except:\n",
+ " sys.exit(\"Cannot open source file\\n\")\n",
+ "try:\n",
+ " ft=open(sys.argv[2], \"w\")\n",
+ "except:\n",
+ " fs.close()\n",
+ " sys.exit(\"Cannot open source file\\n\")\n",
+ "ch=fs.readlines()\n",
+ "ft.writelines(ch)\n",
+ "fs.close()\n",
+ "ft.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:437-438"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "try:\n",
+ " fp=open('python.txt','w')\n",
+ " while True:\n",
+ " ch=fp.read(1)\n",
+ " if not ch:\n",
+ " break;\n",
+ " print \"%c\" % (ch)\n",
+ "except:\n",
+ " print \"Error in reading file\\n\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Error in reading file\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:439"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import tempfile\n",
+ "import win32api\n",
+ "import win32print\n",
+ "import sys\n",
+ "\n",
+ "try:\n",
+ " fp=open('poem.txt','r') #No need to open it\n",
+ "except:\n",
+ " sys.exit(\"Cannot open file\\n\")\n",
+ "win32api.ShellExecute (\n",
+ " 0,\n",
+ " \"print\",\n",
+ " \"poem.txt\",\n",
+ " '/d:\"%s\"' % win32print.GetDefaultPrinter (),\n",
+ " \".\",\n",
+ " 0\n",
+ ")\n",
+ "fp.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 3,
+ "text": [
+ "42"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:440-441"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import sys\n",
+ "ch = sys.stdin.read(1)\n",
+ "while (len(ch)>0):\n",
+ " sys.stdout.write(ch)\n",
+ " ch = sys.stdin.read(1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:442"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for ch in range(0,256,1):\n",
+ " print \"%d %c\\n\" % (ch,ch)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0 \u0000\n",
+ "\n",
+ "1 \u0001\n",
+ "\n",
+ "2 \u0002\n",
+ "\n",
+ "3 \u0003\n",
+ "\n",
+ "4 \u0004\n",
+ "\n",
+ "5 \u0005\n",
+ "\n",
+ "6 \u0006\n",
+ "\n",
+ "7 \u0007\n",
+ "\n",
+ "8 \b\n",
+ "\n",
+ "9 \t\n",
+ "\n",
+ "10 \n",
+ "\n",
+ "\n",
+ "11 \u000b",
+ "\n",
+ "\n",
+ "12 \f",
+ "\n",
+ "\n",
+ "13 \r\n",
+ "\n",
+ "14 \u000e\n",
+ "\n",
+ "15 \u000f\n",
+ "\n",
+ "16 \u0010\n",
+ "\n",
+ "17 \u0011\n",
+ "\n",
+ "18 \u0012\n",
+ "\n",
+ "19 \u0013\n",
+ "\n",
+ "20 \u0014\n",
+ "\n",
+ "21 \u0015\n",
+ "\n",
+ "22 \u0016\n",
+ "\n",
+ "23 \u0017\n",
+ "\n",
+ "24 \u0018\n",
+ "\n",
+ "25 \u0019\n",
+ "\n",
+ "26 \u001a\n",
+ "\n",
+ "27 \u001b\n",
+ "\n",
+ "28 \u001c",
+ "\n",
+ "\n",
+ "29 \u001d",
+ "\n",
+ "\n",
+ "30 \u001e",
+ "\n",
+ "\n",
+ "31 \u001f\n",
+ "\n",
+ "32 \n",
+ "\n",
+ "33 !\n",
+ "\n",
+ "34 \"\n",
+ "\n",
+ "35 #\n",
+ "\n",
+ "36 $\n",
+ "\n",
+ "37 %\n",
+ "\n",
+ "38 &\n",
+ "\n",
+ "39 '\n",
+ "\n",
+ "40 (\n",
+ "\n",
+ "41 )\n",
+ "\n",
+ "42 *\n",
+ "\n",
+ "43 +\n",
+ "\n",
+ "44 ,\n",
+ "\n",
+ "45 -\n",
+ "\n",
+ "46 .\n",
+ "\n",
+ "47 /\n",
+ "\n",
+ "48 0\n",
+ "\n",
+ "49 1\n",
+ "\n",
+ "50 2\n",
+ "\n",
+ "51 3\n",
+ "\n",
+ "52 4\n",
+ "\n",
+ "53 5\n",
+ "\n",
+ "54 6\n",
+ "\n",
+ "55 7\n",
+ "\n",
+ "56 8\n",
+ "\n",
+ "57 9\n",
+ "\n",
+ "58 :\n",
+ "\n",
+ "59 ;\n",
+ "\n",
+ "60 <\n",
+ "\n",
+ "61 =\n",
+ "\n",
+ "62 >\n",
+ "\n",
+ "63 ?\n",
+ "\n",
+ "64 @\n",
+ "\n",
+ "65 A\n",
+ "\n",
+ "66 B\n",
+ "\n",
+ "67 C\n",
+ "\n",
+ "68 D\n",
+ "\n",
+ "69 E\n",
+ "\n",
+ "70 F\n",
+ "\n",
+ "71 G\n",
+ "\n",
+ "72 H\n",
+ "\n",
+ "73 I\n",
+ "\n",
+ "74 J\n",
+ "\n",
+ "75 K\n",
+ "\n",
+ "76 L\n",
+ "\n",
+ "77 M\n",
+ "\n",
+ "78 N\n",
+ "\n",
+ "79 O\n",
+ "\n",
+ "80 P\n",
+ "\n",
+ "81 Q\n",
+ "\n",
+ "82 R\n",
+ "\n",
+ "83 S\n",
+ "\n",
+ "84 T\n",
+ "\n",
+ "85 U\n",
+ "\n",
+ "86 V\n",
+ "\n",
+ "87 W\n",
+ "\n",
+ "88 X\n",
+ "\n",
+ "89 Y\n",
+ "\n",
+ "90 Z\n",
+ "\n",
+ "91 [\n",
+ "\n",
+ "92 \\\n",
+ "\n",
+ "93 ]\n",
+ "\n",
+ "94 ^\n",
+ "\n",
+ "95 _\n",
+ "\n",
+ "96 `\n",
+ "\n",
+ "97 a\n",
+ "\n",
+ "98 b\n",
+ "\n",
+ "99 c\n",
+ "\n",
+ "100 d\n",
+ "\n",
+ "101 e\n",
+ "\n",
+ "102 f\n",
+ "\n",
+ "103 g\n",
+ "\n",
+ "104 h\n",
+ "\n",
+ "105 i\n",
+ "\n",
+ "106 j\n",
+ "\n",
+ "107 k\n",
+ "\n",
+ "108 l\n",
+ "\n",
+ "109 m\n",
+ "\n",
+ "110 n\n",
+ "\n",
+ "111 o\n",
+ "\n",
+ "112 p\n",
+ "\n",
+ "113 q\n",
+ "\n",
+ "114 r\n",
+ "\n",
+ "115 s\n",
+ "\n",
+ "116 t\n",
+ "\n",
+ "117 u\n",
+ "\n",
+ "118 v\n",
+ "\n",
+ "119 w\n",
+ "\n",
+ "120 x\n",
+ "\n",
+ "121 y\n",
+ "\n",
+ "122 z\n",
+ "\n",
+ "123 {\n",
+ "\n",
+ "124 |\n",
+ "\n",
+ "125 }\n",
+ "\n",
+ "126 ~\n",
+ "\n",
+ "127 \u007f\n",
+ "\n",
+ "128 \ufffd\n",
+ "\n",
+ "129 \ufffd\n",
+ "\n",
+ "130 \ufffd\n",
+ "\n",
+ "131 \ufffd\n",
+ "\n",
+ "132 \ufffd\n",
+ "\n",
+ "133 \ufffd\n",
+ "\n",
+ "134 \ufffd\n",
+ "\n",
+ "135 \ufffd\n",
+ "\n",
+ "136 \ufffd\n",
+ "\n",
+ "137 \ufffd\n",
+ "\n",
+ "138 \ufffd\n",
+ "\n",
+ "139 \ufffd\n",
+ "\n",
+ "140 \ufffd\n",
+ "\n",
+ "141 \ufffd\n",
+ "\n",
+ "142 \ufffd\n",
+ "\n",
+ "143 \ufffd\n",
+ "\n",
+ "144 \ufffd\n",
+ "\n",
+ "145 \ufffd\n",
+ "\n",
+ "146 \ufffd\n",
+ "\n",
+ "147 \ufffd\n",
+ "\n",
+ "148 \ufffd\n",
+ "\n",
+ "149 \ufffd\n",
+ "\n",
+ "150 \ufffd\n",
+ "\n",
+ "151 \ufffd\n",
+ "\n",
+ "152 \ufffd\n",
+ "\n",
+ "153 \ufffd\n",
+ "\n",
+ "154 \ufffd\n",
+ "\n",
+ "155 \ufffd\n",
+ "\n",
+ "156 \ufffd\n",
+ "\n",
+ "157 \ufffd\n",
+ "\n",
+ "158 \ufffd\n",
+ "\n",
+ "159 \ufffd\n",
+ "\n",
+ "160 \ufffd\n",
+ "\n",
+ "161 \ufffd\n",
+ "\n",
+ "162 \ufffd\n",
+ "\n",
+ "163 \ufffd\n",
+ "\n",
+ "164 \ufffd\n",
+ "\n",
+ "165 \ufffd\n",
+ "\n",
+ "166 \ufffd\n",
+ "\n",
+ "167 \ufffd\n",
+ "\n",
+ "168 \ufffd\n",
+ "\n",
+ "169 \ufffd\n",
+ "\n",
+ "170 \ufffd\n",
+ "\n",
+ "171 \ufffd\n",
+ "\n",
+ "172 \ufffd\n",
+ "\n",
+ "173 \ufffd\n",
+ "\n",
+ "174 \ufffd\n",
+ "\n",
+ "175 \ufffd\n",
+ "\n",
+ "176 \ufffd\n",
+ "\n",
+ "177 \ufffd\n",
+ "\n",
+ "178 \ufffd\n",
+ "\n",
+ "179 \ufffd\n",
+ "\n",
+ "180 \ufffd\n",
+ "\n",
+ "181 \ufffd\n",
+ "\n",
+ "182 \ufffd\n",
+ "\n",
+ "183 \ufffd\n",
+ "\n",
+ "184 \ufffd\n",
+ "\n",
+ "185 \ufffd\n",
+ "\n",
+ "186 \ufffd\n",
+ "\n",
+ "187 \ufffd\n",
+ "\n",
+ "188 \ufffd\n",
+ "\n",
+ "189 \ufffd\n",
+ "\n",
+ "190 \ufffd\n",
+ "\n",
+ "191 \ufffd\n",
+ "\n",
+ "192 \ufffd\n",
+ "\n",
+ "193 \ufffd\n",
+ "\n",
+ "194 \ufffd\n",
+ "\n",
+ "195 \ufffd\n",
+ "\n",
+ "196 \ufffd\n",
+ "\n",
+ "197 \ufffd\n",
+ "\n",
+ "198 \ufffd\n",
+ "\n",
+ "199 \ufffd\n",
+ "\n",
+ "200 \ufffd\n",
+ "\n",
+ "201 \ufffd\n",
+ "\n",
+ "202 \ufffd\n",
+ "\n",
+ "203 \ufffd\n",
+ "\n",
+ "204 \ufffd\n",
+ "\n",
+ "205 \ufffd\n",
+ "\n",
+ "206 \ufffd\n",
+ "\n",
+ "207 \ufffd\n",
+ "\n",
+ "208 \ufffd\n",
+ "\n",
+ "209 \ufffd\n",
+ "\n",
+ "210 \ufffd\n",
+ "\n",
+ "211 \ufffd\n",
+ "\n",
+ "212 \ufffd\n",
+ "\n",
+ "213 \ufffd\n",
+ "\n",
+ "214 \ufffd\n",
+ "\n",
+ "215 \ufffd\n",
+ "\n",
+ "216 \ufffd\n",
+ "\n",
+ "217 \ufffd\n",
+ "\n",
+ "218 \ufffd\n",
+ "\n",
+ "219 \ufffd\n",
+ "\n",
+ "220 \ufffd\n",
+ "\n",
+ "221 \ufffd\n",
+ "\n",
+ "222 \ufffd\n",
+ "\n",
+ "223 \ufffd\n",
+ "\n",
+ "224 \ufffd\n",
+ "\n",
+ "225 \ufffd\n",
+ "\n",
+ "226 \ufffd\n",
+ "\n",
+ "227 \ufffd\n",
+ "\n",
+ "228 \ufffd\n",
+ "\n",
+ "229 \ufffd\n",
+ "\n",
+ "230 \ufffd\n",
+ "\n",
+ "231 \ufffd\n",
+ "\n",
+ "232 \ufffd\n",
+ "\n",
+ "233 \ufffd\n",
+ "\n",
+ "234 \ufffd\n",
+ "\n",
+ "235 \ufffd\n",
+ "\n",
+ "236 \ufffd\n",
+ "\n",
+ "237 \ufffd\n",
+ "\n",
+ "238 \ufffd\n",
+ "\n",
+ "239 \ufffd\n",
+ "\n",
+ "240 \ufffd\n",
+ "\n",
+ "241 \ufffd\n",
+ "\n",
+ "242 \ufffd\n",
+ "\n",
+ "243 \ufffd\n",
+ "\n",
+ "244 \ufffd\n",
+ "\n",
+ "245 \ufffd\n",
+ "\n",
+ "246 \ufffd\n",
+ "\n",
+ "247 \ufffd\n",
+ "\n",
+ "248 \ufffd\n",
+ "\n",
+ "249 \ufffd\n",
+ "\n",
+ "250 \ufffd\n",
+ "\n",
+ "251 \ufffd\n",
+ "\n",
+ "252 \ufffd\n",
+ "\n",
+ "253 \ufffd\n",
+ "\n",
+ "254 \ufffd\n",
+ "\n",
+ "255 \ufffd\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter14.ipynb b/ANSI_C_Programming/chapter14.ipynb
index c29af0ac..35f6efe1 100644
--- a/ANSI_C_Programming/chapter14.ipynb
+++ b/ANSI_C_Programming/chapter14.ipynb
@@ -1,407 +1,407 @@
-{
- "metadata": {
- "name": "chapter14.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 14: OPERATIONS ON BITS"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:449"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Print binary equivalent of integers using showbits() function()\n",
- "def showbits(x):\n",
- " return bin(x)[2:].zfill(16)\n",
- "for j in range(0,6,1):\n",
- " print \"Decimal %d is same as binary\" % (j)\n",
- " print showbits(j)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Decimal 0 is same as binary\n",
- "0000000000000000\n",
- "Decimal 1 is same as binary\n",
- "0000000000000001\n",
- "Decimal 2 is same as binary\n",
- "0000000000000010\n",
- "Decimal 3 is same as binary\n",
- "0000000000000011\n",
- "Decimal 4 is same as binary\n",
- "0000000000000100\n",
- "Decimal 5 is same as binary\n",
- "0000000000000101\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:450"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Use of One's complement operator\n",
- "def showbits(x):\n",
- " return bin(x)[2:].zfill(16)\n",
- "for j in range(0,4,1):\n",
- " print \"Decimal %d is same as binary\" % (j)\n",
- " print showbits(j)\n",
- " k=j^65535 #using xor for making one's complement\n",
- " print \"One's complement of %d is\" % (j)\n",
- " print showbits(k)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Decimal 0 is same as binary\n",
- "0000000000000000\n",
- "One's complement of 0 is\n",
- "1111111111111111\n",
- "Decimal 1 is same as binary\n",
- "0000000000000001\n",
- "One's complement of 1 is\n",
- "1111111111111110\n",
- "Decimal 2 is same as binary\n",
- "0000000000000010\n",
- "One's complement of 2 is\n",
- "1111111111111101\n",
- "Decimal 3 is same as binary\n",
- "0000000000000011\n",
- "One's complement of 3 is\n",
- "1111111111111100\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:451"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#file encryption utility\n",
- "import sys\n",
- "def encrypt():\n",
- " try:\n",
- " fs=open('SOURCE.txt','r') #normal file\n",
- " ft=open('TARGET.txt','w') #encrypted file\n",
- " except:\n",
- " print \"File opening error!\"\n",
- " sys.exit(1)\n",
- " while True:\n",
- " ch=fs.read(1)\n",
- " if not ch:\n",
- " break\n",
- " ft.write(bytearray([ord(ch)^0xff]))\n",
- " fs.close()\n",
- " ft.close()\n",
- "encrypt()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:452"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Use of Right shift operator\n",
- "def showbits(x):\n",
- " return bin(x)[2:].zfill(16)\n",
- "i=5225\n",
- "print \"Decimal %d is same as binary\" % (i)\n",
- "print showbits(i)\n",
- "for j in range(0,6,1):\n",
- " k=i>>j #right shift operator\n",
- " print \"%d right shift %d gives\" % (i,j)\n",
- " print showbits(k)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Decimal 5225 is same as binary\n",
- "0001010001101001\n",
- "5225 right shift 0 gives\n",
- "0001010001101001\n",
- "5225 right shift 1 gives\n",
- "0000101000110100\n",
- "5225 right shift 2 gives\n",
- "0000010100011010\n",
- "5225 right shift 3 gives\n",
- "0000001010001101\n",
- "5225 right shift 4 gives\n",
- "0000000101000110\n",
- "5225 right shift 5 gives\n",
- "0000000010100011\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:453-454"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Use of left shift operator\n",
- "def showbits(x):\n",
- " return bin(x)[2:].zfill(16)\n",
- "i=5225\n",
- "print \"Decimal %d is same as binary\" % (i)\n",
- "print showbits(i)\n",
- "for j in range(0,5,1):\n",
- " mask = 2 ** 16 - 1\n",
- " k = (i << j) & mask #left shift operator\n",
- " print \"%d right shift %d gives\" % (i,j)\n",
- " print showbits(k)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Decimal 5225 is same as binary\n",
- "0001010001101001\n",
- "5225 right shift 0 gives\n",
- "0001010001101001\n",
- "5225 right shift 1 gives\n",
- "0010100011010010\n",
- "5225 right shift 2 gives\n",
- "0101000110100100\n",
- "5225 right shift 3 gives\n",
- "1010001101001000\n",
- "5225 right shift 4 gives\n",
- "0100011010010000\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:457-458"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Decoding date field in directory entry using bitwise operators\n",
- "#Note:Answer in the book is wrong\n",
- "d=9\n",
- "m=3\n",
- "y=1990\n",
- "date=(y-1980)*512+m*32+d\n",
- "print \"Date=%u\\n\" % (date)\n",
- "year=1980+(date>>9)\n",
- "month=((date<<7)>>12)\n",
- "day=((date<<11)>>11)\n",
- "print \"Year=%u\" % (year)\n",
- "print \"Month=%u\" % (month)\n",
- "print \"Day=%u\" % (day)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Date=5225\n",
- "\n",
- "Year=1990\n",
- "Month=163\n",
- "Day=5225\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:460"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#To test whether a bit in a number is ON or OFF\n",
- "i=65\n",
- "print \"Value of i=%d\\n\" % (i)\n",
- "j=i&32\n",
- "if j==0:\n",
- " print \"and its fifth bit is off\\n\"\n",
- "else:\n",
- " print \"and its fifth bit is on\\n\"\n",
- "j=i&64\n",
- "if j==0:\n",
- " print \"whereas its sixth bit is off\\n\"\n",
- "else:\n",
- " print \"whereas its sixth bit is on\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Value of i=65\n",
- "\n",
- "and its fifth bit is off\n",
- "\n",
- "whereas its sixth bit is on\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:463"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Use of XOR operator\n",
- "b=50\n",
- "b=b^12 #XOR operator\n",
- "print \"%d\\n\" % (b) #this will print 62\n",
- "b=b^12\n",
- "print \"%d\\n\" % (b) #this will print 50"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "62\n",
- "\n",
- "50\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:463-464"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#function for 16 bit binary representation of a number\n",
- "def showbit(n):\n",
- " for i in range(15,-1,-1):\n",
- " andmask=1<<i\n",
- " k=n&andmask\n",
- " if k==0:\n",
- " print 0, \n",
- " else:\n",
- " print 1, \n",
- " print \"\\n\"\n",
- "showbit(32)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 \n",
- "\n"
- ]
- }
- ],
- "prompt_number": 14
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e28261ed5c0b0cf7c10e8c91bd2debc8e99bf24519225a056fc19ed619f1e95d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 14: OPERATIONS ON BITS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:449"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def showbits(x):\n",
+ " return bin(x)[2:].zfill(16)\n",
+ "for j in range(0,6,1):\n",
+ " print \"Decimal %d is same as binary\" % (j)\n",
+ " print showbits(j)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Decimal 0 is same as binary\n",
+ "0000000000000000\n",
+ "Decimal 1 is same as binary\n",
+ "0000000000000001\n",
+ "Decimal 2 is same as binary\n",
+ "0000000000000010\n",
+ "Decimal 3 is same as binary\n",
+ "0000000000000011\n",
+ "Decimal 4 is same as binary\n",
+ "0000000000000100\n",
+ "Decimal 5 is same as binary\n",
+ "0000000000000101\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:450"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def showbits(x):\n",
+ " return bin(x)[2:].zfill(16)\n",
+ "for j in range(0,4,1):\n",
+ " print \"Decimal %d is same as binary\" % (j)\n",
+ " print showbits(j)\n",
+ " k=j^65535 #using xor for making one's complement\n",
+ " print \"One's complement of %d is\" % (j)\n",
+ " print showbits(k)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Decimal 0 is same as binary\n",
+ "0000000000000000\n",
+ "One's complement of 0 is\n",
+ "1111111111111111\n",
+ "Decimal 1 is same as binary\n",
+ "0000000000000001\n",
+ "One's complement of 1 is\n",
+ "1111111111111110\n",
+ "Decimal 2 is same as binary\n",
+ "0000000000000010\n",
+ "One's complement of 2 is\n",
+ "1111111111111101\n",
+ "Decimal 3 is same as binary\n",
+ "0000000000000011\n",
+ "One's complement of 3 is\n",
+ "1111111111111100\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:451"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import sys\n",
+ "def encrypt():\n",
+ " try:\n",
+ " fs=open('SOURCE.txt','r') #normal file\n",
+ " ft=open('TARGET.txt','w') #encrypted file\n",
+ " except:\n",
+ " print \"File opening error!\"\n",
+ " sys.exit(1)\n",
+ " while True:\n",
+ " ch=fs.read(1)\n",
+ " if not ch:\n",
+ " break\n",
+ " ft.write(bytearray([ord(ch)^0xff]))\n",
+ " fs.close()\n",
+ " ft.close()\n",
+ "encrypt()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:452"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def showbits(x):\n",
+ " return bin(x)[2:].zfill(16)\n",
+ "i=5225\n",
+ "print \"Decimal %d is same as binary\" % (i)\n",
+ "print showbits(i)\n",
+ "for j in range(0,6,1):\n",
+ " k=i>>j #right shift operator\n",
+ " print \"%d right shift %d gives\" % (i,j)\n",
+ " print showbits(k)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Decimal 5225 is same as binary\n",
+ "0001010001101001\n",
+ "5225 right shift 0 gives\n",
+ "0001010001101001\n",
+ "5225 right shift 1 gives\n",
+ "0000101000110100\n",
+ "5225 right shift 2 gives\n",
+ "0000010100011010\n",
+ "5225 right shift 3 gives\n",
+ "0000001010001101\n",
+ "5225 right shift 4 gives\n",
+ "0000000101000110\n",
+ "5225 right shift 5 gives\n",
+ "0000000010100011\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:453-454"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def showbits(x):\n",
+ " return bin(x)[2:].zfill(16)\n",
+ "i=5225\n",
+ "print \"Decimal %d is same as binary\" % (i)\n",
+ "print showbits(i)\n",
+ "for j in range(0,5,1):\n",
+ " mask = 2 ** 16 - 1\n",
+ " k = (i << j) & mask #left shift operator\n",
+ " print \"%d right shift %d gives\" % (i,j)\n",
+ " print showbits(k)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Decimal 5225 is same as binary\n",
+ "0001010001101001\n",
+ "5225 right shift 0 gives\n",
+ "0001010001101001\n",
+ "5225 right shift 1 gives\n",
+ "0010100011010010\n",
+ "5225 right shift 2 gives\n",
+ "0101000110100100\n",
+ "5225 right shift 3 gives\n",
+ "1010001101001000\n",
+ "5225 right shift 4 gives\n",
+ "0100011010010000\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:457-458"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "d=9\n",
+ "m=3\n",
+ "y=1990\n",
+ "date=(y-1980)*512+m*32+d\n",
+ "print \"Date=%u\\n\" % (date)\n",
+ "year=1980+(date>>9)\n",
+ "month=((date<<7)>>12)\n",
+ "day=((date<<11)>>11)\n",
+ "print \"Year=%u\" % (year)\n",
+ "print \"Month=%u\" % (month)\n",
+ "print \"Day=%u\" % (day)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Date=5225\n",
+ "\n",
+ "Year=1990\n",
+ "Month=163\n",
+ "Day=5225\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:460"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=65\n",
+ "print \"Value of i=%d\\n\" % (i)\n",
+ "j=i&32\n",
+ "if j==0:\n",
+ " print \"and its fifth bit is off\\n\"\n",
+ "else:\n",
+ " print \"and its fifth bit is on\\n\"\n",
+ "j=i&64\n",
+ "if j==0:\n",
+ " print \"whereas its sixth bit is off\\n\"\n",
+ "else:\n",
+ " print \"whereas its sixth bit is on\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of i=65\n",
+ "\n",
+ "and its fifth bit is off\n",
+ "\n",
+ "whereas its sixth bit is on\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:463"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "b=50\n",
+ "b=b^12 #XOR operator\n",
+ "print \"%d\\n\" % (b) #this will print 62\n",
+ "b=b^12\n",
+ "print \"%d\\n\" % (b) #this will print 50"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "62\n",
+ "\n",
+ "50\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:463-464"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def showbit(n):\n",
+ " for i in range(15,-1,-1):\n",
+ " andmask=1<<i\n",
+ " k=n&andmask\n",
+ " if k==0:\n",
+ " print 0, \n",
+ " else:\n",
+ " print 1, \n",
+ " print \"\\n\"\n",
+ "showbit(32)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter15.ipynb b/ANSI_C_Programming/chapter15.ipynb
index 9a67d04b..6421f521 100644
--- a/ANSI_C_Programming/chapter15.ipynb
+++ b/ANSI_C_Programming/chapter15.ipynb
@@ -1,691 +1,692 @@
-{
- "metadata": {
- "name": "chapter15.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 15: MISCELLANEOUS FEATURES"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:473-474"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Use of enumerated data type for an employee department\n",
- "def emp_dept(*sequential, **named): #definition of enumeration\n",
- " enums = dict(zip(sequential, range(len(sequential))), **named)\n",
- " return type('Enum', (), enums)\n",
- "class employee(): #structure\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "department=emp_dept('assembly','manufacturing','accounts','stores') #defining a variable of type enum emp_dept\n",
- "e=employee(name=\"Lothar Mattheus\",age=28,bs=5575.50,department=department.manufacturing)\n",
- "print \"Name=%s\\n\" % (e.name)\n",
- "print \"Age=%d\\n\" % (e.age)\n",
- "print \"Basic salary=%f\\n\" % (e.bs)\n",
- "print \"Dept=%d\\n\" % (e.department)\n",
- "if e.department==department.accounts:\n",
- " print \"%s is an accountant\\n\" % (e.name)\n",
- "else:\n",
- " print \"%s is not an accountant\\n\" % (e.name)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Name=Lothar Mattheus\n",
- "\n",
- "Age=28\n",
- "\n",
- "Basic salary=5575.500000\n",
- "\n",
- "Dept=1\n",
- "\n",
- "Lothar Mattheus is not an accountant\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:475"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Above program using macros\n",
- "def ASSEMBLY():\n",
- " return 0\n",
- "def MANUFACTURING():\n",
- " return 1\n",
- "def ACCOUNTS():\n",
- " return 2\n",
- "def STORES():\n",
- " return 3\n",
- "class employee():\n",
- " def __init__(self,**kwds):\n",
- " self.__dict__.update(kwds)\n",
- "e=employee()\n",
- "e.name=\"Lothar Mattheus\"\n",
- "e.age=28\n",
- "e.bs=5575.50\n",
- "e.department=MANUFACTURING()\n",
- "print \"Name=%s\\n\" % (e.name)\n",
- "print \"Age=%d\\n\" % (e.age)\n",
- "print \"Basic salary=%f\\n\" % (e.bs)\n",
- "print \"Dept=%d\\n\" % (e.department)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Name=Lothar Mattheus\n",
- "\n",
- "Age=28\n",
- "\n",
- "Basic salary=5575.500000\n",
- "\n",
- "Dept=1\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:477-478"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program showing need for typecasting\n",
- "x=6\n",
- "y=4\n",
- "a=x/y #int\n",
- "print \"Value of a=%f\\n\" % (a)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Value of a=1.000000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:478"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program using typecasting to convert an expression into particular data type\n",
- "x=6\n",
- "y=4\n",
- "a=float(x)/y #float\n",
- "print \"Value of a=%f\\n\" % (a)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Value of a=1.500000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:478-479"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Another example of typecasting\n",
- "a=6.35\n",
- "print \"Value of a on type casting=%d\\n\" % (int(a)) #converts float to int\n",
- "print \"Value of a=%f\\n\" % (a) "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Value of a on type casting=6\n",
- "\n",
- "Value of a=6.350000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:480"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using bit fields for stroring variables\n",
- "from ctypes import *\n",
- "def MALE():\n",
- " return 0\n",
- "def FEMALE():\n",
- " return 1\n",
- "def SINGLE():\n",
- " return 0\n",
- "def MARRIED():\n",
- " return 1\n",
- "def DIVORCED():\n",
- " return 2\n",
- "def WIDOWED():\n",
- " return 3\n",
- "class employee(Structure):\n",
- " _fields_= [(\"gender\",c_short, 1), #1 bit size for storage\n",
- " (\"mar_stat\", c_short, 2), #2 bit size for storage\n",
- " (\"hobby\",c_short, 3), #3 bit size for storage\n",
- " (\"scheme\",c_short, 4)] #4 bit size for storage\n",
- "e=employee()\n",
- "e.gender=MALE()\n",
- "e.mar_status=DIVORCED()\n",
- "e.hobby=5\n",
- "e.scheme=9\n",
- "print \"Gender=%d\\n\" % (e.gender)\n",
- "print \"Marital status=%d\\n\" % (e.mar_status)\n",
- "import ctypes\n",
- "print \"Bytes occupied by e=%d\\n\" % (ctypes.sizeof(e))"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Gender=0\n",
- "\n",
- "Marital status=2\n",
- "\n",
- "Bytes occupied by e=2\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:481"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing address of function\n",
- "def display():\n",
- " print \"Long live viruses!!\\n\"\n",
- "print \"Address of function display is %s\\n\" % (display)\n",
- "display()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Address of function display is <function display at 0x02D93DF0>\n",
- "\n",
- "Long live viruses!!\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:481-482"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing address of function\n",
- "def display():\n",
- " print \"\\nLong live viruses!!\"\n",
- "func_ptr=display\n",
- "print \"Address of function display is %s\\n\" % (display)\n",
- "func_ptr()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Address of function display is <function display at 0x05696730>\n",
- "\n",
- "\n",
- "Long live viruses!!\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:483"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#function returning address\n",
- "def fun():\n",
- " i=20\n",
- " return (id(i))\n",
- "p=fun\n",
- "p()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "metadata": {},
- "output_type": "pyout",
- "prompt_number": 9,
- "text": [
- "20688356"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:483-484"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program to copy one string into another\n",
- "def copy(t,s):\n",
- " t=\"\\0\"\n",
- " for item in s:\n",
- " t=t+item\n",
- " return t\n",
- "source=\"Jaded\"\n",
- "target=[]\n",
- "str1=copy(target,source)\n",
- "print \"%s\\n\" % (str1)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\u0000Jaded\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 18
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:485"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#function with variable number of arguments\n",
- "def findmax(tot_num,*num): #tuples\n",
- " max=0\n",
- " for count in range(0,len(num),1):\n",
- " if num[count]>max:\n",
- " max=num[count]\n",
- " return max\n",
- "max=findmax(5,23,15,1,92,50)\n",
- "print \"maximum=%d\\n\" % (max)\n",
- "max=findmax(3,100,300,29)\n",
- "print \"maximum=%d\\n\" % (max)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "maximum=92\n",
- "\n",
- "maximum=300\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 19
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:486-487"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#function for printing any number of arguments of any type\n",
- "def display(type,num,*t):\n",
- " def integer():\n",
- " for j in range(0,num,1):\n",
- " print \"%d\" % (t[j])\n",
- " def char():\n",
- " for j in range(0,num,1):\n",
- " print \"%c\" % (t[j])\n",
- " def floating():\n",
- " for j in range(0,num,1):\n",
- " print \"%f\" % (t[j])\n",
- " def switch(ch):\n",
- " return {1: integer,\n",
- " 2: char,\n",
- " 3: floating,\n",
- " }[ch]()\n",
- " switch(type)\n",
- "display(1,2,5,6)\n",
- "display(2,4,'A','a','b','c')\n",
- "display(3,3,2.5,299.3,-1.0)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n",
- "6\n",
- "A\n",
- "a\n",
- "b\n",
- "c\n",
- "2.500000\n",
- "299.300000\n",
- "-1.000000\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:488"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Demo of union at work\n",
- "from ctypes import *\n",
- "class a(Union): #definition of union\n",
- " _fields_= [(\"i\", c_short),\n",
- " (\"ch\",c_byte*2)]\n",
- "key=a()\n",
- "key.i=512\n",
- "print key.i\n",
- "print key.ch[0]\n",
- "print key.ch[1]"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "512\n",
- "0\n",
- "2\n"
- ]
- }
- ],
- "prompt_number": 22
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:491"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Program explaining operation of union\n",
- "from ctypes import *\n",
- "class a(Union):\n",
- " _fields_= [(\"i\", c_short),\n",
- " (\"ch\",c_byte*2)]\n",
- "key=a()\n",
- "key.i=512\n",
- "print key.i\n",
- "print key.ch[0]\n",
- "print key.ch[1]\n",
- "key.ch[0]=50\n",
- "print key.i\n",
- "print key.ch[0]\n",
- "print key.ch[1]"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "512\n",
- "0\n",
- "2\n",
- "562\n",
- "50\n",
- "2\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:492-493"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program for union of structures\n",
- "from ctypes import *\n",
- "class a(Structure):\n",
- " _fields_ = [(\"i\", c_short),\n",
- " (\"c\", c_byte*2)]\n",
- "\n",
- "class b(Structure):\n",
- " _fields_ = [(\"j\", c_short),\n",
- " (\"d\", c_byte*2)]\n",
- "\n",
- "class z(Union):\n",
- " _fields_ = [(\"key\", a),\n",
- " (\"data\", b)]\n",
- "strange = z()\n",
- "strange.key.i=512\n",
- "strange.data.d[0]=0\n",
- "strange.data.d[1]=32\n",
- "print strange.key.i\n",
- "print strange.data.j\n",
- "print strange.key.c[0]\n",
- "print strange.data.d[0]\n",
- "print strange.key.c[1]\n",
- "print strange.data.d[1]"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "512\n",
- "512\n",
- "0\n",
- "0\n",
- "32\n",
- "32\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:494-495"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Utility of Unions\n",
- "from ctypes import *\n",
- "class info1(Structure):\n",
- " _fields_ = [(\"hobby\", c_byte*10),\n",
- " (\"crcardno\", c_short)]\n",
- "\n",
- "class info2(Structure):\n",
- " _fields_ = [(\"vehno\", c_byte*10),\n",
- " (\"dist\", c_short)]\n",
- "\n",
- "class info(Union):\n",
- " _fields_ = [(\"a\", info1),\n",
- " (\"b\", info2)]\n",
- "class emp(Structure):\n",
- " _fields_ = [(\"n\", c_byte*20),\n",
- " (\"grade\", c_byte*4),\n",
- " (\"age\", c_short),\n",
- " (\"f\", info)]\n",
- "e=emp()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [],
- "prompt_number": 3
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:831402bdcf6a50366e6a400bf971e09b25983de0ebf01458d42a693aa22990c1"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 15: MISCELLANEOUS FEATURES"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:473-474"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def emp_dept(*sequential, **named): #definition of enumeration\n",
+ " enums = dict(zip(sequential, range(len(sequential))), **named)\n",
+ " return type('Enum', (), enums)\n",
+ "class employee(): #structure\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "department=emp_dept('assembly','manufacturing','accounts','stores') #defining a variable of type enum emp_dept\n",
+ "e=employee(name=\"Lothar Mattheus\",age=28,bs=5575.50,department=department.manufacturing)\n",
+ "print \"Name=%s\\n\" % (e.name)\n",
+ "print \"Age=%d\\n\" % (e.age)\n",
+ "print \"Basic salary=%f\\n\" % (e.bs)\n",
+ "print \"Dept=%d\\n\" % (e.department)\n",
+ "if e.department==department.accounts:\n",
+ " print \"%s is an accountant\\n\" % (e.name)\n",
+ "else:\n",
+ " print \"%s is not an accountant\\n\" % (e.name)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Name=Lothar Mattheus\n",
+ "\n",
+ "Age=28\n",
+ "\n",
+ "Basic salary=5575.500000\n",
+ "\n",
+ "Dept=1\n",
+ "\n",
+ "Lothar Mattheus is not an accountant\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:475"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def ASSEMBLY():\n",
+ " return 0\n",
+ "def MANUFACTURING():\n",
+ " return 1\n",
+ "def ACCOUNTS():\n",
+ " return 2\n",
+ "def STORES():\n",
+ " return 3\n",
+ "class employee():\n",
+ " def __init__(self,**kwds):\n",
+ " self.__dict__.update(kwds)\n",
+ "e=employee()\n",
+ "e.name=\"Lothar Mattheus\"\n",
+ "e.age=28\n",
+ "e.bs=5575.50\n",
+ "e.department=MANUFACTURING()\n",
+ "print \"Name=%s\\n\" % (e.name)\n",
+ "print \"Age=%d\\n\" % (e.age)\n",
+ "print \"Basic salary=%f\\n\" % (e.bs)\n",
+ "print \"Dept=%d\\n\" % (e.department)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Name=Lothar Mattheus\n",
+ "\n",
+ "Age=28\n",
+ "\n",
+ "Basic salary=5575.500000\n",
+ "\n",
+ "Dept=1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:477-478"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "x=6\n",
+ "y=4\n",
+ "a=x/y #int\n",
+ "print \"Value of a=%f\\n\" % (a)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of a=1.000000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:478"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "x=6\n",
+ "y=4\n",
+ "a=float(x)/y #float\n",
+ "print \"Value of a=%f\\n\" % (a)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of a=1.500000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:478-479"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "a=6.35\n",
+ "print \"Value of a on type casting=%d\\n\" % (int(a)) #converts float to int\n",
+ "print \"Value of a=%f\\n\" % (a) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of a on type casting=6\n",
+ "\n",
+ "Value of a=6.350000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:480"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "from ctypes import *\n",
+ "def MALE():\n",
+ " return 0\n",
+ "def FEMALE():\n",
+ " return 1\n",
+ "def SINGLE():\n",
+ " return 0\n",
+ "def MARRIED():\n",
+ " return 1\n",
+ "def DIVORCED():\n",
+ " return 2\n",
+ "def WIDOWED():\n",
+ " return 3\n",
+ "class employee(Structure):\n",
+ " _fields_= [(\"gender\",c_short, 1), #1 bit size for storage\n",
+ " (\"mar_stat\", c_short, 2), #2 bit size for storage\n",
+ " (\"hobby\",c_short, 3), #3 bit size for storage\n",
+ " (\"scheme\",c_short, 4)] #4 bit size for storage\n",
+ "e=employee()\n",
+ "e.gender=MALE()\n",
+ "e.mar_status=DIVORCED()\n",
+ "e.hobby=5\n",
+ "e.scheme=9\n",
+ "print \"Gender=%d\\n\" % (e.gender)\n",
+ "print \"Marital status=%d\\n\" % (e.mar_status)\n",
+ "import ctypes\n",
+ "print \"Bytes occupied by e=%d\\n\" % (ctypes.sizeof(e))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Gender=0\n",
+ "\n",
+ "Marital status=2\n",
+ "\n",
+ "Bytes occupied by e=2\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:481"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def display():\n",
+ " print \"Long live viruses!!\\n\"\n",
+ "print \"Address of function display is %s\\n\" % (display)\n",
+ "display()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Address of function display is <function display at 0x02D93DF0>\n",
+ "\n",
+ "Long live viruses!!\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:481-482"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def display():\n",
+ " print \"\\nLong live viruses!!\"\n",
+ "func_ptr=display\n",
+ "print \"Address of function display is %s\\n\" % (display)\n",
+ "func_ptr()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Address of function display is <function display at 0x05696730>\n",
+ "\n",
+ "\n",
+ "Long live viruses!!\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:483"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def fun():\n",
+ " i=20\n",
+ " return (id(i))\n",
+ "p=fun\n",
+ "p()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 9,
+ "text": [
+ "20688356"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:483-484"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def copy(t,s):\n",
+ " t=\"\\0\"\n",
+ " for item in s:\n",
+ " t=t+item\n",
+ " return t\n",
+ "source=\"Jaded\"\n",
+ "target=[]\n",
+ "str1=copy(target,source)\n",
+ "print \"%s\\n\" % (str1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\u0000Jaded\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:485"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def findmax(tot_num,*num): #tuples\n",
+ " max=0\n",
+ " for count in range(0,len(num),1):\n",
+ " if num[count]>max:\n",
+ " max=num[count]\n",
+ " return max\n",
+ "max=findmax(5,23,15,1,92,50)\n",
+ "print \"maximum=%d\\n\" % (max)\n",
+ "max=findmax(3,100,300,29)\n",
+ "print \"maximum=%d\\n\" % (max)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "maximum=92\n",
+ "\n",
+ "maximum=300\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:486-487"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def display(type,num,*t):\n",
+ " def integer():\n",
+ " for j in range(0,num,1):\n",
+ " print \"%d\" % (t[j])\n",
+ " def char():\n",
+ " for j in range(0,num,1):\n",
+ " print \"%c\" % (t[j])\n",
+ " def floating():\n",
+ " for j in range(0,num,1):\n",
+ " print \"%f\" % (t[j])\n",
+ " def switch(ch):\n",
+ " return {1: integer,\n",
+ " 2: char,\n",
+ " 3: floating,\n",
+ " }[ch]()\n",
+ " switch(type)\n",
+ "display(1,2,5,6)\n",
+ "display(2,4,'A','a','b','c')\n",
+ "display(3,3,2.5,299.3,-1.0)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n",
+ "6\n",
+ "A\n",
+ "a\n",
+ "b\n",
+ "c\n",
+ "2.500000\n",
+ "299.300000\n",
+ "-1.000000\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "from ctypes import *\n",
+ "class a(Union): #definition of union\n",
+ " _fields_= [(\"i\", c_short),\n",
+ " (\"ch\",c_byte*2)]\n",
+ "key=a()\n",
+ "key.i=512\n",
+ "print key.i\n",
+ "print key.ch[0]\n",
+ "print key.ch[1]"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "512\n",
+ "0\n",
+ "2\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:491"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "from ctypes import *\n",
+ "class a(Union):\n",
+ " _fields_= [(\"i\", c_short),\n",
+ " (\"ch\",c_byte*2)]\n",
+ "key=a()\n",
+ "key.i=512\n",
+ "print key.i\n",
+ "print key.ch[0]\n",
+ "print key.ch[1]\n",
+ "key.ch[0]=50\n",
+ "print key.i\n",
+ "print key.ch[0]\n",
+ "print key.ch[1]"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "512\n",
+ "0\n",
+ "2\n",
+ "562\n",
+ "50\n",
+ "2\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:492-493"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "from ctypes import *\n",
+ "class a(Structure):\n",
+ " _fields_ = [(\"i\", c_short),\n",
+ " (\"c\", c_byte*2)]\n",
+ "\n",
+ "class b(Structure):\n",
+ " _fields_ = [(\"j\", c_short),\n",
+ " (\"d\", c_byte*2)]\n",
+ "\n",
+ "class z(Union):\n",
+ " _fields_ = [(\"key\", a),\n",
+ " (\"data\", b)]\n",
+ "strange = z()\n",
+ "strange.key.i=512\n",
+ "strange.data.d[0]=0\n",
+ "strange.data.d[1]=32\n",
+ "print strange.key.i\n",
+ "print strange.data.j\n",
+ "print strange.key.c[0]\n",
+ "print strange.data.d[0]\n",
+ "print strange.key.c[1]\n",
+ "print strange.data.d[1]"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "512\n",
+ "512\n",
+ "0\n",
+ "0\n",
+ "32\n",
+ "32\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:494-495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "from ctypes import *\n",
+ "class info1(Structure):\n",
+ " _fields_ = [(\"hobby\", c_byte*10),\n",
+ " (\"crcardno\", c_short)]\n",
+ "\n",
+ "class info2(Structure):\n",
+ " _fields_ = [(\"vehno\", c_byte*10),\n",
+ " (\"dist\", c_short)]\n",
+ "\n",
+ "class info(Union):\n",
+ " _fields_ = [(\"a\", info1),\n",
+ " (\"b\", info2)]\n",
+ "class emp(Structure):\n",
+ " _fields_ = [(\"n\", c_byte*20),\n",
+ " (\"grade\", c_byte*4),\n",
+ " (\"age\", c_short),\n",
+ " (\"f\", info)]\n",
+ "e=emp()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter2.ipynb b/ANSI_C_Programming/chapter2.ipynb
index 255326b2..644241bb 100644
--- a/ANSI_C_Programming/chapter2.ipynb
+++ b/ANSI_C_Programming/chapter2.ipynb
@@ -1,782 +1,783 @@
-{
- "metadata": {
- "name": "chapter2.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 2: THE DECISION CONTROL STRUCTURE"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE-45"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Demonstration of if statement\n",
- "print \"Enter a number less than 10\"\n",
- "num=eval(raw_input()) #Inputs float variables #you can also input float variables using input()\n",
- "if num<10:\n",
- " print \"What an obedient servant you are !\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter a number less than 10\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "What an obedient servant you are !\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.1: Page-47"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculation of total expenses\n",
- "print \"Enter quantity and rate\"\n",
- "qty=eval(raw_input()) #Inputs float variables\n",
- "rate=eval(raw_input())\n",
- "dis=0\n",
- "if qty>1000:\n",
- " dis=10\n",
- "tot=(qty*rate)-(qty*rate*dis/100)\n",
- "print \"Total expenses=Rs.\" ,tot"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter quantity and rate\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1200\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "15.50\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Total expenses=Rs. 16740.0\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.2: Page-49"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculation of bonus\n",
- "print \"Enter current year and year of joining\"\n",
- "cy=eval(raw_input())\n",
- "yoj=eval(raw_input())\n",
- "yos=cy-yoj\n",
- "if yos>3:\n",
- " bonus=2500\n",
- " print \"Bonus=Rs.\" ,bonus"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter current year and year of joining\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2014\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2009\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Bonus=Rs. 2500\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.3: Page-51"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculation of gross salary\n",
- "print \"Enter basic salary\"\n",
- "bs=eval(raw_input())\n",
- "if bs<1500:\n",
- " hra=bs*10/100\n",
- " da=bs*90/100\n",
- "else:\n",
- " hra=500\n",
- " da=bs*98/100\n",
- "gs=bs+hra+da\n",
- "print \"gross salary=Rs.\" ,gs"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter basic salary\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1000\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "gross salary=Rs. 2000\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON Page-53"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#A quick demo of nested if-else\n",
- "print \"Enter either 1 or 2\"\n",
- "i=eval(raw_input())\n",
- "if i==1:\n",
- " print \"You would go to heaven !\\n\"\n",
- "else:\n",
- " if i==2:\n",
- " print \"Hell was created with you in mind\\n\"\n",
- " else:\n",
- " print \"How about mother earth !\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter either 1 or 2\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "How about mother earth !\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.4: Page-55-56"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Method-I: program using nested if-else to find division of student\n",
- "print \"Enter marks in five subjects\"\n",
- "m1=eval(raw_input())\n",
- "m2=eval(raw_input())\n",
- "m3=eval(raw_input())\n",
- "m4=eval(raw_input())\n",
- "m5=eval(raw_input())\n",
- "per=(m1+m2+m3+m4+m5)*100/500\n",
- "if per>=60:\n",
- " print \"First division\\n\"\n",
- "else:\n",
- " if per>=50:\n",
- " print \"Second division\\n\"\n",
- " else:\n",
- " if per>=40:\n",
- " print \"Third division\\n\"\n",
- " else:\n",
- " print \"Fail\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks in five subjects\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "70\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "87\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "91\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "91\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "98\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "First division\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON Page-56-57"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Method-II: program using if statement to find division of student\n",
- "print \"Enter marks in five subjects\"\n",
- "m1=eval(raw_input())\n",
- "m2=eval(raw_input())\n",
- "m3=eval(raw_input())\n",
- "m4=eval(raw_input())\n",
- "m5=eval(raw_input())\n",
- "per=(m1+m2+m3+m4+m5)*100/500\n",
- "if per>=60:\n",
- " print \"First division\\n\"\n",
- "if per>=50 and per<60:\n",
- " print \"Second division\\n\"\n",
- "if per>=40 and per<50:\n",
- " print \"Third division\\n\"\n",
- "if per<40:\n",
- " print \"Fail\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks in five subjects\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "70\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "87\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "91\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "91\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "98\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "First division\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON Page-58"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#else if ladder demo\n",
- "print \"Enter marks in five subjects\"\n",
- "m1=eval(raw_input())\n",
- "m2=eval(raw_input())\n",
- "m3=eval(raw_input())\n",
- "m4=eval(raw_input())\n",
- "m5=eval(raw_input())\n",
- "per=(m1+m2+m3+m4+m5)*100/500\n",
- "if per>=60:\n",
- " print \"First division\\n\"\n",
- "elif per>=50:\n",
- " print \"Second division\\n\"\n",
- "elif per>=40:\n",
- " print \"Third division\\n\"\n",
- "else:\n",
- " print \"fail\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks in five subjects\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "70\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "87\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "91\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "91\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "98\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "First division\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.5: Page-59"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Insurance of driver-without using logical operators\n",
- "print \"Enter age,sex,marital status\"\n",
- "age=eval(raw_input())\n",
- "sex=raw_input() #Inputs string variables i,e; we can't use these variables in calculations\n",
- "ms=raw_input() #Inputs string variables\n",
- "if ms=='M':\n",
- " print \"Driver is insured\\n\"\n",
- "else:\n",
- " if sex=='M':\n",
- " if age>30:\n",
- " print \"Driver is insured\\n\"\n",
- " else:\n",
- " print \"Driver is not insured\\n\"\n",
- " else:\n",
- " if age>25:\n",
- " print \"Driver is insured\\n\"\n",
- " else:\n",
- " print \"Driver is not insured\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter age,sex,marital status\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "20\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "M\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "U\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Driver is not insured\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON Page-60"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Insurance of driver-using logical operators\n",
- "print \"Enter age,sex,marital status\"\n",
- "age=eval(raw_input())\n",
- "sex=raw_input()\n",
- "ms=raw_input()\n",
- "if (ms=='M') or (ms=='U' and sex=='M' and age>30) or (ms=='U' and sex=='F' and age>25):\n",
- " print \"Driver is insured\\n\"\n",
- "else:\n",
- " print \"Driver is not insured\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter age,sex,marital status\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "20\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "M\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "U\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Driver is not insured\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.6: Page-61-62"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate the salary\n",
- "print \"Enter Gender,Years of Service and Qualifications(0=G,1=PG):\"\n",
- "g=raw_input()\n",
- "yos=eval(raw_input())\n",
- "qual=eval(raw_input())\n",
- "sal=0\n",
- "if g=='m' and yos>=10 and qual==1:\n",
- " sal=15000\n",
- "elif (g=='m' and yos>=10 and qual==0) or (g=='m' and yos<10 and qual==1):\n",
- " sal=10000\n",
- "elif g=='m' and yos<10 and qual==0:\n",
- " sal=7000\n",
- "elif g=='f' and yos>=10 and qual==1:\n",
- " sal=12000\n",
- "elif g=='f' and yos>=10 and qual==0:\n",
- " sal=9000\n",
- "elif g=='f' and yos<10 and qual==1:\n",
- " sal=10000\n",
- "elif g=='f' and yos<10 and qual==0:\n",
- " sal=6000\n",
- "print \"\\nSalary of Employee=\" ,sal"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter Gender,Years of Service and Qualifications(0=G,1=PG):\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "m\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "0\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "Salary of Employee= 7000\n"
- ]
- }
- ],
- "prompt_number": 12
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:6a166cd5bc555687c7e5271b8e9483765eadd38f5e9c5bfca7169a4ded24b03b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 2: THE DECISION CONTROL STRUCTURE"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE-45"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter a number less than 10\"\n",
+ "num=eval(raw_input()) #Inputs float variables #you can also input float variables using input()\n",
+ "if num<10:\n",
+ " print \"What an obedient servant you are !\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number less than 10\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "What an obedient servant you are !\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.1: Page-47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter quantity and rate\"\n",
+ "qty=eval(raw_input()) #Inputs float variables\n",
+ "rate=eval(raw_input())\n",
+ "dis=0\n",
+ "if qty>1000:\n",
+ " dis=10\n",
+ "tot=(qty*rate)-(qty*rate*dis/100)\n",
+ "print \"Total expenses=Rs.\" ,tot"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter quantity and rate\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1200\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "15.50\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total expenses=Rs. 16740.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.2: Page-49"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter current year and year of joining\"\n",
+ "cy=eval(raw_input())\n",
+ "yoj=eval(raw_input())\n",
+ "yos=cy-yoj\n",
+ "if yos>3:\n",
+ " bonus=2500\n",
+ " print \"Bonus=Rs.\" ,bonus"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter current year and year of joining\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2014\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2009\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Bonus=Rs. 2500\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.3: Page-51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter basic salary\"\n",
+ "bs=eval(raw_input())\n",
+ "if bs<1500:\n",
+ " hra=bs*10/100\n",
+ " da=bs*90/100\n",
+ "else:\n",
+ " hra=500\n",
+ " da=bs*98/100\n",
+ "gs=bs+hra+da\n",
+ "print \"gross salary=Rs.\" ,gs"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter basic salary\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1000\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "gross salary=Rs. 2000\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON Page-53"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter either 1 or 2\"\n",
+ "i=eval(raw_input())\n",
+ "if i==1:\n",
+ " print \"You would go to heaven !\\n\"\n",
+ "else:\n",
+ " if i==2:\n",
+ " print \"Hell was created with you in mind\\n\"\n",
+ " else:\n",
+ " print \"How about mother earth !\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter either 1 or 2\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "How about mother earth !\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.4: Page-55-56"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter marks in five subjects\"\n",
+ "m1=eval(raw_input())\n",
+ "m2=eval(raw_input())\n",
+ "m3=eval(raw_input())\n",
+ "m4=eval(raw_input())\n",
+ "m5=eval(raw_input())\n",
+ "per=(m1+m2+m3+m4+m5)*100/500\n",
+ "if per>=60:\n",
+ " print \"First division\\n\"\n",
+ "else:\n",
+ " if per>=50:\n",
+ " print \"Second division\\n\"\n",
+ " else:\n",
+ " if per>=40:\n",
+ " print \"Third division\\n\"\n",
+ " else:\n",
+ " print \"Fail\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks in five subjects\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "70\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "87\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "91\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "91\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "98\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "First division\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON Page-56-57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter marks in five subjects\"\n",
+ "m1=eval(raw_input())\n",
+ "m2=eval(raw_input())\n",
+ "m3=eval(raw_input())\n",
+ "m4=eval(raw_input())\n",
+ "m5=eval(raw_input())\n",
+ "per=(m1+m2+m3+m4+m5)*100/500\n",
+ "if per>=60:\n",
+ " print \"First division\\n\"\n",
+ "if per>=50 and per<60:\n",
+ " print \"Second division\\n\"\n",
+ "if per>=40 and per<50:\n",
+ " print \"Third division\\n\"\n",
+ "if per<40:\n",
+ " print \"Fail\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks in five subjects\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "70\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "87\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "91\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "91\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "98\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "First division\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON Page-58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter marks in five subjects\"\n",
+ "m1=eval(raw_input())\n",
+ "m2=eval(raw_input())\n",
+ "m3=eval(raw_input())\n",
+ "m4=eval(raw_input())\n",
+ "m5=eval(raw_input())\n",
+ "per=(m1+m2+m3+m4+m5)*100/500\n",
+ "if per>=60:\n",
+ " print \"First division\\n\"\n",
+ "elif per>=50:\n",
+ " print \"Second division\\n\"\n",
+ "elif per>=40:\n",
+ " print \"Third division\\n\"\n",
+ "else:\n",
+ " print \"fail\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks in five subjects\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "70\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "87\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "91\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "91\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "98\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "First division\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.5: Page-59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter age,sex,marital status\"\n",
+ "age=eval(raw_input())\n",
+ "sex=raw_input() #Inputs string variables i,e; we can't use these variables in calculations\n",
+ "ms=raw_input() #Inputs string variables\n",
+ "if ms=='M':\n",
+ " print \"Driver is insured\\n\"\n",
+ "else:\n",
+ " if sex=='M':\n",
+ " if age>30:\n",
+ " print \"Driver is insured\\n\"\n",
+ " else:\n",
+ " print \"Driver is not insured\\n\"\n",
+ " else:\n",
+ " if age>25:\n",
+ " print \"Driver is insured\\n\"\n",
+ " else:\n",
+ " print \"Driver is not insured\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter age,sex,marital status\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "20\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "M\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "U\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Driver is not insured\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON Page-60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter age,sex,marital status\"\n",
+ "age=eval(raw_input())\n",
+ "sex=raw_input()\n",
+ "ms=raw_input()\n",
+ "if (ms=='M') or (ms=='U' and sex=='M' and age>30) or (ms=='U' and sex=='F' and age>25):\n",
+ " print \"Driver is insured\\n\"\n",
+ "else:\n",
+ " print \"Driver is not insured\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter age,sex,marital status\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "20\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "M\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "U\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Driver is not insured\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.6: Page-61-62"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter Gender,Years of Service and Qualifications(0=G,1=PG):\"\n",
+ "g=raw_input()\n",
+ "yos=eval(raw_input())\n",
+ "qual=eval(raw_input())\n",
+ "sal=0\n",
+ "if g=='m' and yos>=10 and qual==1:\n",
+ " sal=15000\n",
+ "elif (g=='m' and yos>=10 and qual==0) or (g=='m' and yos<10 and qual==1):\n",
+ " sal=10000\n",
+ "elif g=='m' and yos<10 and qual==0:\n",
+ " sal=7000\n",
+ "elif g=='f' and yos>=10 and qual==1:\n",
+ " sal=12000\n",
+ "elif g=='f' and yos>=10 and qual==0:\n",
+ " sal=9000\n",
+ "elif g=='f' and yos<10 and qual==1:\n",
+ " sal=10000\n",
+ "elif g=='f' and yos<10 and qual==0:\n",
+ " sal=6000\n",
+ "print \"\\nSalary of Employee=\" ,sal"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter Gender,Years of Service and Qualifications(0=G,1=PG):\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "m\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "Salary of Employee= 7000\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter3.ipynb b/ANSI_C_Programming/chapter3.ipynb
index 18b9c2f4..24b5eb3a 100644
--- a/ANSI_C_Programming/chapter3.ipynb
+++ b/ANSI_C_Programming/chapter3.ipynb
@@ -1,1590 +1,1590 @@
-{
- "metadata": {
- "name": "chapter3.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 3: THE LOOP CONTROL STRUCTURE"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:89-90"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculation of simple interest for 3 sets of p,n and r\n",
- "count=1\n",
- "while count<=3: #while loop codition check\n",
- " print \"Enter values of p,n and r\"\n",
- " p=eval(raw_input())\n",
- " n=eval(raw_input())\n",
- " r=eval(raw_input())\n",
- " si=p*n*r/100\n",
- " print \"Simple interest=Rs.%f\" % (si)\n",
- " count=count+1 #increment"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter values of p,n and r\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1000\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "13.5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Simple interest=Rs.675.000000\n",
- "Enter values of p,n and r\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2000\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "13.5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Simple interest=Rs.1350.000000\n",
- "Enter values of p,n and r\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3500\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3.5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Simple interest=Rs.612.500000\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:92"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#a program for indefinite loop\n",
- "i=1\n",
- "while i<=10:\n",
- " print \"%d\\n\" % (i) #there is no increment/decrement thats why indefinite loop"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:93"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing numbers from 1 to 10\n",
- "i=1\n",
- "while i<=10:\n",
- " print \"\\n\" ,i\n",
- " i=i+1"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "1\n",
- "\n",
- "2\n",
- "\n",
- "3\n",
- "\n",
- "4\n",
- "\n",
- "5\n",
- "\n",
- "6\n",
- "\n",
- "7\n",
- "\n",
- "8\n",
- "\n",
- "9\n",
- "\n",
- "10\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:93"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing a message repeatedly\n",
- "i=5\n",
- "while i>=1:\n",
- " print \"Make the computer literate!\\n\"\n",
- " i=i-1"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Make the computer literate!\n",
- "\n",
- "Make the computer literate!\n",
- "\n",
- "Make the computer literate!\n",
- "\n",
- "Make the computer literate!\n",
- "\n",
- "Make the computer literate!\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:93"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing a message repeatedly by taking float loop counter\n",
- "a=10.0\n",
- "while a<=10.5:\n",
- " print \"Raindrops on roses...\"\n",
- " print \"...and whiskers on kittens\\n\"\n",
- " a=a+0.1"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Raindrops on roses...\n",
- "...and whiskers on kittens\n",
- "\n",
- "Raindrops on roses...\n",
- "...and whiskers on kittens\n",
- "\n",
- "Raindrops on roses...\n",
- "...and whiskers on kittens\n",
- "\n",
- "Raindrops on roses...\n",
- "...and whiskers on kittens\n",
- "\n",
- "Raindrops on roses...\n",
- "...and whiskers on kittens\n",
- "\n",
- "Raindrops on roses...\n",
- "...and whiskers on kittens\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:94"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#This is not indefinite loop in python because range of int in python is larger than 32767\n",
- "i=1\n",
- "while i<=32767: #print numbers from 1 to 32767\n",
- " print \"%d\\n\" ,i \n",
- " i=i+1"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:95"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Method 1:print numbers from 1 to 10\n",
- "i=1 \n",
- "while i<=10:\n",
- " print i\n",
- " i=i+1"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n",
- "2\n",
- "3\n",
- "4\n",
- "5\n",
- "6\n",
- "7\n",
- "8\n",
- "9\n",
- "10\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:96"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Method 2:print numbers from 1 to 10\n",
- "i=1\n",
- "while i<=10:\n",
- " print \"\\n\" ,i\n",
- " i+=1 #increment short hand operator"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "1\n",
- "\n",
- "2\n",
- "\n",
- "3\n",
- "\n",
- "4\n",
- "\n",
- "5\n",
- "\n",
- "6\n",
- "\n",
- "7\n",
- "\n",
- "8\n",
- "\n",
- "9\n",
- "\n",
- "10\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:98"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculation of simple interest for 3 sets of p,n and r using \"for loop\"\n",
- "for count in range(1,4,1): #for loop\n",
- " print \"Enter values of p,n and r\"\n",
- " p=eval(raw_input())\n",
- " n=eval(raw_input())\n",
- " r=eval(raw_input())\n",
- " si=p*n*r/100\n",
- " print \"Simple Interest=Rs.%f\" % (si)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter values of p,n and r\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1000\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "13.5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Simple Interest=Rs.675.000000\n",
- "Enter values of p,n and r\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2000\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "13.5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Simple Interest=Rs.1350.000000\n",
- "Enter values of p,n and r\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3500\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3.5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Simple Interest=Rs.612.500000\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:101"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#print numbers from 1 to 10 using for loop\n",
- "for i in range(1,11,1):\n",
- " print \"%d\\n\" % (i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n",
- "\n",
- "2\n",
- "\n",
- "3\n",
- "\n",
- "4\n",
- "\n",
- "5\n",
- "\n",
- "6\n",
- "\n",
- "7\n",
- "\n",
- "8\n",
- "\n",
- "9\n",
- "\n",
- "10\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:101"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#print numbers from 1 to 10 with incrementation in the body\n",
- "for i in range(1,11):\n",
- " print \"\\n\" ,i\n",
- " i=i+1"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "1\n",
- "\n",
- "2\n",
- "\n",
- "3\n",
- "\n",
- "4\n",
- "\n",
- "5\n",
- "\n",
- "6\n",
- "\n",
- "7\n",
- "\n",
- "8\n",
- "\n",
- "9\n",
- "\n",
- "10\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:101"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#print numbers from 1 to 10 with initialisation above for loop\n",
- "i=1\n",
- "for i in range(i,11,1):\n",
- " print \"%d\\n\" % (i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n",
- "\n",
- "2\n",
- "\n",
- "3\n",
- "\n",
- "4\n",
- "\n",
- "5\n",
- "\n",
- "6\n",
- "\n",
- "7\n",
- "\n",
- "8\n",
- "\n",
- "9\n",
- "\n",
- "10\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:102"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#print 1 to 10 with initialisation above for loop and incrementation in the body\n",
- "i=1\n",
- "for i in range(i,11):\n",
- " print \"%d\\n\" % (i)\n",
- " i=i+1"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n",
- "\n",
- "2\n",
- "\n",
- "3\n",
- "\n",
- "4\n",
- "\n",
- "5\n",
- "\n",
- "6\n",
- "\n",
- "7\n",
- "\n",
- "8\n",
- "\n",
- "9\n",
- "\n",
- "10\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:103"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Demonstration of nested loops\n",
- "for r in range(1,4,1): #outer loop\n",
- " for c in range(1,3,1): #inner loop \n",
- " sum=r+c\n",
- " print \"r=%d c=%d sum=%d\\n\" % (r,c,sum)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "r=1 c=1 sum=2\n",
- "\n",
- "r=1 c=2 sum=3\n",
- "\n",
- "r=2 c=1 sum=3\n",
- "\n",
- "r=2 c=2 sum=4\n",
- "\n",
- "r=3 c=1 sum=4\n",
- "\n",
- "r=3 c=2 sum=5\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:104-105"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Execution of a loop an unknown number of times\n",
- "#Implementing do-while loop using while loop\n",
- "while(1): #do-while loop is not present in python\n",
- " print \"Enter a number\"\n",
- " num=eval(raw_input())\n",
- " print \"square of %d is %d\\n\" % (num,num*num)\n",
- " print \"Want to enter another number y/n\"\n",
- " another=raw_input()\n",
- " if(another!='y'):\n",
- " break"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter a number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "square of 5 is 25\n",
- "\n",
- "Want to enter another number y/n\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "y\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter a number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "7\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "square of 7 is 49\n",
- "\n",
- "Want to enter another number y/n\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "n\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:105"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#odd loop using a for loop\n",
- "another='y'\n",
- "for i in range(1,1000): #check if another is in word\n",
- " if another=='y':\n",
- " print \"Enter a number\"\n",
- " num=eval(raw_input())\n",
- " print \"square of %d is %d\\n\" % (num,num*num)\n",
- " print \"Want to enter another number y/n\"\n",
- " another=raw_input()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter a number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "square of 5 is 25\n",
- "\n",
- "Want to enter another number y/n\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "y\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter a number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "7\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "square of 7 is 49\n",
- "\n",
- "Want to enter another number y/n\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "n\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:105-106"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#odd loop using a while loop\n",
- "another='y'\n",
- "while(another=='y'):\n",
- " print \"Enter a number\"\n",
- " num=eval(raw_input())\n",
- " print \"square of %d is %d\\n\" % (num,num*num)\n",
- " print \"Want to enter another number y/n\"\n",
- " another=raw_input()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter a number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "square of 5 is 25\n",
- "\n",
- "Want to enter another number y/n\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "y\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter a number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "7\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "square of 7 is 49\n",
- "\n",
- "Want to enter another number y/n\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "n\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:106"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Program to check prime number using break in while loop\n",
- "print \"Enter a number\"\n",
- "num=eval(raw_input())\n",
- "i=2\n",
- "while i<=num-1:\n",
- " if num%i==0:\n",
- " print \"Not a prime number\\n\"\n",
- " break #exit the loop\n",
- " i+=1\n",
- "if i==num:\n",
- " print \"Prime number\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter a number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "11\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Prime number\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:107"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program using break statement\n",
- "i=1\n",
- "j=1\n",
- "while (i<=100):\n",
- " i+=1\n",
- " while (j<=200):\n",
- " j+=1\n",
- " if (j==150):\n",
- " break #it will terminate the inner loop only\n",
- " else:\n",
- " print \"%d %d\\n\" % (i,j)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2 2\n",
- "\n",
- "2 3\n",
- "\n",
- "2 4\n",
- "\n",
- "2 5\n",
- "\n",
- "2 6\n",
- "\n",
- "2 7\n",
- "\n",
- "2 8\n",
- "\n",
- "2 9\n",
- "\n",
- "2 10\n",
- "\n",
- "2 11\n",
- "\n",
- "2 12\n",
- "\n",
- "2 13\n",
- "\n",
- "2 14\n",
- "\n",
- "2 15\n",
- "\n",
- "2 16\n",
- "\n",
- "2 17\n",
- "\n",
- "2 18\n",
- "\n",
- "2 19\n",
- "\n",
- "2 20\n",
- "\n",
- "2 21\n",
- "\n",
- "2 22\n",
- "\n",
- "2 23\n",
- "\n",
- "2 24\n",
- "\n",
- "2 25\n",
- "\n",
- "2 26\n",
- "\n",
- "2 27\n",
- "\n",
- "2 28\n",
- "\n",
- "2 29\n",
- "\n",
- "2 30\n",
- "\n",
- "2 31\n",
- "\n",
- "2 32\n",
- "\n",
- "2 33\n",
- "\n",
- "2 34\n",
- "\n",
- "2 35\n",
- "\n",
- "2 36\n",
- "\n",
- "2 37\n",
- "\n",
- "2 38\n",
- "\n",
- "2 39\n",
- "\n",
- "2 40\n",
- "\n",
- "2 41\n",
- "\n",
- "2 42\n",
- "\n",
- "2 43\n",
- "\n",
- "2 44\n",
- "\n",
- "2 45\n",
- "\n",
- "2 46\n",
- "\n",
- "2 47\n",
- "\n",
- "2 48\n",
- "\n",
- "2 49\n",
- "\n",
- "2 50\n",
- "\n",
- "2 51\n",
- "\n",
- "2 52\n",
- "\n",
- "2 53\n",
- "\n",
- "2 54\n",
- "\n",
- "2 55\n",
- "\n",
- "2 56\n",
- "\n",
- "2 57\n",
- "\n",
- "2 58\n",
- "\n",
- "2 59\n",
- "\n",
- "2 60\n",
- "\n",
- "2 61\n",
- "\n",
- "2 62\n",
- "\n",
- "2 63\n",
- "\n",
- "2 64\n",
- "\n",
- "2 65\n",
- "\n",
- "2 66\n",
- "\n",
- "2 67\n",
- "\n",
- "2 68\n",
- "\n",
- "2 69\n",
- "\n",
- "2 70\n",
- "\n",
- "2 71\n",
- "\n",
- "2 72\n",
- "\n",
- "2 73\n",
- "\n",
- "2 74\n",
- "\n",
- "2 75\n",
- "\n",
- "2 76\n",
- "\n",
- "2 77\n",
- "\n",
- "2 78\n",
- "\n",
- "2 79\n",
- "\n",
- "2 80\n",
- "\n",
- "2 81\n",
- "\n",
- "2 82\n",
- "\n",
- "2 83\n",
- "\n",
- "2 84\n",
- "\n",
- "2 85\n",
- "\n",
- "2 86\n",
- "\n",
- "2 87\n",
- "\n",
- "2 88\n",
- "\n",
- "2 89\n",
- "\n",
- "2 90\n",
- "\n",
- "2 91\n",
- "\n",
- "2 92\n",
- "\n",
- "2 93\n",
- "\n",
- "2 94\n",
- "\n",
- "2 95\n",
- "\n",
- "2 96\n",
- "\n",
- "2 97\n",
- "\n",
- "2 98\n",
- "\n",
- "2 99\n",
- "\n",
- "2 100\n",
- "\n",
- "2 101\n",
- "\n",
- "2 102\n",
- "\n",
- "2 103\n",
- "\n",
- "2 104\n",
- "\n",
- "2 105\n",
- "\n",
- "2 106\n",
- "\n",
- "2 107\n",
- "\n",
- "2 108\n",
- "\n",
- "2 109\n",
- "\n",
- "2 110\n",
- "\n",
- "2 111\n",
- "\n",
- "2 112\n",
- "\n",
- "2 113\n",
- "\n",
- "2 114\n",
- "\n",
- "2 115\n",
- "\n",
- "2 116\n",
- "\n",
- "2 117\n",
- "\n",
- "2 118\n",
- "\n",
- "2 119\n",
- "\n",
- "2 120\n",
- "\n",
- "2 121\n",
- "\n",
- "2 122\n",
- "\n",
- "2 123\n",
- "\n",
- "2 124\n",
- "\n",
- "2 125\n",
- "\n",
- "2 126\n",
- "\n",
- "2 127\n",
- "\n",
- "2 128\n",
- "\n",
- "2 129\n",
- "\n",
- "2 130\n",
- "\n",
- "2 131\n",
- "\n",
- "2 132\n",
- "\n",
- "2 133\n",
- "\n",
- "2 134\n",
- "\n",
- "2 135\n",
- "\n",
- "2 136\n",
- "\n",
- "2 137\n",
- "\n",
- "2 138\n",
- "\n",
- "2 139\n",
- "\n",
- "2 140\n",
- "\n",
- "2 141\n",
- "\n",
- "2 142\n",
- "\n",
- "2 143\n",
- "\n",
- "2 144\n",
- "\n",
- "2 145\n",
- "\n",
- "2 146\n",
- "\n",
- "2 147\n",
- "\n",
- "2 148\n",
- "\n",
- "2 149\n",
- "\n",
- "3 151\n",
- "\n",
- "3 152\n",
- "\n",
- "3 153\n",
- "\n",
- "3 154\n",
- "\n",
- "3 155\n",
- "\n",
- "3 156\n",
- "\n",
- "3 157\n",
- "\n",
- "3 158\n",
- "\n",
- "3 159\n",
- "\n",
- "3 160\n",
- "\n",
- "3 161\n",
- "\n",
- "3 162\n",
- "\n",
- "3 163\n",
- "\n",
- "3 164\n",
- "\n",
- "3 165\n",
- "\n",
- "3 166\n",
- "\n",
- "3 167\n",
- "\n",
- "3 168\n",
- "\n",
- "3 169\n",
- "\n",
- "3 170\n",
- "\n",
- "3 171\n",
- "\n",
- "3 172\n",
- "\n",
- "3 173\n",
- "\n",
- "3 174\n",
- "\n",
- "3 175\n",
- "\n",
- "3 176\n",
- "\n",
- "3 177\n",
- "\n",
- "3 178\n",
- "\n",
- "3 179\n",
- "\n",
- "3 180\n",
- "\n",
- "3 181\n",
- "\n",
- "3 182\n",
- "\n",
- "3 183\n",
- "\n",
- "3 184\n",
- "\n",
- "3 185\n",
- "\n",
- "3 186\n",
- "\n",
- "3 187\n",
- "\n",
- "3 188\n",
- "\n",
- "3 189\n",
- "\n",
- "3 190\n",
- "\n",
- "3 191\n",
- "\n",
- "3 192\n",
- "\n",
- "3 193\n",
- "\n",
- "3 194\n",
- "\n",
- "3 195\n",
- "\n",
- "3 196\n",
- "\n",
- "3 197\n",
- "\n",
- "3 198\n",
- "\n",
- "3 199\n",
- "\n",
- "3 200\n",
- "\n",
- "3 201\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:108"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program using continue statement\n",
- "for i in range(1,3,1):\n",
- " for j in range(1,3,1):\n",
- " if i==j:\n",
- " continue #it will again send back to loop without executing succeeding statements\n",
- " print \"%d %d\\n\" % (i,j)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1 2\n",
- "\n",
- "2 1\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 17
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2f63105cbe9f49f191de7b50016730212f162ceb128a95b6bc9a54da3a6efc20"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 3: THE LOOP CONTROL STRUCTURE"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:89-90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "count=1\n",
+ "while count<=3: #while loop codition check\n",
+ " print \"Enter values of p,n and r\"\n",
+ " p=eval(raw_input())\n",
+ " n=eval(raw_input())\n",
+ " r=eval(raw_input())\n",
+ " si=p*n*r/100\n",
+ " print \"Simple interest=Rs.%f\" % (si)\n",
+ " count=count+1 #increment"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter values of p,n and r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1000\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "13.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Simple interest=Rs.675.000000\n",
+ "Enter values of p,n and r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2000\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "13.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Simple interest=Rs.1350.000000\n",
+ "Enter values of p,n and r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3500\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Simple interest=Rs.612.500000\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:92"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=1\n",
+ "while i<=10:\n",
+ " print \"%d\\n\" % (i) #there is no increment/decrement thats why indefinite loop"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=1\n",
+ "while i<=10:\n",
+ " print \"\\n\" ,i\n",
+ " i=i+1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "1\n",
+ "\n",
+ "2\n",
+ "\n",
+ "3\n",
+ "\n",
+ "4\n",
+ "\n",
+ "5\n",
+ "\n",
+ "6\n",
+ "\n",
+ "7\n",
+ "\n",
+ "8\n",
+ "\n",
+ "9\n",
+ "\n",
+ "10\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=5\n",
+ "while i>=1:\n",
+ " print \"Make the computer literate!\\n\"\n",
+ " i=i-1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Make the computer literate!\n",
+ "\n",
+ "Make the computer literate!\n",
+ "\n",
+ "Make the computer literate!\n",
+ "\n",
+ "Make the computer literate!\n",
+ "\n",
+ "Make the computer literate!\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "a=10.0\n",
+ "while a<=10.5:\n",
+ " print \"Raindrops on roses...\"\n",
+ " print \"...and whiskers on kittens\\n\"\n",
+ " a=a+0.1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Raindrops on roses...\n",
+ "...and whiskers on kittens\n",
+ "\n",
+ "Raindrops on roses...\n",
+ "...and whiskers on kittens\n",
+ "\n",
+ "Raindrops on roses...\n",
+ "...and whiskers on kittens\n",
+ "\n",
+ "Raindrops on roses...\n",
+ "...and whiskers on kittens\n",
+ "\n",
+ "Raindrops on roses...\n",
+ "...and whiskers on kittens\n",
+ "\n",
+ "Raindrops on roses...\n",
+ "...and whiskers on kittens\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=1\n",
+ "while i<=32767: #print numbers from 1 to 32767\n",
+ " print \"%d\\n\" ,i \n",
+ " i=i+1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=1 \n",
+ "while i<=10:\n",
+ " print i\n",
+ " i=i+1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "2\n",
+ "3\n",
+ "4\n",
+ "5\n",
+ "6\n",
+ "7\n",
+ "8\n",
+ "9\n",
+ "10\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:96"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=1\n",
+ "while i<=10:\n",
+ " print \"\\n\" ,i\n",
+ " i+=1 #increment short hand operator"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "1\n",
+ "\n",
+ "2\n",
+ "\n",
+ "3\n",
+ "\n",
+ "4\n",
+ "\n",
+ "5\n",
+ "\n",
+ "6\n",
+ "\n",
+ "7\n",
+ "\n",
+ "8\n",
+ "\n",
+ "9\n",
+ "\n",
+ "10\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:98"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for count in range(1,4,1): #for loop\n",
+ " print \"Enter values of p,n and r\"\n",
+ " p=eval(raw_input())\n",
+ " n=eval(raw_input())\n",
+ " r=eval(raw_input())\n",
+ " si=p*n*r/100\n",
+ " print \"Simple Interest=Rs.%f\" % (si)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter values of p,n and r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1000\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "13.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Simple Interest=Rs.675.000000\n",
+ "Enter values of p,n and r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2000\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "13.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Simple Interest=Rs.1350.000000\n",
+ "Enter values of p,n and r\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3500\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Simple Interest=Rs.612.500000\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:101"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for i in range(1,11,1):\n",
+ " print \"%d\\n\" % (i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "\n",
+ "2\n",
+ "\n",
+ "3\n",
+ "\n",
+ "4\n",
+ "\n",
+ "5\n",
+ "\n",
+ "6\n",
+ "\n",
+ "7\n",
+ "\n",
+ "8\n",
+ "\n",
+ "9\n",
+ "\n",
+ "10\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:101"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for i in range(1,11):\n",
+ " print \"\\n\" ,i\n",
+ " i=i+1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "1\n",
+ "\n",
+ "2\n",
+ "\n",
+ "3\n",
+ "\n",
+ "4\n",
+ "\n",
+ "5\n",
+ "\n",
+ "6\n",
+ "\n",
+ "7\n",
+ "\n",
+ "8\n",
+ "\n",
+ "9\n",
+ "\n",
+ "10\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:101"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=1\n",
+ "for i in range(i,11,1):\n",
+ " print \"%d\\n\" % (i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "\n",
+ "2\n",
+ "\n",
+ "3\n",
+ "\n",
+ "4\n",
+ "\n",
+ "5\n",
+ "\n",
+ "6\n",
+ "\n",
+ "7\n",
+ "\n",
+ "8\n",
+ "\n",
+ "9\n",
+ "\n",
+ "10\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:102"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=1\n",
+ "for i in range(i,11):\n",
+ " print \"%d\\n\" % (i)\n",
+ " i=i+1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "\n",
+ "2\n",
+ "\n",
+ "3\n",
+ "\n",
+ "4\n",
+ "\n",
+ "5\n",
+ "\n",
+ "6\n",
+ "\n",
+ "7\n",
+ "\n",
+ "8\n",
+ "\n",
+ "9\n",
+ "\n",
+ "10\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for r in range(1,4,1): #outer loop\n",
+ " for c in range(1,3,1): #inner loop \n",
+ " sum=r+c\n",
+ " print \"r=%d c=%d sum=%d\\n\" % (r,c,sum)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "r=1 c=1 sum=2\n",
+ "\n",
+ "r=1 c=2 sum=3\n",
+ "\n",
+ "r=2 c=1 sum=3\n",
+ "\n",
+ "r=2 c=2 sum=4\n",
+ "\n",
+ "r=3 c=1 sum=4\n",
+ "\n",
+ "r=3 c=2 sum=5\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:104-105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "while(1): #do-while loop is not present in python\n",
+ " print \"Enter a number\"\n",
+ " num=eval(raw_input())\n",
+ " print \"square of %d is %d\\n\" % (num,num*num)\n",
+ " print \"Want to enter another number y/n\"\n",
+ " another=raw_input()\n",
+ " if(another!='y'):\n",
+ " break"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "square of 5 is 25\n",
+ "\n",
+ "Want to enter another number y/n\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "y\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "7\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "square of 7 is 49\n",
+ "\n",
+ "Want to enter another number y/n\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "n\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "another='y'\n",
+ "for i in range(1,1000): #check if another is in word\n",
+ " if another=='y':\n",
+ " print \"Enter a number\"\n",
+ " num=eval(raw_input())\n",
+ " print \"square of %d is %d\\n\" % (num,num*num)\n",
+ " print \"Want to enter another number y/n\"\n",
+ " another=raw_input()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "square of 5 is 25\n",
+ "\n",
+ "Want to enter another number y/n\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "y\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "7\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "square of 7 is 49\n",
+ "\n",
+ "Want to enter another number y/n\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "n\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:105-106"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "another='y'\n",
+ "while(another=='y'):\n",
+ " print \"Enter a number\"\n",
+ " num=eval(raw_input())\n",
+ " print \"square of %d is %d\\n\" % (num,num*num)\n",
+ " print \"Want to enter another number y/n\"\n",
+ " another=raw_input()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "square of 5 is 25\n",
+ "\n",
+ "Want to enter another number y/n\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "y\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "7\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "square of 7 is 49\n",
+ "\n",
+ "Want to enter another number y/n\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "n\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:106"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter a number\"\n",
+ "num=eval(raw_input())\n",
+ "i=2\n",
+ "while i<=num-1:\n",
+ " if num%i==0:\n",
+ " print \"Not a prime number\\n\"\n",
+ " break #exit the loop\n",
+ " i+=1\n",
+ "if i==num:\n",
+ " print \"Prime number\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter a number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "11\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Prime number\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:107"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=1\n",
+ "j=1\n",
+ "while (i<=100):\n",
+ " i+=1\n",
+ " while (j<=200):\n",
+ " j+=1\n",
+ " if (j==150):\n",
+ " break #it will terminate the inner loop only\n",
+ " else:\n",
+ " print \"%d %d\\n\" % (i,j)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2 2\n",
+ "\n",
+ "2 3\n",
+ "\n",
+ "2 4\n",
+ "\n",
+ "2 5\n",
+ "\n",
+ "2 6\n",
+ "\n",
+ "2 7\n",
+ "\n",
+ "2 8\n",
+ "\n",
+ "2 9\n",
+ "\n",
+ "2 10\n",
+ "\n",
+ "2 11\n",
+ "\n",
+ "2 12\n",
+ "\n",
+ "2 13\n",
+ "\n",
+ "2 14\n",
+ "\n",
+ "2 15\n",
+ "\n",
+ "2 16\n",
+ "\n",
+ "2 17\n",
+ "\n",
+ "2 18\n",
+ "\n",
+ "2 19\n",
+ "\n",
+ "2 20\n",
+ "\n",
+ "2 21\n",
+ "\n",
+ "2 22\n",
+ "\n",
+ "2 23\n",
+ "\n",
+ "2 24\n",
+ "\n",
+ "2 25\n",
+ "\n",
+ "2 26\n",
+ "\n",
+ "2 27\n",
+ "\n",
+ "2 28\n",
+ "\n",
+ "2 29\n",
+ "\n",
+ "2 30\n",
+ "\n",
+ "2 31\n",
+ "\n",
+ "2 32\n",
+ "\n",
+ "2 33\n",
+ "\n",
+ "2 34\n",
+ "\n",
+ "2 35\n",
+ "\n",
+ "2 36\n",
+ "\n",
+ "2 37\n",
+ "\n",
+ "2 38\n",
+ "\n",
+ "2 39\n",
+ "\n",
+ "2 40\n",
+ "\n",
+ "2 41\n",
+ "\n",
+ "2 42\n",
+ "\n",
+ "2 43\n",
+ "\n",
+ "2 44\n",
+ "\n",
+ "2 45\n",
+ "\n",
+ "2 46\n",
+ "\n",
+ "2 47\n",
+ "\n",
+ "2 48\n",
+ "\n",
+ "2 49\n",
+ "\n",
+ "2 50\n",
+ "\n",
+ "2 51\n",
+ "\n",
+ "2 52\n",
+ "\n",
+ "2 53\n",
+ "\n",
+ "2 54\n",
+ "\n",
+ "2 55\n",
+ "\n",
+ "2 56\n",
+ "\n",
+ "2 57\n",
+ "\n",
+ "2 58\n",
+ "\n",
+ "2 59\n",
+ "\n",
+ "2 60\n",
+ "\n",
+ "2 61\n",
+ "\n",
+ "2 62\n",
+ "\n",
+ "2 63\n",
+ "\n",
+ "2 64\n",
+ "\n",
+ "2 65\n",
+ "\n",
+ "2 66\n",
+ "\n",
+ "2 67\n",
+ "\n",
+ "2 68\n",
+ "\n",
+ "2 69\n",
+ "\n",
+ "2 70\n",
+ "\n",
+ "2 71\n",
+ "\n",
+ "2 72\n",
+ "\n",
+ "2 73\n",
+ "\n",
+ "2 74\n",
+ "\n",
+ "2 75\n",
+ "\n",
+ "2 76\n",
+ "\n",
+ "2 77\n",
+ "\n",
+ "2 78\n",
+ "\n",
+ "2 79\n",
+ "\n",
+ "2 80\n",
+ "\n",
+ "2 81\n",
+ "\n",
+ "2 82\n",
+ "\n",
+ "2 83\n",
+ "\n",
+ "2 84\n",
+ "\n",
+ "2 85\n",
+ "\n",
+ "2 86\n",
+ "\n",
+ "2 87\n",
+ "\n",
+ "2 88\n",
+ "\n",
+ "2 89\n",
+ "\n",
+ "2 90\n",
+ "\n",
+ "2 91\n",
+ "\n",
+ "2 92\n",
+ "\n",
+ "2 93\n",
+ "\n",
+ "2 94\n",
+ "\n",
+ "2 95\n",
+ "\n",
+ "2 96\n",
+ "\n",
+ "2 97\n",
+ "\n",
+ "2 98\n",
+ "\n",
+ "2 99\n",
+ "\n",
+ "2 100\n",
+ "\n",
+ "2 101\n",
+ "\n",
+ "2 102\n",
+ "\n",
+ "2 103\n",
+ "\n",
+ "2 104\n",
+ "\n",
+ "2 105\n",
+ "\n",
+ "2 106\n",
+ "\n",
+ "2 107\n",
+ "\n",
+ "2 108\n",
+ "\n",
+ "2 109\n",
+ "\n",
+ "2 110\n",
+ "\n",
+ "2 111\n",
+ "\n",
+ "2 112\n",
+ "\n",
+ "2 113\n",
+ "\n",
+ "2 114\n",
+ "\n",
+ "2 115\n",
+ "\n",
+ "2 116\n",
+ "\n",
+ "2 117\n",
+ "\n",
+ "2 118\n",
+ "\n",
+ "2 119\n",
+ "\n",
+ "2 120\n",
+ "\n",
+ "2 121\n",
+ "\n",
+ "2 122\n",
+ "\n",
+ "2 123\n",
+ "\n",
+ "2 124\n",
+ "\n",
+ "2 125\n",
+ "\n",
+ "2 126\n",
+ "\n",
+ "2 127\n",
+ "\n",
+ "2 128\n",
+ "\n",
+ "2 129\n",
+ "\n",
+ "2 130\n",
+ "\n",
+ "2 131\n",
+ "\n",
+ "2 132\n",
+ "\n",
+ "2 133\n",
+ "\n",
+ "2 134\n",
+ "\n",
+ "2 135\n",
+ "\n",
+ "2 136\n",
+ "\n",
+ "2 137\n",
+ "\n",
+ "2 138\n",
+ "\n",
+ "2 139\n",
+ "\n",
+ "2 140\n",
+ "\n",
+ "2 141\n",
+ "\n",
+ "2 142\n",
+ "\n",
+ "2 143\n",
+ "\n",
+ "2 144\n",
+ "\n",
+ "2 145\n",
+ "\n",
+ "2 146\n",
+ "\n",
+ "2 147\n",
+ "\n",
+ "2 148\n",
+ "\n",
+ "2 149\n",
+ "\n",
+ "3 151\n",
+ "\n",
+ "3 152\n",
+ "\n",
+ "3 153\n",
+ "\n",
+ "3 154\n",
+ "\n",
+ "3 155\n",
+ "\n",
+ "3 156\n",
+ "\n",
+ "3 157\n",
+ "\n",
+ "3 158\n",
+ "\n",
+ "3 159\n",
+ "\n",
+ "3 160\n",
+ "\n",
+ "3 161\n",
+ "\n",
+ "3 162\n",
+ "\n",
+ "3 163\n",
+ "\n",
+ "3 164\n",
+ "\n",
+ "3 165\n",
+ "\n",
+ "3 166\n",
+ "\n",
+ "3 167\n",
+ "\n",
+ "3 168\n",
+ "\n",
+ "3 169\n",
+ "\n",
+ "3 170\n",
+ "\n",
+ "3 171\n",
+ "\n",
+ "3 172\n",
+ "\n",
+ "3 173\n",
+ "\n",
+ "3 174\n",
+ "\n",
+ "3 175\n",
+ "\n",
+ "3 176\n",
+ "\n",
+ "3 177\n",
+ "\n",
+ "3 178\n",
+ "\n",
+ "3 179\n",
+ "\n",
+ "3 180\n",
+ "\n",
+ "3 181\n",
+ "\n",
+ "3 182\n",
+ "\n",
+ "3 183\n",
+ "\n",
+ "3 184\n",
+ "\n",
+ "3 185\n",
+ "\n",
+ "3 186\n",
+ "\n",
+ "3 187\n",
+ "\n",
+ "3 188\n",
+ "\n",
+ "3 189\n",
+ "\n",
+ "3 190\n",
+ "\n",
+ "3 191\n",
+ "\n",
+ "3 192\n",
+ "\n",
+ "3 193\n",
+ "\n",
+ "3 194\n",
+ "\n",
+ "3 195\n",
+ "\n",
+ "3 196\n",
+ "\n",
+ "3 197\n",
+ "\n",
+ "3 198\n",
+ "\n",
+ "3 199\n",
+ "\n",
+ "3 200\n",
+ "\n",
+ "3 201\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:108"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for i in range(1,3,1):\n",
+ " for j in range(1,3,1):\n",
+ " if i==j:\n",
+ " continue #it will again send back to loop without executing succeeding statements\n",
+ " print \"%d %d\\n\" % (i,j)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1 2\n",
+ "\n",
+ "2 1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter4.ipynb b/ANSI_C_Programming/chapter4.ipynb
index a3d738f1..3a15cce2 100644
--- a/ANSI_C_Programming/chapter4.ipynb
+++ b/ANSI_C_Programming/chapter4.ipynb
@@ -1,389 +1,390 @@
-{
- "metadata": {
- "name": "chapter4.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 4: THE CASE CONTROL STRUCTURE"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:126"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Switch case statement using dictionary\n",
- "i=2\n",
- "def switch(i):\n",
- " return {True: 'I am in default\\n', #default case\n",
- " i==1: 'I am in case1\\n',\n",
- " i==2: 'I am in case2\\n',\n",
- " i==3: 'I am in case3\\n',\n",
- " }[True]\n",
- "print switch(i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "I am in case2\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:128"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Switch case using scrambled case order\n",
- "i=22\n",
- "def switch(i):\n",
- " return{True: 'I am in default\\n',\n",
- " i==121: 'I am in case 121\\n',\n",
- " i==7: 'I am in case 7\\n',\n",
- " i==22: 'I am in case 22\\n',\n",
- " }[True]\n",
- "print switch(i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "I am in case 22\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:128-129"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Switch case using char values in case\n",
- "c='x'\n",
- "def switch(c):\n",
- " return {True: 'I am in default\\n',\n",
- " c=='v': 'I am in case v\\n',\n",
- " c=='a': 'I am in case a\\n',\n",
- " c=='x': 'I am in case x\\n',\n",
- " }[True]\n",
- "print switch(c)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "I am in case x\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:129-130"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Executing common set of statements for multiple cases\n",
- "print \"Enter any one of the alphabets a,b,or c\"\n",
- "ch=raw_input()\n",
- "def casea():\n",
- " print \"\"\n",
- "def caseb():\n",
- " print \"\"\n",
- "def casec():\n",
- " print \"\"\n",
- "def switch(ch):\n",
- " return {True: 'wish you knew what are alphabets\\n',\n",
- " ch=='a' or ch=='A': 'a as in ashar\\n',\n",
- " ch=='b' or ch=='B': 'b as in brain\\n',\n",
- " ch=='c' or ch=='C': 'c as in cookie\\n',\n",
- " }[True]\n",
- "print switch(ch)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter any one of the alphabets a,b,or c\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "B\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "b as in brain\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:130"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Iniatialisation according to cases\n",
- "print \"Enter value of i\"\n",
- "i=eval(raw_input())\n",
- "def switch(i):\n",
- " print \"Hello\\n\" #It's python,not C :)\n",
- " try:\n",
- " return {1: a,\n",
- " 2: b,\n",
- " }[i]()\n",
- " except:\n",
- " print \"wrong choice\" #print message in default case\n",
- "def a():\n",
- " j=10\n",
- " print j #print j as 10 if i=1\n",
- "def b():\n",
- " j=20 \n",
- " print j #print j as 20 if i=2\n",
- "switch(i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter value of i\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Hello\n",
- "\n",
- "10\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:133"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Conditional printing of messages\n",
- "import sys\n",
- "print \"Enter the number of goals scored against india\"\n",
- "goals=eval(raw_input())\n",
- "if goals<=5:\n",
- " print \"To err is human!\\n\"\n",
- "else:\n",
- " print \"About time soccer players learnt C\\n\"\n",
- " print \"and said goodbye! adieu! to soccer\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter the number of goals scored against india\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "7\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "About time soccer players learnt C\n",
- "\n",
- "and said goodbye! adieu! to soccer\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:134-135"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Program to conditional print of numbers\n",
- "for i in range(1,4,1):\n",
- " for j in range(1,4,1):\n",
- " for k in range(1,4,1):\n",
- " if (i==3 and j==3 and k==3):\n",
- " print \"Out of the loop at last!\\n\"\n",
- " else:\n",
- " print \"%d %d %d\\n\" % (i,j,k)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1 1 1\n",
- "\n",
- "1 1 2\n",
- "\n",
- "1 1 3\n",
- "\n",
- "1 2 1\n",
- "\n",
- "1 2 2\n",
- "\n",
- "1 2 3\n",
- "\n",
- "1 3 1\n",
- "\n",
- "1 3 2\n",
- "\n",
- "1 3 3\n",
- "\n",
- "2 1 1\n",
- "\n",
- "2 1 2\n",
- "\n",
- "2 1 3\n",
- "\n",
- "2 2 1\n",
- "\n",
- "2 2 2\n",
- "\n",
- "2 2 3\n",
- "\n",
- "2 3 1\n",
- "\n",
- "2 3 2\n",
- "\n",
- "2 3 3\n",
- "\n",
- "3 1 1\n",
- "\n",
- "3 1 2\n",
- "\n",
- "3 1 3\n",
- "\n",
- "3 2 1\n",
- "\n",
- "3 2 2\n",
- "\n",
- "3 2 3\n",
- "\n",
- "3 3 1\n",
- "\n",
- "3 3 2\n",
- "\n",
- "Out of the loop at last!\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 12
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:c88e4872fc4418c2962652967a7ca0a93c345eb9f3bd38488ba817f74e5fc2eb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 4: THE CASE CONTROL STRUCTURE"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=2\n",
+ "def switch(i):\n",
+ " return {True: 'I am in default\\n', #default case\n",
+ " i==1: 'I am in case1\\n',\n",
+ " i==2: 'I am in case2\\n',\n",
+ " i==3: 'I am in case3\\n',\n",
+ " }[True]\n",
+ "print switch(i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I am in case2\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:128"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=22\n",
+ "def switch(i):\n",
+ " return{True: 'I am in default\\n',\n",
+ " i==121: 'I am in case 121\\n',\n",
+ " i==7: 'I am in case 7\\n',\n",
+ " i==22: 'I am in case 22\\n',\n",
+ " }[True]\n",
+ "print switch(i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I am in case 22\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:128-129"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "c='x'\n",
+ "def switch(c):\n",
+ " return {True: 'I am in default\\n',\n",
+ " c=='v': 'I am in case v\\n',\n",
+ " c=='a': 'I am in case a\\n',\n",
+ " c=='x': 'I am in case x\\n',\n",
+ " }[True]\n",
+ "print switch(c)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I am in case x\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:129-130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter any one of the alphabets a,b,or c\"\n",
+ "ch=raw_input()\n",
+ "def casea():\n",
+ " print \"\"\n",
+ "def caseb():\n",
+ " print \"\"\n",
+ "def casec():\n",
+ " print \"\"\n",
+ "def switch(ch):\n",
+ " return {True: 'wish you knew what are alphabets\\n',\n",
+ " ch=='a' or ch=='A': 'a as in ashar\\n',\n",
+ " ch=='b' or ch=='B': 'b as in brain\\n',\n",
+ " ch=='c' or ch=='C': 'c as in cookie\\n',\n",
+ " }[True]\n",
+ "print switch(ch)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter any one of the alphabets a,b,or c\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "B\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "b as in brain\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter value of i\"\n",
+ "i=eval(raw_input())\n",
+ "def switch(i):\n",
+ " print \"Hello\\n\" #It's python,not C :)\n",
+ " try:\n",
+ " return {1: a,\n",
+ " 2: b,\n",
+ " }[i]()\n",
+ " except:\n",
+ " print \"wrong choice\" #print message in default case\n",
+ "def a():\n",
+ " j=10\n",
+ " print j #print j as 10 if i=1\n",
+ "def b():\n",
+ " j=20 \n",
+ " print j #print j as 20 if i=2\n",
+ "switch(i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter value of i\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Hello\n",
+ "\n",
+ "10\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import sys\n",
+ "print \"Enter the number of goals scored against india\"\n",
+ "goals=eval(raw_input())\n",
+ "if goals<=5:\n",
+ " print \"To err is human!\\n\"\n",
+ "else:\n",
+ " print \"About time soccer players learnt C\\n\"\n",
+ " print \"and said goodbye! adieu! to soccer\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter the number of goals scored against india\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "7\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "About time soccer players learnt C\n",
+ "\n",
+ "and said goodbye! adieu! to soccer\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:134-135"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for i in range(1,4,1):\n",
+ " for j in range(1,4,1):\n",
+ " for k in range(1,4,1):\n",
+ " if (i==3 and j==3 and k==3):\n",
+ " print \"Out of the loop at last!\\n\"\n",
+ " else:\n",
+ " print \"%d %d %d\\n\" % (i,j,k)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1 1 1\n",
+ "\n",
+ "1 1 2\n",
+ "\n",
+ "1 1 3\n",
+ "\n",
+ "1 2 1\n",
+ "\n",
+ "1 2 2\n",
+ "\n",
+ "1 2 3\n",
+ "\n",
+ "1 3 1\n",
+ "\n",
+ "1 3 2\n",
+ "\n",
+ "1 3 3\n",
+ "\n",
+ "2 1 1\n",
+ "\n",
+ "2 1 2\n",
+ "\n",
+ "2 1 3\n",
+ "\n",
+ "2 2 1\n",
+ "\n",
+ "2 2 2\n",
+ "\n",
+ "2 2 3\n",
+ "\n",
+ "2 3 1\n",
+ "\n",
+ "2 3 2\n",
+ "\n",
+ "2 3 3\n",
+ "\n",
+ "3 1 1\n",
+ "\n",
+ "3 1 2\n",
+ "\n",
+ "3 1 3\n",
+ "\n",
+ "3 2 1\n",
+ "\n",
+ "3 2 2\n",
+ "\n",
+ "3 2 3\n",
+ "\n",
+ "3 3 1\n",
+ "\n",
+ "3 3 2\n",
+ "\n",
+ "Out of the loop at last!\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter5.ipynb b/ANSI_C_Programming/chapter5.ipynb
index aadabff0..6e2f2667 100644
--- a/ANSI_C_Programming/chapter5.ipynb
+++ b/ANSI_C_Programming/chapter5.ipynb
@@ -1,971 +1,970 @@
-{
- "metadata": {
- "name": "chapter5.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 5: FUNCTIONS AND POINTERS"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:144"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Defining & calling a function\n",
- "def message(): #function definition\n",
- " print \"Smile,and the world smiles with you...\\n\"\n",
- "message() #function call\n",
- "print \"Cry, and you stop the monotony!\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Smile,and the world smiles with you...\n",
- "\n",
- "Cry, and you stop the monotony!\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:146"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calling of multiple functions\n",
- "def italy():\n",
- " print \"I am in italy\\n\"\n",
- "def brazil():\n",
- " print \"I am in brazil\\n\"\n",
- "def argentina():\n",
- " print \"I am in argentina\\n\"\n",
- "print \"I am in main\\n\"\n",
- "italy(); #italy() will be called\n",
- "brazil(); #brazil() will be called\n",
- "argentina(); #argentina() will be called"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "I am in main\n",
- "\n",
- "I am in italy\n",
- "\n",
- "I am in brazil\n",
- "\n",
- "I am in argentina\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:147"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calling of function inside another function\n",
- "def italy():\n",
- " print \"I am in italy\\n\"\n",
- " brazil(); #it will call brazil()\n",
- " print \"I am back in italy\\n\"\n",
- "def brazil():\n",
- " print \"I am in brazil\\n\"\n",
- " argentina(); #it will call argentina()\n",
- "def argentina():\n",
- " print \"I am in argentina\\n\"\n",
- "print \"I am in main\\n\"\n",
- "italy(); #italy() is called\n",
- "print \"I am finally back in main\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "I am in main\n",
- "\n",
- "I am in italy\n",
- "\n",
- "I am in brazil\n",
- "\n",
- "I am in argentina\n",
- "\n",
- "I am back in italy\n",
- "\n",
- "I am finally back in main\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:148"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calling of main from another function\n",
- "def message():\n",
- " print \"Can't imagine life without C\\n\"\n",
- " main() #it will call back main()\n",
- "def main():\n",
- " message()\n",
- "main()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:149"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calling a function multiple number of times\n",
- "def message():\n",
- " print \"Jewel Thief!!\\n\"\n",
- "message() #1st call\n",
- "message() #2nd call"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Jewel Thief!!\n",
- "\n",
- "Jewel Thief!!\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:149"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Function calls doesn't depend on the order of functions definition\n",
- "def message2():\n",
- " print \"But the butter was bitter\\n\"\n",
- "def message1():\n",
- " print \"Mary bought some butter\\n\"\n",
- "message1()\n",
- "message2()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Mary bought some butter\n",
- "\n",
- "But the butter was bitter\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:151-152"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Sending and receiving values between functions\n",
- "def calsum(x,y,z): #parameterized function\n",
- " d=x+y+z\n",
- " return d\n",
- "print \"Enter any three numbers\"\n",
- "a=eval(raw_input())\n",
- "b=eval(raw_input())\n",
- "c=eval(raw_input())\n",
- "sum=calsum(a,b,c) #passing values as arguments\n",
- "print \"Sum=%d\\n\" % (sum)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter any three numbers\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "10\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "20\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "30\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Sum=60\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:153"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#A function can have multiple return statements\n",
- "def fun():\n",
- " print \"Enter any number\"\n",
- " n=eval(raw_input())\n",
- " if (n>=10 and n<=90):\n",
- " return n\n",
- " else:\n",
- " return n+32\n",
- "fun()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter any number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "100\n"
- ]
- },
- {
- "metadata": {},
- "output_type": "pyout",
- "prompt_number": 7,
- "text": [
- "132"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:154"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Changing formal argument in function doesn't affect the actual argument\n",
- "def fun(b):\n",
- " b=60\n",
- " print \"%d\\n\" % (b) #prints 60\n",
- "a=30\n",
- "fun(a) #prints 30\n",
- "print \"%d\\n\" % (a)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "60\n",
- "\n",
- "30\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:155"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Program explaining scope of a variable\n",
- "def display(j):\n",
- " k=35\n",
- " print \"%d\\n\" % (j) #we can't print i directly here because scope of variable is local by default\n",
- " print \"%d\\n\" % (k)\n",
- "i=20\n",
- "display(i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "20\n",
- "\n",
- "35\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:158-159"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Square of a floating point number using a function\n",
- "def square(x):\n",
- " y=x*x\n",
- " return y\n",
- "print \"Enter any number\"\n",
- "a=eval(raw_input())\n",
- "b=square(a)\n",
- "print \"Square of %f is %f\\n\" % (a,b)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter any number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "2.5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Square of 2.500000 is 6.250000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:161"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Printing address location of a variable\n",
- "#Note:There is no concept of pointer in python thats why i am only writing it to get the similar output\n",
- "i=3\n",
- "print \"Address of i=%u\\n\" % (id(i)) #id() will return the loaction of a variable\n",
- "print \"Value of i=%d\\n\" % (i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Address of i=20688560\n",
- "\n",
- "Value of i=3\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:161"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Program to print address & value\n",
- "i=3\n",
- "print \"Address of i=%u\\n\" % (id(i))\n",
- "print \"Value of i=%d\\n\" % (i)\n",
- "print \"Value of i=%d\\n\" % (i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Address of i=20688560\n",
- "\n",
- "Value of i=3\n",
- "\n",
- "Value of i=3\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:162"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Assigning address to other variable and printing them\n",
- "i=3\n",
- "j=id(i)\n",
- "print \"Address of i=%u\\n\" % (id(i)) #print address of i\n",
- "print \"Address of i=%u\\n\" % (j) #print address of i\n",
- "print \"Address of j=%u\\n\" % (id(j)) #print address of j\n",
- "print \"Value of j=%u\\n\" % (j) #print value of j\n",
- "print \"Value of i=%d\\n\" % (i)\n",
- "print \"Value of i=%d\\n\" % (i)\n",
- "print \"Value of i=%d\\n\" % (i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Address of i=20688560\n",
- "\n",
- "Address of i=20688560\n",
- "\n",
- "Address of j=88986780\n",
- "\n",
- "Value of j=20688560\n",
- "\n",
- "Value of i=3\n",
- "\n",
- "Value of i=3\n",
- "\n",
- "Value of i=3\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:164"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Variable containg address of another variable\n",
- "i=3\n",
- "j=id(i)\n",
- "k=id(j)\n",
- "print \"Address of i=%u\\n\" % (id(i)) #print address of i\n",
- "print \"Address of i=%u\\n\" % (j) #print address of i\n",
- "print \"Address of i=%u\\n\" % (j) #print address of i\n",
- "print \"Address of j=%u\\n\" % (id(j)) #print address of i\n",
- "print \"Address of j=%u\\n\" % (k) #print address of j\n",
- "print \"Address of k=%u\\n\" % (id(k)) #print address of k\n",
- "print \"Value of j=%u\\n\" % (j) #print value of j\n",
- "print \"Value of k=%u\\n\" % (k) #print value of k\n",
- "print \"Value of i=%u\\n\" % (i) #print value of i\n",
- "print \"Value of i=%u\\n\" % (i)\n",
- "print \"Value of i=%u\\n\" % (i)\n",
- "print \"Value of i=%u\\n\" % (i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Address of i=20688560\n",
- "\n",
- "Address of i=20688560\n",
- "\n",
- "Address of i=20688560\n",
- "\n",
- "Address of j=88986672\n",
- "\n",
- "Address of j=88986672\n",
- "\n",
- "Address of k=88986708\n",
- "\n",
- "Value of j=20688560\n",
- "\n",
- "Value of k=88986672\n",
- "\n",
- "Value of i=3\n",
- "\n",
- "Value of i=3\n",
- "\n",
- "Value of i=3\n",
- "\n",
- "Value of i=3\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:166"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Swapping of two variables\n",
- "def swapv(x,y):\n",
- " x,y=y,x\n",
- " print \"x=%d y=%d\\n\" % (x,y)\n",
- "a=10\n",
- "b=20\n",
- "swapv(a,b)\n",
- "print \"a=%d b=%d\\n\" % (a,b)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "x=20 y=10\n",
- "\n",
- "a=10 b=20\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE-167"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program to swap 2 variables\n",
- "#Note:There is no concept of pointer in python that's why i used global variables to get the same output\n",
- "def swapr():\n",
- " global a,b #global declaration\n",
- " a,b=b,a\n",
- "a=10\n",
- "b=20\n",
- "swapr()\n",
- "print \"a=%d b=%d\\n\" % (a,b)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "a=20 b=10\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:167-168"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Program to print area & perimeter of circle\n",
- "def areaperi(r,a,p):\n",
- " a=3.14*r*r #formula of area\n",
- " p=2*3.14*r #formula of perimeter\n",
- " print \"Area=%f\\n\" % (a)\n",
- " print \"Perimeter=%f\\n\" % (p)\n",
- "area=0\n",
- "perimeter=0\n",
- "print \"Enter radius of a circle\"\n",
- "radius=eval(raw_input())\n",
- "areaperi(radius,area,perimeter)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter radius of a circle\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Area=78.500000\n",
- "\n",
- "Perimeter=31.400000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 22
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:169"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Finding factorial of a number without recursion\n",
- "def factorial(x):\n",
- " f=1\n",
- " for i in range(x,1,-1):\n",
- " f=f*i\n",
- " return f\n",
- "print \"Enter any number\"\n",
- "a=eval(raw_input())\n",
- "fact=factorial(a)\n",
- "print \"Factorial value=%d\\n\" % (fact)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter any number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Factorial value=6\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 23
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:170"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Finding factorial of a number with recursion\n",
- "def rec(x):\n",
- " if x==1:\n",
- " return 1\n",
- " else:\n",
- " f=x*rec(x-1) \n",
- " return f #will call back the rec() function\n",
- "print \"Enter any number\"\n",
- "a=eval(raw_input())\n",
- "fact=rec(a)\n",
- "print \"Factorial value=%d\\n\" % (fact)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter any number\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "5\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Factorial value=120\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 24
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:173"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Sum of two variables using function\n",
- "def add(i,j):\n",
- " sum=i+j\n",
- " return sum\n",
- "a=5\n",
- "b=2\n",
- "c=add(a,b) #Transfers control to add()\n",
- "print \"sum=%d\\n\" % (c)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "sum=7\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 25
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:175-176"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "def factorial(num):\n",
- " f=1\n",
- " for i in range(1,num+1,1):\n",
- " f=f*i;\n",
- " return f\n",
- "f=factorial(5)\n",
- "print \"%d\\n\" % f"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "120\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2cf0a369761f6b9850c2adad43b1edd33ca8cbea4df08e2e06de2898a570851d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 5: FUNCTIONS AND POINTERS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:144"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def message(): #function definition\n",
+ " print \"Smile,and the world smiles with you...\\n\"\n",
+ "message() #function call\n",
+ "print \"Cry, and you stop the monotony!\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Smile,and the world smiles with you...\n",
+ "\n",
+ "Cry, and you stop the monotony!\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:146"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def italy():\n",
+ " print \"I am in italy\\n\"\n",
+ "def brazil():\n",
+ " print \"I am in brazil\\n\"\n",
+ "def argentina():\n",
+ " print \"I am in argentina\\n\"\n",
+ "print \"I am in main\\n\"\n",
+ "italy(); #italy() will be called\n",
+ "brazil(); #brazil() will be called\n",
+ "argentina(); #argentina() will be called"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I am in main\n",
+ "\n",
+ "I am in italy\n",
+ "\n",
+ "I am in brazil\n",
+ "\n",
+ "I am in argentina\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:147"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def italy():\n",
+ " print \"I am in italy\\n\"\n",
+ " brazil(); #it will call brazil()\n",
+ " print \"I am back in italy\\n\"\n",
+ "def brazil():\n",
+ " print \"I am in brazil\\n\"\n",
+ " argentina(); #it will call argentina()\n",
+ "def argentina():\n",
+ " print \"I am in argentina\\n\"\n",
+ "print \"I am in main\\n\"\n",
+ "italy(); #italy() is called\n",
+ "print \"I am finally back in main\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I am in main\n",
+ "\n",
+ "I am in italy\n",
+ "\n",
+ "I am in brazil\n",
+ "\n",
+ "I am in argentina\n",
+ "\n",
+ "I am back in italy\n",
+ "\n",
+ "I am finally back in main\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:148"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def message():\n",
+ " print \"Can't imagine life without C\\n\"\n",
+ " main() #it will call back main()\n",
+ "def main():\n",
+ " message()\n",
+ "main()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:149"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def message():\n",
+ " print \"Jewel Thief!!\\n\"\n",
+ "message() #1st call\n",
+ "message() #2nd call"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Jewel Thief!!\n",
+ "\n",
+ "Jewel Thief!!\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:149"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def message2():\n",
+ " print \"But the butter was bitter\\n\"\n",
+ "def message1():\n",
+ " print \"Mary bought some butter\\n\"\n",
+ "message1()\n",
+ "message2()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mary bought some butter\n",
+ "\n",
+ "But the butter was bitter\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:151-152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def calsum(x,y,z): #parameterized function\n",
+ " d=x+y+z\n",
+ " return d\n",
+ "print \"Enter any three numbers\"\n",
+ "a=eval(raw_input())\n",
+ "b=eval(raw_input())\n",
+ "c=eval(raw_input())\n",
+ "sum=calsum(a,b,c) #passing values as arguments\n",
+ "print \"Sum=%d\\n\" % (sum)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter any three numbers\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "10\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "20\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "30\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Sum=60\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:153"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def fun():\n",
+ " print \"Enter any number\"\n",
+ " n=eval(raw_input())\n",
+ " if (n>=10 and n<=90):\n",
+ " return n\n",
+ " else:\n",
+ " return n+32\n",
+ "fun()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter any number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "100\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 7,
+ "text": [
+ "132"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:154"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def fun(b):\n",
+ " b=60\n",
+ " print \"%d\\n\" % (b) #prints 60\n",
+ "a=30\n",
+ "fun(a) #prints 30\n",
+ "print \"%d\\n\" % (a)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "60\n",
+ "\n",
+ "30\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:155"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def display(j):\n",
+ " k=35\n",
+ " print \"%d\\n\" % (j) #we can't print i directly here because scope of variable is local by default\n",
+ " print \"%d\\n\" % (k)\n",
+ "i=20\n",
+ "display(i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "20\n",
+ "\n",
+ "35\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:158-159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def square(x):\n",
+ " y=x*x\n",
+ " return y\n",
+ "print \"Enter any number\"\n",
+ "a=eval(raw_input())\n",
+ "b=square(a)\n",
+ "print \"Square of %f is %f\\n\" % (a,b)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter any number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2.5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Square of 2.500000 is 6.250000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:161"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=3\n",
+ "print \"Address of i=%u\\n\" % (id(i)) #id() will return the loaction of a variable\n",
+ "print \"Value of i=%d\\n\" % (i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Address of i=20688560\n",
+ "\n",
+ "Value of i=3\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:161"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=3\n",
+ "print \"Address of i=%u\\n\" % (id(i))\n",
+ "print \"Value of i=%d\\n\" % (i)\n",
+ "print \"Value of i=%d\\n\" % (i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Address of i=20688560\n",
+ "\n",
+ "Value of i=3\n",
+ "\n",
+ "Value of i=3\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:162"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=3\n",
+ "j=id(i)\n",
+ "print \"Address of i=%u\\n\" % (id(i)) #print address of i\n",
+ "print \"Address of i=%u\\n\" % (j) #print address of i\n",
+ "print \"Address of j=%u\\n\" % (id(j)) #print address of j\n",
+ "print \"Value of j=%u\\n\" % (j) #print value of j\n",
+ "print \"Value of i=%d\\n\" % (i)\n",
+ "print \"Value of i=%d\\n\" % (i)\n",
+ "print \"Value of i=%d\\n\" % (i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Address of i=20688560\n",
+ "\n",
+ "Address of i=20688560\n",
+ "\n",
+ "Address of j=88986780\n",
+ "\n",
+ "Value of j=20688560\n",
+ "\n",
+ "Value of i=3\n",
+ "\n",
+ "Value of i=3\n",
+ "\n",
+ "Value of i=3\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:164"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=3\n",
+ "j=id(i)\n",
+ "k=id(j)\n",
+ "print \"Address of i=%u\\n\" % (id(i)) #print address of i\n",
+ "print \"Address of i=%u\\n\" % (j) #print address of i\n",
+ "print \"Address of i=%u\\n\" % (j) #print address of i\n",
+ "print \"Address of j=%u\\n\" % (id(j)) #print address of i\n",
+ "print \"Address of j=%u\\n\" % (k) #print address of j\n",
+ "print \"Address of k=%u\\n\" % (id(k)) #print address of k\n",
+ "print \"Value of j=%u\\n\" % (j) #print value of j\n",
+ "print \"Value of k=%u\\n\" % (k) #print value of k\n",
+ "print \"Value of i=%u\\n\" % (i) #print value of i\n",
+ "print \"Value of i=%u\\n\" % (i)\n",
+ "print \"Value of i=%u\\n\" % (i)\n",
+ "print \"Value of i=%u\\n\" % (i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Address of i=20688560\n",
+ "\n",
+ "Address of i=20688560\n",
+ "\n",
+ "Address of i=20688560\n",
+ "\n",
+ "Address of j=88986672\n",
+ "\n",
+ "Address of j=88986672\n",
+ "\n",
+ "Address of k=88986708\n",
+ "\n",
+ "Value of j=20688560\n",
+ "\n",
+ "Value of k=88986672\n",
+ "\n",
+ "Value of i=3\n",
+ "\n",
+ "Value of i=3\n",
+ "\n",
+ "Value of i=3\n",
+ "\n",
+ "Value of i=3\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:166"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def swapv(x,y):\n",
+ " x,y=y,x\n",
+ " print \"x=%d y=%d\\n\" % (x,y)\n",
+ "a=10\n",
+ "b=20\n",
+ "swapv(a,b)\n",
+ "print \"a=%d b=%d\\n\" % (a,b)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x=20 y=10\n",
+ "\n",
+ "a=10 b=20\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE-167"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def swapr():\n",
+ " global a,b #global declaration\n",
+ " a,b=b,a\n",
+ "a=10\n",
+ "b=20\n",
+ "swapr()\n",
+ "print \"a=%d b=%d\\n\" % (a,b)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "a=20 b=10\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:167-168"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def areaperi(r,a,p):\n",
+ " a=3.14*r*r #formula of area\n",
+ " p=2*3.14*r #formula of perimeter\n",
+ " print \"Area=%f\\n\" % (a)\n",
+ " print \"Perimeter=%f\\n\" % (p)\n",
+ "area=0\n",
+ "perimeter=0\n",
+ "print \"Enter radius of a circle\"\n",
+ "radius=eval(raw_input())\n",
+ "areaperi(radius,area,perimeter)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter radius of a circle\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area=78.500000\n",
+ "\n",
+ "Perimeter=31.400000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:169"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def factorial(x):\n",
+ " f=1\n",
+ " for i in range(x,1,-1):\n",
+ " f=f*i\n",
+ " return f\n",
+ "print \"Enter any number\"\n",
+ "a=eval(raw_input())\n",
+ "fact=factorial(a)\n",
+ "print \"Factorial value=%d\\n\" % (fact)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter any number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Factorial value=6\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:170"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def rec(x):\n",
+ " if x==1:\n",
+ " return 1\n",
+ " else:\n",
+ " f=x*rec(x-1) \n",
+ " return f #will call back the rec() function\n",
+ "print \"Enter any number\"\n",
+ "a=eval(raw_input())\n",
+ "fact=rec(a)\n",
+ "print \"Factorial value=%d\\n\" % (fact)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter any number\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Factorial value=120\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def add(i,j):\n",
+ " sum=i+j\n",
+ " return sum\n",
+ "a=5\n",
+ "b=2\n",
+ "c=add(a,b) #Transfers control to add()\n",
+ "print \"sum=%d\\n\" % (c)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sum=7\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:175-176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "def factorial(num):\n",
+ " f=1\n",
+ " for i in range(1,num+1,1):\n",
+ " f=f*i;\n",
+ " return f\n",
+ "f=factorial(5)\n",
+ "print \"%d\\n\" % f"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "120\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter6.ipynb b/ANSI_C_Programming/chapter6.ipynb
index 1cdd6dae..08372811 100644
--- a/ANSI_C_Programming/chapter6.ipynb
+++ b/ANSI_C_Programming/chapter6.ipynb
@@ -1,1731 +1,1731 @@
-{
- "metadata": {
- "name": "chapter6.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 6: DATA TYPES REVISITED"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:199"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing character corresponding to integer value\n",
- "ch=291\n",
- "if ch>255:\n",
- " ch=ch-256\n",
- "print \"\\n%d %c\\n\" % (ch,ch)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "35 #\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:199"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#print ascii values and their corresponding characters\n",
- "for ch in range(0,256,1):\n",
- " print \"%d %c\\n\" % (ch,ch)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "0 \u0000\n",
- "\n",
- "1 \u0001\n",
- "\n",
- "2 \u0002\n",
- "\n",
- "3 \u0003\n",
- "\n",
- "4 \u0004\n",
- "\n",
- "5 \u0005\n",
- "\n",
- "6 \u0006\n",
- "\n",
- "7 \u0007\n",
- "\n",
- "8 \b\n",
- "\n",
- "9 \t\n",
- "\n",
- "10 \n",
- "\n",
- "\n",
- "11 \u000b",
- "\n",
- "\n",
- "12 \f",
- "\n",
- "\n",
- "13 \r\n",
- "\n",
- "14 \u000e\n",
- "\n",
- "15 \u000f\n",
- "\n",
- "16 \u0010\n",
- "\n",
- "17 \u0011\n",
- "\n",
- "18 \u0012\n",
- "\n",
- "19 \u0013\n",
- "\n",
- "20 \u0014\n",
- "\n",
- "21 \u0015\n",
- "\n",
- "22 \u0016\n",
- "\n",
- "23 \u0017\n",
- "\n",
- "24 \u0018\n",
- "\n",
- "25 \u0019\n",
- "\n",
- "26 \u001a\n",
- "\n",
- "27 \u001b\n",
- "\n",
- "28 \u001c",
- "\n",
- "\n",
- "29 \u001d",
- "\n",
- "\n",
- "30 \u001e",
- "\n",
- "\n",
- "31 \u001f\n",
- "\n",
- "32 \n",
- "\n",
- "33 !\n",
- "\n",
- "34 \"\n",
- "\n",
- "35 #\n",
- "\n",
- "36 $\n",
- "\n",
- "37 %\n",
- "\n",
- "38 &\n",
- "\n",
- "39 '\n",
- "\n",
- "40 (\n",
- "\n",
- "41 )\n",
- "\n",
- "42 *\n",
- "\n",
- "43 +\n",
- "\n",
- "44 ,\n",
- "\n",
- "45 -\n",
- "\n",
- "46 .\n",
- "\n",
- "47 /\n",
- "\n",
- "48 0\n",
- "\n",
- "49 1\n",
- "\n",
- "50 2\n",
- "\n",
- "51 3\n",
- "\n",
- "52 4\n",
- "\n",
- "53 5\n",
- "\n",
- "54 6\n",
- "\n",
- "55 7\n",
- "\n",
- "56 8\n",
- "\n",
- "57 9\n",
- "\n",
- "58 :\n",
- "\n",
- "59 ;\n",
- "\n",
- "60 <\n",
- "\n",
- "61 =\n",
- "\n",
- "62 >\n",
- "\n",
- "63 ?\n",
- "\n",
- "64 @\n",
- "\n",
- "65 A\n",
- "\n",
- "66 B\n",
- "\n",
- "67 C\n",
- "\n",
- "68 D\n",
- "\n",
- "69 E\n",
- "\n",
- "70 F\n",
- "\n",
- "71 G\n",
- "\n",
- "72 H\n",
- "\n",
- "73 I\n",
- "\n",
- "74 J\n",
- "\n",
- "75 K\n",
- "\n",
- "76 L\n",
- "\n",
- "77 M\n",
- "\n",
- "78 N\n",
- "\n",
- "79 O\n",
- "\n",
- "80 P\n",
- "\n",
- "81 Q\n",
- "\n",
- "82 R\n",
- "\n",
- "83 S\n",
- "\n",
- "84 T\n",
- "\n",
- "85 U\n",
- "\n",
- "86 V\n",
- "\n",
- "87 W\n",
- "\n",
- "88 X\n",
- "\n",
- "89 Y\n",
- "\n",
- "90 Z\n",
- "\n",
- "91 [\n",
- "\n",
- "92 \\\n",
- "\n",
- "93 ]\n",
- "\n",
- "94 ^\n",
- "\n",
- "95 _\n",
- "\n",
- "96 `\n",
- "\n",
- "97 a\n",
- "\n",
- "98 b\n",
- "\n",
- "99 c\n",
- "\n",
- "100 d\n",
- "\n",
- "101 e\n",
- "\n",
- "102 f\n",
- "\n",
- "103 g\n",
- "\n",
- "104 h\n",
- "\n",
- "105 i\n",
- "\n",
- "106 j\n",
- "\n",
- "107 k\n",
- "\n",
- "108 l\n",
- "\n",
- "109 m\n",
- "\n",
- "110 n\n",
- "\n",
- "111 o\n",
- "\n",
- "112 p\n",
- "\n",
- "113 q\n",
- "\n",
- "114 r\n",
- "\n",
- "115 s\n",
- "\n",
- "116 t\n",
- "\n",
- "117 u\n",
- "\n",
- "118 v\n",
- "\n",
- "119 w\n",
- "\n",
- "120 x\n",
- "\n",
- "121 y\n",
- "\n",
- "122 z\n",
- "\n",
- "123 {\n",
- "\n",
- "124 |\n",
- "\n",
- "125 }\n",
- "\n",
- "126 ~\n",
- "\n",
- "127 \u007f\n",
- "\n",
- "128 \ufffd\n",
- "\n",
- "129 \ufffd\n",
- "\n",
- "130 \ufffd\n",
- "\n",
- "131 \ufffd\n",
- "\n",
- "132 \ufffd\n",
- "\n",
- "133 \ufffd\n",
- "\n",
- "134 \ufffd\n",
- "\n",
- "135 \ufffd\n",
- "\n",
- "136 \ufffd\n",
- "\n",
- "137 \ufffd\n",
- "\n",
- "138 \ufffd\n",
- "\n",
- "139 \ufffd\n",
- "\n",
- "140 \ufffd\n",
- "\n",
- "141 \ufffd\n",
- "\n",
- "142 \ufffd\n",
- "\n",
- "143 \ufffd\n",
- "\n",
- "144 \ufffd\n",
- "\n",
- "145 \ufffd\n",
- "\n",
- "146 \ufffd\n",
- "\n",
- "147 \ufffd\n",
- "\n",
- "148 \ufffd\n",
- "\n",
- "149 \ufffd\n",
- "\n",
- "150 \ufffd\n",
- "\n",
- "151 \ufffd\n",
- "\n",
- "152 \ufffd\n",
- "\n",
- "153 \ufffd\n",
- "\n",
- "154 \ufffd\n",
- "\n",
- "155 \ufffd\n",
- "\n",
- "156 \ufffd\n",
- "\n",
- "157 \ufffd\n",
- "\n",
- "158 \ufffd\n",
- "\n",
- "159 \ufffd\n",
- "\n",
- "160 \ufffd\n",
- "\n",
- "161 \ufffd\n",
- "\n",
- "162 \ufffd\n",
- "\n",
- "163 \ufffd\n",
- "\n",
- "164 \ufffd\n",
- "\n",
- "165 \ufffd\n",
- "\n",
- "166 \ufffd\n",
- "\n",
- "167 \ufffd\n",
- "\n",
- "168 \ufffd\n",
- "\n",
- "169 \ufffd\n",
- "\n",
- "170 \ufffd\n",
- "\n",
- "171 \ufffd\n",
- "\n",
- "172 \ufffd\n",
- "\n",
- "173 \ufffd\n",
- "\n",
- "174 \ufffd\n",
- "\n",
- "175 \ufffd\n",
- "\n",
- "176 \ufffd\n",
- "\n",
- "177 \ufffd\n",
- "\n",
- "178 \ufffd\n",
- "\n",
- "179 \ufffd\n",
- "\n",
- "180 \ufffd\n",
- "\n",
- "181 \ufffd\n",
- "\n",
- "182 \ufffd\n",
- "\n",
- "183 \ufffd\n",
- "\n",
- "184 \ufffd\n",
- "\n",
- "185 \ufffd\n",
- "\n",
- "186 \ufffd\n",
- "\n",
- "187 \ufffd\n",
- "\n",
- "188 \ufffd\n",
- "\n",
- "189 \ufffd\n",
- "\n",
- "190 \ufffd\n",
- "\n",
- "191 \ufffd\n",
- "\n",
- "192 \ufffd\n",
- "\n",
- "193 \ufffd\n",
- "\n",
- "194 \ufffd\n",
- "\n",
- "195 \ufffd\n",
- "\n",
- "196 \ufffd\n",
- "\n",
- "197 \ufffd\n",
- "\n",
- "198 \ufffd\n",
- "\n",
- "199 \ufffd\n",
- "\n",
- "200 \ufffd\n",
- "\n",
- "201 \ufffd\n",
- "\n",
- "202 \ufffd\n",
- "\n",
- "203 \ufffd\n",
- "\n",
- "204 \ufffd\n",
- "\n",
- "205 \ufffd\n",
- "\n",
- "206 \ufffd\n",
- "\n",
- "207 \ufffd\n",
- "\n",
- "208 \ufffd\n",
- "\n",
- "209 \ufffd\n",
- "\n",
- "210 \ufffd\n",
- "\n",
- "211 \ufffd\n",
- "\n",
- "212 \ufffd\n",
- "\n",
- "213 \ufffd\n",
- "\n",
- "214 \ufffd\n",
- "\n",
- "215 \ufffd\n",
- "\n",
- "216 \ufffd\n",
- "\n",
- "217 \ufffd\n",
- "\n",
- "218 \ufffd\n",
- "\n",
- "219 \ufffd\n",
- "\n",
- "220 \ufffd\n",
- "\n",
- "221 \ufffd\n",
- "\n",
- "222 \ufffd\n",
- "\n",
- "223 \ufffd\n",
- "\n",
- "224 \ufffd\n",
- "\n",
- "225 \ufffd\n",
- "\n",
- "226 \ufffd\n",
- "\n",
- "227 \ufffd\n",
- "\n",
- "228 \ufffd\n",
- "\n",
- "229 \ufffd\n",
- "\n",
- "230 \ufffd\n",
- "\n",
- "231 \ufffd\n",
- "\n",
- "232 \ufffd\n",
- "\n",
- "233 \ufffd\n",
- "\n",
- "234 \ufffd\n",
- "\n",
- "235 \ufffd\n",
- "\n",
- "236 \ufffd\n",
- "\n",
- "237 \ufffd\n",
- "\n",
- "238 \ufffd\n",
- "\n",
- "239 \ufffd\n",
- "\n",
- "240 \ufffd\n",
- "\n",
- "241 \ufffd\n",
- "\n",
- "242 \ufffd\n",
- "\n",
- "243 \ufffd\n",
- "\n",
- "244 \ufffd\n",
- "\n",
- "245 \ufffd\n",
- "\n",
- "246 \ufffd\n",
- "\n",
- "247 \ufffd\n",
- "\n",
- "248 \ufffd\n",
- "\n",
- "249 \ufffd\n",
- "\n",
- "250 \ufffd\n",
- "\n",
- "251 \ufffd\n",
- "\n",
- "252 \ufffd\n",
- "\n",
- "253 \ufffd\n",
- "\n",
- "254 \ufffd\n",
- "\n",
- "255 \ufffd\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:200"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#print ascii values and their corresponding characters\n",
- "for ch in range(0,255,1):\n",
- " print \"%d %c\\n\" % (ch,ch)\n",
- "print \"%d %c\\n\" % (ch,ch)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "0 \u0000\n",
- "\n",
- "1 \u0001\n",
- "\n",
- "2 \u0002\n",
- "\n",
- "3 \u0003\n",
- "\n",
- "4 \u0004\n",
- "\n",
- "5 \u0005\n",
- "\n",
- "6 \u0006\n",
- "\n",
- "7 \u0007\n",
- "\n",
- "8 \b\n",
- "\n",
- "9 \t\n",
- "\n",
- "10 \n",
- "\n",
- "\n",
- "11 \u000b",
- "\n",
- "\n",
- "12 \f",
- "\n",
- "\n",
- "13 \r\n",
- "\n",
- "14 \u000e\n",
- "\n",
- "15 \u000f\n",
- "\n",
- "16 \u0010\n",
- "\n",
- "17 \u0011\n",
- "\n",
- "18 \u0012\n",
- "\n",
- "19 \u0013\n",
- "\n",
- "20 \u0014\n",
- "\n",
- "21 \u0015\n",
- "\n",
- "22 \u0016\n",
- "\n",
- "23 \u0017\n",
- "\n",
- "24 \u0018\n",
- "\n",
- "25 \u0019\n",
- "\n",
- "26 \u001a\n",
- "\n",
- "27 \u001b\n",
- "\n",
- "28 \u001c",
- "\n",
- "\n",
- "29 \u001d",
- "\n",
- "\n",
- "30 \u001e",
- "\n",
- "\n",
- "31 \u001f\n",
- "\n",
- "32 \n",
- "\n",
- "33 !\n",
- "\n",
- "34 \"\n",
- "\n",
- "35 #\n",
- "\n",
- "36 $\n",
- "\n",
- "37 %\n",
- "\n",
- "38 &\n",
- "\n",
- "39 '\n",
- "\n",
- "40 (\n",
- "\n",
- "41 )\n",
- "\n",
- "42 *\n",
- "\n",
- "43 +\n",
- "\n",
- "44 ,\n",
- "\n",
- "45 -\n",
- "\n",
- "46 .\n",
- "\n",
- "47 /\n",
- "\n",
- "48 0\n",
- "\n",
- "49 1\n",
- "\n",
- "50 2\n",
- "\n",
- "51 3\n",
- "\n",
- "52 4\n",
- "\n",
- "53 5\n",
- "\n",
- "54 6\n",
- "\n",
- "55 7\n",
- "\n",
- "56 8\n",
- "\n",
- "57 9\n",
- "\n",
- "58 :\n",
- "\n",
- "59 ;\n",
- "\n",
- "60 <\n",
- "\n",
- "61 =\n",
- "\n",
- "62 >\n",
- "\n",
- "63 ?\n",
- "\n",
- "64 @\n",
- "\n",
- "65 A\n",
- "\n",
- "66 B\n",
- "\n",
- "67 C\n",
- "\n",
- "68 D\n",
- "\n",
- "69 E\n",
- "\n",
- "70 F\n",
- "\n",
- "71 G\n",
- "\n",
- "72 H\n",
- "\n",
- "73 I\n",
- "\n",
- "74 J\n",
- "\n",
- "75 K\n",
- "\n",
- "76 L\n",
- "\n",
- "77 M\n",
- "\n",
- "78 N\n",
- "\n",
- "79 O\n",
- "\n",
- "80 P\n",
- "\n",
- "81 Q\n",
- "\n",
- "82 R\n",
- "\n",
- "83 S\n",
- "\n",
- "84 T\n",
- "\n",
- "85 U\n",
- "\n",
- "86 V\n",
- "\n",
- "87 W\n",
- "\n",
- "88 X\n",
- "\n",
- "89 Y\n",
- "\n",
- "90 Z\n",
- "\n",
- "91 [\n",
- "\n",
- "92 \\\n",
- "\n",
- "93 ]\n",
- "\n",
- "94 ^\n",
- "\n",
- "95 _\n",
- "\n",
- "96 `\n",
- "\n",
- "97 a\n",
- "\n",
- "98 b\n",
- "\n",
- "99 c\n",
- "\n",
- "100 d\n",
- "\n",
- "101 e\n",
- "\n",
- "102 f\n",
- "\n",
- "103 g\n",
- "\n",
- "104 h\n",
- "\n",
- "105 i\n",
- "\n",
- "106 j\n",
- "\n",
- "107 k\n",
- "\n",
- "108 l\n",
- "\n",
- "109 m\n",
- "\n",
- "110 n\n",
- "\n",
- "111 o\n",
- "\n",
- "112 p\n",
- "\n",
- "113 q\n",
- "\n",
- "114 r\n",
- "\n",
- "115 s\n",
- "\n",
- "116 t\n",
- "\n",
- "117 u\n",
- "\n",
- "118 v\n",
- "\n",
- "119 w\n",
- "\n",
- "120 x\n",
- "\n",
- "121 y\n",
- "\n",
- "122 z\n",
- "\n",
- "123 {\n",
- "\n",
- "124 |\n",
- "\n",
- "125 }\n",
- "\n",
- "126 ~\n",
- "\n",
- "127 \u007f\n",
- "\n",
- "128 \ufffd\n",
- "\n",
- "129 \ufffd\n",
- "\n",
- "130 \ufffd\n",
- "\n",
- "131 \ufffd\n",
- "\n",
- "132 \ufffd\n",
- "\n",
- "133 \ufffd\n",
- "\n",
- "134 \ufffd\n",
- "\n",
- "135 \ufffd\n",
- "\n",
- "136 \ufffd\n",
- "\n",
- "137 \ufffd\n",
- "\n",
- "138 \ufffd\n",
- "\n",
- "139 \ufffd\n",
- "\n",
- "140 \ufffd\n",
- "\n",
- "141 \ufffd\n",
- "\n",
- "142 \ufffd\n",
- "\n",
- "143 \ufffd\n",
- "\n",
- "144 \ufffd\n",
- "\n",
- "145 \ufffd\n",
- "\n",
- "146 \ufffd\n",
- "\n",
- "147 \ufffd\n",
- "\n",
- "148 \ufffd\n",
- "\n",
- "149 \ufffd\n",
- "\n",
- "150 \ufffd\n",
- "\n",
- "151 \ufffd\n",
- "\n",
- "152 \ufffd\n",
- "\n",
- "153 \ufffd\n",
- "\n",
- "154 \ufffd\n",
- "\n",
- "155 \ufffd\n",
- "\n",
- "156 \ufffd\n",
- "\n",
- "157 \ufffd\n",
- "\n",
- "158 \ufffd\n",
- "\n",
- "159 \ufffd\n",
- "\n",
- "160 \ufffd\n",
- "\n",
- "161 \ufffd\n",
- "\n",
- "162 \ufffd\n",
- "\n",
- "163 \ufffd\n",
- "\n",
- "164 \ufffd\n",
- "\n",
- "165 \ufffd\n",
- "\n",
- "166 \ufffd\n",
- "\n",
- "167 \ufffd\n",
- "\n",
- "168 \ufffd\n",
- "\n",
- "169 \ufffd\n",
- "\n",
- "170 \ufffd\n",
- "\n",
- "171 \ufffd\n",
- "\n",
- "172 \ufffd\n",
- "\n",
- "173 \ufffd\n",
- "\n",
- "174 \ufffd\n",
- "\n",
- "175 \ufffd\n",
- "\n",
- "176 \ufffd\n",
- "\n",
- "177 \ufffd\n",
- "\n",
- "178 \ufffd\n",
- "\n",
- "179 \ufffd\n",
- "\n",
- "180 \ufffd\n",
- "\n",
- "181 \ufffd\n",
- "\n",
- "182 \ufffd\n",
- "\n",
- "183 \ufffd\n",
- "\n",
- "184 \ufffd\n",
- "\n",
- "185 \ufffd\n",
- "\n",
- "186 \ufffd\n",
- "\n",
- "187 \ufffd\n",
- "\n",
- "188 \ufffd\n",
- "\n",
- "189 \ufffd\n",
- "\n",
- "190 \ufffd\n",
- "\n",
- "191 \ufffd\n",
- "\n",
- "192 \ufffd\n",
- "\n",
- "193 \ufffd\n",
- "\n",
- "194 \ufffd\n",
- "\n",
- "195 \ufffd\n",
- "\n",
- "196 \ufffd\n",
- "\n",
- "197 \ufffd\n",
- "\n",
- "198 \ufffd\n",
- "\n",
- "199 \ufffd\n",
- "\n",
- "200 \ufffd\n",
- "\n",
- "201 \ufffd\n",
- "\n",
- "202 \ufffd\n",
- "\n",
- "203 \ufffd\n",
- "\n",
- "204 \ufffd\n",
- "\n",
- "205 \ufffd\n",
- "\n",
- "206 \ufffd\n",
- "\n",
- "207 \ufffd\n",
- "\n",
- "208 \ufffd\n",
- "\n",
- "209 \ufffd\n",
- "\n",
- "210 \ufffd\n",
- "\n",
- "211 \ufffd\n",
- "\n",
- "212 \ufffd\n",
- "\n",
- "213 \ufffd\n",
- "\n",
- "214 \ufffd\n",
- "\n",
- "215 \ufffd\n",
- "\n",
- "216 \ufffd\n",
- "\n",
- "217 \ufffd\n",
- "\n",
- "218 \ufffd\n",
- "\n",
- "219 \ufffd\n",
- "\n",
- "220 \ufffd\n",
- "\n",
- "221 \ufffd\n",
- "\n",
- "222 \ufffd\n",
- "\n",
- "223 \ufffd\n",
- "\n",
- "224 \ufffd\n",
- "\n",
- "225 \ufffd\n",
- "\n",
- "226 \ufffd\n",
- "\n",
- "227 \ufffd\n",
- "\n",
- "228 \ufffd\n",
- "\n",
- "229 \ufffd\n",
- "\n",
- "230 \ufffd\n",
- "\n",
- "231 \ufffd\n",
- "\n",
- "232 \ufffd\n",
- "\n",
- "233 \ufffd\n",
- "\n",
- "234 \ufffd\n",
- "\n",
- "235 \ufffd\n",
- "\n",
- "236 \ufffd\n",
- "\n",
- "237 \ufffd\n",
- "\n",
- "238 \ufffd\n",
- "\n",
- "239 \ufffd\n",
- "\n",
- "240 \ufffd\n",
- "\n",
- "241 \ufffd\n",
- "\n",
- "242 \ufffd\n",
- "\n",
- "243 \ufffd\n",
- "\n",
- "244 \ufffd\n",
- "\n",
- "245 \ufffd\n",
- "\n",
- "246 \ufffd\n",
- "\n",
- "247 \ufffd\n",
- "\n",
- "248 \ufffd\n",
- "\n",
- "249 \ufffd\n",
- "\n",
- "250 \ufffd\n",
- "\n",
- "251 \ufffd\n",
- "\n",
- "252 \ufffd\n",
- "\n",
- "253 \ufffd\n",
- "\n",
- "254 \ufffd\n",
- "\n",
- "254 \ufffd\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:200-201"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Use of format specifiers to output variables\n",
- "#char\n",
- "c=raw_input()\n",
- "d=raw_input()\n",
- "print \"%c %c\\n\" % (c,d)\n",
- "#int\n",
- "i=eval(raw_input())\n",
- "j=eval(raw_input())\n",
- "print \"%d %u\\n\" % (i,j)\n",
- "#short int\n",
- "k=eval(raw_input())\n",
- "l=eval(raw_input())\n",
- "print \"%d %u\\n\" % (k,l)\n",
- "#long int\n",
- "m=eval(raw_input())\n",
- "n=eval(raw_input())\n",
- "print \"%ld %lu\\n\" % (m,n)\n",
- "#float,double,long double\n",
- "x=eval(raw_input())\n",
- "y=eval(raw_input())\n",
- "z=eval(raw_input())\n",
- "print \"%f %lf %Lf\\n\" % (x,y,z)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "a\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "b\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "a b\n",
- "\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "10000\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "7389\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "10000 7389\n",
- "\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "34\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "585\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "34 585\n",
- "\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "34676\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "500000\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "34676 500000\n",
- "\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "445.55\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "57846.44\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "55666885.6655\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "445.550000 57846.440000 55666885.665500\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:205"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program explaining concept of scope of variables\n",
- "#no concept of auto storage class\n",
- "def main():\n",
- " i=1\n",
- " def main2():\n",
- " def main3():\n",
- " print \"%d\" % (i) #prints 1\n",
- " main3()\n",
- " print \"%d\" % (i) #prints 1\n",
- " main2()\n",
- " print \"%d\\n\" % (i) #prints 1\n",
- "main()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n",
- "1\n",
- "1\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:205"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program explaing concept of local variables\n",
- "def main():\n",
- " i=1\n",
- " def main2():\n",
- " i=2\n",
- " def main3():\n",
- " i=3\n",
- " print \"%d\" % (i) #prints 3\n",
- " main3()\n",
- " print \"%d\" % (i) #prints 2\n",
- " main2()\n",
- " print \"%d\\n\" % (i) #prints 1\n",
- "main()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3\n",
- "2\n",
- "1\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:206"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#prints numbers from 1 to 10\n",
- "for i in range(1,11,1):\n",
- " print \"%d\\n\" % (i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n",
- "\n",
- "2\n",
- "\n",
- "3\n",
- "\n",
- "4\n",
- "\n",
- "5\n",
- "\n",
- "6\n",
- "\n",
- "7\n",
- "\n",
- "8\n",
- "\n",
- "9\n",
- "\n",
- "10\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:208"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program to explain use of variable\n",
- "def increment():\n",
- " i=1\n",
- " print \"%d\\n\" % (i) #prints 1 every time\n",
- " i=i+1\n",
- "increment()\n",
- "increment()\n",
- "increment()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n",
- "\n",
- "1\n",
- "\n",
- "1\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:208"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program using static variables\n",
- "def static_var(varname, value): #function to make it static\n",
- " def decorate(func):\n",
- " setattr(func, varname, value)\n",
- " return func\n",
- " return decorate\n",
- "@static_var(\"i\", 1) #i is static variable\n",
- "def increment():\n",
- " print \"%d\\n\" % increment.i\n",
- " increment.i += 1\n",
- "increment()\n",
- "increment()\n",
- "increment()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n",
- "\n",
- "2\n",
- "\n",
- "3\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:209"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Returning address from function\n",
- "def fun():\n",
- " k=35\n",
- " return id(k) #returns address of k\n",
- "j=fun() #stores address of k\n",
- "print \"%d\\n\" % (j) #prints address of k"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "19639600\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:210"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program using global variables\n",
- "def increment():\n",
- " global i #gloabal declaration\n",
- " i=i+1\n",
- " print \"on incrementing i=%d\\n\" % (i)\n",
- "def decrement():\n",
- " global i #global declaration\n",
- " i=i-1\n",
- " print \"on decrementing i=%d\\n\" % (i)\n",
- "i=0\n",
- "print \"\\ni=%d\" % (i)\n",
- "increment()\n",
- "increment()\n",
- "decrement()\n",
- "decrement()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "i=0\n",
- "on incrementing i=1\n",
- "\n",
- "on incrementing i=2\n",
- "\n",
- "on decrementing i=1\n",
- "\n",
- "on decrementing i=0\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:211"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing of global variables\n",
- "x=21\n",
- "def main():\n",
- " global x,y\n",
- " print \"%d %d\\n\" % (x,y)\n",
- "y=31\n",
- "main()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "21 31\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:211"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Global and local variable\n",
- "def display():\n",
- " global x #global variable\n",
- " print \"%d\\n\" % (x) #prints 10\n",
- "x=10\n",
- "def main():\n",
- " x=20 #local variable for main\n",
- " print \"%d\\n\" % (x) #prints 20\n",
- " display()\n",
- "main()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "20\n",
- "\n",
- "10\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:212-213"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#GLOBAL VARIABLES CONTINUES\n",
- "def fun1():\n",
- " global i\n",
- " i+=1\n",
- " print \"%d\\n\" % (i)\n",
- "def fun2():\n",
- " global i\n",
- " i-=1\n",
- " print \"%d\\n\" % (i)\n",
- "i=35\n",
- "print \"%d\\n\" % (i)\n",
- "fun1()\n",
- "fun2()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "35\n",
- "\n",
- "36\n",
- "\n",
- "35\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 13
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:16010659f0ef4e7689cf0cba4bf13a7155f0a2c561ad3c2947d5e5c9a18c6603"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 6: DATA TYPES REVISITED"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:199"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "ch=291\n",
+ "if ch>255:\n",
+ " ch=ch-256\n",
+ "print \"\\n%d %c\\n\" % (ch,ch)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "35 #\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:199"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for ch in range(0,256,1):\n",
+ " print \"%d %c\\n\" % (ch,ch)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0 \u0000\n",
+ "\n",
+ "1 \u0001\n",
+ "\n",
+ "2 \u0002\n",
+ "\n",
+ "3 \u0003\n",
+ "\n",
+ "4 \u0004\n",
+ "\n",
+ "5 \u0005\n",
+ "\n",
+ "6 \u0006\n",
+ "\n",
+ "7 \u0007\n",
+ "\n",
+ "8 \b\n",
+ "\n",
+ "9 \t\n",
+ "\n",
+ "10 \n",
+ "\n",
+ "\n",
+ "11 \u000b",
+ "\n",
+ "\n",
+ "12 \f",
+ "\n",
+ "\n",
+ "13 \r\n",
+ "\n",
+ "14 \u000e\n",
+ "\n",
+ "15 \u000f\n",
+ "\n",
+ "16 \u0010\n",
+ "\n",
+ "17 \u0011\n",
+ "\n",
+ "18 \u0012\n",
+ "\n",
+ "19 \u0013\n",
+ "\n",
+ "20 \u0014\n",
+ "\n",
+ "21 \u0015\n",
+ "\n",
+ "22 \u0016\n",
+ "\n",
+ "23 \u0017\n",
+ "\n",
+ "24 \u0018\n",
+ "\n",
+ "25 \u0019\n",
+ "\n",
+ "26 \u001a\n",
+ "\n",
+ "27 \u001b\n",
+ "\n",
+ "28 \u001c",
+ "\n",
+ "\n",
+ "29 \u001d",
+ "\n",
+ "\n",
+ "30 \u001e",
+ "\n",
+ "\n",
+ "31 \u001f\n",
+ "\n",
+ "32 \n",
+ "\n",
+ "33 !\n",
+ "\n",
+ "34 \"\n",
+ "\n",
+ "35 #\n",
+ "\n",
+ "36 $\n",
+ "\n",
+ "37 %\n",
+ "\n",
+ "38 &\n",
+ "\n",
+ "39 '\n",
+ "\n",
+ "40 (\n",
+ "\n",
+ "41 )\n",
+ "\n",
+ "42 *\n",
+ "\n",
+ "43 +\n",
+ "\n",
+ "44 ,\n",
+ "\n",
+ "45 -\n",
+ "\n",
+ "46 .\n",
+ "\n",
+ "47 /\n",
+ "\n",
+ "48 0\n",
+ "\n",
+ "49 1\n",
+ "\n",
+ "50 2\n",
+ "\n",
+ "51 3\n",
+ "\n",
+ "52 4\n",
+ "\n",
+ "53 5\n",
+ "\n",
+ "54 6\n",
+ "\n",
+ "55 7\n",
+ "\n",
+ "56 8\n",
+ "\n",
+ "57 9\n",
+ "\n",
+ "58 :\n",
+ "\n",
+ "59 ;\n",
+ "\n",
+ "60 <\n",
+ "\n",
+ "61 =\n",
+ "\n",
+ "62 >\n",
+ "\n",
+ "63 ?\n",
+ "\n",
+ "64 @\n",
+ "\n",
+ "65 A\n",
+ "\n",
+ "66 B\n",
+ "\n",
+ "67 C\n",
+ "\n",
+ "68 D\n",
+ "\n",
+ "69 E\n",
+ "\n",
+ "70 F\n",
+ "\n",
+ "71 G\n",
+ "\n",
+ "72 H\n",
+ "\n",
+ "73 I\n",
+ "\n",
+ "74 J\n",
+ "\n",
+ "75 K\n",
+ "\n",
+ "76 L\n",
+ "\n",
+ "77 M\n",
+ "\n",
+ "78 N\n",
+ "\n",
+ "79 O\n",
+ "\n",
+ "80 P\n",
+ "\n",
+ "81 Q\n",
+ "\n",
+ "82 R\n",
+ "\n",
+ "83 S\n",
+ "\n",
+ "84 T\n",
+ "\n",
+ "85 U\n",
+ "\n",
+ "86 V\n",
+ "\n",
+ "87 W\n",
+ "\n",
+ "88 X\n",
+ "\n",
+ "89 Y\n",
+ "\n",
+ "90 Z\n",
+ "\n",
+ "91 [\n",
+ "\n",
+ "92 \\\n",
+ "\n",
+ "93 ]\n",
+ "\n",
+ "94 ^\n",
+ "\n",
+ "95 _\n",
+ "\n",
+ "96 `\n",
+ "\n",
+ "97 a\n",
+ "\n",
+ "98 b\n",
+ "\n",
+ "99 c\n",
+ "\n",
+ "100 d\n",
+ "\n",
+ "101 e\n",
+ "\n",
+ "102 f\n",
+ "\n",
+ "103 g\n",
+ "\n",
+ "104 h\n",
+ "\n",
+ "105 i\n",
+ "\n",
+ "106 j\n",
+ "\n",
+ "107 k\n",
+ "\n",
+ "108 l\n",
+ "\n",
+ "109 m\n",
+ "\n",
+ "110 n\n",
+ "\n",
+ "111 o\n",
+ "\n",
+ "112 p\n",
+ "\n",
+ "113 q\n",
+ "\n",
+ "114 r\n",
+ "\n",
+ "115 s\n",
+ "\n",
+ "116 t\n",
+ "\n",
+ "117 u\n",
+ "\n",
+ "118 v\n",
+ "\n",
+ "119 w\n",
+ "\n",
+ "120 x\n",
+ "\n",
+ "121 y\n",
+ "\n",
+ "122 z\n",
+ "\n",
+ "123 {\n",
+ "\n",
+ "124 |\n",
+ "\n",
+ "125 }\n",
+ "\n",
+ "126 ~\n",
+ "\n",
+ "127 \u007f\n",
+ "\n",
+ "128 \ufffd\n",
+ "\n",
+ "129 \ufffd\n",
+ "\n",
+ "130 \ufffd\n",
+ "\n",
+ "131 \ufffd\n",
+ "\n",
+ "132 \ufffd\n",
+ "\n",
+ "133 \ufffd\n",
+ "\n",
+ "134 \ufffd\n",
+ "\n",
+ "135 \ufffd\n",
+ "\n",
+ "136 \ufffd\n",
+ "\n",
+ "137 \ufffd\n",
+ "\n",
+ "138 \ufffd\n",
+ "\n",
+ "139 \ufffd\n",
+ "\n",
+ "140 \ufffd\n",
+ "\n",
+ "141 \ufffd\n",
+ "\n",
+ "142 \ufffd\n",
+ "\n",
+ "143 \ufffd\n",
+ "\n",
+ "144 \ufffd\n",
+ "\n",
+ "145 \ufffd\n",
+ "\n",
+ "146 \ufffd\n",
+ "\n",
+ "147 \ufffd\n",
+ "\n",
+ "148 \ufffd\n",
+ "\n",
+ "149 \ufffd\n",
+ "\n",
+ "150 \ufffd\n",
+ "\n",
+ "151 \ufffd\n",
+ "\n",
+ "152 \ufffd\n",
+ "\n",
+ "153 \ufffd\n",
+ "\n",
+ "154 \ufffd\n",
+ "\n",
+ "155 \ufffd\n",
+ "\n",
+ "156 \ufffd\n",
+ "\n",
+ "157 \ufffd\n",
+ "\n",
+ "158 \ufffd\n",
+ "\n",
+ "159 \ufffd\n",
+ "\n",
+ "160 \ufffd\n",
+ "\n",
+ "161 \ufffd\n",
+ "\n",
+ "162 \ufffd\n",
+ "\n",
+ "163 \ufffd\n",
+ "\n",
+ "164 \ufffd\n",
+ "\n",
+ "165 \ufffd\n",
+ "\n",
+ "166 \ufffd\n",
+ "\n",
+ "167 \ufffd\n",
+ "\n",
+ "168 \ufffd\n",
+ "\n",
+ "169 \ufffd\n",
+ "\n",
+ "170 \ufffd\n",
+ "\n",
+ "171 \ufffd\n",
+ "\n",
+ "172 \ufffd\n",
+ "\n",
+ "173 \ufffd\n",
+ "\n",
+ "174 \ufffd\n",
+ "\n",
+ "175 \ufffd\n",
+ "\n",
+ "176 \ufffd\n",
+ "\n",
+ "177 \ufffd\n",
+ "\n",
+ "178 \ufffd\n",
+ "\n",
+ "179 \ufffd\n",
+ "\n",
+ "180 \ufffd\n",
+ "\n",
+ "181 \ufffd\n",
+ "\n",
+ "182 \ufffd\n",
+ "\n",
+ "183 \ufffd\n",
+ "\n",
+ "184 \ufffd\n",
+ "\n",
+ "185 \ufffd\n",
+ "\n",
+ "186 \ufffd\n",
+ "\n",
+ "187 \ufffd\n",
+ "\n",
+ "188 \ufffd\n",
+ "\n",
+ "189 \ufffd\n",
+ "\n",
+ "190 \ufffd\n",
+ "\n",
+ "191 \ufffd\n",
+ "\n",
+ "192 \ufffd\n",
+ "\n",
+ "193 \ufffd\n",
+ "\n",
+ "194 \ufffd\n",
+ "\n",
+ "195 \ufffd\n",
+ "\n",
+ "196 \ufffd\n",
+ "\n",
+ "197 \ufffd\n",
+ "\n",
+ "198 \ufffd\n",
+ "\n",
+ "199 \ufffd\n",
+ "\n",
+ "200 \ufffd\n",
+ "\n",
+ "201 \ufffd\n",
+ "\n",
+ "202 \ufffd\n",
+ "\n",
+ "203 \ufffd\n",
+ "\n",
+ "204 \ufffd\n",
+ "\n",
+ "205 \ufffd\n",
+ "\n",
+ "206 \ufffd\n",
+ "\n",
+ "207 \ufffd\n",
+ "\n",
+ "208 \ufffd\n",
+ "\n",
+ "209 \ufffd\n",
+ "\n",
+ "210 \ufffd\n",
+ "\n",
+ "211 \ufffd\n",
+ "\n",
+ "212 \ufffd\n",
+ "\n",
+ "213 \ufffd\n",
+ "\n",
+ "214 \ufffd\n",
+ "\n",
+ "215 \ufffd\n",
+ "\n",
+ "216 \ufffd\n",
+ "\n",
+ "217 \ufffd\n",
+ "\n",
+ "218 \ufffd\n",
+ "\n",
+ "219 \ufffd\n",
+ "\n",
+ "220 \ufffd\n",
+ "\n",
+ "221 \ufffd\n",
+ "\n",
+ "222 \ufffd\n",
+ "\n",
+ "223 \ufffd\n",
+ "\n",
+ "224 \ufffd\n",
+ "\n",
+ "225 \ufffd\n",
+ "\n",
+ "226 \ufffd\n",
+ "\n",
+ "227 \ufffd\n",
+ "\n",
+ "228 \ufffd\n",
+ "\n",
+ "229 \ufffd\n",
+ "\n",
+ "230 \ufffd\n",
+ "\n",
+ "231 \ufffd\n",
+ "\n",
+ "232 \ufffd\n",
+ "\n",
+ "233 \ufffd\n",
+ "\n",
+ "234 \ufffd\n",
+ "\n",
+ "235 \ufffd\n",
+ "\n",
+ "236 \ufffd\n",
+ "\n",
+ "237 \ufffd\n",
+ "\n",
+ "238 \ufffd\n",
+ "\n",
+ "239 \ufffd\n",
+ "\n",
+ "240 \ufffd\n",
+ "\n",
+ "241 \ufffd\n",
+ "\n",
+ "242 \ufffd\n",
+ "\n",
+ "243 \ufffd\n",
+ "\n",
+ "244 \ufffd\n",
+ "\n",
+ "245 \ufffd\n",
+ "\n",
+ "246 \ufffd\n",
+ "\n",
+ "247 \ufffd\n",
+ "\n",
+ "248 \ufffd\n",
+ "\n",
+ "249 \ufffd\n",
+ "\n",
+ "250 \ufffd\n",
+ "\n",
+ "251 \ufffd\n",
+ "\n",
+ "252 \ufffd\n",
+ "\n",
+ "253 \ufffd\n",
+ "\n",
+ "254 \ufffd\n",
+ "\n",
+ "255 \ufffd\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:200"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for ch in range(0,255,1):\n",
+ " print \"%d %c\\n\" % (ch,ch)\n",
+ "print \"%d %c\\n\" % (ch,ch)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0 \u0000\n",
+ "\n",
+ "1 \u0001\n",
+ "\n",
+ "2 \u0002\n",
+ "\n",
+ "3 \u0003\n",
+ "\n",
+ "4 \u0004\n",
+ "\n",
+ "5 \u0005\n",
+ "\n",
+ "6 \u0006\n",
+ "\n",
+ "7 \u0007\n",
+ "\n",
+ "8 \b\n",
+ "\n",
+ "9 \t\n",
+ "\n",
+ "10 \n",
+ "\n",
+ "\n",
+ "11 \u000b",
+ "\n",
+ "\n",
+ "12 \f",
+ "\n",
+ "\n",
+ "13 \r\n",
+ "\n",
+ "14 \u000e\n",
+ "\n",
+ "15 \u000f\n",
+ "\n",
+ "16 \u0010\n",
+ "\n",
+ "17 \u0011\n",
+ "\n",
+ "18 \u0012\n",
+ "\n",
+ "19 \u0013\n",
+ "\n",
+ "20 \u0014\n",
+ "\n",
+ "21 \u0015\n",
+ "\n",
+ "22 \u0016\n",
+ "\n",
+ "23 \u0017\n",
+ "\n",
+ "24 \u0018\n",
+ "\n",
+ "25 \u0019\n",
+ "\n",
+ "26 \u001a\n",
+ "\n",
+ "27 \u001b\n",
+ "\n",
+ "28 \u001c",
+ "\n",
+ "\n",
+ "29 \u001d",
+ "\n",
+ "\n",
+ "30 \u001e",
+ "\n",
+ "\n",
+ "31 \u001f\n",
+ "\n",
+ "32 \n",
+ "\n",
+ "33 !\n",
+ "\n",
+ "34 \"\n",
+ "\n",
+ "35 #\n",
+ "\n",
+ "36 $\n",
+ "\n",
+ "37 %\n",
+ "\n",
+ "38 &\n",
+ "\n",
+ "39 '\n",
+ "\n",
+ "40 (\n",
+ "\n",
+ "41 )\n",
+ "\n",
+ "42 *\n",
+ "\n",
+ "43 +\n",
+ "\n",
+ "44 ,\n",
+ "\n",
+ "45 -\n",
+ "\n",
+ "46 .\n",
+ "\n",
+ "47 /\n",
+ "\n",
+ "48 0\n",
+ "\n",
+ "49 1\n",
+ "\n",
+ "50 2\n",
+ "\n",
+ "51 3\n",
+ "\n",
+ "52 4\n",
+ "\n",
+ "53 5\n",
+ "\n",
+ "54 6\n",
+ "\n",
+ "55 7\n",
+ "\n",
+ "56 8\n",
+ "\n",
+ "57 9\n",
+ "\n",
+ "58 :\n",
+ "\n",
+ "59 ;\n",
+ "\n",
+ "60 <\n",
+ "\n",
+ "61 =\n",
+ "\n",
+ "62 >\n",
+ "\n",
+ "63 ?\n",
+ "\n",
+ "64 @\n",
+ "\n",
+ "65 A\n",
+ "\n",
+ "66 B\n",
+ "\n",
+ "67 C\n",
+ "\n",
+ "68 D\n",
+ "\n",
+ "69 E\n",
+ "\n",
+ "70 F\n",
+ "\n",
+ "71 G\n",
+ "\n",
+ "72 H\n",
+ "\n",
+ "73 I\n",
+ "\n",
+ "74 J\n",
+ "\n",
+ "75 K\n",
+ "\n",
+ "76 L\n",
+ "\n",
+ "77 M\n",
+ "\n",
+ "78 N\n",
+ "\n",
+ "79 O\n",
+ "\n",
+ "80 P\n",
+ "\n",
+ "81 Q\n",
+ "\n",
+ "82 R\n",
+ "\n",
+ "83 S\n",
+ "\n",
+ "84 T\n",
+ "\n",
+ "85 U\n",
+ "\n",
+ "86 V\n",
+ "\n",
+ "87 W\n",
+ "\n",
+ "88 X\n",
+ "\n",
+ "89 Y\n",
+ "\n",
+ "90 Z\n",
+ "\n",
+ "91 [\n",
+ "\n",
+ "92 \\\n",
+ "\n",
+ "93 ]\n",
+ "\n",
+ "94 ^\n",
+ "\n",
+ "95 _\n",
+ "\n",
+ "96 `\n",
+ "\n",
+ "97 a\n",
+ "\n",
+ "98 b\n",
+ "\n",
+ "99 c\n",
+ "\n",
+ "100 d\n",
+ "\n",
+ "101 e\n",
+ "\n",
+ "102 f\n",
+ "\n",
+ "103 g\n",
+ "\n",
+ "104 h\n",
+ "\n",
+ "105 i\n",
+ "\n",
+ "106 j\n",
+ "\n",
+ "107 k\n",
+ "\n",
+ "108 l\n",
+ "\n",
+ "109 m\n",
+ "\n",
+ "110 n\n",
+ "\n",
+ "111 o\n",
+ "\n",
+ "112 p\n",
+ "\n",
+ "113 q\n",
+ "\n",
+ "114 r\n",
+ "\n",
+ "115 s\n",
+ "\n",
+ "116 t\n",
+ "\n",
+ "117 u\n",
+ "\n",
+ "118 v\n",
+ "\n",
+ "119 w\n",
+ "\n",
+ "120 x\n",
+ "\n",
+ "121 y\n",
+ "\n",
+ "122 z\n",
+ "\n",
+ "123 {\n",
+ "\n",
+ "124 |\n",
+ "\n",
+ "125 }\n",
+ "\n",
+ "126 ~\n",
+ "\n",
+ "127 \u007f\n",
+ "\n",
+ "128 \ufffd\n",
+ "\n",
+ "129 \ufffd\n",
+ "\n",
+ "130 \ufffd\n",
+ "\n",
+ "131 \ufffd\n",
+ "\n",
+ "132 \ufffd\n",
+ "\n",
+ "133 \ufffd\n",
+ "\n",
+ "134 \ufffd\n",
+ "\n",
+ "135 \ufffd\n",
+ "\n",
+ "136 \ufffd\n",
+ "\n",
+ "137 \ufffd\n",
+ "\n",
+ "138 \ufffd\n",
+ "\n",
+ "139 \ufffd\n",
+ "\n",
+ "140 \ufffd\n",
+ "\n",
+ "141 \ufffd\n",
+ "\n",
+ "142 \ufffd\n",
+ "\n",
+ "143 \ufffd\n",
+ "\n",
+ "144 \ufffd\n",
+ "\n",
+ "145 \ufffd\n",
+ "\n",
+ "146 \ufffd\n",
+ "\n",
+ "147 \ufffd\n",
+ "\n",
+ "148 \ufffd\n",
+ "\n",
+ "149 \ufffd\n",
+ "\n",
+ "150 \ufffd\n",
+ "\n",
+ "151 \ufffd\n",
+ "\n",
+ "152 \ufffd\n",
+ "\n",
+ "153 \ufffd\n",
+ "\n",
+ "154 \ufffd\n",
+ "\n",
+ "155 \ufffd\n",
+ "\n",
+ "156 \ufffd\n",
+ "\n",
+ "157 \ufffd\n",
+ "\n",
+ "158 \ufffd\n",
+ "\n",
+ "159 \ufffd\n",
+ "\n",
+ "160 \ufffd\n",
+ "\n",
+ "161 \ufffd\n",
+ "\n",
+ "162 \ufffd\n",
+ "\n",
+ "163 \ufffd\n",
+ "\n",
+ "164 \ufffd\n",
+ "\n",
+ "165 \ufffd\n",
+ "\n",
+ "166 \ufffd\n",
+ "\n",
+ "167 \ufffd\n",
+ "\n",
+ "168 \ufffd\n",
+ "\n",
+ "169 \ufffd\n",
+ "\n",
+ "170 \ufffd\n",
+ "\n",
+ "171 \ufffd\n",
+ "\n",
+ "172 \ufffd\n",
+ "\n",
+ "173 \ufffd\n",
+ "\n",
+ "174 \ufffd\n",
+ "\n",
+ "175 \ufffd\n",
+ "\n",
+ "176 \ufffd\n",
+ "\n",
+ "177 \ufffd\n",
+ "\n",
+ "178 \ufffd\n",
+ "\n",
+ "179 \ufffd\n",
+ "\n",
+ "180 \ufffd\n",
+ "\n",
+ "181 \ufffd\n",
+ "\n",
+ "182 \ufffd\n",
+ "\n",
+ "183 \ufffd\n",
+ "\n",
+ "184 \ufffd\n",
+ "\n",
+ "185 \ufffd\n",
+ "\n",
+ "186 \ufffd\n",
+ "\n",
+ "187 \ufffd\n",
+ "\n",
+ "188 \ufffd\n",
+ "\n",
+ "189 \ufffd\n",
+ "\n",
+ "190 \ufffd\n",
+ "\n",
+ "191 \ufffd\n",
+ "\n",
+ "192 \ufffd\n",
+ "\n",
+ "193 \ufffd\n",
+ "\n",
+ "194 \ufffd\n",
+ "\n",
+ "195 \ufffd\n",
+ "\n",
+ "196 \ufffd\n",
+ "\n",
+ "197 \ufffd\n",
+ "\n",
+ "198 \ufffd\n",
+ "\n",
+ "199 \ufffd\n",
+ "\n",
+ "200 \ufffd\n",
+ "\n",
+ "201 \ufffd\n",
+ "\n",
+ "202 \ufffd\n",
+ "\n",
+ "203 \ufffd\n",
+ "\n",
+ "204 \ufffd\n",
+ "\n",
+ "205 \ufffd\n",
+ "\n",
+ "206 \ufffd\n",
+ "\n",
+ "207 \ufffd\n",
+ "\n",
+ "208 \ufffd\n",
+ "\n",
+ "209 \ufffd\n",
+ "\n",
+ "210 \ufffd\n",
+ "\n",
+ "211 \ufffd\n",
+ "\n",
+ "212 \ufffd\n",
+ "\n",
+ "213 \ufffd\n",
+ "\n",
+ "214 \ufffd\n",
+ "\n",
+ "215 \ufffd\n",
+ "\n",
+ "216 \ufffd\n",
+ "\n",
+ "217 \ufffd\n",
+ "\n",
+ "218 \ufffd\n",
+ "\n",
+ "219 \ufffd\n",
+ "\n",
+ "220 \ufffd\n",
+ "\n",
+ "221 \ufffd\n",
+ "\n",
+ "222 \ufffd\n",
+ "\n",
+ "223 \ufffd\n",
+ "\n",
+ "224 \ufffd\n",
+ "\n",
+ "225 \ufffd\n",
+ "\n",
+ "226 \ufffd\n",
+ "\n",
+ "227 \ufffd\n",
+ "\n",
+ "228 \ufffd\n",
+ "\n",
+ "229 \ufffd\n",
+ "\n",
+ "230 \ufffd\n",
+ "\n",
+ "231 \ufffd\n",
+ "\n",
+ "232 \ufffd\n",
+ "\n",
+ "233 \ufffd\n",
+ "\n",
+ "234 \ufffd\n",
+ "\n",
+ "235 \ufffd\n",
+ "\n",
+ "236 \ufffd\n",
+ "\n",
+ "237 \ufffd\n",
+ "\n",
+ "238 \ufffd\n",
+ "\n",
+ "239 \ufffd\n",
+ "\n",
+ "240 \ufffd\n",
+ "\n",
+ "241 \ufffd\n",
+ "\n",
+ "242 \ufffd\n",
+ "\n",
+ "243 \ufffd\n",
+ "\n",
+ "244 \ufffd\n",
+ "\n",
+ "245 \ufffd\n",
+ "\n",
+ "246 \ufffd\n",
+ "\n",
+ "247 \ufffd\n",
+ "\n",
+ "248 \ufffd\n",
+ "\n",
+ "249 \ufffd\n",
+ "\n",
+ "250 \ufffd\n",
+ "\n",
+ "251 \ufffd\n",
+ "\n",
+ "252 \ufffd\n",
+ "\n",
+ "253 \ufffd\n",
+ "\n",
+ "254 \ufffd\n",
+ "\n",
+ "254 \ufffd\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:200-201"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ " \n",
+ "c=raw_input()\n",
+ "d=raw_input()\n",
+ "print \"%c %c\\n\" % (c,d)\n",
+ "#int\n",
+ "i=eval(raw_input())\n",
+ "j=eval(raw_input())\n",
+ "print \"%d %u\\n\" % (i,j)\n",
+ "#short int\n",
+ "k=eval(raw_input())\n",
+ "l=eval(raw_input())\n",
+ "print \"%d %u\\n\" % (k,l)\n",
+ "#long int\n",
+ "m=eval(raw_input())\n",
+ "n=eval(raw_input())\n",
+ "print \"%ld %lu\\n\" % (m,n)\n",
+ "#float,double,long double\n",
+ "x=eval(raw_input())\n",
+ "y=eval(raw_input())\n",
+ "z=eval(raw_input())\n",
+ "print \"%f %lf %Lf\\n\" % (x,y,z)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "a\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "b\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "a b\n",
+ "\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "10000\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "7389\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "10000 7389\n",
+ "\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "34\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "585\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "34 585\n",
+ "\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "34676\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "500000\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "34676 500000\n",
+ "\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "445.55\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "57846.44\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "55666885.6655\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "445.550000 57846.440000 55666885.665500\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:205"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def main():\n",
+ " i=1\n",
+ " def main2():\n",
+ " def main3():\n",
+ " print \"%d\" % (i) #prints 1\n",
+ " main3()\n",
+ " print \"%d\" % (i) #prints 1\n",
+ " main2()\n",
+ " print \"%d\\n\" % (i) #prints 1\n",
+ "main()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "1\n",
+ "1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:205"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def main():\n",
+ " i=1\n",
+ " def main2():\n",
+ " i=2\n",
+ " def main3():\n",
+ " i=3\n",
+ " print \"%d\" % (i) #prints 3\n",
+ " main3()\n",
+ " print \"%d\" % (i) #prints 2\n",
+ " main2()\n",
+ " print \"%d\\n\" % (i) #prints 1\n",
+ "main()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3\n",
+ "2\n",
+ "1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:206"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "for i in range(1,11,1):\n",
+ " print \"%d\\n\" % (i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "\n",
+ "2\n",
+ "\n",
+ "3\n",
+ "\n",
+ "4\n",
+ "\n",
+ "5\n",
+ "\n",
+ "6\n",
+ "\n",
+ "7\n",
+ "\n",
+ "8\n",
+ "\n",
+ "9\n",
+ "\n",
+ "10\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:208"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def increment():\n",
+ " i=1\n",
+ " print \"%d\\n\" % (i) #prints 1 every time\n",
+ " i=i+1\n",
+ "increment()\n",
+ "increment()\n",
+ "increment()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "\n",
+ "1\n",
+ "\n",
+ "1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:208"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def static_var(varname, value): #function to make it static\n",
+ " def decorate(func):\n",
+ " setattr(func, varname, value)\n",
+ " return func\n",
+ " return decorate\n",
+ "@static_var(\"i\", 1) #i is static variable\n",
+ "def increment():\n",
+ " print \"%d\\n\" % increment.i\n",
+ " increment.i += 1\n",
+ "increment()\n",
+ "increment()\n",
+ "increment()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "\n",
+ "2\n",
+ "\n",
+ "3\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:209"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def fun():\n",
+ " k=35\n",
+ " return id(k) #returns address of k\n",
+ "j=fun() #stores address of k\n",
+ "print \"%d\\n\" % (j) #prints address of k"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "19639600\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:210"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def increment():\n",
+ " global i #gloabal declaration\n",
+ " i=i+1\n",
+ " print \"on incrementing i=%d\\n\" % (i)\n",
+ "def decrement():\n",
+ " global i #global declaration\n",
+ " i=i-1\n",
+ " print \"on decrementing i=%d\\n\" % (i)\n",
+ "i=0\n",
+ "print \"\\ni=%d\" % (i)\n",
+ "increment()\n",
+ "increment()\n",
+ "decrement()\n",
+ "decrement()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "i=0\n",
+ "on incrementing i=1\n",
+ "\n",
+ "on incrementing i=2\n",
+ "\n",
+ "on decrementing i=1\n",
+ "\n",
+ "on decrementing i=0\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:211"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "x=21\n",
+ "def main():\n",
+ " global x,y\n",
+ " print \"%d %d\\n\" % (x,y)\n",
+ "y=31\n",
+ "main()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "21 31\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:211"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def display():\n",
+ " global x #global variable\n",
+ " print \"%d\\n\" % (x) #prints 10\n",
+ "x=10\n",
+ "def main():\n",
+ " x=20 #local variable for main\n",
+ " print \"%d\\n\" % (x) #prints 20\n",
+ " display()\n",
+ "main()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "20\n",
+ "\n",
+ "10\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:212-213"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def fun1():\n",
+ " global i\n",
+ " i+=1\n",
+ " print \"%d\\n\" % (i)\n",
+ "def fun2():\n",
+ " global i\n",
+ " i-=1\n",
+ " print \"%d\\n\" % (i)\n",
+ "i=35\n",
+ "print \"%d\\n\" % (i)\n",
+ "fun1()\n",
+ "fun2()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "35\n",
+ "\n",
+ "36\n",
+ "\n",
+ "35\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter7.ipynb b/ANSI_C_Programming/chapter7.ipynb
index e79f1d7e..ad0fddd9 100644
--- a/ANSI_C_Programming/chapter7.ipynb
+++ b/ANSI_C_Programming/chapter7.ipynb
@@ -1,767 +1,766 @@
-{
- "metadata": {
- "name": "chapter7.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 7:THE C PREPROCESSOR"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:226"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using macros in for loop\n",
- "#Note:Implementing the concept of macros using function\n",
- "def UPPER(): #set UPPER() as 25\n",
- " return 25\n",
- "for i in range(1,UPPER()+1,1):\n",
- " print \"%d\\n\" % (i)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1\n",
- "\n",
- "2\n",
- "\n",
- "3\n",
- "\n",
- "4\n",
- "\n",
- "5\n",
- "\n",
- "6\n",
- "\n",
- "7\n",
- "\n",
- "8\n",
- "\n",
- "9\n",
- "\n",
- "10\n",
- "\n",
- "11\n",
- "\n",
- "12\n",
- "\n",
- "13\n",
- "\n",
- "14\n",
- "\n",
- "15\n",
- "\n",
- "16\n",
- "\n",
- "17\n",
- "\n",
- "18\n",
- "\n",
- "19\n",
- "\n",
- "20\n",
- "\n",
- "21\n",
- "\n",
- "22\n",
- "\n",
- "23\n",
- "\n",
- "24\n",
- "\n",
- "25\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:227"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Defing PI as 3.14 using macros(here functions)\n",
- "def PI(): #set PI() as 3.14\n",
- " return 3.14\n",
- "r=6.25\n",
- "area=PI()*r*r\n",
- "print \"Area of circle=%f\\n\" % (area)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Area of circle=122.656250\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:229"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Defining AND & OR operations using macros\n",
- "def AND(x,y): #set AND(x,y) for \"and\" operation\n",
- " return (x and y)\n",
- "def OR(a,b): #set OR(a,b) for \"or\" operation\n",
- " return (a or b)\n",
- "f=1\n",
- "x=4\n",
- "y=90\n",
- "if (AND(f<5,OR(x<=20,y<=45))):\n",
- " print \"Your PC will always work fine...\\n\"\n",
- "else:\n",
- " print \"In front of the maintenance man\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Your PC will always work fine...\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:229"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Using macros inside another macros\n",
- "def AND(x,y): #set AND(x,y) for \"and\" operation\n",
- " return (x and y)\n",
- "def ARANGE():\n",
- " return (AND(a>25,a<50)) #check for a>25 and a<50\n",
- "a=30\n",
- "if (ARANGE()):\n",
- " print \"within range\\n\"\n",
- "else:\n",
- " print \"out of range\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "within range\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:230"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using macros to replace whole statement\n",
- "def FOUND():\n",
- " print \"The Yankee Doodle Virus\\n\"\n",
- "signature='Y'\n",
- "if (signature=='Y'):\n",
- " FOUND()\n",
- "else:\n",
- " print \"Safe... as yet!\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Yankee Doodle Virus\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:230"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#macros with arguments to find area of circle\n",
- "def AREA(x):\n",
- " return (3.14*x*x)\n",
- "r1=6.25\n",
- "r2=2.5\n",
- "a=AREA(r1)\n",
- "print \"Area of circle=%f\\n\" % (a)\n",
- "a=AREA(r2)\n",
- "print \"Area of circle=%f\\n\" % (a)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Area of circle=122.656250\n",
- "\n",
- "Area of circle=19.625000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:231"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#compiler interpretation of above program\n",
- "r1=6.25\n",
- "r2=2.5\n",
- "a=3.14*r1*r1\n",
- "print \"Area of circle=%f\\n\" % (a)\n",
- "a=3.14*r2*r2\n",
- "print \"Area of circle=%f\\n\" % (a)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Area of circle=122.656250\n",
- "\n",
- "Area of circle=19.625000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:231"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#macros with argument to check if user-input is digit or not\n",
- "def ISDIGIT(y):\n",
- " return (y>=48 and y<=57)\n",
- "print \"Enter any digit\"\n",
- "ch=raw_input()\n",
- "if (ISDIGIT(ord(ch))):\n",
- " print \"You entered a digit\\n\"\n",
- "else:\n",
- " print \"Illegal input\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter any digit\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "7\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "You entered a digit\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:232"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#evaluating an expression\n",
- "def SQUARE(n):\n",
- " return (n*n)\n",
- "j=64/SQUARE(4) #it's function not macros ,so j=4\n",
- "print \"j=%d\\n\" % (j)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "j=4\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:233"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#gotoxy is not present in python,On Linux and other UNIX-like systems you can use curses library.\n",
- "#We can use setsyx func. of curses in place of gotoxy but it will be limited to unix only.\n",
- "def HLINE():\n",
- " for i in range(0,79,1):\n",
- " print \"%c\" % 45, #characters are bytes and therefore encoding-dependent(non utf-8)\n",
- " print \"\\n\"\n",
- "def VLINE(X,Y):\n",
- " print \"%c\" % 124 #If you want to write 179 in place of 124 then use utf-8 encoding\n",
- "HLINE()\n",
- "for y in range(1,25,1):\n",
- " VLINE(39,y)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n",
- "\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n",
- "|\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:236-237"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using ifdef macros for conditional compilation\n",
- "OKAY=False\n",
- "if OKAY:\n",
- " import logging\n",
- " print \"statement 1\"\n",
- " print \"statement 2\" #detects virus\n",
- " print \"statement 3\" \n",
- " print \"statement 4\" #specific to stone virus\n",
- "print \"statement 5\"\n",
- "print \"statement 6\"\n",
- "print \"statement 7\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "statement 5\n",
- "statement 6\n",
- "statement 7\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:237"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using ifdef else macros for conditional compilation\n",
- "INTEL=False\n",
- "if INTEL:\n",
- " print \"code suitable for an Intel PC\"\n",
- "else:\n",
- " print \"code suitable for a Motorola PC\"\n",
- "print \"code common to both the computers\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "code suitable for a Motorola PC\n",
- "code common to both the computers\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:238"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using ifdef else macros for conditional compilation\n",
- "INTEL=True\n",
- "if INTEL:\n",
- " print \"code suitable for a Intel PC\"\n",
- "else:\n",
- " print \"code suitable for a motorola PC\"\n",
- "print \"code common to both the computers\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "code suitable for a Intel PC\n",
- "code common to both the computers\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:239"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using #if directive for conditional compilation\n",
- "TEST=6\n",
- "if TEST<=5:\n",
- " print \"statement 1\"\n",
- " print \"statement 2\"\n",
- " print \"statement 3\"\n",
- "else:\n",
- " print \"statement 4\"\n",
- " print \"statement 5\"\n",
- " print \"statement 6\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "statement 4\n",
- "statement 5\n",
- "statement 6\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:239"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using nested if else directives for conditional compilation\n",
- "ADAPTER='SVGA'\n",
- "if ADAPTER=='VGA':\n",
- " print \"code for video graphics array\"\n",
- "else:\n",
- " if ADAPTER=='SVGA':\n",
- " print \"code for super video graphics array\"\n",
- " else:\n",
- " print \"code for extended graphics array\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "code for super video graphics array\n"
- ]
- }
- ],
- "prompt_number": 17
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:239-240"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#using #elif directives for conditional compilation\n",
- "ADAPTER='SVGA'\n",
- "if ADAPTER=='VGA':\n",
- " print \"code for video graphics array\"\n",
- "elif ADAPTER=='SVGA':\n",
- " print \"code for super video graphics array\"\n",
- "else:\n",
- " print \"code for extented graphics adapter\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "code for super video graphics array\n"
- ]
- }
- ],
- "prompt_number": 18
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:241"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Controlled execution of functions\n",
- "def fun1():\n",
- " print \"Inside fun1\\n\"\n",
- "def fun2():\n",
- " print \"Inside fun 2\\n\"\n",
- "def main():\n",
- " print \"Inside main\\n\"\n",
- "fun1()\n",
- "main()\n",
- "fun2()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Inside fun1\n",
- "\n",
- "Inside main\n",
- "\n",
- "Inside fun 2\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 19
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:242"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Statements causing warnings & error\n",
- "def f1():\n",
- " a=5\n",
- "def f2(x):\n",
- " print \"Inside f2\" #passed parameter is not being used\n",
- "def f3():\n",
- " x=6\n",
- " return x\n",
- " x+=1 #control can never reach this statement\n",
- "f1()\n",
- "f2(7)\n",
- "f3()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Inside f2\n"
- ]
- },
- {
- "metadata": {},
- "output_type": "pyout",
- "prompt_number": 20,
- "text": [
- "6"
- ]
- }
- ],
- "prompt_number": 20
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:c550564369c57fef1a3abbaae1e7e03e923c7091530a87d2bf35262354fa8d51"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 7:THE C PREPROCESSOR"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:226"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def UPPER(): #set UPPER() as 25\n",
+ " return 25\n",
+ "for i in range(1,UPPER()+1,1):\n",
+ " print \"%d\\n\" % (i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "\n",
+ "2\n",
+ "\n",
+ "3\n",
+ "\n",
+ "4\n",
+ "\n",
+ "5\n",
+ "\n",
+ "6\n",
+ "\n",
+ "7\n",
+ "\n",
+ "8\n",
+ "\n",
+ "9\n",
+ "\n",
+ "10\n",
+ "\n",
+ "11\n",
+ "\n",
+ "12\n",
+ "\n",
+ "13\n",
+ "\n",
+ "14\n",
+ "\n",
+ "15\n",
+ "\n",
+ "16\n",
+ "\n",
+ "17\n",
+ "\n",
+ "18\n",
+ "\n",
+ "19\n",
+ "\n",
+ "20\n",
+ "\n",
+ "21\n",
+ "\n",
+ "22\n",
+ "\n",
+ "23\n",
+ "\n",
+ "24\n",
+ "\n",
+ "25\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:227"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def PI(): #set PI() as 3.14\n",
+ " return 3.14\n",
+ "r=6.25\n",
+ "area=PI()*r*r\n",
+ "print \"Area of circle=%f\\n\" % (area)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area of circle=122.656250\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:229"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def AND(x,y): #set AND(x,y) for \"and\" operation\n",
+ " return (x and y)\n",
+ "def OR(a,b): #set OR(a,b) for \"or\" operation\n",
+ " return (a or b)\n",
+ "f=1\n",
+ "x=4\n",
+ "y=90\n",
+ "if (AND(f<5,OR(x<=20,y<=45))):\n",
+ " print \"Your PC will always work fine...\\n\"\n",
+ "else:\n",
+ " print \"In front of the maintenance man\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Your PC will always work fine...\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:229"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def AND(x,y): #set AND(x,y) for \"and\" operation\n",
+ " return (x and y)\n",
+ "def ARANGE():\n",
+ " return (AND(a>25,a<50)) #check for a>25 and a<50\n",
+ "a=30\n",
+ "if (ARANGE()):\n",
+ " print \"within range\\n\"\n",
+ "else:\n",
+ " print \"out of range\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "within range\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def FOUND():\n",
+ " print \"The Yankee Doodle Virus\\n\"\n",
+ "signature='Y'\n",
+ "if (signature=='Y'):\n",
+ " FOUND()\n",
+ "else:\n",
+ " print \"Safe... as yet!\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Yankee Doodle Virus\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def AREA(x):\n",
+ " return (3.14*x*x)\n",
+ "r1=6.25\n",
+ "r2=2.5\n",
+ "a=AREA(r1)\n",
+ "print \"Area of circle=%f\\n\" % (a)\n",
+ "a=AREA(r2)\n",
+ "print \"Area of circle=%f\\n\" % (a)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area of circle=122.656250\n",
+ "\n",
+ "Area of circle=19.625000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:231"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "r1=6.25\n",
+ "r2=2.5\n",
+ "a=3.14*r1*r1\n",
+ "print \"Area of circle=%f\\n\" % (a)\n",
+ "a=3.14*r2*r2\n",
+ "print \"Area of circle=%f\\n\" % (a)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area of circle=122.656250\n",
+ "\n",
+ "Area of circle=19.625000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:231"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def ISDIGIT(y):\n",
+ " return (y>=48 and y<=57)\n",
+ "print \"Enter any digit\"\n",
+ "ch=raw_input()\n",
+ "if (ISDIGIT(ord(ch))):\n",
+ " print \"You entered a digit\\n\"\n",
+ "else:\n",
+ " print \"Illegal input\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter any digit\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "7\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "You entered a digit\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:232"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def SQUARE(n):\n",
+ " return (n*n)\n",
+ "j=64/SQUARE(4) #it's function not macros ,so j=4\n",
+ "print \"j=%d\\n\" % (j)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "j=4\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:233"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def HLINE():\n",
+ " for i in range(0,79,1):\n",
+ " print \"%c\" % 45, #characters are bytes and therefore encoding-dependent(non utf-8)\n",
+ " print \"\\n\"\n",
+ "def VLINE(X,Y):\n",
+ " print \"%c\" % 124 #If you want to write 179 in place of 124 then use utf-8 encoding\n",
+ "HLINE()\n",
+ "for y in range(1,25,1):\n",
+ " VLINE(39,y)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n",
+ "\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n",
+ "|\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:236-237"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "OKAY=False\n",
+ "if OKAY:\n",
+ " import logging\n",
+ " print \"statement 1\"\n",
+ " print \"statement 2\" #detects virus\n",
+ " print \"statement 3\" \n",
+ " print \"statement 4\" #specific to stone virus\n",
+ "print \"statement 5\"\n",
+ "print \"statement 6\"\n",
+ "print \"statement 7\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "statement 5\n",
+ "statement 6\n",
+ "statement 7\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:237"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "INTEL=False\n",
+ "if INTEL:\n",
+ " print \"code suitable for an Intel PC\"\n",
+ "else:\n",
+ " print \"code suitable for a Motorola PC\"\n",
+ "print \"code common to both the computers\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "code suitable for a Motorola PC\n",
+ "code common to both the computers\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:238"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "INTEL=True\n",
+ "if INTEL:\n",
+ " print \"code suitable for a Intel PC\"\n",
+ "else:\n",
+ " print \"code suitable for a motorola PC\"\n",
+ "print \"code common to both the computers\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "code suitable for a Intel PC\n",
+ "code common to both the computers\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:239"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "TEST=6\n",
+ "if TEST<=5:\n",
+ " print \"statement 1\"\n",
+ " print \"statement 2\"\n",
+ " print \"statement 3\"\n",
+ "else:\n",
+ " print \"statement 4\"\n",
+ " print \"statement 5\"\n",
+ " print \"statement 6\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "statement 4\n",
+ "statement 5\n",
+ "statement 6\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:239"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "ADAPTER='SVGA'\n",
+ "if ADAPTER=='VGA':\n",
+ " print \"code for video graphics array\"\n",
+ "else:\n",
+ " if ADAPTER=='SVGA':\n",
+ " print \"code for super video graphics array\"\n",
+ " else:\n",
+ " print \"code for extended graphics array\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "code for super video graphics array\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:239-240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "ADAPTER='SVGA'\n",
+ "if ADAPTER=='VGA':\n",
+ " print \"code for video graphics array\"\n",
+ "elif ADAPTER=='SVGA':\n",
+ " print \"code for super video graphics array\"\n",
+ "else:\n",
+ " print \"code for extented graphics adapter\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "code for super video graphics array\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:241"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def fun1():\n",
+ " print \"Inside fun1\\n\"\n",
+ "def fun2():\n",
+ " print \"Inside fun 2\\n\"\n",
+ "def main():\n",
+ " print \"Inside main\\n\"\n",
+ "fun1()\n",
+ "main()\n",
+ "fun2()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inside fun1\n",
+ "\n",
+ "Inside main\n",
+ "\n",
+ "Inside fun 2\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:242"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def f1():\n",
+ " a=5\n",
+ "def f2(x):\n",
+ " print \"Inside f2\" #passed parameter is not being used\n",
+ "def f3():\n",
+ " x=6\n",
+ " return x\n",
+ " x+=1 #control can never reach this statement\n",
+ "f1()\n",
+ "f2(7)\n",
+ "f3()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Inside f2\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 20,
+ "text": [
+ "6"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter8.ipynb b/ANSI_C_Programming/chapter8.ipynb
index 9dbb6099..50b1b566 100644
--- a/ANSI_C_Programming/chapter8.ipynb
+++ b/ANSI_C_Programming/chapter8.ipynb
@@ -1,1400 +1,1400 @@
-{
- "metadata": {
- "name": "chapter8.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 8: ARRAYS"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:256"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#reassigning value to a variable\n",
- "x=5\n",
- "x=10\n",
- "print \"x=%d\\n\" % (x) #prints 10"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "x=10\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:257-258"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program to find average marks obtained by a class of 30 students\n",
- "sum=0\n",
- "marks=[] #array declaration\n",
- "for i in range(30):\n",
- " marks.append(0)\n",
- "for i in range(0,30,1):\n",
- " print \"Enter marks\"\n",
- " marks[i]=eval(raw_input()) #store data in array\n",
- "for i in range(0,30,1):\n",
- " sum=sum+marks[i]\n",
- "avg=sum/30\n",
- "print \"Average marks=%d\\n\" % (avg)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "98\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "88\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "97\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "96\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "87\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "89\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "80\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "86\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "95\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "99\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "90\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "100\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "99\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "94\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "85\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "84\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "92\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "91\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "87\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "76\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "75\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "96\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "83\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "80\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "93\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "79\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "70\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "78\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "85\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "86\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Average marks=87\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:261"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#storing elements into an array\n",
- "num=[]\n",
- "for i in range(40):\n",
- " num.append(0)\n",
- "for i in range(0,40,1): #be carefull about the size of the array\n",
- " num[i]=i"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:261-262"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Demonstration of call by value\n",
- "def display(m):\n",
- " print \"%d\" % (m)\n",
- "marks=[55,65,75,56,78,78,90]\n",
- "for i in range(0,7,1):\n",
- " display(marks[i])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "55\n",
- "65\n",
- "75\n",
- "56\n",
- "78\n",
- "78\n",
- "90\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:263"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calling of function inside function to print an array\n",
- "def show(n):\n",
- " print \"%d\" % (n)\n",
- "def disp(n):\n",
- " show(n) #calls show()\n",
- "marks=[55,65,75,56,78,78,90]\n",
- "for i in range(0,7,1):\n",
- " disp(marks[i])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "55\n",
- "65\n",
- "75\n",
- "56\n",
- "78\n",
- "78\n",
- "90\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:263-264"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing address and values of variables\n",
- "i=3\n",
- "j=1.5\n",
- "k='c'\n",
- "print \"Value of i=%d\\n\" % (i)\n",
- "print \"Value of j=%f\\n\" % (j)\n",
- "print \"Value of k=%c\\n\" % (k)\n",
- "x=id(i)\n",
- "y=id(j)\n",
- "z=id(k)\n",
- "print \"Original address in x=%u\\n\" % (x)\n",
- "print \"Original address in y=%u\\n\" % (y)\n",
- "print \"Original address in z=%u\\n\" % (z)\n",
- "x+=1\n",
- "y+=1\n",
- "z+=1\n",
- "print \"New address in x=%u\\n\" % (x)\n",
- "print \"New address in y=%u\\n\" % (y)\n",
- "print \"New address in z=%u\\n\" % (z)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Value of i=3\n",
- "\n",
- "Value of j=1.500000\n",
- "\n",
- "Value of k=c\n",
- "\n",
- "Original address in x=21147312\n",
- "\n",
- "Original address in y=88181272\n",
- "\n",
- "Original address in z=21311640\n",
- "\n",
- "New address in x=21147313\n",
- "\n",
- "New address in y=88181273\n",
- "\n",
- "New address in z=21311641\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:265"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing subtraction of addresses & values of 2 elements of array\n",
- "arr=[10,20,30,45,67,56,74]\n",
- "i=id(arr[1])\n",
- "j=id(arr[5])\n",
- "print \"%d %d\\n\" % (j-i,arr[5]-arr[1])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "-432 36\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:266"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Comparison of addresses of elements of same array\n",
- "arr=[10,20,36,72,45,36]\n",
- "j=id(arr[4])\n",
- "k=id(arr[0+4]) #didn't get any other way\n",
- "if j==k:\n",
- " print \"The two pointers point to the same location\\n\"\n",
- "else:\n",
- " print \"The two pointers do not point to the same location\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The two pointers point to the same location\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:267"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "##printing memory location of elements of array\n",
- "num=[24,34,12,44,56,17]\n",
- "for i in range(0,6,1):\n",
- " print \"element no.%d\" % (i)\n",
- " print \"address=%u\\n\" % (id(num[i]))"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "element no.0\n",
- "address=21147060\n",
- "\n",
- "element no.1\n",
- "address=21146940\n",
- "\n",
- "element no.2\n",
- "address=21147204\n",
- "\n",
- "element no.3\n",
- "address=21146820\n",
- "\n",
- "element no.4\n",
- "address=21146676\n",
- "\n",
- "element no.5\n",
- "address=21147144\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:268"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#print addresses & elements of array\n",
- "num=[24,34,12,44,56,17]\n",
- "for i in range(0,6,1):\n",
- " print \"address=%u\" % (id(num[i]))\n",
- " print \"element=%d\\n\" % (num[i])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "address=21147060\n",
- "element=24\n",
- "\n",
- "address=21146940\n",
- "element=34\n",
- "\n",
- "address=21147204\n",
- "element=12\n",
- "\n",
- "address=21146820\n",
- "element=44\n",
- "\n",
- "address=21146676\n",
- "element=56\n",
- "\n",
- "address=21147144\n",
- "element=17\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:268"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#program for accessing the elements of array\n",
- "num=[24,34,12,44,56,17]\n",
- "j=id(num[0]) #assign address of zeroth element\n",
- "for i in range(0,6,1):\n",
- " print \"address=%u\" % (id(num[i]))\n",
- " print \"element=%d\\n\" % (num[i]) "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "address=21147060\n",
- "element=24\n",
- "\n",
- "address=21146940\n",
- "element=34\n",
- "\n",
- "address=21147204\n",
- "element=12\n",
- "\n",
- "address=21146820\n",
- "element=44\n",
- "\n",
- "address=21146676\n",
- "element=56\n",
- "\n",
- "address=21147144\n",
- "element=17\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:270"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Demonstration of passing an entire array to a function\n",
- "def display(j,n):\n",
- " for item in j:\n",
- " print \"element=%d\\n\" % (item)\n",
- "num=[24,34,12,44,56,17]\n",
- "display(num,6)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "element=24\n",
- "\n",
- "element=34\n",
- "\n",
- "element=12\n",
- "\n",
- "element=44\n",
- "\n",
- "element=56\n",
- "\n",
- "element=17\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:271"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Another way of accessing the elements of array\n",
- "num=[24,34,12,44,56,17]\n",
- "for i in range(0,6,1):\n",
- " print \"address=%u\" % (id(num[i]))\n",
- " print \"element=%d %d\" % (num[i],num[i]) #no other way\n",
- " print \"%d %d\\n\" % (num[i],num[i])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "address=21147060\n",
- "element=24 24\n",
- "24 24\n",
- "\n",
- "address=21146940\n",
- "element=34 34\n",
- "34 34\n",
- "\n",
- "address=21147204\n",
- "element=12 12\n",
- "12 12\n",
- "\n",
- "address=21146820\n",
- "element=44 44\n",
- "44 44\n",
- "\n",
- "address=21146676\n",
- "element=56 56\n",
- "56 56\n",
- "\n",
- "address=21147144\n",
- "element=17 17\n",
- "17 17\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:272"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Storing roll no. & marks of 2 students using 2-D array\n",
- "stud=[[0,0],[0,0],[0,0],[0,0]]\n",
- "for i in range(0,4,1):\n",
- " print \"Enter roll no. and marks\"\n",
- " stud[i][0]=eval(raw_input())\n",
- " stud[i][1]=eval(raw_input())\n",
- "for i in range(0,4,1):\n",
- " print \"%d %d\\n\" % (stud[i][0],stud[i][1])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter roll no. and marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1206030\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "100\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter roll no. and marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1206007\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "95\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter roll no. and marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1206034\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "97\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter roll no. and marks\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1206026\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "88\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1206030 100\n",
- "\n",
- "1206007 95\n",
- "\n",
- "1206034 97\n",
- "\n",
- "1206026 88\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:275"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Demo:2-D array is an array of arrays\n",
- "s=[[1234,56],[1212,33],[1434,80],[1312,78]]\n",
- "for i in range(0,4,1):\n",
- " print \"Address of %dth 1-D array=%u\\n\" % (i,id(s[i]))"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Address of 0th 1-D array=88430392\n",
- "\n",
- "Address of 1th 1-D array=89514192\n",
- "\n",
- "Address of 2th 1-D array=88430712\n",
- "\n",
- "Address of 3th 1-D array=88430312\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:277"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Accessing elements of 2-D array\n",
- "s=[[1234,56],[1212,33],[1434,80],[1312,78]]\n",
- "for i in range(0,4,1):\n",
- " for j in range(0,2,1):\n",
- " print \"%d\" % (s[i][j])\n",
- " print \"\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "1234\n",
- "56\n",
- "\n",
- "\n",
- "1212\n",
- "33\n",
- "\n",
- "\n",
- "1434\n",
- "80\n",
- "\n",
- "\n",
- "1312\n",
- "78\n",
- "\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:277-278"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Usage of pointer to an array\n",
- "s=[[1234,56],[1212,33],[1434,80],[1312,78]]\n",
- "p=[]\n",
- "for i in range(2):\n",
- " p.append(0)\n",
- "for i in range(0,4,1):\n",
- " p=s\n",
- " pint=p\n",
- " print \"\\n\"\n",
- " for j in range(0,2,1):\n",
- " print \"%d\" % (pint[i][j])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- "\n",
- "1234\n",
- "56\n",
- "\n",
- "\n",
- "1212\n",
- "33\n",
- "\n",
- "\n",
- "1434\n",
- "80\n",
- "\n",
- "\n",
- "1312\n",
- "78\n"
- ]
- }
- ],
- "prompt_number": 18
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:279-280"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Passing 2-D array to a function\n",
- "#can only implement only one way due to absence of pointers in python\n",
- "def display(q,row,col):\n",
- " for item in q:\n",
- " print item\n",
- " print \"\\n\"\n",
- "a=[[1,2,3,4],[5,6,7,8],[9,0,1,6]]\n",
- "display(a,3,4)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "[1, 2, 3, 4]\n",
- "[5, 6, 7, 8]\n",
- "[9, 0, 1, 6]\n",
- "\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 20
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:281-282"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Assigning values to the elements of an array seperately\n",
- "arr=[]\n",
- "for i in range(4):\n",
- " arr.append(0)\n",
- "i=31\n",
- "j=5\n",
- "k=19\n",
- "l=71\n",
- "arr[0]=i\n",
- "arr[1]=j\n",
- "arr[2]=k\n",
- "arr[3]=l\n",
- "for m in range(0,4,1):\n",
- " print \"%d\\n\" % (arr[m])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "31\n",
- "\n",
- "5\n",
- "\n",
- "19\n",
- "\n",
- "71\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:282"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing address of an element of array\n",
- "a=[0,1,2,3,4]\n",
- "print \"%u %u %d\\n\" % (id(id(a[0])),id(a[0]),a[0])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "88518416 21147348 0\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 22
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:7a02054929dffb84c1e468572cd4b1d9ed109e9267a67821f68ad3b293946118"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 8: ARRAYS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:256"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "x=5\n",
+ "x=10\n",
+ "print \"x=%d\\n\" % (x) #prints 10"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x=10\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:257-258"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "sum=0\n",
+ "marks=[] #array declaration\n",
+ "for i in range(30):\n",
+ " marks.append(0)\n",
+ "for i in range(0,30,1):\n",
+ " print \"Enter marks\"\n",
+ " marks[i]=eval(raw_input()) #store data in array\n",
+ "for i in range(0,30,1):\n",
+ " sum=sum+marks[i]\n",
+ "avg=sum/30\n",
+ "print \"Average marks=%d\\n\" % (avg)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "98\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "88\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "97\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "96\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "87\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "89\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "80\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "86\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "95\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "99\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "90\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "100\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "99\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "94\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "85\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "84\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "92\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "91\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "87\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "76\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "75\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "96\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "83\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "80\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "93\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "79\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "70\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "78\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "85\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "86\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Average marks=87\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:261"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "num=[]\n",
+ "for i in range(40):\n",
+ " num.append(0)\n",
+ "for i in range(0,40,1): #be carefull about the size of the array\n",
+ " num[i]=i"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:261-262"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def display(m):\n",
+ " print \"%d\" % (m)\n",
+ "marks=[55,65,75,56,78,78,90]\n",
+ "for i in range(0,7,1):\n",
+ " display(marks[i])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "55\n",
+ "65\n",
+ "75\n",
+ "56\n",
+ "78\n",
+ "78\n",
+ "90\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:263"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def show(n):\n",
+ " print \"%d\" % (n)\n",
+ "def disp(n):\n",
+ " show(n) #calls show()\n",
+ "marks=[55,65,75,56,78,78,90]\n",
+ "for i in range(0,7,1):\n",
+ " disp(marks[i])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "55\n",
+ "65\n",
+ "75\n",
+ "56\n",
+ "78\n",
+ "78\n",
+ "90\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:263-264"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "i=3\n",
+ "j=1.5\n",
+ "k='c'\n",
+ "print \"Value of i=%d\\n\" % (i)\n",
+ "print \"Value of j=%f\\n\" % (j)\n",
+ "print \"Value of k=%c\\n\" % (k)\n",
+ "x=id(i)\n",
+ "y=id(j)\n",
+ "z=id(k)\n",
+ "print \"Original address in x=%u\\n\" % (x)\n",
+ "print \"Original address in y=%u\\n\" % (y)\n",
+ "print \"Original address in z=%u\\n\" % (z)\n",
+ "x+=1\n",
+ "y+=1\n",
+ "z+=1\n",
+ "print \"New address in x=%u\\n\" % (x)\n",
+ "print \"New address in y=%u\\n\" % (y)\n",
+ "print \"New address in z=%u\\n\" % (z)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of i=3\n",
+ "\n",
+ "Value of j=1.500000\n",
+ "\n",
+ "Value of k=c\n",
+ "\n",
+ "Original address in x=21147312\n",
+ "\n",
+ "Original address in y=88181272\n",
+ "\n",
+ "Original address in z=21311640\n",
+ "\n",
+ "New address in x=21147313\n",
+ "\n",
+ "New address in y=88181273\n",
+ "\n",
+ "New address in z=21311641\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:265"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "arr=[10,20,30,45,67,56,74]\n",
+ "i=id(arr[1])\n",
+ "j=id(arr[5])\n",
+ "print \"%d %d\\n\" % (j-i,arr[5]-arr[1])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-432 36\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:266"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "arr=[10,20,36,72,45,36]\n",
+ "j=id(arr[4])\n",
+ "k=id(arr[0+4]) #didn't get any other way\n",
+ "if j==k:\n",
+ " print \"The two pointers point to the same location\\n\"\n",
+ "else:\n",
+ " print \"The two pointers do not point to the same location\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The two pointers point to the same location\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:267"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "num=[24,34,12,44,56,17]\n",
+ "for i in range(0,6,1):\n",
+ " print \"element no.%d\" % (i)\n",
+ " print \"address=%u\\n\" % (id(num[i]))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "element no.0\n",
+ "address=21147060\n",
+ "\n",
+ "element no.1\n",
+ "address=21146940\n",
+ "\n",
+ "element no.2\n",
+ "address=21147204\n",
+ "\n",
+ "element no.3\n",
+ "address=21146820\n",
+ "\n",
+ "element no.4\n",
+ "address=21146676\n",
+ "\n",
+ "element no.5\n",
+ "address=21147144\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "num=[24,34,12,44,56,17]\n",
+ "for i in range(0,6,1):\n",
+ " print \"address=%u\" % (id(num[i]))\n",
+ " print \"element=%d\\n\" % (num[i])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "address=21147060\n",
+ "element=24\n",
+ "\n",
+ "address=21146940\n",
+ "element=34\n",
+ "\n",
+ "address=21147204\n",
+ "element=12\n",
+ "\n",
+ "address=21146820\n",
+ "element=44\n",
+ "\n",
+ "address=21146676\n",
+ "element=56\n",
+ "\n",
+ "address=21147144\n",
+ "element=17\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "num=[24,34,12,44,56,17]\n",
+ "j=id(num[0]) #assign address of zeroth element\n",
+ "for i in range(0,6,1):\n",
+ " print \"address=%u\" % (id(num[i]))\n",
+ " print \"element=%d\\n\" % (num[i]) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "address=21147060\n",
+ "element=24\n",
+ "\n",
+ "address=21146940\n",
+ "element=34\n",
+ "\n",
+ "address=21147204\n",
+ "element=12\n",
+ "\n",
+ "address=21146820\n",
+ "element=44\n",
+ "\n",
+ "address=21146676\n",
+ "element=56\n",
+ "\n",
+ "address=21147144\n",
+ "element=17\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:270"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def display(j,n):\n",
+ " for item in j:\n",
+ " print \"element=%d\\n\" % (item)\n",
+ "num=[24,34,12,44,56,17]\n",
+ "display(num,6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "element=24\n",
+ "\n",
+ "element=34\n",
+ "\n",
+ "element=12\n",
+ "\n",
+ "element=44\n",
+ "\n",
+ "element=56\n",
+ "\n",
+ "element=17\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:271"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "num=[24,34,12,44,56,17]\n",
+ "for i in range(0,6,1):\n",
+ " print \"address=%u\" % (id(num[i]))\n",
+ " print \"element=%d %d\" % (num[i],num[i]) #no other way\n",
+ " print \"%d %d\\n\" % (num[i],num[i])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "address=21147060\n",
+ "element=24 24\n",
+ "24 24\n",
+ "\n",
+ "address=21146940\n",
+ "element=34 34\n",
+ "34 34\n",
+ "\n",
+ "address=21147204\n",
+ "element=12 12\n",
+ "12 12\n",
+ "\n",
+ "address=21146820\n",
+ "element=44 44\n",
+ "44 44\n",
+ "\n",
+ "address=21146676\n",
+ "element=56 56\n",
+ "56 56\n",
+ "\n",
+ "address=21147144\n",
+ "element=17 17\n",
+ "17 17\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:272"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "stud=[[0,0],[0,0],[0,0],[0,0]]\n",
+ "for i in range(0,4,1):\n",
+ " print \"Enter roll no. and marks\"\n",
+ " stud[i][0]=eval(raw_input())\n",
+ " stud[i][1]=eval(raw_input())\n",
+ "for i in range(0,4,1):\n",
+ " print \"%d %d\\n\" % (stud[i][0],stud[i][1])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter roll no. and marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1206030\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "100\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter roll no. and marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1206007\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "95\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter roll no. and marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1206034\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "97\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter roll no. and marks\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1206026\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "88\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1206030 100\n",
+ "\n",
+ "1206007 95\n",
+ "\n",
+ "1206034 97\n",
+ "\n",
+ "1206026 88\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:275"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "s=[[1234,56],[1212,33],[1434,80],[1312,78]]\n",
+ "for i in range(0,4,1):\n",
+ " print \"Address of %dth 1-D array=%u\\n\" % (i,id(s[i]))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Address of 0th 1-D array=88430392\n",
+ "\n",
+ "Address of 1th 1-D array=89514192\n",
+ "\n",
+ "Address of 2th 1-D array=88430712\n",
+ "\n",
+ "Address of 3th 1-D array=88430312\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:277"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "s=[[1234,56],[1212,33],[1434,80],[1312,78]]\n",
+ "for i in range(0,4,1):\n",
+ " for j in range(0,2,1):\n",
+ " print \"%d\" % (s[i][j])\n",
+ " print \"\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1234\n",
+ "56\n",
+ "\n",
+ "\n",
+ "1212\n",
+ "33\n",
+ "\n",
+ "\n",
+ "1434\n",
+ "80\n",
+ "\n",
+ "\n",
+ "1312\n",
+ "78\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:277-278"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "s=[[1234,56],[1212,33],[1434,80],[1312,78]]\n",
+ "p=[]\n",
+ "for i in range(2):\n",
+ " p.append(0)\n",
+ "for i in range(0,4,1):\n",
+ " p=s\n",
+ " pint=p\n",
+ " print \"\\n\"\n",
+ " for j in range(0,2,1):\n",
+ " print \"%d\" % (pint[i][j])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ "1234\n",
+ "56\n",
+ "\n",
+ "\n",
+ "1212\n",
+ "33\n",
+ "\n",
+ "\n",
+ "1434\n",
+ "80\n",
+ "\n",
+ "\n",
+ "1312\n",
+ "78\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:279-280"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def display(q,row,col):\n",
+ " for item in q:\n",
+ " print item\n",
+ " print \"\\n\"\n",
+ "a=[[1,2,3,4],[5,6,7,8],[9,0,1,6]]\n",
+ "display(a,3,4)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[1, 2, 3, 4]\n",
+ "[5, 6, 7, 8]\n",
+ "[9, 0, 1, 6]\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:281-282"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "arr=[]\n",
+ "for i in range(4):\n",
+ " arr.append(0)\n",
+ "i=31\n",
+ "j=5\n",
+ "k=19\n",
+ "l=71\n",
+ "arr[0]=i\n",
+ "arr[1]=j\n",
+ "arr[2]=k\n",
+ "arr[3]=l\n",
+ "for m in range(0,4,1):\n",
+ " print \"%d\\n\" % (arr[m])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "31\n",
+ "\n",
+ "5\n",
+ "\n",
+ "19\n",
+ "\n",
+ "71\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:282"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "a=[0,1,2,3,4]\n",
+ "print \"%u %u %d\\n\" % (id(id(a[0])),id(a[0]),a[0])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "88518416 21147348 0\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/ANSI_C_Programming/chapter9.ipynb b/ANSI_C_Programming/chapter9.ipynb
index 43e1d355..54eec269 100644
--- a/ANSI_C_Programming/chapter9.ipynb
+++ b/ANSI_C_Programming/chapter9.ipynb
@@ -1,958 +1,958 @@
-{
- "metadata": {
- "name": "chapter9.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "CHAPTER 9: PUPPETTING ON STRINGS"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:311"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Program to demonstrate printing of a string\n",
- "name=\"Klinsman\"\n",
- "i=0\n",
- "while i<=7:\n",
- " print \"%c\" % (name[i]), #method of printing without line feed\n",
- " i+=1\n",
- "print \"\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "K l i n s m a n \n",
- "\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:311-312"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing a string stored in 1-D array\n",
- "name=\"Klinsman \"\n",
- "i=0\n",
- "while name[i]!=' ':\n",
- " print \"%c\" % (name[i]), \n",
- " i+=1\n",
- "print \"\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " K l i n s m a n \n",
- "\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:312"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Program to demonstrate printing of a string\n",
- "name=\"Klinsman \"\n",
- "ptr=[]\n",
- "ptr=name #store base address of string\n",
- "i=0\n",
- "while name[i]!=' ':\n",
- " print \"%c\" % (ptr[i]), \n",
- " i+=1\n",
- "print \"\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "K l i n s m a n \n",
- "\n"
- ]
- }
- ],
- "prompt_number": 18
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:313"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#printing a string\n",
- "name=\"Klinsman\"\n",
- "print \"%s\" % (name)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Klinsman\n"
- ]
- }
- ],
- "prompt_number": 19
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:313"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#storing & printing a string\n",
- "print \"Enter your name\"\n",
- "name=raw_input()\n",
- "print \"Hello %s!\\n\" % (name)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter your name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Debashish\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Hello Debashish!\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 20
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:314"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#storing & printing a string\n",
- "print \"Enter your full name:\"\n",
- "name=raw_input()\n",
- "print \"Hello!\"\n",
- "print name"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter your full name:\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Debashish Roy\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Hello!\n",
- "Debashish Roy\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:315"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Dynamic variables in python\n",
- "str1=\"Hello\"\n",
- "s=\"Good Morning\"\n",
- "str2=str1 #No error in Python since all variables are by default pointers\n",
- "q=s"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:316"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Dynamic allocation in python\n",
- "str1=\"Hello\"\n",
- "p=\"Hello\"\n",
- "str1=\"Bye\" #No error in python\n",
- "p=\"Bye\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:317"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#to count number of characters in an array\n",
- "arr=\"Bamboozled\"\n",
- "len1=len(arr) #return length of string\n",
- "len2=len(\"Humpty Dumpty\")\n",
- "print \"string=%s length=%d\\n\" % (arr,len1)\n",
- "print \"string=%s length=%d\\n\" % (\"Humpty Dumpty\",len2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "string=Bamboozled length=10\n",
- "\n",
- "string=Humpty Dumpty length=13\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 22
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:317-318"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#A look-alike of the function strlen()\n",
- "def xstrlen(s):\n",
- " length=0\n",
- " for item in s:\n",
- " if s!=\"\\0\":\n",
- " length+=1\n",
- " return length\n",
- "arr=\"Bamboozled\"\n",
- "len1=xstrlen(arr) \n",
- "len2=xstrlen(\"Humpty Dumpty\")\n",
- "print \"string=%s length=%d\\n\" % (arr,len1)\n",
- "print \"string=%s length=%d\\n\" % (\"Humpty dumpty\",len2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "string=Bamboozled length=10\n",
- "\n",
- "string=Humpty dumpty length=13\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 23
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:319"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Copying one string into another\n",
- "import copy\n",
- "source=\"Sayonara\"\n",
- "target=copy.copy(source) #copy string\n",
- "print \"source string=%s\\n\" % (source)\n",
- "print \"target string=%s\\n\" % (target)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "source string=Sayonara\n",
- "\n",
- "target string=Sayonara\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 24
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:319-320"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#A look-alike of the function strcpy()\n",
- "def xstrcpy(t,s):\n",
- " t=\"\\0\"\n",
- " for item in s:\n",
- " t=t+str(item)\n",
- " return t\n",
- "source=\"Sayonara\"\n",
- "target=[]\n",
- "target=xstrcpy(target,source)\n",
- "print \"source string=%s\\n\" % (source)\n",
- "print \"target string=%s\\n\" % (target)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "source string=Sayonara\n",
- "\n",
- "target string=\u0000Sayonara\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 25
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:321"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#print area of circle\n",
- "pi=3.14\n",
- "print \"Enter radius of circle\"\n",
- "r=eval(raw_input())\n",
- "a=pi*r*r\n",
- "print \"Area of circle=%f\\n\" % (a)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter radius of circle\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Area of circle=28.260000\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 26
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:322"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Concatenating two strings\n",
- "source=\"Folks!\"\n",
- "target=\"Hello\"\n",
- "target=target+source\n",
- "print \"source string=%s\\n\" % (source)\n",
- "print \"target string=%s\\n\" % (target)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "source string=Folks!\n",
- "\n",
- "target string=HelloFolks!\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 27
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:322-323"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Comparing two strings\n",
- "string1=\"Jerry\"\n",
- "string2=\"Ferry\"\n",
- "i=cmp(string1,\"Jerry\")\n",
- "j=cmp(string1,string2)\n",
- "k=cmp(string1,\"Jerry boy\")\n",
- "print \"%d %d %d\\n\" % (i,j,k)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "0 1 -1\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 29
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:323-324"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Application of 2-D araay of characters\n",
- "def FOUND():\n",
- " return 1\n",
- "def NOTFOUND():\n",
- " return 0\n",
- "masterlist=[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n",
- "print \"Enter your name\"\n",
- "yourname=raw_input()\n",
- "flag=NOTFOUND()\n",
- "for i in range(0,6,1):\n",
- " a=cmp(masterlist[i],yourname)\n",
- " if a==0:\n",
- " print \"Welcome,you can enter the palace\\n\"\n",
- " flag=FOUND()\n",
- " break\n",
- "if flag==NOTFOUND():\n",
- " print \"Sorry,you are a trespasser\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter your name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "gopal\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Welcome,you can enter the palace\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 51
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:327"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Exchange names using 2-D array of characters\n",
- "names=[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n",
- "names = map(bytearray, names)\n",
- "print \"Original:%s %s\\n\" % (names[2],names[3])\n",
- "s = sorted((names[2], names[3]), key=len)\n",
- "for i in range(len(s[1])):\n",
- " try:\n",
- " t=s[0][i]\n",
- " s[0][i]=s[1][i]\n",
- " s[1][i]=t\n",
- " except IndexError:\n",
- " for _ in range(i, len(s[1])):\n",
- " #remove the items from the longer string to and append them to the shorter one.\n",
- " s[0].append(s[1].pop(i)) \n",
- "print \"New:%s %s\\n\" % (names[2],names[3])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Original:raman srinivas\n",
- "\n",
- "New:srinivas raman\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 46
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE-328"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Exchange names using 2-D array of characters\n",
- "names=[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n",
- "print \"Original:%s %s\\n\" % (names[2],names[3])\n",
- "t=names[2]\n",
- "names[2]=names[3]\n",
- "names[3]=t\n",
- "print \"New:%s %s\\n\" % (names[2],names[3])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Original:raman srinivas\n",
- "\n",
- "New:srinivas raman\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 48
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:329"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Storing elements in an array\n",
- "names=[]\n",
- "for i in range(6):\n",
- " names.append(\"\\0\") \n",
- "for i in range(0,6,1):\n",
- " print \"Enter name\"\n",
- " names[i]=raw_input()"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "RAM\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "GOPAL\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "PANDEY\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "GOPU\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "CHOTU\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "RADHEY\n"
- ]
- }
- ],
- "prompt_number": 50
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "EXAMPLE ON PAGE:329-330"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Dynamic memory allocation of variables\n",
- "#No need of malloc func. in python as by default it's dynamic\n",
- "names=[]\n",
- "for i in range(0,6):\n",
- " names.append('\\0')\n",
- "for i in range(0,6,1):\n",
- " print \"Enter name\"\n",
- " n=raw_input()\n",
- " length=len(n)\n",
- " import copy\n",
- " p=copy.copy(n)\n",
- " names[i]=p\n",
- "for i in range(0,6,1):\n",
- " print \"%s\\n\" % (names[i])"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "MUKUT\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "BIHARI\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "PANDEY\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "MADHUBALA\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "PANDEY\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Enter name\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "SUNITA\n"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "MUKUT\n",
- "\n",
- "BIHARI\n",
- "\n",
- "PANDEY\n",
- "\n",
- "MADHUBALA\n",
- "\n",
- "PANDEY\n",
- "\n",
- "SUNITA\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 7
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:d543de519ea53ce295e62c624f3b779f3394a58f64540659aef438fffab60f98"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER 9: PUPPETTING ON STRINGS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:311"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "name=\"Klinsman\"\n",
+ "i=0\n",
+ "while i<=7:\n",
+ " print \"%c\" % (name[i]), #method of printing without line feed\n",
+ " i+=1\n",
+ "print \"\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "K l i n s m a n \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:311-312"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "name=\"Klinsman \"\n",
+ "i=0\n",
+ "while name[i]!=' ':\n",
+ " print \"%c\" % (name[i]), \n",
+ " i+=1\n",
+ "print \"\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " K l i n s m a n \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:312"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "name=\"Klinsman \"\n",
+ "ptr=[]\n",
+ "ptr=name #store base address of string\n",
+ "i=0\n",
+ "while name[i]!=' ':\n",
+ " print \"%c\" % (ptr[i]), \n",
+ " i+=1\n",
+ "print \"\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "K l i n s m a n \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:313"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "name=\"Klinsman\"\n",
+ "print \"%s\" % (name)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Klinsman\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:313"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter your name\"\n",
+ "name=raw_input()\n",
+ "print \"Hello %s!\\n\" % (name)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter your name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Debashish\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Hello Debashish!\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:314"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "print \"Enter your full name:\"\n",
+ "name=raw_input()\n",
+ "print \"Hello!\"\n",
+ "print name"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter your full name:\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Debashish Roy\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Hello!\n",
+ "Debashish Roy\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:315"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "str1=\"Hello\"\n",
+ "s=\"Good Morning\"\n",
+ "str2=str1 #No error in Python since all variables are by default pointers\n",
+ "q=s"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:316"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "str1=\"Hello\"\n",
+ "p=\"Hello\"\n",
+ "str1=\"Bye\" #No error in python\n",
+ "p=\"Bye\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:317"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "arr=\"Bamboozled\"\n",
+ "len1=len(arr) #return length of string\n",
+ "len2=len(\"Humpty Dumpty\")\n",
+ "print \"string=%s length=%d\\n\" % (arr,len1)\n",
+ "print \"string=%s length=%d\\n\" % (\"Humpty Dumpty\",len2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "string=Bamboozled length=10\n",
+ "\n",
+ "string=Humpty Dumpty length=13\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:317-318"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def xstrlen(s):\n",
+ " length=0\n",
+ " for item in s:\n",
+ " if s!=\"\\0\":\n",
+ " length+=1\n",
+ " return length\n",
+ "arr=\"Bamboozled\"\n",
+ "len1=xstrlen(arr) \n",
+ "len2=xstrlen(\"Humpty Dumpty\")\n",
+ "print \"string=%s length=%d\\n\" % (arr,len1)\n",
+ "print \"string=%s length=%d\\n\" % (\"Humpty dumpty\",len2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "string=Bamboozled length=10\n",
+ "\n",
+ "string=Humpty dumpty length=13\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:319"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import copy\n",
+ "source=\"Sayonara\"\n",
+ "target=copy.copy(source) #copy string\n",
+ "print \"source string=%s\\n\" % (source)\n",
+ "print \"target string=%s\\n\" % (target)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "source string=Sayonara\n",
+ "\n",
+ "target string=Sayonara\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:319-320"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def xstrcpy(t,s):\n",
+ " t=\"\\0\"\n",
+ " for item in s:\n",
+ " t=t+str(item)\n",
+ " return t\n",
+ "source=\"Sayonara\"\n",
+ "target=[]\n",
+ "target=xstrcpy(target,source)\n",
+ "print \"source string=%s\\n\" % (source)\n",
+ "print \"target string=%s\\n\" % (target)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "source string=Sayonara\n",
+ "\n",
+ "target string=\u0000Sayonara\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:321"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "pi=3.14\n",
+ "print \"Enter radius of circle\"\n",
+ "r=eval(raw_input())\n",
+ "a=pi*r*r\n",
+ "print \"Area of circle=%f\\n\" % (a)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter radius of circle\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area of circle=28.260000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:322"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "source=\"Folks!\"\n",
+ "target=\"Hello\"\n",
+ "target=target+source\n",
+ "print \"source string=%s\\n\" % (source)\n",
+ "print \"target string=%s\\n\" % (target)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "source string=Folks!\n",
+ "\n",
+ "target string=HelloFolks!\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:322-323"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "string1=\"Jerry\"\n",
+ "string2=\"Ferry\"\n",
+ "i=cmp(string1,\"Jerry\")\n",
+ "j=cmp(string1,string2)\n",
+ "k=cmp(string1,\"Jerry boy\")\n",
+ "print \"%d %d %d\\n\" % (i,j,k)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0 1 -1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:323-324"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "def FOUND():\n",
+ " return 1\n",
+ "def NOTFOUND():\n",
+ " return 0\n",
+ "masterlist=[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n",
+ "print \"Enter your name\"\n",
+ "yourname=raw_input()\n",
+ "flag=NOTFOUND()\n",
+ "for i in range(0,6,1):\n",
+ " a=cmp(masterlist[i],yourname)\n",
+ " if a==0:\n",
+ " print \"Welcome,you can enter the palace\\n\"\n",
+ " flag=FOUND()\n",
+ " break\n",
+ "if flag==NOTFOUND():\n",
+ " print \"Sorry,you are a trespasser\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter your name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "gopal\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Welcome,you can enter the palace\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 51
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:327"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "names=[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n",
+ "names = map(bytearray, names)\n",
+ "print \"Original:%s %s\\n\" % (names[2],names[3])\n",
+ "s = sorted((names[2], names[3]), key=len)\n",
+ "for i in range(len(s[1])):\n",
+ " try:\n",
+ " t=s[0][i]\n",
+ " s[0][i]=s[1][i]\n",
+ " s[1][i]=t\n",
+ " except IndexError:\n",
+ " for _ in range(i, len(s[1])):\n",
+ " #remove the items from the longer string to and append them to the shorter one.\n",
+ " s[0].append(s[1].pop(i)) \n",
+ "print \"New:%s %s\\n\" % (names[2],names[3])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Original:raman srinivas\n",
+ "\n",
+ "New:srinivas raman\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 46
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE-328"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "names=[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n",
+ "print \"Original:%s %s\\n\" % (names[2],names[3])\n",
+ "t=names[2]\n",
+ "names[2]=names[3]\n",
+ "names[3]=t\n",
+ "print \"New:%s %s\\n\" % (names[2],names[3])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Original:raman srinivas\n",
+ "\n",
+ "New:srinivas raman\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:329"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "names=[]\n",
+ "for i in range(6):\n",
+ " names.append(\"\\0\") \n",
+ "for i in range(0,6,1):\n",
+ " print \"Enter name\"\n",
+ " names[i]=raw_input()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "RAM\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "GOPAL\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "PANDEY\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "GOPU\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "CHOTU\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "RADHEY\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "EXAMPLE ON PAGE:329-330"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "names=[]\n",
+ "for i in range(0,6):\n",
+ " names.append('\\0')\n",
+ "for i in range(0,6,1):\n",
+ " print \"Enter name\"\n",
+ " n=raw_input()\n",
+ " length=len(n)\n",
+ " import copy\n",
+ " p=copy.copy(n)\n",
+ " names[i]=p\n",
+ "for i in range(0,6,1):\n",
+ " print \"%s\\n\" % (names[i])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "MUKUT\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "BIHARI\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "PANDEY\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "MADHUBALA\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "PANDEY\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter name\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "SUNITA\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "MUKUT\n",
+ "\n",
+ "BIHARI\n",
+ "\n",
+ "PANDEY\n",
+ "\n",
+ "MADHUBALA\n",
+ "\n",
+ "PANDEY\n",
+ "\n",
+ "SUNITA\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter1.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter1.ipynb
index a1a29ec8..1cb4536f 100644
--- a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter1.ipynb
+++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter1.ipynb
@@ -1,503 +1,504 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "UNIT-1:Waves & Vibrations"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.1,Page no:11"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Velocity of sound \n",
- "\n",
- "#Variable declaration\n",
- "n=512 #frequency in Hz\n",
- "l=67 #wavelength in cm\n",
- "\n",
- "#Calculation\n",
- "v=n*l #calculating velocity\n",
- "\n",
- "#Result\n",
- "print\"Velocity = \",v,\" cm/sec\" \n",
- "print\"NOTE:Calculation mistake in book\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Velocity = 34304 cm/sec\n",
- "NOTE:Calculation mistake in book\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.2,Page no:11"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Frequency of tuning fork \n",
- "\n",
- "#Variable declaration\n",
- "v=340 #velocity in m/sec\n",
- "l=0.68 #wavelength in m\n",
- "\n",
- "#Calculation\n",
- "n=v/l #calculating frequency\n",
- "\n",
- "#Result\n",
- "print\"Frequency\",n,\"Hz\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Frequency 500.0 Hz\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.3,Page no:12"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Wavelength of wave \n",
- "\n",
- "#Variable declaration\n",
- "v=3*10**8 #velocity in m/sec\n",
- "n=500*10**3 #frequency in Hz\n",
- "\n",
- "#Calculation\n",
- "l=v/n #calculating wavelength\n",
- "\n",
- "#Result\n",
- "print\"Wavelength=\",l,\"m\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Wavelength= 600 m\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.4,Page no:12"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Distance by sound in air \n",
- "\n",
- "#Variable declaration\n",
- "v=330 #velocity in m/sec\n",
- "n=560.0 #frequency in Hz\n",
- "\n",
- "#Calculation\n",
- "lamda=v/n #calculating wavelength\n",
- "\n",
- "#Result\n",
- "print\"lambda=\",round(lamda,3),\"m\"\n",
- "print\"Distance travelled in 30 vibrations in m = \",round(lamda*30,2),\"m\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "lambda= 0.589 m\n",
- "Distance travelled in 30 vibrations in m = 17.68 m\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.5,Page no:12"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Sound,when stone dropped from height\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "s=90.0 #distance in m\n",
- "u=0 #initial velocity in m/sec\n",
- "\n",
- "#Calculation\n",
- "t=math.sqrt(90/4.9) #calculating time using kinematical equation\n",
- "later=4.56 #Time after which sound is heard\n",
- "t1=later-t #calculating time taken by sound to travel\n",
- "t1=round(t1,2)\n",
- "v=s/t1 #calculating velocity\n",
- "\n",
- "#Result\n",
- "print\"Velocity in m/sec = \",round(v,2),\"m/s\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Velocity in m/sec = 333.33 m/s\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.6,Page no:13"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Velocity in different medium \n",
- "\n",
- "#Variable declaration\n",
- "l1=1.5 #wavelength in m\n",
- "l2=2 #wavelength in m\n",
- "v1=120 #velocity in m/sec\n",
- "\n",
- "#Calculation\n",
- "n=v1/l1 #calculating frequency\n",
- "v2=n*l2 #calculating velocity\n",
- "\n",
- "#Result\n",
- "print\"Velocity in m/sec = \",v2,\"m/sec\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Velocity in m/sec = 160.0 m/sec\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.7,Page no:14"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Frequency of green light \n",
- "\n",
- "#Variable declaration\n",
- "l=5641*10**-10 #wavelength in m\n",
- "c=3*10**8 #velocity in m/sec\n",
- "u=1.58 #refractive index of glass\n",
- "\n",
- "#Calculation\n",
- "n=c/l #calculating frequency\n",
- "cg=c/u #calculating velocity of light in glass\n",
- "l1=cg/n #calculating wavelegth in glass\n",
- "\n",
- "#Result\n",
- "print\"Wavelength in glass in Angstrom =\",l1*10**10,\"Angstrom\" \n",
- "print\"\\n\\nNOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Wavelength in glass in Angstrom = 3570.25316456 Angstrom\n",
- "\n",
- "\n",
- "NOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.8,Page no:15"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Wavelength of raio station \n",
- "\n",
- "#Variable declaration\n",
- "n=12*10**6 #frequency in Hz\n",
- "v=3*10**8 #velocity in m/sec\n",
- "\n",
- "#Calculation\n",
- "l=v/n #calculating wavelength\n",
- "\n",
- "#Result\n",
- "print\"Wavelength in m = \",l,\"m\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Wavelength in m = 25 m\n"
- ]
- }
- ],
- "prompt_number": 18
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.9,Page no:15"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Wavelength of sound \n",
- "\n",
- "#Variable declaration\n",
- "n=400 #frequency in Hz\n",
- "v=300.0 #velocity in m/sec\n",
- "\n",
- "#Calculation\n",
- "l=v/n #calculating wavelength\n",
- "\n",
- "#Result\n",
- "print\"Wavelength=\",l,\"m\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Wavelength= 0.75 m\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.10,Page no:22"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Equation of SHM\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "a=20 #amplitude in cm\n",
- "n=6 #frequency per second\n",
- "\n",
- "#Calculation\n",
- "w=2*(math.pi)*n #omega in radians/sec\n",
- "\n",
- "#Result\n",
- "print\"Omega in radians/sec = \",round(w,1),\"rad/sec\" \n",
- "print\"y=\",a,\"sin\",round(w,1),\"t\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Omega in radians/sec = 37.7 rad/sec\n",
- "y= 20 sin 37.7 t\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.11,Page no:23"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#SHM by a body \n",
- "\n",
- "#Variable declaration\n",
- "a=6 #amplitude in cm\n",
- "n=9 #frequency in Hz.\n",
- "\n",
- "#Calculation\n",
- "vmax=2*(math.pi)*n*6 #calculating velocity in cm/sec\n",
- "acc=-((18*(math.pi))**2)*6 #calculating acc. in m/sec square\n",
- "\n",
- "#Result\n",
- "print\"Maximum velocity in cm/sec = \",round(vmax,2),\"cm/sec\" \n",
- "print\"Velocity at extreme position = 0\" \n",
- "print\"Accelaration at mean position = 0\" \n",
- "print\"Accelaration at extreme position = \",round(acc,1),\"m/sec^2\" \n",
- "print\"\\n\\nNOTE:Calculation mistake in book\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Maximum velocity in cm/sec = 339.29 cm/sec\n",
- "Velocity at extreme position = 0\n",
- "Accelaration at mean position = 0\n",
- "Accelaration at extreme position = -19186.5 m/sec^2\n",
- "\n",
- "\n",
- "NOTE:Calculation mistake in book\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:1.12,Page no:26"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Weight of body suspended fro spring \n",
- "\n",
- "#Variable declaration\n",
- "g=9.8 #gravitational constant\n",
- "m=50 #mass in kg\n",
- "l=0.2 #length in m\n",
- "T=0.6 #time period\n",
- "\n",
- "#Calculation\n",
- "k=(m*g)/l #calculating constant\n",
- "m=2450*((T/(2*(math.pi)))**2) #calcualting mass using given time period\n",
- "\n",
- "#Result\n",
- "print\"Mass of body= \",round(m,2),\"kg\" \n",
- "print\"Weight of suspended body=\",round(m,2)*g,\"N\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Mass of body= 22.34 kg\n",
- "Weight of suspended body= 218.932 N\n"
- ]
- }
- ],
- "prompt_number": 12
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b9d3600de62f2e313ebd68d87880d0cad19ed95bdfc9a86e635db985c6359259"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "UNIT-1:Waves & Vibrations"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.1,Page no:11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "n=512 #frequency in Hz\n",
+ "l=67 #wavelength in cm\n",
+ "\n",
+ "#Calculation\n",
+ "v=n*l #calculating velocity\n",
+ "\n",
+ "#Result\n",
+ "print\"Velocity = \",v,\" cm/sec\" \n",
+ "print\"NOTE:Calculation mistake in book\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Velocity = 34304 cm/sec\n",
+ "NOTE:Calculation mistake in book\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.2,Page no:11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "v=340 #velocity in m/sec\n",
+ "l=0.68 #wavelength in m\n",
+ "\n",
+ "#Calculation\n",
+ "n=v/l #calculating frequency\n",
+ "\n",
+ "#Result\n",
+ "print\"Frequency\",n,\"Hz\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Frequency 500.0 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.3,Page no:12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "v=3*10**8 #velocity in m/sec\n",
+ "n=500*10**3 #frequency in Hz\n",
+ "\n",
+ "#Calculation\n",
+ "l=v/n #calculating wavelength\n",
+ "\n",
+ "#Result\n",
+ "print\"Wavelength=\",l,\"m\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Wavelength= 600 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.4,Page no:12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "v=330 #velocity in m/sec\n",
+ "n=560.0 #frequency in Hz\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=v/n #calculating wavelength\n",
+ "\n",
+ "#Result\n",
+ "print\"lambda=\",round(lamda,3),\"m\"\n",
+ "print\"Distance travelled in 30 vibrations in m = \",round(lamda*30,2),\"m\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "lambda= 0.589 m\n",
+ "Distance travelled in 30 vibrations in m = 17.68 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.5,Page no:12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "s=90.0 #distance in m\n",
+ "u=0 #initial velocity in m/sec\n",
+ "\n",
+ "#Calculation\n",
+ "t=math.sqrt(90/4.9) #calculating time using kinematical equation\n",
+ "later=4.56 #Time after which sound is heard\n",
+ "t1=later-t #calculating time taken by sound to travel\n",
+ "t1=round(t1,2)\n",
+ "v=s/t1 #calculating velocity\n",
+ "\n",
+ "#Result\n",
+ "print\"Velocity in m/sec = \",round(v,2),\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Velocity in m/sec = 333.33 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.6,Page no:13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "l1=1.5 #wavelength in m\n",
+ "l2=2 #wavelength in m\n",
+ "v1=120 #velocity in m/sec\n",
+ "\n",
+ "#Calculation\n",
+ "n=v1/l1 #calculating frequency\n",
+ "v2=n*l2 #calculating velocity\n",
+ "\n",
+ "#Result\n",
+ "print\"Velocity in m/sec = \",v2,\"m/sec\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Velocity in m/sec = 160.0 m/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.7,Page no:14"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "l=5641*10**-10 #wavelength in m\n",
+ "c=3*10**8 #velocity in m/sec\n",
+ "u=1.58 #refractive index of glass\n",
+ "\n",
+ "#Calculation\n",
+ "n=c/l #calculating frequency\n",
+ "cg=c/u #calculating velocity of light in glass\n",
+ "l1=cg/n #calculating wavelegth in glass\n",
+ "\n",
+ "#Result\n",
+ "print\"Wavelength in glass in Angstrom =\",l1*10**10,\"Angstrom\" \n",
+ "print\"\\n\\nNOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Wavelength in glass in Angstrom = 3570.25316456 Angstrom\n",
+ "\n",
+ "\n",
+ "NOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.8,Page no:15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "n=12*10**6 #frequency in Hz\n",
+ "v=3*10**8 #velocity in m/sec\n",
+ "\n",
+ "#Calculation\n",
+ "l=v/n #calculating wavelength\n",
+ "\n",
+ "#Result\n",
+ "print\"Wavelength in m = \",l,\"m\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Wavelength in m = 25 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.9,Page no:15"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "n=400 #frequency in Hz\n",
+ "v=300.0 #velocity in m/sec\n",
+ "\n",
+ "#Calculation\n",
+ "l=v/n #calculating wavelength\n",
+ "\n",
+ "#Result\n",
+ "print\"Wavelength=\",l,\"m\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Wavelength= 0.75 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.10,Page no:22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "a=20 #amplitude in cm\n",
+ "n=6 #frequency per second\n",
+ "\n",
+ "#Calculation\n",
+ "w=2*(math.pi)*n #omega in radians/sec\n",
+ "\n",
+ "#Result\n",
+ "print\"Omega in radians/sec = \",round(w,1),\"rad/sec\" \n",
+ "print\"y=\",a,\"sin\",round(w,1),\"t\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Omega in radians/sec = 37.7 rad/sec\n",
+ "y= 20 sin 37.7 t\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.11,Page no:23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "a=6 #amplitude in cm\n",
+ "n=9 #frequency in Hz.\n",
+ "\n",
+ "#Calculation\n",
+ "vmax=2*(math.pi)*n*6 #calculating velocity in cm/sec\n",
+ "acc=-((18*(math.pi))**2)*6 #calculating acc. in m/sec square\n",
+ "\n",
+ "#Result\n",
+ "print\"Maximum velocity in cm/sec = \",round(vmax,2),\"cm/sec\" \n",
+ "print\"Velocity at extreme position = 0\" \n",
+ "print\"Accelaration at mean position = 0\" \n",
+ "print\"Accelaration at extreme position = \",round(acc,1),\"m/sec^2\" \n",
+ "print\"\\n\\nNOTE:Calculation mistake in book\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum velocity in cm/sec = 339.29 cm/sec\n",
+ "Velocity at extreme position = 0\n",
+ "Accelaration at mean position = 0\n",
+ "Accelaration at extreme position = -19186.5 m/sec^2\n",
+ "\n",
+ "\n",
+ "NOTE:Calculation mistake in book\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:1.12,Page no:26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "g=9.8 #gravitational constant\n",
+ "m=50 #mass in kg\n",
+ "l=0.2 #length in m\n",
+ "T=0.6 #time period\n",
+ "\n",
+ "#Calculation\n",
+ "k=(m*g)/l #calculating constant\n",
+ "m=2450*((T/(2*(math.pi)))**2) #calcualting mass using given time period\n",
+ "\n",
+ "#Result\n",
+ "print\"Mass of body= \",round(m,2),\"kg\" \n",
+ "print\"Weight of suspended body=\",round(m,2)*g,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass of body= 22.34 kg\n",
+ "Weight of suspended body= 218.932 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter2.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter2.ipynb
index 7c9499cb..b50ddf47 100644
--- a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter2.ipynb
+++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter2.ipynb
@@ -1,342 +1,339 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "UNIT-2:Application of Sound Waves"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:2.1,Page no:41"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate reverberation time\n",
- "\n",
- "#Variable declaration\n",
- "v=3000 #volume in metre cube.\n",
- "theta=0.2 #theta in owu(open window unit).\n",
- "s=1850 #area in metre cube.\n",
- "\n",
- "#Calculation\n",
- "a=theta*s #calculating total absorbtion of surface.\n",
- "T=(0.165*v)/a #calculating T using Sabine formula\n",
- "\n",
- "#Result\n",
- "print\"Reverberation time of Room = \",round(T,2) ,\"sec\" \n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Reverberation time of Room = 1.34 sec\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:2.2,Page no:41"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate average absorbing power\n",
- "\n",
- "#Variable declaration\n",
- "v=120000 #volume in metre cube.\n",
- "t=1.5 #time in second.\n",
- "s=25000 #area in metre cube.\n",
- "\n",
- "#Calculation\n",
- "a=(0.16*v)/(t*s) #using Sabine formula for calculating a\n",
- "\n",
- "#Variable declaration\n",
- "print\"Average Absorbing Power of Surface = \",a,\"o w u\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Average Absorbing Power of Surface = 0.512 o w u\n"
- ]
- }
- ],
- "prompt_number": 39
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:2.3,Page no:42"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Reverberation time of cinema hall\n",
- "\n",
- "#Variable declaration\n",
- "v=6000.0 #Volume in metre cube.\n",
- "a=20.0 #surface absorbtion in owu(open window unit).\n",
- "\n",
- "#Calculation\n",
- "T=(0.165*v)/(a) #calculating T using Sabine Formula.\n",
- "\n",
- "#Result\n",
- "print\"Reverberation Time = \",T,\"sec\"\n",
- "print\"\\nNOTE:Calculation mistake in book\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Reverberation Time = 49.5 sec\n",
- "\n",
- "NOTE:Calculation mistake in book\n"
- ]
- }
- ],
- "prompt_number": 37
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:2.4,Page no:42"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Reverberation time with persons\n",
- "\n",
- "#Variable declaration\n",
- "v=3500 #volume in metre cube.\n",
- "n1=370-300 #no. of audience on wooden seats.\n",
- "n2=300-70 #no. of empty wooden seats.\n",
- "\n",
- "#Calculation\n",
- "a1s1=0.04*60 #absorption due to wooden doors.\n",
- "a2s2=0.03*700 #absorption due to plastered walls.\n",
- "a3s3=0.06*50 #absorption due to glass work.\n",
- "a4s4=4.2*370 #absorption due to audience on spungy and wooden \n",
- "#seats.\n",
- "a5s5=2*230 #absorption due to empty seats.\n",
- "sum=a1s1+a2s2+a3s3+a4s4+a5s5 #total absorption of cinema hall.\n",
- "T=(0.165*v)/sum #calculating T using Sabine Formula.\n",
- "\n",
- "#Result\n",
- "print\"Reverberation Time = \",round(T,2),\"sec\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Reverberation Time = 0.28 sec\n"
- ]
- }
- ],
- "prompt_number": 40
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:2.5,Page no:49"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Frequency of ultrasonics\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "l=10 #length in centimetres.\n",
- "Y=20*10**11 #Young's Modulus in dyne/cm square.\n",
- "R=8 #Density in gram/cc\n",
- "\n",
- "#Calculation\n",
- "n=(1.0/(2*l))*math.sqrt(Y/R) #calculating frequency of vibration using \n",
- "#young's modulus.\n",
- "\n",
- "#Result\n",
- "print\"Frequency of vibration=\",n,\"Hz\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Frequency of vibration= 25000.0 Hz\n"
- ]
- }
- ],
- "prompt_number": 28
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:2.6,Page no:50"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Fundamental frequency of vibration\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "t=0.1 #thickness in centimetre.\n",
- "Y=8.75*10**11 #Young's Modulus in dyne/cm square.\n",
- "R=2.654 #Density in gram/cm square.\n",
- "\n",
- "#Calculation\n",
- "n=(1/(2*t))*math.sqrt(Y/R) #calculating frequency using Young's modulus.\n",
- "\n",
- "#Result\n",
- "print\"Frequency of Vibration=\",round(n),\"Hz\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Frequency of Vibration= 2870936.0 Hz\n"
- ]
- }
- ],
- "prompt_number": 26
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:2.7,Page no:50"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Speed of sound wave in water\n",
- "\n",
- "#Variable declaration\n",
- "K=2.026*10**9 #Bulk Modulus in N/m square.\n",
- "R=10**3 #Density in Kg/m cube.\n",
- "\n",
- "#Calculation\n",
- "V=math.sqrt(K/R) #Calculating speed using Bulk Modulus.\n",
- "\n",
- "#Result\n",
- "print\"Velocity of sound waves in water = \",round(V,2),\"m/sec\" \n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Velocity of sound waves in water = 1423.38 m/sec\n"
- ]
- }
- ],
- "prompt_number": 18
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:2.8,Page no:51"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Speed of ultrasonic wave in air\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "Y=1.41 #Young's Modulus.\n",
- "R=1.293*10**-3 #Density of air in g/centimetre cube.\n",
- "P=76*13.6*980 #atmospheric pressure in dyne/cm square.\n",
- "\n",
- "#Calculation\n",
- "V=math.sqrt((Y*P)/R) #calculating speed using young's modulus.\n",
- "\n",
- "#Result\n",
- "print\"Speed of ultrasonic wave in air at n.t.p=\",round(V*10**-2,1),\"m/sec\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Speed of ultrasonic wave in air at n.t.p= 332.4 m/sec\n"
- ]
- }
- ],
- "prompt_number": 16
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:bc446a4cb1141cc1fc3a73e237c82b9c455db1185763ba734b760bbf57d3288c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "UNIT-2:Application of Sound Waves"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:2.1,Page no:41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "v=3000 #volume in metre cube.\n",
+ "theta=0.2 #theta in owu(open window unit).\n",
+ "s=1850 #area in metre cube.\n",
+ "\n",
+ "#Calculation\n",
+ "a=theta*s #calculating total absorbtion of surface.\n",
+ "T=(0.165*v)/a #calculating T using Sabine formula\n",
+ "\n",
+ "#Result\n",
+ "print\"Reverberation time of Room = \",round(T,2) ,\"sec\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reverberation time of Room = 1.34 sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:2.2,Page no:41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "v=120000 #volume in metre cube.\n",
+ "t=1.5 #time in second.\n",
+ "s=25000 #area in metre cube.\n",
+ "\n",
+ "#Calculation\n",
+ "a=(0.16*v)/(t*s) #using Sabine formula for calculating a\n",
+ "\n",
+ "#Variable declaration\n",
+ "print\"Average Absorbing Power of Surface = \",a,\"o w u\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Average Absorbing Power of Surface = 0.512 o w u\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:2.3,Page no:42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "v=6000.0 #Volume in metre cube.\n",
+ "a=20.0 #surface absorbtion in owu(open window unit).\n",
+ "\n",
+ "#Calculation\n",
+ "T=(0.165*v)/(a) #calculating T using Sabine Formula.\n",
+ "\n",
+ "#Result\n",
+ "print\"Reverberation Time = \",T,\"sec\"\n",
+ "print\"\\nNOTE:Calculation mistake in book\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reverberation Time = 49.5 sec\n",
+ "\n",
+ "NOTE:Calculation mistake in book\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:2.4,Page no:42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "v=3500 #volume in metre cube.\n",
+ "n1=370-300 #no. of audience on wooden seats.\n",
+ "n2=300-70 #no. of empty wooden seats.\n",
+ "\n",
+ "#Calculation\n",
+ "a1s1=0.04*60 #absorption due to wooden doors.\n",
+ "a2s2=0.03*700 #absorption due to plastered walls.\n",
+ "a3s3=0.06*50 #absorption due to glass work.\n",
+ "a4s4=4.2*370 #absorption due to audience on spungy and wooden \n",
+ "#seats.\n",
+ "a5s5=2*230 #absorption due to empty seats.\n",
+ "sum=a1s1+a2s2+a3s3+a4s4+a5s5 #total absorption of cinema hall.\n",
+ "T=(0.165*v)/sum #calculating T using Sabine Formula.\n",
+ "\n",
+ "#Result\n",
+ "print\"Reverberation Time = \",round(T,2),\"sec\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reverberation Time = 0.28 sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:2.5,Page no:49"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "l=10 #length in centimetres.\n",
+ "Y=20*10**11 #Young's Modulus in dyne/cm square.\n",
+ "R=8 #Density in gram/cc\n",
+ "\n",
+ "#Calculation\n",
+ "n=(1.0/(2*l))*math.sqrt(Y/R) #calculating frequency of vibration using \n",
+ "#young's modulus.\n",
+ "\n",
+ "#Result\n",
+ "print\"Frequency of vibration=\",n,\"Hz\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Frequency of vibration= 25000.0 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:2.6,Page no:50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "t=0.1 #thickness in centimetre.\n",
+ "Y=8.75*10**11 #Young's Modulus in dyne/cm square.\n",
+ "R=2.654 #Density in gram/cm square.\n",
+ "\n",
+ "#Calculation\n",
+ "n=(1/(2*t))*math.sqrt(Y/R) #calculating frequency using Young's modulus.\n",
+ "\n",
+ "#Result\n",
+ "print\"Frequency of Vibration=\",round(n),\"Hz\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Frequency of Vibration= 2870936.0 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:2.7,Page no:50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "K=2.026*10**9 #Bulk Modulus in N/m square.\n",
+ "R=10**3 #Density in Kg/m cube.\n",
+ "\n",
+ "#Calculation\n",
+ "V=math.sqrt(K/R) #Calculating speed using Bulk Modulus.\n",
+ "\n",
+ "#Result\n",
+ "print\"Velocity of sound waves in water = \",round(V,2),\"m/sec\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Velocity of sound waves in water = 1423.38 m/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:2.8,Page no:51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Y=1.41 #Young's Modulus.\n",
+ "R=1.293*10**-3 #Density of air in g/centimetre cube.\n",
+ "P=76*13.6*980 #atmospheric pressure in dyne/cm square.\n",
+ "\n",
+ "#Calculation\n",
+ "V=math.sqrt((Y*P)/R) #calculating speed using young's modulus.\n",
+ "\n",
+ "#Result\n",
+ "print\"Speed of ultrasonic wave in air at n.t.p=\",round(V*10**-2,1),\"m/sec\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Speed of ultrasonic wave in air at n.t.p= 332.4 m/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter3.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter3.ipynb
index e8c1b701..147c1c8d 100644
--- a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter3.ipynb
+++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter3.ipynb
@@ -1,606 +1,605 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "UNIT-3:Principle of Optics"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.1,Page no:69"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Distance of object from lens\n",
- "\n",
- "#Variable declaration \n",
- "f=15.0 #focal length in cm\n",
- "v=10.0 #image distance in cm\n",
- "\n",
- "#Calculation\n",
- "u=1/((1/v)-(1/f)) #calculating u using (1/f)=(1/v)-(1/u)\n",
- "\n",
- "#Result\n",
- "print\"Object Distance ,u= \",u,\"cm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Object Distance ,u= 30.0 cm\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.2,Page no:70"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Power of lens\n",
- "\n",
- "#Variable declaration\n",
- "f=80.0 #focal length in cm\n",
- "f1=20.0 #focallength of first lens in cm\n",
- "\n",
- "#Calculation\n",
- "f2=1/((1/f)-(1/f1)) #using (1/F)=(1/f1)+(1/f2)\n",
- "P=(100.0/f) #power in D\n",
- "P1=100.0/20 #power of first lens\n",
- "P2=P1-P #power in D\n",
- "\n",
- "#Variable declaration\n",
- "print\"Power= \",P2,\"D\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Power= 3.75 D\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.3,Page no:71"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Focal length and nature of lens\n",
- "\n",
- "#Variable declaration \n",
- "P=2.5 #Power in D\n",
- "\n",
- "#Calculation\n",
- "f=-(1/P) #calculating f in m\n",
- "\n",
- "#Result\n",
- "print\"Focal length =\",f,\"m\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Focal length = -0.4 m\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.4,Page no:72"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find object and image distance\n",
- "\n",
- "#Variable declaration \n",
- "m=4 #magnigication\n",
- "f=20 #focal length in cm\n",
- "\n",
- "#Calculation\n",
- "u=(20*3)/(4) #on simplifying (1/f)=(1/v)-(1/u)\n",
- "v=(4*u) #calculating v in cm\n",
- "\n",
- "#Result\n",
- "print\"Object distance,u= \",u,\"cm\" \n",
- "print\"Image distance,v= \",v,\"cm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Object distance,u= 15 cm\n",
- "Image distance,v= 60 cm\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.5,Page no:72"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Describe image produced by lens\n",
- "\n",
- "from scipy.optimize import fsolve \n",
- "\n",
- "#Variable declaration\n",
- "u=14.0 #object distance in cm\n",
- "f=-21.0 #focal distance in cm\n",
- "\n",
- "#Calculation\n",
- "v=1/((1/f)-(1/u))\n",
- "I=(3.0*v)/(-u) #using m=(1/0)=(v/u) \n",
- "\n",
- "#Result\n",
- "print\"Image distance= \",v,\"cm\" \n",
- "print\"I= \",I,\"cm\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Image distance= -8.4 cm\n",
- "I= 1.8 cm\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.6,Page no:79"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate magnifying power of glass\n",
- "\n",
- "#Variable declaration \n",
- "fe=5 #focal length in cm\n",
- "D=25 #distance od distinct vision in cm\n",
- "\n",
- "#Calculation\n",
- "m=1+(D/fe) #calculating magnifying power\n",
- "\n",
- "#Result\n",
- "print\"magnifying Power = \",m "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "magnifying Power = 6\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.7,Page no:80"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate magnification produced by objectives\n",
- "\n",
- "#Variable declaration \n",
- "fe=5 #focal length in cm\n",
- "D=25 #distance od distinct vision in cm\n",
- "\n",
- "#Calculation\n",
- "mo=30/(1+(D/fe)) #calculating magnification of objective lens\n",
- "\n",
- "#Result\n",
- "print\"Magnification produced by objective lens = \",mo "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Magnification produced by objective lens = 5\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.8,Page no:80"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Magnifying power of microscope\n",
- "\n",
- "#Variable declaration \n",
- "u=-6.0 #object distance in cm\n",
- "fo=4.0 #focal distance in cm\n",
- "fe=6.0 #focal length in cm\n",
- "D=25.0 #distance of distinct vision in cm\n",
- "\n",
- "#Calculation\n",
- "v=1/((1/u)+(1/fo)) #using (1/f)=(1/v)-(1/u)\n",
- "m=(v/u)*(1+(D/fe)) #calculating m\n",
- "\n",
- "#Result\n",
- "print\"Image distance in cm = \",v,\"cm\" \n",
- "print\"Magnifying Power = \",round(-m,2) "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Image distance in cm = 12.0 cm\n",
- "Magnifying Power = 10.33\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.9,Page no:81"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Magnification of lens\n",
- "\n",
- "#Variable declaration \n",
- "D=25.0 #distance of distinct vision\n",
- "u=-9.0 #object distance in cm\n",
- "fe=10.0 #focal length in cm\n",
- "\n",
- "#Calculation\n",
- "v=1/((1/fe)+(1/u)) #using (1/f)=(1/v)-(1/u)\n",
- "m=(v/u) #calculating m\n",
- "M=D/u #calculating Magnifying power of lens\n",
- "\n",
- "#Result\n",
- "print\"Magnification of lens = \",m \n",
- "print\"Magnifying Power = \",round(-M,1) "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Magnification of lens = 10.0\n",
- "Magnifying Power = 2.8\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.10,Page no:82"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate focal length of eye lens\n",
- "\n",
- "#Variable declaration \n",
- "fo=0.5 #focal length of eye lens\n",
- "D=25 #distance of distinct vision\n",
- "L=15 #length in cm\n",
- "m=375 #magnification\n",
- "\n",
- "#Calculation\n",
- "fe=(-L*D)/(fo*((L/fo)-m)) #calculating fe\n",
- "\n",
- "#Result\n",
- "print\"Focal length of eye lens= \",round(fe,1),\"cm\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Focal length of eye lens= 2.2 cm\n"
- ]
- }
- ],
- "prompt_number": 33
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.11,Page no:86"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Focal length of astronomical lens\n",
- "\n",
- "#Variable declaration \n",
- "m=5 #magnifying power\n",
- "L=24 #length in cm\n",
- "fe=4 #focal length in cm\n",
- "\n",
- "#Calculation\n",
- "fo=5*fe #calculating fo\n",
- "\n",
- "#Result\n",
- "print\"Focal length of lens = \",fo,\"cm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Focal length of lens = 20 cm\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.12,Page no:87"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate magnifying power of telescope\n",
- "\n",
- "#Variable declaration \n",
- "D=25.0 #distance of distinct vision in cm\n",
- "fo=140.0 #focal length of eye lens\n",
- "fe=5.0 #focal length in cm\n",
- "\n",
- "#Calculation\n",
- "m=-(fo/fe) #calculating magnifying power\n",
- "m1=-(fo/fe)*(1+(fe/D)) #calculating magnifying power\n",
- "\n",
- "#Result\n",
- "print\"(a):Magnifying power at normal adjustment = \",m\n",
- "print\"(b):Magnifying power atleast distance of distinct vision = \",m1"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a):Magnifying power at normal adjustment = -28.0\n",
- "(b):Magnifying power atleast distance of distinct vision = -33.6\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.13,Page no:88"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find focal length of eye lens\n",
- "\n",
- "#Variable declaration \n",
- "M=5 #Magnifying power\n",
- "fo=10 #focal length of eye lens\n",
- "\n",
- "#Calculation\n",
- "fe=fo/M #calculating fe\n",
- "\n",
- "#Result\n",
- "print\"Focal length of eye lens= \",fe,\"cm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Focal length of eye lens= 2 cm\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.14,Page no:88"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find magnifying power of telescope\n",
- "\n",
- "#Variable declaration \n",
- "fo=75.0 #focal length of eye lens\n",
- "D=25.0 #distance of distinct vision\n",
- "fe=5.0 #focal of eye lens in cm\n",
- "\n",
- "#Calculation\n",
- "M=-(fo/fe)*(1+(fe/D)) #calculating M\n",
- "\n",
- "#Result\n",
- "print\"Magnifying power = \",M"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Magnifying power = -18.0\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:3.15,Page no:88"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Focal length of two thin lens\n",
- "\n",
- "#Variable declaration \n",
- "M=7 #magnifying power\n",
- "L=40 #length\n",
- "\n",
- "#Calculation\n",
- "fe=(L/(M+1)) #focal length of eye lens in cm\n",
- "fo=(M*fe) #calculating focal length\n",
- "\n",
- "#Result\n",
- "print\"Focal Length of lens=\",fo,\"cm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Focal Length of lens= 35 cm\n"
- ]
- }
- ],
- "prompt_number": 13
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:040e38e52e7b9682cfcedeffe89e523ef70aa22db1a3d6616f3de2ca6dd532ec"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "UNIT-3:Principle of Optics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.1,Page no:69"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "f=15.0 #focal length in cm\n",
+ "v=10.0 #image distance in cm\n",
+ "\n",
+ "#Calculation\n",
+ "u=1/((1/v)-(1/f)) #calculating u using (1/f)=(1/v)-(1/u)\n",
+ "\n",
+ "#Result\n",
+ "print\"Object Distance ,u= \",u,\"cm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Object Distance ,u= 30.0 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.2,Page no:70"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "f=80.0 #focal length in cm\n",
+ "f1=20.0 #focallength of first lens in cm\n",
+ "\n",
+ "#Calculation\n",
+ "f2=1/((1/f)-(1/f1)) #using (1/F)=(1/f1)+(1/f2)\n",
+ "P=(100.0/f) #power in D\n",
+ "P1=100.0/20 #power of first lens\n",
+ "P2=P1-P #power in D\n",
+ "\n",
+ "#Variable declaration\n",
+ "print\"Power= \",P2,\"D\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Power= 3.75 D\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.3,Page no:71"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "P=2.5 #Power in D\n",
+ "\n",
+ "#Calculation\n",
+ "f=-(1/P) #calculating f in m\n",
+ "\n",
+ "#Result\n",
+ "print\"Focal length =\",f,\"m\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Focal length = -0.4 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.4,Page no:72"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "m=4 #magnigication\n",
+ "f=20 #focal length in cm\n",
+ "\n",
+ "#Calculation\n",
+ "u=(20*3)/(4) #on simplifying (1/f)=(1/v)-(1/u)\n",
+ "v=(4*u) #calculating v in cm\n",
+ "\n",
+ "#Result\n",
+ "print\"Object distance,u= \",u,\"cm\" \n",
+ "print\"Image distance,v= \",v,\"cm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Object distance,u= 15 cm\n",
+ "Image distance,v= 60 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.5,Page no:72"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from scipy.optimize import fsolve \n",
+ "\n",
+ "#Variable declaration\n",
+ "u=14.0 #object distance in cm\n",
+ "f=-21.0 #focal distance in cm\n",
+ "\n",
+ "#Calculation\n",
+ "v=1/((1/f)-(1/u))\n",
+ "I=(3.0*v)/(-u) #using m=(1/0)=(v/u) \n",
+ "\n",
+ "#Result\n",
+ "print\"Image distance= \",v,\"cm\" \n",
+ "print\"I= \",I,\"cm\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Image distance= -8.4 cm\n",
+ "I= 1.8 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.6,Page no:79"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "fe=5 #focal length in cm\n",
+ "D=25 #distance od distinct vision in cm\n",
+ "\n",
+ "#Calculation\n",
+ "m=1+(D/fe) #calculating magnifying power\n",
+ "\n",
+ "#Result\n",
+ "print\"magnifying Power = \",m "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "magnifying Power = 6\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.7,Page no:80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "fe=5 #focal length in cm\n",
+ "D=25 #distance od distinct vision in cm\n",
+ "\n",
+ "#Calculation\n",
+ "mo=30/(1+(D/fe)) #calculating magnification of objective lens\n",
+ "\n",
+ "#Result\n",
+ "print\"Magnification produced by objective lens = \",mo "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Magnification produced by objective lens = 5\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.8,Page no:80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "u=-6.0 #object distance in cm\n",
+ "fo=4.0 #focal distance in cm\n",
+ "fe=6.0 #focal length in cm\n",
+ "D=25.0 #distance of distinct vision in cm\n",
+ "\n",
+ "#Calculation\n",
+ "v=1/((1/u)+(1/fo)) #using (1/f)=(1/v)-(1/u)\n",
+ "m=(v/u)*(1+(D/fe)) #calculating m\n",
+ "\n",
+ "#Result\n",
+ "print\"Image distance in cm = \",v,\"cm\" \n",
+ "print\"Magnifying Power = \",round(-m,2) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Image distance in cm = 12.0 cm\n",
+ "Magnifying Power = 10.33\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.9,Page no:81"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "D=25.0 #distance of distinct vision\n",
+ "u=-9.0 #object distance in cm\n",
+ "fe=10.0 #focal length in cm\n",
+ "\n",
+ "#Calculation\n",
+ "v=1/((1/fe)+(1/u)) #using (1/f)=(1/v)-(1/u)\n",
+ "m=(v/u) #calculating m\n",
+ "M=D/u #calculating Magnifying power of lens\n",
+ "\n",
+ "#Result\n",
+ "print\"Magnification of lens = \",m \n",
+ "print\"Magnifying Power = \",round(-M,1) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Magnification of lens = 10.0\n",
+ "Magnifying Power = 2.8\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.10,Page no:82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "fo=0.5 #focal length of eye lens\n",
+ "D=25 #distance of distinct vision\n",
+ "L=15 #length in cm\n",
+ "m=375 #magnification\n",
+ "\n",
+ "#Calculation\n",
+ "fe=(-L*D)/(fo*((L/fo)-m)) #calculating fe\n",
+ "\n",
+ "#Result\n",
+ "print\"Focal length of eye lens= \",round(fe,1),\"cm\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Focal length of eye lens= 2.2 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.11,Page no:86"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "m=5 #magnifying power\n",
+ "L=24 #length in cm\n",
+ "fe=4 #focal length in cm\n",
+ "\n",
+ "#Calculation\n",
+ "fo=5*fe #calculating fo\n",
+ "\n",
+ "#Result\n",
+ "print\"Focal length of lens = \",fo,\"cm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Focal length of lens = 20 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.12,Page no:87"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "D=25.0 #distance of distinct vision in cm\n",
+ "fo=140.0 #focal length of eye lens\n",
+ "fe=5.0 #focal length in cm\n",
+ "\n",
+ "#Calculation\n",
+ "m=-(fo/fe) #calculating magnifying power\n",
+ "m1=-(fo/fe)*(1+(fe/D)) #calculating magnifying power\n",
+ "\n",
+ "#Result\n",
+ "print\"(a):Magnifying power at normal adjustment = \",m\n",
+ "print\"(b):Magnifying power atleast distance of distinct vision = \",m1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a):Magnifying power at normal adjustment = -28.0\n",
+ "(b):Magnifying power atleast distance of distinct vision = -33.6\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.13,Page no:88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "M=5 #Magnifying power\n",
+ "fo=10 #focal length of eye lens\n",
+ "\n",
+ "#Calculation\n",
+ "fe=fo/M #calculating fe\n",
+ "\n",
+ "#Result\n",
+ "print\"Focal length of eye lens= \",fe,\"cm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Focal length of eye lens= 2 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.14,Page no:88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "fo=75.0 #focal length of eye lens\n",
+ "D=25.0 #distance of distinct vision\n",
+ "fe=5.0 #focal of eye lens in cm\n",
+ "\n",
+ "#Calculation\n",
+ "M=-(fo/fe)*(1+(fe/D)) #calculating M\n",
+ "\n",
+ "#Result\n",
+ "print\"Magnifying power = \",M"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Magnifying power = -18.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:3.15,Page no:88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "M=7 #magnifying power\n",
+ "L=40 #length\n",
+ "\n",
+ "#Calculation\n",
+ "fe=(L/(M+1)) #focal length of eye lens in cm\n",
+ "fo=(M*fe) #calculating focal length\n",
+ "\n",
+ "#Result\n",
+ "print\"Focal Length of lens=\",fo,\"cm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Focal Length of lens= 35 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter4.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter4.ipynb
index a7b1202f..67ec2ab8 100644
--- a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter4.ipynb
+++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter4.ipynb
@@ -1,1115 +1,1106 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "UNIT-4:Electrostatics"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.1,Page no:103"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Coulomb or charge of an electron\n",
- "\n",
- "#Variable declaration \n",
- "q=1.0 #no of coulomb\n",
- "e=1.6*10**-19 #charge on an electron\n",
- "\n",
- "#Calculation\n",
- "n=(q/e) #calculating no of electrons\n",
- "\n",
- "#Result\n",
- "print\"No of electrons =\",n\n",
- "print\"NOTE:Calculation mistake in book\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "No of electrons = 6.25e+18\n",
- "NOTE:Calculation mistake in book\n"
- ]
- }
- ],
- "prompt_number": 32
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.2,Page no:103"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calcuate charge in equal sized spheres\n",
- "\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "g=9.8\n",
- "m=4.5 #Massin [kg]\n",
- "r=0.03 #radius in [m]\n",
- "\n",
- "#Calculation\n",
- "F=m*g #in Newton\n",
- "q=math.sqrt(((r**2)*m*g)/(9*10**9)) #calculating q using F=(1/4*3.14*eo)*((q1*q2)/(r**2))\n",
- "\n",
- "#Result\n",
- "print\"Charge = \",q,\"C\"\n",
- "print\"\\nNOTE:Calculation mistake in book\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Charge = 2.1e-06 C\n",
- "\n",
- "NOTE:Calculation mistake in book\n"
- ]
- }
- ],
- "prompt_number": 36
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.3,Page no:103"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calcuate force between small spheres\n",
- "\n",
- "#Variable declaration \n",
- "q1=2*10**-7 #charge in C\n",
- "q2=3*10**-7 #charge in C\n",
- "r=30*10**-2 #r in m\n",
- "\n",
- "#Calculation\n",
- "F=(9*10**9)*((q1*q2)/r**2) #calculating F\n",
- "\n",
- "#Result\n",
- "print\"Force = %.e\"%F,\"N\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Force = 6e-03 N\n"
- ]
- }
- ],
- "prompt_number": 70
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.4,Page no:104"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate force between two charges in vacuum\n",
- "\n",
- "#Variable declaration \n",
- "q1=1 #charge in C\n",
- "q2=1 #charge in C\n",
- "r=1 #r in m\n",
- "\n",
- "#Calculation\n",
- "F=(9*10**9)*((q1*q2)/r**2) #calculating F\n",
- "\n",
- "#Result\n",
- "print\"Force = %.e\"%F,\"N\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Force = 9e+09 N\n"
- ]
- }
- ],
- "prompt_number": 71
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.5,Page no:104"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#No of electrons trasnferred when polythene is rubbed\n",
- "\n",
- "#Variable declaration \n",
- "m=9*10**-31 #mass of electron in kg\n",
- "q=-3.2*10**-7 #charge in C\n",
- "e=-1.6*10**-19 #charge on electron in C\n",
- "\n",
- "#Calculation\n",
- "n=(q/e) #calculating n\n",
- "M=n*m #calculating mass transfered\n",
- "\n",
- "#Result\n",
- "print\"(a):No. of electrons = \",n\n",
- "print\"(b):Mass transfered to polythene= \",M,\"kg\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a):No. of electrons = 2e+12\n",
- "(b):Mass transfered to polythene= 1.8e-18 kg\n"
- ]
- }
- ],
- "prompt_number": 50
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.6,Page no:105"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Compare force between electron and proton\n",
- "\n",
- "#Variable declaration \n",
- "q1=1.6*10**-19 #charge in C\n",
- "q2=-1.6*10**-19 #charge in C\n",
- "r=10**-9 #r in m\n",
- "\n",
- "#Calculation\n",
- "F=(9*10**9)*((q1*q2)/r**2) #calculating F\n",
- "\n",
- "#Result\n",
- "print\"Force=\",F,\"N\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Force= -2.304e-10 N\n"
- ]
- }
- ],
- "prompt_number": 54
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.7,Page no:110"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the value of voltage\n",
- "\n",
- "#Variable declaration \n",
- "Va=-10 #voltage in volts\n",
- "W=100 #work in Joule\n",
- "q=2 #charge in Coulomb\n",
- "\n",
- "#Calculation\n",
- "v=(Va)+(W/q) #calculating v\n",
- "\n",
- "#Result\n",
- "print\"Voltage = \",v,\"V\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Voltage = 40 V\n"
- ]
- }
- ],
- "prompt_number": 55
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.8,Page no:111"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate magnitude of point charge for fixed electric field\n",
- "\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "eo=(8.854*10**-12) #constant\n",
- "E=2 #magnitude of electric field in N/C\n",
- "r=0.5 #r in m\n",
- "\n",
- "#Calculation\n",
- "q=E*4*(math.pi)*(eo)*(r**2) #calculating charge\n",
- "\n",
- "#Result\n",
- "print\"Charge= %.2e\"%q,\"C\"\n",
- "print\"\\nNOTE:Calcualtion mistake in book\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Charge= 5.56e-11 C\n",
- "\n",
- "NOTE:Calcualtion mistake in book\n"
- ]
- }
- ],
- "prompt_number": 73
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.9,Page no:111"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate work done to move electron in capacitor\n",
- "\n",
- "#Variable declaration \n",
- "e=-1.6*10**-19 #charge on electron in Coulomb\n",
- "q=20*10**-6 #charge in Coulomb\n",
- "r1=0.1 #r1 in m\n",
- "r2=0.05 #r2 in m\n",
- "\n",
- "#Calculation\n",
- "Va=9*10**9*(q/r1) #calculating voltage at A\n",
- "Vb=9*10**9*(q/r2) #calculating voltage at B\n",
- "V=Va-Vb #potential difference\n",
- "W=V*e #calculating work done in joule\n",
- "\n",
- "#Result\n",
- "print\"Work done to take the electron from A to B = \",W,\"Joule\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Work done to take the electron from A to B = 2.88e-13 Joule\n"
- ]
- }
- ],
- "prompt_number": 69
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.10,Page no:112"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Potential at the centre of the square\n",
- "\n",
- "#Variable declaration \n",
- "q1=(2.0*10**-8) #charge in coulomb\n",
- "q2=(-2.0*10**-8) #charge in coulomb\n",
- "q3=(3.0*10**-8) #charge in coulomb\n",
- "q4=(6.0*10**-8) #charge in coulomb\n",
- "s=1.0 #side in m\n",
- "\n",
- "#Calculation\n",
- "V=(9.0*10**9)*(1.0/s)*(q1+q2+q3+q4) #calculating voltage\n",
- "\n",
- "#Result\n",
- "print\"Voltage in Volts = \",V,\"Volts\"\n",
- "print\"\\nNOTE:Calculation mistake in book\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Voltage in Volts = 810.0 Volts\n",
- "\n",
- "NOTE:Calculation mistake in book\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.11,Page no:123"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Electrical flux through gaussian surface\n",
- "\n",
- "#Variable declaration \n",
- "eo=8.85*10**-12 #constant\n",
- "q=2*10**-6 #charge in coulomb\n",
- "l=9 #length in cm\n",
- "\n",
- "#Calculation\n",
- "fi=(q/eo) #calcualting flux in (N m square)/c\n",
- "\n",
- "#Result\n",
- "print\"Flux through the surface=%2e\"%fi,\"N m^2/c\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Flux through the surface=2.259887e+05 N m^2/c\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.12,Page no:124"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate charge on spherical capacitor\n",
- "\n",
- "\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "eo=8.85*10**-12 #constant\n",
- "r=1.2 #r in m\n",
- "t=80*10**-6 #surface sharge density in c/m square\n",
- "\n",
- "#Calculation\n",
- "q=t*4*(math.pi)*(r**2) #calculating charge\n",
- "fi=q/eo #calculating flux\n",
- "\n",
- "#Result\n",
- "print\"Flux=%g\"%fi,\"N c^-1 m^2\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Flux=1.63576e+08 N c^-1 m^2\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.13,Page no:124"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate linear charge density\n",
- "\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "eo=8.85*10**-12 #constant\n",
- "E=9*10**4 #Electric field in N/C\n",
- "r=2*10**-2 #r in m\n",
- "\n",
- "#Calculation\n",
- "L=2*(math.pi)*E*eo*r #calculating linear charge density\n",
- "\n",
- "#Result\n",
- "print\"Linear charge density = \",round(L,7),\"cm^-1\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Linear charge density = 1e-07 cm^-1\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.14,Page no:125"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Electrical intensity of plates\n",
- "\n",
- "#Variable declaration \n",
- "o=17*10**-22 #surface charge density in cm**-2\n",
- "eo=8.85*10**-12 #constant\n",
- "\n",
- "#Calculation\n",
- "E=o/eo #calculating electric intensity in region III\n",
- "\n",
- "#Result\n",
- "print\"Electric Intensity in regions I and II = 0\" \n",
- "print\"Electric Intensity in region III = \",round(E,12),\"N/C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Electric Intensity in regions I and II = 0\n",
- "Electric Intensity in region III = 1.92e-10 N/C\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.15,Page no:125"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Intensity of electric field of point charge\n",
- "\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "r=0.05 # in m\n",
- "eo=8.85*10**-12 #constant\n",
- "q=10.0**-9 #charge at point P in Coulomb\n",
- "\n",
- "#Calculation\n",
- "E=q/(4*(math.pi)*eo*(r**2)) #calculating electric field\n",
- "r1=0.2 #in m\n",
- "V1=q/(4*(math.pi)*eo*r1) #calculating potential difference\n",
- "\n",
- "#Result\n",
- "print\"Electric field= \",round(E),\"v/m\"\n",
- "print\"\\nNOTE:Approximate answer is calculated in book\\n\\n\"\n",
- "print\"Potential difference between two points = \",round(V1),\"V\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Electric field= 3597.0 v/m\n",
- "\n",
- "NOTE:Approximate answer is calculated in book\n",
- "\n",
- "\n",
- "Potential difference between two points = 45.0 V\n"
- ]
- }
- ],
- "prompt_number": 65
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.16,Page no:126"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Charge on the sphere and electric flux\n",
- "\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "eo=8.85*10**-12 #constant\n",
- "o=80.0*10**-6 #surface charge density in c/ square\n",
- "r=1.2 #in m\n",
- "\n",
- "#Calculation\n",
- "q=o*(math.pi)*(r**2) #calculating charge in Coulomb\n",
- "fi=q/eo #calculating electric flux\n",
- "\n",
- "#Result\n",
- "print\"Charge= \",q,\"C\"\n",
- "print\"Electric flux = \",fi,\"N m^2/c\"\n",
- "print\"\\nNOTE:Wrong answers in book\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Charge= 0.000361911473694 C\n",
- "Electric flux = 40893951.8298 N m^2/c\n",
- "\n",
- "NOTE:Wrong answers in book\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 19
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.17,Page no:138"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Charge on plates of capacitor\n",
- "\n",
- "#Variable declaration \n",
- "V=250 #potential difference in Volt\n",
- "C=10**-11 #capacitance in farad\n",
- "\n",
- "#Calculation\n",
- "q=C*V #calculating charge\n",
- "\n",
- "#Result\n",
- "print\"Charge = \",q,\"C\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Charge = 2.5e-09 C\n"
- ]
- }
- ],
- "prompt_number": 68
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.18,Page no:138"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate capacitance of earth\n",
- "\n",
- "#Variable declaration \n",
- "r=6.4*10**6 #in m\n",
- "\n",
- "#Calculation\n",
- "C=r/(9*10**9) #calculating charge\n",
- "\n",
- "#Result\n",
- "print\"Capacitance = \",round(C*10**6),\"mu F\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Capacitance = 711.0 mu F\n"
- ]
- }
- ],
- "prompt_number": 67
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.19,Page no:138"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Area of capacitor plate\n",
- "\n",
- "#Variable declaration \n",
- "C=2 #capacitance in Farad\n",
- "d=0.5*10**-2 #distance in m\n",
- "eo=8.85*10**-12 #constant\n",
- "\n",
- "#Calculation\n",
- "A=(C*d)/(eo) #calculating area\n",
- "\n",
- "#Result\n",
- "print\"Area=%.2e\"%A,\"m^2\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Area=1.13e+09 m^2\n"
- ]
- }
- ],
- "prompt_number": 66
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.20,Page no:139"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Spherical and plate capacitor\n",
- "\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "A=0.02 #area in m square\n",
- "r=0.5 #r in m\n",
- "\n",
- "#Calculation\n",
- "d=(A/(4*(math.pi)*r)) #calculating distance\n",
- "\n",
- "#Result\n",
- "print\"Distance between the plates = \",round(d*1000,2),\"mm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Distance between the plates = 3.18 mm\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.21,Page no:139"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Capacitance of parallel plate capacitor\n",
- "\n",
- "#Variable declaration \n",
- "eo=8.85*10**-12 #constant\n",
- "A=1 #area in m square\n",
- "d=2*10**-3 #r in m\n",
- "K=4 #constant\n",
- "\n",
- "#Calculation\n",
- "C=(K*eo*A)/d #calculating capacitance\n",
- "\n",
- "#Result\n",
- "print\"Capacitance = \",C,\"Farad\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Capacitance = 1.77e-08 Farad\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.22,Page no:140"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Capacity with air between plates\n",
- "\n",
- "#Variable declaration \n",
- "cm=10*10**-6 #capacitance in Farad\n",
- "K=2 #constant\n",
- "\n",
- "#Calculation\n",
- "co=cm/K #calculating co\n",
- "\n",
- "#Result\n",
- "print\"capacity of capacitor with air between the plates= \",co*10**6,\"muF\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "capacity of capacitor with air between the plates= 5.0 muF\n"
- ]
- }
- ],
- "prompt_number": 37
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.23,Page no:140"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Capacitance of combination of capacitors\n",
- "\n",
- "#Variable declaration \n",
- "v=100.0 #v in volt\n",
- "c1=8.0*10**-6 #capacitance in Farad\n",
- "c2=12.0*10.0**-6 #capacitance in Farad\n",
- "c3=24.0*10.0**-6 #capacitance in Farad\n",
- "cs=4.0/(10.0**6) #calculating series capacitance\n",
- "\n",
- "#Calculation\n",
- "cp=(c1+c2+c3) #calculating parallel capacitance\n",
- "qs=cs*v #calculating charge\n",
- "\n",
- "#Result\n",
- "print\"Equivalent Series capacitance,C= \",cs*10**6,\"muF\"\n",
- "print\"Equivalent parallel capacitance,Cp= \",cp*10**6,\"muF\" \n",
- "print\"charge on plate=%.e\"%qs,\"C\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Equivalent Series capacitance,C= 4.0 muF\n",
- "Equivalent parallel capacitance,Cp= 44.0 muF\n",
- "charge on plate=4e-04 C\n"
- ]
- }
- ],
- "prompt_number": 48
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.24,Page no:141"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Electrical energy stored by capacitor\n",
- "\n",
- "#Variable declaration \n",
- "C=9*10**-10 #capacitance in farad\n",
- "V=100.0 #in volt\n",
- "\n",
- "#Calculation\n",
- "U=(1/2.0)*(C*(V**2)) #calculating energy stored\n",
- "\n",
- "#Result\n",
- "print\"Energy stored = \",U,\"J\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Energy stored = 4.5e-06 J\n"
- ]
- }
- ],
- "prompt_number": 50
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.25,Page no:141"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate electrical energy stored by the capacitor\n",
- "\n",
- "#Variable declaration \n",
- "eo=8.85*10**-12 #constant\n",
- "A=90.0*10**-4 #area in m square\n",
- "d=2.5*10**-3 #distance in m\n",
- "V=400.0 #in volt\n",
- "\n",
- "#Calculation\n",
- "C=(eo*A)/d #calculating capacitance\n",
- "W=(1/2.0)*(C*(V**2)) #calculating electrical energy stored\n",
- "\n",
- "#Result\n",
- "print\"Capacitance = \",C,\"Farad\"\n",
- "print\"Electrical Energy stored in capacitor =%.2e\"%W,\"J\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Capacitance = 3.186e-11 Farad\n",
- "Electrical Energy stored in capacitor =2.55e-06 J\n"
- ]
- }
- ],
- "prompt_number": 56
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.26,Page no:142"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Time the capacity after parallel\n",
- "#Variable declaration \n",
- "v=100 #v in volt\n",
- "c1=1*10**-6 #capacitance in Farad\n",
- "c2=2*10**-6 #capacitance in Farad\n",
- "c3=3*10**-6 #capacitance in Farad\n",
- "cs=6/11.0 #calculating series capacitance\n",
- "\n",
- "#Calculation\n",
- "cp=(c1+c2+c3) #calculating parallel capacitance\n",
- "\n",
- "#Result\n",
- "print\"Equivalent Series capacitance = \",cs,\"muF\"\n",
- "print\"Equivalent parallel capacitance= \",cp*10**6,\"muF\"\n",
- "print\"Therefore Cp=(11*Cs)\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Equivalent Series capacitance = 0.545454545455 muF\n",
- "Equivalent parallel capacitance= 6.0 muF\n",
- "Therefore Cp=(11*Cs)\n"
- ]
- }
- ],
- "prompt_number": 60
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:4.27,Page no:143"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate work done by battery\n",
- "#Variable declaration \n",
- "eo=8.85*10**-12 #constant\n",
- "V=6 #v in volt\n",
- "A=25*10**-4 #area in m square\n",
- "d=10**-3 #distance in m\n",
- "\n",
- "#Calculation\n",
- "q=(eo*A*V)/d #calculating charge\n",
- "W=q*V #calculating work done\n",
- "\n",
- "#Result\n",
- "print\"Charge through battery =%.3g\"%q,\"C\"\n",
- "print\"Work done by Battery=%.e\"%W,\"J\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Charge through battery =1.33e-10 C\n",
- "Work done by Battery=8e-10 J\n"
- ]
- }
- ],
- "prompt_number": 63
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:5389b8ee7db605c2b6709900953f8acf2763d42f0399c64611452653d4ee8704"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "UNIT-4:Electrostatics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.1,Page no:103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "q=1.0 #no of coulomb\n",
+ "e=1.6*10**-19 #charge on an electron\n",
+ "\n",
+ "#Calculation\n",
+ "n=(q/e) #calculating no of electrons\n",
+ "\n",
+ "#Result\n",
+ "print\"No of electrons =\",n\n",
+ "print\"NOTE:Calculation mistake in book\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "No of electrons = 6.25e+18\n",
+ "NOTE:Calculation mistake in book\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.2,Page no:103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "g=9.8\n",
+ "m=4.5 #Massin [kg]\n",
+ "r=0.03 #radius in [m]\n",
+ "\n",
+ "#Calculation\n",
+ "F=m*g #in Newton\n",
+ "q=math.sqrt(((r**2)*m*g)/(9*10**9)) #calculating q using F=(1/4*3.14*eo)*((q1*q2)/(r**2))\n",
+ "\n",
+ "#Result\n",
+ "print\"Charge = \",q,\"C\"\n",
+ "print\"\\nNOTE:Calculation mistake in book\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Charge = 2.1e-06 C\n",
+ "\n",
+ "NOTE:Calculation mistake in book\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.3,Page no:103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "q1=2*10**-7 #charge in C\n",
+ "q2=3*10**-7 #charge in C\n",
+ "r=30*10**-2 #r in m\n",
+ "\n",
+ "#Calculation\n",
+ "F=(9*10**9)*((q1*q2)/r**2) #calculating F\n",
+ "\n",
+ "#Result\n",
+ "print\"Force = %.e\"%F,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Force = 6e-03 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 70
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.4,Page no:104"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "q1=1 #charge in C\n",
+ "q2=1 #charge in C\n",
+ "r=1 #r in m\n",
+ "\n",
+ "#Calculation\n",
+ "F=(9*10**9)*((q1*q2)/r**2) #calculating F\n",
+ "\n",
+ "#Result\n",
+ "print\"Force = %.e\"%F,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Force = 9e+09 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 71
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.5,Page no:104"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "m=9*10**-31 #mass of electron in kg\n",
+ "q=-3.2*10**-7 #charge in C\n",
+ "e=-1.6*10**-19 #charge on electron in C\n",
+ "\n",
+ "#Calculation\n",
+ "n=(q/e) #calculating n\n",
+ "M=n*m #calculating mass transfered\n",
+ "\n",
+ "#Result\n",
+ "print\"(a):No. of electrons = \",n\n",
+ "print\"(b):Mass transfered to polythene= \",M,\"kg\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a):No. of electrons = 2e+12\n",
+ "(b):Mass transfered to polythene= 1.8e-18 kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.6,Page no:105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "q1=1.6*10**-19 #charge in C\n",
+ "q2=-1.6*10**-19 #charge in C\n",
+ "r=10**-9 #r in m\n",
+ "\n",
+ "#Calculation\n",
+ "F=(9*10**9)*((q1*q2)/r**2) #calculating F\n",
+ "\n",
+ "#Result\n",
+ "print\"Force=\",F,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Force= -2.304e-10 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 54
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.7,Page no:110"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "Va=-10 #voltage in volts\n",
+ "W=100 #work in Joule\n",
+ "q=2 #charge in Coulomb\n",
+ "\n",
+ "#Calculation\n",
+ "v=(Va)+(W/q) #calculating v\n",
+ "\n",
+ "#Result\n",
+ "print\"Voltage = \",v,\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Voltage = 40 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 55
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.8,Page no:111"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "eo=(8.854*10**-12) #constant\n",
+ "E=2 #magnitude of electric field in N/C\n",
+ "r=0.5 #r in m\n",
+ "\n",
+ "#Calculation\n",
+ "q=E*4*(math.pi)*(eo)*(r**2) #calculating charge\n",
+ "\n",
+ "#Result\n",
+ "print\"Charge= %.2e\"%q,\"C\"\n",
+ "print\"\\nNOTE:Calcualtion mistake in book\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Charge= 5.56e-11 C\n",
+ "\n",
+ "NOTE:Calcualtion mistake in book\n"
+ ]
+ }
+ ],
+ "prompt_number": 73
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.9,Page no:111"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "e=-1.6*10**-19 #charge on electron in Coulomb\n",
+ "q=20*10**-6 #charge in Coulomb\n",
+ "r1=0.1 #r1 in m\n",
+ "r2=0.05 #r2 in m\n",
+ "\n",
+ "#Calculation\n",
+ "Va=9*10**9*(q/r1) #calculating voltage at A\n",
+ "Vb=9*10**9*(q/r2) #calculating voltage at B\n",
+ "V=Va-Vb #potential difference\n",
+ "W=V*e #calculating work done in joule\n",
+ "\n",
+ "#Result\n",
+ "print\"Work done to take the electron from A to B = \",W,\"Joule\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Work done to take the electron from A to B = 2.88e-13 Joule\n"
+ ]
+ }
+ ],
+ "prompt_number": 69
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.10,Page no:112"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "q1=(2.0*10**-8) #charge in coulomb\n",
+ "q2=(-2.0*10**-8) #charge in coulomb\n",
+ "q3=(3.0*10**-8) #charge in coulomb\n",
+ "q4=(6.0*10**-8) #charge in coulomb\n",
+ "s=1.0 #side in m\n",
+ "\n",
+ "#Calculation\n",
+ "V=(9.0*10**9)*(1.0/s)*(q1+q2+q3+q4) #calculating voltage\n",
+ "\n",
+ "#Result\n",
+ "print\"Voltage in Volts = \",V,\"Volts\"\n",
+ "print\"\\nNOTE:Calculation mistake in book\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Voltage in Volts = 810.0 Volts\n",
+ "\n",
+ "NOTE:Calculation mistake in book\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.11,Page no:123"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "eo=8.85*10**-12 #constant\n",
+ "q=2*10**-6 #charge in coulomb\n",
+ "l=9 #length in cm\n",
+ "\n",
+ "#Calculation\n",
+ "fi=(q/eo) #calcualting flux in (N m square)/c\n",
+ "\n",
+ "#Result\n",
+ "print\"Flux through the surface=%2e\"%fi,\"N m^2/c\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Flux through the surface=2.259887e+05 N m^2/c\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.12,Page no:124"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "eo=8.85*10**-12 #constant\n",
+ "r=1.2 #r in m\n",
+ "t=80*10**-6 #surface sharge density in c/m square\n",
+ "\n",
+ "#Calculation\n",
+ "q=t*4*(math.pi)*(r**2) #calculating charge\n",
+ "fi=q/eo #calculating flux\n",
+ "\n",
+ "#Result\n",
+ "print\"Flux=%g\"%fi,\"N c^-1 m^2\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Flux=1.63576e+08 N c^-1 m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.13,Page no:124"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "eo=8.85*10**-12 #constant\n",
+ "E=9*10**4 #Electric field in N/C\n",
+ "r=2*10**-2 #r in m\n",
+ "\n",
+ "#Calculation\n",
+ "L=2*(math.pi)*E*eo*r #calculating linear charge density\n",
+ "\n",
+ "#Result\n",
+ "print\"Linear charge density = \",round(L,7),\"cm^-1\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Linear charge density = 1e-07 cm^-1\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.14,Page no:125"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "o=17*10**-22 #surface charge density in cm**-2\n",
+ "eo=8.85*10**-12 #constant\n",
+ "\n",
+ "#Calculation\n",
+ "E=o/eo #calculating electric intensity in region III\n",
+ "\n",
+ "#Result\n",
+ "print\"Electric Intensity in regions I and II = 0\" \n",
+ "print\"Electric Intensity in region III = \",round(E,12),\"N/C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Electric Intensity in regions I and II = 0\n",
+ "Electric Intensity in region III = 1.92e-10 N/C\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.15,Page no:125"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "r=0.05 # in m\n",
+ "eo=8.85*10**-12 #constant\n",
+ "q=10.0**-9 #charge at point P in Coulomb\n",
+ "\n",
+ "#Calculation\n",
+ "E=q/(4*(math.pi)*eo*(r**2)) #calculating electric field\n",
+ "r1=0.2 #in m\n",
+ "V1=q/(4*(math.pi)*eo*r1) #calculating potential difference\n",
+ "\n",
+ "#Result\n",
+ "print\"Electric field= \",round(E),\"v/m\"\n",
+ "print\"\\nNOTE:Approximate answer is calculated in book\\n\\n\"\n",
+ "print\"Potential difference between two points = \",round(V1),\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Electric field= 3597.0 v/m\n",
+ "\n",
+ "NOTE:Approximate answer is calculated in book\n",
+ "\n",
+ "\n",
+ "Potential difference between two points = 45.0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 65
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.16,Page no:126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "eo=8.85*10**-12 #constant\n",
+ "o=80.0*10**-6 #surface charge density in c/ square\n",
+ "r=1.2 #in m\n",
+ "\n",
+ "#Calculation\n",
+ "q=o*(math.pi)*(r**2) #calculating charge in Coulomb\n",
+ "fi=q/eo #calculating electric flux\n",
+ "\n",
+ "#Result\n",
+ "print\"Charge= \",q,\"C\"\n",
+ "print\"Electric flux = \",fi,\"N m^2/c\"\n",
+ "print\"\\nNOTE:Wrong answers in book\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Charge= 0.000361911473694 C\n",
+ "Electric flux = 40893951.8298 N m^2/c\n",
+ "\n",
+ "NOTE:Wrong answers in book\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.17,Page no:138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "V=250 #potential difference in Volt\n",
+ "C=10**-11 #capacitance in farad\n",
+ "\n",
+ "#Calculation\n",
+ "q=C*V #calculating charge\n",
+ "\n",
+ "#Result\n",
+ "print\"Charge = \",q,\"C\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Charge = 2.5e-09 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 68
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.18,Page no:138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "r=6.4*10**6 #in m\n",
+ "\n",
+ "#Calculation\n",
+ "C=r/(9*10**9) #calculating charge\n",
+ "\n",
+ "#Result\n",
+ "print\"Capacitance = \",round(C*10**6),\"mu F\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Capacitance = 711.0 mu F\n"
+ ]
+ }
+ ],
+ "prompt_number": 67
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.19,Page no:138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "C=2 #capacitance in Farad\n",
+ "d=0.5*10**-2 #distance in m\n",
+ "eo=8.85*10**-12 #constant\n",
+ "\n",
+ "#Calculation\n",
+ "A=(C*d)/(eo) #calculating area\n",
+ "\n",
+ "#Result\n",
+ "print\"Area=%.2e\"%A,\"m^2\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area=1.13e+09 m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 66
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.20,Page no:139"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "A=0.02 #area in m square\n",
+ "r=0.5 #r in m\n",
+ "\n",
+ "#Calculation\n",
+ "d=(A/(4*(math.pi)*r)) #calculating distance\n",
+ "\n",
+ "#Result\n",
+ "print\"Distance between the plates = \",round(d*1000,2),\"mm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Distance between the plates = 3.18 mm\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.21,Page no:139"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "eo=8.85*10**-12 #constant\n",
+ "A=1 #area in m square\n",
+ "d=2*10**-3 #r in m\n",
+ "K=4 #constant\n",
+ "\n",
+ "#Calculation\n",
+ "C=(K*eo*A)/d #calculating capacitance\n",
+ "\n",
+ "#Result\n",
+ "print\"Capacitance = \",C,\"Farad\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Capacitance = 1.77e-08 Farad\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.22,Page no:140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "cm=10*10**-6 #capacitance in Farad\n",
+ "K=2 #constant\n",
+ "\n",
+ "#Calculation\n",
+ "co=cm/K #calculating co\n",
+ "\n",
+ "#Result\n",
+ "print\"capacity of capacitor with air between the plates= \",co*10**6,\"muF\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "capacity of capacitor with air between the plates= 5.0 muF\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.23,Page no:140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "v=100.0 #v in volt\n",
+ "c1=8.0*10**-6 #capacitance in Farad\n",
+ "c2=12.0*10.0**-6 #capacitance in Farad\n",
+ "c3=24.0*10.0**-6 #capacitance in Farad\n",
+ "cs=4.0/(10.0**6) #calculating series capacitance\n",
+ "\n",
+ "#Calculation\n",
+ "cp=(c1+c2+c3) #calculating parallel capacitance\n",
+ "qs=cs*v #calculating charge\n",
+ "\n",
+ "#Result\n",
+ "print\"Equivalent Series capacitance,C= \",cs*10**6,\"muF\"\n",
+ "print\"Equivalent parallel capacitance,Cp= \",cp*10**6,\"muF\" \n",
+ "print\"charge on plate=%.e\"%qs,\"C\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Equivalent Series capacitance,C= 4.0 muF\n",
+ "Equivalent parallel capacitance,Cp= 44.0 muF\n",
+ "charge on plate=4e-04 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.24,Page no:141"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "C=9*10**-10 #capacitance in farad\n",
+ "V=100.0 #in volt\n",
+ "\n",
+ "#Calculation\n",
+ "U=(1/2.0)*(C*(V**2)) #calculating energy stored\n",
+ "\n",
+ "#Result\n",
+ "print\"Energy stored = \",U,\"J\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Energy stored = 4.5e-06 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.25,Page no:141"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "eo=8.85*10**-12 #constant\n",
+ "A=90.0*10**-4 #area in m square\n",
+ "d=2.5*10**-3 #distance in m\n",
+ "V=400.0 #in volt\n",
+ "\n",
+ "#Calculation\n",
+ "C=(eo*A)/d #calculating capacitance\n",
+ "W=(1/2.0)*(C*(V**2)) #calculating electrical energy stored\n",
+ "\n",
+ "#Result\n",
+ "print\"Capacitance = \",C,\"Farad\"\n",
+ "print\"Electrical Energy stored in capacitor =%.2e\"%W,\"J\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Capacitance = 3.186e-11 Farad\n",
+ "Electrical Energy stored in capacitor =2.55e-06 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.26,Page no:142"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "v=100 #v in volt\n",
+ "c1=1*10**-6 #capacitance in Farad\n",
+ "c2=2*10**-6 #capacitance in Farad\n",
+ "c3=3*10**-6 #capacitance in Farad\n",
+ "cs=6/11.0 #calculating series capacitance\n",
+ "\n",
+ "#Calculation\n",
+ "cp=(c1+c2+c3) #calculating parallel capacitance\n",
+ "\n",
+ "#Result\n",
+ "print\"Equivalent Series capacitance = \",cs,\"muF\"\n",
+ "print\"Equivalent parallel capacitance= \",cp*10**6,\"muF\"\n",
+ "print\"Therefore Cp=(11*Cs)\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Equivalent Series capacitance = 0.545454545455 muF\n",
+ "Equivalent parallel capacitance= 6.0 muF\n",
+ "Therefore Cp=(11*Cs)\n"
+ ]
+ }
+ ],
+ "prompt_number": 60
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:4.27,Page no:143"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "eo=8.85*10**-12 #constant\n",
+ "V=6 #v in volt\n",
+ "A=25*10**-4 #area in m square\n",
+ "d=10**-3 #distance in m\n",
+ "\n",
+ "#Calculation\n",
+ "q=(eo*A*V)/d #calculating charge\n",
+ "W=q*V #calculating work done\n",
+ "\n",
+ "#Result\n",
+ "print\"Charge through battery =%.3g\"%q,\"C\"\n",
+ "print\"Work done by Battery=%.e\"%W,\"J\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Charge through battery =1.33e-10 C\n",
+ "Work done by Battery=8e-10 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 63
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter5.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter5.ipynb
index 53a08905..581d450b 100644
--- a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter5.ipynb
+++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter5.ipynb
@@ -1,1043 +1,1035 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "UNIT-5 Electricity"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.1,Page no:152"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate current flowing through a conductor\n",
- "\n",
- "#Variable declaration \n",
- "n=10**6 #no. of electrons\n",
- "e=1.6*10**-19 #charge on an electron in C\n",
- "\n",
- "#Calculation\n",
- "q=n*e #calculating total charge\n",
- "t=10**-3 #time in second\n",
- "I=q/t #calculating current\n",
- "\n",
- "#Result\n",
- "print\"Current flowing = \",I,\"Ampere\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Current flowing = 1.6e-10 Ampere\n"
- ]
- }
- ],
- "prompt_number": 71
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.2,Page no:152"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#No of electrons passing through a lamp\n",
- "\n",
- "#Variable declaration \n",
- "I=300*10**-3 #current n Ampere\n",
- "t=60 #time in second\n",
- "e=1.6*10**-19 #chatge on electron in C\n",
- "\n",
- "#Calculation\n",
- "q=I*t #calculating charge\n",
- "n=q/e #calculating no of electrons\n",
- "\n",
- "#Result\n",
- "print\"No. of electrons = \",n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "No. of electrons = 1.125e+20\n"
- ]
- }
- ],
- "prompt_number": 20
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.3,Page no:154"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Frequency of electrons across a conductor\n",
- "\n",
- "#Variable declaration \n",
- "V=200 #voltage in volt\n",
- "R=100 #resistance in Ohm\n",
- "e=1.6*10**-19 #charge on an electron in C\n",
- "\n",
- "#Calculation\n",
- "I=V/R #Ohm's law\n",
- "t=1 #time in second\n",
- "q=I*t #calculating charge\n",
- "n=q/e #calculating no of electrons\n",
- "\n",
- "#Result\n",
- "print\"No. of electrons = \",n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "No. of electrons = 1.25e+19\n"
- ]
- }
- ],
- "prompt_number": 72
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.4,Page no:156"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Resistivity of small wire\n",
- "\n",
- "#Variable declaration \n",
- "l=15 #length in m\n",
- "A=6*10**-7 #area in m square\n",
- "R=5 #resistance in Ohm\n",
- "\n",
- "#Calculation\n",
- "p=(A*R)/l #calculating resistivity\n",
- "\n",
- "#Result\n",
- "print\"Resistivity= \",p,\"Ohm metre\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Resistivity= 2e-07 Ohm metre\n"
- ]
- }
- ],
- "prompt_number": 73
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.5,Page no:157"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Resistivity of a normal wire\n",
- "\n",
- "#Variable declaration \n",
- "l=0.1 #length in m\n",
- "A=10**-4 #area in m square\n",
- "R=0.01 #resistance in Ohm\n",
- "\n",
- "#Calculation\n",
- "p=(A*R)/l #calculating resistivity\n",
- "\n",
- "#Result\n",
- "print\"Resistivity = \",p,\"Ohm metre\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Resistivity = 1e-05 Ohm metre\n"
- ]
- }
- ],
- "prompt_number": 74
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.6,Page no:157"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Resistivity of a long wire\n",
- "\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "L=1 #length in m\n",
- "r=0.2*10**-3 #radius in m\n",
- "R=2 #resistance in Ohm\n",
- "\n",
- "#Calculation\n",
- "A=math.pi*(r)**2 #calculating area\n",
- "P=(R*A)/L #calculating resistivity\n",
- "\n",
- "#Result\n",
- "print\"Resistivity =%.2g\"%P,\"Ohm.metre\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Resistivity =2.5e-07 Ohm.metre\n"
- ]
- }
- ],
- "prompt_number": 38
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.7,Page no:158"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#New resistance of a wire after drawn out\n",
- "\n",
- "#Variable declaration \n",
- "R1=5 #resisitance in Ohm\n",
- "\n",
- "#Calculation\n",
- "#A2=A/3\n",
- "#R2/5=3l*3/A*A/l\n",
- "#R2=9*5\n",
- "\n",
- "R2=9*R1 #calculating using R2/A1=(l2/A2)*(A1/l1)\n",
- "print\"Resisitance = \",R2,\"Ohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Resisitance = 45 Ohm\n"
- ]
- }
- ],
- "prompt_number": 75
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.8,Page no:159"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Change in resistance of a wire\n",
- "\n",
- "#Variable declaration \n",
- "R1=5 #resisitance in Ohm\n",
- "\n",
- "#Calculation\n",
- "#A2=A/2\n",
- "#R1=rho*l1/A1*R2\n",
- "#R2=rho*l2/A2\n",
- "#R2/R1=A1/l1\n",
- "R2=4*R1 #calculating using R2/A1=(l2/A2)*(A1/l1)\n",
- "\n",
- "#Result\n",
- "print\"Resisitance= \",R2,\"Ohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Resisitance= 20 Ohm\n"
- ]
- }
- ],
- "prompt_number": 70
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.9,Page no:162"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Total resistance in parallel\n",
- "\n",
- "#Variable declaration \n",
- "R1=2 #resisitance in Ohm\n",
- "R2=4 #resistance in Ohm\n",
- "R3=5 #resistance in Ohm\n",
- "\n",
- "#Calculation\n",
- "R=(R1**-1)+(R2**-1)+(R3**-1) #calculating parallel resistance\n",
- "Rp=(1/R) \n",
- "\n",
- "#Result\n",
- "print\"Resisitance = \",Rp,\"Ohm\"\n",
- "print\"\\nNOTE:Incorrect answer in book\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Resisitance = 1.05263157895 Ohm\n",
- "\n",
- "NOTE:Incorrect answer in book\n"
- ]
- }
- ],
- "prompt_number": 39
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.10,Page no:163"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Series parallel combination resistance\n",
- "\n",
- "from scipy.optimize import fsolve \n",
- "\n",
- "#Variable declaration\n",
- "Rs=40 #resisitance in Ohm\n",
- "\n",
- "#Calculation\n",
- "#R1+R2=40\n",
- "#R1*R2=256\n",
- "#R1=256/R2\n",
- "#Putting this value in eq 1:\n",
- "#(256/R2)+R2=40\n",
- "from sympy import solve, symbols, pprint\n",
- "R2= symbols('R2')\n",
- "a=1\n",
- "b=-40\n",
- "c=256\n",
- "f = a*R2**2 + b*R2 + c\n",
- "solution = solve(f, R2)\n",
- "\n",
- "#Result\n",
- "print\"When R2=\",solution[0],\"Ohm R1=\",solution[1],\"Ohm\"\n",
- "print\"When R2=\",solution[1],\"Ohm R1=\",solution[0],\"Ohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "When R2= 8 Ohm R1= 32 Ohm\n",
- "When R2= 32 Ohm R1= 8 Ohm\n"
- ]
- }
- ],
- "prompt_number": 24
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.11,Page no:164"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the valueof current in fig\n",
- "\n",
- "#Variable declaration \n",
- "V=2.0 #in volts\n",
- "R1=30.0 #resisitance in Ohm\n",
- "R2=60.0 #resistance in Ohm\n",
- "\n",
- "#Calculation\n",
- "Rp=(R1*R2)/(R1+R2) #calculating parallel resistance\n",
- "I=V/Rp #Ohm's law\n",
- "\n",
- "#Result\n",
- "print\"Resisitance = \",Rp,\"Ohm\"\n",
- "print\"Current = \",I,\"A\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Resisitance = 20.0 Ohm\n",
- "Current = 0.1 A\n"
- ]
- }
- ],
- "prompt_number": 26
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.12,Page no:165"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Combine resistance to get an equivalent resistance\n",
- "\n",
- "#Variable declaration \n",
- "R1=2.0 #resisitance in Ohm\n",
- "R2=3.0 #resistance in Ohm\n",
- "R3=1.0 #resistance in Ohm\n",
- "\n",
- "#Calculation\n",
- "Rp=(R1*R2)/(R1+R2) #calculating parallel resistance\n",
- "R=Rp+1.0 #1 Ohm in series\n",
- "Rs=(R1+R2+R3) #series resistances\n",
- "Rp=(1.0/R1)+(1.0/R2)+(1.0/R3) #calculating parallel resistance\n",
- "\n",
- "#Result\n",
- "print\"(1)Equivalent Resisitance= \",R,\"Ohm\" \n",
- "print\"(2)All resistances in series = \",Rs,\"Ohm\"\n",
- "print\"(3)All in Parallel = \",(1/Rp),\"Ohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(1)Equivalent Resisitance= 2.2 Ohm\n",
- "(2)All resistances in series = 6.0 Ohm\n",
- "(3)All in Parallel = 0.545454545455 Ohm\n"
- ]
- }
- ],
- "prompt_number": 76
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.13,Page no:166"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Total resistor of combination\n",
- "\n",
- "#Variable declaration \n",
- "V=20 #voltage in Volts\n",
- "R1=2.0 #resisitance in Ohm\n",
- "R2=4.0 #resistance in Ohm\n",
- "R3=5.0 #resistance in Ohm\n",
- "\n",
- "#Calculation\n",
- "Rp=(1/R1)+(1/R2)+(1/R3) #calculating parallel resistance\n",
- "R=1/Rp #Parallel\n",
- "I1=V/R1 #calculating current through R1\n",
- "I2=V/R2 #calculating current through R2\n",
- "I3=V/R3 #calculating current through R3\n",
- "I=V/R #calculating total current\n",
- "\n",
- "\n",
- "#Result\n",
- "print\"(a)Equivalent Resisitance = \",R,\"Ohm\"\n",
- "print\"Current through R1 = \",I1,\"Ampere\"\n",
- "print\"Current through R2 = \",I2,\"Ampere\" \n",
- "print\"Total current = \",I,\"Ampere\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Equivalent Resisitance = 1.05263157895 Ohm\n",
- "Current through R1 = 10.0 Ampere\n",
- "Current through R2 = 5.0 Ampere\n",
- "Total current = 19.0 Ampere\n"
- ]
- }
- ],
- "prompt_number": 30
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.14,Page no:166"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate no of resistors form total resistor\n",
- "\n",
- "#Variable declaration\n",
- "R=7 #Total resistanc of combination\n",
- "\n",
- "#Calculation\n",
- "def f(n):\n",
- " Rp = 6*(1/n) #resistance in parallel\n",
- " return(R-Rp-5)\n",
- "n=fsolve(f,1)\n",
- "\n",
- "#Result\n",
- "print\"n=\",n[0]"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "n= 3.0\n"
- ]
- }
- ],
- "prompt_number": 33
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.15,Page no:173"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Voltage and current in figure\n",
- "\n",
- "#Variable declaration \n",
- "R1=2 #resistance in Ohm\n",
- "R2=6 #resistance in Ohm\n",
- "R3=3 #resistance in Ohm\n",
- "V=24 #voltage in volts\n",
- "R=8 #resistance in Ohm\n",
- "\n",
- "#Calculation\n",
- "I=V/R #Ohm's Law\n",
- "V1=I*R1 #Ohm's Law\n",
- "V2=I*R2 #Ohm's Law\n",
- "V3=I*R3 #Ohm's Law\n",
- "\n",
- "#Result\n",
- "print\"Current = \",I,\"Ampere\" \n",
- "print\"Voltage drop across R1 = \",V1,\"Volts\"\n",
- "print\"Voltage drop across R2 = \",V2,\"Volts\" \n",
- "print\"Voltage drop across R3 = \",V3,\"Volts\"\n",
- "print\"\\nNOTE:Wrong answer of R3 in book\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Current = 3 Ampere\n",
- "Voltage drop across R1 = 6 Volts\n",
- "Voltage drop across R2 = 18 Volts\n",
- "Voltage drop across R3 = 9 Volts\n",
- "\n",
- "NOTE:Wrong answer of R3 in book\n"
- ]
- }
- ],
- "prompt_number": 36
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.16,Page no:173"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Current through branches of circuit\n",
- "\n",
- "#Variable declaration \n",
- "R=15 #resistance in Ohm\n",
- "print\"KVL: 16I1+15I2=6 (1)\" #KVL equation\n",
- "I1=-1.66 #from(1)\n",
- "I2=2.17 #from (1)\n",
- "#Calculation\n",
- "V=(I1+I2)*R #calculating potential difference\n",
- "\n",
- "#Result\n",
- "print\"Potential difference= \",V,\"Volt\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "KVL: 16I1+15I2=6 (1)\n",
- "Potential difference= 7.65 Volt\n"
- ]
- }
- ],
- "prompt_number": 37
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.17,Page no:174"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine current in wheatstone bridge\n",
- "\n",
- "print\"3I1-I2-1=0 (1)\" #KVL equation\n",
- "print\"3I1-I2+2I=2 (2)\" #KVL equation\n",
- "print\"3I1-I1+2I=2 (3)\" #KVL equation\n",
- "\n",
- "#Variable declaration\n",
- "I1=4/17.0 #from (1)(2)(3)through AB \n",
- "I2=-2/17.0 #from (1)(2)(3)through BD\n",
- "I=3*I1+I2 #from (1)(2)(3)through main circuit\n",
- "\n",
- "#Calculation\n",
- "Ibc=I1-I2 #calculating current in BC\n",
- "Iad=I-I1 #calculating current in AD\n",
- "Idc=I-I1+I2 #calculating current in DC\n",
- "\n",
- "#Result\n",
- "print\"Current in branch BC = \",Ibc,\"Ampere\"\n",
- "print\"NOTE:Calculation mistake in book while calculating for BC\"\n",
- "print\"Current in branch AD = \",Iad,\"Ampere\"\n",
- "print\"Current in branch DC = \",Idc,\"Ampere\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "3I1-I2-1=0 (1)\n",
- "3I1-I2+2I=2 (2)\n",
- "3I1-I1+2I=2 (3)\n",
- "Current in branch BC = 0.352941176471 Ampere\n",
- "NOTE:Calculation mistake in book while calculating for BC\n",
- "Current in branch AD = 0.352941176471 Ampere\n",
- "Current in branch DC = 0.235294117647 Ampere\n"
- ]
- }
- ],
- "prompt_number": 77
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.18,Page no:176"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Current through a galvanometer in wheatstone bridge\n",
- "\n",
- "#Variable declaration \n",
- "P=10 #Ohm\n",
- "Q=3 #Ohm\n",
- "R=12 #Ohm\n",
- "S=6 #Ohm\n",
- "G=20 #Ohm\n",
- "\n",
- "\n",
- "#Calculation\n",
- "print\"-12I+22I1+IgG=0 (1)\" #KVL\n",
- "print\"6I-9I1+29Ig=0 (2)\" #KVL\n",
- "print\"13I1-3Ig=2 (3)\" #KVL\n",
- "#From above equations\n",
- "import numpy as np\n",
- "a = np.array([[-12,22,20],[6,-9,29],[0,13,-3]]) \n",
- "b = np.array([[0],[0],[2]])\n",
- "np.linalg.solve(a,b)\n",
- "\n",
- "\n",
- "#Result\n",
- "print\"Current through Galvanometer = \",round(Ig*1000,2),\"mA\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "-12I+22I1+IgG=0 (1)\n",
- "6I-9I1+29Ig=0 (2)\n",
- "13I1-3Ig=2 (3)\n",
- "Current through Galvanometer = 7.8 mA\n"
- ]
- }
- ],
- "prompt_number": 78
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.19,Page no:179"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#% drop in heat in bulb\n",
- "\n",
- "#Variable declaration \n",
- "P=500 #power in Watts\n",
- "V=200 #voltage in Volts\n",
- "V1=160 #voltage in Volts\n",
- "\n",
- "#Calculation\n",
- "R=(V**2)/P #using P=V**2*R\n",
- "P1=(V1**2)/R #calculating power\n",
- "Dp=500-P1 #drop in heat\n",
- "D=(Dp*100)/500 #percentage drop\n",
- "\n",
- "#Result\n",
- "print\"Resistance= \",R,\"Ohm\"\n",
- "print\"% Drop in heat production = \",D,\"%\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Resistance= 80 Ohm\n",
- "% Drop in heat production = 36 %\n"
- ]
- }
- ],
- "prompt_number": 79
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.20,Page no:180"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Bulbs connected in parallel\n",
- "\n",
- "#Variable declaration\n",
- "P1=100 #power in Watts\n",
- "P2=500 #power in Watts\n",
- "\n",
- "#Calculation\n",
- "P=P2/P1 #ratio\n",
- "\n",
- "#Result\n",
- "print \"P=\",P\n",
- "print\"P>0,I2=5I Therefore I2>I1\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "P= 5\n",
- "P>0,I2=5I Therefore I2>I1\n"
- ]
- }
- ],
- "prompt_number": 80
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.21,Page no:181"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Heat and light energy produced by bulb on voltage drop\n",
- "\n",
- "#Variable declaration \n",
- "t=1200 #time in second\n",
- "P=100 #power in Watts\n",
- "V=230 #voltage in Volts\n",
- "\n",
- "#Calculation\n",
- "R=(V**2)/P #calculating resistance\n",
- "V1=115 #supply voltage in Volts\n",
- "E=((V1**2)*t)/R #calculating energy\n",
- "\n",
- "#Result\n",
- "print\"Energy dissipated by bulb = \",E,\"J\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Energy dissipated by bulb = 30000 J\n"
- ]
- }
- ],
- "prompt_number": 81
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.22,Page no:181"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate effeciency of transmission\n",
- "\n",
- "#Variable declaration\n",
- "P=10**4 #power in Watts\n",
- "V=250 #voltage in Volts\n",
- "R=0.2 #resistance in ohm\n",
- "\n",
- "#Calculation\n",
- "Pl=((P/V)*(P/V))*R #calculating power loss\n",
- "print P1\n",
- "E=P/(Pl+P) #calculating efficiency\n",
- "\n",
- "#Result\n",
- "print\"Percent Efficiency = \",round(E*100),\"%\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "100\n",
- "Percent Efficiency = 97.0 %\n"
- ]
- }
- ],
- "prompt_number": 56
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.23,Page no:182"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Resistance and current capacity of a lamp\n",
- "\n",
- "#Variable declaration \n",
- "P=100.0 #power in Watts\n",
- "V=220.0 #voltage in Volts\n",
- "\n",
- "#Calculation\n",
- "I=P/V #Current in Ampere\n",
- "R=V/I #resistance\n",
- "\n",
- "#Result\n",
- "print\"Current = \",round(I,3),\"A\" \n",
- "print\"Resistance=\",R,\"Ohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Current = 0.455 A\n",
- "Resistance= 484.0 Ohm\n"
- ]
- }
- ],
- "prompt_number": 59
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example no:5.24,Page no:182"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Resistance of windings of electric motor\n",
- "\n",
- "#Variable declaration \n",
- "V=50 #voltage in Volts\n",
- "I=12 #Current in Ampere\n",
- "\n",
- "#Calculation\n",
- "P=V*I #power\n",
- "Pd=P*0.7 #power dissipated\n",
- "R=(Pd/(I)**2) \n",
- "\n",
- "#Result\n",
- "print\"Resistance = \",round(R,2),\"Ohm\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Resistance = 2.92 Ohm\n"
- ]
- }
- ],
- "prompt_number": 82
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:1f51544adf15fc8ba28e47ac7da1a371a1d8835331773ecfcfa211468f9b325d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "UNIT-5 Electricity"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.1,Page no:152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "n=10**6 #no. of electrons\n",
+ "e=1.6*10**-19 #charge on an electron in C\n",
+ "\n",
+ "#Calculation\n",
+ "q=n*e #calculating total charge\n",
+ "t=10**-3 #time in second\n",
+ "I=q/t #calculating current\n",
+ "\n",
+ "#Result\n",
+ "print\"Current flowing = \",I,\"Ampere\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Current flowing = 1.6e-10 Ampere\n"
+ ]
+ }
+ ],
+ "prompt_number": 71
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.2,Page no:152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "I=300*10**-3 #current n Ampere\n",
+ "t=60 #time in second\n",
+ "e=1.6*10**-19 #chatge on electron in C\n",
+ "\n",
+ "#Calculation\n",
+ "q=I*t #calculating charge\n",
+ "n=q/e #calculating no of electrons\n",
+ "\n",
+ "#Result\n",
+ "print\"No. of electrons = \",n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "No. of electrons = 1.125e+20\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.3,Page no:154"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "V=200 #voltage in volt\n",
+ "R=100 #resistance in Ohm\n",
+ "e=1.6*10**-19 #charge on an electron in C\n",
+ "\n",
+ "#Calculation\n",
+ "I=V/R #Ohm's law\n",
+ "t=1 #time in second\n",
+ "q=I*t #calculating charge\n",
+ "n=q/e #calculating no of electrons\n",
+ "\n",
+ "#Result\n",
+ "print\"No. of electrons = \",n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "No. of electrons = 1.25e+19\n"
+ ]
+ }
+ ],
+ "prompt_number": 72
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.4,Page no:156"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "l=15 #length in m\n",
+ "A=6*10**-7 #area in m square\n",
+ "R=5 #resistance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "p=(A*R)/l #calculating resistivity\n",
+ "\n",
+ "#Result\n",
+ "print\"Resistivity= \",p,\"Ohm metre\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resistivity= 2e-07 Ohm metre\n"
+ ]
+ }
+ ],
+ "prompt_number": 73
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.5,Page no:157"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "l=0.1 #length in m\n",
+ "A=10**-4 #area in m square\n",
+ "R=0.01 #resistance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "p=(A*R)/l #calculating resistivity\n",
+ "\n",
+ "#Result\n",
+ "print\"Resistivity = \",p,\"Ohm metre\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resistivity = 1e-05 Ohm metre\n"
+ ]
+ }
+ ],
+ "prompt_number": 74
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.6,Page no:157"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "L=1 #length in m\n",
+ "r=0.2*10**-3 #radius in m\n",
+ "R=2 #resistance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "A=math.pi*(r)**2 #calculating area\n",
+ "P=(R*A)/L #calculating resistivity\n",
+ "\n",
+ "#Result\n",
+ "print\"Resistivity =%.2g\"%P,\"Ohm.metre\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resistivity =2.5e-07 Ohm.metre\n"
+ ]
+ }
+ ],
+ "prompt_number": 38
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.7,Page no:158"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "R1=5 #resisitance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "#A2=A/3\n",
+ "#R2/5=3l*3/A*A/l\n",
+ "#R2=9*5\n",
+ "\n",
+ "R2=9*R1 #calculating using R2/A1=(l2/A2)*(A1/l1)\n",
+ "print\"Resisitance = \",R2,\"Ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resisitance = 45 Ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 75
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.8,Page no:159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "R1=5 #resisitance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "#A2=A/2\n",
+ "#R1=rho*l1/A1*R2\n",
+ "#R2=rho*l2/A2\n",
+ "#R2/R1=A1/l1\n",
+ "R2=4*R1 #calculating using R2/A1=(l2/A2)*(A1/l1)\n",
+ "\n",
+ "#Result\n",
+ "print\"Resisitance= \",R2,\"Ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resisitance= 20 Ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 70
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.9,Page no:162"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "R1=2 #resisitance in Ohm\n",
+ "R2=4 #resistance in Ohm\n",
+ "R3=5 #resistance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "R=(R1**-1)+(R2**-1)+(R3**-1) #calculating parallel resistance\n",
+ "Rp=(1/R) \n",
+ "\n",
+ "#Result\n",
+ "print\"Resisitance = \",Rp,\"Ohm\"\n",
+ "print\"\\nNOTE:Incorrect answer in book\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resisitance = 1.05263157895 Ohm\n",
+ "\n",
+ "NOTE:Incorrect answer in book\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.10,Page no:163"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from scipy.optimize import fsolve \n",
+ "\n",
+ "#Variable declaration\n",
+ "Rs=40 #resisitance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "#R1+R2=40\n",
+ "#R1*R2=256\n",
+ "#R1=256/R2\n",
+ "#Putting this value in eq 1:\n",
+ "#(256/R2)+R2=40\n",
+ "from sympy import solve, symbols, pprint\n",
+ "R2= symbols('R2')\n",
+ "a=1\n",
+ "b=-40\n",
+ "c=256\n",
+ "f = a*R2**2 + b*R2 + c\n",
+ "solution = solve(f, R2)\n",
+ "\n",
+ "#Result\n",
+ "print\"When R2=\",solution[0],\"Ohm R1=\",solution[1],\"Ohm\"\n",
+ "print\"When R2=\",solution[1],\"Ohm R1=\",solution[0],\"Ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "When R2= 8 Ohm R1= 32 Ohm\n",
+ "When R2= 32 Ohm R1= 8 Ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.11,Page no:164"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "V=2.0 #in volts\n",
+ "R1=30.0 #resisitance in Ohm\n",
+ "R2=60.0 #resistance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "Rp=(R1*R2)/(R1+R2) #calculating parallel resistance\n",
+ "I=V/Rp #Ohm's law\n",
+ "\n",
+ "#Result\n",
+ "print\"Resisitance = \",Rp,\"Ohm\"\n",
+ "print\"Current = \",I,\"A\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resisitance = 20.0 Ohm\n",
+ "Current = 0.1 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.12,Page no:165"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "R1=2.0 #resisitance in Ohm\n",
+ "R2=3.0 #resistance in Ohm\n",
+ "R3=1.0 #resistance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "Rp=(R1*R2)/(R1+R2) #calculating parallel resistance\n",
+ "R=Rp+1.0 #1 Ohm in series\n",
+ "Rs=(R1+R2+R3) #series resistances\n",
+ "Rp=(1.0/R1)+(1.0/R2)+(1.0/R3) #calculating parallel resistance\n",
+ "\n",
+ "#Result\n",
+ "print\"(1)Equivalent Resisitance= \",R,\"Ohm\" \n",
+ "print\"(2)All resistances in series = \",Rs,\"Ohm\"\n",
+ "print\"(3)All in Parallel = \",(1/Rp),\"Ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(1)Equivalent Resisitance= 2.2 Ohm\n",
+ "(2)All resistances in series = 6.0 Ohm\n",
+ "(3)All in Parallel = 0.545454545455 Ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 76
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.13,Page no:166"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "V=20 #voltage in Volts\n",
+ "R1=2.0 #resisitance in Ohm\n",
+ "R2=4.0 #resistance in Ohm\n",
+ "R3=5.0 #resistance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "Rp=(1/R1)+(1/R2)+(1/R3) #calculating parallel resistance\n",
+ "R=1/Rp #Parallel\n",
+ "I1=V/R1 #calculating current through R1\n",
+ "I2=V/R2 #calculating current through R2\n",
+ "I3=V/R3 #calculating current through R3\n",
+ "I=V/R #calculating total current\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print\"(a)Equivalent Resisitance = \",R,\"Ohm\"\n",
+ "print\"Current through R1 = \",I1,\"Ampere\"\n",
+ "print\"Current through R2 = \",I2,\"Ampere\" \n",
+ "print\"Total current = \",I,\"Ampere\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Equivalent Resisitance = 1.05263157895 Ohm\n",
+ "Current through R1 = 10.0 Ampere\n",
+ "Current through R2 = 5.0 Ampere\n",
+ "Total current = 19.0 Ampere\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.14,Page no:166"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "R=7 #Total resistanc of combination\n",
+ "\n",
+ "#Calculation\n",
+ "def f(n):\n",
+ " Rp = 6*(1/n) #resistance in parallel\n",
+ " return(R-Rp-5)\n",
+ "n=fsolve(f,1)\n",
+ "\n",
+ "#Result\n",
+ "print\"n=\",n[0]"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "n= 3.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.15,Page no:173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "R1=2 #resistance in Ohm\n",
+ "R2=6 #resistance in Ohm\n",
+ "R3=3 #resistance in Ohm\n",
+ "V=24 #voltage in volts\n",
+ "R=8 #resistance in Ohm\n",
+ "\n",
+ "#Calculation\n",
+ "I=V/R #Ohm's Law\n",
+ "V1=I*R1 #Ohm's Law\n",
+ "V2=I*R2 #Ohm's Law\n",
+ "V3=I*R3 #Ohm's Law\n",
+ "\n",
+ "#Result\n",
+ "print\"Current = \",I,\"Ampere\" \n",
+ "print\"Voltage drop across R1 = \",V1,\"Volts\"\n",
+ "print\"Voltage drop across R2 = \",V2,\"Volts\" \n",
+ "print\"Voltage drop across R3 = \",V3,\"Volts\"\n",
+ "print\"\\nNOTE:Wrong answer of R3 in book\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Current = 3 Ampere\n",
+ "Voltage drop across R1 = 6 Volts\n",
+ "Voltage drop across R2 = 18 Volts\n",
+ "Voltage drop across R3 = 9 Volts\n",
+ "\n",
+ "NOTE:Wrong answer of R3 in book\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.16,Page no:173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "R=15 #resistance in Ohm\n",
+ "print\"KVL: 16I1+15I2=6 (1)\" #KVL equation\n",
+ "I1=-1.66 #from(1)\n",
+ "I2=2.17 #from (1)\n",
+ "#Calculation\n",
+ "V=(I1+I2)*R #calculating potential difference\n",
+ "\n",
+ "#Result\n",
+ "print\"Potential difference= \",V,\"Volt\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "KVL: 16I1+15I2=6 (1)\n",
+ "Potential difference= 7.65 Volt\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.17,Page no:174"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "print\"3I1-I2-1=0 (1)\" #KVL equation\n",
+ "print\"3I1-I2+2I=2 (2)\" #KVL equation\n",
+ "print\"3I1-I1+2I=2 (3)\" #KVL equation\n",
+ "\n",
+ "#Variable declaration\n",
+ "I1=4/17.0 #from (1)(2)(3)through AB \n",
+ "I2=-2/17.0 #from (1)(2)(3)through BD\n",
+ "I=3*I1+I2 #from (1)(2)(3)through main circuit\n",
+ "\n",
+ "#Calculation\n",
+ "Ibc=I1-I2 #calculating current in BC\n",
+ "Iad=I-I1 #calculating current in AD\n",
+ "Idc=I-I1+I2 #calculating current in DC\n",
+ "\n",
+ "#Result\n",
+ "print\"Current in branch BC = \",Ibc,\"Ampere\"\n",
+ "print\"NOTE:Calculation mistake in book while calculating for BC\"\n",
+ "print\"Current in branch AD = \",Iad,\"Ampere\"\n",
+ "print\"Current in branch DC = \",Idc,\"Ampere\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3I1-I2-1=0 (1)\n",
+ "3I1-I2+2I=2 (2)\n",
+ "3I1-I1+2I=2 (3)\n",
+ "Current in branch BC = 0.352941176471 Ampere\n",
+ "NOTE:Calculation mistake in book while calculating for BC\n",
+ "Current in branch AD = 0.352941176471 Ampere\n",
+ "Current in branch DC = 0.235294117647 Ampere\n"
+ ]
+ }
+ ],
+ "prompt_number": 77
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.18,Page no:176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "P=10 #Ohm\n",
+ "Q=3 #Ohm\n",
+ "R=12 #Ohm\n",
+ "S=6 #Ohm\n",
+ "G=20 #Ohm\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "print\"-12I+22I1+IgG=0 (1)\" #KVL\n",
+ "print\"6I-9I1+29Ig=0 (2)\" #KVL\n",
+ "print\"13I1-3Ig=2 (3)\" #KVL\n",
+ "#From above equations\n",
+ "import numpy as np\n",
+ "a = np.array([[-12,22,20],[6,-9,29],[0,13,-3]]) \n",
+ "b = np.array([[0],[0],[2]])\n",
+ "np.linalg.solve(a,b)\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print\"Current through Galvanometer = \",round(Ig*1000,2),\"mA\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-12I+22I1+IgG=0 (1)\n",
+ "6I-9I1+29Ig=0 (2)\n",
+ "13I1-3Ig=2 (3)\n",
+ "Current through Galvanometer = 7.8 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 78
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.19,Page no:179"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "P=500 #power in Watts\n",
+ "V=200 #voltage in Volts\n",
+ "V1=160 #voltage in Volts\n",
+ "\n",
+ "#Calculation\n",
+ "R=(V**2)/P #using P=V**2*R\n",
+ "P1=(V1**2)/R #calculating power\n",
+ "Dp=500-P1 #drop in heat\n",
+ "D=(Dp*100)/500 #percentage drop\n",
+ "\n",
+ "#Result\n",
+ "print\"Resistance= \",R,\"Ohm\"\n",
+ "print\"% Drop in heat production = \",D,\"%\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resistance= 80 Ohm\n",
+ "% Drop in heat production = 36 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 79
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.20,Page no:180"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "P1=100 #power in Watts\n",
+ "P2=500 #power in Watts\n",
+ "\n",
+ "#Calculation\n",
+ "P=P2/P1 #ratio\n",
+ "\n",
+ "#Result\n",
+ "print \"P=\",P\n",
+ "print\"P>0,I2=5I Therefore I2>I1\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "P= 5\n",
+ "P>0,I2=5I Therefore I2>I1\n"
+ ]
+ }
+ ],
+ "prompt_number": 80
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.21,Page no:181"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "t=1200 #time in second\n",
+ "P=100 #power in Watts\n",
+ "V=230 #voltage in Volts\n",
+ "\n",
+ "#Calculation\n",
+ "R=(V**2)/P #calculating resistance\n",
+ "V1=115 #supply voltage in Volts\n",
+ "E=((V1**2)*t)/R #calculating energy\n",
+ "\n",
+ "#Result\n",
+ "print\"Energy dissipated by bulb = \",E,\"J\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Energy dissipated by bulb = 30000 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 81
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.22,Page no:181"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "P=10**4 #power in Watts\n",
+ "V=250 #voltage in Volts\n",
+ "R=0.2 #resistance in ohm\n",
+ "\n",
+ "#Calculation\n",
+ "Pl=((P/V)*(P/V))*R #calculating power loss\n",
+ "print P1\n",
+ "E=P/(Pl+P) #calculating efficiency\n",
+ "\n",
+ "#Result\n",
+ "print\"Percent Efficiency = \",round(E*100),\"%\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "100\n",
+ "Percent Efficiency = 97.0 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.23,Page no:182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration \n",
+ "P=100.0 #power in Watts\n",
+ "V=220.0 #voltage in Volts\n",
+ "\n",
+ "#Calculation\n",
+ "I=P/V #Current in Ampere\n",
+ "R=V/I #resistance\n",
+ "\n",
+ "#Result\n",
+ "print\"Current = \",round(I,3),\"A\" \n",
+ "print\"Resistance=\",R,\"Ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Current = 0.455 A\n",
+ "Resistance= 484.0 Ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 59
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example no:5.24,Page no:182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration \n",
+ "V=50 #voltage in Volts\n",
+ "I=12 #Current in Ampere\n",
+ "\n",
+ "#Calculation\n",
+ "P=V*I #power\n",
+ "Pd=P*0.7 #power dissipated\n",
+ "R=(Pd/(I)**2) \n",
+ "\n",
+ "#Result\n",
+ "print\"Resistance = \",round(R,2),\"Ohm\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Resistance = 2.92 Ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 82
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch1.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch1.ipynb
index e56a9323..a8b9ed76 100644
--- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch1.ipynb
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:c8eaf5948eadfe6d1b6a7dc0019961e94ca5ac36c2e0b4b3d3661a7c7823315b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#To find mans mass and weight on earth\n",
+ "\n",
"\n",
"# Variables\n",
"F = 300; \t\t\t #[N]\n",
@@ -70,7 +71,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find height of manometer fluid\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 1.15*10**5; \t\t\t#measured pressure[N/m**2]\n",
@@ -111,7 +112,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find height from ground and Kinetic Energy\n",
"\n",
"# Variables\n",
"PE = 1.5*10**3; \t#potential energy[J]\n",
@@ -155,7 +155,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the power developed in man\n",
"\n",
"# Variables\n",
"#Given\n",
@@ -197,7 +196,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the force exerted pressure work done and change in potential energy\n",
+ "\n",
"\n",
"\n",
"import math\n",
@@ -259,7 +258,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine work done by gas\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -300,7 +299,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find the work done on surrounding\n",
+ "\n",
"\n",
"# Variables\n",
"T = 300.; \t\t\t #temperature in K\n",
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch2.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch2.ipynb
index d5f58800..79f16566 100644
--- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch2.ipynb
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:284e048fb2debae82cffada454a9337b6feb1c0e5f0ea929952ef361ea0138a2"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find change in internal energy\n",
+ "\n",
"\n",
"# Variables\n",
"#Given\n",
@@ -67,7 +68,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find heat liberated work done and change in internal energy\n",
"\n",
"#Given\n",
"T = 298.; \t\t\t#temperature in K\n",
@@ -118,7 +118,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find the heat energy dissipated by brakes\n",
+ "\n",
"\n",
"# Variables\n",
"#Given\n",
@@ -162,7 +162,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find internal energy change during each step and work done during adiabatic process\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -217,7 +216,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find change in internal energy and enthalpy\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -266,7 +265,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find internal energy of saturated liquid and internal energy and enthalpy of saturated vapour\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -318,7 +316,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate molar internal energy change and molar enthalpy change\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -370,7 +367,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the theoretical horsepower developed\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -417,7 +414,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find temperature of water delivered to second storage tank\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -472,7 +468,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find change in enthalpy and maximum enthalpy change\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -519,7 +514,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine heat transfer rates\n",
+ "\n",
"\n",
"# Variables\n",
"#At inlet:\n",
@@ -570,7 +565,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find change in internal energy enthalpy heat supplied and work done\n",
"\n",
"#Given:\n",
"m = 10.; \t\t\t#mass of air in kg\n",
@@ -648,7 +642,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine change in internal energy and change in enthalpy\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch3.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch3.ipynb
index 4e689d3d..6803c96b 100644
--- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch3.ipynb
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:2261ff03ab51ed2922b0b6d063ddc383a313c6be373040c779faf21d1a2afd0b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find the molar volume of air\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -67,7 +68,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine heat and work effects for each step\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -142,7 +143,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate change in internal energy change in enthalpy work done and heat supplied\n",
+ "\n",
"\n",
"#Given:\n",
"R = 8.314; \t\t\t#ideal gas constant\n",
@@ -221,7 +222,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine work done and amount of heat transferred\n",
"\n",
"from scipy.integrate import quad\n",
"\n",
@@ -293,7 +293,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To compare the pressures\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -341,7 +341,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the volume\n",
+ "\n",
"\n",
"#To find Approx Value\n",
"def approx(V,n):\n",
@@ -405,7 +405,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate compressibility factor and molar volume\n",
+ "\n",
"\n",
"#To find Approx Value\n",
"def approx(V,n):\n",
@@ -500,7 +500,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate heat of formation of methane gas\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -541,7 +540,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate heat of formation of chloroform\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -583,7 +581,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate standard heat of reaction at 773 K\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -629,7 +627,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine heat added or removed\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -679,7 +677,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate theoretical flame temperature\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb
index 75c3c01e..e9d794c5 100644
--- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch4.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the maximum efficiency\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -66,7 +65,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine minimum amount of work done and heat given to surrounding\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -116,7 +114,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine efficiency of proposed engine\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -164,7 +161,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate entropy of evaporation\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -209,7 +205,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine change in entropy\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -251,7 +246,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the entropy change\n",
"\n",
"#Given:\n",
"T = 300.; \t\t\t#temperature in K\n",
@@ -293,7 +287,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine change in entropy\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -338,7 +331,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the change in entropy\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -387,7 +379,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the total entropy change\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -440,7 +431,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate entropy of 1 kmole of air\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -483,7 +473,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine change in entropy for the reaction\n",
"\n",
"# Variables\n",
"H = -2.8318*10**5; \t\t\t#heat of reaction (J/mol)\n",
@@ -535,7 +524,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate change in entropy and check whether the process is reversible\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -586,7 +574,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the change in entropy of system\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -659,7 +646,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate entropy change\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -720,7 +706,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate entropy change in the process\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -771,7 +756,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate loss in capacity of doing work\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -812,7 +796,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate total change in entropy and available work\n",
"\n",
"import math\n",
"#Given:\n",
@@ -875,7 +858,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the molar entropy of metal\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -917,7 +899,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the absolute entropy of water vapour\n",
"\n",
"# Variables\n",
"#Given:\n",
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch5.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch5.ipynb
index aa03f112..c3e360ec 100644
--- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch5.ipynb
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:8647345ba179ef2ea9d3fa7f02f9c39fe17f9932a98d0fe8ec5f061488b5ae2f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the pressure at exit\n",
"\n",
"import math\n",
"\n",
@@ -80,7 +80,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine quality of steam flowing through the pipe\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -126,7 +125,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the discharge velocity\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -169,7 +167,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine thermodynamic properties at throat and critical pressure\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -241,7 +238,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate work required and temperature after compression\n",
"\n",
"# Variables\n",
"P1 = 1.; \t\t\t#initial pressure (bar)\n",
@@ -286,7 +282,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate work required and temperature\n",
"\n",
"# Variables\n",
"P1 = 100.; \t\t\t#initial pressure of saturated steam (kPa)\n",
@@ -346,7 +341,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the least amount of power\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -388,7 +382,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine COP heat rejected and lowest temperature\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -439,7 +432,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine COP at given conditions\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -500,7 +492,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine power requirement and refrigeration capacity in tonnes\n",
+ "\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -553,7 +545,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the COP and refrigeration circulation rate\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -609,7 +600,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the COP and air circulation rate\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -664,7 +654,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To verify that given heat pump is equivalent to 30 kW pump\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -710,7 +699,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the amount of fuel burned\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -757,7 +745,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate fraction of liquid in inlet stream and temperature\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -820,7 +807,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine fraction of air liquified and temperature of air\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -871,7 +857,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine ideal Rankine cycle efficiency thermal efficiency and rate of steam production\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -945,7 +930,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the work output thermal efficiency and rate of steam circulation\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -1032,7 +1016,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine fraction of steam withdrawn and thermal efficiency of cycle\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -1102,7 +1085,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine mean effective pressure\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -1207,7 +1189,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine work done thermal effeciency and mean effective pressure\n",
"\n",
"# Variables\n",
"#Given:\n",
@@ -1307,7 +1288,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine temperature pressure work and thermal effeciency\n",
"\n",
"# Variables\n",
"#Given:\n",
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch6.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch6.ipynb
index 056e7127..2640be69 100644
--- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch6.ipynb
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:af5e98897fdd6a212dc067e1708c75ce618fcbb9ad24c85104d033a4702b884e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine change in entropy of system\n",
+ "\n",
"\n",
"#Given:\n",
"betta = 1.25*10**-3; \t\t\t#coeffecient of math.expansion (K**-1)\n",
@@ -75,7 +76,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate vapour pressure of water at 363 K\n",
"\n",
"import math\n",
"\n",
@@ -119,7 +119,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the melting point of mercury at 10 bar\n",
"\n",
"# Variables\n",
"d_l = 13.69*10**3; \t\t\t#density of mercury in liquid state (kg/m**3)\n",
@@ -164,7 +163,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate increase in entropy of solid magnesium\n",
"\n",
"# Variables\n",
"T1 = 300.; \t\t\t#initial temperature (K)\n",
@@ -205,7 +203,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate internal energy enthalpy entropy and freenergy for 1 mole of nitrogen\n",
"\n",
"# Variables\n",
"T = 773.; \t\t\t#temperature (K)\n",
@@ -278,7 +275,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate entropy change and mean heat capacity\n",
"\n",
"# Variables\n",
"#Equation of state: P(V-B) = RT + (A*P**2)/T\n",
@@ -349,7 +345,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate Cv for mercury\n",
"\n",
"# Variables\n",
"betta = 1.8*10**-4; \t\t\t#coeffecient of volume math.expansion (K**-1)\n",
@@ -391,7 +386,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To estimate the fugacity of ammonia\n",
"\n",
"# Variables\n",
"#Eqution of state: P(V-b) = RT\n",
@@ -434,7 +428,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the fugacity of gas\n",
"\n",
"# Variables\n",
"#intg(alphadP) = -556.61 J/mol\n",
@@ -475,7 +468,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the fugacity coeffeceint at given pressure\n",
"\n",
"# Variables\n",
"#Equation of state: PV = RT(1-0.00513P)\n",
@@ -516,7 +508,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the fugacity of pure ethylene\n",
"\n",
"# Variables\n",
"P = 100.; \t\t\t#pressure in bar\n",
@@ -562,7 +553,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine fugacity and fugacity coeffecient of steam\n",
"\n",
"# Variables\n",
"T = 623.; \t\t\t#temperature in K\n",
@@ -611,7 +601,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To estimate fugacity of ammonia\n",
"\n",
"# Variables\n",
"T = 473.; \t\t\t#temperature in K\n",
@@ -656,7 +645,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the fugacity of liquid water\n",
"\n",
"# Variables\n",
"T = 303.; \t\t\t#temperature in K\n",
@@ -702,7 +690,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the fugacity of n butane in liquid state at given conditions\n",
"\n",
"# Variables\n",
"T = 350.; \t\t\t#temperature in K\n",
@@ -748,7 +735,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the activity of solid magnesium\n",
"\n",
"# Variables\n",
"M = 24.32; \t\t\t#molecular wt of solid magnesium\n",
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch7.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch7.ipynb
index b0e53020..9c3402d5 100644
--- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch7.ipynb
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:a4d472eaa4dbf60f111758e6e0fce7c88354811184ce66088736c4ac7a13ff8b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find the volume of mixture\n",
"\n",
"# Variables\n",
"V = 0.1; \t\t\t#volume of mixture required (m**3)\n",
@@ -87,7 +87,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find the required volume of methanol and water\n",
"\n",
"# Variables\n",
"V = 2.; \t\t\t#volume of desired solution (m**3)\n",
@@ -139,7 +138,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the volume of water to be added and volume of dilute alcohol solution\n",
"\n",
"# Variables\n",
"V1_w = 0.816*10**-3; \t\t\t#partial molar volume of water in 96% alcohol solution\n",
@@ -205,7 +203,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine enthalpies of pure components and at infinite dilution\n",
"\n",
"# Variables\n",
"x1= .3\n",
@@ -266,7 +263,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the partial molar volume of the components\n",
"\n",
"def V(m):\n",
" y = 1.003*10**-3 + 0.1662*10**-4*m + 0.177*10**-5*m**1.5 + 0.12*10**-6*m**2\n",
@@ -316,7 +312,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To estimate the solubility of oxygen in water at 298K\n",
"\n",
"# Variables\n",
"K = 4.4*10**4; \t\t\t#Henry's law constant (bar)\n",
@@ -362,7 +357,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To confirm that mixture conforms to Raoults Law and to determine Henrys Law constant?\n",
"\n",
"%pylab inline\t\t\t\n",
" \n",
@@ -453,7 +447,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate activity and activity coeffecient of chloroform\n",
"\n",
"from numpy import array\n",
"\n",
@@ -539,7 +532,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine fugacity fugacity coeffecient Henrys Law constant and activity coeffecient\n",
"\n",
"# Variables\n",
"P = 20.; \t\t\t#pressure in bar\n",
@@ -600,7 +592,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine enthalpies at infinite dilution\n",
"\n",
"# Variables\n",
"H1_pure = 400.; \t\t\t#enthalpy of pure liquid 1 at 298 K and 1 bar (J/mol)\n",
@@ -648,7 +639,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine change in entropy for the contents of the vessel\n",
+ "\n",
"\n",
"# Variables\n",
"R = 8.314; \t\t\t#ideal gas constant\n",
@@ -695,7 +686,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine heat of formation of LiCl in 12 moles of water\n",
"\n",
"# Variables\n",
"Hf = -408.610; \t\t\t#heat of formation (kJ)\n",
@@ -741,7 +731,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the free energy of mixing\n",
"\n",
"# Variables\n",
"R = 8.314; \t\t\t#ideal gas constant\n",
@@ -796,7 +785,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the mean heat capacity of 20 mol percent solution\n",
"\n",
"# Variables\n",
"C_water = 4.18*10**3; \t\t\t#heat capacity of water (J/kg K)\n",
@@ -852,7 +840,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find the final temperature attained\n",
"\n",
"# Variables\n",
"To = 298.; \t\t\t#initial temperature (K)\n",
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch8.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch8.ipynb
index 405872e3..18de8e63 100644
--- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch8.ipynb
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:2a584685665e22931eee90916ad677c233c22b41ab4fa1c2aff95245e3dea9a5"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine composition of vapour and liquid in equilibrium\n",
"\n",
"# Variables\n",
"P1 = 106.; \t\t\t#vapour pressure of n-heptane (kPa)\n",
@@ -70,7 +70,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine pressure at the beginning and at the end of the process\n",
"\n",
"# Variables\n",
"P1 = 135.4; \t\t\t#vapour pressure of benzene (kPa)\n",
@@ -116,7 +115,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine temperature pressure and compositions\n",
"\n",
"import math\n",
"def P1(T):\n",
@@ -262,7 +260,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To construct boiling point and equilibrium point diagram\n",
"\n",
"%pylab inline\n",
"\n",
@@ -346,7 +343,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate van Laar constants\n",
"\n",
"# Variables\n",
"x1 = 46.1/100; \t\t\t#mole percent of A\n",
@@ -399,7 +395,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate activity coeffecients in a solution containing 10 percent alcohol\n",
"\n",
"# Variables\n",
"x2 = 0.448; \t\t\t#mole fraction of ethanol\n",
@@ -460,7 +455,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate equilibrium vapour composition for solution containing 20 mole percent hydrazine\n",
"\n",
"# Variables\n",
"x2 = 0.585; \t\t\t#mol fraction of hydrazine\n",
@@ -527,7 +521,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the total pressure\n",
"\n",
"#Given:\n",
"x1 = 0.047; \t\t\t#mol fraction of isopropanol\n",
@@ -583,7 +576,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To construct the Pxy diagram\n",
"\n",
"# Variables\n",
"P1 = 24.62; \t\t\t#vapour pressure of cyclohexane (kPa)\n",
@@ -642,7 +634,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the composition and total pressure of azeotrope\n",
"\n",
"# Variables\n",
"P = 40.25; \t\t\t#total pressure (kPa)\n",
@@ -713,7 +704,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate equilibrium pressure and composition\n",
"\n",
"# Variables\n",
"a12 = 1225.31; \t\t\t#(J/mol)\n",
@@ -831,7 +821,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine parameters in Wilsons equation\n",
"\n",
"# Variables\n",
"P = 101.3; \t\t\t#total pressure of system (kPa)\n",
@@ -1021,7 +1010,7 @@
"collapsed": false,
"input": [
"#Given:\n",
- "#All Ki values are obtained from Fig. 13.6 0f Chemical Engineer's Handbook, 5th ed.\n",
+ "\n",
"P = 1447.14; \t\t\t#pressure of the system (kPa)\n",
"x = [0.25 ,0.4, 0.35]; \t\t\t#composition of the components\n",
"T = [355.4 ,366.5]; \t\t\t#assumed temperatures (K)\n",
@@ -1030,10 +1019,7 @@
"\n",
"\n",
"# Calculation and Result\n",
- "#To calculate bubble and dew point temperatures\n",
- "#(a). The bubble point temperature and composition of the vapour\n",
"\n",
- "#At bubble point temperature, sum(K*x) = 1\n",
"Kx = [0, 0];\n",
"for i in range(3):\n",
" Kx[0] = Kx[0]+K1[i]*x[i];\n",
@@ -1157,7 +1143,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To test whetherthe given data are thermodynamically consistent or not\n",
"\n",
"from numpy import array\n",
"\n",
@@ -1227,7 +1212,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To estimate the constants in Margules equation\n",
"\n",
"# Variables\n",
"x1 = [0.0331, 0.9652]; \t\t\t#composition of chloroform\n",
@@ -1280,7 +1264,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the partial pressure of water in vapour phase\n",
"\n",
"# Variables\n",
"x1 = [0., 0.033, 0.117, 0.318, 0.554, 0.736, 1.000]; \t\t\t#liquid composition of acetone\n",
@@ -1348,7 +1331,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# to calculate under three phase equilibrium\n",
"\n",
"# Variables\n",
"P = 93.30; \t\t\t#total pressure in kPa\n",
@@ -1407,7 +1389,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To prepare temperature composition diagram\n",
"\n",
"# Variables\n",
"T = [323 ,333, 343, 348, 353, 363, 373]; \t\t\t#temperatures (K)\n",
diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch9.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch9.ipynb
index a4ef1c21..b00a214c 100644
--- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch9.ipynb
+++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:70e5d31cbd675202c3287b597ce34b28fa488bc5446177836cd0448444371ac9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate equilibrium constant\n",
"\n",
"import math\n",
"#Given:\n",
@@ -74,7 +74,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate equilibrium constant at 500 K\n",
"\n",
"# Variables\n",
"T1 = 298.; \t\t\t#temperature in K\n",
@@ -124,7 +123,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To alculate standard free energy change and heat of formation\n",
"\n",
"# Variablesa\n",
"R = 8.314; \t\t\t#ideal gas constant\n",
@@ -181,7 +179,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To estimate free energy change and equilibrium constant at 700 K\n",
"\n",
"# Variables\n",
"To = 298.; \t\t\t#temperature in K\n",
@@ -239,7 +236,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# to calculate equilibrium constant at 600 K\n",
+ "\n",
"\n",
"# Variables\n",
"T = 600.; \t\t\t#temperature in K\n",
@@ -291,7 +288,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate equilibrium constant at 500K\n",
"\n",
"# Variables\n",
"T = 500.; \t\t\t#temperature in K\n",
@@ -349,7 +345,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To find the value of n\n",
"\n",
"# Variables\n",
"P1 = 1.; \t\t\t#pressure (bar)\n",
@@ -391,7 +386,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the percent conversion\n",
"\n",
"from scipy.optimize import root\n",
"\n",
@@ -445,7 +439,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate fractional dissociation of steam\n",
"\n",
"# Variables\n",
"K = 1; \t\t\t#equilibrium constant for reaction\n",
@@ -454,14 +447,6 @@
"e = 1./2;\n",
"print '(a) Fractional dissociation of steam is %i percent'%(e*100)\n",
"\n",
- "#(b). If reactant stream is diluted with 2 mol nitrogen\n",
- "#Mole fraction of components\n",
- "#CO: (1-e)/4\n",
- "#H20: (1-e)/4\n",
- "#CO2: e/4\n",
- "#H2: e/4\n",
- "\n",
- "#so% K = (e/4)(e/4)/[(1-e)/4][(1-e)/4]\n",
"#On solving we get\n",
"e = 1./2;\n",
"print ' (b) After dilution fractional distillation of steam is %i percent'%(e*100)\n",
@@ -494,7 +479,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine conversion of nitrogen affected by argon\n",
"\n",
"from scipy.optimize import root\n",
"\n",
@@ -502,17 +486,8 @@
"K = 2.*10**-4; \t\t\t#equilibrium constant of reaction\n",
"P = 20.; \t\t\t#pressure in bar\n",
"\n",
- "#To determine conversion of nitrogen affected by argon\n",
- "\n",
- "#Mole fraction of components\n",
- "#Nitrogen: (1-e)/(6-2e)\n",
- "#Hydrogen: 3(1-e)/(6-2e)\n",
- "#Ammonia: 2e/(6-2e)\n",
"\n",
- "#[2e/(6-2e)]**2/[(1-e)/(6-2e)][3(1-e)/(6-2e)]**3 = K*P**2\n",
- "#e(3-e)/(1-e)**2 = 0.3674\n",
"\n",
- "# Calculations\n",
"def f(e):\n",
" return 1.3674*e**2 - 3.7348*e + 0.3674;\n",
"x = root(f,0)\n",
@@ -549,26 +524,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the fractional dissociation of steam\n",
"\n",
"# Variables\n",
"P = 1.; \t\t\t#pressure in bar\n",
"K = 1.; \t\t\t#equilibrium constant of reaction\n",
"\n",
- "# Calculations and Results\n",
- "#To calculate the fractional dissociation of steam\n",
- "#Basis: 1 mole water vapour present in reactant stream\n",
- "#Let e be the extent of reaction\n",
- "\n",
- "#(a). CO supplied is 100% in excess of the stoichiometric requirement\n",
- "#Mole fraction of components:\n",
- "#CO: (2-e)/3\n",
- "#H20: (1-e)/3\n",
- "#CO2: e/3\n",
- "#H2: e/3\n",
+ "e)(2-e)] = K = 1% so\n",
"\n",
- "#e**2/{(1-e)(2-e)] = K = 1% so\n",
- "#3e-2 = 0;\n",
"e = 2./3;\n",
"print '(a). The conversion of steam is %f percent'%(e*100)\n",
"\n",
@@ -612,7 +574,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the fractional distillation of steam\n",
"\n",
"# Variables\n",
"K = 1.; \t\t\t#equilibrium constant of reaction\n",
@@ -650,7 +611,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To evaluate the percent conversion of CO\n",
"\n",
"# Variables\n",
"#Reaction: CO(g) + 2H2(g) --> CH3OH(g)\n",
@@ -705,7 +665,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the composition of gases leaving the reactor\n",
"\n",
"# Variables\n",
"#Reaction: 1/2N2 + 3/2H2 --> NH3\n",
@@ -719,11 +678,7 @@
"n_inert = 100-n_h-n_n;\n",
"\n",
"# Calculations\n",
- "#To determine the composition of gases leaving the reactor\n",
- "#Mole fractions in the equilibrium mixture\n",
- "#N2: [20-(e/2)]/(100-e)\n",
- "#H2: [60-(3e/2)]/(100-e)\n",
- "#NH3: e/(100-e)\n",
+ "\n",
"Ky = Kp*(P**-v)\n",
"#e/(100-e)/[(20-(e/2)]**1/2[{60-(3e/2)}/(100-e)]**3/2 = Ky\n",
"#e = poly(0%'e'\n",
@@ -776,7 +731,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To evaluate the equilibrium constant\n",
"\n",
"# Variables\n",
"P = 85.; \t\t\t#pressure in bar\n",
@@ -828,7 +782,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the decomposition pressure and temperature at 1 bar\n",
"\n",
"# Variables\n",
"T = 1000.; \t\t\t#temperature of reaction in K\n",
@@ -842,8 +795,6 @@
" return y\n",
"\n",
"# Calculations and Results\n",
- "#To calculate the decomposition pressure and temperaure at 1 bar\n",
- "Go = G(T)\n",
"K = math.e**(-Go/(R*T))\n",
"#Using eq. 9.75 (Page no. 432)\n",
"p_CO2 = K; \t\t\t#decomposition pressure\n",
@@ -892,7 +843,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To evaluate wt of iron produced per 100 cubic m of gas admitted\n",
"\n",
"# Variables\n",
"K = 0.403; \t\t\t#equilibrium constant of reaction\n",
@@ -949,7 +899,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To calculate the composition at equilibrium assuming ideal behaviour\n",
"\n",
"from scipy.optimize import fsolve\n",
"\n",
@@ -1032,33 +981,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To determine the number of degrees of freedom\n",
"\n",
"# Variables\n",
"#A system consisting of CO% CO2% H2% H2O% CH4\n",
"\n",
- "#To determine the number of degrees of freedom\n",
- "\n",
- "#Formation reactions for each of compounds is written\n",
- "#a. C + 1/2O2 --> CO\n",
- "#b. C + O2 --> CO2\n",
- "#c. H2 + 1/2O2 --> H2O\n",
- "#d. C + 2H2 --> CH4\n",
- "\n",
- "#Elements C and O2 are not present% so they are to be eliminated\n",
- "#Combining a and b\n",
- "#e. CO2 --> CO + 1/2O2\n",
- "\n",
- "#Combining a and d\n",
- "#f. CH4 + 1/2O2 --> CO + 2H2\n",
- "\n",
- "#Combining c and e\n",
- "#g. CO2 + H2 --> CO + H2O\n",
- "\n",
- "#Combining c and f\n",
- "#h. 3H2 + CO --> CH4 + H2O\n",
"\n",
- "#Equations g and h represent independent chemical reactions% so\n",
"r = 2.;\n",
"C = 5.; \t\t\t#no. of components\n",
"pi = 1.; \t\t\t#no. of phases\n",
diff --git a/Basic_Electronics_and_Linear_Circuits/ch1.ipynb b/Basic_Electronics_and_Linear_Circuits/ch1.ipynb
index d4853315..6ff156a7 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch1.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch1.ipynb
@@ -1,94 +1,85 @@
-{
- "metadata": {
- "name": "ch1"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter no. 1: Introduction To Electronics"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.1 Page no.8"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 1.1\n",
- "# a resistor has a coloue band sequence : \n",
- "#yellow,voilet,orange and gold.\n",
- "#find the Range in which its value lies so as to satisfy manufacturer's Tolerances\n",
- "\n",
- "#Given\n",
- "#Colour Band Sequence: YELLOW, VIOLET, ORANGE, GOLD \n",
- "A=4 #NUMERICAL CODE FOR BAND YELLOW\n",
- "B=7 #NUMERICAL CODE FOR BAND VIOLET\n",
- "C=3 #NUMERICAL CODE FOR BAND ORANGE\n",
- "D=5 #TOLERANCE VALUE FOR BAND GOLD i.e. 5%\n",
- "\n",
- "#Resistor Value Calculation\n",
- "R=(A*10+B)*10**C\n",
- "#Tolerance Value Calulation\n",
- "T=D*R/100;\n",
- "R1=R-T;\n",
- "R2=R+T;\n",
- "\n",
- "# Results\n",
- "print \"Therefore thr resistance should be within the range \", R1*10**(-3) ,\"kohm\",\"and\", R2*10**(-3),\"kohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 1.2 Page no.8"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 1.2\n",
- "#A resistoe has a colour band sequence : gray ,blue.gold and gold.\n",
- "#what is the Range in which its value must lie to satisfy manufacturer's Tolerances\n",
- "\n",
- "#Colour Band Sequence: GRAY, BLUE, GOLD, GOLD\n",
- "A=8 #NUMERICAL CODE FOR BAND GRAY\n",
- "B=6 #NUMERICAL CODE FOR BAND BLUE\n",
- "C=-1 #NUMERICAL CODE FOR BAND GOLD\n",
- "D=5 #TOLERANCE VALUE FOR BAND GOLD i.e. 5%\n",
- "#Resistor Value Calculation\n",
- "R=(A*10+B)*10**C\n",
- "#Tolerance Value Calulation\n",
- "T=D*R/100\n",
- "R1=R-T\n",
- "R2=R+T\n",
- "# Results \n",
- "print \"Range of Values of the Resistor is between \",R1,\"ohm\",\"and\",R2,\"ohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:d40864745b0958ff90d45e29ecc4874d2fd0d20b38ed09535ff46977537fd224"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter no. 1: Introduction To Electronics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.1 Page no.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "A=4 #NUMERICAL CODE FOR BAND YELLOW\n",
+ "B=7 #NUMERICAL CODE FOR BAND VIOLET\n",
+ "C=3 #NUMERICAL CODE FOR BAND ORANGE\n",
+ "D=5 #TOLERANCE VALUE FOR BAND GOLD i.e. 5%\n",
+ "\n",
+ "#Resistor Value Calculation\n",
+ "R=(A*10+B)*10**C\n",
+ "#Tolerance Value Calulation\n",
+ "T=D*R/100;\n",
+ "R1=R-T;\n",
+ "R2=R+T;\n",
+ "\n",
+ "# Results\n",
+ "print \"Therefore thr resistance should be within the range \", R1*10**(-3) ,\"kohm\",\"and\", R2*10**(-3),\"kohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 1.2 Page no.8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "A=8 #NUMERICAL CODE FOR BAND GRAY\n",
+ "B=6 #NUMERICAL CODE FOR BAND BLUE\n",
+ "C=-1 #NUMERICAL CODE FOR BAND GOLD\n",
+ "D=5 #TOLERANCE VALUE FOR BAND GOLD i.e. 5%\n",
+ "#Resistor Value Calculation\n",
+ "R=(A*10+B)*10**C\n",
+ "#Tolerance Value Calulation\n",
+ "T=D*R/100\n",
+ "R1=R-T\n",
+ "R2=R+T\n",
+ "# Results \n",
+ "print \"Range of Values of the Resistor is between \",R1,\"ohm\",\"and\",R2,\"ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch10.ipynb b/Basic_Electronics_and_Linear_Circuits/ch10.ipynb
index eed36852..1268374a 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch10.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch10.ipynb
@@ -1,141 +1,130 @@
-{
- "metadata": {
- "name": "Ch 10"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 10: Power Amplifiers"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 10.1 Page No.345"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 10.1\n",
- "#Program to Determine the Transformer Turns Ratio\n",
- "\n",
- "#Given Circuit Data\n",
- "RL=16 # Ohms, load resistance\n",
- "RLd=10000.0 # Ohms ,effective load resistance\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "N12=math.sqrt(RLd/RL) #N12=N1/N2\n",
- "\n",
- "# Result\n",
- "print \" The Transformer Turns Ratio is N1/N2\",N12,\":1\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Transformer Turns Ratio is N1/N2 25.0 :1\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 10.2 Page No.345"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 10.2\n",
- "# Determine the Effective Resistance seen\n",
- "# looking into the Primary\n",
- "\n",
- "#Given Circuit Data\n",
- "Rl=8.0 #Ohms, load resistance\n",
- "N12=15.0 #N12=N1/N2, transformer turns ratio\n",
- "\n",
- "#Calculation\n",
- "Rld=(N12)**2*Rl #effective resistance\n",
- "\n",
- "# Result\n",
- "print \" The Effective Resistance seen looking into the Primary, Rld = \",Rld/10**3,\"k ohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 10.3 Page No.353"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 10.3\n",
- "#(a)\n",
- "# Determine the Second, Third & Fourth Harmonic Distortions \n",
- "\n",
- "#Given Circuit Data\n",
- "#io=15*sin(600*t)+1.5*sin(1200*t)+1.2*sin(1800*t)+0.5*sin(2400*t)\n",
- "#current in components 1,2,3,4\n",
- "I1=15 #A\n",
- "I2=1.5 #A\n",
- "I3=1.2 #A\n",
- "I4=0.5 #A\n",
- "\n",
- "#Calculation\n",
- "D2=(I2/I1)*100 #percentage harmonic distribution of component 2\n",
- "D3=(I3/I1)*100 #percentage harmonic distribution of component 3\n",
- "D4=(I4/I1)*100 #percentage harmonic distribution of component 4\n",
- "\n",
- "#Result\n",
- "print \" The Second Harmonic Distortion is, D2 = percent .\",D2\n",
- "print \" The Third Harmonic Distortion is, D3 = percent .\",D3\n",
- "print \" The Fourth Harmonic Distortion is, D4 = percent .\",round(D4,2)\n",
- "\n",
- "#(b)\n",
- "import math\n",
- "P1=1 #say\n",
- "\n",
- "#Calculation\n",
- "D=math.sqrt(D2**2+D3**2+D4**2) #Distortion Factor\n",
- "P=(1+(D/100)**2)*P1\n",
- "Pi=((P-P1)/P1)*100\n",
- "\n",
- "#Result\n",
- "print \"The Percentage Increase in Power because of Distortion is, Pi (in percent)= \",round(Pi,2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:c0e331b614f072bb0c21b302f0e54b6a8366fa46ba53ae4810b072360f344e0d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 10: Power Amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.1 Page No.345"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "RL=16 # Ohms, load resistance\n",
+ "RLd=10000.0 # Ohms ,effective load resistance\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "N12=math.sqrt(RLd/RL) #N12=N1/N2\n",
+ "\n",
+ "# Result\n",
+ "print \" The Transformer Turns Ratio is N1/N2\",N12,\":1\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Transformer Turns Ratio is N1/N2 25.0 :1\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.2 Page No.345"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Given Circuit Data\n",
+ "Rl=8.0 #Ohms, load resistance\n",
+ "N12=15.0 #N12=N1/N2, transformer turns ratio\n",
+ "\n",
+ "#Calculation\n",
+ "Rld=(N12)**2*Rl #effective resistance\n",
+ "\n",
+ "# Result\n",
+ "print \" The Effective Resistance seen looking into the Primary, Rld = \",Rld/10**3,\"k ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.3 Page No.353"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "I1=15 #A\n",
+ "I2=1.5 #A\n",
+ "I3=1.2 #A\n",
+ "I4=0.5 #A\n",
+ "\n",
+ "#Calculation\n",
+ "D2=(I2/I1)*100 #percentage harmonic distribution of component 2\n",
+ "D3=(I3/I1)*100 #percentage harmonic distribution of component 3\n",
+ "D4=(I4/I1)*100 #percentage harmonic distribution of component 4\n",
+ "\n",
+ "#Result\n",
+ "print \" The Second Harmonic Distortion is, D2 = percent .\",D2\n",
+ "print \" The Third Harmonic Distortion is, D3 = percent .\",D3\n",
+ "print \" The Fourth Harmonic Distortion is, D4 = percent .\",round(D4,2)\n",
+ "\n",
+ "#(b)\n",
+ "import math\n",
+ "P1=1 #say\n",
+ "\n",
+ "#Calculation\n",
+ "D=math.sqrt(D2**2+D3**2+D4**2) #Distortion Factor\n",
+ "P=(1+(D/100)**2)*P1\n",
+ "Pi=((P-P1)/P1)*100\n",
+ "\n",
+ "#Result\n",
+ "print \"The Percentage Increase in Power because of Distortion is, Pi (in percent)= \",round(Pi,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch11.ipynb b/Basic_Electronics_and_Linear_Circuits/ch11.ipynb
index 5477acbd..dd06f959 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch11.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch11.ipynb
@@ -1,199 +1,188 @@
-{
- "metadata": {
- "name": "Ch 11"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 11: Tuned Voltage mplifiers"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 11.1 Page No.374"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 11.1\n",
- "# (a)\n",
- "#Calculate Resonant Frequency of the given Circuit\n",
- "\n",
- "#Given Circuit Data\n",
- "C=300*10**(-12) #F, capacitance\n",
- "L=220*10**(-6) #H, inductance\n",
- "R=20.0 #Ohms, resistance\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "fr=1/(2*math.pi*math.sqrt(L*C)) #resonant frequency\n",
- "#result\n",
- "print \" The Resonant Frequency, fr = \",round(fr/10**3,0),\"khz\"\n",
- "\n",
- "#(b) find The Impedance at Resonance\n",
- "#Calculation\n",
- "Rr=R\n",
- "#result\n",
- "print \" The Impedance at Resonance, Rr = \",Rr,\"ohm\"\n",
- "\n",
- "#(c) find The Current at Resonance\n",
- "V=10.0 #V, voltage\n",
- "#Calculation\n",
- "I=V/R\n",
- "#result\n",
- "print \" The Current at Resonance, I = \",I,\"A\"\n",
- "\n",
- "#(d)\n",
- "#Calculation\n",
- "fr=1/(2*math.pi*math.sqrt(L*C))\n",
- "I=V/R\n",
- "Xl=2*math.pi*fr*L #reactance of inductor\n",
- "Vl=I*Xl # Voltage across the Inductance\n",
- "Xc=1/(2*math.pi*fr*C) #reactance of capacitance\n",
- "Vc=I*Xc # Voltage across the Capacitance,\n",
- "Vr=I*R #Voltage across the Resistance\n",
- "\n",
- "#result\n",
- "print \" Voltage across the Inductance, Vl = \",round(Vl,0),\"V\"\n",
- "print \" Voltage across the Capacitance, Vc = \",round(Vc,0),\"V\"\n",
- "print \" Voltage across the Resistance, Vr = \",round(Vr,0),\"V\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Resonant Frequency, fr = 620.0 khz\n",
- " The Impedance at Resonance, Rr = 20.0 ohm\n",
- " The Current at Resonance, I = 0.5 A\n",
- " Voltage across the Inductance, Vl = 428.0 V\n",
- " Voltage across the Capacitance, Vc = 428.0 V\n",
- " Voltage across the Resistance, Vr = 10.0 V\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 11.2 Page No.378"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 11.2\n",
- "# Calculate fr, Il, Ic, Line Current & Impedance of\n",
- "#the Resonant Circuit at Resonance\n",
- "\n",
- "#Given Circuit Data\n",
- "C=100*10**(-12) #F\n",
- "L=100*10**(-6) #H\n",
- "R=10 #Ohms\n",
- "V=100 #V\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "fr=1/(2*math.pi*math.sqrt(L*C)) #Hz, resonant frequency\n",
- "Xl=2*math.pi*fr*L #ohm, inductive reactance\n",
- "Il=V/Xl #A, current in inductive branch\n",
- "Xc=1/(2*math.pi*fr*C) #ohm, capacitance reactance\n",
- "Ic=V/Xc #A, current in capacitive branch \n",
- "Zp=L/(R*C) #ohm , series impedance\n",
- "I=V/Zp #A, line current\n",
- "\n",
- "#Result\n",
- "print \"fr= \",round(fr/10**3,0),\"khz\"\n",
- "print \"Il= \",Il,\"A\"\n",
- "print \"Ic= \",Ic,\"A\"\n",
- "print \"Zp= \",Zp,\"ohm\"\n",
- "print \"I= \",I/10**(-3),\"mA\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "fr= 1592.0 khz\n",
- "Il= 0.1 A\n",
- "Ic= 0.1 A\n",
- "Zp= 100000.0 ohm\n",
- "I= 1.0 mA\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 11.3 Page no. 379"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 11.3\n",
- "# Calculate Impedance, Q and Bandwidth of the \n",
- "#Resonant Circuit \n",
- "\n",
- "#Given Circuit Data\n",
- "import math\n",
- "C=100*10**(-12) #F, capacitance\n",
- "L=150*10**(-6) #H, inductance\n",
- "R=15 #Ohms, resistance\n",
- "\n",
- "#Calculation\n",
- "fr=1/(2*math.pi*math.sqrt(L*C))\n",
- "Zp=L/(R*C)\n",
- "Q=2*math.pi*fr*L/R\n",
- "df=fr/Q #Bandwidth\n",
- "\n",
- "#The Result\n",
- "print \" Impedance, Zp= \",Zp/10**3,\"kohm\"\n",
- "print \" Quality Factor, Q= \",round(Q,1)\n",
- "print \" Bandwidth, df= \",round(df/10**3,2),\"khz\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Impedance, Zp= 100.0 kohm\n",
- " Quality Factor, Q= 81.6\n",
- " Bandwidth, df= 15.92 khz\n"
- ]
- }
- ],
- "prompt_number": 5
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:42316ce336a06a4afe76966dd3df12fd0f55e47e7182329e33e900184918fde7"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 11: Tuned Voltage mplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 11.1 Page No.374"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "C=300*10**(-12) #F, capacitance\n",
+ "L=220*10**(-6) #H, inductance\n",
+ "R=20.0 #Ohms, resistance\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "fr=1/(2*math.pi*math.sqrt(L*C)) #resonant frequency\n",
+ "#result\n",
+ "print \" The Resonant Frequency, fr = \",round(fr/10**3,0),\"khz\"\n",
+ "\n",
+ "#(b) find The Impedance at Resonance\n",
+ "#Calculation\n",
+ "Rr=R\n",
+ "#result\n",
+ "print \" The Impedance at Resonance, Rr = \",Rr,\"ohm\"\n",
+ "\n",
+ "#(c) find The Current at Resonance\n",
+ "V=10.0 #V, voltage\n",
+ "#Calculation\n",
+ "I=V/R\n",
+ "#result\n",
+ "print \" The Current at Resonance, I = \",I,\"A\"\n",
+ "\n",
+ "#(d)\n",
+ "#Calculation\n",
+ "fr=1/(2*math.pi*math.sqrt(L*C))\n",
+ "I=V/R\n",
+ "Xl=2*math.pi*fr*L #reactance of inductor\n",
+ "Vl=I*Xl # Voltage across the Inductance\n",
+ "Xc=1/(2*math.pi*fr*C) #reactance of capacitance\n",
+ "Vc=I*Xc # Voltage across the Capacitance,\n",
+ "Vr=I*R #Voltage across the Resistance\n",
+ "\n",
+ "#result\n",
+ "print \" Voltage across the Inductance, Vl = \",round(Vl,0),\"V\"\n",
+ "print \" Voltage across the Capacitance, Vc = \",round(Vc,0),\"V\"\n",
+ "print \" Voltage across the Resistance, Vr = \",round(Vr,0),\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Resonant Frequency, fr = 620.0 khz\n",
+ " The Impedance at Resonance, Rr = 20.0 ohm\n",
+ " The Current at Resonance, I = 0.5 A\n",
+ " Voltage across the Inductance, Vl = 428.0 V\n",
+ " Voltage across the Capacitance, Vc = 428.0 V\n",
+ " Voltage across the Resistance, Vr = 10.0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 11.2 Page No.378"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "C=100*10**(-12) #F\n",
+ "L=100*10**(-6) #H\n",
+ "R=10 #Ohms\n",
+ "V=100 #V\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "fr=1/(2*math.pi*math.sqrt(L*C)) #Hz, resonant frequency\n",
+ "Xl=2*math.pi*fr*L #ohm, inductive reactance\n",
+ "Il=V/Xl #A, current in inductive branch\n",
+ "Xc=1/(2*math.pi*fr*C) #ohm, capacitance reactance\n",
+ "Ic=V/Xc #A, current in capacitive branch \n",
+ "Zp=L/(R*C) #ohm , series impedance\n",
+ "I=V/Zp #A, line current\n",
+ "\n",
+ "#Result\n",
+ "print \"fr= \",round(fr/10**3,0),\"khz\"\n",
+ "print \"Il= \",Il,\"A\"\n",
+ "print \"Ic= \",Ic,\"A\"\n",
+ "print \"Zp= \",Zp,\"ohm\"\n",
+ "print \"I= \",I/10**(-3),\"mA\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "fr= 1592.0 khz\n",
+ "Il= 0.1 A\n",
+ "Ic= 0.1 A\n",
+ "Zp= 100000.0 ohm\n",
+ "I= 1.0 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 11.3 Page no. 379"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "C=100*10**(-12) #F, capacitance\n",
+ "L=150*10**(-6) #H, inductance\n",
+ "R=15 #Ohms, resistance\n",
+ "\n",
+ "#Calculation\n",
+ "fr=1/(2*math.pi*math.sqrt(L*C))\n",
+ "Zp=L/(R*C)\n",
+ "Q=2*math.pi*fr*L/R\n",
+ "df=fr/Q #Bandwidth\n",
+ "\n",
+ "#The Result\n",
+ "print \" Impedance, Zp= \",Zp/10**3,\"kohm\"\n",
+ "print \" Quality Factor, Q= \",round(Q,1)\n",
+ "print \" Bandwidth, df= \",round(df/10**3,2),\"khz\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Impedance, Zp= 100.0 kohm\n",
+ " Quality Factor, Q= 81.6\n",
+ " Bandwidth, df= 15.92 khz\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch12.ipynb b/Basic_Electronics_and_Linear_Circuits/ch12.ipynb
index 1052aa07..5b2933a1 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch12.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch12.ipynb
@@ -1,224 +1,208 @@
-{
- "metadata": {
- "name": "Ch 12"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 12:Feedback in amplifiers"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 12.1 Page no.395"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 12.1\n",
- "# Calculate the Gain of a Negative Feedback Amplifier with\n",
- "\n",
- "#Given Circuit Data\n",
- "A=100.0 #Internal Gain\n",
- "B=0.1 #Feedback Factor\n",
- "\n",
- "#Calculation\n",
- "Af=A/(1+A*B) # Gain of Feedback Amplifier \n",
- "# Result\n",
- "print \" The Value of the Gain of Feedback Amplifier is = \",round(Af,2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Value of the Gain of Feedback Amplifier is, = 9.09\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 12.2 Page no. 395"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 12.2\n",
- "#Program to Calculate the A(Internal Gain) and Beeta(Feedback Gain) of #a Negative Feedback Amplifier with given Specifications\n",
- "\n",
- "#Given Circuit Data\n",
- "Af=100.0 #Voltage Gain\n",
- "Vin=.05 #V , Input Signal without Feedaback Gain\n",
- "Vi=0.6 #V , Input Signal with Feedaback Gain\n",
- "\n",
- "#Calculation\n",
- "Vo=Af*Vi\n",
- "A=Vo/Vin\n",
- "B=((A/Af)-1)/A\n",
- "#Result\n",
- "print \"The Value of the Internal Gain A is, A = \",A\n",
- "print \" The Value of the Feedback Gain B is, B = percent \",round(B*100,2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Value of the Internal Gain A is, A = 1200.0\n",
- " The Value of the Feedback Gain B is, B = percent 0.92\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 12.3 Page no. 401"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 12.3\n",
- "# Calculate the change in overall Gain of the Feedback\n",
- " #Amplifier with given Gain reduction\n",
- "\n",
- "#Given Circuit Data\n",
- "A=1000 #60dB Voltage Gain\n",
- "B=0.005 #Negative Feedback\n",
- "dAbyA=-0.12 #dA/A = 12 %\n",
- "\n",
- "#Calculation\n",
- "dAfbyAf=1/(1+A*B)*dAbyA #dAf/Af=1/(1+A*B)*dA/A\n",
- "\n",
- "# Result\n",
- "print \" The change in overall Gain of the Feedback Amplifier is\",dAfbyAf\n",
- "print \"Therefore the overall gain of feedback amplifier will be reduce by \",-dAfbyAf*100,\"%\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The change in overall Gain of the Feedback Amplifier is -0.02\n",
- "Therefore the overall gain of feedback amplifier will be reduce by 2.0 %\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 12.4 Page no. 401"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 12.4\n",
- "# Calculate the Input Impedance of the Feedback Amplifier #with given Specifications\n",
- "\n",
- "#Given Circuit Data\n",
- "Zi=1000.0 #Ohms\n",
- "A=1000.0 #Voltage Gain\n",
- "B=0.01 #Negative Feedback\n",
- "\n",
- "#Calculation\n",
- "Zid=(1+A*B)*Zi\n",
- "# Result\n",
- "print \" The Value of the Input Impedance of the Feedback Amplifier is, Zid = \",Zid/10**3,\"K ohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Value of the Input Impedance of the Feedback Amplifier is, Zid = 11.0 K ohm\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 12.5 Page no. 401"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 12.5\n",
- "# Calculate the value of Feedback Factor and Percentage\n",
- " #change in overall Gain of the Internal Amplifier\n",
- "\n",
- "#Given Circuit Data\n",
- "A=1000.0 #60dB, Voltage Gain\n",
- "Zo=12000.0 #Ohms\n",
- "Zod=600.0 #Ohms\n",
- "dAbyA=0.1 #dA/A = 10 %\n",
- "\n",
- "#Calculation\n",
- "B=((Zo/Zod)-1)/A #Zod=Zo/(1+A*B)\n",
- "dAfbyAf=1/(1+A*B)*dAbyA #dAf/Af=1/(1+A*B)*dA/A\n",
- "# Result\n",
- "print \" The Feedback Factor of the Feedback Amplifier is, B = \",B*100,\"percent\"\n",
- "print \" The change in overall Gain of the Feedback Amplifier is, dAf/Af = \",dAfbyAf*100,\"percent\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Feedback Factor of the Feedback Amplifier is, B = 1.9 percent\n",
- " The change in overall Gain of the Feedback Amplifier is, dAf/Af = 0.5 percent\n"
- ]
- }
- ],
- "prompt_number": 6
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:1fc7b4e7810aaec71230ef3ddc13645d6efc0b44874bc6bf484268f68693d914"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 12:Feedback in amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 12.1 Page no.395"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "A=100.0 #Internal Gain\n",
+ "B=0.1 #Feedback Factor\n",
+ "\n",
+ "#Calculation\n",
+ "Af=A/(1+A*B) # Gain of Feedback Amplifier \n",
+ "# Result\n",
+ "print \" The Value of the Gain of Feedback Amplifier is = \",round(Af,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Value of the Gain of Feedback Amplifier is, = 9.09\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 12.2 Page no. 395"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Af=100.0 #Voltage Gain\n",
+ "Vin=.05 #V , Input Signal without Feedaback Gain\n",
+ "Vi=0.6 #V , Input Signal with Feedaback Gain\n",
+ "\n",
+ "#Calculation\n",
+ "Vo=Af*Vi\n",
+ "A=Vo/Vin\n",
+ "B=((A/Af)-1)/A\n",
+ "#Result\n",
+ "print \"The Value of the Internal Gain A is, A = \",A\n",
+ "print \" The Value of the Feedback Gain B is, B = percent \",round(B*100,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Value of the Internal Gain A is, A = 1200.0\n",
+ " The Value of the Feedback Gain B is, B = percent 0.92\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 12.3 Page no. 401"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "A=1000 #60dB Voltage Gain\n",
+ "B=0.005 #Negative Feedback\n",
+ "dAbyA=-0.12 #dA/A = 12 %\n",
+ "\n",
+ "#Calculation\n",
+ "dAfbyAf=1/(1+A*B)*dAbyA #dAf/Af=1/(1+A*B)*dA/A\n",
+ "\n",
+ "# Result\n",
+ "print \" The change in overall Gain of the Feedback Amplifier is\",dAfbyAf\n",
+ "print \"Therefore the overall gain of feedback amplifier will be reduce by \",-dAfbyAf*100,\"%\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The change in overall Gain of the Feedback Amplifier is -0.02\n",
+ "Therefore the overall gain of feedback amplifier will be reduce by 2.0 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 12.4 Page no. 401"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Zi=1000.0 #Ohms\n",
+ "A=1000.0 #Voltage Gain\n",
+ "B=0.01 #Negative Feedback\n",
+ "\n",
+ "#Calculation\n",
+ "Zid=(1+A*B)*Zi\n",
+ "# Result\n",
+ "print \" The Value of the Input Impedance of the Feedback Amplifier is, Zid = \",Zid/10**3,\"K ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Value of the Input Impedance of the Feedback Amplifier is, Zid = 11.0 K ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 12.5 Page no. 401"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "A=1000.0 #60dB, Voltage Gain\n",
+ "Zo=12000.0 #Ohms\n",
+ "Zod=600.0 #Ohms\n",
+ "dAbyA=0.1 #dA/A = 10 %\n",
+ "\n",
+ "#Calculation\n",
+ "B=((Zo/Zod)-1)/A #Zod=Zo/(1+A*B)\n",
+ "dAfbyAf=1/(1+A*B)*dAbyA #dAf/Af=1/(1+A*B)*dA/A\n",
+ "# Result\n",
+ "print \" The Feedback Factor of the Feedback Amplifier is, B = \",B*100,\"percent\"\n",
+ "print \" The change in overall Gain of the Feedback Amplifier is, dAf/Af = \",dAfbyAf*100,\"percent\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Feedback Factor of the Feedback Amplifier is, B = 1.9 percent\n",
+ " The change in overall Gain of the Feedback Amplifier is, dAf/Af = 0.5 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch13.ipynb b/Basic_Electronics_and_Linear_Circuits/ch13.ipynb
index 8de17b0e..47cf6410 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch13.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch13.ipynb
@@ -1,115 +1,104 @@
-{
- "metadata": {
- "name": "Ch 13"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 13:Oscillators"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 13.1 Page no.421"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 13.1\n",
- "#Program to Calculate Frequency of Oscillation of \n",
- "#Tuned Collector Oscillator\n",
- "\n",
- "#Given Circuit Data\n",
- "L=58.6*10**(-6) # H, inductance\n",
- "C=300*10**(-12) # F, capacitance\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "fo=1/(2*math.pi*math.sqrt(L*C))\n",
- "\n",
- "#Result\n",
- "print \" The Frequency of Oscillation of Tuned Collector Oscillator is fo = \",round(fo/10**3,2),\"KHz\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 13.2 Page no.427"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 13.2\n",
- "#Calculate Frequency of Oscillation of \n",
- "#Vacuum Tube Phase Shift Oscillator\n",
- "\n",
- "#Given Circuit Data\n",
- "R=100000.0 # Ohms, resistance\n",
- "C=0.01*10**(-6) #F, capacitance\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "fo=1/(2*math.pi*R*C*math.sqrt(6))\n",
- "#Result\n",
- "print \"The Frequency of Oscillation of Vacuum Tube Phase Shift Oscillator is fo = \",round(fo,2),\"Hz\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 13.3 Page no.427"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 13.3\n",
- "# Calculate Frequency of Oscillation of \n",
- "#Wein Bridge Oscillator\n",
- "\n",
- "#Given Circuit Data\n",
- "R1=220000.0 # Ohms, Resistance 1\n",
- "R2=220000.0 # Ohms Resistance 2\n",
- "C1=250*10**(-12) #F, capacitance 1 \n",
- "C2=250*10**(-12) #F, capacitance 2\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "fo=1/(2*math.pi*math.sqrt(R1*C1*R2*C2))\n",
- "# Result\n",
- "print \"The Frequency of Oscillation of Wein Bridge Oscillator is fo = \",round(fo/10**3,2),\"KHz\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:599e62479fb81312d9e71ded8b631cb3f6c046aff5ae2a1f3f8129c2f46ca250"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 13:Oscillators"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.1 Page no.421"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "L=58.6*10**(-6) # H, inductance\n",
+ "C=300*10**(-12) # F, capacitance\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "fo=1/(2*math.pi*math.sqrt(L*C))\n",
+ "\n",
+ "#Result\n",
+ "print \" The Frequency of Oscillation of Tuned Collector Oscillator is fo = \",round(fo/10**3,2),\"KHz\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.2 Page no.427"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "R=100000.0 # Ohms, resistance\n",
+ "C=0.01*10**(-6) #F, capacitance\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "fo=1/(2*math.pi*R*C*math.sqrt(6))\n",
+ "#Result\n",
+ "print \"The Frequency of Oscillation of Vacuum Tube Phase Shift Oscillator is fo = \",round(fo,2),\"Hz\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.3 Page no.427"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "R1=220000.0 # Ohms, Resistance 1\n",
+ "R2=220000.0 # Ohms Resistance 2\n",
+ "C1=250*10**(-12) #F, capacitance 1 \n",
+ "C2=250*10**(-12) #F, capacitance 2\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "fo=1/(2*math.pi*math.sqrt(R1*C1*R2*C2))\n",
+ "# Result\n",
+ "print \"The Frequency of Oscillation of Wein Bridge Oscillator is fo = \",round(fo/10**3,2),\"KHz\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch14.ipynb b/Basic_Electronics_and_Linear_Circuits/ch14.ipynb
index bf77a2f6..f2764770 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch14.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "CH 14"
+ "name": "",
+ "signature": "sha256:cfa443285df31619aefbaacada3721c633441a1550bfa091bb356c1fe13c7815"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.1\n",
- "# Determine the Series Resistance to Convert given \n",
- "#d' Arsonval movement into a Voltmeter with the specified Range\n",
"\n",
- "#Given Circuit Data\n",
"Rm=100.0 #Ohms, coil resistance\n",
"Is=100*10**(-6 ) #A current sensivity\n",
"Vr=100.0 #V, voltage\n",
@@ -67,10 +64,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.2\n",
- "#Determine the Shunt Resistance required. \n",
"\n",
- "#Given Circuit Data\n",
"Rm=100.0 #. meter resistance #Ohms\n",
"CS=100*10**(-6) #A. current sensivity\n",
"Imax=10*10**(-3) #A. maximum current\n",
@@ -106,11 +100,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.3\n",
- "# Design the Universal Shunt for making Multi-Range\n",
- " #Milliammeter with Range 0-1 mA,0-100 mA,0-500 mA,0-1 A\n",
"\n",
- "#Given Circuit Data\n",
"CS=100*10**(-6) #A, current source\n",
"R=100.0 #Ohms, resistance\n",
"Rm=900.0 #Ohms, resistance of a meter\n",
@@ -188,10 +178,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.4\n",
- "#Program to Determine the AC Voltage \n",
"\n",
- "#Given Circuit Data\n",
"DS=5 #V/cm, Deflection Sensitivity\n",
"l=10 #cm, Trace Length\n",
"\n",
@@ -249,9 +236,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.5\n",
- "# Determine the Magnitude and the Frequency of the \n",
- "#wave Voltage fed to the Y-input\n",
+ "\n",
"import numpy\n",
"#Given Circuit Data\n",
"Am=3.5 #V, Amplitude\n",
@@ -277,6 +262,7 @@
"metadata": {},
"outputs": [
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEICAYAAACzliQjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXlcVdUa938HRUQkBBFRGUVlEAREwBxJzcyxW1pqOWSD\nV3vTNHt7K69Wt7ksy8qhNG83LSs1UVOv01GcQAVncCZMUdEUEFSm5/1jdY4cOAfOsPfZ0/p+Pnz0\nwD57P2etfX5r7d9a61k6IiJwOBwORxO4SB0Ah8PhcJwHF30Oh8PREFz0ORwOR0Nw0edwOBwNwUWf\nw+FwNAQXfQ6Hw9EQXPQlYtKkSXjnnXccOoder0dgYKBAEVnPtm3b0KtXL3h6euLw4cOiXCMtLQ0R\nERGinFsthISEYOvWrVKHwVEYXPRFICQkBE2aNMF9992H4OBg9OnTB7/++qvJMfPnz8fMmTMlitAx\n3nvvPUyYMAHFxcWIjY0V5Ro9e/ZETk6OKOdWCzqdDjqdDgDw5ptvYsyYMRJHJAwnT57EP/7xDwQF\nBcHb2xvJyclYunQpANbRcXFxgaenJ3x9fT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J\n4CMjIzF06FCsXbsWz/FdWxwiMTER2dnZiI+PR3Z2tlU6KRt7p3qLlZSUhE2bNiEvLw96vR4uLi7w\n9PSUMDrlkZ+fDwCoqKjA8uXLMXDgQIkjUhZ8jYmwlJaWGi3GgoICbNq0iTeiApCcnIwlS5bg9u3b\nWLJkCbp27Vr/m8SZXGQdq1atooCAAGrcuDG1bNmSBgwYYPzb3LlzKSwsjCIjI2nnzp0SRqlMxowZ\nQzExMZSQkEDTpk2j69evSx2S4tDr9RQREUFhYWH0+eefSx2Oojl37hzFxsZSbGws9enThxYvXix1\nSIpj5MiR1KpVK2rUqBEFBATQkiVL7JqyKZudszgcDocjPrKxdzgcDocjPlz0ORwOR0Nw0edwOBwN\nwUWfw+FwNAQXfQ6Hw9EQXPQ5HA5HQ/x/swF7YoxaJw4AAAAASUVORK5CYII=\n"
},
diff --git a/Basic_Electronics_and_Linear_Circuits/ch2.ipynb b/Basic_Electronics_and_Linear_Circuits/ch2.ipynb
index ea7aa645..d56fd44b 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch2.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch2.ipynb
@@ -1,157 +1,145 @@
-{
- "metadata": {
- "name": "ch2"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 2:Current and Voltage Source"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.1 Page no.39"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 2.1\n",
- "# Obtain Equivalent Current Source Representaion from Given Voltage Source Representation in fig 2.16\n",
- "\n",
- "#Voltage Source or Thevenin's Representaion (Series Voltage Source & Resistor\n",
- "Vs=2 #V open circuit voltage\n",
- "Rs=1 #ohm . internal impedence\n",
- "#Current Source or Norton's Representaion (Parallel Current Source & Resistor\n",
- "Is=Vs/Rs #Ampere, short circuit current\n",
- "#result\n",
- "print \"The Short Circuit Current Value is \",Is,\"A\"\n",
- "print \"The Source Impedence Value is \",Rs,\"ohm\"\n",
- "print \"The Current Source & Source Impedance are connected in Parallel.\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.2 Page no.40"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 2.2\n",
- "# Obtain Equivalent Voltage Source Representaion from Given Current Source Representation\n",
- "\n",
- "#Current Source or Norton's Representaion (Parallel Current Source & Resistor)\n",
- "Is=0.2 #Amperes\n",
- "Zs=100 #Ohms\n",
- "#Voltage Source or Thevenin's Representaion (Series Voltage Source & Resistor)\n",
- "Vs=Is*Zs #Volts\n",
- "# Results \n",
- "print \"The Open Circuit Voltage is \",Vs,\"V\"\n",
- "print \"The Source Impedence Value is \",Zs,\"ohm\"\n",
- "print \"The Voltage Source & Source Impedance are connected in Series.\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.3 Page no.40"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 2.3\n",
- "#Program to Calculate Current in a Branch by Using Current Source Representation \n",
- "#Verify the Circuit's Result for its equivalence with Voltage Source Representation\n",
- "\n",
- "#Given Circuit Data\n",
- "Is=1.5*10**(-3) #Amperes ,source current\n",
- "Zs=2000 #Ohms, resistance connected to the loads\n",
- "Z1=10000 #Ohms , load resistance 1\n",
- "Z2=40000 #Ohms load resistance 2\n",
- "#Calculation for Current Source Representation\n",
- "Zl=Z1*Z2/(Z1+Z2)\n",
- "I2=Is*Zs/(Zs+Zl)\n",
- "I4I=I2*Z1/(Z1+Z2) #Using Current Divider Rule\n",
- "\n",
- "#Calculation for Current Source Representation\n",
- "Vs=Is*Zs #Open Circuit Volatge\n",
- "I=Vs/(Zs+Zl)\n",
- "I4V=I*Z1/(Z1+Z2) #Using Current Divider Rule\n",
- "# Results \n",
- "print \"The Load Current using Current Source Representaion is I4I = \",I4I,\"A\"\n",
- "print \"The Load Current using Voltage Source Representaion is I4V = \",I4V,\"A\"\n",
- "print \"I4I==I4V so\"\n",
- "print \" Both Results are same.\"\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.4 Page no.45"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 2.4\n",
- "# Obtain Output Voltage Vo from Given A.C. Equivalent of an Amplifier using a Transistor\n",
- "\n",
- "#Given Circuit Data\n",
- "#Input Side\n",
- "Vs=0.01 #V ,dc voltage\n",
- "Rs=1000 # ohm, resistance\n",
- "#Output Side resistance\n",
- "Ro1=20000 #ohm, 20 kOhms\n",
- "Ro2=2000 # Ohms\n",
- "\n",
- "#Calculation\n",
- "i=Vs/Rs #Input Current\n",
- "Io=100*i #Output Current\n",
- "Il=Io*Ro1/(Ro1+Ro2) #Using Current Divider Rule\n",
- "Vo=Il*Ro2 #Output Volatge\n",
- "\n",
- "# Result\n",
- "print \"The Output Voltage Vo = \",round(Vo,3),\"V\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b1613f8489042ca15914370b3e63d5de12449c98b57f7da2c4754a1532abe03b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2:Current and Voltage Source"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.1 Page no.39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vs=2 #V open circuit voltage\n",
+ "Rs=1 #ohm . internal impedence\n",
+ "#Current Source or Norton's Representaion (Parallel Current Source & Resistor\n",
+ "Is=Vs/Rs #Ampere, short circuit current\n",
+ "#result\n",
+ "print \"The Short Circuit Current Value is \",Is,\"A\"\n",
+ "print \"The Source Impedence Value is \",Rs,\"ohm\"\n",
+ "print \"The Current Source & Source Impedance are connected in Parallel.\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.2 Page no.40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Is=0.2 #Amperes\n",
+ "Zs=100 #Ohms\n",
+ "#Voltage Source or Thevenin's Representaion (Series Voltage Source & Resistor)\n",
+ "Vs=Is*Zs #Volts\n",
+ "# Results \n",
+ "print \"The Open Circuit Voltage is \",Vs,\"V\"\n",
+ "print \"The Source Impedence Value is \",Zs,\"ohm\"\n",
+ "print \"The Voltage Source & Source Impedance are connected in Series.\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.3 Page no.40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Is=1.5*10**(-3) #Amperes ,source current\n",
+ "Zs=2000 #Ohms, resistance connected to the loads\n",
+ "Z1=10000 #Ohms , load resistance 1\n",
+ "Z2=40000 #Ohms load resistance 2\n",
+ "#Calculation for Current Source Representation\n",
+ "Zl=Z1*Z2/(Z1+Z2)\n",
+ "I2=Is*Zs/(Zs+Zl)\n",
+ "I4I=I2*Z1/(Z1+Z2) #Using Current Divider Rule\n",
+ "\n",
+ "#Calculation for Current Source Representation\n",
+ "Vs=Is*Zs #Open Circuit Volatge\n",
+ "I=Vs/(Zs+Zl)\n",
+ "I4V=I*Z1/(Z1+Z2) #Using Current Divider Rule\n",
+ "# Results \n",
+ "print \"The Load Current using Current Source Representaion is I4I = \",I4I,\"A\"\n",
+ "print \"The Load Current using Voltage Source Representaion is I4V = \",I4V,\"A\"\n",
+ "print \"I4I==I4V so\"\n",
+ "print \" Both Results are same.\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.4 Page no.45"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input Side\n",
+ "Vs=0.01 #V ,dc voltage\n",
+ "Rs=1000 # ohm, resistance\n",
+ "#Output Side resistance\n",
+ "Ro1=20000 #ohm, 20 kOhms\n",
+ "Ro2=2000 # Ohms\n",
+ "\n",
+ "#Calculation\n",
+ "i=Vs/Rs #Input Current\n",
+ "Io=100*i #Output Current\n",
+ "Il=Io*Ro1/(Ro1+Ro2) #Using Current Divider Rule\n",
+ "Vo=Il*Ro2 #Output Volatge\n",
+ "\n",
+ "# Result\n",
+ "print \"The Output Voltage Vo = \",round(Vo,3),\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch4.ipynb b/Basic_Electronics_and_Linear_Circuits/ch4.ipynb
index efe67026..701f4aaf 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch4.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch4.ipynb
@@ -1,206 +1,188 @@
-{
- "metadata": {
- "name": "Ch 4"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 4:Semiconductor Diode"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 4.1 Page No.85"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 4.1\n",
- "# Assuming the diode resistance to be zero \n",
- "#Determine DC Voltage across the load and PIV of the Diode\n",
- "\n",
- "#Given Circuit Data\n",
- "Vrms=220 #Volts, power supply\n",
- "n2=1 #Assumption\n",
- "n1=12*n2 #Turns Ratio\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "Vp=math.sqrt(2)*Vrms #Maximum(Peak) Primary Voltage\n",
- "Vm=n2*Vp/n1 #Maximum Secondary Voltage\n",
- "Vdc=Vm/math.pi #DC load Voltage \n",
- "# Results \n",
- "print \"The DC load Voltage is = \",round(Vdc,2),\"V\"\n",
- "print \"The Peak Inverse Voltage(PIV) is = \",round(Vm,1),\"V\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 4.2 Page No.90"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 4.2\n",
- "#Determine DC Voltage across the load and \n",
- "#PIV of the \n",
- "#Centre Tap Rectifier and Bridge Rectifier\n",
- "\n",
- "#Given Circuit Data\n",
- "Vrms=220 #Volts, power supply rms voltage\n",
- "n2=1 #Assumption\n",
- "n1=12*n2 #Turns Ratio\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "Vp=math.sqrt(2)*Vrms #Maximum(Peak Primary Voltage\n",
- "Vm=n2*Vp/n1 #Maximum Secondary Voltage\n",
- "Vdc=2*Vm/math.pi #DC load Voltage \n",
- "\n",
- "# Results \n",
- "print \"The DC load Voltage is = \",round(Vdc,1),\"V\"\n",
- "print \"The Peak Inverse Voltage(PIV of Bridge Rectifier is = \",round(Vm,1),\"V\"\n",
- "print \"The Peak Inverse Voltage(PIV of Centre-tap Rectifier is = \",round(2*Vm,1),\"v\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 4.3 Page No.95"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 4.3(a\n",
- "# determine the Peak Value of Current\n",
- "\n",
- "#Given Circuit Data\n",
- "import math\n",
- "Rl=1000.0 #Ohms, load resistance\n",
- "rd=10.0 #Ohms forward base dynamic resistance\n",
- "Vm=220.0 #Volts(Peak Value of Voltage)\n",
- "#Calculation\n",
- "Im=Vm/(rd+Rl) #Peak Value of Current\n",
- "\n",
- "# Result\n",
- "print \"The Peak Value of Current is = \",round(Im*1000,1),\"mA\"\n",
- "\n",
- "#(b) dc or av value of current\n",
- "\n",
- "Idc=2*Im/math.pi #DC Value of Current\n",
- "# Results \n",
- "print \"The DC or Average Value of Current is \",round(Idc*1000,2),\"mA\"\n",
- "\n",
- "#(c)\n",
- "Irms=Im/math.sqrt(2) #RMS Value of Current\n",
- "# Results \n",
- "print \"The RMS Value of Current is = \",round(Irms*1000,1),\"mA\"\n",
- "\n",
- "#(d)\n",
- "r=math.sqrt((Irms/Idc)**2-1) #Ripple Factor\n",
- "# Results i\n",
- "print \" The Ripple Factor r = \",round(r,3)\n",
- "\n",
- "#(e)\n",
- "Pdc=Idc**2*Rl\n",
- "Pac=Irms**2*(rd+Rl)\n",
- "n=Pdc/Pac #Rectification Efficiency\n",
- "# Results\n",
- "print \"The Rectification EFficiency n(eeta) = percent.\",round(n*100,2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 4.4 Page No.103"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 4.4\n",
- "# determine Maximum Current the Given Zener Diode can handle\n",
- "\n",
- "#Given Circuit Data\n",
- "Vz=9.1 #Volts\n",
- "P=0.364 #Watts\n",
- "#Calculation\n",
- "Iz=P/Vz\n",
- "#Result\n",
- "print \" The Maximum permissible Current is \",Iz*1000,\"mA\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 4.5 Page No.105"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 4.5\n",
- "# determine Capacitance of Varactor Diode if the\n",
- "#Reverse-Bias Voltage is increased from 4V to 8V \n",
- "\n",
- "#Given Circuit Data\n",
- "Ci=18*10**(-12) #i.e. 18 pF, capacitance of diode\n",
- "Vi=4 #volt, initial voltage\n",
- "Vf=8 #v, final voltage\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "Vf=8 \n",
- "K=Ci*math.sqrt(Vi)\n",
- "Cf=K/math.sqrt(Vf)\n",
- "#Result\n",
- "print \" The Final Value of Capacitance is C = \",round(Cf/10**(-12),3),\"pF\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:ae9612ced78590c195456849014e70cbd1cdee113840d747c19ee249579f79a3"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4:Semiconductor Diode"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.1 Page No.85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vrms=220 #Volts, power supply\n",
+ "n2=1 #Assumption\n",
+ "n1=12*n2 #Turns Ratio\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "Vp=math.sqrt(2)*Vrms #Maximum(Peak) Primary Voltage\n",
+ "Vm=n2*Vp/n1 #Maximum Secondary Voltage\n",
+ "Vdc=Vm/math.pi #DC load Voltage \n",
+ "# Results \n",
+ "print \"The DC load Voltage is = \",round(Vdc,2),\"V\"\n",
+ "print \"The Peak Inverse Voltage(PIV) is = \",round(Vm,1),\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.2 Page No.90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vrms=220 #Volts, power supply rms voltage\n",
+ "n2=1 #Assumption\n",
+ "n1=12*n2 #Turns Ratio\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "Vp=math.sqrt(2)*Vrms #Maximum(Peak Primary Voltage\n",
+ "Vm=n2*Vp/n1 #Maximum Secondary Voltage\n",
+ "Vdc=2*Vm/math.pi #DC load Voltage \n",
+ "\n",
+ "# Results \n",
+ "print \"The DC load Voltage is = \",round(Vdc,1),\"V\"\n",
+ "print \"The Peak Inverse Voltage(PIV of Bridge Rectifier is = \",round(Vm,1),\"V\"\n",
+ "print \"The Peak Inverse Voltage(PIV of Centre-tap Rectifier is = \",round(2*Vm,1),\"v\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.3 Page No.95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "Rl=1000.0 #Ohms, load resistance\n",
+ "rd=10.0 #Ohms forward base dynamic resistance\n",
+ "Vm=220.0 #Volts(Peak Value of Voltage)\n",
+ "#Calculation\n",
+ "Im=Vm/(rd+Rl) #Peak Value of Current\n",
+ "\n",
+ "# Result\n",
+ "print \"The Peak Value of Current is = \",round(Im*1000,1),\"mA\"\n",
+ "\n",
+ "#(b) dc or av value of current\n",
+ "\n",
+ "Idc=2*Im/math.pi #DC Value of Current\n",
+ "# Results \n",
+ "print \"The DC or Average Value of Current is \",round(Idc*1000,2),\"mA\"\n",
+ "\n",
+ "#(c)\n",
+ "Irms=Im/math.sqrt(2) #RMS Value of Current\n",
+ "# Results \n",
+ "print \"The RMS Value of Current is = \",round(Irms*1000,1),\"mA\"\n",
+ "\n",
+ "#(d)\n",
+ "r=math.sqrt((Irms/Idc)**2-1) #Ripple Factor\n",
+ "# Results i\n",
+ "print \" The Ripple Factor r = \",round(r,3)\n",
+ "\n",
+ "#(e)\n",
+ "Pdc=Idc**2*Rl\n",
+ "Pac=Irms**2*(rd+Rl)\n",
+ "n=Pdc/Pac #Rectification Efficiency\n",
+ "# Results\n",
+ "print \"The Rectification EFficiency n(eeta) = percent.\",round(n*100,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.4 Page No.103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vz=9.1 #Volts\n",
+ "P=0.364 #Watts\n",
+ "#Calculation\n",
+ "Iz=P/Vz\n",
+ "#Result\n",
+ "print \" The Maximum permissible Current is \",Iz*1000,\"mA\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.5 Page No.105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Ci=18*10**(-12) #i.e. 18 pF, capacitance of diode\n",
+ "Vi=4 #volt, initial voltage\n",
+ "Vf=8 #v, final voltage\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "Vf=8 \n",
+ "K=Ci*math.sqrt(Vi)\n",
+ "Cf=K/math.sqrt(Vf)\n",
+ "#Result\n",
+ "print \" The Final Value of Capacitance is C = \",round(Cf/10**(-12),3),\"pF\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch5.ipynb b/Basic_Electronics_and_Linear_Circuits/ch5.ipynb
index bb34b349..89258a51 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch5.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch5.ipynb
@@ -1,411 +1,385 @@
-{
- "metadata": {
- "name": "Ch5"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 5: Transistors"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 5.1 Page No 134"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 5.1\n",
- "#Program to Calculate Collector and Base Currents\n",
- "\n",
- "#Given Circuit Data\n",
- "alpha=0.98 #alpha(dc), current gain\n",
- "Ico=1*10**(-6) #Ampere, collector leakage current\n",
- "Ie=1*10**(-3) # Ampere, emitter current\n",
- "\n",
- "#Calculation\n",
- "Ic=alpha*Ie+Ico #Collector Current\n",
- "Ib=Ie-Ic #Base Current \n",
- "#result\n",
- "print \" The Collector Current is Ic= \",Ic*1000,\"mA\"\n",
- "print \" The Base Current is Ib= \",Ib*10**6,\"microA\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Collector Current is Ic= 0.981 mA\n",
- " The Base Current is Ib= 19.0 microA\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 5.2 Page No 141"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 5.2\n",
- "#Program to Determine Dynamic Input Resistance of the Transistor at #the point: Ie=0.5 mA and Vcb= -10 V.\n",
- "\n",
- "#From the Input Characteristics \n",
- "dIe=(0.7-0.3)*10**(-3) #A, change in emitter current\n",
- "dVeb=(0.7-0.62) #V, change in emitter base voltage\n",
- "#Calculation\n",
- "ri=dVeb/dIe #Dynamic Input Resistance at Vcb= -10 V \n",
- "#Result\n",
- "print \" The Dynamic Input Resistance is ri= \",ri,\"ohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Dynamic Input Resistance is ri= 200.0 ohm\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 5.3 Page No 144"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 5.3\n",
- "# Determine Short Circuit Current Gain of the Transistor\n",
- "\n",
- "#Given Data \n",
- "dIe=1*10**(-3) #A, change in emitter current\n",
- "dIc=0.99*10**(-3) #A, change in the collector current\n",
- "\n",
- "#Calculation\n",
- "hfb=dIc/dIe #Short Circuit Current Gain\n",
- "#Result\n",
- "print \"The Short Circuit Current Gain is alpha or hfb= \",hfb"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 5.4 Page No 147 "
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 5.4(a)\n",
- "# Determine Common Base Short Circuit Current Gain (alpha)\n",
- "#of the Transistor\n",
- "\n",
- "#Given Data \n",
- "dIe=1*10**(-3) #A, change in emitter current\n",
- "dIc=0.995*10**(-3) #A, change in collector current\n",
- "\n",
- "#Calculation\n",
- "alpha=dIc/dIe #Common Base Short Circuit Current Gain\n",
- "#Result\n",
- "print \" The Common Base Short Circuit Current Gain is alpha= \",alpha\n",
- "\n",
- "#(b)\n",
- "beeta=alpha/(1-alpha) #Common Emitter Short Circuit Current Gain\n",
- "# Result\n",
- "print \" The Common Emitter Short Circuit Current Gain is beeta= \",beeta\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Common Base Short Circuit Current Gain is alpha= 0.995\n",
- " The Common Emitter Short Circuit Current Gain is beeta= 199.0\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 5.5 Page No 147 "
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 5.5\n",
- "# Determine DC Current Gain in Common Base Configuration\n",
- "\n",
- "#Given Data \n",
- "Beeta=100.0 #dc current gain\n",
- "\n",
- "#Calculation\n",
- "Alpha=Beeta/(Beeta+1) #DC Current Gain in Common Base Configuration\n",
- "# Result\n",
- "print \" The DC Current Gain in Common Base Configuration is Alpha= \",round(Alpha,2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The DC Current Gain in Common Base Configuration is Alpha= 0.99\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 5.6 Page No 150"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 5.6\n",
- "#Refer Figure 5.20 in the Textbook\n",
- "# Determine the Dynamic Output Resistance, \n",
- "#DC Current Gain & AC Current Gain from given output characteristics\n",
- "\n",
- "#Given Data \n",
- "Vce=10 #V, collector emitter voltage\n",
- "Ib=30*10**(-6) #A, base current\n",
- "\n",
- "#Calculation from Given Output Characteristics at Ib = 30uA\n",
- "dVce=(12.5-7.5) #V, change in collector emitter voltage\n",
- "dic=(3.7-3.5)*10**(-3) #A, change in collector current\n",
- "Ic=3.6*10**(-3) #A, collector current at operating point \n",
- "ro=dVce/dic # Dynamic Output Resistance\n",
- "Beeta_dc=Ic/Ib # DC Current Gain\n",
- "Beeta_ac=((4.7-3.6)*10**(-3))/((40-30)*10**(-6)) #AC Current Gain, From Graph, Bac=delta(ic)/delta(ib) for given Vce\n",
- "\n",
- "# Result\n",
- "print \"Dynamic Output Resistance ,ro = \",ro/10**(3),\"kohm\"\n",
- "print \" DC Current Gain ,Bdc = \",Beeta_dc\n",
- "print \" AC Current Gain ,Bac = \",Beeta_ac"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Dynamic Output Resistance ,ro = 25.0 kohm\n",
- " DC Current Gain ,Bdc = 120.0\n",
- " AC Current Gain ,Bac = 110.0\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 5.7 Page No 159"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 5.7\n",
- "#Refer Figure 5.27 in the Textbook\n",
- "# Determine the Q point from given collector characteristics in fig. 5.27\n",
- "\n",
- "#Given Data \n",
- "Vcc=12 #V, collector bias juncyion voltage\n",
- "Rc=1000.0 #Ohms, collector resistance\n",
- "Vbb=10.7 #V. base bias junction voltage\n",
- "Rb=200000.0 #Ohms, base resistance\n",
- "Vbe=0.7 #V, base emitter voltage\n",
- "\n",
- "#Calculation\n",
- "Ib=(Vbb-Vbe)/Rb # base current\n",
- "#Value of Ib comes out to be 50uA. A dotted Curve is drawn for \n",
- "#Ib=40uA and Ib=60uA. At the Point of Intersection:\n",
- "Vce=6 #V, collector emitter voltage\n",
- "Ic=6*10**(-3) #A, collector current\n",
- "# Result\n",
- "print \" Q point: Ib = \",Ib/10**(-6),\"microA\"\n",
- "print \" Vce = \",Vce,\"V\"\n",
- "print \" Ic = \",Ic/10**(-3),\"mA\"\n",
- "#Plot\n",
- "\n",
- "#DC Load LIne AT Ib=50 microA\n",
- "Vce1=[0,12]\n",
- "Ic1=[12,0]\n",
- "a1=plot(Vce1,Ic1)\n",
- "xlim(0,14)\n",
- "ylim(0,17)\n",
- "\n",
- "\n",
- "# AT Ib=20 microA\n",
- "Vce2=[0,1,12]\n",
- "Ic2=[0,1.5,3]\n",
- "a2=plot(Vce2,Ic2)\n",
- "\n",
- "# AT Ib=40 microA\n",
- "Vce3=[0,1,12]\n",
- "Ic3=[0,4,5]\n",
- "a3=plot(Vce3,Ic3)\n",
- "\n",
- "#At IB=50\n",
- "Vcex=[3.2,9]\n",
- "Icx=[5.5,6]\n",
- "ax=plot(Vcex,Icx,linestyle='--')\n",
- "qx=plot(6.1,5.9,marker='o',label='$Q point$')\n",
- "legend()\n",
- "\n",
- "# AT Ib=60 microA\n",
- "Vce4=[0,1,12]\n",
- "Ic4=[0,6.5,8]\n",
- "a4=plot(Vce4,Ic4)\n",
- "\n",
- "# AT Ib=80 microA\n",
- "Vce5=[0,1,12]\n",
- "Ic5=[0,9,10]\n",
- "a5=plot(Vce5,Ic5)\n",
- "\n",
- "# AT Ib=100 microA\n",
- "Vce6=[0,1,12]\n",
- "Ic6=[0,12,12.5]\n",
- "a6=plot(Vce6,Ic6)\n",
- "\n",
- "# AT Ib=120 microA\n",
- "Vce7=[0,1,12]\n",
- "Ic7=[0,14.2,15]\n",
- "a7=plot(Vce7,Ic7)\n",
- "xlabel(\"$Vce(volt)$\")\n",
- "ylabel(\"$Ic(mA)$\")\n",
- "show(a1)\n",
- "show(ax)\n",
- "show(qx)\n",
- "show(a2)\n",
- "show(a3)\n",
- "show(a4)\n",
- "show(a5)\n",
- "show(a6)\n",
- "show(a7)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Q point: Ib = 50.0 microA\n",
- " Vce = 6 V\n",
- " Ic = 6.0 mA\n"
- ]
- },
- {
- "output_type": "display_data",
- "png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEOCAYAAACNY7BQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX++PHXDPu+CyqihJq44ZrpTSNNzcrtZplampre\n6ndbrmVp91q2maaWlX67N8u1MrO6Wm6lKWWZJWpqauK1QXFXdmQbmPP74wgyMsgMDHNm4P18PHgI\nZ87MvEH4vM/5LO+PTlEUBSGEEOIKvdYBCCGEcC6SGIQQQpiRx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prfv/9d5o0\nacLIkSM5cOAAGzZsYPXq1QQHB+Pr62v2Gn369OHzzz8nMzOTpk2bMmnSJL799luWL1/OiBEjaN26\nNXFxcfz444907NiRJk2acPr0aXJzc/H19UVRFAICArT49oUwI/sxCFFD8+bNY+LEieVjBrW1f/9+\n/vjjD0aOHGmX1xOipuSOQYgamjRpEmvWrLHb63333Xfce++9dns9IWpKEoMQNRQUFER8fHz5dNba\nOHToEP369ZMxBuEUpCtJCCGEGbk8EUIIYUYSgxBCCDOSGIQQQpiRxCCEEMKMJAYhhBBmJDEIIYQw\nI4lBCCGEGUkMQgghzPx/TjiQ+AqbBlQAAAAASUVORK5CYII=\n"
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 5.8 Page No 173"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 5.8\n",
- "#Program to Calculate Dynamic Drain Resistance of JFET\n",
- "\n",
- "#Given Data \n",
- "u=80.0 # Amplification Factor\n",
- "gm=200*10**(-6) # S, Transconductance\n",
- "\n",
- "#Calculation\n",
- "rd=u/gm #Dynamic Drain Resistance\n",
- "# Result\n",
- "print \" The Dynamic Drain Resistance of JFET is rd= \",rd/10**(3),\"kohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Dynamic Drain Resistance of JFET is rd= 400.0 kohm\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:fb72fb6e3e7bfcc92ab695858992d86597c1a24269bab39240e9f25a8dff8c2d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5: Transistors"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.1 Page No 134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "alpha=0.98 #alpha(dc), current gain\n",
+ "Ico=1*10**(-6) #Ampere, collector leakage current\n",
+ "Ie=1*10**(-3) # Ampere, emitter current\n",
+ "\n",
+ "#Calculation\n",
+ "Ic=alpha*Ie+Ico #Collector Current\n",
+ "Ib=Ie-Ic #Base Current \n",
+ "#result\n",
+ "print \" The Collector Current is Ic= \",Ic*1000,\"mA\"\n",
+ "print \" The Base Current is Ib= \",Ib*10**6,\"microA\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Collector Current is Ic= 0.981 mA\n",
+ " The Base Current is Ib= 19.0 microA\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.2 Page No 141"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "dIe=(0.7-0.3)*10**(-3) #A, change in emitter current\n",
+ "dVeb=(0.7-0.62) #V, change in emitter base voltage\n",
+ "#Calculation\n",
+ "ri=dVeb/dIe #Dynamic Input Resistance at Vcb= -10 V \n",
+ "#Result\n",
+ "print \" The Dynamic Input Resistance is ri= \",ri,\"ohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Dynamic Input Resistance is ri= 200.0 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.3 Page No 144"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "dIe=1*10**(-3) #A, change in emitter current\n",
+ "dIc=0.99*10**(-3) #A, change in the collector current\n",
+ "\n",
+ "#Calculation\n",
+ "hfb=dIc/dIe #Short Circuit Current Gain\n",
+ "#Result\n",
+ "print \"The Short Circuit Current Gain is alpha or hfb= \",hfb"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.4 Page No 147 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "dIe=1*10**(-3) #A, change in emitter current\n",
+ "dIc=0.995*10**(-3) #A, change in collector current\n",
+ "\n",
+ "#Calculation\n",
+ "alpha=dIc/dIe #Common Base Short Circuit Current Gain\n",
+ "#Result\n",
+ "print \" The Common Base Short Circuit Current Gain is alpha= \",alpha\n",
+ "\n",
+ "#(b)\n",
+ "beeta=alpha/(1-alpha) #Common Emitter Short Circuit Current Gain\n",
+ "# Result\n",
+ "print \" The Common Emitter Short Circuit Current Gain is beeta= \",beeta\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Common Base Short Circuit Current Gain is alpha= 0.995\n",
+ " The Common Emitter Short Circuit Current Gain is beeta= 199.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.5 Page No 147 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Beeta=100.0 #dc current gain\n",
+ "\n",
+ "#Calculation\n",
+ "Alpha=Beeta/(Beeta+1) #DC Current Gain in Common Base Configuration\n",
+ "# Result\n",
+ "print \" The DC Current Gain in Common Base Configuration is Alpha= \",round(Alpha,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The DC Current Gain in Common Base Configuration is Alpha= 0.99\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.6 Page No 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vce=10 #V, collector emitter voltage\n",
+ "Ib=30*10**(-6) #A, base current\n",
+ "\n",
+ "#Calculation from Given Output Characteristics at Ib = 30uA\n",
+ "dVce=(12.5-7.5) #V, change in collector emitter voltage\n",
+ "dic=(3.7-3.5)*10**(-3) #A, change in collector current\n",
+ "Ic=3.6*10**(-3) #A, collector current at operating point \n",
+ "ro=dVce/dic # Dynamic Output Resistance\n",
+ "Beeta_dc=Ic/Ib # DC Current Gain\n",
+ "Beeta_ac=((4.7-3.6)*10**(-3))/((40-30)*10**(-6)) #AC Current Gain, From Graph, Bac=delta(ic)/delta(ib) for given Vce\n",
+ "\n",
+ "# Result\n",
+ "print \"Dynamic Output Resistance ,ro = \",ro/10**(3),\"kohm\"\n",
+ "print \" DC Current Gain ,Bdc = \",Beeta_dc\n",
+ "print \" AC Current Gain ,Bac = \",Beeta_ac"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Dynamic Output Resistance ,ro = 25.0 kohm\n",
+ " DC Current Gain ,Bdc = 120.0\n",
+ " AC Current Gain ,Bac = 110.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.7 Page No 159"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "Vcc=12 #V, collector bias juncyion voltage\n",
+ "Rc=1000.0 #Ohms, collector resistance\n",
+ "Vbb=10.7 #V. base bias junction voltage\n",
+ "Rb=200000.0 #Ohms, base resistance\n",
+ "Vbe=0.7 #V, base emitter voltage\n",
+ "\n",
+ "#Calculation\n",
+ "Ib=(Vbb-Vbe)/Rb # base current\n",
+ "#Value of Ib comes out to be 50uA. A dotted Curve is drawn for \n",
+ "#Ib=40uA and Ib=60uA. At the Point of Intersection:\n",
+ "Vce=6 #V, collector emitter voltage\n",
+ "Ic=6*10**(-3) #A, collector current\n",
+ "# Result\n",
+ "print \" Q point: Ib = \",Ib/10**(-6),\"microA\"\n",
+ "print \" Vce = \",Vce,\"V\"\n",
+ "print \" Ic = \",Ic/10**(-3),\"mA\"\n",
+ "#Plot\n",
+ "\n",
+ "#DC Load LIne AT Ib=50 microA\n",
+ "Vce1=[0,12]\n",
+ "Ic1=[12,0]\n",
+ "a1=plot(Vce1,Ic1)\n",
+ "xlim(0,14)\n",
+ "ylim(0,17)\n",
+ "\n",
+ "\n",
+ "# AT Ib=20 microA\n",
+ "Vce2=[0,1,12]\n",
+ "Ic2=[0,1.5,3]\n",
+ "a2=plot(Vce2,Ic2)\n",
+ "\n",
+ "# AT Ib=40 microA\n",
+ "Vce3=[0,1,12]\n",
+ "Ic3=[0,4,5]\n",
+ "a3=plot(Vce3,Ic3)\n",
+ "\n",
+ "#At IB=50\n",
+ "Vcex=[3.2,9]\n",
+ "Icx=[5.5,6]\n",
+ "ax=plot(Vcex,Icx,linestyle='--')\n",
+ "qx=plot(6.1,5.9,marker='o',label='$Q point$')\n",
+ "legend()\n",
+ "\n",
+ "# AT Ib=60 microA\n",
+ "Vce4=[0,1,12]\n",
+ "Ic4=[0,6.5,8]\n",
+ "a4=plot(Vce4,Ic4)\n",
+ "\n",
+ "# AT Ib=80 microA\n",
+ "Vce5=[0,1,12]\n",
+ "Ic5=[0,9,10]\n",
+ "a5=plot(Vce5,Ic5)\n",
+ "\n",
+ "# AT Ib=100 microA\n",
+ "Vce6=[0,1,12]\n",
+ "Ic6=[0,12,12.5]\n",
+ "a6=plot(Vce6,Ic6)\n",
+ "\n",
+ "# AT Ib=120 microA\n",
+ "Vce7=[0,1,12]\n",
+ "Ic7=[0,14.2,15]\n",
+ "a7=plot(Vce7,Ic7)\n",
+ "xlabel(\"$Vce(volt)$\")\n",
+ "ylabel(\"$Ic(mA)$\")\n",
+ "show(a1)\n",
+ "show(ax)\n",
+ "show(qx)\n",
+ "show(a2)\n",
+ "show(a3)\n",
+ "show(a4)\n",
+ "show(a5)\n",
+ "show(a6)\n",
+ "show(a7)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Q point: Ib = 50.0 microA\n",
+ " Vce = 6 V\n",
+ " Ic = 6.0 mA\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "display_data",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEOCAYAAACNY7BQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX++PHXDPu+CyqihJq44ZrpTSNNzcrtZplampre\n6ndbrmVp91q2maaWlX67N8u1MrO6Wm6lKWWZJWpqauK1QXFXdmQbmPP74wgyMsgMDHNm4P18PHgI\nZ87MvEH4vM/5LO+PTlEUBSGEEOIKvdYBCCGEcC6SGIQQQpiRxCCEEMKMJAYhhBBmJDEIIYQwI4lB\nCCGEGXetA7CFTqfTOgQhhHBJtqxMcLk7BkVRXPbjxRdf1DwGiV/7OBpi/K4ce32I31YulxiEEELU\nLUkMQgghzEhicKDExEStQ6gViV9brhy/K8cOrh+/rXRKTTqgNKLT6WrUXyaEEA2ZrW2nS81KEkLU\nT6GhoWRmZmodhssLCQkhIyOj1q8jdwxCCM3J37Z9VPVztPXnK2MMQgghzDg8MUyYMIHIyEg6dOhg\ndvzdd98lPj6e9u3b89xzzzk6LCGEEFc4fIxh/PjxPP7444wdO7b82Pbt2/nqq684cOAAHh4eXLx4\n0dFhCSGEuMLhdwy9e/cmJCTE7Nh7773H9On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CSURBVHW+S/ylu2L3hSV5eXmMGDGCt99+G39/f63Dscr69etp1KgRnTt3drm7BYCS\nkhL27t3LY489xt69e/Hz83PqboxrHT9+nAULFpCamsqZM2fIy8vj448/1jqsWtHpdC77N/3aa6/h\n6enJ6NGjtQ7Favn5+cyaNYuXXnqp/Fh1f8sukRisWePg7IxGI/fccw8PPPAAw4YN0zocq+3cuZOv\nvvqK2NhYRo0axbZt2xg7dqzWYVktOjqa6OhounfvDsCIESPYu3evxlFZLzk5mV69ehEWFoa7uzt/\n/etf2blzp9Zh2SwyMpJz584BcPbsWRo1cr09U5YtW8bGjRtdLjEfP36c1NRUEhISiI2N5dSpU3Tt\n2pULFy5U+RyXSAyuvsZBURQmTpxI27Zteeqpp7QOxyazZs0iLS0Ng8HAp59+St++fVmxYoXWYVkt\nKiqKZs2akZKSAsDWrVtp166dxlFZr02bNuzatYuCggIURWHr1q20bdtW67BsNmTIEJYvXw7A8uXL\nXeriCNRZkXPnzmXdunV4e3trHY5NOnTowPnz5zEYDBgMBqKjo9m7d+/1k7PiIjZu3Ki0bt1aiYuL\nU2bNmqV1ODbZsWOHotPplISEBKVTp05Kp06dlE2bNmkdls2SkpKUwYMHax2GzX777TelW7duSseO\nHZXhw4crWVlZWodkkzlz5iht27ZV2rdvr4wdO1YpLi7WOqTruv/++5XGjRsrHh4eSnR0tLJkyRIl\nPT1d6devn9KqVSulf//+SmZmptZhVuna+D/88EOlZcuWSkxMTPnf76OPPqp1mFUqi9/T07P8519R\nbGyskp6eft3XcJpaSUIIIZyDS3QlCSGEcBxJDEIIIcxIYhBCCGFGEoMQQggzkhiEEEKYkcQghBDC\njCQGIWrJHmWwCwsL7RCJEPYhiUE0aIcPH+amm27iwQcf5OLFiwDs27ePdu3asXHjxmqfv379enJz\nc216z2eeeYYZM2aYHTt16hRbt2616XWEqCuSGESD1rZtW+666y769etHREQEoBZ5W7NmTbUVNM+e\nPUtOTg7h4eE2vWdcXBw333wzAEeOHGHWrFm0bNmSw4cPU1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 "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.8 Page No 173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "u=80.0 # Amplification Factor\n",
+ "gm=200*10**(-6) # S, Transconductance\n",
+ "\n",
+ "#Calculation\n",
+ "rd=u/gm #Dynamic Drain Resistance\n",
+ "# Result\n",
+ "print \" The Dynamic Drain Resistance of JFET is rd= \",rd/10**(3),\"kohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Dynamic Drain Resistance of JFET is rd= 400.0 kohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch6.ipynb b/Basic_Electronics_and_Linear_Circuits/ch6.ipynb
index 21a5f4fa..abbcf8b9 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch6.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch6.ipynb
@@ -1,198 +1,197 @@
-{
- "metadata": {
- "name": "Ch6"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 6: Vaccum Tubes"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 6.1 Page no.195"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 6.1\n",
- "#Program to Plot the Characteristics and \n",
- "#Determine Dynamic Plate Resistance\n",
- "\n",
- "from pylab import *\n",
- "#Given Circuit Data\n",
- "V=[0,0.5,1,1.5,2] #V, voltage\n",
- "I=[0,1.6,4,6.7,9.4] #mA, current\n",
- "\n",
- "#Calculation\n",
- "dVp=0.5 #V, change in plate voltage\n",
- "dIp=2.7*10**(-3) #A, change in plate current\n",
- "rp=dVp/dIp # Dynamic Plate Resistance\n",
- "\n",
- "#Result\n",
- "print \"The Dynamic Plate Resistance is rp= \",rp,\"ohm\"\n",
- "\n",
- "#plot\n",
- "\n",
- "a=plot(V,I)\n",
- "xlabel(\"V\") \n",
- "ylabel(\"I (mA)\") \n",
- "\n",
- "show(a)\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Dynamic Plate Resistance is rp= 185.185185185 ohm\n"
- ]
- },
- {
- "output_type": "display_data",
- "png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGqNJREFUeJzt3XtwVPX5x/HPlqA2IAgqwQJqRZiEewBFmAJLERBa0tSo\nNXjlok5RFLSdUtsZwZ9WqDoKxnpBiRFsoCIiFUglyHIRgUIAUSKxhEiCEqsEIQYhhPP749tguIRs\nNrvnsvt+zWQmJkv2mZ3jPvt8zznfj8+yLEsAgJj1I6cLAAA4i0YAADGORgAAMY5GAAAxjkYAADGO\nRgAAMS5ijWDMmDFKSEhQ165dT/xs//79GjJkiDp27KihQ4fqwIEDkXp6AECQItYIRo8erZycnJN+\nNm3aNA0ZMkQFBQUaPHiwpk2bFqmnBwAEyRfJG8qKioo0cuRIbd++XZKUmJioVatWKSEhQfv27ZPf\n79enn34aqacHAATB1nMEpaWlSkhIkCQlJCSotLTUzqcHAJxBnFNP7PP55PP5av0dAKD+QlnksXUi\nqF4SkqQvv/xSrVq1qvWxlmXxFaavRx55xPEaouWL15LX081fobK1EaSkpCgrK0uSlJWVpdTUVDuf\nHgBwBhFrBOnp6erXr5927typdu3aKTMzU5MnT9by5cvVsWNHvf/++5o8eXK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t_number": 3
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 6.2 Page no.202"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 6.2\n",
- "#Program to Plot the Static Plate Characteristics and Determine\n",
- "#Plate AC Resistance, Mutual Conductance & Amplification Factor\n",
- "from math import *\n",
- "from pylab import *\n",
- "#Calculation\n",
- "dip=(14.0-10.7)*10**(-3) #A\n",
- "dvp=20 #V\n",
- "rp=dvp/dip\n",
- "diP=(12.4-5.3)*10**(-3) #A\n",
- "dvG=1 #V\n",
- "gm=diP/dvG\n",
- "u=gm*rp\n",
- "ut=(192-150)/1\n",
- "\n",
- "# Result\n",
- "print \" The Plate AC Resistance is rp= \",round(rp/10**(3),2),\"kohm\"\n",
- "print \" The Mutual Conductance is gm= \",gm/10**(-3),\"mS\"\n",
- "print \" The Graphical Amplification Factor is u= \",round(u,2)\n",
- "print \" The Theoretical Amplification Factor is ut= \",ut\n",
- "\n",
- "\n",
- "#plot\n",
- "#At Vg=0\n",
- "V1=[0,50,100,150]\n",
- "I1=[0,3.5,11.2,20.0]\n",
- "\n",
- "#at Vg=-1\n",
- "V2=[60,100,150,200]\n",
- "I2=[0,4,12.4,21.5]\n",
- "\n",
- "\n",
- "#at Vg=-2\n",
- "V3=[100,150,200]\n",
- "I3=[0,5.4,14.1]\n",
- "\n",
- "#at Vg=-3\n",
- "V4=[160,200,250]\n",
- "I4=[0,3.4,12.4]\n",
- "\n",
- "#at Vg=-4\n",
- "V5=[220,250,300]\n",
- "I5=[0,2.5,11.3]\n",
- "\n",
- "figure(1)\n",
- "import numpy \n",
- "import pylab\n",
- "fig = plt.figure()\n",
- "ax = fig.add_subplot(111)\n",
- "\n",
- "\n",
- "a1=plot(V1,I1)\n",
- "a2=plot(V2,I2)\n",
- "a3=plot(V3,I3)\n",
- "a4=plot(V4,I3)\n",
- "a5=plot(V5,I4)\n",
- "xlabel(\"Vp (V)\") \n",
- "ylabel(\"Ip(mA)\") \n",
- "ax.annotate('vg=0', xy=(152,21),\n",
- " arrowprops=dict(facecolor='black', shrink=0.5),\n",
- " )\n",
- "ax.annotate('vg=-1', xy=(200,21.5), \n",
- " arrowprops=dict(facecolor='black', shrink=0.5),\n",
- " )\n",
- "ax.annotate('vg=-2', xy=(200,14.1), \n",
- " arrowprops=dict(facecolor='black', shrink=0.5),\n",
- " )\n",
- "ax.annotate('vg=-3', xy=(250,12.4),\n",
- " arrowprops=dict(facecolor='black', shrink=0.5),\n",
- " )\n",
- "ax.annotate('vg=-4',xy=(300,11.3), \n",
- " arrowprops=dict(facecolor='black', shrink=0.5),\n",
- " )\n",
- "show(a1)\n",
- "show(a2)\n",
- "show(a3)\n",
- "show(a4)\n",
- "show(a5)\n",
- "\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Plate AC Resistance is rp= 6.06 kohm\n",
- " The Mutual Conductance is gm= 7.1 mS\n",
- " The Graphical Amplification Factor is u= 43.03\n",
- " The Theoretical Amplification Factor is ut= 42\n"
- ]
- },
- {
- "output_type": "display_data",
- "png": "iVBORw0KGgoAAAANSUhEUgAAAZkAAAEMCAYAAAAWDss+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4THf7x/H3INZYi9hSexCyEVRLS1u0pUrTIrZYq1TV\n0lItRVdUqfWprZpHK3aqTy0tFTshQpCEICFkQ6RJJLLMnN8fp/KrJSSRyZkzc7+uq1dJxuRzMsm5\n57sbFEVREEIIIcygiNYBhBBCWC8pMkIIIcxGiowQQgizkSIjhBDCbKTICCGEMBspMkIIIczGbEUm\nKiqKDh060LRpU5o1a8b8+fMBmDZtGrVq1cLDwwMPDw927NhhrghCCCE0ZjDXOpnY2FhiY2Nxd3cn\nJSWFFi1asGXLFtatW0fZsmUZN26cOb6sEEIIC1LMXE9crVo1qlWrBoC9vT1NmjTh2r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kRE2qVKlSrRq\n1Ypt27YBasHo1atX9uePHTvGwoULCQkJ4eLFi2zatOmB5zh48CCenp4AFC1aFC8vL9atWwfAb7/9\nRocOHbC3twfA3d2dQ4cOmfuyhLA4UmSEzfp3F9fatWvx9vbO/lyrVq2oU6cORYoUwdvbmwMHDjzw\n7y9fvpy9L939z7dmzZp7nq9EiRKYTCbu3LljrssRwiJJkRE2q1u3buzevZugoCBSU1Px8PDI/ty/\nd6tVFCXH3Wv/3Y3Wpk0bYmJiOHXqFIcPH6ZLly4PPNaSd/gVwhykyAibZW9vT4cOHRg0aNADA/4B\nAQFERkZiMplYt24d7dq1e+Df165d+56NFw0GA7169cLHx4fXXnuN4sWLZ38uPT2dokWLUqJECfNd\nkBAWSIqMsGne3t6cPn36nq4tg8FAy5YtGTVqFM7OztSrV++hu2S3bduW48ePP/b5AIKCgmjTpo15\nLkIIC1ZM6wBCaOmNN97AaDTe8zFFUShXrhy//fbbI/+tt7c377//PsOHD8/+mJub2wPPB+oR1X37\n9i2Y0ELoiLRkhLhPbk8qrVevHmXLluXixYuPfFx6ejoHDhzQ9ZlBQuSXbPUvhBDCbKQlI4QQwmyk\nyAghhDAbKTJCCCHMRoqMEEIIs5EiI4QQwmykyAghhDCb/wMHqb/IR0Mj3wAAAABJRU5ErkJggg==\n"
- }
- ],
- "prompt_number": 30
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e45efbc918d6e082147a3abf5687f38acaf875f9fd899adb5638679d888fbdcb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6: Vaccum Tubes"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 6.1 Page no.195"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "from pylab import *\n",
+ "#Given Circuit Data\n",
+ "V=[0,0.5,1,1.5,2] #V, voltage\n",
+ "I=[0,1.6,4,6.7,9.4] #mA, current\n",
+ "\n",
+ "#Calculation\n",
+ "dVp=0.5 #V, change in plate voltage\n",
+ "dIp=2.7*10**(-3) #A, change in plate current\n",
+ "rp=dVp/dIp # Dynamic Plate Resistance\n",
+ "\n",
+ "#Result\n",
+ "print \"The Dynamic Plate Resistance is rp= \",rp,\"ohm\"\n",
+ "\n",
+ "#plot\n",
+ "\n",
+ "a=plot(V,I)\n",
+ "xlabel(\"V\") \n",
+ "ylabel(\"I (mA)\") \n",
+ "\n",
+ "show(a)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Dynamic Plate Resistance is rp= 185.185185185 ohm\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "display_data",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGqNJREFUeJzt3XtwVPX5x/HPlqA2IAgqwQJqRZiEewBFmAJLERBa0tSo\nNXjlok5RFLSdUtsZwZ9WqDoKxnpBiRFsoCIiFUglyHIRgUIAUSKxhEiCEqsEIQYhhPP749tguIRs\nNrvnsvt+zWQmJkv2mZ3jPvt8zznfj8+yLEsAgJj1I6cLAAA4i0YAADGORgAAMY5GAAAxjkYAADGO\nRgAAMS5ijWDMmDFKSEhQ165dT/xs//79GjJkiDp27KihQ4fqwIEDkXp6AECQItYIRo8erZycnJN+\nNm3aNA0ZMkQFBQUaPHiwpk2bFqmnBwAEyRfJG8qKioo0cuRIbd++XZKUmJioVatWKSEhQfv27ZPf\n79enn34aqacHAATB1nMEpaWlSkhI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Q0AQysvL1b59e+Xk5Ojmm2/Wzp07nS4JCBsmAiAITZs21aBBgzR69GhOEiPq\n0AiAIKWnp2v79u0sCyHqsDQEADGOiQAAYhyNAABiHI0AAGIcjQAAYhyNAABiHI0AAGLc/wNshpbl\nb3wzYgAAAABJRU5ErkJggg==\n"
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 6.2 Page no.202"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "from math import *\n",
+ "from pylab import *\n",
+ "#Calculation\n",
+ "dip=(14.0-10.7)*10**(-3) #A\n",
+ "dvp=20 #V\n",
+ "rp=dvp/dip\n",
+ "diP=(12.4-5.3)*10**(-3) #A\n",
+ "dvG=1 #V\n",
+ "gm=diP/dvG\n",
+ "u=gm*rp\n",
+ "ut=(192-150)/1\n",
+ "\n",
+ "# Result\n",
+ "print \" The Plate AC Resistance is rp= \",round(rp/10**(3),2),\"kohm\"\n",
+ "print \" The Mutual Conductance is gm= \",gm/10**(-3),\"mS\"\n",
+ "print \" The Graphical Amplification Factor is u= \",round(u,2)\n",
+ "print \" The Theoretical Amplification Factor is ut= \",ut\n",
+ "\n",
+ "\n",
+ "#plot\n",
+ "#At Vg=0\n",
+ "V1=[0,50,100,150]\n",
+ "I1=[0,3.5,11.2,20.0]\n",
+ "\n",
+ "#at Vg=-1\n",
+ "V2=[60,100,150,200]\n",
+ "I2=[0,4,12.4,21.5]\n",
+ "\n",
+ "\n",
+ "#at Vg=-2\n",
+ "V3=[100,150,200]\n",
+ "I3=[0,5.4,14.1]\n",
+ "\n",
+ "#at Vg=-3\n",
+ "V4=[160,200,250]\n",
+ "I4=[0,3.4,12.4]\n",
+ "\n",
+ "#at Vg=-4\n",
+ "V5=[220,250,300]\n",
+ "I5=[0,2.5,11.3]\n",
+ "\n",
+ "figure(1)\n",
+ "import numpy \n",
+ "import pylab\n",
+ "fig = plt.figure()\n",
+ "ax = fig.add_subplot(111)\n",
+ "\n",
+ "\n",
+ "a1=plot(V1,I1)\n",
+ "a2=plot(V2,I2)\n",
+ "a3=plot(V3,I3)\n",
+ "a4=plot(V4,I3)\n",
+ "a5=plot(V5,I4)\n",
+ "xlabel(\"Vp (V)\") \n",
+ "ylabel(\"Ip(mA)\") \n",
+ "ax.annotate('vg=0', xy=(152,21),\n",
+ " arrowprops=dict(facecolor='black', shrink=0.5),\n",
+ " )\n",
+ "ax.annotate('vg=-1', xy=(200,21.5), \n",
+ " arrowprops=dict(facecolor='black', shrink=0.5),\n",
+ " )\n",
+ "ax.annotate('vg=-2', xy=(200,14.1), \n",
+ " arrowprops=dict(facecolor='black', shrink=0.5),\n",
+ " )\n",
+ "ax.annotate('vg=-3', xy=(250,12.4),\n",
+ " arrowprops=dict(facecolor='black', shrink=0.5),\n",
+ " )\n",
+ "ax.annotate('vg=-4',xy=(300,11.3), \n",
+ " arrowprops=dict(facecolor='black', shrink=0.5),\n",
+ " )\n",
+ "show(a1)\n",
+ "show(a2)\n",
+ "show(a3)\n",
+ "show(a4)\n",
+ "show(a5)\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Plate AC Resistance is rp= 6.06 kohm\n",
+ " The Mutual Conductance is gm= 7.1 mS\n",
+ " The Graphical Amplification Factor is u= 43.03\n",
+ " The Theoretical Amplification Factor is ut= 42\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "display_data",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAZkAAAEMCAYAAAAWDss+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4THf7x/H3INZYi9hSexCyEVRLS1u0pUrTIrZYq1TV\n0lItRVdUqfWprZpHK3aqTy0tFTshQpCEICFkQ6RJJLLMnN8fp/KrJSSRyZkzc7+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l68yODBg1m6dOk9n9uy\nZQuvvfYaGRkZPP/885hMpifOLYTeSJERNsnb25s1a9bc87G1a9fSp0+fXD/HhQsXSElJoX79+g99\nvjVr1tCnTx+KFy9Ou3btdLM/nRAFSYqMsEleXl78/vvvZGVlAeo+V9HR0bRt2xZ/f3+ef/55unbt\nSuPGjRkxYsRDN1dcs2ZN9mLhF198kbCwsOyV17dv32b37t33LIzz8/MrpKsTwnJIkRE2qVKlSrRq\n1Ypt27YBasHo1atX9uePHTvGwoULCQkJ4eLFi2zatOmB5zh48CCenp4AFC1aFC8vL9atWwfAb7/9\nRocOHbC3twfA3d2dQ4cOmfuyhLA4UmSEzfp3F9fatWvx9vbO/lyrVq2oU6cORYoUwdvbmwMHDjzw\n7y9fvpy9L939z7dmzZp7nq9EiRKYTCbu3LljrssRwiJJkRE2q1u3buzevZugoCBSU1Px8PDI/ty/\nd6tVFCXH3Wv/3Y3Wpk0bYmJiOHXqFIcPH6ZLly4PPNaSd/gVwhykyAibZW9vT4cOHRg0aNADA/4B\nAQFERkZiMplYt24d7dq1e+Df165d+56NFw0GA7169cLHx4fXXnuN4sWLZ38uPT2dokWLUqJECfNd\nkBAWSIqMsGne3t6cPn36nq4tg8FAy5YtGTVqFM7OztSrV++hu2S3bduW48ePP/b5AIKCgmjTpo15\nLkIIC1ZM6wBCaOmNN97AaDTe8zFFUShXrhy//fbbI/+tt7c377//PsOHD8/+mJub2wPPB+oR1X37\n9i2Y0ELoiLRkhLhPbk8qrVevHmXLluXixYuPfFx6ejoHDhzQ9ZlBQuSXbPUvhBDCbKQlI4QQwmyk\nyAghhDAbKTJCCCHMRoqMEEIIs5EiI4QQwmykyAghhDCb/wMHqb/IR0Mj3wAAAABJRU5ErkJggg==\n"
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch7.ipynb b/Basic_Electronics_and_Linear_Circuits/ch7.ipynb
index 88e5ebf6..7a081d42 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch7.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch7.ipynb
@@ -1,671 +1,610 @@
-{
- "metadata": {
- "name": "CH 7"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 7 :Transistor Biasing And Stabilization of Operation Point"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.1 Page No.230"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.1\n",
- "# Calculate\n",
- "#(a)Collector Current\n",
- "#(b)Collector-to-Emitter Voltage\n",
- "#for the circuit given in fig. 7.11\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=9.0 #V, collector bias junction voltage\n",
- "Rb=300*10**3 #Ohms, , base resistance\n",
- "Rc=2*10**3 #Ohms, collector resistance\n",
- "Beeta=50.0 #current gain factor\n",
- "\n",
- "#Calculation\n",
- "Ib=(Vcc)/Rb\n",
- "Ic=Beeta*Ib\n",
- "Icsat=Vcc/Rc\n",
- "Vce=Vcc-Ic*Rc\n",
- "\n",
- "#Result\n",
- "print \"a) Base current is \",Ib,\"A\"\n",
- "print \"b) collector current is = \",Ic/10**(-3),\"mA\"\n",
- "print \"collector saturation current is = \",Icsat/10**(-3),\"mA\"\n",
- "if Ic < Icsat:\n",
- " \n",
- " print\"Since Ic < Icsat \\nSo Transistor is not in saturation\" \n",
- "else:\n",
- " print \"Transistor is in saturation\"\n",
- "\n",
- "print \"c) The collector to emitter voltage is = \",Vce,\"V\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "a) Base current is 3e-05 A\n",
- "b) collector current is = 1.5 mA\n",
- "collector saturation current is = 4.5 mA\n",
- "Since Ic < Icsat \n",
- "So Transistor is not in saturation\n",
- "c) The collector to emitter voltage is = 6.0 V\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.2 Page No.230"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.2\n",
- "# Calculate Operating Point Coordinates of the Circuit 7.12a\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=10.0 #V, collector bias junction voltage\n",
- "Rb=100*10**3 #Ohms, base resistance\n",
- "Rc=1*10**3 #Ohms, collector resistance\n",
- "Beeta=60 #current gain\n",
- " \n",
- "#Calculation\n",
- "Ib=(Vcc)/Rb #A, base current\n",
- "Ic=Beeta*Ib #A, collector current\n",
- "Icsat=Vcc/Rc #A, collector saturated current\n",
- "Vce=Vcc-Ic*Rc #V, collector emitter voltage\n",
- "\n",
- "#Result\n",
- "print \"a) Base current is \",Ib*10**6,\"microA\"\n",
- "print \"b) collector current is \",Ic*10**3,\"mA\"\n",
- "print \"collector saturation current is \",Icsat*10**3,\"mA\"\n",
- "if Ic < Icsat:\n",
- " \n",
- " print\"Since Ic < Icsat \\nSo Transistor is not in saturation\" \n",
- "else:\n",
- " print \"Transistor is in saturation\"\n",
- "print \"c) The collector emitter voltage is \",Vce,\"V\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "a) Base current is 100.0 microA\n",
- "b) collector current is 6.0 mA\n",
- "collector saturation current is 10.0 mA\n",
- "Since Ic < Icsat \n",
- "So Transistor is not in saturation\n",
- "c) The collector emitter voltage is 4.0 V\n"
- ]
- }
- ],
- "prompt_number": 23
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.3 Page No.231"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.3\n",
- "# Calculate quiescent Operating Point Coordinates of the Circuit\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=10.0 #V, collector bias junction voltage\n",
- "Rb=100*10**3 #Ohms, Base resistance\n",
- "Rc=1*10**3 #Ohms, collector resistance\n",
- "Beeta=150 #current gain\n",
- "\n",
- "#Calculation\n",
- "Ib=(Vcc)/Rb #Base current\n",
- "Ic=Beeta*Ib #collector resistance\n",
- "Icsat=Vcc/Rc #A, collector saturation current\n",
- "Vce=0 #V, collector emitter voltage\n",
- "\n",
- "#Result\n",
- "print \"collector current is Ic = \",Ic/10**(-3),\"mA\"\n",
- "print \"collector saturated current is \",Icsat*10**3,\"mA\" \n",
- "if Ic < Icsat:\n",
- " \n",
- " print\" Transistor is not in saturation.\" \n",
- "else:\n",
- " print \"Since Ic > Icsat \\n So Transistor is in saturation\"\n",
- "print \"collector emitter voltage is \",Vce,\"V\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "collector current is Ic = 15.0 mA\n",
- "collector saturated current is 10.0 mA\n",
- "Since Ic > Icsat \n",
- " So Transistor is in saturation\n",
- "collector emitter voltage is 0 V\n"
- ]
- }
- ],
- "prompt_number": 25
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.4 Page No.231"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.4 (a)\n",
- "#find the Value of Rb so that a germanium resistor with\n",
- "#beeta =20 and Icbo= 2 micrometer draw an Ic of 1 mA.\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=6 #V,collector base junction voltage\n",
- "Vbe=0.3 #V,base emittor voltage\n",
- "Icbo=.000002 #A,colector leakage current\n",
- "Ic=.001 #A,collector current\n",
- "Beeta=20.0\n",
- "\n",
- "#Calculation\n",
- "#Case 1: Considering Icbo and Vbe in the calculations\n",
- "Ib=(Ic-(Beeta+1)*Icbo)/Beeta\n",
- "print Ib\n",
- "Rb1=(Vcc-Vbe)/Ib\n",
- "print \"value of base resistance is =\",round(Rb1/1000,3),\"K ohm\"\n",
- "\n",
- "#Case 2: Neglecting Icbo and Vbe in the calculations\n",
- "Ib2=Ic/Beeta\n",
- "Rb2=Vcc/Ib2\n",
- "#Percentage Error\n",
- "E=(Rb2-Rb1)/Rb1*100\n",
- "#Displaying The Results in Command Window\n",
- "print\"The Base Resistance (Neglecting Icbo and Vbe) is \",Rb2/1000,\"k ohm\"\n",
- "print\" Percentage Error is = \",round(E,3)\n",
- "\n",
- "#b Due to rise in temprature\n",
- "beeta1=25.0\n",
- "Icbo1=10.0\n",
- "Ic1=beeta1*Ib+(beeta1+1)*Icbo1*10**-6\n",
- "print \"Now collector current is \",round(Ic1*10**3,2),\"mA\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "4.79e-05\n",
- "value of base resistance is = 118.998 K ohm\n",
- "The Base Resistance (Neglecting Icbo and Vbe) is 120.0 k ohm\n",
- " Percentage Error is = 0.842\n",
- "Now collector current is 1.46 mA\n"
- ]
- }
- ],
- "prompt_number": 40
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.5 Page No.235"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.5\n",
- "#how much is the emittor current in the circuit in fig. 7.17.\n",
- "#Also calculate Vc.\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=10.0 #V,collectoe base junction voltage\n",
- "Rc=500.0 #Ohms,colector resistance\n",
- "Rb=500000 #Ohms,base resistance\n",
- "Beeta=100.0 #current gain\n",
- "#Calculation\n",
- "Ib=Vcc/(Rb+Beeta*Rc) #emittor currenr\n",
- "Ic=Beeta*Ib\n",
- "Ie=Ic\n",
- "Vce=Vcc-Ic*Rc\n",
- "Vc=Vce\n",
- "\n",
- "# Results \n",
- "print \"emittor current is \",round(Ie*1000,1),\"mA\"\n",
- "print\"The collector voltage is \",round(Vc,1),\"V\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.6 Page No.235"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.6\n",
- "#Calculate\n",
- "#(a)Minimum Collector Current\n",
- "#(b)Maximum Collector Current \n",
- "#in fig7.18 if beeta of the transistor varies within the limits indicated.\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=20.0 #V,collector base voltage\n",
- "Rc=2000.0 #Ohms.collector resistance\n",
- "Rb=200000.0 #Ohms,base resistance\n",
- "Beeta1=50.0 #current gain factor\n",
- "Beeta2=200.0\n",
- "\n",
- "#Calculation CASE-1: Minimum Collector Current\n",
- "#from fig 7.14\n",
- "Ibmin=Vcc/(Rb+Beeta1*Rc)\n",
- "Icmin=Beeta1*Ibmin\n",
- "#result\n",
- "print \"minimum base curent is \",round(Ibmin,6),\"A\"\n",
- "print \"minimum collector current is \",round(Icmin*1000,3),\"mA\"\n",
- "#Calculation CASE-2: Maximum Collector Current\n",
- "Ibmax=Vcc/(Rb+Beeta2*Rc)\n",
- "Icmax=Beeta2*Ibmax\n",
- "\n",
- "#Results \n",
- "print\"The maximum base current = \",round(Ibmax/10**(-3),6),\"A\"\n",
- "print\"The Maximum Collector Current = \",round(Icmax/10**(-3),2),\"mA\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.7 Page No.238"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.7\n",
- "#Calculate\n",
- "#(a)Ib\n",
- "#(b)Ic\n",
- "#(c)Ie in fig 7.22\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=10.0 #V collector junction voltage\n",
- "Rc=2000.0 #Ohms collector resistane\n",
- "Rb=1000000.0 #Ohms,base resistance\n",
- "Re=1000.0 #Ohms emittor resstance\n",
- "Beeta=100.0 #current gain\n",
- "\n",
- "#Calculation\n",
- "Ib=Vcc/(Rb+(Beeta+1)*Re)\n",
- "Ic=Beeta*Ib\n",
- "Ie=Ic+Ib\n",
- "#Results \n",
- "print \" The Collector Current Ic = \",round(Ic*1000,3),\"mA\"\n",
- "print \" The Base Current Ib .\",round(Ib*1000000,2),\"microA\"\n",
- "print \" The Emitter Current Ie = \",round(Ie*1000,3),\"mA\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.8 Page No.239"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.8\n",
- "# Calculate(in fig 7.23)\n",
- "#(a)Minimum Emitter Current & corresponding Vce\n",
- "#(b)Maximum Emitter Current & corresponding Vce\n",
- "#the transistor used in the circuit is a germanium transistor\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=6 #V,collector bias junction volage\n",
- "Vbe=0.3 #V base emittor voltage\n",
- "Rc=50 #Ohms collector resistance\n",
- "Rb=10*10**3 #Ohms base resistance\n",
- "Re=100 #Ohms emittor resistance\n",
- "Beeta1=50 # gain factor\n",
- "Beeta2=200\n",
- "\n",
- "#Calculation CASE-1: Minimum Emitter Current & corresponding Vce\n",
- "Iemin=(Vcc-Vbe)*(Beeta1+1)/(Rb+(Beeta1+1)*Re)\n",
- "Vcemin=Vcc-(Rc+Re)*Iemin\n",
- "#Calculatioen CASE-2: Maximum Emitter Current & corresponding Vce\n",
- "Iemax=(Vcc-Vbe)*(Beeta2+1)/(Rb+(Beeta2+1)*Re)\n",
- "Vcemax=Vcc-(Rc+Re)*Iemax\n",
- "\n",
- "#Results \n",
- "print\"The Minimum Emitter Current Ie(min) is\",round(Iemin*1000,2),\"mA\"\n",
- "print \"The Corresponding Vce = V .\",round(Vcemin,1),\"v\"\n",
- "print \"The Maximum Emitter Current Ie(max) = .\",round(Iemax*1000,1),\"mA\"\n",
- "print \"The Corresponding Vce = V .\",round(Vcemax,1),\"v\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.9 Page No. 240"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.9\n",
- "#if the collector resistance Rc in fig. 7.23 is changed to 1 kohm\n",
- "# Calculate new Q points for \n",
- "#Minimum and Maximum value of Beeta\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=6.0 #V, collector bias junction voltage\n",
- "Vbe=0.3 #V, base emitter voltage\n",
- "Rc=1*10**3 #Ohms, collector resistance\n",
- "Rb=10*10**3 #Ohms, base resistance\n",
- "Re=100.0 #Ohms, emitter resistance\n",
- "Beeta1=50 #current gain factor\n",
- "Beeta2=200\n",
- "Ie1=19.25*10**(-3) #A,for beeta=50, from example 7.8 \n",
- "Ie2=38.2*10**(-3) #A,for beeta=200, from example 7.8\n",
- "\n",
- "#Calculation (i)\n",
- "\n",
- "Ie1=19.25*10**(-3) #A,for beeta=50, from example 7.8 \n",
- "Vce=Vcc-(Rc+Re)*Ie1 #V, collector emitter voltage\n",
- "Icsat1=Vcc/(Rc+Re) #collector saturated current\n",
- "Vcesat1=0\n",
- "print \"The collector voltage is Vcc \",Vcc,\"V\"\n",
- "print \"The collector emitter voltage is Vce\",Vce,\"V\"\n",
- "print \"Because Collector voltage is greater than collector emitter voltage so Transistor is in saturation \"\n",
- "print \"collector saturated current is \",round(Icsat1*10**3,2),\"mA\"\n",
- "print \"collector emitter satirated voltage is\",Vcesat1,\"V\"\n",
- "\n",
- "# ii\n",
- "Icsat2=Icsat1\n",
- "Vcesat2=Vcesat1\n",
- "print \"(ii) collector saturated current is \",round(Icsat2*10**3,3),\"mA\"\n",
- "print \"collector emitter satirated voltage is\",Vcesat2,\"V\"\n",
- "\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The collector voltage is Vcc 6.0 V\n",
- "The collector emitter voltage is Vce -15.175 V\n",
- "Because Collector voltage is greater than collector emitter voltage so Transistor is in saturation \n",
- "collector saturated current is 5.45 mA\n",
- "collector emitter satirated voltage is 0 V\n",
- "(ii) collector saturated current is 5.455 mA\n",
- "collector emitter satirated voltage is 0 V\n"
- ]
- }
- ],
- "prompt_number": 48
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.10 Page No.240"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.10\n",
- "#Calculate Rb in the Biasing Circuit 7.24 so that q poin is fixed at Ic =8 mA and Vce=3 V\n",
- "#Given Circuit Data\n",
- "Vcc=9 #V,collector bias junction voltge\n",
- "Vce=3 #V,collector emittor voltage\n",
- "Re=500 #Ohms,emittor resistance\n",
- "Ic=8*10**(-3) #A,collector current\n",
- "Beeta=80\n",
- "#Calculation\n",
- "Ib=Ic/Beeta\n",
- "Rb=(Vcc-(Beeta+1)*Ib*Re)/Ib\n",
- "#Displaying The Results in Command Window\n",
- "print\"The Base Resistance is :\",round(Rb/1000,5),\"kohm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.11 Page No.242"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.11\n",
- "#Calculate DC Bias Voltages and Currents \n",
- "#in fig 7.27.\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=12.0 #V collector bias junction voltage\n",
- "Vbe=0.3 #V base emitter junction voltage\n",
- "R1=40000.0 #Ohms resistance\n",
- "R2=5000.0 #Ohms resistance\n",
- "Re=1000.0 #Ohms emitter reistance\n",
- "Rc=5000.0 #Ohms collector resistance\n",
- "Beeta=60\n",
- "\n",
- "#Calculation\n",
- "Vb=(R2/(R1+R2))*Vcc\n",
- "Ve=Vb-Vbe\n",
- "Ie=Ve/Re\n",
- "Ic=Ie\n",
- "Vc=Vcc-Ic*Rc\n",
- "Vce=Vc-Ve\n",
- "# Results \n",
- "print\" V2= Vb \",round(Vb,1),\"v\"\n",
- "print\" Ve = \",round(Ve,1),\"v\"\n",
- "print\" Ie = \",round(Ie/10**(-3),1),\"mA\"\n",
- "print\" Ic = \",round(Ic/10**(-3),1),\"mA\"\n",
- "print\" Vc = \",round(Vc,0),\"v\"\n",
- "print\" Vce = \",round(Vce,0),\"v\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.12 Page No.243"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.12\n",
- "#In fig. 7.28 Calculate Re and Vce of the given Circuit Specifications\n",
- "#thr dc resistance of the primary of the output transformer is 20 ohm\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=15.0 #V collector bias junction voltage\n",
- "R1=200.0 #Ohms resistor 1\n",
- "R2=100.0 #Ohms resistor 2\n",
- "Rc=20.0 #Ohms collector resistace\n",
- "Ic=.1 #A collector current\n",
- "\n",
- "#Calculation\n",
- "Ie=Ic\n",
- "Vb=(R2/(R1+R2))*Vcc\n",
- "Ve=Vb # Neglecting Vbe\n",
- "Re=Ve/Ie\n",
- "Vce=Vcc-(Rc+Re)*Ic\n",
- "# Results\n",
- "print\" The Emitter Resistance is Re = .\",Re,\"ohm\"\n",
- "print\" The Collector to Emitter Voltage is Vce = \",Vce,\"v\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.13 Page No.246"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.13\n",
- "#make use thevenin's theorem to Calculate accurate values of \n",
- "# Ic and Vce of the given Circuit 7.27\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=12.0 #V collector bias junction voltage\n",
- "Vbe=0.3 #V base emitter voltage\n",
- "R1=40000.0 #Ohms given resistance\n",
- "R2=5000.0 #Ohms\n",
- "Re=1000.9 #Ohms emitter resistance\n",
- "Rc=5000.0 #Ohms collector resistance\n",
- "Beeta=60\n",
- "#Calculation\n",
- "Vth=(R2/(R1+R2))*Vcc\n",
- "Rth=R1*R2/(R1+R2)\n",
- "Ib=(Vth-Vbe)/(Rth+Beeta*Re)\n",
- "Ic=Beeta*Ib\n",
- "Vce=Vcc-Ic*(Rc+Re)\n",
- "\n",
- "# Results \n",
- "print \"collector current is \",round(Ic*1000,2),\"mA\"\n",
- "print \"collector to emitter voltage = \",round(Vce,2),\"v\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 7.14 Page No.248"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 7.14\n",
- "#Calculate \n",
- "#(a)Ic\n",
- "#(b)Vce for emittor bias circuit \n",
- "#in fif 7.33\n",
- "\n",
- "#Given Circuit Data\n",
- "Vcc=12 #V collector bias junction voltage\n",
- "Vee=15.0 #V emittor bias junction voltage\n",
- "Rc=5000.0 #Ohms collector resistance\n",
- "Re=10000.0 #Ohms emitter resistance\n",
- "Rb=10000.0 #Ohms base resistance\n",
- "Beeta=100\n",
- "\n",
- "#Calculation\n",
- "Ie=Vee/Re\n",
- "Ic=Ie\n",
- "Vce=Vcc-Ic*Rc\n",
- "#Displaying The Results in Command Window\n",
- "print\" Ic = \",Ic/10**(-3),\"mA\"\n",
- "print\" Vce = \",Vce,\"v\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:a8e6eec0c3406a8b34f53cdcd04f5f3e158306e880eeefff72f3f3980fec597f"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7 :Transistor Biasing And Stabilization of Operation Point"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.1 Page No.230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=9.0 #V, collector bias junction voltage\n",
+ "Rb=300*10**3 #Ohms, , base resistance\n",
+ "Rc=2*10**3 #Ohms, collector resistance\n",
+ "Beeta=50.0 #current gain factor\n",
+ "\n",
+ "#Calculation\n",
+ "Ib=(Vcc)/Rb\n",
+ "Ic=Beeta*Ib\n",
+ "Icsat=Vcc/Rc\n",
+ "Vce=Vcc-Ic*Rc\n",
+ "\n",
+ "#Result\n",
+ "print \"a) Base current is \",Ib,\"A\"\n",
+ "print \"b) collector current is = \",Ic/10**(-3),\"mA\"\n",
+ "print \"collector saturation current is = \",Icsat/10**(-3),\"mA\"\n",
+ "if Ic < Icsat:\n",
+ " \n",
+ " print\"Since Ic < Icsat \\nSo Transistor is not in saturation\" \n",
+ "else:\n",
+ " print \"Transistor is in saturation\"\n",
+ "\n",
+ "print \"c) The collector to emitter voltage is = \",Vce,\"V\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "a) Base current is 3e-05 A\n",
+ "b) collector current is = 1.5 mA\n",
+ "collector saturation current is = 4.5 mA\n",
+ "Since Ic < Icsat \n",
+ "So Transistor is not in saturation\n",
+ "c) The collector to emitter voltage is = 6.0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.2 Page No.230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=10.0 #V, collector bias junction voltage\n",
+ "Rb=100*10**3 #Ohms, base resistance\n",
+ "Rc=1*10**3 #Ohms, collector resistance\n",
+ "Beeta=60 #current gain\n",
+ " \n",
+ "#Calculation\n",
+ "Ib=(Vcc)/Rb #A, base current\n",
+ "Ic=Beeta*Ib #A, collector current\n",
+ "Icsat=Vcc/Rc #A, collector saturated current\n",
+ "Vce=Vcc-Ic*Rc #V, collector emitter voltage\n",
+ "\n",
+ "#Result\n",
+ "print \"a) Base current is \",Ib*10**6,\"microA\"\n",
+ "print \"b) collector current is \",Ic*10**3,\"mA\"\n",
+ "print \"collector saturation current is \",Icsat*10**3,\"mA\"\n",
+ "if Ic < Icsat:\n",
+ " \n",
+ " print\"Since Ic < Icsat \\nSo Transistor is not in saturation\" \n",
+ "else:\n",
+ " print \"Transistor is in saturation\"\n",
+ "print \"c) The collector emitter voltage is \",Vce,\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "a) Base current is 100.0 microA\n",
+ "b) collector current is 6.0 mA\n",
+ "collector saturation current is 10.0 mA\n",
+ "Since Ic < Icsat \n",
+ "So Transistor is not in saturation\n",
+ "c) The collector emitter voltage is 4.0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.3 Page No.231"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=10.0 #V, collector bias junction voltage\n",
+ "Rb=100*10**3 #Ohms, Base resistance\n",
+ "Rc=1*10**3 #Ohms, collector resistance\n",
+ "Beeta=150 #current gain\n",
+ "\n",
+ "#Calculation\n",
+ "Ib=(Vcc)/Rb #Base current\n",
+ "Ic=Beeta*Ib #collector resistance\n",
+ "Icsat=Vcc/Rc #A, collector saturation current\n",
+ "Vce=0 #V, collector emitter voltage\n",
+ "\n",
+ "#Result\n",
+ "print \"collector current is Ic = \",Ic/10**(-3),\"mA\"\n",
+ "print \"collector saturated current is \",Icsat*10**3,\"mA\" \n",
+ "if Ic < Icsat:\n",
+ " \n",
+ " print\" Transistor is not in saturation.\" \n",
+ "else:\n",
+ " print \"Since Ic > Icsat \\n So Transistor is in saturation\"\n",
+ "print \"collector emitter voltage is \",Vce,\"V\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "collector current is Ic = 15.0 mA\n",
+ "collector saturated current is 10.0 mA\n",
+ "Since Ic > Icsat \n",
+ " So Transistor is in saturation\n",
+ "collector emitter voltage is 0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.4 Page No.231"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=6 #V,collector base junction voltage\n",
+ "Vbe=0.3 #V,base emittor voltage\n",
+ "Icbo=.000002 #A,colector leakage current\n",
+ "Ic=.001 #A,collector current\n",
+ "Beeta=20.0\n",
+ "\n",
+ "#Calculation\n",
+ "#Case 1: Considering Icbo and Vbe in the calculations\n",
+ "Ib=(Ic-(Beeta+1)*Icbo)/Beeta\n",
+ "print Ib\n",
+ "Rb1=(Vcc-Vbe)/Ib\n",
+ "print \"value of base resistance is =\",round(Rb1/1000,3),\"K ohm\"\n",
+ "\n",
+ "#Case 2: Neglecting Icbo and Vbe in the calculations\n",
+ "Ib2=Ic/Beeta\n",
+ "Rb2=Vcc/Ib2\n",
+ "#Percentage Error\n",
+ "E=(Rb2-Rb1)/Rb1*100\n",
+ "#Displaying The Results in Command Window\n",
+ "print\"The Base Resistance (Neglecting Icbo and Vbe) is \",Rb2/1000,\"k ohm\"\n",
+ "print\" Percentage Error is = \",round(E,3)\n",
+ "\n",
+ "#b Due to rise in temprature\n",
+ "beeta1=25.0\n",
+ "Icbo1=10.0\n",
+ "Ic1=beeta1*Ib+(beeta1+1)*Icbo1*10**-6\n",
+ "print \"Now collector current is \",round(Ic1*10**3,2),\"mA\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "4.79e-05\n",
+ "value of base resistance is = 118.998 K ohm\n",
+ "The Base Resistance (Neglecting Icbo and Vbe) is 120.0 k ohm\n",
+ " Percentage Error is = 0.842\n",
+ "Now collector current is 1.46 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.5 Page No.235"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=10.0 #V,collectoe base junction voltage\n",
+ "Rc=500.0 #Ohms,colector resistance\n",
+ "Rb=500000 #Ohms,base resistance\n",
+ "Beeta=100.0 #current gain\n",
+ "#Calculation\n",
+ "Ib=Vcc/(Rb+Beeta*Rc) #emittor currenr\n",
+ "Ic=Beeta*Ib\n",
+ "Ie=Ic\n",
+ "Vce=Vcc-Ic*Rc\n",
+ "Vc=Vce\n",
+ "\n",
+ "# Results \n",
+ "print \"emittor current is \",round(Ie*1000,1),\"mA\"\n",
+ "print\"The collector voltage is \",round(Vc,1),\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.6 Page No.235"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Given Circuit Data\n",
+ "Vcc=20.0 #V,collector base voltage\n",
+ "Rc=2000.0 #Ohms.collector resistance\n",
+ "Rb=200000.0 #Ohms,base resistance\n",
+ "Beeta1=50.0 #current gain factor\n",
+ "Beeta2=200.0\n",
+ "\n",
+ "#Calculation CASE-1: Minimum Collector Current\n",
+ "#from fig 7.14\n",
+ "Ibmin=Vcc/(Rb+Beeta1*Rc)\n",
+ "Icmin=Beeta1*Ibmin\n",
+ "#result\n",
+ "print \"minimum base curent is \",round(Ibmin,6),\"A\"\n",
+ "print \"minimum collector current is \",round(Icmin*1000,3),\"mA\"\n",
+ "#Calculation CASE-2: Maximum Collector Current\n",
+ "Ibmax=Vcc/(Rb+Beeta2*Rc)\n",
+ "Icmax=Beeta2*Ibmax\n",
+ "\n",
+ "#Results \n",
+ "print\"The maximum base current = \",round(Ibmax/10**(-3),6),\"A\"\n",
+ "print\"The Maximum Collector Current = \",round(Icmax/10**(-3),2),\"mA\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.7 Page No.238"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=10.0 #V collector junction voltage\n",
+ "Rc=2000.0 #Ohms collector resistane\n",
+ "Rb=1000000.0 #Ohms,base resistance\n",
+ "Re=1000.0 #Ohms emittor resstance\n",
+ "Beeta=100.0 #current gain\n",
+ "\n",
+ "#Calculation\n",
+ "Ib=Vcc/(Rb+(Beeta+1)*Re)\n",
+ "Ic=Beeta*Ib\n",
+ "Ie=Ic+Ib\n",
+ "#Results \n",
+ "print \" The Collector Current Ic = \",round(Ic*1000,3),\"mA\"\n",
+ "print \" The Base Current Ib .\",round(Ib*1000000,2),\"microA\"\n",
+ "print \" The Emitter Current Ie = \",round(Ie*1000,3),\"mA\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.8 Page No.239"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=6 #V,collector bias junction volage\n",
+ "Vbe=0.3 #V base emittor voltage\n",
+ "Rc=50 #Ohms collector resistance\n",
+ "Rb=10*10**3 #Ohms base resistance\n",
+ "Re=100 #Ohms emittor resistance\n",
+ "Beeta1=50 # gain factor\n",
+ "Beeta2=200\n",
+ "\n",
+ "#Calculation CASE-1: Minimum Emitter Current & corresponding Vce\n",
+ "Iemin=(Vcc-Vbe)*(Beeta1+1)/(Rb+(Beeta1+1)*Re)\n",
+ "Vcemin=Vcc-(Rc+Re)*Iemin\n",
+ "#Calculatioen CASE-2: Maximum Emitter Current & corresponding Vce\n",
+ "Iemax=(Vcc-Vbe)*(Beeta2+1)/(Rb+(Beeta2+1)*Re)\n",
+ "Vcemax=Vcc-(Rc+Re)*Iemax\n",
+ "\n",
+ "#Results \n",
+ "print\"The Minimum Emitter Current Ie(min) is\",round(Iemin*1000,2),\"mA\"\n",
+ "print \"The Corresponding Vce = V .\",round(Vcemin,1),\"v\"\n",
+ "print \"The Maximum Emitter Current Ie(max) = .\",round(Iemax*1000,1),\"mA\"\n",
+ "print \"The Corresponding Vce = V .\",round(Vcemax,1),\"v\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.9 Page No. 240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=6.0 #V, collector bias junction voltage\n",
+ "Vbe=0.3 #V, base emitter voltage\n",
+ "Rc=1*10**3 #Ohms, collector resistance\n",
+ "Rb=10*10**3 #Ohms, base resistance\n",
+ "Re=100.0 #Ohms, emitter resistance\n",
+ "Beeta1=50 #current gain factor\n",
+ "Beeta2=200\n",
+ "Ie1=19.25*10**(-3) #A,for beeta=50, from example 7.8 \n",
+ "Ie2=38.2*10**(-3) #A,for beeta=200, from example 7.8\n",
+ "\n",
+ "#Calculation (i)\n",
+ "\n",
+ "Ie1=19.25*10**(-3) #A,for beeta=50, from example 7.8 \n",
+ "Vce=Vcc-(Rc+Re)*Ie1 #V, collector emitter voltage\n",
+ "Icsat1=Vcc/(Rc+Re) #collector saturated current\n",
+ "Vcesat1=0\n",
+ "print \"The collector voltage is Vcc \",Vcc,\"V\"\n",
+ "print \"The collector emitter voltage is Vce\",Vce,\"V\"\n",
+ "print \"Because Collector voltage is greater than collector emitter voltage so Transistor is in saturation \"\n",
+ "print \"collector saturated current is \",round(Icsat1*10**3,2),\"mA\"\n",
+ "print \"collector emitter satirated voltage is\",Vcesat1,\"V\"\n",
+ "\n",
+ "# ii\n",
+ "Icsat2=Icsat1\n",
+ "Vcesat2=Vcesat1\n",
+ "print \"(ii) collector saturated current is \",round(Icsat2*10**3,3),\"mA\"\n",
+ "print \"collector emitter satirated voltage is\",Vcesat2,\"V\"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The collector voltage is Vcc 6.0 V\n",
+ "The collector emitter voltage is Vce -15.175 V\n",
+ "Because Collector voltage is greater than collector emitter voltage so Transistor is in saturation \n",
+ "collector saturated current is 5.45 mA\n",
+ "collector emitter satirated voltage is 0 V\n",
+ "(ii) collector saturated current is 5.455 mA\n",
+ "collector emitter satirated voltage is 0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.10 Page No.240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=9 #V,collector bias junction voltge\n",
+ "Vce=3 #V,collector emittor voltage\n",
+ "Re=500 #Ohms,emittor resistance\n",
+ "Ic=8*10**(-3) #A,collector current\n",
+ "Beeta=80\n",
+ "#Calculation\n",
+ "Ib=Ic/Beeta\n",
+ "Rb=(Vcc-(Beeta+1)*Ib*Re)/Ib\n",
+ "#Displaying The Results in Command Window\n",
+ "print\"The Base Resistance is :\",round(Rb/1000,5),\"kohm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.11 Page No.242"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=12.0 #V collector bias junction voltage\n",
+ "Vbe=0.3 #V base emitter junction voltage\n",
+ "R1=40000.0 #Ohms resistance\n",
+ "R2=5000.0 #Ohms resistance\n",
+ "Re=1000.0 #Ohms emitter reistance\n",
+ "Rc=5000.0 #Ohms collector resistance\n",
+ "Beeta=60\n",
+ "\n",
+ "#Calculation\n",
+ "Vb=(R2/(R1+R2))*Vcc\n",
+ "Ve=Vb-Vbe\n",
+ "Ie=Ve/Re\n",
+ "Ic=Ie\n",
+ "Vc=Vcc-Ic*Rc\n",
+ "Vce=Vc-Ve\n",
+ "# Results \n",
+ "print\" V2= Vb \",round(Vb,1),\"v\"\n",
+ "print\" Ve = \",round(Ve,1),\"v\"\n",
+ "print\" Ie = \",round(Ie/10**(-3),1),\"mA\"\n",
+ "print\" Ic = \",round(Ic/10**(-3),1),\"mA\"\n",
+ "print\" Vc = \",round(Vc,0),\"v\"\n",
+ "print\" Vce = \",round(Vce,0),\"v\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.12 Page No.243"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=15.0 #V collector bias junction voltage\n",
+ "R1=200.0 #Ohms resistor 1\n",
+ "R2=100.0 #Ohms resistor 2\n",
+ "Rc=20.0 #Ohms collector resistace\n",
+ "Ic=.1 #A collector current\n",
+ "\n",
+ "#Calculation\n",
+ "Ie=Ic\n",
+ "Vb=(R2/(R1+R2))*Vcc\n",
+ "Ve=Vb # Neglecting Vbe\n",
+ "Re=Ve/Ie\n",
+ "Vce=Vcc-(Rc+Re)*Ic\n",
+ "# Results\n",
+ "print\" The Emitter Resistance is Re = .\",Re,\"ohm\"\n",
+ "print\" The Collector to Emitter Voltage is Vce = \",Vce,\"v\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.13 Page No.246"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=12.0 #V collector bias junction voltage\n",
+ "Vbe=0.3 #V base emitter voltage\n",
+ "R1=40000.0 #Ohms given resistance\n",
+ "R2=5000.0 #Ohms\n",
+ "Re=1000.9 #Ohms emitter resistance\n",
+ "Rc=5000.0 #Ohms collector resistance\n",
+ "Beeta=60\n",
+ "#Calculation\n",
+ "Vth=(R2/(R1+R2))*Vcc\n",
+ "Rth=R1*R2/(R1+R2)\n",
+ "Ib=(Vth-Vbe)/(Rth+Beeta*Re)\n",
+ "Ic=Beeta*Ib\n",
+ "Vce=Vcc-Ic*(Rc+Re)\n",
+ "\n",
+ "# Results \n",
+ "print \"collector current is \",round(Ic*1000,2),\"mA\"\n",
+ "print \"collector to emitter voltage = \",round(Vce,2),\"v\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.14 Page No.248"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=12 #V collector bias junction voltage\n",
+ "Vee=15.0 #V emittor bias junction voltage\n",
+ "Rc=5000.0 #Ohms collector resistance\n",
+ "Re=10000.0 #Ohms emitter resistance\n",
+ "Rb=10000.0 #Ohms base resistance\n",
+ "Beeta=100\n",
+ "\n",
+ "#Calculation\n",
+ "Ie=Vee/Re\n",
+ "Ic=Ie\n",
+ "Vce=Vcc-Ic*Rc\n",
+ "#Displaying The Results in Command Window\n",
+ "print\" Ic = \",Ic/10**(-3),\"mA\"\n",
+ "print\" Vce = \",Vce,\"v\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch8.ipynb b/Basic_Electronics_and_Linear_Circuits/ch8.ipynb
index a1e1a167..0309b1db 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch8.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch8.ipynb
@@ -1,575 +1,561 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 8:Small Signal Amplifiers"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 8.1 Page no.271"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 8.1\n",
- "#Refer Figure 8.15 and 8.16 in the Textbook\n",
- "#Program to find the Hybrid Parameters from the given Transistor Characteristics\n",
- "\n",
- "#Given Circuit Data\n",
- "Ic=2*10**(-3) #A, collector current\n",
- "Vce=8.5 #V, collectoe emitter voltage\n",
- "\n",
- "#Calculation\n",
- "#hfe=delta(ic)/delta(ib), #forward current ratio in CE mode\n",
- "#Vce=constant #collector emitter voltage\n",
- "hfe=(2.7-1.7)*10**(-3)/((20-10)*10**(-6))\n",
- "#hoe=delta(ic)/delta(Vce), #output admittance in CE mode\n",
- "#ib=constant\n",
- "hoe=(2.2-2.1)*10**(-3)/(10-7)\n",
- "#hie=delta(Vbe)/delta(ib), #dynamic input resistance\n",
- "#Vce=constant\n",
- "hie=(0.73-0.715)/((20-10)*10**(-6))\n",
- "#hre=delta(Vbe)/delta(Vce),ib=constant #reverse voltage ratio in CE mode\n",
- "hre=(0.73-0.72)/(20-0)\n",
- "\n",
- "#Result\n",
- "print \"hfe = \",hfe\n",
- "print \"hoe = \",round(hoe/10**(-6),2),\"microS\"\n",
- "print \"hie = \",hie/10**3,\"kohm\"\n",
- "print \"hre = \",hre\n",
- "\n",
- "#a) Plot\n",
- "#Load Line \n",
- "Vce0=[0,15]\n",
- "Ic0=[5,0]\n",
- "a0=plot(Vce0,Ic0)\n",
- "q1=plot(8.5,2.1,label='Q point',marker='o')\n",
- "legend()\n",
- "# AT Ib=0 microA\n",
- "Vce1=[0,1,15]\n",
- "Ic1=[0,0.2,0.7]\n",
- "a1=plot(Vce1,Ic1)\n",
- "# AT Ib=10 microA\n",
- "Vce2=[0,1,15]\n",
- "Ic2=[0,1.2,1.9]\n",
- "a2=plot(Vce2,Ic2)\n",
- "# AT Ib=20 microA\n",
- "Vce3=[0,1,15]\n",
- "Ic3=[0,2.2,3]\n",
- "a3=plot(Vce3,Ic3)\n",
- "# AT Ib=30 microA\n",
- "Vce4=[0,1,15]\n",
- "Ic4=[0,3.1,4.1]\n",
- "a4=plot(Vce4,Ic4)\n",
- "# AT Ib=40 microA\n",
- "Vce5=[0,1,15]\n",
- "Ic5=[0,4.1,5]\n",
- "a5=plot(Vce5,Ic5)\n",
- "# AT Ib=50 microA\n",
- "Vce6=[0,1,15]\n",
- "Ic6=[0,5.1,6.1]\n",
- "a6=plot(Vce6,Ic6)\n",
- "# AT Ib=60 microA\n",
- "Vce7=[0,1,15]\n",
- "Ic7=[0,6.1,7.2]\n",
- "a7=plot(Vce7,Ic7)\n",
- "#At Vce=8.5 V\n",
- "Vce8=[0,15]\n",
- "Ice8=[2.7,2.7]\n",
- "a8=plot(Vce8,Ice8)\n",
- "\n",
- "Vce9=[0,15]\n",
- "Ice9=[1.7,1.7]\n",
- "a9=plot(Vce9,Ice9)\n",
- "#at Vce=8.5\n",
- "Vce10=[8.5,8.5]\n",
- "Ice10=[0,3]\n",
- "a10=plot(Vce10,Ice10)\n",
- "xlim(0,18)\n",
- "ylim(0,8)\n",
- "xlabel(\"$Vce(volt)$\")\n",
- "ylabel(\"$Ic(mA)$\")\n",
- "show(q1)\n",
- "show(a0)\n",
- "show(a1)\n",
- "show(a2)\n",
- "show(a3)\n",
- "show(a4)\n",
- "show(a5)\n",
- "show(a6)\n",
- "show(a7)\n",
- "show(a8)\n",
- "show(a9)\n",
- "show(a10)\n",
- "\n",
- "#(b) Plot\n",
- "#Plot\n",
- "#Load Line \n",
- "Vce0=[0,15]\n",
- "Ic0=[5,0]\n",
- "a0=plot(Vce0,Ic0)\n",
- "# AT Ib=0 microA\n",
- "Vce1=[0,1,15]\n",
- "Ic1=[0,0.2,0.7]\n",
- "a1=plot(Vce1,Ic1)\n",
- "# AT Ib=10 microA\n",
- "Vce2=[0,1,15]\n",
- "Ic2=[0,1.2,1.9]\n",
- "a2=plot(Vce2,Ic2)\n",
- "# AT Ib=20 microA\n",
- "Vce3=[0,1,15]\n",
- "Ic3=[0,2.2,3]\n",
- "a3=plot(Vce3,Ic3)\n",
- "# AT Ib=30 microA\n",
- "Vce4=[0,1,15]\n",
- "Ic4=[0,3.1,4.1]\n",
- "a4=plot(Vce4,Ic4)\n",
- "# AT Ib=40 microA\n",
- "Vce5=[0,1,15]\n",
- "Ic5=[0,4.1,5]\n",
- "a5=plot(Vce5,Ic5)\n",
- "# AT Ib=50 microA\n",
- "Vce6=[0,1,15]\n",
- "Ic6=[0,5.1,6.1]\n",
- "a6=plot(Vce6,Ic6)\n",
- "# AT Ib=60 microA\n",
- "Vce7=[0,1,15]\n",
- "Ic7=[0,6.1,7.2]\n",
- "a7=plot(Vce7,Ic7)\n",
- "\n",
- "#At Vce=8.5 V\n",
- "Vce8=[0,8.5,10]\n",
- "Ice8=[2.2,2.2,2.15]\n",
- "a8=plot(Vce8,Ice8)\n",
- "# and\n",
- "Vce9=[0,8.5,10]\n",
- "Ice9=[2.1,2.1,2.15]\n",
- "a9=plot(Vce9,Ice9)\n",
- "#at Vce=8.5\n",
- "Vce10=[8.5,8.5]\n",
- "Ice10=[0,2.2]\n",
- "a10=plot(Vce10,Ice10)\n",
- "\n",
- "#at Vce=7 V\n",
- "Vce11=[7,7]\n",
- "Ice11=[0,2.5]\n",
- "a11=plot(Vce11,Ice11)\n",
- "#at Vce=10 V\n",
- "Vce12=[10,10]\n",
- "Ice12=[0,2.2]\n",
- "a12=plot(Vce12,Ice12)\n",
- "\n",
- "q2=plot(8.5,2.15,marker='o',label='Q point')\n",
- "legend()\n",
- "\n",
- "xlim(0,18)\n",
- "ylim(0,8)\n",
- "xlabel(\"$Vce(volt)$\")\n",
- "ylabel(\"$Ic(mA)$\")\n",
- "show(a0)\n",
- "show(q2)\n",
- "show(a1)\n",
- "show(a2)\n",
- "show(a3)\n",
- "show(a4)\n",
- "show(a5)\n",
- "show(a6)\n",
- "show(a7)\n",
- "show(a8)\n",
- "show(a9)\n",
- "show(a10)\n",
- "show(a11)\n",
- "show(a12)\n",
- "\n",
- "#C) plot\n",
- "#at Vce=0 V\n",
- "Vbe1=[0.715,0.730,0.735]\n",
- "Ib1=[10,20,30]\n",
- "ab1=plot(Vbe1,Ib1)\n",
- "q3=plot(0.722,15,marker='o',label='Q Point')\n",
- "legend()\n",
- "\n",
- "#at Vce=8.5 V\n",
- "Vbe2=[0.710,0.715,0.730,0.735]\n",
- "Ib2=[5,10,20,26]\n",
- "ab2=plot(Vbe2,Ib2)\n",
- "\n",
- "#at Vce=20 V\n",
- "Vbe3=[0.6,0.715,0.730,0.740]\n",
- "Ib3=[0,10,15,22]\n",
- "ab3=plot(Vbe3,Ib3)\n",
- "\n",
- "#at Ib=10 microA\n",
- "Vbe4=[0,0.7,0.75]\n",
- "Ib4=[10,10,10]\n",
- "ab4=plot(Vbe4,Ib4)\n",
- "\n",
- "#at Ib=15 microA\n",
- "Vbe5=[0,0.7,0.75]\n",
- "Ib5=[15,15,15]\n",
- "ab5=plot(Vbe5,Ib5)\n",
- "#at Ib=20microA\n",
- "Vbe6=[0,0.7,0.75]\n",
- "Ib6=[20,20,20]\n",
- "ab6=plot(Vbe6,Ib6)\n",
- " \n",
- "xlim(0,0.8)\n",
- "ylim(0,35)\n",
- "xlabel(\"$Vbe(volt)$\")\n",
- "ylabel(\"$Ib(microA)$\")\n",
- "show(ab1)\n",
- "show(q3)\n",
- "show(ab2)\n",
- "show(ab3)\n",
- "show(ab4)\n",
- "show(ab5)\n",
- "show(ab6)\n",
- "\n",
- "#d) plot\n",
- "#at Vce=0 V\n",
- "Vbe1=[0.6,0.7,0.72,0.73]\n",
- "Ib1=[0,6,15,30]\n",
- "ab_1=plot(Vbe1,Ib1)\n",
- "q4=plot(0.72,15,marker='o',label='$Q Point$')\n",
- "legend()\n",
- "#Vce=20 V\n",
- "Vbe2=[0.6,0.7,0.72,0.73,0.74]\n",
- "Ib2=[0,6,10,15,28]\n",
- "ab_2=plot(Vbe2,Ib2)\n",
- "#At Ib=15 microA\n",
- "Vbe3=[0,0.72,0.73]\n",
- "Ib3=[15,15,15]\n",
- "ab_3=plot(Vbe3,Ib3)\n",
- "\n",
- "#At Vbe=0.72\n",
- "Vbe4=[0.72,0.72]\n",
- "Ib4=[0,15]\n",
- "ab_4=plot(Vbe4,Ib4)\n",
- "#At Vbe=0.73\n",
- "Vbe5=[0.73,0.73]\n",
- "Ib5=[0,15]\n",
- "ab_5=plot(Vbe5,Ib5)\n",
- "\n",
- "xlim(0,0.8)\n",
- "ylim(0,35)\n",
- "xlabel(\"$Vbe(volt)$\")\n",
- "ylabel(\"$Ib(microA)$\")\n",
- "show(ab_1)\n",
- "show(q4)\n",
- "show(ab_2)\n",
- "show(ab_3)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "hfe = 100.0\n",
- "hoe = 33.33 microS\n",
- "hie = 1.5 kohm\n",
- "hre = 0.0005\n"
- ]
- },
- {
- "output_type": "display_data",
- "png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAESCAYAAAD0aQL3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AA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nfv37YtWsXJElC37590djYqN3GiBEjsH37dkyYMAEA\nEBYWhvT0dNx///0AgIKCAnh4eODIkSOIjY0FABQVFWmL4Yba2lpj/MhEemFBUJfn7u6OsrIyWFlZ\nwdnZGRUVFejTpw/Ky8thY2ODnj17wtHREcnJyZg0aRJGjRqF4uJiWFtbt9hOcXExvL29cfToUQwf\nPhz19fXo2bMnAGDbtm2YM2cOjh49ipiYGPz444/asjhy5Ii2GKys+CtJpsPkbjlKJIe77roLycnJ\nAIApU6Zg165dqKiowPr16wEAM2fOxDvvvANbW1tUVFRg2rRp2juy3TB69Ghs27YN7u7uiImJ0d6h\n78SJE5g2bRr69++PkJAQ/Pzzz0hLS0N+fj6ysrIQEhICJycnCCFue+tHIjnwfhBEbbRq1SqkpaV1\n2C1af/nlF5w+fRozZ87skO0RtRePZ4naaP78+fjiiy86bHs//PCD9n7BRKaABUHURu7u7hg0aBAu\nXrzY7m1lZ2dj7NixnIMgk8IhJiIi0olvV4iISCcWBBER6cSCICIinVgQRESkEwuCiIh0YkEQEZFO\nLAgiItKJBUFERDr9f+uLfdE892zcAAAAAElFTkSuQmCC\n"
- },
- {
- "output_type": "display_data",
- "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAESCAYAAADnvkIDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlYlOXCP/DvCKi4xL6oSOooJaAwiaCFMkhIgBGmaVZE\nSb6dzvFY2Xl9tV4Lu87P8KTHVDpvVqioSYtLGhxxH465gooaahKKWywakOyy3L8/iAlkzGGYmWcG\nvp/r8hIehme+TjFf7vt+FpkQQoCIiOgu3aQOQEREpokFQUREGrEgiIhIIxYEERFpxIIgIiKNWBBE\nRKSR0QuipqYGAQEB8PX1haenJxYsWAAAiI+Ph5ubGxQKBRQKBdLT040djYiIWpBJcR5EVVUVevXq\nhfr6egQGBmLp0qXYt28f+vbti7lz5xo7DhERaSDJFFOvXr0AAHfu3EFDQwPs7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/cPv2bfXl1MPDw9G/f3/MmjULrq6uAID6\n+npJXgMiTVgQ1OU1jyC2b9+OqKgonDx5EkFBQQCaFrHt7Ozw7bffYtiwYUhNTYVMJsPQoUNRV1en\n3sfYsWPx7bffIjw8HADg5eWF5ORkPP/88wCAK1euwNbWFpmZmfD39wcAFBYWqouhWVVVlTH+yURa\nYUFQl2djY4OSkhJ069YNvXv3RllZGYYMGYLS0lJYWlrC3d0d1tbWiIqKwqRJkzBu3DgUFRXBwsKi\n1X6Kiorg4OCArKwsjBkzBrW1tXB3dwcAbN68GTExMcjKyoKfnx8OHDigLovMzEx1MXTrxh9JMh0m\nd8tRIik89thjiIqKAgBMnjwZqampKCsrw+rVqwEA06dPx4oVK2BlZYWysjJMnTpVfUe2ZuPHj8fm\nzZthY2MDPz8/9R36srOzMXXqVHh4eEAul+P7779HXFwc8vPzceLECcjlcvTq1QtCiHve+pFICrwf\nBJGOli5diri4OL3dovX06dO4cOECpk+frpf9EXUUx7NEOpo1axa++eYbve1v37596vsFE5kCFgSR\njmxsbDB8+HBcvXq1w/vKyclBSEgI1yDIpHCKiYiINOKvK0REpBELgoiINGJBEBGRRiwIIiLSiAVB\nREQasSCIiEgjFgQREWnEgiAiIo3+P8ixPOMqV0GTAAAAAElFTkSuQmCC\n"
- }
- ],
- "prompt_number": 50
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 8.2 Page no.276"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 8.2 (a)\n",
- "# find the Input Impedance of the Amplifier\n",
- "\n",
- "#Given Circuit Data\n",
- "ri=2000.0 #Ohms, input resistance\n",
- "Rb=150000.0 #Ohms, base resistance\n",
- "\n",
- "#Calculation\n",
- "Zin=Rb*ri/(Rb+ri)\n",
- "\n",
- "#result\n",
- "print \" The Input Impedance of the Amplifier is Zin = \",round(Zin/10**3,3),\"kohm\"\n",
- "\n",
- "#(b)find the voltage gain (Av)\n",
- "Beeta=100\n",
- "ri=2000.0 #Ohms\n",
- "Rac=5000.0 #Ohms Resistance on outputside\n",
- "\n",
- "#Calculation\n",
- "\n",
- "Av=Beeta*Rac/ri\n",
- "#result\n",
- "\n",
- "print \" The Voltage Gain of the Amplifier with phase of pi/2 is \",Av\n",
- "#(c) find the current gain (Ai)\n",
- "#Let input Current ib=2A\n",
- "ib=2 #A, Assumption\n",
- "io=100*ib \n",
- "\n",
- "#Calculation\n",
- "Ai=io/ib # Current Gain\n",
- "#result\n",
- "print \"The Current Gain of the Amplifier is Ai = \",Ai"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Input Impedance of the Amplifier is Zin = 1.974 kohm\n",
- " The Voltage Gain of the Amplifier with phase of pi/2 is 250.0\n",
- "The Current Gain of the Amplifier is Ai = 100\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 8.3 Page no.277"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 8.3 (a)\n",
- "#Program to find the Voltage Gain of the Amplifier\n",
- "\n",
- "#Given Circuit Data\n",
- "Bac=150.0 #ac current gain\n",
- "rin=2000.0 #Ohms, input resistance\n",
- "R1=4700.00 #Ohms, resistance\n",
- "R2=12000.0 #Ohms resistance\n",
- "\n",
- "#Calculation\n",
- "Rac=R1*R2/(R1+R2) # ohm , resistance\n",
- "Av=Bac*Rac/rin\n",
- "#result\n",
- "print \"a\"\n",
- "print \"the Voltage Gain of the Amplifier with phase of pi/2 is\",round(Av,1)\n",
- "\n",
- "#(b)find input impedance\n",
- "R3=75000.0 #Ohms\n",
- "R4=7500.00 #Ohms\n",
- "\n",
- "#Calculation\n",
- "Zin=R3*R4*rin/(R3*R4+R4*rin+rin*R3)\n",
- "\n",
- "#result\n",
- "print \"b\"\n",
- "print \"The Input Impedance of the Amplifier is Zin = \",round(Zin/10**3,1),\"kohm\"\n",
- "\n",
- "#(c)Q point\n",
- "\n",
- "Vcc=15 #V\n",
- "R1=75000.0 #Ohms\n",
- "R2=7500.00 #Ohms\n",
- "Rc=4700.0 #Ohms\n",
- "Re=1200.0 #Ohms\n",
- "\n",
- "#Calculation\n",
- "Vb=Vcc*R2/(R1+R2) #V, base voltage\n",
- "Ve=Vb\n",
- "Ie=Ve/Re #A, emitter current\n",
- "Vce=Vcc-(Rc+Re)*Ie #V, collector emitter voltage\n",
- "#result\n",
- "print \"c\"\n",
- "print \"voltage at the base is \",round(Vb,2),\"V\"\n",
- "print \"Emitter current is \",round(Ie/10**(-3),2),\"mA\"\n",
- "print \"The collector to emitter voltage is\",round(Vce,2),\"v\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "a\n",
- "the Voltage Gain of the Amplifier with phase of pi/2 is 253.3\n",
- "b\n",
- "The Input Impedance of the Amplifier is Zin = 1.5 kohm\n",
- "c\n",
- "voltage at the base is 1.36 V\n",
- "Emitter current is 1.14 mA\n",
- "The collector to emitter voltage is 8.3 v\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 8.4 Page no.283"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 8.4\n",
- "# find the Voltage Gain of the Amplifier\n",
- "\n",
- "#Given Circuit Data\n",
- "u=20 #amplification factor\n",
- "Rl=10*10**3 #Ohms, load resistance\n",
- "rp=10*10**3 #Ohms, resistance\n",
- "#Calculation\n",
- "A=u*Rl/(rp+Rl) #V, voltage gain\n",
- "#result\n",
- "print \" The Voltage Gain of the Amplifier with phase of pi/2 is\",A"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 8.5 Page no.286"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 8.5\n",
- "# find the Gain of the Amplifier\n",
- "\n",
- "#Given Circuit Data\n",
- "gm=3000*10**(-6) #S, transconductance\n",
- "Rl=22*10**3 #Ohms, resistance\n",
- "rp=300*10**3 #Ohms, resistance \n",
- "\n",
- "#Calculation\n",
- "#A=-(gm*Rl/(1+(Rl/rp))), For rp>>Rl we get\n",
- "A=gm*Rl #with Phase of 180 degrees\n",
- "# Results \n",
- "print \"The Gain of the Amplifier with phase of pi/2 is\",A"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Gain of the Amplifier with phase of pi/2 is 66.0\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 8.6 Page no.286"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 8.6\n",
- "#find the Output Signal Voltage of the Amplifier\n",
- "\n",
- "#Given Circuit Data\n",
- "Rl=12000.0 #Ohms, load resistance\n",
- "Rg=1000000.0 #Ohms, given resistance\n",
- "Rs=1*10**3 #Ohms, given resistance\n",
- "Cs=25*10**(-6) #F. capacitance\n",
- "u=20 #amplification factor\n",
- "rd=10**5 #Ohms, dynamic drain resistance\n",
- "vi=0.1 #V, input voltage\n",
- "f=1*10**3 #Hz, frequency\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "Xcs=1/(2*math.pi*f*Cs)\n",
- "#As Xcs comes out to be much smaller than Rs, Rs is completely bypassed\n",
- "A=u*Rl/(Rl+rd)\n",
- "vo=A*vi\n",
- "# Result\n",
- "print \" The Output Signal Voltage of the Amplifier is vo = \",round(vo,3),\"v\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Output Signal Voltage of the Amplifier is vo = 0.214 v\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:49ff0cb528d7e276dc193290984b83a2a7d93cab62d6ab90be1af99e7320d3ef"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8:Small Signal Amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.1 Page no.271"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Ic=2*10**(-3) #A, collector current\n",
+ "Vce=8.5 #V, collectoe emitter voltage\n",
+ "\n",
+ "#Calculation\n",
+ "#hfe=delta(ic)/delta(ib), #forward current ratio in CE mode\n",
+ "#Vce=constant #collector emitter voltage\n",
+ "hfe=(2.7-1.7)*10**(-3)/((20-10)*10**(-6))\n",
+ "#hoe=delta(ic)/delta(Vce), #output admittance in CE mode\n",
+ "#ib=constant\n",
+ "hoe=(2.2-2.1)*10**(-3)/(10-7)\n",
+ "#hie=delta(Vbe)/delta(ib), #dynamic input resistance\n",
+ "#Vce=constant\n",
+ "hie=(0.73-0.715)/((20-10)*10**(-6))\n",
+ "#hre=delta(Vbe)/delta(Vce),ib=constant #reverse voltage ratio in CE mode\n",
+ "hre=(0.73-0.72)/(20-0)\n",
+ "\n",
+ "#Result\n",
+ "print \"hfe = \",hfe\n",
+ "print \"hoe = \",round(hoe/10**(-6),2),\"microS\"\n",
+ "print \"hie = \",hie/10**3,\"kohm\"\n",
+ "print \"hre = \",hre\n",
+ "\n",
+ "#a) Plot\n",
+ "#Load Line \n",
+ "Vce0=[0,15]\n",
+ "Ic0=[5,0]\n",
+ "a0=plot(Vce0,Ic0)\n",
+ "q1=plot(8.5,2.1,label='Q point',marker='o')\n",
+ "legend()\n",
+ "# AT Ib=0 microA\n",
+ "Vce1=[0,1,15]\n",
+ "Ic1=[0,0.2,0.7]\n",
+ "a1=plot(Vce1,Ic1)\n",
+ "# AT Ib=10 microA\n",
+ "Vce2=[0,1,15]\n",
+ "Ic2=[0,1.2,1.9]\n",
+ "a2=plot(Vce2,Ic2)\n",
+ "# AT Ib=20 microA\n",
+ "Vce3=[0,1,15]\n",
+ "Ic3=[0,2.2,3]\n",
+ "a3=plot(Vce3,Ic3)\n",
+ "# AT Ib=30 microA\n",
+ "Vce4=[0,1,15]\n",
+ "Ic4=[0,3.1,4.1]\n",
+ "a4=plot(Vce4,Ic4)\n",
+ "# AT Ib=40 microA\n",
+ "Vce5=[0,1,15]\n",
+ "Ic5=[0,4.1,5]\n",
+ "a5=plot(Vce5,Ic5)\n",
+ "# AT Ib=50 microA\n",
+ "Vce6=[0,1,15]\n",
+ "Ic6=[0,5.1,6.1]\n",
+ "a6=plot(Vce6,Ic6)\n",
+ "# AT Ib=60 microA\n",
+ "Vce7=[0,1,15]\n",
+ "Ic7=[0,6.1,7.2]\n",
+ "a7=plot(Vce7,Ic7)\n",
+ "#At Vce=8.5 V\n",
+ "Vce8=[0,15]\n",
+ "Ice8=[2.7,2.7]\n",
+ "a8=plot(Vce8,Ice8)\n",
+ "\n",
+ "Vce9=[0,15]\n",
+ "Ice9=[1.7,1.7]\n",
+ "a9=plot(Vce9,Ice9)\n",
+ "#at Vce=8.5\n",
+ "Vce10=[8.5,8.5]\n",
+ "Ice10=[0,3]\n",
+ "a10=plot(Vce10,Ice10)\n",
+ "xlim(0,18)\n",
+ "ylim(0,8)\n",
+ "xlabel(\"$Vce(volt)$\")\n",
+ "ylabel(\"$Ic(mA)$\")\n",
+ "show(q1)\n",
+ "show(a0)\n",
+ "show(a1)\n",
+ "show(a2)\n",
+ "show(a3)\n",
+ "show(a4)\n",
+ "show(a5)\n",
+ "show(a6)\n",
+ "show(a7)\n",
+ "show(a8)\n",
+ "show(a9)\n",
+ "show(a10)\n",
+ "\n",
+ "#(b) Plot\n",
+ "#Plot\n",
+ "#Load Line \n",
+ "Vce0=[0,15]\n",
+ "Ic0=[5,0]\n",
+ "a0=plot(Vce0,Ic0)\n",
+ "# AT Ib=0 microA\n",
+ "Vce1=[0,1,15]\n",
+ "Ic1=[0,0.2,0.7]\n",
+ "a1=plot(Vce1,Ic1)\n",
+ "# AT Ib=10 microA\n",
+ "Vce2=[0,1,15]\n",
+ "Ic2=[0,1.2,1.9]\n",
+ "a2=plot(Vce2,Ic2)\n",
+ "# AT Ib=20 microA\n",
+ "Vce3=[0,1,15]\n",
+ "Ic3=[0,2.2,3]\n",
+ "a3=plot(Vce3,Ic3)\n",
+ "# AT Ib=30 microA\n",
+ "Vce4=[0,1,15]\n",
+ "Ic4=[0,3.1,4.1]\n",
+ "a4=plot(Vce4,Ic4)\n",
+ "# AT Ib=40 microA\n",
+ "Vce5=[0,1,15]\n",
+ "Ic5=[0,4.1,5]\n",
+ "a5=plot(Vce5,Ic5)\n",
+ "# AT Ib=50 microA\n",
+ "Vce6=[0,1,15]\n",
+ "Ic6=[0,5.1,6.1]\n",
+ "a6=plot(Vce6,Ic6)\n",
+ "# AT Ib=60 microA\n",
+ "Vce7=[0,1,15]\n",
+ "Ic7=[0,6.1,7.2]\n",
+ "a7=plot(Vce7,Ic7)\n",
+ "\n",
+ "#At Vce=8.5 V\n",
+ "Vce8=[0,8.5,10]\n",
+ "Ice8=[2.2,2.2,2.15]\n",
+ "a8=plot(Vce8,Ice8)\n",
+ "# and\n",
+ "Vce9=[0,8.5,10]\n",
+ "Ice9=[2.1,2.1,2.15]\n",
+ "a9=plot(Vce9,Ice9)\n",
+ "#at Vce=8.5\n",
+ "Vce10=[8.5,8.5]\n",
+ "Ice10=[0,2.2]\n",
+ "a10=plot(Vce10,Ice10)\n",
+ "\n",
+ "#at Vce=7 V\n",
+ "Vce11=[7,7]\n",
+ "Ice11=[0,2.5]\n",
+ "a11=plot(Vce11,Ice11)\n",
+ "#at Vce=10 V\n",
+ "Vce12=[10,10]\n",
+ "Ice12=[0,2.2]\n",
+ "a12=plot(Vce12,Ice12)\n",
+ "\n",
+ "q2=plot(8.5,2.15,marker='o',label='Q point')\n",
+ "legend()\n",
+ "\n",
+ "xlim(0,18)\n",
+ "ylim(0,8)\n",
+ "xlabel(\"$Vce(volt)$\")\n",
+ "ylabel(\"$Ic(mA)$\")\n",
+ "show(a0)\n",
+ "show(q2)\n",
+ "show(a1)\n",
+ "show(a2)\n",
+ "show(a3)\n",
+ "show(a4)\n",
+ "show(a5)\n",
+ "show(a6)\n",
+ "show(a7)\n",
+ "show(a8)\n",
+ "show(a9)\n",
+ "show(a10)\n",
+ "show(a11)\n",
+ "show(a12)\n",
+ "\n",
+ "#C) plot\n",
+ "#at Vce=0 V\n",
+ "Vbe1=[0.715,0.730,0.735]\n",
+ "Ib1=[10,20,30]\n",
+ "ab1=plot(Vbe1,Ib1)\n",
+ "q3=plot(0.722,15,marker='o',label='Q Point')\n",
+ "legend()\n",
+ "\n",
+ "#at Vce=8.5 V\n",
+ "Vbe2=[0.710,0.715,0.730,0.735]\n",
+ "Ib2=[5,10,20,26]\n",
+ "ab2=plot(Vbe2,Ib2)\n",
+ "\n",
+ "#at Vce=20 V\n",
+ "Vbe3=[0.6,0.715,0.730,0.740]\n",
+ "Ib3=[0,10,15,22]\n",
+ "ab3=plot(Vbe3,Ib3)\n",
+ "\n",
+ "#at Ib=10 microA\n",
+ "Vbe4=[0,0.7,0.75]\n",
+ "Ib4=[10,10,10]\n",
+ "ab4=plot(Vbe4,Ib4)\n",
+ "\n",
+ "#at Ib=15 microA\n",
+ "Vbe5=[0,0.7,0.75]\n",
+ "Ib5=[15,15,15]\n",
+ "ab5=plot(Vbe5,Ib5)\n",
+ "#at Ib=20microA\n",
+ "Vbe6=[0,0.7,0.75]\n",
+ "Ib6=[20,20,20]\n",
+ "ab6=plot(Vbe6,Ib6)\n",
+ " \n",
+ "xlim(0,0.8)\n",
+ "ylim(0,35)\n",
+ "xlabel(\"$Vbe(volt)$\")\n",
+ "ylabel(\"$Ib(microA)$\")\n",
+ "show(ab1)\n",
+ "show(q3)\n",
+ "show(ab2)\n",
+ "show(ab3)\n",
+ "show(ab4)\n",
+ "show(ab5)\n",
+ "show(ab6)\n",
+ "\n",
+ "#d) plot\n",
+ "#at Vce=0 V\n",
+ "Vbe1=[0.6,0.7,0.72,0.73]\n",
+ "Ib1=[0,6,15,30]\n",
+ "ab_1=plot(Vbe1,Ib1)\n",
+ "q4=plot(0.72,15,marker='o',label='$Q Point$')\n",
+ "legend()\n",
+ "#Vce=20 V\n",
+ "Vbe2=[0.6,0.7,0.72,0.73,0.74]\n",
+ "Ib2=[0,6,10,15,28]\n",
+ "ab_2=plot(Vbe2,Ib2)\n",
+ "#At Ib=15 microA\n",
+ "Vbe3=[0,0.72,0.73]\n",
+ "Ib3=[15,15,15]\n",
+ "ab_3=plot(Vbe3,Ib3)\n",
+ "\n",
+ "#At Vbe=0.72\n",
+ "Vbe4=[0.72,0.72]\n",
+ "Ib4=[0,15]\n",
+ "ab_4=plot(Vbe4,Ib4)\n",
+ "#At Vbe=0.73\n",
+ "Vbe5=[0.73,0.73]\n",
+ "Ib5=[0,15]\n",
+ "ab_5=plot(Vbe5,Ib5)\n",
+ "\n",
+ "xlim(0,0.8)\n",
+ "ylim(0,35)\n",
+ "xlabel(\"$Vbe(volt)$\")\n",
+ "ylabel(\"$Ib(microA)$\")\n",
+ "show(ab_1)\n",
+ "show(q4)\n",
+ "show(ab_2)\n",
+ "show(ab_3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "hfe = 100.0\n",
+ "hoe = 33.33 microS\n",
+ "hie = 1.5 kohm\n",
+ "hre = 0.0005\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "display_data",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAESCAYAAAD0aQL3AAAABHNCSVQICAgIfAhkiAA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/PgICAgAAarValueASBcWBHV5N44g\nduzYgeTkZBw7dgxjxowB0DyJ7enpie3bt6Nfv37YtWsXJElC37590djYqN3GiBEjsH37dkyYMAEA\nEBYWhvT0dNx///0AgIKCAnh4eODIkSOIjY0FABQVFWmL4Yba2lpj/MhEemFBUJfn7u6OsrIyWFlZ\nwdnZGRUVFejTpw/Ky8thY2ODnj17wtHREcnJyZg0aRJGjRqF4uJiWFtbt9hOcXExvL29cfToUQwf\nPhz19fXo2bMnAGDbtm2YM2cOjh49ipiYGPz444/asjhy5Ii2GKys+CtJpsPkbjlKJIe77roLycnJ\nAIApU6Zg165dqKiowPr16wEAM2fOxDvvvANbW1tUVFRg2rRp2juy3TB69Ghs27YN7u7uiImJ0d6h\n78SJE5g2bRr69++PkJAQ/Pzzz0hLS0N+fj6ysrIQEhICJycnCCFue+tHIjnwfhBEbbRq1SqkpaV1\n2C1af/nlF5w+fRozZ87skO0RtRePZ4naaP78+fjiiy86bHs//PCD9n7BRKaABUHURu7u7hg0aBAu\nXrzY7m1lZ2dj7NixnIMgk8IhJiIi0olvV4iISCcWBBER6cSCICIinVgQRESkEwuCiIh0YkEQEZFO\nLAgiItKJBUFERDr9f+uLfdE892zcAAAAAElFTkSuQmCC\n"
+ },
+ {
+ "metadata": {},
+ "output_type": "display_data",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAESCAYAAADnvkIDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlYlOXCP/DvCKi4xL6oSOooJaAwiaCFMkhIgBGmaVZE\nSb6dzvFY2Xl9tV4Lu87P8KTHVDpvVqioSYtLGhxxH465gooaahKKWywakOyy3L8/iAlkzGGYmWcG\nvp/r8hIehme+TjFf7vt+FpkQQoCIiOgu3aQOQEREpokFQUREGrEgiIhIIxYEERFpxIIgIiKNWBBE\nRKSR0QuipqYGAQEB8PX1haenJxYsWAAAiI+Ph5ubGxQKBRQKBdLT040djYiIWpBJ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HLlChYvXow333wTw4cPR0VFRauF5eLi\nYjg7O6OmpgaDBg2CXC7HxYsXsXHjRsTGxiIiIgL/+te/cPv2bfXl1MPDw9G/f3/MmjULrq6uAID6\n+npJXgMiTVgQ1OU1jyC2b9+OqKgonDx5EkFBQQCaFrHt7Ozw7bffYtiwYUhNTYVMJsPQoUNRV1en\n3sfYsWPx7bffIjw8HADg5eWF5ORkPP/88wCAK1euwNbWFpmZmfD39wcAFBYWqouhWVVVlTH+yURa\nYUFQl2djY4OSkhJ069YNvXv3RllZGYYMGYLS0lJYWlrC3d0d1tbWiIqKwqRJkzBu3DgUFRXBwsKi\n1X6Kiorg4OCArKwsjBkzBrW1tXB3dwcAbN68GTExMcjKyoKfnx8OHDigLovMzEx1MXTrxh9JMh0m\nd8tRIik89thjiIqKAgBMnjwZqampKCsrw+rVqwEA06dPx4oVK2BlZYWysjJMnTpVfUe2ZuPHj8fm\nzZthY2MDPz8/9R36srOzMXXqVHh4eEAul+P7779HXFwc8vPzceLECcjlcvTq1QtCiHve+pFICrwf\nBJGOli5diri4OL3dovX06dO4cOECpk+frpf9EXUUx7NEOpo1axa++eYbve1v37596vsFE5kCFgSR\njmxsbDB8+HBcvXq1w/vKyclBSEgI1yDIpHCKiYiINOKvK0REpBELgoiINGJBEBGRRiwIIiLSiAVB\nREQasSCIiEgjFgQREWnEgiAiIo3+P8ixPOMqV0GTAAAAAElFTkSuQmCC\n"
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.2 Page no.276"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "ri=2000.0 #Ohms, input resistance\n",
+ "Rb=150000.0 #Ohms, base resistance\n",
+ "\n",
+ "#Calculation\n",
+ "Zin=Rb*ri/(Rb+ri)\n",
+ "\n",
+ "#result\n",
+ "print \" The Input Impedance of the Amplifier is Zin = \",round(Zin/10**3,3),\"kohm\"\n",
+ "\n",
+ "#(b)find the voltage gain (Av)\n",
+ "Beeta=100\n",
+ "ri=2000.0 #Ohms\n",
+ "Rac=5000.0 #Ohms Resistance on outputside\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "Av=Beeta*Rac/ri\n",
+ "#result\n",
+ "\n",
+ "print \" The Voltage Gain of the Amplifier with phase of pi/2 is \",Av\n",
+ "#(c) find the current gain (Ai)\n",
+ "#Let input Current ib=2A\n",
+ "ib=2 #A, Assumption\n",
+ "io=100*ib \n",
+ "\n",
+ "#Calculation\n",
+ "Ai=io/ib # Current Gain\n",
+ "#result\n",
+ "print \"The Current Gain of the Amplifier is Ai = \",Ai"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Input Impedance of the Amplifier is Zin = 1.974 kohm\n",
+ " The Voltage Gain of the Amplifier with phase of pi/2 is 250.0\n",
+ "The Current Gain of the Amplifier is Ai = 100\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.3 Page no.277"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Bac=150.0 #ac current gain\n",
+ "rin=2000.0 #Ohms, input resistance\n",
+ "R1=4700.00 #Ohms, resistance\n",
+ "R2=12000.0 #Ohms resistance\n",
+ "\n",
+ "#Calculation\n",
+ "Rac=R1*R2/(R1+R2) # ohm , resistance\n",
+ "Av=Bac*Rac/rin\n",
+ "#result\n",
+ "print \"a\"\n",
+ "print \"the Voltage Gain of the Amplifier with phase of pi/2 is\",round(Av,1)\n",
+ "\n",
+ "#(b)find input impedance\n",
+ "R3=75000.0 #Ohms\n",
+ "R4=7500.00 #Ohms\n",
+ "\n",
+ "#Calculation\n",
+ "Zin=R3*R4*rin/(R3*R4+R4*rin+rin*R3)\n",
+ "\n",
+ "#result\n",
+ "print \"b\"\n",
+ "print \"The Input Impedance of the Amplifier is Zin = \",round(Zin/10**3,1),\"kohm\"\n",
+ "\n",
+ "#(c)Q point\n",
+ "\n",
+ "Vcc=15 #V\n",
+ "R1=75000.0 #Ohms\n",
+ "R2=7500.00 #Ohms\n",
+ "Rc=4700.0 #Ohms\n",
+ "Re=1200.0 #Ohms\n",
+ "\n",
+ "#Calculation\n",
+ "Vb=Vcc*R2/(R1+R2) #V, base voltage\n",
+ "Ve=Vb\n",
+ "Ie=Ve/Re #A, emitter current\n",
+ "Vce=Vcc-(Rc+Re)*Ie #V, collector emitter voltage\n",
+ "#result\n",
+ "print \"c\"\n",
+ "print \"voltage at the base is \",round(Vb,2),\"V\"\n",
+ "print \"Emitter current is \",round(Ie/10**(-3),2),\"mA\"\n",
+ "print \"The collector to emitter voltage is\",round(Vce,2),\"v\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "a\n",
+ "the Voltage Gain of the Amplifier with phase of pi/2 is 253.3\n",
+ "b\n",
+ "The Input Impedance of the Amplifier is Zin = 1.5 kohm\n",
+ "c\n",
+ "voltage at the base is 1.36 V\n",
+ "Emitter current is 1.14 mA\n",
+ "The collector to emitter voltage is 8.3 v\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.4 Page no.283"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "u=20 #amplification factor\n",
+ "Rl=10*10**3 #Ohms, load resistance\n",
+ "rp=10*10**3 #Ohms, resistance\n",
+ "#Calculation\n",
+ "A=u*Rl/(rp+Rl) #V, voltage gain\n",
+ "#result\n",
+ "print \" The Voltage Gain of the Amplifier with phase of pi/2 is\",A"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.5 Page no.286"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "gm=3000*10**(-6) #S, transconductance\n",
+ "Rl=22*10**3 #Ohms, resistance\n",
+ "rp=300*10**3 #Ohms, resistance \n",
+ "\n",
+ "#Calculation\n",
+ "#A=-(gm*Rl/(1+(Rl/rp))), For rp>>Rl we get\n",
+ "A=gm*Rl #with Phase of 180 degrees\n",
+ "# Results \n",
+ "print \"The Gain of the Amplifier with phase of pi/2 is\",A"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Gain of the Amplifier with phase of pi/2 is 66.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.6 Page no.286"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Rl=12000.0 #Ohms, load resistance\n",
+ "Rg=1000000.0 #Ohms, given resistance\n",
+ "Rs=1*10**3 #Ohms, given resistance\n",
+ "Cs=25*10**(-6) #F. capacitance\n",
+ "u=20 #amplification factor\n",
+ "rd=10**5 #Ohms, dynamic drain resistance\n",
+ "vi=0.1 #V, input voltage\n",
+ "f=1*10**3 #Hz, frequency\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "Xcs=1/(2*math.pi*f*Cs)\n",
+ "#As Xcs comes out to be much smaller than Rs, Rs is completely bypassed\n",
+ "A=u*Rl/(Rl+rd)\n",
+ "vo=A*vi\n",
+ "# Result\n",
+ "print \" The Output Signal Voltage of the Amplifier is vo = \",round(vo,3),\"v\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Output Signal Voltage of the Amplifier is vo = 0.214 v\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Electronics_and_Linear_Circuits/ch9.ipynb b/Basic_Electronics_and_Linear_Circuits/ch9.ipynb
index 045c66b4..3b1261da 100644
--- a/Basic_Electronics_and_Linear_Circuits/ch9.ipynb
+++ b/Basic_Electronics_and_Linear_Circuits/ch9.ipynb
@@ -1,272 +1,254 @@
-{
- "metadata": {
- "name": "Ch 9"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 9:Multi stage Amplifiers"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 9.1 Page no.305"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 9.1\n",
- "# Calculate overall Voltage Gain of a Multistage \n",
- "#Amplifier in dB\n",
- "\n",
- "#Given Data\n",
- "A1=30 #voltage gain 1\n",
- "A2=50 #voltage gain 2\n",
- "A3=80 #voltage gain 3\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "A=A1*A2*A3 #overall Voltage Gain\n",
- "Adb=20*math.log10(A) #Voltage Gain in dB\n",
- "# Result\n",
- "print \" The overall Voltage Gain of the Multistage Amplifier Adb = \",round(Adb,2),\"dB\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The overall Voltage Gain of the Multistage Amplifier Adb = 101.58 dB\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 9.2 Page no.312"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 9.2\n",
- "#Program to Calculate Voltage at the Output Terminal of \n",
- "#Two Stage Direct Coupled Amplifier\n",
- "\n",
- "#Given Data\n",
- "Vcc=30.0 #V, collector bias junction voltage\n",
- "Vi=1.4 #V, input voltage\n",
- "Vbe=0.7 #V. base emitter voltage \n",
- "B=300 #Beeta, gain factor\n",
- "R1=27000.0 #Ohms, given resistance\n",
- "R2=680.0 #Ohms given resistance\n",
- "R3=24000.0 #Ohms\n",
- "R4=2400.0 #Ohms\n",
- "\n",
- "#Calculation\n",
- "Ve=Vi-Vbe #V, voltage at emitter terminal\n",
- "Ie1=Vbe/R2 #A, emitter current at 1st stage\n",
- "Ic1=Ie1 #A, collector current\n",
- "Vc1=Vcc-round(Ie1,3)*R1 #collector voltage at 1st stage\n",
- "Vb2=Vc1 #V, base voltage at 2nd stage\n",
- "\n",
- "Ve2=Vb2-Vbe #V emitter voltage at 2nd stage\n",
- "Ie2=Ve2/R4 #A, emitter current at 2nd stage\n",
- "Ic2=round(Ie2,3) #A collector current at 2nd stage\n",
- "Vc2=Vcc-Ic2*R3\n",
- "Vo=Vc2\n",
- "#Displaying The Results in Command Window\n",
- "print \" The Voltage at the Output Terminal of Two Stage Direct Coupled Amplifier, Vo = \",Vo,\"V\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 9.3 Page no.319"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 9.3\n",
- "#Program to Calculate Gain in dB at Cutoff Frequencies and \n",
- "#Plot Frequency Response Curve\n",
- "\n",
- "#Given Data\n",
- "A=100 #voltage gain\n",
- "f1=400 #Hz, frequency 1\n",
- "f2=25*10**3 #Hz, frequency 2\n",
- "f3=80 #Hz, frequency 3 \n",
- "f4=40*10**3 # Hz, frequency 4 \n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "Adb=20*math.log10(A)\n",
- "Adbc=Adb-3 #Lower by 3dB\n",
- "# Result\n",
- "print \" The Gain at Cutoff Frequencies is, Adb (at Cutoff Frequencies) = \",Adbc,\"dB\"\n",
- "\n",
- "#plot\n",
- "from pylab import *\n",
- "f1=[80,400,25000,40000]\n",
- "Adb1=[37,40,40,37]\n",
- "a=plot(f1,Adb1)\n",
- "xlim(0,40000)\n",
- "xlabel(\"$f(Hz)$\")\n",
- "ylabel(\"$AdB$\")\n",
- "ylim(0,50)\n",
- "show(a1)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " The Gain at Cutoff Frequencies is, Adb (at Cutoff Frequencies) = 37.0 dB\n"
- ]
- },
- {
- "output_type": "display_data",
- "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAESCAYAAAABl4lHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGTNJREFUeJzt3X9M1Pfhx/HXWe2qs/5A5KDQDisg/kBgRWnWZcNaNLaK\nGldtZymtdmlM11mzatcs34x1qeKKW9S6bGvtwnTxx7oNf0StdvbU1gq11Vl1VpuhAsI5BLSgiMr7\n+4fjKiLyBu8X+HwkxLvP3XEv3vHulff78/ncOYwxRgAAWOgS6AAAgI6D0gAAWKM0AADWKA0AgDVK\nAwBgjdIAAFjr6q8nio6OVq9evXTHHXeoW7duKiwsVGVlpaZNm6YTJ04oOjpaa9euVZ8+ffwVCQDQ\nRn6baTgcDrlcLu3bt0+FhYWSpJycHKWnp+vo0aMaPXq0cnJy/BUHANAOfl2euv48wvXr1ysrK0uS\nlJWVpfz8fH/GAQC0kV9nGo888ohSUlL01ltvSZLcbrecTqckyel0yu12+ysOAKAd/LZP46OPPlJE\nRIT++9//Kj09XfHx8U1udzgccjgczR53o20AgNb54lOi/DbTiIiIkCT1799fkydPVmFhoZxOp8rL\nyyVJZWVlCgsLu+FjjTFB//OLX/wi4Bk6Q0ZykjPYfzpKTl/xS2mcP39eX331lSSptrZWW7duVUJC\ngjIyMpSXlydJysvL06RJk/wRBwDQTn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f3/P9X379jVbmqqsrNSsWbP0zjvvqGvXqy+x8+fP+zg1\n4B/s0wCuc/DgQQ0bNkySdMcddzS5raCgQMnJyZ7rn332mUaMGOG5bozRCy+8oKVLl6p79+46evSo\nJDX5uk6gI2OmAVzn1KlTnm9X7NGjh2f77t279bvf/U4hISEqLS3VgQMHtGrVKqWmpurs2bPq3bu3\nNm3apNdee02LFi1SbW2t3n77bRljmn2FLNBR8X0awP/8/e9/V319vT788EPPjuvc3FzNnDlTffv2\nbffv/de//qUjR45o2rRp3ooKBAxzZuB/unXrpuLiYr344ouebT/60Y/017/+9ZZ+7z//+U89/vjj\ntxoPCArMNIBW7Nq1S9/61rd03333tfmxhw4d0uXLl5WYmOiDZID/URoAAGssTwEArFEaAABrlAYA\nwBqlAQCwRmkAAKxRGgAAa5QGAMAapQEAsPb/7+aB+FqyhEoAAAAASUVORK5CYII=\n"
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 9.4 Page no 325."
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 9.4\n",
- "# (a)\n",
- "#Calculate Input Impedance of the given \n",
- "#Two Stage RC Coupled Amplifier\n",
- "\n",
- "#Given Data #all the quantities of R are resistances\n",
- "R1=5600.0 #Ohms\n",
- "R2=56000.0 #Ohms\n",
- "R3=1100.0 #Ohms\n",
- "\n",
- "#Calculation\n",
- "Zi=R1*R2*R3/(R1*R2+R2*R3+R3*R1)\n",
- "#Result\n",
- "print \" The Input Impedance, Zi = \",round(Zi/10**3,3),\"kohm\"\n",
- "\n",
- "#(b) Calculate output Impedance \n",
- "Ro1=3300.0 #Ohms\n",
- "Ro2=2200 #Ohms\n",
- "\n",
- "#Calculation\n",
- "Zo=Ro1*Ro2/(Ro1+Ro2)\n",
- "\n",
- "#Result\n",
- "print \" The Output Impedance, Zo = \",Zo/10**3,\"kohm\"\n",
- "#(c) voltage gain\n",
- "hfe=120 #current amplification factor\n",
- "hie=1100.0 #Ohms, dynamic input resistance\n",
- "R1=6800.0 #Ohms\n",
- "R2=56000.0 #Ohms\n",
- "R3=5600.0 #Ohms\n",
- "R4=1100.0 #Ohms\n",
- "\n",
- "#Calculation\n",
- "Rac2=Ro1*Ro2/(Ro1+Ro2)\n",
- "A2=-hfe*Rac2/hie\n",
- "Rac1=R1*R2*R3*R4/(R1*R2*R3+R2*R3*R4+R1*R3*R4+R1*R2*R4)\n",
- "Rac1=round(Rac1,0)\n",
- "A1=-hfe*Rac1/hie\n",
- "\n",
- "A1=round(A1,2)\n",
- "A=A1*A2 #Overall Gain\n",
- "\n",
- "#Result\n",
- "print \" The Overall Gain, A = \",round(A,0)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 9.5 Page no. 326"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 9.5\n",
- "#Program to Calculate Maximum Voltage Gain & Bandwidth\n",
- "\n",
- "#Given Data\n",
- "Rl=10000.0 #Ohms, resistance\n",
- "Rg=470000.0 #Ohms dynamic input resistance\n",
- "Cs=100*10**(-12) #F Capacitance\n",
- "u=25 #amplification factor\n",
- "rp=8000.0 #Ohms\n",
- "Cc=0.01*10**(-6) #F, capacitance\n",
- "\n",
- "#Calculation\n",
- "import math\n",
- "gm=u/rp #transconductance\n",
- "Req=rp*Rl*Rg/(rp*Rl+Rl*Rg+Rg*rp) #equivalent resistance\n",
- "Avm=(u/rp)*Req #voltage gain\n",
- "Avmd=Avm**2 # Voltage Gain of Two Stages\n",
- "Rd=(rp*Rl/(rp+Rl))+Rg\n",
- "f1=1/(2*math.pi*Cc*Rd) #Lower Cutoff Frequency\n",
- "f1d=f1/math.sqrt(math.sqrt(2)-1) #Lower Cutoff Frequency of Two Stages\n",
- "Req =(rp*Rl)/(rp+Rl) #approximately\n",
- "f2=1/(2*math.pi*Cs*Req) #Upper Cutoff Frequency\n",
- "f2d=f2*math.sqrt(math.sqrt(2)-1) #Upper Cutoff Frequency of Two Stages\n",
- "BW=f2d-f1d \n",
- "#Bandwidth\n",
- "# Result\n",
- "print \" The Voltage Gain of Two Stages, Avmd = \",round(Avmd,2)\n",
- "print \" The Bandwidth, BW = \",round(BW/10**3,0),\"KHz\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:83bf55a24e2aa90db4083899e2e7c0a6deddf51b02a3e4634d291129436942ec"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 9:Multi stage Amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.1 Page no.305"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "A1=30 #voltage gain 1\n",
+ "A2=50 #voltage gain 2\n",
+ "A3=80 #voltage gain 3\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "A=A1*A2*A3 #overall Voltage Gain\n",
+ "Adb=20*math.log10(A) #Voltage Gain in dB\n",
+ "# Result\n",
+ "print \" The overall Voltage Gain of the Multistage Amplifier Adb = \",round(Adb,2),\"dB\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The overall Voltage Gain of the Multistage Amplifier Adb = 101.58 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.2 Page no.312"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Vcc=30.0 #V, collector bias junction voltage\n",
+ "Vi=1.4 #V, input voltage\n",
+ "Vbe=0.7 #V. base emitter voltage \n",
+ "B=300 #Beeta, gain factor\n",
+ "R1=27000.0 #Ohms, given resistance\n",
+ "R2=680.0 #Ohms given resistance\n",
+ "R3=24000.0 #Ohms\n",
+ "R4=2400.0 #Ohms\n",
+ "\n",
+ "#Calculation\n",
+ "Ve=Vi-Vbe #V, voltage at emitter terminal\n",
+ "Ie1=Vbe/R2 #A, emitter current at 1st stage\n",
+ "Ic1=Ie1 #A, collector current\n",
+ "Vc1=Vcc-round(Ie1,3)*R1 #collector voltage at 1st stage\n",
+ "Vb2=Vc1 #V, base voltage at 2nd stage\n",
+ "\n",
+ "Ve2=Vb2-Vbe #V emitter voltage at 2nd stage\n",
+ "Ie2=Ve2/R4 #A, emitter current at 2nd stage\n",
+ "Ic2=round(Ie2,3) #A collector current at 2nd stage\n",
+ "Vc2=Vcc-Ic2*R3\n",
+ "Vo=Vc2\n",
+ "#Displaying The Results in Command Window\n",
+ "print \" The Voltage at the Output Terminal of Two Stage Direct Coupled Amplifier, Vo = \",Vo,\"V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.3 Page no.319"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "A=100 #voltage gain\n",
+ "f1=400 #Hz, frequency 1\n",
+ "f2=25*10**3 #Hz, frequency 2\n",
+ "f3=80 #Hz, frequency 3 \n",
+ "f4=40*10**3 # Hz, frequency 4 \n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "Adb=20*math.log10(A)\n",
+ "Adbc=Adb-3 #Lower by 3dB\n",
+ "# Result\n",
+ "print \" The Gain at Cutoff Frequencies is, Adb (at Cutoff Frequencies) = \",Adbc,\"dB\"\n",
+ "\n",
+ "#plot\n",
+ "from pylab import *\n",
+ "f1=[80,400,25000,40000]\n",
+ "Adb1=[37,40,40,37]\n",
+ "a=plot(f1,Adb1)\n",
+ "xlim(0,40000)\n",
+ "xlabel(\"$f(Hz)$\")\n",
+ "ylabel(\"$AdB$\")\n",
+ "ylim(0,50)\n",
+ "show(a1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The Gain at Cutoff Frequencies is, Adb (at Cutoff Frequencies) = 37.0 dB\n"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "display_data",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAESCAYAAAABl4lHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGTNJREFUeJzt3X9M1Pfhx/HXWe2qs/5A5KDQDisg/kBgRWnWZcNaNLaK\nGldtZymtdmlM11mzatcs34x1qeKKW9S6bGvtwnTxx7oNf0StdvbU1gq11Vl1VpuhAsI5BLSgiMr7\n+4fjKiLyBu8X+HwkxLvP3XEv3vHulff78/ncOYwxRgAAWOgS6AAAgI6D0gAAWKM0AADWKA0AgDVK\nAwBgjdIAAFjr6q8nio6OVq9evXTHHXeoW7duKiwsVGVlpaZNm6YTJ04oOjpaa9euVZ8+ffwVCQDQ\nRn6baTgcDrlcLu3bt0+FhYWSpJycHKWnp+vo0aMaPXq0cnJy/BUHANAOfl2euv48wvXr1ysrK0uS\nlJWVpfz8fH/GAQC0kV9nGo888ohSUlL01ltvSZLcbrecTqckyel0yu12+ysOAKAd/LZP46OPPlJE\nRIT++9//Kj09XfHx8U1udzgccjgczR53o20AgNb54lOi/DbTiIiIkCT1799fkydPVmFhoZxOp8rL\nyyVJZWVlCgsLu+FjjTFB//OLX/wi4Bk6Q0ZykjPYfzpKTl/xS2mcP39eX331lSSptrZWW7duVUJC\ngjIyMpSXlydJysvL06RJk/wRBwDQTn5ZnnK73Zo8ebIk6fLly5o+fbrGjBmjlJQUTZ06VcuXL/cc\ncgsACF5+KY0BAwZo//79zbaHhITo/fff90cEn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Z7rn332mUaMGOG5bozRCy+8oKVLl6p79+46evSo\nJDX5uk6gI2OmAVzn1KlTnm9X7NGjh2f77t279bvf/U4hISEqLS3VgQMHtGrVKqWmpurs2bPq3bu3\nNm3apNdee02LFi1SbW2t3n77bRljmn2FLNBR8X0awP/8/e9/V319vT788EPPjuvc3FzNnDlTffv2\nbffv/de//qUjR45o2rRp3ooKBAxzZuB/unXrpuLiYr344ouebT/60Y/017/+9ZZ+7z//+U89/vjj\ntxoPCArMNIBW7Nq1S9/61rd03333tfmxhw4d0uXLl5WYmOiDZID/URoAAGssTwEArFEaAABrlAYA\nwBqlAQCwRmkAAKxRGgAAa5QGAMAapQEAsPb/7+aB+FqyhEoAAAAASUVORK5CYII=\n"
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.4 Page no 325."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " #all the quantities of R are resistances\n",
+ "R1=5600.0 #Ohms\n",
+ "R2=56000.0 #Ohms\n",
+ "R3=1100.0 #Ohms\n",
+ "\n",
+ "#Calculation\n",
+ "Zi=R1*R2*R3/(R1*R2+R2*R3+R3*R1)\n",
+ "#Result\n",
+ "print \" The Input Impedance, Zi = \",round(Zi/10**3,3),\"kohm\"\n",
+ "\n",
+ "#(b) Calculate output Impedance \n",
+ "Ro1=3300.0 #Ohms\n",
+ "Ro2=2200 #Ohms\n",
+ "\n",
+ "#Calculation\n",
+ "Zo=Ro1*Ro2/(Ro1+Ro2)\n",
+ "\n",
+ "#Result\n",
+ "print \" The Output Impedance, Zo = \",Zo/10**3,\"kohm\"\n",
+ "#(c) voltage gain\n",
+ "hfe=120 #current amplification factor\n",
+ "hie=1100.0 #Ohms, dynamic input resistance\n",
+ "R1=6800.0 #Ohms\n",
+ "R2=56000.0 #Ohms\n",
+ "R3=5600.0 #Ohms\n",
+ "R4=1100.0 #Ohms\n",
+ "\n",
+ "#Calculation\n",
+ "Rac2=Ro1*Ro2/(Ro1+Ro2)\n",
+ "A2=-hfe*Rac2/hie\n",
+ "Rac1=R1*R2*R3*R4/(R1*R2*R3+R2*R3*R4+R1*R3*R4+R1*R2*R4)\n",
+ "Rac1=round(Rac1,0)\n",
+ "A1=-hfe*Rac1/hie\n",
+ "\n",
+ "A1=round(A1,2)\n",
+ "A=A1*A2 #Overall Gain\n",
+ "\n",
+ "#Result\n",
+ "print \" The Overall Gain, A = \",round(A,0)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.5 Page no. 326"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Rl=10000.0 #Ohms, resistance\n",
+ "Rg=470000.0 #Ohms dynamic input resistance\n",
+ "Cs=100*10**(-12) #F Capacitance\n",
+ "u=25 #amplification factor\n",
+ "rp=8000.0 #Ohms\n",
+ "Cc=0.01*10**(-6) #F, capacitance\n",
+ "\n",
+ "#Calculation\n",
+ "import math\n",
+ "gm=u/rp #transconductance\n",
+ "Req=rp*Rl*Rg/(rp*Rl+Rl*Rg+Rg*rp) #equivalent resistance\n",
+ "Avm=(u/rp)*Req #voltage gain\n",
+ "Avmd=Avm**2 # Voltage Gain of Two Stages\n",
+ "Rd=(rp*Rl/(rp+Rl))+Rg\n",
+ "f1=1/(2*math.pi*Cc*Rd) #Lower Cutoff Frequency\n",
+ "f1d=f1/math.sqrt(math.sqrt(2)-1) #Lower Cutoff Frequency of Two Stages\n",
+ "Req =(rp*Rl)/(rp+Rl) #approximately\n",
+ "f2=1/(2*math.pi*Cs*Req) #Upper Cutoff Frequency\n",
+ "f2d=f2*math.sqrt(math.sqrt(2)-1) #Upper Cutoff Frequency of Two Stages\n",
+ "BW=f2d-f1d \n",
+ "#Bandwidth\n",
+ "# Result\n",
+ "print \" The Voltage Gain of Two Stages, Avmd = \",round(Avmd,2)\n",
+ "print \" The Bandwidth, BW = \",round(BW/10**3,0),\"KHz\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Mechanical_Engineering/bme1.ipynb b/Basic_Mechanical_Engineering/bme1.ipynb
index fa3c24cb..f265eb09 100644
--- a/Basic_Mechanical_Engineering/bme1.ipynb
+++ b/Basic_Mechanical_Engineering/bme1.ipynb
@@ -1,1510 +1,1495 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 1: Fundamental Concepts and Definitions"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.1 Page No. 34"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the work done\n",
- "\n",
- "#Input data\n",
- "p=700\t\t #pressure of fluid in kN/m**2\n",
- "v1=0.28\t\t#Initial volume of fluid in m**3\n",
- "v2=1.68\t\t#Final volume of fluid in m**3\n",
- "\n",
- "#Calculations\n",
- "W=p*(v2-v1)\t#Work done in kJ\n",
- "\n",
- "#Output\n",
- "print'The Work done is',round(W,1),'KJ or',round(W/1000,3),'MJ'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Work done is 980.0 KJ or 0.98 MJ\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.2 Page No.35"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the new volume of gas\n",
- "\n",
- "#Input data\n",
- "p1=138.0\t\t#Initial pressure of gas in kN/m**2\n",
- "p2=690.0\t\t#Final pressure of gas in kN/m**2\n",
- "v1=0.112\t\t#Initial volume in m**3\n",
- "\n",
- "#Calculations\n",
- "P=p1/p2\t\t#Pressure ratio\n",
- "v2=v1*(P**(1/1.4))\t#Final volume of gas in m**3\n",
- "\n",
- "#Output\n",
- "print'The new volume of the gas is',round(v2,3),\"m**3\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The new volume of the gas is 0.035 m**3\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.3 Page No. 35"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find (a)Final volume of gas . \n",
- "#(b)Work done by the gas during the expansion \n",
- "\n",
- "#Input data\n",
- "p1=2070\t\t#Initial pressure of gas in kN/m**2\n",
- "p2=207\t\t#Final pressure of gas in kN/m**2\n",
- "v1=0.014\t\t#Initial volume of gas in m**3\n",
- "n=1.35\t\t#constant\n",
- "\n",
- "#Calculations\n",
- "P=p1/p2\t\t#Pressure ratio\n",
- "v2=v1*(P**(1/1.35))\t#Final volume of gas in m**3\n",
- "W=(p1*v1-p2*v2)/(n-1)\t#Work done in kJ\n",
- "\n",
- "#Output\n",
- "print'(a)Final volume of gas ',round(v2,3),\"m**3 \"\n",
- "print'(b)Work done by the gas during the expansion is',round(W,2),\"kJ\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Final volume of gas 0.077 m**3 \n",
- "(b)Work done by the gas during the expansion is 37.22 kJ\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.4 Page No.36"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find(a)Final pressure and the work done on gas\n",
- "\n",
- "#Input data\n",
- "v1=0.056\t\t#Initial volume of gas in m**3\n",
- "v2=0.007\t\t#Final volume of gas in m**3\n",
- "p1=100\t\t#Initial perssure compressed Isothermally in kN/m**2\n",
- "\n",
- "#Calculations\n",
- "p2=(p1*v1)/v2\t#Final pressure in kN/m**2\n",
- "W=p1*v1*(math.log(v2/v1))\t#Work done in kJ\n",
- "\n",
- "#Output\n",
- "print'(a)Final pressure is',round(p2,0),\"kN/m**2 \"\n",
- "print'(b)The work done on gas is',round(-W,2), \"kJ\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Final pressure is 800.0 kN/m**2 \n",
- "(b)The work done on gas is 11.64 kJ\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- " Example 1.5 Page No. 37"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the work done\n",
- "\n",
- "#Input data\n",
- "v1=1.0\t\t#Initial volume in m**3\n",
- "v2=3.0\t\t#Final volume in m**3\n",
- "\n",
- "#Calculations\n",
- "import math\n",
- "W=10**5*(((v2**3-v1**3)/3)+8*(math.log(v2/v1)))\t#Work done in J\n",
- "\n",
- "#Output\n",
- "print'The work done is',round(W,0),\"Nm\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The work done is 1745556.0 Nm\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.6 Page No. 38"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The work done by the gas .\n",
- "\n",
- "#Input data\n",
- "v1=0.2\t#Initial volume in m**3\n",
- "v2=0.5\t#Final volume in m**3\n",
- "\n",
- "#Calculations\n",
- "W=1500*(((v2**2-v1**2)/200)+(v2-v1))/1000\t#Work done in kJ\n",
- "\n",
- "#Output\n",
- "print'The work done by the gas is',round(W,4),\"KJ\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The work done by the gas is 0.4516 KJ\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.8 Page No. 39"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The work done by the gas \n",
- "\n",
- "#Input data\n",
- "v1=1.5\t\t#Initial volume in m**3\n",
- "v2=2\t\t#Final volume in m**3\n",
- "w1=2\t\t#Work receiving in Nm\n",
- "p=6\t\t#constsnt pressure of gas in N/m**2\n",
- "\n",
- "#Calculations\n",
- "w2=p*(v2-v1)\t#Work done in Nm\n",
- "W=w2-w1\t\t#Net work done by the system in Nm\n",
- "\n",
- "#Output\n",
- "print'Net work done by the system is',round(W,2),\"Nm\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Net work done by the system is 1.0 Nm\n"
- ]
- }
- ],
- "prompt_number": 20
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.9 Page No. 40"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find(a)Pressure of 80cm and 40 cm of Hg \n",
- "#(c)Pressure due to 1.5m of water coloumn \n",
- "#(d)Pressure in kPa for 5.2bar \n",
- "\n",
- "#Input data\n",
- "d=13596\t\t#Density of Hg in kg/m**3\n",
- "g=9.806\t\t#gravity in m/sec**2\n",
- "z=760.0\t\t#Barometer pressure in mm of Hg\n",
- "Pv=40.0\t\t#Vaccum pressure in cm\n",
- "dw=1000.0\t\t#Density of water in kg/m**3\n",
- "Zw=1.5\t\t#Level of water in m\n",
- "\n",
- "#Calculations\n",
- "p=(d*g*z)/10**6\t#Pressure in kPa\n",
- "p1=(80/76.0)*p\t#Pressure in kPa\n",
- "Pa=p-Pv\t\t#Absolute pressure in kPa\n",
- "p2=(36/76.0)*p\t#Pressure in kPa\n",
- "p3=(dw*g*Zw)/1000.0\t\t#pressure in kPa\n",
- "p4=(5.2*10**5)/1000.0\t#pressure in kPa\n",
- "\n",
- "#Output\n",
- "print'(a)Pressure of 80cm of Hg is',round(p1,2),\"kPa\" \n",
- "print'(b)Pressure of 40cm of Hg vaccum is',round(p2,2), \"kPa \"\n",
- "print'(c)Pressure due to 1.5m of water coloumn is',round(p3*1000,4),\"N/m**2or Pa\" \n",
- "print'(d)Pressure in kPa for 5.2bar is',round(p4,2),\"kPa\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Pressure of 80cm of Hg is 106.66 kPa\n",
- "(b)Pressure of 40cm of Hg vaccum is 48.0 kPa \n",
- "(c)Pressure due to 1.5m of water coloumn is 14709.0 N/m**2or Pa\n",
- "(d)Pressure in kPa for 5.2bar is 520.0 kPa\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.10 Page No.41"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the pressure at different conditions.\n",
- "\n",
- "\n",
- "#Input data \n",
- "z=750\t\t#Barometric pressure in mm of Hg\n",
- "g=9.81\t\t#Gravity in m/sec**2\n",
- "Pa=101.325\t#one atm pressure in kN/m**2\n",
- "Pg=3.3\t\t#Pressure in atm\n",
- "Pf=3.2\t\t#Pressure in m of water\n",
- "d=13596\t\t#Density of Hg in kg/m**3\n",
- "\n",
- "#calculations\n",
- "Pp=(d*g*z)/10**6\t\t #Pressure in kPa\n",
- "p1=(d*g*0.55)/1000.0\t\t #Pressure in kPa\n",
- "p2=Pp+(Pg*101.325)\t #Pressure in kPa\n",
- "p3=Pp+(Pf*g*100)/1000.0\t#Pressure in kPa\n",
- "p4=4.6*100\t\t #Pressure in kPa\n",
- "\n",
- "#Output\n",
- "print'(a)Pressure of 55cm of Hg (Abs)',round(p1,1),\"KPa\"\n",
- "print'(b)Pressure at 3.3 atm (Gauge)',round(p2,1),\"kPa\" \n",
- "print'(c)Pressure of 3.2m of water (Gauge)',round(p3,1),\"kPa\" \n",
- "print'NOTE: In the book there is mistake in calculation p3 '\n",
- "print'(d)Pressure of 4.6bar (Abs)',round(p4,1),\"kPa\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Pressure of 55cm of Hg (Abs) 73.4 KPa\n",
- "(b)Pressure at 3.3 atm (Gauge) 434.4 kPa\n",
- "(c)Pressure of 3.2m of water (Gauge) 103.2 kPa\n",
- "NOTE: In the book there is mistake in calculation p3 \n",
- "(d)Pressure of 4.6bar (Abs) 460.0 kPa\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.11 Page No. 42"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the absolute pressure\n",
- "\n",
- "#Input data\n",
- "Zw=50\t\t#Manometer reading of water in cm\n",
- "Zo=763\t\t#Atmospheric pressure in mm of Hg\n",
- "d=13.6*10**3\t#Density of Hg in kg/m**3\n",
- "dw=1000\t\t#Density of water in kg/m**3\n",
- "g=9.81\t\t#Gravity in m/sec**2\n",
- "\n",
- "#Calculations\n",
- "Pa=(d*g*Zo)/10**6\t\t#Atmospheric pressure in kPa\n",
- "Pg=(dw*g*Zw)/10**5\t#Gauge pressure in kPa\n",
- "Pab=Pa+Pg\t\t#Absolute pressure in kPa\n",
- "\n",
- "#Output\n",
- "print'Absolute pressure is',round(Pab,2),\"kPa\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Absolute pressure is 106.7 kPa\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.12 Page No. 42"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the absolute pressure\n",
- "\n",
- "#Input data\n",
- "Z=70\t\t\t#Vaccum gauge reading in cm of Hg\n",
- "Pa=101.325\t\t#Atmospheric pressure in kPa\n",
- "d=13.6*10**3\t\t#Density of Hg in kg/m**3\n",
- "g=9.81\t\t\t#Gravity in m/sec**2\n",
- "\n",
- "#Calculations\n",
- "Pv=(d*g*Z)/10**5\t\t#Vaccum pressure in kPa\n",
- "Pab=Pa-Pv\t\t#Absolute pressure in kPa\n",
- "\n",
- "#Output\n",
- "print'Absolute pressure is',round(Pab,2),\"kPa\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Absolute pressure is 7.93 kPa\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.13 Page No. 43"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the absolute pressure\n",
- "\n",
- "#Input data\n",
- "Pv=30\t\t#Vaccum pressure in kPa\n",
- "Z=755\t\t#Barometer reading in mm of Hg\n",
- "d=13590\t\t#Density of Hg in kg/m**3\n",
- "g=9.81\t\t#Gravity in m/sec**2\n",
- "\n",
- "#calculations \n",
- "Pa=(d*g*Z)/10**6\t#Atmospheric perssure in kPa\n",
- "Pab=Pa-Pv\t#Absolute pressure in kPa\n",
- "\n",
- "#Output\n",
- "print'Asolute pressure in the tank is',round(Pab,2),\"kPa\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Asolute pressure in the tank is 70.66 kPa\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.14 Page No. 43"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- " #Find the gas pressure\n",
- "\n",
- "#Input data\n",
- "Z=0.562\t\t#Level of open limb in m\n",
- "Z1=0.761\t\t#Barometer reading in m of Hg\n",
- "g=9.79\t\t#Gravity in m/sec**2\n",
- "d=13640\t\t#Density of Hg in kg/m**2\n",
- "\n",
- "#Calculations\n",
- "Pa=(d*g*Z1)/1000.0\t#Atmospheric pressure in kPa\n",
- "Ph=(d*g*Z)/1000.0\t#Pressure exercterd due to height in kPa\n",
- "Pab=Pa+Ph\t#Absolute pressure in kPa\n",
- "\n",
- "#Output\n",
- "print'The gas pressure is',round(Pab,3),\"kN/m**2\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The gas pressure is 176.668 kN/m**2\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.15 Page No. 44"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is Absolute pressure of the gas\n",
- "\n",
- "#Input data \n",
- "d=13.596*10**3\t#Density of Hg in kg/m**3\n",
- "dl=800\t\t#Density of liquid in kg/m**3\n",
- "Z=30\t\t#Level of the liquid in the arm in cm\n",
- "Z1=0.75\t\t#Barometric pressure in m\n",
- "g=9.81\t\t#Gravity in m/sec**2\n",
- "\n",
- "#Calculatins\n",
- "Pg=(dl*g*Z)/10**7\t#Gauge pressure in bar\n",
- "Pa=(d*g*Z1)/10**5\t#Atmospheric pressure in bar\n",
- "Pab=Pa+Pg #Absolute pressure in bar\n",
- "\n",
- "#Output\n",
- "print'Absolute pressure of the gas is',round(Pab,2),\"bar\"\n",
- "print'NOTE:In the book there is calculation mistake in last step'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Absolute pressure of the gas is 1.02 bar\n",
- "NOTE:In the book there is calculation mistake in last step\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.16 Page No. 45"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine Absolute pressure of the gas\n",
- "\n",
- "#Input data\n",
- "Z1=0.17\t\t#Level of liquid in m\n",
- "Z=0.76\t\t#Barometer readings in m\n",
- "d=13596\t\t#Density of Hg in kg/m**3\n",
- "g=9.806\t\t#Gravity in m/sec**2\n",
- "s=0.8\t\t#Specific gravity \n",
- "d1=1000\t\t#Density of water in kg/m**3\n",
- "\n",
- "#Calculations\n",
- "dl=s*d1\t\t#Density of given liquid in kg/m**3\n",
- "Pa=d*g*Z\t\t#Atmospheric pressure in N/m**2\n",
- "p=dl*g*Z1\t#Pressure in N/m**2\n",
- "Pab=(Pa-p)/10**5\t#Absolute pressure in bar\n",
- "\n",
- "#Output\n",
- "print'Absolute pressure of the gas is',round(Pab),\"bar\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Absolute pressure of the gas is 1.0 bar\n"
- ]
- }
- ],
- "prompt_number": 18
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.17 Page No. 46"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#determine Absolute pressure of the steam\n",
- "\n",
- "#Input data\n",
- "g=9.806\t\t#Gravity in m/sec**2\n",
- "d=13596\t\t#Density of Hg in kg/m**3\n",
- "Z=9.75\t\t#Level of Hg in cm\n",
- "dw=1000\t\t#Density of water in kg/m**3\n",
- "Zw=0.034\t\t#Coloumn of condensate in m\n",
- "Zo=0.76\t\t#Atmospheric pressure in m of Hg\n",
- "\n",
- "#Calculations\n",
- "P=dw*g*Zw\t #Pressure in N/m**2\n",
- "Pa=d*g*Zo\t #Atmospheric pressure in N/m**2\n",
- "Pg=(d*g*Z)/100.0\t#Gauge pressure in N/m**2\n",
- "Pab=(Pa+Pg-P)/10**5\t#Absolute pressure in bar\n",
- "\n",
- "#Output\n",
- "print'Pressure due to height is',round(P,3),'N/m**2'\n",
- "print'Atmospheric Pressure is ',round(Pa,0),'N/m**2'\n",
- "print'Absolute pressure of steam is',round(Pab,4),\"bar\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Pressure due to height is 333.404 N/m**2\n",
- "Atmospheric Pressure is 101325.0 N/m**2\n",
- "Absolute pressure of steam is 1.1399 bar\n"
- ]
- }
- ],
- "prompt_number": 23
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.18 Page No. 47"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#determine Absolute pressure of the steam\n",
- "\n",
- "#Input data\n",
- "g=9.7\t\t #Gravity in m/sec**2\n",
- "d=13.69*10**3\t#Density of Hg in kg/m**3\n",
- "dw=1000\t\t #Density of water in kg/m**3\n",
- "Pa=98\t \t#Atmospheric pressure in kPa\n",
- "Z=0.6\t \t#Manometer level difference in m of Hg\n",
- "Zw=0.04\t\t #Water coloumn level in m\n",
- "\n",
- "#Calculations \n",
- "Pw=(dw*g*Zw)/1000.0\t#Pressure due to water in kPa\n",
- "Pg=(d*g*Z)/1000.0\t\t#Pressure in kPa\n",
- "Pab1=Pa+Pg-Pw\t\t#Absolute pressure in kPa\n",
- "Pab=Pab1/100.0\t\t #Absolute pressure in bar\n",
- "\n",
- "#Output \n",
- "print'The absolute pressure of steam is',round(Pab,2),\"bar\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The absolute pressure of steam is 1.77 bar\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.19 Page No. 48"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#find Absolute pressure of the steam\n",
- "\n",
- "#Input data\n",
- "Z=0.76\t\t#Actual height of mercury coloumn in m\n",
- "g=9.806\t\t#Gravity in m/sec**2\n",
- "d=13596\t\t#Density of Hg in kg/m**3\n",
- "dw=1000\t\t#Density of water in kg/m**3\n",
- "Zw=0.035\t\t#Height of condensate coloumn in m\n",
- "Zh=0.10\t\t#Height of mercury coloumn in m\n",
- "\n",
- "#Calculations\n",
- "Pa=d*g*Z\t\t#Atmospheric pressure in N/m**2\n",
- "Pw=dw*g*Zw\t#Pressure due to water in N/m**2\n",
- "Ph=d*g*Zh\t#Pressure due to Hg in N/m**2\n",
- "Pab=(Pa+Ph-Pw)/10**5\t#Absolute pressure in bar\n",
- "\n",
- "#Output \n",
- "print'Absolute pressure of steam in the pipe is',round(Pab,2),\"bar\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Absolute pressure of steam in the pipe is 1.14 bar\n"
- ]
- }
- ],
- "prompt_number": 17
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.20Page No. 49"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is Absolute pressure of the gas\n",
- "\n",
- "#Input data\n",
- "dk=800\t\t#Density of kerosene in kg/m**3\n",
- "g=9.81\t\t#gravity in m/sec**2\n",
- "Zk=0.051\t\t#Kerosene vapour on Hg coloumn in m\n",
- "d=13600\t\t#Density of Hg in kg/m**3\n",
- "Zh=0.1\t\t#Hg level in m\n",
- "Z=0.755\t\t#Atmospheric pressure in m of Hg\n",
- "\n",
- "#Calculations\n",
- "Pk=dk*g*Zk\t\t #Pressure of kerosene in N/m**2\n",
- "Pa=d*g*Z\t\t #Atmospheric pressure in N/m**2\n",
- "Ph=d*g*Zh \t#Pressure due to Hg in N/m**2\n",
- "Pab=(Pa+Ph-Pk)/1000.0\t#Absolute pressure in kPa\n",
- "\n",
- "#Output \n",
- "print'Absolute pressure of vapour is ',round(Pab,2),\"kPa\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Absolute pressure of vapour is 113.67 kPa\n"
- ]
- }
- ],
- "prompt_number": 19
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.21 Page No. 50"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#find (a)The Absolute pressure of the gas in pipe line and \n",
- "#(b)If the fluid used is Hg then the difference of height of Hg coloumn in the 2 arms .\n",
- "\n",
- "#Input data\n",
- "d=13596\t\t#Density of Hg in kg/m**3\n",
- "g=9.806\t\t#Gravity in m/sec**2\n",
- "df=0.8*1000\t#Density of fluid in kg/m**3\n",
- "Z=0.76\t\t#Atmospheric pressure in m of Hg\n",
- "Zf=0.3\t\t#Height of fluid coloumn in m\n",
- "\n",
- "#Calculations\n",
- "Pa=d*g*Z\t\t#Atmospheric perssure in N/m**2\n",
- "P=df*g*Zf\t#Pressure due to fluid in N/m**2\n",
- "Pab=(Pa+P)/10**5\t#Absolute pressure in bar\n",
- "Zh=((Pab*10**5-Pa)/(d*g))*100\t#Difference between the height of Hg coloumn in 2 arms in m\n",
- "\n",
- "#Output\n",
- "print'(a)The Absolute pressure of the gas in pipe line Pab',round(Pab,2),\" bar\" \n",
- "print'(b)If the fluid used is Hg then the difference of height of Hg coloumn in the 2 arms is',round(Zh,2),\"cm\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " (a)The Absolute pressure of the gas in pipe line Pab 1.04 bar\n",
- "(b)If the fluid used is Hg then the difference of height of Hg coloumn in the 2 arms is 1.77 cm\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.22 Page No. 51"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the pressure at the bottom and inner surface of oil and water\n",
- "\n",
- "#Input data\n",
- "Pa=1\t\t#Atmospheric pressure in bar\n",
- "g=9.81\t\t#Gravity in m/sec**2\n",
- "do=0.8*1000\t#Density of oil in kg/m**3\n",
- "Zo=0.8\t\t#Level of oil in m\n",
- "dw=1000\t\t#Density of water in kg/m**3\n",
- "Zw=0.65\t\t#Level of water in m\n",
- "d=13.6*10**3\t#Density of Hg in kg/m**3\n",
- "Z=0.45\t\t#Level of Hg in m\n",
- "\n",
- "#Calculations\n",
- "Po=(do*g*Zo)/10**5\t#Pressure of oil in bar\n",
- "Pw=(dw*g*Zw)/10**5\t#Pressure of water in bar\n",
- "P=(d*g*Z)/10**5\t\t#Pressure of Hg in bar\n",
- "Pab=Pa+Po+Pw+P\t\t#Pressure at the bottom of the coloumn in bar\n",
- "Pow=Pa+Po\t\t#Pressure at the interface of oil and water in bar\n",
- "Poh=Pa+Po+Pw\t\t#Pressure at the interface of water and Hg\n",
- "\n",
- "#Output\n",
- "print'(a)Pressure at the bottom of the coloumn is',round(Pab,2),\"bar\" \n",
- "print'(b)Pressure at the inter surface of oil and water ia',round(Pow,3),\"bar \" \n",
- "print'(c)Pressure at the inter surface of water and Hg ',round(Poh,3),\"bar\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Pressure at the bottom of the coloumn is 1.73 bar\n",
- "(b)Pressure at the inter surface of oil and water ia 1.063 bar \n",
- "(c)Pressure at the inter surface of water and Hg 1.127 bar\n"
- ]
- }
- ],
- "prompt_number": 24
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.23 Page No. 52"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the height of fluid for oil , water and Hg manometer\n",
- "\n",
- "#Input data\n",
- "Z=0.76\t\t#Barometer reading in m\n",
- "g=9.81\t\t#Gravity in m/sec**2\n",
- "d=13.6*10**3\t#Density of Hg in kg/m**3\n",
- "Pab=1.2*10**5\t#Absolute pressure in N/m**2\n",
- "do=0.8*1000\t#Density of oil in kg/m**3\n",
- "dw=1000\t\t#Density of water in kg/m**3\n",
- "dh=13.6*10**3\t#Density of Hg in kg/m**3\n",
- "\n",
- "#calculations\n",
- "Pa=dh*g*Z\t#Atmospheric pressure in N/m**2\n",
- "Pg=Pab-Pa\t#Gauge pressure in N/m**2\n",
- "Zo=Pg/(do*g)\t#Height of oil in manometer in m\n",
- "Pw=Pab-Pa\t#Pressure exercted by water in N/m**2\n",
- "Zw=Pw/(dw*g)\t#Height of water in manometer in m\n",
- "P=Pab-Pa\t\t#Pressure of Hg in N/m**2\n",
- "Zh=P/(d*g)\t#Height of Hg in manometer in m\n",
- "\n",
- "#Output\n",
- "print'(a)The height of fluid for oil Manometer',round(Zo,2),\"m \"\n",
- "print'(b)The height of fluid for water Manometer ia',round(Zw,2),\"m\" \n",
- "print'(c)The height of fluid for Hg Manometer is',round(Zh,3),\"m\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The height of fluid for oil Manometer 2.37 m \n",
- "(b)The height of fluid for water Manometer ia 1.9 m\n",
- "(c)The height of fluid for Hg Manometer is 0.139 m\n"
- ]
- }
- ],
- "prompt_number": 26
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.24 Page No. 54"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The altitude of the plane from ground level \n",
- "\n",
- "#Input data\n",
- "Zg=0.753\t\t#Barometer reading at ground level in m\n",
- "Zp=0.690\t\t#Pilots barometer reading in the plane in m\n",
- "d=13600\t\t#Density of Hg in kg/m**3\n",
- "g=9.81\t\t #Gravity in m/sec**2\n",
- "da=1.25\t\t#Density of air in kg/m**3\n",
- "\n",
- "#Calculations\n",
- "Pg=d*g*Zg\t#Pressure at ground level in N/m**2\n",
- "Pp=d*g*Zp\t#Pressure at plane level in N/m**2\n",
- "P=Pg-Pp\t\t#Change of pressure at ground level and that of plane level in N/m**2\n",
- "Za=P/(da*g)\t#Altitude of plane from ground in m\n",
- "\n",
- "#Output \n",
- "print'The altitude of the plane from ground level is',round(Za,1),\"m\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The altitude of the plane from ground level is 685.4 m\n"
- ]
- }
- ],
- "prompt_number": 26
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.25 Page No. 54"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Pressure exercted \n",
- "\n",
- "#Input data\n",
- "dw=1000\t\t#Density of water in kg/m**3\n",
- "dh=13590\t\t#Density of Hg in kg/m**3\n",
- "Pa=400\t\t#Pressure at A in kPa\n",
- "g=9.81\t\t#Gravity in N/m**2\n",
- "Zw1=2.5\t\t#First level of water in m\n",
- "Zw2=0.4\t\t#Second level of water in m\n",
- "Zh=0.6\t\t#Level of Hg in m\n",
- "\n",
- "#Calculations \n",
- "Pw1=dw*g*Zw1\t#First level of water pressure in N/m**2\n",
- "Pw2=dw*g*Zw2\t#Second level of water pressure in n/m**2\n",
- "Ph=dh*g*Zh\t#Pressure of Hg in N/m**2\n",
- "Pb=((Pa*1000)+Pw1+Pw2-Ph)/1000\t#Pressure exercted at B in kPa\n",
- "\n",
- "#Output\n",
- "print'Pressure exercted at B is',round(Pb,2),\"KPa\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Pressure exercted at B is 348.46 KPa\n"
- ]
- }
- ],
- "prompt_number": 29
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.26 Page No. 55"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is The total weight of piston and slab \n",
- "\n",
- "#Input data\n",
- "do=0.902*10**3\t#Density of oil in kg/m**3\n",
- "Pg=2*10**5\t #Gauge pressure in N/m**2\n",
- "g=9.81\t\t #Gravity in m/sec**2\n",
- "ho=2\t\t #Level of oil in m\n",
- "d=2\t\t #Diameter of cylinder in m\n",
- "pi=3.141595\t#Constant value of pi\n",
- "\n",
- "#Calculations\n",
- "A=(pi/4.0)*d**2 #Area of cylinder \n",
- "Po=do*g*ho\t # Pressure due to oil in N/m**2\n",
- "W=(Pg+Po)*A\t #Weight of the piston in N\n",
- "\n",
- "#Output\n",
- "print'The total weight of piston and slab is',round(W,2),\"N\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The total weight of piston and slab is 683916.56 N\n"
- ]
- }
- ],
- "prompt_number": 27
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.27 Page No. 56"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is The pressure in the gas \n",
- "\n",
- "#Input data\n",
- "m=21\t\t#Mass of piston in kg\n",
- "P1=600\t\t#Pressure in the pipe 1 in kPa\n",
- "P2=170\t\t#Pressure in the pipe 2 in kPa\n",
- "d1=0.10\t\t#Diameter of the piston 1 in m\n",
- "d2=0.20\t\t#Diameter of the piston 2 in m\n",
- "pi=3.14155\t#Constant value of pi\n",
- "\n",
- "#Calculations\n",
- "F=(m*9.81)/1000\t\t#Force due to mass in kN\n",
- "F1=(pi/4)*d1**2*P1\t\t#Force 1 acting on 10 cm diameter piston in kN\n",
- "F2=(pi/4)*(d2**2-d1**2)*P2\t#Force 2 acting on 20 cm diameter piston in kN\n",
- "F3=F+F1+F2\t\t#Total downward force in kN\n",
- "P3=F3/((pi/4)*d2**2)\t#Pressure 3 in the gas in kPa\n",
- "\n",
- "#Output\n",
- "print'The pressure in the gas is ',round(P3,2),\"KPa\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The pressure in the gas is 284.06 KPa\n"
- ]
- }
- ],
- "prompt_number": 35
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.28 Page No. 57"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is The height of the building\n",
- "\n",
- "#Input data\n",
- "P1=0.755\t\t#Barometric reading at the bottom of the building in m\n",
- "P2=0.73\t\t#Barometric reading at the top of the building in m\n",
- "da=1.18\t\t#Density of air in kg/m**3\n",
- "g=9.81\t\t#Gravitalional constant in m/sec**2\n",
- "d=13600\t\t#Density of Hg in kg/m**3\n",
- "\n",
- "#Calculations\n",
- "h=((P1-P2)*d*g)/(da*g) #The height of the building in m\n",
- "\n",
- "#Output\n",
- "print'The height of the building ',round(h,1),\"m\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The height of the building 288.1 m\n"
- ]
- }
- ],
- "prompt_number": 37
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.29 Page No. 58"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The absolute pressure in the container A and B\n",
- "\n",
- "#Given\n",
- "PA=200\t\t#Gauge pressure reading for A in kPa\n",
- "PB=120\t\t#Gauge pressure reading for B in kPa\n",
- "hb=750\t\t#Barometer reading in mm of Hg\n",
- "g=9.806\t\t#Gravitational constant in m/sec**2\n",
- "d=13597\t\t#Density of Hg in barometer in kg/m**3\n",
- "\n",
- "#Calculations\n",
- "Pa=d*g*hb/10**6\t#Atmospheric pressure in kPa\n",
- "Pab1=PA+Pa\t#Absolute pressure in container A in kPa\n",
- "Pab2=PB+Pab1\t#Absolute pressure in container B in kPa\n",
- "\n",
- "#Output \n",
- "print'(a)The absolute pressure in the container A is',round(Pab1,1),\"kPa\" \n",
- "print'(b)The absolute pressure in the container B is ',round(Pab2,2),\"kPa\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The absolute pressure in the container A is 300.0 kPa\n",
- "(b)The absolute pressure in the container B is 420.0 kPa\n"
- ]
- }
- ],
- "prompt_number": 38
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.30 Page No. 59"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine the temprature in fahreneheit\n",
- "\n",
- "#Input data\n",
- "C1=40\t\t #Temperature 1 in degree centigrade\n",
- "C2=-20\t\t#Temperature 2 in degree centigrade \n",
- "\n",
- "#calculations\n",
- "F1=((C1/100.0)*180)+32\t#Temperature 1 in Fahrenheit\n",
- "F2=((C2/100.0)*180)+32\t#Temperature 2 in Fahrenheit\n",
- "\n",
- "#Output\n",
- "print'(a)Temperature after converting 40 degree C is',round(F1,2),\"F\"\n",
- "print'(b)Temperature after convertibg -20 degree C is ',round(F2,2),\"F\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Temperature after converting 40 degree C is 104.0 F\n",
- "(b)Temperature after convertibg -20 degree C is -4.0 F\n"
- ]
- }
- ],
- "prompt_number": 27
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.31 Page No. 59"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The temperature which has the same value on both the centrigrade and fahrenheit scales\n",
- "\n",
- "#Given that the temperature has the same value on both the centrigrade and fahrenheit scales\n",
- "#(C/100)=((F-32)/180)\n",
- "\n",
- "#Putting C=F\n",
- "C=(-32/180.0)/((1/100.0)-(1/180.0))\t#Centrigade temperature in degree C\n",
- "F=C\t\t\t#Fahrenheit temperature in degree Fahrenheit\n",
- "\n",
- "print'The temperature which has the same value on both the centrigrade and fahrenheit scales is',C\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The temperature which has the same value on both the centrigrade and fahrenheit scales is -40.0\n"
- ]
- }
- ],
- "prompt_number": 40
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.32 Page No. 59"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine the temprature\n",
- "\n",
- "#Input data\n",
- "P1=1.5\t\t#Thermometric properties at ice point\n",
- "P2=7.5\t\t#Thermometric properties at steam point\n",
- "P3=3.5\t\t#Thermometric property\n",
- "\n",
- "#Calculations\n",
- "import math\n",
- "M = array([[math.log(P2), 1], [math.log(P1), 1]])\n",
- "N=([100,0])\n",
- "X=inv(M)*N #Inverse matrix\n",
- "a=X[0,0]\n",
- "b=X[1,0]\n",
- "t=(a*math.log(P3)+b)\t#Required temperature in degree C\n",
- "\n",
- "#Output\n",
- "print'The required temperature is ',round(t,2),\"C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The required temperature is 52.65 C\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.33 Page No. 60"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is Temperature corresponding to the thermometric property\n",
- "\n",
- "#Input data\n",
- "T1=100\n",
- "T2=300 #Temperature of ice and steam point in the scale\n",
- "P1=1.86\t\t #Values of thermometric properties at ice point nad steam point respectively\n",
- "P2=6.8\n",
- "P=2.5\t\t\t #Thermometric property\n",
- "\n",
- "#Calculations\n",
- "import math\n",
- "#aln(P2)+b=300 #Costants in the temprature scale reading, a and b\n",
- "#aln(P1)+b=100\n",
- "#Solving above two equations\n",
- "a=(T2-T1)/(math.log(P2/P1)) \n",
- "b=T2-a*math.log(P2)\n",
- "t=(a*math.log(P)+b)\t#Required temperature in degree C\n",
- "\n",
- "#Output\n",
- "print'Temperature corresponding to the thermometric property is ',round(t,1),\"C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Temperature corresponding to the thermometric property is 145.6 C\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.34 Page No. 60"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine the required temprature\n",
- "\n",
- "#Input data\n",
- "p1=32.0\t\t #Pressure in mm of Hg at triple point of water\n",
- "p2=76.0\t\t #Pressure in mm of Hg above atmospheric pressure\n",
- "p3=752.0\t\t#Barometric pressure in mm of Hg\n",
- "T=273.16\t\t#Triple point of water in K\n",
- "\n",
- "#Calculations\n",
- "P1=p3+p1\t#Total pressure in mm of Hg\n",
- "P2=p2+p3\t#Total pressure in mm of Hg\n",
- "T2=((T*P2)/P1)-273.16\t#Temperture in degree C\n",
- "\n",
- "#Output\n",
- "print'Temperature is ',round(T2,2),\"C\"\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Temperature is 15.33 C\n"
- ]
- }
- ],
- "prompt_number": 20
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1.35 Page No.61"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine Temperature corresponding to the thermometric property \n",
- "\n",
- "#Input data\n",
- "T1=32\t\t#Temperatures of ice point and steam point respectively\n",
- "T2=212\n",
- "P1=1.86\t\t #P values at ice point and steam point respectively\n",
- "P2=6.81\n",
- "P=2.5\t\t\t#Reading on the thermometer\n",
- "\n",
- "#Calculations\n",
- "import math\n",
- "#aln(P1)+b=32 #Costants in the given temprature scale reading, a and b\n",
- "#aln(P2)+b=212\n",
- "#Solving above two equations\n",
- "a=(T2-T1)/(math.log(P2/P1)) \n",
- "b=T2-a*math.log(P2)\n",
- "t=(a*math.log(P)+b)\t#Required temperature in degree C\n",
- "\n",
- "#Output\n",
- "print'Temperature corresponding to the thermometric property is ',round(t,0),\"C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Temperature corresponding to the thermometric property is 73.0 C\n"
- ]
- }
- ],
- "prompt_number": 39
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:1c2bde816df4a48f4bf4b466f0c4a777a3dcae429d1891036e825820f9cb6fc1"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 1: Fundamental Concepts and Definitions"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.1 Page No. 34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "p=700\t\t #pressure of fluid in kN/m**2\n",
+ "v1=0.28\t\t#Initial volume of fluid in m**3\n",
+ "v2=1.68\t\t#Final volume of fluid in m**3\n",
+ "\n",
+ "#Calculations\n",
+ "W=p*(v2-v1)\t#Work done in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'The Work done is',round(W,1),'KJ or',round(W/1000,3),'MJ'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Work done is 980.0 KJ or 0.98 MJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.2 Page No.35"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "p1=138.0\t\t#Initial pressure of gas in kN/m**2\n",
+ "p2=690.0\t\t#Final pressure of gas in kN/m**2\n",
+ "v1=0.112\t\t#Initial volume in m**3\n",
+ "\n",
+ "#Calculations\n",
+ "P=p1/p2\t\t#Pressure ratio\n",
+ "v2=v1*(P**(1/1.4))\t#Final volume of gas in m**3\n",
+ "\n",
+ "#Output\n",
+ "print'The new volume of the gas is',round(v2,3),\"m**3\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The new volume of the gas is 0.035 m**3\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.3 Page No. 35"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "p1=2070\t\t#Initial pressure of gas in kN/m**2\n",
+ "p2=207\t\t#Final pressure of gas in kN/m**2\n",
+ "v1=0.014\t\t#Initial volume of gas in m**3\n",
+ "n=1.35\t\t#constant\n",
+ "\n",
+ "#Calculations\n",
+ "P=p1/p2\t\t#Pressure ratio\n",
+ "v2=v1*(P**(1/1.35))\t#Final volume of gas in m**3\n",
+ "W=(p1*v1-p2*v2)/(n-1)\t#Work done in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Final volume of gas ',round(v2,3),\"m**3 \"\n",
+ "print'(b)Work done by the gas during the expansion is',round(W,2),\"kJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Final volume of gas 0.077 m**3 \n",
+ "(b)Work done by the gas during the expansion is 37.22 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.4 Page No.36"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "v1=0.056\t\t#Initial volume of gas in m**3\n",
+ "v2=0.007\t\t#Final volume of gas in m**3\n",
+ "p1=100\t\t#Initial perssure compressed Isothermally in kN/m**2\n",
+ "\n",
+ "#Calculations\n",
+ "p2=(p1*v1)/v2\t#Final pressure in kN/m**2\n",
+ "W=p1*v1*(math.log(v2/v1))\t#Work done in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Final pressure is',round(p2,0),\"kN/m**2 \"\n",
+ "print'(b)The work done on gas is',round(-W,2), \"kJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Final pressure is 800.0 kN/m**2 \n",
+ "(b)The work done on gas is 11.64 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ " Example 1.5 Page No. 37"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "v1=1.0\t\t#Initial volume in m**3\n",
+ "v2=3.0\t\t#Final volume in m**3\n",
+ "\n",
+ "#Calculations\n",
+ "import math\n",
+ "W=10**5*(((v2**3-v1**3)/3)+8*(math.log(v2/v1)))\t#Work done in J\n",
+ "\n",
+ "#Output\n",
+ "print'The work done is',round(W,0),\"Nm\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The work done is 1745556.0 Nm\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.6 Page No. 38"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "v1=0.2\t#Initial volume in m**3\n",
+ "v2=0.5\t#Final volume in m**3\n",
+ "\n",
+ "#Calculations\n",
+ "W=1500*(((v2**2-v1**2)/200)+(v2-v1))/1000\t#Work done in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'The work done by the gas is',round(W,4),\"KJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The work done by the gas is 0.4516 KJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.8 Page No. 39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "v1=1.5\t\t#Initial volume in m**3\n",
+ "v2=2\t\t#Final volume in m**3\n",
+ "w1=2\t\t#Work receiving in Nm\n",
+ "p=6\t\t#constsnt pressure of gas in N/m**2\n",
+ "\n",
+ "#Calculations\n",
+ "w2=p*(v2-v1)\t#Work done in Nm\n",
+ "W=w2-w1\t\t#Net work done by the system in Nm\n",
+ "\n",
+ "#Output\n",
+ "print'Net work done by the system is',round(W,2),\"Nm\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Net work done by the system is 1.0 Nm\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.9 Page No. 40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "d=13596\t\t#Density of Hg in kg/m**3\n",
+ "g=9.806\t\t#gravity in m/sec**2\n",
+ "z=760.0\t\t#Barometer pressure in mm of Hg\n",
+ "Pv=40.0\t\t#Vaccum pressure in cm\n",
+ "dw=1000.0\t\t#Density of water in kg/m**3\n",
+ "Zw=1.5\t\t#Level of water in m\n",
+ "\n",
+ "#Calculations\n",
+ "p=(d*g*z)/10**6\t#Pressure in kPa\n",
+ "p1=(80/76.0)*p\t#Pressure in kPa\n",
+ "Pa=p-Pv\t\t#Absolute pressure in kPa\n",
+ "p2=(36/76.0)*p\t#Pressure in kPa\n",
+ "p3=(dw*g*Zw)/1000.0\t\t#pressure in kPa\n",
+ "p4=(5.2*10**5)/1000.0\t#pressure in kPa\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Pressure of 80cm of Hg is',round(p1,2),\"kPa\" \n",
+ "print'(b)Pressure of 40cm of Hg vaccum is',round(p2,2), \"kPa \"\n",
+ "print'(c)Pressure due to 1.5m of water coloumn is',round(p3*1000,4),\"N/m**2or Pa\" \n",
+ "print'(d)Pressure in kPa for 5.2bar is',round(p4,2),\"kPa\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Pressure of 80cm of Hg is 106.66 kPa\n",
+ "(b)Pressure of 40cm of Hg vaccum is 48.0 kPa \n",
+ "(c)Pressure due to 1.5m of water coloumn is 14709.0 N/m**2or Pa\n",
+ "(d)Pressure in kPa for 5.2bar is 520.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.10 Page No.41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data \n",
+ "z=750\t\t#Barometric pressure in mm of Hg\n",
+ "g=9.81\t\t#Gravity in m/sec**2\n",
+ "Pa=101.325\t#one atm pressure in kN/m**2\n",
+ "Pg=3.3\t\t#Pressure in atm\n",
+ "Pf=3.2\t\t#Pressure in m of water\n",
+ "d=13596\t\t#Density of Hg in kg/m**3\n",
+ "\n",
+ "#calculations\n",
+ "Pp=(d*g*z)/10**6\t\t #Pressure in kPa\n",
+ "p1=(d*g*0.55)/1000.0\t\t #Pressure in kPa\n",
+ "p2=Pp+(Pg*101.325)\t #Pressure in kPa\n",
+ "p3=Pp+(Pf*g*100)/1000.0\t#Pressure in kPa\n",
+ "p4=4.6*100\t\t #Pressure in kPa\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Pressure of 55cm of Hg (Abs)',round(p1,1),\"KPa\"\n",
+ "print'(b)Pressure at 3.3 atm (Gauge)',round(p2,1),\"kPa\" \n",
+ "print'(c)Pressure of 3.2m of water (Gauge)',round(p3,1),\"kPa\" \n",
+ "print'NOTE: In the book there is mistake in calculation p3 '\n",
+ "print'(d)Pressure of 4.6bar (Abs)',round(p4,1),\"kPa\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Pressure of 55cm of Hg (Abs) 73.4 KPa\n",
+ "(b)Pressure at 3.3 atm (Gauge) 434.4 kPa\n",
+ "(c)Pressure of 3.2m of water (Gauge) 103.2 kPa\n",
+ "NOTE: In the book there is mistake in calculation p3 \n",
+ "(d)Pressure of 4.6bar (Abs) 460.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.11 Page No. 42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "Zw=50\t\t#Manometer reading of water in cm\n",
+ "Zo=763\t\t#Atmospheric pressure in mm of Hg\n",
+ "d=13.6*10**3\t#Density of Hg in kg/m**3\n",
+ "dw=1000\t\t#Density of water in kg/m**3\n",
+ "g=9.81\t\t#Gravity in m/sec**2\n",
+ "\n",
+ "#Calculations\n",
+ "Pa=(d*g*Zo)/10**6\t\t#Atmospheric pressure in kPa\n",
+ "Pg=(dw*g*Zw)/10**5\t#Gauge pressure in kPa\n",
+ "Pab=Pa+Pg\t\t#Absolute pressure in kPa\n",
+ "\n",
+ "#Output\n",
+ "print'Absolute pressure is',round(Pab,2),\"kPa\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute pressure is 106.7 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.12 Page No. 42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "Z=70\t\t\t#Vaccum gauge reading in cm of Hg\n",
+ "Pa=101.325\t\t#Atmospheric pressure in kPa\n",
+ "d=13.6*10**3\t\t#Density of Hg in kg/m**3\n",
+ "g=9.81\t\t\t#Gravity in m/sec**2\n",
+ "\n",
+ "#Calculations\n",
+ "Pv=(d*g*Z)/10**5\t\t#Vaccum pressure in kPa\n",
+ "Pab=Pa-Pv\t\t#Absolute pressure in kPa\n",
+ "\n",
+ "#Output\n",
+ "print'Absolute pressure is',round(Pab,2),\"kPa\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute pressure is 7.93 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.13 Page No. 43"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "Pv=30\t\t#Vaccum pressure in kPa\n",
+ "Z=755\t\t#Barometer reading in mm of Hg\n",
+ "d=13590\t\t#Density of Hg in kg/m**3\n",
+ "g=9.81\t\t#Gravity in m/sec**2\n",
+ "\n",
+ "#calculations \n",
+ "Pa=(d*g*Z)/10**6\t#Atmospheric perssure in kPa\n",
+ "Pab=Pa-Pv\t#Absolute pressure in kPa\n",
+ "\n",
+ "#Output\n",
+ "print'Asolute pressure in the tank is',round(Pab,2),\"kPa\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Asolute pressure in the tank is 70.66 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.14 Page No. 43"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Input data\n",
+ "Z=0.562\t\t#Level of open limb in m\n",
+ "Z1=0.761\t\t#Barometer reading in m of Hg\n",
+ "g=9.79\t\t#Gravity in m/sec**2\n",
+ "d=13640\t\t#Density of Hg in kg/m**2\n",
+ "\n",
+ "#Calculations\n",
+ "Pa=(d*g*Z1)/1000.0\t#Atmospheric pressure in kPa\n",
+ "Ph=(d*g*Z)/1000.0\t#Pressure exercterd due to height in kPa\n",
+ "Pab=Pa+Ph\t#Absolute pressure in kPa\n",
+ "\n",
+ "#Output\n",
+ "print'The gas pressure is',round(Pab,3),\"kN/m**2\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The gas pressure is 176.668 kN/m**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.15 Page No. 44"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data \n",
+ "d=13.596*10**3\t#Density of Hg in kg/m**3\n",
+ "dl=800\t\t#Density of liquid in kg/m**3\n",
+ "Z=30\t\t#Level of the liquid in the arm in cm\n",
+ "Z1=0.75\t\t#Barometric pressure in m\n",
+ "g=9.81\t\t#Gravity in m/sec**2\n",
+ "\n",
+ "#Calculatins\n",
+ "Pg=(dl*g*Z)/10**7\t#Gauge pressure in bar\n",
+ "Pa=(d*g*Z1)/10**5\t#Atmospheric pressure in bar\n",
+ "Pab=Pa+Pg #Absolute pressure in bar\n",
+ "\n",
+ "#Output\n",
+ "print'Absolute pressure of the gas is',round(Pab,2),\"bar\"\n",
+ "print'NOTE:In the book there is calculation mistake in last step'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute pressure of the gas is 1.02 bar\n",
+ "NOTE:In the book there is calculation mistake in last step\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.16 Page No. 45"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "Z1=0.17\t\t#Level of liquid in m\n",
+ "Z=0.76\t\t#Barometer readings in m\n",
+ "d=13596\t\t#Density of Hg in kg/m**3\n",
+ "g=9.806\t\t#Gravity in m/sec**2\n",
+ "s=0.8\t\t#Specific gravity \n",
+ "d1=1000\t\t#Density of water in kg/m**3\n",
+ "\n",
+ "#Calculations\n",
+ "dl=s*d1\t\t#Density of given liquid in kg/m**3\n",
+ "Pa=d*g*Z\t\t#Atmospheric pressure in N/m**2\n",
+ "p=dl*g*Z1\t#Pressure in N/m**2\n",
+ "Pab=(Pa-p)/10**5\t#Absolute pressure in bar\n",
+ "\n",
+ "#Output\n",
+ "print'Absolute pressure of the gas is',round(Pab),\"bar\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute pressure of the gas is 1.0 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.17 Page No. 46"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "g=9.806\t\t#Gravity in m/sec**2\n",
+ "d=13596\t\t#Density of Hg in kg/m**3\n",
+ "Z=9.75\t\t#Level of Hg in cm\n",
+ "dw=1000\t\t#Density of water in kg/m**3\n",
+ "Zw=0.034\t\t#Coloumn of condensate in m\n",
+ "Zo=0.76\t\t#Atmospheric pressure in m of Hg\n",
+ "\n",
+ "#Calculations\n",
+ "P=dw*g*Zw\t #Pressure in N/m**2\n",
+ "Pa=d*g*Zo\t #Atmospheric pressure in N/m**2\n",
+ "Pg=(d*g*Z)/100.0\t#Gauge pressure in N/m**2\n",
+ "Pab=(Pa+Pg-P)/10**5\t#Absolute pressure in bar\n",
+ "\n",
+ "#Output\n",
+ "print'Pressure due to height is',round(P,3),'N/m**2'\n",
+ "print'Atmospheric Pressure is ',round(Pa,0),'N/m**2'\n",
+ "print'Absolute pressure of steam is',round(Pab,4),\"bar\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure due to height is 333.404 N/m**2\n",
+ "Atmospheric Pressure is 101325.0 N/m**2\n",
+ "Absolute pressure of steam is 1.1399 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.18 Page No. 47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "g=9.7\t\t #Gravity in m/sec**2\n",
+ "d=13.69*10**3\t#Density of Hg in kg/m**3\n",
+ "dw=1000\t\t #Density of water in kg/m**3\n",
+ "Pa=98\t \t#Atmospheric pressure in kPa\n",
+ "Z=0.6\t \t#Manometer level difference in m of Hg\n",
+ "Zw=0.04\t\t #Water coloumn level in m\n",
+ "\n",
+ "#Calculations \n",
+ "Pw=(dw*g*Zw)/1000.0\t#Pressure due to water in kPa\n",
+ "Pg=(d*g*Z)/1000.0\t\t#Pressure in kPa\n",
+ "Pab1=Pa+Pg-Pw\t\t#Absolute pressure in kPa\n",
+ "Pab=Pab1/100.0\t\t #Absolute pressure in bar\n",
+ "\n",
+ "#Output \n",
+ "print'The absolute pressure of steam is',round(Pab,2),\"bar\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The absolute pressure of steam is 1.77 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.19 Page No. 48"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "Z=0.76\t\t#Actual height of mercury coloumn in m\n",
+ "g=9.806\t\t#Gravity in m/sec**2\n",
+ "d=13596\t\t#Density of Hg in kg/m**3\n",
+ "dw=1000\t\t#Density of water in kg/m**3\n",
+ "Zw=0.035\t\t#Height of condensate coloumn in m\n",
+ "Zh=0.10\t\t#Height of mercury coloumn in m\n",
+ "\n",
+ "#Calculations\n",
+ "Pa=d*g*Z\t\t#Atmospheric pressure in N/m**2\n",
+ "Pw=dw*g*Zw\t#Pressure due to water in N/m**2\n",
+ "Ph=d*g*Zh\t#Pressure due to Hg in N/m**2\n",
+ "Pab=(Pa+Ph-Pw)/10**5\t#Absolute pressure in bar\n",
+ "\n",
+ "#Output \n",
+ "print'Absolute pressure of steam in the pipe is',round(Pab,2),\"bar\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute pressure of steam in the pipe is 1.14 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.20Page No. 49"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "dk=800\t\t#Density of kerosene in kg/m**3\n",
+ "g=9.81\t\t#gravity in m/sec**2\n",
+ "Zk=0.051\t\t#Kerosene vapour on Hg coloumn in m\n",
+ "d=13600\t\t#Density of Hg in kg/m**3\n",
+ "Zh=0.1\t\t#Hg level in m\n",
+ "Z=0.755\t\t#Atmospheric pressure in m of Hg\n",
+ "\n",
+ "#Calculations\n",
+ "Pk=dk*g*Zk\t\t #Pressure of kerosene in N/m**2\n",
+ "Pa=d*g*Z\t\t #Atmospheric pressure in N/m**2\n",
+ "Ph=d*g*Zh \t#Pressure due to Hg in N/m**2\n",
+ "Pab=(Pa+Ph-Pk)/1000.0\t#Absolute pressure in kPa\n",
+ "\n",
+ "#Output \n",
+ "print'Absolute pressure of vapour is ',round(Pab,2),\"kPa\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute pressure of vapour is 113.67 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.21 Page No. 50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "d=13596\t\t#Density of Hg in kg/m**3\n",
+ "g=9.806\t\t#Gravity in m/sec**2\n",
+ "df=0.8*1000\t#Density of fluid in kg/m**3\n",
+ "Z=0.76\t\t#Atmospheric pressure in m of Hg\n",
+ "Zf=0.3\t\t#Height of fluid coloumn in m\n",
+ "\n",
+ "#Calculations\n",
+ "Pa=d*g*Z\t\t#Atmospheric perssure in N/m**2\n",
+ "P=df*g*Zf\t#Pressure due to fluid in N/m**2\n",
+ "Pab=(Pa+P)/10**5\t#Absolute pressure in bar\n",
+ "Zh=((Pab*10**5-Pa)/(d*g))*100\t#Difference between the height of Hg coloumn in 2 arms in m\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The Absolute pressure of the gas in pipe line Pab',round(Pab,2),\" bar\" \n",
+ "print'(b)If the fluid used is Hg then the difference of height of Hg coloumn in the 2 arms is',round(Zh,2),\"cm\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " (a)The Absolute pressure of the gas in pipe line Pab 1.04 bar\n",
+ "(b)If the fluid used is Hg then the difference of height of Hg coloumn in the 2 arms is 1.77 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.22 Page No. 51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "Pa=1\t\t#Atmospheric pressure in bar\n",
+ "g=9.81\t\t#Gravity in m/sec**2\n",
+ "do=0.8*1000\t#Density of oil in kg/m**3\n",
+ "Zo=0.8\t\t#Level of oil in m\n",
+ "dw=1000\t\t#Density of water in kg/m**3\n",
+ "Zw=0.65\t\t#Level of water in m\n",
+ "d=13.6*10**3\t#Density of Hg in kg/m**3\n",
+ "Z=0.45\t\t#Level of Hg in m\n",
+ "\n",
+ "#Calculations\n",
+ "Po=(do*g*Zo)/10**5\t#Pressure of oil in bar\n",
+ "Pw=(dw*g*Zw)/10**5\t#Pressure of water in bar\n",
+ "P=(d*g*Z)/10**5\t\t#Pressure of Hg in bar\n",
+ "Pab=Pa+Po+Pw+P\t\t#Pressure at the bottom of the coloumn in bar\n",
+ "Pow=Pa+Po\t\t#Pressure at the interface of oil and water in bar\n",
+ "Poh=Pa+Po+Pw\t\t#Pressure at the interface of water and Hg\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Pressure at the bottom of the coloumn is',round(Pab,2),\"bar\" \n",
+ "print'(b)Pressure at the inter surface of oil and water ia',round(Pow,3),\"bar \" \n",
+ "print'(c)Pressure at the inter surface of water and Hg ',round(Poh,3),\"bar\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Pressure at the bottom of the coloumn is 1.73 bar\n",
+ "(b)Pressure at the inter surface of oil and water ia 1.063 bar \n",
+ "(c)Pressure at the inter surface of water and Hg 1.127 bar\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.23 Page No. 52"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "Z=0.76\t\t#Barometer reading in m\n",
+ "g=9.81\t\t#Gravity in m/sec**2\n",
+ "d=13.6*10**3\t#Density of Hg in kg/m**3\n",
+ "Pab=1.2*10**5\t#Absolute pressure in N/m**2\n",
+ "do=0.8*1000\t#Density of oil in kg/m**3\n",
+ "dw=1000\t\t#Density of water in kg/m**3\n",
+ "dh=13.6*10**3\t#Density of Hg in kg/m**3\n",
+ "\n",
+ "#calculations\n",
+ "Pa=dh*g*Z\t#Atmospheric pressure in N/m**2\n",
+ "Pg=Pab-Pa\t#Gauge pressure in N/m**2\n",
+ "Zo=Pg/(do*g)\t#Height of oil in manometer in m\n",
+ "Pw=Pab-Pa\t#Pressure exercted by water in N/m**2\n",
+ "Zw=Pw/(dw*g)\t#Height of water in manometer in m\n",
+ "P=Pab-Pa\t\t#Pressure of Hg in N/m**2\n",
+ "Zh=P/(d*g)\t#Height of Hg in manometer in m\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The height of fluid for oil Manometer',round(Zo,2),\"m \"\n",
+ "print'(b)The height of fluid for water Manometer ia',round(Zw,2),\"m\" \n",
+ "print'(c)The height of fluid for Hg Manometer is',round(Zh,3),\"m\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The height of fluid for oil Manometer 2.37 m \n",
+ "(b)The height of fluid for water Manometer ia 1.9 m\n",
+ "(c)The height of fluid for Hg Manometer is 0.139 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.24 Page No. 54"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Zg=0.753\t\t#Barometer reading at ground level in m\n",
+ "Zp=0.690\t\t#Pilots barometer reading in the plane in m\n",
+ "d=13600\t\t#Density of Hg in kg/m**3\n",
+ "g=9.81\t\t #Gravity in m/sec**2\n",
+ "da=1.25\t\t#Density of air in kg/m**3\n",
+ "\n",
+ "#Calculations\n",
+ "Pg=d*g*Zg\t#Pressure at ground level in N/m**2\n",
+ "Pp=d*g*Zp\t#Pressure at plane level in N/m**2\n",
+ "P=Pg-Pp\t\t#Change of pressure at ground level and that of plane level in N/m**2\n",
+ "Za=P/(da*g)\t#Altitude of plane from ground in m\n",
+ "\n",
+ "#Output \n",
+ "print'The altitude of the plane from ground level is',round(Za,1),\"m\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The altitude of the plane from ground level is 685.4 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.25 Page No. 54"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "dw=1000\t\t#Density of water in kg/m**3\n",
+ "dh=13590\t\t#Density of Hg in kg/m**3\n",
+ "Pa=400\t\t#Pressure at A in kPa\n",
+ "g=9.81\t\t#Gravity in N/m**2\n",
+ "Zw1=2.5\t\t#First level of water in m\n",
+ "Zw2=0.4\t\t#Second level of water in m\n",
+ "Zh=0.6\t\t#Level of Hg in m\n",
+ "\n",
+ "#Calculations \n",
+ "Pw1=dw*g*Zw1\t#First level of water pressure in N/m**2\n",
+ "Pw2=dw*g*Zw2\t#Second level of water pressure in n/m**2\n",
+ "Ph=dh*g*Zh\t#Pressure of Hg in N/m**2\n",
+ "Pb=((Pa*1000)+Pw1+Pw2-Ph)/1000\t#Pressure exercted at B in kPa\n",
+ "\n",
+ "#Output\n",
+ "print'Pressure exercted at B is',round(Pb,2),\"KPa\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure exercted at B is 348.46 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.26 Page No. 55"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "do=0.902*10**3\t#Density of oil in kg/m**3\n",
+ "Pg=2*10**5\t #Gauge pressure in N/m**2\n",
+ "g=9.81\t\t #Gravity in m/sec**2\n",
+ "ho=2\t\t #Level of oil in m\n",
+ "d=2\t\t #Diameter of cylinder in m\n",
+ "pi=3.141595\t#Constant value of pi\n",
+ "\n",
+ "#Calculations\n",
+ "A=(pi/4.0)*d**2 #Area of cylinder \n",
+ "Po=do*g*ho\t # Pressure due to oil in N/m**2\n",
+ "W=(Pg+Po)*A\t #Weight of the piston in N\n",
+ "\n",
+ "#Output\n",
+ "print'The total weight of piston and slab is',round(W,2),\"N\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total weight of piston and slab is 683916.56 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.27 Page No. 56"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Input data\n",
+ "m=21\t\t#Mass of piston in kg\n",
+ "P1=600\t\t#Pressure in the pipe 1 in kPa\n",
+ "P2=170\t\t#Pressure in the pipe 2 in kPa\n",
+ "d1=0.10\t\t#Diameter of the piston 1 in m\n",
+ "d2=0.20\t\t#Diameter of the piston 2 in m\n",
+ "pi=3.14155\t#Constant value of pi\n",
+ "\n",
+ "#Calculations\n",
+ "F=(m*9.81)/1000\t\t#Force due to mass in kN\n",
+ "F1=(pi/4)*d1**2*P1\t\t#Force 1 acting on 10 cm diameter piston in kN\n",
+ "F2=(pi/4)*(d2**2-d1**2)*P2\t#Force 2 acting on 20 cm diameter piston in kN\n",
+ "F3=F+F1+F2\t\t#Total downward force in kN\n",
+ "P3=F3/((pi/4)*d2**2)\t#Pressure 3 in the gas in kPa\n",
+ "\n",
+ "#Output\n",
+ "print'The pressure in the gas is ',round(P3,2),\"KPa\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure in the gas is 284.06 KPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.28 Page No. 57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "P1=0.755\t\t#Barometric reading at the bottom of the building in m\n",
+ "P2=0.73\t\t#Barometric reading at the top of the building in m\n",
+ "da=1.18\t\t#Density of air in kg/m**3\n",
+ "g=9.81\t\t#Gravitalional constant in m/sec**2\n",
+ "d=13600\t\t#Density of Hg in kg/m**3\n",
+ "\n",
+ "#Calculations\n",
+ "h=((P1-P2)*d*g)/(da*g) #The height of the building in m\n",
+ "\n",
+ "#Output\n",
+ "print'The height of the building ',round(h,1),\"m\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The height of the building 288.1 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.29 Page No. 58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Given\n",
+ "PA=200\t\t#Gauge pressure reading for A in kPa\n",
+ "PB=120\t\t#Gauge pressure reading for B in kPa\n",
+ "hb=750\t\t#Barometer reading in mm of Hg\n",
+ "g=9.806\t\t#Gravitational constant in m/sec**2\n",
+ "d=13597\t\t#Density of Hg in barometer in kg/m**3\n",
+ "\n",
+ "#Calculations\n",
+ "Pa=d*g*hb/10**6\t#Atmospheric pressure in kPa\n",
+ "Pab1=PA+Pa\t#Absolute pressure in container A in kPa\n",
+ "Pab2=PB+Pab1\t#Absolute pressure in container B in kPa\n",
+ "\n",
+ "#Output \n",
+ "print'(a)The absolute pressure in the container A is',round(Pab1,1),\"kPa\" \n",
+ "print'(b)The absolute pressure in the container B is ',round(Pab2,2),\"kPa\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The absolute pressure in the container A is 300.0 kPa\n",
+ "(b)The absolute pressure in the container B is 420.0 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 38
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.30 Page No. 59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "C1=40\t\t #Temperature 1 in degree centigrade\n",
+ "C2=-20\t\t#Temperature 2 in degree centigrade \n",
+ "\n",
+ "#calculations\n",
+ "F1=((C1/100.0)*180)+32\t#Temperature 1 in Fahrenheit\n",
+ "F2=((C2/100.0)*180)+32\t#Temperature 2 in Fahrenheit\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Temperature after converting 40 degree C is',round(F1,2),\"F\"\n",
+ "print'(b)Temperature after convertibg -20 degree C is ',round(F2,2),\"F\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Temperature after converting 40 degree C is 104.0 F\n",
+ "(b)Temperature after convertibg -20 degree C is -4.0 F\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.31 Page No. 59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "C=(-32/180.0)/((1/100.0)-(1/180.0))\t#Centrigade temperature in degree C\n",
+ "F=C\t\t\t#Fahrenheit temperature in degree Fahrenheit\n",
+ "\n",
+ "print'The temperature which has the same value on both the centrigrade and fahrenheit scales is',C\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The temperature which has the same value on both the centrigrade and fahrenheit scales is -40.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.32 Page No. 59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "P1=1.5\t\t#Thermometric properties at ice point\n",
+ "P2=7.5\t\t#Thermometric properties at steam point\n",
+ "P3=3.5\t\t#Thermometric property\n",
+ "\n",
+ "#Calculations\n",
+ "import math\n",
+ "M = array([[math.log(P2), 1], [math.log(P1), 1]])\n",
+ "N=([100,0])\n",
+ "X=inv(M)*N #Inverse matrix\n",
+ "a=X[0,0]\n",
+ "b=X[1,0]\n",
+ "t=(a*math.log(P3)+b)\t#Required temperature in degree C\n",
+ "\n",
+ "#Output\n",
+ "print'The required temperature is ',round(t,2),\"C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The required temperature is 52.65 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.33 Page No. 60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "T1=100\n",
+ "T2=300 #Temperature of ice and steam point in the scale\n",
+ "P1=1.86\t\t #Values of thermometric properties at ice point nad steam point respectively\n",
+ "P2=6.8\n",
+ "P=2.5\t\t\t #Thermometric property\n",
+ "\n",
+ "#Calculations\n",
+ "import math\n",
+ "#aln(P2)+b=300 #Costants in the temprature scale reading, a and b\n",
+ "#aln(P1)+b=100\n",
+ "#Solving above two equations\n",
+ "a=(T2-T1)/(math.log(P2/P1)) \n",
+ "b=T2-a*math.log(P2)\n",
+ "t=(a*math.log(P)+b)\t#Required temperature in degree C\n",
+ "\n",
+ "#Output\n",
+ "print'Temperature corresponding to the thermometric property is ',round(t,1),\"C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Temperature corresponding to the thermometric property is 145.6 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.34 Page No. 60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "p1=32.0\t\t #Pressure in mm of Hg at triple point of water\n",
+ "p2=76.0\t\t #Pressure in mm of Hg above atmospheric pressure\n",
+ "p3=752.0\t\t#Barometric pressure in mm of Hg\n",
+ "T=273.16\t\t#Triple point of water in K\n",
+ "\n",
+ "#Calculations\n",
+ "P1=p3+p1\t#Total pressure in mm of Hg\n",
+ "P2=p2+p3\t#Total pressure in mm of Hg\n",
+ "T2=((T*P2)/P1)-273.16\t#Temperture in degree C\n",
+ "\n",
+ "#Output\n",
+ "print'Temperature is ',round(T2,2),\"C\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Temperature is 15.33 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1.35 Page No.61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "T1=32\t\t#Temperatures of ice point and steam point respectively\n",
+ "T2=212\n",
+ "P1=1.86\t\t #P values at ice point and steam point respectively\n",
+ "P2=6.81\n",
+ "P=2.5\t\t\t#Reading on the thermometer\n",
+ "\n",
+ "#Calculations\n",
+ "import math\n",
+ "#aln(P1)+b=32 #Costants in the given temprature scale reading, a and b\n",
+ "#aln(P2)+b=212\n",
+ "#Solving above two equations\n",
+ "a=(T2-T1)/(math.log(P2/P1)) \n",
+ "b=T2-a*math.log(P2)\n",
+ "t=(a*math.log(P)+b)\t#Required temperature in degree C\n",
+ "\n",
+ "#Output\n",
+ "print'Temperature corresponding to the thermometric property is ',round(t,0),\"C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Temperature corresponding to the thermometric property is 73.0 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Mechanical_Engineering/bme2.ipynb b/Basic_Mechanical_Engineering/bme2.ipynb
index 71e898ae..d16be4dc 100644
--- a/Basic_Mechanical_Engineering/bme2.ipynb
+++ b/Basic_Mechanical_Engineering/bme2.ipynb
@@ -1,1447 +1,1431 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 2:First Law of Thermodynamics"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.1 Page No.90"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is net work transfer in a cycle\n",
- "\n",
- "#Input data\n",
- "h1=60\t\t#The heat transfer in the process in kJ\n",
- "h2=-8\t\t#The heat transfer in the process in kJ\n",
- "h3=-34\t\t#The heat transfer in the process in kJ\n",
- "h4=6\t\t#The heat transfer in the process in kJ\n",
- "\n",
- "#Calculations\n",
- "Q=h1+h2+h3+h4\t\t#Net work transfer in a cycle in kJ\n",
- "\n",
- "#Output\n",
- "print'Net work transfer in a cycle is',round(Q,2),\"KJ\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Net work transfer in a cycle is 24.0 KJ\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.2 Page No. 90"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#FinThe work done on the system\n",
- "\n",
- "#Input data\n",
- "Q=-300\t\t#Heat transfer in the system consisting of the gas in kJ\n",
- "u=0\t\t#Internal energy is constant\n",
- "\n",
- "#Calculations\n",
- "W=Q-u\t\t#Work done of the system in kJ\n",
- "\n",
- "#Output\n",
- "print'The work done of the system W = %3.0f kJ ',round(W,1),\"KJ\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The work done of the system W = %3.0f kJ -300.0 KJ\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.3 Page No. 90"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Input data\n",
- "v1=1.5\t\t#Initial volume of the process in m**3\n",
- "v2=4.5\t\t#Final volume of the process in m**3\n",
- "Q=2000\t\t#Amount of heat added in kJ\n",
- "\n",
- "#Calculations\n",
- "W=100*((3.5*math.log(v2/v1))+(3*(v2-v1)))\t#Amount of work done in kJ\n",
- "U=Q-W\t\t\t\t\t#The change in internal energy in kJ\n",
- "\n",
- "#Output\n",
- "print'The change in internal energy is',round(U,2),\"KJ\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The change in internal energy is 715.49 KJ\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.4 Page No.91"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is the heat transfer per kg of steam\n",
- "\n",
- "#Input data\n",
- "h1=35\t\t#Enthalpy of water entering the boiler in kJ/kg\n",
- "h2=705\t\t#Enthalpy of steam leaving the boiler in kJ/kg\n",
- "C=0\t\t#Change in kinetic energy is neglected\n",
- "Z=0\t\t#Change in potential energy is neglected\n",
- "\n",
- "#Calculations\n",
- "q=h2-h1\t\t#The heat transfer per kg of steam in kJ/kg\n",
- "\n",
- "#Output\n",
- "print'The heat transfer per kg of steam is',round(q,1),\"kJ/kg\"\t\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The heat transfer per kg of steam is 670.0 kJ/kg\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.5 Page No. 92"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine (a)Change in energy in a-b,b-c,c-d,d-a process \n",
- "#Heat developed in the process d-a \n",
- "#Work done in the d-a process \n",
- "#Net rate of work output\n",
- "\n",
- "#Input data\n",
- "Q=-170\t\t#Sum of all heat transfers per cycle in kJ\n",
- "N=100\t\t#Total number of cycles per min in cycles/min\n",
- "Q1=0\t\t#Heat developed in a-b process in kJ/min\n",
- "Q2=21000\t\t#Heat developed in b-c process in kJ/min\n",
- "Q3=-2100\t\t#Heat developed in c-d process in kJ/min\n",
- "W1=2170\t\t#Work done in the process a-b in kJ/min\n",
- "W2=0\t\t#Work done in the b-c process in kJ/min\n",
- "E3=-36600\t#Change in energy in the process in kJ/min\n",
- "\n",
- "#Calculations\n",
- "E1=Q1-W1\t\t#Change in energy in process a-b in kJ/min\n",
- "E2=Q2-W2\t\t#Change in energy in b-c process in kJ/min\n",
- "W3=Q3-E3\t\t#Work done in the c-d process in kJ/min\n",
- "Qt=Q*N\t\t\t#Total heat transfer per min in kJ/min \n",
- "Q4=Qt-Q1-Q2-Q3\t\t#Heat developed in the process d-a in kJ/min\n",
- "Et=0\t\t\t#Total change in energy of the cycle\n",
- "E4=Et-E1-E2-E3\t\t#Energy in the process d-a in kJ/min\n",
- "W4=Q4-E4\t\t#Work done in the d-a process in kJ/min \n",
- "Wn=Qt/60.0\t\t#Net rate of work output in kW\n",
- "\n",
- "#Output\n",
- "print'(a)Change in energy in a-b process is',round(E1,2),\"kJ/min\"\n",
- "print'(b)Change in energy in b-c process is',round(E2,2),\"kJ/min\"\n",
- "print'(c)Work done in the c-d process is',round(W3,2),\"kJ/min\"\n",
- "print'(d)Heat developed in the process d-a is',round(Q4,2),\"kJ/min\"\n",
- "print'(e)Energy in the process d-a is',round(E4,2),\"kJ/min\"\n",
- "print'(f)Work done in the d-a process is',round(W4,2),\"kJ/min\"\n",
- "print'(g)Net rate of work output is',round(Wn,2),\"kW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Change in energy in a-b process is -2170.0 kJ/min\n",
- "(b)Change in energy in b-c process is 21000.0 kJ/min\n",
- "(c)Work done in the c-d process is 34500.0 kJ/min\n",
- "(d)Heat developed in the process d-a is -35900.0 kJ/min\n",
- "(e)Energy in the process d-a is 17770.0 kJ/min\n",
- "(f)Work done in the d-a process is -53670.0 kJ/min\n",
- "(g)Net rate of work output is -283.33 kW\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.6 Page No. 93"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine (a)Change in work done in 1-2,2-3,3-1 process \n",
- "#change in energy in the process 2-3 \n",
- "#mass flow rate and rate of power and heat developed\n",
- "\n",
- "#Input data\n",
- "Q1=50\t\t#Heat developed in the 1-2 process in kJ/kg\n",
- "U1=20\t\t#Change in energy in the 1-2 process in kJ/kg\n",
- "Q2=-30\t\t#Heat developed in the 2-3 process in kJ/kg\n",
- "W2=-40\t\t#Work done in the 2-3 process in kj/kg\n",
- "U3=-30\t\t#Change in energy in the 3-1 process in kJ/kg\n",
- "Wt=30\t\t#Net work done per kg of fluid in kJ/kg\n",
- "m=0.1\t\t#Mass of fluid in the cycle in kg\n",
- "N=10\t\t#Number of cycles per sec in cycles/sec\n",
- "\n",
- "#Calculations\n",
- "W1=Q1-U1\t#Work done in the 1-2 process in kJ/kg\n",
- "U2=Q2-W2\t#Change in energy in the 2-3 process in kJ/kg\n",
- "W3=Wt-W1-W2\t#Work done in the 3-1 process in kJ/kg\n",
- "Q3=W3+U3\t#Heat developed in the process in kJ/kg\n",
- "m1=m*N\t\t#mass flow rate per sec in kg/sec\n",
- "P=Wt*m1\t\t#Rate of power in kW\n",
- "\n",
- "#Output\n",
- "print'(a)Work done in the 1-2 process is',round(W1,1),\"kJ/kg\"\n",
- "print'(b)Change in energy in the 2-3 process is',round(U2,1),\"kJ/kg\"\n",
- "print'(c)Work done in the 3-1 process is',round(W3,1),\"kJ/kg\"\n",
- "print'(d)Heat developed in the processis',round(Q3,1),\"kJ/kg\"\n",
- "print'(e)mass flow rate per sec ',round(m1,1), \"kg/sec \"\n",
- "print'(f)Rate of power is',round(P,2),\"kW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Work done in the 1-2 process is 30.0 kJ/kg\n",
- "(b)Change in energy in the 2-3 process is 10.0 kJ/kg\n",
- "(c)Work done in the 3-1 process is 40.0 kJ/kg\n",
- "(d)Heat developed in the processis 10.0 kJ/kg\n",
- "(e)mass flow rate per sec 1.0 kg/sec \n",
- "(f)Rate of power is 30.0 kW\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.7 Page No. 94"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine (a)Change in work done in 1-2 process \n",
- "#total change in energy \n",
- "#work done and heat developed\n",
- "\n",
- "#Input data\n",
- "m=3.0\t\t#Mass of substance in the system in kg\n",
- "P1=500.0\t\t#Initial pressure of the system in kPa\n",
- "P2=100.0\t\t#Final pressure of the system in kPa\n",
- "V1=0.22\t\t#Initial volume of the system in m**3\n",
- "n=1.2\t\t#Polytropic index \n",
- "Q1=30.0\t\t#Heat transfer for the another process\n",
- "\n",
- "#Calculations\n",
- "V2=V1*(P1/P2)**(1/1.2)\t#Final volume of the system in m**3\n",
- "U=3.56*(P2*V2-P1*V1)\t#Total change in internal energy in kJ\n",
- "W1=(P2*V2-P1*V1)/(1-n)\t#Work done for the 1-2 process in kJ\n",
- "Q=U+W1\t\t\t#Heat developed in the process in kJ\n",
- "W2=Q1-U\t\t#Work done for the another process in kJ\n",
- "\n",
- "#Output\n",
- "print'(a)Total change in internal energy is',round(U,0), \"kJ\" \n",
- "print'(b)Work done for the 1-2 process is',round(W1,2), \"kJ\" \n",
- "print'(c)Heat developed in the process is',round(Q,0), \"kJ\" \n",
- "print'(d)Work done for the another process is',round(W2,0), \"kJ\" \n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Total change in internal energy is -92.0 kJ\n",
- "(b)Work done for the 1-2 process is 129.4 kJ\n",
- "(c)Heat developed in the process is 37.0 kJ\n",
- "(d)Work done for the another process is 122.0 kJ\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.8 Page No. 96"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find heat transfer and total change in internal energy\n",
- "\n",
- "#Input data\n",
- "m=5\t\t#Mass of the substance in the system in kg\n",
- "P1=500\t\t#Initial pressure of the system in kPa\n",
- "P2=100\t\t#Final pressure of the system in kPa\n",
- "V1=0.22\t\t#Initial volume of the system in m**3\n",
- "n=1.2\t\t#Polytropic index\n",
- "\n",
- "#Calculations \n",
- "V2=V1*(P1/P2)**(1/1.2)\t#Final volume of the system in m**3\n",
- "U=3.5*(P2*V2-P1*V1)\t#Change in the internal energy of the system in kJ\n",
- "W=(P1*V1-P2*V2)/(n-1)\t#Work developed in the process in kJ\n",
- "Q=U+W\t\t\t#Heat transfer in the process in kJ\n",
- "\n",
- "#Output\n",
- "print'Total change in Internal Energy is',round(U,0),\"KJ\" \n",
- "print'Non flow work in the process is',round(W,2),\"KJ\" \n",
- "print'Heat transfer of the process is',round(Q,0),\"KJ\" \n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Total change in Internal Energy is -91.0 KJ\n",
- "Non flow work in the process is 129.4 KJ\n",
- "Heat transfer of the process is 39.0 KJ\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.9 Page No. 97"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the direction and magnitude of work and heat transfer\n",
- "\n",
- "#Input data\n",
- "p1=170\t\t#Initial pressure of the fluid in kPa\n",
- "p2=400\t\t#Final pressure of the fluid in kPa\n",
- "v1=0.03\t\t#Initial volume in m**3\n",
- "v2=0.06\t\t#Final volume in m**3\n",
- "\n",
- "#Calculations\n",
- "dU=3.15*((p2*v2)-(p1*v1))\t#The change in internal energy of the fluid in kJ\n",
- "#P=a+b*V #Given relation \n",
- "A = array([[1,v1], \n",
- " [1,v2]])\n",
- "b = array([p1,p2])\n",
- "X = solve(A, b)\n",
- "W=(X[0]*(v2-v1))+(X[1]*((v2**2-v1**2)/2.0))\t#The work done during the process in kJ\n",
- "Q=U+W\t\t#The heat transfer in kJ\n",
- "\n",
- "#Output\n",
- "print'(a)The direction and magnitude of work is',round(W,2),\"KJ\"\n",
- "print'(b)The direction and magnitude of heat transfer is',round(Q,2),\"KJ\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The direction and magnitude of work is 8.55 KJ\n",
- "(b)The direction and magnitude of heat transfer is 68.08 KJ\n"
- ]
- }
- ],
- "prompt_number": 30
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.11 Page No. 99"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is power capacity of the system\n",
- "\n",
- "#Input data\n",
- "E1=4000\t\t#Enthalpy at entrance in kJ/Kg\n",
- "E2=4100\t\t#Enthalpy at exit in kJ/kg\n",
- "V1=50\t\t#Velocity at entrance in m/s\n",
- "V2=20\t\t#Velocity at exit in m/s\n",
- "h1=50\t\t#Height at the entrance \n",
- "h2=10\t\t#Height at the exit\n",
- "m=1\t\t#mass flow rate to the system in kJ/s\n",
- "Q=200\t\t#Heat transfer rate to the system in kJ/s\n",
- "g=9.8\t\t#Gravitational constant in m/s**2\n",
- "\n",
- "#Calculations\n",
- "P=m*(((V1**2-V2**2)/(2000.0))+(g*(h2-h1)/1000.0)+(E1-E2))+Q\n",
- "print'Power capacity of the system ',round(P,0),\"KW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Power capacity of the system 101.0 KW\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.12 Page No. 101"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is specific internal energy\n",
- "\n",
- "#Input data\n",
- "W=135\t\t#Work done by the system in kJ/kg\n",
- "V1=0.37\t\t#Specific volume of fluid at inlet in m**3/kg\n",
- "V2=0.62\t\t#Specific volume of fluid at outlet in m**3/kg\n",
- "P1=600\t\t#Pressure at the inlet in kPa\n",
- "P2=100\t\t#Pressure at the outlet in kPa\n",
- "C1=16\t\t#Velocity at the inlet in m/s\n",
- "C2=270\t\t#Velocity at the outlet in m/s\n",
- "Z1=32\t\t#Inlet height from floor level in m\n",
- "Z2=0\t\t#Outlet height from floor level in m\n",
- "q=-9\t\t#Heat loss between inlet and discharge in kJ/kg\n",
- "g=9.81\t\t#Gravitational constant in m/s**2\n",
- "\n",
- "#Calculations\n",
- "U=((C2**2-C1**2)/2000.0)+(g*(Z2-Z1))/1000.0+(P2*V2-P1*V1)+W-q\n",
- "\n",
- "#Output\n",
- "print'Specific Internal Energy decreases by ',round(U,2),\"kJ/kg\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Specific Internal Energy decreases by 20.01 kJ/kg\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.13 Page No. 102"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is Total work done in the system and Power capacity of the system\n",
- "\n",
- "#Input data\n",
- "m=5\t\t#Rate of fluid flow in the system in kg/s\n",
- "P1=620\t\t#Pressure at the entrance in kPa\n",
- "P2=130\t\t#Pressure at the exit in kPa\n",
- "C1=300\t\t#Velocity at the entrance in m/s\n",
- "C2=150\t\t#Velocity at the exit in m/s\n",
- "U1=2100\t\t#Internal energy at the entrance in kJ/kg\n",
- "U2=1500\t\t#Internal energy at the exit in kJ/kg\n",
- "V1=0.37\t\t#Specific volume at entrance in m**3/kg\n",
- "V2=1.2\t\t#Specific volume at exit in m**3/kg\n",
- "Q=-30\t\t#Heat loss in the system during flow in kJ/kg\n",
- "Z=0\t\t#Change in potential energy is neglected in m\n",
- "g=9.81\t\t#Gravitational constant in m/s**2\n",
- "\n",
- "#Calculations\n",
- "W=((C1**2-C2**2)/(2*1000))+(g*Z)+(U1-U2)+(P1*V1-P2*V2)+Q\n",
- "P=W*m#Power capacity of the system in kW\n",
- "\n",
- "#Output\n",
- "print'(a)Total work done in the system ',round(W,1),\"kJ/kg\"\n",
- "print'(b)Power capacity of the system',round(P,1),\"KW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " (a)Total work done in the system 676.4 kJ/kg\n",
- "(b)Power capacity of the system 3382.0 KW\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.14 Page No. 103"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The power required to drive the compressor\n",
- "\n",
- "#Input Data\n",
- "P1=100\t\t#Pressure at Inlet in kPa\n",
- "P2=500\t\t#Pressure at Exit in kPa\n",
- "V1=0.6\t\t#Specific volume at Inlet in m**3/kg\n",
- "V2=0.15\t\t#Specific volume at Exit in m**3/kg\n",
- "U1=50\t\t#Specific internal energy at inlet in kJ/kg\n",
- "U2=125\t\t#Specific internal energy at Exit in kJ/kg\n",
- "C1=8\t\t#Velocity of air at Inlet in m/s\n",
- "C2=4\t\t#Velocity of air at Exit in m/s\n",
- "m=5\t\t#Mass flow rate of air in kg/s\n",
- "Q=-45\t\t#Heat rejected to cooling water in kW\n",
- "Z=0\t\t#Change in potential energy is neglected in m\n",
- "g=9.81\t\t#Gravitational constant in m/s**2\n",
- "\n",
- "#Calculations\n",
- "P=m*(((C1**2-C2**2)/(2*1000.0))+(g*Z)+(U1-U2)+(P1*V1-P2*V2))+Q\n",
- "P1=-P\n",
- "\n",
- "#Output\n",
- "print'The power required to drive the compressor',round(-P1,2),\"kW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The power required to drive the compressor -494.88 kW\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.15 Page No. 104"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Input data\n",
- "m1=5000\t\t#Steam flow rate in kg/hr\n",
- "Q1=-250\t\t#Heat loss from the turbine insulation to surroundings in kj/min\n",
- "C1=40\t \t#Velocity of steam at entrance in m/s\n",
- "h1=2500\t\t#Enthalpy of the steam at entrance in kJ/kg\n",
- "C2=90\t\t #Velocity of the steam at the Exit in m/s\n",
- "h2=2030\t\t#Enthalpy of the steam at exit in kj/kg\n",
- "Z=0\t\t #Change in potential energy is neglected in m\n",
- "g=9.81\t\t#Gravitational constant in m/s**2\n",
- "\n",
- "#Calculations\n",
- "m=m1/3600.0\t #Steam flow rate in kg/s\n",
- "Q=Q1/60.0\t\t#Heat loss from the turbine to the surroundings\n",
- "P=m*(((C1**2-C2**2)/(2*1000))+(g*Z)+(h1-h2))+Q\n",
- "\n",
- "#Output\n",
- "print'The power developed by the turbine is',round(P,1),\"KW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The power developed by the turbine is 643.1 KW\n"
- ]
- }
- ],
- "prompt_number": 19
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.16 Page No. 105"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The work output from the turbine \n",
- "\n",
- "#Input data \n",
- "c1=16\t\t#Velocity of steam at entrance in m/s\n",
- "c2=37\t\t#Velocity of steam at exit in m/s\n",
- "h1=2990\t\t#Specific enthalpy of steam at entrance in kJ/kg\n",
- "h2=2530\t\t#Specific enthalpy of steam at exit in kJ/kg\n",
- "Q=-25\t\t#Heat lost to the surroundings in kJ/kg\n",
- "m1=360000\t#The steam flow rate in kg/hr\n",
- "\n",
- "#Calculations\n",
- "m=m1/3600.0 #The steam flow rate in kg/s\n",
- "W=(c1**2-c2**2)/2000.0+(h1-h2)+Q\t#Total work done in the system in kJ/kg\n",
- "P=m*W\t\t\t\t\t #Power developed by the turbine in kW\n",
- "\n",
- "#Output\n",
- "print'The work output from the turbine is',round(P,1),\"kW \"\n",
- "print'NOTE: In the book there is Calculation mistake'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The work output from the turbine is 43444.3 kW \n",
- "NOTE: In the book there is Calculation mistake\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.17 Page No.106"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The external work output of the turbine\n",
- "\n",
- "#Input data\n",
- "p1=720\t\t#Pressure at the entrance in kPa\n",
- "t1=850\t\t#Temperature at the entrance in degree centigrade \n",
- "c1=160\t\t#Velocity of the gas at entrance in m/s\n",
- "Q=0\t\t#Insulation (adiabatic turbine)\n",
- "P2=115\t\t#Pressure at the exit in kPa\n",
- "t2=450\t\t#Temperature at the exit in degree centigrade\n",
- "c2=250\t\t#Velocity of the gas at exit in m/s\n",
- "cp=1.04\t\t#Specific heat of gas at constant pressure in kJ/kg-K\n",
- "\n",
- "#Calculations\n",
- "H=cp*(t1-t2)\t\t\t#Change in Enthalpy of the gas at entrance and exit in kJ/kg\n",
- "W=((c1**2-c2**2)/(2*1000))+(H)\t#External work output of the turbine in kJ/kg\n",
- "\n",
- "#Output\n",
- "print'The external work output of the turbine is',round(W,0),\"kJ/kg\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The external work output of the turbine is 397.0 kJ/kg\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.18 Page No. 107"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The work done per unit mass of the steam and mass flow rate\n",
- "\n",
- "#Input data\n",
- "p=5000\t\t#Power output of an adiabatic steam turbine in kW\n",
- "p1=2000\t\t#Pressure at the inlet in kPa\n",
- "p2=0.15\t\t#Pressure at the exit in bar\n",
- "t1=400\t\t#temperature at the inlet in degree centigrade\n",
- "x=0.9\t\t#Dryness at the exit\n",
- "c1=50\t\t#Velocity at the inlet in m/s\n",
- "c2=180\t\t#Velocity at the exit in m/s\n",
- "z1=10\t\t#Elevation at inlet in m\n",
- "z2=6\t\t#Elevation at exit in m\n",
- "h1=3248.7\t\t#Enthalpy at the inlet from the steam table corresponding to and 20 bar in kJ/kg\n",
- "hf=226\t\t#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg\n",
- "hfg=2373.2\t#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg\n",
- "g=9.81\t\t#Gravitational constant in m/s**2\n",
- "\n",
- "#Calculations\n",
- "h2=hf+(x*hfg) #Enthalpy at the exit in kJ/kg\n",
- "W=(h1-h2)+((c1**2-c2**2)/(2*1000))+((g*(z1-z2))/1000.0)\n",
- "m=p/W\t\t\t\t\t\t \n",
- "\n",
- "#Output\n",
- "print'(a)The work done per unit mass of the steam flowing through turbine is',round(W,1),\"kJ/kg\"\n",
- "print'(b)The mass flow rate of the steam is',round(m,1),\"kg/s\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The work done per unit mass of the steam flowing through turbine is 871.9 kJ/kg\n",
- "(b)The mass flow rate of the steam is 5.7 kg/s\n"
- ]
- }
- ],
- "prompt_number": 23
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.19 Page No. 108"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Temperature of air at exit and power output\n",
- "\n",
- "#Input Data\n",
- "p1=1000.0\t\t#Pressure at the inlet in kPa\n",
- "t1=750.0\t\t#Temperature at the inlet in K\n",
- "c1=200.0\t\t#Velocity at the inlet in m/s\n",
- "p2=125.0\t\t#Pressure at the exit in kPa\n",
- "c2=40.0\t\t #Velocity at the exit in m/s\n",
- "m1=1000.0\t\t#Mass flow rate of air in kg/hr\n",
- "cp=1.053\t\t#Specific heat at constant pressure in kJ/kgK\n",
- "k=1.375\t\t #Adiabatic index\n",
- "Q=0\t\t #The turbine is adiabatic\n",
- "\n",
- "#Calculations\n",
- "m=m1/3600.0\t#The mass flow rate of air in kg/s\n",
- "P=p2/p1\t\t#Ratio of the pressure\n",
- "t2=t1*((p2/p1)**((k-1)/k))\t#Temperature of air at exit in K\n",
- "h=cp*(t2-t1)\t\t#Change in enthalpy of the system in kJ\n",
- "p=m*(((c2**2-c1**2)/(2*1000))+h)\t#Power output of the turbine in kW\n",
- "p1=-p\t\t\t#Power output of the turbine in kW\n",
- "\n",
- "#Output\n",
- "print'(a)Temperature of air at exit is',round(t2,2),\" K \"\n",
- "print'(b)The power output of the turbine is',round(p1,1),\"kW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Temperature of air at exit is 425.37 K \n",
- "(b)The power output of the turbine is 100.3 kW\n"
- ]
- }
- ],
- "prompt_number": 24
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.20 Page No. 110"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The rate of work input to the air and\n",
- "#The ratio of inlet pipe diameter to the outlet pipe diameter\n",
- "\n",
- "#Input data\n",
- "c1=7\t\t #Velocity of air at entrance in m/s\n",
- "c2=5\t\t #Velocity of air at exit in m/s\n",
- "p1=100\t\t #Pressure at the entrance in kPa\n",
- "p2=700\t\t #Pressure at the exit in kPa\n",
- "v1=0.95\t\t#Specific volume at entrance in m**3/kg\n",
- "v2=0.19\t\t#Specific volume at exit in m**3/kg\n",
- "u=90\t\t # Change in internal energy of the air entering and leaving in kJ/kg\n",
- "z=0\t\t #Potential energy is neglected \n",
- "Q=-58\t\t #Heat rejected to the surroundings in kW\n",
- "m=0.5\t\t #The rate at which air flow in kg/s\n",
- "g=9.81\t\t #Gravitational constant in m/s**2\n",
- "\n",
- "#Calculations\n",
- "P=m*(((c1**2-c2**2)/(2000.0))+(p1*v1-p2*v2)-u)+(Q)\n",
- "A=(v1*c2)/(v2*c1)\t#From continuity equation the ratio of areas\n",
- "D=A**(1/2.0)\t #The ratio of inlet pipe diameter to the outlet pipe diameter\n",
- "\n",
- "#Output\n",
- "print'(a)The rate of work input to the air is ',round(P,2),\"kW\"\n",
- "print'(b)The ratio of inlet pipe diameter to the outlet pipe diameter is ',round(D,2)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The rate of work input to the air is -121.99 kW\n",
- "(b)The ratio of inlet pipe diameter to the outlet pipe diameter is 1.89\n"
- ]
- }
- ],
- "prompt_number": 20
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.21 Page No. 112"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The velocity at exit, mass flow rate area at exit\n",
- "\n",
- "#Input data\n",
- "h1=3000\t\t#Enthalpy of the fluid passing at inlet in kJ/kg\n",
- "h2=2757\t\t#Enthalpy of the fluid at the discharge in kJ/kg\n",
- "c1=60\t\t#Velocity of the fluid at inlet in m/s\n",
- "A1=0.1\t\t#Inlet area of the nozzle in m**2\n",
- "v1=0.187\t\t#Specific volume at inlet in m**3/kg\n",
- "v2=0.498\t\t#Specific volume at the outlet in m**3/kg\n",
- "q=0\t\t#Heat loss during the flow is negligable\n",
- "z=0\t\t#The nozzle is horizontal so change in PE is constant\n",
- "w=0\t\t#The work done is also negligable\n",
- "\n",
- "#Calculations\n",
- "c2=(2*1000*((h1-h2)+(c1**2/2000.0)))**(1/2.0)\t#Velocity at the exit in m/s\n",
- "m=(A1*c1)/v1\t\t\t\t#The mass flow rate in kg/s\n",
- "A2=(m*v2)/c2\t\t\t\t#Area at the exit of the nozzle in m**3\n",
- "\n",
- "#Output\n",
- "print'(a)The velocity at the exit is',round(c2,1),\"m/s\"\n",
- "print'(b)The mass flow rateis',round(m,1),\"kg/s\" \n",
- "print'(c)Area at the exit is',round(A2,3),\"m**2\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The velocity at the exit is 699.7 m/s\n",
- "(b)The mass flow rateis 32.1 kg/s\n",
- "(c)Area at the exit is 0.023 m**2\n"
- ]
- }
- ],
- "prompt_number": 21
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.22 Page No. 113"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Velocity of the steam at the outlet, mass flow rate and area at nozzle exit\n",
- "\n",
- "#Input data\n",
- "h1=3000\t\t#Specific enthalpy of steam at inlet in kJ/kg\n",
- "h2=2762\t\t#Specific enthalpy of steam at the outlet in kJ/kg\n",
- "v1=0.187\t\t#Specific volume of steam at inlet in m**3/kg\n",
- "v2=0.498\t\t#Specific volume of steam at the outlet in m**3/kg\n",
- "A1=0.1\t\t#Area at the inlet in m**2\n",
- "q=0\t\t#There is no heat loss\n",
- "z=0\t\t#The nozzle is horizontal ,so no change in PE\n",
- "c1=60\t\t#Velocity of the steam at the inlet in m/s\n",
- "\n",
- "#Calculations\n",
- "c2=((2*1000)*((h1-h2)+(c1**2/2000.0)))**(1/2.0)\t#Velocity of the steam at the outlet in m/s\n",
- "m=(A1*c1)/v1\t\t\t\t#Mass flow rate of steam in kg/s\n",
- "A2=(m*v2)/c2\t\t\t\t#Area at the nozzle exit in m**2\n",
- "\n",
- "#Output\n",
- "print'(a)Velocity of the steam at the outlet is ',round(c2,2), \"m/s \"\n",
- "print'(b)Mass flow rate of steam is ',round(m,2),\"kg/s \"\n",
- "print'(c)Area at the nozzle exit is',round(A2,3),\"m**2\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Velocity of the steam at the outlet is 692.53 m/s \n",
- "(b)Mass flow rate of steam is 32.09 kg/s \n",
- "(c)Area at the nozzle exit is 0.023 m**2\n"
- ]
- }
- ],
- "prompt_number": 25
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.23 Page No. 114"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the exit velocity\n",
- "#Input data\n",
- "c1=40\t\t#Velocity of air at the inlet of nozzle in m/s\n",
- "h=180\t\t#The decrease in enthalpy in the nozzle in kJ/kg\n",
- "w=0\t\t#Since adiabatic\n",
- "q=0\t\t#Since adiabatic\n",
- "z=0\t\t#Since adiabatic\n",
- "\n",
- "#Calculations\n",
- "c2=((2*1000)*((h)+(c1**2/(2*1000))))**(1/2.0)\t#The exit velocity of air in m/s\n",
- "\n",
- "#Output\n",
- "print'The exit velocity of the air is',round(c2,1),\"m/s\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The exit velocity of the air is 600.0 m/s\n"
- ]
- }
- ],
- "prompt_number": 32
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.24 Page No. 115"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Input data\n",
- "p1=100\t\t#Pressure at the inlet of the compressor in kPa\n",
- "p2=500\t\t#Pressure at the outlet of the compressor in kPa\n",
- "v1=3\t\t#Volume of the air at the inlet of the compressor in m**3/kg\n",
- "v2=0.8\t\t#Volume of the air at the outlet of the compressor in m**3/kg\n",
- "c1=25\t\t#The velocity of air at the inlet of the compressor in m/s\n",
- "c2=130\t\t#The velocity of air at the outlet of the compressor in m/s\n",
- "z=12\t\t#The height of delivery connection above the inlet in m\n",
- "g=9.81\t\t#Gravitational constant in m/s**2\n",
- "n=1.3\t\t#Polytropic index\n",
- "\n",
- "#Calculations\n",
- "W=((n)*(p1*v1-p2*v2))/(n-1)\t#Workdone for open system polytropic process in kJ/kg\n",
- "K=((c2**2-c1**2)/2000.0)\t#Change in kinetic energy of the system in kJ/kg\n",
- "P=g*(z)/1000.0 \t\t#Change in potential energy of the system in kJ/kg\n",
- "w=W-K-P\t\t\t #The shaft work of the compressor in kJ/kg\n",
- "\n",
- "#Output\n",
- "print'The Shaft work of the compressor ',round(w,1),\"kj/kgIt is the power absorbing system\"\n",
- "if w<0:\n",
- " print'It is the power absorbing system'\n",
- "else:\n",
- " print'It is not power absorbing system'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Shaft work of the compressor -441.6 kj/kgIt is the power absorbing system\n",
- "It is the power absorbing system\n"
- ]
- }
- ],
- "prompt_number": 38
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.25 Page No. 117"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine the power required\n",
- "\n",
- "#Input data\n",
- "m=10\t\t#The rate of fluid compressed adiabatically in kg/s\n",
- "p1=500\t\t#Initial pressure of the process in kPa\n",
- "p2=5000\t\t#Final pressure of the process in kPa\n",
- "v=0.001\t\t#The specific volume of the fluid in m**3/kg\n",
- "\n",
- "#Calculations\n",
- "P=m*v*(p2-p1)\t#The power required in kW\n",
- "\n",
- "#Output\n",
- "print'The power required is',round(P,2),\"kW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The power required is 45.0 kW\n"
- ]
- }
- ],
- "prompt_number": 40
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.26 Page No. 117"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine the exit temprature\n",
- "\n",
- "#Input data\n",
- "m=2.0\t\t#Mass flow rate of air in kg/s\n",
- "t1=20\t\t#Initial temperature of the air in degree centigrade\n",
- "P=-30\t\t#The amount of power consumed in kW\n",
- "c1=100\t\t#The inlet velocity of air in m/s\n",
- "c2=150\t\t#The outlet velocity of air in m/s\n",
- "R=0.287\t\t#The gas constant for air in kJ/kg-K\n",
- "g=1.4\t\t#It is the adiabatic index\n",
- "cp=1.005\t\t#Specific heat at constant pressure in kJ/kg-K\n",
- "q=0\t\t#Heat developed as it is adiabatic condition\n",
- "z=0\t\t#The change in potential energy is neglected\n",
- "\n",
- "#Calculations\n",
- "h=(P/m)+((c2**2-c1**2)/(2*1000))\t\t#The change in enthalpy of the system in kJ/kg\n",
- "t=h/cp\t\t#The change in temperature of the system in degree centigrade\n",
- "t2=t1-t\t\t#The exit air temperature in degree centigrade\n",
- "\n",
- "#Output\n",
- "print'The exit air temperature is is',round(t2,2),\"C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The exit air temperature is is 28.96 C\n"
- ]
- }
- ],
- "prompt_number": 26
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.27 Page No. 119"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The exit air temperature\n",
- "\n",
- "#Input data\n",
- "m=0.6\t\t#Mass flow rate of air in kg/s\n",
- "W=40\t\t#Power required to run the compressor in kW\n",
- "p1=100\t\t#Initial pressure at the inlet of the compressor in kPa\n",
- "t1=30\t\t#Initial temperature at the inlet of the compressor in degree centigrade\n",
- "z=0\t\t#Change in potential energy is neglected\n",
- "c=0\t\t#Change in kinetic energy is neglected\n",
- "q=0.4\t\t#Heat lost to the cooling water ,bearings and frictional effects is 40% of input\n",
- "cp=1.005\t\t#Specific heat at constant pressure in kJ/kg-K\n",
- "\n",
- "#Calculations\n",
- "Q=q*W\t\t#Net heat losses from the system in kW\n",
- "H=W-Q\t\t#Change in total enthalpy of the system in kW\n",
- "t2=(H/(m*cp))+t1\t#The exit air temperature in degree centigrade\n",
- "\n",
- "#Output\n",
- "print'The exit air temperature is',round(t2,0),\"C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The exit air temperature is 70.0 C\n"
- ]
- }
- ],
- "prompt_number": 46
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.28 Page No. 120"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The rate at which the heat is to be removed by cooler X\n",
- "\n",
- "#Input data\n",
- "m1=100\t\t#Air flow rate in kg/hr\n",
- "q1=600\t\t#The heat generated by each person in kJ/hr\n",
- "h1=85\t\t#The enthalpy of air entering the room in kJ/kg\n",
- "h2=60\t\t#The enthalpy of air leaving the room in kJ/kg\n",
- "Q1=0.2\t\t#The heat added by each lamp in the room in kW\n",
- "P1=0.2\t\t#The power consumed by each fan in kW\n",
- "\n",
- "#Calculations\n",
- "q=(5*q1)/3600.0\t#The heat generated by 5 persons in the room in kW\n",
- "Q=3*Q1\t\t #The heat added by three lamps in the room in kW\n",
- "P=2*P1\t\t #The power consumed by two fans in the room in kW\n",
- "m=m1/3600.0\t\t #Mass flow rate of air in kg/s\n",
- "H=(q+Q+P)+(m*(h1-h2))\t#Heat to be removed by the cooler in kW\n",
- "\n",
- "#Output\n",
- "print'The rate at which the heat is to be removed by cooler X is',round(H,1),\"kJ/sec\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The rate at which the heat is to be removed by cooler X is 2.5 kJ/sec\n"
- ]
- }
- ],
- "prompt_number": 34
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.29 Page No. 121"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The Heat loss by the system\n",
- "\n",
- "#Input data\n",
- "p1=1000\t\t#Pressure at the inlet of the system in kPa\n",
- "p2=15\t\t#Pressure at the outlet of the system in kPa\n",
- "v1=0.206\t\t#Specific volume at the inlet of the system in m**3/kg\n",
- "v2=8.93\t\t#Specific volume at the outlet of the system in m**3/kg\n",
- "h1=2827\t\t#Specific enthalpy at the inlet of the system in kJ/kg\n",
- "h2=2341\t\t#Specific enthalpy at the outlet of the system in kJ/kg\n",
- "c1=20\t\t#Velocity at the inlet of the system in m/s\n",
- "c2=120\t\t#Velocity at the outlet of the system in m/s\n",
- "z1=3.2\t\t#Elevation at the inlet of the system in m\n",
- "z2=0.5\t\t#Elevation at the outlet of the system in m\n",
- "m=2.1\t\t#The fluid flow rate in kg/s\n",
- "W=750\t\t#The work output of the device in kW\n",
- "g=9.81\t\t#Gravitational constant in m/s**2\n",
- "\n",
- "#Calculations\n",
- "Q=m*(((c2**2-c1**2)/(2*1000))+((g*(z2-z1)/(1000.0)))+(h2-h1))+W #The heat loss/gain by the system in kW\n",
- "\n",
- "#Output\n",
- "print'The Heat loss by the system is',round(Q,1),\"kW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Heat loss by the system is -256.0 kW\n"
- ]
- }
- ],
- "prompt_number": 50
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.30 Page No. 122"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Rate of heat transfer to the air \n",
- "\n",
- "#Input data\n",
- "t1=15\t\t#The inlet temperature of the air passing through the heat exchanger in degree centigrade\n",
- "c1=30\t\t#The inlet velocity of air in m/s\n",
- "t2=800\t\t#The outlet temperature of the air from heat exchanger in degree centigrade \n",
- "c2=30\t\t#The inlet velocity of air to the turbine in m/s\n",
- "t3=650\t\t#The outlet temperature of the air from the turbine in degree centigrade\n",
- "c3=60\t\t#The outlet velocity of the air from turbine in m/s\n",
- "t4=500\t\t#The temperature at the outlet of the nozzle in degree centigrade\n",
- "m=2\t\t #Air flow rate in kg/s\n",
- "cp=1.005\t\t#Specific heat at constant pressure in kJ/kgK\n",
- "\n",
- "#Calculations\n",
- "Qh=m*cp*(t2-t1)\t#Rate of heat transfer to the air in the heat exchanger in kJ/s\n",
- "P=m*((cp*(t2-t3))+((c2**2-c3**2)/2000.0))\t\t#Power output from the turbine in kW\n",
- "c4=((2*1000)*(cp*(t3-t4))+c3**2)**(1/2.0)\t\t#Velocity of air at exit from nozzle in m/s\n",
- "\n",
- "#Output \n",
- "print'(a)Rate of heat transfer to the air in the heat exchanger is',round(Qh,1),\"kJ/s\"\n",
- "print'(b)Power output from the turbine is',round(P,1),\"kW\"\n",
- "print'(c)Velocity of air at exit from nozzle is',round(c4),\"m/s\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Rate of heat transfer to the air in the heat exchanger is 1577.8 kJ/s\n",
- "(b)Power output from the turbine is 298.8 kW\n",
- "(c)Velocity of air at exit from nozzle is 552.0 m/s\n"
- ]
- }
- ],
- "prompt_number": 40
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2.31 Page No. 123"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Input data\n",
- "p1=400.0\t\t#Initial pressure of the gas in a turbine in kPa\n",
- "t1=573.0\t\t#Initial temperature of the gas in a turbine in K\n",
- "p2=100.0\t\t#Final pressure of the gas in a turbine in kPa\n",
- "V=2.5\t\t #It is the ratio of final volume to the inlet volume \n",
- "c2=50.0\t\t#Velocity of the gas at exit in m/s\n",
- "P=1000.0\t\t#Power developed by the turbine in kW\n",
- "cp=5.193\t\t#Specific heat of the helium at constant pressure in kJ/kg K\n",
- "G=8.314\t\t#Gas constant in kNm/kgK\n",
- "M=4.0\t\t #Molecular weight of the helium\n",
- "\n",
- "#Calculations\n",
- "import math\n",
- "R=G/M\t\t #Characteristic gas constant in kNm/kgK\n",
- "v1=(R*t1)/p1\t#Specific volume at the inlet in m**3/kg\n",
- "v2=V*v1\t \t#Specific volume at the outlet in m**3/kg\n",
- "n=math.log(p2/p1)/math.log(v1/v2)\t#Polytropic index \n",
- "t2=((t1)*((p2/p1)**((n-1)/n)))\t\t#Final temperature of the gas in a turbine in K\n",
- "w=(n/(n-1))*(R*(t1))*(1-((p2*v2)/(p1*v1)))\t#Specific work in kJ/kg\n",
- "K=c2**2/(2*1000)\t\t\t#Change in kinetic energy in kJ/kg\n",
- "Ws=w-K\t\t\t#Work done by the shaft in kJ/kg\n",
- "q=Ws+(cp*(t2-t1))+K\t#The heat transfer during the process in kJ/kg\n",
- "m=P/Ws\t\t\t#Mass flow rate of gas required in kg/s\n",
- "A2=(m*v2)/c2\t\t#Exit area of the turbine in m**2\n",
- "\n",
- "#Output\n",
- "print'(a)The mass flow rate of the gas required is',round(m,3),\"kg/s\" \n",
- "print'(b)The heat transfer during the process is',round(q,1), \"kJ/kg\" \n",
- "print'(c)Exit area of the turbine is ',round(A2,3),\"m**2\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The mass flow rate of the gas required is 0.76 kg/s\n",
- "(b)The heat transfer during the process is 201.5 kJ/kg\n",
- "(c)Exit area of the turbine is 0.113 m**2\n"
- ]
- }
- ],
- "prompt_number": 31
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:eb480946d569a90f950fa22c2b37d79f68cd522d201043a9e36d8370900550dc"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2:First Law of Thermodynamics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.1 Page No.90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "h1=60\t\t#The heat transfer in the process in kJ\n",
+ "h2=-8\t\t#The heat transfer in the process in kJ\n",
+ "h3=-34\t\t#The heat transfer in the process in kJ\n",
+ "h4=6\t\t#The heat transfer in the process in kJ\n",
+ "\n",
+ "#Calculations\n",
+ "Q=h1+h2+h3+h4\t\t#Net work transfer in a cycle in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'Net work transfer in a cycle is',round(Q,2),\"KJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Net work transfer in a cycle is 24.0 KJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.2 Page No. 90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "Q=-300\t\t#Heat transfer in the system consisting of the gas in kJ\n",
+ "u=0\t\t#Internal energy is constant\n",
+ "\n",
+ "#Calculations\n",
+ "W=Q-u\t\t#Work done of the system in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'The work done of the system W = %3.0f kJ ',round(W,1),\"KJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The work done of the system W = %3.0f kJ -300.0 KJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.3 Page No. 90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "v1=1.5\t\t#Initial volume of the process in m**3\n",
+ "v2=4.5\t\t#Final volume of the process in m**3\n",
+ "Q=2000\t\t#Amount of heat added in kJ\n",
+ "\n",
+ "#Calculations\n",
+ "W=100*((3.5*math.log(v2/v1))+(3*(v2-v1)))\t#Amount of work done in kJ\n",
+ "U=Q-W\t\t\t\t\t#The change in internal energy in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'The change in internal energy is',round(U,2),\"KJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The change in internal energy is 715.49 KJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.4 Page No.91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "h1=35\t\t#Enthalpy of water entering the boiler in kJ/kg\n",
+ "h2=705\t\t#Enthalpy of steam leaving the boiler in kJ/kg\n",
+ "C=0\t\t#Change in kinetic energy is neglected\n",
+ "Z=0\t\t#Change in potential energy is neglected\n",
+ "\n",
+ "#Calculations\n",
+ "q=h2-h1\t\t#The heat transfer per kg of steam in kJ/kg\n",
+ "\n",
+ "#Output\n",
+ "print'The heat transfer per kg of steam is',round(q,1),\"kJ/kg\"\t\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The heat transfer per kg of steam is 670.0 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.5 Page No. 92"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "Q=-170\t\t#Sum of all heat transfers per cycle in kJ\n",
+ "N=100\t\t#Total number of cycles per min in cycles/min\n",
+ "Q1=0\t\t#Heat developed in a-b process in kJ/min\n",
+ "Q2=21000\t\t#Heat developed in b-c process in kJ/min\n",
+ "Q3=-2100\t\t#Heat developed in c-d process in kJ/min\n",
+ "W1=2170\t\t#Work done in the process a-b in kJ/min\n",
+ "W2=0\t\t#Work done in the b-c process in kJ/min\n",
+ "E3=-36600\t#Change in energy in the process in kJ/min\n",
+ "\n",
+ "#Calculations\n",
+ "E1=Q1-W1\t\t#Change in energy in process a-b in kJ/min\n",
+ "E2=Q2-W2\t\t#Change in energy in b-c process in kJ/min\n",
+ "W3=Q3-E3\t\t#Work done in the c-d process in kJ/min\n",
+ "Qt=Q*N\t\t\t#Total heat transfer per min in kJ/min \n",
+ "Q4=Qt-Q1-Q2-Q3\t\t#Heat developed in the process d-a in kJ/min\n",
+ "Et=0\t\t\t#Total change in energy of the cycle\n",
+ "E4=Et-E1-E2-E3\t\t#Energy in the process d-a in kJ/min\n",
+ "W4=Q4-E4\t\t#Work done in the d-a process in kJ/min \n",
+ "Wn=Qt/60.0\t\t#Net rate of work output in kW\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Change in energy in a-b process is',round(E1,2),\"kJ/min\"\n",
+ "print'(b)Change in energy in b-c process is',round(E2,2),\"kJ/min\"\n",
+ "print'(c)Work done in the c-d process is',round(W3,2),\"kJ/min\"\n",
+ "print'(d)Heat developed in the process d-a is',round(Q4,2),\"kJ/min\"\n",
+ "print'(e)Energy in the process d-a is',round(E4,2),\"kJ/min\"\n",
+ "print'(f)Work done in the d-a process is',round(W4,2),\"kJ/min\"\n",
+ "print'(g)Net rate of work output is',round(Wn,2),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Change in energy in a-b process is -2170.0 kJ/min\n",
+ "(b)Change in energy in b-c process is 21000.0 kJ/min\n",
+ "(c)Work done in the c-d process is 34500.0 kJ/min\n",
+ "(d)Heat developed in the process d-a is -35900.0 kJ/min\n",
+ "(e)Energy in the process d-a is 17770.0 kJ/min\n",
+ "(f)Work done in the d-a process is -53670.0 kJ/min\n",
+ "(g)Net rate of work output is -283.33 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.6 Page No. 93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "Q1=50\t\t#Heat developed in the 1-2 process in kJ/kg\n",
+ "U1=20\t\t#Change in energy in the 1-2 process in kJ/kg\n",
+ "Q2=-30\t\t#Heat developed in the 2-3 process in kJ/kg\n",
+ "W2=-40\t\t#Work done in the 2-3 process in kj/kg\n",
+ "U3=-30\t\t#Change in energy in the 3-1 process in kJ/kg\n",
+ "Wt=30\t\t#Net work done per kg of fluid in kJ/kg\n",
+ "m=0.1\t\t#Mass of fluid in the cycle in kg\n",
+ "N=10\t\t#Number of cycles per sec in cycles/sec\n",
+ "\n",
+ "#Calculations\n",
+ "W1=Q1-U1\t#Work done in the 1-2 process in kJ/kg\n",
+ "U2=Q2-W2\t#Change in energy in the 2-3 process in kJ/kg\n",
+ "W3=Wt-W1-W2\t#Work done in the 3-1 process in kJ/kg\n",
+ "Q3=W3+U3\t#Heat developed in the process in kJ/kg\n",
+ "m1=m*N\t\t#mass flow rate per sec in kg/sec\n",
+ "P=Wt*m1\t\t#Rate of power in kW\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Work done in the 1-2 process is',round(W1,1),\"kJ/kg\"\n",
+ "print'(b)Change in energy in the 2-3 process is',round(U2,1),\"kJ/kg\"\n",
+ "print'(c)Work done in the 3-1 process is',round(W3,1),\"kJ/kg\"\n",
+ "print'(d)Heat developed in the processis',round(Q3,1),\"kJ/kg\"\n",
+ "print'(e)mass flow rate per sec ',round(m1,1), \"kg/sec \"\n",
+ "print'(f)Rate of power is',round(P,2),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Work done in the 1-2 process is 30.0 kJ/kg\n",
+ "(b)Change in energy in the 2-3 process is 10.0 kJ/kg\n",
+ "(c)Work done in the 3-1 process is 40.0 kJ/kg\n",
+ "(d)Heat developed in the processis 10.0 kJ/kg\n",
+ "(e)mass flow rate per sec 1.0 kg/sec \n",
+ "(f)Rate of power is 30.0 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.7 Page No. 94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "m=3.0\t\t#Mass of substance in the system in kg\n",
+ "P1=500.0\t\t#Initial pressure of the system in kPa\n",
+ "P2=100.0\t\t#Final pressure of the system in kPa\n",
+ "V1=0.22\t\t#Initial volume of the system in m**3\n",
+ "n=1.2\t\t#Polytropic index \n",
+ "Q1=30.0\t\t#Heat transfer for the another process\n",
+ "\n",
+ "#Calculations\n",
+ "V2=V1*(P1/P2)**(1/1.2)\t#Final volume of the system in m**3\n",
+ "U=3.56*(P2*V2-P1*V1)\t#Total change in internal energy in kJ\n",
+ "W1=(P2*V2-P1*V1)/(1-n)\t#Work done for the 1-2 process in kJ\n",
+ "Q=U+W1\t\t\t#Heat developed in the process in kJ\n",
+ "W2=Q1-U\t\t#Work done for the another process in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Total change in internal energy is',round(U,0), \"kJ\" \n",
+ "print'(b)Work done for the 1-2 process is',round(W1,2), \"kJ\" \n",
+ "print'(c)Heat developed in the process is',round(Q,0), \"kJ\" \n",
+ "print'(d)Work done for the another process is',round(W2,0), \"kJ\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Total change in internal energy is -92.0 kJ\n",
+ "(b)Work done for the 1-2 process is 129.4 kJ\n",
+ "(c)Heat developed in the process is 37.0 kJ\n",
+ "(d)Work done for the another process is 122.0 kJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.8 Page No. 96"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "m=5\t\t#Mass of the substance in the system in kg\n",
+ "P1=500\t\t#Initial pressure of the system in kPa\n",
+ "P2=100\t\t#Final pressure of the system in kPa\n",
+ "V1=0.22\t\t#Initial volume of the system in m**3\n",
+ "n=1.2\t\t#Polytropic index\n",
+ "\n",
+ "#Calculations \n",
+ "V2=V1*(P1/P2)**(1/1.2)\t#Final volume of the system in m**3\n",
+ "U=3.5*(P2*V2-P1*V1)\t#Change in the internal energy of the system in kJ\n",
+ "W=(P1*V1-P2*V2)/(n-1)\t#Work developed in the process in kJ\n",
+ "Q=U+W\t\t\t#Heat transfer in the process in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'Total change in Internal Energy is',round(U,0),\"KJ\" \n",
+ "print'Non flow work in the process is',round(W,2),\"KJ\" \n",
+ "print'Heat transfer of the process is',round(Q,0),\"KJ\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total change in Internal Energy is -91.0 KJ\n",
+ "Non flow work in the process is 129.4 KJ\n",
+ "Heat transfer of the process is 39.0 KJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.9 Page No. 97"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "p1=170\t\t#Initial pressure of the fluid in kPa\n",
+ "p2=400\t\t#Final pressure of the fluid in kPa\n",
+ "v1=0.03\t\t#Initial volume in m**3\n",
+ "v2=0.06\t\t#Final volume in m**3\n",
+ "\n",
+ "#Calculations\n",
+ "dU=3.15*((p2*v2)-(p1*v1))\t#The change in internal energy of the fluid in kJ\n",
+ "#P=a+b*V #Given relation \n",
+ "A = array([[1,v1], \n",
+ " [1,v2]])\n",
+ "b = array([p1,p2])\n",
+ "X = solve(A, b)\n",
+ "W=(X[0]*(v2-v1))+(X[1]*((v2**2-v1**2)/2.0))\t#The work done during the process in kJ\n",
+ "Q=U+W\t\t#The heat transfer in kJ\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The direction and magnitude of work is',round(W,2),\"KJ\"\n",
+ "print'(b)The direction and magnitude of heat transfer is',round(Q,2),\"KJ\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The direction and magnitude of work is 8.55 KJ\n",
+ "(b)The direction and magnitude of heat transfer is 68.08 KJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.11 Page No. 99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "E1=4000\t\t#Enthalpy at entrance in kJ/Kg\n",
+ "E2=4100\t\t#Enthalpy at exit in kJ/kg\n",
+ "V1=50\t\t#Velocity at entrance in m/s\n",
+ "V2=20\t\t#Velocity at exit in m/s\n",
+ "h1=50\t\t#Height at the entrance \n",
+ "h2=10\t\t#Height at the exit\n",
+ "m=1\t\t#mass flow rate to the system in kJ/s\n",
+ "Q=200\t\t#Heat transfer rate to the system in kJ/s\n",
+ "g=9.8\t\t#Gravitational constant in m/s**2\n",
+ "\n",
+ "#Calculations\n",
+ "P=m*(((V1**2-V2**2)/(2000.0))+(g*(h2-h1)/1000.0)+(E1-E2))+Q\n",
+ "print'Power capacity of the system ',round(P,0),\"KW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Power capacity of the system 101.0 KW\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.12 Page No. 101"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "W=135\t\t#Work done by the system in kJ/kg\n",
+ "V1=0.37\t\t#Specific volume of fluid at inlet in m**3/kg\n",
+ "V2=0.62\t\t#Specific volume of fluid at outlet in m**3/kg\n",
+ "P1=600\t\t#Pressure at the inlet in kPa\n",
+ "P2=100\t\t#Pressure at the outlet in kPa\n",
+ "C1=16\t\t#Velocity at the inlet in m/s\n",
+ "C2=270\t\t#Velocity at the outlet in m/s\n",
+ "Z1=32\t\t#Inlet height from floor level in m\n",
+ "Z2=0\t\t#Outlet height from floor level in m\n",
+ "q=-9\t\t#Heat loss between inlet and discharge in kJ/kg\n",
+ "g=9.81\t\t#Gravitational constant in m/s**2\n",
+ "\n",
+ "#Calculations\n",
+ "U=((C2**2-C1**2)/2000.0)+(g*(Z2-Z1))/1000.0+(P2*V2-P1*V1)+W-q\n",
+ "\n",
+ "#Output\n",
+ "print'Specific Internal Energy decreases by ',round(U,2),\"kJ/kg\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Specific Internal Energy decreases by 20.01 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.13 Page No. 102"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "m=5\t\t#Rate of fluid flow in the system in kg/s\n",
+ "P1=620\t\t#Pressure at the entrance in kPa\n",
+ "P2=130\t\t#Pressure at the exit in kPa\n",
+ "C1=300\t\t#Velocity at the entrance in m/s\n",
+ "C2=150\t\t#Velocity at the exit in m/s\n",
+ "U1=2100\t\t#Internal energy at the entrance in kJ/kg\n",
+ "U2=1500\t\t#Internal energy at the exit in kJ/kg\n",
+ "V1=0.37\t\t#Specific volume at entrance in m**3/kg\n",
+ "V2=1.2\t\t#Specific volume at exit in m**3/kg\n",
+ "Q=-30\t\t#Heat loss in the system during flow in kJ/kg\n",
+ "Z=0\t\t#Change in potential energy is neglected in m\n",
+ "g=9.81\t\t#Gravitational constant in m/s**2\n",
+ "\n",
+ "#Calculations\n",
+ "W=((C1**2-C2**2)/(2*1000))+(g*Z)+(U1-U2)+(P1*V1-P2*V2)+Q\n",
+ "P=W*m#Power capacity of the system in kW\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Total work done in the system ',round(W,1),\"kJ/kg\"\n",
+ "print'(b)Power capacity of the system',round(P,1),\"KW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " (a)Total work done in the system 676.4 kJ/kg\n",
+ "(b)Power capacity of the system 3382.0 KW\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.14 Page No. 103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input Data\n",
+ "P1=100\t\t#Pressure at Inlet in kPa\n",
+ "P2=500\t\t#Pressure at Exit in kPa\n",
+ "V1=0.6\t\t#Specific volume at Inlet in m**3/kg\n",
+ "V2=0.15\t\t#Specific volume at Exit in m**3/kg\n",
+ "U1=50\t\t#Specific internal energy at inlet in kJ/kg\n",
+ "U2=125\t\t#Specific internal energy at Exit in kJ/kg\n",
+ "C1=8\t\t#Velocity of air at Inlet in m/s\n",
+ "C2=4\t\t#Velocity of air at Exit in m/s\n",
+ "m=5\t\t#Mass flow rate of air in kg/s\n",
+ "Q=-45\t\t#Heat rejected to cooling water in kW\n",
+ "Z=0\t\t#Change in potential energy is neglected in m\n",
+ "g=9.81\t\t#Gravitational constant in m/s**2\n",
+ "\n",
+ "#Calculations\n",
+ "P=m*(((C1**2-C2**2)/(2*1000.0))+(g*Z)+(U1-U2)+(P1*V1-P2*V2))+Q\n",
+ "P1=-P\n",
+ "\n",
+ "#Output\n",
+ "print'The power required to drive the compressor',round(-P1,2),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The power required to drive the compressor -494.88 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.15 Page No. 104"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Input data\n",
+ "m1=5000\t\t#Steam flow rate in kg/hr\n",
+ "Q1=-250\t\t#Heat loss from the turbine insulation to surroundings in kj/min\n",
+ "C1=40\t \t#Velocity of steam at entrance in m/s\n",
+ "h1=2500\t\t#Enthalpy of the steam at entrance in kJ/kg\n",
+ "C2=90\t\t #Velocity of the steam at the Exit in m/s\n",
+ "h2=2030\t\t#Enthalpy of the steam at exit in kj/kg\n",
+ "Z=0\t\t #Change in potential energy is neglected in m\n",
+ "g=9.81\t\t#Gravitational constant in m/s**2\n",
+ "\n",
+ "#Calculations\n",
+ "m=m1/3600.0\t #Steam flow rate in kg/s\n",
+ "Q=Q1/60.0\t\t#Heat loss from the turbine to the surroundings\n",
+ "P=m*(((C1**2-C2**2)/(2*1000))+(g*Z)+(h1-h2))+Q\n",
+ "\n",
+ "#Output\n",
+ "print'The power developed by the turbine is',round(P,1),\"KW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The power developed by the turbine is 643.1 KW\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.16 Page No. 105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "#Input data \n",
+ "c1=16\t\t#Velocity of steam at entrance in m/s\n",
+ "c2=37\t\t#Velocity of steam at exit in m/s\n",
+ "h1=2990\t\t#Specific enthalpy of steam at entrance in kJ/kg\n",
+ "h2=2530\t\t#Specific enthalpy of steam at exit in kJ/kg\n",
+ "Q=-25\t\t#Heat lost to the surroundings in kJ/kg\n",
+ "m1=360000\t#The steam flow rate in kg/hr\n",
+ "\n",
+ "#Calculations\n",
+ "m=m1/3600.0 #The steam flow rate in kg/s\n",
+ "W=(c1**2-c2**2)/2000.0+(h1-h2)+Q\t#Total work done in the system in kJ/kg\n",
+ "P=m*W\t\t\t\t\t #Power developed by the turbine in kW\n",
+ "\n",
+ "#Output\n",
+ "print'The work output from the turbine is',round(P,1),\"kW \"\n",
+ "print'NOTE: In the book there is Calculation mistake'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The work output from the turbine is 43444.3 kW \n",
+ "NOTE: In the book there is Calculation mistake\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.17 Page No.106"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "p1=720\t\t#Pressure at the entrance in kPa\n",
+ "t1=850\t\t#Temperature at the entrance in degree centigrade \n",
+ "c1=160\t\t#Velocity of the gas at entrance in m/s\n",
+ "Q=0\t\t#Insulation (adiabatic turbine)\n",
+ "P2=115\t\t#Pressure at the exit in kPa\n",
+ "t2=450\t\t#Temperature at the exit in degree centigrade\n",
+ "c2=250\t\t#Velocity of the gas at exit in m/s\n",
+ "cp=1.04\t\t#Specific heat of gas at constant pressure in kJ/kg-K\n",
+ "\n",
+ "#Calculations\n",
+ "H=cp*(t1-t2)\t\t\t#Change in Enthalpy of the gas at entrance and exit in kJ/kg\n",
+ "W=((c1**2-c2**2)/(2*1000))+(H)\t#External work output of the turbine in kJ/kg\n",
+ "\n",
+ "#Output\n",
+ "print'The external work output of the turbine is',round(W,0),\"kJ/kg\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The external work output of the turbine is 397.0 kJ/kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.18 Page No. 107"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "p=5000\t\t#Power output of an adiabatic steam turbine in kW\n",
+ "p1=2000\t\t#Pressure at the inlet in kPa\n",
+ "p2=0.15\t\t#Pressure at the exit in bar\n",
+ "t1=400\t\t#temperature at the inlet in degree centigrade\n",
+ "x=0.9\t\t#Dryness at the exit\n",
+ "c1=50\t\t#Velocity at the inlet in m/s\n",
+ "c2=180\t\t#Velocity at the exit in m/s\n",
+ "z1=10\t\t#Elevation at inlet in m\n",
+ "z2=6\t\t#Elevation at exit in m\n",
+ "h1=3248.7\t\t#Enthalpy at the inlet from the steam table corresponding to and 20 bar in kJ/kg\n",
+ "hf=226\t\t#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg\n",
+ "hfg=2373.2\t#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg\n",
+ "g=9.81\t\t#Gravitational constant in m/s**2\n",
+ "\n",
+ "#Calculations\n",
+ "h2=hf+(x*hfg) #Enthalpy at the exit in kJ/kg\n",
+ "W=(h1-h2)+((c1**2-c2**2)/(2*1000))+((g*(z1-z2))/1000.0)\n",
+ "m=p/W\t\t\t\t\t\t \n",
+ "\n",
+ "#Output\n",
+ "print'(a)The work done per unit mass of the steam flowing through turbine is',round(W,1),\"kJ/kg\"\n",
+ "print'(b)The mass flow rate of the steam is',round(m,1),\"kg/s\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The work done per unit mass of the steam flowing through turbine is 871.9 kJ/kg\n",
+ "(b)The mass flow rate of the steam is 5.7 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.19 Page No. 108"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input Data\n",
+ "p1=1000.0\t\t#Pressure at the inlet in kPa\n",
+ "t1=750.0\t\t#Temperature at the inlet in K\n",
+ "c1=200.0\t\t#Velocity at the inlet in m/s\n",
+ "p2=125.0\t\t#Pressure at the exit in kPa\n",
+ "c2=40.0\t\t #Velocity at the exit in m/s\n",
+ "m1=1000.0\t\t#Mass flow rate of air in kg/hr\n",
+ "cp=1.053\t\t#Specific heat at constant pressure in kJ/kgK\n",
+ "k=1.375\t\t #Adiabatic index\n",
+ "Q=0\t\t #The turbine is adiabatic\n",
+ "\n",
+ "#Calculations\n",
+ "m=m1/3600.0\t#The mass flow rate of air in kg/s\n",
+ "P=p2/p1\t\t#Ratio of the pressure\n",
+ "t2=t1*((p2/p1)**((k-1)/k))\t#Temperature of air at exit in K\n",
+ "h=cp*(t2-t1)\t\t#Change in enthalpy of the system in kJ\n",
+ "p=m*(((c2**2-c1**2)/(2*1000))+h)\t#Power output of the turbine in kW\n",
+ "p1=-p\t\t\t#Power output of the turbine in kW\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Temperature of air at exit is',round(t2,2),\" K \"\n",
+ "print'(b)The power output of the turbine is',round(p1,1),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Temperature of air at exit is 425.37 K \n",
+ "(b)The power output of the turbine is 100.3 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.20 Page No. 110"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "c1=7\t\t #Velocity of air at entrance in m/s\n",
+ "c2=5\t\t #Velocity of air at exit in m/s\n",
+ "p1=100\t\t #Pressure at the entrance in kPa\n",
+ "p2=700\t\t #Pressure at the exit in kPa\n",
+ "v1=0.95\t\t#Specific volume at entrance in m**3/kg\n",
+ "v2=0.19\t\t#Specific volume at exit in m**3/kg\n",
+ "u=90\t\t # Change in internal energy of the air entering and leaving in kJ/kg\n",
+ "z=0\t\t #Potential energy is neglected \n",
+ "Q=-58\t\t #Heat rejected to the surroundings in kW\n",
+ "m=0.5\t\t #The rate at which air flow in kg/s\n",
+ "g=9.81\t\t #Gravitational constant in m/s**2\n",
+ "\n",
+ "#Calculations\n",
+ "P=m*(((c1**2-c2**2)/(2000.0))+(p1*v1-p2*v2)-u)+(Q)\n",
+ "A=(v1*c2)/(v2*c1)\t#From continuity equation the ratio of areas\n",
+ "D=A**(1/2.0)\t #The ratio of inlet pipe diameter to the outlet pipe diameter\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The rate of work input to the air is ',round(P,2),\"kW\"\n",
+ "print'(b)The ratio of inlet pipe diameter to the outlet pipe diameter is ',round(D,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The rate of work input to the air is -121.99 kW\n",
+ "(b)The ratio of inlet pipe diameter to the outlet pipe diameter is 1.89\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.21 Page No. 112"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "h1=3000\t\t#Enthalpy of the fluid passing at inlet in kJ/kg\n",
+ "h2=2757\t\t#Enthalpy of the fluid at the discharge in kJ/kg\n",
+ "c1=60\t\t#Velocity of the fluid at inlet in m/s\n",
+ "A1=0.1\t\t#Inlet area of the nozzle in m**2\n",
+ "v1=0.187\t\t#Specific volume at inlet in m**3/kg\n",
+ "v2=0.498\t\t#Specific volume at the outlet in m**3/kg\n",
+ "q=0\t\t#Heat loss during the flow is negligable\n",
+ "z=0\t\t#The nozzle is horizontal so change in PE is constant\n",
+ "w=0\t\t#The work done is also negligable\n",
+ "\n",
+ "#Calculations\n",
+ "c2=(2*1000*((h1-h2)+(c1**2/2000.0)))**(1/2.0)\t#Velocity at the exit in m/s\n",
+ "m=(A1*c1)/v1\t\t\t\t#The mass flow rate in kg/s\n",
+ "A2=(m*v2)/c2\t\t\t\t#Area at the exit of the nozzle in m**3\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The velocity at the exit is',round(c2,1),\"m/s\"\n",
+ "print'(b)The mass flow rateis',round(m,1),\"kg/s\" \n",
+ "print'(c)Area at the exit is',round(A2,3),\"m**2\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The velocity at the exit is 699.7 m/s\n",
+ "(b)The mass flow rateis 32.1 kg/s\n",
+ "(c)Area at the exit is 0.023 m**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.22 Page No. 113"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "h1=3000\t\t#Specific enthalpy of steam at inlet in kJ/kg\n",
+ "h2=2762\t\t#Specific enthalpy of steam at the outlet in kJ/kg\n",
+ "v1=0.187\t\t#Specific volume of steam at inlet in m**3/kg\n",
+ "v2=0.498\t\t#Specific volume of steam at the outlet in m**3/kg\n",
+ "A1=0.1\t\t#Area at the inlet in m**2\n",
+ "q=0\t\t#There is no heat loss\n",
+ "z=0\t\t#The nozzle is horizontal ,so no change in PE\n",
+ "c1=60\t\t#Velocity of the steam at the inlet in m/s\n",
+ "\n",
+ "#Calculations\n",
+ "c2=((2*1000)*((h1-h2)+(c1**2/2000.0)))**(1/2.0)\t#Velocity of the steam at the outlet in m/s\n",
+ "m=(A1*c1)/v1\t\t\t\t#Mass flow rate of steam in kg/s\n",
+ "A2=(m*v2)/c2\t\t\t\t#Area at the nozzle exit in m**2\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Velocity of the steam at the outlet is ',round(c2,2), \"m/s \"\n",
+ "print'(b)Mass flow rate of steam is ',round(m,2),\"kg/s \"\n",
+ "print'(c)Area at the nozzle exit is',round(A2,3),\"m**2\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Velocity of the steam at the outlet is 692.53 m/s \n",
+ "(b)Mass flow rate of steam is 32.09 kg/s \n",
+ "(c)Area at the nozzle exit is 0.023 m**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.23 Page No. 114"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "c1=40\t\t#Velocity of air at the inlet of nozzle in m/s\n",
+ "h=180\t\t#The decrease in enthalpy in the nozzle in kJ/kg\n",
+ "w=0\t\t#Since adiabatic\n",
+ "q=0\t\t#Since adiabatic\n",
+ "z=0\t\t#Since adiabatic\n",
+ "\n",
+ "#Calculations\n",
+ "c2=((2*1000)*((h)+(c1**2/(2*1000))))**(1/2.0)\t#The exit velocity of air in m/s\n",
+ "\n",
+ "#Output\n",
+ "print'The exit velocity of the air is',round(c2,1),\"m/s\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The exit velocity of the air is 600.0 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.24 Page No. 115"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Input data\n",
+ "p1=100\t\t#Pressure at the inlet of the compressor in kPa\n",
+ "p2=500\t\t#Pressure at the outlet of the compressor in kPa\n",
+ "v1=3\t\t#Volume of the air at the inlet of the compressor in m**3/kg\n",
+ "v2=0.8\t\t#Volume of the air at the outlet of the compressor in m**3/kg\n",
+ "c1=25\t\t#The velocity of air at the inlet of the compressor in m/s\n",
+ "c2=130\t\t#The velocity of air at the outlet of the compressor in m/s\n",
+ "z=12\t\t#The height of delivery connection above the inlet in m\n",
+ "g=9.81\t\t#Gravitational constant in m/s**2\n",
+ "n=1.3\t\t#Polytropic index\n",
+ "\n",
+ "#Calculations\n",
+ "W=((n)*(p1*v1-p2*v2))/(n-1)\t#Workdone for open system polytropic process in kJ/kg\n",
+ "K=((c2**2-c1**2)/2000.0)\t#Change in kinetic energy of the system in kJ/kg\n",
+ "P=g*(z)/1000.0 \t\t#Change in potential energy of the system in kJ/kg\n",
+ "w=W-K-P\t\t\t #The shaft work of the compressor in kJ/kg\n",
+ "\n",
+ "#Output\n",
+ "print'The Shaft work of the compressor ',round(w,1),\"kj/kgIt is the power absorbing system\"\n",
+ "if w<0:\n",
+ " print'It is the power absorbing system'\n",
+ "else:\n",
+ " print'It is not power absorbing system'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Shaft work of the compressor -441.6 kj/kgIt is the power absorbing system\n",
+ "It is the power absorbing system\n"
+ ]
+ }
+ ],
+ "prompt_number": 38
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.25 Page No. 117"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "m=10\t\t#The rate of fluid compressed adiabatically in kg/s\n",
+ "p1=500\t\t#Initial pressure of the process in kPa\n",
+ "p2=5000\t\t#Final pressure of the process in kPa\n",
+ "v=0.001\t\t#The specific volume of the fluid in m**3/kg\n",
+ "\n",
+ "#Calculations\n",
+ "P=m*v*(p2-p1)\t#The power required in kW\n",
+ "\n",
+ "#Output\n",
+ "print'The power required is',round(P,2),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The power required is 45.0 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.26 Page No. 117"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "m=2.0\t\t#Mass flow rate of air in kg/s\n",
+ "t1=20\t\t#Initial temperature of the air in degree centigrade\n",
+ "P=-30\t\t#The amount of power consumed in kW\n",
+ "c1=100\t\t#The inlet velocity of air in m/s\n",
+ "c2=150\t\t#The outlet velocity of air in m/s\n",
+ "R=0.287\t\t#The gas constant for air in kJ/kg-K\n",
+ "g=1.4\t\t#It is the adiabatic index\n",
+ "cp=1.005\t\t#Specific heat at constant pressure in kJ/kg-K\n",
+ "q=0\t\t#Heat developed as it is adiabatic condition\n",
+ "z=0\t\t#The change in potential energy is neglected\n",
+ "\n",
+ "#Calculations\n",
+ "h=(P/m)+((c2**2-c1**2)/(2*1000))\t\t#The change in enthalpy of the system in kJ/kg\n",
+ "t=h/cp\t\t#The change in temperature of the system in degree centigrade\n",
+ "t2=t1-t\t\t#The exit air temperature in degree centigrade\n",
+ "\n",
+ "#Output\n",
+ "print'The exit air temperature is is',round(t2,2),\"C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The exit air temperature is is 28.96 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.27 Page No. 119"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "m=0.6\t\t#Mass flow rate of air in kg/s\n",
+ "W=40\t\t#Power required to run the compressor in kW\n",
+ "p1=100\t\t#Initial pressure at the inlet of the compressor in kPa\n",
+ "t1=30\t\t#Initial temperature at the inlet of the compressor in degree centigrade\n",
+ "z=0\t\t#Change in potential energy is neglected\n",
+ "c=0\t\t#Change in kinetic energy is neglected\n",
+ "q=0.4\t\t#Heat lost to the cooling water ,bearings and frictional effects is 40% of input\n",
+ "cp=1.005\t\t#Specific heat at constant pressure in kJ/kg-K\n",
+ "\n",
+ "#Calculations\n",
+ "Q=q*W\t\t#Net heat losses from the system in kW\n",
+ "H=W-Q\t\t#Change in total enthalpy of the system in kW\n",
+ "t2=(H/(m*cp))+t1\t#The exit air temperature in degree centigrade\n",
+ "\n",
+ "#Output\n",
+ "print'The exit air temperature is',round(t2,0),\"C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The exit air temperature is 70.0 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 46
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.28 Page No. 120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "m1=100\t\t#Air flow rate in kg/hr\n",
+ "q1=600\t\t#The heat generated by each person in kJ/hr\n",
+ "h1=85\t\t#The enthalpy of air entering the room in kJ/kg\n",
+ "h2=60\t\t#The enthalpy of air leaving the room in kJ/kg\n",
+ "Q1=0.2\t\t#The heat added by each lamp in the room in kW\n",
+ "P1=0.2\t\t#The power consumed by each fan in kW\n",
+ "\n",
+ "#Calculations\n",
+ "q=(5*q1)/3600.0\t#The heat generated by 5 persons in the room in kW\n",
+ "Q=3*Q1\t\t #The heat added by three lamps in the room in kW\n",
+ "P=2*P1\t\t #The power consumed by two fans in the room in kW\n",
+ "m=m1/3600.0\t\t #Mass flow rate of air in kg/s\n",
+ "H=(q+Q+P)+(m*(h1-h2))\t#Heat to be removed by the cooler in kW\n",
+ "\n",
+ "#Output\n",
+ "print'The rate at which the heat is to be removed by cooler X is',round(H,1),\"kJ/sec\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate at which the heat is to be removed by cooler X is 2.5 kJ/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.29 Page No. 121"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "p1=1000\t\t#Pressure at the inlet of the system in kPa\n",
+ "p2=15\t\t#Pressure at the outlet of the system in kPa\n",
+ "v1=0.206\t\t#Specific volume at the inlet of the system in m**3/kg\n",
+ "v2=8.93\t\t#Specific volume at the outlet of the system in m**3/kg\n",
+ "h1=2827\t\t#Specific enthalpy at the inlet of the system in kJ/kg\n",
+ "h2=2341\t\t#Specific enthalpy at the outlet of the system in kJ/kg\n",
+ "c1=20\t\t#Velocity at the inlet of the system in m/s\n",
+ "c2=120\t\t#Velocity at the outlet of the system in m/s\n",
+ "z1=3.2\t\t#Elevation at the inlet of the system in m\n",
+ "z2=0.5\t\t#Elevation at the outlet of the system in m\n",
+ "m=2.1\t\t#The fluid flow rate in kg/s\n",
+ "W=750\t\t#The work output of the device in kW\n",
+ "g=9.81\t\t#Gravitational constant in m/s**2\n",
+ "\n",
+ "#Calculations\n",
+ "Q=m*(((c2**2-c1**2)/(2*1000))+((g*(z2-z1)/(1000.0)))+(h2-h1))+W #The heat loss/gain by the system in kW\n",
+ "\n",
+ "#Output\n",
+ "print'The Heat loss by the system is',round(Q,1),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Heat loss by the system is -256.0 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.30 Page No. 122"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "t1=15\t\t#The inlet temperature of the air passing through the heat exchanger in degree centigrade\n",
+ "c1=30\t\t#The inlet velocity of air in m/s\n",
+ "t2=800\t\t#The outlet temperature of the air from heat exchanger in degree centigrade \n",
+ "c2=30\t\t#The inlet velocity of air to the turbine in m/s\n",
+ "t3=650\t\t#The outlet temperature of the air from the turbine in degree centigrade\n",
+ "c3=60\t\t#The outlet velocity of the air from turbine in m/s\n",
+ "t4=500\t\t#The temperature at the outlet of the nozzle in degree centigrade\n",
+ "m=2\t\t #Air flow rate in kg/s\n",
+ "cp=1.005\t\t#Specific heat at constant pressure in kJ/kgK\n",
+ "\n",
+ "#Calculations\n",
+ "Qh=m*cp*(t2-t1)\t#Rate of heat transfer to the air in the heat exchanger in kJ/s\n",
+ "P=m*((cp*(t2-t3))+((c2**2-c3**2)/2000.0))\t\t#Power output from the turbine in kW\n",
+ "c4=((2*1000)*(cp*(t3-t4))+c3**2)**(1/2.0)\t\t#Velocity of air at exit from nozzle in m/s\n",
+ "\n",
+ "#Output \n",
+ "print'(a)Rate of heat transfer to the air in the heat exchanger is',round(Qh,1),\"kJ/s\"\n",
+ "print'(b)Power output from the turbine is',round(P,1),\"kW\"\n",
+ "print'(c)Velocity of air at exit from nozzle is',round(c4),\"m/s\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Rate of heat transfer to the air in the heat exchanger is 1577.8 kJ/s\n",
+ "(b)Power output from the turbine is 298.8 kW\n",
+ "(c)Velocity of air at exit from nozzle is 552.0 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.31 Page No. 123"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Input data\n",
+ "p1=400.0\t\t#Initial pressure of the gas in a turbine in kPa\n",
+ "t1=573.0\t\t#Initial temperature of the gas in a turbine in K\n",
+ "p2=100.0\t\t#Final pressure of the gas in a turbine in kPa\n",
+ "V=2.5\t\t #It is the ratio of final volume to the inlet volume \n",
+ "c2=50.0\t\t#Velocity of the gas at exit in m/s\n",
+ "P=1000.0\t\t#Power developed by the turbine in kW\n",
+ "cp=5.193\t\t#Specific heat of the helium at constant pressure in kJ/kg K\n",
+ "G=8.314\t\t#Gas constant in kNm/kgK\n",
+ "M=4.0\t\t #Molecular weight of the helium\n",
+ "\n",
+ "#Calculations\n",
+ "import math\n",
+ "R=G/M\t\t #Characteristic gas constant in kNm/kgK\n",
+ "v1=(R*t1)/p1\t#Specific volume at the inlet in m**3/kg\n",
+ "v2=V*v1\t \t#Specific volume at the outlet in m**3/kg\n",
+ "n=math.log(p2/p1)/math.log(v1/v2)\t#Polytropic index \n",
+ "t2=((t1)*((p2/p1)**((n-1)/n)))\t\t#Final temperature of the gas in a turbine in K\n",
+ "w=(n/(n-1))*(R*(t1))*(1-((p2*v2)/(p1*v1)))\t#Specific work in kJ/kg\n",
+ "K=c2**2/(2*1000)\t\t\t#Change in kinetic energy in kJ/kg\n",
+ "Ws=w-K\t\t\t#Work done by the shaft in kJ/kg\n",
+ "q=Ws+(cp*(t2-t1))+K\t#The heat transfer during the process in kJ/kg\n",
+ "m=P/Ws\t\t\t#Mass flow rate of gas required in kg/s\n",
+ "A2=(m*v2)/c2\t\t#Exit area of the turbine in m**2\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The mass flow rate of the gas required is',round(m,3),\"kg/s\" \n",
+ "print'(b)The heat transfer during the process is',round(q,1), \"kJ/kg\" \n",
+ "print'(c)Exit area of the turbine is ',round(A2,3),\"m**2\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The mass flow rate of the gas required is 0.76 kg/s\n",
+ "(b)The heat transfer during the process is 201.5 kJ/kg\n",
+ "(c)Exit area of the turbine is 0.113 m**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Mechanical_Engineering/bme6.ipynb b/Basic_Mechanical_Engineering/bme6.ipynb
index 7f3d569b..8b37ff4a 100644
--- a/Basic_Mechanical_Engineering/bme6.ipynb
+++ b/Basic_Mechanical_Engineering/bme6.ipynb
@@ -1,942 +1,922 @@
-{
- "metadata": {
- "name": "C6ankit"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 6:Introduction to Heat Transfer"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.1 Page no:221"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is The minimum value of heat transfer coefficient at the outer surface\n",
- "\n",
- "#Input data\n",
- "t1=270\t\t#Temperature inside surface of the furnace wall in degree centigrade\n",
- "t3=20\t\t#Temperature outside surface is dissipating heat by convection into air in degree centigrade\n",
- "L=0.04\t\t#Thickness of the wall in m\n",
- "K=1.2\t\t#Thermal conductivity of wall in W/m-K\n",
- "t2=70\t\t#Temperature of outside surface should not exceed in degree centigrade\n",
- "A=1\t\t #Assuming area in m**2\n",
- "\n",
- "#Calculations\n",
- "Q1=(K*A*(t1-t2))/(L)\t#Heat transfer through the furnace wall in W\n",
- "hc=(Q1)/(A*(t2-t3))\t\t#Heat transfer coefficient in W/m**2K\n",
- "\n",
- "#Output\n",
- "print\"The minimum value of heat transfer coefficient at the outer surface is\",hc,\"W/m**2K\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The minimum value of heat transfer coefficient at the outer surface is 120.0 W/m**2K\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.2 page no:222"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is The change in its emissive power.\n",
- "\n",
- "#Input data\n",
- "t1=30\t\t #Normal temperature of black body in degree centigrade\n",
- "t2=100\t\t#Heated temperature of black body in degree centigrade\n",
- "s=20.52*10**-8\t#Stefan Boltzmann constant in kJ/hrK**4\n",
- "A=1\t\t #Assume area in m**2\n",
- "\n",
- "#Calculations\n",
- "T1=273+t1\t#Black body temperatures in kelvin K\n",
- "T2=273+t2\t#Heated temperature of black body in kelvin K\n",
- "E=s*(T2**4-T1**4)\t#Increase of emissive power in kJ/hr\n",
- "\n",
- "#Output\n",
- "print'The change in its emissive power',round(E,4),\"kJ/hr\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The change in its emissive power 2242.4228 kJ/hr\n"
- ]
- }
- ],
- "prompt_number": 82
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.3 page no:222"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The rate of heat loss \n",
- "#(b) Overall heat transfer coefficient \n",
- "#(c) Temperature of the outside surface of tank \n",
- "#(d)The surface area of the coil\n",
- "\n",
- "#Input data\n",
- "L=0.012 \t#Wall thickness of a mild steel tank in m\n",
- "t1=100.0\t\t#Temperature of water in tank in degree centigrade\n",
- "t4=20.0\t \t#Atmospheric temperature of air in degree centigrade\n",
- "K=50.0\t\t #Thermal conductivity of mild steel in W/m-K\n",
- "hi=2850.0\t\t#Convection heat transfer coefficient on water side in W/m**2-K\n",
- "ho=10.0\t\t#Convection heat transfer coefficient on air side in W/m**2-K\n",
- "Q1=60.0 \t#Heat trasfer from the incandicent lamp in W\n",
- "s=5.67*10**-8\t#Stefan boltzmann constant in W/m**2/K**4\n",
- "T1=2500.0\t #Lamp surface temperature in K\n",
- "T2=300.0\t\t#Room temperature in K\n",
- "A=1.0\t\t #Assuming area in m**2\n",
- "\n",
- "#Calculations\n",
- "T=t1-t4\t\t#Temperature difference in degree centigrade\n",
- "Q=(T)/((1/hi)+(L/K)+(1/ho))\t#Rate of heat loss per m**2 area of surface of tank in W\n",
- "t3=(Q/(ho*A))+(t4)\t\t#Temperature of the outside surface in degree centigrade\n",
- "U=(Q)/(A*T)\t\t#Overall Heat transfer coefficient in W/m**2/K\n",
- "a=(Q1)/(s*(T1**4-T2**4))\t#surface area of the coil in m**2\n",
- "a1=a*10**6#Surface area of the coil in mm**2\n",
- "\n",
- "#Output\n",
- "print'(a) The rate of heat loss per sq m area of the tank is',round(Q,2),\" W \"\n",
- "print '(b) Overall heat transfer coefficient is ',round(U,2),\" W/m**2/K\" \n",
- "print '(c) Temperature of the outside surface of tank is ',round(t3,2),\"C\" \n",
- "print '(d)The surface area of the coil is ',round(a1,3),\"mm**2\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a) The rate of heat loss per sq m area of the tank is 795.3 W \n",
- "(b) Overall heat transfer coefficient is 9.94 W/m**2/K\n",
- "(c) Temperature of the outside surface of tank is 99.53 C\n",
- "(d)The surface area of the coil is 27.096 mm**2\n"
- ]
- }
- ],
- "prompt_number": 83
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.4 page no:225"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine (a)Rate of heat loss . \n",
- "#(b)Rate of heat loss per hour \n",
- "\n",
- "#Input data\n",
- "A1=3.5\t\t#Area of the boiler plate in m**2\n",
- "X2=0.02\t\t#Thickness of the plate in m\n",
- "K2=50.0\t\t#Thermal conductivity of plate in W/m-K\n",
- "X1=0.002\t #Thickness of layer inside boiler in m\n",
- "K1=1.0\t\t #Thermal conductivity of layer in W/m-K\n",
- "t1=250.0\t\t#The hot gas temperature of the plate in degree centigrade\n",
- "t3=200.0\t\t#Temperature of cold air in degree centigrade\n",
- "\n",
- "#Calculations \n",
- "T=t1-t3\t\t#Temperature difference in degree centigrade\n",
- "Q=(T*A1)/((X1/K1)+(X2/K2))\t#Rate of heat loss in W\n",
- "Q1=Q/1000\t\t#Rate of heat loss in kJ/s\n",
- "Q2=Q1*3600\t\t#Rate of heat loss in kJ/hr\n",
- "\n",
- "#Output\n",
- "print'(a)Rate of heat loss is',round(Q1,2),\" kJ/s \"\n",
- "print'(b)Rate of heat loss per hour is',round(Q2,2),\"kJ/hr\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Rate of heat loss is 72.92 kJ/s \n",
- "(b)Rate of heat loss per hour is 262500.0 kJ/hr\n"
- ]
- }
- ],
- "prompt_number": 84
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.5 page no:226"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find (a)The rate of heat loss per sq m of the wall \n",
- "#(b)The temperature at the inner surface \n",
- "#(c)The temperature at the outer surface\n",
- "\n",
- "#Input data \n",
- "L1=0.225\t\t#Thickness of the brick in m\n",
- "K1=4.984\t\t#Thermal conductivity of brick in kJ/hr m C/m\n",
- "L2=0.125\t\t#Thickness of insulating brick in m\n",
- "K2=0.623\t\t#Thermal conductivity of insulating brick in kJ/hr m C /m\n",
- "Ti=1650.0\t\t#Temperature inside the furnace in degree centigrade\n",
- "hl=245.28\t\t#Conductance at inside wall in kJ/hr m**2 C\n",
- "ho=40.88\t\t#Conductance at outside wall in kJ/hr m**2 C\n",
- "To=27.0\t\t#Temperature of surrounding atmosphere in degree centigrade \n",
- "\n",
- "#Calculations \n",
- "R=((1.0/hl)+(L1/K1)+(L2/K2)+(1.0/ho))\t#Total resistance of the wall in C hr/kJ\n",
- "q=(Ti-To)/R\t\t\t#Rate of heat loss per m**2 of the wall in kJ/hr m**2\n",
- "T1=Ti-(q*(1.0/hl))\t\t\t#Inner surface temperature in degree centigrade\n",
- "T3=Ti-(q*((1.0/hl)+(L1/K1)+(L2/K2)))\t#Outer surface temperature in degree centigrade\n",
- "\n",
- "#Output\n",
- "print'(a)The rate of heat loss per sq m of the wall is',round(q,1), \"kJ/hr m**2\"\n",
- "print'(b)The temperature at the inner surface is',round(T1,2),\"C\" \n",
- "print'(c)The temperature at the outer surface is',round(T3,2),\"C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The rate of heat loss per sq m of the wall is 5916.3 kJ/hr m**2\n",
- "(b)The temperature at the inner surface is 1625.88 C\n",
- "(c)The temperature at the outer surface is 171.72 C\n"
- ]
- }
- ],
- "prompt_number": 85
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.6 page no:227"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find(a)The heat transfer by conduction through the wall \n",
- "#(b)Resistance of the wall \n",
- "#Conductance of the wall .\n",
- "\n",
- "#Input data\n",
- "x=0.3\t\t#Thickness of the wall in degree centigrade\n",
- "t1=24.0\t\t#Inside surface temperature of the wall in degree centigrade\n",
- "t2=-6\t\t#Outside temperature of wall in degree centigrade\n",
- "h=2.75\t\t#Height of the wall in m\n",
- "L=6.1\t\t#Length of the wall in m\n",
- "K=2.6\t\t#Coefficient of conductivity of brick in kJ/hr m C\n",
- "\n",
- "#Calculations \n",
- "A=h*L\t\t#Area of the wall in m**2\n",
- "A=round(A,1)\n",
- "T=t2-t1\t\t#Temperature difference in degree centigrade\n",
- "q=(K*A*(-T))/(x)\t#Heat transfer by conduction in kJ/hr\n",
- "R=(t1-t2)/q\t#Resistance of the wall in C hr/kJ\n",
- "C=1.0/R\t\t#Conductance of the wall in kJ/m C\n",
- "\n",
- "#Output\n",
- "print'(a)The heat transfer by conduction through the wall is',q, \"kJ/hr\"\n",
- "print'(b)Resistance of the wall is',round(R,5),\"C hr/kJ\"\n",
- "print'(C)Conductance of the wall is',round(C,1),\"kJ/m C\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The heat transfer by conduction through the wall is 4368.0 kJ/hr\n",
- "(b)Resistance of the wall is 0.00687 C hr/kJ\n",
- "(C)Conductance of the wall is 145.6 kJ/m C\n"
- ]
- }
- ],
- "prompt_number": 86
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.8 page no:230"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine Heat received by the unit area of earths surface.\n",
- "\n",
- "#Input data \n",
- "T=300\t\t#Temperature of the earth as a black body in K\n",
- "s=20.52*10**-8\t#Stefan Boltzmann constant in kJ/hr m**2 T**4\n",
- "\n",
- "#Calculations \n",
- "Q=s*T**4\t#Heat received by unit area on the earths surface perpendicular to solar rays in kJ/hr\n",
- "\n",
- "#Output\n",
- "print'Heat received by the unit area of earths surface',round(Q,2),\"kJ/hr\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Heat received by the unit area of earths surface 1662.12 kJ/hr\n"
- ]
- }
- ],
- "prompt_number": 87
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.9 page no:230"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is The loss of heat by radiation from steel tube\n",
- "\n",
- "#Input data\n",
- "D=0.07\t\t # Diameter of the steel tube in m\n",
- "L=3.0\t\t #Length of the steel tube\n",
- "t1=227.0\t\t#Temperature of the steel tube in m\n",
- "t2=27.0\t \t#Temperature of the room in degree centigrade\n",
- "s=20.52*10**-8\t#Stefan Boltzmann constant in kJ/hr m**2 T**4\n",
- "pi=3.1428\t\t#Constant value of pi\n",
- "\n",
- "#Calculations \n",
- "A=2*pi*D*L\t #Surface area of the tube in m**2\n",
- "Q=(A)*(s)*((t1+273)**4-(t2+273)**4)\t#Loss of heat by radiation in kJ/hr\n",
- "Q1=Q/3600.0\t #Loss of heat by radiation in kW\n",
- "\n",
- "#Output\n",
- "print'The loss of heat by radiation from steel tube is',round(Q1,3),\"KW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The loss of heat by radiation from steel tube is 4.093 KW\n"
- ]
- }
- ],
- "prompt_number": 88
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.10 page no:231"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The rate of heat removed from the refrigirator\n",
- "\n",
- "#Input data\n",
- "T1=7.0\t\t #Inside temperature of refrigerator in degree centigrade \n",
- "T0=28.0\t\t#Temperature in the kitchen in degree centigrade\n",
- "K1=40.0\t\t#Thermal conductivity of mild steel in W/mC\n",
- "x1=0.03\t\t#Thickness of mild sheets in m\n",
- "K3=40.0\t\t#Thermal conductivity of the mild steel in W/mC\n",
- "x3=0.03\t\t#Thickness of another side mild sheet in m\n",
- "x2=0.05\t\t#Thickness of glass wool insulated in m\n",
- "hi=10.0\t\t#Heat transfer coefficient in the inner surface of refrigerator in W/m**2 C\n",
- "ho=12.5\t\t#Heat transfer coefficient in the outer surface of refrigerator in W/m**2 C\n",
- "K2=0.04\t\t#Thermal conductivity of glass in W/mC\n",
- "\n",
- "#Calculations\n",
- "Q=(T1-T0)/((1/hi)+(x1/K1)+(x2/K2)+(x3/K3)+(1/ho))\t#Heat transfer per unit area in W/m**2\n",
- "\n",
- "#Output\n",
- "print'The rate of heat removed from the refrigirator ',round(Q,3),\"W/m**2\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The rate of heat removed from the refrigirator -14.67 W/m**2\n"
- ]
- }
- ],
- "prompt_number": 89
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.11 page no:232"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find (a)Heat loss per m**2 area of the furnace wall \n",
- "#(b)Maximum temperature to which common brick is subjected \n",
- "\n",
- "#Input data\n",
- "x1=0.2\t \t#Thickness of the fire brick\n",
- "x2=0.2\t \t#Thickness of the common brick\n",
- "Ti=1400.0 \t#Temperature of hot gases in the inner surface of the brick in degree centigrade\n",
- "To=50.0\t\t#Temperature of gases in the outer surface of the brick in degree centigrade\n",
- "h1=16.5\t\t#Convection heat transfer coefficient on gas side in W/mC\n",
- "h2=17.5\t\t#radiation heat transfer coefficient on gas side in W/mC\n",
- "h3=12.5\t\t#Convection heat transfer coefficient on outer side in W/mC\n",
- "h4=6.5 \t\t#Radiation heat transfer coeeficient on outer side in W/mC\n",
- "K1=4.0 \t\t#Thermal conductivity of fire brick in W/mC\n",
- "K2=0.65\t\t#Thermal conductivity of common brick in W/mC\n",
- "\n",
- "#Calculations \n",
- "hi=h1+h2\t\t#Total heat transfer coefficient in inner \n",
- "ho=h3+h4\t\t#Total heat transfer coefficient in outer \n",
- "Q=(Ti-To)/((1/hi)+(x1/K1)+(x2/K2)+(1/ho))\t#Heat flow through the furnace composite wall per unit area in W/m**2\n",
- "Q1=Q/1000\n",
- "T1=Ti-(Q/hi)\t#Temperature at the inside of the fire brick \n",
- "T2=T1-(Q*(x1/K1))#Maximum temperature to which common brick is subjected in degree centigrade\n",
- "\n",
- "#Output\n",
- "print'(a)Heat loss per m**2 area of the furnace wall is',round(Q)/1000,\"kW/m**2\" \n",
- "print'(b)Maximum temperature to which common brick is subjec',round(T1,3),\"C\" \n",
- "print'(c)similarly on other side is',round(T2,3),\"C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)Heat loss per m**2 area of the furnace wall is 3.07 kW/m**2\n",
- "(b)Maximum temperature to which common brick is subjec 1309.705 C\n",
- "(c)similarly on other side is 1156.204 C\n"
- ]
- }
- ],
- "prompt_number": 90
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.12 page no:234"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is The thickness of the red brick layer \n",
- "\n",
- "#Input data\n",
- "K1=0.93\t\t#Thermal conductivity of fire clay in W/mC\n",
- "K2=0.13\t\t#Thermal conductivity of diatomite brick in W/mC\n",
- "K3=0.7\t\t#Thermal conductivity of red brick in W/mC\n",
- "x1=0.12\t\t#Thickness of fire clay in m\n",
- "x2=0.05\t\t#Thickness of diatomite in m\n",
- "x3=0.25\t\t#Thickness of brick in m\n",
- "T=1\t\t#Assume the difference between temperature in degree centigrade\n",
- "\n",
- "#Calculations\n",
- "Q=(T)/((x1/K1)+(x2/K2)+(x3/K3))\t#The heat flow per unit area in W/m**2\n",
- "X3=K3*((T/Q)-(x1/K1))\t\t#Thickness of the red brick layer in m\n",
- "X=X3*100\t\t\t#Thickness of the red brick layer in cm\n",
- "\n",
- "#Output\n",
- "print'The thickness of the red brick layer is',round(X,3),\"cm\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The thickness of the red brick layer is 51.923 cm\n"
- ]
- }
- ],
- "prompt_number": 91
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.13 page no:235"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Determine the rate of heat loss\n",
- "\n",
- "#Input data\n",
- "R1=0.06\t\t#Thickness of material layer in m\n",
- "R2=0.12\t\t#Thickness of the two insulating materials in m\n",
- "R3=0.16\t\t#Thickness of material layers with pipe in m\n",
- "K1=0.24\t\t#Thermal conductivity of one layer in W/mC\n",
- "K2=0.4\t\t #Thermal conductivity of another layer in W/mC\n",
- "L=60.0\t\t #Length of the pipe in m\n",
- "hi=60.0\t\t#Heat transfer coefficient inside in W/m**2C\n",
- "ho=12.0\t\t#Heat transfer coefficient outside in W/m**2C\n",
- "ti=65.0\t\t#Temperature of hot air flowing in pipe in degree centigrade\n",
- "to=20.0\t\t#Atmospheric temperature in degree centigrade\n",
- "pi=3.1428\t #Constant value of pi\n",
- "\n",
- "#Calculations\n",
- "Q=(ti-to)*(2*pi*L)/((1/(hi*R1))+(math.log(R2/R1)/(K1))+(math.log(R3/R2)/(K2))+(1/(ho*R3)))\t#Rate of heat loss in W\n",
- "Q1=Q/1000\t#Rate of heat loss in kW\n",
- "\n",
- "#Output\n",
- "print'The rate of heat loss is',round(Q1,4),\"kW\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The rate of heat loss is 3.8519 kW\n"
- ]
- }
- ],
- "prompt_number": 92
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.14 page no:237"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find (a)The quantity of heat lost per meter length of steam pipe \n",
- "#(b)The quantity of steam coming out of one meter length pipe.\n",
- "\n",
- "#Input data\n",
- "R1=8.0\t\t #Inner radius of the pipe in cm\n",
- "R2=8.5\t\t #Outter radius of the pipe in cm\n",
- "x1=3.0\t\t #Thickness of first layer in cm\n",
- "x2=5.0\t\t #Thickness of second layer in cm\n",
- "T1=300.0\t\t#Inner surface temperature of the steam pipe in degree centigrade\n",
- "pi=3.1428\t #Constant value of pi \n",
- "T4=50.0\t\t #Temperature at outer surface of insulation in degree centigrade\n",
- "L=1.0\t\t #Length of the pipe in m\n",
- "K1=50.0\t \t#Thermal conductivity of pipe in W/mC\n",
- "K2=0.15\t \t#Thermal conductivity of first layer in W/mC\n",
- "K3=0.08\t \t#Thermal conductivity of second layer in W/mC\n",
- "h=2751.0\t\t#Enthalpy of dry and saturated steam at 300 degree centigrade in kJ/kg\n",
- "q=40.0\t \t#Quantity of steam flow in gm/hr\n",
- "hf=1345.0\t\t#Enthalpy of fluid at 300 degree centigrade in kJ/kg\n",
- "hfg=1406.0\t\t#enthalpy at 300 degree centigrade in kJ/kg\n",
- "\n",
- "#Calculations\n",
- "R3=R2+x1\t#Radius of pipe with first layer\n",
- "R4=R3+x2\t#Radius of pipe with two layers\n",
- "Q=(2*pi*L*(T1-T4))/((math.log(R2/R1)/(K1))+(math.log(R3/R2)/(K2))+(math.log(R4/R3)/(K3)))\n",
- "Q1=Q/1000\t#Quantity of heat loss per meter length of pipe in kW\n",
- "Q2=Q1*3600\t#Quantity of heat loss per meter length of pipe in kJ/hr\n",
- "hg=((h)-(Q2/q))\t#Enthalpy of steam in kJ/kg\n",
- "x=(hg-hf)/(hfg)\t#Dryness fraction of steam\n",
- "\n",
- "#Output\n",
- "print'(a)The quantity of heat lost per meter length of steam pipe is',round(Q,2),\"W/m or\",round(Q*3600/1000),\"kJ/hr\"\n",
- "print'(b)The quantity of steam coming out of one meter length pipe is',round(x,4),\"gm/h\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The quantity of heat lost per meter length of steam pipe is 240.68 W/m or 866.0 kJ/hr\n",
- "(b)The quantity of steam coming out of one meter length pipe is 0.9846 gm/h\n"
- ]
- }
- ],
- "prompt_number": 93
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.15 page no:238"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find(a)The heat transfer by conduction through the wall \n",
- "#(b)Resistance of the wall \n",
- "#Conductance of the wall .\n",
- "\n",
- "#Input data\n",
- "x=0.3\t\t#Thickness of brick wall in m\n",
- "ti=24.0\t\t#Inside surface temperature of wall in degree centigrade\n",
- "to=-6.0\t\t#Outside surface temperature of wall in degree centigrade\n",
- "h=2.75\t\t#Height of the wall in m\n",
- "L=6.1\t\t#Length of the wall in m\n",
- "K=2.6\t\t#Thermal conductivity of brick material in kJ/m hr C\n",
- "\n",
- "#Calculations\n",
- "T=ti-to\t\t#Temperature difference across the wall in degree centigrade\n",
- "A=h*L\t\t#Area of the wall in m**2\n",
- "Q=(K*A*T)/(x)\t#Heat transfer through conduction by the wall per hour in kJ/hr\n",
- "R=T/Q\t\t#Resistance of the wall in hr C/kJ\n",
- "C=1.0/R\t\t#Conductance of the wall in kJ/hr C\n",
- "\n",
- "#Output\n",
- "print'(a)The heat transfer by conduction through the wall is',round(Q),\"kJ/hr \"\n",
- "print'(b)The resistance of the wall is ',round(R,5),\"Chr/Kj \" \n",
- "print' The conductance of the wall is',round(C,1), \"kJ/hr C \"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The heat transfer by conduction through the wall is 4362.0 kJ/hr \n",
- "(b)The resistance of the wall is 0.00688 Chr/Kj \n",
- " The conductance of the wall is 145.4 kJ/hr C \n"
- ]
- }
- ],
- "prompt_number": 94
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.16 page no:240"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#What is The reduction in heat loss through the wall\n",
- "\n",
- "#Input data\n",
- "x1=0.3 \t#Thickness of refractory bricks in m\n",
- "K1=5.66\t\t#Thermal conductivity of refractory bricks in kJ/hr mC\n",
- "t1=1650.0\t\t#Inner surface temperature of the wall in degree centigrade\n",
- "t2=320.0\t \t#Outside surface temperature of the wall in degree centigrade\n",
- "x2=0.3\t \t#Thickness of insulating brick in m\n",
- "K2=1.26\t\t#Thermal conductivity of insulating brick in kJ/hr mC\n",
- "A=1.0\t \t#unit surface area in m**2\n",
- "t3=27.0\t\t#Outside surface temperature of the brick in degree centigrade\n",
- "\n",
- "#Calculations \n",
- "T1=t1-t2\t\t#Temperature difference in degree centigrade\n",
- "Q1=(K1*A*T1)/(x1)\t#Heat loss without insulation in kJ/hr/m**2\n",
- "R1=(K1*A)/(x1)\t#Heat loss for the change in temperature for refractory brick wall material in kJ/hrC\n",
- "R2=(K2*A)/(x2)\t#Heat loss for the change in temperature for insulated brick wall material kJ/hrC\n",
- "Q2=(t1-t3)/((1.0/R1)+(1.0/R2))\t#Heat loss with insulation in kJ/hr/m**2\n",
- "Q3=Q1-Q2\t\t#Reduction in heat loss through the wall in kJ/hr/m**2\n",
- "\n",
- "#Output\n",
- "print'The reduction in heat loss through the wall is ',round(Q3,1),\"kJ/hr/m**2\"\n",
- "print\"\\nNOTE:Answer wrongly written in book as 1951.4\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The reduction in heat loss through the wall is 19517.2 kJ/hr/m**2\n",
- "\n",
- "NOTE:Answer wrongly written in book as 1951.4\n"
- ]
- }
- ],
- "prompt_number": 95
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.17 page no:241"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find (a)The leakage through the wall per 24 hours \n",
- "#(b)Temperature at the interface \n",
- "#Temperature at interface \n",
- "\n",
- "#Input data\n",
- "L=4.6\t \t #Length of the wall in m\n",
- "b=2.3\t \t#Breadth of the wall in m\n",
- "x1=0.025\t\t#Thickness of the wood in m\n",
- "x2=0.075\t\t#Thickness of the cork slabbing in m\n",
- "x3=0.115\t\t#Thickness of the brick in m\n",
- "t1=18.0\t\t #Exterior temperature of the wall in degree centigrade\n",
- "t4=-20.0\t\t#Interior temperature of the wall in degree centigrade\n",
- "K1=7.5 \t\t #Thermal conductivity of the wood in kJ/hr mC\n",
- "K2=1.9 \t\t #Thermal conductivity of the wood in kJ/hr.mC\n",
- "K3=41.0\t\t #Thermal conductivity of the brick in kJ/hr mC\n",
- "\n",
- "#Calculations\n",
- "A=L*b\t\t#Area of the wall in m**2\n",
- "R1=(K1*A)/(x1)\t#Heat loss for the change in temperature for insulated wood material in kJ/hrC\n",
- "R2=(K2*A)/(x2)\t#Heat loss for the change in temperature for cork material in kJ/hrC\n",
- "R3=(K3*A)/(x3)\t#Heat loss for the change in temperature for brick in kJ/hrC\n",
- "Q=(t1-t4)/((1.0/R1)+(1.0/R2)+(1.0/R3))\t#Heat loss with insulation in kJ/hr\n",
- "Q1=Q*24.0\t\t#Heat loss with insulation in kJ/24hr\n",
- "t2=t1-(Q/R1)\t#Interface temperature t2 in degree centigrade \n",
- "t3=t2-(Q/R2)\t#Interface temperature t3 in degree centigrade\n",
- "\n",
- "#Output \n",
- "print'(a)The leakage through the wall per 24 hours is',round(Q,2),\"kJ/hr=\",round(Q,2)*24 \n",
- "print'(b)Temperature at the interface is',round(t2,3),\"C\" \n",
- "print'(c)Temperature at interface ',round(t3,3),\"C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The leakage through the wall per 24 hours is 8814.37 kJ/hr= 211544.88\n",
- "(b)Temperature at the interface is 15.223 C\n",
- "(c)Temperature at interface -17.663 C\n"
- ]
- }
- ],
- "prompt_number": 96
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.18 page no:243"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find The heat loss per sq metre of surface area for a furnace wall \n",
- "\n",
- "#Input data\n",
- "L=0.3\t\t#Thickness of the wall in m\n",
- "ti=320\t\t#Inner surface temperature in degree centigrade\n",
- "to=38\t\t#Outer surface temperature in degree centigrade\n",
- "A=1\t\t#Assume unit area in m**2\n",
- "\n",
- "#Calculations\n",
- "Q=(A/L)*((0.01256/2)*(ti**2-to**2)-(4.2/3)*10**-6*(ti**3-to**3)) #Heat loss per sq metre of surface area\n",
- "\n",
- "#Output\n",
- "print'The heat loss per sq metre of surface area for a furnace wall is',round(Q,2),\"kJ/hr/m**2 \"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The heat loss per sq metre of surface area for a furnace wall is 1960.68 kJ/hr/m**2 \n"
- ]
- }
- ],
- "prompt_number": 97
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.19 page no:245"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Input data\n",
- "d=11.5\t\t#Outer diameter of steam pipe line in cm\n",
- "t1=5.0\t\t#Thickness of first layer in cm\n",
- "K1=0.222\t\t#Thermal conductivity of first layer in kJ/hr mC\n",
- "t2=3.0\t\t#Thickness of second layer in cm\n",
- "pi=3.1428\t\t#Constant value of pi\n",
- "K2=3.14\t\t#Thermal conductivity of second layer in kJ/hr mC\n",
- "T1=235\t\t#Outside surface temperature of steam pipe in degree centigrade\n",
- "T3=38\t\t#Outer surface of lagging in degree centigrade\n",
- "L=1.0\t\t#Length of the pipe in m\n",
- "\n",
- "#Calculations\n",
- "I=math.log((d+(2*t1))/d)\t\t\t#For inner layer calculation\n",
- "O=math.log((d+(2*t1)+(2*t2))/(d+(2*t1)))\t\t#For outer layer calculations\n",
- "R1=(2.0*pi*L*K1)/I\t\t#Heat loss for change in temperature for first insulated material in kJ/hC\n",
- "R2=(2.0*pi*L*K2)/O\t\t#Heat loss for the change in temperature for second insulated material in kJ/hC\n",
- "Q=(T1-T3)/(1.0/R1+1.0/R2)\t#Heat loss per metre length of pipe per hr in kJ/hr\n",
- "T2=T1-(Q/R1)#Temperature between the two layers of insulation in degree centigrade\n",
- "\n",
- "#Output\n",
- "print'(a)The heat loss per metre length of pipe per hr is',round(Q,2),\" kJ/hr\" \n",
- "print'(b)Temperature between the two layers of insulation is',round(T2,2),\"C\"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(a)The heat loss per metre length of pipe per hr is 427.45 kJ/hr\n",
- "(b)Temperature between the two layers of insulation is 43.33 C\n"
- ]
- }
- ],
- "prompt_number": 98
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6.20 page no:247"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the rate of heat flow\n",
- "\n",
- "#Input data\n",
- "t1=24.0 \t#Temperature at the outside surface in degree centigrade \n",
- "t4=-15.0 \t#Temperature at the inner surface in degree centigrade\n",
- "A=1.0 \t\t#Assuming unit area in m**2\n",
- "K1=23.2\t\t#Thermal conductivity of steel in W/mC\n",
- "K2=0.014\t\t#Thermal conductivity of glasswood in W/mC\n",
- "K3=0.052\t\t#Thermal conductivity of plywood in W/mC\n",
- "x1=0.0015\t\t#Thickness of steel sheet at outer surface in m\n",
- "x2=0.02\t\t#Thickness of glasswood in between in m\n",
- "x3=0.01\t\t#Thickness of plywood at a inner surface in m\n",
- "\n",
- "#Calculations\n",
- "R1=(K1*A)/x1\t#Heat loss for the change in temperature for first insulated material\n",
- "R2=(K2*A)/x2\t#Heat loss for the change in temperature for second insulated material\n",
- "R3=(K3*A)/x3\t#Heat loss for the change in temperature for third insulated material\n",
- "Q=(t1-t4)/(1/R1+1/R2+1/R3)\t#The rate of heat flow in W/m**2\n",
- "\n",
- "#Output\n",
- "print'The rate of heat flow is',round(Q,2),\"W/m**2 \"\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The rate of heat flow is 24.06 W/m**2 \n"
- ]
- }
- ],
- "prompt_number": 21
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:3005e9f014df5b80be5a0d9ce99c3166f00b45b3269e9a4b1d59ef8c3aeabae4"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6:Introduction to Heat Transfer"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.1 Page no:221"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "t1=270\t\t#Temperature inside surface of the furnace wall in degree centigrade\n",
+ "t3=20\t\t#Temperature outside surface is dissipating heat by convection into air in degree centigrade\n",
+ "L=0.04\t\t#Thickness of the wall in m\n",
+ "K=1.2\t\t#Thermal conductivity of wall in W/m-K\n",
+ "t2=70\t\t#Temperature of outside surface should not exceed in degree centigrade\n",
+ "A=1\t\t #Assuming area in m**2\n",
+ "\n",
+ "#Calculations\n",
+ "Q1=(K*A*(t1-t2))/(L)\t#Heat transfer through the furnace wall in W\n",
+ "hc=(Q1)/(A*(t2-t3))\t\t#Heat transfer coefficient in W/m**2K\n",
+ "\n",
+ "#Output\n",
+ "print\"The minimum value of heat transfer coefficient at the outer surface is\",hc,\"W/m**2K\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The minimum value of heat transfer coefficient at the outer surface is 120.0 W/m**2K\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.2 page no:222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "t1=30\t\t #Normal temperature of black body in degree centigrade\n",
+ "t2=100\t\t#Heated temperature of black body in degree centigrade\n",
+ "s=20.52*10**-8\t#Stefan Boltzmann constant in kJ/hrK**4\n",
+ "A=1\t\t #Assume area in m**2\n",
+ "\n",
+ "#Calculations\n",
+ "T1=273+t1\t#Black body temperatures in kelvin K\n",
+ "T2=273+t2\t#Heated temperature of black body in kelvin K\n",
+ "E=s*(T2**4-T1**4)\t#Increase of emissive power in kJ/hr\n",
+ "\n",
+ "#Output\n",
+ "print'The change in its emissive power',round(E,4),\"kJ/hr\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The change in its emissive power 2242.4228 kJ/hr\n"
+ ]
+ }
+ ],
+ "prompt_number": 82
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.3 page no:222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "L=0.012 \t#Wall thickness of a mild steel tank in m\n",
+ "t1=100.0\t\t#Temperature of water in tank in degree centigrade\n",
+ "t4=20.0\t \t#Atmospheric temperature of air in degree centigrade\n",
+ "K=50.0\t\t #Thermal conductivity of mild steel in W/m-K\n",
+ "hi=2850.0\t\t#Convection heat transfer coefficient on water side in W/m**2-K\n",
+ "ho=10.0\t\t#Convection heat transfer coefficient on air side in W/m**2-K\n",
+ "Q1=60.0 \t#Heat trasfer from the incandicent lamp in W\n",
+ "s=5.67*10**-8\t#Stefan boltzmann constant in W/m**2/K**4\n",
+ "T1=2500.0\t #Lamp surface temperature in K\n",
+ "T2=300.0\t\t#Room temperature in K\n",
+ "A=1.0\t\t #Assuming area in m**2\n",
+ "\n",
+ "#Calculations\n",
+ "T=t1-t4\t\t#Temperature difference in degree centigrade\n",
+ "Q=(T)/((1/hi)+(L/K)+(1/ho))\t#Rate of heat loss per m**2 area of surface of tank in W\n",
+ "t3=(Q/(ho*A))+(t4)\t\t#Temperature of the outside surface in degree centigrade\n",
+ "U=(Q)/(A*T)\t\t#Overall Heat transfer coefficient in W/m**2/K\n",
+ "a=(Q1)/(s*(T1**4-T2**4))\t#surface area of the coil in m**2\n",
+ "a1=a*10**6#Surface area of the coil in mm**2\n",
+ "\n",
+ "#Output\n",
+ "print'(a) The rate of heat loss per sq m area of the tank is',round(Q,2),\" W \"\n",
+ "print '(b) Overall heat transfer coefficient is ',round(U,2),\" W/m**2/K\" \n",
+ "print '(c) Temperature of the outside surface of tank is ',round(t3,2),\"C\" \n",
+ "print '(d)The surface area of the coil is ',round(a1,3),\"mm**2\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) The rate of heat loss per sq m area of the tank is 795.3 W \n",
+ "(b) Overall heat transfer coefficient is 9.94 W/m**2/K\n",
+ "(c) Temperature of the outside surface of tank is 99.53 C\n",
+ "(d)The surface area of the coil is 27.096 mm**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 83
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.4 page no:225"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "A1=3.5\t\t#Area of the boiler plate in m**2\n",
+ "X2=0.02\t\t#Thickness of the plate in m\n",
+ "K2=50.0\t\t#Thermal conductivity of plate in W/m-K\n",
+ "X1=0.002\t #Thickness of layer inside boiler in m\n",
+ "K1=1.0\t\t #Thermal conductivity of layer in W/m-K\n",
+ "t1=250.0\t\t#The hot gas temperature of the plate in degree centigrade\n",
+ "t3=200.0\t\t#Temperature of cold air in degree centigrade\n",
+ "\n",
+ "#Calculations \n",
+ "T=t1-t3\t\t#Temperature difference in degree centigrade\n",
+ "Q=(T*A1)/((X1/K1)+(X2/K2))\t#Rate of heat loss in W\n",
+ "Q1=Q/1000\t\t#Rate of heat loss in kJ/s\n",
+ "Q2=Q1*3600\t\t#Rate of heat loss in kJ/hr\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Rate of heat loss is',round(Q1,2),\" kJ/s \"\n",
+ "print'(b)Rate of heat loss per hour is',round(Q2,2),\"kJ/hr\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Rate of heat loss is 72.92 kJ/s \n",
+ "(b)Rate of heat loss per hour is 262500.0 kJ/hr\n"
+ ]
+ }
+ ],
+ "prompt_number": 84
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.5 page no:226"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data \n",
+ "L1=0.225\t\t#Thickness of the brick in m\n",
+ "K1=4.984\t\t#Thermal conductivity of brick in kJ/hr m C/m\n",
+ "L2=0.125\t\t#Thickness of insulating brick in m\n",
+ "K2=0.623\t\t#Thermal conductivity of insulating brick in kJ/hr m C /m\n",
+ "Ti=1650.0\t\t#Temperature inside the furnace in degree centigrade\n",
+ "hl=245.28\t\t#Conductance at inside wall in kJ/hr m**2 C\n",
+ "ho=40.88\t\t#Conductance at outside wall in kJ/hr m**2 C\n",
+ "To=27.0\t\t#Temperature of surrounding atmosphere in degree centigrade \n",
+ "\n",
+ "#Calculations \n",
+ "R=((1.0/hl)+(L1/K1)+(L2/K2)+(1.0/ho))\t#Total resistance of the wall in C hr/kJ\n",
+ "q=(Ti-To)/R\t\t\t#Rate of heat loss per m**2 of the wall in kJ/hr m**2\n",
+ "T1=Ti-(q*(1.0/hl))\t\t\t#Inner surface temperature in degree centigrade\n",
+ "T3=Ti-(q*((1.0/hl)+(L1/K1)+(L2/K2)))\t#Outer surface temperature in degree centigrade\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The rate of heat loss per sq m of the wall is',round(q,1), \"kJ/hr m**2\"\n",
+ "print'(b)The temperature at the inner surface is',round(T1,2),\"C\" \n",
+ "print'(c)The temperature at the outer surface is',round(T3,2),\"C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The rate of heat loss per sq m of the wall is 5916.3 kJ/hr m**2\n",
+ "(b)The temperature at the inner surface is 1625.88 C\n",
+ "(c)The temperature at the outer surface is 171.72 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 85
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.6 page no:227"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "x=0.3\t\t#Thickness of the wall in degree centigrade\n",
+ "t1=24.0\t\t#Inside surface temperature of the wall in degree centigrade\n",
+ "t2=-6\t\t#Outside temperature of wall in degree centigrade\n",
+ "h=2.75\t\t#Height of the wall in m\n",
+ "L=6.1\t\t#Length of the wall in m\n",
+ "K=2.6\t\t#Coefficient of conductivity of brick in kJ/hr m C\n",
+ "\n",
+ "#Calculations \n",
+ "A=h*L\t\t#Area of the wall in m**2\n",
+ "A=round(A,1)\n",
+ "T=t2-t1\t\t#Temperature difference in degree centigrade\n",
+ "q=(K*A*(-T))/(x)\t#Heat transfer by conduction in kJ/hr\n",
+ "R=(t1-t2)/q\t#Resistance of the wall in C hr/kJ\n",
+ "C=1.0/R\t\t#Conductance of the wall in kJ/m C\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The heat transfer by conduction through the wall is',q, \"kJ/hr\"\n",
+ "print'(b)Resistance of the wall is',round(R,5),\"C hr/kJ\"\n",
+ "print'(C)Conductance of the wall is',round(C,1),\"kJ/m C\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The heat transfer by conduction through the wall is 4368.0 kJ/hr\n",
+ "(b)Resistance of the wall is 0.00687 C hr/kJ\n",
+ "(C)Conductance of the wall is 145.6 kJ/m C\n"
+ ]
+ }
+ ],
+ "prompt_number": 86
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.8 page no:230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "T=300\t\t#Temperature of the earth as a black body in K\n",
+ "s=20.52*10**-8\t#Stefan Boltzmann constant in kJ/hr m**2 T**4\n",
+ "\n",
+ "#Calculations \n",
+ "Q=s*T**4\t#Heat received by unit area on the earths surface perpendicular to solar rays in kJ/hr\n",
+ "\n",
+ "#Output\n",
+ "print'Heat received by the unit area of earths surface',round(Q,2),\"kJ/hr\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Heat received by the unit area of earths surface 1662.12 kJ/hr\n"
+ ]
+ }
+ ],
+ "prompt_number": 87
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.9 page no:230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "D=0.07\t\t # Diameter of the steel tube in m\n",
+ "L=3.0\t\t #Length of the steel tube\n",
+ "t1=227.0\t\t#Temperature of the steel tube in m\n",
+ "t2=27.0\t \t#Temperature of the room in degree centigrade\n",
+ "s=20.52*10**-8\t#Stefan Boltzmann constant in kJ/hr m**2 T**4\n",
+ "pi=3.1428\t\t#Constant value of pi\n",
+ "\n",
+ "#Calculations \n",
+ "A=2*pi*D*L\t #Surface area of the tube in m**2\n",
+ "Q=(A)*(s)*((t1+273)**4-(t2+273)**4)\t#Loss of heat by radiation in kJ/hr\n",
+ "Q1=Q/3600.0\t #Loss of heat by radiation in kW\n",
+ "\n",
+ "#Output\n",
+ "print'The loss of heat by radiation from steel tube is',round(Q1,3),\"KW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The loss of heat by radiation from steel tube is 4.093 KW\n"
+ ]
+ }
+ ],
+ "prompt_number": 88
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.10 page no:231"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "T1=7.0\t\t #Inside temperature of refrigerator in degree centigrade \n",
+ "T0=28.0\t\t#Temperature in the kitchen in degree centigrade\n",
+ "K1=40.0\t\t#Thermal conductivity of mild steel in W/mC\n",
+ "x1=0.03\t\t#Thickness of mild sheets in m\n",
+ "K3=40.0\t\t#Thermal conductivity of the mild steel in W/mC\n",
+ "x3=0.03\t\t#Thickness of another side mild sheet in m\n",
+ "x2=0.05\t\t#Thickness of glass wool insulated in m\n",
+ "hi=10.0\t\t#Heat transfer coefficient in the inner surface of refrigerator in W/m**2 C\n",
+ "ho=12.5\t\t#Heat transfer coefficient in the outer surface of refrigerator in W/m**2 C\n",
+ "K2=0.04\t\t#Thermal conductivity of glass in W/mC\n",
+ "\n",
+ "#Calculations\n",
+ "Q=(T1-T0)/((1/hi)+(x1/K1)+(x2/K2)+(x3/K3)+(1/ho))\t#Heat transfer per unit area in W/m**2\n",
+ "\n",
+ "#Output\n",
+ "print'The rate of heat removed from the refrigirator ',round(Q,3),\"W/m**2\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate of heat removed from the refrigirator -14.67 W/m**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 89
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.11 page no:232"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "x1=0.2\t \t#Thickness of the fire brick\n",
+ "x2=0.2\t \t#Thickness of the common brick\n",
+ "Ti=1400.0 \t#Temperature of hot gases in the inner surface of the brick in degree centigrade\n",
+ "To=50.0\t\t#Temperature of gases in the outer surface of the brick in degree centigrade\n",
+ "h1=16.5\t\t#Convection heat transfer coefficient on gas side in W/mC\n",
+ "h2=17.5\t\t#radiation heat transfer coefficient on gas side in W/mC\n",
+ "h3=12.5\t\t#Convection heat transfer coefficient on outer side in W/mC\n",
+ "h4=6.5 \t\t#Radiation heat transfer coeeficient on outer side in W/mC\n",
+ "K1=4.0 \t\t#Thermal conductivity of fire brick in W/mC\n",
+ "K2=0.65\t\t#Thermal conductivity of common brick in W/mC\n",
+ "\n",
+ "#Calculations \n",
+ "hi=h1+h2\t\t#Total heat transfer coefficient in inner \n",
+ "ho=h3+h4\t\t#Total heat transfer coefficient in outer \n",
+ "Q=(Ti-To)/((1/hi)+(x1/K1)+(x2/K2)+(1/ho))\t#Heat flow through the furnace composite wall per unit area in W/m**2\n",
+ "Q1=Q/1000\n",
+ "T1=Ti-(Q/hi)\t#Temperature at the inside of the fire brick \n",
+ "T2=T1-(Q*(x1/K1))#Maximum temperature to which common brick is subjected in degree centigrade\n",
+ "\n",
+ "#Output\n",
+ "print'(a)Heat loss per m**2 area of the furnace wall is',round(Q)/1000,\"kW/m**2\" \n",
+ "print'(b)Maximum temperature to which common brick is subjec',round(T1,3),\"C\" \n",
+ "print'(c)similarly on other side is',round(T2,3),\"C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Heat loss per m**2 area of the furnace wall is 3.07 kW/m**2\n",
+ "(b)Maximum temperature to which common brick is subjec 1309.705 C\n",
+ "(c)similarly on other side is 1156.204 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 90
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.12 page no:234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "K1=0.93\t\t#Thermal conductivity of fire clay in W/mC\n",
+ "K2=0.13\t\t#Thermal conductivity of diatomite brick in W/mC\n",
+ "K3=0.7\t\t#Thermal conductivity of red brick in W/mC\n",
+ "x1=0.12\t\t#Thickness of fire clay in m\n",
+ "x2=0.05\t\t#Thickness of diatomite in m\n",
+ "x3=0.25\t\t#Thickness of brick in m\n",
+ "T=1\t\t#Assume the difference between temperature in degree centigrade\n",
+ "\n",
+ "#Calculations\n",
+ "Q=(T)/((x1/K1)+(x2/K2)+(x3/K3))\t#The heat flow per unit area in W/m**2\n",
+ "X3=K3*((T/Q)-(x1/K1))\t\t#Thickness of the red brick layer in m\n",
+ "X=X3*100\t\t\t#Thickness of the red brick layer in cm\n",
+ "\n",
+ "#Output\n",
+ "print'The thickness of the red brick layer is',round(X,3),\"cm\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The thickness of the red brick layer is 51.923 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 91
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.13 page no:235"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "R1=0.06\t\t#Thickness of material layer in m\n",
+ "R2=0.12\t\t#Thickness of the two insulating materials in m\n",
+ "R3=0.16\t\t#Thickness of material layers with pipe in m\n",
+ "K1=0.24\t\t#Thermal conductivity of one layer in W/mC\n",
+ "K2=0.4\t\t #Thermal conductivity of another layer in W/mC\n",
+ "L=60.0\t\t #Length of the pipe in m\n",
+ "hi=60.0\t\t#Heat transfer coefficient inside in W/m**2C\n",
+ "ho=12.0\t\t#Heat transfer coefficient outside in W/m**2C\n",
+ "ti=65.0\t\t#Temperature of hot air flowing in pipe in degree centigrade\n",
+ "to=20.0\t\t#Atmospheric temperature in degree centigrade\n",
+ "pi=3.1428\t #Constant value of pi\n",
+ "\n",
+ "#Calculations\n",
+ "Q=(ti-to)*(2*pi*L)/((1/(hi*R1))+(math.log(R2/R1)/(K1))+(math.log(R3/R2)/(K2))+(1/(ho*R3)))\t#Rate of heat loss in W\n",
+ "Q1=Q/1000\t#Rate of heat loss in kW\n",
+ "\n",
+ "#Output\n",
+ "print'The rate of heat loss is',round(Q1,4),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate of heat loss is 3.8519 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 92
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.14 page no:237"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "R1=8.0\t\t #Inner radius of the pipe in cm\n",
+ "R2=8.5\t\t #Outter radius of the pipe in cm\n",
+ "x1=3.0\t\t #Thickness of first layer in cm\n",
+ "x2=5.0\t\t #Thickness of second layer in cm\n",
+ "T1=300.0\t\t#Inner surface temperature of the steam pipe in degree centigrade\n",
+ "pi=3.1428\t #Constant value of pi \n",
+ "T4=50.0\t\t #Temperature at outer surface of insulation in degree centigrade\n",
+ "L=1.0\t\t #Length of the pipe in m\n",
+ "K1=50.0\t \t#Thermal conductivity of pipe in W/mC\n",
+ "K2=0.15\t \t#Thermal conductivity of first layer in W/mC\n",
+ "K3=0.08\t \t#Thermal conductivity of second layer in W/mC\n",
+ "h=2751.0\t\t#Enthalpy of dry and saturated steam at 300 degree centigrade in kJ/kg\n",
+ "q=40.0\t \t#Quantity of steam flow in gm/hr\n",
+ "hf=1345.0\t\t#Enthalpy of fluid at 300 degree centigrade in kJ/kg\n",
+ "hfg=1406.0\t\t#enthalpy at 300 degree centigrade in kJ/kg\n",
+ "\n",
+ "#Calculations\n",
+ "R3=R2+x1\t#Radius of pipe with first layer\n",
+ "R4=R3+x2\t#Radius of pipe with two layers\n",
+ "Q=(2*pi*L*(T1-T4))/((math.log(R2/R1)/(K1))+(math.log(R3/R2)/(K2))+(math.log(R4/R3)/(K3)))\n",
+ "Q1=Q/1000\t#Quantity of heat loss per meter length of pipe in kW\n",
+ "Q2=Q1*3600\t#Quantity of heat loss per meter length of pipe in kJ/hr\n",
+ "hg=((h)-(Q2/q))\t#Enthalpy of steam in kJ/kg\n",
+ "x=(hg-hf)/(hfg)\t#Dryness fraction of steam\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The quantity of heat lost per meter length of steam pipe is',round(Q,2),\"W/m or\",round(Q*3600/1000),\"kJ/hr\"\n",
+ "print'(b)The quantity of steam coming out of one meter length pipe is',round(x,4),\"gm/h\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The quantity of heat lost per meter length of steam pipe is 240.68 W/m or 866.0 kJ/hr\n",
+ "(b)The quantity of steam coming out of one meter length pipe is 0.9846 gm/h\n"
+ ]
+ }
+ ],
+ "prompt_number": 93
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.15 page no:238"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "x=0.3\t\t#Thickness of brick wall in m\n",
+ "ti=24.0\t\t#Inside surface temperature of wall in degree centigrade\n",
+ "to=-6.0\t\t#Outside surface temperature of wall in degree centigrade\n",
+ "h=2.75\t\t#Height of the wall in m\n",
+ "L=6.1\t\t#Length of the wall in m\n",
+ "K=2.6\t\t#Thermal conductivity of brick material in kJ/m hr C\n",
+ "\n",
+ "#Calculations\n",
+ "T=ti-to\t\t#Temperature difference across the wall in degree centigrade\n",
+ "A=h*L\t\t#Area of the wall in m**2\n",
+ "Q=(K*A*T)/(x)\t#Heat transfer through conduction by the wall per hour in kJ/hr\n",
+ "R=T/Q\t\t#Resistance of the wall in hr C/kJ\n",
+ "C=1.0/R\t\t#Conductance of the wall in kJ/hr C\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The heat transfer by conduction through the wall is',round(Q),\"kJ/hr \"\n",
+ "print'(b)The resistance of the wall is ',round(R,5),\"Chr/Kj \" \n",
+ "print' The conductance of the wall is',round(C,1), \"kJ/hr C \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The heat transfer by conduction through the wall is 4362.0 kJ/hr \n",
+ "(b)The resistance of the wall is 0.00688 Chr/Kj \n",
+ " The conductance of the wall is 145.4 kJ/hr C \n"
+ ]
+ }
+ ],
+ "prompt_number": 94
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.16 page no:240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "x1=0.3 \t#Thickness of refractory bricks in m\n",
+ "K1=5.66\t\t#Thermal conductivity of refractory bricks in kJ/hr mC\n",
+ "t1=1650.0\t\t#Inner surface temperature of the wall in degree centigrade\n",
+ "t2=320.0\t \t#Outside surface temperature of the wall in degree centigrade\n",
+ "x2=0.3\t \t#Thickness of insulating brick in m\n",
+ "K2=1.26\t\t#Thermal conductivity of insulating brick in kJ/hr mC\n",
+ "A=1.0\t \t#unit surface area in m**2\n",
+ "t3=27.0\t\t#Outside surface temperature of the brick in degree centigrade\n",
+ "\n",
+ "#Calculations \n",
+ "T1=t1-t2\t\t#Temperature difference in degree centigrade\n",
+ "Q1=(K1*A*T1)/(x1)\t#Heat loss without insulation in kJ/hr/m**2\n",
+ "R1=(K1*A)/(x1)\t#Heat loss for the change in temperature for refractory brick wall material in kJ/hrC\n",
+ "R2=(K2*A)/(x2)\t#Heat loss for the change in temperature for insulated brick wall material kJ/hrC\n",
+ "Q2=(t1-t3)/((1.0/R1)+(1.0/R2))\t#Heat loss with insulation in kJ/hr/m**2\n",
+ "Q3=Q1-Q2\t\t#Reduction in heat loss through the wall in kJ/hr/m**2\n",
+ "\n",
+ "#Output\n",
+ "print'The reduction in heat loss through the wall is ',round(Q3,1),\"kJ/hr/m**2\"\n",
+ "print\"\\nNOTE:Answer wrongly written in book as 1951.4\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The reduction in heat loss through the wall is 19517.2 kJ/hr/m**2\n",
+ "\n",
+ "NOTE:Answer wrongly written in book as 1951.4\n"
+ ]
+ }
+ ],
+ "prompt_number": 95
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.17 page no:241"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "L=4.6\t \t #Length of the wall in m\n",
+ "b=2.3\t \t#Breadth of the wall in m\n",
+ "x1=0.025\t\t#Thickness of the wood in m\n",
+ "x2=0.075\t\t#Thickness of the cork slabbing in m\n",
+ "x3=0.115\t\t#Thickness of the brick in m\n",
+ "t1=18.0\t\t #Exterior temperature of the wall in degree centigrade\n",
+ "t4=-20.0\t\t#Interior temperature of the wall in degree centigrade\n",
+ "K1=7.5 \t\t #Thermal conductivity of the wood in kJ/hr mC\n",
+ "K2=1.9 \t\t #Thermal conductivity of the wood in kJ/hr.mC\n",
+ "K3=41.0\t\t #Thermal conductivity of the brick in kJ/hr mC\n",
+ "\n",
+ "#Calculations\n",
+ "A=L*b\t\t#Area of the wall in m**2\n",
+ "R1=(K1*A)/(x1)\t#Heat loss for the change in temperature for insulated wood material in kJ/hrC\n",
+ "R2=(K2*A)/(x2)\t#Heat loss for the change in temperature for cork material in kJ/hrC\n",
+ "R3=(K3*A)/(x3)\t#Heat loss for the change in temperature for brick in kJ/hrC\n",
+ "Q=(t1-t4)/((1.0/R1)+(1.0/R2)+(1.0/R3))\t#Heat loss with insulation in kJ/hr\n",
+ "Q1=Q*24.0\t\t#Heat loss with insulation in kJ/24hr\n",
+ "t2=t1-(Q/R1)\t#Interface temperature t2 in degree centigrade \n",
+ "t3=t2-(Q/R2)\t#Interface temperature t3 in degree centigrade\n",
+ "\n",
+ "#Output \n",
+ "print'(a)The leakage through the wall per 24 hours is',round(Q,2),\"kJ/hr=\",round(Q,2)*24 \n",
+ "print'(b)Temperature at the interface is',round(t2,3),\"C\" \n",
+ "print'(c)Temperature at interface ',round(t3,3),\"C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The leakage through the wall per 24 hours is 8814.37 kJ/hr= 211544.88\n",
+ "(b)Temperature at the interface is 15.223 C\n",
+ "(c)Temperature at interface -17.663 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 96
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.18 page no:243"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Input data\n",
+ "L=0.3\t\t#Thickness of the wall in m\n",
+ "ti=320\t\t#Inner surface temperature in degree centigrade\n",
+ "to=38\t\t#Outer surface temperature in degree centigrade\n",
+ "A=1\t\t#Assume unit area in m**2\n",
+ "\n",
+ "#Calculations\n",
+ "Q=(A/L)*((0.01256/2)*(ti**2-to**2)-(4.2/3)*10**-6*(ti**3-to**3)) #Heat loss per sq metre of surface area\n",
+ "\n",
+ "#Output\n",
+ "print'The heat loss per sq metre of surface area for a furnace wall is',round(Q,2),\"kJ/hr/m**2 \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The heat loss per sq metre of surface area for a furnace wall is 1960.68 kJ/hr/m**2 \n"
+ ]
+ }
+ ],
+ "prompt_number": 97
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.19 page no:245"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Input data\n",
+ "d=11.5\t\t#Outer diameter of steam pipe line in cm\n",
+ "t1=5.0\t\t#Thickness of first layer in cm\n",
+ "K1=0.222\t\t#Thermal conductivity of first layer in kJ/hr mC\n",
+ "t2=3.0\t\t#Thickness of second layer in cm\n",
+ "pi=3.1428\t\t#Constant value of pi\n",
+ "K2=3.14\t\t#Thermal conductivity of second layer in kJ/hr mC\n",
+ "T1=235\t\t#Outside surface temperature of steam pipe in degree centigrade\n",
+ "T3=38\t\t#Outer surface of lagging in degree centigrade\n",
+ "L=1.0\t\t#Length of the pipe in m\n",
+ "\n",
+ "#Calculations\n",
+ "I=math.log((d+(2*t1))/d)\t\t\t#For inner layer calculation\n",
+ "O=math.log((d+(2*t1)+(2*t2))/(d+(2*t1)))\t\t#For outer layer calculations\n",
+ "R1=(2.0*pi*L*K1)/I\t\t#Heat loss for change in temperature for first insulated material in kJ/hC\n",
+ "R2=(2.0*pi*L*K2)/O\t\t#Heat loss for the change in temperature for second insulated material in kJ/hC\n",
+ "Q=(T1-T3)/(1.0/R1+1.0/R2)\t#Heat loss per metre length of pipe per hr in kJ/hr\n",
+ "T2=T1-(Q/R1)#Temperature between the two layers of insulation in degree centigrade\n",
+ "\n",
+ "#Output\n",
+ "print'(a)The heat loss per metre length of pipe per hr is',round(Q,2),\" kJ/hr\" \n",
+ "print'(b)Temperature between the two layers of insulation is',round(T2,2),\"C\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The heat loss per metre length of pipe per hr is 427.45 kJ/hr\n",
+ "(b)Temperature between the two layers of insulation is 43.33 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 98
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6.20 page no:247"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Input data\n",
+ "t1=24.0 \t#Temperature at the outside surface in degree centigrade \n",
+ "t4=-15.0 \t#Temperature at the inner surface in degree centigrade\n",
+ "A=1.0 \t\t#Assuming unit area in m**2\n",
+ "K1=23.2\t\t#Thermal conductivity of steel in W/mC\n",
+ "K2=0.014\t\t#Thermal conductivity of glasswood in W/mC\n",
+ "K3=0.052\t\t#Thermal conductivity of plywood in W/mC\n",
+ "x1=0.0015\t\t#Thickness of steel sheet at outer surface in m\n",
+ "x2=0.02\t\t#Thickness of glasswood in between in m\n",
+ "x3=0.01\t\t#Thickness of plywood at a inner surface in m\n",
+ "\n",
+ "#Calculations\n",
+ "R1=(K1*A)/x1\t#Heat loss for the change in temperature for first insulated material\n",
+ "R2=(K2*A)/x2\t#Heat loss for the change in temperature for second insulated material\n",
+ "R3=(K3*A)/x3\t#Heat loss for the change in temperature for third insulated material\n",
+ "Q=(t1-t4)/(1/R1+1/R2+1/R3)\t#The rate of heat flow in W/m**2\n",
+ "\n",
+ "#Output\n",
+ "print'The rate of heat flow is',round(Q,2),\"W/m**2 \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The rate of heat flow is 24.06 W/m**2 \n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch1.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch1.ipynb
index 947cfb01..0948f57e 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch1.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ad7d15642ee4e9d7fd8a276d1246f62e3d28aa177d39ecd9ac2c125ea04f5d33"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Finding the density'''\n",
"\n",
- "#let the total mass of mud be 100lbm\n",
"#variables\n",
"m_total=100.0; #lbm\n",
"#70% by wt of mud is sand(SiO2)and remaining is water\n",
@@ -70,9 +69,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the shear stress at the surface of the inner cylinder\n",
- "'''\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -117,7 +114,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#problem on surface tension\n",
+ "\n",
"# variablees\n",
"l=0.10; #m (length of sliding part)\n",
"f=0.00589; #N (pull due to 0.6 gm of mass)\n",
@@ -155,7 +152,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Convert 327 miles/hr into ft/s\n",
+ "\n",
"\n",
"# variables\n",
"V=327. #miles/hr\n",
@@ -193,7 +190,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Convert 2.6 hours into seconds\n",
+ "\n",
"\n",
"# variables\n",
"t=2.6 #hr\n",
@@ -230,8 +227,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculate the acceleration in ft/min^2\n",
- "\n",
+ "#\n",
"# variables\n",
"m=10. #lbm\n",
"F=3.5 #lbf\n",
@@ -269,7 +265,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculate the wt of metallic aluminium deposited in an electrolytic cell\n",
"\n",
"# variables\n",
"I=50000. #Ampere or Coulumbs/sec\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch10.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch10.ipynb
index 621beb27..e4b7fe7d 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch10.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:9f0f51ee792551db4a5ae3ded00fa549611bdd66fece52d68af61c7a164f38e5"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Reaction in which Fraction Conversion is specified\n",
"\n",
- "# Variables \n",
"F = 100 # feed to the reactor-[g mol]\n",
"CH4 = 0.4*F # [g mol]\n",
"Cl2 = 0.5*F ; # [g mol]\n",
@@ -112,7 +111,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# A reaction in which Fraction Conversion is to beCalculated\n",
+ "\n",
"\n",
"# Variables \n",
"S = 5000. ; # Sulphur [lb]\n",
@@ -182,7 +181,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Material Balances for Process in which two Simultaneous Reactions Occur\n",
"\n",
"# Variables \n",
"F = 1 #CH3OH -[gmol]\n",
@@ -280,7 +278,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Analysis of Bioreactor\n",
+ "\n",
"from numpy import matrix\n",
"\n",
"# Variables \n",
@@ -356,7 +354,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Solution using Elemental Balances\n",
+ "\n",
"from numpy import matrix\n",
"\n",
"# Variables \n",
@@ -507,7 +505,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Use of Elemental Balance to Solve a Hydrocracking Problem\n",
+ "\n",
"from numpy import matrix\n",
"\n",
"# Variables \n",
@@ -560,7 +558,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Excesss Air\n",
"\n",
"# Variables \n",
"C3H8 = 20 #C3H8 burned in a test-[kg]\n",
@@ -605,7 +602,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# A Fuel Cell to generate Electricity from Methane\n",
+ "\n",
"\n",
"# Variables\n",
"F = 16. # feed of CH4 -[kg]\n",
@@ -682,7 +679,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Combustion of Coal\n",
"\n",
"# Variables\n",
"F = 100. # feed of coal -[lb]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch11.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch11.ipynb
index 9592fff3..70f855c2 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch11.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:03c09e4ffd933027d277b1c64cc2c94bd3c72b7cbc229c1b8170ffd14e813958"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the Number of Independent Material Balance in a process with Multiple Units\n",
+ "\n",
"\n",
"# Variables \n",
"\n",
@@ -122,7 +123,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Material Balances for Multiple Units in which no Reaction occurs\n",
+ "\n",
"\n",
"from numpy import matrix\n",
"\n",
@@ -201,7 +202,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Material Balance for problems Involving Multiple units and Reactions\n",
"\n",
"from numpy import matrix\n",
"\n",
@@ -299,8 +299,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Analysis of Sugar Recovery Process involving Multiple Serial Units\n",
- "# Solution fig E11.4\n",
+ "\n",
"from numpy import matrix\n",
"\n",
"# Variables \n",
@@ -440,7 +439,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Production of a Hormone in connected Reactor\n",
+ "\n",
"\n",
"# Variables \n",
"F = 15. #[L/hr]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch13.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch13.ipynb
index b72b411d..d6a85197 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch13.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:86277517338e3080962ec366bf78a36ead36dc032944d5f67a8c58022c6af85a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -279,8 +280,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\t\t\t# Example 13.7 Page no. 416\n",
- "\t\t\t# Solution fig E13.7\n",
+ "\n",
"\n",
"# Variables\n",
"G = 100. ;\t\t\t# Basis: Pyrolysis Gas-[lb mol] \n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch15.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch15.ipynb
index c6c7dffb..e0ee646a 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch15.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch15.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:eeb1c8da856a86d3cb60a72e738f1fe4c7b2d7aaa546df7d68c6871754268745"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of Van der Walls Equation to Calculate a Temperature\n",
"\n",
"# variables\n",
"R = 82.06 # gas constant-[(cm**3 *atm)/(g mol *K)]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch19.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch19.ipynb
index dc3cb7a9..509330f3 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch19.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch19.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:c896c859a24a6b70446a5e83cded412ac42718005bc7d2e546816e8274c18e21"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculating the number of degrees to freedom'''\n",
"\n",
- "# Use phase rule to get degree of freedom(F) = 2-P+C \n",
- "# (a)\n",
+ "\n",
"N1 = 1.;\n",
"P1 = 1. ;\t\t\t# Number of phases present\n",
"C1 = 1. ;\t\t\t#Number of components present\n",
@@ -95,10 +94,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculating the number of degrees to freedom'''\n",
"\n",
- "# Use phase rule to get degree of freedom(F) = 2-P+C \n",
- "# (a)\n",
+ "\n",
"N1 = 5.;\n",
"P1 = 1.; \t\t\t# Number of phases present,here 1 gas \n",
"C1 = 3. ;\t\t\t#Number of independent components present,here 3 because 3 elements(C,O and H)\n",
@@ -143,7 +140,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Bubble point calculation'''\n",
"\n",
"from scipy.optimize import fsolve\n",
"import math\n",
@@ -211,7 +207,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculating the fraction of liquid that will remain in equilibrium'''\n",
"\n",
"# Variables\n",
"# Basis : 100 g solution\n",
@@ -271,7 +266,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Seperation of virus from a culture'''\n",
"\n",
"# Variables\n",
"Vo = 3.0 ;\t\t\t# Initial volume of the solution containing the culture and virus-[L]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch2.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch2.ipynb
index d803af44..84439d15 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch2.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ef26cf09debc2accb827957d575ac9576db35c1e13d184b4161dad1098add2f0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate specific weight of water\n",
+ "\n",
"\n",
"# variables\n",
"g=32.2; #ft/s^2\n",
@@ -68,7 +69,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc pressure at depth of 304.9m\n",
+ "\n",
"\n",
"# variables\n",
"d=304.9; #m\n",
@@ -108,7 +109,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#gauge pressure=(density)*(acc. due to gravity)*(depth)\n",
"\n",
"# variables\n",
"rho_oil=55.; #lbm/ft^3\n",
@@ -153,7 +153,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the pressures\n",
+ "\n",
"import math\n",
"\n",
"# varirbles\n",
@@ -213,7 +213,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc pressuer at different heights considering on density change in air\n",
+ "\n",
"\n",
"# variables\n",
"p_atm=14.7; #psia\n",
@@ -275,7 +275,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate the atmosphere\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -319,7 +319,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate net pressure.\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -366,7 +366,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc the total force on a lock gate\n",
"\n",
"# variables\n",
"#lock gate has water on one side and air on the other at atm. pressure\n",
@@ -414,7 +413,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc thickness of an oil storage\n",
+ "\n",
"sigma_tensile=20000. #lbf/in^2 (tensile stress is normally 1/4 rupture stress)\n",
"\n",
"#max pressure is observed at the bottom of the storage\n",
@@ -456,7 +455,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc thickness of a storage tank\n",
"\n",
"# variables\n",
"p_working=250.0; #lbf/in^2\n",
@@ -498,7 +496,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc payload of a helium balloon\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -548,7 +546,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#wooden block floating in two phase mix of water and gasoline\n",
"\n",
"# variables\n",
"#calc fraction of block in water\n",
@@ -588,7 +585,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc gauge pressure of cylinder in a manometer\n",
+ "\n",
"\n",
"# variables\n",
"#height of water above pt.C = 2.5ft\n",
@@ -631,7 +628,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc pressure diff between two tanks in a two liquid manometer\n",
+ "\n",
"rho_water=62.3; #lbm/ft^3\n",
"SG_oil=1.1;\n",
"rho_oil=SG_oil*(rho_water);\n",
@@ -674,7 +671,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc pressure of gauge through a spring piston system\n",
"\n",
"# variables\n",
"k=10000.; #N/m (spring constant)\n",
@@ -714,7 +710,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc pressure diff at the mouth of the fire place\n",
+ "\n",
"\n",
"# variables\n",
"g=32.2; #ft/s^2\n",
@@ -756,7 +752,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate the gauge pressure at the bottom of the tank.\n",
"\n",
"# variables\n",
"rho_water=1000. #Kg/m^3\n",
@@ -811,7 +806,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate angle\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -853,7 +848,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc the height to which liq in a cylinder rises when rotated\n",
"\n",
"import math\n",
"# variables\n",
@@ -895,7 +889,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calc thickness of liquid strip at the bottom of the industrial centrifuge\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch20.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch20.ipynb
index 9286e99b..2a777cf6 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch20.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch20.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:160cdac5d7f0b7135dad8dda86f1147a9289b5d9942c1ebb05ca32b461c42f4f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Fitting Adsorption Isotherms to Experimental Data\n",
"\n",
"%pylab inline\n",
"\n",
@@ -75,7 +75,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Seperation of Biochemicals by Solvent Extraction\n",
+ "\n",
"\n",
"# Variables\n",
"G = 1000.0 ;\t\t\t# Volume of solution - [L]\n",
@@ -116,7 +116,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Combination of an Adsorption Isotherm with a Meterial Balance\n",
"\n",
"# Variables\n",
"G = 1000. ;\t\t\t# Volume of solution - [L]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.ipynb
index 741dcc7d..69c36534 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch21.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:63761cd2f20f542c8cf7d5599bfa09993cda87c6763136710915fa76185904f1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of Mechanical work by a gas on a piston showing how the path affects the value of the work\n",
+ "\n",
"\n",
"from scipy.integrate import quad\n",
"\n",
@@ -78,7 +79,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of Specific Kinetic energy for a Flowing fluid\n",
+ "\n",
"\n",
"# Variables\n",
"id_ = 3. ;\t\t\t# Internal diameter of tube-[cm]\n",
@@ -119,7 +120,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of potential Energy change of water\n",
+ "\n",
"\n",
"# Variables\n",
"# Let water level in first reservoir be the reference plane\n",
@@ -157,7 +158,7 @@
"cell_type": "code",
"collapsed": true,
"input": [
- "# Calculation of an internal energy change using the heat capacity\n",
+ "\n",
"\n",
"# Variables\n",
"#Constant volume process \n",
@@ -200,7 +201,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of Enthalpy change\n",
"\n",
"# Variables\n",
"#Constant pressure process \n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch22.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch22.ipynb
index 01acfa93..52b1e9dd 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch22.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch22.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:378027dede13493be733241ad48420c91ebbcd1218fa032fc3c46fa099a45a58"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of the energy balance to a closed system\n",
+ "\n",
"\n",
"# Variables\n",
"#Assume that properties of water can be used to substitute properties of solution\n",
@@ -75,7 +76,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of U using American engineering units\n",
+ "\n",
"\n",
"# Variables\n",
"# Given\n",
@@ -134,7 +135,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# use of the general energy balance to analyze an open , unsteady-state system\n",
+ "\n",
"\n",
"# Variables\n",
"#Lets take tank to be system\n",
@@ -180,7 +181,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# application of the energy balance to a open, steady-state system, a heat exchanger\n",
+ "\n",
"\n",
"# Variables\n",
"# Take milk plus water in tank to be system\n",
@@ -241,7 +242,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of power needed to pump water in an open, steady state system\n",
+ "\n",
"\n",
"# Variables\n",
"# Take pipe between initial and final level of water\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch23.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch23.ipynb
index 6773ceb9..78279b16 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch23.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch23.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:85497d817768e6e1d81546cc4adcb855eed2a97589497e4f8a3f22d0bc4a6c3d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -28,7 +29,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Graph that showing the heat of vaporization of water\n",
"\n",
"%pylab inline\n",
"from matplotlib.pyplot import *\n",
@@ -77,7 +77,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# comparison of various sources to estimate the heat of vaporization\n",
"\n",
"import math\n",
"\n",
@@ -139,7 +138,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Conversion of units in a heat capacity equation\n",
+ "\n",
"\n",
"# Variables\n",
"c = 2.675*10**4 #*.4536)/(1055*1.8) ;\n",
@@ -182,7 +181,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Fitting Heat Capacity Equation to Heat Capacity Data\n",
"\n",
"\n",
"# Variables\n",
@@ -235,7 +233,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of H for a gas mixture using heat capacity equation for each component\n",
+ "\n",
"\n",
"from scipy.integrate import quad\n",
"# Variables\n",
@@ -318,7 +316,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the Change in Enthalpy for a Gas using Tabulated Enthalpy Values\n",
+ "\n",
"\n",
"\n",
"# Solution \n",
@@ -362,9 +360,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Use of Steam Tables to Calculate Change in Enthalpy\n",
- "\n",
- "# Solution Fig.E23.7\n",
"\n",
"# Variables\n",
"#Given\n",
@@ -423,7 +418,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Use of Steam Table when a Phase Change is involved to Calculate the final State of Water\n",
+ "\n",
"\n",
"\n",
"# Solution \n",
@@ -473,7 +468,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate Enthalpy Difference betwee two States by Pressure Enthalpy Chart for Butane\n",
"\n",
"\n",
"# Solution \n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch24.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch24.ipynb
index 00a323af..b4b06951 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch24.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch24.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:81bdcd8b52f99578fa3372035df0b4461d5784b0d3f676ae0e588533ba351cbf"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# simplification of the general energy balance\n",
"\n",
- "# Solution Fig. E24.1\n",
- "\n",
- "# Assumptions to be made in eqn. 24.1 in following segment \n",
"print 'Assumptions to be made in eqn. 24.1 in following segments are:'\n",
"#(a)- 1 to 5\n",
"print '(a)- 1 to 5.'\n",
@@ -120,7 +117,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of the energy balance.\n",
+ "\n",
"\n",
"# Variables\n",
"# Given\n",
@@ -167,7 +164,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of the energy balance to plasma etching.\n",
+ "\n",
"\n",
"from scipy.optimize import fsolve\n",
"\n",
@@ -229,7 +226,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Energy balance applied to a batch process\n",
"\n",
"# Variables\n",
"# Pick the system as shown in above figure of book\n",
@@ -322,7 +318,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# application of the energy balance to pumping water\n",
"\n",
"from scipy.optimize import fsolve\n",
"\n",
@@ -389,8 +384,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# application of the energy balance, to heat a biomass.\n",
- "\n",
+ "#\n",
"# Variables\n",
"# Pick the system as shown in above figure of book\n",
"# Given\n",
@@ -438,9 +432,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Sterilization of a Fermentation Medium\n",
"\n",
- "# Pick the system of whole process as shown in above figure of book\n",
"# Given\n",
"Q = 1.63 ;\t\t\t# Heat loss from the process - [ kW ]\n",
"m_bm = 150 ;\t\t\t# Mass flow rate of biological media into the sterlizer -[kg/min]\n",
@@ -486,7 +478,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Use of combined meterial and energy balances to solve a distillation problem.\n",
+ "\n",
"\n",
"# Variables\n",
"F = 20000 ;\t\t\t# Feed rate of saturated liquid - [kg/h]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch25.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch25.ipynb
index 66cbaa91..8e33f5fb 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch25.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch25.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:da2384fa5db2cbd49ec84301569b45dd22f0d12dd2e12e0fa83528eb61b2d43b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of a heat of formation from heat transfer measurements\n",
"\n",
"# Variables\n",
"Qa = -393.51 ;\t\t\t# Heat of reaction of reaction (a) - [kJ/g mol C] \n",
@@ -66,7 +66,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Retrival of heats of formation from reference data.\n",
"\n",
"# Variables\n",
"H_H2 = 0 ;\t\t\t# Standard heat of formation of H2 -[kJ/ g mol H2]\n",
@@ -104,7 +103,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the standard heat of reaction from the standard heats of formation.\n",
+ "\n",
"\n",
"# Variables\n",
"H_fNH3 = -46.191 ;\t\t\t# Standard heat of formation of NH3 -[kJ/ g mol]\n",
@@ -143,7 +142,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculation of the heat of reaction at a temparature different from the standard conditions.\n",
"\n",
"# Variables\n",
"P1 = 1. ;\t\t\t# Initial pressure - [atm]\n",
@@ -201,7 +199,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the Heat Transfer using Heat of Reaction in a Process in\n",
"\n",
"# Variables\n",
"m_CO2 = 1. ;\t\t\t# Moles of CO2 - [ g mol]\n",
@@ -272,7 +269,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the enthalpy change in anerobic culture.\n",
"\n",
"# Variables\n",
"H_EtOH =-1330.51 ;\t\t\t# Change in enthalpy of ethanol -[kJ/g mol]\n",
@@ -321,7 +317,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Green Chemistry Examining Alternate Processes\n",
"\n",
"\n",
"# Solution \n",
@@ -384,10 +379,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the Heat of Reaction at a Tempera-\n",
"\n",
- "#ture different from the Standard Conditions with Heat of Formation Merged\n",
- "#with Sensible Heat\n",
"# Variables\n",
"P1 = 1. ;\t\t\t# Initial pressure - [atm]\n",
"P2 = 1. ;\t\t\t# Final pressure - [atm]\n",
@@ -442,7 +434,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the Heat Transfer when Reactants enter and Products leave at Different Temperatures\n",
+ "\n",
"\n",
"# Solution \n",
"\n",
@@ -498,7 +490,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Heating Value of Coal\n",
+ "\n",
"\n",
"# Solution \n",
"\n",
@@ -548,9 +540,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Selecting a Fuel to reduce SO2 emissions\n",
"\n",
- "# Solution \n",
"\n",
"# Variables\n",
"H_req = 10**6 ;\t\t\t# Heat requirement - [Btu]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb
index 5268900c..5000414f 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch26.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:98deaafae63448982b8112f9e6ce85846fb35bc262bd2facf3329e5947fa2984"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of an adiabetic reaction temperature.\n",
+ "\n",
"\n",
"# Variables\n",
"m1_CO = 1.; \t\t\t# Moles of CO input- [g mol]\n",
@@ -106,9 +107,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of general Energy Balance in a Process in which More than one Reaction Occurs\n",
- "\n",
- "# Solution Fig E26.3b\n",
"\n",
"# Variables\n",
"v_CH4 = 1000. ;\t\t\t# Volume of CH4 taken - [ cubic feet]\n",
@@ -175,9 +173,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of general Energy Balance in a Process Composed of Multiple Units\n",
- "\n",
- "# Solution Fig E26.4b\n",
"\n",
"# Variables\n",
"SO2_in = 2200. ;\t\t\t# Amount of SO2 entering reactor 2-[lb mol/hr]\n",
@@ -254,9 +249,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Production of Citric Acid by Fungus\n",
- "\n",
- "# Solution \n",
+ " \n",
"\n",
"# Variables\n",
"CA = 10000. ;\t\t\t# Produced citric acid - [kg]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch27.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch27.ipynb
index 0515e5c2..4bcff200 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch27.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch27.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:21747075c112c6cd9e1a0a4f001fec6264fd627d603e23ce68da0341f7d86ac0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the Work done during Evaporation of a Liquid\n",
- "# Solution E27.1\n",
+ "\n",
"\n",
"# Variables\n",
"V_w = 1. ;\t\t\t# Volume of given water -[L]\n",
@@ -71,8 +71,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of Work in a Batch Process\n",
- "# Solution E27.2\n",
+ "\n",
"\n",
"# Variables\n",
"m_N2 = 1. ;\t\t\t# Moles of N2 taken -[kg mol]\n",
@@ -122,8 +121,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Efficiency of Power Generation by a Hydroelectric Plant\n",
- "# Solution \n",
+ "\n",
"\n",
"# Variables\n",
"p_plant = 20. ;\t\t\t# Power generated by plant-[MW]\n",
@@ -165,8 +163,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of Plant Efficiency\n",
- "# Solution Fig.E27.4\n",
+ "\n",
"\n",
"# Variables\n",
"LHV = 36654. ;\t\t\t# LHV value of fuel - [kJ/ cubic metre]\n",
@@ -220,7 +217,6 @@
"cell_type": "code",
"collapsed": true,
"input": [
- "# Comparison of the reversible work for a batch process with that of a flow process operating under the same conditions.\n",
"\n",
"from scipy.integrate import quad\n",
"\n",
@@ -279,7 +275,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of the mechanical energy balance to the pumping water\n",
"\n",
"from scipy.integrate import quad\n",
"# Variables\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch28.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch28.ipynb
index 6a34dc72..f3a9553e 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch28.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch28.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ac2f423a0dd7909a3558159c9b6408459426072d293b0494654db2eec3dde604"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of Heats of Solution data\n",
"\n",
- "# Solution \n",
"# Variables\n",
"Ref_T = 77. ;\t\t\t#Reference temperature-[degree F]\n",
"\n",
@@ -94,7 +93,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of the heat of solution data\n",
+ "\n",
"\n",
"from scipy.integrate import quad\n",
"# Variables\n",
@@ -164,9 +163,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of an Enthalpy Concentration Chart\n",
- "\n",
- "# Solution fig. 28.3\n",
"\n",
"# Variables\n",
"soln1 = 600. ; \t\t\t# Mass flow rate of entering solution 1 -[lb/hr]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch29.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch29.ipynb
index db601ca5..7c95dcbe 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch29.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch29.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:b5b2fcf9bb3d537cea245cafaa4a19d4d1dc42af6ab432d7e1ef22a8e48ae245"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determining properties of moist air from the humidity chart\n",
"\n",
- "# Variables\n",
"DBT = 90. ;\t\t\t# Dry bulb temperature - [degree F]\n",
"WBT = 70. ;\t\t\t# Wet bulb temperature - [degree F]\n",
"\n",
@@ -70,9 +69,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Heating at constant Humidity\n",
"\n",
- "# Solution fig. E29.2\n",
"\n",
"# Variables\n",
"DBT1 = 38 ;\t\t\t# Initial dry bulb temperature - [degree C]\n",
@@ -125,9 +122,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Cooling and Humidification using a Water Spray\n",
"\n",
- "# Solution fig. E29.3b\n",
"\n",
"# Variables\n",
"DBT1 = 40 ;\t\t\t# Initial dry bulb temperature - [degree C]\n",
@@ -171,9 +166,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Combined Material and Energy Balance for a Cooling Tower\n",
- "\n",
- "# Solution fig. E29.4\n",
"\n",
"# Variables\n",
"c_bl = 8.30 * 10**6 ;\t\t\t# Capacity of blower - [cubic feet/hr]\n",
@@ -235,9 +227,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Drying of Chlorella\n",
"\n",
- "# Solution fig. E29.5\n",
"\n",
"# Variables\n",
"W = 100 ;\t\t\t# Amount of entering water -[lb/hr]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch3.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch3.ipynb
index af8703d1..4e398ea9 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch3.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:445dec12235c400efa979dcf04faa2911a77ac6433ec8e786b9205e0e8fdeeb4"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculate vol. flow rate, mass flow rate and average vel of gasoline through pipe\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -73,7 +74,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calculate velocity and mass flow rate of natural in a pipe\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -119,7 +120,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calculate the mass flow rate, volumetric flow rate and velocity of waterin a pipe\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -167,7 +168,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calulate the time required\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -207,7 +208,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calculate the final or steady state pressure in tank\n",
"\n",
"# variables\n",
"m_in=0.0001; #lbm/min\n",
@@ -247,7 +247,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calculate how fast the level of water is rising or falling in a cylindrical tank\n",
+ "\n",
"import math\n",
"\n",
"# variables\n",
@@ -302,7 +302,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calculate flow rate of ventilation air supply\n",
"\n",
"# variables\n",
"q=5/8.0; #kg/hr mass evaporation rate of benzene\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch4.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch4.ipynb
index 392607c8..7ed88091 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch4.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:16617b0214df1f3fa0b6950901fd2bc173679187633649259f00cd5dd8aa8d5e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -28,8 +29,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Temperature Conversion\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variable\n",
"#(a)\n",
@@ -74,8 +74,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Temperature Conversion\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"c = 139.1 + (1.56*10**-1)*(-460-32)/1.8 ;\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch5.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch5.ipynb
index 5023ef53..7c4d25d6 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch5.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:17452ca2e9b7dcffa8d444e8e6e3bb3b7f47f9f947558729a784ae56a1f45de2"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Pressure Conversion\n",
- "# Solution\n",
"\n",
"# Variables\n",
"P = 60 ; #[Gpa]\n",
@@ -78,8 +77,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Pressure Conversion\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variable\n",
"b_rd = 28.0 ; #[in. Hg]\n",
@@ -117,8 +115,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Vacuum Pressure Reading\n",
- "# Solution\n",
"\n",
"# Variables\n",
"b_rd = 100.0 ; #[kPa]\n",
@@ -158,8 +154,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of Pressure Difference\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"df = 1.10*10**3 ; #[kg/m**3]\n",
@@ -198,8 +193,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Pressure Conversion\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"p_atm=730.0*29.92/760.0 ; #[in. Hg]\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch6.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch6.ipynb
index 5ffa4f19..572f406f 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch6.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:829300ed441b0056de124b3c59bbb1f7034cd4f5704a4d95b4ff6c77357fd0c5"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# A Material Balance for the blending of Gasoline\n",
- "# Solution\n",
+ "\n",
"from numpy import matrix\n",
"\n",
"# Variables\n",
@@ -83,8 +83,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Concentration of cells using a Centrifuge\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"fd= 1000.0 ; #feed rate-[L/hr]\n",
@@ -124,10 +123,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Discharge of Tank Residuals to the Environment\n",
- "# Solution\n",
"\n",
- "# Variables\n",
"dn = 0.80 ; #Density of motor oil-[g/cm**3]\n",
"\n",
"# Calculation and Result\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch7.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch7.ipynb
index 759dde83..f1754ae4 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch7.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:702f6d54433444391f54642fccdef71d5ded6c19433d61198181ed7204437113"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Understanding the Problem\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"v_ts = 105.0 ; # velocity of train wrt station-[cm/s]\n",
@@ -69,8 +69,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Drawing a Sketch of a Mixing Process\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"n_un= 7 ; # Number of unknowns in the given problem- 3 values of xi and 4 values Fi\n",
@@ -107,8 +106,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Placing the unknown Information on the Diagram\n",
- "# Solution\n",
"\n",
"# variables\n",
"n_un=8 ; # Number of unknowns in the given problem- 8 values of mole fractions\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch8.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch8.ipynb
index 4d600c4f..350e9391 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch8.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:db3a394cd915f3675da3a1ec91e93913eb152d495576bd0a47778fe0952f79fb"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Extraction of Streptomycin from a Fermentation Broth\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"# Basis : 1 min\n",
@@ -79,8 +79,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Separation of gases Using a Membrane\n",
- "# Solution Fig. E8.2b\n",
+ "\n",
"\n",
"# Variables\n",
"F_O2 = 0.21 ; # fraction of O2 in feed(F) \n",
@@ -131,8 +130,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Overall analysis for a continuous Distillation Column\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"# Basis : 1 hr so F = 1000 kg\n",
@@ -192,8 +190,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Mixing of Battery Acid\n",
- "# Solution Fig E8.4\n",
+ "\n",
"from numpy import matrix\n",
"\n",
"# Variables\n",
@@ -243,8 +240,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Drying\n",
- "# Solution Fig E8.5\n",
+ "\n",
"from numpy import matrix\n",
"\n",
"# Variables\n",
@@ -289,8 +285,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Crystallizaton\n",
- "# Solution\n",
"\n",
"# Variables\n",
"# Composition of initial solution at 30 degree C\n",
@@ -359,8 +353,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Hemodialysis\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"# Write given data\n",
diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch9.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch9.ipynb
index 4b127966..53f8e501 100644
--- a/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch9.ipynb
+++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/ch9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:fa0721f1d96e3929565a094cfe21c7d86b4e801aa71b0940b32ef9174b4285dc"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Balancing a reaction for a Biological Reaction\n",
- "# Solution\n",
+ "\n",
"\n",
"# variables\n",
"# Given \n",
@@ -75,8 +75,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Use of Chemical Reaction to Calculate the Mass of Reactants given the Mass of Products\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"m_CO2 = 44.0 ; #molecular wt-[g]\n",
@@ -116,8 +115,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Application of Stoichiometry when more than one Reaction occurs\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"m_CaCO3 = 100.1 ; #molecular wt-[g]\n",
@@ -177,8 +175,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of extent of Reaction\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"f_NH3 = 5. ; # NH3 in feed-[g]\n",
@@ -250,8 +247,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of Limiting and Excess Reactants\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"f_N2 = 10. ; # N2 in feed-[g]\n",
@@ -316,8 +312,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Yeilds in the Reaction of Glucose to produce Ethanol\n",
- "# Solution\n",
+ "\n",
"\n",
"# variables\n",
"#(a)\n",
@@ -361,8 +356,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Selectivity in the Production of Nanotubes\n",
- "# Solution\n",
"\n",
"# Variables\n",
"# By using reaction (a)\n",
@@ -400,8 +393,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of various terms Pertaning to Reaction\n",
- "# Solution\n",
+ "\n",
"\n",
"# Variables\n",
"m_C3H6 = 42.08 # molecular wt. of propene-[g]\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter1.ipynb b/Beginning_C_By_Ivon_Horton/chapter1.ipynb
index c989b607..a59448aa 100644
--- a/Beginning_C_By_Ivon_Horton/chapter1.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:8e3cf2addd66f79ee38d4e50bfee328191c27b60f9cde7a75aa445057c2c6240"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Very First C Program - Displaying Hello World */\n",
- "\"\"\"\n",
+ "\n",
+ "\n",
"\n",
"print \"Hello world!\"\n"
],
@@ -58,9 +58,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Second C Program\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"\\\"If at first you don't succeed, try, try, try again!\\\"\""
],
@@ -89,9 +87,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Another Simple C Program - Displaying a Quotation\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Beware the Ides of March!\""
],
@@ -120,9 +116,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Displaying Quotation \n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"My formula for success?\\nRise early, work late, strike oil.\\n\""
],
@@ -153,9 +147,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Another Simple C Program - Displaying Great Quotations\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"\\\"It is a wise father that knows his own child.\\\"\\nShakespeare\\n\""
],
@@ -186,10 +178,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Another Simple C Program - Displaying Great Quotations\n",
- "note: \\a does not work in python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Be careful!!\\n \\a\""
],
@@ -219,9 +208,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A longer program\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Hi there!\\nThis program is a bit longer than the others.\"\n",
"print \"But really it's only more text.\\n\\a\\a\"\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter10.ipynb b/Beginning_C_By_Ivon_Horton/chapter10.ipynb
index fd052668..89cc83ed 100644
--- a/Beginning_C_By_Ivon_Horton/chapter10.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:67a316ecc3def0c634c382410d442033098ecf91839327bce17c0f2bf4424e27"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Exercising formatted input\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -234,9 +233,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Characters in the format control string\n",
- "\"\"\"\n",
"\n",
"\n",
"value_count = 2\n",
@@ -309,11 +305,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Floating-Point Input\n",
- "note: the way it is given in textbook is not possible in python. Just showing a\n",
- "sample float input.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"value_count = 3\n",
"print \"Enter: 3.14 3.14 3.14\"\n",
@@ -387,9 +379,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Reading hexadecimal and octal values\n",
- "\"\"\"\n",
"\n",
"print \"Enter three integer values: \"\n",
"n = 3\n",
@@ -459,9 +448,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Reading characters with scanf_s()\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your first initial: \",\n",
"initial = raw_input()\n",
@@ -547,9 +534,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Reading a string with gets_s()\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your first initial: \",\n",
"initial = raw_input()\n",
@@ -616,9 +601,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Reading and unreading characters\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter a sequence of integers and alphabetic names in a single line(separated by spaces): \",\n",
"text = raw_input()\n",
@@ -677,9 +660,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Ineger output variations\n",
- "\"\"\"\n",
+ "\n",
"\n",
"i = 15\n",
"j = 345\n",
@@ -721,9 +702,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Variations on a single integer\n",
- "\"\"\"\n",
+ "\n",
"\n",
"k = \"678\"\n",
"hex_k = int(k, 16)\n",
@@ -762,9 +741,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Outputting floating-point values\n",
- "\"\"\"\n",
+ "\n",
"\n",
"fp1 = 345.678\n",
"fp2 = 1.234E6\n",
@@ -803,9 +780,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "print printable characters\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import string\n",
"\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter11.ipynb b/Beginning_C_By_Ivon_Horton/chapter11.ipynb
index b85dcda1..8bed3984 100644
--- a/Beginning_C_By_Ivon_Horton/chapter11.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:f5ae274b34f8832ebb766131ce16691aa9f05236c3dacd19d82ce9c6b22fe7d8"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Exercising the horse\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Horse:\n",
" age = 0\n",
@@ -157,9 +156,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Exercising the horses\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Horse:\n",
" age = 0\n",
@@ -416,9 +413,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Pointing out the horses\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Horse:\n",
" age = 0\n",
@@ -586,9 +581,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Daisy chaining the horses\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Horse:\n",
" age = 0\n",
@@ -764,9 +757,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Daisy chaining the horses both ways\n",
- "\"\"\"\n",
+ "\n",
"\n",
"first = None\n",
"current = None\n",
@@ -1034,11 +1025,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Program 11.6, page no. 456\n",
"\n",
- "\"\"\"\n",
- "Basics of a family tree\n",
- "\"\"\"\n",
"\n",
"class Date:\n",
" day = 0\n",
@@ -1320,11 +1307,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Program 11.7, page no. 466\n",
"\n",
- "\"\"\"\n",
- "binary tree to sort integers\n",
- "\"\"\"\n",
+ "\n",
"class Node:\n",
" item = 0.0\n",
" count = 0\n",
@@ -1622,9 +1606,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "The operation of a union\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def print_date(date):\n",
" if date.format == 0:\n",
@@ -1709,11 +1691,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Program 11.9, page no. 482\n",
"\n",
- "\"\"\"\n",
- "Generating a Bar chart\n",
- "\"\"\"\n",
"\n",
"import numpy\n",
"import sys\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter12.ipynb b/Beginning_C_By_Ivon_Horton/chapter12.ipynb
index 71ea1f1a..b80c0151 100644
--- a/Beginning_C_By_Ivon_Horton/chapter12.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:792ce9bacf230895f9bb69020ed0a90ab017f7ded1cf3c8298370c217c100f66"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Writing a file a character at a time\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -104,9 +103,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "As the saying goes. . .it comes back!\n",
- "\"\"\"\n",
+ "\n",
"\n",
"proverbs = [\"Many a mickle makes a muckle.\\n\",\n",
" \"Too many cooks spoil the broth.\\n\",\n",
@@ -198,9 +195,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Messing about with formatted file I/O\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -278,11 +273,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Program 12.4, page no. 514\n",
"\n",
- "\"\"\"\n",
- "A prime example using binary files\n",
- "\"\"\"\n",
+ "\n",
+ "\n",
"\n",
"import math\n",
"import sys\n",
@@ -412,11 +405,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Program 12.5, page no. 523\n",
"\n",
- "\"\"\"\n",
- "Investigating the family.\n",
- "\"\"\"\n",
"\n",
"class Date:\n",
" day = 0\n",
@@ -512,11 +501,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Program 12.6, page no. 531\n",
"\n",
- "\"\"\"\n",
- "Writing a binary file with an update mode\n",
- "\"\"\"\n",
"\n",
"MAXLEN = 50\n",
"\n",
@@ -564,11 +549,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Program 12.7, page no. 545\n",
"\n",
- "\"\"\"\n",
- "Writing, reading and updating a binary file\n",
- "\"\"\"\n",
"\n",
"class Record:\n",
" name = \"\"\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter13.ipynb b/Beginning_C_By_Ivon_Horton/chapter13.ipynb
index 8a2ffbe5..6169215b 100644
--- a/Beginning_C_By_Ivon_Horton/chapter13.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:a9141c3e95bf9510ebd3627775c232beb902109a956e0bd2f7e906b08fe40884"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Demonstrating assertions\n",
- "\"\"\"\n",
+ "\n",
"\n",
"y = 5\n",
"for x in range(20):\n",
@@ -76,9 +75,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Test our timer function\n",
- "\"\"\"\n",
"\n",
"import time\n",
"import datetime\n",
@@ -175,9 +171,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Getting date data with ease\n",
- "\"\"\"\n",
+ "\n",
"\n",
"from datetime import *\n",
"import time\n",
@@ -228,9 +222,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Getting the day for a given date\n",
- "\"\"\"\n",
+ "\n",
"\n",
"from datetime import *\n",
"import time\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter14.ipynb b/Beginning_C_By_Ivon_Horton/chapter14.ipynb
index 42a4f7a7..c351c6f1 100644
--- a/Beginning_C_By_Ivon_Horton/chapter14.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:275b458b34ae91067224e50705db107812d45fc58e5291ede57a7d2fe00a2167"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Classifying wide characters\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import string\n",
"import sys\n",
@@ -89,9 +88,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Finding occurrences of one wide character string in another\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter a string of less than 100 characters: \",\n",
"text = raw_input()\n",
@@ -170,9 +167,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Working with complex numbers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"cx = 1.0 + 3.0j\n",
"cy = 1.0 - 4.0j\n",
@@ -224,9 +219,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Joining threads\n",
- "\"\"\"\n",
+ "\n",
"\n",
"from threading import Thread\n",
"\n",
@@ -283,9 +276,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Thread operations\n",
- "\"\"\"\n",
+ "\n",
"\n",
"from threading import Thread\n",
"import math\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter2.ipynb b/Beginning_C_By_Ivon_Horton/chapter2.ipynb
index 7e4b1bf3..c8739188 100644
--- a/Beginning_C_By_Ivon_Horton/chapter2.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:62d8fc451396635cdeab5f4f92b23401a31f7b72236a9f3ecb8a6d1a87f20612"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "What is a Variable?\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"My salary is $10000\""
],
@@ -58,9 +57,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using a variable\n",
- "\"\"\"\n",
+ "\n",
" \n",
"salary = 10000; #Declare and store 10000 in variable called salary\n",
"print \"My salary is %d.\" %salary"
@@ -90,9 +87,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using more variables\n",
- "\"\"\"\n",
+ "\n",
"\n",
"brothers = 7 #declaring variable & storing value\n",
"brides = 7 #declaring variable & storing value\n",
@@ -124,9 +119,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Program 2.4 Simple calculations\n",
- "\"\"\"\n",
+ "\n",
"\n",
"cats = 2\n",
"dogs = 1\n",
@@ -163,9 +156,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Calculations with cookies\n",
- "\"\"\"\n",
+ "\n",
"\n",
"cookies = 5\n",
"cookie_calories = 125\n",
@@ -210,9 +201,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Cookies and kids\n",
- "\"\"\"\n",
+ "\n",
"\n",
"cookies = 45\n",
"children = 7\n",
@@ -254,9 +243,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Division with float values\n",
- "\"\"\"\n",
+ "\n",
"\n",
"plank_length = 10.0\n",
"piece_count = 4.0\n",
@@ -291,9 +278,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculations on a table\n",
- "\"\"\"\n",
+ "\n",
"\n",
"radius = 0.0\n",
"diameter = 0.0\n",
@@ -354,9 +339,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "More round tables\n",
- "\"\"\"\n",
+ "\n",
"\n",
"PI = 3.14159\n",
" \n",
@@ -419,9 +402,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Round tables again but shorter\n",
- "\"\"\"\n",
+ "\n",
"\n",
"diameter = 0.0\n",
"radius = 0.0\n",
@@ -478,12 +459,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Data Types\n",
- "Note: there is no long double, or float double or double range or short.\n",
- "Also, the size of data types my defer compared to c & there is no limit so we\n",
- "have skipped example 2.11 of this chapter\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys \n",
"\n",
@@ -520,10 +496,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Choosing the correct type for the job\n",
- "note: there won't be any error as said in the book, hence, skipping 2.14\n",
- "\"\"\"\n",
+ "\n",
"\n",
"Revenue_Per_150 = 4.5\n",
"JanSold = 23500\n",
@@ -572,9 +545,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Characters and numbers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"first = 'T'\n",
"second = 63\n",
@@ -613,9 +584,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using type char\n",
- "\"\"\"\n",
+ "\n",
"\n",
"first = 'A'\n",
"second = 'B'\n",
@@ -658,9 +627,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Calculating the height of a tree\n",
- "\"\"\"\n",
+ "\n",
"\n",
"shorty = 0.0\n",
"lofty = 0.0\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter3.ipynb b/Beginning_C_By_Ivon_Horton/chapter3.ipynb
index 49245eb1..74bd1aaf 100644
--- a/Beginning_C_By_Ivon_Horton/chapter3.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:395f91f52f5165130592aef7f92afdbea52f690b93426a4caf3da2a8b3404bd6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A simple example of the if statement\n",
- "\"\"\"\n",
+ "\n",
"\n",
"number = 0;\n",
"print \"\\nEnter an integer between 1 and 10: \",\n",
@@ -82,9 +81,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using if statements to decide on a discount\n",
- "\"\"\"\n",
+ "\n",
"\n",
"unit_price = 3.50\n",
"print \"Enter the number that you want to buy: \", \n",
@@ -137,10 +134,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using nested ifs to analyze numbers\n",
- "note: no need of LONG_MAX as there is no limit in python for an integer value\n",
- "\"\"\"\n",
+ "\n",
"\n",
"test = 0.0\n",
"print \"Enter an integer: \",\n",
@@ -196,9 +190,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Converting uppercase to lowercase\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter an uppercase letter:\",\n",
"letter = raw_input()\n",
@@ -249,9 +241,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Testing letters an easier way\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter an uppercase letter:\",\n",
"letter = raw_input()\n",
@@ -301,9 +291,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Multiple Discount Levels\n",
- "\"\"\"\n",
+ "\n",
"\n",
"unit_price = 3.50\n",
"discount1 = 0.05\n",
@@ -365,9 +353,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A confused recruiting policy \n",
- "\"\"\"\n",
+ "\n",
"\n",
"age = 0\n",
"college = 0\n",
@@ -465,10 +451,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Lucky Lotteries\n",
- "note: there is no switch statement in Python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Pick a number between 1 and 10 and you may win a prize! \",\n",
"choice = int(raw_input())\n",
@@ -527,9 +510,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Testing cases\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter Y or N: \",\n",
"answer = raw_input()\n",
@@ -581,9 +562,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Excercising bitwise operator\n",
- "\"\"\"\n",
+ "\n",
"\n",
"original = 0xABC\n",
"result = 0\n",
@@ -627,9 +606,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A calculator\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter the calculation\\n\",\n",
"number1 = float(raw_input(\"Enter first number: \"))\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter4.ipynb b/Beginning_C_By_Ivon_Horton/chapter4.ipynb
index 1dd29164..72f009be 100644
--- a/Beginning_C_By_Ivon_Horton/chapter4.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:4c41735fb67bb40797fc8ec99d1c0b5c81a6828d699e86fe05c05b6962ed94db"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "List ten integers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"for count in range (1, 11):\n",
" print count,\n",
@@ -61,9 +60,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Drawing a box\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"**************\"\n",
"for count in range(1, 9):\n",
@@ -104,9 +101,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Sum the integers from 1 to a user-specified number\n",
- "\"\"\"\n",
+ "\n",
"\n",
"sum = 0\n",
"\n",
@@ -158,11 +153,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Sum the integers from 1 to a user-specified number (compact version)\n",
- "note: the way specified in book is not possible in Python, it will be same as\n",
- "previous progam\n",
- "\"\"\"\n",
+ "\n",
"\n",
"sum = 0\n",
"\n",
@@ -214,9 +205,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "summing the integers backward\n",
- "\"\"\"\n",
+ "\n",
"\n",
"sum = 0\n",
"\n",
@@ -266,10 +255,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "The almost indefinite loop - computing an average\n",
- "note: there cannot be infinit for loop in python, we will use while loop\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"This program calculates the average of any number of values.\"\n",
"total = 0\n",
@@ -406,9 +392,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A Guessing Game\n",
- "\"\"\"\n",
+ "\n",
"import sys\n",
"\n",
"chosen = 15\n",
@@ -515,9 +499,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A More Interesting Guessing Game\n",
- "\"\"\"\n",
+ "\n",
"\n",
"from random import *\n",
"\n",
@@ -624,9 +606,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "While programming and summing integers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"sum = 0\n",
"i = 1\n",
@@ -680,9 +660,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Output a box with given width and height\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MIN_SIZE = 3;\n",
" \n",
@@ -768,9 +746,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Sums of successive integer sequences\n",
- "\"\"\"\n",
+ "\n",
"\n",
"sum = 0\n",
"count = 0\n",
@@ -836,9 +812,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Sums of integers with a while loop nested in a for loop\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter the number of integers you want to sum: \",\n",
"count = int(raw_input())\n",
@@ -905,9 +879,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Reversing the digits\n",
- "\"\"\"\n",
+ "\n",
"rebmun = 0\n",
"print \"\\nEnter a positive integer: \",\n",
"number = int(raw_input())\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter5.ipynb b/Beginning_C_By_Ivon_Horton/chapter5.ipynb
index 3b34352d..8e195f37 100644
--- a/Beginning_C_By_Ivon_Horton/chapter5.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:a29cdeb847e548d8c74cdb11f8f6f17380a9a763c13e45e4e17605b4ec6cf4a6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Averaging ten grades without storing them\n",
- "\"\"\"\n",
+ "\n",
"\n",
"count = 10\n",
"sum = 0\n",
@@ -217,9 +216,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Averaging ten grades - storing values the hard way\n",
- "\"\"\"\n",
+ "\n",
"\n",
"sum = 0\n",
"average = 0.0\n",
@@ -361,9 +358,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Averaging ten grades - storing the values the easy way\n",
- "\"\"\"\n",
+ "\n",
"\n",
"grades = []\n",
"count = 10\n",
@@ -394,9 +389,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Reusing the numbers stored\n",
- "\"\"\"\n",
+ "\n",
"\n",
"grades = []\n",
"count = 10\n",
@@ -599,9 +592,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using the & operator\n",
- "\"\"\"\n",
+ "\n",
"import sys\n",
"\n",
"a = 1\n",
@@ -652,9 +643,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Know your hat size - if you dare...\n",
- "\"\"\"\n",
+ "\n",
"\n",
"size = [['6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7'],\n",
" ['1', '5', '3', '7', ' ', '1', '1', '3', '1', '5', '3', '7'],\n",
@@ -720,9 +709,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Averaging a variable number of grades\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter the number of grades: \",\n",
"nGrades = int(raw_input())\n",
@@ -864,9 +851,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Tic-Tac-Toe\n",
- "\"\"\"\n",
+ "\n",
"\n",
"player = 0\n",
"winner = 0\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter6.ipynb b/Beginning_C_By_Ivon_Horton/chapter6.ipynb
index fdf576c5..c05d45c7 100644
--- a/Beginning_C_By_Ivon_Horton/chapter6.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:cc6cd32b3760ef9f8d727f2cbad62d4127abffa00d3c9ad693debfc7914ad190"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Displaying a string\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"The character \\\\0 is used to terminate a string.\""
],
@@ -58,9 +57,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Lengths\n",
- "\"\"\"\n",
+ "\n",
"\n",
"str1 = \"To be or not to be\"\n",
"str2 = \",that is a question\"\n",
@@ -94,9 +91,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Arrays of strings\n",
- "\"\"\"\n",
+ "\n",
"\n",
"str1 = \"Computers do what you tell them to do, not what you want them to do.\"\n",
"str2 = \"When you put something in memory, remember where you put it.\"\n",
@@ -147,9 +142,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Joining strings\n",
- "\"\"\"\n",
+ "\n",
"\n",
"preamble = \"The joke is: \"\n",
"str1 = \"My dog hasn\\'t got any nose.\\n\"\n",
@@ -189,9 +182,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Comparing strings\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Type in the first word (maximum 20 characters): \",\n",
"word1 = raw_input()\n",
@@ -219,9 +210,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A demonstration of seeking and finding\n",
- "\"\"\"\n",
+ "\n",
"\n",
"str1 = \"This string contains the holy grail.\"\n",
"str2 = \"the holy grail\"\n",
@@ -265,10 +254,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Find all the words\n",
- "note: program 7A in the book will remain same in Python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter some prose that is less than 1000 characters (go on typing hit enter to terminate):\"\n",
"str1 = raw_input()\n",
@@ -344,9 +330,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Testing characters in a string\n",
- "\"\"\"\n",
+ "\n",
"\n",
"\n",
"nLetters = 0\n",
@@ -407,9 +391,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Finding occurrences of one string in another\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter the string to be searched (less than 100 characters): \",\n",
"text = raw_input()\n",
@@ -481,9 +463,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Analyzing Text\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import numpy\n",
"\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter7.ipynb b/Beginning_C_By_Ivon_Horton/chapter7.ipynb
index 7a7e0247..e46960ce 100644
--- a/Beginning_C_By_Ivon_Horton/chapter7.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:711ef8d09307cb9b16d63b16134924968e61ecb1c05fd7745b7d89ba9bc4ac32"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A simple program using pointers\n",
- "note: there are no pointers in Python.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -74,9 +72,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "What's the pointer of it all\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num1 = 0\n",
"num2 = 0\n",
@@ -115,10 +111,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using pointer arguments to scanf_s\n",
- "note: in Python you cannot use pointers to input a value\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Input an integer: \",\n",
"value = int(raw_input())\n",
@@ -164,9 +157,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Arrays and pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"multiple = ['M', 'y','s','t', 'r', 'i', 'n', 'g']\n",
" \n",
@@ -201,9 +192,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Incrementing a pointer to an array\n",
- "\"\"\"\n",
"\n",
"multiple = \"a string\"\n",
"p = multiple\n",
@@ -243,9 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Incrementing a pointer to an array of integers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -286,9 +272,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Two-dimensional arrays and pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"board = [['1','2','3'],\n",
" ['4','5','6'],\n",
@@ -324,9 +308,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Two-dimensional arrays and pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"board = [['1','2','3'],\n",
" ['4','5','6'],\n",
@@ -363,9 +345,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Getting values in a two-dimensional array\n",
- "\"\"\"\n",
+ "\n",
"\n",
"board = [['1','2','3'],\n",
" ['4','5','6'],\n",
@@ -408,9 +388,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Multidimensional arrays and pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"board = [['1','2','3'],\n",
" ['4','5','6'],\n",
@@ -453,9 +431,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Understand pointers to your hat size - if you dare\n",
- "\"\"\"\n",
+ "\n",
"\n",
"size = [['6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7'],\n",
" ['1', '5', '3', '7', ' ', '1', '1', '3', '1', '5', '3', '7'],\n",
@@ -521,10 +497,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A dynamic prime example\n",
- "note: program 7.12 will remain same\n",
- "\"\"\"\n",
+ "\n",
"\n",
"pPrimes = []\n",
"found = False\n",
@@ -600,9 +573,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Extending dynamically allocated memory for strings\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -681,9 +652,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Using array notation with pointers to sort strings\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter strings to be sorted, separated by '.' Press Enter to end: \"\n",
"text = raw_input()\n",
@@ -741,9 +710,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "An improved calculator\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"To use this calculator, enter any expression with or without spaces.\"\n",
"print \"An expression may include the operators\"\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter8.ipynb b/Beginning_C_By_Ivon_Horton/chapter8.ipynb
index 548884d6..2b0cdc0b 100644
--- a/Beginning_C_By_Ivon_Horton/chapter8.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:3fbbd33189f83aa6d0187f308c759f69619a009cb3b8fae3f4a0ad98df7c2c47"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Scoping out scope\n",
- "\"\"\"\n",
+ "\n",
"\n",
"count1 = 1\n",
"\n",
@@ -116,9 +115,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Calculating an average using functions\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def Sum(x, n):\n",
" sum = 0.0\n",
@@ -224,9 +221,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "The functional approach to string sorting\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def sort_string(text):\n",
" dot_separated = text.split('.')\n",
@@ -284,9 +279,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A function to increase your pay\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def IncomePlus(pPay):\n",
" pPay += 10000\n",
@@ -324,9 +317,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A function to increase your pay that doesn't\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def IncomePlus(pPay):\n",
" pPay += 10000\n",
diff --git a/Beginning_C_By_Ivon_Horton/chapter9.ipynb b/Beginning_C_By_Ivon_Horton/chapter9.ipynb
index d7adce09..6b5e2864 100644
--- a/Beginning_C_By_Ivon_Horton/chapter9.ipynb
+++ b/Beginning_C_By_Ivon_Horton/chapter9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:6ada72776bf91dd75540d29fecfeda6a5cab8bde3c866cd455973111367e4933"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Pointing to functions\n",
- "\"\"\"\n",
"\n",
"def sum(x, y):\n",
" return x + y\n",
@@ -79,9 +77,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Arrays of Pointers to functions\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def sum(x, y):\n",
" return x + y\n",
@@ -135,9 +131,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Passing a Pointer to a function\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def sum(x, y):\n",
" return x + y\n",
@@ -187,10 +181,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Static versus automatic variables\n",
- "note: there is no static in python. Output will be different from book.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def test1():\n",
" count = 0\n",
@@ -240,10 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Global variables\n",
- "note: output will vary from textbook because of static variable\n",
- "\"\"\"\n",
+ "\n",
"\n",
"count = 0\n",
"\n",
@@ -295,9 +283,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Calculating factorials using recursion\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def factorial(n):\n",
" if(n < 2):\n",
@@ -348,10 +334,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Calculating an average using variable argument lists\n",
- "note: output will vary from that given in textbook\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def average(*arg):\n",
" sum = arg[0] + arg[1]\n",
@@ -399,9 +382,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A program to list the command line arguments\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -440,9 +421,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "REVERSI An Othello type game\n",
- "\"\"\"\n",
+ "\n",
"\n",
"SIZE = 6\n",
"comp_c = '@'\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter1.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter1.ipynb
index b19bede4..48ad3225 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter1.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:e4a8e7d7f68c55157338101fb923c578a4287a391df7f630ea67b43d6c59bd53"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Simple Hello World !\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Hello World!\""
],
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter10.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter10.ipynb
index dd6f3a0f..7fcd3612 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter10.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ffbb5815913062b1375d894b2fe1e26db393d3f99c982f5934f82d0355e05d2e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "defining an array\n",
- "note: no need to specify size of an array in python, it exapands automatically.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = [] #array defined"
],
@@ -51,12 +49,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "variable as size of array\n",
- "note: this won't give an error as mentioned in book as it will take numTests as\n",
- "an element of array instead of size of array, as there is no need of size of \n",
- "array in python.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter the number of test scores:\",\n",
"numTests = int(raw_input())\n",
@@ -102,11 +95,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "variable as size of array\n",
- "note: numTests will be taken as an element of array instead of size.\n",
- "Also, there in no constant in Python, this program will be same as previous one\n",
- "\"\"\"\n",
+ "\n",
"\n",
"numTests = 3\n",
"print \"Enter the number of test scores:\",\n",
@@ -153,11 +142,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "variable as size of array\n",
- "note: numTests will be taken as an element of array instead of size.\n",
- "Also, there in no constant in Python, this program will be same as previous one\n",
- "\"\"\"\n",
+ "\n",
"\n",
"numTests = 3\n",
"print \"Enter the number of test scores:\",\n",
@@ -205,10 +190,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "intializing character array\n",
- "note: '\\0' will have different result in python than in c++ \n",
- "\"\"\"\n",
+ "\n",
"\n",
"name = ['J', 'e', 'f', 'f', '\\0']\n",
"print name"
@@ -238,10 +220,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "intializing character array\n",
- "note: output will be different than that in book.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"name = ['J', 'e', 'f', 'f']\n",
"print name"
@@ -271,9 +250,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "assigning & displaying array values\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = []\n",
"print \"Enter test score #1: \",\n",
@@ -358,9 +335,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "using 3 separate variables instead of array in previous example\n",
- "\"\"\"\n",
+ "\n",
"\n",
"\n",
"print \"Enter test score #1: \",\n",
@@ -445,9 +420,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "looping for array\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = []\n",
"for i in range(3):\n",
@@ -529,9 +502,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "using constant for range of array\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MAX = 3\n",
"\n",
@@ -615,11 +586,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Common programming mistake for array\n",
- "note: the problem mentioned in the textbook won't occur in python as we are not\n",
- "specifying size of an array.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MAX = 3\n",
"\n",
@@ -719,11 +686,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "input element by index in array\n",
- "note: if the array is not initialized then this method won't work. append() may\n",
- "be used instead.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MAX = 3\n",
"grades = [0,0,0]\n",
@@ -802,9 +765,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "character array\n",
- "\"\"\"\n",
+ "\n",
"\n",
"name = ['J','e','f','f']\n",
"print \"Enter your name: \",\n",
@@ -851,11 +812,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "cout Object with Numeric Arrays\n",
- "note: here the list itself will be printed instead of base address(as mentioned\n",
- "in textbook).\n",
- "\"\"\"\n",
"\n",
"MAX = 3\n",
"testScore = []\n",
@@ -935,11 +891,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "cin with numeric array\n",
- "note: there won't be any error in python as it is with the case of c++. It will\n",
- "just take testScore as a normal variable.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = []\n",
"testScore = raw_input()"
@@ -970,11 +922,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "cin with character array\n",
- "note: it will simply override the array and assign whatever value you enter to\n",
- "the name variable unlike c++(as mentioned in c++)\n",
- "\"\"\"\n",
+ "\n",
"\n",
"name = ['J','e','f','f']\n",
"print \"Enter your name: \",\n",
@@ -1021,9 +969,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "name as string\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your name: \",\n",
"name = raw_input()\n",
@@ -1069,10 +1015,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "getline()\n",
- "note: there is no getline() in python.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your name: \",\n",
"name = raw_input()\n",
@@ -1118,9 +1061,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "passing array as function argument\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MAX = 3\n",
"\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter11.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter11.ipynb
index f1d28b76..28bea5a9 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter11.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:3856d250c0b05978b896337a2d03bfbc47b52567398ed488a9db68479c713e89"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "size of pointers\n",
- "note: there is no concept of pointers in python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -69,10 +67,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "attempt to print the value of pointer.\n",
- "note: there is no pointer in python, we will simply print out an integer value instead\n",
- "\"\"\"\n",
+ "\n",
"\n",
"iPtr = 0\n",
"print \"The value of iPtr is\", iPtr"
@@ -102,9 +97,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Null pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"iPtr = None\n",
"print \"The value of iPtr is \", iPtr"
@@ -134,9 +127,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "address of pointers\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 5\n",
"iPtr = id(num)\n",
@@ -169,10 +160,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "dereferencing\n",
- "output will deffer from that given in textbook\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 5\n",
"iPtr = id(num)\n",
@@ -209,10 +197,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Pointer as a Variable\n",
- "note: output may differ from that given in textbook\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num1 = 5\n",
"num2 = 14\n",
@@ -253,11 +238,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "array name as a constant pointer\n",
- "note: we cannot use * operator to point in python as there are no pointers\n",
- "python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = [4, 7, 1]\n",
"print \"The address of the array using testScore is \", testScore\n",
@@ -293,10 +274,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Pointer Arithmetic\n",
- "the adress values will be different\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MAX = 3\n",
"\n",
@@ -335,10 +313,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "previous program modified with a pointer to point to array\n",
- "the adress values will be different\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MAX = 3\n",
"\n",
@@ -378,11 +353,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Incrementing a Pointer\n",
- "the method given in textbook is not possible in python.\n",
- "We will do it in different way\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MAX = 3\n",
"\n",
@@ -422,9 +393,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "comparing address\n",
- "\"\"\"\n",
+ "\n",
"import sys\n",
"MAX = 3\n",
"\n",
@@ -489,10 +458,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "decrementing pointers\n",
- "Note: not possible in python. Impletement in a different way\n",
- "\"\"\"\n",
+ "\n",
"import sys\n",
"MAX = 3\n",
"\n",
@@ -536,9 +502,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "pointer as function\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MAX = 3\n",
"\n",
@@ -627,10 +591,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "pointer as function\n",
- "the program remains same in python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"MAX = 3\n",
"\n",
@@ -719,9 +680,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Passing a Single Variable Using Pointer Notation\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def doubleIt(x):\n",
" print \"The number to be doubled is \", x\n",
@@ -776,12 +735,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "modify previous program so it passes the variable to be doubled by address instead of by\n",
- "reference\n",
"\n",
- "note: in python it will remain same\n",
- "\"\"\"\n",
"\n",
"def doubleIt(x):\n",
" print \"The number to be doubled is \", x\n",
@@ -836,9 +790,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Dynamic Memory Allocation\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter the number of test scores: \",\n",
"numTests = int(raw_input())\n",
@@ -937,9 +889,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Returning Pointers from Functions\n",
- "\"\"\"\n",
+ "\n",
"\n",
"str = \"Jeff Kent\"\n",
"print str"
@@ -969,9 +919,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Returning a Pointer to a Local Variable\n",
- "\"\"\"\n",
"\n",
"def setName():\n",
" print \"Enter your name: \",\n",
@@ -1021,9 +968,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Returning a Pointer to a Static Local Variable\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def setName():\n",
" print \"Enter your name: \",\n",
@@ -1073,9 +1018,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Returning a Pointer to a Dynamically Created Variable\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def setName():\n",
" print \"Enter your name: \",\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter12.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter12.ipynb
index 20f1ab81..aad6446b 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter12.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter12"
+ "name": "",
+ "signature": "sha256:7cb05a28e7ffaf35858d238ed32ee5850136dba10511258d20543dca08f1609c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -28,9 +29,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "The \"Press Any Key to Continue\" Problem\n",
- "\"\"\"\n",
+ "\n",
"\n",
"ch = 'a'\n",
"\n",
@@ -98,10 +97,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "cin.get function example.\n",
- "we will use raw_input\n",
- "\"\"\"\n",
"\n",
"ch = 'a'\n",
"\n",
@@ -169,10 +164,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "cin.ignore function.\n",
- "note: no such function in Python, using normal raw_input\n",
- "\"\"\"\n",
+ "\n",
"\n",
"ch = 'a'\n",
"\n",
@@ -224,10 +216,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "ignoring \\n character\n",
- "we will do it normally in Python as \\n is alread ignored.\n",
- "\"\"\"\n",
"\n",
"ch = 'a'\n",
"\n",
@@ -295,10 +283,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Combining Use of cin, cin.get, and cin.getline\n",
- "note: result differ from textbook\n",
- "\"\"\"\n",
+ "\n",
"\n",
"name = []\n",
"print \"Enter course number: \",\n",
@@ -364,9 +349,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "cin.get, cin.getline contd.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"name = []\n",
"print \"Enter course number: \",\n",
@@ -432,10 +415,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Useful Character Functions\n",
- "toupper\n",
- "\"\"\"\n",
+ "\n",
"\n",
"ch = 'a'\n",
"while(ch != 'Q'):\n",
@@ -487,9 +467,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "string comparison\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter first string: \",\n",
"str1 = raw_input()\n",
@@ -557,9 +535,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "string to int\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys\n",
"\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter13.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter13.ipynb
index 46b00b70..a7e400b9 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter13.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:60c23a8f50ffb51e0da71a6e8b36475b7941871a6f534003180327a651bb1c1c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "open a file\n",
- "note: it will give an error\n",
- "\"\"\"\n",
+ "\n",
"\n",
"try:\n",
" if(fp):\n",
@@ -67,9 +65,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "open file write mode\n",
- "\"\"\"\n",
+ "\n",
"\n",
"try:\n",
" fp = open(\"students.dat\", \"w\")\n",
@@ -105,9 +101,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "writing to file\n",
- "\"\"\"\n",
"\n",
"fp = open(\"students.dat\", \"w\")\n",
"print \"Writing to the file\"\n",
@@ -178,9 +171,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "reading from file\n",
- "\"\"\"\n",
+ "\n",
"\n",
"fp = open(\"students.dat\", \"w\")\n",
"print \"Writing to the file\"\n",
@@ -262,9 +253,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "reading from file using getline\n",
- "\"\"\"\n",
"\n",
"fp = open(\"students.dat\", \"w\")\n",
"print \"Writing to the file\"\n",
@@ -346,9 +334,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "looping through file\n",
- "\"\"\"\n",
+ "\n",
"\n",
"fp = open(\"students.dat\", \"w\")\n",
"print \"Writing to the file\"\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter14.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter14.ipynb
index 57cde338..ff10cf77 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter14.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:016508922d0131c0ac159bf106009ef877ee5a7ded89017b639b2c0f28cf52bc"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "declaring structure\n",
- "note: there is no concept of structure in python. We will use class instead\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Person:\n",
" name = \"\"\n",
@@ -53,10 +51,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "declares a three-element Person array, assigns values to the member\n",
- "variables of each element, and then outputs their values\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Person:\n",
" name = \"\"\n",
@@ -199,10 +194,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "constructors & destructors\n",
- "note: there are no destructors in Python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Person:\n",
" name = \"\"\n",
@@ -237,9 +229,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "constructors\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Person:\n",
" def __init__(self):\n",
@@ -275,9 +265,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "constructors with arguments\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Person:\n",
" def __init__(self, s=\"no name assigned\", h=-1):\n",
@@ -347,11 +335,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Separating the Constructor Prototype and Implementation\n",
- "note: separation is not possible in Python we will do it the same way as previous\n",
- "program\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Person:\n",
" def __init__(self, s=\"no name assigned\", h=-1):\n",
@@ -421,9 +405,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Passing Structures as Function Arguments\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Person:\n",
" name = \"\"\n",
@@ -499,9 +481,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "nesting structures\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Date:\n",
" month = 0\n",
@@ -622,10 +602,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "classes\n",
- "note: there won't be any error unlike the situation mentioned in textbook\n",
- "\"\"\"\n",
+ "\n",
"\n",
"class Person:\n",
" name = \"\"\n",
@@ -701,10 +678,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "private & public specifiers\n",
- "note: there are no such specifiers in Python\n",
- "\"\"\"\n",
"\n",
"class Person:\n",
" name = \"\"\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter2.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter2.ipynb
index d25f5c31..a10e4f68 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter2.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter2"
+ "name": "",
+ "signature": "sha256:609a5d3522e4231d9e4a78cca1d62620ebc8f02a9a5a670cc7f12a71d13447b3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Data Types\n",
- "Note: there is no long double, or float double or double range or short.\n",
- "Also, the size of data types my differ compared to c++\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import sys \n",
"\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter3.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter3.ipynb
index d1b20dbb..ea8d38c3 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter3.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter3"
+ "name": "",
+ "signature": "sha256:7d3fff6ffc0709910490ced1c16839cdcfbdac70ad380dbfa135865aaf26e67d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Variable Declaration\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = 0 #will declare testScore as an integer"
],
@@ -50,9 +49,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Variable Declaration with error\n",
- "\"\"\"\n",
"\n",
"testScore"
],
@@ -82,10 +78,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Memory Address of variable\n",
- "Note: address will be different from that given in the book\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = 0\n",
"print id(testScore)"
@@ -115,10 +108,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Address and size of two variables\n",
- "Note: the address and size will be diffent than the ones given in book\n",
- "\"\"\"\n",
+ "\n",
"import sys\n",
"\n",
"testScore = 0\n",
@@ -157,9 +147,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "change in the value of a variable\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = 95;\n",
"print \"Your test score is: \", testScore\n",
@@ -192,11 +180,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "A floating-point value, 77.83, is being assigned to an integer variable\n",
- "Note: it will be printed as 77.83 unlike in the book, as Python implicitly\n",
- "takes the data type according to the value assigned\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = 77.83;\n",
"print \"The test score is: \", testScore\n",
@@ -228,10 +212,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Printing variable of short type but out of range.\n",
- "Note: it will print 32768 as it is as there is no short data type in python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = 32768;\n",
"print \"Your test score is: \", testScore"
@@ -261,10 +242,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Printing variable of short type but out of range.\n",
- "Note: it will print -32769 as it is as there is no short data type in python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = -32769\n",
"print \"Your test score is: \", testScore"
@@ -294,9 +272,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Inputting a value (without prompt msg)\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = int(raw_input())\n",
"print \"Your test score is: \", testScore"
@@ -317,9 +293,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Inputting a value (with prompt msg)\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = int(raw_input(\"Enter your test score: \"))\n",
"print \"Your test score is: \", testScore"
@@ -357,9 +331,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Inputting Values for Multiple Variables\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your name: \",\n",
"myName = raw_input()\n",
@@ -443,10 +415,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Inputting Values for Multiple Variables in one prompt (no possible in python, it\n",
- "will be same like the previous program\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your name: \",\n",
"myName = raw_input()\n",
@@ -530,9 +499,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "inputting a string (python will take the whole string and will not omit anything)\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your name: \",\n",
"name = raw_input()\n",
@@ -578,10 +545,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Printing variable of short type but out of range.\n",
- "Note: it will print -32769 as it is as there is no short data type in python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"testScore = 32769\n",
"print \"Your test score is: \", testScore"
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter4.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter4.ipynb
index 3293ca3b..2fed811a 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter4.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:985e0e6b7e8ae27035cca1419b7775a3f9a570b5ac018168350c0febbe31d7b4"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "following program has two integer variables, total and added\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter number of preregistered students: \",\n",
"total = int(raw_input())\n",
@@ -93,9 +92,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "addition operator also can be used with string operands\n",
- "\"\"\"\n",
+ "\n",
"\n",
"firstName = \"Jeff\"\n",
"lastName = \"Kent\"\n",
@@ -126,9 +123,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "program then uses the subtraction operator to update total.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter number of preregistered students: \",\n",
"total = int(raw_input())\n",
@@ -210,9 +205,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "The Multiplication Operator\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter number of preregistered students: \",\n",
"total = int(raw_input())\n",
@@ -296,9 +289,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "The Division Operator\n",
- "\"\"\"\n",
+ "\n",
"\n",
"firstOp = 10\n",
"secondOp = 4\n",
@@ -330,9 +321,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "The Division Operator with the variables intialized with float values\n",
- "\"\"\"\n",
+ "\n",
"\n",
"firstOp = 10.0\n",
"secondOp = 4.0\n",
@@ -364,10 +353,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "the first division example changed to make the result of integer division\n",
- "result into float\n",
- "\"\"\"\n",
+ "\n",
"\n",
"firstOp = 10\n",
"secondOp = 4\n",
@@ -399,9 +385,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "using all the operators together\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter number of preregistered students: \",\n",
"total = int(raw_input())\n",
@@ -488,9 +472,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "program calculates the area of a circle based on a radius inputted by the user\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter radius of circle: \",\n",
"radius = float(raw_input())\n",
@@ -537,10 +519,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "converting pennies to dollars, Dollars: 3, \n",
- "Quarters, Dimes: 1, Nickels: 0, Pennies: 2\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter number of pennies to make change for: \",\n",
"total = int(raw_input())\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter5.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter5.ipynb
index cd6b98e9..7973421f 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter5.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter5"
+ "name": "",
+ "signature": "sha256:527aef20f7b40df168e6ff4a5ccb96d249aaf7c6743cc854ce1a221227ecfb75"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "outputs the results of several variable comparisons.\n",
- "0 -> False 1 -> True\n",
- "\"\"\"\n",
+ "\n",
"\n",
"a = 4\n",
"b = 5\n",
@@ -69,9 +67,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Addition operation\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter number of preregistered students: \",\n",
"total = int(raw_input())\n",
@@ -135,9 +131,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "tests if a whole number entered is even\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter a whole number: \",\n",
"num = int(raw_input())\n",
@@ -184,9 +178,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "previous program modified to add else part for odd number\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter a whole number: \",\n",
"num = int(raw_input())\n",
@@ -235,9 +227,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "odd or even using inline condition (similar to conditional operator)\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter a whole number: \",\n",
"num = int(raw_input())\n",
@@ -283,9 +273,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "determines grades based on test score\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your test score: \",\n",
"testScore = int(raw_input())\n",
@@ -340,10 +328,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "determines your average based on your grade\n",
- "note: there is no switch statement in python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your grade: \",\n",
"grade = raw_input()\n",
@@ -399,10 +384,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "determines your average based on your grade with lower case alphabets also\n",
- "note: there is no switch statement in python\n",
- "\"\"\"\n",
+ "\n",
"\n",
"\n",
"print \"Enter your grade: \",\n",
@@ -459,9 +441,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "more example for switch (if else in python)\n",
- "\"\"\"\n",
+ "\n",
+ "\n",
"\n",
"print \"Choose your car\"\n",
"print \"S for Standard\"\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter6.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter6.ipynb
index a00118a8..bb24153c 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter6.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:9c21d1f44f5f11828308d4a5b6ab2316e8a5d933b04912def7dc67cfcb9dbaea"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "use of nested if statements\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your age: \",\n",
"age = int(raw_input())\n",
@@ -102,9 +101,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "use of nested if statements\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your age: \",\n",
"age = int(raw_input())\n",
@@ -156,9 +153,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "use of the logical And operator\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your age: \",\n",
"age = int(raw_input())\n",
@@ -228,9 +223,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "use of the logical Or operator\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter your age: \",\n",
"age = int(raw_input())\n",
@@ -279,9 +272,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "use of the logical Not operator\n",
- "\"\"\"\n",
"\n",
"print \"Enter your age: \",\n",
"age = int(raw_input())\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter7.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter7.ipynb
index 6076d617..0272be09 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter7.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter7"
+ "name": "",
+ "signature": "sha256:84d44e5e34aa0042556dda8bb39ee06beeff8eaea8bb2913d8710f888ef51867"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "unary operators\n",
- "\"\"\"\n",
"\n",
"num = 2\n",
"num += 1\n",
@@ -60,10 +58,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "increment operator\n",
- "note: there is no increment/decrement operator in python we will use += instead\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 2\n",
"num += 1\n",
@@ -94,10 +89,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "increment operator\n",
- "note: there is no increment/decrement operator in python we will use += instead\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 2\n",
"print num\n",
@@ -128,9 +120,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "unary operator (decrement)\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 2\n",
"num -= 1\n",
@@ -161,11 +151,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "prefix & postfix\n",
- "note: there is no increment/decrement operator in python we will use -= instead\n",
- "this program illustrates n--\n",
- "\"\"\"\n",
+ "\n",
"\n",
"\n",
"num = 2\n",
@@ -197,11 +183,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "prefix & postfix\n",
- "note: there is no increment/decrement operator in python we will use -= instead\n",
- "this program illustrates --n\n",
- "\"\"\"\n",
"\n",
"\n",
"num = 2\n",
@@ -233,9 +214,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "output the numbers between 1 and 10\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 1\n",
"print num\n",
@@ -292,9 +271,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "using a for loop (1 to 10)\n",
- "\"\"\"\n",
+ "\n",
"\n",
"for num in range(1, 11):\n",
" print num\n"
@@ -333,9 +310,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "using a for loop (1 to 100)\n",
- "\"\"\"\n",
+ "\n",
"\n",
"for num in range(1, 101):\n",
" print num,"
@@ -365,11 +340,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "using a for loop\n",
- "note: the method given in textbook is not possible in python, we will use a while\n",
- "loop instead\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 1\n",
"while num <= 10:\n",
@@ -401,9 +372,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "infinite loop\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 1\n",
"while num <= 10:\n",
@@ -425,9 +394,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "factorial\n",
- "\"\"\"\n",
"\n",
"total = 1;\n",
"print \"Enter a number: \",\n",
@@ -477,9 +443,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Breaking Out of a Loop\n",
- "\"\"\"\n",
+ "\n",
"\n",
"secret = 3\n",
"print \"Guess a number between 1 and 10\"\n",
@@ -564,12 +528,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "logical && (And) operator is an alternative to using the break\n",
- "keyword\n",
"\n",
- "note: and cannot be used in python with for loop, we will use if condition\n",
- "\"\"\"\n",
"\n",
"secret = 3\n",
"print \"Guess a number between 1 and 10\\n\"\n",
@@ -631,12 +590,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "missing condition\n",
- "Instead, the break keyword inside the if/else structure substitutes for that condition\n",
- "note: we cannot write an infinte loop in python as given in book, we will use\n",
- "while loop\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 1\n",
"while True:\n",
@@ -671,9 +625,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "continue keyword\n",
- "\"\"\"\n",
+ "\n",
"\n",
"total = 0\n",
"print \"How many items do you want to buy: \",\n",
@@ -724,9 +676,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "using logical Not instead of continue keyword\n",
- "\"\"\"\n",
+ "\n",
"\n",
"total = 0\n",
"print \"How many items do you want to buy: \",\n",
@@ -777,9 +727,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Nesting for loop\n",
- "\"\"\"\n",
+ "\n",
"\n",
"for x in range(1, 6):\n",
" for y in range(1, 11):\n",
@@ -820,9 +768,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "more nested for loop\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter number of salespersons: \",\n",
"persons = int(raw_input())\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter8.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter8.ipynb
index c3bc8e16..24601877 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter8.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter8"
+ "name": "",
+ "signature": "sha256:0900a5bcaf7054f0b4351a7d97782dfa44a0ae756b508bf87060112c13f5f981"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "for loop that was used earlier to show the difference between while loop & for\n",
- "\"\"\"\n",
+ "\n",
"\n",
"for num in range(1, 11):\n",
" print num,"
@@ -59,9 +58,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "using while loop for the same\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 1\n",
"while num <=10:\n",
@@ -93,10 +90,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "updation in the condition itself.\n",
- "it is not possible in python, we will use normal while loop\n",
- "\"\"\"\n",
+ "\n",
"\n",
"num = 0\n",
"while (num <= 10):\n",
@@ -128,10 +122,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "asks the user to enter a positive number,\n",
- "and in a loop continues that request until the user does so\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter a positive number: \",\n",
"num = int(raw_input())\n",
@@ -180,10 +171,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "modification of the program uses the break keyword to provide the user with the\n",
- "option of quitting the data entry\n",
- "\"\"\"\n",
+ "\n",
"\n",
"print \"Enter a positive number: \",\n",
"num = int(raw_input())\n",
@@ -267,11 +255,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "flags\n",
- "note: there is a mistake in the textbook, it should be choice == 'Y' instead of\n",
- "choice != 'Y'\n",
- "\"\"\"\n",
+ "\n",
"\n",
"quit = False\n",
"print \"Enter a positive number: \",\n",
@@ -329,9 +313,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "while(true)\n",
- "\"\"\"\n",
"\n",
"quit = False\n",
"while(True):\n",
@@ -405,9 +386,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "continue keyword\n",
- "\"\"\"\n",
"\n",
"counter = 0\n",
"total = 0\n",
@@ -436,10 +414,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "logical ! (Not)\n",
- "operator as an alternative to using the continue keyword\n",
- "\"\"\"\n",
"\n",
"counter = 0\n",
"total = 0\n",
@@ -492,9 +466,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "program using nested while loops\n",
- "\"\"\"\n",
"\n",
"x = 0\n",
"while(x < 5):\n",
@@ -539,10 +510,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "do while loop\n",
- "note: there is no do while loop in python, we will use while loop instead\n",
- "\"\"\"\n",
+ "\n",
"\n",
"quit = False\n",
"print \"Enter a positive number: \",\n",
diff --git a/C++_Demystified:_A_Self-Teaching_Guide/chapter9.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/chapter9.ipynb
index 4918a533..78228f18 100644
--- a/C++_Demystified:_A_Self-Teaching_Guide/chapter9.ipynb
+++ b/C++_Demystified:_A_Self-Teaching_Guide/chapter9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:f0e84b29896f17b0ff44f8bccf20cf041a408375d83b3bc2290848ec54364369"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "terminology of a function\n",
- "note: there is no need of main in python, defining here just for sake of understanding\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def main(): #defining a function \n",
" print \"Hello World!\"\n",
@@ -62,9 +60,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "defining a function\n",
- "\"\"\"\n",
"\n",
"def printMessage(): # defining function\n",
" print \"Hello world!\"\n",
@@ -96,10 +91,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "prototyping\n",
- "note: there is no need of prototyping in Python. In fact, you have to define a function before you call it in Python.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"printMessage();\n",
"\n",
@@ -131,11 +123,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "prototyping\n",
- "note: the way it is given in textbook is not possible in python. We have to \n",
- "define a funciton first in order to call it\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def printMessage():\n",
" print \"Hello world!\"\n",
@@ -167,10 +155,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "local variables\n",
- "note: program will give an error saying local variable time is not defined\n",
- "\"\"\"\n",
"\n",
"def printMessage():\n",
" times += 1\n",
@@ -231,9 +215,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "local variables\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def printMessage():\n",
" times = 0\n",
@@ -322,9 +304,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "global variables\n",
- "\"\"\"\n",
+ "\n",
"\n",
"times = 0\n",
"def printMessage():\n",
@@ -430,11 +410,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "static local variables\n",
- "note: there is no static keyword in python so we will use it as global variable\n",
- "only.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"times = 0\n",
"def printMessage():\n",
@@ -540,9 +516,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "sending info. to a function\n",
- "\"\"\"\n",
"\n",
"def printMessage():\n",
" print \"You inputted \", str\n",
@@ -591,9 +564,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "passing argument by value\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def printMessage(s):\n",
" print \"You inputted \", s\n",
@@ -642,9 +613,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "multiple function arguments\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def printMessage(firstName, lastName):\n",
" print \"Your name is \", firstName, \" \", lastName\n",
@@ -710,12 +679,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "multiple function arguments\n",
- "note: in Python even if the arguments are reversed, it won't give an error as \n",
- "we do not have to specipy the data type explicitly. The meaning or the context\n",
- "of the output may change.\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def printMessage(thename, theage):\n",
" print \"Your name is \", thename, \" and your age is\", theage\n",
@@ -783,9 +747,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "passing argument by reference\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def doubleIt(x):\n",
" print \"The number to be doubled is \", x\n",
@@ -839,12 +801,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "pass by reference (address)\n",
- "note: & sign is used in c++ to access a varibale by its address. There is no\n",
- "such way or it is not a good practice to implement it. We will do the same in \n",
- "some other way(there are multiple ways to achieve the same result)\n",
- "\"\"\"\n",
+ "\n",
"\n",
"li = [0]\n",
"def doubleIt():\n",
@@ -900,10 +857,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "function to add two numbers\n",
- "note: we are doing it in a differnt way then the one given in book\n",
- "\"\"\"\n",
+ "\n",
"\n",
"z = []\n",
"def addNumbers (a, b):\n",
@@ -972,9 +926,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "returning value from function\n",
- "\"\"\"\n",
+ "\n",
"\n",
"def addNumbers(x, y):\n",
" return x + y\n",
diff --git a/C++_from_the_Ground/Chapter_10(1).ipynb b/C++_from_the_Ground/Chapter_10(1).ipynb
index 6196736b..77fa05ce 100644
--- a/C++_from_the_Ground/Chapter_10(1).ipynb
+++ b/C++_from_the_Ground/Chapter_10(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 10"
+ "name": "",
+ "signature": "sha256:369d1716e7a65538ad06381f5a1cdafc97ddfbad9ccd970d060ca5c894a6593b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,141 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 10: Structures and Unions<h1>"
+ "source": [
+ "<h1>Chapter 10: Structures and Unions<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.1, Page Number: 223<h3>"
+ "source": [
+ "<h3>Example 10.1, Page Number: 223<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple inventory prohram that uses an array of structures/ '''\n'''Implementing structures in python'''\n\n\nclass inv_type:\n def __init__(self):\n self.item=None\n self.cost=0\n self.retail=0\n self.on_hand=0\n self.lead_time=0\n\n#Variable declaration\nsize=100 \ninvtry = []*size\ni=5 #User iput for menu selection\n\n#Initialize the array\ndef init_list():\n for t in range(size):\n invtry.append(inv_type())\n \n#get a menu selection\ndef menu():\n global i\n print \"(E)nter\"\n print \"(D)isplay\"\n print \"(U)pdate\"\n print \"(Q)uit\"\n print \"choose one: \"\n i-=1\n return i\n\n#enter items into the list\ndef enter():\n #find the first free structure\n for i in range(size):\n if not(invtry[i].item==None):\n break\n #i will be size if list is full\n if i==size:\n print \"List full.\"\n return\n input(i)\n \n#Input the information\ndef input(i):\n #Enter information; User input\n invtry[i].item=\"Gloves\"\n invtry[i].cost=10\n invtry[i].retail=25\n invtry[i].on_hand=50\n invtry[i].lead_time=10\n \n#Modify an existing item\ndef update():\n name=\"Gloves\" #User input\n for i in range(size):\n if not(name==invtry[i].item):\n break\n if i==size:\n print \"Item not found.\"\n return\n print \"Enter new information.\"\n input(i)\n \n#Display the list\ndef display():\n for t in range(size):\n if not(invtry[t].item==None):\n print invtry[t].item\n print \"Cost: $\",invtry[t].cost\n print \"Retail: $\",invtry[t].retail\n print \"On hand: \",invtry[t].on_hand\n print \"Resupply time: \",invtry[t].lead_time,\" days\"\n \n\ninit_list()\nwhile True:\n choice=menu()\n if choice==4:\n enter()\n elif choice==3:\n display()\n elif choice==2:\n update()\n elif choice==1:\n break",
+ "input": [
+ "\n",
+ "class inv_type:\n",
+ " def __init__(self):\n",
+ " self.item=None\n",
+ " self.cost=0\n",
+ " self.retail=0\n",
+ " self.on_hand=0\n",
+ " self.lead_time=0\n",
+ "\n",
+ "#Variable declaration\n",
+ "size=100 \n",
+ "invtry = []*size\n",
+ "i=5 #User iput for menu selection\n",
+ "\n",
+ "#Initialize the array\n",
+ "def init_list():\n",
+ " for t in range(size):\n",
+ " invtry.append(inv_type())\n",
+ " \n",
+ "#get a menu selection\n",
+ "def menu():\n",
+ " global i\n",
+ " print \"(E)nter\"\n",
+ " print \"(D)isplay\"\n",
+ " print \"(U)pdate\"\n",
+ " print \"(Q)uit\"\n",
+ " print \"choose one: \"\n",
+ " i-=1\n",
+ " return i\n",
+ "\n",
+ "#enter items into the list\n",
+ "def enter():\n",
+ " #find the first free structure\n",
+ " for i in range(size):\n",
+ " if not(invtry[i].item==None):\n",
+ " break\n",
+ " #i will be size if list is full\n",
+ " if i==size:\n",
+ " print \"List full.\"\n",
+ " return\n",
+ " input(i)\n",
+ " \n",
+ "#Input the information\n",
+ "def input(i):\n",
+ " #Enter information; User input\n",
+ " invtry[i].item=\"Gloves\"\n",
+ " invtry[i].cost=10\n",
+ " invtry[i].retail=25\n",
+ " invtry[i].on_hand=50\n",
+ " invtry[i].lead_time=10\n",
+ " \n",
+ "#Modify an existing item\n",
+ "def update():\n",
+ " name=\"Gloves\" #User input\n",
+ " for i in range(size):\n",
+ " if not(name==invtry[i].item):\n",
+ " break\n",
+ " if i==size:\n",
+ " print \"Item not found.\"\n",
+ " return\n",
+ " print \"Enter new information.\"\n",
+ " input(i)\n",
+ " \n",
+ "#Display the list\n",
+ "def display():\n",
+ " for t in range(size):\n",
+ " if not(invtry[t].item==None):\n",
+ " print invtry[t].item\n",
+ " print \"Cost: $\",invtry[t].cost\n",
+ " print \"Retail: $\",invtry[t].retail\n",
+ " print \"On hand: \",invtry[t].on_hand\n",
+ " print \"Resupply time: \",invtry[t].lead_time,\" days\"\n",
+ " \n",
+ "\n",
+ "init_list()\n",
+ "while True:\n",
+ " choice=menu()\n",
+ " if choice==4:\n",
+ " enter()\n",
+ " elif choice==3:\n",
+ " display()\n",
+ " elif choice==2:\n",
+ " update()\n",
+ " elif choice==1:\n",
+ " break"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "(E)nter\n(D)isplay\n(U)pdate\n(Q)uit\nchoose one: \n(E)nter\n(D)isplay\n(U)pdate\n(Q)uit\nchoose one: \nGloves\nCost: $ 10\nRetail: $ 25\nOn hand: 50\nResupply time: 10 days\n(E)nter\n(D)isplay\n(U)pdate\n(Q)uit\nchoose one: \nEnter new information.\n(E)nter\n(D)isplay\n(U)pdate\n(Q)uit\nchoose one: \n"
+ "text": [
+ "(E)nter\n",
+ "(D)isplay\n",
+ "(U)pdate\n",
+ "(Q)uit\n",
+ "choose one: \n",
+ "(E)nter\n",
+ "(D)isplay\n",
+ "(U)pdate\n",
+ "(Q)uit\n",
+ "choose one: \n",
+ "Gloves\n",
+ "Cost: $ 10\n",
+ "Retail: $ 25\n",
+ "On hand: 50\n",
+ "Resupply time: 10 days\n",
+ "(E)nter\n",
+ "(D)isplay\n",
+ "(U)pdate\n",
+ "(Q)uit\n",
+ "choose one: \n",
+ "Enter new information.\n",
+ "(E)nter\n",
+ "(D)isplay\n",
+ "(U)pdate\n",
+ "(Q)uit\n",
+ "choose one: \n"
+ ]
}
],
"prompt_number": 11
@@ -35,19 +153,43 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.2, Page Number: 226<h3>"
+ "source": [
+ "<h3>Example 10.2, Page Number: 226<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Pass a structure(class) to a function'''\n\n#Define a structure(class) type\nclass sample:\n a=None\n ch=None\n \ndef f1(parm):\n print parm.a,\" \",parm.ch\n\n#declare arg\narg=sample() \n\n#initialize arg\narg.a=1000\narg.ch='X'\n\n#call function\nf1(arg)\n ",
+ "input": [
+ "\n",
+ "\n",
+ "class sample:\n",
+ " a=None\n",
+ " ch=None\n",
+ " \n",
+ "def f1(parm):\n",
+ " print parm.a,\" \",parm.ch\n",
+ "\n",
+ "#declare arg\n",
+ "arg=sample() \n",
+ "\n",
+ "#initialize arg\n",
+ "arg.a=1000\n",
+ "arg.ch='X'\n",
+ "\n",
+ "#call function\n",
+ "f1(arg)\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1000 X\n"
+ "text": [
+ "1000 X\n"
+ ]
}
],
"prompt_number": 12
@@ -55,19 +197,52 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.3, Page Number: 227<h3>"
+ "source": [
+ "<h3>Example 10.3, Page Number: 227<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate structure assignments.'''\n\nclass stype:\n a=None\n b=None\n\n#Variable declaration\nsvar1=stype()\nsvar2=stype()\n\nsvar1.a=svar1.b=10\nsvar2.a=svar2.b=20\n\nprint \"Structures before assignment.\"\nprint \"svar1: \",svar1.a,' ',svar1.b\nprint \"svar1: \",svar2.a,' ',svar2.b\n\nsvar2=svar1 #assign structures\n\n#Result\nprint \"\\nStructures before assignment.\"\nprint \"svar1: \",svar1.a,' ',svar1.b\nprint \"svar1: \",svar2.a,' ',svar2.b",
+ "input": [
+ "\n",
+ "class stype:\n",
+ " a=None\n",
+ " b=None\n",
+ "\n",
+ "#Variable declaration\n",
+ "svar1=stype()\n",
+ "svar2=stype()\n",
+ "\n",
+ "svar1.a=svar1.b=10\n",
+ "svar2.a=svar2.b=20\n",
+ "\n",
+ "print \"Structures before assignment.\"\n",
+ "print \"svar1: \",svar1.a,' ',svar1.b\n",
+ "print \"svar1: \",svar2.a,' ',svar2.b\n",
+ "\n",
+ "svar2=svar1 #assign structures\n",
+ "\n",
+ "#Result\n",
+ "print \"\\nStructures before assignment.\"\n",
+ "print \"svar1: \",svar1.a,' ',svar1.b\n",
+ "print \"svar1: \",svar2.a,' ',svar2.b"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Structures before assignment.\nsvar1: 10 10\nsvar1: 20 20\n\nStructures before assignment.\nsvar1: 10 10\nsvar1: 10 10\n"
+ "text": [
+ "Structures before assignment.\n",
+ "svar1: 10 10\n",
+ "svar1: 20 20\n",
+ "\n",
+ "Structures before assignment.\n",
+ "svar1: 10 10\n",
+ "svar1: 10 10\n"
+ ]
}
],
"prompt_number": 13
@@ -75,19 +250,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.4, Page Number: 230<h3>"
+ "source": [
+ "<h3>Example 10.4, Page Number: 230<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program displays the current system time.'''\n\nimport datetime\n\ndate=datetime.datetime.now()\n\n#Result\nprint date.time()",
+ "input": [
+ "\n",
+ "\n",
+ "import datetime\n",
+ "\n",
+ "date=datetime.datetime.now()\n",
+ "\n",
+ "#Result\n",
+ "print date.time()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "17:06:28.236000\n"
+ "text": [
+ "17:06:28.236000\n"
+ ]
}
],
"prompt_number": 14
@@ -95,19 +283,31 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.5, Page Number: 231<h3>"
+ "source": [
+ "<h3>Example 10.5, Page Number: 231<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program displays the current system time.'''\n\nimport datetime\n\ndate=datetime.datetime.now()\n\n#Result\nprint date.ctime()",
+ "input": [
+ "\n",
+ "import datetime\n",
+ "\n",
+ "date=datetime.datetime.now()\n",
+ "\n",
+ "#Result\n",
+ "print date.ctime()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Sat Sep 14 17:07:14 2013\n"
+ "text": [
+ "Sat Sep 14 17:07:14 2013\n"
+ ]
}
],
"prompt_number": 15
@@ -115,19 +315,55 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.6, Page Number: 232<h3>"
+ "source": [
+ "<h3>Example 10.6, Page Number: 232<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate a reference to a structure'''\n\nclass mystruct:\n a=None\n b=None\n\n#Recieve and return by reference\ndef f(var):\n var[0].a=var[0].a*var[0].a\n var[0].b=var[0].b/var[0].b\n return var[0]\n \n#Variable declaration\nx=[]\nx.append(mystruct())\ny=mystruct()\n\n#Initializing\nx[0].a=10\nx[0].b=20\n\nprint \"Original x.a and x.b: \",x[0].a,' ',x[0].b\n\ny=f(x) #function call\n\n#Result\nprint \"Modified x.a and x.b: \",x[0].a,' ',x[0].b\nprint \"Modified y.a and y.b: \",y.a,' ',y.b\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class mystruct:\n",
+ " a=None\n",
+ " b=None\n",
+ "\n",
+ "#Recieve and return by reference\n",
+ "def f(var):\n",
+ " var[0].a=var[0].a*var[0].a\n",
+ " var[0].b=var[0].b/var[0].b\n",
+ " return var[0]\n",
+ " \n",
+ "#Variable declaration\n",
+ "x=[]\n",
+ "x.append(mystruct())\n",
+ "y=mystruct()\n",
+ "\n",
+ "#Initializing\n",
+ "x[0].a=10\n",
+ "x[0].b=20\n",
+ "\n",
+ "print \"Original x.a and x.b: \",x[0].a,' ',x[0].b\n",
+ "\n",
+ "y=f(x) #function call\n",
+ "\n",
+ "#Result\n",
+ "print \"Modified x.a and x.b: \",x[0].a,' ',x[0].b\n",
+ "print \"Modified y.a and y.b: \",y.a,' ',y.b\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original x.a and x.b: 10 20\nModified x.a and x.b: 100 1\nModified y.a and y.b: 100 1\n"
+ "text": [
+ "Original x.a and x.b: 10 20\n",
+ "Modified x.a and x.b: 100 1\n",
+ "Modified y.a and y.b: 100 1\n"
+ ]
}
],
"prompt_number": 16
@@ -135,19 +371,61 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.7, Page Number: 239<h3>"
+ "source": [
+ "<h3>Example 10.7, Page Number: 239<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Use a union to exchange the bytes within a short integer'''\n#Class used in place of union \n\nclass swap_bytes:\n ch=[0,0]\n\n#Exchange of bytes\ndef disp_binary(u):\n t=128\n while not(t==0):\n if u&t:\n print \"1 \",\n else:\n print \"0 \",\n t=t/2\n\n#Variable declaration\nsb=swap_bytes()\n\nsb.ch[0]=15\n\nprint \"Original bytes: \",\ndisp_binary(sb.ch[1])\ndisp_binary(sb.ch[0])\n\n#Exchange bytes\ntemp=sb.ch[0]\nsb.ch[0]=sb.ch[1]\nsb.ch[1]=temp\n\n#Result\nprint \"\\nExchanged bytes: \",\ndisp_binary(sb.ch[1])\ndisp_binary(sb.ch[0])\n\n\n ",
+ "input": [
+ "\n",
+ "\n",
+ "class swap_bytes:\n",
+ " ch=[0,0]\n",
+ "\n",
+ "#Exchange of bytes\n",
+ "def disp_binary(u):\n",
+ " t=128\n",
+ " while not(t==0):\n",
+ " if u&t:\n",
+ " print \"1 \",\n",
+ " else:\n",
+ " print \"0 \",\n",
+ " t=t/2\n",
+ "\n",
+ "#Variable declaration\n",
+ "sb=swap_bytes()\n",
+ "\n",
+ "sb.ch[0]=15\n",
+ "\n",
+ "print \"Original bytes: \",\n",
+ "disp_binary(sb.ch[1])\n",
+ "disp_binary(sb.ch[0])\n",
+ "\n",
+ "#Exchange bytes\n",
+ "temp=sb.ch[0]\n",
+ "sb.ch[0]=sb.ch[1]\n",
+ "sb.ch[1]=temp\n",
+ "\n",
+ "#Result\n",
+ "print \"\\nExchanged bytes: \",\n",
+ "disp_binary(sb.ch[1])\n",
+ "disp_binary(sb.ch[0])\n",
+ "\n",
+ "\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original bytes: 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 \nExchanged bytes: 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 \n"
+ "text": [
+ "Original bytes: 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 \n",
+ "Exchanged bytes: 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 \n"
+ ]
}
],
"prompt_number": 17
@@ -155,19 +433,66 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.8, Page Number: 240<h3>"
+ "source": [
+ "<h3>Example 10.8, Page Number: 240<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Display the ASCII code in binary for characters'''\n\n#Variable declaration\nch='a'\n\nwhile True:\n print \"\\n\",ch,\n print bin(ord(ch)) #Display the bit pattern for each character\n ch=chr(ord(ch)+1)\n if ch=='r':\n break",
+ "input": [
+ "\n",
+ "ch='a'\n",
+ "\n",
+ "while True:\n",
+ " print \"\\n\",ch,\n",
+ " print bin(ord(ch)) #Display the bit pattern for each character\n",
+ " ch=chr(ord(ch)+1)\n",
+ " if ch=='r':\n",
+ " break"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\na 0b1100001\n\nb 0b1100010\n\nc 0b1100011\n\nd 0b1100100\n\ne 0b1100101\n\nf 0b1100110\n\ng 0b1100111\n\nh 0b1101000\n\ni 0b1101001\n\nj 0b1101010\n\nk 0b1101011\n\nl 0b1101100\n\nm 0b1101101\n\nn 0b1101110\n\no 0b1101111\n\np 0b1110000\n\nq 0b1110001\n"
+ "text": [
+ "\n",
+ "a 0b1100001\n",
+ "\n",
+ "b 0b1100010\n",
+ "\n",
+ "c 0b1100011\n",
+ "\n",
+ "d 0b1100100\n",
+ "\n",
+ "e 0b1100101\n",
+ "\n",
+ "f 0b1100110\n",
+ "\n",
+ "g 0b1100111\n",
+ "\n",
+ "h 0b1101000\n",
+ "\n",
+ "i 0b1101001\n",
+ "\n",
+ "j 0b1101010\n",
+ "\n",
+ "k 0b1101011\n",
+ "\n",
+ "l 0b1101100\n",
+ "\n",
+ "m 0b1101101\n",
+ "\n",
+ "n 0b1101110\n",
+ "\n",
+ "o 0b1101111\n",
+ "\n",
+ "p 0b1110000\n",
+ "\n",
+ "q 0b1110001\n"
+ ]
}
],
"prompt_number": 18
@@ -175,19 +500,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.9, Page Number: 242<h3>"
+ "source": [
+ "<h3>Example 10.9, Page Number: 242<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of an example of union in python'''\n\n#Variable declaration\nch=['X','Y']\nc=\"\"\ndef disp_bits(u):\n t=128\n global c\n while not(t==0):\n if u&t:\n c=c+\"1\"\n else:\n c=c+\"0\"\n t=t/2 \n return c\n\n#Result\nprint \"union as chars: \",ch[0],ch[1]\nprint \"union as integer: \",\nc= disp_bits(ord(ch[1]))\nc= disp_bits(ord(ch[0]))\nprint int(str(c),2)\n\n\n",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "ch=['X','Y']\n",
+ "c=\"\"\n",
+ "def disp_bits(u):\n",
+ " t=128\n",
+ " global c\n",
+ " while not(t==0):\n",
+ " if u&t:\n",
+ " c=c+\"1\"\n",
+ " else:\n",
+ " c=c+\"0\"\n",
+ " t=t/2 \n",
+ " return c\n",
+ "\n",
+ "#Result\n",
+ "print \"union as chars: \",ch[0],ch[1]\n",
+ "print \"union as integer: \",\n",
+ "c= disp_bits(ord(ch[1]))\n",
+ "c= disp_bits(ord(ch[0]))\n",
+ "print int(str(c),2)\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "union as chars: X Y\nunion as integer: 22872\n"
+ "text": [
+ "union as chars: X Y\n",
+ "union as integer: 22872\n"
+ ]
}
],
"prompt_number": 19
@@ -195,7 +549,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_11(1).ipynb b/C++_from_the_Ground/Chapter_11(1).ipynb
index b59e52c7..fdd70bcf 100644
--- a/C++_from_the_Ground/Chapter_11(1).ipynb
+++ b/C++_from_the_Ground/Chapter_11(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 11"
+ "name": "",
+ "signature": "sha256:5428ee61d548a6c3eefd868dac96cac83b29f85d9bfd7876e9904bdfe87b0fad"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,78 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 11: Introducing the Class<h1>"
+ "source": [
+ "<h1>Chapter 11: Introducing the Class<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.1, Page Number: 249<h3>"
+ "source": [
+ "<h3>Example 11.1, Page Number: 249<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Illustration of a class in python'''\n\n#This creates the class queue\nclass queue:\n #Initialize the queue \n def __init__(self):\n self.__sloc=0\n self.__rloc=-1\n self.__q=[]\n \n #Put an integer into the queue\n def qput(self,i):\n if self.__sloc==100:\n print \"Queue is full.\"\n return\n self.__sloc+=1\n self.__q.append(i)\n \n #Get an integer from the queue\n def qget(self):\n if self.__rloc==self.__sloc:\n print \"Queue underflow\"\n return\n self.__rloc+=1\n return self.__q[self.__rloc] \n \n\n \n#Create two queue objects\nb=queue()\na=queue()\n\na.qput(10)\nb.qput(19)\n\na.qput(20)\nb.qput(1)\n\n#Result\nprint \"Contents of queue a: \",\nprint a.qget(),' ',a.qget()\n\nprint \"Contents of queue b: \",\nprint b.qget(),' ',b.qget()\n\n\n \n",
+ "input": [
+ "\n",
+ "\n",
+ "class queue:\n",
+ " #Initialize the queue \n",
+ " def __init__(self):\n",
+ " self.__sloc=0\n",
+ " self.__rloc=-1\n",
+ " self.__q=[]\n",
+ " \n",
+ " #Put an integer into the queue\n",
+ " def qput(self,i):\n",
+ " if self.__sloc==100:\n",
+ " print \"Queue is full.\"\n",
+ " return\n",
+ " self.__sloc+=1\n",
+ " self.__q.append(i)\n",
+ " \n",
+ " #Get an integer from the queue\n",
+ " def qget(self):\n",
+ " if self.__rloc==self.__sloc:\n",
+ " print \"Queue underflow\"\n",
+ " return\n",
+ " self.__rloc+=1\n",
+ " return self.__q[self.__rloc] \n",
+ " \n",
+ "\n",
+ " \n",
+ "#Create two queue objects\n",
+ "b=queue()\n",
+ "a=queue()\n",
+ "\n",
+ "a.qput(10)\n",
+ "b.qput(19)\n",
+ "\n",
+ "a.qput(20)\n",
+ "b.qput(1)\n",
+ "\n",
+ "#Result\n",
+ "print \"Contents of queue a: \",\n",
+ "print a.qget(),' ',a.qget()\n",
+ "\n",
+ "print \"Contents of queue b: \",\n",
+ "print b.qget(),' ',b.qget()\n",
+ "\n",
+ "\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Contents of queue a: 10 20\nContents of queue b: 19 1\n"
+ "text": [
+ "Contents of queue a: 10 20\n",
+ "Contents of queue b: 19 1\n"
+ ]
}
],
"prompt_number": 3
@@ -35,19 +90,56 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.2, Page Number: 250<h3>"
+ "source": [
+ "<h3>Example 11.2, Page Number: 250<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate class member access'''\n \nclass myclass:\n def __init__(self):\n self.__a=None #private member\n self.b=None #public member\n #public functions\n def setlab(self,i):\n self.__a=i #refer to a\n self.b=i*i #refer to b\n return\n def geta(self):\n return self.__a #refer to a\n def reset(self):\n #call setlab using self\n self.setlab(0) #the object is already known\n \n \nob=myclass()\nob.setlab(5) #set ob.a and ob.b\nprint \"ob after setlab(5): \",ob.geta(),' ',\nprint ob.b #can access b because it is public\n\nob.b=20 #can access b because it is public\nprint \"ob after ob.b=20: \",\nprint ob.geta(),' ',ob.b\n\nob.reset()\nprint \"ob after ob.reset(): \",ob.geta(),' ',ob.b\n\n",
+ "input": [
+ "\n",
+ " \n",
+ "class myclass:\n",
+ " def __init__(self):\n",
+ " self.__a=None #private member\n",
+ " self.b=None #public member\n",
+ " #public functions\n",
+ " def setlab(self,i):\n",
+ " self.__a=i #refer to a\n",
+ " self.b=i*i #refer to b\n",
+ " return\n",
+ " def geta(self):\n",
+ " return self.__a #refer to a\n",
+ " def reset(self):\n",
+ " #call setlab using self\n",
+ " self.setlab(0) #the object is already known\n",
+ " \n",
+ " \n",
+ "ob=myclass()\n",
+ "ob.setlab(5) #set ob.a and ob.b\n",
+ "print \"ob after setlab(5): \",ob.geta(),' ',\n",
+ "print ob.b #can access b because it is public\n",
+ "\n",
+ "ob.b=20 #can access b because it is public\n",
+ "print \"ob after ob.b=20: \",\n",
+ "print ob.geta(),' ',ob.b\n",
+ "\n",
+ "ob.reset()\n",
+ "print \"ob after ob.reset(): \",ob.geta(),' ',ob.b\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "ob after setlab(5): 5 25\nob after ob.b=20: 5 20\nob after ob.reset(): 0 0\n"
+ "text": [
+ "ob after setlab(5): 5 25\n",
+ "ob after ob.b=20: 5 20\n",
+ "ob after ob.reset(): 0 0\n"
+ ]
}
],
"prompt_number": 4
@@ -55,19 +147,74 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.3, Page Number: 254<h3>"
+ "source": [
+ "<h3>Example 11.3, Page Number: 254<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate a constructor and a destructor'''\n#The destructors of python behave a little differently.\n\n#This creates the class queue\nclass queue:\n \n #Constructor\n def __init__(self): \n self.__q=[]\n self.__rloc=-1\n self.__sloc=0\n print \"Queue initialized\"\n \n #Destructor\n def __del__(self):\n print (\"Queue destroyed\")\n \n #Put an integer into the queue\n def qput(self,i):\n if self.__sloc == 100:\n print \"Queue is full\"\n return \n self.__sloc+=1\n self.__q.append(i)\n \n #Get an integer from the queue\n def qget(self):\n if self.__rloc==self.__sloc:\n print \"Queue underflow\"\n return\n self.__rloc+=1\n return self.__q[self.__rloc]\n \n#Create two queue objects\na=queue()\n\n\na.qput(10)\na.qput(20)\nb=queue()\nb.qput(19)\n\nb.qput(1)\n\n#Result\nprint a.qget(),' ',\nprint a.qget(),' ',\nprint b.qget(),' ',\nprint b.qget(),' '\n",
+ "input": [
+ "\n",
+ "class queue:\n",
+ " \n",
+ " #Constructor\n",
+ " def __init__(self): \n",
+ " self.__q=[]\n",
+ " self.__rloc=-1\n",
+ " self.__sloc=0\n",
+ " print \"Queue initialized\"\n",
+ " \n",
+ " #Destructor\n",
+ " def __del__(self):\n",
+ " print (\"Queue destroyed\")\n",
+ " \n",
+ " #Put an integer into the queue\n",
+ " def qput(self,i):\n",
+ " if self.__sloc == 100:\n",
+ " print \"Queue is full\"\n",
+ " return \n",
+ " self.__sloc+=1\n",
+ " self.__q.append(i)\n",
+ " \n",
+ " #Get an integer from the queue\n",
+ " def qget(self):\n",
+ " if self.__rloc==self.__sloc:\n",
+ " print \"Queue underflow\"\n",
+ " return\n",
+ " self.__rloc+=1\n",
+ " return self.__q[self.__rloc]\n",
+ " \n",
+ "#Create two queue objects\n",
+ "a=queue()\n",
+ "\n",
+ "\n",
+ "a.qput(10)\n",
+ "a.qput(20)\n",
+ "b=queue()\n",
+ "b.qput(19)\n",
+ "\n",
+ "b.qput(1)\n",
+ "\n",
+ "#Result\n",
+ "print a.qget(),' ',\n",
+ "print a.qget(),' ',\n",
+ "print b.qget(),' ',\n",
+ "print b.qget(),' '\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Queue initialized\nQueue destroyed\nQueue initialized\nQueue destroyed\n10 20 19 1 \n"
+ "text": [
+ "Queue initialized\n",
+ "Queue destroyed\n",
+ "Queue initialized\n",
+ "Queue destroyed\n",
+ "10 20 19 1 \n"
+ ]
}
],
"prompt_number": 2
@@ -75,19 +222,74 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.4, Page Number: 257<h3>"
+ "source": [
+ "<h3>Example 11.4, Page Number: 257<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Parameterized Constructors'''\n\n#This creates the class queue\nclass queue: \n \n #Constructor\n def __init__(self,i): \n self.__q=[]\n self.__rloc=-1\n self.__sloc=0\n self.__who=i\n print \"Queue \",self.__who,\" initialized.\"\n \n #Destructor\n def __del__():\n print \"Queue \",self.__who,\" destroyed\"\n \n #Put an integer into the queue\n def qput(self,i):\n if self.__sloc == 100:\n print \"Queue is full\"\n return \n self.__sloc+=1\n self.__q.append(i)\n \n #Get an integer from the queue\n def qget(self):\n if self.__rloc==self.__sloc:\n print \"Queue underflow\"\n return\n self.__rloc+=1\n return self.__q[self.__rloc]\n \na=queue(1)\nb=queue(2)\n\na.qput(10)\nb.qput(19)\n\na.qput(20)\nb.qput(1)\n\n#Result\nprint a.qget(),' ',\nprint a.qget(),' ',\nprint b.qget(),' ',\nprint b.qget(),' '\n",
+ "input": [
+ "\n",
+ "\n",
+ "class queue: \n",
+ " \n",
+ " #Constructor\n",
+ " def __init__(self,i): \n",
+ " self.__q=[]\n",
+ " self.__rloc=-1\n",
+ " self.__sloc=0\n",
+ " self.__who=i\n",
+ " print \"Queue \",self.__who,\" initialized.\"\n",
+ " \n",
+ " #Destructor\n",
+ " def __del__():\n",
+ " print \"Queue \",self.__who,\" destroyed\"\n",
+ " \n",
+ " #Put an integer into the queue\n",
+ " def qput(self,i):\n",
+ " if self.__sloc == 100:\n",
+ " print \"Queue is full\"\n",
+ " return \n",
+ " self.__sloc+=1\n",
+ " self.__q.append(i)\n",
+ " \n",
+ " #Get an integer from the queue\n",
+ " def qget(self):\n",
+ " if self.__rloc==self.__sloc:\n",
+ " print \"Queue underflow\"\n",
+ " return\n",
+ " self.__rloc+=1\n",
+ " return self.__q[self.__rloc]\n",
+ " \n",
+ "a=queue(1)\n",
+ "b=queue(2)\n",
+ "\n",
+ "a.qput(10)\n",
+ "b.qput(19)\n",
+ "\n",
+ "a.qput(20)\n",
+ "b.qput(1)\n",
+ "\n",
+ "#Result\n",
+ "print a.qget(),' ',\n",
+ "print a.qget(),' ',\n",
+ "print b.qget(),' ',\n",
+ "print b.qget(),' '\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Queue 1 initialized.\nQueue destroyed\nQueue 2 initialized.\nQueue destroyed\n10 20 19 1 \n"
+ "text": [
+ "Queue 1 initialized.\n",
+ "Queue destroyed\n",
+ "Queue 2 initialized.\n",
+ "Queue destroyed\n",
+ "10 20 19 1 \n"
+ ]
}
],
"prompt_number": 3
@@ -95,19 +297,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.5, Page Number: 258<h3>"
+ "source": [
+ "<h3>Example 11.5, Page Number: 258<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Passing more than a single arguments'''\nclass widget:\n \n #Pass two arguments to the constructor\n def __init__(self,a,b):\n self.__i=a\n self.__j=b\n \n def put_widget(self):\n print self.__i,\" \",self.__j\n\n#Initializing\nx=widget(10,20)\ny=widget(0,0)\n\nx.put_widget()\ny.put_widget()\n\n ",
+ "input": [
+ "\n",
+ "class widget:\n",
+ " \n",
+ " #Pass two arguments to the constructor\n",
+ " def __init__(self,a,b):\n",
+ " self.__i=a\n",
+ " self.__j=b\n",
+ " \n",
+ " def put_widget(self):\n",
+ " print self.__i,\" \",self.__j\n",
+ "\n",
+ "#Initializing\n",
+ "x=widget(10,20)\n",
+ "y=widget(0,0)\n",
+ "\n",
+ "x.put_widget()\n",
+ "y.put_widget()\n",
+ "\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 20\n0 0\n"
+ "text": [
+ "10 20\n",
+ "0 0\n"
+ ]
}
],
"prompt_number": 5
@@ -115,19 +342,40 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.6, Page Number: 259<h3>"
+ "source": [
+ "<h3>Example 11.6, Page Number: 259<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example of class'''\n\nclass myclass:\n \n #Constructor\n def __init__(self,x):\n self.a=x\n #To get the vale of a\n def get_a(self):\n return self.a\n\n#Initializing\nob=myclass(4)\n\n#Result\nprint ob.get_a()",
+ "input": [
+ "\n",
+ "\n",
+ "class myclass:\n",
+ " \n",
+ " #Constructor\n",
+ " def __init__(self,x):\n",
+ " self.a=x\n",
+ " #To get the vale of a\n",
+ " def get_a(self):\n",
+ " return self.a\n",
+ "\n",
+ "#Initializing\n",
+ "ob=myclass(4)\n",
+ "\n",
+ "#Result\n",
+ "print ob.get_a()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
}
],
"prompt_number": 1
@@ -135,19 +383,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.7, Page Number: 260<h3>"
+ "source": [
+ "<h3>Example 11.7, Page Number: 260<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using structures to create a class'''\n\nfrom ctypes import *\n\nclass c1(Structure):\n _fields_=[(\"__i\", c_int)] #private member\n def get_i(self): #public finctions\n return self.__i\n def put_i(self,j):\n self.__i=j\n\n#Variable declaration\ns=c1()\n\ns.put_i(10)\n\n#Result\nprint s.get_i()\n \n ",
+ "input": [
+ "\n",
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "class c1(Structure):\n",
+ " _fields_=[(\"__i\", c_int)] #private member\n",
+ " def get_i(self): #public finctions\n",
+ " return self.__i\n",
+ " def put_i(self,j):\n",
+ " self.__i=j\n",
+ "\n",
+ "#Variable declaration\n",
+ "s=c1()\n",
+ "\n",
+ "s.put_i(10)\n",
+ "\n",
+ "#Result\n",
+ "print s.get_i()\n",
+ " \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
}
],
"prompt_number": 1
@@ -155,19 +428,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.8, Page Number: 261<h3>"
+ "source": [
+ "<h3>Example 11.8, Page Number: 261<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Now we use class instead'''\n\nclass c1:\n def __init__(self):\n self.__i=None #private member\n def get_i(self): #public finctions\n return self.__i\n def put_i(self,j):\n self.__i=j\n\n#Variable declaration\ns=c1()\n\ns.put_i(10)\n\n#Result\nprint s.get_i()\n \n ",
+ "input": [
+ "\n",
+ "class c1:\n",
+ " def __init__(self):\n",
+ " self.__i=None #private member\n",
+ " def get_i(self): #public finctions\n",
+ " return self.__i\n",
+ " def put_i(self,j):\n",
+ " self.__i=j\n",
+ "\n",
+ "#Variable declaration\n",
+ "s=c1()\n",
+ "\n",
+ "s.put_i(10)\n",
+ "\n",
+ "#Result\n",
+ "print s.get_i()\n",
+ " \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
}
],
"prompt_number": 2
@@ -175,19 +471,47 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.9, Page Number: 263<h3> "
+ "source": [
+ "<h3>Example 11.9, Page Number: 263<h3> "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Create a union-based class'''\n\nfrom ctypes import *\n\n#Creates a union\nclass u_type(Union):\n _fields_ = [(\"i\",c_short),\n (\"ch\", c_char*2)]\n #Constructor\n def __init__(self,a):\n self.i=a\n \n #Show the characters that comprise a short int.\n def showchars(self):\n print self.ch[0]\n print self.ch[1]\n \n \nu=u_type(1000)\n\n#Displays char of 1000\nu.showchars()",
+ "input": [
+ "\n",
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Creates a union\n",
+ "class u_type(Union):\n",
+ " _fields_ = [(\"i\",c_short),\n",
+ " (\"ch\", c_char*2)]\n",
+ " #Constructor\n",
+ " def __init__(self,a):\n",
+ " self.i=a\n",
+ " \n",
+ " #Show the characters that comprise a short int.\n",
+ " def showchars(self):\n",
+ " print self.ch[0]\n",
+ " print self.ch[1]\n",
+ " \n",
+ " \n",
+ "u=u_type(1000)\n",
+ "\n",
+ "#Displays char of 1000\n",
+ "u.showchars()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ufffd\n\u0003\n"
+ "text": [
+ "\ufffd\n",
+ "\u0003\n"
+ ]
}
],
"prompt_number": 2
@@ -195,19 +519,40 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.10, Page Number: 264<h3> "
+ "source": [
+ "<h3>Example 11.10, Page Number: 264<h3> "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple class program'''\n#There is no inline function in python\n\nclass c1:\n def __init__(self):\n self.__i=None\n def get_i(self):\n return self.i\n def put_i(self,j):\n self.i=j\n\n#Variable declaration\ns=c1()\n\ns.put_i(10)\n\n#Result\nprint s.get_i()",
+ "input": [
+ "\n",
+ "class c1:\n",
+ " def __init__(self):\n",
+ " self.__i=None\n",
+ " def get_i(self):\n",
+ " return self.i\n",
+ " def put_i(self,j):\n",
+ " self.i=j\n",
+ "\n",
+ "#Variable declaration\n",
+ "s=c1()\n",
+ "\n",
+ "s.put_i(10)\n",
+ "\n",
+ "#Result\n",
+ "print s.get_i()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
}
],
"prompt_number": 2
@@ -215,19 +560,41 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.11, Page Number: 265<h3> "
+ "source": [
+ "<h3>Example 11.11, Page Number: 265<h3> "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple class program'''\n#There is no inline functions in python\n\nclass c1:\n def __init__(self):\n self.__i=None\n def get_i(self):\n return self.i\n def put_i(self,j):\n self.i=j\n\n#Variable declaration\ns=c1()\n\ns.put_i(10)\n\n#Result\nprint s.get_i()",
+ "input": [
+ "\n",
+ "\n",
+ "class c1:\n",
+ " def __init__(self):\n",
+ " self.__i=None\n",
+ " def get_i(self):\n",
+ " return self.i\n",
+ " def put_i(self,j):\n",
+ " self.i=j\n",
+ "\n",
+ "#Variable declaration\n",
+ "s=c1()\n",
+ "\n",
+ "s.put_i(10)\n",
+ "\n",
+ "#Result\n",
+ "print s.get_i()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
}
],
"prompt_number": 3
@@ -235,19 +602,70 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.12, Page Number: 267<h3> "
+ "source": [
+ "<h3>Example 11.12, Page Number: 267<h3> "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example of arrays of objects'''\n\nclass display:\n def __init__(self):\n width=None\n height=None\n res=None\n def set_dim(self,w,h):\n self.width=w\n self.height=h\n def get_dim(self):\n return self.width,self.height\n def set_res(self,r):\n self.res=r\n def get_res(self):\n return self.res\n \n#Variable decleration\nnames=[\"low\",\"medium\",\"high\"] \n(low,medium,high)=(0,1,2) #For enumeration type\nw=None\nh=None\ndisplay_mode=[]*3\n\nfor i in range(3):\n display_mode.append(display())\n\n#Initialize the array of objects using member functions\ndisplay_mode[0].set_res(low)\ndisplay_mode[0].set_dim(640,480)\n\ndisplay_mode[1].set_res(medium)\ndisplay_mode[1].set_dim(800,600)\n\ndisplay_mode[2].set_res(high)\ndisplay_mode[2].set_dim(1600,1200)\n\n#Result\nprint \"Available display modes: \"\nfor i in range(3):\n print names[display_mode[i].get_res()],\" : \",\n w,h=display_mode[i].get_dim()\n print w,\" by \",h",
+ "input": [
+ "\n",
+ "\n",
+ "class display:\n",
+ " def __init__(self):\n",
+ " width=None\n",
+ " height=None\n",
+ " res=None\n",
+ " def set_dim(self,w,h):\n",
+ " self.width=w\n",
+ " self.height=h\n",
+ " def get_dim(self):\n",
+ " return self.width,self.height\n",
+ " def set_res(self,r):\n",
+ " self.res=r\n",
+ " def get_res(self):\n",
+ " return self.res\n",
+ " \n",
+ "#Variable decleration\n",
+ "names=[\"low\",\"medium\",\"high\"] \n",
+ "(low,medium,high)=(0,1,2) #For enumeration type\n",
+ "w=None\n",
+ "h=None\n",
+ "display_mode=[]*3\n",
+ "\n",
+ "for i in range(3):\n",
+ " display_mode.append(display())\n",
+ "\n",
+ "#Initialize the array of objects using member functions\n",
+ "display_mode[0].set_res(low)\n",
+ "display_mode[0].set_dim(640,480)\n",
+ "\n",
+ "display_mode[1].set_res(medium)\n",
+ "display_mode[1].set_dim(800,600)\n",
+ "\n",
+ "display_mode[2].set_res(high)\n",
+ "display_mode[2].set_dim(1600,1200)\n",
+ "\n",
+ "#Result\n",
+ "print \"Available display modes: \"\n",
+ "for i in range(3):\n",
+ " print names[display_mode[i].get_res()],\" : \",\n",
+ " w,h=display_mode[i].get_dim()\n",
+ " print w,\" by \",h"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Available display modes: \nlow : 640 by 480\nmedium : 800 by 600\nhigh : 1600 by 1200\n"
+ "text": [
+ "Available display modes: \n",
+ "low : 640 by 480\n",
+ "medium : 800 by 600\n",
+ "high : 1600 by 1200\n"
+ ]
}
],
"prompt_number": 3
@@ -255,19 +673,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.13, Page Number: 268<h3>"
+ "source": [
+ "<h3>Example 11.13, Page Number: 268<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Initialize an array of objects'''\n\nclass samp:\n __a=None\n def __init__(self,n):\n self.__a=n\n def get_a(self):\n return self.__a\n\n#Initializing the list\nsampArray=[samp(-1),samp(-2),samp(-3),samp(-4)]\n\n#Display\nfor i in range(4):\n print sampArray[i].get_a(),' ',",
+ "input": [
+ "\n",
+ "\n",
+ "class samp:\n",
+ " __a=None\n",
+ " def __init__(self,n):\n",
+ " self.__a=n\n",
+ " def get_a(self):\n",
+ " return self.__a\n",
+ "\n",
+ "#Initializing the list\n",
+ "sampArray=[samp(-1),samp(-2),samp(-3),samp(-4)]\n",
+ "\n",
+ "#Display\n",
+ "for i in range(4):\n",
+ " print sampArray[i].get_a(),' ',"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "-1 -2 -3 -4 \n"
+ "text": [
+ "-1 -2 -3 -4 \n"
+ ]
}
],
"prompt_number": 4
@@ -275,19 +713,56 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.14, Page Number: 269<h3>"
+ "source": [
+ "<h3>Example 11.14, Page Number: 269<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Two dimensional array if objects'''\n\nclass samp:\n __a=None\n __b=None\n def __init__(self,n,m):\n self.__a=n\n self.__b=m\n def get_a(self):\n return self.__a\n def get_b(self):\n return self.__b\n \n#Initializing the list\nsampArray=[[samp(1,2),samp(3,4)],\n [samp(5,6),samp(7,8)],\n [samp(9,10),samp(11,12)],\n [samp(13,14),samp(15,16)]]\n\n#Display\nfor i in range(4):\n print sampArray[i][0].get_a(),' ',\n print sampArray[i][0].get_b()\n print sampArray[i][1].get_a(),' ',\n print sampArray[i][1].get_b()",
+ "input": [
+ "\n",
+ "\n",
+ "class samp:\n",
+ " __a=None\n",
+ " __b=None\n",
+ " def __init__(self,n,m):\n",
+ " self.__a=n\n",
+ " self.__b=m\n",
+ " def get_a(self):\n",
+ " return self.__a\n",
+ " def get_b(self):\n",
+ " return self.__b\n",
+ " \n",
+ "#Initializing the list\n",
+ "sampArray=[[samp(1,2),samp(3,4)],\n",
+ " [samp(5,6),samp(7,8)],\n",
+ " [samp(9,10),samp(11,12)],\n",
+ " [samp(13,14),samp(15,16)]]\n",
+ "\n",
+ "#Display\n",
+ "for i in range(4):\n",
+ " print sampArray[i][0].get_a(),' ',\n",
+ " print sampArray[i][0].get_b()\n",
+ " print sampArray[i][1].get_a(),' ',\n",
+ " print sampArray[i][1].get_b()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 2\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n"
+ "text": [
+ "1 2\n",
+ "3 4\n",
+ "5 6\n",
+ "7 8\n",
+ "9 10\n",
+ "11 12\n",
+ "13 14\n",
+ "15 16\n"
+ ]
}
],
"prompt_number": 5
@@ -295,19 +770,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.15, Page Number: 270<h3>"
+ "source": [
+ "<h3>Example 11.15, Page Number: 270<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple example using an object pointer'''\n\nfrom ctypes import *\n\nclass P_example(Structure):\n __num=None\n def set_num(self,val):\n self.__num=val\n def show_num(self):\n print self.__num\n\n#Variable declaration\nob=P_example() #Declare an object to the structure\np=POINTER(P_example) #Declare a pointer to the structure\n\nob.set_num(1) #access ob directly\nob.show_num()\n\np=ob #assign p the address of ob\np.show_num() #access ob using pointer\n \n ",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "class P_example(Structure):\n",
+ " __num=None\n",
+ " def set_num(self,val):\n",
+ " self.__num=val\n",
+ " def show_num(self):\n",
+ " print self.__num\n",
+ "\n",
+ "#Variable declaration\n",
+ "ob=P_example() #Declare an object to the structure\n",
+ "p=POINTER(P_example) #Declare a pointer to the structure\n",
+ "\n",
+ "ob.set_num(1) #access ob directly\n",
+ "ob.show_num()\n",
+ "\n",
+ "p=ob #assign p the address of ob\n",
+ "p.show_num() #access ob using pointer\n",
+ " \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1\n1\n"
+ "text": [
+ "1\n",
+ "1\n"
+ ]
}
],
"prompt_number": 6
@@ -315,19 +817,47 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.16, Page Number: 271<h3>"
+ "source": [
+ "<h3>Example 11.16, Page Number: 271<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Pointer to array of objects'''\n\nclass P_example(Structure):\n __num=None\n def set_num(self,val):\n self.__num=val\n def show_num(self):\n print self.__num\n \n#Variable declaration\nob=[P_example(),P_example()] #Declare an object to the structure\np=POINTER(P_example) #Declare a pointer to the structure\n\nob[0].set_num(10) #access objects directly\nob[1].set_num(20)\n\np=ob #obtain pointer to first element\np[0].show_num() #access ob using pointer\n\np[1].show_num()\n\np[0].show_num()\n",
+ "input": [
+ "\n",
+ "class P_example(Structure):\n",
+ " __num=None\n",
+ " def set_num(self,val):\n",
+ " self.__num=val\n",
+ " def show_num(self):\n",
+ " print self.__num\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob=[P_example(),P_example()] #Declare an object to the structure\n",
+ "p=POINTER(P_example) #Declare a pointer to the structure\n",
+ "\n",
+ "ob[0].set_num(10) #access objects directly\n",
+ "ob[1].set_num(20)\n",
+ "\n",
+ "p=ob #obtain pointer to first element\n",
+ "p[0].show_num() #access ob using pointer\n",
+ "\n",
+ "p[1].show_num()\n",
+ "\n",
+ "p[0].show_num()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n20\n10\n"
+ "text": [
+ "10\n",
+ "20\n",
+ "10\n"
+ ]
}
],
"prompt_number": 7
@@ -335,7 +865,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_12(1).ipynb b/C++_from_the_Ground/Chapter_12(1).ipynb
index abad8d81..f92ff06c 100644
--- a/C++_from_the_Ground/Chapter_12(1).ipynb
+++ b/C++_from_the_Ground/Chapter_12(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 12"
+ "name": "",
+ "signature": "sha256:16b30eb675083837fc31b76aa8f3c6bd5549baef25d739f4f8bead7d865cbcbf"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,51 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 12: A Closer Look at Classes<h1>"
+ "source": [
+ "<h1>Chapter 12: A Closer Look at Classes<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.1, Page Number: 274<h3>"
+ "source": [
+ "<h3>Example 12.1, Page Number: 274<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of friend functions in python'''\n\nclass myclass:\n __a=None\n __b=None\n def __init__(self,i,j):\n self.__a=i\n self.__b=j\n def sum(self,x): #Friend function\n return sum1(x)\n \ndef sum1(x): \n return x._myclass__a +x._myclass__b #accessing private members\n\n#Variable declaration\nn=myclass(3,4)\n\n#Result\nprint n.sum(n)\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class myclass:\n",
+ " __a=None\n",
+ " __b=None\n",
+ " def __init__(self,i,j):\n",
+ " self.__a=i\n",
+ " self.__b=j\n",
+ " def sum(self,x): #Friend function\n",
+ " return sum1(x)\n",
+ " \n",
+ "def sum1(x): \n",
+ " return x._myclass__a +x._myclass__b #accessing private members\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=myclass(3,4)\n",
+ "\n",
+ "#Result\n",
+ "print n.sum(n)\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +63,65 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.2, Page Number: 275<h3>"
+ "source": [
+ "<h3>Example 12.2, Page Number: 275<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Use a friend function'''\n\nclass c1:\n __status=None\n def set_status(self,state):\n self.__status=state\n \nclass c2:\n __status=None\n def set_status(self,state):\n self.status=state\n \n#Friend function \ndef idle(a,b):\n if a._c1__status or b._c2__status :\n return 0\n else:\n return 1\n \n#variable declarations\ndef IDLE(): #Constants\n return 0\ndef INUSE():\n return 1\nx=c1()\ny=c2()\n\nx.set_status(IDLE())\ny.set_status(IDLE())\n\nif idle(x,y):\n print \"Screen Can Be Used.\"\n \nx.set_status(INUSE())\n\nif idle(x,y):\n print \"Screen Can Be Used.\"\nelse:\n print \"Pop-up In Use.\"\n \n ",
+ "input": [
+ "\n",
+ "class c1:\n",
+ " __status=None\n",
+ " def set_status(self,state):\n",
+ " self.__status=state\n",
+ " \n",
+ "class c2:\n",
+ " __status=None\n",
+ " def set_status(self,state):\n",
+ " self.status=state\n",
+ " \n",
+ "#Friend function \n",
+ "def idle(a,b):\n",
+ " if a._c1__status or b._c2__status :\n",
+ " return 0\n",
+ " else:\n",
+ " return 1\n",
+ " \n",
+ "#variable declarations\n",
+ "def IDLE(): #Constants\n",
+ " return 0\n",
+ "def INUSE():\n",
+ " return 1\n",
+ "x=c1()\n",
+ "y=c2()\n",
+ "\n",
+ "x.set_status(IDLE())\n",
+ "y.set_status(IDLE())\n",
+ "\n",
+ "if idle(x,y):\n",
+ " print \"Screen Can Be Used.\"\n",
+ " \n",
+ "x.set_status(INUSE())\n",
+ "\n",
+ "if idle(x,y):\n",
+ " print \"Screen Can Be Used.\"\n",
+ "else:\n",
+ " print \"Pop-up In Use.\"\n",
+ " \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Screen Can Be Used.\nPop-up In Use.\n"
+ "text": [
+ "Screen Can Be Used.\n",
+ "Pop-up In Use.\n"
+ ]
}
],
"prompt_number": 2
@@ -55,19 +129,64 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.3, Page Number: 277<h3>"
+ "source": [
+ "<h3>Example 12.3, Page Number: 277<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A function can be member of one class and a friend of another'''\n\n #Constants\ndef IDLE(): \n return 0\ndef INUSE():\n return 1\n\nclass c1:\n __status=None\n def set_status(self,state):\n self.__status=state\n def idle(self,b): #now a member of c1\n if self.__status or b._c2__status :\n return 0\n else:\n return 1\n \nclass c2:\n __status=None #IDLE if off INUSE if on screen\n def set_status(self,state):\n self.status=state\n \n#Variable declarations \nx=c1()\ny=c2()\n\nx.set_status(IDLE())\ny.set_status(IDLE())\n\nif idle(x,y):\n print \"Screen Can Be Used.\"\n \nx.set_status(INUSE())\n\nif idle(x,y):\n print \"Screen Can Be Used.\"\nelse:\n print \"Pop-up In Use.\"\n ",
+ "input": [
+ "\n",
+ "\n",
+ "def IDLE(): \n",
+ " return 0\n",
+ "def INUSE():\n",
+ " return 1\n",
+ "\n",
+ "class c1:\n",
+ " __status=None\n",
+ " def set_status(self,state):\n",
+ " self.__status=state\n",
+ " def idle(self,b): #now a member of c1\n",
+ " if self.__status or b._c2__status :\n",
+ " return 0\n",
+ " else:\n",
+ " return 1\n",
+ " \n",
+ "class c2:\n",
+ " __status=None #IDLE if off INUSE if on screen\n",
+ " def set_status(self,state):\n",
+ " self.status=state\n",
+ " \n",
+ "#Variable declarations \n",
+ "x=c1()\n",
+ "y=c2()\n",
+ "\n",
+ "x.set_status(IDLE())\n",
+ "y.set_status(IDLE())\n",
+ "\n",
+ "if idle(x,y):\n",
+ " print \"Screen Can Be Used.\"\n",
+ " \n",
+ "x.set_status(INUSE())\n",
+ "\n",
+ "if idle(x,y):\n",
+ " print \"Screen Can Be Used.\"\n",
+ "else:\n",
+ " print \"Pop-up In Use.\"\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Screen Can Be Used.\nPop-up In Use.\n"
+ "text": [
+ "Screen Can Be Used.\n",
+ "Pop-up In Use.\n"
+ ]
}
],
"prompt_number": 4
@@ -75,29 +194,70 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.4, Page Number: 278<h3>"
+ "source": [
+ "<h3>Example 12.4, Page Number: 278<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Use of overloaded constructors'''\n#Printing the time passed since the functon started instead of ringing the bell.\n\nimport time,string\n\nclass timer:\n __seconds=None\n \n def __init__(self,t1,t2=None):\n if t2==None:\n if isinstance(t1,int): #seconds specified as an integer\n self.__seconds=t1\n else: #seconds specified as a string\n self.__seconds=string.atoi(t1)\n else: #time in minutes and seconds\n self.__seconds=t1*60+t2\n \n def run(self):\n t1=time.clock()\n while (time.clock()-t1)<self.__seconds:\n a=10\n print time.clock()-t1\n \n \na=timer(10)\nb=timer(\"20\")\nc=timer(1,10)\na.run() #count 10 seconds\nb.run() #count 20 seconds\nc.run() #count 1 minute,10 seconds\n ",
+ "input": [
+ "\n",
+ "\n",
+ "import time,string\n",
+ "\n",
+ "class timer:\n",
+ " __seconds=None\n",
+ " \n",
+ " def __init__(self,t1,t2=None):\n",
+ " if t2==None:\n",
+ " if isinstance(t1,int): #seconds specified as an integer\n",
+ " self.__seconds=t1\n",
+ " else: #seconds specified as a string\n",
+ " self.__seconds=string.atoi(t1)\n",
+ " else: #time in minutes and seconds\n",
+ " self.__seconds=t1*60+t2\n",
+ " \n",
+ " def run(self):\n",
+ " t1=time.clock()\n",
+ " while (time.clock()-t1)<self.__seconds:\n",
+ " a=10\n",
+ " print time.clock()-t1\n",
+ " \n",
+ " \n",
+ "a=timer(10)\n",
+ "b=timer(\"20\")\n",
+ "c=timer(1,10)\n",
+ "a.run() #count 10 seconds\n",
+ "b.run() #count 20 seconds\n",
+ "c.run() #count 1 minute,10 seconds\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10.0000009774\n20.0000009774"
+ "text": [
+ "10.0000009774\n",
+ "20.0000009774"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n70.0000004887"
+ "text": [
+ "\n",
+ "70.0000004887"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 1
@@ -105,29 +265,77 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.5, Page Number: 280<h3>"
+ "source": [
+ "<h3>Example 12.5, Page Number: 280<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstarate dynamic initialization'''\n#Printing the time passed since the functon started instead of ringing the bell.\n\nimport time,string\n\nclass timer:\n __seconds=None\n \n def __init__(self,t1,t2=None):\n if t2==None:\n if isinstance(t1,int): #seconds specified as an integer\n self.__seconds=t1\n else: #seconds specified as a string\n self.__seconds=string.atoi(t1)\n else: #time in minutes and seconds\n self.__seconds=t1*60+t2\n \n def run(self):\n t1=time.clock()\n while (time.clock()-t1)<self.__seconds:\n a=10\n print time.clock()-t1\n \na=timer(10)\na.run()\n\nprint \"Enter number of seconds: \"\nstr=\"20\"\nb=timer(str) #initialize at the run time\nc.run()\n\nprint \"Enter minutes and seconds: \"\nmin=1\nsec=10\nc=timer(min,sec) #initialize at the run time\nc.run()\n ",
+ "input": [
+ "\n",
+ "import time,string\n",
+ "\n",
+ "class timer:\n",
+ " __seconds=None\n",
+ " \n",
+ " def __init__(self,t1,t2=None):\n",
+ " if t2==None:\n",
+ " if isinstance(t1,int): #seconds specified as an integer\n",
+ " self.__seconds=t1\n",
+ " else: #seconds specified as a string\n",
+ " self.__seconds=string.atoi(t1)\n",
+ " else: #time in minutes and seconds\n",
+ " self.__seconds=t1*60+t2\n",
+ " \n",
+ " def run(self):\n",
+ " t1=time.clock()\n",
+ " while (time.clock()-t1)<self.__seconds:\n",
+ " a=10\n",
+ " print time.clock()-t1\n",
+ " \n",
+ "a=timer(10)\n",
+ "a.run()\n",
+ "\n",
+ "print \"Enter number of seconds: \"\n",
+ "str=\"20\"\n",
+ "b=timer(str) #initialize at the run time\n",
+ "c.run()\n",
+ "\n",
+ "print \"Enter minutes and seconds: \"\n",
+ "min=1\n",
+ "sec=10\n",
+ "c=timer(min,sec) #initialize at the run time\n",
+ "c.run()\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10.0000004887\nEnter number of seconds: \n70.0000009774"
+ "text": [
+ "10.0000004887\n",
+ "Enter number of seconds: \n",
+ "70.0000009774"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\nEnter minutes and seconds: \n70.0000009774"
+ "text": [
+ "\n",
+ "Enter minutes and seconds: \n",
+ "70.0000009774"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -135,19 +343,66 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.6, Page Number: 282<h3>"
+ "source": [
+ "<h3>Example 12.6, Page Number: 282<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate object assignment'''\n\nclass myclass:\n __a=None #private members\n __b=None\n def setab(self,i,j): #publc functons\n self.__a=i\n self.__b=j\n def showab(self):\n print \"a is \",self.__a\n print \"b is \",self.__b\n\n#Variable declaration\nob1 = myclass()\nob2 = myclass()\n\n#Intalizing\nob1.setab(10,20)\nob2.setab(0,0)\n\nprint \"ob1 before assignment: \"\nob1.showab()\nprint \"ob2 before assignment: \"\nob2.showab()\n\nob2 = ob1 #assign ob1 to ob2\n\n#Result\nprint \"ob1 after assignment: \"\nob1.showab()\nprint \"ob2 after assignment: \"\nob2.showab()\n",
+ "input": [
+ "\n",
+ "class myclass:\n",
+ " __a=None #private members\n",
+ " __b=None\n",
+ " def setab(self,i,j): #publc functons\n",
+ " self.__a=i\n",
+ " self.__b=j\n",
+ " def showab(self):\n",
+ " print \"a is \",self.__a\n",
+ " print \"b is \",self.__b\n",
+ "\n",
+ "#Variable declaration\n",
+ "ob1 = myclass()\n",
+ "ob2 = myclass()\n",
+ "\n",
+ "#Intalizing\n",
+ "ob1.setab(10,20)\n",
+ "ob2.setab(0,0)\n",
+ "\n",
+ "print \"ob1 before assignment: \"\n",
+ "ob1.showab()\n",
+ "print \"ob2 before assignment: \"\n",
+ "ob2.showab()\n",
+ "\n",
+ "ob2 = ob1 #assign ob1 to ob2\n",
+ "\n",
+ "#Result\n",
+ "print \"ob1 after assignment: \"\n",
+ "ob1.showab()\n",
+ "print \"ob2 after assignment: \"\n",
+ "ob2.showab()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "ob1 before assignment: \na is 10\nb is 20\nob2 before assignment: \na is 0\nb is 0\nob1 after assignment: \na is 10\nb is 20\nob2 after assignment: \na is 10\nb is 20\n"
+ "text": [
+ "ob1 before assignment: \n",
+ "a is 10\n",
+ "b is 20\n",
+ "ob2 before assignment: \n",
+ "a is 0\n",
+ "b is 0\n",
+ "ob1 after assignment: \n",
+ "a is 10\n",
+ "b is 20\n",
+ "ob2 after assignment: \n",
+ "a is 10\n",
+ "b is 20\n"
+ ]
}
],
"prompt_number": 1
@@ -155,19 +410,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.7, Page Number: 283<h3>"
+ "source": [
+ "<h3>Example 12.7, Page Number: 283<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstration of passing objects to functions'''\n'''Implementing call by value method in python'''\n\nfrom copy import deepcopy\n \nclass OBJ:\n def set_i(self,x):\n self.__i=x\n def out_i(self):\n print self.__i,\n \ndef f(x):\n x=deepcopy(x)\n x.out_i() #outputs 10\n x.set_i(100) #this affects only local copy\n x.out_i() #outputs 100\n \n#Variable declaration\no=OBJ()\no.set_i(10)\nf(o) \no.out_i() #still outputs 10, value of i unchanged\n",
+ "input": [
+ "\n",
+ "from copy import deepcopy\n",
+ " \n",
+ "class OBJ:\n",
+ " def set_i(self,x):\n",
+ " self.__i=x\n",
+ " def out_i(self):\n",
+ " print self.__i,\n",
+ " \n",
+ "def f(x):\n",
+ " x=deepcopy(x)\n",
+ " x.out_i() #outputs 10\n",
+ " x.set_i(100) #this affects only local copy\n",
+ " x.out_i() #outputs 100\n",
+ " \n",
+ "#Variable declaration\n",
+ "o=OBJ()\n",
+ "o.set_i(10)\n",
+ "f(o) \n",
+ "o.out_i() #still outputs 10, value of i unchanged\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 100 10\n"
+ "text": [
+ "10 100 10\n"
+ ]
}
],
"prompt_number": 3
@@ -175,19 +455,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.8, Page Number: 284<h3> "
+ "source": [
+ "<h3>Example 12.8, Page Number: 284<h3> "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Constructors, destructors, and passing objects'''\n\nclass myclass: \n def __init__(self,i):\n self.__val=i\n print \"Constructing\"\n def __del__(self):\n print \"Destructing\"\n def getval(self):\n return self.__val\n \ndef display(ob):\n print ob.getval()\n\n#Varable declaration\na=myclass(10)\n\ndisplay(a)\n",
+ "input": [
+ "\n",
+ "\n",
+ "class myclass: \n",
+ " def __init__(self,i):\n",
+ " self.__val=i\n",
+ " print \"Constructing\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing\"\n",
+ " def getval(self):\n",
+ " return self.__val\n",
+ " \n",
+ "def display(ob):\n",
+ " print ob.getval()\n",
+ "\n",
+ "#Varable declaration\n",
+ "a=myclass(10)\n",
+ "\n",
+ "display(a)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Constructing\nDestructing\n10\n"
+ "text": [
+ "Constructing\n",
+ "Destructing\n",
+ "10\n"
+ ]
}
],
"prompt_number": 2
@@ -195,19 +500,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.9, Page Number: 286<h3>"
+ "source": [
+ "<h3>Example 12.9, Page Number: 286<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Passing objects with a pointer'''\n#The problem shown in C++, will not occur in python because it does not have pointers.\n\nfrom ctypes import *\n\nclass myclass:\n def __init__(self,i):\n print \"Allocating p\"\n self.p=pointer(c_int(i))\n def __del__(self):\n print \"Freeing p\"\n def getval(self):\n return self.p[0]\n \ndef display(ob):\n print ob.getval()\n\n#Variable declaration\na=myclass(10)\n\ndisplay(a)\n ",
+ "input": [
+ "\n",
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "class myclass:\n",
+ " def __init__(self,i):\n",
+ " print \"Allocating p\"\n",
+ " self.p=pointer(c_int(i))\n",
+ " def __del__(self):\n",
+ " print \"Freeing p\"\n",
+ " def getval(self):\n",
+ " return self.p[0]\n",
+ " \n",
+ "def display(ob):\n",
+ " print ob.getval()\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=myclass(10)\n",
+ "\n",
+ "display(a)\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Allocating p\n10\n"
+ "text": [
+ "Allocating p\n",
+ "10\n"
+ ]
}
],
"prompt_number": 4
@@ -215,19 +547,47 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.10, Page Number: 287<h3>"
+ "source": [
+ "<h3>Example 12.10, Page Number: 287<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Passing objects by reference'''\n\nfrom ctypes import *\nclass myclass:\n def __init__(self,i):\n print \"Allocating p\"\n self.p=pointer(c_int(i))\n def __del__(self):\n print \"Freeing p\"\n def getval(self):\n return self.p[0]\n \ndef display(ob):\n print ob[0].getval()\n\n#Variable declaration\na=[]\na.append(myclass(10))\n\ndisplay(a)\n ",
+ "input": [
+ "'''Passing objects by reference'''\n",
+ "\n",
+ "from ctypes import *\n",
+ "class myclass:\n",
+ " def __init__(self,i):\n",
+ " print \"Allocating p\"\n",
+ " self.p=pointer(c_int(i))\n",
+ " def __del__(self):\n",
+ " print \"Freeing p\"\n",
+ " def getval(self):\n",
+ " return self.p[0]\n",
+ " \n",
+ "def display(ob):\n",
+ " print ob[0].getval()\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=[]\n",
+ "a.append(myclass(10))\n",
+ "\n",
+ "display(a)\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Freeing p\nAllocating p\n10\n"
+ "text": [
+ "Freeing p\n",
+ "Allocating p\n",
+ "10\n"
+ ]
}
],
"prompt_number": 5
@@ -235,19 +595,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.11, Page Number: 288<h3>"
+ "source": [
+ "<h3>Example 12.11, Page Number: 288<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Returning an object'''\n\nclass sample:\n __s=None\n def show(self):\n print self.__s\n def set(self,str):\n self.__s=str\n\n#Return an object of type sample\ndef input():\n str=sample()\n instr = \"Hello\" #User input\n str.set(instr)\n return str\n\n#Variable declaration\nob=sample()\n\n#assign returned object to ob\nob=input()\n\n#Result\nob.show()\n",
+ "input": [
+ "\n",
+ "\n",
+ "class sample:\n",
+ " __s=None\n",
+ " def show(self):\n",
+ " print self.__s\n",
+ " def set(self,str):\n",
+ " self.__s=str\n",
+ "\n",
+ "#Return an object of type sample\n",
+ "def input():\n",
+ " str=sample()\n",
+ " instr = \"Hello\" #User input\n",
+ " str.set(instr)\n",
+ " return str\n",
+ "\n",
+ "#Variable declaration\n",
+ "ob=sample()\n",
+ "\n",
+ "#assign returned object to ob\n",
+ "ob=input()\n",
+ "\n",
+ "#Result\n",
+ "ob.show()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello\n"
+ "text": [
+ "Hello\n"
+ ]
}
],
"prompt_number": 6
@@ -255,19 +644,56 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.12, Page Number: 289<h3>"
+ "source": [
+ "<h3>Example 12.12, Page Number: 289<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Returning an object'''\n#The error shown in C++ doesnt occur here.\nclass sample:\n __s=None\n def __init__(self):\n self.__s=0\n def __del__(self): \n print \"Freeing p\"\n def show(self):\n print self.__s\n def set(self,str):\n self.__s=str\n \n#This function takes one object parameter\ndef input():\n str=sample()\n instr=\"Hello\" #User input\n str.set(instr)\n return str\n\n#Variable declaration\nob=sample()\n\n#assign returned object to ob\nob=input()\n\n#Result\nob.show()\n\n\n",
+ "input": [
+ "\n",
+ "#\n",
+ "class sample:\n",
+ " __s=None\n",
+ " def __init__(self):\n",
+ " self.__s=0\n",
+ " def __del__(self): \n",
+ " print \"Freeing p\"\n",
+ " def show(self):\n",
+ " print self.__s\n",
+ " def set(self,str):\n",
+ " self.__s=str\n",
+ " \n",
+ "#This function takes one object parameter\n",
+ "def input():\n",
+ " str=sample()\n",
+ " instr=\"Hello\" #User input\n",
+ " str.set(instr)\n",
+ " return str\n",
+ "\n",
+ "#Variable declaration\n",
+ "ob=sample()\n",
+ "\n",
+ "#assign returned object to ob\n",
+ "ob=input()\n",
+ "\n",
+ "#Result\n",
+ "ob.show()\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Freeing p\nFreeing p\nHello\n"
+ "text": [
+ "Freeing p\n",
+ "Freeing p\n",
+ "Hello\n"
+ ]
}
],
"prompt_number": 8
@@ -275,19 +701,52 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.13, Page Number: 292<h3>"
+ "source": [
+ "<h3>Example 12.13, Page Number: 292<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing a copy constructor'''\n#Copy construcor doesnt work in this example, it works only when explicitly called\n\nclass myclass:\n __p=None\n def __init__(self,i):\n if isinstance(i,int):\n print \"Allocating p\"\n self.__p=i\n else:\n print \"Copy constructor called\"\n self.__p=i.getval()\n def __del__(self): \n print \"Freeing p\"\n def getval(self):\n return self.__p\n \n#This function takes one object parameter\ndef display(ob):\n print ob.getval()\n\n#Variable declaration\nob=myclass(10)\n\n#Result\ndisplay(ob)\n\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class myclass:\n",
+ " __p=None\n",
+ " def __init__(self,i):\n",
+ " if isinstance(i,int):\n",
+ " print \"Allocating p\"\n",
+ " self.__p=i\n",
+ " else:\n",
+ " print \"Copy constructor called\"\n",
+ " self.__p=i.getval()\n",
+ " def __del__(self): \n",
+ " print \"Freeing p\"\n",
+ " def getval(self):\n",
+ " return self.__p\n",
+ " \n",
+ "#This function takes one object parameter\n",
+ "def display(ob):\n",
+ " print ob.getval()\n",
+ "\n",
+ "#Variable declaration\n",
+ "ob=myclass(10)\n",
+ "\n",
+ "#Result\n",
+ "display(ob)\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Allocating p\n10\n"
+ "text": [
+ "Allocating p\n",
+ "10\n"
+ ]
}
],
"prompt_number": 1
@@ -295,19 +754,50 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.14, Page Number: 294<h3>"
+ "source": [
+ "<h3>Example 12.14, Page Number: 294<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing a copy constructor'''\n\n\nclass myclass:\n __p=None\n def __init__(self,i):\n if isinstance(i,int):\n print \"Allocating p\"\n self.__p=i\n else:\n print \"Copy constructor called\"\n self.__p=i.getval()\n def __del__(self): \n print \"Freeing p\"\n def getval(self):\n return self.__p\n \n\n#Variable declaration\na=myclass(10) #calls normal constructor\nb=myclass(a) #calls copy constructor\n\n\n\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "class myclass:\n",
+ " __p=None\n",
+ " def __init__(self,i):\n",
+ " if isinstance(i,int):\n",
+ " print \"Allocating p\"\n",
+ " self.__p=i\n",
+ " else:\n",
+ " print \"Copy constructor called\"\n",
+ " self.__p=i.getval()\n",
+ " def __del__(self): \n",
+ " print \"Freeing p\"\n",
+ " def getval(self):\n",
+ " return self.__p\n",
+ " \n",
+ "\n",
+ "#Variable declaration\n",
+ "a=myclass(10) #calls normal constructor\n",
+ "b=myclass(a) #calls copy constructor\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Allocating p\nCopy constructor called\n"
+ "text": [
+ "Allocating p\n",
+ "Copy constructor called\n"
+ ]
}
],
"prompt_number": 4
@@ -315,19 +805,45 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.15, Page Number: 295<h3>"
+ "source": [
+ "<h3>Example 12.15, Page Number: 295<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing a copy constructor'''\n\n\nclass myclass:\n def __init__(self,i=0):\n if isinstance(i,int):\n print \"Normal constructor\"\n else:\n print \"Copy constructor\"\n\n\n#Variable declaration\na=myclass() #calls normal constructor\n\nf=myclass()\na=myclass(f) #Invoke copyconstructor\n\n\n\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class myclass:\n",
+ " def __init__(self,i=0):\n",
+ " if isinstance(i,int):\n",
+ " print \"Normal constructor\"\n",
+ " else:\n",
+ " print \"Copy constructor\"\n",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=myclass() #calls normal constructor\n",
+ "\n",
+ "f=myclass()\n",
+ "a=myclass(f) #Invoke copyconstructor\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Normal constructor\nNormal constructor\nCopy constructor\n"
+ "text": [
+ "Normal constructor\n",
+ "Normal constructor\n",
+ "Copy constructor\n"
+ ]
}
],
"prompt_number": 8
@@ -335,19 +851,41 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 12.16, Page Number: 297<h3>"
+ "source": [
+ "<h3>Example 12.16, Page Number: 297<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of the this pointer'''\n#Here self works as this\n\nclass c1:\n def __init__(self):\n self.__i=None\n def load_i(self,val):\n self.__i=val\n def get_i(self):\n return self.__i\n \n#Variable declaration \no=c1()\n\no.load_i(100)\n\n#Result\nprint o.get_i()\n",
+ "input": [
+ "\n",
+ "\n",
+ "class c1:\n",
+ " def __init__(self):\n",
+ " self.__i=None\n",
+ " def load_i(self,val):\n",
+ " self.__i=val\n",
+ " def get_i(self):\n",
+ " return self.__i\n",
+ " \n",
+ "#Variable declaration \n",
+ "o=c1()\n",
+ "\n",
+ "o.load_i(100)\n",
+ "\n",
+ "#Result\n",
+ "print o.get_i()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "100\n"
+ "text": [
+ "100\n"
+ ]
}
],
"prompt_number": 13
@@ -355,7 +893,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_13(1).ipynb b/C++_from_the_Ground/Chapter_13(1).ipynb
index c38dca6a..6d12a5a7 100644
--- a/C++_from_the_Ground/Chapter_13(1).ipynb
+++ b/C++_from_the_Ground/Chapter_13(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 13"
+ "name": "",
+ "signature": "sha256:be0df45a07fa8844875025463a4211b5faab9834d4e1dd155b475b36ae6ea27e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,85 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 13: Operator Overloading<h1>"
+ "source": [
+ "<h1>Chapter 13: Operator Overloading<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.1, Page Number: 300<h3>"
+ "source": [
+ "<h3>Example 13.1, Page Number: 300<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Overloading operators using member functions'''\n\nclass three_d:\n def __init__(self,i=None,j=None,k=None):\n if i==None:\n self.x=self.y=self.z=0\n else:\n self.x=i\n self.y=j\n self.z=k\n #Overload +\n def __add__(self,op2):\n temp=three_d()\n temp.x=self.x + op2.x #These are integer additions\n temp.y=self.y + op2.y #and the + retains its original\n temp.z=self.z + op2.z #meaning relative to them.\n return temp\n #Overload assignment\n def __assign__(self,op2):\n self.x=op2.x #These are integer assignments\n self.y=op2.y #and the = retains its original \n self.z=op2.z #meaning relative to them\n return self\n #Show x,y,z coordinates\n def show(self):\n print self.x,\",\",self.y,\",\",self.z\n \n#Variable declaration\na=three_d(1,2,3)\nb=three_d(10,10,10)\nc=three_d()\n\na.show()\nb.show()\n\n#add a and b together\nc=a+b\nc.show()\n\n#add a,b and c together\nc=a+b+c\nc.show()\n\n#demonstrate multiple assignment\nc=b=a\nc.show()\nb.show()\n \n ",
+ "input": [
+ "\n",
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,i=None,j=None,k=None):\n",
+ " if i==None:\n",
+ " self.x=self.y=self.z=0\n",
+ " else:\n",
+ " self.x=i\n",
+ " self.y=j\n",
+ " self.z=k\n",
+ " #Overload +\n",
+ " def __add__(self,op2):\n",
+ " temp=three_d()\n",
+ " temp.x=self.x + op2.x #These are integer additions\n",
+ " temp.y=self.y + op2.y #and the + retains its original\n",
+ " temp.z=self.z + op2.z #meaning relative to them.\n",
+ " return temp\n",
+ " #Overload assignment\n",
+ " def __assign__(self,op2):\n",
+ " self.x=op2.x #These are integer assignments\n",
+ " self.y=op2.y #and the = retains its original \n",
+ " self.z=op2.z #meaning relative to them\n",
+ " return self\n",
+ " #Show x,y,z coordinates\n",
+ " def show(self):\n",
+ " print self.x,\",\",self.y,\",\",self.z\n",
+ " \n",
+ "#Variable declaration\n",
+ "a=three_d(1,2,3)\n",
+ "b=three_d(10,10,10)\n",
+ "c=three_d()\n",
+ "\n",
+ "a.show()\n",
+ "b.show()\n",
+ "\n",
+ "#add a and b together\n",
+ "c=a+b\n",
+ "c.show()\n",
+ "\n",
+ "#add a,b and c together\n",
+ "c=a+b+c\n",
+ "c.show()\n",
+ "\n",
+ "#demonstrate multiple assignment\n",
+ "c=b=a\n",
+ "c.show()\n",
+ "b.show()\n",
+ " \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 , 2 , 3\n10 , 10 , 10\n11 , 12 , 13\n22 , 24 , 26\n1 , 2 , 3\n1 , 2 , 3\n"
+ "text": [
+ "1 , 2 , 3\n",
+ "10 , 10 , 10\n",
+ "11 , 12 , 13\n",
+ "22 , 24 , 26\n",
+ "1 , 2 , 3\n",
+ "1 , 2 , 3\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +97,86 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.2, Page Number: 303<h3>"
+ "source": [
+ "<h3>Example 13.2, Page Number: 303<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of ++ operator in python'''\n\nclass three_d:\n def __init__(self,i=None,j=None,k=None):\n if i==None:\n self.x=self.y=self.z=0\n else:\n self.x=i\n self.y=j\n self.z=k\n #Overload +\n def __add__(self,op2):\n temp=three_d()\n temp.x=self.x + op2.x #These are integer additions\n temp.y=self.y + op2.y #and the + retains its original\n temp.z=self.z + op2.z #meaning relative to them.\n return temp\n #Overload assignment\n def __assign__(self,op2):\n self.x=op2.x #These are integer assignments\n self.y=op2.y #and the = retains its original \n self.z=op2.z #meaning relative to them\n return self\n #Overload the increment operator\n def __iadd__(self,op2):\n self.x+=op2\n self.y+=op2\n self.z+=op2\n return self\n #Show x,y,z coordinates\n def show(self):\n print self.x,\",\",self.y,\",\",self.z\n \na=three_d(1,2,3)\nb=three_d(10,10,10)\nc=three_d()\n\na.show()\nb.show()\n\n#add a and b together\nc=a+b\nc.show()\n\n#add a,b and c together\nc=a+b+c\nc.show()\n\n#demonstrate multiple assignment\nc=b=a\nc.show()\nb.show()\n \n#Increment c\nc+=1\nc.show()\n",
+ "input": [
+ "\n",
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,i=None,j=None,k=None):\n",
+ " if i==None:\n",
+ " self.x=self.y=self.z=0\n",
+ " else:\n",
+ " self.x=i\n",
+ " self.y=j\n",
+ " self.z=k\n",
+ " #Overload +\n",
+ " def __add__(self,op2):\n",
+ " temp=three_d()\n",
+ " temp.x=self.x + op2.x #These are integer additions\n",
+ " temp.y=self.y + op2.y #and the + retains its original\n",
+ " temp.z=self.z + op2.z #meaning relative to them.\n",
+ " return temp\n",
+ " #Overload assignment\n",
+ " def __assign__(self,op2):\n",
+ " self.x=op2.x #These are integer assignments\n",
+ " self.y=op2.y #and the = retains its original \n",
+ " self.z=op2.z #meaning relative to them\n",
+ " return self\n",
+ " #Overload the increment operator\n",
+ " def __iadd__(self,op2):\n",
+ " self.x+=op2\n",
+ " self.y+=op2\n",
+ " self.z+=op2\n",
+ " return self\n",
+ " #Show x,y,z coordinates\n",
+ " def show(self):\n",
+ " print self.x,\",\",self.y,\",\",self.z\n",
+ " \n",
+ "a=three_d(1,2,3)\n",
+ "b=three_d(10,10,10)\n",
+ "c=three_d()\n",
+ "\n",
+ "a.show()\n",
+ "b.show()\n",
+ "\n",
+ "#add a and b together\n",
+ "c=a+b\n",
+ "c.show()\n",
+ "\n",
+ "#add a,b and c together\n",
+ "c=a+b+c\n",
+ "c.show()\n",
+ "\n",
+ "#demonstrate multiple assignment\n",
+ "c=b=a\n",
+ "c.show()\n",
+ "b.show()\n",
+ " \n",
+ "#Increment c\n",
+ "c+=1\n",
+ "c.show()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 , 2 , 3\n10 , 10 , 10\n11 , 12 , 13\n22 , 24 , 26\n1 , 2 , 3\n1 , 2 , 3\n2 , 3 , 4\n"
+ "text": [
+ "1 , 2 , 3\n",
+ "10 , 10 , 10\n",
+ "11 , 12 , 13\n",
+ "22 , 24 , 26\n",
+ "1 , 2 , 3\n",
+ "1 , 2 , 3\n",
+ "2 , 3 , 4\n"
+ ]
}
],
"prompt_number": 2
@@ -55,19 +184,107 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.3, Page Number: 306<h3>"
+ "source": [
+ "<h3>Example 13.3, Page Number: 306<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of prefix and postfix ++ operator in python'''\n\nclass three_d:\n def __init__(self,i=None,j=None,k=None):\n if i==None:\n self.x=self.y=self.z=0\n else:\n self.x=i\n self.y=j\n self.z=k\n #Overload +\n def __add__(self,op2):\n temp=three_d()\n temp.x=self.x + op2.x #These are integer additions\n temp.y=self.y + op2.y #and the + retains its original\n temp.z=self.z + op2.z #meaning relative to them.\n return temp\n #Overload assignment\n def __assign__(self,op2):\n self.x=op2.x #These are integer assignments\n self.y=op2.y #and the = retains its original \n self.z=op2.z #meaning relative to them\n return self\n #Overload the increment operator\n def __iadd__(self,op2):\n self.x+=op2\n self.y+=op2\n self.z+=op2\n return self\n #Show x,y,z coordinates\n def show(self):\n print self.x,\",\",self.y,\",\",self.z\n \na=three_d(1,2,3)\nb=three_d(10,10,10)\nc=three_d()\n\na.show()\nb.show()\n\n#add a and b together\nc=a+b\nc.show()\n\n#add a,b and c together\nc=a+b+c\nc.show()\n\n#demonstrate multiple assignment\nc=b=a\nc.show()\nb.show()\n \n#Increment c (prefix)\nc+=1\nc.show()\n\n#Increment c (postfix)\nc+=1\nc.show()\n\n#Implementing prefix\nc+=1\na=c\na.show()\nc.show()\n\n#Implementing postfix\na=c\na.show()\nc+=1\nc.show()",
+ "input": [
+ "\n",
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,i=None,j=None,k=None):\n",
+ " if i==None:\n",
+ " self.x=self.y=self.z=0\n",
+ " else:\n",
+ " self.x=i\n",
+ " self.y=j\n",
+ " self.z=k\n",
+ " #Overload +\n",
+ " def __add__(self,op2):\n",
+ " temp=three_d()\n",
+ " temp.x=self.x + op2.x #These are integer additions\n",
+ " temp.y=self.y + op2.y #and the + retains its original\n",
+ " temp.z=self.z + op2.z #meaning relative to them.\n",
+ " return temp\n",
+ " #Overload assignment\n",
+ " def __assign__(self,op2):\n",
+ " self.x=op2.x #These are integer assignments\n",
+ " self.y=op2.y #and the = retains its original \n",
+ " self.z=op2.z #meaning relative to them\n",
+ " return self\n",
+ " #Overload the increment operator\n",
+ " def __iadd__(self,op2):\n",
+ " self.x+=op2\n",
+ " self.y+=op2\n",
+ " self.z+=op2\n",
+ " return self\n",
+ " #Show x,y,z coordinates\n",
+ " def show(self):\n",
+ " print self.x,\",\",self.y,\",\",self.z\n",
+ " \n",
+ "a=three_d(1,2,3)\n",
+ "b=three_d(10,10,10)\n",
+ "c=three_d()\n",
+ "\n",
+ "a.show()\n",
+ "b.show()\n",
+ "\n",
+ "#add a and b together\n",
+ "c=a+b\n",
+ "c.show()\n",
+ "\n",
+ "#add a,b and c together\n",
+ "c=a+b+c\n",
+ "c.show()\n",
+ "\n",
+ "#demonstrate multiple assignment\n",
+ "c=b=a\n",
+ "c.show()\n",
+ "b.show()\n",
+ " \n",
+ "#Increment c (prefix)\n",
+ "c+=1\n",
+ "c.show()\n",
+ "\n",
+ "#Increment c (postfix)\n",
+ "c+=1\n",
+ "c.show()\n",
+ "\n",
+ "#Implementing prefix\n",
+ "c+=1\n",
+ "a=c\n",
+ "a.show()\n",
+ "c.show()\n",
+ "\n",
+ "#Implementing postfix\n",
+ "a=c\n",
+ "a.show()\n",
+ "c+=1\n",
+ "c.show()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 , 2 , 3\n10 , 10 , 10\n11 , 12 , 13\n22 , 24 , 26\n1 , 2 , 3\n1 , 2 , 3\n2 , 3 , 4\n3 , 4 , 5\n4 , 5 , 6\n4 , 5 , 6\n4 , 5 , 6\n5 , 6 , 7\n"
+ "text": [
+ "1 , 2 , 3\n",
+ "10 , 10 , 10\n",
+ "11 , 12 , 13\n",
+ "22 , 24 , 26\n",
+ "1 , 2 , 3\n",
+ "1 , 2 , 3\n",
+ "2 , 3 , 4\n",
+ "3 , 4 , 5\n",
+ "4 , 5 , 6\n",
+ "4 , 5 , 6\n",
+ "4 , 5 , 6\n",
+ "5 , 6 , 7\n"
+ ]
}
],
"prompt_number": 3
@@ -75,19 +292,79 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.4, Page Number: 310<h3>"
+ "source": [
+ "<h3>Example 13.4, Page Number: 310<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Overload + using a friend'''\n\nclass three_d:\n def __init__(self,i=None,j=None,k=None):\n if i==None:\n self.x=self.y=self.z=0\n else:\n self.x=i\n self.y=j\n self.z=k\n #Overload +\n def __add__(self,op2):\n return add(self,op2)\n #Overload assignment\n def __assign__(self,op2):\n self.x=op2.x #These are integer assignments\n self.y=op2.y #and the = retains its original \n self.z=op2.z #meaning relative to them\n return self\n #Show x,y,z coordinates\n def show(self):\n print self.x,\",\",self.y,\",\",self.z\n \n#friending the funcion\ndef add(op1,op2):\n temp=three_d()\n temp.x=op1.x + op2.x #These are integer additions\n temp.y=op1.y + op2.y #and the + retains its original\n temp.z=op1.z + op2.z #meaning relative to them.\n return temp\n\na=three_d(1,2,3)\nb=three_d(10,10,10)\nc=three_d()\n\na.show()\nb.show()\n\n#add a and b together\nc=a+b\nc.show()\n\n#add a,b and c together\nc=a+b+c\nc.show()\n\n#demonstrate multiple assignment\nc=b=a\nc.show()\nb.show()\n",
+ "input": [
+ "\n",
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,i=None,j=None,k=None):\n",
+ " if i==None:\n",
+ " self.x=self.y=self.z=0\n",
+ " else:\n",
+ " self.x=i\n",
+ " self.y=j\n",
+ " self.z=k\n",
+ " #Overload +\n",
+ " def __add__(self,op2):\n",
+ " return add(self,op2)\n",
+ " #Overload assignment\n",
+ " def __assign__(self,op2):\n",
+ " self.x=op2.x #These are integer assignments\n",
+ " self.y=op2.y #and the = retains its original \n",
+ " self.z=op2.z #meaning relative to them\n",
+ " return self\n",
+ " #Show x,y,z coordinates\n",
+ " def show(self):\n",
+ " print self.x,\",\",self.y,\",\",self.z\n",
+ " \n",
+ "#friending the funcion\n",
+ "def add(op1,op2):\n",
+ " temp=three_d()\n",
+ " temp.x=op1.x + op2.x #These are integer additions\n",
+ " temp.y=op1.y + op2.y #and the + retains its original\n",
+ " temp.z=op1.z + op2.z #meaning relative to them.\n",
+ " return temp\n",
+ "\n",
+ "a=three_d(1,2,3)\n",
+ "b=three_d(10,10,10)\n",
+ "c=three_d()\n",
+ "\n",
+ "a.show()\n",
+ "b.show()\n",
+ "\n",
+ "#add a and b together\n",
+ "c=a+b\n",
+ "c.show()\n",
+ "\n",
+ "#add a,b and c together\n",
+ "c=a+b+c\n",
+ "c.show()\n",
+ "\n",
+ "#demonstrate multiple assignment\n",
+ "c=b=a\n",
+ "c.show()\n",
+ "b.show()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 , 2 , 3\n10 , 10 , 10\n11 , 12 , 13\n22 , 24 , 26\n1 , 2 , 3\n1 , 2 , 3\n"
+ "text": [
+ "1 , 2 , 3\n",
+ "10 , 10 , 10\n",
+ "11 , 12 , 13\n",
+ "22 , 24 , 26\n",
+ "1 , 2 , 3\n",
+ "1 , 2 , 3\n"
+ ]
}
],
"prompt_number": 4
@@ -95,19 +372,62 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.5, Page Number: 311<h3>"
+ "source": [
+ "<h3>Example 13.5, Page Number: 311<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Operator overloading when object is on the right side of the operator'''\n\nclass CL:\n def __init__(self):\n self.count=0\n def __assign__(self,obj):\n self.count=obj.count\n return self\n def __add__(self,i): \n return add(self,i)\n def __radd__(self,i):\n return radd(self,i)\n\n#This handles ob + int\ndef add(ob,i):\n temp=CL()\n temp.count=ob.count+i\n return temp\n \n#This handles int + ob \ndef radd(ob,i):\n temp=CL()\n temp.count=i+ob.count\n return temp\n\n#Variable declaration\no=CL()\no.count = 10\n\n#Result\nprint o.count, #outputs 10\no=10+o\nprint o.count, #outputs 20\no=o+12\nprint o.count #outputs 32\n\n\n ",
+ "input": [
+ "\n",
+ "\n",
+ "class CL:\n",
+ " def __init__(self):\n",
+ " self.count=0\n",
+ " def __assign__(self,obj):\n",
+ " self.count=obj.count\n",
+ " return self\n",
+ " def __add__(self,i): \n",
+ " return add(self,i)\n",
+ " def __radd__(self,i):\n",
+ " return radd(self,i)\n",
+ "\n",
+ "#This handles ob + int\n",
+ "def add(ob,i):\n",
+ " temp=CL()\n",
+ " temp.count=ob.count+i\n",
+ " return temp\n",
+ " \n",
+ "#This handles int + ob \n",
+ "def radd(ob,i):\n",
+ " temp=CL()\n",
+ " temp.count=i+ob.count\n",
+ " return temp\n",
+ "\n",
+ "#Variable declaration\n",
+ "o=CL()\n",
+ "o.count = 10\n",
+ "\n",
+ "#Result\n",
+ "print o.count, #outputs 10\n",
+ "o=10+o\n",
+ "print o.count, #outputs 20\n",
+ "o=o+12\n",
+ "print o.count #outputs 32\n",
+ "\n",
+ "\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 20 32\n"
+ "text": [
+ "10 20 32\n"
+ ]
}
],
"prompt_number": 1
@@ -115,19 +435,112 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.6, Page Number: 314<h3>"
+ "source": [
+ "<h3>Example 13.6, Page Number: 314<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of prefix and postfix ++ as a friend function'''\n\nclass three_d:\n def __init__(self,i=None,j=None,k=None):\n if i==None:\n self.x=self.y=self.z=0\n else:\n self.x=i\n self.y=j\n self.z=k\n #Overload +\n def __add__(self,op2):\n return add(self,op2)\n #Overload assignment\n def __assign__(self,op2):\n self.x=op2.x #These are integer assignments\n self.y=op2.y #and the = retains its original \n self.z=op2.z #meaning relative to them\n return self\n #Overload the increment operator\n def __iadd__(self,op2):\n return iadd(self,op2)\n #Show x,y,z coordinates\n def show(self):\n print self.x,\",\",self.y,\",\",self.z\n\n#friending the funcion\ndef add(op1,op2):\n temp=three_d()\n temp.x=op1.x + op2.x #These are integer additions\n temp.y=op1.y + op2.y #and the + retains its original\n temp.z=op1.z + op2.z #meaning relative to them.\n return temp\ndef iadd(op1,op2):\n op1.x+=op2\n op1.y+=op2\n op1.z+=op2\n return op1\n \na=three_d(1,2,3)\nb=three_d(10,10,10)\nc=three_d()\n\na.show()\nb.show()\n\n#add a and b together\nc=a+b\nc.show()\n\n#add a,b and c together\nc=a+b+c\nc.show()\n\n#demonstrate multiple assignment\nc=b=a\nc.show()\nb.show()\n \n#Increment c (prefix)\nc+=1\nc.show()\n\n#Increment c (postfix)\nc+=1\nc.show()\n\n#Implementing prefix\nc+=1\na=c\na.show()\nc.show()\n\n#Implementing postfix\na=c\na.show()\nc+=1\nc.show()",
+ "input": [
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,i=None,j=None,k=None):\n",
+ " if i==None:\n",
+ " self.x=self.y=self.z=0\n",
+ " else:\n",
+ " self.x=i\n",
+ " self.y=j\n",
+ " self.z=k\n",
+ " #Overload +\n",
+ " def __add__(self,op2):\n",
+ " return add(self,op2)\n",
+ " #Overload assignment\n",
+ " def __assign__(self,op2):\n",
+ " self.x=op2.x #These are integer assignments\n",
+ " self.y=op2.y #and the = retains its original \n",
+ " self.z=op2.z #meaning relative to them\n",
+ " return self\n",
+ " #Overload the increment operator\n",
+ " def __iadd__(self,op2):\n",
+ " return iadd(self,op2)\n",
+ " #Show x,y,z coordinates\n",
+ " def show(self):\n",
+ " print self.x,\",\",self.y,\",\",self.z\n",
+ "\n",
+ "#friending the funcion\n",
+ "def add(op1,op2):\n",
+ " temp=three_d()\n",
+ " temp.x=op1.x + op2.x #These are integer additions\n",
+ " temp.y=op1.y + op2.y #and the + retains its original\n",
+ " temp.z=op1.z + op2.z #meaning relative to them.\n",
+ " return temp\n",
+ "def iadd(op1,op2):\n",
+ " op1.x+=op2\n",
+ " op1.y+=op2\n",
+ " op1.z+=op2\n",
+ " return op1\n",
+ " \n",
+ "a=three_d(1,2,3)\n",
+ "b=three_d(10,10,10)\n",
+ "c=three_d()\n",
+ "\n",
+ "a.show()\n",
+ "b.show()\n",
+ "\n",
+ "#add a and b together\n",
+ "c=a+b\n",
+ "c.show()\n",
+ "\n",
+ "#add a,b and c together\n",
+ "c=a+b+c\n",
+ "c.show()\n",
+ "\n",
+ "#demonstrate multiple assignment\n",
+ "c=b=a\n",
+ "c.show()\n",
+ "b.show()\n",
+ " \n",
+ "#Increment c (prefix)\n",
+ "c+=1\n",
+ "c.show()\n",
+ "\n",
+ "#Increment c (postfix)\n",
+ "c+=1\n",
+ "c.show()\n",
+ "\n",
+ "#Implementing prefix\n",
+ "c+=1\n",
+ "a=c\n",
+ "a.show()\n",
+ "c.show()\n",
+ "\n",
+ "#Implementing postfix\n",
+ "a=c\n",
+ "a.show()\n",
+ "c+=1\n",
+ "c.show()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 , 2 , 3\n10 , 10 , 10\n11 , 12 , 13\n22 , 24 , 26\n1 , 2 , 3\n1 , 2 , 3\n2 , 3 , 4\n3 , 4 , 5\n4 , 5 , 6\n4 , 5 , 6\n4 , 5 , 6\n5 , 6 , 7\n"
+ "text": [
+ "1 , 2 , 3\n",
+ "10 , 10 , 10\n",
+ "11 , 12 , 13\n",
+ "22 , 24 , 26\n",
+ "1 , 2 , 3\n",
+ "1 , 2 , 3\n",
+ "2 , 3 , 4\n",
+ "3 , 4 , 5\n",
+ "4 , 5 , 6\n",
+ "4 , 5 , 6\n",
+ "4 , 5 , 6\n",
+ "5 , 6 , 7\n"
+ ]
}
],
"prompt_number": 6
@@ -135,19 +548,61 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.7, Page Number: 318<h3>"
+ "source": [
+ "<h3>Example 13.7, Page Number: 318<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n\nclass sample:\n def __init__(self,ob=0):\n if isinstance(ob,int):\n #Normal constructor\n self.__s=\"\"\n return\n else:\n #Copy constructor\n self.__s=obj._sample__s\n return\n def __del__(self):\n print \"Freeing s\"\n def show(self):\n print self.__s\n def set(self,str):\n self.__s=str\n def __assign__(self,ob): #Overload assignment\n self.s=ob._sample__s\n return self\n \ndef input():\n str=sample()\n instr=\"Hello\" #User input\n str.set(instr)\n return str\n\nob=sample()\n\n#assign returned object to ob\nob=input()\n\n#Result\nob.show()\n",
+ "input": [
+ "\n",
+ "\n",
+ "class sample:\n",
+ " def __init__(self,ob=0):\n",
+ " if isinstance(ob,int):\n",
+ " #Normal constructor\n",
+ " self.__s=\"\"\n",
+ " return\n",
+ " else:\n",
+ " #Copy constructor\n",
+ " self.__s=obj._sample__s\n",
+ " return\n",
+ " def __del__(self):\n",
+ " print \"Freeing s\"\n",
+ " def show(self):\n",
+ " print self.__s\n",
+ " def set(self,str):\n",
+ " self.__s=str\n",
+ " def __assign__(self,ob): #Overload assignment\n",
+ " self.s=ob._sample__s\n",
+ " return self\n",
+ " \n",
+ "def input():\n",
+ " str=sample()\n",
+ " instr=\"Hello\" #User input\n",
+ " str.set(instr)\n",
+ " return str\n",
+ "\n",
+ "ob=sample()\n",
+ "\n",
+ "#assign returned object to ob\n",
+ "ob=input()\n",
+ "\n",
+ "#Result\n",
+ "ob.show()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Freeing s\nFreeing s\nHello\n"
+ "text": [
+ "Freeing s\n",
+ "Freeing s\n",
+ "Hello\n"
+ ]
}
],
"prompt_number": 4
@@ -155,19 +610,41 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.8, Page Number: 321<h3>"
+ "source": [
+ "<h3>Example 13.8, Page Number: 321<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Overload []'''\n#There is on implementation of overloading [], hence we use normal functions\n\n\nclass atype:\n def __init__(self):\n self.__a=[]\n for i in range(SIZE):\n self.__a.append(i)\n def a(self,i):\n return self.__a[i]\n \n#Variable declaration\nSIZE=3\nob=atype()\n\n#Result\nprint ob.a(2),\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class atype:\n",
+ " def __init__(self):\n",
+ " self.__a=[]\n",
+ " for i in range(SIZE):\n",
+ " self.__a.append(i)\n",
+ " def a(self,i):\n",
+ " return self.__a[i]\n",
+ " \n",
+ "#Variable declaration\n",
+ "SIZE=3\n",
+ "ob=atype()\n",
+ "\n",
+ "#Result\n",
+ "print ob.a(2),\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
}
],
"prompt_number": 6
@@ -175,19 +652,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.9, Page Number: 322<h3>"
+ "source": [
+ "<h3>Example 13.9, Page Number: 322<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Overload []'''\n\nclass atype:\n def __init__(self):\n self.__a=[]\n for i in range(SIZE):\n self.__a.append(i)\n def a(self,i,j=None):\n if j==None:\n return self.__a[i]\n else:\n self.__a[i]=j\n \n#Variable declaration\nSIZE=3 \nob=atype()\n\nprint ob.a(2), #displays 2\n\nob.a(2,25)\n\nprint ob.a(2) #now displays 25",
+ "input": [
+ "\n",
+ "\n",
+ "class atype:\n",
+ " def __init__(self):\n",
+ " self.__a=[]\n",
+ " for i in range(SIZE):\n",
+ " self.__a.append(i)\n",
+ " def a(self,i,j=None):\n",
+ " if j==None:\n",
+ " return self.__a[i]\n",
+ " else:\n",
+ " self.__a[i]=j\n",
+ " \n",
+ "#Variable declaration\n",
+ "SIZE=3 \n",
+ "ob=atype()\n",
+ "\n",
+ "print ob.a(2), #displays 2\n",
+ "\n",
+ "ob.a(2,25)\n",
+ "\n",
+ "print ob.a(2) #now displays 25"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "2 25\n"
+ "text": [
+ "2 25\n"
+ ]
}
],
"prompt_number": 7
@@ -195,19 +699,52 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.10, Page Number: 323<h3>"
+ "source": [
+ "<h3>Example 13.10, Page Number: 323<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A safe array example'''\n\nclass atype:\n def __init__(self):\n self.__a=[]\n for i in range(SIZE):\n self.__a.append(i)\n def a(self,i,j=None):\n if (i<0 or i>SIZE-1):\n print \"Index value of\",\n print i,\"is out of bounds.\"\n return\n if j==None:\n return self.__a[i]\n else:\n self.__a[i]=j\n \n#Variable declaration\nSIZE=3 \nob=atype()\n\nprint ob.a(2), #displays 2\n\nob.a(2,25)\n\nprint ob.a(2) #now displays 25\n\nob.a(44,3) #generates runtime error, 3 out of bounds",
+ "input": [
+ "\n",
+ "class atype:\n",
+ " def __init__(self):\n",
+ " self.__a=[]\n",
+ " for i in range(SIZE):\n",
+ " self.__a.append(i)\n",
+ " def a(self,i,j=None):\n",
+ " if (i<0 or i>SIZE-1):\n",
+ " print \"Index value of\",\n",
+ " print i,\"is out of bounds.\"\n",
+ " return\n",
+ " if j==None:\n",
+ " return self.__a[i]\n",
+ " else:\n",
+ " self.__a[i]=j\n",
+ " \n",
+ "#Variable declaration\n",
+ "SIZE=3 \n",
+ "ob=atype()\n",
+ "\n",
+ "print ob.a(2), #displays 2\n",
+ "\n",
+ "ob.a(2,25)\n",
+ "\n",
+ "print ob.a(2) #now displays 25\n",
+ "\n",
+ "ob.a(44,3) #generates runtime error, 3 out of bounds"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "2 25\nIndex value of 44 is out of bounds.\n"
+ "text": [
+ "2 25\n",
+ "Index value of 44 is out of bounds.\n"
+ ]
}
],
"prompt_number": 9
@@ -215,19 +752,56 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.11, Page Number: 324<h3>"
+ "source": [
+ "<h3>Example 13.11, Page Number: 324<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Overload ()'''\n\nclass three_d:\n def __init__(self,i=None,j=None,k=None):\n if i==None:\n self.x=self.y=self.z=0 #3-D coordinates\n else:\n self.x=i\n self.y=j\n self.z=k\n #Show X,Y,Z coordinates\n def show(self):\n print self.x,\",\",self.y,\",\",self.z\n #Overload ()\n def a(self,a,b,c):\n temp = three_d()\n temp.x=self.x+a\n temp.y=self.y+b\n temp.z=self.z+c\n return temp\n \n#Variable declaration\nob1=three_d(1,2,3)\n\nob2=ob1.a(10,11,12) #invoke operator ()\n\n#Result\nprint \"ob1: \",\nob1.show()\nprint \"ob2: \",\nob2.show()",
+ "input": [
+ "\n",
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,i=None,j=None,k=None):\n",
+ " if i==None:\n",
+ " self.x=self.y=self.z=0 #3-D coordinates\n",
+ " else:\n",
+ " self.x=i\n",
+ " self.y=j\n",
+ " self.z=k\n",
+ " #Show X,Y,Z coordinates\n",
+ " def show(self):\n",
+ " print self.x,\",\",self.y,\",\",self.z\n",
+ " #Overload ()\n",
+ " def a(self,a,b,c):\n",
+ " temp = three_d()\n",
+ " temp.x=self.x+a\n",
+ " temp.y=self.y+b\n",
+ " temp.z=self.z+c\n",
+ " return temp\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob1=three_d(1,2,3)\n",
+ "\n",
+ "ob2=ob1.a(10,11,12) #invoke operator ()\n",
+ "\n",
+ "#Result\n",
+ "print \"ob1: \",\n",
+ "ob1.show()\n",
+ "print \"ob2: \",\n",
+ "ob2.show()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "ob1: 1 , 2 , 3\nob2: 11 , 13 , 15\n"
+ "text": [
+ "ob1: 1 , 2 , 3\n",
+ "ob2: 11 , 13 , 15\n"
+ ]
}
],
"prompt_number": 10
@@ -235,19 +809,61 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 13.12, Page Number: 326<h3>"
+ "source": [
+ "<h3>Example 13.12, Page Number: 326<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Expanding the string type'''\n\nclass str_type:\n def __init__(self,str=\"\"):\n self.__string=str\n #String concatenation\n def __add__(self,str):\n temp=str_type()\n if isinstance(str,str_type):\n temp.__string=self.__string+str.__string\n else:\n temp.__string=self.__string+str\n return temp\n #String copy\n def __assign__(self,str):\n if isinstance(str,str_type):\n self.__string=str.__string\n else:\n self.__string=str\n return self\n def show_str(self):\n print self.__string\n \na=str_type(\"Hello \")\nb=str_type(\"There\")\nc=a+b\nc.show_str()\n\na=str_type(\"to program in because\")\na.show_str()\n\nb=c=str_type(\"C++ is fun\")\n\nc=c+\" \"+a+\" \"+b\nc.show_str()\n\n",
+ "input": [
+ "\n",
+ "class str_type:\n",
+ " def __init__(self,str=\"\"):\n",
+ " self.__string=str\n",
+ " #String concatenation\n",
+ " def __add__(self,str):\n",
+ " temp=str_type()\n",
+ " if isinstance(str,str_type):\n",
+ " temp.__string=self.__string+str.__string\n",
+ " else:\n",
+ " temp.__string=self.__string+str\n",
+ " return temp\n",
+ " #String copy\n",
+ " def __assign__(self,str):\n",
+ " if isinstance(str,str_type):\n",
+ " self.__string=str.__string\n",
+ " else:\n",
+ " self.__string=str\n",
+ " return self\n",
+ " def show_str(self):\n",
+ " print self.__string\n",
+ " \n",
+ "a=str_type(\"Hello \")\n",
+ "b=str_type(\"There\")\n",
+ "c=a+b\n",
+ "c.show_str()\n",
+ "\n",
+ "a=str_type(\"to program in because\")\n",
+ "a.show_str()\n",
+ "\n",
+ "b=c=str_type(\"C++ is fun\")\n",
+ "\n",
+ "c=c+\" \"+a+\" \"+b\n",
+ "c.show_str()\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello There\nto program in because\nC++ is fun to program in because C++ is fun\n"
+ "text": [
+ "Hello There\n",
+ "to program in because\n",
+ "C++ is fun to program in because C++ is fun\n"
+ ]
}
],
"prompt_number": 12
@@ -255,7 +871,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_14(1).ipynb b/C++_from_the_Ground/Chapter_14(1).ipynb
index 0a3df4c8..2f8447ba 100644
--- a/C++_from_the_Ground/Chapter_14(1).ipynb
+++ b/C++_from_the_Ground/Chapter_14(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 14"
+ "name": "",
+ "signature": "sha256:d3cc78f10810f320519cd1c8becefb4790578385b5c2b528dc88273651f18c12"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,112 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 14: Inheritance<h1>"
+ "source": [
+ "<h1>Chapter 14: Inheritance<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.1, Page Number: 333<h3>"
+ "source": [
+ "<h3>Example 14.1, Page Number: 333<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate inheritance'''\n\n#Define base class for vehicles\nclass road_vehicle:\n def __init__(self):\n self.__wheels=None\n self.__passengers=None\n def set_wheels(self,num):\n self.__wheels=num\n def get_wheels(self):\n return self.__wheels\n def set_pass(self,num):\n self.__passengers=num\n def get_pass(self):\n return self.__passengers\n\n#Define a truck\nclass truck(road_vehicle):\n def __init__(self):\n self.__cargo=None\n def set_cargo(self,size):\n self.__cargo=size\n def get_cargo(self):\n return self.__cargo\n def show(self):\n print \"wheels: \",self.get_wheels()\n print \"passengers: \",self.get_pass()\n print \"cargo capacity in cubic feet: \",self.__cargo\n \n#Define an enum type\n(car,van,wagon)=(1,2,3)\ntype=[\"car\",\"van\",\"wagon\"]\n \n#Define an automobile\nclass automobile(road_vehicle):\n def __init__(self):\n self.car_type=None\n def set_type(self,t):\n self.car_type=t\n def get_type(self):\n return self.car_type\n def show(self):\n print \"wheels: \",self.get_wheels()\n print \"passengers: \",self.get_pass()\n print \"type: \",\n if self.get_type()==1:\n print \"car\"\n elif self.get_type()==2:\n print \"van\"\n elif self.get_type()==3:\n print \"wagon\"\n \n#Variable declaration\nt1=truck()\nt2=truck()\nc=automobile()\n\nt1.set_wheels(18)\nt1.set_pass(2)\nt1.set_cargo(3200)\n\nt2.set_wheels(6)\nt2.set_pass(3)\nt2.set_cargo(1200)\n\nt1.show()\nt2.show()\n\nc.set_wheels(4)\nc.set_pass(6)\nc.set_type(van)\n\nc.show() \n ",
+ "input": [
+ "\n",
+ "\n",
+ "class road_vehicle:\n",
+ " def __init__(self):\n",
+ " self.__wheels=None\n",
+ " self.__passengers=None\n",
+ " def set_wheels(self,num):\n",
+ " self.__wheels=num\n",
+ " def get_wheels(self):\n",
+ " return self.__wheels\n",
+ " def set_pass(self,num):\n",
+ " self.__passengers=num\n",
+ " def get_pass(self):\n",
+ " return self.__passengers\n",
+ "\n",
+ "#Define a truck\n",
+ "class truck(road_vehicle):\n",
+ " def __init__(self):\n",
+ " self.__cargo=None\n",
+ " def set_cargo(self,size):\n",
+ " self.__cargo=size\n",
+ " def get_cargo(self):\n",
+ " return self.__cargo\n",
+ " def show(self):\n",
+ " print \"wheels: \",self.get_wheels()\n",
+ " print \"passengers: \",self.get_pass()\n",
+ " print \"cargo capacity in cubic feet: \",self.__cargo\n",
+ " \n",
+ "#Define an enum type\n",
+ "(car,van,wagon)=(1,2,3)\n",
+ "type=[\"car\",\"van\",\"wagon\"]\n",
+ " \n",
+ "#Define an automobile\n",
+ "class automobile(road_vehicle):\n",
+ " def __init__(self):\n",
+ " self.car_type=None\n",
+ " def set_type(self,t):\n",
+ " self.car_type=t\n",
+ " def get_type(self):\n",
+ " return self.car_type\n",
+ " def show(self):\n",
+ " print \"wheels: \",self.get_wheels()\n",
+ " print \"passengers: \",self.get_pass()\n",
+ " print \"type: \",\n",
+ " if self.get_type()==1:\n",
+ " print \"car\"\n",
+ " elif self.get_type()==2:\n",
+ " print \"van\"\n",
+ " elif self.get_type()==3:\n",
+ " print \"wagon\"\n",
+ " \n",
+ "#Variable declaration\n",
+ "t1=truck()\n",
+ "t2=truck()\n",
+ "c=automobile()\n",
+ "\n",
+ "t1.set_wheels(18)\n",
+ "t1.set_pass(2)\n",
+ "t1.set_cargo(3200)\n",
+ "\n",
+ "t2.set_wheels(6)\n",
+ "t2.set_pass(3)\n",
+ "t2.set_cargo(1200)\n",
+ "\n",
+ "t1.show()\n",
+ "t2.show()\n",
+ "\n",
+ "c.set_wheels(4)\n",
+ "c.set_pass(6)\n",
+ "c.set_type(van)\n",
+ "\n",
+ "c.show() \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "wheels: 18\npassengers: 2\ncargo capacity in cubic feet: 3200\nwheels: 6\npassengers: 3\ncargo capacity in cubic feet: 1200\nwheels: 4\npassengers: 6\ntype: van\n"
+ "text": [
+ "wheels: 18\n",
+ "passengers: 2\n",
+ "cargo capacity in cubic feet: 3200\n",
+ "wheels: 6\n",
+ "passengers: 3\n",
+ "cargo capacity in cubic feet: 1200\n",
+ "wheels: 4\n",
+ "passengers: 6\n",
+ "type: van\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +124,50 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.2, Page Number: 335<h3>"
+ "source": [
+ "<h3>Example 14.2, Page Number: 335<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Base class access control'''\n\nclass base:\n def __init__(self):\n self.__i=self.__j=None\n def set(self,a,b):\n self.__i=a\n self.__j=b\n def show(self):\n print self.__i,self.__j\n \nclass derived(base):\n def __init__(self,x):\n self.__k=x\n def showk(self):\n print self.__k\n \n#Variable declaration\nob = derived(3)\n\nob.set(1,2) #access member of base\nob.show() #access member of base\n\nob.showk() #uses member of derived class\n ",
+ "input": [
+ "\n",
+ "\n",
+ "class base:\n",
+ " def __init__(self):\n",
+ " self.__i=self.__j=None\n",
+ " def set(self,a,b):\n",
+ " self.__i=a\n",
+ " self.__j=b\n",
+ " def show(self):\n",
+ " print self.__i,self.__j\n",
+ " \n",
+ "class derived(base):\n",
+ " def __init__(self,x):\n",
+ " self.__k=x\n",
+ " def showk(self):\n",
+ " print self.__k\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob = derived(3)\n",
+ "\n",
+ "ob.set(1,2) #access member of base\n",
+ "ob.show() #access member of base\n",
+ "\n",
+ "ob.showk() #uses member of derived class\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 2\n3\n"
+ "text": [
+ "1 2\n",
+ "3\n"
+ ]
}
],
"prompt_number": 1
@@ -55,19 +175,52 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.3, Page Number: 337<h3>"
+ "source": [
+ "<h3>Example 14.3, Page Number: 337<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing protected members'''\n\nclass base:\n def __init__(self):\n self.__i=self.__j=None #These act as protected members\n def set(self,a,b):\n self.__i=a\n self.__j=b\n def show(self):\n print self.__i,self.__j\n \nclass derived(base):\n def __init__(self):\n self.__k=None\n def setk(self):\n self.__k=self._base__i*self._base__j #accessing private variables in derived class\n def showk(self):\n print self.__k\n \n#Variable declaration\nob = derived()\n\nob.set(2,3) #OK, known to be derived\nob.show() #OK, known to be derived\n\nob.setk()\nob.showk() #uses member of derived class\n ",
+ "input": [
+ "\n",
+ "class base:\n",
+ " def __init__(self):\n",
+ " self.__i=self.__j=None #These act as protected members\n",
+ " def set(self,a,b):\n",
+ " self.__i=a\n",
+ " self.__j=b\n",
+ " def show(self):\n",
+ " print self.__i,self.__j\n",
+ " \n",
+ "class derived(base):\n",
+ " def __init__(self):\n",
+ " self.__k=None\n",
+ " def setk(self):\n",
+ " self.__k=self._base__i*self._base__j #accessing private variables in derived class\n",
+ " def showk(self):\n",
+ " print self.__k\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob = derived()\n",
+ "\n",
+ "ob.set(2,3) #OK, known to be derived\n",
+ "ob.show() #OK, known to be derived\n",
+ "\n",
+ "ob.setk()\n",
+ "ob.showk() #uses member of derived class\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "2 3\n6\n"
+ "text": [
+ "2 3\n",
+ "6\n"
+ ]
}
],
"prompt_number": 10
@@ -75,19 +228,73 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.4, Page Number: 338<h3>"
+ "source": [
+ "<h3>Example 14.4, Page Number: 338<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Hierarchical Inheritance in python'''\n\nclass base:\n def __init__(self):\n self.__i=None\n self.__j=None\n def set(self,a,b):\n self.__i=a\n self.__j=b\n def show(self):\n print self.__i,self.__j\n \nclass derived1(base):\n def __init__(self):\n self.__k=None\n def setk(self):\n self.__k=self._base__i*self._base__j\n def showk(self):\n print self.__k\n\nclass derived2(derived1):\n def __init__(self):\n self.__m=None\n def setm(self):\n self.__m=self._base__i-self._base__j\n def showm(self):\n print self.__m\n \n \n#Variable declaration\nob1 = derived1()\nob2 = derived2()\n\nob1.set(2,3) #access member of base\nob1.show() #access member of base\nob1.setk() #uses member of derived1 class\nob1.showk() #uses member of derived1 class\n\nob2.set(3,4) #access member of base\nob2.show() #access member of base\nob2.setk() #access member of derived1 class\nob2.setm() #access member of derived2 class\nob2.showk() #uses member of derived1 class\nob2.showm() #uses member of derived1 class\n ",
+ "input": [
+ "\n",
+ "\n",
+ "class base:\n",
+ " def __init__(self):\n",
+ " self.__i=None\n",
+ " self.__j=None\n",
+ " def set(self,a,b):\n",
+ " self.__i=a\n",
+ " self.__j=b\n",
+ " def show(self):\n",
+ " print self.__i,self.__j\n",
+ " \n",
+ "class derived1(base):\n",
+ " def __init__(self):\n",
+ " self.__k=None\n",
+ " def setk(self):\n",
+ " self.__k=self._base__i*self._base__j\n",
+ " def showk(self):\n",
+ " print self.__k\n",
+ "\n",
+ "class derived2(derived1):\n",
+ " def __init__(self):\n",
+ " self.__m=None\n",
+ " def setm(self):\n",
+ " self.__m=self._base__i-self._base__j\n",
+ " def showm(self):\n",
+ " print self.__m\n",
+ " \n",
+ " \n",
+ "#Variable declaration\n",
+ "ob1 = derived1()\n",
+ "ob2 = derived2()\n",
+ "\n",
+ "ob1.set(2,3) #access member of base\n",
+ "ob1.show() #access member of base\n",
+ "ob1.setk() #uses member of derived1 class\n",
+ "ob1.showk() #uses member of derived1 class\n",
+ "\n",
+ "ob2.set(3,4) #access member of base\n",
+ "ob2.show() #access member of base\n",
+ "ob2.setk() #access member of derived1 class\n",
+ "ob2.setm() #access member of derived2 class\n",
+ "ob2.showk() #uses member of derived1 class\n",
+ "ob2.showm() #uses member of derived1 class\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "2 3\n6\n3 4\n12\n-1\n"
+ "text": [
+ "2 3\n",
+ "6\n",
+ "3 4\n",
+ "12\n",
+ "-1\n"
+ ]
}
],
"prompt_number": 11
@@ -95,19 +302,53 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.5, Page Number: 341<h3>"
+ "source": [
+ "<h3>Example 14.5, Page Number: 341<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate inheriting a protected base class'''\n\nclass base:\n def __init__(self):\n self.__i=None\n self._j=None\n self.k=None\n def seti(self,a):\n self.__i=a\n def geti(self):\n return i\n \nclass derived(base):\n def setj(self,a):\n self._j=a\n def setk(self,a):\n self.k=a\n def getj(self):\n return self._j\n def getk(self):\n return self.k\n \n#Variable declaration \nob=derived()\n\nob.setk(10)\nprint ob.getk(),\nob.setj(12)\nprint ob.getj()",
+ "input": [
+ "\n",
+ "\n",
+ "class base:\n",
+ " def __init__(self):\n",
+ " self.__i=None\n",
+ " self._j=None\n",
+ " self.k=None\n",
+ " def seti(self,a):\n",
+ " self.__i=a\n",
+ " def geti(self):\n",
+ " return i\n",
+ " \n",
+ "class derived(base):\n",
+ " def setj(self,a):\n",
+ " self._j=a\n",
+ " def setk(self,a):\n",
+ " self.k=a\n",
+ " def getj(self):\n",
+ " return self._j\n",
+ " def getk(self):\n",
+ " return self.k\n",
+ " \n",
+ "#Variable declaration \n",
+ "ob=derived()\n",
+ "\n",
+ "ob.setk(10)\n",
+ "print ob.getk(),\n",
+ "ob.setj(12)\n",
+ "print ob.getj()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 12\n"
+ "text": [
+ "10 12\n"
+ ]
}
],
"prompt_number": 1
@@ -115,19 +356,50 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.6, Page Number: 342<h3>"
+ "source": [
+ "<h3>Example 14.6, Page Number: 342<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example of multiple base classes'''\n\nclass base1:\n def __init__(self):\n self.x=None\n def showx(self):\n print self.x\n \nclass base2:\n def __init__(self):\n self.y=None\n def showy(self):\n print self.y\n \nclass derived(base1,base2):\n def set(self,i,j):\n self.x=i\n self.y=j\n \n#Variable declaration\nob = derived()\n\nob.set(10,20) #provided by derived\nob.showx() #from base1\nob.showy() #from base2\n",
+ "input": [
+ "\n",
+ "\n",
+ "class base1:\n",
+ " def __init__(self):\n",
+ " self.x=None\n",
+ " def showx(self):\n",
+ " print self.x\n",
+ " \n",
+ "class base2:\n",
+ " def __init__(self):\n",
+ " self.y=None\n",
+ " def showy(self):\n",
+ " print self.y\n",
+ " \n",
+ "class derived(base1,base2):\n",
+ " def set(self,i,j):\n",
+ " self.x=i\n",
+ " self.y=j\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob = derived()\n",
+ "\n",
+ "ob.set(10,20) #provided by derived\n",
+ "ob.showx() #from base1\n",
+ "ob.showy() #from base2\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n20\n"
+ "text": [
+ "10\n",
+ "20\n"
+ ]
}
],
"prompt_number": 17
@@ -135,19 +407,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.7, Page Number: 343<h3>"
+ "source": [
+ "<h3>Example 14.7, Page Number: 343<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Constructors, Destructors and Inheritance'''\n\nclass base:\n def __init__(self):\n print \"Constructing base\"\n def __del__(self):\n print \"Destructing base\"\n\nclass derived(base):\n def __init__(self):\n base.__init__(self)\n print \"Constructing derived\"\n def __del__(self):\n print \"Destructing derived\"\n for b in self.__class__.__bases__:\n b.__del__(self)\n\n#Variable declaration\nob=derived()\n\n#Does nothing but construct and destruct ob",
+ "input": [
+ "\n",
+ "\n",
+ "class base:\n",
+ " def __init__(self):\n",
+ " print \"Constructing base\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing base\"\n",
+ "\n",
+ "class derived(base):\n",
+ " def __init__(self):\n",
+ " base.__init__(self)\n",
+ " print \"Constructing derived\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing derived\"\n",
+ " for b in self.__class__.__bases__:\n",
+ " b.__del__(self)\n",
+ "\n",
+ "#Variable declaration\n",
+ "ob=derived()\n",
+ "\n",
+ "#Does nothing but construct and destruct ob"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Constructing base\nConstructing derived\nDestructing derived\nDestructing base\n"
+ "text": [
+ "Constructing base\n",
+ "Constructing derived\n",
+ "Destructing derived\n",
+ "Destructing base\n"
+ ]
}
],
"prompt_number": 19
@@ -155,12 +456,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.8, Page Number: 344<h3>"
+ "source": [
+ "<h3>Example 14.8, Page Number: 344<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Inheritance 344 eg:14.8\n'''Constructors, Destructors and Inheritance'''\n\nclass base:\n def __init__(self):\n print \"Constructing base\"\n def __del__(self):\n print \"Destructing base\"\n\nclass derived1(base):\n def __init__(self):\n base.__init__(self)\n print \"Constructing derived1\"\n def __del__(self):\n print \"Destructing derived1\"\n super(derived1,self).__del__(self)\n\nclass derived2(derived1):\n def __init__(self):\n derived1.__init__(self)\n print \"Constructing derived2\"\n def __del__(self):\n print \"Destructing derived2\"\n super(self.__class__,self).__del__(self)\n \n#Variable declaration\nob=derived2()\n\n#Does nothing but construct and destruct ob",
+ "input": [
+ "\n",
+ "class base:\n",
+ " def __init__(self):\n",
+ " print \"Constructing base\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing base\"\n",
+ "\n",
+ "class derived1(base):\n",
+ " def __init__(self):\n",
+ " base.__init__(self)\n",
+ " print \"Constructing derived1\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing derived1\"\n",
+ " super(derived1,self).__del__(self)\n",
+ "\n",
+ "class derived2(derived1):\n",
+ " def __init__(self):\n",
+ " derived1.__init__(self)\n",
+ " print \"Constructing derived2\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing derived2\"\n",
+ " super(self.__class__,self).__del__(self)\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob=derived2()\n",
+ "\n",
+ "#Does nothing but construct and destruct ob"
+ ],
"language": "python",
"metadata": {},
"outputs": []
@@ -168,19 +499,55 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.9, Page Number: 345<h3>"
+ "source": [
+ "<h3>Example 14.9, Page Number: 345<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Constructors and Destructors in Multiple Inheritance'''\n\nclass base1:\n def __init__(self):\n print \"Constructing base1\"\n def __del__(self):\n print \"Destructing base1\"\n \nclass base2:\n def __init__(self):\n print \"Constructing base2\"\n def __del__(self):\n print \"Destructing base2\"\n \nclass derived(base1,base2):\n def __init__(self):\n for b in self.__class__.__bases__:\n b.__init__(self)\n print \"Constructing derived\"\n def __del__(self):\n print \"Destructing derived\"\n for b in self.__class__.__bases__:\n b.__del__(self)\n \n#Variable declaration\nob = derived()\n\n",
+ "input": [
+ "\n",
+ "class base1:\n",
+ " def __init__(self):\n",
+ " print \"Constructing base1\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing base1\"\n",
+ " \n",
+ "class base2:\n",
+ " def __init__(self):\n",
+ " print \"Constructing base2\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing base2\"\n",
+ " \n",
+ "class derived(base1,base2):\n",
+ " def __init__(self):\n",
+ " for b in self.__class__.__bases__:\n",
+ " b.__init__(self)\n",
+ " print \"Constructing derived\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing derived\"\n",
+ " for b in self.__class__.__bases__:\n",
+ " b.__del__(self)\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob = derived()\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Constructing base1\nConstructing base2\nConstructing derived\nDestructing derived\nDestructing base1\nDestructing base2\n"
+ "text": [
+ "Constructing base1\n",
+ "Constructing base2\n",
+ "Constructing derived\n",
+ "Destructing derived\n",
+ "Destructing base1\n",
+ "Destructing base2\n"
+ ]
}
],
"prompt_number": 21
@@ -188,19 +555,53 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.10, Page Number: 347<h3>"
+ "source": [
+ "<h3>Example 14.10, Page Number: 347<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Passing parameters to parent constructors in inheritance'''\n\nclass base:\n def __init__(self,x):\n self._i=x\n print \"Constructing base\"\n def __del__(self):\n print \"Destructing base\"\n\nclass derived(base):\n def __init__(self,x,y):\n base.__init__(self,y)\n self.__j=x\n print \"Constructing derived\"\n def __del__(self):\n print \"Destructing derived\"\n for b in self.__class__.__bases__:\n b.__del__(self)\n def show(self):\n print self._i,self.__j\n\n#Variable declaration\nob=derived(3,4)\n\n#Result\nob.show() #shows 4 3",
+ "input": [
+ "\n",
+ "class base:\n",
+ " def __init__(self,x):\n",
+ " self._i=x\n",
+ " print \"Constructing base\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing base\"\n",
+ "\n",
+ "class derived(base):\n",
+ " def __init__(self,x,y):\n",
+ " base.__init__(self,y)\n",
+ " self.__j=x\n",
+ " print \"Constructing derived\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing derived\"\n",
+ " for b in self.__class__.__bases__:\n",
+ " b.__del__(self)\n",
+ " def show(self):\n",
+ " print self._i,self.__j\n",
+ "\n",
+ "#Variable declaration\n",
+ "ob=derived(3,4)\n",
+ "\n",
+ "#Result\n",
+ "ob.show() #shows 4 3"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Constructing base\nConstructing derived\nDestructing derived\nDestructing base\n4 3\n"
+ "text": [
+ "Constructing base\n",
+ "Constructing derived\n",
+ "Destructing derived\n",
+ "Destructing base\n",
+ "4 3\n"
+ ]
}
],
"prompt_number": 23
@@ -208,19 +609,69 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.11, Page Number: 348<h3>"
+ "source": [
+ "<h3>Example 14.11, Page Number: 348<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example that uses multiple base classes'''\n\nclass base1:\n def __init__(self,x):\n self._i=x\n print \"Constructing base1\"\n def __del__(self):\n print \"Destructing base1\"\n \nclass base2:\n def __init__(self,x):\n self._k=x\n print \"Constructing base2\"\n def __del__(self):\n print \"Destructing base2\"\n \nclass derived(base1,base2):\n def __init__(self,x,y,z):\n self.__j=x\n i=0\n for b in self.__class__.__bases__:\n if i==0:\n b.__init__(self,y)\n else :\n b.__init__(self,z)\n i+=1\n print \"Constructing derived\"\n def __del__(self):\n print \"Destructing derived\"\n for b in self.__class__.__bases__:\n b.__del__(self)\n def show(self):\n print self._i,self.__j,self._k\n \n#Variable declaration\nob = derived(3,4,5)\n\n#Result\nob.show()\n\n",
+ "input": [
+ "\n",
+ "class base1:\n",
+ " def __init__(self,x):\n",
+ " self._i=x\n",
+ " print \"Constructing base1\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing base1\"\n",
+ " \n",
+ "class base2:\n",
+ " def __init__(self,x):\n",
+ " self._k=x\n",
+ " print \"Constructing base2\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing base2\"\n",
+ " \n",
+ "class derived(base1,base2):\n",
+ " def __init__(self,x,y,z):\n",
+ " self.__j=x\n",
+ " i=0\n",
+ " for b in self.__class__.__bases__:\n",
+ " if i==0:\n",
+ " b.__init__(self,y)\n",
+ " else :\n",
+ " b.__init__(self,z)\n",
+ " i+=1\n",
+ " print \"Constructing derived\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing derived\"\n",
+ " for b in self.__class__.__bases__:\n",
+ " b.__del__(self)\n",
+ " def show(self):\n",
+ " print self._i,self.__j,self._k\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob = derived(3,4,5)\n",
+ "\n",
+ "#Result\n",
+ "ob.show()\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Constructing base1\nConstructing base2\nConstructing derived\nDestructing derived\nDestructing base1\nDestructing base2\n4 3 5\n"
+ "text": [
+ "Constructing base1\n",
+ "Constructing base2\n",
+ "Constructing derived\n",
+ "Destructing derived\n",
+ "Destructing base1\n",
+ "Destructing base2\n",
+ "4 3 5\n"
+ ]
}
],
"prompt_number": 25
@@ -228,19 +679,68 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.12, Page Number: 348<h3>"
+ "source": [
+ "<h3>Example 14.12, Page Number: 348<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Another example that uses multiple base classes'''\n\nclass base1:\n def __init__(self,x):\n self._i=x\n print \"Constructing base1\"\n def __del__(self):\n print \"Destructing base1\"\n \nclass base2:\n def __init__(self,x):\n self._k=x\n print \"Constructing base2\"\n def __del__(self):\n print \"Destructing base2\"\n \nclass derived(base1,base2):\n def __init__(self,x,y):\n i=0\n for b in self.__class__.__bases__:\n if i==0:\n b.__init__(self,x)\n else :\n b.__init__(self,y)\n i+=1\n print \"Constructing derived\"\n def __del__(self):\n print \"Destructing derived\"\n for b in self.__class__.__bases__:\n b.__del__(self)\n def show(self):\n print self._i,self._k\n \n#Variable declaration\nob = derived(3,4)\n\n#Result\nob.show()\n\n",
+ "input": [
+ "\n",
+ "class base1:\n",
+ " def __init__(self,x):\n",
+ " self._i=x\n",
+ " print \"Constructing base1\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing base1\"\n",
+ " \n",
+ "class base2:\n",
+ " def __init__(self,x):\n",
+ " self._k=x\n",
+ " print \"Constructing base2\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing base2\"\n",
+ " \n",
+ "class derived(base1,base2):\n",
+ " def __init__(self,x,y):\n",
+ " i=0\n",
+ " for b in self.__class__.__bases__:\n",
+ " if i==0:\n",
+ " b.__init__(self,x)\n",
+ " else :\n",
+ " b.__init__(self,y)\n",
+ " i+=1\n",
+ " print \"Constructing derived\"\n",
+ " def __del__(self):\n",
+ " print \"Destructing derived\"\n",
+ " for b in self.__class__.__bases__:\n",
+ " b.__del__(self)\n",
+ " def show(self):\n",
+ " print self._i,self._k\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob = derived(3,4)\n",
+ "\n",
+ "#Result\n",
+ "ob.show()\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Constructing base1\nConstructing base2\nConstructing derived\nDestructing derived\nDestructing base1\nDestructing base2\n3 4\n"
+ "text": [
+ "Constructing base1\n",
+ "Constructing base2\n",
+ "Constructing derived\n",
+ "Destructing derived\n",
+ "Destructing base1\n",
+ "Destructing base2\n",
+ "3 4\n"
+ ]
}
],
"prompt_number": 26
@@ -248,19 +748,51 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.13, Page Number: 351<h3>"
+ "source": [
+ "<h3>Example 14.13, Page Number: 351<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Acessing member variables'''\n\nclass base:\n def __init__(self):\n self.__i=None\n self.j=self.k=None\n def seti(self,x):\n self.__i=x\n def geti(self):\n return self.__i\n\nclass derived(base):\n def __init__(self):\n self.a=None\n\n\n#Variable declaration\nob=derived()\n\nob._base__i=10 #Accessing private members of base class\nob.j=20 #legal because j and k are public variable in base\nob.k=30\n\nob.a=40 #legal because a is public in derived class\nob.seti(10)\n\n#Result\nprint ob.geti(),ob.j,ob.a",
+ "input": [
+ "\n",
+ "class base:\n",
+ " def __init__(self):\n",
+ " self.__i=None\n",
+ " self.j=self.k=None\n",
+ " def seti(self,x):\n",
+ " self.__i=x\n",
+ " def geti(self):\n",
+ " return self.__i\n",
+ "\n",
+ "class derived(base):\n",
+ " def __init__(self):\n",
+ " self.a=None\n",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "ob=derived()\n",
+ "\n",
+ "ob._base__i=10 #Accessing private members of base class\n",
+ "ob.j=20 #legal because j and k are public variable in base\n",
+ "ob.k=30\n",
+ "\n",
+ "ob.a=40 #legal because a is public in derived class\n",
+ "ob.seti(10)\n",
+ "\n",
+ "#Result\n",
+ "print ob.geti(),ob.j,ob.a"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 20 40\n"
+ "text": [
+ "10 20 40\n"
+ ]
}
],
"prompt_number": 28
@@ -268,19 +800,55 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.14, Page Number: 354<h3>"
+ "source": [
+ "<h3>Example 14.14, Page Number: 354<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Virtual base class'''\n#All classes in pyhton are effectively virtual, hence scope resolution is not needed\n\nclass base:\n def __init__(self):\n self.i=None\n\n#derived1 inherits base\nclass derived1(base):\n def __init__(self):\n self.__j=None\n \n#derived2 inherits base\nclass derived2(base):\n def __init__(self):\n self.__k=None\n\n#derived3 inherits from both derived1 and derived2\nclass derived3(derived1,derived2):\n def __init__(self):\n self.__sum=None\n \n#Variable declaration\nob=derived3()\n\nob.i=10\nob.j=20\nob.k=30\n\nob.sum=ob.i+ob.j+ob.k\n\n#Result\nprint ob.i,ob.j,ob.k,ob.sum",
+ "input": [
+ "\n",
+ "class base:\n",
+ " def __init__(self):\n",
+ " self.i=None\n",
+ "\n",
+ "#derived1 inherits base\n",
+ "class derived1(base):\n",
+ " def __init__(self):\n",
+ " self.__j=None\n",
+ " \n",
+ "#derived2 inherits base\n",
+ "class derived2(base):\n",
+ " def __init__(self):\n",
+ " self.__k=None\n",
+ "\n",
+ "#derived3 inherits from both derived1 and derived2\n",
+ "class derived3(derived1,derived2):\n",
+ " def __init__(self):\n",
+ " self.__sum=None\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob=derived3()\n",
+ "\n",
+ "ob.i=10\n",
+ "ob.j=20\n",
+ "ob.k=30\n",
+ "\n",
+ "ob.sum=ob.i+ob.j+ob.k\n",
+ "\n",
+ "#Result\n",
+ "print ob.i,ob.j,ob.k,ob.sum"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 20 30 60\n"
+ "text": [
+ "10 20 30 60\n"
+ ]
}
],
"prompt_number": 29
@@ -288,19 +856,55 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 14.15, Page Number: 355<h3>"
+ "source": [
+ "<h3>Example 14.15, Page Number: 355<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Virtual base class'''\n#All classes in pyhton are effectively virtual, hence virtual keyword is not needed\n\nclass base:\n def __init__(self):\n self.i=None\n\n#derived1 inherits base\nclass derived1(base):\n def __init__(self):\n self.__j=None\n \n#derived2 inherits base\nclass derived2(base):\n def __init__(self):\n self.__k=None\n\n#derived3 inherits from both derived1 and derived2\nclass derived3(derived1,derived2):\n def __init__(self):\n self.__sum=None\n \n#Variable declaration\nob=derived3()\n\nob.i=10\nob.j=20\nob.k=30\n\nob.sum=ob.i+ob.j+ob.k\n\n#Result\nprint ob.i,ob.j,ob.k,ob.sum",
+ "input": [
+ "\n",
+ "class base:\n",
+ " def __init__(self):\n",
+ " self.i=None\n",
+ "\n",
+ "#derived1 inherits base\n",
+ "class derived1(base):\n",
+ " def __init__(self):\n",
+ " self.__j=None\n",
+ " \n",
+ "#derived2 inherits base\n",
+ "class derived2(base):\n",
+ " def __init__(self):\n",
+ " self.__k=None\n",
+ "\n",
+ "#derived3 inherits from both derived1 and derived2\n",
+ "class derived3(derived1,derived2):\n",
+ " def __init__(self):\n",
+ " self.__sum=None\n",
+ " \n",
+ "#Variable declaration\n",
+ "ob=derived3()\n",
+ "\n",
+ "ob.i=10\n",
+ "ob.j=20\n",
+ "ob.k=30\n",
+ "\n",
+ "ob.sum=ob.i+ob.j+ob.k\n",
+ "\n",
+ "#Result\n",
+ "print ob.i,ob.j,ob.k,ob.sum"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 20 30 60\n"
+ "text": [
+ "10 20 30 60\n"
+ ]
}
],
"prompt_number": 30
@@ -308,7 +912,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_15(1).ipynb b/C++_from_the_Ground/Chapter_15(1).ipynb
index 53e0df9a..211b1c7d 100644
--- a/C++_from_the_Ground/Chapter_15(1).ipynb
+++ b/C++_from_the_Ground/Chapter_15(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 15"
+ "name": "",
+ "signature": "sha256:1198072630a182533bf651767f275df9ee5758e0d781322254bb408a8b4cffaa"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,85 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 15: Virtual Functions and Polymorphism<h1>"
+ "source": [
+ "<h1>Chapter 15: Virtual Functions and Polymorphism<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 15.1, Page Number: 358<h3>"
+ "source": [
+ "<h3>Example 15.1, Page Number: 358<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using base pointers on derived class objects'''\n\n\nclass B_class:\n def __init__(self):\n self.author=None\n def put_author(self,s):\n self.author=s\n def show_author(self):\n print self.author\n \nclass D_class(B_class):\n def __init__(self):\n self.title=None\n def put_title(self,num):\n self.title=num\n def show_title(self):\n print \"Title:\",self.title\n \n#Variable declaration\np=[B_class()] #acts as a pointer to B_class type\nB_ob=B_class()\n\ndp=[D_class()] #acts as a pointer to D_class type\nD_ob=D_class()\n\np[0]=B_ob #assigning p to object of base\n\n\n#Access B_class via pointer\np[0].put_author(\"Tom Clancy\")\n\n#Access D_class via base pointer\np[0]=D_ob\np[0].put_author(\"William Shakespeare\")\n\n#Show that each author went into proper object\nB_ob.show_author()\nD_ob.show_author()\nprint \"\\n\"\n\n#Since put_title() and show_title() are not part of the base class, \n#they are not accessible via the base pointer p and must be accessed \n#either directly, or, as shown here, through a pointer to the \n#derived type\ndp[0]=D_ob\ndp[0].put_title(\"The Tempest\")\np[0].show_author()\ndp[0].show_title()\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "class B_class:\n",
+ " def __init__(self):\n",
+ " self.author=None\n",
+ " def put_author(self,s):\n",
+ " self.author=s\n",
+ " def show_author(self):\n",
+ " print self.author\n",
+ " \n",
+ "class D_class(B_class):\n",
+ " def __init__(self):\n",
+ " self.title=None\n",
+ " def put_title(self,num):\n",
+ " self.title=num\n",
+ " def show_title(self):\n",
+ " print \"Title:\",self.title\n",
+ " \n",
+ "#Variable declaration\n",
+ "p=[B_class()] #acts as a pointer to B_class type\n",
+ "B_ob=B_class()\n",
+ "\n",
+ "dp=[D_class()] #acts as a pointer to D_class type\n",
+ "D_ob=D_class()\n",
+ "\n",
+ "p[0]=B_ob #assigning p to object of base\n",
+ "\n",
+ "\n",
+ "#Access B_class via pointer\n",
+ "p[0].put_author(\"Tom Clancy\")\n",
+ "\n",
+ "#Access D_class via base pointer\n",
+ "p[0]=D_ob\n",
+ "p[0].put_author(\"William Shakespeare\")\n",
+ "\n",
+ "#Show that each author went into proper object\n",
+ "B_ob.show_author()\n",
+ "D_ob.show_author()\n",
+ "print \"\\n\"\n",
+ "\n",
+ "#Since put_title() and show_title() are not part of the base class, \n",
+ "#they are not accessible via the base pointer p and must be accessed \n",
+ "#either directly, or, as shown here, through a pointer to the \n",
+ "#derived type\n",
+ "dp[0]=D_ob\n",
+ "dp[0].put_title(\"The Tempest\")\n",
+ "p[0].show_author()\n",
+ "dp[0].show_title()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Tom Clancy\nWilliam Shakespeare\n\n\nWilliam Shakespeare\nTitle: The Tempest\n"
+ "text": [
+ "Tom Clancy\n",
+ "William Shakespeare\n",
+ "\n",
+ "\n",
+ "William Shakespeare\n",
+ "Title: The Tempest\n"
+ ]
}
],
"prompt_number": 2
@@ -35,19 +97,56 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 15.2, Page Number: 361<h3>"
+ "source": [
+ "<h3>Example 15.2, Page Number: 361<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A short example that uses virtual functions'''\n#All functions in python are effectively virtual, hence virtual keyword not required\n\n\nclass base:\n def who(self): #virtual function\n print \"Base\"\n\nclass first_d(base):\n def who(self): #redifine who() relative to first_d\n print \"First derivation\"\n \nclass second_d(base):\n def who(self): #redifine who() relative to second_d\n print \"Second derivation\"\n \n \n#Variable declaration\nbase_obj=base()\np=[base()]\nfirst_obj=first_d()\nsecond_obj=second_d()\n\np[0]=base_obj\np[0].who() #access base's who\n\np[0]=first_obj\np[0].who() #access first_d's who\n\np[0]=second_obj\np[0].who() #access second_d's who\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class base:\n",
+ " def who(self): #virtual function\n",
+ " print \"Base\"\n",
+ "\n",
+ "class first_d(base):\n",
+ " def who(self): #redifine who() relative to first_d\n",
+ " print \"First derivation\"\n",
+ " \n",
+ "class second_d(base):\n",
+ " def who(self): #redifine who() relative to second_d\n",
+ " print \"Second derivation\"\n",
+ " \n",
+ " \n",
+ "#Variable declaration\n",
+ "base_obj=base()\n",
+ "p=[base()]\n",
+ "first_obj=first_d()\n",
+ "second_obj=second_d()\n",
+ "\n",
+ "p[0]=base_obj\n",
+ "p[0].who() #access base's who\n",
+ "\n",
+ "p[0]=first_obj\n",
+ "p[0].who() #access first_d's who\n",
+ "\n",
+ "p[0]=second_obj\n",
+ "p[0].who() #access second_d's who\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Base\nFirst derivation\nSecond derivation\n"
+ "text": [
+ "Base\n",
+ "First derivation\n",
+ "Second derivation\n"
+ ]
}
],
"prompt_number": 3
@@ -55,19 +154,57 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 15.3, Page Number: 363<h3>"
+ "source": [
+ "<h3>Example 15.3, Page Number: 363<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example that shows virtual functions are inherited'''\n\n\nclass base:\n def who(self): #virtual function\n print \"Base\"\n\nclass first_d(base):\n def who(self): #redifine who() relative to first_d\n print \"First derivation\"\n \nclass second_d(base):\n #who not defined\n pass\n \n \n#Variable declaration\nbase_obj=base()\np=[base()]\nfirst_obj=first_d()\nsecond_obj=second_d()\n\np[0]=base_obj\np[0].who() #access base's who\n\np[0]=first_obj\np[0].who() #access first_d's who\n\np[0]=second_obj\np[0].who() #access base's who because\n #second_d does not redefine it.\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class base:\n",
+ " def who(self): #virtual function\n",
+ " print \"Base\"\n",
+ "\n",
+ "class first_d(base):\n",
+ " def who(self): #redifine who() relative to first_d\n",
+ " print \"First derivation\"\n",
+ " \n",
+ "class second_d(base):\n",
+ " #who not defined\n",
+ " pass\n",
+ " \n",
+ " \n",
+ "#Variable declaration\n",
+ "base_obj=base()\n",
+ "p=[base()]\n",
+ "first_obj=first_d()\n",
+ "second_obj=second_d()\n",
+ "\n",
+ "p[0]=base_obj\n",
+ "p[0].who() #access base's who\n",
+ "\n",
+ "p[0]=first_obj\n",
+ "p[0].who() #access first_d's who\n",
+ "\n",
+ "p[0]=second_obj\n",
+ "p[0].who() #access base's who because\n",
+ " #second_d does not redefine it.\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Base\nFirst derivation\nBase\n"
+ "text": [
+ "Base\n",
+ "First derivation\n",
+ "Base\n"
+ ]
}
],
"prompt_number": 4
@@ -75,19 +212,58 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 15.4, Page Number: 364<h3>"
+ "source": [
+ "<h3>Example 15.4, Page Number: 364<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Virtual function in hierarchical inheritance'''\n\n\nclass base:\n def who(self): #virtual function\n print \"Base\"\n\nclass first_d(base):\n def who(self): #redifine who() relative to first_d\n print \"First derivation\"\n \n#second_d now inherited first_d -- not base\nclass second_d(first_d):\n #who not defined\n pass\n \n \n#Variable declaration\nbase_obj=base()\np=[base()]\nfirst_obj=first_d()\nsecond_obj=second_d()\n\np[0]=base_obj\np[0].who() #access base's who\n\np[0]=first_obj\np[0].who() #access first_d's who\n\np[0]=second_obj\np[0].who() #access first_d's who because\n #second_d does not redefine it.\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class base:\n",
+ " def who(self): #virtual function\n",
+ " print \"Base\"\n",
+ "\n",
+ "class first_d(base):\n",
+ " def who(self): #redifine who() relative to first_d\n",
+ " print \"First derivation\"\n",
+ " \n",
+ "#second_d now inherited first_d -- not base\n",
+ "class second_d(first_d):\n",
+ " #who not defined\n",
+ " pass\n",
+ " \n",
+ " \n",
+ "#Variable declaration\n",
+ "base_obj=base()\n",
+ "p=[base()]\n",
+ "first_obj=first_d()\n",
+ "second_obj=second_d()\n",
+ "\n",
+ "p[0]=base_obj\n",
+ "p[0].who() #access base's who\n",
+ "\n",
+ "p[0]=first_obj\n",
+ "p[0].who() #access first_d's who\n",
+ "\n",
+ "p[0]=second_obj\n",
+ "p[0].who() #access first_d's who because\n",
+ " #second_d does not redefine it.\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Base\nFirst derivation\nFirst derivation\n"
+ "text": [
+ "Base\n",
+ "First derivation\n",
+ "First derivation\n"
+ ]
}
],
"prompt_number": 5
@@ -95,19 +271,64 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 15.5, Page Number: 366<h3>"
+ "source": [
+ "<h3>Example 15.5, Page Number: 366<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple application of virtual functions'''\n\nclass figure:\n def __init__(self):\n self._x=None\n self._y=None\n def set_dim(self,i,j):\n self._x=i\n self._y=j\n def show_area(self):\n print \"No area computation defined\",\n print \"for this class.\"\n \nclass triangle(figure):\n def show_area(self):\n print \"Triangle with height\",\n print self._x,\"and base\",self._y,\n print \"has an area of\",\n print self._x*0.5*self._y,\".\"\n \nclass rectangle(figure):\n def show_area(self):\n print \"Rectangle with dimensions\",\n print self._x,\"x\",self._y,\n print \"has an area of\",\n print self._x*self._y,\".\"\n \n#Variable declaration\np=[figure()] #pointer to base type\nt=triangle() #objects of derived type\nr=rectangle()\n\np[0]=t\np[0].set_dim(10.0,5.0)\np[0].show_area()\n\np[0]=r\np[0].set_dim(10.0,5.0)\np[0].show_area()\n ",
+ "input": [
+ "\n",
+ "class figure:\n",
+ " def __init__(self):\n",
+ " self._x=None\n",
+ " self._y=None\n",
+ " def set_dim(self,i,j):\n",
+ " self._x=i\n",
+ " self._y=j\n",
+ " def show_area(self):\n",
+ " print \"No area computation defined\",\n",
+ " print \"for this class.\"\n",
+ " \n",
+ "class triangle(figure):\n",
+ " def show_area(self):\n",
+ " print \"Triangle with height\",\n",
+ " print self._x,\"and base\",self._y,\n",
+ " print \"has an area of\",\n",
+ " print self._x*0.5*self._y,\".\"\n",
+ " \n",
+ "class rectangle(figure):\n",
+ " def show_area(self):\n",
+ " print \"Rectangle with dimensions\",\n",
+ " print self._x,\"x\",self._y,\n",
+ " print \"has an area of\",\n",
+ " print self._x*self._y,\".\"\n",
+ " \n",
+ "#Variable declaration\n",
+ "p=[figure()] #pointer to base type\n",
+ "t=triangle() #objects of derived type\n",
+ "r=rectangle()\n",
+ "\n",
+ "p[0]=t\n",
+ "p[0].set_dim(10.0,5.0)\n",
+ "p[0].show_area()\n",
+ "\n",
+ "p[0]=r\n",
+ "p[0].set_dim(10.0,5.0)\n",
+ "p[0].show_area()\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Triangle with height 10.0 and base 5.0 has an area of 25.0 .\nRectangle with dimensions 10.0 x 5.0 has an area of 50.0 .\n"
+ "text": [
+ "Triangle with height 10.0 and base 5.0 has an area of 25.0 .\n",
+ "Rectangle with dimensions 10.0 x 5.0 has an area of 50.0 .\n"
+ ]
}
],
"prompt_number": 6
@@ -115,19 +336,78 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 15.6, Page Number: 368<h3>"
+ "source": [
+ "<h3>Example 15.6, Page Number: 368<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An expanded version of previous program'''\n\nclass figure:\n def __init__(self):\n self._x=None\n self._y=None\n def set_dim(self,i,j=0):\n self._x=i\n self._y=j\n def show_area(self):\n print \"No area computation defined\",\n print \"for this class.\"\n \nclass triangle(figure):\n def show_area(self):\n print \"Triangle with height\",\n print self._x,\"and base\",self._y,\n print \"has an area of\",\n print self._x*0.5*self._y,\".\"\n \nclass rectangle(figure):\n def show_area(self):\n print \"Rectangle with dimensions\",\n print self._x,\"x\",self._y,\n print \"has an area of\",\n print self._x*self._y,\".\"\n \nclass circle(figure):\n def show_area(self):\n print \"Circle with radius\",\n print self._x,\n print \"has an area of\",\n print 3.14*self._x*self._x,\".\"\n \n \n#Variable declaration\np=[figure()] #pointer to base type\nt=triangle() #objects of derived type\nr=rectangle()\nc=circle()\n\np[0]=t\np[0].set_dim(10.0,5.0)\np[0].show_area()\n\np[0]=r\np[0].set_dim(10.0,5.0)\np[0].show_area()\n\np[0]=c\np[0].set_dim(9.0)\np[0].show_area()\n ",
+ "input": [
+ "\n",
+ "class figure:\n",
+ " def __init__(self):\n",
+ " self._x=None\n",
+ " self._y=None\n",
+ " def set_dim(self,i,j=0):\n",
+ " self._x=i\n",
+ " self._y=j\n",
+ " def show_area(self):\n",
+ " print \"No area computation defined\",\n",
+ " print \"for this class.\"\n",
+ " \n",
+ "class triangle(figure):\n",
+ " def show_area(self):\n",
+ " print \"Triangle with height\",\n",
+ " print self._x,\"and base\",self._y,\n",
+ " print \"has an area of\",\n",
+ " print self._x*0.5*self._y,\".\"\n",
+ " \n",
+ "class rectangle(figure):\n",
+ " def show_area(self):\n",
+ " print \"Rectangle with dimensions\",\n",
+ " print self._x,\"x\",self._y,\n",
+ " print \"has an area of\",\n",
+ " print self._x*self._y,\".\"\n",
+ " \n",
+ "class circle(figure):\n",
+ " def show_area(self):\n",
+ " print \"Circle with radius\",\n",
+ " print self._x,\n",
+ " print \"has an area of\",\n",
+ " print 3.14*self._x*self._x,\".\"\n",
+ " \n",
+ " \n",
+ "#Variable declaration\n",
+ "p=[figure()] #pointer to base type\n",
+ "t=triangle() #objects of derived type\n",
+ "r=rectangle()\n",
+ "c=circle()\n",
+ "\n",
+ "p[0]=t\n",
+ "p[0].set_dim(10.0,5.0)\n",
+ "p[0].show_area()\n",
+ "\n",
+ "p[0]=r\n",
+ "p[0].set_dim(10.0,5.0)\n",
+ "p[0].show_area()\n",
+ "\n",
+ "p[0]=c\n",
+ "p[0].set_dim(9.0)\n",
+ "p[0].show_area()\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Triangle with height 10.0 and base 5.0 has an area of 25.0 .\nRectangle with dimensions 10.0 x 5.0 has an area of 50.0 .\nCircle with radius 9.0 has an area of 254.34 .\n"
+ "text": [
+ "Triangle with height 10.0 and base 5.0 has an area of 25.0 .\n",
+ "Rectangle with dimensions 10.0 x 5.0 has an area of 50.0 .\n",
+ "Circle with radius 9.0 has an area of 254.34 .\n"
+ ]
}
],
"prompt_number": 7
@@ -135,7 +415,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_16(1).ipynb b/C++_from_the_Ground/Chapter_16(1).ipynb
index afb4b4f1..941febba 100644
--- a/C++_from_the_Ground/Chapter_16(1).ipynb
+++ b/C++_from_the_Ground/Chapter_16(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 16"
+ "name": "",
+ "signature": "sha256:bbf24dca4298d6f4bb5217612c0027ad0473157ec0c530ae82f2e0944bb06ddf"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,62 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 16: Templates<h1>"
+ "source": [
+ "<h1>Chapter 16: Templates<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.1, Page Number: 376<h3>"
+ "source": [
+ "<h3>Example 16.1, Page Number: 376<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of templates'''\n\n#The concept of template in in-built in python,hence this is a function template\ndef swapargs(a,b):\n temp=a[0]\n a[0]=b[0]\n b[0]=temp\n\n#Variable declaration\ni=[10]\nj=[20]\nx=[10.1]\ny=[23.3]\na=['x']\nb=['z']\n\nprint \"Original i, j: \",i[0],j[0]\nprint \"Original x,y: \",x[0],y[0]\nprint \"Original a,b: \",a[0],b[0]\n\nswapargs(i,j) #swap integers\nswapargs(x,y) #swap floats\nswapargs(a,b) #swap chars\n\n#Result\nprint \"Swapped i, j: \",i[0],j[0]\nprint \"Swapped x,y: \",x[0],y[0]\nprint \"Swapped a,b: \",a[0],b[0]",
+ "input": [
+ "\n",
+ "def swapargs(a,b):\n",
+ " temp=a[0]\n",
+ " a[0]=b[0]\n",
+ " b[0]=temp\n",
+ "\n",
+ "#Variable declaration\n",
+ "i=[10]\n",
+ "j=[20]\n",
+ "x=[10.1]\n",
+ "y=[23.3]\n",
+ "a=['x']\n",
+ "b=['z']\n",
+ "\n",
+ "print \"Original i, j: \",i[0],j[0]\n",
+ "print \"Original x,y: \",x[0],y[0]\n",
+ "print \"Original a,b: \",a[0],b[0]\n",
+ "\n",
+ "swapargs(i,j) #swap integers\n",
+ "swapargs(x,y) #swap floats\n",
+ "swapargs(a,b) #swap chars\n",
+ "\n",
+ "#Result\n",
+ "print \"Swapped i, j: \",i[0],j[0]\n",
+ "print \"Swapped x,y: \",x[0],y[0]\n",
+ "print \"Swapped a,b: \",a[0],b[0]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original i, j: 10 20\nOriginal x,y: 10.1 23.3\nOriginal a,b: x z\nSwapped i, j: 20 10\nSwapped x,y: 23.3 10.1\nSwapped a,b: z x\n"
+ "text": [
+ "Original i, j: 10 20\n",
+ "Original x,y: 10.1 23.3\n",
+ "Original a,b: x z\n",
+ "Swapped i, j: 20 10\n",
+ "Swapped x,y: 23.3 10.1\n",
+ "Swapped a,b: z x\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +74,31 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.2, Page Number: 378<h3>"
+ "source": [
+ "<h3>Example 16.2, Page Number: 378<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Template for two generic types'''\n\ndef myfunc(x,y):\n print x,y\n \nmyfunc(10,\"hi\")\nmyfunc(0.23,10L)",
+ "input": [
+ "\n",
+ "def myfunc(x,y):\n",
+ " print x,y\n",
+ " \n",
+ "myfunc(10,\"hi\")\n",
+ "myfunc(0.23,10L)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 hi\n0.23 10\n"
+ "text": [
+ "10 hi\n",
+ "0.23 10\n"
+ ]
}
],
"prompt_number": 3
@@ -55,19 +106,65 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.3, Page Number: 379<h3>"
+ "source": [
+ "<h3>Example 16.3, Page Number: 379<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Overloading generic functions'''\n\ndef swapargs(a,b):\n if isinstance(a[0],int): #integer version\n temp=a[0]\n a[0]=b[0]\n b[0]=temp\n print \"Inside swapargs int specialization.\"\n else: #generic version\n temp=a[0]\n a[0]=b[0]\n b[0]=temp\n print \"Inside template swapargs.\"\n\n#Variable declaration\ni=[10]\nj=[20]\nx=[10.1]\ny=[23.3]\na=['x']\nb=['z']\n\nprint \"Original i, j: \",i[0],j[0]\nprint \"Original x,y: \",x[0],y[0]\nprint \"Original a,b: \",a[0],b[0]\n\nswapargs(i,j) #calls explicitly overloaded swapargs()\nswapargs(x,y) #calls generic swapargs()\nswapargs(a,b) #calls generic swapargs()\n\n#Result\nprint \"Swapped i, j: \",i[0],j[0]\nprint \"Swapped x,y: \",x[0],y[0]\nprint \"Swapped a,b: \",a[0],b[0]",
+ "input": [
+ "\n",
+ "def swapargs(a,b):\n",
+ " if isinstance(a[0],int): #integer version\n",
+ " temp=a[0]\n",
+ " a[0]=b[0]\n",
+ " b[0]=temp\n",
+ " print \"Inside swapargs int specialization.\"\n",
+ " else: #generic version\n",
+ " temp=a[0]\n",
+ " a[0]=b[0]\n",
+ " b[0]=temp\n",
+ " print \"Inside template swapargs.\"\n",
+ "\n",
+ "#Variable declaration\n",
+ "i=[10]\n",
+ "j=[20]\n",
+ "x=[10.1]\n",
+ "y=[23.3]\n",
+ "a=['x']\n",
+ "b=['z']\n",
+ "\n",
+ "print \"Original i, j: \",i[0],j[0]\n",
+ "print \"Original x,y: \",x[0],y[0]\n",
+ "print \"Original a,b: \",a[0],b[0]\n",
+ "\n",
+ "swapargs(i,j) #calls explicitly overloaded swapargs()\n",
+ "swapargs(x,y) #calls generic swapargs()\n",
+ "swapargs(a,b) #calls generic swapargs()\n",
+ "\n",
+ "#Result\n",
+ "print \"Swapped i, j: \",i[0],j[0]\n",
+ "print \"Swapped x,y: \",x[0],y[0]\n",
+ "print \"Swapped a,b: \",a[0],b[0]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original i, j: 10 20\nOriginal x,y: 10.1 23.3\nOriginal a,b: x z\nInside swapargs int specialization.\nInside template swapargs.\nInside template swapargs.\nSwapped i, j: 20 10\nSwapped x,y: 23.3 10.1\nSwapped a,b: z x\n"
+ "text": [
+ "Original i, j: 10 20\n",
+ "Original x,y: 10.1 23.3\n",
+ "Original a,b: x z\n",
+ "Inside swapargs int specialization.\n",
+ "Inside template swapargs.\n",
+ "Inside template swapargs.\n",
+ "Swapped i, j: 20 10\n",
+ "Swapped x,y: 23.3 10.1\n",
+ "Swapped a,b: z x\n"
+ ]
}
],
"prompt_number": 2
@@ -75,19 +172,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.4, Page Number: 381<h3>"
+ "source": [
+ "<h3>Example 16.4, Page Number: 381<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Overload a function template declaration'''\n\n#Function version of f() template\ndef f(a,b=None):\n if(b==None): #First version of f()\n print \"Inside f(X a)\"\n else: #Second version of f()\n print \"Inside f(X a, Y b)\"\n \nf(10) #calls f(X)\nf(10,20) #calls f(X,Y)",
+ "input": [
+ "\n",
+ "def f(a,b=None):\n",
+ " if(b==None): #First version of f()\n",
+ " print \"Inside f(X a)\"\n",
+ " else: #Second version of f()\n",
+ " print \"Inside f(X a, Y b)\"\n",
+ " \n",
+ "f(10) #calls f(X)\n",
+ "f(10,20) #calls f(X,Y)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Inside f(X a)\nInside f(X a, Y b)\n"
+ "text": [
+ "Inside f(X a)\n",
+ "Inside f(X a, Y b)\n"
+ ]
}
],
"prompt_number": 4
@@ -95,19 +207,45 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.5, Page Number: 382<h3>"
+ "source": [
+ "<h3>Example 16.5, Page Number: 382<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing templates in python'''\n\n#Display data specified number of times.\ndef repeat(data,times):\n while times:\n print data\n times-=1\n \nrepeat(\"This is a test\",3)\nrepeat(100,5)\nrepeat(99.0/2, 4)\n",
+ "input": [
+ "\n",
+ "#Display data specified number of times.\n",
+ "def repeat(data,times):\n",
+ " while times:\n",
+ " print data\n",
+ " times-=1\n",
+ " \n",
+ "repeat(\"This is a test\",3)\n",
+ "repeat(100,5)\n",
+ "repeat(99.0/2, 4)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This is a test\nThis is a test\nThis is a test\n100\n100\n100\n100\n100\n49.5\n49.5\n49.5\n49.5\n"
+ "text": [
+ "This is a test\n",
+ "This is a test\n",
+ "This is a test\n",
+ "100\n",
+ "100\n",
+ "100\n",
+ "100\n",
+ "100\n",
+ "49.5\n",
+ "49.5\n",
+ "49.5\n",
+ "49.5\n"
+ ]
}
],
"prompt_number": 5
@@ -115,19 +253,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.6, Page Number: 383<h3>"
+ "source": [
+ "<h3>Example 16.6, Page Number: 383<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A generic version of myabs()'''\n\ndef myabs(val):\n if val<0:\n return -val\n else:\n return val\n\n#Result\nprint myabs(-10)\nprint myabs(-10.0)\nprint myabs(-10L)\nprint myabs(-10.0)\n",
+ "input": [
+ "\n",
+ "def myabs(val):\n",
+ " if val<0:\n",
+ " return -val\n",
+ " else:\n",
+ " return val\n",
+ "\n",
+ "#Result\n",
+ "print myabs(-10)\n",
+ "print myabs(-10.0)\n",
+ "print myabs(-10L)\n",
+ "print myabs(-10.0)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n10.0\n10\n10.0\n"
+ "text": [
+ "10\n",
+ "10.0\n",
+ "10\n",
+ "10.0\n"
+ ]
}
],
"prompt_number": 6
@@ -135,19 +293,73 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.7, Page Number: 385<h3>"
+ "source": [
+ "<h3>Example 16.7, Page Number: 385<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing a generic queue class'''\n\ndef SIZE():\n return 100\nclass queue:\n def __init__(self):\n self.q=[]\n self.sloc=self.rloc=0\n #Put an object into the queue\n def qput(self,i):\n if self.sloc==SIZE():\n print \"Queue is full.\"\n return\n self.sloc+=1\n self.q.append(i)\n #Get an object from the queue.\n def qget(self):\n if self.rloc==self.sloc:\n print \"Queue Underflow.\"\n return\n a=self.rloc\n self.rloc+=1\n return self.q[a]\n \n#Create two integer queues\na=queue()\nb=queue()\na.qput(10)\nb.qput(19)\na.qput(20)\nb.qput(1)\n\nprint a.qget(),\nprint a.qget(),\nprint b.qget(),\nprint b.qget()\n\n#Create two double queues\nc=queue()\nd=queue()\nc.qput(10.12)\nd.qput(19.99)\nc.qput(-20.0)\nd.qput(0.986)\n\nprint c.qget(),\nprint c.qget(),\nprint d.qget(),\nprint d.qget()\n",
+ "input": [
+ "\n",
+ "def SIZE():\n",
+ " return 100\n",
+ "class queue:\n",
+ " def __init__(self):\n",
+ " self.q=[]\n",
+ " self.sloc=self.rloc=0\n",
+ " #Put an object into the queue\n",
+ " def qput(self,i):\n",
+ " if self.sloc==SIZE():\n",
+ " print \"Queue is full.\"\n",
+ " return\n",
+ " self.sloc+=1\n",
+ " self.q.append(i)\n",
+ " #Get an object from the queue.\n",
+ " def qget(self):\n",
+ " if self.rloc==self.sloc:\n",
+ " print \"Queue Underflow.\"\n",
+ " return\n",
+ " a=self.rloc\n",
+ " self.rloc+=1\n",
+ " return self.q[a]\n",
+ " \n",
+ "#Create two integer queues\n",
+ "a=queue()\n",
+ "b=queue()\n",
+ "a.qput(10)\n",
+ "b.qput(19)\n",
+ "a.qput(20)\n",
+ "b.qput(1)\n",
+ "\n",
+ "print a.qget(),\n",
+ "print a.qget(),\n",
+ "print b.qget(),\n",
+ "print b.qget()\n",
+ "\n",
+ "#Create two double queues\n",
+ "c=queue()\n",
+ "d=queue()\n",
+ "c.qput(10.12)\n",
+ "d.qput(19.99)\n",
+ "c.qput(-20.0)\n",
+ "d.qput(0.986)\n",
+ "\n",
+ "print c.qget(),\n",
+ "print c.qget(),\n",
+ "print d.qget(),\n",
+ "print d.qget()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 20 19 1\n10.12 -20.0 19.99 0.986\n"
+ "text": [
+ "10 20 19 1\n",
+ "10.12 -20.0 19.99 0.986\n"
+ ]
}
],
"prompt_number": 7
@@ -155,19 +367,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.8, Page Number: 387<h3>"
+ "source": [
+ "<h3>Example 16.8, Page Number: 387<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Two generic types in a class'''\n\nclass myclass:\n def __init__(self,a,b):\n self.__i=a\n self.__j=b\n def show(self):\n print self.__i,self.__j\n\nob1=myclass(10,0.23)\nob2=myclass('X',\"This is a test\")\n\n#Result\nob1.show() #Show int,double\nob2.show() #Show char.char*\n",
+ "input": [
+ "\n",
+ "class myclass:\n",
+ " def __init__(self,a,b):\n",
+ " self.__i=a\n",
+ " self.__j=b\n",
+ " def show(self):\n",
+ " print self.__i,self.__j\n",
+ "\n",
+ "ob1=myclass(10,0.23)\n",
+ "ob2=myclass('X',\"This is a test\")\n",
+ "\n",
+ "#Result\n",
+ "ob1.show() #Show int,double\n",
+ "ob2.show() #Show char.char*\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 0.23\nX This is a test\n"
+ "text": [
+ "10 0.23\n",
+ "X This is a test\n"
+ ]
}
],
"prompt_number": 8
@@ -175,19 +407,69 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.9, Page Number: 388<h3>"
+ "source": [
+ "<h3>Example 16.9, Page Number: 388<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A generic safe array example'''\n\n#Defining constant\ndef SIZE():\n return 10\n\nclass atype:\n def __init__(self):\n self.a=[]\n for i in range(SIZE()):\n self.a.append(i)\n #Implementing the [] overloading\n def op1(self,i,j):\n if (i<0 or i>=SIZE()):\n print \"\\nIndex value of \",\n print i,\" is out-of-bounds.\"\n return \n self.a[i]=j\n def op2(self,i):\n if (i<0 or i>SIZE()-1):\n print \"\\nIndex value of \",\n print i,\" is out-of-bounds.\"\n return\n return self.a[i]\n \n#Variable declaration\nintob=atype()\ndoubleob=atype()\n \nprint \"Integer array: \",\nfor i in range(SIZE()):\n intob.op1(i,i)\nfor i in range(SIZE()):\n print intob.op2(i),\n \nprint \"\"\n\nprint \"Double array: \",\nfor i in range(SIZE()):\n doubleob.op1(i,float(i)/3)\nfor i in range(SIZE()):\n print doubleob.op2(i),\n \nintob.op1(12,100)",
+ "input": [
+ "\n",
+ "#Defining constant\n",
+ "def SIZE():\n",
+ " return 10\n",
+ "\n",
+ "class atype:\n",
+ " def __init__(self):\n",
+ " self.a=[]\n",
+ " for i in range(SIZE()):\n",
+ " self.a.append(i)\n",
+ " #Implementing the [] overloading\n",
+ " def op1(self,i,j):\n",
+ " if (i<0 or i>=SIZE()):\n",
+ " print \"\\nIndex value of \",\n",
+ " print i,\" is out-of-bounds.\"\n",
+ " return \n",
+ " self.a[i]=j\n",
+ " def op2(self,i):\n",
+ " if (i<0 or i>SIZE()-1):\n",
+ " print \"\\nIndex value of \",\n",
+ " print i,\" is out-of-bounds.\"\n",
+ " return\n",
+ " return self.a[i]\n",
+ " \n",
+ "#Variable declaration\n",
+ "intob=atype()\n",
+ "doubleob=atype()\n",
+ " \n",
+ "print \"Integer array: \",\n",
+ "for i in range(SIZE()):\n",
+ " intob.op1(i,i)\n",
+ "for i in range(SIZE()):\n",
+ " print intob.op2(i),\n",
+ " \n",
+ "print \"\"\n",
+ "\n",
+ "print \"Double array: \",\n",
+ "for i in range(SIZE()):\n",
+ " doubleob.op1(i,float(i)/3)\n",
+ "for i in range(SIZE()):\n",
+ " print doubleob.op2(i),\n",
+ " \n",
+ "intob.op1(12,100)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Integer array: 0 1 2 3 4 5 6 7 8 9 \nDouble array: 0.0 0.333333333333 0.666666666667 1.0 1.33333333333 1.66666666667 2.0 2.33333333333 2.66666666667 3.0 \nIndex value of 12 is out-of-bounds.\n"
+ "text": [
+ "Integer array: 0 1 2 3 4 5 6 7 8 9 \n",
+ "Double array: 0.0 0.333333333333 0.666666666667 1.0 1.33333333333 1.66666666667 2.0 2.33333333333 2.66666666667 3.0 \n",
+ "Index value of 12 is out-of-bounds.\n"
+ ]
}
],
"prompt_number": 1
@@ -195,19 +477,66 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.10, Page Number: 389<h3>"
+ "source": [
+ "<h3>Example 16.10, Page Number: 389<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing non-type template arguments'''\n\nclass atype:\n def __init__(self,size):\n self.a=[]\n self.size=size\n for i in range(size):\n self.a.append(i)\n #Implementing the [] overloading\n def op1(self,i,j):\n if (i<0 or i>self.size-1):\n print \"\\nIndex value of \",\n print i,\" is out-of-bounds.\"\n return\n self.a[i]=j\n def op2(self,i):\n if (i<0 or i>self.size-1):\n print \"\\nIndex value of \",\n print i,\" is out-of-bounds.\"\n return\n return self.a[i]\n \n#Variable declaration\nintob=atype(10)\ndoubleob=atype(15)\n \nprint \"Integer array: \",\nfor i in range(10):\n intob.op1(i,i)\nfor i in range(10):\n print intob.op2(i),\n \nprint \"\"\n\nprint \"Double array: \",\nfor i in range(15):\n doubleob.op1(i,float(i)/3)\nfor i in range(15):\n print doubleob.op2(i),\n \nintob.op1(12,100) #generates runtime error\n",
+ "input": [
+ "\n",
+ "class atype:\n",
+ " def __init__(self,size):\n",
+ " self.a=[]\n",
+ " self.size=size\n",
+ " for i in range(size):\n",
+ " self.a.append(i)\n",
+ " #Implementing the [] overloading\n",
+ " def op1(self,i,j):\n",
+ " if (i<0 or i>self.size-1):\n",
+ " print \"\\nIndex value of \",\n",
+ " print i,\" is out-of-bounds.\"\n",
+ " return\n",
+ " self.a[i]=j\n",
+ " def op2(self,i):\n",
+ " if (i<0 or i>self.size-1):\n",
+ " print \"\\nIndex value of \",\n",
+ " print i,\" is out-of-bounds.\"\n",
+ " return\n",
+ " return self.a[i]\n",
+ " \n",
+ "#Variable declaration\n",
+ "intob=atype(10)\n",
+ "doubleob=atype(15)\n",
+ " \n",
+ "print \"Integer array: \",\n",
+ "for i in range(10):\n",
+ " intob.op1(i,i)\n",
+ "for i in range(10):\n",
+ " print intob.op2(i),\n",
+ " \n",
+ "print \"\"\n",
+ "\n",
+ "print \"Double array: \",\n",
+ "for i in range(15):\n",
+ " doubleob.op1(i,float(i)/3)\n",
+ "for i in range(15):\n",
+ " print doubleob.op2(i),\n",
+ " \n",
+ "intob.op1(12,100) #generates runtime error\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Integer array: 0 1 2 3 4 5 6 7 8 9 \nDouble array: 0.0 0.333333333333 0.666666666667 1.0 1.33333333333 1.66666666667 2.0 2.33333333333 2.66666666667 3.0 3.33333333333 3.66666666667 4.0 4.33333333333 4.66666666667 \nIndex value of 12 is out-of-bounds.\n"
+ "text": [
+ "Integer array: 0 1 2 3 4 5 6 7 8 9 \n",
+ "Double array: 0.0 0.333333333333 0.666666666667 1.0 1.33333333333 1.66666666667 2.0 2.33333333333 2.66666666667 3.0 3.33333333333 3.66666666667 4.0 4.33333333333 4.66666666667 \n",
+ "Index value of 12 is out-of-bounds.\n"
+ ]
}
],
"prompt_number": 2
@@ -215,19 +544,73 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.11, Page Number: 391<h3>"
+ "source": [
+ "<h3>Example 16.11, Page Number: 391<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A generic safe array example with default arguments'''\n\nclass atype:\n def __init__(self,size=10):\n self.a=[]\n for i in range(size):\n self.a.append(i)\n #Implementing the [] overloading\n def op1(self,i,j):\n if (i<0 and i>SIZE()-1):\n print \"Index value of \"\n print i,\" is out-of-bounds.\"\n exit(1)\n self.a[i]=j\n def op2(self,i):\n if (i<0 and i>SIZE()-1):\n print \"Index value of \"\n print i,\" is out-of-bounds.\"\n exit()\n return self.a[i]\n \n#Variable declaration\nintob=atype(100)\ndoubleob=atype()\ndefarray=atype()\n \nprint \"Integer array: \",\nfor i in range(100):\n intob.op1(i,i)\nfor i in range(100):\n print intob.op2(i),\n \nprint \"\"\n\nprint \"Double array: \",\nfor i in range(10):\n doubleob.op1(i,float(i)/3)\nfor i in range(10):\n print doubleob.op2(i),\n \nprint \"\"\n\nprint \"Defarray array: \",\nfor i in range(10):\n doubleob.op1(i,i)\nfor i in range(10):\n print doubleob.op2(i),\n\n",
+ "input": [
+ "\n",
+ "class atype:\n",
+ " def __init__(self,size=10):\n",
+ " self.a=[]\n",
+ " for i in range(size):\n",
+ " self.a.append(i)\n",
+ " #Implementing the [] overloading\n",
+ " def op1(self,i,j):\n",
+ " if (i<0 and i>SIZE()-1):\n",
+ " print \"Index value of \"\n",
+ " print i,\" is out-of-bounds.\"\n",
+ " exit(1)\n",
+ " self.a[i]=j\n",
+ " def op2(self,i):\n",
+ " if (i<0 and i>SIZE()-1):\n",
+ " print \"Index value of \"\n",
+ " print i,\" is out-of-bounds.\"\n",
+ " exit()\n",
+ " return self.a[i]\n",
+ " \n",
+ "#Variable declaration\n",
+ "intob=atype(100)\n",
+ "doubleob=atype()\n",
+ "defarray=atype()\n",
+ " \n",
+ "print \"Integer array: \",\n",
+ "for i in range(100):\n",
+ " intob.op1(i,i)\n",
+ "for i in range(100):\n",
+ " print intob.op2(i),\n",
+ " \n",
+ "print \"\"\n",
+ "\n",
+ "print \"Double array: \",\n",
+ "for i in range(10):\n",
+ " doubleob.op1(i,float(i)/3)\n",
+ "for i in range(10):\n",
+ " print doubleob.op2(i),\n",
+ " \n",
+ "print \"\"\n",
+ "\n",
+ "print \"Defarray array: \",\n",
+ "for i in range(10):\n",
+ " doubleob.op1(i,i)\n",
+ "for i in range(10):\n",
+ " print doubleob.op2(i),\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Integer array: 0 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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 \nDouble array: 0.0 0.333333333333 0.666666666667 1.0 1.33333333333 1.66666666667 2.0 2.33333333333 2.66666666667 3.0 \nDefarray array: 0 1 2 3 4 5 6 7 8 9\n"
+ "text": [
+ "Integer array: 0 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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 \n",
+ "Double array: 0.0 0.333333333333 0.666666666667 1.0 1.33333333333 1.66666666667 2.0 2.33333333333 2.66666666667 3.0 \n",
+ "Defarray array: 0 1 2 3 4 5 6 7 8 9\n"
+ ]
}
],
"prompt_number": 3
@@ -235,19 +618,45 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 16.12, Page Number: 393<h3>"
+ "source": [
+ "<h3>Example 16.12, Page Number: 393<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate class specialization'''\n\nclass myclass:\n def __init__(self,a):\n if isinstance(a,int):\n print \"Inside myclass<int>specialization\"\n self.__x=a*a\n else:\n print \"Inside generic myclass\"\n self.__x=a\n def getx(self):\n return self.__x\n \nd=myclass(10.1)\nprint \"double: \",d.getx(),\"\\n\"\n\ni=myclass(5)\nprint \"int: \",i.getx()\n",
+ "input": [
+ "\n",
+ "class myclass:\n",
+ " def __init__(self,a):\n",
+ " if isinstance(a,int):\n",
+ " print \"Inside myclass<int>specialization\"\n",
+ " self.__x=a*a\n",
+ " else:\n",
+ " print \"Inside generic myclass\"\n",
+ " self.__x=a\n",
+ " def getx(self):\n",
+ " return self.__x\n",
+ " \n",
+ "d=myclass(10.1)\n",
+ "print \"double: \",d.getx(),\"\\n\"\n",
+ "\n",
+ "i=myclass(5)\n",
+ "print \"int: \",i.getx()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Inside generic myclass\ndouble: 10.1 \n\nInside myclass<int>specialization\nint: 25\n"
+ "text": [
+ "Inside generic myclass\n",
+ "double: 10.1 \n",
+ "\n",
+ "Inside myclass<int>specialization\n",
+ "int: 25\n"
+ ]
}
],
"prompt_number": 4
@@ -255,7 +664,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_17(1).ipynb b/C++_from_the_Ground/Chapter_17(1).ipynb
index 8694627c..c50f48aa 100644
--- a/C++_from_the_Ground/Chapter_17(1).ipynb
+++ b/C++_from_the_Ground/Chapter_17(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 17"
+ "name": "",
+ "signature": "sha256:636fe844c88ef46d09064f199c6b3a4c62e262611a41cc6f126f08459b94982e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 17: Exception Handling<h1>"
+ "source": [
+ "<h1>Chapter 17: Exception Handling<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.1, Page Number: 397<h3>"
+ "source": [
+ "<h3>Example 17.1, Page Number: 397<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple exception handling example'''\n\nprint \"start\"\n\ntry: #start a try block\n print \"Inside try block\"\n raise Exception(99) #raise an error\n print \"This will not execute\"\nexcept Exception,i: #catch an error\n print \"Caught an exception -- value is:\",\n print i\n\nprint \"end\"",
+ "input": [
+ "\n",
+ "print \"start\"\n",
+ "\n",
+ "try: #start a try block\n",
+ " print \"Inside try block\"\n",
+ " raise Exception(99) #raise an error\n",
+ " print \"This will not execute\"\n",
+ "except Exception,i: #catch an error\n",
+ " print \"Caught an exception -- value is:\",\n",
+ " print i\n",
+ "\n",
+ "print \"end\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "start\nInside try block\nCaught an exception -- value is: 99\nend\n"
+ "text": [
+ "start\n",
+ "Inside try block\n",
+ "Caught an exception -- value is: 99\n",
+ "end\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +58,49 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.2, Page Number: 399<h3>"
+ "source": [
+ "<h3>Example 17.2, Page Number: 399<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''A simple exception handling example'''\n\nimport sys\n\n\n\ndef main():\n print \"start\"\n try: #start a try block\n print \"Inside try block\"\n raise Exception(99) #raise an error\n print \"This will not execute\"\n except Exception,i: #catch an error\n if isinstance(i,float):\n print \"Caught an exception -- value is:\",\n print i\n else:\n print \"Abnormal program termination\"\n return\n print \"end\"\n\n \nmain()",
+ "input": [
+ "\n",
+ "\n",
+ "import sys\n",
+ "\n",
+ "\n",
+ "\n",
+ "def main():\n",
+ " print \"start\"\n",
+ " try: #start a try block\n",
+ " print \"Inside try block\"\n",
+ " raise Exception(99) #raise an error\n",
+ " print \"This will not execute\"\n",
+ " except Exception,i: #catch an error\n",
+ " if isinstance(i,float):\n",
+ " print \"Caught an exception -- value is:\",\n",
+ " print i\n",
+ " else:\n",
+ " print \"Abnormal program termination\"\n",
+ " return\n",
+ " print \"end\"\n",
+ "\n",
+ " \n",
+ "main()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "start\nInside try block\nAbnormal program termination\n"
+ "text": [
+ "start\n",
+ "Inside try block\n",
+ "Abnormal program termination\n"
+ ]
}
],
"prompt_number": 1
@@ -55,19 +108,47 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.3, Page Number: 400<h3>"
+ "source": [
+ "<h3>Example 17.3, Page Number: 400<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Throwing an exception from a function called \n from within a try block'''\n\ndef Xtest(test):\n print \"Inside Xtest, test is: \",test\n if(test):\n raise Exception(test)\n \nprint \"start\"\n\ntry: #start a try block\n print \"Inside try block\"\n Xtest(0)\n Xtest(1)\n Xtest(2)\nexcept Exception,i: #catch an error\n print \"Caught an exception -- value is:\",\n print i\n\nprint \"end\"",
+ "input": [
+ "\n",
+ "def Xtest(test):\n",
+ " print \"Inside Xtest, test is: \",test\n",
+ " if(test):\n",
+ " raise Exception(test)\n",
+ " \n",
+ "print \"start\"\n",
+ "\n",
+ "try: #start a try block\n",
+ " print \"Inside try block\"\n",
+ " Xtest(0)\n",
+ " Xtest(1)\n",
+ " Xtest(2)\n",
+ "except Exception,i: #catch an error\n",
+ " print \"Caught an exception -- value is:\",\n",
+ " print i\n",
+ "\n",
+ "print \"end\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "start\nInside try block\nInside Xtest, test is: 0\nInside Xtest, test is: 1\nCaught an exception -- value is: 1\nend\n"
+ "text": [
+ "start\n",
+ "Inside try block\n",
+ "Inside Xtest, test is: 0\n",
+ "Inside Xtest, test is: 1\n",
+ "Caught an exception -- value is: 1\n",
+ "end\n"
+ ]
}
],
"prompt_number": 2
@@ -75,19 +156,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.4, Page Number: 401<h3>"
+ "source": [
+ "<h3>Example 17.4, Page Number: 401<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A try/except is reset each time a function is entered'''\n\ndef Xhandler(test):\n try:\n if(test):\n raise Exception(test)\n except Exception,i:\n print \"Caught One! Ex #:\",i\n \nprint \"start\"\n\nXhandler(1)\nXhandler(2)\nXhandler(0)\nXhandler(3)\n\nprint \"end\"",
+ "input": [
+ "\n",
+ "def Xhandler(test):\n",
+ " try:\n",
+ " if(test):\n",
+ " raise Exception(test)\n",
+ " except Exception,i:\n",
+ " print \"Caught One! Ex #:\",i\n",
+ " \n",
+ "print \"start\"\n",
+ "\n",
+ "Xhandler(1)\n",
+ "Xhandler(2)\n",
+ "Xhandler(0)\n",
+ "Xhandler(3)\n",
+ "\n",
+ "print \"end\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "start\nCaught One! Ex #: 1\nCaught One! Ex #: 2\nCaught One! Ex #: 3\nend\n"
+ "text": [
+ "start\n",
+ "Caught One! Ex #: 1\n",
+ "Caught One! Ex #: 2\n",
+ "Caught One! Ex #: 3\n",
+ "end\n"
+ ]
}
],
"prompt_number": 3
@@ -95,19 +201,47 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.5, Page Number: 401<h3>"
+ "source": [
+ "<h3>Example 17.5, Page Number: 401<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Use exception class'''\n\nclass MyException:\n def __init__(self,s):\n self.str_what=s\n \n#Variable declaration\na=None \nb=None\n\ntry:\n print \"Enter numerator and denominator:\"\n #User-input\n a=10 \n b=0\n if not(b):\n raise MyException(\"Cannot divide by zero!\")\n else:\n print \"Quotient is\",a/b\nexcept MyException as e: #catch an error\n print e.str_what\n ",
+ "input": [
+ "\n",
+ "\n",
+ "class MyException:\n",
+ " def __init__(self,s):\n",
+ " self.str_what=s\n",
+ " \n",
+ "#Variable declaration\n",
+ "a=None \n",
+ "b=None\n",
+ "\n",
+ "try:\n",
+ " print \"Enter numerator and denominator:\"\n",
+ " #User-input\n",
+ " a=10 \n",
+ " b=0\n",
+ " if not(b):\n",
+ " raise MyException(\"Cannot divide by zero!\")\n",
+ " else:\n",
+ " print \"Quotient is\",a/b\n",
+ "except MyException as e: #catch an error\n",
+ " print e.str_what\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter numerator and denominator:\nCannot divide by zero!\n"
+ "text": [
+ "Enter numerator and denominator:\n",
+ "Cannot divide by zero!\n"
+ ]
}
],
"prompt_number": 4
@@ -115,19 +249,55 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.6, Page Number: 403<h3>"
+ "source": [
+ "<h3>Example 17.6, Page Number: 403<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Different types of exceptions being caught'''\n\nclass MyException:\n def __init__(self,s):\n self.x=s\n \ndef Xhandler(test):\n try:\n if(test):\n raise MyException(test)\n else:\n raise MyException(\"Value is zero\")\n except MyException as i:\n if isinstance(i.x,int):\n print \"Caught One! Ex #:\",i.x\n else:\n print \"Caught a string:\",\n print i.x\n \nprint \"start\"\n\nXhandler(1)\nXhandler(2)\nXhandler(0)\nXhandler(3)\n\nprint \"end\"",
+ "input": [
+ "\n",
+ "class MyException:\n",
+ " def __init__(self,s):\n",
+ " self.x=s\n",
+ " \n",
+ "def Xhandler(test):\n",
+ " try:\n",
+ " if(test):\n",
+ " raise MyException(test)\n",
+ " else:\n",
+ " raise MyException(\"Value is zero\")\n",
+ " except MyException as i:\n",
+ " if isinstance(i.x,int):\n",
+ " print \"Caught One! Ex #:\",i.x\n",
+ " else:\n",
+ " print \"Caught a string:\",\n",
+ " print i.x\n",
+ " \n",
+ "print \"start\"\n",
+ "\n",
+ "Xhandler(1)\n",
+ "Xhandler(2)\n",
+ "Xhandler(0)\n",
+ "Xhandler(3)\n",
+ "\n",
+ "print \"end\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "start\nCaught One! Ex #: 1\nCaught One! Ex #: 2\nCaught a string: Value is zero\nCaught One! Ex #: 3\nend\n"
+ "text": [
+ "start\n",
+ "Caught One! Ex #: 1\n",
+ "Caught One! Ex #: 2\n",
+ "Caught a string: Value is zero\n",
+ "Caught One! Ex #: 3\n",
+ "end\n"
+ ]
}
],
"prompt_number": 5
@@ -135,19 +305,41 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.7, Page Number: 404<h3>"
+ "source": [
+ "<h3>Example 17.7, Page Number: 404<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Catching derived classes'''\n\nclass B:\n pass\n\nclass D(B):\n pass\n\nderived=D()\n\ntry:\n raise B()\nexcept B as b:\n print \"Caught a base class.\"\nexcept D as d:\n print \"This wont execute.\"\n ",
+ "input": [
+ "\n",
+ "\n",
+ "class B:\n",
+ " pass\n",
+ "\n",
+ "class D(B):\n",
+ " pass\n",
+ "\n",
+ "derived=D()\n",
+ "\n",
+ "try:\n",
+ " raise B()\n",
+ "except B as b:\n",
+ " print \"Caught a base class.\"\n",
+ "except D as d:\n",
+ " print \"This wont execute.\"\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Caught a base class.\n"
+ "text": [
+ "Caught a base class.\n"
+ ]
}
],
"prompt_number": 6
@@ -155,19 +347,47 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.8, Page Number: 405<h3>"
+ "source": [
+ "<h3>Example 17.8, Page Number: 405<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example to catch all exceptions'''\n\ndef Xhandler(test):\n try:\n if test==0:\n raise Exception(test) #throw int\n if test==1:\n raise Exception('a') #throw char\n if test==2:\n raise Exception(123.23) #throw double\n except: #Catches all exceptions\n print \"Caught One!\"\n\nprint \"start\"\n\nXhandler(0)\nXhandler(1)\nXhandler(2)\n\nprint \"end\"",
+ "input": [
+ "\n",
+ "def Xhandler(test):\n",
+ " try:\n",
+ " if test==0:\n",
+ " raise Exception(test) #throw int\n",
+ " if test==1:\n",
+ " raise Exception('a') #throw char\n",
+ " if test==2:\n",
+ " raise Exception(123.23) #throw double\n",
+ " except: #Catches all exceptions\n",
+ " print \"Caught One!\"\n",
+ "\n",
+ "print \"start\"\n",
+ "\n",
+ "Xhandler(0)\n",
+ "Xhandler(1)\n",
+ "Xhandler(2)\n",
+ "\n",
+ "print \"end\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "start\nCaught One!\nCaught One!\nCaught One!\nend\n"
+ "text": [
+ "start\n",
+ "Caught One!\n",
+ "Caught One!\n",
+ "Caught One!\n",
+ "end\n"
+ ]
}
],
"prompt_number": 7
@@ -175,19 +395,55 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.9, Page Number: 405<h3>"
+ "source": [
+ "<h3>Example 17.9, Page Number: 405<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example to catch all exceptions'''\n\nclass MyException:\n def __init__(self,s):\n self.x=s\n \ndef Xhandler(test):\n try:\n if test==0:\n raise MyException(test) #throw int\n if test==1:\n raise MyException('a') #throw char\n if test==2:\n raise MyException(123.23) #throw double\n except MyException as i:\n if isinstance(i.x,int): #catch an int exception\n print \"Caught\",i.x \n else: #catch all other exceptions\n print \"Caught One!\"\n \n\nprint \"start\"\n\nXhandler(0)\nXhandler(1)\nXhandler(2)\n\nprint \"end\"",
+ "input": [
+ "\n",
+ "class MyException:\n",
+ " def __init__(self,s):\n",
+ " self.x=s\n",
+ " \n",
+ "def Xhandler(test):\n",
+ " try:\n",
+ " if test==0:\n",
+ " raise MyException(test) #throw int\n",
+ " if test==1:\n",
+ " raise MyException('a') #throw char\n",
+ " if test==2:\n",
+ " raise MyException(123.23) #throw double\n",
+ " except MyException as i:\n",
+ " if isinstance(i.x,int): #catch an int exception\n",
+ " print \"Caught\",i.x \n",
+ " else: #catch all other exceptions\n",
+ " print \"Caught One!\"\n",
+ " \n",
+ "\n",
+ "print \"start\"\n",
+ "\n",
+ "Xhandler(0)\n",
+ "Xhandler(1)\n",
+ "Xhandler(2)\n",
+ "\n",
+ "print \"end\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "start\nCaught 0\nCaught One!\nCaught One!\nend\n"
+ "text": [
+ "start\n",
+ "Caught 0\n",
+ "Caught One!\n",
+ "Caught One!\n",
+ "end\n"
+ ]
}
],
"prompt_number": 8
@@ -195,19 +451,53 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.10, Page Number: 407<h3>"
+ "source": [
+ "<h3>Example 17.10, Page Number: 407<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Restricting function throw types'''\n\nclass MyException:\n def __init__(self,s):\n self.x=s\n \n#This function can only throw ints, chars and doubles\ndef Xhandler(test):\n if test==0:\n raise MyException(test) #throw int\n if test==1:\n raise MyException('a') #throw char\n if test==2:\n raise MyException(123.23) #throw double\n \n\nprint \"start\"\ntry:\n Xhandler(0)\nexcept MyException as i:\n if isinstance(i.x,int): #catch an int exception\n print \"Caught int\" \n elif isinstance(i.x,str): #catch a char exception\n print \"Caught char\"\n elif isinstance(i.x,float): #catch a float exception\n print \"Caught double\"\n\nprint \"end\"",
+ "input": [
+ "\n",
+ "class MyException:\n",
+ " def __init__(self,s):\n",
+ " self.x=s\n",
+ " \n",
+ "#This function can only throw ints, chars and doubles\n",
+ "def Xhandler(test):\n",
+ " if test==0:\n",
+ " raise MyException(test) #throw int\n",
+ " if test==1:\n",
+ " raise MyException('a') #throw char\n",
+ " if test==2:\n",
+ " raise MyException(123.23) #throw double\n",
+ " \n",
+ "\n",
+ "print \"start\"\n",
+ "try:\n",
+ " Xhandler(0)\n",
+ "except MyException as i:\n",
+ " if isinstance(i.x,int): #catch an int exception\n",
+ " print \"Caught int\" \n",
+ " elif isinstance(i.x,str): #catch a char exception\n",
+ " print \"Caught char\"\n",
+ " elif isinstance(i.x,float): #catch a float exception\n",
+ " print \"Caught double\"\n",
+ "\n",
+ "print \"end\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "start\nCaught int\nend\n"
+ "text": [
+ "start\n",
+ "Caught int\n",
+ "end\n"
+ ]
}
],
"prompt_number": 9
@@ -215,19 +505,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.11, Page Number: 408<h3>"
+ "source": [
+ "<h3>Example 17.11, Page Number: 408<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example of \"rethrowing\" an exception'''\n\ndef Xhandler():\n try:\n raise Exception(\"hello\") #throw a char *\n except Exception,c: #catch a char *\n print \"Caugh char * inside Xhandler\"\n raise #rethrow char * out of function\n \nprint \"start\"\ntry:\n Xhandler()\nexcept Exception,c:\n print \"Caught char * inside main\"\n \nprint \"end\"",
+ "input": [
+ "\n",
+ "def Xhandler():\n",
+ " try:\n",
+ " raise Exception(\"hello\") #throw a char *\n",
+ " except Exception,c: #catch a char *\n",
+ " print \"Caugh char * inside Xhandler\"\n",
+ " raise #rethrow char * out of function\n",
+ " \n",
+ "print \"start\"\n",
+ "try:\n",
+ " Xhandler()\n",
+ "except Exception,c:\n",
+ " print \"Caught char * inside main\"\n",
+ " \n",
+ "print \"end\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "start\nCaugh char * inside Xhandler\nCaught char * inside main\nend\n"
+ "text": [
+ "start\n",
+ "Caugh char * inside Xhandler\n",
+ "Caught char * inside main\n",
+ "end\n"
+ ]
}
],
"prompt_number": 10
@@ -235,19 +548,43 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.12, Page Number: 410<h3>"
+ "source": [
+ "<h3>Example 17.12, Page Number: 410<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Handle exceptions due to allocation failure'''\n\nfrom ctypes import *\n\n#Variable declaration\np=[]\n\ntry:\n for i in range(32):\n p.append(c_int())\nexcept MemoryError,m:\n print \"Allocation failure.\"\n \nfor i in range(32):\n p[i]=i\n \nfor i in range(32):\n print p[i],\n \n ",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "p=[]\n",
+ "\n",
+ "try:\n",
+ " for i in range(32):\n",
+ " p.append(c_int())\n",
+ "except MemoryError,m:\n",
+ " print \"Allocation failure.\"\n",
+ " \n",
+ "for i in range(32):\n",
+ " p[i]=i\n",
+ " \n",
+ "for i in range(32):\n",
+ " print p[i],\n",
+ " \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 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\n"
+ "text": [
+ "0 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\n"
+ ]
}
],
"prompt_number": 12
@@ -255,19 +592,43 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.13, Page Number: 410<h3>"
+ "source": [
+ "<h3>Example 17.13, Page Number: 410<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Checking allocation failure without raising an exception'''\n\nfrom ctypes import *\n\n#Variable declaration\np=[]\n\n\nfor i in range(32):\n p.append(c_int()) \nif not(p):\n print \"Allocation failure.\"\n \nfor i in range(32):\n p[i]=i\n \nfor i in range(32):\n print p[i],\n \n ",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "p=[]\n",
+ "\n",
+ "\n",
+ "for i in range(32):\n",
+ " p.append(c_int()) \n",
+ "if not(p):\n",
+ " print \"Allocation failure.\"\n",
+ " \n",
+ "for i in range(32):\n",
+ " p[i]=i\n",
+ " \n",
+ "for i in range(32):\n",
+ " print p[i],\n",
+ " \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 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\n"
+ "text": [
+ "0 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\n"
+ ]
}
],
"prompt_number": 13
@@ -275,19 +636,81 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 17.13, Page Number: 412<h3>"
+ "source": [
+ "<h3>Example 17.13, Page Number: 412<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate overloaded new and delete'''\n\nclass three_d:\n def __init__(self,i=0,j=0,k=0): #3=D coordinates\n if(i==0 and j==0 and k==0):\n self.x=self.y=self.z=0\n print \"Constructing 0, 0, 0\"\n else:\n self.x=i\n self.y=j\n self.z=k\n print \"Constructing\",i,\",\",j,\",\",k\n def __del__(self):\n print \"Destructing\"\n #new overloaded relative to three_d.\n def __new__(typ, *args, **kwargs):\n obj = object.__new__(typ, *args, **kwargs)\n return obj\n def show(self):\n print self.x,\",\",\n print self.y,\",\",\n print self.z\n \np1=[]*3\np2=[]\n \ntry:\n print \"Allocating array of three_d objects.\"\n for i in range(3): #allocate array\n p1.append(three_d())\n print \"Allocating three_d object.\"\n p2.append(three_d(5,6,7)) #allocate object\nexcept MemoryError:\n print \"Allocation error\"\n \np1[2].show()\np2[0].show()\n\n\nfor i in xrange(2,-1,-1):\n del p1[i] #delete array\nprint \"Deleting array of thee_d objects.\"\n\ndel p2[0] #delete object\nprint \"Deleting three_d object.\"",
+ "input": [
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,i=0,j=0,k=0): #3=D coordinates\n",
+ " if(i==0 and j==0 and k==0):\n",
+ " self.x=self.y=self.z=0\n",
+ " print \"Constructing 0, 0, 0\"\n",
+ " else:\n",
+ " self.x=i\n",
+ " self.y=j\n",
+ " self.z=k\n",
+ " print \"Constructing\",i,\",\",j,\",\",k\n",
+ " def __del__(self):\n",
+ " print \"Destructing\"\n",
+ " #new overloaded relative to three_d.\n",
+ " def __new__(typ, *args, **kwargs):\n",
+ " obj = object.__new__(typ, *args, **kwargs)\n",
+ " return obj\n",
+ " def show(self):\n",
+ " print self.x,\",\",\n",
+ " print self.y,\",\",\n",
+ " print self.z\n",
+ " \n",
+ "p1=[]*3\n",
+ "p2=[]\n",
+ " \n",
+ "try:\n",
+ " print \"Allocating array of three_d objects.\"\n",
+ " for i in range(3): #allocate array\n",
+ " p1.append(three_d())\n",
+ " print \"Allocating three_d object.\"\n",
+ " p2.append(three_d(5,6,7)) #allocate object\n",
+ "except MemoryError:\n",
+ " print \"Allocation error\"\n",
+ " \n",
+ "p1[2].show()\n",
+ "p2[0].show()\n",
+ "\n",
+ "\n",
+ "for i in xrange(2,-1,-1):\n",
+ " del p1[i] #delete array\n",
+ "print \"Deleting array of thee_d objects.\"\n",
+ "\n",
+ "del p2[0] #delete object\n",
+ "print \"Deleting three_d object.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Allocating array of three_d objects.\nConstructing 0, 0, 0\nConstructing 0, 0, 0\nConstructing 0, 0, 0\nAllocating three_d object.\nConstructing 5 , 6 , 7\n0 , 0 , 0\n5 , 6 , 7\nDestructing\nDestructing\nDestructing\nDeleting array of thee_d objects.\nDestructing\nDeleting three_d object.\n"
+ "text": [
+ "Allocating array of three_d objects.\n",
+ "Constructing 0, 0, 0\n",
+ "Constructing 0, 0, 0\n",
+ "Constructing 0, 0, 0\n",
+ "Allocating three_d object.\n",
+ "Constructing 5 , 6 , 7\n",
+ "0 , 0 , 0\n",
+ "5 , 6 , 7\n",
+ "Destructing\n",
+ "Destructing\n",
+ "Destructing\n",
+ "Deleting array of thee_d objects.\n",
+ "Destructing\n",
+ "Deleting three_d object.\n"
+ ]
}
],
"prompt_number": 14
@@ -295,7 +718,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_18(1).ipynb b/C++_from_the_Ground/Chapter_18(1).ipynb
index 3ad3c39c..e2cae07f 100644
--- a/C++_from_the_Ground/Chapter_18(1).ipynb
+++ b/C++_from_the_Ground/Chapter_18(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 18"
+ "name": "",
+ "signature": "sha256:3dbb4b61b32533eb72607c7c790e9f8f91b9c2e123ddbd5190ffe13a1b2b7647"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,51 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 18: The C++ I/O System<h1>"
+ "source": [
+ "<h1>Chapter 18: The C++ I/O System<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.1, Page Number: 421<h3>"
+ "source": [
+ "<h3>Example 18.1, Page Number: 421<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of overloading << for print in python'''\n\nclass three_d:\n def __init__(self,a,b,c): #3D coordinates\n self.x=a\n self.y=b\n self.z=c\n #Display x,y,z coordinates - three_d inserter.\n def __repr__(self):\n return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n\n#Variable declaration\na=three_d(1,2,3)\nb=three_d(3,4,5)\nc=three_d(5,6,7)\n\n#Result\nprint a,b,c",
+ "input": [
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,a,b,c): #3D coordinates\n",
+ " self.x=a\n",
+ " self.y=b\n",
+ " self.z=c\n",
+ " #Display x,y,z coordinates - three_d inserter.\n",
+ " def __repr__(self):\n",
+ " return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=three_d(1,2,3)\n",
+ "b=three_d(3,4,5)\n",
+ "c=three_d(5,6,7)\n",
+ "\n",
+ "#Result\n",
+ "print a,b,c"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1, 2, 3\n 3, 4, 5\n 5, 6, 7\n\n"
+ "text": [
+ "1, 2, 3\n",
+ " 3, 4, 5\n",
+ " 5, 6, 7\n",
+ "\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +63,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.2, Page Number: 423<h3>"
+ "source": [
+ "<h3>Example 18.2, Page Number: 423<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using a friend function implement overloading of << in python'''\n\nclass thrnee_d:\n def __init__(self,a,b,c): #3D coordinates\n self.x=a\n self.y=b\n self.z=c\n #Display x,y,z coordinates - three_d inserter.\n __repr__=repr \n \n#Friend function \ndef repr():\n return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n\n#Variable declaration\na=three_d(1,2,3)\nb=three_d(3,4,5)\nc=three_d(5,6,7)\n\nprint a,b,c",
+ "input": [
+ "\n",
+ "class thrnee_d:\n",
+ " def __init__(self,a,b,c): #3D coordinates\n",
+ " self.x=a\n",
+ " self.y=b\n",
+ " self.z=c\n",
+ " #Display x,y,z coordinates - three_d inserter.\n",
+ " __repr__=repr \n",
+ " \n",
+ "#Friend function \n",
+ "def repr():\n",
+ " return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=three_d(1,2,3)\n",
+ "b=three_d(3,4,5)\n",
+ "c=three_d(5,6,7)\n",
+ "\n",
+ "print a,b,c"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1, 2, 3\n 3, 4, 5\n 5, 6, 7\n\n"
+ "text": [
+ "1, 2, 3\n",
+ " 3, 4, 5\n",
+ " 5, 6, 7\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -55,19 +110,45 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.3, Page Number: 424<h3>"
+ "source": [
+ "<h3>Example 18.3, Page Number: 424<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of overloading << and >> in python'''\n\nclass three_d:\n def __init__(self,a,b,c): #3D coordinates\n self.x=a\n self.y=b\n self.z=c\n #Display x,y,z coordinates - three_d inserter.\n def __repr__(self):\n return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)\n\n#Variable declaration\na=three_d(1,2,3)\n\nprint a\n\n#User input\nprint \"Enter X,Y,Z values:\"\na=three_d(4,5,6) \nprint a",
+ "input": [
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,a,b,c): #3D coordinates\n",
+ " self.x=a\n",
+ " self.y=b\n",
+ " self.z=c\n",
+ " #Display x,y,z coordinates - three_d inserter.\n",
+ " def __repr__(self):\n",
+ " return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=three_d(1,2,3)\n",
+ "\n",
+ "print a\n",
+ "\n",
+ "#User input\n",
+ "print \"Enter X,Y,Z values:\"\n",
+ "a=three_d(4,5,6) \n",
+ "print a"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1, 2, 3\nEnter X,Y,Z values:\n4, 5, 6\n"
+ "text": [
+ "1, 2, 3\n",
+ "Enter X,Y,Z values:\n",
+ "4, 5, 6\n"
+ ]
}
],
"prompt_number": 3
@@ -75,19 +156,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.4, Page Number: 428<h3>"
+ "source": [
+ "<h3>Example 18.4, Page Number: 428<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing some ios flags in python'''\n\n\nprint '{0:+d}'.format(123), #for ios::showpos\nif(123.23>0):\n i='{0:e}'.format(123.23) #for ios::scientific \n i='+'+i\n print i\nelse :\n print '{0:e}'.format(123.23)\n ",
+ "input": [
+ "\n",
+ "\n",
+ "print '{0:+d}'.format(123), #for ios::showpos\n",
+ "if(123.23>0):\n",
+ " i='{0:e}'.format(123.23) #for ios::scientific \n",
+ " i='+'+i\n",
+ " print i\n",
+ "else :\n",
+ " print '{0:e}'.format(123.23)\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "+123 +1.232300e+02\n"
+ "text": [
+ "+123 +1.232300e+02\n"
+ ]
}
],
"prompt_number": 4
@@ -95,19 +191,55 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.5, Page Number: 430<h3>"
+ "source": [
+ "<h3>Example 18.5, Page Number: 430<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing some ios flags in python'''\n\nimport string\n\nprint '{0:+d}'.format(123), #for ios::showpos\nif(123.23>0):\n i='{0:e}'.format(123.23) #for ios::scientific \n i='+'+i\n print i\nelse :\n print '{0:e}'.format(123.23)\n\n \nprint '{:10.2f}'.format(123.23), #2 digits left of decimal\nif(123.23>0):\n i='{0:.2e}'.format(123.23) #for ios::scientific \n i='+'+i\n print i\nelse :\n print '{0:.2e}'.format(123.23)\n \n \nprint '{:#>10}'.format(str(123)), #for ios::fill\nif(123.23>0): \n i='{0:.2e}'.format(123.23) #for ios::scientific \n i='+'+i\n print i\nelse :\n print '{0:.2e}'.format(123.23)\n\n",
+ "input": [
+ "\n",
+ "import string\n",
+ "\n",
+ "print '{0:+d}'.format(123), #for ios::showpos\n",
+ "if(123.23>0):\n",
+ " i='{0:e}'.format(123.23) #for ios::scientific \n",
+ " i='+'+i\n",
+ " print i\n",
+ "else :\n",
+ " print '{0:e}'.format(123.23)\n",
+ "\n",
+ " \n",
+ "print '{:10.2f}'.format(123.23), #2 digits left of decimal\n",
+ "if(123.23>0):\n",
+ " i='{0:.2e}'.format(123.23) #for ios::scientific \n",
+ " i='+'+i\n",
+ " print i\n",
+ "else :\n",
+ " print '{0:.2e}'.format(123.23)\n",
+ " \n",
+ " \n",
+ "print '{:#>10}'.format(str(123)), #for ios::fill\n",
+ "if(123.23>0): \n",
+ " i='{0:.2e}'.format(123.23) #for ios::scientific \n",
+ " i='+'+i\n",
+ " print i\n",
+ "else :\n",
+ " print '{0:.2e}'.format(123.23)\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "+123 +1.232300e+02\n 123.23 +1.23e+02\n#######123 +1.23e+02\n"
+ "text": [
+ "+123 +1.232300e+02\n",
+ " 123.23 +1.23e+02\n",
+ "#######123 +1.23e+02\n"
+ ]
}
],
"prompt_number": 1
@@ -115,19 +247,28 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.6, Page Number: 432<h3>"
+ "source": [
+ "<h3>Example 18.6, Page Number: 432<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implement io manipulators in python'''\n\nprint '{0:.0e}'.format(1000.243) #for setprecision\nprint '{:>20}'.format(\"Hello There\") #to set width and right align\n",
+ "input": [
+ "\n",
+ "print '{0:.0e}'.format(1000.243) #for setprecision\n",
+ "print '{:>20}'.format(\"Hello There\") #to set width and right align\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1e+03\n Hello There\n"
+ "text": [
+ "1e+03\n",
+ " Hello There\n"
+ ]
}
],
"prompt_number": 5
@@ -135,19 +276,33 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.7, Page Number: 433<h3>"
+ "source": [
+ "<h3>Example 18.7, Page Number: 433<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing some ios flags in python'''\n\nprint '{0:+d}'.format(123), #for ios::showpos\nif(123.23>0):\n i='{0:e}'.format(123.23) #for ios::scientific \n i='+'+i\n print i\nelse :\n print '{0:e}'.format(123.23)\n ",
+ "input": [
+ "\n",
+ "print '{0:+d}'.format(123), #for ios::showpos\n",
+ "if(123.23>0):\n",
+ " i='{0:e}'.format(123.23) #for ios::scientific \n",
+ " i='+'+i\n",
+ " print i\n",
+ "else :\n",
+ " print '{0:e}'.format(123.23)\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "+123 +1.232300e+02\n"
+ "text": [
+ "+123 +1.232300e+02\n"
+ ]
}
],
"prompt_number": 6
@@ -155,19 +310,30 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.8, Page Number: 433<h3>"
+ "source": [
+ "<h3>Example 18.8, Page Number: 433<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Removing leading whitespaces from a string'''\n\n#User input\ns=\" Hello\"\n\n#Result\nprint s.lstrip() #lstrip removes leading spaces",
+ "input": [
+ "\n",
+ "#User input\n",
+ "s=\" Hello\"\n",
+ "\n",
+ "#Result\n",
+ "print s.lstrip() #lstrip removes leading spaces"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello\n"
+ "text": [
+ "Hello\n"
+ ]
}
],
"prompt_number": 7
@@ -175,19 +341,33 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.9, Page Number: 434<h3>"
+ "source": [
+ "<h3>Example 18.9, Page Number: 434<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing some ios flags in python'''\n\ndef setup(s):\n return '{:$<10}'.format(str(s))\n\n\n#Result\nprint 10,setup(10)\n\n\n",
+ "input": [
+ "\n",
+ "def setup(s):\n",
+ " return '{:$<10}'.format(str(s))\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print 10,setup(10)\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 10$$$$$$$$\n"
+ "text": [
+ "10 10$$$$$$$$\n"
+ ]
}
],
"prompt_number": 2
@@ -195,12 +375,26 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.10, Page Number: 435<h3>"
+ "source": [
+ "<h3>Example 18.10, Page Number: 435<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Prompting the user to enter number in hexadecimal form'''\n\ndef prompt():\n print \"Enter number using hex format:\"\n hex=0x46\n return hex\n\n\n#Result\ni=prompt()\nprint i\n\n",
+ "input": [
+ "\n",
+ "def prompt():\n",
+ " print \"Enter number using hex format:\"\n",
+ " hex=0x46\n",
+ " return hex\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "i=prompt()\n",
+ "print i\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": []
@@ -208,12 +402,28 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.11, Page Number: 438<h3>"
+ "source": [
+ "<h3>Example 18.11, Page Number: 438<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to write to a file'''\n\n#Open a file, creating one if it does not already exist\nout=open(\"test\",'w')\n\n#In case file cannot open\nif(not(out)):\n print \"Cannot open file.\"\nelse:\n #Write to file\n out.write(\"10 123.23\\n\")\n out.write(\"This is a short text file.\")\n #Close the file\n out.close()",
+ "input": [
+ "\n",
+ "#Open a file, creating one if it does not already exist\n",
+ "out=open(\"test\",'w')\n",
+ "\n",
+ "#In case file cannot open\n",
+ "if(not(out)):\n",
+ " print \"Cannot open file.\"\n",
+ "else:\n",
+ " #Write to file\n",
+ " out.write(\"10 123.23\\n\")\n",
+ " out.write(\"This is a short text file.\")\n",
+ " #Close the file\n",
+ " out.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -222,19 +432,43 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.12, Page Number: 438<h3>"
+ "source": [
+ "<h3>Example 18.12, Page Number: 438<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to read to a file'''\n\n#Open a file, creating one if it does not already exist\nIn=open(\"test\",'r')\n\n#In case file cannot open\nif(not(In)):\n print \"Cannot open file.\"\nelse:\n #Read file\n i=In.read(2)\n ch=In.read(1)\n f=In.read(6)\n str=In.read()\n print i,f,ch\n print str\n #Close the file\n out.close()",
+ "input": [
+ "\n",
+ "#Open a file, creating one if it does not already exist\n",
+ "In=open(\"test\",'r')\n",
+ "\n",
+ "#In case file cannot open\n",
+ "if(not(In)):\n",
+ " print \"Cannot open file.\"\n",
+ "else:\n",
+ " #Read file\n",
+ " i=In.read(2)\n",
+ " ch=In.read(1)\n",
+ " f=In.read(6)\n",
+ " str=In.read()\n",
+ " print i,f,ch\n",
+ " print str\n",
+ " #Close the file\n",
+ " out.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 123.23 \n\nThis is a short text file.\n"
+ "text": [
+ "10 123.23 \n",
+ "\n",
+ "This is a short text file.\n"
+ ]
}
],
"prompt_number": 9
@@ -242,19 +476,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.13, Page Number: 439<h3>"
+ "source": [
+ "<h3>Example 18.13, Page Number: 439<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to read to a file provided on the screen'''\n#Program cannot be provided here, so error is obtained\n\nimport sys\n \nif not(len(sys.argv)==2):\n print \"Usage: PR <filename>\\n\"\nelse:\n #Open a file\n In=open(sys.argv[1],'r')\n\n #In case file cannot open\n if(not(In)):\n print \"Cannot open file.\"\n else:\n #Read file\n ch=In.read()\n print ch\n In.close()\n \n",
+ "input": [
+ "\n",
+ "\n",
+ "import sys\n",
+ " \n",
+ "if not(len(sys.argv)==2):\n",
+ " print \"Usage: PR <filename>\\n\"\n",
+ "else:\n",
+ " #Open a file\n",
+ " In=open(sys.argv[1],'r')\n",
+ "\n",
+ " #In case file cannot open\n",
+ " if(not(In)):\n",
+ " print \"Cannot open file.\"\n",
+ " else:\n",
+ " #Read file\n",
+ " ch=In.read()\n",
+ " print ch\n",
+ " In.close()\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Usage: PR <filename>\n\n"
+ "text": [
+ "Usage: PR <filename>\n",
+ "\n"
+ ]
}
],
"prompt_number": 10
@@ -262,12 +521,29 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.14, Page Number: 440<h3>"
+ "source": [
+ "<h3>Example 18.14, Page Number: 440<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to write to a file'''\n\nimport sys\n\np=\"hello there\"\n\nout=open(\"test\",'w')\n\n#In case file cannot open\nif(not(out)):\n print \"Cannot open file.\"\nelse:\n #Write to file\n for i in range(len(p)):\n out.write(p[i])\n",
+ "input": [
+ "\n",
+ "import sys\n",
+ "\n",
+ "p=\"hello there\"\n",
+ "\n",
+ "out=open(\"test\",'w')\n",
+ "\n",
+ "#In case file cannot open\n",
+ "if(not(out)):\n",
+ " print \"Cannot open file.\"\n",
+ "else:\n",
+ " #Write to file\n",
+ " for i in range(len(p)):\n",
+ " out.write(p[i])\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -276,19 +552,60 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.15, Page Number: 441<h3>"
+ "source": [
+ "<h3>Example 18.15, Page Number: 441<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to read and write in a file'''\n\nimport sys\n\nn=[1,2,3,4,5]\n\n#Open a file 'test'\nout=open(\"test\",'w')\n\n#In case file cannot open\nif(not(out)):\n print \"Cannot open file.\"\nelse:\n #Write to file\n for i in range(5):\n out.write(chr(n[i]))\n out.close()\n \nfor i in range(5): #clear array\n n[i]=0\n \n#Open the file\nIn=open(\"test\",'r')\n\n#In case file cannot open\nif(not(In)):\n print \"Cannot open file.\"\nelse:\n #Read file\n for i in range(5):\n n[i]=ord(In.read(1))\n\n#Result, shows value from file\nfor i in range(5):\n print n[i],\n \nIn.close()",
+ "input": [
+ "\n",
+ "import sys\n",
+ "\n",
+ "n=[1,2,3,4,5]\n",
+ "\n",
+ "#Open a file 'test'\n",
+ "out=open(\"test\",'w')\n",
+ "\n",
+ "#In case file cannot open\n",
+ "if(not(out)):\n",
+ " print \"Cannot open file.\"\n",
+ "else:\n",
+ " #Write to file\n",
+ " for i in range(5):\n",
+ " out.write(chr(n[i]))\n",
+ " out.close()\n",
+ " \n",
+ "for i in range(5): #clear array\n",
+ " n[i]=0\n",
+ " \n",
+ "#Open the file\n",
+ "In=open(\"test\",'r')\n",
+ "\n",
+ "#In case file cannot open\n",
+ "if(not(In)):\n",
+ " print \"Cannot open file.\"\n",
+ "else:\n",
+ " #Read file\n",
+ " for i in range(5):\n",
+ " n[i]=ord(In.read(1))\n",
+ "\n",
+ "#Result, shows value from file\n",
+ "for i in range(5):\n",
+ " print n[i],\n",
+ " \n",
+ "In.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 2 3 4 5\n"
+ "text": [
+ "1 2 3 4 5\n"
+ ]
}
],
"prompt_number": 12
@@ -296,19 +613,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.16, Page Number: 442<h3>"
+ "source": [
+ "<h3>Example 18.16, Page Number: 442<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Detect end-of-file for a file on the screen'''\n#File cannot be provided here, so program wont work\nimport sys\n \nif not(len(sys.argv)==2):\n print \"Usage: PR <filename>\\n\"\nelse:\n #Open a file\n In=open(sys.argv[1],'r')\n\n #In case file cannot open\n if(not(In)):\n print \"Cannot open file.\"\n else:\n #Read file\n while True:\n ch=In.read(1)\n if not ch:\n break\n print ch,\n #Close file\n In.close()\n ",
+ "input": [
+ "import sys\n",
+ " \n",
+ "if not(len(sys.argv)==2):\n",
+ " print \"Usage: PR <filename>\\n\"\n",
+ "else:\n",
+ " #Open a file\n",
+ " In=open(sys.argv[1],'r')\n",
+ "\n",
+ " #In case file cannot open\n",
+ " if(not(In)):\n",
+ " print \"Cannot open file.\"\n",
+ " else:\n",
+ " #Read file\n",
+ " while True:\n",
+ " ch=In.read(1)\n",
+ " if not ch:\n",
+ " break\n",
+ " print ch,\n",
+ " #Close file\n",
+ " In.close()\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Usage: PR <filename>\n\n"
+ "text": [
+ "Usage: PR <filename>\n",
+ "\n"
+ ]
}
],
"prompt_number": 13
@@ -316,19 +660,74 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.17, Page Number: 443<h3>"
+ "source": [
+ "<h3>Example 18.17, Page Number: 443<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to compare files'''\n\n#Since file names cannot be provided, two \n#files are being created test1 and test2\n\n#creating test1\nout=open(\"test1\",'w')\nout.write(\"Hello\")\nout.close()\n\n#creating test2\nout=open(\"test2\",'w')\nout.write(\"There\")\nout.close()\n\n\n#Open test1\nf1=open(\"test1\",'r')\n#In case file cannot open\nif(not(In)):\n print \"Cannot open file.\"\n\n#Open test2\nf2=open(\"test2\",'r')\n#In case file cannot open\nif(not(In)):\n print \"Cannot open file.\"\n \nprint \"Comparing files...\"\n\nbuf1=f1.read()\nbuf2=f2.read()\nprint buf1,buf2\n\nif len(buf1)==len(buf2):\n print \"Files are of different sizes.\"\n f1.close()\n f2.close()\nelse:\n #compare contents of buffers\n flag=1\n for i in range(len(buf1)):\n if not(buf1[i]==buf2[i]):\n print \"Files differ.\"\n f1.close()\n f2.close()\n flag=0\n break\n if flag==1:\n print \"Files are the same.\"\n \n ",
+ "input": [
+ "\n",
+ "#creating test1\n",
+ "out=open(\"test1\",'w')\n",
+ "out.write(\"Hello\")\n",
+ "out.close()\n",
+ "\n",
+ "#creating test2\n",
+ "out=open(\"test2\",'w')\n",
+ "out.write(\"There\")\n",
+ "out.close()\n",
+ "\n",
+ "\n",
+ "#Open test1\n",
+ "f1=open(\"test1\",'r')\n",
+ "#In case file cannot open\n",
+ "if(not(In)):\n",
+ " print \"Cannot open file.\"\n",
+ "\n",
+ "#Open test2\n",
+ "f2=open(\"test2\",'r')\n",
+ "#In case file cannot open\n",
+ "if(not(In)):\n",
+ " print \"Cannot open file.\"\n",
+ " \n",
+ "print \"Comparing files...\"\n",
+ "\n",
+ "buf1=f1.read()\n",
+ "buf2=f2.read()\n",
+ "print buf1,buf2\n",
+ "\n",
+ "if len(buf1)==len(buf2):\n",
+ " print \"Files are of different sizes.\"\n",
+ " f1.close()\n",
+ " f2.close()\n",
+ "else:\n",
+ " #compare contents of buffers\n",
+ " flag=1\n",
+ " for i in range(len(buf1)):\n",
+ " if not(buf1[i]==buf2[i]):\n",
+ " print \"Files differ.\"\n",
+ " f1.close()\n",
+ " f2.close()\n",
+ " flag=0\n",
+ " break\n",
+ " if flag==1:\n",
+ " print \"Files are the same.\"\n",
+ " \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Comparing files...\nHello There\nFiles are of different sizes.\n"
+ "text": [
+ "Comparing files...\n",
+ "Hello There\n",
+ "Files are of different sizes.\n"
+ ]
}
],
"prompt_number": 14
@@ -336,19 +735,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.18, Page Number: 445<h3>"
+ "source": [
+ "<h3>Example 18.18, Page Number: 445<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Read a string and print it'''\n\nprint \"Enter your name:\"\n\n#User imput\nstr=\"hello world\"\n\nprint str",
+ "input": [
+ "\n",
+ "print \"Enter your name:\"\n",
+ "\n",
+ "#User imput\n",
+ "str=\"hello world\"\n",
+ "\n",
+ "print str"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name:\nhello world\n"
+ "text": [
+ "Enter your name:\n",
+ "hello world\n"
+ ]
}
],
"prompt_number": 15
@@ -356,12 +768,29 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.19, Page Number: 447<h3>"
+ "source": [
+ "<h3>Example 18.19, Page Number: 447<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate random access by writing X at a specified location'''\n\n#Since arguments cannot be provided file test \n#is created and X is written in the 3nd location.\n\n#Open test\nout=open(\"test\",'r+b')\nout.write(\"Hello\")\n\n\n#In case file cannot open\nif(not(out)):\n print \"Cannot open file.\"\nelse:\n out.seek(2,0)\n out.write('X')\n out.close()\n \n",
+ "input": [
+ "\n",
+ "#Open test\n",
+ "out=open(\"test\",'r+b')\n",
+ "out.write(\"Hello\")\n",
+ "\n",
+ "\n",
+ "#In case file cannot open\n",
+ "if(not(out)):\n",
+ " print \"Cannot open file.\"\n",
+ "else:\n",
+ " out.seek(2,0)\n",
+ " out.write('X')\n",
+ " out.close()\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -370,19 +799,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.20, Page Number: 447<h3>"
+ "source": [
+ "<h3>Example 18.20, Page Number: 447<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Display a file from a given point'''\n\n#Here, file is displayed from 3nd position\n\n#Open test\nout=open(\"test\",'r+b')\nout.write(\"Hello\")\nout.close()\n\nIn=open(\"test\",'r')\n#In case file cannot open\nif(not(In)):\n print \"Cannot open file.\"\nelse:\n In.seek(2,0)\n ch=In.read()\n print ch\n \n",
+ "input": [
+ "\n",
+ "#Open test\n",
+ "out=open(\"test\",'r+b')\n",
+ "out.write(\"Hello\")\n",
+ "out.close()\n",
+ "\n",
+ "In=open(\"test\",'r')\n",
+ "#In case file cannot open\n",
+ "if(not(In)):\n",
+ " print \"Cannot open file.\"\n",
+ "else:\n",
+ " In.seek(2,0)\n",
+ " ch=In.read()\n",
+ " print ch\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "llo\n"
+ "text": [
+ "llo\n"
+ ]
}
],
"prompt_number": 3
@@ -390,12 +839,41 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 18.21, Page Number: 450<h3>"
+ "source": [
+ "<h3>Example 18.21, Page Number: 450<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implement use of overloaded inserter to write three_d'''\n\nclass three_d:\n def __init__(self,a,b,c):\n self.__x=a\n self.__y=b\n self.__z=c\n def __repr__(self):\n c=(\"%d\"%self.__x)+\", \"+(\"%d\"%self.__y)+\", \"+(\"%d\"%self.__z)+\"\\n\"\n return c \n\n#Variable declaration\na=three_d(1,2,3)\nb=three_d(3,4,5)\nc=three_d(5,6,7)\n\n#Open threed\nout=open(\"threed\",'w')\n#In case file cannot open\nif(not(out)):\n print \"Cannot open file.\"\nelse:\n out.write(a.__repr__())\n out.write(b.__repr__())\n out.write(c.__repr__())\n\n ",
+ "input": [
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,a,b,c):\n",
+ " self.__x=a\n",
+ " self.__y=b\n",
+ " self.__z=c\n",
+ " def __repr__(self):\n",
+ " c=(\"%d\"%self.__x)+\", \"+(\"%d\"%self.__y)+\", \"+(\"%d\"%self.__z)+\"\\n\"\n",
+ " return c \n",
+ "\n",
+ "#Variable declaration\n",
+ "a=three_d(1,2,3)\n",
+ "b=three_d(3,4,5)\n",
+ "c=three_d(5,6,7)\n",
+ "\n",
+ "#Open threed\n",
+ "out=open(\"threed\",'w')\n",
+ "#In case file cannot open\n",
+ "if(not(out)):\n",
+ " print \"Cannot open file.\"\n",
+ "else:\n",
+ " out.write(a.__repr__())\n",
+ " out.write(b.__repr__())\n",
+ " out.write(c.__repr__())\n",
+ "\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -404,7 +882,7 @@
{
"cell_type": "raw",
"metadata": {},
- "source": ""
+ "source": []
}
],
"metadata": {}
diff --git a/C++_from_the_Ground/Chapter_19(1).ipynb b/C++_from_the_Ground/Chapter_19(1).ipynb
index 318b8aaa..3c9ecd17 100644
--- a/C++_from_the_Ground/Chapter_19(1).ipynb
+++ b/C++_from_the_Ground/Chapter_19(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 19"
+ "name": "",
+ "signature": "sha256:d2c5aefc81786f6e7a83b5f07eeb250789c73d2ab2ad23662758aa0cdec50617"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,56 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 19: Run-Time Type ID and the Casting Operators<h1>"
+ "source": [
+ "<h1>Chapter 19: Run-Time Type ID and the Casting Operators<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.1, Page Number: 453<h3>"
+ "source": [
+ "<h3>Example 19.1, Page Number: 453<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple example taht uses typeid'''\n\nclass myclass:\n pass\n\n#Variable declaration\ni=j=0\nf=0.0\nob=myclass()\n\nprint \"The type of i is:\",type(i).__name__\nprint \"The type of f is:\",type(f).__name__\nprint \"The type of ob is:\",ob.__class__.__name__\nprint \"\\n\"\n\nif type(i)==type(j):\n print \"The types of i and j are the same\"\n \nif not(type(i)==type(f)):\n print \"The types of i and f are not the same\"",
+ "input": [
+ "\n",
+ "class myclass:\n",
+ " pass\n",
+ "\n",
+ "#Variable declaration\n",
+ "i=j=0\n",
+ "f=0.0\n",
+ "ob=myclass()\n",
+ "\n",
+ "print \"The type of i is:\",type(i).__name__\n",
+ "print \"The type of f is:\",type(f).__name__\n",
+ "print \"The type of ob is:\",ob.__class__.__name__\n",
+ "print \"\\n\"\n",
+ "\n",
+ "if type(i)==type(j):\n",
+ " print \"The types of i and j are the same\"\n",
+ " \n",
+ "if not(type(i)==type(f)):\n",
+ " print \"The types of i and f are not the same\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The type of i is: int\nThe type of f is: float\nThe type of ob is: myclass\n\n\nThe types of i and j are the same\nThe types of i and f are not the same\n"
+ "text": [
+ "The type of i is: int\n",
+ "The type of f is: float\n",
+ "The type of ob is: myclass\n",
+ "\n",
+ "\n",
+ "The types of i and j are the same\n",
+ "The types of i and f are not the same\n"
+ ]
}
],
"prompt_number": 2
@@ -35,19 +68,52 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.2, Page Number: 454<h3>"
+ "source": [
+ "<h3>Example 19.2, Page Number: 454<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example that uses typeid on a polymorphic class hierarchy'''\n\nclass Base:\n pass\nclass Derived1(Base):\n pass\nclass Derived2(Base):\n pass\n\n#Variable declaration\nbaseob=Base()\np=[Base()]\nob1=Derived1()\nob2=Derived2()\n\n\np[0]=baseob\nprint \"p is pointing to an object of type\",\nprint p[0].__class__.__name__\n\np[0]=ob1\nprint \"p is pointing to an object of type\",\nprint p[0].__class__.__name__\n\np[0]=ob2\nprint \"p is pointing to an object of type\",\nprint p[0].__class__.__name__",
+ "input": [
+ "\n",
+ "class Base:\n",
+ " pass\n",
+ "class Derived1(Base):\n",
+ " pass\n",
+ "class Derived2(Base):\n",
+ " pass\n",
+ "\n",
+ "#Variable declaration\n",
+ "baseob=Base()\n",
+ "p=[Base()]\n",
+ "ob1=Derived1()\n",
+ "ob2=Derived2()\n",
+ "\n",
+ "\n",
+ "p[0]=baseob\n",
+ "print \"p is pointing to an object of type\",\n",
+ "print p[0].__class__.__name__\n",
+ "\n",
+ "p[0]=ob1\n",
+ "print \"p is pointing to an object of type\",\n",
+ "print p[0].__class__.__name__\n",
+ "\n",
+ "p[0]=ob2\n",
+ "print \"p is pointing to an object of type\",\n",
+ "print p[0].__class__.__name__"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "p is pointing to an object of type Base\np is pointing to an object of type Derived1\np is pointing to an object of type Derived2\n"
+ "text": [
+ "p is pointing to an object of type Base\n",
+ "p is pointing to an object of type Derived1\n",
+ "p is pointing to an object of type Derived2\n"
+ ]
}
],
"prompt_number": 3
@@ -55,19 +121,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.3, Page Number: 455<h3>"
+ "source": [
+ "<h3>Example 19.3, Page Number: 455<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example that uses typeid on a polymorphic class hierarchy'''\n\nclass Base:\n pass\nclass Derived1(Base):\n pass\nclass Derived2(Base):\n pass\n\ndef WhatType(ob):\n print \"ob is referencing an object of type\",\n print ob.__class__.__name__\n \n \n#Variable declaration\nbaseob=Base()\np=[Base()]\nob1=Derived1()\nob2=Derived2()\n\nWhatType(baseob)\nWhatType(ob1)\nWhatType(ob2)",
+ "input": [
+ "\n",
+ "class Base:\n",
+ " pass\n",
+ "class Derived1(Base):\n",
+ " pass\n",
+ "class Derived2(Base):\n",
+ " pass\n",
+ "\n",
+ "def WhatType(ob):\n",
+ " print \"ob is referencing an object of type\",\n",
+ " print ob.__class__.__name__\n",
+ " \n",
+ " \n",
+ "#Variable declaration\n",
+ "baseob=Base()\n",
+ "p=[Base()]\n",
+ "ob1=Derived1()\n",
+ "ob2=Derived2()\n",
+ "\n",
+ "WhatType(baseob)\n",
+ "WhatType(ob1)\n",
+ "WhatType(ob2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "ob is referencing an object of type Base\nob is referencing an object of type Derived1\nob is referencing an object of type Derived2\n"
+ "text": [
+ "ob is referencing an object of type Base\n",
+ "ob is referencing an object of type Derived1\n",
+ "ob is referencing an object of type Derived2\n"
+ ]
}
],
"prompt_number": 4
@@ -75,19 +170,94 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.4, Page Number: 456<h3>"
+ "source": [
+ "<h3>Example 19.4, Page Number: 456<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate run-time type id'''\n\nimport random\n\nclass figure:\n def __init__(self,i,j):\n self._x=i\n self._y=j\n \nclass triangle(figure):\n def __init__(self,i,j):\n figure.__init__(self,i,j)\n def area(self):\n return self._x*0.5*self._y\n \nclass rectangle(figure):\n def __init__(self,i,j):\n figure.__init__(self,i,j)\n def area(self):\n return self._x*self._y\n \nclass circle(figure):\n def __init__(self,i,j=0):\n figure.__init__(self,i,j)\n def area(self):\n return self._x*self._x*3.14\n \ndef factory():\n i=random.randint(0,2)\n if i==0:\n return circle(10.0)\n elif i==1:\n return triangle(10.1,5.3)\n elif i==2:\n return rectangle(4.3,5.7)\n \n\nt=c=r=0 \np=[None]\n\n#generate and count objects\nfor i in range(10):\n p[0]=factory() #generate an object\n print \"Object is \",p[0].__class__.__name__,\". \",\n #count it\n if p[0].__class__.__name__==triangle.__name__:\n t+=1\n if p[0].__class__.__name__==rectangle.__name__:\n r+=1\n if p[0].__class__.__name__==circle.__name__:\n c+=1\n #display its area\n print \"Area is\",p[0].area()\n\nprint \"Objects generated:\"\nprint \"Triangles:\",t\nprint \"Rectangles:\",r\nprint \"Circles:\",c",
+ "input": [
+ "\n",
+ "import random\n",
+ "\n",
+ "class figure:\n",
+ " def __init__(self,i,j):\n",
+ " self._x=i\n",
+ " self._y=j\n",
+ " \n",
+ "class triangle(figure):\n",
+ " def __init__(self,i,j):\n",
+ " figure.__init__(self,i,j)\n",
+ " def area(self):\n",
+ " return self._x*0.5*self._y\n",
+ " \n",
+ "class rectangle(figure):\n",
+ " def __init__(self,i,j):\n",
+ " figure.__init__(self,i,j)\n",
+ " def area(self):\n",
+ " return self._x*self._y\n",
+ " \n",
+ "class circle(figure):\n",
+ " def __init__(self,i,j=0):\n",
+ " figure.__init__(self,i,j)\n",
+ " def area(self):\n",
+ " return self._x*self._x*3.14\n",
+ " \n",
+ "def factory():\n",
+ " i=random.randint(0,2)\n",
+ " if i==0:\n",
+ " return circle(10.0)\n",
+ " elif i==1:\n",
+ " return triangle(10.1,5.3)\n",
+ " elif i==2:\n",
+ " return rectangle(4.3,5.7)\n",
+ " \n",
+ "\n",
+ "t=c=r=0 \n",
+ "p=[None]\n",
+ "\n",
+ "#generate and count objects\n",
+ "for i in range(10):\n",
+ " p[0]=factory() #generate an object\n",
+ " print \"Object is \",p[0].__class__.__name__,\". \",\n",
+ " #count it\n",
+ " if p[0].__class__.__name__==triangle.__name__:\n",
+ " t+=1\n",
+ " if p[0].__class__.__name__==rectangle.__name__:\n",
+ " r+=1\n",
+ " if p[0].__class__.__name__==circle.__name__:\n",
+ " c+=1\n",
+ " #display its area\n",
+ " print \"Area is\",p[0].area()\n",
+ "\n",
+ "print \"Objects generated:\"\n",
+ "print \"Triangles:\",t\n",
+ "print \"Rectangles:\",r\n",
+ "print \"Circles:\",c"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Object is circle . Area is 314.0\nObject is rectangle . Area is 24.51\nObject is rectangle . Area is 24.51\nObject is circle . Area is 314.0\nObject is rectangle . Area is 24.51\nObject is circle . Area is 314.0\nObject is rectangle . Area is 24.51\nObject is triangle . Area is 26.765\nObject is rectangle . Area is 24.51\nObject is circle . Area is 314.0\nObjects generated:\nTriangles: 1\nRectangles: 5\nCircles: 4\n"
+ "text": [
+ "Object is circle . Area is 314.0\n",
+ "Object is rectangle . Area is 24.51\n",
+ "Object is rectangle . Area is 24.51\n",
+ "Object is circle . Area is 314.0\n",
+ "Object is rectangle . Area is 24.51\n",
+ "Object is circle . Area is 314.0\n",
+ "Object is rectangle . Area is 24.51\n",
+ "Object is triangle . Area is 26.765\n",
+ "Object is rectangle . Area is 24.51\n",
+ "Object is circle . Area is 314.0\n",
+ "Objects generated:\n",
+ "Triangles: 1\n",
+ "Rectangles: 5\n",
+ "Circles: 4\n"
+ ]
}
],
"prompt_number": 5
@@ -95,19 +265,56 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.5, Page Number: 456<h3>"
+ "source": [
+ "<h3>Example 19.5, Page Number: 456<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using typeid with templates'''\n#Since python does not have templates\n#it will give a different output.\n\n#Template class\nclass myclass:\n def __init__(self,i):\n self.__a=i\n \no1=myclass(10)\no2=myclass(9)\no3=myclass(7.2)\n\nprint \"Type of o1 is\",o1.__class__.__name__\n\nprint \"Type of o2 is\",o2.__class__.__name__\n\nprint \"Type of o3 is\",o3.__class__.__name__\n\nprint\n\nif o1.__class__.__name__==o2.__class__.__name__:\n print \"o1 and o2 are the same type\"\n \nif o1.__class__.__name__==o3.__class__.__name__:\n print \"Error\"\nelse:\n print \"o1 and o3 are different types\"\n\n#This prints error because python doesnt use templates.",
+ "input": [
+ "\n",
+ "#Template class\n",
+ "class myclass:\n",
+ " def __init__(self,i):\n",
+ " self.__a=i\n",
+ " \n",
+ "o1=myclass(10)\n",
+ "o2=myclass(9)\n",
+ "o3=myclass(7.2)\n",
+ "\n",
+ "print \"Type of o1 is\",o1.__class__.__name__\n",
+ "\n",
+ "print \"Type of o2 is\",o2.__class__.__name__\n",
+ "\n",
+ "print \"Type of o3 is\",o3.__class__.__name__\n",
+ "\n",
+ "print\n",
+ "\n",
+ "if o1.__class__.__name__==o2.__class__.__name__:\n",
+ " print \"o1 and o2 are the same type\"\n",
+ " \n",
+ "if o1.__class__.__name__==o3.__class__.__name__:\n",
+ " print \"Error\"\n",
+ "else:\n",
+ " print \"o1 and o3 are different types\"\n",
+ "\n",
+ "#This prints error because python doesnt use templates."
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Type of o1 is myclass\nType of o2 is myclass\nType of o3 is myclass\n\no1 and o2 are the same type\nError\n"
+ "text": [
+ "Type of o1 is myclass\n",
+ "Type of o2 is myclass\n",
+ "Type of o3 is myclass\n",
+ "\n",
+ "o1 and o2 are the same type\n",
+ "Error\n"
+ ]
}
],
"prompt_number": 6
@@ -115,19 +322,94 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.6, Page Number: 460<h3>"
+ "source": [
+ "<h3>Example 19.6, Page Number: 460<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Template version of figure hierarchy'''\n#Python classes are effectively template classes.\n\nimport random\n\nclass figure:\n def __init__(self,i,j):\n self._x=i\n self._y=j\n \nclass triangle(figure):\n def __init__(self,i,j):\n figure.__init__(self,i,j)\n def area(self):\n return self._x*0.5*self._y\n \nclass rectangle(figure):\n def __init__(self,i,j):\n figure.__init__(self,i,j)\n def area(self):\n return self._x*self._y\n \nclass circle(figure):\n def __init__(self,i,j=0):\n figure.__init__(self,i,j)\n def area(self):\n return self._x*self._x*3.14\n \ndef factory():\n i=random.randint(0,2)\n if i==0:\n return circle(10.0)\n elif i==1:\n return triangle(10.1,5.3)\n elif i==2:\n return rectangle(4.3,5.7)\n \n\nt=c=r=0 \np=[None]\n\n#generate and count objects\nfor i in range(10):\n p[0]=factory() #generate an object\n print \"Object is \",p[0].__class__.__name__,\". \",\n #count it\n if p[0].__class__.__name__==triangle.__name__:\n t+=1\n if p[0].__class__.__name__==rectangle.__name__:\n r+=1\n if p[0].__class__.__name__==circle.__name__:\n c+=1\n #display its area\n print \"Area is\",p[0].area()\n\nprint \"Objects generated:\"\nprint \"Triangles:\",t\nprint \"Rectangles:\",r\nprint \"Circles:\",c",
+ "input": [
+ "\n",
+ "import random\n",
+ "\n",
+ "class figure:\n",
+ " def __init__(self,i,j):\n",
+ " self._x=i\n",
+ " self._y=j\n",
+ " \n",
+ "class triangle(figure):\n",
+ " def __init__(self,i,j):\n",
+ " figure.__init__(self,i,j)\n",
+ " def area(self):\n",
+ " return self._x*0.5*self._y\n",
+ " \n",
+ "class rectangle(figure):\n",
+ " def __init__(self,i,j):\n",
+ " figure.__init__(self,i,j)\n",
+ " def area(self):\n",
+ " return self._x*self._y\n",
+ " \n",
+ "class circle(figure):\n",
+ " def __init__(self,i,j=0):\n",
+ " figure.__init__(self,i,j)\n",
+ " def area(self):\n",
+ " return self._x*self._x*3.14\n",
+ " \n",
+ "def factory():\n",
+ " i=random.randint(0,2)\n",
+ " if i==0:\n",
+ " return circle(10.0)\n",
+ " elif i==1:\n",
+ " return triangle(10.1,5.3)\n",
+ " elif i==2:\n",
+ " return rectangle(4.3,5.7)\n",
+ " \n",
+ "\n",
+ "t=c=r=0 \n",
+ "p=[None]\n",
+ "\n",
+ "#generate and count objects\n",
+ "for i in range(10):\n",
+ " p[0]=factory() #generate an object\n",
+ " print \"Object is \",p[0].__class__.__name__,\". \",\n",
+ " #count it\n",
+ " if p[0].__class__.__name__==triangle.__name__:\n",
+ " t+=1\n",
+ " if p[0].__class__.__name__==rectangle.__name__:\n",
+ " r+=1\n",
+ " if p[0].__class__.__name__==circle.__name__:\n",
+ " c+=1\n",
+ " #display its area\n",
+ " print \"Area is\",p[0].area()\n",
+ "\n",
+ "print \"Objects generated:\"\n",
+ "print \"Triangles:\",t\n",
+ "print \"Rectangles:\",r\n",
+ "print \"Circles:\",c"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Object is triangle . Area is 26.765\nObject is circle . Area is 314.0\nObject is circle . Area is 314.0\nObject is rectangle . Area is 24.51\nObject is rectangle . Area is 24.51\nObject is rectangle . Area is 24.51\nObject is circle . Area is 314.0\nObject is circle . Area is 314.0\nObject is rectangle . Area is 24.51\nObject is triangle . Area is 26.765\nObjects generated:\nTriangles: 2\nRectangles: 4\nCircles: 4\n"
+ "text": [
+ "Object is triangle . Area is 26.765\n",
+ "Object is circle . Area is 314.0\n",
+ "Object is circle . Area is 314.0\n",
+ "Object is rectangle . Area is 24.51\n",
+ "Object is rectangle . Area is 24.51\n",
+ "Object is rectangle . Area is 24.51\n",
+ "Object is circle . Area is 314.0\n",
+ "Object is circle . Area is 314.0\n",
+ "Object is rectangle . Area is 24.51\n",
+ "Object is triangle . Area is 26.765\n",
+ "Objects generated:\n",
+ "Triangles: 2\n",
+ "Rectangles: 4\n",
+ "Circles: 4\n"
+ ]
}
],
"prompt_number": 7
@@ -135,19 +417,119 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.7, Page Number: 463<h3>"
+ "source": [
+ "<h3>Example 19.7, Page Number: 463<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implement dynamic casting'''\n#Dynamic casting is not needed in python \n#Also, the output will be different in python since \n#here since pointers are implemented using lists,\n\nclass Base:\n def f(self):\n print \"Inside Base\"\n \nclass Derived(Base):\n def f(self):\n print \"Inside Derived\"\n \nbp=[Base()] #pointer to base\nb_ob=Base() \ndp=[Derived()] #pointer to derived\nd_ob=Derived()\n\ndp[0]=d_ob\nif dp[0]:\n print \"Cast from Derived * to Derived * OK.\"\n dp[0].f()\nelse:\n print \"Error\"\nprint\n\nbp[0]=d_ob\nif bp[0]:\n print \"Cast from Derived * to Base * OK.\"\n bp[0].f()\nelse:\n print \"Error\"\nprint\n\nbp[0]=b_ob\nif bp[0]:\n print \"Cast from Base * to Base * OK.\"\n bp[0].f()\nelse:\n print \"Error\"\nprint\n\ndp[0]=b_ob\nif dp[0]:\n print \"Error\"\nelse:\n print \"Cast from Base * to Derived * not OK.\"\nprint\n\nbp[0]=d_ob #bp points to Derived object\ndp[0]=bp[0]\nif dp[0]:\n print \"Cast bp to a Derived * OK.\"\n print \"because bp is really pointing\\n\",\n print \"to a Derived object.\"\n dp[0].f()\nelse:\n print \"Error\"\nprint\n\nbp[0]=b_ob #bp points to Base object\ndp[0]=bp[0]\nif dp[0]:\n print \"Error\"\nelse:\n print \"Now casting bp to a Derived *\\n\",\n print \"is not OK because bp is really\\n\",\n print \" pointing to a Base object.\"\nprint\n\ndp[0]=d_ob #dp points to Derived object\nbp[0]=dp[0]\nif bp[0]:\n print \"Casting dp to a Base * is OK.\"\n bp[0].f()\nelse:\n print \"Error\"\nprint\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Base:\n",
+ " def f(self):\n",
+ " print \"Inside Base\"\n",
+ " \n",
+ "class Derived(Base):\n",
+ " def f(self):\n",
+ " print \"Inside Derived\"\n",
+ " \n",
+ "bp=[Base()] #pointer to base\n",
+ "b_ob=Base() \n",
+ "dp=[Derived()] #pointer to derived\n",
+ "d_ob=Derived()\n",
+ "\n",
+ "dp[0]=d_ob\n",
+ "if dp[0]:\n",
+ " print \"Cast from Derived * to Derived * OK.\"\n",
+ " dp[0].f()\n",
+ "else:\n",
+ " print \"Error\"\n",
+ "print\n",
+ "\n",
+ "bp[0]=d_ob\n",
+ "if bp[0]:\n",
+ " print \"Cast from Derived * to Base * OK.\"\n",
+ " bp[0].f()\n",
+ "else:\n",
+ " print \"Error\"\n",
+ "print\n",
+ "\n",
+ "bp[0]=b_ob\n",
+ "if bp[0]:\n",
+ " print \"Cast from Base * to Base * OK.\"\n",
+ " bp[0].f()\n",
+ "else:\n",
+ " print \"Error\"\n",
+ "print\n",
+ "\n",
+ "dp[0]=b_ob\n",
+ "if dp[0]:\n",
+ " print \"Error\"\n",
+ "else:\n",
+ " print \"Cast from Base * to Derived * not OK.\"\n",
+ "print\n",
+ "\n",
+ "bp[0]=d_ob #bp points to Derived object\n",
+ "dp[0]=bp[0]\n",
+ "if dp[0]:\n",
+ " print \"Cast bp to a Derived * OK.\"\n",
+ " print \"because bp is really pointing\\n\",\n",
+ " print \"to a Derived object.\"\n",
+ " dp[0].f()\n",
+ "else:\n",
+ " print \"Error\"\n",
+ "print\n",
+ "\n",
+ "bp[0]=b_ob #bp points to Base object\n",
+ "dp[0]=bp[0]\n",
+ "if dp[0]:\n",
+ " print \"Error\"\n",
+ "else:\n",
+ " print \"Now casting bp to a Derived *\\n\",\n",
+ " print \"is not OK because bp is really\\n\",\n",
+ " print \" pointing to a Base object.\"\n",
+ "print\n",
+ "\n",
+ "dp[0]=d_ob #dp points to Derived object\n",
+ "bp[0]=dp[0]\n",
+ "if bp[0]:\n",
+ " print \"Casting dp to a Base * is OK.\"\n",
+ " bp[0].f()\n",
+ "else:\n",
+ " print \"Error\"\n",
+ "print\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Cast from Derived * to Derived * OK.\nInside Derived\n\nCast from Derived * to Base * OK.\nInside Derived\n\nCast from Base * to Base * OK.\nInside Base\n\nError\n\nCast bp to a Derived * OK.\nbecause bp is really pointing\nto a Derived object.\nInside Derived\n\nError\n\nCasting dp to a Base * is OK.\nInside Derived\n\n"
+ "text": [
+ "Cast from Derived * to Derived * OK.\n",
+ "Inside Derived\n",
+ "\n",
+ "Cast from Derived * to Base * OK.\n",
+ "Inside Derived\n",
+ "\n",
+ "Cast from Base * to Base * OK.\n",
+ "Inside Base\n",
+ "\n",
+ "Error\n",
+ "\n",
+ "Cast bp to a Derived * OK.\n",
+ "because bp is really pointing\n",
+ "to a Derived object.\n",
+ "Inside Derived\n",
+ "\n",
+ "Error\n",
+ "\n",
+ "Casting dp to a Base * is OK.\n",
+ "Inside Derived\n",
+ "\n"
+ ]
}
],
"prompt_number": 8
@@ -155,19 +537,74 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.8, Page Number: 465<h3>"
+ "source": [
+ "<h3>Example 19.8, Page Number: 465<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implement dynamic casting'''\n#Dynamic casting is not needed in python \n#Also, the output will be different in python since \n#here since pointers are implemented using lists,\n\nclass Base:\n def f(self):\n pass\n \nclass Derived(Base):\n def derivedOnly(self):\n print \"Is a Derived Object\"\n \nbp=[Base()] #pointer to base\nb_ob=Base() \ndp=[Derived()] #pointer to derived\nd_ob=Derived()\n\n#Use typeid\n\nbp[0]=b_ob\nif bp[0].__class__.__name__==Derived.__name__:\n dp[0]=bp[0]\n dp[0].derivedOnly()\nelse:\n print \"Cast from Base to Derived failed.\"\n \nbp[0]=d_ob\nif bp[0].__class__.__name__==Derived.__name__:\n dp[0]=bp[0]\n dp[0].derivedOnly()\nelse:\n print \"Error, cast should work!\"\n \n#Use dynamic_cast\n\nbp[0]=b_ob\ndp[0]=bp[0]\nif dp[0].__class__.__name__==Derived.__name__:\n dp[0].derivedOnly()\nelse:\n print \"Cast from Base to Derived failed.\"\n \nbp[0]=d_ob\ndp[0]=bp[0]\nif dp:\n dp[0].derivedOnly()\nelse:\n print \"Error, cast should work!\"\n ",
+ "input": [
+ "\n",
+ "\n",
+ "class Base:\n",
+ " def f(self):\n",
+ " pass\n",
+ " \n",
+ "class Derived(Base):\n",
+ " def derivedOnly(self):\n",
+ " print \"Is a Derived Object\"\n",
+ " \n",
+ "bp=[Base()] #pointer to base\n",
+ "b_ob=Base() \n",
+ "dp=[Derived()] #pointer to derived\n",
+ "d_ob=Derived()\n",
+ "\n",
+ "#Use typeid\n",
+ "\n",
+ "bp[0]=b_ob\n",
+ "if bp[0].__class__.__name__==Derived.__name__:\n",
+ " dp[0]=bp[0]\n",
+ " dp[0].derivedOnly()\n",
+ "else:\n",
+ " print \"Cast from Base to Derived failed.\"\n",
+ " \n",
+ "bp[0]=d_ob\n",
+ "if bp[0].__class__.__name__==Derived.__name__:\n",
+ " dp[0]=bp[0]\n",
+ " dp[0].derivedOnly()\n",
+ "else:\n",
+ " print \"Error, cast should work!\"\n",
+ " \n",
+ "#Use dynamic_cast\n",
+ "\n",
+ "bp[0]=b_ob\n",
+ "dp[0]=bp[0]\n",
+ "if dp[0].__class__.__name__==Derived.__name__:\n",
+ " dp[0].derivedOnly()\n",
+ "else:\n",
+ " print \"Cast from Base to Derived failed.\"\n",
+ " \n",
+ "bp[0]=d_ob\n",
+ "dp[0]=bp[0]\n",
+ "if dp:\n",
+ " dp[0].derivedOnly()\n",
+ "else:\n",
+ " print \"Error, cast should work!\"\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Cast from Base to Derived failed.\nIs a Derived Object\nCast from Base to Derived failed.\nIs a Derived Object\n"
+ "text": [
+ "Cast from Base to Derived failed.\n",
+ "Is a Derived Object\n",
+ "Cast from Base to Derived failed.\n",
+ "Is a Derived Object\n"
+ ]
}
],
"prompt_number": 9
@@ -175,19 +612,37 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.9, Page Number: 467<h3>"
+ "source": [
+ "<h3>Example 19.9, Page Number: 467<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of const_cast'''\n#Since python does not have constants, const_cast is not needed\n\ndef f(p):\n v=p\n v[0]=100\n \n#Variable declaration\nx=[]\n\nx.append(99)\nprint \"x before call:\",x[0]\nf(x)\nprint \"x after call:\",x[0]\n",
+ "input": [
+ "\n",
+ "def f(p):\n",
+ " v=p\n",
+ " v[0]=100\n",
+ " \n",
+ "#Variable declaration\n",
+ "x=[]\n",
+ "\n",
+ "x.append(99)\n",
+ "print \"x before call:\",x[0]\n",
+ "f(x)\n",
+ "print \"x after call:\",x[0]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x before call: 99\nx after call: 100\n"
+ "text": [
+ "x before call: 99\n",
+ "x after call: 100\n"
+ ]
}
],
"prompt_number": 10
@@ -195,19 +650,30 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.10, Page Number: 468<h3>"
+ "source": [
+ "<h3>Example 19.10, Page Number: 468<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implement static_cast'''\n#Since python does not have static variables,\n#static_cast is not needed\n\nf=199.22\n\ni=f\nprint i\n",
+ "input": [
+ "\n",
+ "\n",
+ "f=199.22\n",
+ "\n",
+ "i=f\n",
+ "print i\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "199.22\n"
+ "text": [
+ "199.22\n"
+ ]
}
],
"prompt_number": 11
@@ -215,19 +681,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 19.11, Page Number: 469<h3>"
+ "source": [
+ "<h3>Example 19.11, Page Number: 469<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example of reinterpret_cast'''\n#python does not have specific data type variables \n#hence reinterpretation is not required\n\n#Variable Declaration\ni=0 #int\np=\"This is a string\"\n\ni=p #cast pointer to integer \n\n#Result\nprint i\n",
+ "input": [
+ "\n",
+ "i=0 #int\n",
+ "p=\"This is a string\"\n",
+ "\n",
+ "i=p #cast pointer to integer \n",
+ "\n",
+ "#Result\n",
+ "print i\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This is a string\n"
+ "text": [
+ "This is a string\n"
+ ]
}
],
"prompt_number": 12
@@ -235,7 +714,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_2(1).ipynb b/C++_from_the_Ground/Chapter_2(1).ipynb
index ca5a3177..603f2bab 100644
--- a/C++_from_the_Ground/Chapter_2(1).ipynb
+++ b/C++_from_the_Ground/Chapter_2(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 2"
+ "name": "",
+ "signature": "sha256:2822ffa73df44943f6be3bedb4cf89d60d9228e7b719790e40dca7bc4236f0b9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 2: An Overview of C++<h1>"
+ "source": [
+ "<h1>Chapter 2: An Overview of C++<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.1, Page Number: 12<h3>"
+ "source": [
+ "<h3>Example 2.1, Page Number: 12<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program 1:A first Python(C++) program'''\n\n#Result\nprint \"This is my first C++ program.\"",
+ "input": [
+ "\n",
+ "#Result\n",
+ "print \"This is my first C++ program.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This is my first C++ program.\n"
+ "text": [
+ "This is my first C++ program.\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +46,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.2, Page Number: 17<h3>"
+ "source": [
+ "<h3>Example 2.2, Page Number: 17<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program 2: Using a variable'''\n\n#Variable Declaration\nx=None \n\nx=1023 #this assigns 1023 to x\n\n#Result\nprint \"This program prints the value of x: \",x #prints x,i.e, 1023\n",
+ "input": [
+ "'\n",
+ "\n",
+ "\n",
+ "#Variable Declaration\n",
+ "x=None \n",
+ "\n",
+ "x=1023 #this assigns 1023 to x\n",
+ "\n",
+ "#Result\n",
+ "print \"This program prints the value of x: \",x #prints x,i.e, 1023\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This program prints the value of x: 1023\n"
+ "text": [
+ "This program prints the value of x: 1023\n"
+ ]
}
],
"prompt_number": 2
@@ -55,19 +81,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.3, Page Number: 18<h3>"
+ "source": [
+ "<h3>Example 2.3, Page Number: 18<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program converts gallons to liters'''\n\n#Variable declaration\ngallons=10 #User input\nliters=None\n\nliters=gallons*4 #convert to liters\n\n#Result\nprint \"Liters: \",liters",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "gallons=10 #User input\n",
+ "liters=None\n",
+ "\n",
+ "liters=gallons*4 #convert to liters\n",
+ "\n",
+ "#Result\n",
+ "print \"Liters: \",liters"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Liters: 40\n"
+ "text": [
+ "Liters: 40\n"
+ ]
}
],
"prompt_number": 3
@@ -75,19 +116,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.4, Page Number: 20<h3>"
+ "source": [
+ "<h3>Example 2.4, Page Number: 20<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program converts gallons to liters using floating point numbers'''\n\n#Variable declaration\ngallons=10.20 #User input\nliters=None\n\nliters=gallons*3.7854 #convert to liters\n\n#Result\nprint \"Liters: \",liters",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "gallons=10.20 #User input\n",
+ "liters=None\n",
+ "\n",
+ "liters=gallons*3.7854 #convert to liters\n",
+ "\n",
+ "#Result\n",
+ "print \"Liters: \",liters"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Liters: 38.61108\n"
+ "text": [
+ "Liters: 38.61108\n"
+ ]
}
],
"prompt_number": 4
@@ -95,19 +152,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.5, Page Number: 21<h3>"
+ "source": [
+ "<h3>Example 2.5, Page Number: 21<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program uses a function'''\n\n#myfunc's definition\ndef myfunc():\n print \"Inside myfunc() \"\n \nprint \"In main()\"\nmyfunc() #call myfunc()\nprint \"Back in main()\"",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "#myfunc's definition\n",
+ "def myfunc():\n",
+ " print \"Inside myfunc() \"\n",
+ " \n",
+ "print \"In main()\"\n",
+ "myfunc() #call myfunc()\n",
+ "print \"Back in main()\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "In main()\nInside myfunc() \nBack in main()\n"
+ "text": [
+ "In main()\n",
+ "Inside myfunc() \n",
+ "Back in main()\n"
+ ]
}
],
"prompt_number": 5
@@ -115,19 +189,29 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.6, Page Number: 22<h3>"
+ "source": [
+ "<h3>Example 2.6, Page Number: 22<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using the abs() function'''\n\n#Result\nprint abs(-10)",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print abs(-10)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
}
],
"prompt_number": 6
@@ -135,19 +219,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.7, Page Number: 23<h3>"
+ "source": [
+ "<h3>Example 2.7, Page Number: 23<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple program that demonstrates mul()'''\n\n#mul's definition\ndef mul(x,y):\n print x*y,\n\n#calling mul\nmul(10,20)\nmul(5,6)\nmul(8,9)",
+ "input": [
+ "\n",
+ "\n",
+ "#mul's definition\n",
+ "def mul(x,y):\n",
+ " print x*y,\n",
+ "\n",
+ "#calling mul\n",
+ "mul(10,20)\n",
+ "mul(5,6)\n",
+ "mul(8,9)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "200 30 72\n"
+ "text": [
+ "200 30 72\n"
+ ]
}
],
"prompt_number": 1
@@ -155,19 +254,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.8, Page Number: 24<h3>"
+ "source": [
+ "<h3>Example 2.8, Page Number: 24<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Returning a value'''\n\n#mul()'s definition; this function returns a value\ndef mul(x,y):\n return x*y #return product of x and y\n\n#Variable declaration\nanswer=mul(10,11) #assign return values\n\n#Result\nprint \"The answer is: \",answer\n",
+ "input": [
+ "\n",
+ "\n",
+ "#mul()'s definition; this function returns a value\n",
+ "def mul(x,y):\n",
+ " return x*y #return product of x and y\n",
+ "\n",
+ "#Variable declaration\n",
+ "answer=mul(10,11) #assign return values\n",
+ "\n",
+ "#Result\n",
+ "print \"The answer is: \",answer\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The answer is: 110\n"
+ "text": [
+ "The answer is: 110\n"
+ ]
}
],
"prompt_number": 8
@@ -175,19 +290,31 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.9, Page Number: 26<h3>"
+ "source": [
+ "<h3>Example 2.9, Page Number: 26<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This demonstrates how to got to the next line'''\n\nprint \"one\"\nprint \"two\" #prints in different line\nprint \"three\",\"four\" #prints all in same line",
+ "input": [
+ "\n",
+ "\n",
+ "print \"one\"\n",
+ "print \"two\" #prints in different line\n",
+ "print \"three\",\"four\" #prints all in same line"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "one\ntwo\nthree four\n"
+ "text": [
+ "one\n",
+ "two\n",
+ "three four\n"
+ ]
}
],
"prompt_number": 9
@@ -195,19 +322,33 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.10, Page Number: 27<h3>"
+ "source": [
+ "<h3>Example 2.10, Page Number: 27<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program illustrates the if statement'''\n\n#Variable declaration\na=10 #user input for two numbers\nb=20\n\n#Result\nif a<b:\n print \"First number is less than second. \"",
+ "input": [
+ "'''This program illustrates the if statement'''\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=10 #user input for two numbers\n",
+ "b=20\n",
+ "\n",
+ "#Result\n",
+ "if a<b:\n",
+ " print \"First number is less than second. \""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "First number is less than second. \n"
+ "text": [
+ "First number is less than second. \n"
+ ]
}
],
"prompt_number": 10
@@ -215,19 +356,28 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.11, Page Number: 28<h3>"
+ "source": [
+ "<h3>Example 2.11, Page Number: 28<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A program that illustrates the for loop'''\n\nfor count in range(1,100+1):\n print count,",
+ "input": [
+ "\n",
+ "\n",
+ "for count in range(1,100+1):\n",
+ " print count,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\n"
+ "text": [
+ "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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\n"
+ ]
}
],
"prompt_number": 3
@@ -235,19 +385,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 2.12, Page Number: 30<h3>"
+ "source": [
+ "<h3>Example 2.12, Page Number: 30<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program demonstrates a block of code'''\n\n#Variable declaration\na=10 #User input for two numbers\nb=20\n\n#Result\nif a<b:\n print \"First number is less than second\"\n print \"Their difference is: \",b-a\n",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "a=10 #User input for two numbers\n",
+ "b=20\n",
+ "\n",
+ "#Result\n",
+ "if a<b:\n",
+ " print \"First number is less than second\"\n",
+ " print \"Their difference is: \",b-a\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "First number is less than second\nTheir difference is: 10\n"
+ "text": [
+ "First number is less than second\n",
+ "Their difference is: 10\n"
+ ]
}
],
"prompt_number": 12
@@ -255,7 +420,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_20(2).ipynb b/C++_from_the_Ground/Chapter_20(2).ipynb
index cc097c14..e56ad6fd 100644
--- a/C++_from_the_Ground/Chapter_20(2).ipynb
+++ b/C++_from_the_Ground/Chapter_20(2).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:c2dea3221dd29327bd680c1c48d2d9bcb943c373644635507698dc8145b7a0c6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -25,11 +26,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Implementing a namespace'''\n",
- "#A good implementaton of namespaces in python would be\n",
- "#creating python files or modules and then importing them.\n",
- "#Since that is not possible n ipython, implementation is \n",
- "#done using classes.\n",
+ "\n",
"\n",
"\n",
"class CounterNameSpace:\n",
@@ -107,8 +104,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Implementing using'''\n",
- "\n",
+ "'\n",
"class CounterNameSpace:\n",
" upperbound=None\n",
" lowerbound=None\n",
@@ -187,7 +183,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Printing a number'''\n",
+ "\n",
"\n",
"#User-input\n",
"print \"Enter a number:\"\n",
@@ -221,7 +217,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Implementing the std:: qualification'''\n",
+ "\n",
"\n",
"import sys\n",
"\n",
@@ -258,7 +254,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Bring only a few names into global namespace'''\n",
"\n",
"from sys import stdout\n",
"\n",
@@ -295,7 +290,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Implementing pointers to functions'''\n",
"\n",
"#functions\n",
"def vline(i):\n",
@@ -340,9 +334,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''qsort in python:for string'''\n",
- "#Python doesn't have an in-built function hence,\n",
- "#a function for qsort is defined.\n",
+ "\n",
"\n",
"import string\n",
"\n",
@@ -389,9 +381,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''qsort in python:for int'''\n",
- "#Python doesn't have an in-built function hence,\n",
- "#a function for qsort is defined.\n",
"\n",
"import string\n",
"\n",
@@ -439,9 +428,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Illustrate assigning function pointers to overload functions'''\n",
"\n",
- "#Output count number of spaces.\n",
"def space(count,ch=None):\n",
" if ch==None:\n",
" for i in xrange(count,0,-1):\n",
@@ -488,7 +475,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Implementing static class members'''\n",
"\n",
"num=None #static variable\n",
"\n",
@@ -540,7 +526,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Implement const and mutable member functions'''\n",
"\n",
"class Demo:\n",
" i=None\n",
@@ -579,7 +564,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''A simple class program'''\n",
"\n",
"class myclass:\n",
" def __init__(self,x):\n",
@@ -617,8 +601,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''A Class Example'''\n",
- "#explicit not implemented in python\n",
+ "\n",
"\n",
"class myclass:\n",
" def __init__(self,x):\n",
@@ -644,7 +627,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Implementing implicit conversion'''\n",
"\n",
"class myclass:\n",
" def __init__(self,i):\n",
@@ -686,7 +668,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Member nitialization Syntax'''\n",
"\n",
"class myclass:\n",
" def __init__(self,x,y):\n",
@@ -731,7 +712,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Member nitialization Syntax'''\n",
"\n",
"class myclass:\n",
" def __init__(self,x,y):\n",
@@ -776,7 +756,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Implementing entern functions'''\n",
"\n",
"def myfunc():\n",
" print \"This links as a C function.\"\n",
@@ -807,7 +786,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Pointer to member example'''\n",
+ "\n",
"from ctypes import *\n",
"\n",
"class myclass: \n",
@@ -852,7 +831,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Pointer to member example'''\n",
+ "\n",
"from ctypes import *\n",
"\n",
"class myclass:\n",
@@ -899,7 +878,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Implementing conversion functions'''\n",
+ "\n",
"\n",
"class three_d:\n",
" def __init__(self,a,b,c): #3D coordinates\n",
diff --git a/C++_from_the_Ground/Chapter_21(1).ipynb b/C++_from_the_Ground/Chapter_21(1).ipynb
index a37db7f8..023fd126 100644
--- a/C++_from_the_Ground/Chapter_21(1).ipynb
+++ b/C++_from_the_Ground/Chapter_21(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 21"
+ "name": "",
+ "signature": "sha256:0975c16101ec7adc0b19a0a24a31504acce776790d976f2710d7048c660d7882"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,84 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 21: Introducing the Standard Template Library<h1>"
+ "source": [
+ "<h1>Chapter 21: Introducing the Standard Template Library<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.1, Page Number:507<h3>"
+ "source": [
+ "<h3>Example 21.1, Page Number:507<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An implementation of vector in python'''\n\n#Variable declaratio\nv=[] #Create a zero length vector\n\n#display original size of v\nprint \"Size =\",len(v)\n\n#put values onto end of vector\n#vector will grow as needed\n\nfor i in range(10):\n v.append(i)\n \n#display current size of v\nprint \"Current contents: \"\nprint \"Size now =\",len(v)\n\n#display contents of vector\nfor i in range(len(v)):\n print v[i],\n \nprint\n \n#put more values onto end of vector\n#again, vector will grow as needed.\nfor i in range(10):\n v.append(i+10)\n#display current size of v\nprint \"Size now =\",len(v)\n\n#display contents of vector\nprint \"Current contents:\"\nfor i in range(len(v)):\n print v[i],\nprint\n \n#change contents of vector\nfor i in range(len(v)):\n v[i]=v[i]+v[i]\n \n#display contents of vector\nprint \"Contents doubled:\"\nfor i in range(len(v)):\n print v[i],",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaratio\n",
+ "v=[] #Create a zero length vector\n",
+ "\n",
+ "#display original size of v\n",
+ "print \"Size =\",len(v)\n",
+ "\n",
+ "#put values onto end of vector\n",
+ "#vector will grow as needed\n",
+ "\n",
+ "for i in range(10):\n",
+ " v.append(i)\n",
+ " \n",
+ "#display current size of v\n",
+ "print \"Current contents: \"\n",
+ "print \"Size now =\",len(v)\n",
+ "\n",
+ "#display contents of vector\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n",
+ " \n",
+ "print\n",
+ " \n",
+ "#put more values onto end of vector\n",
+ "#again, vector will grow as needed.\n",
+ "for i in range(10):\n",
+ " v.append(i+10)\n",
+ "#display current size of v\n",
+ "print \"Size now =\",len(v)\n",
+ "\n",
+ "#display contents of vector\n",
+ "print \"Current contents:\"\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n",
+ "print\n",
+ " \n",
+ "#change contents of vector\n",
+ "for i in range(len(v)):\n",
+ " v[i]=v[i]+v[i]\n",
+ " \n",
+ "#display contents of vector\n",
+ "print \"Contents doubled:\"\n",
+ "for i in range(len(v)):\n",
+ " print v[i],"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Size = 0\nCurrent contents: \nSize now = 10\n0 1 2 3 4 5 6 7 8 9\nSize now = 20\nCurrent contents:\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19\nContents doubled:\n0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38\n"
+ "text": [
+ "Size = 0\n",
+ "Current contents: \n",
+ "Size now = 10\n",
+ "0 1 2 3 4 5 6 7 8 9\n",
+ "Size now = 20\n",
+ "Current contents:\n",
+ "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19\n",
+ "Contents doubled:\n",
+ "0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +96,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.2, Page Number:508<h3>"
+ "source": [
+ "<h3>Example 21.2, Page Number:508<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Access vector usng an terator'''\n\n#Variable declaration\nv=[] #Create a zero length vector\n\n#put values onto end of vector\nfor i in range(10):\n v.append(chr(ord('A')+i))\n \n#can access vector contents using subscripts\nfor i in range(len(v)):\n print v[i], \nprint\n \n#access via iterator\nfor p in v:\n print p,\n ",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "v=[] #Create a zero length vector\n",
+ "\n",
+ "#put values onto end of vector\n",
+ "for i in range(10):\n",
+ " v.append(chr(ord('A')+i))\n",
+ " \n",
+ "#can access vector contents using subscripts\n",
+ "for i in range(len(v)):\n",
+ " print v[i], \n",
+ "print\n",
+ " \n",
+ "#access via iterator\n",
+ "for p in v:\n",
+ " print p,\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "A B C D E F G H I J\nA B C D E F G H I J\n"
+ "text": [
+ "A B C D E F G H I J\n",
+ "A B C D E F G H I J\n"
+ ]
}
],
"prompt_number": 2
@@ -55,19 +139,71 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.3, Page Number:509<h3>"
+ "source": [
+ "<h3>Example 21.3, Page Number:509<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate insert and erase'''\n\n#Variable declaration\nv=[] #Create a zero length vector\n\n#put values onto end of vector\nfor i in range(10):\n v.append(chr(ord('A')+i))\n \n#Display original contents of vector\nprint \"Size =\",len(v)\nprint \"Original contents:\"\nfor i in range(len(v)):\n print v[i], \nprint \"\\n\"\n \np=2 #point to 3rd element\nfor i in range(10):\n v.insert(p+i,'X')\n \n#display contents after insertion\nprint \"Size after insert =\",len(v)\nprint \"Contents after insert:\"\nfor i in range(len(v)):\n print v[i],\nprint \"\\n\"\n\n#remove those elements\np=2 #point to 3rd element\nfor i in range(10):\n v.pop(p)\n \n#display contents after insertion\nprint \"Size after erase =\",len(v)\nprint \"Contents after insert:\"\nfor i in range(len(v)):\n print v[i],\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "v=[] #Create a zero length vector\n",
+ "\n",
+ "#put values onto end of vector\n",
+ "for i in range(10):\n",
+ " v.append(chr(ord('A')+i))\n",
+ " \n",
+ "#Display original contents of vector\n",
+ "print \"Size =\",len(v)\n",
+ "print \"Original contents:\"\n",
+ "for i in range(len(v)):\n",
+ " print v[i], \n",
+ "print \"\\n\"\n",
+ " \n",
+ "p=2 #point to 3rd element\n",
+ "for i in range(10):\n",
+ " v.insert(p+i,'X')\n",
+ " \n",
+ "#display contents after insertion\n",
+ "print \"Size after insert =\",len(v)\n",
+ "print \"Contents after insert:\"\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n",
+ "print \"\\n\"\n",
+ "\n",
+ "#remove those elements\n",
+ "p=2 #point to 3rd element\n",
+ "for i in range(10):\n",
+ " v.pop(p)\n",
+ " \n",
+ "#display contents after insertion\n",
+ "print \"Size after erase =\",len(v)\n",
+ "print \"Contents after insert:\"\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Size = 10\nOriginal contents:\nA B C D E F G H I J \n\nSize after insert = 20\nContents after insert:\nA B X X X X X X X X X X C D E F G H I J \n\nSize after erase = 10\nContents after insert:\nA B C D E F G H I J\n"
+ "text": [
+ "Size = 10\n",
+ "Original contents:\n",
+ "A B C D E F G H I J \n",
+ "\n",
+ "Size after insert = 20\n",
+ "Contents after insert:\n",
+ "A B X X X X X X X X X X C D E F G H I J \n",
+ "\n",
+ "Size after erase = 10\n",
+ "Contents after insert:\n",
+ "A B C D E F G H I J\n"
+ ]
}
],
"prompt_number": 3
@@ -75,19 +211,84 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.4, Page Number:511<h3>"
+ "source": [
+ "<h3>Example 21.4, Page Number:511<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Store a class object in a vector'''\n\nclass three_d:\n def __init__(self,a,b,c): #3D coordinates\n self.x=a\n self.y=b\n self.z=c\n #Display x,y,z coordinates - three_d inserter.\n def __repr__(self):\n return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n def __add__(self,a):\n self.x+=a\n self.y+=a\n self.z+=a\n return self\n def __lt__(self,b):\n return (self.x+self.y+self.z)<(b.x+b.y+b.z)\n def __eq__(self,b):\n return (self.x+self.y+self.z)==(b.x+b.y+b.z) \n \n#Variable declaration\nv=[]\n\n#add objects to the vector\nfor i in range(10):\n v.append(three_d(i,i+2,i-3))\n \n#Display contents of vector\nfor i in range(len(v)):\n print v[i], \nprint\n\n\n#Modify objects in a vector\nfor i in range(len(v)):\n v[i]=v[i]+10 \n\n#Display modified vector\nfor i in range(len(v)):\n print v[i], \n",
+ "input": [
+ "\n",
+ "class three_d:\n",
+ " def __init__(self,a,b,c): #3D coordinates\n",
+ " self.x=a\n",
+ " self.y=b\n",
+ " self.z=c\n",
+ " #Display x,y,z coordinates - three_d inserter.\n",
+ " def __repr__(self):\n",
+ " return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n",
+ " def __add__(self,a):\n",
+ " self.x+=a\n",
+ " self.y+=a\n",
+ " self.z+=a\n",
+ " return self\n",
+ " def __lt__(self,b):\n",
+ " return (self.x+self.y+self.z)<(b.x+b.y+b.z)\n",
+ " def __eq__(self,b):\n",
+ " return (self.x+self.y+self.z)==(b.x+b.y+b.z) \n",
+ " \n",
+ "#Variable declaration\n",
+ "v=[]\n",
+ "\n",
+ "#add objects to the vector\n",
+ "for i in range(10):\n",
+ " v.append(three_d(i,i+2,i-3))\n",
+ " \n",
+ "#Display contents of vector\n",
+ "for i in range(len(v)):\n",
+ " print v[i], \n",
+ "print\n",
+ "\n",
+ "\n",
+ "#Modify objects in a vector\n",
+ "for i in range(len(v)):\n",
+ " v[i]=v[i]+10 \n",
+ "\n",
+ "#Display modified vector\n",
+ "for i in range(len(v)):\n",
+ " print v[i], \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0, 2, -3\n 1, 3, -2\n 2, 4, -1\n 3, 5, 0\n 4, 6, 1\n 5, 7, 2\n 6, 8, 3\n 7, 9, 4\n 8, 10, 5\n 9, 11, 6\n\n10, 12, 7\n 11, 13, 8\n 12, 14, 9\n 13, 15, 10\n 14, 16, 11\n 15, 17, 12\n 16, 18, 13\n 17, 19, 14\n 18, 20, 15\n 19, 21, 16\n\n"
+ "text": [
+ "0, 2, -3\n",
+ " 1, 3, -2\n",
+ " 2, 4, -1\n",
+ " 3, 5, 0\n",
+ " 4, 6, 1\n",
+ " 5, 7, 2\n",
+ " 6, 8, 3\n",
+ " 7, 9, 4\n",
+ " 8, 10, 5\n",
+ " 9, 11, 6\n",
+ "\n",
+ "10, 12, 7\n",
+ " 11, 13, 8\n",
+ " 12, 14, 9\n",
+ " 13, 15, 10\n",
+ " 14, 16, 11\n",
+ " 15, 17, 12\n",
+ " 16, 18, 13\n",
+ " 17, 19, 14\n",
+ " 18, 20, 15\n",
+ " 19, 21, 16\n",
+ "\n"
+ ]
}
],
"prompt_number": 4
@@ -95,19 +296,64 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.5, Page Number:513<h3>"
+ "source": [
+ "<h3>Example 21.5, Page Number:513<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Store a class object in a vector'''\n \n#Variable declaration\nv=[]\nv2=[]\n\nfor i in range(10):\n v.append(chr(ord('A')+i))\n \n#Display original contents of vector\nprint \"Size =\",len(v)\nprint \"Original contents:\"\nfor i in range(len(v)):\n print v[i], \nprint \"\\n\"\n\n#initialze second vector\nstr=\"-STL Power-\"\nfor i in range(len(str)):\n v2.append(str[i])\n \n#get iterators to the middle of v and to the start and end of v2.\np=5\np2start=0\np2end=len(v2)-1\n\n#insert v2 into v\nfor i in range(p2end):\n v.insert(p+i,v2[p2start+i])\n \n#display result\nprint \"Contents of v after inserton:\"\nfor i in range(len(v)):\n print v[i],\n ",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable declaration\n",
+ "v=[]\n",
+ "v2=[]\n",
+ "\n",
+ "for i in range(10):\n",
+ " v.append(chr(ord('A')+i))\n",
+ " \n",
+ "#Display original contents of vector\n",
+ "print \"Size =\",len(v)\n",
+ "print \"Original contents:\"\n",
+ "for i in range(len(v)):\n",
+ " print v[i], \n",
+ "print \"\\n\"\n",
+ "\n",
+ "#initialze second vector\n",
+ "str=\"-STL Power-\"\n",
+ "for i in range(len(str)):\n",
+ " v2.append(str[i])\n",
+ " \n",
+ "#get iterators to the middle of v and to the start and end of v2.\n",
+ "p=5\n",
+ "p2start=0\n",
+ "p2end=len(v2)-1\n",
+ "\n",
+ "#insert v2 into v\n",
+ "for i in range(p2end):\n",
+ " v.insert(p+i,v2[p2start+i])\n",
+ " \n",
+ "#display result\n",
+ "print \"Contents of v after inserton:\"\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Size = 10\nOriginal contents:\nA B C D E F G H I J \n\nContents of v after inserton:\nA B C D E - S T L P o w e r F G H I J\n"
+ "text": [
+ "Size = 10\n",
+ "Original contents:\n",
+ "A B C D E F G H I J \n",
+ "\n",
+ "Contents of v after inserton:\n",
+ "A B C D E - S T L P o w e r F G H I J\n"
+ ]
}
],
"prompt_number": 5
@@ -115,19 +361,40 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.6, Page Number:517<h3>"
+ "source": [
+ "<h3>Example 21.6, Page Number:517<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate list basics'''\n\n#Variable declaration\nlst=[] #create an empty list\n\nfor i in range(10):\n lst.append(chr(ord('A')+i))\n \nprint \"Size =\",len(lst)\n\nprint \"Contents:\",\nfor p in lst:\n print p, \nprint \"\\n\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "lst=[] #create an empty list\n",
+ "\n",
+ "for i in range(10):\n",
+ " lst.append(chr(ord('A')+i))\n",
+ " \n",
+ "print \"Size =\",len(lst)\n",
+ "\n",
+ "print \"Contents:\",\n",
+ "for p in lst:\n",
+ " print p, \n",
+ "print \"\\n\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Size = 10\nContents: A B C D E F G H I J \n\n"
+ "text": [
+ "Size = 10\n",
+ "Contents: A B C D E F G H I J \n",
+ "\n"
+ ]
}
],
"prompt_number": 6
@@ -135,19 +402,53 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.7, Page Number:518<h3>"
+ "source": [
+ "<h3>Example 21.7, Page Number:518<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''elements can be put on the front or end of a list'''\n\n#Variable declaration\nlst=[] \nrevlst=[]\n\nfor i in range(10):\n lst.append(chr(ord('A')+i))\n \nprint \"Size of list =\",len(lst)\n\nprint \"Original Contents:\",\n#Remove elements from lst and put them into revlst in reverse order.\nfor p in lst:\n print p, \n revlst.insert(0,p) \nfor i in range(10):\n lst.pop(0)\nprint \"\\n\"\n\nprint \"Size of revlst =\",len(revlst)\n\nprint \"Reversed Contents:\",\nfor p in revlst:\n print p,",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "lst=[] \n",
+ "revlst=[]\n",
+ "\n",
+ "for i in range(10):\n",
+ " lst.append(chr(ord('A')+i))\n",
+ " \n",
+ "print \"Size of list =\",len(lst)\n",
+ "\n",
+ "print \"Original Contents:\",\n",
+ "#Remove elements from lst and put them into revlst in reverse order.\n",
+ "for p in lst:\n",
+ " print p, \n",
+ " revlst.insert(0,p) \n",
+ "for i in range(10):\n",
+ " lst.pop(0)\n",
+ "print \"\\n\"\n",
+ "\n",
+ "print \"Size of revlst =\",len(revlst)\n",
+ "\n",
+ "print \"Reversed Contents:\",\n",
+ "for p in revlst:\n",
+ " print p,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Size of list = 10\nOriginal Contents: A B C D E F G H I J \n\nSize of revlst = 10\nReversed Contents: J I H G F E D C B A\n"
+ "text": [
+ "Size of list = 10\n",
+ "Original Contents: A B C D E F G H I J \n",
+ "\n",
+ "Size of revlst = 10\n",
+ "Reversed Contents: J I H G F E D C B A\n"
+ ]
}
],
"prompt_number": 8
@@ -155,19 +456,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.8, Page Number:519<h3>"
+ "source": [
+ "<h3>Example 21.8, Page Number:519<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Sort a list'''\n\nimport random\n\n#Variable declaration\nlst=[] \n\n#create a list of random integers\nfor i in range(10):\n lst.append(random.randint(0,100))\n\nprint \"Original Contents:\",\nfor p in lst:\n print p, \nprint \"\\n\"\n\n#sort the list\nlst.sort()\n\nprint \"Sorted Contents:\",\nfor p in lst:\n print p,",
+ "input": [
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "#Variable declaration\n",
+ "lst=[] \n",
+ "\n",
+ "#create a list of random integers\n",
+ "for i in range(10):\n",
+ " lst.append(random.randint(0,100))\n",
+ "\n",
+ "print \"Original Contents:\",\n",
+ "for p in lst:\n",
+ " print p, \n",
+ "print \"\\n\"\n",
+ "\n",
+ "#sort the list\n",
+ "lst.sort()\n",
+ "\n",
+ "print \"Sorted Contents:\",\n",
+ "for p in lst:\n",
+ " print p,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original Contents: 75 73 72 4 88 7 85 21 67 42 \n\nSorted Contents: 4 7 21 42 67 72 73 75 85 88\n"
+ "text": [
+ "Original Contents: 75 73 72 4 88 7 85 21 67 42 \n",
+ "\n",
+ "Sorted Contents: 4 7 21 42 67 72 73 75 85 88\n"
+ ]
}
],
"prompt_number": 9
@@ -175,19 +505,62 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.9, Page Number:520<h3>"
+ "source": [
+ "<h3>Example 21.9, Page Number:520<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Merge two lists'''\n\n#Variable declaration\nlst1=[] \nlst2=[]\n\nfor i in xrange(0,10,2):\n lst1.append(chr(ord('A')+i))\nfor i in xrange(1,11,2):\n lst2.append(chr(ord('A')+i))\n\nprint \"Contents of lst1:\",\nfor p in lst1:\n print p, \nprint \"\\n\"\n\nprint \"Contents of lst2:\",\nfor p in lst2:\n print p, \nprint \"\\n\"\n\n#merge the lists\nlst1=lst1+lst2\nlst1.sort()\nlst2=[]\n\nif lst2==[]:\n print \"lst2 is now empty\"\n\nprint \"Contentsof lst1 after merge:\"\nfor p in lst1:\n print p,",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "lst1=[] \n",
+ "lst2=[]\n",
+ "\n",
+ "for i in xrange(0,10,2):\n",
+ " lst1.append(chr(ord('A')+i))\n",
+ "for i in xrange(1,11,2):\n",
+ " lst2.append(chr(ord('A')+i))\n",
+ "\n",
+ "print \"Contents of lst1:\",\n",
+ "for p in lst1:\n",
+ " print p, \n",
+ "print \"\\n\"\n",
+ "\n",
+ "print \"Contents of lst2:\",\n",
+ "for p in lst2:\n",
+ " print p, \n",
+ "print \"\\n\"\n",
+ "\n",
+ "#merge the lists\n",
+ "lst1=lst1+lst2\n",
+ "lst1.sort()\n",
+ "lst2=[]\n",
+ "\n",
+ "if lst2==[]:\n",
+ " print \"lst2 is now empty\"\n",
+ "\n",
+ "print \"Contentsof lst1 after merge:\"\n",
+ "for p in lst1:\n",
+ " print p,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Contents of lst1: A C E G I \n\nContents of lst2: B D F H J \n\nlst2 is now empty\nContentsof lst1 after merge:\nA B C D E F G H I J\n"
+ "text": [
+ "Contents of lst1: A C E G I \n",
+ "\n",
+ "Contents of lst2: B D F H J \n",
+ "\n",
+ "lst2 is now empty\n",
+ "Contentsof lst1 after merge:\n",
+ "A B C D E F G H I J\n"
+ ]
}
],
"prompt_number": 10
@@ -195,19 +568,72 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.10, Page Number:521<h3>"
+ "source": [
+ "<h3>Example 21.10, Page Number:521<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Store class objects in a list'''\n\nclass myclass:\n def __init__(self,i=0,j=0):\n self.__a=i\n self.__b=j\n self.sum=self.__a+self.__b\n def getsum(self):\n return self.sum\n def __lt__(self,o2):\n return self.sum<o2.sum\n def __gt__(self,o2):\n return self.sum>o2.sum\n def __eq__(self,o2):\n return self.sum==o2.sum\n def __ne__(self, other):\n return not self.__eq__(self)\n \n#create first list\nlst1=[]\nfor i in range(10):\n lst1.append(myclass(i,i))\n \nprint \"First list:\",\nfor p in lst1:\n print p.getsum(),\nprint\n\n#create second list\nlst2=[]\nfor i in range(10):\n lst2.append(myclass(i*2,i*3))\n \nprint \"First list:\",\nfor p in lst2:\n print p.getsum(),\nprint\n \n#Now merge list\nlst1=lst1+lst2\nlst1.sort()\n\n#Display merge list\nprint \"Merged list:\",\nfor p in lst1:\n print p.getsum(),\nprint",
+ "input": [
+ "\n",
+ "class myclass:\n",
+ " def __init__(self,i=0,j=0):\n",
+ " self.__a=i\n",
+ " self.__b=j\n",
+ " self.sum=self.__a+self.__b\n",
+ " def getsum(self):\n",
+ " return self.sum\n",
+ " def __lt__(self,o2):\n",
+ " return self.sum<o2.sum\n",
+ " def __gt__(self,o2):\n",
+ " return self.sum>o2.sum\n",
+ " def __eq__(self,o2):\n",
+ " return self.sum==o2.sum\n",
+ " def __ne__(self, other):\n",
+ " return not self.__eq__(self)\n",
+ " \n",
+ "#create first list\n",
+ "lst1=[]\n",
+ "for i in range(10):\n",
+ " lst1.append(myclass(i,i))\n",
+ " \n",
+ "print \"First list:\",\n",
+ "for p in lst1:\n",
+ " print p.getsum(),\n",
+ "print\n",
+ "\n",
+ "#create second list\n",
+ "lst2=[]\n",
+ "for i in range(10):\n",
+ " lst2.append(myclass(i*2,i*3))\n",
+ " \n",
+ "print \"First list:\",\n",
+ "for p in lst2:\n",
+ " print p.getsum(),\n",
+ "print\n",
+ " \n",
+ "#Now merge list\n",
+ "lst1=lst1+lst2\n",
+ "lst1.sort()\n",
+ "\n",
+ "#Display merge list\n",
+ "print \"Merged list:\",\n",
+ "for p in lst1:\n",
+ " print p.getsum(),\n",
+ "print"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "First list: 0 2 4 6 8 10 12 14 16 18\nFirst list: 0 5 10 15 20 25 30 35 40 45\nMerged list: 0 0 2 4 5 6 8 10 10 12 14 15 16 18 20 25 30 35 40 45\n"
+ "text": [
+ "First list: 0 2 4 6 8 10 12 14 16 18\n",
+ "First list: 0 5 10 15 20 25 30 35 40 45\n",
+ "Merged list: 0 0 2 4 5 6 8 10 10 12 14 15 16 18 20 25 30 35 40 45\n"
+ ]
}
],
"prompt_number": 12
@@ -215,19 +641,49 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.11, Page Number:527<h3>"
+ "source": [
+ "<h3>Example 21.11, Page Number:527<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple map implementation'''\n\n#Variable declaration\nm=[] \n\n#define the function find\ndef find(x,ch):\n for p in x:\n if p[0]==ch:\n return p\n return -1\n\n#put pairs into map\nfor i in range(10):\n m.append([chr(ord('A')+i),i])\n \n#User Input\nch='D'\n\n#find value of the given key\np=find(m,ch)\n\nif not(p==-1):\n print p[1]\nelse:\n print \"Key not in the map\"",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "m=[] \n",
+ "\n",
+ "#define the function find\n",
+ "def find(x,ch):\n",
+ " for p in x:\n",
+ " if p[0]==ch:\n",
+ " return p\n",
+ " return -1\n",
+ "\n",
+ "#put pairs into map\n",
+ "for i in range(10):\n",
+ " m.append([chr(ord('A')+i),i])\n",
+ " \n",
+ "#User Input\n",
+ "ch='D'\n",
+ "\n",
+ "#find value of the given key\n",
+ "p=find(m,ch)\n",
+ "\n",
+ "if not(p==-1):\n",
+ " print p[1]\n",
+ "else:\n",
+ " print \"Key not in the map\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
}
],
"prompt_number": 13
@@ -235,19 +691,66 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.12, Page Number:528<h3>"
+ "source": [
+ "<h3>Example 21.12, Page Number:528<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using a map to create a dictionary'''\n\n#define the function find\ndef find(x,ch):\n for p in x:\n if p[0].get()==ch.get():\n return p\n return -1\n\n\nclass word:\n def __init__(self,s=\"\"):\n self.str=s\n def get(self):\n return self.str\n #must define less than relative to word objects\n def __lt__(self,b):\n return self.str<b.str\n\nclass meaning:\n def __init__(self,s=\"\"):\n self.str=s\n def get(self):\n return self.str\n\ndictionary=[]\n\ndictionary.append([word(\"house\"),meaning(\"A place of dwelling\")])\ndictionary.append([word(\"keyboard\"),meaning(\"An input device\")])\ndictionary.append([word(\"programming\"),meaning(\"The act of writing a program\")])\ndictionary.append([word(\"STL\"),meaning(\"Standard Template Library\")])\n\n#given a word, find meaning\nprint \"Enter word:\"\nstr=\"house\" #User input\n\np=find(dictionary,word(str))\n\nif not(p==-1):\n print \"Definition:\",p[1].get()\nelse:\n print \"Word not in the dictionary.\"",
+ "input": [
+ "\n",
+ "#define the function find\n",
+ "def find(x,ch):\n",
+ " for p in x:\n",
+ " if p[0].get()==ch.get():\n",
+ " return p\n",
+ " return -1\n",
+ "\n",
+ "\n",
+ "class word:\n",
+ " def __init__(self,s=\"\"):\n",
+ " self.str=s\n",
+ " def get(self):\n",
+ " return self.str\n",
+ " #must define less than relative to word objects\n",
+ " def __lt__(self,b):\n",
+ " return self.str<b.str\n",
+ "\n",
+ "class meaning:\n",
+ " def __init__(self,s=\"\"):\n",
+ " self.str=s\n",
+ " def get(self):\n",
+ " return self.str\n",
+ "\n",
+ "dictionary=[]\n",
+ "\n",
+ "dictionary.append([word(\"house\"),meaning(\"A place of dwelling\")])\n",
+ "dictionary.append([word(\"keyboard\"),meaning(\"An input device\")])\n",
+ "dictionary.append([word(\"programming\"),meaning(\"The act of writing a program\")])\n",
+ "dictionary.append([word(\"STL\"),meaning(\"Standard Template Library\")])\n",
+ "\n",
+ "#given a word, find meaning\n",
+ "print \"Enter word:\"\n",
+ "str=\"house\" #User input\n",
+ "\n",
+ "p=find(dictionary,word(str))\n",
+ "\n",
+ "if not(p==-1):\n",
+ " print \"Definition:\",p[1].get()\n",
+ "else:\n",
+ " print \"Word not in the dictionary.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter word:\nDefinition: A place of dwelling\n"
+ "text": [
+ "Enter word:\n",
+ "Definition: A place of dwelling\n"
+ ]
}
],
"prompt_number": 14
@@ -255,19 +758,57 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.13, Page Number:532<h3>"
+ "source": [
+ "<h3>Example 21.13, Page Number:532<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate count and count_if'''\n\n#This is a unary precdate that determines if character is a vowel\ndef isvowel(ch):\n ch=ch.lower()\n if (ch=='a' or ch=='e'or ch=='i' or ch=='o' or ch=='u'):\n return 1\n else:\n return 0\n\nstr=\"STL programming is powerful.\"\nv=[]\n\nfor i in range(len(str)):\n v.append(str[i])\n \nprint \"Sequence:\",\nfor i in range(len(v)):\n print v[i],\nprint\n\nn=str.count('p')\nprint n,\"characters are p\"\n\n#count if vowel\nn=0\nfor i in v:\n if isvowel(i):\n n+=1\n \nprint n,\"characters are vowels.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#This is a unary precdate that determines if character is a vowel\n",
+ "def isvowel(ch):\n",
+ " ch=ch.lower()\n",
+ " if (ch=='a' or ch=='e'or ch=='i' or ch=='o' or ch=='u'):\n",
+ " return 1\n",
+ " else:\n",
+ " return 0\n",
+ "\n",
+ "str=\"STL programming is powerful.\"\n",
+ "v=[]\n",
+ "\n",
+ "for i in range(len(str)):\n",
+ " v.append(str[i])\n",
+ " \n",
+ "print \"Sequence:\",\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n",
+ "print\n",
+ "\n",
+ "n=str.count('p')\n",
+ "print n,\"characters are p\"\n",
+ "\n",
+ "#count if vowel\n",
+ "n=0\n",
+ "for i in v:\n",
+ " if isvowel(i):\n",
+ " n+=1\n",
+ " \n",
+ "print n,\"characters are vowels.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Sequence: S T L p r o g r a m m i n g i s p o w e r f u l .\n2 characters are p\n7 characters are vowels.\n"
+ "text": [
+ "Sequence: S T L p r o g r a m m i n g i s p o w e r f u l .\n",
+ "2 characters are p\n",
+ "7 characters are vowels.\n"
+ ]
}
],
"prompt_number": 15
@@ -275,19 +816,61 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.14, Page Number:534<h3>"
+ "source": [
+ "<h3>Example 21.14, Page Number:534<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate remove_copy and replace_copy'''\n\nstr=\"This is a test\"\nv=[]\nv2=[]\n\nfor i in range(len(str)):\n v.append(str[i])\n \n# ***implement remove_copy***\nprint \"Input sequence:\",\nfor i in range(len(v)):\n print v[i],\nprint \n\n#Remove all i's\nv2 = str.replace(\"i\", \"\")\n\nprint \"Result after removing i's: \",\nprint v2,\"\\n\"\n\n\n# ***implement replace_copy***\nprint \"Input sequence:\",\nfor i in range(len(v)):\n print v[i],\nprint \n\n#Replace s's with X's\nv2 = str.replace(\"s\", \"X\")\n\nprint \"Result after replacning s's with X's: \",\nprint v2",
+ "input": [
+ "\n",
+ "\n",
+ "str=\"This is a test\"\n",
+ "v=[]\n",
+ "v2=[]\n",
+ "\n",
+ "for i in range(len(str)):\n",
+ " v.append(str[i])\n",
+ " \n",
+ "# ***implement remove_copy***\n",
+ "print \"Input sequence:\",\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n",
+ "print \n",
+ "\n",
+ "#Remove all i's\n",
+ "v2 = str.replace(\"i\", \"\")\n",
+ "\n",
+ "print \"Result after removing i's: \",\n",
+ "print v2,\"\\n\"\n",
+ "\n",
+ "\n",
+ "# ***implement replace_copy***\n",
+ "print \"Input sequence:\",\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n",
+ "print \n",
+ "\n",
+ "#Replace s's with X's\n",
+ "v2 = str.replace(\"s\", \"X\")\n",
+ "\n",
+ "print \"Result after replacning s's with X's: \",\n",
+ "print v2"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Input sequence: T h i s i s a t e s t\nResult after removing i's: Ths s a test \n\nInput sequence: T h i s i s a t e s t\nResult after replacning s's with X's: ThiX iX a teXt\n"
+ "text": [
+ "Input sequence: T h i s i s a t e s t\n",
+ "Result after removing i's: Ths s a test \n",
+ "\n",
+ "Input sequence: T h i s i s a t e s t\n",
+ "Result after replacning s's with X's: ThiX iX a teXt\n"
+ ]
}
],
"prompt_number": 16
@@ -295,19 +878,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.15, Page Number:535<h3>"
+ "source": [
+ "<h3>Example 21.15, Page Number:535<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Reversing a list'''\n\n#Variable declaration\nv=[]\n\nfor i in range(10):\n v.append(i)\n \nprint \"Initial:\",\nfor i in range(len(v)):\n print v[i],\nprint\n\n#Reversing the list\nv.reverse()\n\nprint \"Reversed:\",\nfor i in range(len(v)):\n print v[i],\nprint \n ",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "v=[]\n",
+ "\n",
+ "for i in range(10):\n",
+ " v.append(i)\n",
+ " \n",
+ "print \"Initial:\",\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n",
+ "print\n",
+ "\n",
+ "#Reversing the list\n",
+ "v.reverse()\n",
+ "\n",
+ "print \"Reversed:\",\n",
+ "for i in range(len(v)):\n",
+ " print v[i],\n",
+ "print \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Initial: 0 1 2 3 4 5 6 7 8 9\nReversed: 9 8 7 6 5 4 3 2 1 0\n"
+ "text": [
+ "Initial: 0 1 2 3 4 5 6 7 8 9\n",
+ "Reversed: 9 8 7 6 5 4 3 2 1 0\n"
+ ]
}
],
"prompt_number": 17
@@ -315,19 +925,54 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.16, Page Number:536<h3>"
+ "source": [
+ "<h3>Example 21.16, Page Number:536<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An implementation of transform algorithm'''\n\n#A simple transformaton function\ndef xform(i):\n return i*i #square original value\n\n#the transorm function\ndef transform(x,f):\n for i in range(len(x)):\n x[i]= f(x[i])\n \n#Variable declaration\nx1=[]\n\n#put values into list\nfor i in range(10):\n x1.append(i)\n\nprint \"Original contents of x1: \",\nfor p in x1:\n print p,\nprint \n\n#transform x1\np=transform(x1,xform)\n\nprint \"Transformed contents of x1:\",\nfor p in x1:\n print p,",
+ "input": [
+ "\n",
+ "\n",
+ "#A simple transformaton function\n",
+ "def xform(i):\n",
+ " return i*i #square original value\n",
+ "\n",
+ "#the transorm function\n",
+ "def transform(x,f):\n",
+ " for i in range(len(x)):\n",
+ " x[i]= f(x[i])\n",
+ " \n",
+ "#Variable declaration\n",
+ "x1=[]\n",
+ "\n",
+ "#put values into list\n",
+ "for i in range(10):\n",
+ " x1.append(i)\n",
+ "\n",
+ "print \"Original contents of x1: \",\n",
+ "for p in x1:\n",
+ " print p,\n",
+ "print \n",
+ "\n",
+ "#transform x1\n",
+ "p=transform(x1,xform)\n",
+ "\n",
+ "print \"Transformed contents of x1:\",\n",
+ "for p in x1:\n",
+ " print p,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original contents of x1: 0 1 2 3 4 5 6 7 8 9\nTransformed contents of x1: 0 1 4 9 16 25 36 49 64 81\n"
+ "text": [
+ "Original contents of x1: 0 1 2 3 4 5 6 7 8 9\n",
+ "Transformed contents of x1: 0 1 4 9 16 25 36 49 64 81\n"
+ ]
}
],
"prompt_number": 18
@@ -335,19 +980,61 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.17, Page Number:540<h3>"
+ "source": [
+ "<h3>Example 21.17, Page Number:540<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A short string demonstration'''\n\nstr1=\"The string class gives \"\nstr2=\"C++ high strng handlng.\"\n\n#assign a string\nstr3=str1\nprint str1,\"\\n\",str3\n\n#Concatenate two strings\nstr3=str1+str2\nprint str3\n\n#Compare strings\nif str3>str1:\n print \"str3 > str1\"\nif str3==str1+str2:\n print \"str3 == str1+str2\"\n \nstr1=\"This is a null-terminated string.\"\nprint str1\n\n#create a string object using another string object\nstr4=str1\nprint str4\n\n#nput a string\nprint \"Enter a string:\"\nstr4=\"Hello\"\nprint str4",
+ "input": [
+ "\n",
+ "str1=\"The string class gives \"\n",
+ "str2=\"C++ high strng handlng.\"\n",
+ "\n",
+ "#assign a string\n",
+ "str3=str1\n",
+ "print str1,\"\\n\",str3\n",
+ "\n",
+ "#Concatenate two strings\n",
+ "str3=str1+str2\n",
+ "print str3\n",
+ "\n",
+ "#Compare strings\n",
+ "if str3>str1:\n",
+ " print \"str3 > str1\"\n",
+ "if str3==str1+str2:\n",
+ " print \"str3 == str1+str2\"\n",
+ " \n",
+ "str1=\"This is a null-terminated string.\"\n",
+ "print str1\n",
+ "\n",
+ "#create a string object using another string object\n",
+ "str4=str1\n",
+ "print str4\n",
+ "\n",
+ "#nput a string\n",
+ "print \"Enter a string:\"\n",
+ "str4=\"Hello\"\n",
+ "print str4"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The string class gives \nThe string class gives \nThe string class gives C++ high strng handlng.\nstr3 > str1\nstr3 == str1+str2\nThis is a null-terminated string.\nThis is a null-terminated string.\nEnter a string:\nHello\n"
+ "text": [
+ "The string class gives \n",
+ "The string class gives \n",
+ "The string class gives C++ high strng handlng.\n",
+ "str3 > str1\n",
+ "str3 == str1+str2\n",
+ "This is a null-terminated string.\n",
+ "This is a null-terminated string.\n",
+ "Enter a string:\n",
+ "Hello\n"
+ ]
}
],
"prompt_number": 19
@@ -355,19 +1042,58 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.18, Page Number:542<h3>"
+ "source": [
+ "<h3>Example 21.18, Page Number:542<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate insert(), erase(), and replace()'''\n\nstr1=\"This is a test\"\nstr2=\"ABCDEFG\"\n\nprint \"Initial strings:\"\nprint \"str1:\",str1\nprint \"str2:\",str2\nprint\n\n#demonstrate insert\nprint \"Insert str2 into str1:\"\nstr1=str1[:5]+str2+str1[5:]\nprint str1,\"\\n\"\n\n#demonstrate erase\nprint \"Remove 7 charecters from str1:\"\nstr1=str[:5]+str[5:]\nprint str1,\"\\n\"\n\n#demonstrate replace\nprint \"Replace 2 characters in str1 with str2:\"\nstr1=str1[:5]+str2+str1[7:]\nprint str1\n",
+ "input": [
+ "\n",
+ "str1=\"This is a test\"\n",
+ "str2=\"ABCDEFG\"\n",
+ "\n",
+ "print \"Initial strings:\"\n",
+ "print \"str1:\",str1\n",
+ "print \"str2:\",str2\n",
+ "print\n",
+ "\n",
+ "#demonstrate insert\n",
+ "print \"Insert str2 into str1:\"\n",
+ "str1=str1[:5]+str2+str1[5:]\n",
+ "print str1,\"\\n\"\n",
+ "\n",
+ "#demonstrate erase\n",
+ "print \"Remove 7 charecters from str1:\"\n",
+ "str1=str[:5]+str[5:]\n",
+ "print str1,\"\\n\"\n",
+ "\n",
+ "#demonstrate replace\n",
+ "print \"Replace 2 characters in str1 with str2:\"\n",
+ "str1=str1[:5]+str2+str1[7:]\n",
+ "print str1\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Initial strings:\nstr1: This is a test\nstr2: ABCDEFG\n\nInsert str2 into str1:\nThis ABCDEFGis a test \n\nRemove 7 charecters from str1:\nThis is a test \n\nReplace 2 characters in str1 with str2:\nThis ABCDEFG a test\n"
+ "text": [
+ "Initial strings:\n",
+ "str1: This is a test\n",
+ "str2: ABCDEFG\n",
+ "\n",
+ "Insert str2 into str1:\n",
+ "This ABCDEFGis a test \n",
+ "\n",
+ "Remove 7 charecters from str1:\n",
+ "This is a test \n",
+ "\n",
+ "Replace 2 characters in str1 with str2:\n",
+ "This ABCDEFG a test\n"
+ ]
}
],
"prompt_number": 21
@@ -375,19 +1101,37 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.19, Page Number:543<h3>"
+ "source": [
+ "<h3>Example 21.19, Page Number:543<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of find()'''\n\nimport string\n\n#Variable declaration \ns1=\"The string class makes string handling easy.\"\n\ni=string.find(s1,\"class\")\nif not(i==-1):\n print \"Match found at\",i\n print \"Remaining string is:\",\n s2=s1[i:]\n print s2",
+ "input": [
+ "\n",
+ "import string\n",
+ "\n",
+ "#Variable declaration \n",
+ "s1=\"The string class makes string handling easy.\"\n",
+ "\n",
+ "i=string.find(s1,\"class\")\n",
+ "if not(i==-1):\n",
+ " print \"Match found at\",i\n",
+ " print \"Remaining string is:\",\n",
+ " s2=s1[i:]\n",
+ " print s2"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Match found at 11\nRemaining string is: class makes string handling easy.\n"
+ "text": [
+ "Match found at 11\n",
+ "Remaining string is: class makes string handling easy.\n"
+ ]
}
],
"prompt_number": 22
@@ -395,19 +1139,51 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 21.20, Page Number:545<h3>"
+ "source": [
+ "<h3>Example 21.20, Page Number:545<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using a map to create a dictionary'''\n\n#define the function find\ndef find(x,ch):\n for p in x:\n if p[0]==ch:\n return p\n return -1\n\n\ndictionary=[]\n\ndictionary.append([\"house\",\"A place of dwelling\"])\ndictionary.append([\"keyboard\",\"An input device\"])\ndictionary.append([\"programming\",\"The act of writing a program\"])\ndictionary.append([\"STL\",\"Standard Template Library\"])\n\n#given a word, find meaning\nprint \"Enter word:\"\nstr=\"house\" #User input\n\np=find(dictionary,str)\n\nif not(p==-1):\n print \"Definition:\",p[1]\nelse:\n print \"Word not in the dictionary.\"",
+ "input": [
+ "\n",
+ "#define the function find\n",
+ "def find(x,ch):\n",
+ " for p in x:\n",
+ " if p[0]==ch:\n",
+ " return p\n",
+ " return -1\n",
+ "\n",
+ "\n",
+ "dictionary=[]\n",
+ "\n",
+ "dictionary.append([\"house\",\"A place of dwelling\"])\n",
+ "dictionary.append([\"keyboard\",\"An input device\"])\n",
+ "dictionary.append([\"programming\",\"The act of writing a program\"])\n",
+ "dictionary.append([\"STL\",\"Standard Template Library\"])\n",
+ "\n",
+ "#given a word, find meaning\n",
+ "print \"Enter word:\"\n",
+ "str=\"house\" #User input\n",
+ "\n",
+ "p=find(dictionary,str)\n",
+ "\n",
+ "if not(p==-1):\n",
+ " print \"Definition:\",p[1]\n",
+ "else:\n",
+ " print \"Word not in the dictionary.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter word:\nDefinition: A place of dwelling\n"
+ "text": [
+ "Enter word:\n",
+ "Definition: A place of dwelling\n"
+ ]
}
],
"prompt_number": 23
@@ -415,7 +1191,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_22(1).ipynb b/C++_from_the_Ground/Chapter_22(1).ipynb
index 83be7161..8c26974a 100644
--- a/C++_from_the_Ground/Chapter_22(1).ipynb
+++ b/C++_from_the_Ground/Chapter_22(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 22"
+ "name": "",
+ "signature": "sha256:53f00d75f5adfa37af0d8067426691c881e1b4ea1e38045c3a67a88230ca00f5"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 22: The C++ Preprocessor<h1>"
+ "source": [
+ "<h1>Chapter 22: The C++ Preprocessor<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 22.1, Page Number: 550<h3>"
+ "source": [
+ "<h3>Example 22.1, Page Number: 550<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implement a function-like macro'''\n\ndef MIN(a,b):\n if a<b:\n return a\n else:\n return b\n\n#Variable declaration\nx=10\ny=20\n\n#Result\nprint \"The minimum is\",MIN(x,y)",
+ "input": [
+ "\n",
+ "def MIN(a,b):\n",
+ " if a<b:\n",
+ " return a\n",
+ " else:\n",
+ " return b\n",
+ "\n",
+ "#Variable declaration\n",
+ "x=10\n",
+ "y=20\n",
+ "\n",
+ "#Result\n",
+ "print \"The minimum is\",MIN(x,y)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The minimum is 10\n"
+ "text": [
+ "The minimum is 10\n"
+ ]
}
],
"prompt_number": 2
@@ -35,19 +56,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 22.2, Page Number: 551<h3>"
+ "source": [
+ "<h3>Example 22.2, Page Number: 551<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implement a function-like macro'''\n#Since macros is implemented here using functions,\n#it wont give a wrong answer.\n\ndef EVEN(a):\n if a%2==0:\n return 1\n else:\n return 0\n\nif EVEN(9+1):\n print \"is even\"\nelse:\n print \"is odd\"",
+ "input": [
+ "\n",
+ "\n",
+ "def EVEN(a):\n",
+ " if a%2==0:\n",
+ " return 1\n",
+ " else:\n",
+ " return 0\n",
+ "\n",
+ "if EVEN(9+1):\n",
+ " print \"is even\"\n",
+ "else:\n",
+ " print \"is odd\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "is even\n"
+ "text": [
+ "is even\n"
+ ]
}
],
"prompt_number": 3
@@ -55,19 +93,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 22.3, Page Number: 551<h3>"
+ "source": [
+ "<h3>Example 22.3, Page Number: 551<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implement a function-like macro'''\n\ndef EVEN(a):\n if a%2==0:\n return 1\n else:\n return 0\n\nif EVEN(9+1):\n print \"is even\"\nelse:\n print \"is odd\"",
+ "input": [
+ "\n",
+ "def EVEN(a):\n",
+ " if a%2==0:\n",
+ " return 1\n",
+ " else:\n",
+ " return 0\n",
+ "\n",
+ "if EVEN(9+1):\n",
+ " print \"is even\"\n",
+ "else:\n",
+ " print \"is odd\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "is even\n"
+ "text": [
+ "is even\n"
+ ]
}
],
"prompt_number": 4
@@ -75,19 +129,31 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 22.4, Page Number: 553<h3>"
+ "source": [
+ "<h3>Example 22.4, Page Number: 553<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Impementing #if'''\n\ndef MAX():\n return 100\n\nif MAX()>10:\n print \"Extra memory required.\"\n ",
+ "input": [
+ "\n",
+ "def MAX():\n",
+ " return 100\n",
+ "\n",
+ "if MAX()>10:\n",
+ " print \"Extra memory required.\"\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Extra memory required.\n"
+ "text": [
+ "Extra memory required.\n"
+ ]
}
],
"prompt_number": 5
@@ -95,19 +161,33 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 22.5, Page Number: 554<h3>"
+ "source": [
+ "<h3>Example 22.5, Page Number: 554<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Impementing #if/#else'''\n\ndef MAX():\n return 6\n\nif MAX()>10:\n print \"Extra memory required.\"\nelse:\n print \"Current memory OK.\"\n ",
+ "input": [
+ "\n",
+ "def MAX():\n",
+ " return 6\n",
+ "\n",
+ "if MAX()>10:\n",
+ " print \"Extra memory required.\"\n",
+ "else:\n",
+ " print \"Current memory OK.\"\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Current memory OK.\n"
+ "text": [
+ "Current memory OK.\n"
+ ]
}
],
"prompt_number": 7
@@ -115,19 +195,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 22.6, Page Number: 556<h3>"
+ "source": [
+ "<h3>Example 22.6, Page Number: 556<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of #ifdef and #ifndef'''\n\ndef TOM():\n pass\n\n\ntry:\n TOM()\nexcept NameError:\n print \"Programmer is unknown.\"\nelse:\n print \"Programmer is Tom.\"\n \ntry:\n RALPH()\nexcept NameError:\n print \"RALPH not defined.\"\n ",
+ "input": [
+ "\n",
+ "def TOM():\n",
+ " pass\n",
+ "\n",
+ "\n",
+ "try:\n",
+ " TOM()\n",
+ "except NameError:\n",
+ " print \"Programmer is unknown.\"\n",
+ "else:\n",
+ " print \"Programmer is Tom.\"\n",
+ " \n",
+ "try:\n",
+ " RALPH()\n",
+ "except NameError:\n",
+ " print \"RALPH not defined.\"\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Programmer is Tom.\nRALPH not defined.\n"
+ "text": [
+ "Programmer is Tom.\n",
+ "RALPH not defined.\n"
+ ]
}
],
"prompt_number": 8
@@ -135,19 +238,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 22.7, Page Number: 558<h3>"
+ "source": [
+ "<h3>Example 22.7, Page Number: 558<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implement __LINE__ '''\n\nimport inspect\n\n#Returns the current line number in our program.\ndef lineno():\n return inspect.currentframe().f_back.f_lineno\n \nprint lineno()+200\n",
+ "input": [
+ "\n",
+ "import inspect\n",
+ "\n",
+ "#Returns the current line number in our program.\n",
+ "def lineno():\n",
+ " return inspect.currentframe().f_back.f_lineno\n",
+ " \n",
+ "print lineno()+200\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "209\n"
+ "text": [
+ "209\n"
+ ]
}
],
"prompt_number": 9
@@ -155,19 +271,31 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 22.8, Page Number: 559<h3>"
+ "source": [
+ "<h3>Example 22.8, Page Number: 559<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implemention # operator'''\n\ndef mkstr(s):\n return str(s)\n\n#Result\nprint mkstr('I like C++')\n",
+ "input": [
+ "\n",
+ "\n",
+ "def mkstr(s):\n",
+ " return str(s)\n",
+ "\n",
+ "#Result\n",
+ "print mkstr('I like C++')\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "I like C++\n"
+ "text": [
+ "I like C++\n"
+ ]
}
],
"prompt_number": 10
@@ -175,19 +303,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 22.9, Page Number: 560<h3>"
+ "source": [
+ "<h3>Example 22.9, Page Number: 560<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implemention # operator'''\n\ndef concat(a,b):\n return a+b\n#Variable declaration\nxy=10\n\n#Result\nexec(\"print %s\")%concat('x','y')",
+ "input": [
+ "\n",
+ "def concat(a,b):\n",
+ " return a+b\n",
+ "#Variable declaration\n",
+ "xy=10\n",
+ "\n",
+ "#Result\n",
+ "exec(\"print %s\")%concat('x','y')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
}
],
"prompt_number": 11
@@ -195,7 +336,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_3(1).ipynb b/C++_from_the_Ground/Chapter_3(1).ipynb
index b0b5479c..19f2cea0 100644
--- a/C++_from_the_Ground/Chapter_3(1).ipynb
+++ b/C++_from_the_Ground/Chapter_3(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 3"
+ "name": "",
+ "signature": "sha256:a048620e2c0a121c8dd48d68bd57c4172e8820ecd9345c7b4ca01d8f4f4621a3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 3: The Basic Data Types<h1>"
+ "source": [
+ "<h1>Chapter 3: The Basic Data Types<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 3.1, Page Number: 35<h3>"
+ "source": [
+ "<h3>Example 3.1, Page Number: 35<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Local Variables'''\n\ndef func():\n x=-199 #local to func\n print x #displays -199 \n \nx=10 #local to main\n\nfunc()\nprint x #displays 10\n",
+ "input": [
+ "\n",
+ "\n",
+ "def func():\n",
+ " x=-199 #local to func\n",
+ " print x #displays -199 \n",
+ " \n",
+ "x=10 #local to main\n",
+ "\n",
+ "func()\n",
+ "print x #displays 10\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "-199\n10\n"
+ "text": [
+ "-199\n",
+ "10\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +54,51 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 3.2, Page Number: 37<h3>"
+ "source": [
+ "<h3>Example 3.2, Page Number: 37<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Global Variables'''\n\ndef func1():\n global count\n print \"count: \",count #access global count\n func2()\n\ndef func2():\n for count in range(3): #this is local variable\n print '.',\n\n \ncount=None #global variables\n\nfor i in range(10):\n count=i*2\n func1()\n",
+ "input": [
+ "\n",
+ "\n",
+ "def func1():\n",
+ " global count\n",
+ " print \"count: \",count #access global count\n",
+ " func2()\n",
+ "\n",
+ "def func2():\n",
+ " for count in range(3): #this is local variable\n",
+ " print '.',\n",
+ "\n",
+ " \n",
+ "count=None #global variables\n",
+ "\n",
+ "for i in range(10):\n",
+ " count=i*2\n",
+ " func1()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "count: 0\n. . . count: 2\n. . . count: 4\n. . . count: 6\n. . . count: 8\n. . . count: 10\n. . . count: 12\n. . . count: 14\n. . . count: 16\n. . . count: 18\n. . .\n"
+ "text": [
+ "count: 0\n",
+ ". . . count: 2\n",
+ ". . . count: 4\n",
+ ". . . count: 6\n",
+ ". . . count: 8\n",
+ ". . . count: 10\n",
+ ". . . count: 12\n",
+ ". . . count: 14\n",
+ ". . . count: 16\n",
+ ". . . count: 18\n",
+ ". . .\n"
+ ]
}
],
"prompt_number": 1
@@ -55,19 +106,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 3.3, Page Number: 40<h3>"
+ "source": [
+ "<h3>Example 3.3, Page Number: 40<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Singned and Unsigned integers'''\n#Since there is no limit to values stored\n#by integers in python, the output would \n#be different from the one in C++.\n\nfrom ctypes import *\n\n#Variable declaration\nj=c_uint(60000)\ni=c_int(60000)\n\n#Result\nprint i.value,j.value",
+ "input": [
+ "\n",
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "j=c_uint(60000)\n",
+ "i=c_int(60000)\n",
+ "\n",
+ "#Result\n",
+ "print i.value,j.value"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "60000 60000\n"
+ "text": [
+ "60000 60000\n"
+ ]
}
],
"prompt_number": 5
@@ -75,19 +141,29 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 3.4, Page Number: 41<h3>"
+ "source": [
+ "<h3>Example 3.4, Page Number: 41<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to print the alphabet in reverse order'''\n\nfor letter in xrange(ord('Z'),ord('A')-1,-1):\n print chr(letter),\n ",
+ "input": [
+ "\n",
+ "\n",
+ "for letter in xrange(ord('Z'),ord('A')-1,-1):\n",
+ " print chr(letter),\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Z Y X W V U T S R Q P O N M L K J I H G F E D C B A\n"
+ "text": [
+ "Z Y X W V U T S R Q P O N M L K J I H G F E D C B A\n"
+ ]
}
],
"prompt_number": 8
@@ -95,19 +171,29 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 3.5, Page Number: 44<h3>"
+ "source": [
+ "<h3>Example 3.5, Page Number: 44<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate character escape sequences'''\n\n#prints a newline, a backslash and a backspace\nprint \"\\n\\\\\\b\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#prints a newline, a backslash and a backspace\n",
+ "print \"\\n\\\\\\b\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n\\\b\n"
+ "text": [
+ "\n",
+ "\\\b\n"
+ ]
}
],
"prompt_number": 9
@@ -115,19 +201,50 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 3.6, Page Number: 45<h3>"
+ "source": [
+ "<h3>Example 3.6, Page Number: 45<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example that uses variable initalization'''\n\ndef total(x):\n sum=0\n for i in xrange(1,x+1):\n sum=sum+i\n for count in range(10):\n print '-',\n print \"The current sum is\",sum\n \nprint \"Computing summation of 5.\"\ntotal(5)\n\nprint \"Computing summation of 6.\"\ntotal(6)",
+ "input": [
+ "\n",
+ "def total(x):\n",
+ " sum=0\n",
+ " for i in xrange(1,x+1):\n",
+ " sum=sum+i\n",
+ " for count in range(10):\n",
+ " print '-',\n",
+ " print \"The current sum is\",sum\n",
+ " \n",
+ "print \"Computing summation of 5.\"\n",
+ "total(5)\n",
+ "\n",
+ "print \"Computing summation of 6.\"\n",
+ "total(6)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Computing summation of 5.\n- - - - - - - - - - The current sum is 1\n- - - - - - - - - - The current sum is 3\n- - - - - - - - - - The current sum is 6\n- - - - - - - - - - The current sum is 10\n- - - - - - - - - - The current sum is 15\nComputing summation of 6.\n- - - - - - - - - - The current sum is 1\n- - - - - - - - - - The current sum is 3\n- - - - - - - - - - The current sum is 6\n- - - - - - - - - - The current sum is 10\n- - - - - - - - - - The current sum is 15\n- - - - - - - - - - The current sum is 21\n"
+ "text": [
+ "Computing summation of 5.\n",
+ "- - - - - - - - - - The current sum is 1\n",
+ "- - - - - - - - - - The current sum is 3\n",
+ "- - - - - - - - - - The current sum is 6\n",
+ "- - - - - - - - - - The current sum is 10\n",
+ "- - - - - - - - - - The current sum is 15\n",
+ "Computing summation of 6.\n",
+ "- - - - - - - - - - The current sum is 1\n",
+ "- - - - - - - - - - The current sum is 3\n",
+ "- - - - - - - - - - The current sum is 6\n",
+ "- - - - - - - - - - The current sum is 10\n",
+ "- - - - - - - - - - The current sum is 15\n",
+ "- - - - - - - - - - The current sum is 21\n"
+ ]
}
],
"prompt_number": 2
@@ -135,19 +252,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 3.7, Page Number: 47<h3>"
+ "source": [
+ "<h3>Example 3.7, Page Number: 47<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate arithmetic operations'''\n\n#Variable declaration\nx=10\ny=3\n\nprint x/y #will display 3\nprint x%y #will display1, the remainder\n\nx=1\ny=2\n\n#Result\nprint x/y,x%y #will display 0 1",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "x=10\n",
+ "y=3\n",
+ "\n",
+ "print x/y #will display 3\n",
+ "print x%y #will display1, the remainder\n",
+ "\n",
+ "x=1\n",
+ "y=2\n",
+ "\n",
+ "#Result\n",
+ "print x/y,x%y #will display 0 1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "3\n1\n0 1\n"
+ "text": [
+ "3\n",
+ "1\n",
+ "0 1\n"
+ ]
}
],
"prompt_number": 11
@@ -155,19 +292,43 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 3.8, Page Number: 51<h3>"
+ "source": [
+ "<h3>Example 3.8, Page Number: 51<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate the xor function'''\n\n#the xor function\ndef xor(a,b):\n return (a or b)and(not(a and b))\n\n#User-input\nprint \"Enter P(0 or 1):\"\np=1 \nprint \"Enter Q(0 or 1):\"\nq=0\n\n#Result\nprint \"P AND Q:\",(p and q)\nprint \"P OR Q:\",(p or q)\nprint \"P XOR Q:\",xor(p,q)\n",
+ "input": [
+ "\n",
+ "#the xor function\n",
+ "def xor(a,b):\n",
+ " return (a or b)and(not(a and b))\n",
+ "\n",
+ "#User-input\n",
+ "print \"Enter P(0 or 1):\"\n",
+ "p=1 \n",
+ "print \"Enter Q(0 or 1):\"\n",
+ "q=0\n",
+ "\n",
+ "#Result\n",
+ "print \"P AND Q:\",(p and q)\n",
+ "print \"P OR Q:\",(p or q)\n",
+ "print \"P XOR Q:\",xor(p,q)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter P(0 or 1):\nEnter Q(0 or 1):\nP AND Q: 0\nP OR Q: 1\nP XOR Q: True\n"
+ "text": [
+ "Enter P(0 or 1):\n",
+ "Enter Q(0 or 1):\n",
+ "P AND Q: 0\n",
+ "P OR Q: 1\n",
+ "P XOR Q: True\n"
+ ]
}
],
"prompt_number": 12
@@ -175,19 +336,127 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 3.9, Page Number: 54<h3>"
+ "source": [
+ "<h3>Example 3.9, Page Number: 54<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate casting'''\n\nfor i in xrange(1,100+1):\n print i,\"/ 2 is:\",float(i)/2\n",
+ "input": [
+ "\n",
+ "\n",
+ "for i in xrange(1,100+1):\n",
+ " print i,\"/ 2 is:\",float(i)/2\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 / 2 is: 0.5\n2 / 2 is: 1.0\n3 / 2 is: 1.5\n4 / 2 is: 2.0\n5 / 2 is: 2.5\n6 / 2 is: 3.0\n7 / 2 is: 3.5\n8 / 2 is: 4.0\n9 / 2 is: 4.5\n10 / 2 is: 5.0\n11 / 2 is: 5.5\n12 / 2 is: 6.0\n13 / 2 is: 6.5\n14 / 2 is: 7.0\n15 / 2 is: 7.5\n16 / 2 is: 8.0\n17 / 2 is: 8.5\n18 / 2 is: 9.0\n19 / 2 is: 9.5\n20 / 2 is: 10.0\n21 / 2 is: 10.5\n22 / 2 is: 11.0\n23 / 2 is: 11.5\n24 / 2 is: 12.0\n25 / 2 is: 12.5\n26 / 2 is: 13.0\n27 / 2 is: 13.5\n28 / 2 is: 14.0\n29 / 2 is: 14.5\n30 / 2 is: 15.0\n31 / 2 is: 15.5\n32 / 2 is: 16.0\n33 / 2 is: 16.5\n34 / 2 is: 17.0\n35 / 2 is: 17.5\n36 / 2 is: 18.0\n37 / 2 is: 18.5\n38 / 2 is: 19.0\n39 / 2 is: 19.5\n40 / 2 is: 20.0\n41 / 2 is: 20.5\n42 / 2 is: 21.0\n43 / 2 is: 21.5\n44 / 2 is: 22.0\n45 / 2 is: 22.5\n46 / 2 is: 23.0\n47 / 2 is: 23.5\n48 / 2 is: 24.0\n49 / 2 is: 24.5\n50 / 2 is: 25.0\n51 / 2 is: 25.5\n52 / 2 is: 26.0\n53 / 2 is: 26.5\n54 / 2 is: 27.0\n55 / 2 is: 27.5\n56 / 2 is: 28.0\n57 / 2 is: 28.5\n58 / 2 is: 29.0\n59 / 2 is: 29.5\n60 / 2 is: 30.0\n61 / 2 is: 30.5\n62 / 2 is: 31.0\n63 / 2 is: 31.5\n64 / 2 is: 32.0\n65 / 2 is: 32.5\n66 / 2 is: 33.0\n67 / 2 is: 33.5\n68 / 2 is: 34.0\n69 / 2 is: 34.5\n70 / 2 is: 35.0\n71 / 2 is: 35.5\n72 / 2 is: 36.0\n73 / 2 is: 36.5\n74 / 2 is: 37.0\n75 / 2 is: 37.5\n76 / 2 is: 38.0\n77 / 2 is: 38.5\n78 / 2 is: 39.0\n79 / 2 is: 39.5\n80 / 2 is: 40.0\n81 / 2 is: 40.5\n82 / 2 is: 41.0\n83 / 2 is: 41.5\n84 / 2 is: 42.0\n85 / 2 is: 42.5\n86 / 2 is: 43.0\n87 / 2 is: 43.5\n88 / 2 is: 44.0\n89 / 2 is: 44.5\n90 / 2 is: 45.0\n91 / 2 is: 45.5\n92 / 2 is: 46.0\n93 / 2 is: 46.5\n94 / 2 is: 47.0\n95 / 2 is: 47.5\n96 / 2 is: 48.0\n97 / 2 is: 48.5\n98 / 2 is: 49.0\n99 / 2 is: 49.5\n100 / 2 is: 50.0\n"
+ "text": [
+ "1 / 2 is: 0.5\n",
+ "2 / 2 is: 1.0\n",
+ "3 / 2 is: 1.5\n",
+ "4 / 2 is: 2.0\n",
+ "5 / 2 is: 2.5\n",
+ "6 / 2 is: 3.0\n",
+ "7 / 2 is: 3.5\n",
+ "8 / 2 is: 4.0\n",
+ "9 / 2 is: 4.5\n",
+ "10 / 2 is: 5.0\n",
+ "11 / 2 is: 5.5\n",
+ "12 / 2 is: 6.0\n",
+ "13 / 2 is: 6.5\n",
+ "14 / 2 is: 7.0\n",
+ "15 / 2 is: 7.5\n",
+ "16 / 2 is: 8.0\n",
+ "17 / 2 is: 8.5\n",
+ "18 / 2 is: 9.0\n",
+ "19 / 2 is: 9.5\n",
+ "20 / 2 is: 10.0\n",
+ "21 / 2 is: 10.5\n",
+ "22 / 2 is: 11.0\n",
+ "23 / 2 is: 11.5\n",
+ "24 / 2 is: 12.0\n",
+ "25 / 2 is: 12.5\n",
+ "26 / 2 is: 13.0\n",
+ "27 / 2 is: 13.5\n",
+ "28 / 2 is: 14.0\n",
+ "29 / 2 is: 14.5\n",
+ "30 / 2 is: 15.0\n",
+ "31 / 2 is: 15.5\n",
+ "32 / 2 is: 16.0\n",
+ "33 / 2 is: 16.5\n",
+ "34 / 2 is: 17.0\n",
+ "35 / 2 is: 17.5\n",
+ "36 / 2 is: 18.0\n",
+ "37 / 2 is: 18.5\n",
+ "38 / 2 is: 19.0\n",
+ "39 / 2 is: 19.5\n",
+ "40 / 2 is: 20.0\n",
+ "41 / 2 is: 20.5\n",
+ "42 / 2 is: 21.0\n",
+ "43 / 2 is: 21.5\n",
+ "44 / 2 is: 22.0\n",
+ "45 / 2 is: 22.5\n",
+ "46 / 2 is: 23.0\n",
+ "47 / 2 is: 23.5\n",
+ "48 / 2 is: 24.0\n",
+ "49 / 2 is: 24.5\n",
+ "50 / 2 is: 25.0\n",
+ "51 / 2 is: 25.5\n",
+ "52 / 2 is: 26.0\n",
+ "53 / 2 is: 26.5\n",
+ "54 / 2 is: 27.0\n",
+ "55 / 2 is: 27.5\n",
+ "56 / 2 is: 28.0\n",
+ "57 / 2 is: 28.5\n",
+ "58 / 2 is: 29.0\n",
+ "59 / 2 is: 29.5\n",
+ "60 / 2 is: 30.0\n",
+ "61 / 2 is: 30.5\n",
+ "62 / 2 is: 31.0\n",
+ "63 / 2 is: 31.5\n",
+ "64 / 2 is: 32.0\n",
+ "65 / 2 is: 32.5\n",
+ "66 / 2 is: 33.0\n",
+ "67 / 2 is: 33.5\n",
+ "68 / 2 is: 34.0\n",
+ "69 / 2 is: 34.5\n",
+ "70 / 2 is: 35.0\n",
+ "71 / 2 is: 35.5\n",
+ "72 / 2 is: 36.0\n",
+ "73 / 2 is: 36.5\n",
+ "74 / 2 is: 37.0\n",
+ "75 / 2 is: 37.5\n",
+ "76 / 2 is: 38.0\n",
+ "77 / 2 is: 38.5\n",
+ "78 / 2 is: 39.0\n",
+ "79 / 2 is: 39.5\n",
+ "80 / 2 is: 40.0\n",
+ "81 / 2 is: 40.5\n",
+ "82 / 2 is: 41.0\n",
+ "83 / 2 is: 41.5\n",
+ "84 / 2 is: 42.0\n",
+ "85 / 2 is: 42.5\n",
+ "86 / 2 is: 43.0\n",
+ "87 / 2 is: 43.5\n",
+ "88 / 2 is: 44.0\n",
+ "89 / 2 is: 44.5\n",
+ "90 / 2 is: 45.0\n",
+ "91 / 2 is: 45.5\n",
+ "92 / 2 is: 46.0\n",
+ "93 / 2 is: 46.5\n",
+ "94 / 2 is: 47.0\n",
+ "95 / 2 is: 47.5\n",
+ "96 / 2 is: 48.0\n",
+ "97 / 2 is: 48.5\n",
+ "98 / 2 is: 49.0\n",
+ "99 / 2 is: 49.5\n",
+ "100 / 2 is: 50.0\n"
+ ]
}
],
"prompt_number": 3
@@ -195,7 +464,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_4(1).ipynb b/C++_from_the_Ground/Chapter_4(1).ipynb
index 5bc3dfe7..ebd72abc 100644
--- a/C++_from_the_Ground/Chapter_4(1).ipynb
+++ b/C++_from_the_Ground/Chapter_4(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 4"
+ "name": "",
+ "signature": "sha256:7a7e07f5e71ec203dfa93cc13b4ce9de80c80af3b59f8d7d6bebe41c247db83e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,17 +11,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 4: Program Control Statements<h1>"
+ "source": [
+ "<h1>Chapter 4: Program Control Statements<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.1, Page Number: 58<h3>"
+ "source": [
+ "<h3>Example 4.1, Page Number: 58<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Magic Number Program'''\n\nimport random\n\n#Variable declaration and initialization\nmagic = random.randint(0,100) #Number which the user has to guess\nguess = 10 #Number which the user guesses\n\nif guess == magic:\n print \"***Right***\" #Result\n\n\n \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "#Variable declaration and initialization\n",
+ "magic = random.randint(0,100) #Number which the user has to guess\n",
+ "guess = 10 #Number which the user guesses\n",
+ "\n",
+ "if guess == magic:\n",
+ " print \"***Right***\" #Result\n",
+ "\n",
+ "\n",
+ " \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -29,19 +49,43 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.2, Page Number: 59<h3>"
+ "source": [
+ "<h3>Example 4.2, Page Number: 59<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Magic Number program: 1st improvement'''\n\nimport random\n\n#Variable decleration and initialization\nmagic=random.randint(0,100) #Number to be guessed\nguess = 10 #Number the user guesses\n\n#Result\nif guess == magic:\n print \"***Right***\"\nelse:\n print \"... Sorry, you're wrong.\"\n\n\n\n \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "#Variable decleration and initialization\n",
+ "magic=random.randint(0,100) #Number to be guessed\n",
+ "guess = 10 #Number the user guesses\n",
+ "\n",
+ "#Result\n",
+ "if guess == magic:\n",
+ " print \"***Right***\"\n",
+ "else:\n",
+ " print \"... Sorry, you're wrong.\"\n",
+ "\n",
+ "\n",
+ "\n",
+ " \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "... Sorry, you're wrong.\n"
+ "text": [
+ "... Sorry, you're wrong.\n"
+ ]
}
],
"prompt_number": 8
@@ -49,19 +93,37 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.3, Page Number: 60<h3>"
+ "source": [
+ "<h3>Example 4.3, Page Number: 60<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''#Divide the first number by the second.'''\n\n#Variable decleration and initialization\na = 30 #User input for the two nos.\nb = 10\n\n#Calculation and Result\nif b:\n print a/b\nelse:\n print \"Cannot divide by zero.\"\n\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable decleration and initialization\n",
+ "a = 30 #User input for the two nos.\n",
+ "b = 10\n",
+ "\n",
+ "#Calculation and Result\n",
+ "if b:\n",
+ " print a/b\n",
+ "else:\n",
+ " print \"Cannot divide by zero.\"\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
}
],
"prompt_number": 11
@@ -69,12 +131,40 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.4, Page Number: 61<h3>"
+ "source": [
+ "<h3>Example 4.4, Page Number: 61<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Magic Number Program: 2nd improvement'''\n\nimport random\n\n#Variable decleration \nmagic = random.randint(0,100) #Numbr to be guessed\nguess = 10 #Number the user guesses\n\n#Result\nif guess == magic:\n print \"***Right***\"\n print magic,\" is the magic number.\"\nelse:\n print \"... Sorry, you're wrong\" \n if(guess>magic): #use a nested if statement\n print \"Your guess is too high\"\n else:\n print \"Your guess is too low\"\n\n \n \n\n \n \n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "#Variable decleration \n",
+ "magic = random.randint(0,100) #Numbr to be guessed\n",
+ "guess = 10 #Number the user guesses\n",
+ "\n",
+ "#Result\n",
+ "if guess == magic:\n",
+ " print \"***Right***\"\n",
+ " print magic,\" is the magic number.\"\n",
+ "else:\n",
+ " print \"... Sorry, you're wrong\" \n",
+ " if(guess>magic): #use a nested if statement\n",
+ " print \"Your guess is too high\"\n",
+ " else:\n",
+ " print \"Your guess is too low\"\n",
+ "\n",
+ " \n",
+ " \n",
+ "\n",
+ " \n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": []
@@ -82,19 +172,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.5, Page Number: 62<h3>"
+ "source": [
+ "<h3>Example 4.5, Page Number: 62<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Demonstrate an if-else-if ladder'''\n\nfor x in range(6):\n if x==1: #using if-else ladder in a for loop\n print \"x is one\"\n elif x==2:\n print \"x is two\"\n elif x==3:\n print \"x is three\"\n elif x==4:\n print \"x is four\"\n else:\n print \"x is not between 1 nd 4\"\n \n \n \n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "for x in range(6):\n",
+ " if x==1: #using if-else ladder in a for loop\n",
+ " print \"x is one\"\n",
+ " elif x==2:\n",
+ " print \"x is two\"\n",
+ " elif x==3:\n",
+ " print \"x is three\"\n",
+ " elif x==4:\n",
+ " print \"x is four\"\n",
+ " else:\n",
+ " print \"x is not between 1 nd 4\"\n",
+ " \n",
+ " \n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x is not between 1 nd 4\nx is one\nx is two\nx is three\nx is four\nx is not between 1 nd 4\n"
+ "text": [
+ "x is not between 1 nd 4\n",
+ "x is one\n",
+ "x is two\n",
+ "x is three\n",
+ "x is four\n",
+ "x is not between 1 nd 4\n"
+ ]
}
],
"prompt_number": 13
@@ -102,19 +219,131 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.6, Page Number: 63<h3>"
+ "source": [
+ "<h3>Example 4.6, Page Number: 63<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''For loop demonstration'''\n\nimport math\n\nfor num in range(100):\n sq_root = math.sqrt(float(num)) #Calculation\n print num,\" \",sq_root #Result\n ",
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "for num in range(100):\n",
+ " sq_root = math.sqrt(float(num)) #Calculation\n",
+ " print num,\" \",sq_root #Result\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 0.0\n1 1.0\n2 1.41421356237\n3 1.73205080757\n4 2.0\n5 2.2360679775\n6 2.44948974278\n7 2.64575131106\n8 2.82842712475\n9 3.0\n10 3.16227766017\n11 3.31662479036\n12 3.46410161514\n13 3.60555127546\n14 3.74165738677\n15 3.87298334621\n16 4.0\n17 4.12310562562\n18 4.24264068712\n19 4.35889894354\n20 4.472135955\n21 4.58257569496\n22 4.69041575982\n23 4.79583152331\n24 4.89897948557\n25 5.0\n26 5.09901951359\n27 5.19615242271\n28 5.29150262213\n29 5.38516480713\n30 5.47722557505\n31 5.56776436283\n32 5.65685424949\n33 5.74456264654\n34 5.83095189485\n35 5.9160797831\n36 6.0\n37 6.0827625303\n38 6.16441400297\n39 6.2449979984\n40 6.32455532034\n41 6.40312423743\n42 6.48074069841\n43 6.5574385243\n44 6.63324958071\n45 6.7082039325\n46 6.78232998313\n47 6.8556546004\n48 6.92820323028\n49 7.0\n50 7.07106781187\n51 7.14142842854\n52 7.21110255093\n53 7.28010988928\n54 7.34846922835\n55 7.4161984871\n56 7.48331477355\n57 7.54983443527\n58 7.61577310586\n59 7.68114574787\n60 7.74596669241\n61 7.81024967591\n62 7.87400787401\n63 7.93725393319\n64 8.0\n65 8.0622577483\n66 8.12403840464\n67 8.18535277187\n68 8.24621125124\n69 8.30662386292\n70 8.36660026534\n71 8.42614977318\n72 8.48528137424\n73 8.54400374532\n74 8.60232526704\n75 8.66025403784\n76 8.71779788708\n77 8.77496438739\n78 8.83176086633\n79 8.88819441732\n80 8.94427191\n81 9.0\n82 9.05538513814\n83 9.11043357914\n84 9.16515138991\n85 9.21954445729\n86 9.2736184955\n87 9.32737905309\n88 9.38083151965\n89 9.43398113206\n90 9.48683298051\n91 9.53939201417\n92 9.59166304663\n93 9.64365076099\n94 9.69535971483\n95 9.74679434481\n96 9.79795897113\n97 9.8488578018\n98 9.89949493661\n99 9.94987437107\n"
+ "text": [
+ "0 0.0\n",
+ "1 1.0\n",
+ "2 1.41421356237\n",
+ "3 1.73205080757\n",
+ "4 2.0\n",
+ "5 2.2360679775\n",
+ "6 2.44948974278\n",
+ "7 2.64575131106\n",
+ "8 2.82842712475\n",
+ "9 3.0\n",
+ "10 3.16227766017\n",
+ "11 3.31662479036\n",
+ "12 3.46410161514\n",
+ "13 3.60555127546\n",
+ "14 3.74165738677\n",
+ "15 3.87298334621\n",
+ "16 4.0\n",
+ "17 4.12310562562\n",
+ "18 4.24264068712\n",
+ "19 4.35889894354\n",
+ "20 4.472135955\n",
+ "21 4.58257569496\n",
+ "22 4.69041575982\n",
+ "23 4.79583152331\n",
+ "24 4.89897948557\n",
+ "25 5.0\n",
+ "26 5.09901951359\n",
+ "27 5.19615242271\n",
+ "28 5.29150262213\n",
+ "29 5.38516480713\n",
+ "30 5.47722557505\n",
+ "31 5.56776436283\n",
+ "32 5.65685424949\n",
+ "33 5.74456264654\n",
+ "34 5.83095189485\n",
+ "35 5.9160797831\n",
+ "36 6.0\n",
+ "37 6.0827625303\n",
+ "38 6.16441400297\n",
+ "39 6.2449979984\n",
+ "40 6.32455532034\n",
+ "41 6.40312423743\n",
+ "42 6.48074069841\n",
+ "43 6.5574385243\n",
+ "44 6.63324958071\n",
+ "45 6.7082039325\n",
+ "46 6.78232998313\n",
+ "47 6.8556546004\n",
+ "48 6.92820323028\n",
+ "49 7.0\n",
+ "50 7.07106781187\n",
+ "51 7.14142842854\n",
+ "52 7.21110255093\n",
+ "53 7.28010988928\n",
+ "54 7.34846922835\n",
+ "55 7.4161984871\n",
+ "56 7.48331477355\n",
+ "57 7.54983443527\n",
+ "58 7.61577310586\n",
+ "59 7.68114574787\n",
+ "60 7.74596669241\n",
+ "61 7.81024967591\n",
+ "62 7.87400787401\n",
+ "63 7.93725393319\n",
+ "64 8.0\n",
+ "65 8.0622577483\n",
+ "66 8.12403840464\n",
+ "67 8.18535277187\n",
+ "68 8.24621125124\n",
+ "69 8.30662386292\n",
+ "70 8.36660026534\n",
+ "71 8.42614977318\n",
+ "72 8.48528137424\n",
+ "73 8.54400374532\n",
+ "74 8.60232526704\n",
+ "75 8.66025403784\n",
+ "76 8.71779788708\n",
+ "77 8.77496438739\n",
+ "78 8.83176086633\n",
+ "79 8.88819441732\n",
+ "80 8.94427191\n",
+ "81 9.0\n",
+ "82 9.05538513814\n",
+ "83 9.11043357914\n",
+ "84 9.16515138991\n",
+ "85 9.21954445729\n",
+ "86 9.2736184955\n",
+ "87 9.32737905309\n",
+ "88 9.38083151965\n",
+ "89 9.43398113206\n",
+ "90 9.48683298051\n",
+ "91 9.53939201417\n",
+ "92 9.59166304663\n",
+ "93 9.64365076099\n",
+ "94 9.69535971483\n",
+ "95 9.74679434481\n",
+ "96 9.79795897113\n",
+ "97 9.8488578018\n",
+ "98 9.89949493661\n",
+ "99 9.94987437107\n"
+ ]
}
],
"prompt_number": 14
@@ -122,19 +351,29 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.7, Page Number: 64<h3>"
+ "source": [
+ "<h3>Example 4.7, Page Number: 64<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Printin numbers 100 to -100 in decrements of 5'''\n\nfor i in xrange(100,-100,-5): \n print i,\n \n",
+ "input": [
+ "\n",
+ "\n",
+ "for i in xrange(100,-100,-5): \n",
+ " print i,\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0 -5 -10 -15 -20 -25 -30 -35 -40 -45 -50 -55 -60 -65 -70 -75 -80 -85 -90 -95\n"
+ "text": [
+ "100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0 -5 -10 -15 -20 -25 -30 -35 -40 -45 -50 -55 -60 -65 -70 -75 -80 -85 -90 -95\n"
+ ]
}
],
"prompt_number": 1
@@ -142,19 +381,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.8, Page Number: 66<h3>"
+ "source": [
+ "<h3>Example 4.8, Page Number: 66<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Runs a loop till 123 is typed'''\n\n#Variable decleration\nx=0\n\n#Loop till 123 is entered\nwhile x!=123:\n print \"Enter a number: \"\n x = 123\n \n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "#Variable decleration\n",
+ "x=0\n",
+ "\n",
+ "#Loop till 123 is entered\n",
+ "while x!=123:\n",
+ " print \"Enter a number: \"\n",
+ " x = 123\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a number: \n"
+ "text": [
+ "Enter a number: \n"
+ ]
}
],
"prompt_number": 11
@@ -162,19 +417,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.9, Page Number: 68<h3>"
+ "source": [
+ "<h3>Example 4.9, Page Number: 68<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Demonstrate switch usig \"help\" program'''\n\n#Displaying the menu\nprint \"Help on:\"\nprint \"1. for\"\nprint \"2. if\"\nprint \"3. while\"\n\n\nchoice = 2 #Choice of user\n\nif choice==1: #Executing users choice with if-else\n print \"for is c++'s most versatile loop.\"\nelif choice==2:\n print \"if is c++'s conditional branch statement.\"\nelif choice==3:\n print \"switch is C++'s multiway branch statement. \"\nelse:\n print \"You must enter a number between 1 and 3.\"\n \n",
+ "input": [
+ "\n",
+ "\n",
+ "#Displaying the menu\n",
+ "print \"Help on:\"\n",
+ "print \"1. for\"\n",
+ "print \"2. if\"\n",
+ "print \"3. while\"\n",
+ "\n",
+ "\n",
+ "choice = 2 #Choice of user\n",
+ "\n",
+ "if choice==1: #Executing users choice with if-else\n",
+ " print \"for is c++'s most versatile loop.\"\n",
+ "elif choice==2:\n",
+ " print \"if is c++'s conditional branch statement.\"\n",
+ "elif choice==3:\n",
+ " print \"switch is C++'s multiway branch statement. \"\n",
+ "else:\n",
+ " print \"You must enter a number between 1 and 3.\"\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Help on:\n1. for\n2. if\n3. while\nif is c++'s conditional branch statement.\n"
+ "text": [
+ "Help on:\n",
+ "1. for\n",
+ "2. if\n",
+ "3. while\n",
+ "if is c++'s conditional branch statement.\n"
+ ]
}
],
"prompt_number": 19
@@ -182,19 +466,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.10, Page Number: 69<h3>"
+ "source": [
+ "<h3>Example 4.10, Page Number: 69<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing the switch statement'''\n#If switch without break is used(as in the book), \n#it gives a different output(Fall through).'''\n\nfor i in range(5):\n if i==0:\n print \"less than 1\"\n elif i==1:\n print \"less than 2\"\n elif i==2:\n print \"less than 3\"\n elif i==3:\n print \"less than 4\"\n elif i==4:\n print \"less than 5\"\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "for i in range(5):\n",
+ " if i==0:\n",
+ " print \"less than 1\"\n",
+ " elif i==1:\n",
+ " print \"less than 2\"\n",
+ " elif i==2:\n",
+ " print \"less than 3\"\n",
+ " elif i==3:\n",
+ " print \"less than 4\"\n",
+ " elif i==4:\n",
+ " print \"less than 5\"\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "less than 1\nless than 2\nless than 3\nless than 4\nless than 5\n"
+ "text": [
+ "less than 1\n",
+ "less than 2\n",
+ "less than 3\n",
+ "less than 4\n",
+ "less than 5\n"
+ ]
}
],
"prompt_number": 20
@@ -202,19 +509,167 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.11, Page Number: 71<h3>"
+ "source": [
+ "<h3>Example 4.11, Page Number: 71<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Displays all printable characters.'''\n\n#Variable decleration\nch = 32\n\n#Loop to print the characters\nfor ch in range(128):\n print chr(ch)\n \n",
+ "input": [
+ "\n",
+ "'''Displays all printable characters.'''\n",
+ "\n",
+ "#Variable decleration\n",
+ "ch = 32\n",
+ "\n",
+ "#Loop to print the characters\n",
+ "for ch in range(128):\n",
+ " print chr(ch)\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\u0000\n\u0001\n\u0002\n\u0003\n\u0004\n\u0005\n\u0006\n\u0007\n\b\n\t\n\n\n\u000b\n\f\n\r\n\u000e\n\u000f\n\u0010\n\u0011\n\u0012\n\u0013\n\u0014\n\u0015\n\u0016\n\u0017\n\u0018\n\u0019\n\u001a\n\u001b\n\u001c\n\u001d\n\u001e\n\u001f\n \n!\n\"\n#\n$\n%\n&\n'\n(\n)\n*\n+\n,\n-\n.\n/\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n:\n;\n<\n=\n>\n?\n@\nA\nB\nC\nD\nE\nF\nG\nH\nI\nJ\nK\nL\nM\nN\nO\nP\nQ\nR\nS\nT\nU\nV\nW\nX\nY\nZ\n[\n\\\n]\n^\n_\n`\na\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz\n{\n|\n}\n~\n\u007f\n"
+ "text": [
+ "\u0000\n",
+ "\u0001\n",
+ "\u0002\n",
+ "\u0003\n",
+ "\u0004\n",
+ "\u0005\n",
+ "\u0006\n",
+ "\u0007\n",
+ "\b\n",
+ "\t\n",
+ "\n",
+ "\n",
+ "\u000b",
+ "\n",
+ "\f",
+ "\n",
+ "\r\n",
+ "\u000e\n",
+ "\u000f\n",
+ "\u0010\n",
+ "\u0011\n",
+ "\u0012\n",
+ "\u0013\n",
+ "\u0014\n",
+ "\u0015\n",
+ "\u0016\n",
+ "\u0017\n",
+ "\u0018\n",
+ "\u0019\n",
+ "\u001a\n",
+ "\u001b\n",
+ "\u001c",
+ "\n",
+ "\u001d",
+ "\n",
+ "\u001e",
+ "\n",
+ "\u001f\n",
+ " \n",
+ "!\n",
+ "\"\n",
+ "#\n",
+ "$\n",
+ "%\n",
+ "&\n",
+ "'\n",
+ "(\n",
+ ")\n",
+ "*\n",
+ "+\n",
+ ",\n",
+ "-\n",
+ ".\n",
+ "/\n",
+ "0\n",
+ "1\n",
+ "2\n",
+ "3\n",
+ "4\n",
+ "5\n",
+ "6\n",
+ "7\n",
+ "8\n",
+ "9\n",
+ ":\n",
+ ";\n",
+ "<\n",
+ "=\n",
+ ">\n",
+ "?\n",
+ "@\n",
+ "A\n",
+ "B\n",
+ "C\n",
+ "D\n",
+ "E\n",
+ "F\n",
+ "G\n",
+ "H\n",
+ "I\n",
+ "J\n",
+ "K\n",
+ "L\n",
+ "M\n",
+ "N\n",
+ "O\n",
+ "P\n",
+ "Q\n",
+ "R\n",
+ "S\n",
+ "T\n",
+ "U\n",
+ "V\n",
+ "W\n",
+ "X\n",
+ "Y\n",
+ "Z\n",
+ "[\n",
+ "\\\n",
+ "]\n",
+ "^\n",
+ "_\n",
+ "`\n",
+ "a\n",
+ "b\n",
+ "c\n",
+ "d\n",
+ "e\n",
+ "f\n",
+ "g\n",
+ "h\n",
+ "i\n",
+ "j\n",
+ "k\n",
+ "l\n",
+ "m\n",
+ "n\n",
+ "o\n",
+ "p\n",
+ "q\n",
+ "r\n",
+ "s\n",
+ "t\n",
+ "u\n",
+ "v\n",
+ "w\n",
+ "x\n",
+ "y\n",
+ "z\n",
+ "{\n",
+ "|\n",
+ "}\n",
+ "~\n",
+ "\u007f\n"
+ ]
}
],
"prompt_number": 21
@@ -222,19 +677,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.12, Page Number: 72<h3>"
+ "source": [
+ "<h3>Example 4.12, Page Number: 72<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example for while loop'''\n\n#Variable decleration\nlen = 5\n\nwhile (len>0 & len<80):\n print \".\"\n len-=1\n",
+ "input": [
+ "\n",
+ "#Variable decleration\n",
+ "len = 5\n",
+ "\n",
+ "while (len>0 & len<80):\n",
+ " print \".\"\n",
+ " len-=1\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": ".\n.\n.\n.\n.\n"
+ "text": [
+ ".\n",
+ ".\n",
+ ".\n",
+ ".\n",
+ ".\n"
+ ]
}
],
"prompt_number": 22
@@ -242,19 +713,38 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.13, Page Number: 73<h3>"
+ "source": [
+ "<h3>Example 4.13, Page Number: 73<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to loop till number 100 is entered'''\n\n#Variable Declaration\nnum=95\n\nwhile True:\n print \"Enter a number(100 to stop): \"\n num+=1 #User input, incrementing num till it reaches 100\n if(num==100): #Condition check to stop loop\n break\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable Declaration\n",
+ "num=95\n",
+ "\n",
+ "while True:\n",
+ " print \"Enter a number(100 to stop): \"\n",
+ " num+=1 #User input, incrementing num till it reaches 100\n",
+ " if(num==100): #Condition check to stop loop\n",
+ " break\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a number(100 to stop): \nEnter a number(100 to stop): \nEnter a number(100 to stop): \nEnter a number(100 to stop): \nEnter a number(100 to stop): \n"
+ "text": [
+ "Enter a number(100 to stop): \n",
+ "Enter a number(100 to stop): \n",
+ "Enter a number(100 to stop): \n",
+ "Enter a number(100 to stop): \n",
+ "Enter a number(100 to stop): \n"
+ ]
}
],
"prompt_number": 9
@@ -262,19 +752,79 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.14, Page Number: 73<h3>"
+ "source": [
+ "<h3>Example 4.14, Page Number: 73<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Magic Number program: 3rd improvement.'''\n\nimport random\n\n#Variable decleration\nmagic = random.randint(0,100) #Number which the user has to guess\nlow=0\nhigh=100\n\n#Play thr magic number game\nwhile True:\n guess = random.randint(low,high) #Number which the user guesses\n if guess==magic: \n print \"**Right**\"\n print magic,\" is the magic number.\"\n break\n else:\n print \"...Sorry, you're wrong.\"\n if(guess>magic):\n print \"Your guess is too high.\"\n high=guess\n else:\n print \"Your guess is too low.\"\n low=guess\n \n \n",
+ "input": [
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "#Variable decleration\n",
+ "magic = random.randint(0,100) #Number which the user has to guess\n",
+ "low=0\n",
+ "high=100\n",
+ "\n",
+ "#Play thr magic number game\n",
+ "while True:\n",
+ " guess = random.randint(low,high) #Number which the user guesses\n",
+ " if guess==magic: \n",
+ " print \"**Right**\"\n",
+ " print magic,\" is the magic number.\"\n",
+ " break\n",
+ " else:\n",
+ " print \"...Sorry, you're wrong.\"\n",
+ " if(guess>magic):\n",
+ " print \"Your guess is too high.\"\n",
+ " high=guess\n",
+ " else:\n",
+ " print \"Your guess is too low.\"\n",
+ " low=guess\n",
+ " \n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "...Sorry, you're wrong.\nYour guess is too low.\n...Sorry, you're wrong.\nYour guess is too high.\n...Sorry, you're wrong.\nYour guess is too low.\n...Sorry, you're wrong.\nYour guess is too high.\n...Sorry, you're wrong.\nYour guess is too low.\n...Sorry, you're wrong.\nYour guess is too high.\n...Sorry, you're wrong.\nYour guess is too low.\n...Sorry, you're wrong.\nYour guess is too high.\n...Sorry, you're wrong.\nYour guess is too low.\n...Sorry, you're wrong.\nYour guess is too low.\n...Sorry, you're wrong.\nYour guess is too high.\n...Sorry, you're wrong.\nYour guess is too high.\n...Sorry, you're wrong.\nYour guess is too high.\n...Sorry, you're wrong.\nYour guess is too low.\n**Right**\n72 is the magic number.\n"
+ "text": [
+ "...Sorry, you're wrong.\n",
+ "Your guess is too low.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too high.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too low.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too high.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too low.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too high.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too low.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too high.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too low.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too low.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too high.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too high.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too high.\n",
+ "...Sorry, you're wrong.\n",
+ "Your guess is too low.\n",
+ "**Right**\n",
+ "72 is the magic number.\n"
+ ]
}
],
"prompt_number": 26
@@ -282,19 +832,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.15, Page Number: 74<h3>"
+ "source": [
+ "<h3>Example 4.15, Page Number: 74<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example for continue statement'''\n\nfor x in range(100+1):\n if x%2: #Condition check to continue the loop\n continue\n print x,\n \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "for x in range(100+1):\n",
+ " if x%2: #Condition check to continue the loop\n",
+ " continue\n",
+ " print x,\n",
+ " \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100\n"
+ "text": [
+ "0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100\n"
+ ]
}
],
"prompt_number": 2
@@ -302,19 +865,31 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.16, Page Number: 75<h3>"
+ "source": [
+ "<h3>Example 4.16, Page Number: 75<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Iterates from 0 to 9, not to 100'''\n\nfor t in range(100):\n if t==10: #Condition check to break out of the loop\n break\n print t,\n \n",
+ "input": [
+ "\n",
+ "\n",
+ "for t in range(100):\n",
+ " if t==10: #Condition check to break out of the loop\n",
+ " break\n",
+ " print t,\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 2 3 4 5 6 7 8 9\n"
+ "text": [
+ "0 1 2 3 4 5 6 7 8 9\n"
+ ]
}
],
"prompt_number": 3
@@ -322,19 +897,134 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.17, Page Number: 75<h3>"
+ "source": [
+ "<h3>Example 4.17, Page Number: 75<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example for break'''\n\nfor t in range(100):\n count = 1 \n while True:\n print count,\n count+=1\n if count==10: \n break #Breaks from the inner loop\n print\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "for t in range(100):\n",
+ " count = 1 \n",
+ " while True:\n",
+ " print count,\n",
+ " count+=1\n",
+ " if count==10: \n",
+ " break #Breaks from the inner loop\n",
+ " print\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n1 2 3 4 5 6 7 8 9\n1 2 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 5 6 7 8 9\n",
+ "1 2 3 4 5 6 7 8 9\n"
+ ]
}
],
"prompt_number": 5
@@ -342,24 +1032,206 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.18, Page Number: 76<h3>"
+ "source": [
+ "<h3>Example 4.18, Page Number: 76<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This Program finds the prime nos. from 2 to 1000'''\n\nfor i in range(2,1000):\n j=2\n for j in range(2,i/j): #Nested for loop\n if i%j == False: #Check for prime no.\n break\n if j>(i/j):\n print i,\" is prime.\" #Result\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "for i in range(2,1000):\n",
+ " j=2\n",
+ " for j in range(2,i/j): #Nested for loop\n",
+ " if i%j == False: #Check for prime no.\n",
+ " break\n",
+ " if j>(i/j):\n",
+ " print i,\" is prime.\" #Result\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "2 is prime.\n3 is prime.\n11 is prime.\n13 is prime.\n17 is prime.\n19 is prime.\n23 is prime.\n29 is prime.\n31 is prime.\n37 is prime.\n41 is prime.\n43 is prime.\n47 is prime.\n53 is prime.\n59 is prime.\n61 is prime.\n67 is prime.\n71 is prime.\n73 is prime.\n79 is prime.\n83 is prime.\n89 is prime.\n97 is prime.\n101 is prime.\n103 is prime.\n107 is prime.\n109 is prime.\n113 is prime.\n127 is prime.\n131 is prime.\n137 is prime.\n139 is prime.\n149 is prime.\n151 is prime.\n157 is prime.\n163 is prime.\n167 is prime.\n173 is prime.\n179 is prime.\n181 is prime.\n191 is prime.\n193 is prime.\n197 is prime.\n199 is prime.\n211 is prime.\n223 is prime.\n227 is prime.\n229 is prime.\n233 is prime.\n239 is prime.\n241 is prime.\n251 is prime.\n257 is prime.\n263 is prime.\n269 is prime.\n271 is prime.\n277 is prime.\n281 is prime.\n283 is prime.\n293 is prime.\n307 is prime.\n311 is prime.\n313 is prime.\n317 is prime.\n331 is prime.\n337 is prime.\n347 is prime.\n349 is prime.\n353 is prime.\n359 is prime.\n367 is prime.\n373 is prime.\n379 is prime.\n383 is prime.\n389 is prime.\n397 is prime.\n401 is prime.\n409 is prime.\n419 is prime.\n421 is prime.\n431 is prime.\n433 is prime.\n439 is prime.\n443 is prime.\n449 is prime.\n457 is prime.\n461 is prime.\n463 is prime.\n467 is prime.\n479 is prime.\n487 is prime.\n491 is prime.\n499 is prime.\n503 is prime.\n509 is prime.\n521 is prime.\n523 is prime.\n541 is prime.\n547 is prime.\n557 is prime.\n563 is prime.\n569 is prime.\n571 is prime.\n577 is prime.\n587 is prime.\n593 is prime.\n599 is prime.\n601 is prime.\n607 is prime.\n613 is prime.\n617 is prime.\n619 is prime.\n631 is prime.\n641 is prime.\n643 is prime.\n647 is prime.\n653 is prime.\n659 is prime.\n661 is prime.\n673 is prime.\n677 is prime.\n683 is prime.\n691 is prime.\n701 is prime.\n709 is prime.\n719 is prime.\n727 is prime.\n733 is prime.\n739 is prime.\n743 is prime.\n751 is prime.\n757 is prime.\n761 is prime.\n769 is prime.\n773 is prime.\n787 is prime.\n797 is prime.\n809 is prime.\n811 is prime.\n821 is prime.\n823 is prime.\n827 is prime.\n829 is prime.\n839 is prime.\n853 is prime.\n857 is prime.\n859 is prime.\n863 is prime.\n877"
+ "text": [
+ "2 is prime.\n",
+ "3 is prime.\n",
+ "11 is prime.\n",
+ "13 is prime.\n",
+ "17 is prime.\n",
+ "19 is prime.\n",
+ "23 is prime.\n",
+ "29 is prime.\n",
+ "31 is prime.\n",
+ "37 is prime.\n",
+ "41 is prime.\n",
+ "43 is prime.\n",
+ "47 is prime.\n",
+ "53 is prime.\n",
+ "59 is prime.\n",
+ "61 is prime.\n",
+ "67 is prime.\n",
+ "71 is prime.\n",
+ "73 is prime.\n",
+ "79 is prime.\n",
+ "83 is prime.\n",
+ "89 is prime.\n",
+ "97 is prime.\n",
+ "101 is prime.\n",
+ "103 is prime.\n",
+ "107 is prime.\n",
+ "109 is prime.\n",
+ "113 is prime.\n",
+ "127 is prime.\n",
+ "131 is prime.\n",
+ "137 is prime.\n",
+ "139 is prime.\n",
+ "149 is prime.\n",
+ "151 is prime.\n",
+ "157 is prime.\n",
+ "163 is prime.\n",
+ "167 is prime.\n",
+ "173 is prime.\n",
+ "179 is prime.\n",
+ "181 is prime.\n",
+ "191 is prime.\n",
+ "193 is prime.\n",
+ "197 is prime.\n",
+ "199 is prime.\n",
+ "211 is prime.\n",
+ "223 is prime.\n",
+ "227 is prime.\n",
+ "229 is prime.\n",
+ "233 is prime.\n",
+ "239 is prime.\n",
+ "241 is prime.\n",
+ "251 is prime.\n",
+ "257 is prime.\n",
+ "263 is prime.\n",
+ "269 is prime.\n",
+ "271 is prime.\n",
+ "277 is prime.\n",
+ "281 is prime.\n",
+ "283 is prime.\n",
+ "293 is prime.\n",
+ "307 is prime.\n",
+ "311 is prime.\n",
+ "313 is prime.\n",
+ "317 is prime.\n",
+ "331 is prime.\n",
+ "337 is prime.\n",
+ "347 is prime.\n",
+ "349 is prime.\n",
+ "353 is prime.\n",
+ "359 is prime.\n",
+ "367 is prime.\n",
+ "373 is prime.\n",
+ "379 is prime.\n",
+ "383 is prime.\n",
+ "389 is prime.\n",
+ "397 is prime.\n",
+ "401 is prime.\n",
+ "409 is prime.\n",
+ "419 is prime.\n",
+ "421 is prime.\n",
+ "431 is prime.\n",
+ "433 is prime.\n",
+ "439 is prime.\n",
+ "443 is prime.\n",
+ "449 is prime.\n",
+ "457 is prime.\n",
+ "461 is prime.\n",
+ "463 is prime.\n",
+ "467 is prime.\n",
+ "479 is prime.\n",
+ "487 is prime.\n",
+ "491 is prime.\n",
+ "499 is prime.\n",
+ "503 is prime.\n",
+ "509 is prime.\n",
+ "521 is prime.\n",
+ "523 is prime.\n",
+ "541 is prime.\n",
+ "547 is prime.\n",
+ "557 is prime.\n",
+ "563 is prime.\n",
+ "569 is prime.\n",
+ "571 is prime.\n",
+ "577 is prime.\n",
+ "587 is prime.\n",
+ "593 is prime.\n",
+ "599 is prime.\n",
+ "601 is prime.\n",
+ "607 is prime.\n",
+ "613 is prime.\n",
+ "617 is prime.\n",
+ "619 is prime.\n",
+ "631 is prime.\n",
+ "641 is prime.\n",
+ "643 is prime.\n",
+ "647 is prime.\n",
+ "653 is prime.\n",
+ "659 is prime.\n",
+ "661 is prime.\n",
+ "673 is prime.\n",
+ "677 is prime.\n",
+ "683 is prime.\n",
+ "691 is prime.\n",
+ "701 is prime.\n",
+ "709 is prime.\n",
+ "719 is prime.\n",
+ "727 is prime.\n",
+ "733 is prime.\n",
+ "739 is prime.\n",
+ "743 is prime.\n",
+ "751 is prime.\n",
+ "757 is prime.\n",
+ "761 is prime.\n",
+ "769 is prime.\n",
+ "773 is prime.\n",
+ "787 is prime.\n",
+ "797 is prime.\n",
+ "809 is prime.\n",
+ "811 is prime.\n",
+ "821 is prime.\n",
+ "823 is prime.\n",
+ "827 is prime.\n",
+ "829 is prime.\n",
+ "839 is prime.\n",
+ "853 is prime.\n",
+ "857 is prime.\n",
+ "859 is prime.\n",
+ "863 is prime.\n",
+ "877"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " is prime.\n881 is prime.\n883 is prime.\n887 is prime.\n907 is prime.\n911 is prime.\n919 is prime.\n929 is prime.\n937 is prime.\n941 is prime.\n947 is prime.\n953 is prime.\n967 is prime.\n971 is prime.\n977 is prime.\n983 is prime.\n991 is prime.\n997 is prime.\n"
+ "text": [
+ " is prime.\n",
+ "881 is prime.\n",
+ "883 is prime.\n",
+ "887 is prime.\n",
+ "907 is prime.\n",
+ "911 is prime.\n",
+ "919 is prime.\n",
+ "929 is prime.\n",
+ "937 is prime.\n",
+ "941 is prime.\n",
+ "947 is prime.\n",
+ "953 is prime.\n",
+ "967 is prime.\n",
+ "971 is prime.\n",
+ "977 is prime.\n",
+ "983 is prime.\n",
+ "991 is prime.\n",
+ "997 is prime.\n"
+ ]
}
],
"prompt_number": 30
@@ -367,19 +1239,92 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 4.19, Page Number: 78<h3>"
+ "source": [
+ "<h3>Example 4.19, Page Number: 78<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Magic Number program: Final improvement'''\n\nimport random\n\n#Variable declaration\nmagic = random.randint(0,100) #Number to be guessed\ni=1\nhigh=100\nlow=0\n\n#Function to play the magic number game\ndef play(m):\n low=0\n high=100\n for t in range(100):\n x = random.randint(low,high) #Number guessed by the user\n if x==m:\n print \"***Right***\"\n return\n else:\n if(x<m):\n print \"Too low.\"\n low=x\n else:\n print \"Too high.\"\n high=x\n print \"You've used up all your guesses\" \n\n#Menu\nwhile True:\n print \"1.Get a new magic number.\" \n print \"2.Play\"\n print \"3.Quit\"\n while True:\n option = i \n if option>=1 and option<=3:\n break\n if option==1:\n magic=random.randint(0,100) #Number to be guessed\n elif option==2:\n play(magic) #Calls the function play\n elif option==3:\n print \"Goodbye\" \n break\n i+=1 #increments i such that the 3 options get selected sequentially\n",
+ "input": [
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "#Variable declaration\n",
+ "magic = random.randint(0,100) #Number to be guessed\n",
+ "i=1\n",
+ "high=100\n",
+ "low=0\n",
+ "\n",
+ "#Function to play the magic number game\n",
+ "def play(m):\n",
+ " low=0\n",
+ " high=100\n",
+ " for t in range(100):\n",
+ " x = random.randint(low,high) #Number guessed by the user\n",
+ " if x==m:\n",
+ " print \"***Right***\"\n",
+ " return\n",
+ " else:\n",
+ " if(x<m):\n",
+ " print \"Too low.\"\n",
+ " low=x\n",
+ " else:\n",
+ " print \"Too high.\"\n",
+ " high=x\n",
+ " print \"You've used up all your guesses\" \n",
+ "\n",
+ "#Menu\n",
+ "while True:\n",
+ " print \"1.Get a new magic number.\" \n",
+ " print \"2.Play\"\n",
+ " print \"3.Quit\"\n",
+ " while True:\n",
+ " option = i \n",
+ " if option>=1 and option<=3:\n",
+ " break\n",
+ " if option==1:\n",
+ " magic=random.randint(0,100) #Number to be guessed\n",
+ " elif option==2:\n",
+ " play(magic) #Calls the function play\n",
+ " elif option==3:\n",
+ " print \"Goodbye\" \n",
+ " break\n",
+ " i+=1 #increments i such that the 3 options get selected sequentially\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1.Get a new magic number.\n2.Play\n3.Quit\n1.Get a new magic number.\n2.Play\n3.Quit\nToo low.\nToo low.\nToo low.\nToo low.\nToo high.\nToo low.\nToo high.\nToo low.\nToo high.\nToo high.\nToo high.\nToo high.\nToo low.\n***Right***\n1.Get a new magic number.\n2.Play\n3.Quit\nGoodbye\n"
+ "text": [
+ "1.Get a new magic number.\n",
+ "2.Play\n",
+ "3.Quit\n",
+ "1.Get a new magic number.\n",
+ "2.Play\n",
+ "3.Quit\n",
+ "Too low.\n",
+ "Too low.\n",
+ "Too low.\n",
+ "Too low.\n",
+ "Too high.\n",
+ "Too low.\n",
+ "Too high.\n",
+ "Too low.\n",
+ "Too high.\n",
+ "Too high.\n",
+ "Too high.\n",
+ "Too high.\n",
+ "Too low.\n",
+ "***Right***\n",
+ "1.Get a new magic number.\n",
+ "2.Play\n",
+ "3.Quit\n",
+ "Goodbye\n"
+ ]
}
],
"prompt_number": 6
@@ -387,7 +1332,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_5(1).ipynb b/C++_from_the_Ground/Chapter_5(1).ipynb
index 4ae8f6f6..adbe1235 100644
--- a/C++_from_the_Ground/Chapter_5(1).ipynb
+++ b/C++_from_the_Ground/Chapter_5(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 5"
+ "name": "",
+ "signature": "sha256:daa9c054e3b743c745cfe62599d80f03d625b2ef5131489390410210f502a5cb"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,40 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 5: Arrays ans Strings<h1>"
+ "source": [
+ "<h1>Chapter 5: Arrays ans Strings<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.1, Page Number: 82<h3>\n "
+ "source": [
+ "<h3>Example 5.1, Page Number: 82<h3>\n",
+ " "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Loads sample with the numbers 0 to 9'''\n\n#Variable declaration\nsample = range(10) #Declares an array [0,1,2,3,4,5,6,7,8,9]\n\n#Displays the array\nfor t in range(10):\n print sample[t],\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "sample = range(10) #Declares an array [0,1,2,3,4,5,6,7,8,9]\n",
+ "\n",
+ "#Displays the array\n",
+ "for t in range(10):\n",
+ " print sample[t],\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 2 3 4 5 6 7 8 9\n"
+ "text": [
+ "0 1 2 3 4 5 6 7 8 9\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +52,50 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.2, Page Number: 83<h3>"
+ "source": [
+ "<h3>Example 5.2, Page Number: 83<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Maximum and Minimum value from a list'''\n\nimport random\n\n#Variable declaration\nlist = [] #List of integers\n\nfor i in range(10):\n list.append(random.randint(0,1000)) #randomely assigning integers\n \n#Finding the minimum value\nmin_value = list[0]\n\nfor i in range(10):\n if min_value>list[i]:\n min_value=list[i]\nprint \"minimum value: \",min_value #Result:Minimum value\n\n#Finding maximum value\nmax_value = list[0]\n\nfor i in range(10):\n if max_value<list[i]:\n max_value=list[i]\nprint \"maximum value: \",max_value #Result:Maximum value\n",
+ "input": [
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "#Variable declaration\n",
+ "list = [] #List of integers\n",
+ "\n",
+ "for i in range(10):\n",
+ " list.append(random.randint(0,1000)) #randomely assigning integers\n",
+ " \n",
+ "#Finding the minimum value\n",
+ "min_value = list[0]\n",
+ "\n",
+ "for i in range(10):\n",
+ " if min_value>list[i]:\n",
+ " min_value=list[i]\n",
+ "print \"minimum value: \",min_value #Result:Minimum value\n",
+ "\n",
+ "#Finding maximum value\n",
+ "max_value = list[0]\n",
+ "\n",
+ "for i in range(10):\n",
+ " if max_value<list[i]:\n",
+ " max_value=list[i]\n",
+ "print \"maximum value: \",max_value #Result:Maximum value\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "minimum value: 192\nmaximum value: 684\n"
+ "text": [
+ "minimum value: 192\n",
+ "maximum value: 684\n"
+ ]
}
],
"prompt_number": 2
@@ -55,19 +103,57 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.3, Page Number: 85<h3>"
+ "source": [
+ "<h3>Example 5.3, Page Number: 85<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Bubble Sort'''\n\nimport random\n\n#Variable declaration\nnums = []\nsize = 10\n\n#Initializing list with random numbers\nfor t in range(size):\n nums.append(random.randint(0,1000))\n\n#Displays original array\nprint \"Original array is: \"\nprint nums\n\n#Bubble Sort\nfor a in range(size):\n for b in xrange(size-1,a,-1):\n if nums[b-1]>nums[b]:\n t=nums[b-1]\n nums[b-1]=nums[b]\n nums[b] = t\n\n#Display sorted array\nprint \"Sorted array is: \"\nprint nums\n\n \n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "#Variable declaration\n",
+ "nums = []\n",
+ "size = 10\n",
+ "\n",
+ "#Initializing list with random numbers\n",
+ "for t in range(size):\n",
+ " nums.append(random.randint(0,1000))\n",
+ "\n",
+ "#Displays original array\n",
+ "print \"Original array is: \"\n",
+ "print nums\n",
+ "\n",
+ "#Bubble Sort\n",
+ "for a in range(size):\n",
+ " for b in xrange(size-1,a,-1):\n",
+ " if nums[b-1]>nums[b]:\n",
+ " t=nums[b-1]\n",
+ " nums[b-1]=nums[b]\n",
+ " nums[b] = t\n",
+ "\n",
+ "#Display sorted array\n",
+ "print \"Sorted array is: \"\n",
+ "print nums\n",
+ "\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original array is: \n[388, 661, 218, 595, 167, 46, 704, 140, 559, 428]\nSorted array is: \n[46, 140, 167, 218, 388, 428, 559, 595, 661, 704]\n"
+ "text": [
+ "Original array is: \n",
+ "[388, 661, 218, 595, 167, 46, 704, 140, 559, 428]\n",
+ "Sorted array is: \n",
+ "[46, 140, 167, 218, 388, 428, 559, 595, 661, 704]\n"
+ ]
}
],
"prompt_number": 4
@@ -75,19 +161,31 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.4, Page Number: 87<h3>"
+ "source": [
+ "<h3>Example 5.4, Page Number: 87<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Example for a string; Implementing cin and cout'''\n\n#Variable decleration\nstr = \"Hello\"\n\n#Result\nprint \"Here is your string:\",\nprint str\n",
+ "input": [
+ "\n",
+ "#Variable decleration\n",
+ "str = \"Hello\"\n",
+ "\n",
+ "#Result\n",
+ "print \"Here is your string:\",\n",
+ "print str\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Here is your string: Hello\n"
+ "text": [
+ "Here is your string: Hello\n"
+ ]
}
],
"prompt_number": 2
@@ -95,19 +193,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.5, Page Number: 88<h3>"
+ "source": [
+ "<h3>Example 5.5, Page Number: 88<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Example for a string; Implementing gets for input'''\n\nprint \"Enter a string: \"\n\n#user input\nstr = \"Hello\"\n\n#Result\nprint \"Here is your string:\",\nprint str\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "print \"Enter a string: \"\n",
+ "\n",
+ "#user input\n",
+ "str = \"Hello\"\n",
+ "\n",
+ "#Result\n",
+ "print \"Here is your string:\",\n",
+ "print str\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a string: \nHere is your string: Hello\n"
+ "text": [
+ "Enter a string: \n",
+ "Here is your string: Hello\n"
+ ]
}
],
"prompt_number": 1
@@ -115,19 +230,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.6, Page Number: 89<h3>"
+ "source": [
+ "<h3>Example 5.6, Page Number: 89<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Implementing strcpy'''\n\n#Variable decleration\ns=str\nstr = s #copying s into str\n\n#Result\nprint str\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable decleration\n",
+ "s=str\n",
+ "str = s #copying s into str\n",
+ "\n",
+ "#Result\n",
+ "print str\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello\n"
+ "text": [
+ "Hello\n"
+ ]
}
],
"prompt_number": 5
@@ -135,19 +263,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.7, Page Number: 89<h3>"
+ "source": [
+ "<h3>Example 5.7, Page Number: 89<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Example for concatenation'''\n\n#Variable decleration\ns1 = \"Hello\"\ns2 = \" There\"\n\n#Concatenation\ns1+=s2\n\n#Result\nprint s1\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable decleration\n",
+ "s1 = \"Hello\"\n",
+ "s2 = \" There\"\n",
+ "\n",
+ "#Concatenation\n",
+ "s1+=s2\n",
+ "\n",
+ "#Result\n",
+ "print s1\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello There\n"
+ "text": [
+ "Hello There\n"
+ ]
}
],
"prompt_number": 2
@@ -155,19 +299,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.8, Page Number: 90<h3>"
+ "source": [
+ "<h3>Example 5.8, Page Number: 90<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n#Example for string compare: Password verification\n\n#Function for password verification\ndef password():\n print \"Enter password: \" #User input for password\n s= \"pass\"\n if s==\"password\":\n return True\n else:\n print \"Invalid password.\"\n return False\n\n#Result\nif password() :\n print \"Logged On.\"\nelse:\n print \"Access denied\"\n \n \n \n",
+ "input": [
+ "\n",
+ "def password():\n",
+ " print \"Enter password: \" #User input for password\n",
+ " s= \"pass\"\n",
+ " if s==\"password\":\n",
+ " return True\n",
+ " else:\n",
+ " print \"Invalid password.\"\n",
+ " return False\n",
+ "\n",
+ "#Result\n",
+ "if password() :\n",
+ " print \"Logged On.\"\n",
+ "else:\n",
+ " print \"Access denied\"\n",
+ " \n",
+ " \n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter password: \nInvalid password.\nAccess denied\n"
+ "text": [
+ "Enter password: \n",
+ "Invalid password.\n",
+ "Access denied\n"
+ ]
}
],
"prompt_number": 3
@@ -175,12 +344,25 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.9, Page Number: 91<h3>"
+ "source": [
+ "<h3>Example 5.9, Page Number: 91<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Takes user input till strings match'''\n\nwhile True:\n s=raw_input(\"Enter a string: \") #User input of string;\n if s==\"quit\": #Sting comparison\n break\n \n \n\n \n \n",
+ "input": [
+ "import string\n",
+ "\n",
+ " s=raw_input(\"Enter a string: \") #User input of string;\n",
+ " if s==\"quit\": #Sting comparison\n",
+ " break\n",
+ " \n",
+ " \n",
+ "\n",
+ " \n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -188,19 +370,25 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a string: ddc\n"
+ "text": [
+ "Enter a string: ddc\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a string: hello\n"
+ "text": [
+ "Enter a string: hello\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a string: quit\n"
+ "text": [
+ "Enter a string: quit\n"
+ ]
}
],
"prompt_number": 1
@@ -208,19 +396,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.10, Page Number: 91<h3>"
+ "source": [
+ "<h3>Example 5.10, Page Number: 91<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''String length; Implementing strlen'''\n\n#Variable declaration\nstr = \"Hello\"\n\n#Result\nprint \"Length is: \",len(str)\n \n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "str = \"Hello\"\n",
+ "\n",
+ "#Result\n",
+ "print \"Length is: \",len(str)\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Length is: 5\n"
+ "text": [
+ "Length is: 5\n"
+ ]
}
],
"prompt_number": 5
@@ -228,19 +429,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.11, Page Number: 92<h3>"
+ "source": [
+ "<h3>Example 5.11, Page Number: 92<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Print a string backwards.'''\n\n#Taking a user input string\nstr = \"Hello World\"\n\n#Reversing a String\nrev = str[::-1]\n\n#Result\nprint rev\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "str = \"Hello World\"\n",
+ "\n",
+ "#Reversing a String\n",
+ "rev = str[::-1]\n",
+ "\n",
+ "#Result\n",
+ "print rev\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "dlroW olleH\n"
+ "text": [
+ "dlroW olleH\n"
+ ]
}
],
"prompt_number": 6
@@ -248,19 +464,51 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.12, Page Number: 92<h3>"
+ "source": [
+ "<h3>Example 5.12, Page Number: 92<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "\n'''Illustrating string functions'''\n\n#Variable declaration\ns1 = \"Hello\"\ns2 = \"there\"\n\n#Printing lengths\nprint \"lengths: \",len(s1),' ',len(s2)\n\n#Comparing\nif(s1==s2):\n print \"The strings are equal\"\nelse:\n print \"not equal\"\n\n#Concatenation\ns1+=s2\nprint s1\n\n\n#Copying\ns1=s2\n\n#Result\nprint s1,\"and\",s2,\" are now the same\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "s1 = \"Hello\"\n",
+ "s2 = \"there\"\n",
+ "\n",
+ "#Printing lengths\n",
+ "print \"lengths: \",len(s1),' ',len(s2)\n",
+ "\n",
+ "#Comparing\n",
+ "if(s1==s2):\n",
+ " print \"The strings are equal\"\n",
+ "else:\n",
+ " print \"not equal\"\n",
+ "\n",
+ "#Concatenation\n",
+ "s1+=s2\n",
+ "print s1\n",
+ "\n",
+ "\n",
+ "#Copying\n",
+ "s1=s2\n",
+ "\n",
+ "#Result\n",
+ "print s1,\"and\",s2,\" are now the same\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "lengths: 5 5\nnot equal\nHellothere\nthere and there are now the same\n"
+ "text": [
+ "lengths: 5 5\n",
+ "not equal\n",
+ "Hellothere\n",
+ "there and there are now the same\n"
+ ]
}
],
"prompt_number": 9
@@ -268,19 +516,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.13, Page Number: 93<h3>"
+ "source": [
+ "<h3>Example 5.13, Page Number: 93<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Convert a string to upper case'''\n\nimport string\n\n#Variable Initialization\nstr= \"this is a test\"\n\nstr=string.upper(str)\n\n#Result\nprint str\n ",
+ "input": [
+ "\n",
+ "import string\n",
+ "\n",
+ "#Variable Initialization\n",
+ "str= \"this is a test\"\n",
+ "\n",
+ "str=string.upper(str)\n",
+ "\n",
+ "#Result\n",
+ "print str\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "THIS IS A TEST\n"
+ "text": [
+ "THIS IS A TEST\n"
+ ]
}
],
"prompt_number": 12
@@ -288,19 +552,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.14, Page Number: 94<h3>"
+ "source": [
+ "<h3>Example 5.14, Page Number: 94<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Load a two-dimensional array with values 1-12'''\n\n#Variable Initialization\narr=[] #The 2-D list\nnew=[] #The nested list\n\n#Initializing the 2-D array\nfor i in range(3):\n new=[]\n for j in range(4):\n new.append(i*4+j+1)\n arr.append(new)\n\n#Result\nfor i in range(3):\n for j in range(4):\n print arr[i][j],\n print",
+ "input": [
+ "\n",
+ "arr=[] #The 2-D list\n",
+ "new=[] #The nested list\n",
+ "\n",
+ "#Initializing the 2-D array\n",
+ "for i in range(3):\n",
+ " new=[]\n",
+ " for j in range(4):\n",
+ " new.append(i*4+j+1)\n",
+ " arr.append(new)\n",
+ "\n",
+ "#Result\n",
+ "for i in range(3):\n",
+ " for j in range(4):\n",
+ " print arr[i][j],\n",
+ " print"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 2 3 4\n5 6 7 8\n9 10 11 12\n"
+ "text": [
+ "1 2 3 4\n",
+ "5 6 7 8\n",
+ "9 10 11 12\n"
+ ]
}
],
"prompt_number": 6
@@ -308,19 +595,38 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.15, Page Number: 98<h3>"
+ "source": [
+ "<h3>Example 5.15, Page Number: 98<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Looks up a no. in an array n prints the corresponding square'''\n\n#Variabe Initialzation\nsqrs= [[1,1],[2,4],[3,9],[4,16],[5,25],\n [6,36],[7,49],[8,64],[9,81],[10,100]] #Array storing the squares\ni=6 #User input of number whose square is to be looked up\n\n#Search for the number\nfor j in range(10):\n if sqrs[j][0]==i:\n break\n \n#Result\nprint \"The square of \",i,\" is \", sqrs[j][1]",
+ "input": [
+ "\n",
+ "\n",
+ "#Variabe Initialzation\n",
+ "sqrs= [[1,1],[2,4],[3,9],[4,16],[5,25],\n",
+ " [6,36],[7,49],[8,64],[9,81],[10,100]] #Array storing the squares\n",
+ "i=6 #User input of number whose square is to be looked up\n",
+ "\n",
+ "#Search for the number\n",
+ "for j in range(10):\n",
+ " if sqrs[j][0]==i:\n",
+ " break\n",
+ " \n",
+ "#Result\n",
+ "print \"The square of \",i,\" is \", sqrs[j][1]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The square of 6 is 36\n"
+ "text": [
+ "The square of 6 is 36\n"
+ ]
}
],
"prompt_number": 15
@@ -328,19 +634,38 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.16, Page Number: 99<h3>"
+ "source": [
+ "<h3>Example 5.16, Page Number: 99<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstating how local strings are initialized each time they are called'''\n\ndef f1():\n s=\"this is a test\" #initial s\n print s\n s=\"CHANGED\" #s is now changed \n print s\n\n#Calling the function twice\nf1()\nf1()",
+ "input": [
+ "\n",
+ "\n",
+ "def f1():\n",
+ " s=\"this is a test\" #initial s\n",
+ " print s\n",
+ " s=\"CHANGED\" #s is now changed \n",
+ " print s\n",
+ "\n",
+ "#Calling the function twice\n",
+ "f1()\n",
+ "f1()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "this is a test\nCHANGED\nthis is a test\nCHANGED\n"
+ "text": [
+ "this is a test\n",
+ "CHANGED\n",
+ "this is a test\n",
+ "CHANGED\n"
+ ]
}
],
"prompt_number": 17
@@ -348,19 +673,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.17, Page Number: 101<h3>"
+ "source": [
+ "<h3>Example 5.17, Page Number: 101<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Enter and display strings'''\n\n#Variable decleration\ntext=[]\nstr=['eat','play','work'] #user input of strings\np=len(str)\n\nfor t in range(p):\n print t,\":\"\n text.append(str[t]) #Here, user input taken from the list\n \n#Result; redisplay the strings\nfor i in range(p):\n print text[i]\n ",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable decleration\n",
+ "text=[]\n",
+ "str=['eat','play','work'] #user input of strings\n",
+ "p=len(str)\n",
+ "\n",
+ "for t in range(p):\n",
+ " print t,\":\"\n",
+ " text.append(str[t]) #Here, user input taken from the list\n",
+ " \n",
+ "#Result; redisplay the strings\n",
+ "for i in range(p):\n",
+ " print text[i]\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 :\n1 :\n2 :\neat\nplay\nwork\n"
+ "text": [
+ "0 :\n",
+ "1 :\n",
+ "2 :\n",
+ "eat\n",
+ "play\n",
+ "work\n"
+ ]
}
],
"prompt_number": 18
@@ -368,287 +718,460 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 5.18, Page Number: 103<h3>"
+ "source": [
+ "<h3>Example 5.18, Page Number: 103<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple employee database program'''\nimport random \n\n#Variable decleration\nname=[] #this list holds employee names\nwage=[] #their phone numbers\nphone=[] #hours worked per week\nhours=[] #wage\nnum=0 #User choice\n\n#Menu \ndef menu():\n global num #All options are chosen one by one\n print \"0.Quit.\"\n print \"1.Enter information\"\n print \"2.Report information\"\n print \"Choose one: \"\n num=int(input())\n return num #Return users selction\n\n#Enter information\ndef enter():\n for i in range(10):\n n=raw_input(\"Enter your name: \")\n name.append(n)\n phone.append(int(input(\"Enter your phone number\")))\n hours.append(int(input(\"Enter number of hours worked: \")))\n wage.append(int(input(\"Enter wage: \")))\n\n#Display report\ndef report():\n p=len(name)\n for i in range(p):\n print name[i],' ',phone[i]\n print \"Pay for the week: \",wage[i]*hours[i]\n\n\nwhile True:\n ch=menu() #get selection\n if ch==0:\n break\n elif ch==1:\n enter()\n elif ch==2:\n report()\n else:\n print \"Try again.\"\n if ch==0:\n break\n",
+ "input": [
+ "\n",
+ "import random \n",
+ "\n",
+ "#Variable decleration\n",
+ "name=[] #this list holds employee names\n",
+ "wage=[] #their phone numbers\n",
+ "phone=[] #hours worked per week\n",
+ "hours=[] #wage\n",
+ "num=0 #User choice\n",
+ "\n",
+ "#Menu \n",
+ "def menu():\n",
+ " global num #All options are chosen one by one\n",
+ " print \"0.Quit.\"\n",
+ " print \"1.Enter information\"\n",
+ " print \"2.Report information\"\n",
+ " print \"Choose one: \"\n",
+ " num=int(input())\n",
+ " return num #Return users selction\n",
+ "\n",
+ "#Enter information\n",
+ "def enter():\n",
+ " for i in range(10):\n",
+ " n=raw_input(\"Enter your name: \")\n",
+ " name.append(n)\n",
+ " phone.append(int(input(\"Enter your phone number\")))\n",
+ " hours.append(int(input(\"Enter number of hours worked: \")))\n",
+ " wage.append(int(input(\"Enter wage: \")))\n",
+ "\n",
+ "#Display report\n",
+ "def report():\n",
+ " p=len(name)\n",
+ " for i in range(p):\n",
+ " print name[i],' ',phone[i]\n",
+ " print \"Pay for the week: \",wage[i]*hours[i]\n",
+ "\n",
+ "\n",
+ "while True:\n",
+ " ch=menu() #get selection\n",
+ " if ch==0:\n",
+ " break\n",
+ " elif ch==1:\n",
+ " enter()\n",
+ " elif ch==2:\n",
+ " report()\n",
+ " else:\n",
+ " print \"Try again.\"\n",
+ " if ch==0:\n",
+ " break\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.Quit.\n1.Enter information\n2.Report information\nChoose one: \n"
+ "text": [
+ "0.Quit.\n",
+ "1.Enter information\n",
+ "2.Report information\n",
+ "Choose one: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Anny\n"
+ "text": [
+ "Enter your name: Anny\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number987654321\n"
+ "text": [
+ "Enter your phone number987654321\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 10\n"
+ "text": [
+ "Enter number of hours worked: 10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 50\n"
+ "text": [
+ "Enter wage: 50\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Billy\n"
+ "text": [
+ "Enter your name: Billy\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number9456783652\n"
+ "text": [
+ "Enter your phone number9456783652\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 10\n"
+ "text": [
+ "Enter number of hours worked: 10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 50\n"
+ "text": [
+ "Enter wage: 50\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Catherene\n"
+ "text": [
+ "Enter your name: Catherene\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number9476836578\n"
+ "text": [
+ "Enter your phone number9476836578\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 10\n"
+ "text": [
+ "Enter number of hours worked: 10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 50\n"
+ "text": [
+ "Enter wage: 50\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Dolly\n"
+ "text": [
+ "Enter your name: Dolly\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number9831356748\n"
+ "text": [
+ "Enter your phone number9831356748\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 15\n"
+ "text": [
+ "Enter number of hours worked: 15\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 50\n"
+ "text": [
+ "Enter wage: 50\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Emily\n"
+ "text": [
+ "Enter your name: Emily\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number9576843721\n"
+ "text": [
+ "Enter your phone number9576843721\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 15\n"
+ "text": [
+ "Enter number of hours worked: 15\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 40\n"
+ "text": [
+ "Enter wage: 40\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Jack\n"
+ "text": [
+ "Enter your name: Jack\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number9485738567\n"
+ "text": [
+ "Enter your phone number9485738567\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 10\n"
+ "text": [
+ "Enter number of hours worked: 10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 45\n"
+ "text": [
+ "Enter wage: 45\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Kevin\n"
+ "text": [
+ "Enter your name: Kevin\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number9345678923\n"
+ "text": [
+ "Enter your phone number9345678923\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 10\n"
+ "text": [
+ "Enter number of hours worked: 10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 45\n"
+ "text": [
+ "Enter wage: 45\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Lily\n"
+ "text": [
+ "Enter your name: Lily\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number9345672831\n"
+ "text": [
+ "Enter your phone number9345672831\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 10\n"
+ "text": [
+ "Enter number of hours worked: 10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 45\n"
+ "text": [
+ "Enter wage: 45\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Monica\n"
+ "text": [
+ "Enter your name: Monica\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number9475867483\n"
+ "text": [
+ "Enter your phone number9475867483\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 10\n"
+ "text": [
+ "Enter number of hours worked: 10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 50\n"
+ "text": [
+ "Enter wage: 50\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your name: Irene\n"
+ "text": [
+ "Enter your name: Irene\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your phone number5674356776\n"
+ "text": [
+ "Enter your phone number5674356776\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of hours worked: 10\n"
+ "text": [
+ "Enter number of hours worked: 10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter wage: 20\n"
+ "text": [
+ "Enter wage: 20\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.Quit.\n1.Enter information\n2.Report information\nChoose one: \n"
+ "text": [
+ "0.Quit.\n",
+ "1.Enter information\n",
+ "2.Report information\n",
+ "Choose one: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Anny 987654321\nPay for the week: 500\nBilly 9456783652\nPay for the week: 500\nCatherene 9476836578\nPay for the week: 500\nDolly 9831356748\nPay for the week: 750\nEmily 9576843721\nPay for the week: 600\nJack 9485738567\nPay for the week: 450\nKevin 9345678923\nPay for the week: 450\nLily 9345672831\nPay for the week: 450\nMonica 9475867483\nPay for the week: 500\nIrene 5674356776\nPay for the week: 200\n0.Quit.\n1.Enter information\n2.Report information\nChoose one: \n"
+ "text": [
+ "Anny 987654321\n",
+ "Pay for the week: 500\n",
+ "Billy 9456783652\n",
+ "Pay for the week: 500\n",
+ "Catherene 9476836578\n",
+ "Pay for the week: 500\n",
+ "Dolly 9831356748\n",
+ "Pay for the week: 750\n",
+ "Emily 9576843721\n",
+ "Pay for the week: 600\n",
+ "Jack 9485738567\n",
+ "Pay for the week: 450\n",
+ "Kevin 9345678923\n",
+ "Pay for the week: 450\n",
+ "Lily 9345672831\n",
+ "Pay for the week: 450\n",
+ "Monica 9475867483\n",
+ "Pay for the week: 500\n",
+ "Irene 5674356776\n",
+ "Pay for the week: 200\n",
+ "0.Quit.\n",
+ "1.Enter information\n",
+ "2.Report information\n",
+ "Choose one: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
}
],
"prompt_number": 2
@@ -656,7 +1179,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_6(1).ipynb b/C++_from_the_Ground/Chapter_6(1).ipynb
index 052075ed..5010922a 100644
--- a/C++_from_the_Ground/Chapter_6(1).ipynb
+++ b/C++_from_the_Ground/Chapter_6(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 6"
+ "name": "",
+ "signature": "sha256:b382733cd221154cfe7c9ffe63477448084168d501d248c2b1d0c253ed011821"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,41 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 6: Pointers<h1>"
+ "source": [
+ "<h1>Chapter 6: Pointers<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.1, Page Number: 107<h3>"
+ "source": [
+ "<h3>Example 6.1, Page Number: 107<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing pointers in python'''\n\nfrom ctypes import *\n\nbalance =c_int(3200) #int variable\nbalptr=pointer(balance) #pointer to int\nvalue=balptr[0] #accessing the value using the pointer\n\n#Result\nprint \"balance: \",value \n\n",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "balance =c_int(3200) #int variable\n",
+ "balptr=pointer(balance) #pointer to int\n",
+ "value=balptr[0] #accessing the value using the pointer\n",
+ "\n",
+ "#Result\n",
+ "print \"balance: \",value \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "balance: 3200\n"
+ "text": [
+ "balance: 3200\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +53,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.2, Page Number: 109<h3>"
+ "source": [
+ "<h3>Example 6.2, Page Number: 109<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program will not create the problem as in C++ since \n python does'nt have specific data types'''\n\n#Variable declaration\nx=123.23\ny=c_double()\np=POINTER(c_int)\n\np=pointer(c_int(int(x))) #type case double to int\ny=p[0]\n\n#Result\nprint y",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "x=123.23\n",
+ "y=c_double()\n",
+ "p=POINTER(c_int)\n",
+ "\n",
+ "p=pointer(c_int(int(x))) #type case double to int\n",
+ "y=p[0]\n",
+ "\n",
+ "#Result\n",
+ "print y"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "123\n"
+ "text": [
+ "123\n"
+ ]
}
],
"prompt_number": 2
@@ -55,19 +90,37 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.3, Page Number: 110<h3>"
+ "source": [
+ "<h3>Example 6.3, Page Number: 110<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate usage of pointers'''\n\nfrom ctypes import *\n\n#Variable declaration\nnum=c_int() #declaring int\np=pointer(num) #pointer to int\n\np[0]=100\nprint num.value,\np[0]+=1\nprint num.value,\np[0]-=1\nprint num.value",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "num=c_int() #declaring int\n",
+ "p=pointer(num) #pointer to int\n",
+ "\n",
+ "p[0]=100\n",
+ "print num.value,\n",
+ "p[0]+=1\n",
+ "print num.value,\n",
+ "p[0]-=1\n",
+ "print num.value"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "100 101 100\n"
+ "text": [
+ "100 101 100\n"
+ ]
}
],
"prompt_number": 2
@@ -75,19 +128,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.4, Page Number: 111<h3>"
+ "source": [
+ "<h3>Example 6.4, Page Number: 111<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate pointer arithmetic'''\n\nfrom ctypes import *\n\n#Variable declaration\nj=c_int()\ng=c_double()\ni=pointer(j)\nf=pointer(g)\n\n\nfor x in range(10):\n print addressof(i.contents)+x,addressof(f.contents)+x\n \n ",
+ "input": [
+ "\n",
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "j=c_int()\n",
+ "g=c_double()\n",
+ "i=pointer(j)\n",
+ "f=pointer(g)\n",
+ "\n",
+ "\n",
+ "for x in range(10):\n",
+ " print addressof(i.contents)+x,addressof(f.contents)+x\n",
+ " \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "84638480 84639248\n84638481 84639249\n84638482 84639250\n84638483 84639251\n84638484 84639252\n84638485 84639253\n84638486 84639254\n84638487 84639255\n84638488 84639256\n84638489 84639257\n"
+ "text": [
+ "84638480 84639248\n",
+ "84638481 84639249\n",
+ "84638482 84639250\n",
+ "84638483 84639251\n",
+ "84638484 84639252\n",
+ "84638485 84639253\n",
+ "84638486 84639254\n",
+ "84638487 84639255\n",
+ "84638488 84639256\n",
+ "84638489 84639257\n"
+ ]
}
],
"prompt_number": 10
@@ -95,19 +177,45 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.5, Page Number: 114<h3>"
+ "source": [
+ "<h3>Example 6.5, Page Number: 114<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Tokenizing program: pointer verion'''\n\nfrom ctypes import *\n\n#Variable declaration\nstr=\"This is a test\"\ntoken =\"\"\ni=0\n\n#Read a token at a time from the string\nwhile i<len(str):\n token=c_char_p(\"\") #set token to null string\n q=pointer(token) \n #Read characters until either a space or the null terminator is encountered'''\n while i<len(str) and not(str[i]==\" \"):\n q[0]+=str[i]\n i+=1\n i+=1 #advance past the space\n print q[0]",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "str=\"This is a test\"\n",
+ "token =\"\"\n",
+ "i=0\n",
+ "\n",
+ "#Read a token at a time from the string\n",
+ "while i<len(str):\n",
+ " token=c_char_p(\"\") #set token to null string\n",
+ " q=pointer(token) \n",
+ " #Read characters until either a space or the null terminator is encountered'''\n",
+ " while i<len(str) and not(str[i]==\" \"):\n",
+ " q[0]+=str[i]\n",
+ " i+=1\n",
+ " i+=1 #advance past the space\n",
+ " print q[0]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This\nis\na\ntest\n"
+ "text": [
+ "This\n",
+ "is\n",
+ "a\n",
+ "test\n"
+ ]
}
],
"prompt_number": 12
@@ -115,19 +223,41 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.6, Page Number: 115<h3>"
+ "source": [
+ "<h3>Example 6.6, Page Number: 115<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Tokenizing program: array-indexing verion'''\n\n#Variable declaration\nstr=\"This is a test\"\ni=0\n\n#Read a token at a time from the string\nwhile i<len(str):\n token=\"\" #set q to null string\n #Read characters until either a space or the null terminator is encountered'''\n while i<len(str) and not(str[i]==\" \"):\n token+=str[i]\n i+=1\n i+=1 #advance past the space\n print token",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "str=\"This is a test\"\n",
+ "i=0\n",
+ "\n",
+ "#Read a token at a time from the string\n",
+ "while i<len(str):\n",
+ " token=\"\" #set q to null string\n",
+ " #Read characters until either a space or the null terminator is encountered'''\n",
+ " while i<len(str) and not(str[i]==\" \"):\n",
+ " token+=str[i]\n",
+ " i+=1\n",
+ " i+=1 #advance past the space\n",
+ " print token"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This\nis\na\ntest\n"
+ "text": [
+ "This\n",
+ "is\n",
+ "a\n",
+ "test\n"
+ ]
}
],
"prompt_number": 14
@@ -135,19 +265,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.7, Page Number: 115<h3>"
+ "source": [
+ "<h3>Example 6.7, Page Number: 115<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Converting to uppercase using pointer indexing'''\n\nimport string\n\nstr=c_char_p(\"hello tom\")\nq=\"\"\np=pointer(str) #put address of str into p\n \np[0]=string.upper(p[0])\n\n#Result\nprint p[0]",
+ "input": [
+ "\n",
+ "\n",
+ "import string\n",
+ "\n",
+ "str=c_char_p(\"hello tom\")\n",
+ "q=\"\"\n",
+ "p=pointer(str) #put address of str into p\n",
+ " \n",
+ "p[0]=string.upper(p[0])\n",
+ "\n",
+ "#Result\n",
+ "print p[0]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "HELLO TOM\n"
+ "text": [
+ "HELLO TOM\n"
+ ]
}
],
"prompt_number": 15
@@ -155,19 +302,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.8, Page Number: 117<h3>"
+ "source": [
+ "<h3>Example 6.8, Page Number: 117<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Pointers and string literals'''\n\n#Varible declaration\ns=\"Pointers are fun to use\"\n\n#Result\nprint s\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Varible declaration\n",
+ "s=\"Pointers are fun to use\"\n",
+ "\n",
+ "#Result\n",
+ "print s\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Pointers are fun to use\n"
+ "text": [
+ "Pointers are fun to use\n"
+ ]
}
],
"prompt_number": 4
@@ -175,19 +335,38 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.9, Page Number: 118<h3>"
+ "source": [
+ "<h3>Example 6.9, Page Number: 118<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example of pointers and arrays'''\n\nfrom ctypes import *\n\n#Variable declaration\nnum=[]\n\n#User input\nfor i in range(10):\n num.append(i)\n \nstart=num #set start to the starting pointer \nfor i in range(10):\n print start[i],\n \n",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "num=[]\n",
+ "\n",
+ "#User input\n",
+ "for i in range(10):\n",
+ " num.append(i)\n",
+ " \n",
+ "start=num #set start to the starting pointer \n",
+ "for i in range(10):\n",
+ " print start[i],\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 2 3 4 5 6 7 8 9\n"
+ "text": [
+ "0 1 2 3 4 5 6 7 8 9\n"
+ ]
}
],
"prompt_number": 5
@@ -195,19 +374,43 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.10, Page Number: 119<h3>"
+ "source": [
+ "<h3>Example 6.10, Page Number: 119<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A fortune cookie program'''\n\nimport random\n\nfortunes=[\"Soon, you will come into some money.\",\n \"A new love will enter your lifr. \",\n \"You will live long and prosper.\",\n \"Now is a good time to invest for the future.\",\n \"A close friend will ask for a favour.\"]\n\nprint \"To see your fortune, press a key: \"\n\n#Randomize the random number generator\nchance=random.randint(0,100)\nchance=chance%5\n\n#Result\nprint fortunes[chance]",
+ "input": [
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "fortunes=[\"Soon, you will come into some money.\",\n",
+ " \"A new love will enter your lifr. \",\n",
+ " \"You will live long and prosper.\",\n",
+ " \"Now is a good time to invest for the future.\",\n",
+ " \"A close friend will ask for a favour.\"]\n",
+ "\n",
+ "print \"To see your fortune, press a key: \"\n",
+ "\n",
+ "#Randomize the random number generator\n",
+ "chance=random.randint(0,100)\n",
+ "chance=chance%5\n",
+ "\n",
+ "#Result\n",
+ "print fortunes[chance]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "To see your fortune, press a key: \nA close friend will ask for a favour.\n"
+ "text": [
+ "To see your fortune, press a key: \n",
+ "A close friend will ask for a favour.\n"
+ ]
}
],
"prompt_number": 6
@@ -215,19 +418,41 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.11, Page Number: 120<h3>"
+ "source": [
+ "<h3>Example 6.11, Page Number: 120<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple C++ keyword synopsis program'''\n\nkeyword=[[\"for\",\"for(initialization; condition; increment\"],\n [\"if\",\"if(condition) ... else ...\"],\n [\"switch\",\"switch(value) { case-list }\"],\n [\"while\",\"while(condition) ...\"],\n [\"\",\"\"]] #Terminates the list with nulls\n \n#User input \nprint \"Enter keyword: \"\nstr=\"for\" \n\nfor i in range(4):\n if str==keyword[i][0]:\n print keyword[i][1]\n \n",
+ "input": [
+ "\n",
+ "\n",
+ "keyword=[[\"for\",\"for(initialization; condition; increment\"],\n",
+ " [\"if\",\"if(condition) ... else ...\"],\n",
+ " [\"switch\",\"switch(value) { case-list }\"],\n",
+ " [\"while\",\"while(condition) ...\"],\n",
+ " [\"\",\"\"]] #Terminates the list with nulls\n",
+ " \n",
+ "#User input \n",
+ "print \"Enter keyword: \"\n",
+ "str=\"for\" \n",
+ "\n",
+ "for i in range(4):\n",
+ " if str==keyword[i][0]:\n",
+ " print keyword[i][1]\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter keyword: \nfor(initialization; condition; increment\n"
+ "text": [
+ "Enter keyword: \n",
+ "for(initialization; condition; increment\n"
+ ]
}
],
"prompt_number": 7
@@ -235,19 +460,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.12, Page Number: 123<h3>"
+ "source": [
+ "<h3>Example 6.12, Page Number: 123<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate multiple indirection'''\n\nfrom ctypes import *\n\n#Variable declaration\nx=c_int(10) #int variable\np=pointer(x) #pointer to int\nq=pointer(p) #pointer to a pointer\n\n#Result\nprint q[0][0] #accessing the value using a pointer to a pointer\n",
+ "input": [
+ "\n",
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "x=c_int(10) #int variable\n",
+ "p=pointer(x) #pointer to int\n",
+ "q=pointer(p) #pointer to a pointer\n",
+ "\n",
+ "#Result\n",
+ "print q[0][0] #accessing the value using a pointer to a pointer\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
}
],
"prompt_number": 3
@@ -255,19 +496,49 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 6.13, Page Number: 126<h3>"
+ "source": [
+ "<h3>Example 6.13, Page Number: 126<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Print ASCII value of each character of string using pointer'''\n\nfrom ctypes import *\n\n#Variable declaration\ns=c_char_p()\np1=pointer(s)\nx=0\n\nwhile True:\n print \"\\nEnter a string: \",\n if x==2:\n p1[0]=c_char_p(\"done\")\n else:\n p1[0]=c_char_p(\"Hello\")\n #print the ASCII values of each characcter\n for i in range(0,len(p1[0])):\n print ord(p1[0][i]),\n x+=1\n if p1[0]==\"done\":\n break\n \n\n",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "s=c_char_p()\n",
+ "p1=pointer(s)\n",
+ "x=0\n",
+ "\n",
+ "while True:\n",
+ " print \"\\nEnter a string: \",\n",
+ " if x==2:\n",
+ " p1[0]=c_char_p(\"done\")\n",
+ " else:\n",
+ " p1[0]=c_char_p(\"Hello\")\n",
+ " #print the ASCII values of each characcter\n",
+ " for i in range(0,len(p1[0])):\n",
+ " print ord(p1[0][i]),\n",
+ " x+=1\n",
+ " if p1[0]==\"done\":\n",
+ " break\n",
+ " \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\nEnter a string: 72 101 108 108 111 \nEnter a string: 72 101 108 108 111 \nEnter a string: 100 111 110 101\n"
+ "text": [
+ "\n",
+ "Enter a string: 72 101 108 108 111 \n",
+ "Enter a string: 72 101 108 108 111 \n",
+ "Enter a string: 100 111 110 101\n"
+ ]
}
],
"prompt_number": 9
@@ -275,7 +546,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_7(1).ipynb b/C++_from_the_Ground/Chapter_7(1).ipynb
index 4e347f41..28829c6d 100644
--- a/C++_from_the_Ground/Chapter_7(1).ipynb
+++ b/C++_from_the_Ground/Chapter_7(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 7"
+ "name": "",
+ "signature": "sha256:9a6978851f88c0c91bde88465299d72777f3dae7854964b1cadad7b80092df72"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 7: Functions,Part One: The Fundamentals<h1>"
+ "source": [
+ "<h1>Chapter 7: Functions,Part One: The Fundamentals<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.1, Page Number: 129<h3>"
+ "source": [
+ "<h3>Example 7.1, Page Number: 129<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example of a function'''\n\ndef f1():\n print \"Enter something: \"\n str= \"Hello\" #User-input\n print str\n \n#Variable decleration\nstr=\"This is str in main\"\n\nprint str\nf1() #function call\nprint str",
+ "input": [
+ "\n",
+ "def f1():\n",
+ " print \"Enter something: \"\n",
+ " str= \"Hello\" #User-input\n",
+ " print str\n",
+ " \n",
+ "#Variable decleration\n",
+ "str=\"This is str in main\"\n",
+ "\n",
+ "print str\n",
+ "f1() #function call\n",
+ "print str"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This is str in main\nEnter something: \nHello\nThis is str in main\n"
+ "text": [
+ "This is str in main\n",
+ "Enter something: \n",
+ "Hello\n",
+ "This is str in main\n"
+ ]
}
],
"prompt_number": 1
@@ -35,19 +58,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.2, Page Number: 130<h3>"
+ "source": [
+ "<h3>Example 7.2, Page Number: 130<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program illustrates how variables can be local to a block'''\n\n#Variable decleration\nchoice=0\n\nprint \"(1) add numbers or (2) concatenate strings?: \"\nchoice=2 #User Input taken as 2\n\nif choice==1:\n print \"Enter two numbers: \"\n a=5 #Variable decleration; User Input\n b=7\n print a+b #Result\nelse :\n print \"Enter two strings: \"\n s1=\"Hello\" #Variable decleration; User Input\n s2=\"World\"\n s1+=s2 #Concatenation\n print s1 #Result",
+ "input": [
+ "\n",
+ "#Variable decleration\n",
+ "choice=0\n",
+ "\n",
+ "print \"(1) add numbers or (2) concatenate strings?: \"\n",
+ "choice=2 #User Input taken as 2\n",
+ "\n",
+ "if choice==1:\n",
+ " print \"Enter two numbers: \"\n",
+ " a=5 #Variable decleration; User Input\n",
+ " b=7\n",
+ " print a+b #Result\n",
+ "else :\n",
+ " print \"Enter two strings: \"\n",
+ " s1=\"Hello\" #Variable decleration; User Input\n",
+ " s2=\"World\"\n",
+ " s1+=s2 #Concatenation\n",
+ " print s1 #Result"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "(1) add numbers or (2) concatenate strings?: \nEnter two strings: \nHelloWorld\n"
+ "text": [
+ "(1) add numbers or (2) concatenate strings?: \n",
+ "Enter two strings: \n",
+ "HelloWorld\n"
+ ]
}
],
"prompt_number": 1
@@ -55,19 +103,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.3, Page Number: 131<h3>"
+ "source": [
+ "<h3>Example 7.3, Page Number: 131<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program illustrates the scope of variables'''\n\n'''This program will give same output for inner and outer i's\n because pyhton doesnt consider the if statment block as a scope'''\n#Variable decleration\ni=10\nj=100\n\nif j>0:\n i=None \n i= j/2\n print \"inner i: \",i #Result\n\nprint \"outer i: \",i #Result",
+ "input": [
+ "\n",
+ "#Variable decleration\n",
+ "i=10\n",
+ "j=100\n",
+ "\n",
+ "if j>0:\n",
+ " i=None \n",
+ " i= j/2\n",
+ " print \"inner i: \",i #Result\n",
+ "\n",
+ "print \"outer i: \",i #Result"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "inner i: 50\nouter i: 50\n"
+ "text": [
+ "inner i: 50\n",
+ "outer i: 50\n"
+ ]
}
],
"prompt_number": 2
@@ -75,19 +140,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.4, Page Number: 132<h3>"
+ "source": [
+ "<h3>Example 7.4, Page Number: 132<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example for declaring variables anywhere in the program'''\n\na=5 #Variable decleration; user input\n\nb=10 #declaration of another variable; user input\n\n#Result\nprint \"Product: \",a*b",
+ "input": [
+ "\n",
+ "\n",
+ "a=5 #Variable decleration; user input\n",
+ "\n",
+ "b=10 #declaration of another variable; user input\n",
+ "\n",
+ "#Result\n",
+ "print \"Product: \",a*b"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Product: 50\n"
+ "text": [
+ "Product: 50\n"
+ ]
}
],
"prompt_number": 4
@@ -95,19 +173,70 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.5, Page Number: 134<h3>"
+ "source": [
+ "<h3>Example 7.5, Page Number: 134<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A simple addition drill program.'''\n\nimport random\n\n#Variable decleration\ncount=None\nnum_right=0\n\n#Function for the drill\ndef drill():\n #Generate two numbers between 0 and 99.\n a=random.randint(0,99)\n b=random.randint(0,99)\n #The user gets three tries to get it right.\n for count in range(3):\n print \"What is \",a,\" + \",b,\"? \"\n ans = random.randint(0,200) #user input\n if ans==a+b:\n print \"Right\"\n num_right+=1\n print \"You've used up all your tries.\"\n print \"The answer is \",a+b\n \n#Main function \nprint \"How many practice problems: \"\ncount=2 #User input taken as 2\nnum_right=0\nwhile True:\n drill()\n count-=1\n if(count==0):\n break\n \n#Result\nprint \"You got \",num_right,\" right. \" \n",
+ "input": [
+ "\n",
+ "\n",
+ "import random\n",
+ "\n",
+ "#Variable decleration\n",
+ "count=None\n",
+ "num_right=0\n",
+ "\n",
+ "#Function for the drill\n",
+ "def drill():\n",
+ " #Generate two numbers between 0 and 99.\n",
+ " a=random.randint(0,99)\n",
+ " b=random.randint(0,99)\n",
+ " #The user gets three tries to get it right.\n",
+ " for count in range(3):\n",
+ " print \"What is \",a,\" + \",b,\"? \"\n",
+ " ans = random.randint(0,200) #user input\n",
+ " if ans==a+b:\n",
+ " print \"Right\"\n",
+ " num_right+=1\n",
+ " print \"You've used up all your tries.\"\n",
+ " print \"The answer is \",a+b\n",
+ " \n",
+ "#Main function \n",
+ "print \"How many practice problems: \"\n",
+ "count=2 #User input taken as 2\n",
+ "num_right=0\n",
+ "while True:\n",
+ " drill()\n",
+ " count-=1\n",
+ " if(count==0):\n",
+ " break\n",
+ " \n",
+ "#Result\n",
+ "print \"You got \",num_right,\" right. \" \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "How many practice problems: \nWhat is 9 + 89 ? \nWhat is 9 + 89 ? \nWhat is 9 + 89 ? \nYou've used up all your tries.\nThe answer is 98\nWhat is 85 + 98 ? \nWhat is 85 + 98 ? \nWhat is 85 + 98 ? \nYou've used up all your tries.\nThe answer is 183\nYou got 0 right. \n"
+ "text": [
+ "How many practice problems: \n",
+ "What is 9 + 89 ? \n",
+ "What is 9 + 89 ? \n",
+ "What is 9 + 89 ? \n",
+ "You've used up all your tries.\n",
+ "The answer is 98\n",
+ "What is 85 + 98 ? \n",
+ "What is 85 + 98 ? \n",
+ "What is 85 + 98 ? \n",
+ "You've used up all your tries.\n",
+ "The answer is 183\n",
+ "You got 0 right. \n"
+ ]
}
],
"prompt_number": 5
@@ -115,19 +244,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.6, Page Number: 136<h3>"
+ "source": [
+ "<h3>Example 7.6, Page Number: 136<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Pass by reference(pointer) to a function'''\n\nfrom ctypes import *\n\n#Function to change the reference value\ndef f(j):\n j[0]=100 #j is assigned 100\n\n#Variable decleration\ni=c_int(1)\np=pointer(i)\n\n#Calling the function\nf(p) \n\nprint i",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Function to change the reference value\n",
+ "def f(j):\n",
+ " j[0]=100 #j is assigned 100\n",
+ "\n",
+ "#Variable decleration\n",
+ "i=c_int(1)\n",
+ "p=pointer(i)\n",
+ "\n",
+ "#Calling the function\n",
+ "f(p) \n",
+ "\n",
+ "print i"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "c_long(100)\n"
+ "text": [
+ "c_long(100)\n"
+ ]
}
],
"prompt_number": 5
@@ -135,19 +284,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.7, Page Number: 137<h3>"
+ "source": [
+ "<h3>Example 7.7, Page Number: 137<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Pass by reference(pointer) to a function'''\n\nfrom ctypes import *\n\n#Function to change the reference value\ndef f(j):\n j[0]=100 #j is assigned 100\n\n#Variable decleration\ni=c_int(1)\np=pointer(i)\n\n#Calling the function\nf(p) \n\nprint i",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Function to change the reference value\n",
+ "def f(j):\n",
+ " j[0]=100 #j is assigned 100\n",
+ "\n",
+ "#Variable decleration\n",
+ "i=c_int(1)\n",
+ "p=pointer(i)\n",
+ "\n",
+ "#Calling the function\n",
+ "f(p) \n",
+ "\n",
+ "print i"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "c_long(100)\n"
+ "text": [
+ "c_long(100)\n"
+ ]
}
],
"prompt_number": 6
@@ -155,19 +324,37 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.8, Page Number: 137<h3>"
+ "source": [
+ "<h3>Example 7.8, Page Number: 137<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calling function with a list(array)'''\n\n#function to print some nos.\ndef display(num):\n for i in range(10):\n print num[i],\n \n#Variable declaration\nt=[]\n\nfor i in range(10):\n t.append(i)\n#Pass list to a function\ndisplay(t)",
+ "input": [
+ "\n",
+ "#function to print some nos.\n",
+ "def display(num):\n",
+ " for i in range(10):\n",
+ " print num[i],\n",
+ " \n",
+ "#Variable declaration\n",
+ "t=[]\n",
+ "\n",
+ "for i in range(10):\n",
+ " t.append(i)\n",
+ "#Pass list to a function\n",
+ "display(t)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 2 3 4 5 6 7 8 9\n"
+ "text": [
+ "0 1 2 3 4 5 6 7 8 9\n"
+ ]
}
],
"prompt_number": 7
@@ -175,19 +362,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.9, Page Number: 138<h3>"
+ "source": [
+ "<h3>Example 7.9, Page Number: 138<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Displaying list without passing the list'''\n\n#Print some nos.\ndef display(num):\n print num,\n\n#Variable declaration\nt=[]\n\nfor i in range(10):\n t.append(i)\n \n#Printing without passing entire list\nfor i in range(10):\n display(t[i])",
+ "input": [
+ "\n",
+ "\n",
+ "#Print some nos.\n",
+ "def display(num):\n",
+ " print num,\n",
+ "\n",
+ "#Variable declaration\n",
+ "t=[]\n",
+ "\n",
+ "for i in range(10):\n",
+ " t.append(i)\n",
+ " \n",
+ "#Printing without passing entire list\n",
+ "for i in range(10):\n",
+ " display(t[i])"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 2 3 4 5 6 7 8 9\n"
+ "text": [
+ "0 1 2 3 4 5 6 7 8 9\n"
+ ]
}
],
"prompt_number": 8
@@ -195,19 +402,51 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.10, Page Number: 139<h3>"
+ "source": [
+ "<h3>Example 7.10, Page Number: 139<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to convert each of the array element into its cube'''\n\n#Function to convert into cubes\ndef cube(n,num):\n num-=1\n while num:\n n[num]=n[num]*n[num]*n[num]\n num-=1\n\n#Variable declaration\nnums=[]\n\nfor i in range(10):\n nums.append(i+1)\n \nprint \"Original contents: \",\nfor i in range(10):\n print nums[i],\nprint\n\ncube(nums,10) #Compute cubes\n\n#Result\nprint \"Altered contents: \",\nfor i in range(10):\n print nums[i],",
+ "input": [
+ "\n",
+ "\n",
+ "#Function to convert into cubes\n",
+ "def cube(n,num):\n",
+ " num-=1\n",
+ " while num:\n",
+ " n[num]=n[num]*n[num]*n[num]\n",
+ " num-=1\n",
+ "\n",
+ "#Variable declaration\n",
+ "nums=[]\n",
+ "\n",
+ "for i in range(10):\n",
+ " nums.append(i+1)\n",
+ " \n",
+ "print \"Original contents: \",\n",
+ "for i in range(10):\n",
+ " print nums[i],\n",
+ "print\n",
+ "\n",
+ "cube(nums,10) #Compute cubes\n",
+ "\n",
+ "#Result\n",
+ "print \"Altered contents: \",\n",
+ "for i in range(10):\n",
+ " print nums[i],"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original contents: 1 2 3 4 5 6 7 8 9 10\nAltered contents: 1 8 27 64 125 216 343 512 729 1000\n"
+ "text": [
+ "Original contents: 1 2 3 4 5 6 7 8 9 10\n",
+ "Altered contents: 1 8 27 64 125 216 343 512 729 1000\n"
+ ]
}
],
"prompt_number": 10
@@ -215,19 +454,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.11, Page Number: 140<h3>"
+ "source": [
+ "<h3>Example 7.11, Page Number: 140<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to convert a string to uppercase'''\n\nimport string\n\ndef stringupper(str):\n str=string.upper(str) #convert to uppercase\n return str\n\n#Variable declaration \nstr=\"this is a test\"\n\n#Calling the function\nstr=stringupper(str)\n\n#Result\nprint str",
+ "input": [
+ "\n",
+ "import string\n",
+ "\n",
+ "def stringupper(str):\n",
+ " str=string.upper(str) #convert to uppercase\n",
+ " return str\n",
+ "\n",
+ "#Variable declaration \n",
+ "str=\"this is a test\"\n",
+ "\n",
+ "#Calling the function\n",
+ "str=stringupper(str)\n",
+ "\n",
+ "#Result\n",
+ "print str"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "THIS IS A TEST\n"
+ "text": [
+ "THIS IS A TEST\n"
+ ]
}
],
"prompt_number": 7
@@ -235,19 +494,33 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.12, Page Number: 141<h3>"
+ "source": [
+ "<h3>Example 7.12, Page Number: 141<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to find length of string'''\n\n#Function to fond length\ndef mystrlen(str):\n l=len(str)\n return l\n\n#Result\nprint \"Length of Hello There is: \",\nprint mystrlen(\"Hello There\")",
+ "input": [
+ "\n",
+ "#Function to fond length\n",
+ "def mystrlen(str):\n",
+ " l=len(str)\n",
+ " return l\n",
+ "\n",
+ "#Result\n",
+ "print \"Length of Hello There is: \",\n",
+ "print mystrlen(\"Hello There\")"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Length of Hello There is: 11\n"
+ "text": [
+ "Length of Hello There is: 11\n"
+ ]
}
],
"prompt_number": 11
@@ -255,19 +528,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.13, Page Number: 142<h3>"
+ "source": [
+ "<h3>Example 7.13, Page Number: 142<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrates how to access command line arguments.'''\n#This wont work because we cannot provide command line arguments\n\nimport sys\n\ndef main():\n if len(sys.argv)!=2:\n print \"You forgot to type your name.\" #CHECK!!!!\n return\n #Result\n print \"Hello \",sys.argv[1]\n\nmain()",
+ "input": [
+ "\n",
+ "import sys\n",
+ "\n",
+ "def main():\n",
+ " if len(sys.argv)!=2:\n",
+ " print \"You forgot to type your name.\" #CHECK!!!!\n",
+ " return\n",
+ " #Result\n",
+ " print \"Hello \",sys.argv[1]\n",
+ "\n",
+ "main()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "You forgot to type your name.\n"
+ "text": [
+ "You forgot to type your name.\n"
+ ]
}
],
"prompt_number": 2
@@ -275,19 +564,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.14, Page Number: 143<h3>"
+ "source": [
+ "<h3>Example 7.14, Page Number: 143<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The program prints all command line arguments '''\nimport sys\n\n#Result\nfor t in range(len(sys.argv)):\n i=0\n print sys.argv[t] ",
+ "input": [
+ "'''The program prints all command line arguments '''\n",
+ "import sys\n",
+ "\n",
+ "#Result\n",
+ "for t in range(len(sys.argv)):\n",
+ " i=0\n",
+ " print sys.argv[t] "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "-c\n-f\nC:\\Users\\Anandi\\.ipython\\profile_default\\security\\kernel-6e851974-75ff-4911-bdf9-e089a03e5741.json\n--KernelApp.parent_appname='ipython-notebook'\n--interrupt=904\n--parent=876\n"
+ "text": [
+ "-c\n",
+ "-f\n",
+ "C:\\Users\\Anandi\\.ipython\\profile_default\\security\\kernel-6e851974-75ff-4911-bdf9-e089a03e5741.json\n",
+ "--KernelApp.parent_appname='ipython-notebook'\n",
+ "--interrupt=904\n",
+ "--parent=876\n"
+ ]
}
],
"prompt_number": 2
@@ -295,19 +601,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.15, Page Number: 144<h3>"
+ "source": [
+ "<h3>Example 7.15, Page Number: 144<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program concatenates the two string arguments and displays them'''\n\nimport sys\n\nif len(sys.argv)!=3:\n print \"usage: add num num\" \nelse :\n #Variable Decleration\n a=sys.argv[1]\n b=sys.argv[2]\n #Result\n print a+b\n \n",
+ "input": [
+ "\n",
+ "import sys\n",
+ "\n",
+ "if len(sys.argv)!=3:\n",
+ " print \"usage: add num num\" \n",
+ "else :\n",
+ " #Variable Decleration\n",
+ " a=sys.argv[1]\n",
+ " b=sys.argv[2]\n",
+ " #Result\n",
+ " print a+b\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "usage: add num num\n"
+ "text": [
+ "usage: add num num\n"
+ ]
}
],
"prompt_number": 3
@@ -315,19 +638,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.16, Page Number: 145<h3>"
+ "source": [
+ "<h3>Example 7.16, Page Number: 145<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example program'''\n\nimport string\n\n#Variable Decleration\ni=string.atoi(\"100\")\nj=string.atoi(\"100000\")\nk=string.atof(\"-0.123\")\n\n#Result\nprint i,\" \",j,\" \",k",
+ "input": [
+ "\n",
+ "import string\n",
+ "\n",
+ "#Variable Decleration\n",
+ "i=string.atoi(\"100\")\n",
+ "j=string.atoi(\"100000\")\n",
+ "k=string.atof(\"-0.123\")\n",
+ "\n",
+ "#Result\n",
+ "print i,\" \",j,\" \",k"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "100 100000 -0.123\n"
+ "text": [
+ "100 100000 -0.123\n"
+ ]
}
],
"prompt_number": 13
@@ -335,24 +673,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.17, Page Number: 147<h3>"
+ "source": [
+ "<h3>Example 7.17, Page Number: 147<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example to use the function abs()'''\n\n#Variable Decleration\ni=abs(-10)\n\n#Result\nprint abs(-23)\nabs(100)",
+ "input": [
+ "\n",
+ "#Variable Decleration\n",
+ "i=abs(-10)\n",
+ "\n",
+ "#Result\n",
+ "print abs(-23)\n",
+ "abs(100)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "23\n"
+ "text": [
+ "23\n"
+ ]
},
{
+ "metadata": {},
"output_type": "pyout",
"prompt_number": 5,
- "text": "100"
+ "text": [
+ "100"
+ ]
}
],
"prompt_number": 5
@@ -360,19 +713,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.18, Page Number: 148<h3>"
+ "source": [
+ "<h3>Example 7.18, Page Number: 148<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to find a substring'''\n\n#Return index of substring or -1 if not found.\ndef find_substr(sub,str):\n l=str.find(sub)\n return l\n\n#Variable decleration;Calling the function\nindex=find_substr(\"three\",\"one two three four\")\n\n#Result\nprint \"Index of three is \",index",
+ "input": [
+ "\n",
+ "\n",
+ "#Return index of substring or -1 if not found.\n",
+ "def find_substr(sub,str):\n",
+ " l=str.find(sub)\n",
+ " return l\n",
+ "\n",
+ "#Variable decleration;Calling the function\n",
+ "index=find_substr(\"three\",\"one two three four\")\n",
+ "\n",
+ "#Result\n",
+ "print \"Index of three is \",index"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Index of three is 8\n"
+ "text": [
+ "Index of three is 8\n"
+ ]
}
],
"prompt_number": 6
@@ -380,19 +750,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.19, Page Number: 149<h3>"
+ "source": [
+ "<h3>Example 7.19, Page Number: 149<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to print a string vertically downward'''\n\nimport sys\n\ndef print_vertical(str):\n l=len(str)\n for i in range(l):\n print str[i],\n \nprint_vertical(sys.argv[1])\n ",
+ "input": [
+ "\n",
+ "\n",
+ "import sys\n",
+ "\n",
+ "def print_vertical(str):\n",
+ " l=len(str)\n",
+ " for i in range(l):\n",
+ " print str[i],\n",
+ " \n",
+ "print_vertical(sys.argv[1])\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "- f\n"
+ "text": [
+ "- f\n"
+ ]
}
],
"prompt_number": 14
@@ -400,19 +786,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.20, Page Number: 150<h3>"
+ "source": [
+ "<h3>Example 7.20, Page Number: 150<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Rework find_substr() to return pointer'''\n\n#Return position of substring\ndef find_substr(sub,str):\n return str.find(sub)\n\n#Variable declaration\ns=\"one two three four\"\n\nsubstr = find_substr(\"three\",s)\n\n#Result\nprint \"substring found:\",s[substr:]\n",
+ "input": [
+ "\n",
+ "#Return position of substring\n",
+ "def find_substr(sub,str):\n",
+ " return str.find(sub)\n",
+ "\n",
+ "#Variable declaration\n",
+ "s=\"one two three four\"\n",
+ "\n",
+ "substr = find_substr(\"three\",s)\n",
+ "\n",
+ "#Result\n",
+ "print \"substring found:\",s[substr:]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "substring found: three four\n"
+ "text": [
+ "substring found: three four\n"
+ ]
}
],
"prompt_number": 2
@@ -420,19 +823,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.21, Page Number: 154<h3>"
+ "source": [
+ "<h3>Example 7.21, Page Number: 154<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to calculate factorial'''\n\n#Recursive version\ndef factr(n):\n if n==1:\n return 1\n answer=factr(n-1)*n\n return answer\n\n#Iterative version\ndef fact(n):\n answer=1\n for t in range(n):\n answer=answer*(t+1)\n return answer\n\n#Using recursion version\nprint \"4 factorial is \",factr(4)\n\n#Using iterative version\nprint \"4 factorial is \",fact(4)\n\n ",
+ "input": [
+ "\n",
+ "\n",
+ "#Recursive version\n",
+ "def factr(n):\n",
+ " if n==1:\n",
+ " return 1\n",
+ " answer=factr(n-1)*n\n",
+ " return answer\n",
+ "\n",
+ "#Iterative version\n",
+ "def fact(n):\n",
+ " answer=1\n",
+ " for t in range(n):\n",
+ " answer=answer*(t+1)\n",
+ " return answer\n",
+ "\n",
+ "#Using recursion version\n",
+ "print \"4 factorial is \",factr(4)\n",
+ "\n",
+ "#Using iterative version\n",
+ "print \"4 factorial is \",fact(4)\n",
+ "\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "4 factorial is 24\n4 factorial is 24\n"
+ "text": [
+ "4 factorial is 24\n",
+ "4 factorial is 24\n"
+ ]
}
],
"prompt_number": 3
@@ -440,19 +872,38 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 7.22, Page Number: 155<h3>"
+ "source": [
+ "<h3>Example 7.22, Page Number: 155<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Print a string backwards using recursion'''\n\n#Reversing a string\ndef reverse(s):\n r = \"\"\n for c in s:\n r=c+r\n print r\n \n#VariabDecleration \nstr=\"this is a test\"\n\n#Calling function\nreverse(str)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Reversing a string\n",
+ "def reverse(s):\n",
+ " r = \"\"\n",
+ " for c in s:\n",
+ " r=c+r\n",
+ " print r\n",
+ " \n",
+ "#VariabDecleration \n",
+ "str=\"this is a test\"\n",
+ "\n",
+ "#Calling function\n",
+ "reverse(str)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "tset a si siht\n"
+ "text": [
+ "tset a si siht\n"
+ ]
}
],
"prompt_number": 9
@@ -460,7 +911,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_8(1).ipynb b/C++_from_the_Ground/Chapter_8(1).ipynb
index da5f88d2..3092696e 100644
--- a/C++_from_the_Ground/Chapter_8(1).ipynb
+++ b/C++_from_the_Ground/Chapter_8(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 8"
+ "name": "",
+ "signature": "sha256:cea79a35a095750f932030d193b34f2136c703d7c2c54113f8e7917863a4322a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,41 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 8: Functions,Part Two: References, Overloading, and Default Arguments<h1>"
+ "source": [
+ "<h1>Chapter 8: Functions,Part Two: References, Overloading, and Default Arguments<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.1, Page Number: 158<h3>"
+ "source": [
+ "<h3>Example 8.1, Page Number: 158<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example for call by value'''\n\ndef sqr_it(x):\n x=x*x\n return x\n\n#Variable decleration\nt=10\n\n#Result; function calling\nprint sqr_it(t),' ',t\n",
+ "input": [
+ "\n",
+ "def sqr_it(x):\n",
+ " x=x*x\n",
+ " return x\n",
+ "\n",
+ "#Variable decleration\n",
+ "t=10\n",
+ "\n",
+ "#Result; function calling\n",
+ "print sqr_it(t),' ',t\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "100 10\n"
+ "text": [
+ "100 10\n"
+ ]
}
],
"prompt_number": 2
@@ -35,19 +53,47 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.2, Page Number: 159<h3>"
+ "source": [
+ "<h3>Example 8.2, Page Number: 159<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to swap two values; implementing call by pointers'''\n\ndef swap(x,y):\n temp=x\n x=y\n y=temp\n return x, y\n\n#Variable decleration\ni=10\nj=20 \n\n#Initial values\nprint \"Initial values of i and j: \",\nprint i,' ',j\n\n#Calling function to swap\ni, j=swap(i,j)\n\n#Result\nprint \"Swapped values of i and j: \",\nprint i,' ',j",
+ "input": [
+ "\n",
+ "\n",
+ "def swap(x,y):\n",
+ " temp=x\n",
+ " x=y\n",
+ " y=temp\n",
+ " return x, y\n",
+ "\n",
+ "#Variable decleration\n",
+ "i=10\n",
+ "j=20 \n",
+ "\n",
+ "#Initial values\n",
+ "print \"Initial values of i and j: \",\n",
+ "print i,' ',j\n",
+ "\n",
+ "#Calling function to swap\n",
+ "i, j=swap(i,j)\n",
+ "\n",
+ "#Result\n",
+ "print \"Swapped values of i and j: \",\n",
+ "print i,' ',j"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Initial values of i and j: 10 20\nSwapped values of i and j: 20 10\n"
+ "text": [
+ "Initial values of i and j: 10 20\n",
+ "Swapped values of i and j: 20 10\n"
+ ]
}
],
"prompt_number": 1
@@ -55,19 +101,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.3, Page Number: 161<h3>"
+ "source": [
+ "<h3>Example 8.3, Page Number: 161<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example to implement call by reference in python'''\n\ndef f(i):\n i=10\n return i #Returning the value since the function cannot access the variables in the calling scope.\n\n#Variable Decleration\nval=1\n\nprint \"Old value for val: \",val\nval=f(val) #Function call\n\n#Result\nprint \"New value for val: \",val\n",
+ "input": [
+ "\n",
+ "\n",
+ "def f(i):\n",
+ " i=10\n",
+ " return i #Returning the value since the function cannot access the variables in the calling scope.\n",
+ "\n",
+ "#Variable Decleration\n",
+ "val=1\n",
+ "\n",
+ "print \"Old value for val: \",val\n",
+ "val=f(val) #Function call\n",
+ "\n",
+ "#Result\n",
+ "print \"New value for val: \",val\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Old value for val: 1\nNew value for val: 10\n"
+ "text": [
+ "Old value for val: 1\n",
+ "New value for val: 10\n"
+ ]
}
],
"prompt_number": 4
@@ -75,19 +141,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.4, Page Number: 162<h3>"
+ "source": [
+ "<h3>Example 8.4, Page Number: 162<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Program to swap two values; implementing call by reference'''\n\ndef swap(i,j):\n temp=i[0]\n i[0]=j[0]\n j[0]=temp\n return i, j\n\n#Variable decleration\ni=[]\nj=[]\ni.append(10)\nj.append(20)\n\n#Initial values\nprint \"Initial values of i and j: \",\nprint i[0],' ',j[0]\n\n#Calling function to swap\ni, j=swap(i,j)\n\n#Result\nprint \"Swapped values of i and j: \",\nprint i[0],' ',j[0]",
+ "input": [
+ "\n",
+ "def swap(i,j):\n",
+ " temp=i[0]\n",
+ " i[0]=j[0]\n",
+ " j[0]=temp\n",
+ " return i, j\n",
+ "\n",
+ "#Variable decleration\n",
+ "i=[]\n",
+ "j=[]\n",
+ "i.append(10)\n",
+ "j.append(20)\n",
+ "\n",
+ "#Initial values\n",
+ "print \"Initial values of i and j: \",\n",
+ "print i[0],' ',j[0]\n",
+ "\n",
+ "#Calling function to swap\n",
+ "i, j=swap(i,j)\n",
+ "\n",
+ "#Result\n",
+ "print \"Swapped values of i and j: \",\n",
+ "print i[0],' ',j[0]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Initial values of i and j: 10 20\nSwapped values of i and j: 20 10\n"
+ "text": [
+ "Initial values of i and j: 10 20\n",
+ "Swapped values of i and j: 20 10\n"
+ ]
}
],
"prompt_number": 2
@@ -95,19 +190,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.5, Page Number: 164<h3>"
+ "source": [
+ "<h3>Example 8.5, Page Number: 164<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example program'''\n#Since python cannot return references, the value is changed using the variable itself\n\n#Variable Decleration\nval = 100.0\n\ndef f():\n global val\n return val\n\n#Result\nprint val\n\nnewval=f() #function call\nprint newval\n\nval=99.1 #change val's value\nprint f() #print val's new value\n",
+ "input": [
+ "\n",
+ "#Variable Decleration\n",
+ "val = 100.0\n",
+ "\n",
+ "def f():\n",
+ " global val\n",
+ " return val\n",
+ "\n",
+ "#Result\n",
+ "print val\n",
+ "\n",
+ "newval=f() #function call\n",
+ "print newval\n",
+ "\n",
+ "val=99.1 #change val's value\n",
+ "print f() #print val's new value\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "100.0\n100.0\n99.1\n"
+ "text": [
+ "100.0\n",
+ "100.0\n",
+ "99.1\n"
+ ]
}
],
"prompt_number": 4
@@ -115,19 +233,47 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.6, Page Number: 166<h3>"
+ "source": [
+ "<h3>Example 8.6, Page Number: 166<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Changing contents of a list'''\n#Since python cannot return references, the program has been modified.\n\n#Function definition\ndef change_it(i,n):\n global vals\n vals[i]=n\n\n#Variable Decleration\nvals=[1.1,2.2,3.3,4.4,5.5]\n\nprint \"Here are the original values: \",\nfor i in range(5):\n print vals[i],\nprint\n \n#Function call\nchange_it(1,5298.23)\nchange_it(3,-98.8)\n\n#Result\nprint \"Here are the changed values: \",\nfor i in range(5):\n print vals[i],",
+ "input": [
+ "\n",
+ "#Function definition\n",
+ "def change_it(i,n):\n",
+ " global vals\n",
+ " vals[i]=n\n",
+ "\n",
+ "#Variable Decleration\n",
+ "vals=[1.1,2.2,3.3,4.4,5.5]\n",
+ "\n",
+ "print \"Here are the original values: \",\n",
+ "for i in range(5):\n",
+ " print vals[i],\n",
+ "print\n",
+ " \n",
+ "#Function call\n",
+ "change_it(1,5298.23)\n",
+ "change_it(3,-98.8)\n",
+ "\n",
+ "#Result\n",
+ "print \"Here are the changed values: \",\n",
+ "for i in range(5):\n",
+ " print vals[i],"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Here are the original values: 1.1 2.2 3.3 4.4 5.5\nHere are the changed values: 1.1 5298.23 3.3 -98.8 5.5\n"
+ "text": [
+ "Here are the original values: 1.1 2.2 3.3 4.4 5.5\n",
+ "Here are the changed values: 1.1 5298.23 3.3 -98.8 5.5\n"
+ ]
}
],
"prompt_number": 5
@@ -135,19 +281,56 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.7, Page Number: 167<h3>"
+ "source": [
+ "<h3>Example 8.7, Page Number: 167<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing a simple safe array'''\n\n#Variable Decleration\nvals=[None]*10\nerror=-1\n\n#put values into the array\ndef put(i,n):\n global vals\n if i>=0 and i<10:\n vals[i]=n\n else:\n print \"Bounds Error!\"\n error=n\n\n#obtain a value from the array\ndef get(i):\n if i>=0 and i<10:\n return vals[i]\n else:\n print \"Bounds error!\"\n return -1\n \n#put values into the array\nput(0,10)\nput(1,20)\nput(9,30)\n\n#Result\nprint get(0),' ',get(1),' ',get(9),\n\n#now, intentionally generate an errer\nput(12,1)",
+ "input": [
+ "\n",
+ "#Variable Decleration\n",
+ "vals=[None]*10\n",
+ "error=-1\n",
+ "\n",
+ "#put values into the array\n",
+ "def put(i,n):\n",
+ " global vals\n",
+ " if i>=0 and i<10:\n",
+ " vals[i]=n\n",
+ " else:\n",
+ " print \"Bounds Error!\"\n",
+ " error=n\n",
+ "\n",
+ "#obtain a value from the array\n",
+ "def get(i):\n",
+ " if i>=0 and i<10:\n",
+ " return vals[i]\n",
+ " else:\n",
+ " print \"Bounds error!\"\n",
+ " return -1\n",
+ " \n",
+ "#put values into the array\n",
+ "put(0,10)\n",
+ "put(1,20)\n",
+ "put(9,30)\n",
+ "\n",
+ "#Result\n",
+ "print get(0),' ',get(1),' ',get(9),\n",
+ "\n",
+ "#now, intentionally generate an errer\n",
+ "put(12,1)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 20 30 Bounds Error!\n"
+ "text": [
+ "10 20 30 Bounds Error!\n"
+ ]
}
],
"prompt_number": 6
@@ -155,19 +338,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.8, Page Number: 169<h3>"
+ "source": [
+ "<h3>Example 8.8, Page Number: 169<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing references in pyhton'''\n\n#Variable Decleration\ni=[]\nj=i #independent reference\n\nj.append(10) #Here i and j are just references to [10]\n\nprint j[0],\" \",i[0] \n\nk=121\ni[0]=k #copies k's value into j[0] \n\n#Result\nprint j[0]",
+ "input": [
+ "\n",
+ "#Variable Decleration\n",
+ "i=[]\n",
+ "j=i #independent reference\n",
+ "\n",
+ "j.append(10) #Here i and j are just references to [10]\n",
+ "\n",
+ "print j[0],\" \",i[0] \n",
+ "\n",
+ "k=121\n",
+ "i[0]=k #copies k's value into j[0] \n",
+ "\n",
+ "#Result\n",
+ "print j[0]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 10\n121\n"
+ "text": [
+ "10 10\n",
+ "121\n"
+ ]
}
],
"prompt_number": 7
@@ -175,19 +378,40 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.9, Page Number: 170<h3>"
+ "source": [
+ "<h3>Example 8.9, Page Number: 170<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Function overloading in python'''\n#Overloading is not supported by python, hence it is implemented by default arguments.\n\ndef f(i,j=None):\n if j==None: \n if isinstance(i,int): #for 1st function\n print \"In f(int), i is \",i \n else: #for 3rd function\n print \"In f(double), k is \",i\n else: #for 2nd arguments\n print \"In f(int,int), i is \",i,\", j is \",j\n \n#calling function\nf(10)\nf(10,20)\nf(12.23)\n",
+ "input": [
+ "\n",
+ "def f(i,j=None):\n",
+ " if j==None: \n",
+ " if isinstance(i,int): #for 1st function\n",
+ " print \"In f(int), i is \",i \n",
+ " else: #for 3rd function\n",
+ " print \"In f(double), k is \",i\n",
+ " else: #for 2nd arguments\n",
+ " print \"In f(int,int), i is \",i,\", j is \",j\n",
+ " \n",
+ "#calling function\n",
+ "f(10)\n",
+ "f(10,20)\n",
+ "f(12.23)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "In f(int), i is 10\nIn f(int,int), i is 10 , j is 20\nIn f(double), k is 12.23\n"
+ "text": [
+ "In f(int), i is 10\n",
+ "In f(int,int), i is 10 , j is 20\n",
+ "In f(double), k is 12.23\n"
+ ]
}
],
"prompt_number": 6
@@ -195,19 +419,53 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.10, Page Number: 171<h3>"
+ "source": [
+ "<h3>Example 8.10, Page Number: 171<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Create an overloaded function of abs called myabs()'''\n\n#myabs() in three ways\ndef myabs(i):\n if isinstance(i,int): #first instance\n print \"Using integer myabs(): \",\n if i<0:\n return -i\n else:\n return i\n elif isinstance(i,float): #second instance\n print \"Using double myabs(): \",\n if(i<0.0):\n return -i\n else:\n return i\n elif isinstance(i,long): #third instance\n print \"Using long myabs(): \",\n if i<0:\n return -i\n else:\n return i\n\n#Result; calling the function \nprint myabs(-10)\nprint myabs(-11.0)\nprint myabs(-9L)\n\n",
+ "input": [
+ "\n",
+ "#myabs() in three ways\n",
+ "def myabs(i):\n",
+ " if isinstance(i,int): #first instance\n",
+ " print \"Using integer myabs(): \",\n",
+ " if i<0:\n",
+ " return -i\n",
+ " else:\n",
+ " return i\n",
+ " elif isinstance(i,float): #second instance\n",
+ " print \"Using double myabs(): \",\n",
+ " if(i<0.0):\n",
+ " return -i\n",
+ " else:\n",
+ " return i\n",
+ " elif isinstance(i,long): #third instance\n",
+ " print \"Using long myabs(): \",\n",
+ " if i<0:\n",
+ " return -i\n",
+ " else:\n",
+ " return i\n",
+ "\n",
+ "#Result; calling the function \n",
+ "print myabs(-10)\n",
+ "print myabs(-11.0)\n",
+ "print myabs(-9L)\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Using integer myabs(): 10\nUsing double myabs(): 11.0\nUsing long myabs(): 9\n"
+ "text": [
+ "Using integer myabs(): 10\n",
+ "Using double myabs(): 11.0\n",
+ "Using long myabs(): 9\n"
+ ]
}
],
"prompt_number": 8
@@ -215,19 +473,1149 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.11, Page Number: 174<h3>"
+ "source": [
+ "<h3>Example 8.11, Page Number: 174<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An example of default arguments'''\n\nimport os\n\ndef clrscr(size=25):\n while(size):\n print \"\"\n size-=1\n \nfor i in range(30):\n print i\n clrscr() #clears 25 lines\n\nfor i in range(30):\n print i\n clrscr(10) #clears 10 lines\n ",
+ "input": [
+ "\n",
+ "import os\n",
+ "\n",
+ "def clrscr(size=25):\n",
+ " while(size):\n",
+ " print \"\"\n",
+ " size-=1\n",
+ " \n",
+ "for i in range(30):\n",
+ " print i\n",
+ " clrscr() #clears 25 lines\n",
+ "\n",
+ "for i in range(30):\n",
+ " print i\n",
+ " clrscr(10) #clears 10 lines\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n1\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n2\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n3\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n4\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n5\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n6\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n7\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n8\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n9\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n10\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n11\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n12\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n13\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n14\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n15\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n16\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n17\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n18\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n19\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n20\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n21\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n22\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n23\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n24\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n25\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n26\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n27\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n28\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n29\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n0\n \n \n \n \n \n \n \n \n \n \n1\n \n \n \n \n \n \n \n \n \n \n2\n \n \n \n \n \n \n \n \n \n \n3\n \n \n \n \n \n \n \n \n \n \n4\n \n \n \n \n \n \n \n \n \n \n5\n \n \n \n \n \n \n \n \n \n \n6\n \n \n \n \n \n \n \n \n \n \n7\n \n \n \n \n \n \n \n \n \n \n8\n \n \n \n \n \n \n \n \n \n \n9\n \n \n \n \n \n \n \n \n \n \n10\n \n \n \n \n \n \n \n \n \n \n11\n \n \n \n \n \n \n \n \n \n \n12\n \n \n \n \n \n \n \n \n \n \n13\n \n \n \n \n \n \n \n \n \n \n14\n \n \n \n \n \n \n \n \n \n \n15\n \n \n \n \n \n \n \n \n \n \n16\n \n \n \n \n \n \n \n \n \n \n17\n \n \n \n \n \n \n \n \n \n \n18\n \n \n \n \n \n \n \n \n \n \n19\n \n \n \n \n \n \n \n \n \n \n20\n \n \n \n \n \n \n \n \n \n \n21\n \n \n \n \n \n \n \n \n \n \n22\n \n \n \n \n \n \n \n \n \n \n23\n \n \n \n \n \n \n \n \n \n \n24\n \n \n \n \n \n \n \n \n \n \n25\n \n \n \n \n \n \n \n \n \n \n26\n \n \n \n \n \n \n \n \n \n \n27\n \n \n \n \n \n \n \n \n \n \n28\n \n \n \n \n \n \n \n \n \n \n29\n \n \n \n \n \n \n \n \n \n \n"
+ "text": [
+ "0\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "1\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "2\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "3\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "4\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "5\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "6\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "7\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "8\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "9\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "10\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "11\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "12\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "13\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "14\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "15\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "16\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "17\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "18\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "19\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "20\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "21\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "22\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "23\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "24\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "25\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "26\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "27\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "28\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "29\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "0\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "1\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "2\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "3\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "4\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "5\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "6\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "7\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "8\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "9\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "10\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "11\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "12\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "13\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "14\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "15\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "16\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "17\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "18\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "19\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "20\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "21\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "22\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "23\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "24\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "25\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "26\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "27\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "28\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "29\n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n"
+ ]
}
],
"prompt_number": 8
@@ -235,19 +1623,45 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.12, Page Number: 176<h3>"
+ "source": [
+ "<h3>Example 8.12, Page Number: 176<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A customized version of strcat'''\n\n#Variable Decleration\nstr1 = \"This is a test\"\nstr2 = \"0123456789\"\n\n#function for concatenation\ndef mystrcat(s1,s2,l=-1):\n if l==-1:\n l=len(str2)\n s2=s2[:l] #truncates s2\n s1=s1+s2 #concatenates the 2 strings\n return s1\n\nstr1=mystrcat(str1,str2,5) #concatenate 5 chars\nprint str1\n\nstr1 = \"this is a test\" #reset str1\n\nstr1=mystrcat(str1, str2) #concatenate entire string\nprint str1",
+ "input": [
+ "\n",
+ "#Variable Decleration\n",
+ "str1 = \"This is a test\"\n",
+ "str2 = \"0123456789\"\n",
+ "\n",
+ "#function for concatenation\n",
+ "def mystrcat(s1,s2,l=-1):\n",
+ " if l==-1:\n",
+ " l=len(str2)\n",
+ " s2=s2[:l] #truncates s2\n",
+ " s1=s1+s2 #concatenates the 2 strings\n",
+ " return s1\n",
+ "\n",
+ "str1=mystrcat(str1,str2,5) #concatenate 5 chars\n",
+ "print str1\n",
+ "\n",
+ "str1 = \"this is a test\" #reset str1\n",
+ "\n",
+ "str1=mystrcat(str1, str2) #concatenate entire string\n",
+ "print str1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This is a test01234\nthis is a test0123456789\n"
+ "text": [
+ "This is a test01234\n",
+ "this is a test0123456789\n"
+ ]
}
],
"prompt_number": 9
@@ -255,19 +1669,30 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.13, Page Number: 177<h3>"
+ "source": [
+ "<h3>Example 8.13, Page Number: 177<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Overload ambiguity'''\n#Here there wont be any ambiguity because float and double are the same.\n\ndef myfunc(i):\n return i\n \nprint myfunc(10.1),\nprint myfunc(10)",
+ "input": [
+ "\n",
+ "def myfunc(i):\n",
+ " return i\n",
+ " \n",
+ "print myfunc(10.1),\n",
+ "print myfunc(10)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10.1 10\n"
+ "text": [
+ "10.1 10\n"
+ ]
}
],
"prompt_number": 2
@@ -275,19 +1700,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.14, Page Number: 178<h3>"
+ "source": [
+ "<h3>Example 8.14, Page Number: 178<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Another ambiguity'''\n\nfrom ctypes import *\n\ndef myfunc(ch):\n if isinstance(ch,c_int):\n return chr(ch.value+1)\n elif isinstance(ch,c_uint):\n return chr(ch.value-1)\n \n \nprint myfunc(c_int(ord('c'))),\nprint myfunc(c_uint(88))",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "def myfunc(ch):\n",
+ " if isinstance(ch,c_int):\n",
+ " return chr(ch.value+1)\n",
+ " elif isinstance(ch,c_uint):\n",
+ " return chr(ch.value-1)\n",
+ " \n",
+ " \n",
+ "print myfunc(c_int(ord('c'))),\n",
+ "print myfunc(c_uint(88))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " d W\n"
+ "text": [
+ " d W\n"
+ ]
}
],
"prompt_number": 5
@@ -295,19 +1737,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 8.15, Page Number: 179<h3>"
+ "source": [
+ "<h3>Example 8.15, Page Number: 179<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''More ambiguity'''\n\ndef myfunc(i,j=1):\n if j==1:\n return i*j\n else:\n return i\n \n \nprint myfunc(4,5),\nprint myfunc(10)",
+ "input": [
+ "\n",
+ "def myfunc(i,j=1):\n",
+ " if j==1:\n",
+ " return i*j\n",
+ " else:\n",
+ " return i\n",
+ " \n",
+ " \n",
+ "print myfunc(4,5),\n",
+ "print myfunc(10)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "4 10\n"
+ "text": [
+ "4 10\n"
+ ]
}
],
"prompt_number": 6
@@ -315,7 +1772,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_from_the_Ground/Chapter_9(1).ipynb b/C++_from_the_Ground/Chapter_9(1).ipynb
index b31c36a0..9e6e1729 100644
--- a/C++_from_the_Ground/Chapter_9(1).ipynb
+++ b/C++_from_the_Ground/Chapter_9(1).ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 9"
+ "name": "",
+ "signature": "sha256:9ff1f12edc348acd1b1c3b16cc9a9556459332fb35a1337252165631b4cd82af"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,37 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 9: More Data Types and Operations<h1>"
+ "source": [
+ "<h1>Chapter 9: More Data Types and Operations<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.1, Page Number: 182<h3>"
+ "source": [
+ "<h3>Example 9.1, Page Number: 182<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Printing a string'''\n#pyhton doesnt have constants, hence a normal object has been used\n\ndef code(str):\n print str\n\n#Calling function\ncode(\"this is a test\")",
+ "input": [
+ "\n",
+ "def code(str):\n",
+ " print str\n",
+ "\n",
+ "#Calling function\n",
+ "code(\"this is a test\")"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "this is a test\n"
+ "text": [
+ "this is a test\n"
+ ]
}
],
"prompt_number": 2
@@ -35,19 +49,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.2, Page Number: 183<h3>"
+ "source": [
+ "<h3>Example 9.2, Page Number: 183<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing const references'''\n\ndef f(i):\n i=100\n print i\n \n#Variable declaration\nk=10\n\n#function call\nf(k)\n",
+ "input": [
+ "\n",
+ "def f(i):\n",
+ " i=100\n",
+ " print i\n",
+ " \n",
+ "#Variable declaration\n",
+ "k=10\n",
+ "\n",
+ "#function call\n",
+ "f(k)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "100\n"
+ "text": [
+ "100\n"
+ ]
}
],
"prompt_number": 1
@@ -55,19 +84,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.3, Page Number: 187<h3>"
+ "source": [
+ "<h3>Example 9.3, Page Number: 187<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementing extern in pyhton'''\n\n#Variable Declaration\nfirst=10 #global definition of first and last\nlast=20\n\n#Result\nprint first,last\n\n",
+ "input": [
+ "\n",
+ "#Variable Declaration\n",
+ "first=10 #global definition of first and last\n",
+ "last=20\n",
+ "\n",
+ "#Result\n",
+ "print first,last\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 20\n"
+ "text": [
+ "10 20\n"
+ ]
}
],
"prompt_number": 7
@@ -75,19 +117,55 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.4, Page Number: 188<h3>"
+ "source": [
+ "<h3>Example 9.4, Page Number: 188<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Compute a running average of numbers entered by the user'''\n'''Implementing static variables in python'''\n\n#Variable declaration\nsum=0 \ncount=0\nnum=5 #Loop for user entries\n\n#compute a running average\ndef r_avg(i):\n global sum,count\n sum=sum+i\n count+=1\n return sum/count\n\n\nwhile True:\n print \"Enter numbers(-1 to quit): \"\n num-=1 #User input\n if not(num==-1):\n print \"Running average is: \",r_avg(num) #Result\n if num<0:\n break",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "sum=0 \n",
+ "count=0\n",
+ "num=5 #Loop for user entries\n",
+ "\n",
+ "#compute a running average\n",
+ "def r_avg(i):\n",
+ " global sum,count\n",
+ " sum=sum+i\n",
+ " count+=1\n",
+ " return sum/count\n",
+ "\n",
+ "\n",
+ "while True:\n",
+ " print \"Enter numbers(-1 to quit): \"\n",
+ " num-=1 #User input\n",
+ " if not(num==-1):\n",
+ " print \"Running average is: \",r_avg(num) #Result\n",
+ " if num<0:\n",
+ " break"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter numbers(-1 to quit): \nRunning average is: 4\nEnter numbers(-1 to quit): \nRunning average is: 3\nEnter numbers(-1 to quit): \nRunning average is: 3\nEnter numbers(-1 to quit): \nRunning average is: 2\nEnter numbers(-1 to quit): \nRunning average is: 2\nEnter numbers(-1 to quit): \n"
+ "text": [
+ "Enter numbers(-1 to quit): \n",
+ "Running average is: 4\n",
+ "Enter numbers(-1 to quit): \n",
+ "Running average is: 3\n",
+ "Enter numbers(-1 to quit): \n",
+ "Running average is: 3\n",
+ "Enter numbers(-1 to quit): \n",
+ "Running average is: 2\n",
+ "Enter numbers(-1 to quit): \n",
+ "Running average is: 2\n",
+ "Enter numbers(-1 to quit): \n"
+ ]
}
],
"prompt_number": 3
@@ -95,19 +173,75 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.5, Page Number: 189<h3>"
+ "source": [
+ "<h3>Example 9.5, Page Number: 189<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Compute a running average of numbers entered by the user'''\n'''Implementing static variables in python'''\n\n#Variable declaration\nsum=0 \ncount=0\nnum=10 #Loop for user entries\n\n#user input given: 9,8,7,6,-2,4,3,2,1,-1\n\n#compute a running average\ndef r_avg(i):\n global sum,count\n sum=sum+i\n count+=1\n return sum/count\n\ndef reset():\n global sum,count\n sum=0\n count=0\n \nwhile True:\n print \"Enter numbers(-1 to quit, -2 to reset): \"\n num-=1 #User input\n if num==5:\n num=-2\n if num==-2: #for reset\n num=4\n reset()\n continue\n if not(num==-1):\n print \"Running average is: \",r_avg(num) #Result\n else:\n break",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "sum=0 \n",
+ "count=0\n",
+ "num=10 #Loop for user entries\n",
+ "\n",
+ "#user input given: 9,8,7,6,-2,4,3,2,1,-1\n",
+ "\n",
+ "#compute a running average\n",
+ "def r_avg(i):\n",
+ " global sum,count\n",
+ " sum=sum+i\n",
+ " count+=1\n",
+ " return sum/count\n",
+ "\n",
+ "def reset():\n",
+ " global sum,count\n",
+ " sum=0\n",
+ " count=0\n",
+ " \n",
+ "while True:\n",
+ " print \"Enter numbers(-1 to quit, -2 to reset): \"\n",
+ " num-=1 #User input\n",
+ " if num==5:\n",
+ " num=-2\n",
+ " if num==-2: #for reset\n",
+ " num=4\n",
+ " reset()\n",
+ " continue\n",
+ " if not(num==-1):\n",
+ " print \"Running average is: \",r_avg(num) #Result\n",
+ " else:\n",
+ " break"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter numbers(-1 to quit, -2 to reset): \nRunning average is: 9\nEnter numbers(-1 to quit, -2 to reset): \nRunning average is: 8\nEnter numbers(-1 to quit, -2 to reset): \nRunning average is: 8\nEnter numbers(-1 to quit, -2 to reset): \nRunning average is: 7\nEnter numbers(-1 to quit, -2 to reset): \nEnter numbers(-1 to quit, -2 to reset): \nRunning average is: 3\nEnter numbers(-1 to quit, -2 to reset): \nRunning average is: 2\nEnter numbers(-1 to quit, -2 to reset): \nRunning average is: 2\nEnter numbers(-1 to quit, -2 to reset): \nRunning average is: 1\nEnter numbers(-1 to quit, -2 to reset): \n"
+ "text": [
+ "Enter numbers(-1 to quit, -2 to reset): \n",
+ "Running average is: 9\n",
+ "Enter numbers(-1 to quit, -2 to reset): \n",
+ "Running average is: 8\n",
+ "Enter numbers(-1 to quit, -2 to reset): \n",
+ "Running average is: 8\n",
+ "Enter numbers(-1 to quit, -2 to reset): \n",
+ "Running average is: 7\n",
+ "Enter numbers(-1 to quit, -2 to reset): \n",
+ "Enter numbers(-1 to quit, -2 to reset): \n",
+ "Running average is: 3\n",
+ "Enter numbers(-1 to quit, -2 to reset): \n",
+ "Running average is: 2\n",
+ "Enter numbers(-1 to quit, -2 to reset): \n",
+ "Running average is: 2\n",
+ "Enter numbers(-1 to quit, -2 to reset): \n",
+ "Running average is: 1\n",
+ "Enter numbers(-1 to quit, -2 to reset): \n"
+ ]
}
],
"prompt_number": 4
@@ -115,19 +249,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.6, Page Number: 196<h3>"
+ "source": [
+ "<h3>Example 9.6, Page Number: 196<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of enumeration in python'''\n\n#Array of strings that correspond to the enumeration\nname=[\"Jonathan\",\"Golden Delicious\",\"Red Delicious\",\"Winesap\",\n \"Cortland\",\"McIntosh\"]\n\n#enumeration type\n(Jonathan,Golden_Delicious,Red_Delicious,Winesap,Cortland,McIntosh) = (0,1,2,3,4,5)\n\nfruit=Jonathan\nprint name[fruit]\n\nfruit = Winesap\nprint name[fruit]\n\nfruit = McIntosh\nprint name[fruit]",
+ "input": [
+ "\n",
+ "#Array of strings that correspond to the enumeration\n",
+ "name=[\"Jonathan\",\"Golden Delicious\",\"Red Delicious\",\"Winesap\",\n",
+ " \"Cortland\",\"McIntosh\"]\n",
+ "\n",
+ "#enumeration type\n",
+ "(Jonathan,Golden_Delicious,Red_Delicious,Winesap,Cortland,McIntosh) = (0,1,2,3,4,5)\n",
+ "\n",
+ "fruit=Jonathan\n",
+ "print name[fruit]\n",
+ "\n",
+ "fruit = Winesap\n",
+ "print name[fruit]\n",
+ "\n",
+ "fruit = McIntosh\n",
+ "print name[fruit]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Jonathan\nWinesap\nMcIntosh\n"
+ "text": [
+ "Jonathan\n",
+ "Winesap\n",
+ "McIntosh\n"
+ ]
}
],
"prompt_number": 1
@@ -135,19 +292,45 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.7, Page Number: 198<h3>"
+ "source": [
+ "<h3>Example 9.7, Page Number: 198<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Convert to uppercase letter'''\n\n#Variable declaration\nch='j' #User input\nwhile True:\n #This statement turns off the 6th but.\n c=chr(ord(ch)&223) #ch is now uppercase\n print c\n if c=='Q':\n break \n else:\n ch = chr(ord(ch)+1) #incrementing for different user inputs\n \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "ch='j' #User input\n",
+ "while True:\n",
+ " #This statement turns off the 6th but.\n",
+ " c=chr(ord(ch)&223) #ch is now uppercase\n",
+ " print c\n",
+ " if c=='Q':\n",
+ " break \n",
+ " else:\n",
+ " ch = chr(ord(ch)+1) #incrementing for different user inputs\n",
+ " \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "J\nK\nL\nM\nN\nO\nP\nQ\n"
+ "text": [
+ "J\n",
+ "K\n",
+ "L\n",
+ "M\n",
+ "N\n",
+ "O\n",
+ "P\n",
+ "Q\n"
+ ]
}
],
"prompt_number": 3
@@ -155,19 +338,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.8, Page Number: 200<h3>"
+ "source": [
+ "<h3>Example 9.8, Page Number: 200<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Convert to lowercase letter'''\n\n#Variable declaration\nch='J' #User input\nwhile True:\n #This statement turns off the 6th but.\n c=chr(ord(ch)|32) #ch is now uppercase\n print c\n if c=='q':\n break \n else:\n ch = chr(ord(ch)+1) #incrementing for different user inputs\n ",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "ch='J' #User input\n",
+ "while True:\n",
+ " #This statement turns off the 6th but.\n",
+ " c=chr(ord(ch)|32) #ch is now uppercase\n",
+ " print c\n",
+ " if c=='q':\n",
+ " break \n",
+ " else:\n",
+ " ch = chr(ord(ch)+1) #incrementing for different user inputs\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "j\nk\nl\nm\nn\no\np\nq\n"
+ "text": [
+ "j\n",
+ "k\n",
+ "l\n",
+ "m\n",
+ "n\n",
+ "o\n",
+ "p\n",
+ "q\n"
+ ]
}
],
"prompt_number": 4
@@ -175,19 +383,46 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.9, Page Number: 201<h3>"
+ "source": [
+ "<h3>Example 9.9, Page Number: 201<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Display the bits within a byte'''\n\n#function to display the bits\ndef disp_binary(u):\n t=128\n while t:\n if u&t:\n print 1,\n else:\n print 0,\n t=t/2\n print \"\"\n \n#Variable declaration\nu=99 #User Input\n\nprint \"Here's the number in binary: \",\ndisp_binary(u)\n\nprint \"Here's the complement of th number: \",\ndisp_binary(~u)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#function to display the bits\n",
+ "def disp_binary(u):\n",
+ " t=128\n",
+ " while t:\n",
+ " if u&t:\n",
+ " print 1,\n",
+ " else:\n",
+ " print 0,\n",
+ " t=t/2\n",
+ " print \"\"\n",
+ " \n",
+ "#Variable declaration\n",
+ "u=99 #User Input\n",
+ "\n",
+ "print \"Here's the number in binary: \",\n",
+ "disp_binary(u)\n",
+ "\n",
+ "print \"Here's the complement of th number: \",\n",
+ "disp_binary(~u)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Here's the number in binary: 0 1 1 0 0 0 1 1 \nHere's the complement of th number: 1 0 0 1 1 1 0 0 \n"
+ "text": [
+ "Here's the number in binary: 0 1 1 0 0 0 1 1 \n",
+ "Here's the complement of th number: 1 0 0 1 1 1 0 0 \n"
+ ]
}
],
"prompt_number": 5
@@ -195,19 +430,68 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.10, Page Number: 202<h3>"
+ "source": [
+ "<h3>Example 9.10, Page Number: 202<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate bitshifting'''\n\n#unction to display the bits within a byte\ndef disp_binary(u):\n t=128\n while t:\n if u&t:\n print 1,\n else:\n print 0,\n t=t/2\n print \"\"\n \n#Variable dclaration\ni=1\n\n#Result\nfor t in range(8):\n disp_binary(i)\n i=i<<1\n\nprint\"\\n\"\n\nfor t in range(8):\n i=i>>1\n disp_binary(i)\n ",
+ "input": [
+ "\n",
+ "\n",
+ "#unction to display the bits within a byte\n",
+ "def disp_binary(u):\n",
+ " t=128\n",
+ " while t:\n",
+ " if u&t:\n",
+ " print 1,\n",
+ " else:\n",
+ " print 0,\n",
+ " t=t/2\n",
+ " print \"\"\n",
+ " \n",
+ "#Variable dclaration\n",
+ "i=1\n",
+ "\n",
+ "#Result\n",
+ "for t in range(8):\n",
+ " disp_binary(i)\n",
+ " i=i<<1\n",
+ "\n",
+ "print\"\\n\"\n",
+ "\n",
+ "for t in range(8):\n",
+ " i=i>>1\n",
+ " disp_binary(i)\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 0 0 0 0 0 0 1 \n0 0 0 0 0 0 1 0 \n0 0 0 0 0 1 0 0 \n0 0 0 0 1 0 0 0 \n0 0 0 1 0 0 0 0 \n0 0 1 0 0 0 0 0 \n0 1 0 0 0 0 0 0 \n1 0 0 0 0 0 0 0 \n\n\n1 0 0 0 0 0 0 0 \n0 1 0 0 0 0 0 0 \n0 0 1 0 0 0 0 0 \n0 0 0 1 0 0 0 0 \n0 0 0 0 1 0 0 0 \n0 0 0 0 0 1 0 0 \n0 0 0 0 0 0 1 0 \n0 0 0 0 0 0 0 1 \n"
+ "text": [
+ "0 0 0 0 0 0 0 1 \n",
+ "0 0 0 0 0 0 1 0 \n",
+ "0 0 0 0 0 1 0 0 \n",
+ "0 0 0 0 1 0 0 0 \n",
+ "0 0 0 1 0 0 0 0 \n",
+ "0 0 1 0 0 0 0 0 \n",
+ "0 1 0 0 0 0 0 0 \n",
+ "1 0 0 0 0 0 0 0 \n",
+ "\n",
+ "\n",
+ "1 0 0 0 0 0 0 0 \n",
+ "0 1 0 0 0 0 0 0 \n",
+ "0 0 1 0 0 0 0 0 \n",
+ "0 0 0 1 0 0 0 0 \n",
+ "0 0 0 0 1 0 0 0 \n",
+ "0 0 0 0 0 1 0 0 \n",
+ "0 0 0 0 0 0 1 0 \n",
+ "0 0 0 0 0 0 0 1 \n"
+ ]
}
],
"prompt_number": 6
@@ -215,19 +499,43 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.11, Page Number: 204<h3>"
+ "source": [
+ "<h3>Example 9.11, Page Number: 204<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''This program implements ? operator in python'''\n\ndef div_zero():\n print \"Cannot divide by zero.\"\n return 0\n \n#Variable declaration\ni=10 #User Input\nj=0\n\n#This statement prevents a divide by zero\nif j:\n result=i/j\nelse:\n result=div_zero()\n\n#Result\nprint \"Result: \",result",
+ "input": [
+ "\n",
+ "\n",
+ "def div_zero():\n",
+ " print \"Cannot divide by zero.\"\n",
+ " return 0\n",
+ " \n",
+ "#Variable declaration\n",
+ "i=10 #User Input\n",
+ "j=0\n",
+ "\n",
+ "#This statement prevents a divide by zero\n",
+ "if j:\n",
+ " result=i/j\n",
+ "else:\n",
+ " result=div_zero()\n",
+ "\n",
+ "#Result\n",
+ "print \"Result: \",result"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Cannot divide by zero.\nResult: 0\n"
+ "text": [
+ "Cannot divide by zero.\n",
+ "Result: 0\n"
+ ]
}
],
"prompt_number": 7
@@ -235,19 +543,35 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.12, Page Number: 206<h3>"
+ "source": [
+ "<h3>Example 9.12, Page Number: 206<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of the comma operator'''\n\n#Variable declaration\nj=10\ni=None\n\nj+=1\nj+100\ni=999+j\n\n#Result\nprint i",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "j=10\n",
+ "i=None\n",
+ "\n",
+ "j+=1\n",
+ "j+100\n",
+ "i=999+j\n",
+ "\n",
+ "#Result\n",
+ "print i"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1010\n"
+ "text": [
+ "1010\n"
+ ]
}
],
"prompt_number": 1
@@ -255,19 +579,36 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.13, Page Number: 207<h3>"
+ "source": [
+ "<h3>Example 9.13, Page Number: 207<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Demonstrate sizeof'''\n\nfrom ctypes import *\n\n#Variable declaration\nch=c_char\ni=c_int\n\nprint sizeof(ch), #size of char\nprint sizeof(i), #size of int\nprint sizeof(c_float), #size of float\nprint sizeof(c_double) #size of double\n",
+ "input": [
+ "\n",
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "ch=c_char\n",
+ "i=c_int\n",
+ "\n",
+ "print sizeof(ch), #size of char\n",
+ "print sizeof(i), #size of int\n",
+ "print sizeof(c_float), #size of float\n",
+ "print sizeof(c_double) #size of double\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 4 4 8\n"
+ "text": [
+ "1 4 4 8\n"
+ ]
}
],
"prompt_number": 2
@@ -275,19 +616,33 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.14, Page Number: 209<h3>"
+ "source": [
+ "<h3>Example 9.14, Page Number: 209<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Example of pointers'''\n\nfrom ctypes import *\n\n#Variabke declaration \ni=c_int(20) #allocate memory for int\np=pointer(i) #assign a pointer to the memory\n\n#Result\nprint p[0] #proove that it works by displaying value\n",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variabke declaration \n",
+ "i=c_int(20) #allocate memory for int\n",
+ "p=pointer(i) #assign a pointer to the memory\n",
+ "\n",
+ "#Result\n",
+ "print p[0] #proove that it works by displaying value\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "20\n"
+ "text": [
+ "20\n"
+ ]
}
],
"prompt_number": 3
@@ -295,19 +650,33 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.15, Page Number: 210<h3>"
+ "source": [
+ "<h3>Example 9.15, Page Number: 210<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Imlementation of dynamic initialization in python'''\n\nfrom ctypes import *\n\n#Variable declaration \ni=c_int(99) #initialize with 99\np=pointer(i) #assign a pointer to the value\n\n#Result\nprint p[0] #displays 99\n",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration \n",
+ "i=c_int(99) #initialize with 99\n",
+ "p=pointer(i) #assign a pointer to the value\n",
+ "\n",
+ "#Result\n",
+ "print p[0] #displays 99\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "99\n"
+ "text": [
+ "99\n"
+ ]
}
],
"prompt_number": 4
@@ -315,19 +684,38 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.16, Page Number: 211<h3>"
+ "source": [
+ "<h3>Example 9.16, Page Number: 211<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Imlementation of dynamic initialization in python'''\n\nfrom ctypes import *\n\n#Variable declaration \ni=c_double(10) \np=pointer(i)\n\n#assign the values 100 to 109\nfor i in range(10):\n p[i]=100.00+i\n\n#display the contents of the array\nfor i in range(10):\n print p[i],\n",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration \n",
+ "i=c_double(10) \n",
+ "p=pointer(i)\n",
+ "\n",
+ "#assign the values 100 to 109\n",
+ "for i in range(10):\n",
+ " p[i]=100.00+i\n",
+ "\n",
+ "#display the contents of the array\n",
+ "for i in range(10):\n",
+ " print p[i],\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0\n"
+ "text": [
+ "100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0\n"
+ ]
}
],
"prompt_number": 5
@@ -335,19 +723,38 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.17, Page Number: 211<h3>"
+ "source": [
+ "<h3>Example 9.17, Page Number: 211<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of malloc int python'''\n\n#Variable declaration\ni=c_int() \nj=c_double()\npi=pointer(i) #pointer to int\npj=pointer(j) #pointer to double\n\n#Assign values using pointers\npi[0]=10\npj[0]=100.123\n\n#Result\nprint pi[0],pj[0]\n\n",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "i=c_int() \n",
+ "j=c_double()\n",
+ "pi=pointer(i) #pointer to int\n",
+ "pj=pointer(j) #pointer to double\n",
+ "\n",
+ "#Assign values using pointers\n",
+ "pi[0]=10\n",
+ "pj[0]=100.123\n",
+ "\n",
+ "#Result\n",
+ "print pi[0],pj[0]\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 100.123\n"
+ "text": [
+ "10 100.123\n"
+ ]
}
],
"prompt_number": 6
@@ -355,19 +762,45 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 9.18, Page Number: 212<h3>"
+ "source": [
+ "<h3>Example 9.18, Page Number: 212<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Implementation of dynamic memory allocation'''\nfrom ctypes import *\n\n#Variable declaration\ni=pointer(c_int())\nj=pointer(c_double())\n\n#Checking if i and j have been allocated memory addresses\nif not(id(i)):\n print \"Allocation Failure.\"\n \nif not(id(j)):\n print \"Allocation Failure.\" \n\ni[0]=10\nj[0]=100.123\n\n\n#Result\nprint i[0],j[0]\n\n",
+ "input": [
+ "\n",
+ "from ctypes import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "i=pointer(c_int())\n",
+ "j=pointer(c_double())\n",
+ "\n",
+ "#Checking if i and j have been allocated memory addresses\n",
+ "if not(id(i)):\n",
+ " print \"Allocation Failure.\"\n",
+ " \n",
+ "if not(id(j)):\n",
+ " print \"Allocation Failure.\" \n",
+ "\n",
+ "i[0]=10\n",
+ "j[0]=100.123\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print i[0],j[0]\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 100.123\n"
+ "text": [
+ "10 100.123\n"
+ ]
}
],
"prompt_number": 11
@@ -375,7 +808,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch1.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch1.ipynb
index 79c81a76..37aa04ae 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch1.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch1"
+ "name": "",
+ "signature": "sha256:c628e15db0bd7c4697d070eda00c000c028cdbc1d271898882fdd16c63c0f120"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,18 +12,27 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter One : Naming"
+ "source": [
+ "Chapter One : Naming"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 1.1 Page no : 2 \n"
+ "source": [
+ "EXAMPLE 1.1 Page no : 2 \n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nNaming a variable\n'''\n\nstrL = 0 # Not recommended\nstringLength = 0 # Recommended",
+ "input": [
+ "\n",
+ "\n",
+ "strL = 0 # Not recommended\n",
+ "stringLength = 0 # Recommended"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -32,19 +42,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2 Page no : 3\n"
+ "source": [
+ "Example 2 Page no : 3\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nDifferent ways to print an object\n'''\n\nclass EmcFruit:\n def print_(self):\n pass\n\nclass EmcApple(EmcFruit):\n def print_(self):\n pass\n\nfp = EmcApple()\nprint fp ",
+ "input": [
+ "\n",
+ "\n",
+ "class EmcFruit:\n",
+ " def print_(self):\n",
+ " pass\n",
+ "\n",
+ "class EmcApple(EmcFruit):\n",
+ " def print_(self):\n",
+ " pass\n",
+ "\n",
+ "fp = EmcApple()\n",
+ "print fp "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "<__main__.EmcApple instance at 0x9d29c8c>\n"
+ "text": [
+ "<__main__.EmcApple instance at 0x9d29c8c>\n"
+ ]
}
],
"prompt_number": 2
@@ -53,19 +80,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 1.3 Page no : 4\n"
+ "source": [
+ "EXAMPLE 1.3 Page no : 4\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nNaming accessors and modifiers\n'''\nclass Point:\n def __init__(self,a,b):\n self.x = a\n self.y = b\n def x1(self,a):\n self.x = a\n\np = Point(0,0) # a point in a 2-dimensional space\np.x1(1); # set X-coordinate\nprint p.x # prints X-coordinate, \"1\"",
+ "input": [
+ "\n",
+ "class Point:\n",
+ " def __init__(self,a,b):\n",
+ " self.x = a\n",
+ " self.y = b\n",
+ " def x1(self,a):\n",
+ " self.x = a\n",
+ "\n",
+ "p = Point(0,0) # a point in a 2-dimensional space\n",
+ "p.x1(1); # set X-coordinate\n",
+ "print p.x # prints X-coordinate, \"1\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
}
],
"prompt_number": 3
@@ -74,12 +117,21 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 1.4 page no : 4\n"
+ "source": [
+ "EXAMPLE 1.4 page no : 4\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nNames used by a template function\n'''\n\n# typename to mark a qualified name as a type name.\ndef check_assign(a,i,t):\n if (i < len(a)):\n a[i] = t;",
+ "input": [
+ "\n",
+ "\n",
+ "# typename to mark a qualified name as a type name.\n",
+ "def check_assign(a,i,t):\n",
+ " if (i < len(a)):\n",
+ " a[i] = t;"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -89,12 +141,21 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 1.5 Page no : 6\n"
+ "source": [
+ "EXAMPLE 1.5 Page no : 6\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nNamespace\nA namespace is a declarative region in which classes, functions, types and templates\ncan be defined.\nNote : Python doesn't have concept of namespace.\n\n'''\nclass String:\n pass\n\nclass DynamicArray:\n pass",
+ "input": [
+ "\n",
+ "class String:\n",
+ " pass\n",
+ "\n",
+ "class DynamicArray:\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -104,12 +165,19 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 1.6 page no : 6\n"
+ "source": [
+ "EXAMPLE 1.6 page no : 6\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nAccessing names from namespace\nNote : Python doesn't have namespace.\n'''\na = 'aaa' \ns1 = 'xyz'\ns = 'abc' # Emc::String s;\n",
+ "input": [
+ "\n",
+ "a = 'aaa' \n",
+ "s1 = 'xyz'\n",
+ "s = 'abc' # Emc::String s;\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -119,12 +187,18 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 1.8 page no : 7\n"
+ "source": [
+ "EXAMPLE 1.8 page no : 7\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nClass names with prefixes\nNote : this will give error because file doesn't have class EmcString and OtherString.\n'''\ns1 = EmcString() # Belongs to the Emc Class Library\ns2 = OtherString() # Belongs to the Other Class Library",
+ "input": [
+ "\n",
+ "s1 = EmcString() # Belongs to the Emc Class Library\n",
+ "s2 = OtherString() # Belongs to the Other Class Library"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -145,12 +219,18 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 1.9 Page no : 8\n"
+ "source": [
+ "EXAMPLE 1.9 Page no : 8\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nNames of include files\n\nNote : this would give error because we dont have packages written here.\n'''\nimport RWCstring #include \"RWCstring.h\" /* Recommended */\nfrom rw import cstring #include \"rw/cstring.h\" /* Sometimes needed */",
+ "input": [
+ "\n",
+ "import RWCstring #include \"RWCstring.h\" /* Recommended */\n",
+ "from rw import cstring #include \"rw/cstring.h\" /* Sometimes needed */"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -171,12 +251,20 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 1.10 page no : 9\n"
+ "source": [
+ "EXAMPLE 1.10 page no : 9\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nUse of underscores in names\n'''\n\ni__j = 11;\n_K = 22;\n_m = 33;\n",
+ "input": [
+ "\n",
+ "\n",
+ "i__j = 11;\n",
+ "_K = 22;\n",
+ "_m = 33;\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -185,7 +273,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch10.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch10.ipynb
index 45094edc..2951ba7c 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch10.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch10.ipynb
@@ -1,249 +1,508 @@
{
"metadata": {
- "name": "ch10"
- },
- "name": "ch10",
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:605cfaa74a14889610adf1b63bc80cf152287815885aa99d6c7f0c182f62cc6b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
- "source": "<h1> Chapter Ten : Object-oriented programming </h1>"
- },
- {
- "cell_type": "markdown",
- "source": "<h3>Example 10.1 page no :105"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nReturning non-const reference to object\n'''\n\ns = \"hello\" # length() == 5\nprint s\nprint len(s)",
- "language": "python",
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1> Chapter Ten : Object-oriented programming </h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 10.1 page no :105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "s = \"hello\" # length() == 5\n",
+ "print s\n",
+ "print len(s)"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "hello\n5"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "hello\n",
+ "5"
+ ]
}
- ],
+ ],
"prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.2 page no : 106"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nAssigning to string element\n'''\ns = \"Hello\"\n#s[0] = 'h'\ns = s.lower()\nprint s",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.2 page no : 106"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "s = \"Hello\"\n",
+ "#s[0] = 'h'\n",
+ "s = s.lower()\n",
+ "print s"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "hello"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "hello"
+ ]
}
- ],
+ ],
"prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "source": "<h3> example 10.3 page no :107"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nfactory class\n\nNote : Python does not have virtual function concept.\n\n'''\n\nclass EmcCollection:\n # insert one element\n def insert(self,t):\n pass\n \n def operator(self, coll):\n pass\n\nclass EmcArrayCollection(EmcCollection):\n initialSize = 10\n\n def __init__(self,maxsize):\n pass\n\n\nclass InvalidCollectionType(EmcException):\n \n def __init__(self,i):\n pass\n\nclass EmcCollectionFactory:\n def __init__(self):\n pass\n\n def create(self,type):\n pass\n\n def createArray(self):\n pass",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> example 10.3 page no :107"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "class EmcCollection:\n",
+ " # insert one element\n",
+ " def insert(self,t):\n",
+ " pass\n",
+ " \n",
+ " def operator(self, coll):\n",
+ " pass\n",
+ "\n",
+ "class EmcArrayCollection(EmcCollection):\n",
+ " initialSize = 10\n",
+ "\n",
+ " def __init__(self,maxsize):\n",
+ " pass\n",
+ "\n",
+ "\n",
+ "class InvalidCollectionType(EmcException):\n",
+ " \n",
+ " def __init__(self,i):\n",
+ " pass\n",
+ "\n",
+ "class EmcCollectionFactory:\n",
+ " def __init__(self):\n",
+ " pass\n",
+ "\n",
+ " def create(self,type):\n",
+ " pass\n",
+ "\n",
+ " def createArray(self):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "ename": "NameError",
- "evalue": "name 'EmcException' is not defined",
- "output_type": "pyerr",
+ "ename": "NameError",
+ "evalue": "name 'EmcException' is not defined",
+ "output_type": "pyerr",
"traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m/home/jay/<ipython-input-3-5d8a499d2644>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 24\u001b[0;31m \u001b[0;32mclass\u001b[0m \u001b[0mInvalidCollectionType\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mEmcException\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 25\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m/home/jay/<ipython-input-3-5d8a499d2644>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 24\u001b[0;31m \u001b[0;32mclass\u001b[0m \u001b[0mInvalidCollectionType\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mEmcException\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 25\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'EmcException' is not defined"
]
}
- ],
+ ],
"prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "source": "<h3>example 10.4 page no :109"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\ndynamic binding\nNote : This program will give you error as there is no any class declared in this program.\n'''\n\nfactory = EmcCollectionFactory()\ncollection = factory.create(ArrayId)\ncollection.insert(42); # EmcArrayCollection<int>::insert() is called\nprint collection",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>example 10.4 page no :109"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "factory = EmcCollectionFactory()\n",
+ "collection = factory.create(ArrayId)\n",
+ "collection.insert(42); # EmcArrayCollection<int>::insert() is called\n",
+ "print collection"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "ename": "NameError",
- "evalue": "name 'EmcCollectionFactory' is not defined",
- "output_type": "pyerr",
+ "ename": "NameError",
+ "evalue": "name 'EmcCollectionFactory' is not defined",
+ "output_type": "pyerr",
"traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m/home/jay/<ipython-input-4-9ee6096719fb>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mfactory\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mEmcCollectionFactory\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mcollection\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfactory\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mArrayId\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mcollection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minsert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m42\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m \u001b[0;31m# EmcArrayCollection<int>::insert() is called\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m/home/jay/<ipython-input-4-9ee6096719fb>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mfactory\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mEmcCollectionFactory\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mcollection\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfactory\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mArrayId\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mcollection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minsert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m42\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m \u001b[0;31m# EmcArrayCollection<int>::insert() is called\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'EmcCollectionFactory' is not defined"
]
}
- ],
+ ],
"prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "source": "<h3>example 10.5 page no : 111"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\ndeleting object\n'''\nclass EmcCollection:\n def __del__(self):\n pass\n\nclass EmcArrayCollection( EmcCollection):\n def __del__(self):\n pass",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>example 10.5 page no : 111"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "ting object\n",
+ "'''\n",
+ "class EmcCollection:\n",
+ " def __del__(self):\n",
+ " pass\n",
+ "\n",
+ "class EmcArrayCollection( EmcCollection):\n",
+ " def __del__(self):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "source": "<h3>example 10.6 page no :112"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nvirtual base class\n'''\nclass EmcLogged:\n def writeClassName(self,o):\n pass\n\n def writeValue(self,o):\n pass\n\n def logMessage(self,message):\n pass\n\n def __del__(self):\n pass\n\nclass EmcLoggedCollection(EmcCollection):\n\n def writeValue(self,o):\n pass\n\n def __del__(self):\n pass ",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>example 10.6 page no :112"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class EmcLogged:\n",
+ " def writeClassName(self,o):\n",
+ " pass\n",
+ "\n",
+ " def writeValue(self,o):\n",
+ " pass\n",
+ "\n",
+ " def logMessage(self,message):\n",
+ " pass\n",
+ "\n",
+ " def __del__(self):\n",
+ " pass\n",
+ "\n",
+ "class EmcLoggedCollection(EmcCollection):\n",
+ "\n",
+ " def writeValue(self,o):\n",
+ " pass\n",
+ "\n",
+ " def __del__(self):\n",
+ " pass "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.7 Page no : 117"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nPre- and postconditions\n'''\n\n\nclass EmcIntStack:\n def empty(self):\n pass\n\n def full(self):\n pass\n \n def top(self):\n pass\n \n def push(self,i):\n pass\n \n def pop(self):\n pass",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.7 Page no : 117"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "class EmcIntStack:\n",
+ " def empty(self):\n",
+ " pass\n",
+ "\n",
+ " def full(self):\n",
+ " pass\n",
+ " \n",
+ " def top(self):\n",
+ " pass\n",
+ " \n",
+ " def push(self,i):\n",
+ " pass\n",
+ " \n",
+ " def pop(self):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 7
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.8 Page no : 117"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nUsing member function with precondition\n'''\n\ndef makeString(stack):\n returnValue = ''\n copy = stack\n while (not copy.empty()):\n # loop condition makes precondition valid\n print copy.pop() # Precondition: ! copy.empty()\n returnValue += copy.pop\n\n return returnValue;",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.8 Page no : 117"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "def makeString(stack):\n",
+ " returnValue = ''\n",
+ " copy = stack\n",
+ " while (not copy.empty()):\n",
+ " # loop condition makes precondition valid\n",
+ " print copy.pop() # Precondition: ! copy.empty()\n",
+ " returnValue += copy.pop\n",
+ "\n",
+ " return returnValue;"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 8
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.9 page no : 118"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nClass with invariant\n'''\n\nclass EmcString:\n def cStr(self):\n pass\n # cStr() returns 0-terminated string\n\n def length(self):\n pass",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.9 page no : 118"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "class EmcString:\n",
+ " def cStr(self):\n",
+ " pass\n",
+ " # cStr() returns 0-terminated string\n",
+ "\n",
+ " def length(self):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 9
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.10 page no : 119"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nUsing comments to specify class template\n'''\n\nclass EmcCollection:\n def __del__(self):\n pass\n\n def insert(self,T):\n pass\n\n def clear(self):\n pass\n\n def remove(self):\n pass",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.10 page no : 119"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "class EmcCollection:\n",
+ " def __del__(self):\n",
+ " pass\n",
+ "\n",
+ " def insert(self,T):\n",
+ " pass\n",
+ "\n",
+ " def clear(self):\n",
+ " pass\n",
+ "\n",
+ " def remove(self):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 10
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.11 page no : 120"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nChecking precondition\nNote : This program will give error as it has no declaration of EmcCollectionFactory\n'''\n\nfactrory = EmcCollectionFactory()\ncollection = factory.create(ArrayId);\nif (not collection.isFull()):\n collection.insert(42);",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.11 page no : 120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "factrory = EmcCollectionFactory()\n",
+ "collection = factory.create(ArrayId);\n",
+ "if (not collection.isFull()):\n",
+ " collection.insert(42);"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "ename": "NameError",
- "evalue": "name 'EmcCollectionFactory' is not defined",
- "output_type": "pyerr",
+ "ename": "NameError",
+ "evalue": "name 'EmcCollectionFactory' is not defined",
+ "output_type": "pyerr",
"traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m/home/jay/<ipython-input-11-0508dec5ea10>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mfactrory\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mEmcCollectionFactory\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mcollection\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfactory\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mArrayId\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;32mnot\u001b[0m \u001b[0mcollection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misFull\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m/home/jay/<ipython-input-11-0508dec5ea10>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mfactrory\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mEmcCollectionFactory\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mcollection\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfactory\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mArrayId\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;32mnot\u001b[0m \u001b[0mcollection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misFull\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'EmcCollectionFactory' is not defined"
]
}
- ],
+ ],
"prompt_number": 11
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.12 page no : 121"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nSubstitutability\n'''\n\n# insertObject() works for any class with\n# EmcCollection<T> as public base class.\ndef insertObject(c,element):\n # throw (bad_alloc)\n # return false if insertion fails, true otherwise\n if (not c.isFull()):\n c.insert(element)\n return True\n return False",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.12 page no : 121"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "# insertObject() works for any class with\n",
+ "# EmcCollection<T> as public base class.\n",
+ "def insertObject(c,element):\n",
+ " # throw (bad_alloc)\n",
+ " # return false if insertion fails, true otherwise\n",
+ " if (not c.isFull()):\n",
+ " c.insert(element)\n",
+ " return True\n",
+ " return False"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 12
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.13 Page no : 121"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nSpecification of overriden member function\n'''\n\ndef insert(T):\n pass",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.13 Page no : 121"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "def insert(T):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 13
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.14 page no : 123"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nDescribing template argument requirements\n'''\n\n# T must be: DefaultConstructible\n# copyConstructible\n# Assignable\n# Destructible\n# EqualityComparable\n\nclass EmcCollection:\n pass",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.14 page no : 123"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "# T must be: DefaultConstructible\n",
+ "# copyConstructible\n",
+ "# Assignable\n",
+ "# Destructible\n",
+ "# EqualityComparable\n",
+ "\n",
+ "class EmcCollection:\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 14
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 10.15 page no : 124"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nChecking type constraints\n'''\nclass EmcCollection:\n def templateRequirements(self):\n pass\n\n def templateRequirements(self):\n # T must be:\n t1 = T1()\n # DefaultContructible\n t2 =t1\n # CopyConstructible\n t2 = t1;\n # Assignable\n b = (t2 == t1); # EqualityComparable",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 10.15 page no : 124"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class EmcCollection:\n",
+ " def templateRequirements(self):\n",
+ " pass\n",
+ "\n",
+ " def templateRequirements(self):\n",
+ " # T must be:\n",
+ " t1 = T1()\n",
+ " # DefaultContructible\n",
+ " t2 =t1\n",
+ " # CopyConstructible\n",
+ " t2 = t1;\n",
+ " # Assignable\n",
+ " b = (t2 == t1); # EqualityComparable"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 15
- },
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [],
+ "language": "python",
+ "metadata": {},
"outputs": []
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch11.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch11.ipynb
index b08fdb2b..a7fe619a 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch11.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch11.ipynb
@@ -1,48 +1,80 @@
{
"metadata": {
- "name": "ch11"
- },
- "name": "ch11",
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:8fd9f65c8a3cbb619fe291dbff540345e03b3be12cb5c6908ed137d152dc018d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
- "source": "<h1>Chapter Eleven : Assertions"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter Eleven : Assertions"
+ ]
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 11.1 page no : 130"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 11.1 page no : 130"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nStandard assert macro\n'''\n\ndef check(answer):\n assert answer ==42",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "def check(answer):\n",
+ " assert answer ==42"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 11.2 page no : 131"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 11.2 page no : 131"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nAssertions and exceptions\n'''\n# Checked version\nclass EmcString:\n def at(self,index):\n if (index >= self.lengthM):\n raise Exception;\n return self.cpM[index];\n\n # Unchecked version\n def operator(self,index):\n assert(index < self.lengthM)\n return self.cpM[index];",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "# Checked version\n",
+ "class EmcString:\n",
+ " def at(self,index):\n",
+ " if (index >= self.lengthM):\n",
+ " raise Exception;\n",
+ " return self.cpM[index];\n",
+ "\n",
+ " # Unchecked version\n",
+ " def operator(self,index):\n",
+ " assert(index < self.lengthM)\n",
+ " return self.cpM[index];"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 2
- },
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [],
+ "language": "python",
+ "metadata": {},
"outputs": []
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch12.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch12.ipynb
index 80b28b9c..d96329cd 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch12.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch12.ipynb
@@ -1,185 +1,367 @@
{
"metadata": {
- "name": "ch12"
- },
- "name": "ch12",
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:de2e0bed7b67eb2329c8c600e57f29ce4e5a2c157d6a6ad64246d09e0189ed52"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
- "source": "<h1>Chapter Twelve : Error handling"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter Twelve : Error handling"
+ ]
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.1 page no : 135"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.1 page no : 135"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nChecking status value\nNote : we dont have socket function so would give error.\n'''\n'''\nThe socket() function is a UNIX library function that creates a communication\nchannel between two processes. If the call succeeds, it returns a socket file descriptor\nthat is >= 0, otherwise -1 is returned.\n// create socket\n'''\nsocketfd = socket(AF_UNIX, SOCK_STREAM, 0);\nif(socketfd < 0):\n pass",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "socketfd = socket(AF_UNIX, SOCK_STREAM, 0);\n",
+ "if(socketfd < 0):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "ename": "NameError",
- "evalue": "name 'socket' is not defined",
- "output_type": "pyerr",
+ "ename": "NameError",
+ "evalue": "name 'socket' is not defined",
+ "output_type": "pyerr",
"traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m/home/jay/<ipython-input-1-7161141a3c7c>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;34m//\u001b[0m \u001b[0mcreate\u001b[0m \u001b[0msocket\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m '''\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0msocketfd\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msocket\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mAF_UNIX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSOCK_STREAM\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0;32mif\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msocketfd\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m/home/jay/<ipython-input-1-7161141a3c7c>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;34m//\u001b[0m \u001b[0mcreate\u001b[0m \u001b[0msocket\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m '''\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0msocketfd\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msocket\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mAF_UNIX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSOCK_STREAM\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0;32mif\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msocketfd\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'socket' is not defined"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.2 page no : 136"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.2 page no : 136"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nThrowing an exception\nOne way to encapsulate the UNIX system calls is to provide a wrapper function that\nthrows an exception instead of returning a status value.\n'''\nclass EmcException:\n def operator(self,n):\n pass\n\nclass EmcSystemException( EmcException):\n def __init__(self,m):\n pass\n \n def emcSocket(self,family,t,protocol):\n # create socket\n socketfd = socket(family, t, protocol);\n if (socketfd < 0): # check status value\n raise EmcSystemException(\"emcSocket\");\n return socketfd;",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class EmcException:\n",
+ " def operator(self,n):\n",
+ " pass\n",
+ "\n",
+ "class EmcSystemException( EmcException):\n",
+ " def __init__(self,m):\n",
+ " pass\n",
+ " \n",
+ " def emcSocket(self,family,t,protocol):\n",
+ " # create socket\n",
+ " socketfd = socket(family, t, protocol);\n",
+ " if (socketfd < 0): # check status value\n",
+ " raise EmcSystemException(\"emcSocket\");\n",
+ " return socketfd;"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.3 page no : 139"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.3 page no : 139"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nMember function with precondition\nnote : only constructor is given.\n'''\n\ndef __init__(self,cp):\n self.lengthM = len(cp)\n self.cpM = cp",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "def __init__(self,cp):\n",
+ " self.lengthM = len(cp)\n",
+ " self.cpM = cp"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 13
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.5 page no : 141"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.5 page no : 141"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nPreventing exceptions inside destructors\nNote : uncaught_exception() is not defined here so it would give error.\n'''\nclass EmcLog:\n def __init__(self,filename):\n pass\n\n def message(self,EmcString):\n pass\n\n def __del__(self):\n if uncaught_exception():\n self.flush()\n \n def flush(self):\n if ( not uncaught_exception()):\n raise EmcSystemException(\"EmcLog::flush()\")",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class EmcLog:\n",
+ " def __init__(self,filename):\n",
+ " pass\n",
+ "\n",
+ " def message(self,EmcString):\n",
+ " pass\n",
+ "\n",
+ " def __del__(self):\n",
+ " if uncaught_exception():\n",
+ " self.flush()\n",
+ " \n",
+ " def flush(self):\n",
+ " if ( not uncaught_exception()):\n",
+ " raise EmcSystemException(\"EmcLog::flush()\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.6 page no : 142"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.6 page no : 142"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nException class constructor\n'''\nclass EmcException:\n def __init__(self,m):\n maxSizeM = 100\n actualLength = len(m);\n self.lengthM = min(maxSizeM,actualLength);\n self.messageM = message",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class EmcException:\n",
+ " def __init__(self,m):\n",
+ " maxSizeM = 100\n",
+ " actualLength = len(m);\n",
+ " self.lengthM = min(maxSizeM,actualLength);\n",
+ " self.messageM = message"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.7"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.7"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nUnsafe memory allocation\nNote : Python does memory allocation by it self. no need to allocate explicitely.\n'''\n\ndef f():\n ip = 1\n g(ip)\n\n# Not recommended\n# create int with new\ndef g(i):\n raise Exception(i)",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "def f():\n",
+ " ip = 1\n",
+ " g(ip)\n",
+ "\n",
+ "# Not recommended\n",
+ "# create int with new\n",
+ "def g(i):\n",
+ " raise Exception(i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.8 page no : 146"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.8 page no : 146"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nHaving a try-block to manage memory\n\nIt is possible to rewrite our previous example so that the memory leak is avoided with-\nout introducing any new classes. The function should have a try-block with a handler\nthat catches all possible exceptions.\n'''\n\ndef f():\n ip = 1\n g(ip)\n\n# Not recommended\n# create int with new\ndef g(i):\n raise Exception(i)",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "def f():\n",
+ " ip = 1\n",
+ " g(ip)\n",
+ "\n",
+ "# Not recommended\n",
+ "# create int with new\n",
+ "def g(i):\n",
+ " raise Exception(i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.9 page no :146"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.9 page no :146"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nException safe allocation of free store objects\n\n'''\ndef f():\n ip = 1\n g(ip)",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "def f():\n",
+ " ip = 1\n",
+ " g(ip)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.10 page no : 148"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.10 page no : 148"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nException safe copy assignment operator\nThe template EmcStack uses a built-in array, vectorM, to store copies of objects.\nThe pointer topM stores an index to the next element in the array to assign. The data\nmember allocatedM stores the number of currently allocated objects, and is always\na positive number.\n'''\n\nclass EmcStack:\n defaultSizeM = 100\n def __init__(self,size = 100):\n pass\n\n def __del__(self):\n pass\n\n def operator(self,s):\n pass\n\n def empty(self):\n pass\n \n def top(self):\n pass\n\n def push(self,i):\n pass\n \n def pop(self):\n pass",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class EmcStack:\n",
+ " defaultSizeM = 100\n",
+ " def __init__(self,size = 100):\n",
+ " pass\n",
+ "\n",
+ " def __del__(self):\n",
+ " pass\n",
+ "\n",
+ " def operator(self,s):\n",
+ " pass\n",
+ "\n",
+ " def empty(self):\n",
+ " pass\n",
+ " \n",
+ " def top(self):\n",
+ " pass\n",
+ "\n",
+ " def push(self,i):\n",
+ " pass\n",
+ " \n",
+ " def pop(self):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.12 page no : 151"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.12 page no : 151"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nInheritance of exception classes\nIt is good to have a general exception class at the top that allows you to print a descrip-\ntion of the error. Most users are satisfied with knowing what went wrong and would\nonly have one handler for a whole hierarchy of exception classes.\nIn our examples we have used the class EmcException, that stores strings that\ndescribe the error condition.\n'''\nclass EmcException:\n def __init__(self,m):\n pass\n # EmcException objects can be printed\n\n def operator(self,o,EmcException):\n pass\n\n def printOn(self,o): \n print self.messageM;",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class EmcException:\n",
+ " def __init__(self,m):\n",
+ " pass\n",
+ " # EmcException objects can be printed\n",
+ "\n",
+ " def operator(self,o,EmcException):\n",
+ " pass\n",
+ "\n",
+ " def printOn(self,o): \n",
+ " print self.messageM;"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.13 page no : 153"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.13 page no : 153"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nHandling many exceptions with one handler\nA handler for EmcException can be used to handle an EmcSystemException,\nsince the latter class inherits from EmcException.\nNote : emcSocket() is not defined here. so would give error.\n'''\ntry:\n socketfd = emcSocket(AF_UNIX, SOCK_STREAM, 0);\nexcept Exception,e:\n print e",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "try:\n",
+ " socketfd = emcSocket(AF_UNIX, SOCK_STREAM, 0);\n",
+ "except Exception,e:\n",
+ " print e"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "name 'emcSocket' is not defined"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "name 'emcSocket' is not defined"
+ ]
}
- ],
+ ],
"prompt_number": 11
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 12.14 page no : 155"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 12.14 page no : 155"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nException specification\n'''\n\ndef at(s,pos):\n if (pos > len(s)):\n raise Exception;",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "def at(s,pos):\n",
+ " if (pos > len(s)):\n",
+ " raise Exception;"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 12
- },
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [],
+ "language": "python",
+ "metadata": {},
"outputs": []
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch13.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch13.ipynb
index 99e0fb38..126df2ad 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch13.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch13.ipynb
@@ -1,210 +1,355 @@
{
"metadata": {
- "name": "ch13"
- },
- "name": "ch13",
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:bbeb97ae5d957eb9274ccf64bc1e7f46b7b45c306736856a8df6cdc589631d7d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
- "source": "<h1> Chapter Thirteen : Parts of C++ to avoid"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1> Chapter Thirteen : Parts of C++ to avoid"
+ ]
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.1 page no : 159"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.1 page no : 159"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nC-style I/O is not adequate for objects\n'''\n\ns = 'abc' #raw_input()\nprint s",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "s = 'abc' #raw_input()\n",
+ "print s"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "abc"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "abc"
+ ]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.2 page no : 160"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.2 page no : 160"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nPassing objects to printf()\nThe function printf() should not be given an object as argument even if the object\nis of a class that can be implicitly converted to a type that printf() knows how to\nhandle.\n'''\nclass DangerousString:\n def __init__(self,cp):\n pass\n \n def char(self):\n pass\n\nhello = \"Hello World!\";\nprint hello # Works perfectly\nprint \"%s\"%hello",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "class DangerousString:\n",
+ " def __init__(self,cp):\n",
+ " pass\n",
+ " \n",
+ " def char(self):\n",
+ " pass\n",
+ "\n",
+ "hello = \"Hello World!\";\n",
+ "print hello # Works perfectly\n",
+ "print \"%s\"%hello"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "Hello World!\nHello World!"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Hello World!\n",
+ "Hello World!"
+ ]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.3 page no : 160"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.3 page no : 160"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nOverloading of operator<<\n'''\nclass EmcString:\n def __init__(self,cp):\n pass\n\n\ns = \"Hello World!\";\nprint s ",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "class EmcString:\n",
+ " def __init__(self,cp):\n",
+ " pass\n",
+ "\n",
+ "\n",
+ "s = \"Hello World!\";\n",
+ "print s "
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "Hello World!"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Hello World!"
+ ]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.4 page no :161"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.4 page no :161"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nMacros do not obey scope rules\n'''\n#define SIZE 1024\nSIZE = 1024;\nprint SIZE",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#define SIZE 1024\n",
+ "SIZE = 1024;\n",
+ "print SIZE"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "1024"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1024"
+ ]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.5 page no : 162"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.5 page no : 162"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nRecommended way to define constants\nYou can often define constants within a class.\n'''\nclass X:\n class Color:\n green = 1\n yellow = 2\n red = 3",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class X:\n",
+ " class Color:\n",
+ " green = 1\n",
+ " yellow = 2\n",
+ " red = 3"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.6 page no : 162"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.6 page no : 162"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nUsing an enum instead of static const int\nOlder compilers will not allow you to define ordinary constants inside a class. A com-\nmon trick is to use an anonymous enum instead.\n'''\nclass X:\n maxBuf = 1024\n class Color:\n green = 1\n yellow = 2\n red = 3",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class X:\n",
+ " maxBuf = 1024\n",
+ " class Color:\n",
+ " green = 1\n",
+ " yellow = 2\n",
+ " red = 3"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.7 page no : 162"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.7 page no : 162"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nFunction-like macro, SQUARE\n'''\n# Not recommended to have function-like macro\ndef SQUARE(x):\n return x*x\n\ni = SQUARE(3 + 4); \nprint i",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Not recommended to have function-like macro\n",
+ "def SQUARE(x):\n",
+ " return x*x\n",
+ "\n",
+ "i = SQUARE(3 + 4); \n",
+ "print i"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "49"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "49"
+ ]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.8 page no : 163"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.8 page no : 163"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nInline function, square\n'''\ndef square(x):\n return x * x;\nc = 2;\nd = square(c)\nprint d",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def square(x):\n",
+ " return x * x;\n",
+ "c = 2;\n",
+ "d = square(c)\n",
+ "print d"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "4"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "4"
+ ]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.9 page no : 163"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.9 page no : 163"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nFunction-like macros are not type safe\nNote : this would give error.\n'''\ndef SQUARE(x):\n return x*x\ni = SQUARE(\"hello\");\nprint i",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def SQUARE(x):\n",
+ " return x*x\n",
+ "i = SQUARE(\"hello\");\n",
+ "print i"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "ename": "TypeError",
- "evalue": "can't multiply sequence by non-int of type 'str'",
- "output_type": "pyerr",
+ "ename": "TypeError",
+ "evalue": "can't multiply sequence by non-int of type 'str'",
+ "output_type": "pyerr",
"traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m/home/jay/<ipython-input-10-df398cb9cbc0>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0mi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"hello\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 9\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;32m/home/jay/<ipython-input-10-df398cb9cbc0>\u001b[0m in \u001b[0;36mSQUARE\u001b[0;34m(x)\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"hello\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m/home/jay/<ipython-input-10-df398cb9cbc0>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0mi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"hello\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 9\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;32m/home/jay/<ipython-input-10-df398cb9cbc0>\u001b[0m in \u001b[0;36mSQUARE\u001b[0;34m(x)\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"hello\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTypeError\u001b[0m: can't multiply sequence by non-int of type 'str'"
]
}
- ],
+ ],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.10 page no : 163"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.10 page no : 163"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nHow to define synonyms for a type\nNote : Python doesnot have synonyms for type as we do not have to explicitely \ndeclare variables.\n'''\n#define Velocity int\n#typedef int Velocity;\n# Not recommended",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#define Velocity int\n",
+ "#typedef int Velocity;\n",
+ "# Not recommended"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "pyout",
- "prompt_number": 11,
- "text": "'\\nEXAMPLE 13.10 page no : 163\\nHow to define synonyms for a type\\nNote : Python doesnot have synonyms for type as we do not have to explicitely \\ndeclare variables.\\n'"
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 11,
+ "text": [
+ "'\\nEXAMPLE 13.10 page no : 163\\nHow to define synonyms for a type\\nNote : Python doesnot have synonyms for type as we do not have to explicitely \\ndeclare variables.\\n'"
+ ]
}
- ],
+ ],
"prompt_number": 11
- },
+ },
{
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 13.11 page no : 164"
- },
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 13.11 page no : 164"
+ ]
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nPassing array to function\n'''\n\n# Fruit is a base class\ndef printFruits(fruits,size):\n # Not recommended to pass arrays to functions\n for i in range(size):\n print fruits[i] ",
- "language": "python",
- "outputs": [],
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "# Fruit is a base class\n",
+ "def printFruits(fruits,size):\n",
+ " # Not recommended to pass arrays to functions\n",
+ " for i in range(size):\n",
+ " print fruits[i] "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 12
- },
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [],
+ "language": "python",
+ "metadata": {},
"outputs": []
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch15.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch15.ipynb
index b01dfcea..9ba32dd4 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch15.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch15.ipynb
@@ -1,363 +1,626 @@
{
"metadata": {
- "name": "ch15"
- },
- "name": "ch15",
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:7951193995e49370edf3fafb6d685d317214f33d43101f294ebf8961471bb078"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
- "source": "<h1> Chapter Fifteen : Portability"
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.1 page no : 172"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nImplementation-defined behavior\n'''\nc = -100;\nif (c < 0):\n pass",
- "language": "python",
- "outputs": [],
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1> Chapter Fifteen : Portability"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.1 page no : 172"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "c = -100;\n",
+ "if (c < 0):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.2 page no : 173"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nUnspecified behavior\n'''\n\nclass BasicAttrType:\n counterGauge = 0x1000\n counterPeg = 0x2000\n conterAcc = 0x3000\n \n\n\nt = BasicAttrType.counterGauge\nprint t",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.2 page no : 173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "class BasicAttrType:\n",
+ " counterGauge = 0x1000\n",
+ " counterPeg = 0x2000\n",
+ " conterAcc = 0x3000\n",
+ " \n",
+ "\n",
+ "\n",
+ "t = BasicAttrType.counterGauge\n",
+ "print t"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "4096"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "4096"
+ ]
}
- ],
+ ],
"prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.3 page no : 173"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nUndefined behavior\n'''\na = ''\nprint a",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.3 page no : 173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "a = ''\n",
+ "print a"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": ""
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": []
}
- ],
+ ],
"prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "source": "<h3>example 15.5 page no : 174"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nType of fixed size\n'''\n\nresult = 1234 * 567\nprint result",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>example 15.5 page no : 174"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "result = 1234 * 567\n",
+ "print result"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "699678"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "699678"
+ ]
}
- ],
+ ],
"prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "source": "<h3>Example 15.6 page no : 175"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nGood and bad way of including files\n'''\nimport math # python has only one way to importing file.\nfrom math import *",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 15.6 page no : 175"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "import math # python has only one way to importing file.\n",
+ "from math import *"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "source": "<h3>exmaple 15.7 page no : 176"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nDirectory names in include directives\nNote : python has . operator to import a file from directory\n'''\n\n \n# import inc.MyFile\n# import inc.MyFile\n\n# import gui.xinterface",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>exmaple 15.7 page no : 176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ " \n",
+ "# import inc.MyFile\n",
+ "# import inc.MyFile\n",
+ "\n",
+ "# import gui.xinterface"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "pyout",
- "prompt_number": 6,
- "text": "'\\nexmaple 15.7 page no : 176\\nDirectory names in include directives\\nNote : python has . operator to import a file from directory\\n'"
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 6,
+ "text": [
+ "'\\nexmaple 15.7 page no : 176\\nDirectory names in include directives\\nNote : python has . operator to import a file from directory\\n'"
+ ]
}
- ],
+ ],
"prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.8 page no : 176"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nCase-sensitivity of header file name\n'''\n\nimport math\n# import Math # does not work",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.8 page no : 176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "# import Math # does not work"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 7
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.9 page no : 178"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nOffset of data member\n'''\n\nclass PersonRecord:\n ageM = ''\n phoneNumberM = 0\n nameM = ''",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.9 page no : 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "class PersonRecord:\n",
+ " ageM = ''\n",
+ " phoneNumberM = 0\n",
+ " nameM = ''"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 8
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.10 page no : 178"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nCast must obey alignment rules\n'''\ndef stepAndConvert(a,n):\n b = a + str(n) # step n chars ahead\n return b # NO: Dangerous cast of const char* to int*\n\n\ndata = \"abcdefghijklmnop\"\nanInt = 3;\ni = stepAndConvert(data, anInt)\nprint i",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.10 page no : 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def stepAndConvert(a,n):\n",
+ " b = a + str(n) # step n chars ahead\n",
+ " return b # NO: Dangerous cast of const char* to int*\n",
+ "\n",
+ "\n",
+ "data = \"abcdefghijklmnop\"\n",
+ "anInt = 3;\n",
+ "i = stepAndConvert(data, anInt)\n",
+ "print i"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "abcdefghijklmnop3"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "abcdefghijklmnop3"
+ ]
}
- ],
+ ],
"prompt_number": 9
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.11 page no : 179"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nMixing signed and unsigned integers\nThe standard header limits.h defines a number of constants that describe the range\nof the built-in types, for example INT_MIN, INT_MAX, UINT_MIN and UINT_MAX. If\nyou work with very large numbers, be sure to check against these values.\n'''\nINT_MIN = -2147483648\nINT_MAX = 2147483647\nUINT_MAX = 4294967295\ni = 42\nui = 2222222242;\nj = i - ui;\nprint j",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.11 page no : 179"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "INT_MIN = -2147483648\n",
+ "INT_MAX = 2147483647\n",
+ "UINT_MAX = 4294967295\n",
+ "i = 42\n",
+ "ui = 2222222242;\n",
+ "j = i - ui;\n",
+ "print j"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "-2222222200"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-2222222200"
+ ]
}
- ],
+ ],
"prompt_number": 10
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.12 page no : 180"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nchars can be signed or unsigned\n'''\nzero = 0;\none = 1;\nminusOne = zero - one;\nprint minusOne\nresult = one + minusOne;\nprint result",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.12 page no : 180"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "zero = 0;\n",
+ "one = 1;\n",
+ "minusOne = zero - one;\n",
+ "print minusOne\n",
+ "result = one + minusOne;\n",
+ "print result"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "-1\n0"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-1\n",
+ "0"
+ ]
}
- ],
+ ],
"prompt_number": 11
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.13 page no : 180"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nOS-specific typedef\nNote : It would shoot error because fork() is not defined here.\n'''\npid1 = fork(); # NO: should use pid_t\n\npid2 = fork();",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.13 page no : 180"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "pid1 = fork(); # NO: should use pid_t\n",
+ "\n",
+ "pid2 = fork();"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "ename": "NameError",
- "evalue": "name 'fork' is not defined",
- "output_type": "pyerr",
+ "ename": "NameError",
+ "evalue": "name 'fork' is not defined",
+ "output_type": "pyerr",
"traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m/home/jay/<ipython-input-12-ef16c6a16507>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mNote\u001b[0m \u001b[0;34m:\u001b[0m \u001b[0mIt\u001b[0m \u001b[0mwould\u001b[0m \u001b[0mshoot\u001b[0m \u001b[0merror\u001b[0m \u001b[0mbecause\u001b[0m \u001b[0mfork\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mdefined\u001b[0m \u001b[0mhere\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mpid1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfork\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m \u001b[0;31m# NO: should use pid_t\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mpid2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfork\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m/home/jay/<ipython-input-12-ef16c6a16507>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mNote\u001b[0m \u001b[0;34m:\u001b[0m \u001b[0mIt\u001b[0m \u001b[0mwould\u001b[0m \u001b[0mshoot\u001b[0m \u001b[0merror\u001b[0m \u001b[0mbecause\u001b[0m \u001b[0mfork\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mdefined\u001b[0m \u001b[0mhere\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mpid1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfork\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m \u001b[0;31m# NO: should use pid_t\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mpid2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfork\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'fork' is not defined"
]
}
- ],
+ ],
"prompt_number": 12
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.14 page no : 181"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nPrefixed name\n'''\nfamousClimber = \"Edmund Hillary\"; # Uses Emc as prefix\nprint famousClimber",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.14 page no : 181"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "famousClimber = \"Edmund Hillary\"; # Uses Emc as prefix\n",
+ "print famousClimber"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "Edmund Hillary"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Edmund Hillary"
+ ]
}
- ],
+ ],
"prompt_number": 13
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.15 page no : 183"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nUnsupported keyword as empty macro\n'''\n\nclass EmcArray:\n def __init__(self,size):\n pass",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.15 page no : 183"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "class EmcArray:\n",
+ " def __init__(self,size):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 14
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.16 page no : 183"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nForward-compatibility macros\n'''\n\n\nfalse = 0;\ntrue = 1;",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.16 page no : 183"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "false = 0;\n",
+ "true = 1;"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 15
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.17 page no : 184"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nReusing a loop variable\nNote : It would shoot error as last() and first() are not defined function here.\n'''\ni = 0;\nfor i in range(last()):\n pass\n\nfor i in range(first()):\n pass",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.17 page no : 184"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "i = 0;\n",
+ "for i in range(last()):\n",
+ " pass\n",
+ "\n",
+ "for i in range(first()):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "ename": "NameError",
- "evalue": "name 'last' is not defined",
- "output_type": "pyerr",
+ "ename": "NameError",
+ "evalue": "name 'last' is not defined",
+ "output_type": "pyerr",
"traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m/home/jay/<ipython-input-16-119935826b55>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0mi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlast\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m/home/jay/<ipython-input-16-119935826b55>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0mi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlast\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'last' is not defined"
]
}
- ],
+ ],
"prompt_number": 16
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.18 page no : 185"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nUsing a template\n'''\n\ndef emcMax(a, b):\n if a>b:\n return a\n return b\n\ndef foo(i,j):\n m = emcMax(i, j); # usage of emcMax\n\nq = 0 # usage of class EmcQueue<int> and\ns = 0 # EmcQueue<int>:s default constructor",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.18 page no : 185"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "def emcMax(a, b):\n",
+ " if a>b:\n",
+ " return a\n",
+ " return b\n",
+ "\n",
+ "def foo(i,j):\n",
+ " m = emcMax(i, j); # usage of emcMax\n",
+ "\n",
+ "q = 0 # usage of class EmcQueue<int> and\n",
+ "s = 0 # EmcQueue<int>:s default constructor"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.19 page no : 186"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nTemplate header file\nBy having a macro EXTERNAL_TEMPLATE_DEFINITION it is possible, at compile-\ntime, to control whether the implementation file is included by the header file or not.\n'''\nclass EmcQueue:\n pass",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.19 page no : 186"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "class EmcQueue:\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.20 page no : 187"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nTemporary objects\n'''\n\nclass DangerousString:\n def __init__(self,cp):\n pass\n\n def char(self):\n pass",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.20 page no : 187"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "class DangerousString:\n",
+ " def __init__(self,cp):\n",
+ " pass\n",
+ "\n",
+ " def char(self):\n",
+ " pass"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "source": "<h3>example 15.22 page no : 189"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nHow to declare main()\n'''\ndef main(self):\n return 0",
- "language": "python",
- "outputs": [],
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>example 15.22 page no : 189"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "def main(self):\n",
+ " return 0"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
"prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.23"
- },
- {
- "cell_type": "code",
- "collapsed": true,
- "input": "'''\nEvaluation order of arguments\nNote : It will give error as f1(),f2(),f3() are not defined here.\n'''\n\nfunc(f1(), f2(), f3()) # f1 may be evaluated before f2 and f3,\n# but don't depend on it!",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [
+ "\n",
+ "\n",
+ "func(f1(), f2(), f3()) # f1 may be evaluated before f2 and f3,\n",
+ "# but don't depend on it!"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": []
- },
- {
- "cell_type": "markdown",
- "source": "<h3>EXAMPLE 15.24 page no : 189"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "'''\nEvaluation order of subexpressions\n'''\na = [0,0,0]\ni = 0\na[i] = i;\ni += 1\nprint i \n# NO: i may be incremented before or\n# after its value is used on",
- "language": "python",
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>EXAMPLE 15.24 page no : 189"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "a = [0,0,0]\n",
+ "i = 0\n",
+ "a[i] = i;\n",
+ "i += 1\n",
+ "print i \n",
+ "# NO: i may be incremented before or\n",
+ "# after its value is used on"
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
- "text": "1"
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1"
+ ]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "code",
- "collapsed": true,
- "input": "",
- "language": "python",
+ "cell_type": "code",
+ "collapsed": true,
+ "input": [],
+ "language": "python",
+ "metadata": {},
"outputs": []
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch2.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch2.ipynb
index 3b817d84..faabf783 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch2.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch2"
+ "name": "",
+ "signature": "sha256:47670c105df749836e80ebb95394825725c9958056aa9467a60adf31201b90cb"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,18 +12,26 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter : Two : Organizing the code"
+ "source": [
+ "Chapter : Two : Organizing the code"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 2.1 Page no : 12\n"
+ "source": [
+ "EXAMPLE 2.1 Page no : 12\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nTesting for self-containment\nNote : would give error because we dont have EmcArray and iostream packages.\n'''\nimport EmcArray # EmcArray.py\nimport iostream # The rest of the EmcArray.cc file ",
+ "input": [
+ "\n",
+ "import EmcArray # EmcArray.py\n",
+ "import iostream # The rest of the EmcArray.cc file "
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -43,12 +52,28 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 2.2 page no : 13\n"
+ "source": [
+ "EXAMPLE 2.2 page no : 13\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nData member of class type\n'''\n\n#import A \n\nclass X :\n def __init__(self):\n pass #self.aM = A()\n \n def returnA(self):\n pass #return self.aM\n \n def withAParameter(self,a):\n pass #self.aM = a",
+ "input": [
+ "\n",
+ "\n",
+ "#import A \n",
+ "\n",
+ "class X :\n",
+ " def __init__(self):\n",
+ " pass #self.aM = A()\n",
+ " \n",
+ " def returnA(self):\n",
+ " pass #return self.aM\n",
+ " \n",
+ " def withAParameter(self,a):\n",
+ " pass #self.aM = a"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -58,12 +83,26 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 2.3 page no :14\n"
+ "source": [
+ "EXAMPLE 2.3 page no :14\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nForward declaration\nNote : Python does not require forward declaration\n'''\n\nclass Y :\n def __init__(self):\n pass #self.bM = B()\n \n def returnBPtr(self):\n pass #return self.aM\n \n def withAParameter(self,b):\n pass #self.bM = a\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Y :\n",
+ " def __init__(self):\n",
+ " pass #self.bM = B()\n",
+ " \n",
+ " def returnBPtr(self):\n",
+ " pass #return self.aM\n",
+ " \n",
+ " def withAParameter(self,b):\n",
+ " pass #self.bM = a\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -73,12 +112,23 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 2.4 page no : 15\n"
+ "source": [
+ "EXAMPLE 2.4 page no : 15\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nInclude guard\n'''\ndef module_exists(module_name):\n try:\n __import__(module_name)\n except ImportError:\n return False\n else:\n return True",
+ "input": [
+ "\n",
+ "def module_exists(module_name):\n",
+ " try:\n",
+ " __import__(module_name)\n",
+ " except ImportError:\n",
+ " return False\n",
+ " else:\n",
+ " return True"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -88,12 +138,19 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 2.5 page no : 15\n"
+ "source": [
+ "EXAMPLE 2.5 page no : 15\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nDefining function\n'''\n\ndef cStr(cpM):\n return cpM\n",
+ "input": [
+ "\n",
+ "\n",
+ "def cStr(cpM):\n",
+ " return cpM\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -103,19 +160,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 2.6 page no : 17\n"
+ "source": [
+ "EXAMPLE 2.6 page no : 17\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nFunction template\n'''\n\ndef max_(x,y):\n if x > y:\n return x\n return y\n\ndef function(i,j):\n m = max_(i,j) # must instantiate max(int,int)\n print m\n\nfunction(5,10) \n ",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "def max_(x,y):\n",
+ " if x > y:\n",
+ " return x\n",
+ " return y\n",
+ "\n",
+ "def function(i,j):\n",
+ " m = max_(i,j) # must instantiate max(int,int)\n",
+ " print m\n",
+ "\n",
+ "function(5,10) \n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
}
],
"prompt_number": 6
@@ -124,12 +200,26 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 2.7 page no : 17\n"
+ "source": [
+ "EXAMPLE 2.7 page no : 17\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nClass template\n'''\n\nclass EmcQueue:\n def __init__(self):\n pass\n \n def insert(self,t):\n pass\n\nq = EmcQueue()\nq.insert(42);",
+ "input": [
+ "\n",
+ "\n",
+ "class EmcQueue:\n",
+ " def __init__(self):\n",
+ " pass\n",
+ " \n",
+ " def insert(self,t):\n",
+ " pass\n",
+ "\n",
+ "q = EmcQueue()\n",
+ "q.insert(42);"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -139,12 +229,19 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 2.8 page no : 18\n"
+ "source": [
+ "EXAMPLE 2.8 page no : 18\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\ndefining class\n''' \n\nclass EmcQueue:\n pass",
+ "input": [
+ "\n",
+ "\n",
+ "class EmcQueue:\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -153,7 +250,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch3.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch3.ipynb
index 88c25a97..dab765f1 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch3.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch3"
+ "name": "",
+ "signature": "sha256:ea79adc8d9da30a7f64270d4281f6f246d2c16fc489ed1f94a45b5b3b8be3491"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,36 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter Three : Comments"
+ "source": [
+ "Chapter Three : Comments"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 3.1 Page no : 22\n"
+ "source": [
+ "EXAMPLE 3.1 Page no : 22\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nStatic string identifying the file\n'''\n\nrcsid = \"$Id: $\"\nprint rcsid",
+ "input": [
+ "\n",
+ "\n",
+ "rcsid = \"$Id: $\"\n",
+ "print rcsid"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "$Id: $\n"
+ "text": [
+ "$Id: $\n"
+ ]
}
],
"prompt_number": 1
@@ -38,12 +50,18 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 3.2 Page no : 22\n"
+ "source": [
+ "EXAMPLE 3.2 Page no : 22\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nComments in C++\n'''\ncpM = ''; # A String variable\nlenM = 0 # The length of the character array ",
+ "input": [
+ "\n",
+ "cpM = ''; # A String variable\n",
+ "lenM = 0 # The length of the character array "
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -53,12 +71,23 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 3.3 Page no : 22\n"
+ "source": [
+ "Example 3.3 Page no : 22\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nNested Python-style comment\n'''\n\n''' No: this nesting of C-style comments will not work !!!\nchar* cpM;\nint lenM;\n# A pointer to the characters\n# The length of the character array \n'''",
+ "input": [
+ "\n",
+ "\n",
+ "''' No: this nesting of C-style comments will not work !!!\n",
+ "char* cpM;\n",
+ "int lenM;\n",
+ "# A pointer to the characters\n",
+ "# The length of the character array \n",
+ "'''"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -66,7 +95,9 @@
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
- "text": "' No: this nesting of C-style comments will not work !!!\\nchar* cpM;\\nint lenM;\\n# A pointer to the characters\\n# The length of the character array \\n'"
+ "text": [
+ "' No: this nesting of C-style comments will not work !!!\\nchar* cpM;\\nint lenM;\\n# A pointer to the characters\\n# The length of the character array \\n'"
+ ]
}
],
"prompt_number": 4
@@ -74,7 +105,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch4.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch4.ipynb
index 099da02d..16c0834c 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch4.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch4"
+ "name": "",
+ "signature": "sha256:814e2a9ffe7448c8830af394019244e2f81fe0819c83f253105a48f1b6c7edaf"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,81 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter Four : Control flow"
+ "source": [
+ "Chapter Four : Control flow"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.1 page no : 27\n"
+ "source": [
+ "Example 4.1 page no : 27\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nBlock after for-loop\n'''\n\nnumberOfObjects = 42;\na = []\nfor i in range(numberOfObjects):\n # Recommended\n print i \n a.append(i)",
+ "input": [
+ "\n",
+ "\n",
+ "numberOfObjects = 42;\n",
+ "a = []\n",
+ "for i in range(numberOfObjects):\n",
+ " # Recommended\n",
+ " print i \n",
+ " a.append(i)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n"
+ "text": [
+ "0\n",
+ "1\n",
+ "2\n",
+ "3\n",
+ "4\n",
+ "5\n",
+ "6\n",
+ "7\n",
+ "8\n",
+ "9\n",
+ "10\n",
+ "11\n",
+ "12\n",
+ "13\n",
+ "14\n",
+ "15\n",
+ "16\n",
+ "17\n",
+ "18\n",
+ "19\n",
+ "20\n",
+ "21\n",
+ "22\n",
+ "23\n",
+ "24\n",
+ "25\n",
+ "26\n",
+ "27\n",
+ "28\n",
+ "29\n",
+ "30\n",
+ "31\n",
+ "32\n",
+ "33\n",
+ "34\n",
+ "35\n",
+ "36\n",
+ "37\n",
+ "38\n",
+ "39\n",
+ "40\n",
+ "41\n"
+ ]
}
],
"prompt_number": 1
@@ -38,30 +95,54 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 4.2 page no :27\n"
+ "source": [
+ "EXAMPLE 4.2 page no :27\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nBlocks in if-statement\n'''\nnumberOfObjects = 42;\na = []\nfor i in range(numberOfObjects):\n # Recommended\n a.append(i)\n\nprint \"Enter value: \";\nvalue = int(raw_input())\n\nif value == 1 or value==2:\n print \"1 or 2: \" , a[value] \nelse:\n if (value > 2 and value < numberOfObjects):\n print \"Not 1 or 2: \" , a[value] ",
+ "input": [
+ "\n",
+ "numberOfObjects = 42;\n",
+ "a = []\n",
+ "for i in range(numberOfObjects):\n",
+ " # Recommended\n",
+ " a.append(i)\n",
+ "\n",
+ "print \"Enter value: \";\n",
+ "value = int(raw_input())\n",
+ "\n",
+ "if value == 1 or value==2:\n",
+ " print \"1 or 2: \" , a[value] \n",
+ "else:\n",
+ " if (value > 2 and value < numberOfObjects):\n",
+ " print \"Not 1 or 2: \" , a[value] "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter value: \n"
+ "text": [
+ "Enter value: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Not 1 or 2: 10\n"
+ "text": [
+ "Not 1 or 2: 10\n"
+ ]
}
],
"prompt_number": 2
@@ -70,19 +151,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 4.3 page no : 28\n"
+ "source": [
+ "EXAMPLE 4.3 page no : 28\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nHow to write switch statements\n'''\n\nclass Status:\n red = 1\n green = 2\n\ndef convertStatus(status):\n if status == Status.red:\n return \"Red\"\n elif status == Status.green:\n return \"Green\"\n else: \n return \"Illegal value\" \n\nprint convertStatus(1) \nprint convertStatus(2)\nprint convertStatus(5)",
+ "input": [
+ "\n",
+ "\n",
+ "class Status:\n",
+ " red = 1\n",
+ " green = 2\n",
+ "\n",
+ "def convertStatus(status):\n",
+ " if status == Status.red:\n",
+ " return \"Red\"\n",
+ " elif status == Status.green:\n",
+ " return \"Green\"\n",
+ " else: \n",
+ " return \"Illegal value\" \n",
+ "\n",
+ "print convertStatus(1) \n",
+ "print convertStatus(2)\n",
+ "print convertStatus(5)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Red\nGreen\nIllegal value\n"
+ "text": [
+ "Red\n",
+ "Green\n",
+ "Illegal value\n"
+ ]
}
],
"prompt_number": 3
@@ -91,12 +196,27 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 4.4 page no : 29"
+ "source": [
+ "EXAMPLE 4.4 page no : 29"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nHow to break out of a loop\n'''\nm = 10;\nerrorflag = False;\n\nfor i in range(m):\n if (True):\n errorflag = True;\n break; # leaves loop\n\n# no goto needed\nif(errorflag):\n pass",
+ "input": [
+ "\n",
+ "m = 10;\n",
+ "errorflag = False;\n",
+ "\n",
+ "for i in range(m):\n",
+ " if (True):\n",
+ " errorflag = True;\n",
+ " break; # leaves loop\n",
+ "\n",
+ "# no goto needed\n",
+ "if(errorflag):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -105,7 +225,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch5.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch5.ipynb
index c589d2d2..c0f0e5a6 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch5.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch5"
+ "name": "",
+ "signature": "sha256:f452e228ccf497c46b256d665e9e2f574a49ac9ecca7f62127c2ea4d07013e6d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,18 +12,27 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter Five : Object Life Cycle"
+ "source": [
+ "Chapter Five : Object Life Cycle"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.1 page no: 32\n"
+ "source": [
+ "Example 5.1 page no: 32\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nInitializing variables\nInstead of declaring the variable at the beginning of a code block and giving it a value\nmuch later:\n'''\n\ni = 10;\nj = 10;",
+ "input": [
+ "\n",
+ "\n",
+ "i = 10;\n",
+ "j = 10;"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -32,19 +42,30 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.2 page no : 33\n"
+ "source": [
+ "Example 5.2 page no : 33\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nInitialization instead of assignment\n'''\n\n# Not recommended\nstring1 = \"hello\";\nstring2 = \"hello\"; \nprint string1, string2",
+ "input": [
+ "\n",
+ "\n",
+ "# Not recommended\n",
+ "string1 = \"hello\";\n",
+ "string2 = \"hello\"; \n",
+ "print string1, string2"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "hello hello\n"
+ "text": [
+ "hello hello\n"
+ ]
}
],
"prompt_number": 2
@@ -53,12 +74,19 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 5.3 page no : 33\n"
+ "source": [
+ "EXAMPLE 5.3 page no : 33\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nAssignment instead of initialization\n'''\n\ni = int(raw_input()) # no reason to initialize i\nprint i",
+ "input": [
+ "\n",
+ "\n",
+ "i = int(raw_input()) # no reason to initialize i\n",
+ "print i"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -66,12 +94,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
}
],
"prompt_number": 3
@@ -80,12 +112,18 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 5.4 page no : 34\n"
+ "source": [
+ "EXAMPLE 5.4 page no : 34\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nDeclaring multiple variables\n'''\noldLm = 0;\nnewLm = 0;",
+ "input": [
+ "\n",
+ "oldLm = 0;\n",
+ "newLm = 0;"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -95,12 +133,21 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 5.5 page no : 34\n"
+ "source": [
+ "EXAMPLE 5.5 page no : 34\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nCorrect use of magic number\n'''\n# Literal in definition of const,\ncharMapSize = 256;\n# but not to specify array size!\nfor i in range(charMapSize):\n pass",
+ "input": [
+ "\n",
+ "# Literal in definition of const,\n",
+ "charMapSize = 256;\n",
+ "# but not to specify array size!\n",
+ "for i in range(charMapSize):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -110,12 +157,25 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 5.6 page no : 36\n"
+ "source": [
+ "EXAMPLE 5.6 page no : 36\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nConstructor initialization lists\n'''\n\nclass Base:\n def __init__(self,i=0):\n self.iM = 0\n\nclass Derived(Base):\n def __init__(self,i=0):\n Base.__init__(self,i)\n self.jM = i",
+ "input": [
+ "\n",
+ "\n",
+ "class Base:\n",
+ " def __init__(self,i=0):\n",
+ " self.iM = 0\n",
+ "\n",
+ "class Derived(Base):\n",
+ " def __init__(self,i=0):\n",
+ " Base.__init__(self,i)\n",
+ " self.jM = i"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -125,12 +185,24 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 5.7 page no : 37\n"
+ "source": [
+ "EXAMPLE 5.7 page no : 37\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nOrder of initializers\n'''\nclass Base:\n def __init__(self,i=0):\n self.iM = 0\n\nclass Derived(Base):\n def __init__(self,i=0):\n self.jM = i\n bm = Base(i)",
+ "input": [
+ "\n",
+ "class Base:\n",
+ " def __init__(self,i=0):\n",
+ " self.iM = 0\n",
+ "\n",
+ "class Derived(Base):\n",
+ " def __init__(self,i=0):\n",
+ " self.jM = i\n",
+ " bm = Base(i)"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -140,19 +212,31 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "example 5.8 page no : 40\n"
+ "source": [
+ "example 5.8 page no : 40\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nReturning dangling pointers and references\n'''\n\ndef dangerous():\n i = 5;\n return i\nj = dangerous(); # NO: j is dangerous to use\nprint j;\n",
+ "input": [
+ "\n",
+ "\n",
+ "def dangerous():\n",
+ " i = 5;\n",
+ " return i\n",
+ "j = dangerous(); # NO: j is dangerous to use\n",
+ "print j;\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
}
],
"prompt_number": 8
@@ -161,12 +245,23 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 5.9 page no : 41\n"
+ "source": [
+ "EXAMPLE 5.9 page no : 41\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nclass declaration\n'''\n\nclass CommunicationPort:\n def __init__(self,port):\n pass\n \n def __del__(self):\n pass",
+ "input": [
+ "\n",
+ "\n",
+ "class CommunicationPort:\n",
+ " def __init__(self,port):\n",
+ " pass\n",
+ " \n",
+ " def __del__(self):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -176,12 +271,24 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 5.10 page no : 42\n"
+ "source": [
+ "EXAMPLE 5.10 page no : 42\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nCopyable class that manages memory\n'''\n\nclass EmcIntStack:\n def __init__(self,d):\n self.allocatedM = d\n self.vectorM = []\n\n def __del__():\n pass ",
+ "input": [
+ "\n",
+ "\n",
+ "class EmcIntStack:\n",
+ " def __init__(self,d):\n",
+ " self.allocatedM = d\n",
+ " self.vectorM = []\n",
+ "\n",
+ " def __del__():\n",
+ " pass "
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -191,19 +298,29 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "example 5.11 page no : 43\n"
+ "source": [
+ "example 5.11 page no : 43\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nSelf-assignment\n'''\n\ns = \"Aguirre\";\ns = s;\nprint s ",
+ "input": [
+ "\n",
+ "\n",
+ "s = \"Aguirre\";\n",
+ "s = s;\n",
+ "print s "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Aguirre\n"
+ "text": [
+ "Aguirre\n"
+ ]
}
],
"prompt_number": 11
@@ -212,19 +329,28 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "example 5.12 page no : 43\n"
+ "source": [
+ "example 5.12 page no : 43\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nImplementing a copy assignment operator\nin Python, = operator no need to implement.\n'''\ns = \"Aguirre\";\nr = s;\nprint r",
+ "input": [
+ "\n",
+ "s = \"Aguirre\";\n",
+ "r = s;\n",
+ "print r"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Aguirre\n"
+ "text": [
+ "Aguirre\n"
+ ]
}
],
"prompt_number": 12
@@ -232,7 +358,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch6.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch6.ipynb
index c6fba155..a35d9ee7 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch6.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch6"
+ "name": "",
+ "signature": "sha256:02be36ad85c7df4dace913f54f3ea199522926d07ecd14544c2024f6326359fd"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,36 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter Six : Conversions"
+ "source": [
+ "Chapter Six : Conversions"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 6.1 page no : 48\n"
+ "source": [
+ "EXAMPLE 6.1 page no : 48\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExplicit conversions \nNote : converting int to float\n'''\nlarge = 456789; # Potentially dangerous conversion\nsize = float(large)\nprint size",
+ "input": [
+ "\n",
+ "large = 456789; # Potentially dangerous conversion\n",
+ "size = float(large)\n",
+ "print size"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "456789.0\n"
+ "text": [
+ "456789.0\n"
+ ]
}
],
"prompt_number": 1
@@ -38,12 +50,23 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 6.2 page no : 49\n"
+ "source": [
+ "EXAMPLE 6.2 page no : 49\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nConversion of string object to const char*\nclass defining\n'''\n\nclass DangerousString :\n def __init__(self):\n pass # self.s = ''\n\n def __str__(self):\n pass # return self.s",
+ "input": [
+ "\n",
+ "\n",
+ "class DangerousString :\n",
+ " def __init__(self):\n",
+ " pass # self.s = ''\n",
+ "\n",
+ " def __str__(self):\n",
+ " pass # return self.s"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -53,19 +76,30 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 6.3 page no : 51\n"
+ "source": [
+ "EXAMPLE 6.3 page no : 51\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nUsing static_cast\n'''\n\nlarge = 456789\nsize = int(large);\nthree = \"three\" \nprint large,size,three",
+ "input": [
+ "\n",
+ "\n",
+ "large = 456789\n",
+ "size = int(large);\n",
+ "three = \"three\" \n",
+ "print large,size,three"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "456789 456789 three\n"
+ "text": [
+ "456789 456789 three\n"
+ ]
}
],
"prompt_number": 9
@@ -74,12 +108,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 6.4 page no : 51\n"
+ "source": [
+ "EXAMPLE 6.4 page no : 51\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nNew style casts\n'''\nclass B:\n pass\n \nclass D( B):\n pass\n\nclass E:\n pass\n \ndef dynamicCast(b):\n # Must use dynamic_cast when base class is virtual.\n return D(b)\n\ndef constCast(d1):\n # Should use const_cast when casting away const.\n return D(d1)\n\ndef reinterpretCast(d):\n # Should use reinterpret_cast when casting pointer\n # to pointer of unrelated type.\n return E(d)",
+ "input": [
+ "\n",
+ "class B:\n",
+ " pass\n",
+ " \n",
+ "class D( B):\n",
+ " pass\n",
+ "\n",
+ "class E:\n",
+ " pass\n",
+ " \n",
+ "def dynamicCast(b):\n",
+ " # Must use dynamic_cast when base class is virtual.\n",
+ " return D(b)\n",
+ "\n",
+ "def constCast(d1):\n",
+ " # Should use const_cast when casting away const.\n",
+ " return D(d1)\n",
+ "\n",
+ "def reinterpretCast(d):\n",
+ " # Should use reinterpret_cast when casting pointer\n",
+ " # to pointer of unrelated type.\n",
+ " return E(d)"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -89,12 +148,24 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 6.5 page no : 52\n"
+ "source": [
+ "EXAMPLE 6.5 page no : 52\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nCasting away const\n'''\n\ndef addToFileList(s):\n pass\n \ndef addFiles(s):\n m = len(s)\n for i in range(m):\n addToFileList(s[i])",
+ "input": [
+ "\n",
+ "\n",
+ "def addToFileList(s):\n",
+ " pass\n",
+ " \n",
+ "def addFiles(s):\n",
+ " m = len(s)\n",
+ " for i in range(m):\n",
+ " addToFileList(s[i])"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -104,19 +175,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 6.6 page no : 52\n"
+ "source": [
+ "EXAMPLE 6.6 page no : 52\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nObject in write-protected memory\n''' \n\n# ci may be in write-protected memory\nci = 22;\npi = ci # NO: Const cast away\ni = pi; # OK\n# writing into write-protected memory?\npi = 7 \nprint ci, pi, i ",
+ "input": [
+ "\n",
+ "\n",
+ "# ci may be in write-protected memory\n",
+ "ci = 22;\n",
+ "pi = ci # NO: Const cast away\n",
+ "i = pi; # OK\n",
+ "# writing into write-protected memory?\n",
+ "pi = 7 \n",
+ "print ci, pi, i "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "22 7 22\n"
+ "text": [
+ "22 7 22\n"
+ ]
}
],
"prompt_number": 7
@@ -125,12 +210,30 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "example 6.7 page no : 53\n"
+ "source": [
+ "example 6.7 page no : 53\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nClass with mutable data member\n'''\nclass EmcMatrix:\n def __init__(self):\n self.isDirtyM = False\n self.detM = 0.0\n\n def calculateDeterminant(self):\n pass\n\n def determinant(self):\n if(isDirtyM):\n # OK, access to mutable data members\n self.detM = self.calculateDeterminant();\n self.isDirtyM = False;\n return self.detM;",
+ "input": [
+ "\n",
+ "class EmcMatrix:\n",
+ " def __init__(self):\n",
+ " self.isDirtyM = False\n",
+ " self.detM = 0.0\n",
+ "\n",
+ " def calculateDeterminant(self):\n",
+ " pass\n",
+ "\n",
+ " def determinant(self):\n",
+ " if(isDirtyM):\n",
+ " # OK, access to mutable data members\n",
+ " self.detM = self.calculateDeterminant();\n",
+ " self.isDirtyM = False;\n",
+ " return self.detM;"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -139,7 +242,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch7.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch7.ipynb
index 82ae17cc..753ae756 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch7.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch7"
+ "name": "",
+ "signature": "sha256:bef0a5b42b24e0648e81ec34d8c7331f906450b7163d1ed429e0503042ac5057"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,18 +12,43 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter Seven : The class interface"
+ "source": [
+ "Chapter Seven : The class interface"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.1 page no : 57\n"
+ "source": [
+ "EXAMPLE 7.1 page no : 57\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nA class with inline member functions\n'''\nclass Point:\n def __init__(self,x,y):\n self.xM = x\n self.yM = y\n\n def x(self):\n return self.xM\n \n def y(self):\n return self.yM\n\n def x_(self,x):\n self.xM = x\n \n def y_(self,y):\n self.yM = y\n\n def __add__(self,p2): \n return Point(self.x() + p2.x(), self.y() + p2.y())",
+ "input": [
+ "\n",
+ "class Point:\n",
+ " def __init__(self,x,y):\n",
+ " self.xM = x\n",
+ " self.yM = y\n",
+ "\n",
+ " def x(self):\n",
+ " return self.xM\n",
+ " \n",
+ " def y(self):\n",
+ " return self.yM\n",
+ "\n",
+ " def x_(self,x):\n",
+ " self.xM = x\n",
+ " \n",
+ " def y_(self,y):\n",
+ " self.yM = y\n",
+ "\n",
+ " def __add__(self,p2): \n",
+ " return Point(self.x() + p2.x(), self.y() + p2.y())"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -32,12 +58,25 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "example 7.2 page no : 59\n"
+ "source": [
+ "example 7.2 page no : 59\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nDifferent types of function parameters\nNote : python doesn't have pass by reference kind of functions.\n'''\n\ndef valueFunc(t):\n pass\n\ndef pointerFunc(tp):\n pass\n\ndef referenceFunc(tr):\n pass",
+ "input": [
+ "\n",
+ "\n",
+ "def valueFunc(t):\n",
+ " pass\n",
+ "\n",
+ "def pointerFunc(tp):\n",
+ " pass\n",
+ "\n",
+ "def referenceFunc(tr):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -47,12 +86,28 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "example 7.3 page no : 60\n"
+ "source": [
+ "example 7.3 page no : 60\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nPassing parameters by value\n'''\n\ndef func1(c):\n pass\n\ndef func2(i):\n pass\n \ndef func3(d):\n pass\n \ndef func(c):\n pass",
+ "input": [
+ "\n",
+ "\n",
+ "def func1(c):\n",
+ " pass\n",
+ "\n",
+ "def func2(i):\n",
+ " pass\n",
+ " \n",
+ "def func3(d):\n",
+ " pass\n",
+ " \n",
+ "def func(c):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -62,19 +117,51 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.4 page no : 61\n"
+ "source": [
+ "EXAMPLE 7.4 page no : 61\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\n'''\nclass EmcMathVector:\n def __init__(self,x,y):\n self.xM = x\n self.yM = y\n\n def __mul__(self,i):\n self.xM *= i\n self.yM *= i\n\n def x(self):\n return self.xM\n \n def y(self):\n return self.yM\n\n def x_(self,x):\n self.xM = x\n \n def y_(self,y):\n yM = y\n\na = EmcMathVector(5,10)\nprint a.xM,a.yM\na * 5\nprint a.xM,a.yM",
+ "input": [
+ "\n",
+ "class EmcMathVector:\n",
+ " def __init__(self,x,y):\n",
+ " self.xM = x\n",
+ " self.yM = y\n",
+ "\n",
+ " def __mul__(self,i):\n",
+ " self.xM *= i\n",
+ " self.yM *= i\n",
+ "\n",
+ " def x(self):\n",
+ " return self.xM\n",
+ " \n",
+ " def y(self):\n",
+ " return self.yM\n",
+ "\n",
+ " def x_(self,x):\n",
+ " self.xM = x\n",
+ " \n",
+ " def y_(self,y):\n",
+ " yM = y\n",
+ "\n",
+ "a = EmcMathVector(5,10)\n",
+ "print a.xM,a.yM\n",
+ "a * 5\n",
+ "print a.xM,a.yM"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "5 10\n25 50\n"
+ "text": [
+ "5 10\n",
+ "25 50\n"
+ ]
}
],
"prompt_number": 4
@@ -83,12 +170,29 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.5 page no : 63\n"
+ "source": [
+ "EXAMPLE 7.5 page no : 63\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nPassing arguments of unknown type\n'''\n\nclass vector:\n def __init__(self,first,last):\n pass\n\n def begin(self):\n pass\n\n def push_back(self,x):\n pass\n \n def insert(self,x):\n pass",
+ "input": [
+ "\n",
+ "\n",
+ "class vector:\n",
+ " def __init__(self,first,last):\n",
+ " pass\n",
+ "\n",
+ " def begin(self):\n",
+ " pass\n",
+ "\n",
+ " def push_back(self,x):\n",
+ " pass\n",
+ " \n",
+ " def insert(self,x):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -98,19 +202,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.6 page no : 64\n"
+ "source": [
+ "EXAMPLE 7.6 page no : 64\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nPassing base class reference\n'''\n\nclass basic_ofstream:\n def __init__(self,x,y):\n self.x = x\n self.y = y\n\n def print_(self):\n print self.x , \", \" , self.y;\n\n\nv = basic_ofstream(1.2, 5.5);\nv.print_()",
+ "input": [
+ "\n",
+ "\n",
+ "class basic_ofstream:\n",
+ " def __init__(self,x,y):\n",
+ " self.x = x\n",
+ " self.y = y\n",
+ "\n",
+ " def print_(self):\n",
+ " print self.x , \", \" , self.y;\n",
+ "\n",
+ "\n",
+ "v = basic_ofstream(1.2, 5.5);\n",
+ "v.print_()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1.2 , 5.5\n"
+ "text": [
+ "1.2 , 5.5\n"
+ ]
}
],
"prompt_number": 6
@@ -119,12 +241,20 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.7 page no : 65 \n"
+ "source": [
+ "EXAMPLE 7.7 page no : 65 \n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nPassing base class object by value\n''' \n\ndef uselessPrint(v):\n # NO: Compile error\n print v.x() , \", \" , v.y();",
+ "input": [
+ "\n",
+ "\n",
+ "def uselessPrint(v):\n",
+ " # NO: Compile error\n",
+ " print v.x() , \", \" , v.y();"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -134,19 +264,31 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "example 7.8 page no : 65\n"
+ "source": [
+ "example 7.8 page no : 65\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nReturn value from assignment operators\n'''\n\narray = ['','','']\n# assign to first element\narrayPointer = 42 #*(arrayPointer = array) = 42\nprint arrayPointer",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "array = ['','','']\n",
+ "# assign to first element\n",
+ "arrayPointer = 42 #*(arrayPointer = array) = 42\n",
+ "print arrayPointer"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "42\n"
+ "text": [
+ "42\n"
+ ]
}
],
"prompt_number": 8
@@ -155,19 +297,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.10 page no : 67\n"
+ "source": [
+ "EXAMPLE 7.10 page no : 67\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nUsing parameter as a local variable\n'''\n\ndef arraySum(array,first,last):\n s = 0\n for i in array:\n # It is possible to update first since\n # it has not been declared const.\n s += i\n return s;\n \nprint arraySum([5,4,3,2],5,2) ",
+ "input": [
+ "\n",
+ "\n",
+ "def arraySum(array,first,last):\n",
+ " s = 0\n",
+ " for i in array:\n",
+ " # It is possible to update first since\n",
+ " # it has not been declared const.\n",
+ " s += i\n",
+ " return s;\n",
+ " \n",
+ "print arraySum([5,4,3,2],5,2) "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "14\n"
+ "text": [
+ "14\n"
+ ]
}
],
"prompt_number": 9
@@ -176,12 +334,27 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.11 page no : 68\n"
+ "source": [
+ "EXAMPLE 7.11 page no : 68\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nCopyable type parameter\n'''\nclass EmcStack:\n def __init__(self):\n self.repM = []\n self.allocatedM = 0\n self.topM = 0\n \n def push(t):\n if self.topM == allocatedM : # allocate more memory\n pass #size_t newSize = 2 * allocatedM;\n self.repM.append(t)\n self.topM +=1",
+ "input": [
+ "\n",
+ "class EmcStack:\n",
+ " def __init__(self):\n",
+ " self.repM = []\n",
+ " self.allocatedM = 0\n",
+ " self.topM = 0\n",
+ " \n",
+ " def push(t):\n",
+ " if self.topM == allocatedM : # allocate more memory\n",
+ " pass #size_t newSize = 2 * allocatedM;\n",
+ " self.repM.append(t)\n",
+ " self.topM +=1"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -191,19 +364,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.12 page no : 69\n"
+ "source": [
+ "EXAMPLE 7.12 page no : 69\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nAccessing string literals\n'''\n\nmessage1 = \"Calling Orson\";\nmessage2 = \"Ice Hockey\";\nmessage3 = \"Terminator\";\nmessage4 = \"I like candy\"\n\nprint message1\nprint message2\nprint message3\nprint message4",
+ "input": [
+ "\n",
+ "\n",
+ "message1 = \"Calling Orson\";\n",
+ "message2 = \"Ice Hockey\";\n",
+ "message3 = \"Terminator\";\n",
+ "message4 = \"I like candy\"\n",
+ "\n",
+ "print message1\n",
+ "print message2\n",
+ "print message3\n",
+ "print message4"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Calling Orson\nIce Hockey\nTerminator\nI like candy\n"
+ "text": [
+ "Calling Orson\n",
+ "Ice Hockey\n",
+ "Terminator\n",
+ "I like candy\n"
+ ]
}
],
"prompt_number": 11
@@ -212,12 +404,32 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.13 page no : 70\n"
+ "source": [
+ "EXAMPLE 7.13 page no : 70\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nImplications of const\nUselessString is a class that has not declared any const member functions.\n'''\n\nclass UselessString:\n def __init__(self,c=None):\n pass\n \n def cStr(self):\n pass\n \n def length(self):\n pass\n \n def at(self,index):\n pass\n \n def print_(self):\n print self.s ",
+ "input": [
+ "\n",
+ "\n",
+ "class UselessString:\n",
+ " def __init__(self,c=None):\n",
+ " pass\n",
+ " \n",
+ " def cStr(self):\n",
+ " pass\n",
+ " \n",
+ " def length(self):\n",
+ " pass\n",
+ " \n",
+ " def at(self,index):\n",
+ " pass\n",
+ " \n",
+ " def print_(self):\n",
+ " print self.s "
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -227,12 +439,22 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.14 page no : 71\n"
+ "source": [
+ "EXAMPLE 7.14 page no : 71\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nAccessing objects inside const member function\n'''\nclass Silly:\n def __init__(self,val):\n self.valM = val\n \n def me(self,s):\n pass",
+ "input": [
+ "\n",
+ "class Silly:\n",
+ " def __init__(self,val):\n",
+ " self.valM = val\n",
+ " \n",
+ " def me(self,s):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -242,19 +464,28 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.15 page no : 72\n"
+ "source": [
+ "EXAMPLE 7.15 page no : 72\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nAccessing characters in a string\n'''\n\nname = \"John Bauer\";\nprint name[0]",
+ "input": [
+ "\n",
+ "\n",
+ "name = \"John Bauer\";\n",
+ "print name[0]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "J\n"
+ "text": [
+ "J\n"
+ ]
}
],
"prompt_number": 14
@@ -263,19 +494,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.16 page no : 75\n"
+ "source": [
+ "EXAMPLE 7.16 page no : 75\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nOverloaded member functions\n'''\ncosmonaut = \"Juri Gagarin\"\nc = 'a';\ncValue = c in cosmonaut # cValue == true\nuri = \"uri\"\nuriValue = uri in cosmonaut # uriValue == true\nprint cValue\nprint uriValue",
+ "input": [
+ "\n",
+ "cosmonaut = \"Juri Gagarin\"\n",
+ "c = 'a';\n",
+ "cValue = c in cosmonaut # cValue == true\n",
+ "uri = \"uri\"\n",
+ "uriValue = uri in cosmonaut # uriValue == true\n",
+ "print cValue\n",
+ "print uriValue"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "True\nTrue\n"
+ "text": [
+ "True\n",
+ "True\n"
+ ]
}
],
"prompt_number": 15
@@ -284,19 +529,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.17 page no : 76 \n"
+ "source": [
+ "EXAMPLE 7.17 page no : 76 \n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nOperator overloading\n'''\ndef max_(x,y):\n if (x > y): # could use: < instead\n # We also expect that:\n # y < x\n return x;\n else:\n # We also expect that:\n # x <= y\n return y;\n\nx = 42;\ny = 0;\nprint max(x,y)\n\n",
+ "input": [
+ "\n",
+ "def max_(x,y):\n",
+ " if (x > y): # could use: < instead\n",
+ " # We also expect that:\n",
+ " # y < x\n",
+ " return x;\n",
+ " else:\n",
+ " # We also expect that:\n",
+ " # x <= y\n",
+ " return y;\n",
+ "\n",
+ "x = 42;\n",
+ "y = 0;\n",
+ "print max(x,y)\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "42\n"
+ "text": [
+ "42\n"
+ ]
}
],
"prompt_number": 16
@@ -305,12 +570,19 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.18 page no : 76\n"
+ "source": [
+ "EXAMPLE 7.18 page no : 76\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nImplementation of closely related operators\nPython has inbuilt this facility. No need to write functions for that.\n''' ",
+ "input": [
+ "'''\n",
+ "Implementation of closely related operators\n",
+ "Python has inbuilt this facility. No need to write functions for that.\n",
+ "''' "
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -318,7 +590,9 @@
"metadata": {},
"output_type": "pyout",
"prompt_number": 17,
- "text": "'\\nEXAMPLE 7.18 page no : 76\\nImplementation of closely related operators\\nPython has inbuilt this facility. No need to write functions for that.\\n'"
+ "text": [
+ "'\\nEXAMPLE 7.18 page no : 76\\nImplementation of closely related operators\\nPython has inbuilt this facility. No need to write functions for that.\\n'"
+ ]
}
],
"prompt_number": 17
@@ -327,12 +601,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.19 page no : 77\n"
+ "source": [
+ "EXAMPLE 7.19 page no : 77\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nHiding member functions\n'''\nclass Base:\n def f(char):\n pass\n def f(i):\n pass\n def v(char):\n pass\n\nclass Derived(Base):\n def __init__(self):\n pass\n\n def f(self,i):\n pass\n \n def v(self,c):\n self.f(c)",
+ "input": [
+ "\n",
+ "class Base:\n",
+ " def f(char):\n",
+ " pass\n",
+ " def f(i):\n",
+ " pass\n",
+ " def v(char):\n",
+ " pass\n",
+ "\n",
+ "class Derived(Base):\n",
+ " def __init__(self):\n",
+ " pass\n",
+ "\n",
+ " def f(self,i):\n",
+ " pass\n",
+ " \n",
+ " def v(self,c):\n",
+ " self.f(c)"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -342,12 +637,24 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.20 page no : 79\n"
+ "source": [
+ "EXAMPLE 7.20 page no : 79\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nInheriting overloaded virtual member functions\nSuppose the template EmcBoundedCollection<T> inherits from EmcCollec-\ntion<T>. Objects of the same derived class are possible to compare more efficiently\nthan if the objects are of different classes. This is the reason to why the member func-\ntion isEqual is overloaded in the derived class, but to avoid surprises the base class\nversion is also made accessible.\n'''\nclass EmcCollection:\n def isEqual(self):\n pass\n \nclass EmcBoundedCollection(EmcCollection):\n\n def isEqual(a):\n pass",
+ "input": [
+ "\n",
+ "class EmcCollection:\n",
+ " def isEqual(self):\n",
+ " pass\n",
+ " \n",
+ "class EmcBoundedCollection(EmcCollection):\n",
+ "\n",
+ " def isEqual(a):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -357,19 +664,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "example 7.21 page no : 80\n"
+ "source": [
+ "example 7.21 page no : 80\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nAdding default arguments\n'''\n\ndef f(x,y = 2):\n print x\n print y\n#void f(int x = 1, int y); // NOT RECOMMENDED\n\nf(1)\nf(2,3)",
+ "input": [
+ "\n",
+ "\n",
+ "def f(x,y = 2):\n",
+ " print x\n",
+ " print y\n",
+ "#void f(int x = 1, int y); // NOT RECOMMENDED\n",
+ "\n",
+ "f(1)\n",
+ "f(2,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1\n2\n2\n3\n"
+ "text": [
+ "1\n",
+ "2\n",
+ "2\n",
+ "3\n"
+ ]
}
],
"prompt_number": 20
@@ -378,12 +702,20 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.22 page no : 80\n"
+ "source": [
+ "EXAMPLE 7.22 page no : 80\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nDefault arguments for member function\n'''\n\nclass RanDraw:\n def __init__(self, limit,seed, t = 'Good' ):\n pass # Default argument for t in class definition\n",
+ "input": [
+ "\n",
+ "\n",
+ "class RanDraw:\n",
+ " def __init__(self, limit,seed, t = 'Good' ):\n",
+ " pass # Default argument for t in class definition\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -393,12 +725,22 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 7.23 page no : 82\n"
+ "source": [
+ "EXAMPLE 7.23 page no : 82\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nOne-argument constructor\n'''\nclass Other:\n def __init__(self,a): #No implicit conversion from Any\n pass\n \n def foo(self,o):\n pass",
+ "input": [
+ "\n",
+ "class Other:\n",
+ " def __init__(self,a): #No implicit conversion from Any\n",
+ " pass\n",
+ " \n",
+ " def foo(self,o):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -408,19 +750,34 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "example 7.24 page no : 82\n"
+ "source": [
+ "example 7.24 page no : 82\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nHow to avoid conversion operator function\nOur string class EmcString provides a member function cStr() for the purpose of\nreturning the string representation as a const char*.\n'''\nclass EmcString:\n def cStr(): # conversion to const char*\n pass\n\n def log(cp): \n pass\n\nmagicPlace =\"Ngoro-Ngoro crater at dusk\"\nprint magicPlace # Explicit conversion from String to const char*",
+ "input": [
+ "\n",
+ "class EmcString:\n",
+ " def cStr(): # conversion to const char*\n",
+ " pass\n",
+ "\n",
+ " def log(cp): \n",
+ " pass\n",
+ "\n",
+ "magicPlace =\"Ngoro-Ngoro crater at dusk\"\n",
+ "print magicPlace # Explicit conversion from String to const char*"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Ngoro-Ngoro crater at dusk\n"
+ "text": [
+ "Ngoro-Ngoro crater at dusk\n"
+ ]
}
],
"prompt_number": 23
@@ -428,7 +785,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch8.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch8.ipynb
index cca0a638..1449db62 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch8.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch8"
+ "name": "",
+ "signature": "sha256:90db160243231bb1b3699a6dc0bde758daa5bf22473aeb4fd74b345857a46432"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,37 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter Eight : new and delete"
+ "source": [
+ "Chapter Eight : new and delete"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 8.1 page no : 89\n"
+ "source": [
+ "EXAMPLE 8.1 page no : 89\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nAllocate and deallocate free store object\nNote : Python does deallocation it self.\n'''\n\nsp = \"Hello\" \narraySize = 5;\nsa = []\nprint sp, arraySize\n",
+ "input": [
+ "\n",
+ "sp = \"Hello\" \n",
+ "arraySize = 5;\n",
+ "sa = []\n",
+ "print sp, arraySize\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello 5\n"
+ "text": [
+ "Hello 5\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +51,28 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 8.2 page no : 90\n"
+ "source": [
+ "EXAMPLE 8.2 page no : 90\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nDangerous access to deleted object\nNote : python deallocates variable memory when program exits. \n'''\n\nsp = \"Hello\"\nprint sp\n",
+ "input": [
+ "\n",
+ "\n",
+ "sp = \"Hello\"\n",
+ "print sp\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello\n"
+ "text": [
+ "Hello\n"
+ ]
}
],
"prompt_number": 2
@@ -59,12 +81,28 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 8.3 page no : 90\n"
+ "source": [
+ "EXAMPLE 8.3 page no : 90\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nObjects that commit suicide\n'''\nclass W:\n def __init__(self):\n pass\n\n def goAway(self):\n pass\n \n def foo(self):\n pass\n \n def bar(self):\n pass",
+ "input": [
+ "\n",
+ "class W:\n",
+ " def __init__(self):\n",
+ " pass\n",
+ "\n",
+ " def goAway(self):\n",
+ " pass\n",
+ " \n",
+ " def foo(self):\n",
+ " pass\n",
+ " \n",
+ " def bar(self):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -74,12 +112,20 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 8.4 page no : 91\n"
+ "source": [
+ "EXAMPLE 8.4 page no : 91\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nPlacement new\nA common form of placement new, that is part of the standard library, takes a memory\naddress as argument.\n'''\n\nmaxSize = 100; # get storage for object\nstorage = [] # call placement new to create object\n#ap1 = A(); # A() class is not defined here.",
+ "input": [
+ "\n",
+ "\n",
+ "maxSize = 100; # get storage for object\n",
+ "storage = [] # call placement new to create object\n",
+ "#ap1 = A(); # A() class is not defined here."
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -89,12 +135,24 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 8.5 page no : 93 \n"
+ "source": [
+ "EXAMPLE 8.5 page no : 93 \n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nClass with customized memory management\nNote : Python does not have new operator, so can not be overloaded.\n'''\n\nclass BadArgument:\n def __init__(self):\n pass\n\nclass A:\n def __init__(self):\n pass",
+ "input": [
+ "\n",
+ "\n",
+ "class BadArgument:\n",
+ " def __init__(self):\n",
+ " pass\n",
+ "\n",
+ "class A:\n",
+ " def __init__(self):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -103,7 +161,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch9.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch9.ipynb
index 33f294da..35b80cf8 100644
--- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch9.ipynb
+++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch9"
+ "name": "",
+ "signature": "sha256:bb23348ad3296a941665bd16b2187a89f9e17bfa05baf675e9a0cf4ac9ab49e8"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,39 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter Nine : Static Objects"
+ "source": [
+ "Chapter Nine : Static Objects"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 9.1 page no : 97\n"
+ "source": [
+ "EXAMPLE 9.1 page no : 97\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nFunction local static object\n'''\n\ndef randomValue(seed):\n oldValue = seed; # calculate new value\n return oldValue\n \nprint randomValue(5) ",
+ "input": [
+ "\n",
+ "\n",
+ "def randomValue(seed):\n",
+ " oldValue = seed; # calculate new value\n",
+ " return oldValue\n",
+ " \n",
+ "print randomValue(5) "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
}
],
"prompt_number": 1
@@ -38,12 +53,27 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 9.2 page no : 97\n"
+ "source": [
+ "EXAMPLE 9.2 page no : 97\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nStatic data member\n'''\n\nclass EmcSingleton:\n def instance():\n pass\n \n def create(i = 0):\n self.instanceM = EmcSingleton(i)\n\n def __init__(self,i):\n pass\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class EmcSingleton:\n",
+ " def instance():\n",
+ " pass\n",
+ " \n",
+ " def create(i = 0):\n",
+ " self.instanceM = EmcSingleton(i)\n",
+ "\n",
+ " def __init__(self,i):\n",
+ " pass\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -53,19 +83,27 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 9.3 page no : 98\n"
+ "source": [
+ "EXAMPLE 9.3 page no : 98\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nUnnamed namespace\nNote : python doesnt have namespace.\n'''\nsccsid = \"@(#)myfile.cc\"\nprint sccsid",
+ "input": [
+ "\n",
+ "sccsid = \"@(#)myfile.cc\"\n",
+ "print sccsid"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "@(#)myfile.cc\n"
+ "text": [
+ "@(#)myfile.cc\n"
+ ]
}
],
"prompt_number": 7
@@ -74,19 +112,27 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 9.4 page no : 98\n"
+ "source": [
+ "EXAMPLE 9.4 page no : 98\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nStatic objects in file scope\n'''\nsccsid = \"@(#)myfile.cc\"\nprint sccsid",
+ "input": [
+ "\n",
+ "sccsid = \"@(#)myfile.cc\"\n",
+ "print sccsid"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "@(#)myfile.cc\n"
+ "text": [
+ "@(#)myfile.cc\n"
+ ]
}
],
"prompt_number": 8
@@ -95,19 +141,31 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 9.5 page no : 98\n"
+ "source": [
+ "EXAMPLE 9.5 page no : 98\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nAccess to static object inside constructor\nSuppose a constructor writes a message to cout. If the iostream library would not\nhave provided a method for safe initialization of cout, such constructors would be\ndangerous to use for static objects.\n'''\n\nclass EmcLog:\n def __init__(self,out=None):\n print \"Creating log\"\n\nt = EmcLog()",
+ "input": [
+ "\n",
+ "\n",
+ "class EmcLog:\n",
+ " def __init__(self,out=None):\n",
+ " print \"Creating log\"\n",
+ "\n",
+ "t = EmcLog()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Creating log\n"
+ "text": [
+ "Creating log\n"
+ ]
}
],
"prompt_number": 10
@@ -116,19 +174,29 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 9.6 page no : 100\n"
+ "source": [
+ "EXAMPLE 9.6 page no : 100\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nInitialization order of static objects\n'''\n\nsccsid = \"@(#)myfile.cc\"\nrelease = \"@(#)Emc Class Library, 1.2\"\nprint sccsid, release",
+ "input": [
+ "\n",
+ "\n",
+ "sccsid = \"@(#)myfile.cc\"\n",
+ "release = \"@(#)Emc Class Library, 1.2\"\n",
+ "print sccsid, release"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "@(#)myfile.cc @(#)Emc Class Library, 1.2\n"
+ "text": [
+ "@(#)myfile.cc @(#)Emc Class Library, 1.2\n"
+ ]
}
],
"prompt_number": 11
@@ -137,12 +205,29 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "EXAMPLE 9.7 page no : 100\n"
+ "source": [
+ "EXAMPLE 9.7 page no : 100\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nInitialization object\nSuppose you have a class EmcObject that requires initialization. The class provides a\nnested class Initor for that purpose. The implementation of Initor uses two mem-\nber functions provided by EmcObject, initialize and finalize, that do the\nactual initialization and finalization of the class. An initialization object should be cre-\nated before operating upon EmcObject objects.\n\nNote : Python does not have static stuff.\n'''\n\nclass EmcObject:\n def __init__(self):\n pass\n \n def __del__(self):\n pass\n \n def initialize(self):\n pass\n \n def finalize(self):\n pass",
+ "input": [
+ "\n",
+ "\n",
+ "class EmcObject:\n",
+ " def __init__(self):\n",
+ " pass\n",
+ " \n",
+ " def __del__(self):\n",
+ " pass\n",
+ " \n",
+ " def initialize(self):\n",
+ " pass\n",
+ " \n",
+ " def finalize(self):\n",
+ " pass"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -151,7 +236,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Chemical_Engineering_Thermodynamics/ch10_1.ipynb b/Chemical_Engineering_Thermodynamics/ch10_1.ipynb
index ed294198..0a1b388b 100644
--- a/Chemical_Engineering_Thermodynamics/ch10_1.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch10_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:3b50ad151f89e9ea380ce80c8112ec5468586c82e236862a1e3d8e194fa15249"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Preparation of fugacity and fugacity coefficient\n",
"\n",
"import math\n",
"\n",
@@ -113,8 +113,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of enthalpy entropy and internal energy change\n",
- "\n",
+ " \n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -249,8 +248,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of molar heat capacity\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 35 + 273.15;\t\t\t#[K] - Temperature\n",
"P = 10;\t\t\t#[atm] - Pressure\n",
@@ -307,8 +305,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final temperature after expansion\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"\n",
"# Variables\n",
@@ -387,8 +384,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of fugacity of liquid benzene\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 220 + 273.15;\t\t\t#[K] - Temperature\n",
"Tc = 562.2;\t\t\t#[K] - Critical temperature\n",
@@ -463,8 +459,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of molar enthalpy\n",
- "\n",
+ " \n",
"# Variables\n",
"# C = -0.067 + 30.7/T\n",
"# D = 0.0012 - 0.416/T\n",
@@ -520,8 +515,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of second and third virial coefficients and fugacity\n",
- "\n",
+ " \n",
"# Variables\n",
"# (1)\n",
"T = 311;\t\t\t#[K] - Temperature\n",
@@ -626,8 +620,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of second and third virial coefficients\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 0 + 273.15;\t\t\t#[K] - Temperature\n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
@@ -722,8 +715,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of work done and the exit temperature\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math\n",
"from scipy.integrate import quad \n",
@@ -948,8 +940,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of temperature and pressure\n",
- "\n",
+ " \n",
"# Variables\n",
"Vol = 0.15;\t\t\t #[m**(3)] - Volume of the cylinder\n",
"P_1 = 100.;\t\t\t #[bar] - Initial pressure\n",
@@ -1089,8 +1080,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of change of internal energy enthalpy entropy and exergy\n",
- "\n",
+ " \n",
"# Variables\n",
"P_1 = 80.;\t\t\t #[bar] - Initial pressure\n",
"P_1 = P_1*10.**(5);\t\t\t#[Pa]\n",
@@ -1187,8 +1177,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of change in enthalpy\n",
- "\n",
+ " \n",
"# Variables\n",
"T_1 = 500.;\t\t\t#[K] - Initial temperature\n",
"P_1 = 30.;\t\t\t#[atm] - Initial pressure\n",
@@ -1255,14 +1244,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final temperature\n",
- "\n",
- "#(1)\n",
- "#This part involves proving a relation in which no mathematical components are involved.\n",
- "#For proof refer to this example 10.14 on page number 354 of the book.\n",
- "\n",
- "\n",
- "#(2)\n",
+ " \n",
"\n",
"# Variables\n",
"Vol_1 = 0.1;\t\t\t#[m**(3)] - Initial volume of each compartment\n",
@@ -1311,8 +1293,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of work done and the exit temperature\n",
- "\n",
+ " \n",
"# Variables\n",
"P_1 = 1*10**(6);\t\t\t#[Pa] - Initial pressure\n",
"T_1 = 200 + 273.15;\t\t\t#[K] - Initial temperature\n",
@@ -1450,8 +1431,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of molar volume and fugacity\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 100 + 273.15;\t\t\t#[K] - Temperature\n",
"Tc = 647.1;\t\t\t#[K] - Critical temperature of water\n",
@@ -1514,9 +1494,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of enthalpy and entropy change\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 6;\t\t\t#[bar] - Initial pressure\n",
"P_1 = P_1*10**(5);\t\t\t#[Pa]\n",
"T_1 = 100 + 273.15;\t\t\t#[T] - Initial temperature\n",
@@ -1650,8 +1628,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of fugacity\n",
- "\n",
+ " \n",
"# Variables\n",
"P = 2.76*10**(6);\t\t\t#[N/m**(2)] - Pressure\n",
"T = 310.93;\t\t\t#[K] - Temperature\n",
@@ -1739,8 +1716,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of enthalpy change\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 50+273.15;\t\t\t#[K] - Temperature\n",
"P = 25.*10**(3);\t\t\t#[Pa] - Pressure\n",
@@ -1878,8 +1854,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of fugacity of water vapour\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 320 + 273.15;\t\t\t#[K]\n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
@@ -1975,8 +1950,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of change in internal energy\n",
- "\n",
+ " \n",
"# Variables\n",
"Vol = 0.057;\t\t\t#[m**(3)] - Volume of car tyre\n",
"P_1 = 300.;\t\t\t#[kPa] - Initial pressure\n",
@@ -2071,8 +2045,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of enthalpy and entropy change\n",
- "\n",
+ " \n",
"# Variables\n",
"T_1 = 150 + 273.15;\t\t\t#[K] - Initial emperature\n",
"T_2 = T_1;\t\t\t# Isothermal process\n",
@@ -2195,8 +2168,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final temperature and pressure\n",
- "\n",
"# Variables\n",
"Vol = 0.15;\t\t\t#[m**(3)]\n",
"T_1 = 170;\t\t\t#[K] - Initial emperature\n",
@@ -2370,8 +2341,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of vapour pressure\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 373.15;\t\t\t#[K]\n",
"Tc = 562.16;\t\t\t#[K]\n",
@@ -2460,8 +2430,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of vapour pressure\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 150 + 273.15;\t\t\t#[K]\n",
"Tc = 647.1;\t\t\t#[K]\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch11_1.ipynb b/Chemical_Engineering_Thermodynamics/ch11_1.ipynb
index fdf3f695..79f48f9c 100644
--- a/Chemical_Engineering_Thermodynamics/ch11_1.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch11_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ea5fa2ce45062851dc4892fcc5b621c33d72fa0443d476b1ef4133dade9e39b0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of volumes of ethanol and water\n",
- "\n",
+ " \n",
"import math\n",
"\n",
"# Variables\n",
@@ -89,8 +89,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Developing an expression\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 25+273.15;\t\t\t#[K] - Temperature\n",
"P = 1;\t\t\t#[atm]\n",
@@ -144,8 +143,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of enthalpies\n",
- "\n",
+ " \n",
"# Variables\n",
"#H = a*x_1 + b*x_2 +c*x_1*x_2\n",
"\n",
@@ -233,8 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of minimum work required\n",
- "\n",
+ " \n",
"# Variables\n",
"n = 1*10**(3);\t\t\t#[mol] - No of moles\n",
"P = 0.1;\t\t\t#[MPa] - Pressure of the surrounding\n",
@@ -289,8 +286,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of fugacity 0f the mixture\n",
- "\n",
+ " \n",
"# Variables\n",
"x_A = 0.20;\t\t\t# Mole fraction of A\n",
"x_B = 0.35;\t\t\t# Mole fraction of B\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch12_1.ipynb b/Chemical_Engineering_Thermodynamics/ch12_1.ipynb
index 6b7a0b02..0ee70a67 100644
--- a/Chemical_Engineering_Thermodynamics/ch12_1.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch12_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:acb0234cca7ef04cf2e231ae1d04809101d746587fbd14cf847d456347c563ea"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of partial molar volume\n",
- "\n",
+ " \n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -116,8 +116,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of volume of the mixture\n",
- "\n",
+ " \n",
"# Variables\n",
"#component 1 = water\n",
"#component 2 = methanol\n",
@@ -187,11 +186,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of volumes\n",
+ " \n",
+ " \n",
"\n",
- "# Variables\n",
- "#component 1 = methanol\n",
- "#component 2 = water\n",
"Vol = 20;\t\t\t#[cm**(3)] - Volume of the solution\n",
"T = 22 + 273.15;\t\t\t#[K] - Temperature\n",
"W_bottle = 11.5485;\t\t\t#[g] - Weight of density bottle\n",
@@ -322,8 +319,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of partial molar volumes\n",
- "\n",
+ " \n",
"from numpy import *\n",
"\n",
"\n",
@@ -429,8 +425,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of enthalpy\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 40 + 273.15;\t\t\t#[K] - Temperature\n",
"\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch13_1.ipynb b/Chemical_Engineering_Thermodynamics/ch13_1.ipynb
index 4dce9007..3cee342e 100644
--- a/Chemical_Engineering_Thermodynamics/ch13_1.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch13_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:894f18dec91baf4a10867e0d301a68220274d02a1e24c4e2bef1038061daa009"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -28,8 +29,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Caculation of fugacity coefficients\n",
- "\n",
+ " \n",
"import math \n",
"\n",
"\n",
@@ -136,8 +136,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of fugacity coefficients\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch14_1.ipynb b/Chemical_Engineering_Thermodynamics/ch14_1.ipynb
index 03350db4..be081f3c 100644
--- a/Chemical_Engineering_Thermodynamics/ch14_1.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch14_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:98f2e1e0f1c561d3ee302fd629093b7572c8b263613f73036059e7020f90d8cc"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Proving a mathematical relation\n",
- "\n",
+ " \n",
"import math\n",
"\n",
"# Variables,\n",
@@ -93,9 +93,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Comparision of Margules and van Laar eqations\n",
- "\n",
- "\n",
+ " \n",
"import math \n",
"from numpy import zeros\n",
"from scipy.stats import linregress\n",
@@ -169,8 +167,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of activity coefficients\n",
- "\n",
+ " \n",
"# Variables,\n",
"T = 60 + 273.15;\t\t\t#[K] - Temperature\n",
"R = 1.987;\t\t\t#[cal/mol*K] - Universal gas constant\n",
@@ -244,8 +241,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the value of activity coefficients\n",
- "\n",
+ " \n",
"# Variables \n",
"T = 307;\t\t\t#[K]\n",
"x_1 = 0.047;\n",
@@ -372,8 +368,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the value of activity coefficients\n",
- "\n",
+ " \n",
"# Variables,\n",
"T = 25 + 273.15;\t\t\t#[K] - Temperature\n",
"R = 1.987;\t\t\t#[cal/mol*K] - Universal gas constant\n",
@@ -426,8 +421,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the value of activity coefficients\n",
- "\n",
+ " \n",
"# Variables,\n",
"T = 25 + 273.15;\t\t\t#[K] - Temperature\n",
"mol_HCl = 0.001;\t\t\t#[mol/kg] - Molality of HCl\n",
@@ -479,8 +473,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the value of activity coefficients\n",
- "\n",
+ " \n",
"# Variables,\n",
"T = 25 + 273.15;\t\t\t#[K] - Temperature\n",
"mol_CaCl2 = 0.001;\t\t\t#[mol/kg] - Molality of HCl\n",
@@ -528,8 +521,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Proving a mathematical relation\n",
- "\n",
+ " \n",
"# Variables,\n",
"T = 50 + 273.15;\t\t\t#[K] - Temperature\n",
"R=8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
@@ -583,8 +575,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculation of enthalpy entropy and Gibbs free energy\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 293.15;\t\t\t#[K] - Temperature\n",
"R=8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
@@ -654,8 +645,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of Gibbs free energy and enthalpy change\n",
- "\n",
+ " \n",
"# Given\n",
"T = 60 + 273.15;\t\t\t#[K] - Temperature\n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch15_1.ipynb b/Chemical_Engineering_Thermodynamics/ch15_1.ipynb
index ad62c947..fcfb0cd5 100644
--- a/Chemical_Engineering_Thermodynamics/ch15_1.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch15_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:aa6f699613cdf9bcba2dda4617212630ca1760d21939d5cd99d17e7e03b7e885"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of number of moles in liquid and vapour phase\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 90+ 273.15;\t\t\t#[K] - Temperature\n",
"P = 1;\t\t\t#[atm] - Pressure\n",
@@ -97,8 +97,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure temperature and composition\n",
- "\n",
+ " \n",
"import math\n",
"\n",
"# Variables\n",
@@ -232,14 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure temperature and composition\n",
- "\n",
- "# Variables\n",
- "\t\t\t# math.log(P_1_sat) = 14.3916 - 2795.82/(t + 230.00)\n",
- "\t\t\t# math.log(P_2_sat) = 14.2724 - 2945.47/(t + 224.00)\n",
- "\t\t\t# math.log(P_3_sat) = 14.2043 - 2972.64/(t + 209.00)\n",
- "\n",
- "\t\t\t#(a)\n",
+ " \n",
"x_1_a = 0.25;\t\t\t# Equilibrium composition of liquid phase\n",
"x_2_a = 0.35;\n",
"x_3_a = 1 - x_1_a - x_2_a;\n",
@@ -381,8 +373,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure and composition\n",
- "\n",
+ " \n",
"import math\n",
"\n",
"# Variables\n",
@@ -458,8 +449,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure temperature and composition\n",
- "\n",
+ " \n",
"import math\n",
"# Variables\n",
"T = 27;\t\t\t#[C] - Temperature\n",
@@ -556,8 +546,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determinatin of DPT and BPT\n",
- "\n",
+ " \n",
"# Variables\n",
"P = 90;\t\t\t#[kPa] - Pressure\n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
@@ -639,8 +628,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of range of temperature for which two phase exists\n",
- "\n",
+ " \n",
"# Variables\n",
"P = 1;\t\t\t#[bar] - Pressure\n",
"P = P*10**(2);\t\t\t#[kPa]\n",
@@ -732,8 +720,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of DPT and BPT\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
@@ -859,8 +846,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of range of pressure for which two phase exists\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
@@ -959,8 +945,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of vapour and liquid phase composition\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 50;\t\t\t#[C] - Temperature\n",
"P = 64;\t\t\t#[kPa] - Pressure\n",
@@ -1037,8 +1022,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of temperature\n",
- "\n",
+ " \n",
"# Variables\n",
"P = 12.25*101325*10**(-3);\t\t\t#[kPa]\n",
"z_1 = 0.8;\n",
@@ -1121,8 +1105,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of number of moles in liquid and vapour phase\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 105;\t\t\t#[C]\n",
"P = 1.5;\t\t\t#[atm]\n",
@@ -1173,8 +1156,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of vapour and liquid phase composition\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 90;\t\t\t#[C]\n",
"P = 1;\t\t\t#[atm]\n",
@@ -1235,8 +1217,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Preparation of table having composition and pressure data\n",
- "\n",
+ " \n",
"from numpy import zeros\n",
"\n",
"# Variables\n",
@@ -1340,8 +1321,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of DPT and BPT\n",
- "\n",
+ " \n",
"# Variables\n",
"P_1_sat = 79.80;\t\t\t#[kPa]\n",
"P_2_sat = 40.45;\t\t\t#[kPa]\n",
@@ -1409,7 +1389,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure\n",
+ "\n",
"\n",
"# Variables\n",
"T = 78.15;\t\t\t#[C]\n",
@@ -1473,8 +1453,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of van Laar activity coefficient parameters\n",
- "\n",
+ " \n",
"from scipy.stats import linregress\n",
"\n",
"# Variables\n",
@@ -1546,8 +1525,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Prediction of azeotrrope formation\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
@@ -1623,8 +1601,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Tabulation of activity coefficients relative volatility and compositions\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 45;\t\t\t#[C] - Temperature\n",
"\n",
@@ -1733,8 +1710,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Tabulation of partial pressure and total pressure data of components\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 25;\t\t\t#[C] - Temperature\n",
"P_1_sat = 230.4;\t\t\t#[mm Hg]\n",
@@ -1837,9 +1813,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of azeotrope formation\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 50;\t\t\t#[C]\n",
"\t\t\t# At 50 C\n",
"P_1_sat = 0.67;\t\t\t#[atm]\n",
@@ -1923,8 +1897,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Tabulation of pressure and composition data\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 25;\t\t\t#[C]\n",
"\t\t\t# At 50 C\n",
@@ -2027,8 +2000,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of van Laar parameters\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 58.7;\t\t\t#[C]\n",
"P = 1;\t\t\t#[atm]\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch16_1.ipynb b/Chemical_Engineering_Thermodynamics/ch16_1.ipynb
index 902f4a5c..69003cd3 100644
--- a/Chemical_Engineering_Thermodynamics/ch16_1.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch16_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:a00a89ec39a5812cdf143d7f00f601a0bb401404f1638737e2689f71d07acb65"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of solubility\n",
- "\n",
+ " \n",
"import math \n",
"\n",
"# Variables\t\t\t\n",
@@ -125,8 +125,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of solubility\n",
- "\n",
+ " \n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
@@ -201,8 +200,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of composition\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
@@ -289,8 +287,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of equilibrium composition\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 300;\t\t\t#[K]\n",
"R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
@@ -334,9 +331,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of freezing point depression\n",
- "\n",
- "# Variables\n",
+ " \n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
"M_wt_meth = 32;\t\t\t# Molecular weight of methanol \n",
"M_wt_water = 18;\t\t\t# Molecular weight of water \n",
@@ -387,8 +382,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of freezing point\n",
- "\n",
+ " \n",
"# Variables\n",
"R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
"T_f = 273.15;\t\t\t#[K] - Freezing point of water\n",
@@ -445,8 +439,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determination of boiling point elevation \n",
- "\n",
+ " \n",
"# Variables\n",
"R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
"T_b = 373.15;\t\t\t#[K] - Boiling point of water\n",
@@ -497,8 +490,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of osmotic pressure\n",
- "\n",
+ " \n",
"# Variables\n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
"T = 25 + 273.15;\t\t\t#[K] - Surrounding temperature \n",
@@ -549,7 +541,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of pressure\n",
"\n",
"# Variables\n",
"R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
@@ -612,8 +603,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determination of amount of precipitate\n",
- "\n",
+ " \n",
"# Variables\n",
"R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
"T = 173.15;\t\t\t#[K] - Surrounding temperature\n",
@@ -678,8 +668,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure\n",
- "\n",
+ " \n",
"# Variables\n",
"R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n",
"T = 350.;\t\t\t#[K] - Surrounding temperature\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch17_1.ipynb b/Chemical_Engineering_Thermodynamics/ch17_1.ipynb
index f87043e6..004b3bab 100644
--- a/Chemical_Engineering_Thermodynamics/ch17_1.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch17_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:e354b0525ce1aff27214eb76f8a2c9be56cfff2939a8a4b8688a7fe1cea4959c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of number of moles\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
@@ -165,8 +165,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of equilibrium composition\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 600;\t\t\t#[K] - Reactor temperature\n",
"P = 300;\t\t\t#[atm] - Reactor pressure\n",
@@ -236,8 +235,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the value of equilibrium constant\n",
- "\n",
+ " \n",
"# Variables\t\t\n",
"T = 600;\t\t\t#[K] - Reactor temperature\n",
"P = 4;\t\t\t#[atm] - Reactor pressure\n",
@@ -332,8 +330,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of mole fraction\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 400;\t\t\t#[K] - Reactor temperature\n",
"P = 1;\t\t\t#[atm] - Reactor pressure\n",
@@ -380,7 +377,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of number of moles\n",
+ " \n",
"\n",
"# Variables\n",
"T = 749.;\t\t\t#[K] - Reactor temperature\n",
@@ -479,7 +476,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# \t\tCalculation of mole fraction\n",
+ " \n",
"\n",
"# Variables\n",
"T = 500;\t\t\t#[K]\n",
@@ -612,7 +609,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Dtermination of heat of reaction \n",
+ " \n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
@@ -740,7 +737,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Tabulation of equilibrium constant values\n",
+ " \n",
"\n",
"from numpy import *\n",
"\n",
@@ -859,7 +856,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of mean standard enthalpy of reaction\n",
+ " \n",
"\n",
"# Variables\n",
"\t\t\t# SO2 + (1/2)*O2 - SO3\n",
@@ -905,7 +902,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of equilibrium composition\n",
+ " \n",
"\n",
"# Variables\n",
"T_1 = 298.15;\t\t\t#[K]\n",
@@ -1069,7 +1066,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of equilibrium composition\n",
+ " \n",
"\n",
"# Variables\n",
"T = 25 + 298.15;\t\t\t#[K] - Temperature\n",
@@ -1135,7 +1132,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the\n",
+ " \n",
"\n",
"# Variables\t\t\t\n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n",
@@ -1219,7 +1216,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the value of Gibbs free energy\n",
+ " \n",
"\n",
"# Variables\n",
"\t\t\t# CaCO3 (s1) - CaO (s2) + CO2 (g)\n",
@@ -1284,7 +1281,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of nu\n",
+ " \n",
"\n",
"# Variables\n",
"T = 700 + 273.15;\t\t\t#[K]\n",
@@ -1359,8 +1356,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of value of the equilibrium constant\n",
- "\n",
+ " \n",
"# Variables \n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n",
"T_2 = 1042;\t\t\t#[K] - Reaction temperature\n",
@@ -1456,7 +1452,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the value of equilibrium constant\n",
+ " \n",
"\n",
"# Variables \n",
"T_1 = 298.15;\t\t\t#[k] - Smath.tan(math.radiansard reaction temperature\n",
@@ -1545,8 +1541,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of standard equilibrium cell voltage\n",
- "\n",
+ " \n",
"# Variables\n",
"delta_G_H2O_298 = -237.034;\t\t\t#[kJ/mol] - Smath.tan(math.radiansard Gibbs free energy of formation of H2O (l) at 298 K\n",
"F = 96485;\t\t\t#[C/mol] - Faraday constant\n",
@@ -1614,8 +1609,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of number of chemical reactions\n",
- "\n",
+ " \n",
"# Variables\t\t\t\n",
"P = 2;\t\t\t# Number of phases\n",
"C = 5;\t\t\t# Number of components\n",
@@ -1704,8 +1698,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of number of chemical reactions\n",
- "\n",
+ " \n",
"# Variables\t\t\t\n",
"T = 400.;\t\t\t#[K] - Temperature\n",
"P = 1.;\t\t\t#[atm] - Pressure\n",
@@ -1866,9 +1859,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of equilibrium composition\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 600;\t\t\t#[K] - Temperature\n",
"P = 1;\t\t\t#[atm] - Pressure\n",
"R = 1.987;\t\t\t#[cal/mol-K] - Universal gas consatnt\n",
@@ -1974,9 +1965,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of number of moles\n",
- "\n",
- "# Variables \n",
+ " \n",
"T = 600 + 273.15;\t\t\t#[K] - Reaction temperature\n",
"P = 1;\t\t\t#[atm] - Reaction pressure\n",
"\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch18_1.ipynb b/Chemical_Engineering_Thermodynamics/ch18_1.ipynb
index 730764b8..46865b0c 100644
--- a/Chemical_Engineering_Thermodynamics/ch18_1.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch18_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:32121f42f5b148741ef15da1993d191234c228c3ab7dcf05f69114fbe323a883"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of heat transfer\n",
- "\n",
+ " \n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -124,7 +124,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of adiabatic flame temperature\n",
+ " \n",
"\n",
"from scipy.optimize import fsolve \n",
"\n",
@@ -205,8 +205,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of mole fraction and average heat capacity\n",
- "\n",
+ " \n",
"# Variables\n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n",
"\n",
@@ -258,8 +257,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of adiabatic flame temperature\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"\n",
"\n",
@@ -348,8 +346,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of conversion\n",
- "\n",
+ " \n",
"# Variables\n",
"\t\t\t# N2 + 3H2 - 2NH3\n",
"T_1 = 700;\t\t\t#[K] - Reaction temperature\n",
@@ -406,8 +403,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of maximum pressure\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -497,7 +493,7 @@
"input": [
"from scipy.optimize import fsolve\n",
"import math\n",
- "# Calculation of number of moles\n",
+ " \n",
"\n",
"# Variables\n",
"T_1 = 400 + 273.15;\t\t\t#[K]\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch1_2.ipynb b/Chemical_Engineering_Thermodynamics/ch1_2.ipynb
index 558a147b..b7e6716d 100644
--- a/Chemical_Engineering_Thermodynamics/ch1_2.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch1_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:05ef5db2afef7232054abda0278780d1df8c92b807546fcd7648e8885fa4539f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure and heat transfer in piston cylinder assembly\n",
- "\n",
+ "# \n",
"# Variables\n",
"#(a)\n",
- "# The pressure in the cylinder is due to the weight of the piston and due to surroundings pressure\n",
+ " \n",
"m = 50.;\t\t\t#[kg] - Mass of piston\n",
"A = 0.05;\t\t\t#[m**(2)] - Area of piston\n",
"g = 9.81;\t\t\t#[m/s**(2)] - Acceleration due to gravity\n",
@@ -75,7 +75,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of mass of air contained in a room\n",
+ " \n",
"\n",
"# Variables\n",
"P = 1.;\t\t\t#[atm] - Atmospheric pressure\n",
@@ -123,7 +123,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of work done\n",
+ " \n",
"\n",
"# Variables\n",
"P1 = 3.;\t\t\t# [bar] - initial pressure\n",
@@ -191,7 +191,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of wind energy per unit mass and diameter of the wind turbine\n",
+ " \n",
"\n",
"# Variables\n",
"#(a)\n",
@@ -243,8 +243,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of temperature\n",
- "\n",
+ " \n",
"# Given\n",
"P = 1.;\t\t\t # [bar] - atospheric pressure\n",
"P1guz = 0.75;\t\t\t# [bar] - gauze pressure in 1st evaporator\n",
@@ -289,8 +288,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of dryness fraction of steam\n",
- "\n",
+ " \n",
"# Variables\n",
"V = 1.;\t\t\t # [kg] - volume of tank\n",
"P = 10.;\t\t\t# [bar] - pressure\n",
@@ -335,8 +333,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of pressure mass and volume\n",
- "\n",
+ " \n",
"# Variables\n",
"V = 1.;\t\t\t# [m**(3)] - volume of tank\n",
"M = 10.;\t\t\t# [m**(3)] - total mass\n",
@@ -394,8 +391,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of heat supplied\n",
- "\n",
+ " \n",
"# Variables\n",
"V = 10.;\t\t\t# [m**(3)] - volume of vessel\n",
"P_1 = 1.;\t\t\t# [bar] - initial pressure\n",
@@ -464,8 +460,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of saturation temperature\n",
- "\n",
+ " \n",
"# Variables\n",
"#Antoine equation for water ln(Psat)=16.262-(3799.89/(T_sat + 226.35))\n",
"P = 2.;\t\t\t#[atm] - Pressure\n",
@@ -511,8 +506,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure and temperature at triple point\n",
- "\n",
+ " \n",
"# Variables\n",
"# math.log(P)=-(1640/T)+10.56 (solid)\n",
"# math.log(P)=-(1159/T)+7.769 (liquid)%where T is in K\n",
@@ -556,8 +550,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of value of R Cp0 and Cv0\n",
- "\n",
+ " \n",
"# Variables\n",
"M_O2 = 31.999;\t\t\t#molecular weight of oxygen\n",
"M_N2 = 28.014;\t\t\t#molecular weight of nitrogen\n",
@@ -606,8 +599,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of molar heat capacity\n",
- "\n",
+ " \n",
"# Variables\n",
"Y = 1.4;\t\t\t#molar heat capacities ratio for air\n",
"R = 8.314;\t\t\t# [J/mol*K] - Universal gas constant\n",
@@ -646,8 +638,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of mean heat capacity\n",
- "\n",
+ " \n",
"from scipy.integrate import quad\n",
"\n",
"# Variables\n",
@@ -690,8 +681,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of enthalpy of water\n",
- "\n",
+ " \n",
"# Variables\n",
"#(a)\n",
"P_1 = 0.2;\t\t\t# [MPa] - pressure\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch2_2.ipynb b/Chemical_Engineering_Thermodynamics/ch2_2.ipynb
index 659ed555..b3f8bd13 100644
--- a/Chemical_Engineering_Thermodynamics/ch2_2.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch2_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:6aa23fb1475338cf467e7afb5732b8b9e456bbb3ad63c14224d73232d920457e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -28,8 +29,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of acentric factor\n",
- "\n",
+ " \n",
"import math\n",
"\n",
"# Variables\n",
@@ -71,8 +71,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of acentric factor\n",
- "\n",
+ " \n",
"# Variables\n",
"\t\t\t#math.log10(Psat)=8.1122-(1592.864/(t+226.184))\t\t\t# 'Psat' in [mm Hg] and 't' in [c]\n",
"Tc = 513.9;\t\t\t#[K] - Critical temperature\n",
@@ -116,8 +115,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of virial coefficients\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 380;\t\t\t#[K] - Temperature\n",
"Tc = 562.1;\t\t\t#[K] - Critical temperature\n",
@@ -173,8 +171,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of mass using virial equation of state\n",
- "\n",
+ " \n",
"# Variables\n",
"V_1 = 0.3;\t\t\t#[m**(3)]\t\t\t#volume of cylinder\n",
"T = 60+273.15;\t\t\t#[K] - Temperature\n",
@@ -234,8 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of molar volume\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 373.15;\t\t\t#[K] - Temperature\n",
"P = 101325;\t\t\t#[N/m**(2)] - Pressure\n",
@@ -288,8 +284,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of molar volume and virial coefficients\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 50+273.15;\t\t\t#[K] - Temperature\n",
"P = 15*10**(5)\t\t\t#[N/m**(2)] - Pressure\n",
@@ -405,9 +400,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of second and third virial coefficients\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 0 + 273.15;\t\t\t#[K] - Temperature\n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
"from numpy import linalg,array\n",
@@ -464,9 +457,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of second virial coefficient\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 444.3;\t\t\t#[K] - Temperature\n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
"B_11 = -8.1;\t\t\t#[cm**(3)/mol]\n",
@@ -532,9 +523,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of molar volume\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 71+273.15;\t\t\t#[K] - Temperature\n",
"P = 69*10**(5)\t\t\t#[N/m**(2)] - Pressure\n",
"y1 = 0.5;\t\t\t#[mol] - mole fraction of equimolar mixture\n",
@@ -625,9 +614,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of maximum temperature\n",
- "\n",
- "# Variables\n",
+ " \n",
"P = 6.*10**(6)\t\t\t# [Pa] - Pressure\n",
"P_max = 12.*10**(6)\t\t\t# [Pa] - Max pressure to which cylinder may be math.exposed\n",
"T = 280.;\t\t\t#[K] - Temperature\n",
@@ -755,10 +742,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure\n",
- "\n",
- "# Variables\n",
- "\n",
+ " \n",
"V_vessel = 0.1;\t\t\t#[m**(3)]\t\t\t# Volume of vessel\n",
"T = 25 + 273.15;\t\t#[K] - Temperature\n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
@@ -815,9 +799,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure\n",
- "\n",
- "# Variables\n",
+ " \n",
"\n",
"V_vessel = 360*10**(-3)\t\t\t#[m**(3)] - volume of vessel\n",
"T = 62+273.15;\t\t\t#[K] - Temperature\n",
@@ -905,9 +887,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of compressibility factor\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 500+273.15;\t\t\t#[K] - Temperature\n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
"P = 325*1000;\t\t\t#[Pa] - Pressure\n",
@@ -981,8 +961,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of molar volume\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve\n",
"\n",
"\n",
@@ -1054,8 +1033,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of volume\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 500+273.15;\t\t\t#[K] - Temperature\n",
"P = 15.;\t\t\t#[atm] - Pressure\n",
@@ -1173,8 +1151,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of compressibility factor\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 310.93;\t\t\t#[K] - Temperature\n",
"P = 2.76*10**(6)\t\t\t#[N/m**(2)] - Pressure\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch3_2.ipynb b/Chemical_Engineering_Thermodynamics/ch3_2.ipynb
index dd655676..1dbe2b34 100644
--- a/Chemical_Engineering_Thermodynamics/ch3_2.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch3_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:8255c3a74c7b52da7fb922c8e6e009ed3e07e5e50a88f1302c38a2c832cbdc1f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of temperature\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
@@ -149,8 +149,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of heat required\n",
- "\n",
+ " \n",
"import math\n",
"\n",
"# Variables\n",
@@ -208,8 +207,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of temperature internal energy and enthalpy\n",
- "\n",
+ " \n",
"# Variables\n",
"M_vap_sat = 0.22;\t\t\t#[kg] - mass of saturated vapour\n",
"M_liq_sat = 1.78;\t\t\t#[kg] - mass of saturated liquid\n",
@@ -283,8 +281,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work done\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -369,8 +366,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work done\n",
- "\n",
+ " \n",
"# Variables\n",
"\n",
"T = 300;\t\t\t#[K] - Temperature\n",
@@ -491,8 +487,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work done\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 125+273.15;\t\t\t#[K] - Temperature\n",
"P1 = 1;\t\t\t#[bar] - Initial pressure\n",
@@ -654,9 +649,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work done\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 20 + 273.15;\t\t\t#[K] - Temperature\n",
"P_1 = 140.;\t\t\t#[kPa] - Initial pressure\n",
"P_1 = P_1*10.**(3);\t\t\t#[Pa]\n",
@@ -723,9 +716,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final temperature\n",
- "\n",
- "# Variables\n",
+ " \n",
"m_ice = 1000;\t\t\t#[g] - Mass of ice\n",
"m_water = 1000;\t\t\t#[g] - Mass of water\n",
"T_ice = 273.15;\t\t\t#[K] - Temperature of ice\n",
@@ -790,8 +781,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final pressure\n",
- "\n",
+ " \n",
"# Variables\n",
"n = 1.5;\t\t\t# - ratio of heat capacities\n",
"T_1 = 500.;\t\t\t#[K] - Initial temperature\n",
@@ -852,9 +842,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of slope and work done\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 150*10**(3);\t\t\t#[Pa] - Initial pressure\n",
"V_1 = 0.001;\t\t\t#[m**(3)] - Initial volume\n",
"P_2 = 1000*10**(3);\t\t\t#[Pa] - Final pressure\n",
@@ -914,9 +902,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work done and final temperature\n",
- "\n",
- "# Variables\n",
+ " \n",
"V = 36;\t\t\t#[L] - Vol of gas on each side\n",
"P_1 = 1;\t\t\t#[atm] - pressure on left side of the piston\n",
"P_1 = P_1*101325;\t\t\t#[Pa]\n",
@@ -1001,9 +987,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of powerand discharge head\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_2 = 0.2;\t\t\t#[bar]\n",
"P_2 = P_2*10**(5);\t\t\t#[Pa]\n",
"int_dia_2 = 2.4*10**(-2);\t\t\t#[m] - internal diameter at state 2.\n",
@@ -1059,9 +1043,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of discharge velocity\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 1000.;\t\t\t#[K] - Temperature at entry\n",
"P_1 = 0.6;\t\t\t#[MPa] - Pressure at entry\n",
"P_2 = 0.2;\t\t\t#[MPa] - Exit pressure\n",
@@ -1117,9 +1099,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of change in enthalpy\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_entry = 10;\t\t\t#[bar] - Pressure at entry\n",
"V_entry = 200;\t\t\t#[m/s] - Velocity at entry\n",
"P_exit = 1;\t\t\t#[bar] - Vressure at exit\n",
@@ -1162,9 +1142,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work done and change in enthalpy\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 280;\t\t\t#[K] - Temperature at entry\n",
"P_1 = 100;\t\t\t#[kPa] - Pressure at entry\n",
"T_2 = 400;\t\t\t#[K] - Temperature at exit\n",
@@ -1226,9 +1204,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work done per unit mass\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 300;\t\t\t#[K] - Temperature at entry\n",
"P_1 = 100;\t\t\t#[kPa] - Pressure at entry\n",
"P_2 = 900;\t\t\t#[kPa] - Pressure at exit\n",
@@ -1296,9 +1272,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of inlet and outlet velocity and power\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 600;\t\t\t#[C] - Temperature at entry\n",
"P_1 = 15;\t\t\t#[MPa] - Pressure at entry\n",
"T_2 = 400;\t\t\t#[K] - Temperature at exit\n",
@@ -1360,9 +1334,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Proving a mathematical relation\n",
- "\n",
- "# Variables,\n",
+ " \n",
"R = 8.314;\t\t\t#[J/mol-K] - Universal gas constant\n",
"Cp_0 = 2.5*R;\t\t\t#[J/mol-K] - Specific heat capacity at constant pressure\n",
"Cv_0 = 1.5*R;\t\t\t#[J/mol-K] - Specific heat capacity at constant volume\n",
@@ -1403,9 +1375,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of equilibrium temperature\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 40 + 273.15;\t\t\t#[K] - Initial temperature.\n",
"P_1 = 1;\t\t\t#[bar] - Initial pressure.\n",
"P_1 = P_1*10**(5);\t\t\t#[Pa]\n",
@@ -1474,9 +1444,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of mass\n",
- "\n",
- "# Variables\n",
+ " \n",
"V_total = 5;\t\t\t#[L] - Volume of pressure cooker.\n",
"V_total = V_total*10**(-3);\t\t\t#m**(3)\n",
"P_gauze = 15;\t\t\t#[psi] - Operating pressure (gauze)of pressure cooker.\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch4_2.ipynb b/Chemical_Engineering_Thermodynamics/ch4_2.ipynb
index 2e333961..52c2044d 100644
--- a/Chemical_Engineering_Thermodynamics/ch4_2.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch4_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:8185298e7063d37f738c422b0f9a0946dd677189cdf544f54e436d8d650cb521"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of entropy change\n",
- "\n",
+ " \n",
"import math\n",
"\n",
"# Variables\n",
@@ -117,8 +117,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of whether the process is reversible or not\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 400.;\t\t\t#[K] - Temperature\n",
"P_1 = 500.*10**(3);\t\t\t#[Pa] - Initial pressure\n",
@@ -184,9 +183,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final pressure temperature and increase in entropy\n",
- "\n",
- "# Variables\n",
+ " \n",
"R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n",
"\t\t\t# For side A\n",
"V_A = 1;\t\t\t#[L] - Volume\n",
@@ -261,9 +258,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# CAlculation of final temperature heat transfer and change of entropy\n",
- "\n",
- "# Variables\n",
+ " \n",
"V_vessel = 0.2;\t\t\t#[m**(3)] - Volume of the vessel\n",
"P_1 = 10;\t\t\t#[bar] - Initial pressure inside the vessel\n",
"P_1 = P_1*10**(5);\t\t\t#[Pa]\n",
@@ -358,8 +353,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final temperature work and heat transfer\n",
- "\n",
+ " \n",
"from math import *\n",
"# Variables\n",
"m = 1000.;\t\t\t#[g] - Mass of fluid\n",
@@ -477,8 +471,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final temperature and work done\n",
- "\n",
+ " \n",
"# Variables\n",
"m = 1000;\t\t\t#[g] - Mass of fluid\n",
"P_1 = 20;\t\t\t#[bar] - Initial pressure\n",
@@ -556,8 +549,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of index of isentropic expansion\n",
- "\n",
+ " \n",
"# Variables\n",
"P_1 = 15.;\t\t\t#[bar] - Initial pressure\n",
"P_2 = 0.15;\t\t\t#[bar] - Final pressure\n",
@@ -622,9 +614,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of entropy production\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 40;\t\t\t#[bar] - Initial pressure\n",
"T_1 = 500;\t\t\t#[C] - Initial temperature\n",
"Vel_1 = 140;\t\t\t#[m/s] - Initial velocity\n",
@@ -692,9 +682,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of work required and exit temperature\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 1.;\t\t\t#[MPa] - Initial pressure\n",
"T_1 = 200 + 273.15;\t\t\t#[K] - Initial temperature\n",
"P_2 = 8.;\t\t\t#[MPa] - Final pressure\n",
@@ -757,8 +745,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of work required and exit temperature\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -847,8 +834,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of work required and exit temperature\n",
- "\n",
+ " \n",
"# Variables\n",
"P_1 = 1;\t\t\t#[MPa] - Initial pressure\n",
"T_1 = 200 + 273.15;\t\t\t#[K] - Initial temperature\n",
@@ -934,9 +920,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of work required and discharge temperature\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 140.;\t\t\t#[kPa] - Initial pressure\n",
"T_1 = 20. + 273.15;\t\t\t#[K] - Initial temperature\n",
"P_2 = 560.;\t\t\t#[kPa] - Final pressure\n",
@@ -1021,9 +1005,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Dtermination of power output entropy and exit temperature\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 10;\t\t\t#[bar] - Initial pressure\n",
"T_1 = 500 + 273.15;\t\t\t#[K] - Initial temperature\n",
"P_2 = 2;\t\t\t#[psia] - Final pressure\n",
@@ -1135,9 +1117,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work output per unit mass\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 6;\t\t\t#[MPa] - Initial pressure\n",
"T_1 = 500 + 273.15;\t\t\t#[K] - Initial temperature\n",
"P_2 = 10;\t\t\t#[kPa] - Final pressure\n",
@@ -1231,9 +1211,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of final velocity\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 3.;\t\t\t#[bar] - Initial pressure\n",
"T_1 = 150. + 273.15;\t\t\t#[K] - Initial temperature\n",
"Vel_1 = 90.;\t\t\t#[m/s] - Initial velocity\n",
@@ -1312,8 +1290,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final velocity and increase in entropy\n",
- "\n",
+ " \n",
"# Variables\n",
"P_1 = 300.;\t\t\t#[kPa] - Initial pressure\n",
"T_1 = 450.;\t\t\t#[K] - Initial temperature\n",
@@ -1387,9 +1364,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work done and heat transfer\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 1;\t\t\t#[bar] - Initial pressure\n",
"T_1 = 150 + 273.15;\t\t\t#[K] - Initial temperature\n",
"V_2 = 0.28;\t\t\t#[m**(3)/kg] - Final specific volume\n",
@@ -1474,9 +1449,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of air velocity and change in entropy\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 7*10**(5);\t\t\t#[Pa] - Initial pressure\n",
"T_1 = 95 + 273.15;\t\t\t#[K] - Initial temperature\n",
"P_2 = 3.5*10**(5);\t\t\t#[Pa] - Final pressure\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch5_2.ipynb b/Chemical_Engineering_Thermodynamics/ch5_2.ipynb
index db8558ce..82489a66 100644
--- a/Chemical_Engineering_Thermodynamics/ch5_2.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch5_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:beb354ab1f11a4413c580f54f984be6db9b7dd2c39bed82bc1f4874533d75759"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of fraction of the availability loss\n",
- "\n",
+ " \n",
"import math\n",
"\n",
"# Variables\n",
@@ -76,8 +76,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of availability change and irreversibility\n",
- "\n",
+ " \n",
"# Variables\n",
"T_1 = 300.;\t\t\t#[K] - Initial temperature.\n",
"P_1 = 100.;\t\t\t#[kPa] - Initial pressure.\n",
@@ -143,8 +142,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of availability change and irreversibility\n",
- "\n",
+ " \n",
"import math\n",
"# Variables\n",
"P_1 = 15.;\t\t\t#[bar] - Initial pressure\n",
@@ -296,9 +294,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of useful work and irreversibility\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 150+273.15;\t\t\t#[K] - Initial temperature.\n",
"m = 4.6;\t\t\t#[kg] - mass of water\n",
"P_1 = 1;\t\t\t#[MPa] - Initial pressure\n",
@@ -380,9 +376,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of reversible work and irreversibility\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 700+273.15;\t\t\t#[K] - Initial temperature.\n",
"P_1 = 12;\t\t\t#[MPa] - Initial pressure\n",
"P_2 = 0.6;\t\t\t#[MPa] - Final pressure\n",
@@ -480,9 +474,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of maximum obtainable work and efficiency\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_1 = 8.;\t\t\t#[bar] - Initial pressure\n",
"T_1 = 93. + 273.15;\t\t\t#[C] - Initial temperature\n",
"V_1 = 100.;\t\t\t#[m/s] - Initial velocity\n",
@@ -545,9 +537,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of entropy generation rate and irreversibility\n",
- "\n",
- "# Variables\n",
+ " \n",
"m_cold_water = 60;\t\t\t#[kg/s] - mass flow rate of cold water\n",
"P_1 = 50;\t\t\t#[kPa]\n",
"T_2 = 250;\t\t\t#[C]\n",
@@ -617,9 +607,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of exit temperature entropy and irreversibility rate\n",
- "\n",
- "# Variables\n",
+ " \n",
"m_water = 10000.;\t\t\t#[kg/h] - Mass flow rate of cold water\n",
"m_water = m_water/3600;\t\t\t#[kg/s]\n",
"T_1_water = 30. + 273.15;\t\t\t#[K] - Cold water entering temperature\n",
@@ -686,9 +674,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determinatio of exit temperature availability change and irreversibility\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1_hotgas = 800.;\t\t\t#[K]\n",
"P_1_hotgas = 1.;\t\t\t#[bar]\n",
"T_2_hotgas = 700.;\t\t\t#[K]\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch6_2.ipynb b/Chemical_Engineering_Thermodynamics/ch6_2.ipynb
index 301b4be1..71808e15 100644
--- a/Chemical_Engineering_Thermodynamics/ch6_2.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch6_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:5875fd58ba5a3eb4a34d80c6cbf01fc2219f223f8352a521a425e02950a18a26"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of enthalpy entropy and Gibbs free energy change of reaction\n",
- "\n",
+ " \n",
"import math \n",
"from scipy.integrate import quad \n",
"\t\t\t\n",
@@ -131,9 +131,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of standard enthalpy and Gibbs free energy change of reaction\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n",
"T_2 = 400;\t\t\t#[K] - Reaction temperature\n",
"\n",
@@ -220,9 +218,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of standard enthalpy and Gibbs free energy change of reaction\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n",
"T_2 = 1200;\t\t\t#[K] - Reaction temperature\n",
"\n",
@@ -316,9 +312,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of standard enthalpy and Gibbs free energy change of reaction\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n",
"T_2 = 500;\t\t\t#[K] - Reaction temperature\n",
"\n",
@@ -402,10 +396,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of standard enthalpy and Gibbs free energy change of reaction\n",
- "\n",
- "# Variables\n",
- "\t\t\t#Cp_0 = 7.7 + 0.04594*10**(-2)*T + 0.2521*10**(-5)*T**(2) - 0.8587*10**(-9)*T**(3)\n",
+ " \n",
"\n",
"delta_H_rkn_298 = -57.7979*10**(3);\t\t\t#[cal/mol] - Reaction enthalpy at 298.15 K\n",
"delta_G_rkn_298 = -54.6351*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of H2O at 298.15 K\n",
@@ -486,9 +477,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of heat exchange\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n",
"T_2 = 500.;\t\t\t#[K] - Reaction temperature\n",
"\n",
@@ -563,9 +552,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of change in entropy\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n",
"T_2 = 600.;\t\t\t#[K] - Reaction temperature\n",
"\n",
@@ -638,9 +625,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of standard enthalpy change and Gibbs free energy change\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n",
"T_2 = 973.15;\t\t\t#[K] - Reaction temperature\n",
"\n",
@@ -715,9 +700,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of standard enthalpy change and Gibbs free energy change\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n",
"T_2 = 1000;\t\t\t#[K] - Reaction temperature\n",
"\n",
@@ -796,9 +779,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of standard enthalpy change and Gibbs free energy change\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n",
"T_2 = 1042;\t\t\t#[K] - Reaction temperature\n",
"\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch7_2.ipynb b/Chemical_Engineering_Thermodynamics/ch7_2.ipynb
index 11e9b4cd..dae2b7f0 100644
--- a/Chemical_Engineering_Thermodynamics/ch7_2.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch7_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:1fc4ec5605309ff88ba6d75ddff6c3046fc8a8dc45dca2d12f7651c49812921e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of entropy change\n",
- "\n",
+ " \n",
"import math \n",
"\n",
"\n",
@@ -81,8 +81,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of work done\n",
- "\n",
+ " \n",
"import math \n",
"from scipy.integrate import quad \n",
"\t\t\t\n",
@@ -161,8 +160,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Evaluation of beta and K for nitrogen gas\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"\n",
"\n",
@@ -226,9 +224,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of temperature change and entropy change of water\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 45+273.15;\t\t\t#[K]\n",
"P_1 = 10;\t\t\t#[kPa] - Initial pressure\n",
"P_2 = 8600;\t\t\t#[kPa] - Final pressure\n",
@@ -300,9 +296,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of change in entropy and enthalpy\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 270;\t\t\t#[K]\n",
"P_1 = 381;\t\t\t#[kPa] - Initial pressure\n",
"P_2 = 1200;\t\t\t#[kPa] - Final pressure\n",
@@ -353,8 +347,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of percentage change in volume\n",
- "\n",
+ " \n",
"# Variables\n",
"T_1 = 0;\t\t\t#[C] - Initial tempetaure\n",
"T_2 = 100;\t\t\t#[C] - Final temperature\n",
@@ -404,9 +397,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of enthalpy and entropy change\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_1 = 25 + 273.15;\t\t\t#[C] - Initial tempetaure\n",
"T_2 = 50 + 273.15;\t\t\t#[C] - Final temperature\n",
"P_1 = 1;\t\t\t#[bar] - Initial pressure\n",
@@ -479,8 +470,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculation of volume expansivity and isothermal compressibility\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 100 + 273.15;\t\t\t#[K]\n",
"P = 10;\t\t\t#[MPa]\n",
@@ -535,8 +525,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of specific heat capacity\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 300 + 273.15;\t\t\t#[K]\n",
"P = 4;\t\t\t#[MPa] \n",
@@ -589,9 +578,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of specific heat capacity\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 300 + 273.15;\t\t\t#[K]\n",
"P = 2.0;\t\t\t#[MPa]\n",
"\n",
@@ -632,9 +619,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of volume expansivity and isothermal compressibility\n",
- "\n",
- "# Variables\n",
+ " \n",
"T = 80 + 273.15;\t\t\t#[K]\n",
"P = 10;\t\t\t#[MPa] \n",
"\n",
@@ -699,8 +684,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of mean Joule Thomson coefficient\n",
- "\n",
+ " \n",
"# Variables\n",
"P_1 = 150;\t\t\t#[bar]\n",
"P_2 = 1;\t\t\t#[bar]\n",
@@ -771,8 +755,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of Joule Thomson coefficient\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 300;\t\t\t#[K] - Temperature\n",
"P = 5;\t\t\t#[atm] - Pressure\n",
@@ -825,8 +808,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of pressure\n",
- "\n",
+ " \n",
"# Variables\n",
"den_liq = 13690.;\t\t\t#[kg/m**(3)] - Density of liquid mercury\n",
"den_solid = 14190.;\t\t\t#[kg/m**(3)] - Density of solid mercury\n",
@@ -878,8 +860,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of enthalpy change and entropy change\n",
- "\n",
+ " \n",
"# Calculations and Results\n",
"\t\t\t#(1)\n",
"\t\t\t# At 1 bar\n",
@@ -932,8 +913,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of ratio of temperature change and pressure change\n",
- "\n",
+ " \n",
"# Variables\n",
"H_fus = 80;\t\t\t#[cal/g] - Heat of fusion at 0 C and 1 atm pressure\n",
"T = 0+273.15;\t\t\t#[K] - Temperature\n",
@@ -975,7 +955,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of boiling point of water\n",
+ " \n",
"\n",
"# Variables\n",
"P = 2;\t\t\t#[atm] - Surrounding pressure\n",
@@ -1025,8 +1005,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of enthalpy and entropy of vaporization of water\n",
- "\n",
+ " \n",
"# Variables\n",
"T_1 = 0.01 +273.15;\t\t\t#[K]\n",
"T_2 = 1 + 273.15;\t\t\t#[K]\n",
@@ -1075,7 +1054,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of heat of vaporization of water\n",
+ " \n",
"\n",
"# Variables\n",
"T = 100. + 273.15;\t\t\t#[K]\n",
@@ -1129,7 +1108,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of latent heat of vaporization\n",
+ " \n",
"\n",
"# Variables\n",
"T_1 = 100 + 273.15;\t\t\t#[K]\n",
@@ -1189,7 +1168,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of temperature dependence\n",
+ " \n",
"from scipy.integrate import quad \n",
"from scipy.optimize import *\n",
"\n",
@@ -1292,8 +1271,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of fugacity of water\n",
- "\n",
+ " \n",
"# Variables\n",
"T = 300 + 273.15;\t\t\t#[K] - Temperature\n",
"P = 9000;\t\t\t#[kPa] - Pressure\n",
@@ -1340,7 +1318,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of fugacity of saturated steam\n",
+ " \n",
"\n",
"# Variables\n",
"T = 200 + 273.15;\t\t\t#[K] - Temperature\n",
@@ -1401,7 +1379,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of fugacity of steam\n",
+ " \n",
"\n",
"# Variables\n",
"T = 320 + 273.15;\t\t\t#[K]\n",
@@ -1509,7 +1487,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of fugacities at two states\n",
+ " \n",
"\n",
"# Variables\n",
"T = 300 + 273.15;\t\t\t#[K]\n",
diff --git a/Chemical_Engineering_Thermodynamics/ch8_2.ipynb b/Chemical_Engineering_Thermodynamics/ch8_2.ipynb
index e4dd389d..6b83d68c 100644
--- a/Chemical_Engineering_Thermodynamics/ch8_2.ipynb
+++ b/Chemical_Engineering_Thermodynamics/ch8_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:8df6804e24ffba947b26128cacd98ede56f82be4a3089c7567d672249f51ebda"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -28,8 +29,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of work done\n",
- "\n",
+ " \n",
"import math\n",
"\n",
"# Variables\n",
@@ -144,9 +144,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of efficiency of Rankine cycle\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_max = 700+273.15;\t\t\t#[K] - Maximum temperature.\n",
"P_boiler = 10*10**(6);\t\t\t#[Pa] - Constant pressure in the boiler\n",
"P_condenser = 10*10**(3);\t\t\t#[Pa] - Constant pressure in the condenser\n",
@@ -226,9 +224,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculatrion of COP of carnot refrigerator and heat rejected\n",
- "\n",
- "# Variables\n",
+ " \n",
"W = 1.1;\t\t\t#[kW] - Work done per ton of refrigeration \n",
"\t\t\t#1 ton refrigeration = 3.517 kW, therefore\n",
"H = 3.517;\t\t\t#[kW] - Heat absorbed\n",
@@ -277,9 +273,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of minimum power required\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_high = 20 + 273.15;\t\t\t#[K] - High temperature\n",
"T_low = 0 + 273.15;\t\t\t#[K] - Low temperature\n",
"Q_H = 10;\t\t\t#[kW] - Heat supplied\n",
@@ -320,9 +314,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of COP and power required\n",
- "\n",
- "# Variables\n",
+ " \n",
"T_high = 40 + 273.15;\t\t\t#[K] - High temperature\n",
"T_low = -20 + 273.15;\t\t\t#[K] - Low temperature\n",
"C = 10;\t\t\t#[tons of refrigeration] - Capacity\n",
@@ -366,9 +358,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of maximum refrigeration effect\n",
- "\n",
- "# Variables\n",
+ " \n",
"COP = 4;\t\t\t#Coefficient of performance\n",
"P = 10;\t\t\t#[kW] - Work done on the cycle\n",
"\n",
@@ -412,9 +402,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of refrigeration effect power consumed and COP of refrigerator\n",
- "\n",
- "# Variables\n",
+ " \n",
"m = 0.6;\t\t\t#[kg/s] - mass flow rate\n",
"T_low = -20+273.15;\t\t\t#[K] - Temperature at which vapour enters the compressor\n",
"T_high = 30+273.15;\t\t\t#[K] - Temperature at which vapour leaves the condenser\n",
@@ -527,8 +515,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of amount of air\n",
- "\n",
+ " \n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\t\t\n",
@@ -601,8 +588,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of amount of air and temperature\n",
- "\n",
+ " \n",
"# Variables\n",
"\t\t\t#At 1 bar, 310 K \n",
"H_1 = 310.38;\t\t\t#[kJ/kg]\n",
@@ -702,9 +688,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of temperature of air\n",
- "\n",
- "# Variables\n",
+ " \n",
"P_high = 40;\t\t\t#[bar]\n",
"P_low = 5;\t\t\t#[bar]\n",
"m_1 = 0.5;\t\t\t#[kg/s] - Rate of mass moving through the expander\n",
diff --git a/Data_Structures_and_Algorithms_in_Java/ch1.ipynb b/Data_Structures_and_Algorithms_in_Java/ch1.ipynb
index c62ab0cb..8973ccb0 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch1.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch1"
+ "name": "",
+ "signature": "sha256:85fd10a5846b5256e76a45973450cd001c1aeb110532e77b6ab379820dba7274"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "demonstrates basic OOP syntax\n",
- "to run this program: python BankApp\n",
- "'''\n",
+ " \n",
"\n",
"class BankAccount:\n",
" def __init__(self,openingBalance): # constructor\n",
diff --git a/Data_Structures_and_Algorithms_in_Java/ch10.ipynb b/Data_Structures_and_Algorithms_in_Java/ch10.ipynb
index cf44793a..86853ad0 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch10.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch10"
+ "name": "",
+ "signature": "sha256:8fd742e3911255005d5cc80d3e792a10aed91d6e12fc125e66cc3c416b974be7"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,27 +12,221 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 10 : 2-3-4 Trees and External Storage"
+ "source": [
+ "Chapter 10 : 2-3-4 Trees and External Storage"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.1 Page No : 478"
+ "source": [
+ "Example 10.1 Page No : 478"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 10.1\ndemonstrates 234 tree\n'''\nclass DataItem:\n def __init__(self,dd):\n self.dData = dd\n\n def displayItem(self):\n print '/' ,self.dData\n\nclass Node:\n def __init__(self):\n self.ORDER = 4\n self.numItems = 0\n self.parent = None\n self.childArray = [None,None,None,None]\n self.itemArray = [None,None,None]\n\n def connectChild(self,childNum,child):\n self.childArray[childNum] = child\n if(child != None):\n child.parent = self\n\n def disconnectChild(self,childNum):\n tempNode = self.childArray[childNum]\n self.childArray[childNum] = None\n return tempNode\n\n def getChild(self,childNum):\n return self.childArray[childNum]\n\n def getParent(self):\n return self.parent\n\n def isLeaf(self):\n if self.childArray[0]==None:\n return True \n return False \n\n def getNumItems(self):\n return self.numItems\n\n def getItem(self,index): # get DataItem at index\n return self.itemArray[index] \n\n def isFull(self):\n if self.numItems==self.ORDER-1:\n return True\n return False\n\n def findItem(self,key): # return index of # item (within node)\n for j in range(self.ORDER-1): \n if(self.itemArray[j] == None):\n break\n elif(self.itemArray[j].dData == key):\n return j\n return -1\n\n def insertItem(self,newItem):\n #assumes node is not full\n self.numItems += 1 # will add new item\n newKey = newItem.dData # key of new item\n j = self.ORDER - 2\n while j>=0:\n if(self.itemArray[j] == None):\n continue\n else:\n itsKey = self.itemArray[j].dData\n if(newKey < itsKey):\n self.itemArray[j+1] = self.itemArray[j]\n else:\n self.itemArray[j+1] = newItem\n return j+1 # return index to\n j -= 1\n\n self.itemArray[0] = newItem # insert new item\n return 0\n\n def removeItem(self): # remove largest item\n temp = self.itemArray[self.numItems-1] # save item\n self.itemArray[self.numItems-1] = None # disconnect it\n self.numItems -= 1 # one less item\n return temp # return item\n\n def displayNode(self):\n for j in range(self.numItems):\n self.itemArray[j].displayItem()\n print ''\n\nclass Tree234:\n def __init__(self):\n self.root = Node() # make root node\n\n def find(self,key):\n curNode = self.root\n childNumber = 0\n while(True):\n childNumber=curNode.findItem(key) \n if(childNumber != -1):\n return childNumber # found it\n elif( curNode.isLeaf() ):\n return -1 # cant find it\n else: # search deeper\n curNode = getNextChild(curNode, key)\n\n def insert(self,dValue):\n curNode = self.root\n tempItem = DataItem(dValue)\n while(True):\n if( curNode.isFull() ):\n split(curNode)\n curNode = curNode.getParent()\n curNode = getNextChild(curNode, dValue)\n elif( curNode.isLeaf() ): # if node is leaf,\n break\n else:\n curNode = getNextChild(curNode, dValue)\n curNode.insertItem(tempItem)\n\n def split(self,thisNode): # split the node\n # assumes node is full\n itemC = thisNode.removeItem() # remove items from\n itemB = thisNode.removeItem() # this node\n child2 = thisNode.disconnectChild(2) # remove children\n child3 = thisNode.disconnectChild(3) # from this nodeJava Code for a 2-3-4 Tree\n newRight = Node() # make new node\n if(thisNode==self.root):\n self.root = Node()\n parent = self.root\n self.root.connectChild(0, thisNode)\n else:\n parent = thisNode.getParent()\n itemIndex = parent.insertItem(itemB) # item B to parent\n n = parent.getNumItems()\n j = n-1\n while j > itemIndex:\n temp = parent.disconnectChild(j) # one child\n parent.connectChild(j+1, temp)\n j -= 1\n\n parent.connectChild(itemIndex+1, newRight) # deal with newRight\n newRight.insertItem(itemC) # item C to newRight\n newRight.connectChild(0, child2) # connect to 0 and 1\n newRight.connectChild(1, child3) # on newRight\n\n def getNextChild(self,theNode,theValue):\n # assumes node is not empty, not full, not a leaf\n numItems = theNode.getNumItems() \n for j in range(numItems): # for each item in node\n if( theValue < theNode.getItem(j).dData ):\n return theNode.getChild(j) # return left child\n return theNode.getChild(j)\n\n def displayTree(self):\n self.recDisplayTree(self.root, 0, 0)\n\n def recDisplayTree(self,thisNode,level, childNumber):\n print 'level=' ,level ,' child=',childNumber , ' '\n thisNode.displayNode()\n numItems = thisNode.getNumItems()\n for j in range(numItems+1):\n nextNode = thisNode.getChild(j)\n if(nextNode != None):\n self.recDisplayTree(nextNode, level+1, j)\n else:\n return\ntheTree = Tree234()\ntheTree.insert(50)\ntheTree.insert(40)\ntheTree.insert(60)\ntheTree.insert(30)\ntheTree.insert(70)\nwhile(True):\n print 'Enter first letter of show, '\n print 'insert, find, or display: ',\n choice = raw_input()\n if choice == 's':\n theTree.displayTree()\n elif choice == 'i':\n print 'Enter value to insert: '\n value = int(raw_input())\n theTree.insert(value)\n elif choice == 'f':\n print 'Enter value to find: ',\n value = int(raw_input())\n found = theTree.find(value)\n if(found != -1):\n print 'Found: ', value\n else:\n print 'Could not find', value \n else:\n print 'Invalid entry'\n",
+ "input": [
+ " \n",
+ "class DataItem:\n",
+ " def __init__(self,dd):\n",
+ " self.dData = dd\n",
+ "\n",
+ " def displayItem(self):\n",
+ " print '/' ,self.dData\n",
+ "\n",
+ "class Node:\n",
+ " def __init__(self):\n",
+ " self.ORDER = 4\n",
+ " self.numItems = 0\n",
+ " self.parent = None\n",
+ " self.childArray = [None,None,None,None]\n",
+ " self.itemArray = [None,None,None]\n",
+ "\n",
+ " def connectChild(self,childNum,child):\n",
+ " self.childArray[childNum] = child\n",
+ " if(child != None):\n",
+ " child.parent = self\n",
+ "\n",
+ " def disconnectChild(self,childNum):\n",
+ " tempNode = self.childArray[childNum]\n",
+ " self.childArray[childNum] = None\n",
+ " return tempNode\n",
+ "\n",
+ " def getChild(self,childNum):\n",
+ " return self.childArray[childNum]\n",
+ "\n",
+ " def getParent(self):\n",
+ " return self.parent\n",
+ "\n",
+ " def isLeaf(self):\n",
+ " if self.childArray[0]==None:\n",
+ " return True \n",
+ " return False \n",
+ "\n",
+ " def getNumItems(self):\n",
+ " return self.numItems\n",
+ "\n",
+ " def getItem(self,index): # get DataItem at index\n",
+ " return self.itemArray[index] \n",
+ "\n",
+ " def isFull(self):\n",
+ " if self.numItems==self.ORDER-1:\n",
+ " return True\n",
+ " return False\n",
+ "\n",
+ " def findItem(self,key): # return index of # item (within node)\n",
+ " for j in range(self.ORDER-1): \n",
+ " if(self.itemArray[j] == None):\n",
+ " break\n",
+ " elif(self.itemArray[j].dData == key):\n",
+ " return j\n",
+ " return -1\n",
+ "\n",
+ " def insertItem(self,newItem):\n",
+ " #assumes node is not full\n",
+ " self.numItems += 1 # will add new item\n",
+ " newKey = newItem.dData # key of new item\n",
+ " j = self.ORDER - 2\n",
+ " while j>=0:\n",
+ " if(self.itemArray[j] == None):\n",
+ " continue\n",
+ " else:\n",
+ " itsKey = self.itemArray[j].dData\n",
+ " if(newKey < itsKey):\n",
+ " self.itemArray[j+1] = self.itemArray[j]\n",
+ " else:\n",
+ " self.itemArray[j+1] = newItem\n",
+ " return j+1 # return index to\n",
+ " j -= 1\n",
+ "\n",
+ " self.itemArray[0] = newItem # insert new item\n",
+ " return 0\n",
+ "\n",
+ " def removeItem(self): # remove largest item\n",
+ " temp = self.itemArray[self.numItems-1] # save item\n",
+ " self.itemArray[self.numItems-1] = None # disconnect it\n",
+ " self.numItems -= 1 # one less item\n",
+ " return temp # return item\n",
+ "\n",
+ " def displayNode(self):\n",
+ " for j in range(self.numItems):\n",
+ " self.itemArray[j].displayItem()\n",
+ " print ''\n",
+ "\n",
+ "class Tree234:\n",
+ " def __init__(self):\n",
+ " self.root = Node() # make root node\n",
+ "\n",
+ " def find(self,key):\n",
+ " curNode = self.root\n",
+ " childNumber = 0\n",
+ " while(True):\n",
+ " childNumber=curNode.findItem(key) \n",
+ " if(childNumber != -1):\n",
+ " return childNumber # found it\n",
+ " elif( curNode.isLeaf() ):\n",
+ " return -1 # cant find it\n",
+ " else: # search deeper\n",
+ " curNode = getNextChild(curNode, key)\n",
+ "\n",
+ " def insert(self,dValue):\n",
+ " curNode = self.root\n",
+ " tempItem = DataItem(dValue)\n",
+ " while(True):\n",
+ " if( curNode.isFull() ):\n",
+ " split(curNode)\n",
+ " curNode = curNode.getParent()\n",
+ " curNode = getNextChild(curNode, dValue)\n",
+ " elif( curNode.isLeaf() ): # if node is leaf,\n",
+ " break\n",
+ " else:\n",
+ " curNode = getNextChild(curNode, dValue)\n",
+ " curNode.insertItem(tempItem)\n",
+ "\n",
+ " def split(self,thisNode): # split the node\n",
+ " # assumes node is full\n",
+ " itemC = thisNode.removeItem() # remove items from\n",
+ " itemB = thisNode.removeItem() # this node\n",
+ " child2 = thisNode.disconnectChild(2) # remove children\n",
+ " child3 = thisNode.disconnectChild(3) # from this nodeJava Code for a 2-3-4 Tree\n",
+ " newRight = Node() # make new node\n",
+ " if(thisNode==self.root):\n",
+ " self.root = Node()\n",
+ " parent = self.root\n",
+ " self.root.connectChild(0, thisNode)\n",
+ " else:\n",
+ " parent = thisNode.getParent()\n",
+ " itemIndex = parent.insertItem(itemB) # item B to parent\n",
+ " n = parent.getNumItems()\n",
+ " j = n-1\n",
+ " while j > itemIndex:\n",
+ " temp = parent.disconnectChild(j) # one child\n",
+ " parent.connectChild(j+1, temp)\n",
+ " j -= 1\n",
+ "\n",
+ " parent.connectChild(itemIndex+1, newRight) # deal with newRight\n",
+ " newRight.insertItem(itemC) # item C to newRight\n",
+ " newRight.connectChild(0, child2) # connect to 0 and 1\n",
+ " newRight.connectChild(1, child3) # on newRight\n",
+ "\n",
+ " def getNextChild(self,theNode,theValue):\n",
+ " # assumes node is not empty, not full, not a leaf\n",
+ " numItems = theNode.getNumItems() \n",
+ " for j in range(numItems): # for each item in node\n",
+ " if( theValue < theNode.getItem(j).dData ):\n",
+ " return theNode.getChild(j) # return left child\n",
+ " return theNode.getChild(j)\n",
+ "\n",
+ " def displayTree(self):\n",
+ " self.recDisplayTree(self.root, 0, 0)\n",
+ "\n",
+ " def recDisplayTree(self,thisNode,level, childNumber):\n",
+ " print 'level=' ,level ,' child=',childNumber , ' '\n",
+ " thisNode.displayNode()\n",
+ " numItems = thisNode.getNumItems()\n",
+ " for j in range(numItems+1):\n",
+ " nextNode = thisNode.getChild(j)\n",
+ " if(nextNode != None):\n",
+ " self.recDisplayTree(nextNode, level+1, j)\n",
+ " else:\n",
+ " return\n",
+ "theTree = Tree234()\n",
+ "theTree.insert(50)\n",
+ "theTree.insert(40)\n",
+ "theTree.insert(60)\n",
+ "theTree.insert(30)\n",
+ "theTree.insert(70)\n",
+ "while(True):\n",
+ " print 'Enter first letter of show, '\n",
+ " print 'insert, find, or display: ',\n",
+ " choice = raw_input()\n",
+ " if choice == 's':\n",
+ " theTree.displayTree()\n",
+ " elif choice == 'i':\n",
+ " print 'Enter value to insert: '\n",
+ " value = int(raw_input())\n",
+ " theTree.insert(value)\n",
+ " elif choice == 'f':\n",
+ " print 'Enter value to find: ',\n",
+ " value = int(raw_input())\n",
+ " found = theTree.find(value)\n",
+ " if(found != -1):\n",
+ " print 'Found: ', value\n",
+ " else:\n",
+ " print 'Could not find', value \n",
+ " else:\n",
+ " print 'Invalid entry'\n"
+ ],
"language": "python",
"metadata": {},
- "outputs": [],
- "prompt_number": "*"
+ "outputs": []
},
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch11.ipynb b/Data_Structures_and_Algorithms_in_Java/ch11.ipynb
index 5756b776..41231968 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch11.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch11"
+ "name": "",
+ "signature": "sha256:2ea25d6b8d9f93ae0488601c3ca91103c231ea11e5b2efa6b43dd14ae7e00851"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,80 +12,460 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 11 : Hash Tables"
+ "source": [
+ "Chapter 11 : Hash Tables"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 11.1 Page No : 535"
+ "source": [
+ "Example 11.1 Page No : 535"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 11.1\ndemonstrates hash table with linear probing\n'''\nclass DataItem:\n def __init__(self,ii):\n self.iData = ii\n\n def getKey(self):\n return self.iData\n\nclass HashTable:\n def __init__(self,size):\n self.hashArray = [] # array is the hash table\n for i in range(size):\n self.hashArray.append(DataItem(0))\n self.arraySize = size\n self.nonItem = None # for deleted items\n\n def displayTable(self):\n print 'Table: ',\n for j in range(self.arraySize):\n if(self.hashArray[j] != None):\n print self.hashArray[j].getKey() ,\n else:\n print '** ' ,\n print ''\n\n\n def hashFunc(self,key):\n return key % self.arraySize\n\n # insert a DataItem\n def insert(self,item):\n key = item.getKey() # extract key\n hashVal = self.hashFunc(key) # hash the key\n while(self.hashArray[hashVal] != None and self.hashArray[hashVal].getKey() != -1):\n hashVal += 1\n hashVal %= self.arraySize # wraparound if necessary\n self.hashArray[hashVal] = item # insert item\n\n def delete(self,key): # delete a DataItem\n hashVal = hashFunc(key) # hash the key\n while(self.hashArray[hashVal] != None): # until empty cell,\n # is correct hashVal?\n if(self.hashArray[hashVal].getKey() == key):\n temp = self.hashArray[hashVal] # save item\n self.hashArray[hashVal] = nonItem # delete item\n return temp # return item\n hashVal += 1\n hashVal %= self.arraySize # for wraparound\n return None # cant find item\n\n def find(self,key): # find item with key\n # (assumes table not full)\n hashVal = hashFunc(key) # hash the key\n while(self.hashArray[hashVal] != None): # until empty cell,\n # is correct hashVal?\n if(self.hashArray[hashVal].getKey() == key):\n return self.hashArray[hashVal] # yes, return item\n hashVal += 1 # add the step\n hashVal %= self.arraySize\n # for wraparound\n return None # cant find item\n\nprint 'Enter size of hash table: ',\nsize = int(raw_input())\nprint 'Enter initial number of items: ',\nn = int(raw_input()) # make table\ntheHashTable = HashTable(size)\nkeysPerCell = 10\nimport random\nfor j in range(n): # insert data\n aKey = int(random.random() * keysPerCell * size)\n aDataItem = DataItem(aKey) \n theHashTable.insert(aDataItem)\n\nwhile(True):\n print 'Enter first letter of show, '\n print 'insert, find, delete, or traverse: ',\n choice = raw_input()\n if choice == 's':\n theHashTable.displayTable()\n elif choice == 'i':\n print 'Enter value to key to insert: '\n value = int(raw_input())\n aDataItem = DataItem(aKey)\n theHashTable.insert(aDataItem)\n elif choice == 'f':\n print 'Enter key value to find: ',\n value = int(raw_input())\n aDataItem = theHashTable.find(aKey)\n if(aDataItem != None):\n print 'Found ' , aKey\n else:\n print 'Could not find ' , aKey\n\n elif choice=='d':\n print 'Enter key value to delete: ',\n value = int(raw_input())\n theHashTable.delete(value)\n else:\n print 'Invalid entry'\n",
+ "input": [
+ " \n",
+ "class DataItem:\n",
+ " def __init__(self,ii):\n",
+ " self.iData = ii\n",
+ "\n",
+ " def getKey(self):\n",
+ " return self.iData\n",
+ "\n",
+ "class HashTable:\n",
+ " def __init__(self,size):\n",
+ " self.hashArray = [] # array is the hash table\n",
+ " for i in range(size):\n",
+ " self.hashArray.append(DataItem(0))\n",
+ " self.arraySize = size\n",
+ " self.nonItem = None # for deleted items\n",
+ "\n",
+ " def displayTable(self):\n",
+ " print 'Table: ',\n",
+ " for j in range(self.arraySize):\n",
+ " if(self.hashArray[j] != None):\n",
+ " print self.hashArray[j].getKey() ,\n",
+ " else:\n",
+ " print '** ' ,\n",
+ " print ''\n",
+ "\n",
+ "\n",
+ " def hashFunc(self,key):\n",
+ " return key % self.arraySize\n",
+ "\n",
+ " # insert a DataItem\n",
+ " def insert(self,item):\n",
+ " key = item.getKey() # extract key\n",
+ " hashVal = self.hashFunc(key) # hash the key\n",
+ " while(self.hashArray[hashVal] != None and self.hashArray[hashVal].getKey() != -1):\n",
+ " hashVal += 1\n",
+ " hashVal %= self.arraySize # wraparound if necessary\n",
+ " self.hashArray[hashVal] = item # insert item\n",
+ "\n",
+ " def delete(self,key): # delete a DataItem\n",
+ " hashVal = hashFunc(key) # hash the key\n",
+ " while(self.hashArray[hashVal] != None): # until empty cell,\n",
+ " # is correct hashVal?\n",
+ " if(self.hashArray[hashVal].getKey() == key):\n",
+ " temp = self.hashArray[hashVal] # save item\n",
+ " self.hashArray[hashVal] = nonItem # delete item\n",
+ " return temp # return item\n",
+ " hashVal += 1\n",
+ " hashVal %= self.arraySize # for wraparound\n",
+ " return None # cant find item\n",
+ "\n",
+ " def find(self,key): # find item with key\n",
+ " # (assumes table not full)\n",
+ " hashVal = hashFunc(key) # hash the key\n",
+ " while(self.hashArray[hashVal] != None): # until empty cell,\n",
+ " # is correct hashVal?\n",
+ " if(self.hashArray[hashVal].getKey() == key):\n",
+ " return self.hashArray[hashVal] # yes, return item\n",
+ " hashVal += 1 # add the step\n",
+ " hashVal %= self.arraySize\n",
+ " # for wraparound\n",
+ " return None # cant find item\n",
+ "\n",
+ "print 'Enter size of hash table: ',\n",
+ "size = int(raw_input())\n",
+ "print 'Enter initial number of items: ',\n",
+ "n = int(raw_input()) # make table\n",
+ "theHashTable = HashTable(size)\n",
+ "keysPerCell = 10\n",
+ "import random\n",
+ "for j in range(n): # insert data\n",
+ " aKey = int(random.random() * keysPerCell * size)\n",
+ " aDataItem = DataItem(aKey) \n",
+ " theHashTable.insert(aDataItem)\n",
+ "\n",
+ "while(True):\n",
+ " print 'Enter first letter of show, '\n",
+ " print 'insert, find, delete, or traverse: ',\n",
+ " choice = raw_input()\n",
+ " if choice == 's':\n",
+ " theHashTable.displayTable()\n",
+ " elif choice == 'i':\n",
+ " print 'Enter value to key to insert: '\n",
+ " value = int(raw_input())\n",
+ " aDataItem = DataItem(aKey)\n",
+ " theHashTable.insert(aDataItem)\n",
+ " elif choice == 'f':\n",
+ " print 'Enter key value to find: ',\n",
+ " value = int(raw_input())\n",
+ " aDataItem = theHashTable.find(aKey)\n",
+ " if(aDataItem != None):\n",
+ " print 'Found ' , aKey\n",
+ " else:\n",
+ " print 'Could not find ' , aKey\n",
+ "\n",
+ " elif choice=='d':\n",
+ " print 'Enter key value to delete: ',\n",
+ " value = int(raw_input())\n",
+ " theHashTable.delete(value)\n",
+ " else:\n",
+ " print 'Invalid entry'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter size of hash table: "
+ "text": [
+ "Enter size of hash table: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "12\n"
+ "text": [
+ "12\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter initial number of items: "
+ "text": [
+ " Enter initial number of items: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
}
- ],
- "prompt_number": "*"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 11.2 Page no: 546"
+ "source": [
+ "Example 11.2 Page no: 546"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 11.2\ndemonstrates hash table with double hashing\n'''\nclass DataItem:\n def __init__(self,ii):\n self.iData = ii\n\n def getKey(self):\n return self.iData\n\nclass HashTable:\n def __init__(self,size):\n self.hashArray = [] # array is the hash table\n for i in range(size):\n self.hashArray.append(DataItem(0))\n self.arraySize = size\n self.nonItem = None # for deleted items\n\n def displayTable(self):\n print 'Table: ',\n for j in range(self.arraySize):\n if(self.hashArray[j] != None):\n print self.hashArray[j].getKey() ,\n else:\n print '** ' ,\n print ''\n\n def hashFunc1(self,key):\n return key % self.arraySize\n\n def hashFunc2(self,key):\n # non-zero, less than array size, different from hF1\n # array size must be relatively prime to 5, 4, 3, and 2\n return 5 - key % 5\n \n # insert a DataItem\n def insert(self,key,item):\n # (assumes table not full)\n hashVal = self.hashFunc1(key) # hash the key\n stepSize = self.hashFunc2(key) # get step size\n # until empty cell or -1\n while(self.hashArray[hashVal] != None and self.hashArray[hashVal].getKey() != -1):\n hashVal += stepSize # add the step\n hashVal %= self.arraySize # for wraparound\n self.hashArray[hashVal] = item # insert item\n\n def delete(self,key): # delete a DataItem\n hashVal = hashFunc1(key) # hash the key\n stepSize = hashFunc2(key) # get step size\n while(self.hashArray[hashVal] != None): # until empty cell,\n # is correct hashVal?\n if(self.hashArray[hashVal].getKey() == key):\n temp = self.hashArray[hashVal] # save item\n self.hashArray[hashVal] = nonItem # delete item\n return temp # return item\n hashVal += stepSize # add the step\n hashVal %= self.arraySize # for wraparound\n return None # cant find item\n\n def find(self,key): # find item with key\n # (assumes table not full)\n hashVal = hashFunc1(key) # hash the key\n stepSize = hashFunc2(key) # get step size\n while(self.hashArray[hashVal] != None): # until empty cell,\n # is correct hashVal?\n if(self.hashArray[hashVal].getKey() == key):\n return self.hashArray[hashVal] # yes, return item\n hashVal += stepSize # add the step\n hashVal %= self.arraySize\n # for wraparound\n return None # cant find item\n\nprint 'Enter size of hash table: ',\nsize = int(raw_input())\nprint 'Enter initial number of items: ',\nn = int(raw_input()) # make table\ntheHashTable = HashTable(size)\nimport random\nfor j in range(n): # insert data\n aKey = int(random.random() * 2 * size)\n aDataItem = DataItem(aKey) \n theHashTable.insert(aKey, aDataItem)\n\nwhile(True):\n print 'Enter first letter of show, '\n print 'insert, find, delete, or traverse: ',\n choice = raw_input()\n if choice == 's':\n theHashTable.displayTable()\n elif choice == 'i':\n print 'Enter value to key to insert: '\n value = int(raw_input())\n aDataItem = DataItem(aKey)\n theHashTable.insert(aKey, aDataItem)\n elif choice == 'f':\n print 'Enter key value to find: ',\n value = int(raw_input())\n aDataItem = theHashTable.find(aKey)\n if(aDataItem != None):\n print 'Found ' , aKey\n else:\n print 'Could not find ' , aKey\n\n elif choice=='d':\n print 'Enter key value to delete: ',\n value = int(raw_input())\n theHashTable.delete(value)\n else:\n print 'Invalid entry'\n",
+ "input": [
+ " \n",
+ "class DataItem:\n",
+ " def __init__(self,ii):\n",
+ " self.iData = ii\n",
+ "\n",
+ " def getKey(self):\n",
+ " return self.iData\n",
+ "\n",
+ "class HashTable:\n",
+ " def __init__(self,size):\n",
+ " self.hashArray = [] # array is the hash table\n",
+ " for i in range(size):\n",
+ " self.hashArray.append(DataItem(0))\n",
+ " self.arraySize = size\n",
+ " self.nonItem = None # for deleted items\n",
+ "\n",
+ " def displayTable(self):\n",
+ " print 'Table: ',\n",
+ " for j in range(self.arraySize):\n",
+ " if(self.hashArray[j] != None):\n",
+ " print self.hashArray[j].getKey() ,\n",
+ " else:\n",
+ " print '** ' ,\n",
+ " print ''\n",
+ "\n",
+ " def hashFunc1(self,key):\n",
+ " return key % self.arraySize\n",
+ "\n",
+ " def hashFunc2(self,key):\n",
+ " # non-zero, less than array size, different from hF1\n",
+ " # array size must be relatively prime to 5, 4, 3, and 2\n",
+ " return 5 - key % 5\n",
+ " \n",
+ " # insert a DataItem\n",
+ " def insert(self,key,item):\n",
+ " # (assumes table not full)\n",
+ " hashVal = self.hashFunc1(key) # hash the key\n",
+ " stepSize = self.hashFunc2(key) # get step size\n",
+ " # until empty cell or -1\n",
+ " while(self.hashArray[hashVal] != None and self.hashArray[hashVal].getKey() != -1):\n",
+ " hashVal += stepSize # add the step\n",
+ " hashVal %= self.arraySize # for wraparound\n",
+ " self.hashArray[hashVal] = item # insert item\n",
+ "\n",
+ " def delete(self,key): # delete a DataItem\n",
+ " hashVal = hashFunc1(key) # hash the key\n",
+ " stepSize = hashFunc2(key) # get step size\n",
+ " while(self.hashArray[hashVal] != None): # until empty cell,\n",
+ " # is correct hashVal?\n",
+ " if(self.hashArray[hashVal].getKey() == key):\n",
+ " temp = self.hashArray[hashVal] # save item\n",
+ " self.hashArray[hashVal] = nonItem # delete item\n",
+ " return temp # return item\n",
+ " hashVal += stepSize # add the step\n",
+ " hashVal %= self.arraySize # for wraparound\n",
+ " return None # cant find item\n",
+ "\n",
+ " def find(self,key): # find item with key\n",
+ " # (assumes table not full)\n",
+ " hashVal = hashFunc1(key) # hash the key\n",
+ " stepSize = hashFunc2(key) # get step size\n",
+ " while(self.hashArray[hashVal] != None): # until empty cell,\n",
+ " # is correct hashVal?\n",
+ " if(self.hashArray[hashVal].getKey() == key):\n",
+ " return self.hashArray[hashVal] # yes, return item\n",
+ " hashVal += stepSize # add the step\n",
+ " hashVal %= self.arraySize\n",
+ " # for wraparound\n",
+ " return None # cant find item\n",
+ "\n",
+ "print 'Enter size of hash table: ',\n",
+ "size = int(raw_input())\n",
+ "print 'Enter initial number of items: ',\n",
+ "n = int(raw_input()) # make table\n",
+ "theHashTable = HashTable(size)\n",
+ "import random\n",
+ "for j in range(n): # insert data\n",
+ " aKey = int(random.random() * 2 * size)\n",
+ " aDataItem = DataItem(aKey) \n",
+ " theHashTable.insert(aKey, aDataItem)\n",
+ "\n",
+ "while(True):\n",
+ " print 'Enter first letter of show, '\n",
+ " print 'insert, find, delete, or traverse: ',\n",
+ " choice = raw_input()\n",
+ " if choice == 's':\n",
+ " theHashTable.displayTable()\n",
+ " elif choice == 'i':\n",
+ " print 'Enter value to key to insert: '\n",
+ " value = int(raw_input())\n",
+ " aDataItem = DataItem(aKey)\n",
+ " theHashTable.insert(aKey, aDataItem)\n",
+ " elif choice == 'f':\n",
+ " print 'Enter key value to find: ',\n",
+ " value = int(raw_input())\n",
+ " aDataItem = theHashTable.find(aKey)\n",
+ " if(aDataItem != None):\n",
+ " print 'Found ' , aKey\n",
+ " else:\n",
+ " print 'Could not find ' , aKey\n",
+ "\n",
+ " elif choice=='d':\n",
+ " print 'Enter key value to delete: ',\n",
+ " value = int(raw_input())\n",
+ " theHashTable.delete(value)\n",
+ " else:\n",
+ " print 'Invalid entry'\n"
+ ],
"language": "python",
"metadata": {},
- "outputs": [],
- "prompt_number": "*"
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Enter size of hash table: "
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Enter initial number of items: "
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2\n"
+ ]
+ }
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 11.3 Page no : 555"
+ "source": [
+ "Example 11.3 Page no : 555"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 11.3\ndemonstrates hash table with separate chaining\n'''\n\nclass Link:\n def __init__(self,ii):\n self.iData = ii\n\n def getKey(self):\n return self.iData\n\n def displayLink(self):\n print self.iData ,\n\nclass SortedList:\n def __init__(self):\n self.first = None\n\n def insert(self,theLink): # insert link, in order\n key = theLink.getKey()\n self.previous = None # start at self.first\n current = self.first # until end of list,\n while( current != None and key > current.getKey() ): # or current > key,\n self.previous = current \n current = current.next # go to next item\n if(self.previous==None): # if beginning of list,\n self.first = theLink\n else: # not at beginning,\n self.previous.next = theLink\n theLink.next = current # new link --> current\n\n def delete(self,key): # delete link\n # (assumes non-empty list)\n self.previous = None # start at self.first\n current = self.first # until end of list,\n while( current != None and key != current.getKey() ): # or key == current,\n self.previous = current\n current = current.next # go to next link\n if(self.previous==None):\n self.first = self.first.next\n else:\n self.previous.next = current.next \n\n def find(self,key): # find link\n current = self.first # start at self.first\n # until end of list,\n while(current != None and current.getKey() <= key): # or key too small,\n if(current.getKey() == key):# is this the link?\n return current # found it, return link\n current = current.next # go to next item\n return None # didnt find it\n\n def displayList(self):\n print 'List (self.first-->last): ',\n current = self.first # start at beginning of list\n while(current != None): # until end of list,\n current.displayLink() # print data\n current = current.next # move to next link\n print ''\n\nclass HashTable:\n def __init__(self,size):\n self.hashArray = [] # array is the hash table\n for i in range(size):\n self.hashArray.append(SortedList())\n self.arraySize = size\n self.nonItem = None # for deleted items\n\n def displayTable(self):\n print 'Table: ',\n for j in range(self.arraySize):\n print j, \n self.hashArray[j].displayList()\n\n def hashFunc(self,key):\n return key % self.arraySize\n\n def insert(self,theLink):\n key = theLink.getKey()\n hashVal = self.hashFunc(key)\n self.hashArray[hashVal].insert(theLink)\n\n def delete(self,key): # delete a DataItem\n hashVal = self.hashFunc(key) # hash the key\n self.hashArray[hashVal].delete(key) # delete link\n\n def find(self,key): # find link\n hashVal = self.hashFunc(key)# hash the key\n theLink = self.hashArray[hashVal].find(key) # get link\n return theLink # return link\n\nkeysPerCell = 100 \nprint 'Enter size of hash table: ',\nsize = int(raw_input())\nprint 'Enter initial number of items: ',\nn = int(raw_input()) # make table\ntheHashTable = HashTable(size)\nimport random\nfor j in range(n): # insert data\n aKey = int(random.random() * 2 * size)\n aDataItem = Link(aKey) \n theHashTable.insert(aDataItem)\n\nwhile(True):\n print 'Enter self.first letter of show, '\n print 'insert, find, delete, or show: ',\n choice = raw_input()\n if choice == 's':\n theHashTable.displayTable()\n elif choice == 'i':\n print 'Enter value to key to insert: '\n value = int(raw_input())\n aDataItem = Link(aKey)\n theHashTable.insert(aDataItem)\n elif choice == 'f':\n print 'Enter key value to find: ',\n value = int(raw_input())\n aDataItem = theHashTable.find(aKey)\n if(aDataItem != None):\n print 'Found ' , aKey\n else:\n print 'Could not find ' , aKey\n\n elif choice=='d':\n print 'Enter key value to delete: ',\n value = int(raw_input())\n theHashTable.delete(value)\n else:\n print 'Invalid entry'\n",
+ "input": [
+ " \n",
+ "class Link:\n",
+ " def __init__(self,ii):\n",
+ " self.iData = ii\n",
+ "\n",
+ " def getKey(self):\n",
+ " return self.iData\n",
+ "\n",
+ " def displayLink(self):\n",
+ " print self.iData ,\n",
+ "\n",
+ "class SortedList:\n",
+ " def __init__(self):\n",
+ " self.first = None\n",
+ "\n",
+ " def insert(self,theLink): # insert link, in order\n",
+ " key = theLink.getKey()\n",
+ " self.previous = None # start at self.first\n",
+ " current = self.first # until end of list,\n",
+ " while( current != None and key > current.getKey() ): # or current > key,\n",
+ " self.previous = current \n",
+ " current = current.next # go to next item\n",
+ " if(self.previous==None): # if beginning of list,\n",
+ " self.first = theLink\n",
+ " else: # not at beginning,\n",
+ " self.previous.next = theLink\n",
+ " theLink.next = current # new link --> current\n",
+ "\n",
+ " def delete(self,key): # delete link\n",
+ " # (assumes non-empty list)\n",
+ " self.previous = None # start at self.first\n",
+ " current = self.first # until end of list,\n",
+ " while( current != None and key != current.getKey() ): # or key == current,\n",
+ " self.previous = current\n",
+ " current = current.next # go to next link\n",
+ " if(self.previous==None):\n",
+ " self.first = self.first.next\n",
+ " else:\n",
+ " self.previous.next = current.next \n",
+ "\n",
+ " def find(self,key): # find link\n",
+ " current = self.first # start at self.first\n",
+ " # until end of list,\n",
+ " while(current != None and current.getKey() <= key): # or key too small,\n",
+ " if(current.getKey() == key):# is this the link?\n",
+ " return current # found it, return link\n",
+ " current = current.next # go to next item\n",
+ " return None # didnt find it\n",
+ "\n",
+ " def displayList(self):\n",
+ " print 'List (self.first-->last): ',\n",
+ " current = self.first # start at beginning of list\n",
+ " while(current != None): # until end of list,\n",
+ " current.displayLink() # print data\n",
+ " current = current.next # move to next link\n",
+ " print ''\n",
+ "\n",
+ "class HashTable:\n",
+ " def __init__(self,size):\n",
+ " self.hashArray = [] # array is the hash table\n",
+ " for i in range(size):\n",
+ " self.hashArray.append(SortedList())\n",
+ " self.arraySize = size\n",
+ " self.nonItem = None # for deleted items\n",
+ "\n",
+ " def displayTable(self):\n",
+ " print 'Table: ',\n",
+ " for j in range(self.arraySize):\n",
+ " print j, \n",
+ " self.hashArray[j].displayList()\n",
+ "\n",
+ " def hashFunc(self,key):\n",
+ " return key % self.arraySize\n",
+ "\n",
+ " def insert(self,theLink):\n",
+ " key = theLink.getKey()\n",
+ " hashVal = self.hashFunc(key)\n",
+ " self.hashArray[hashVal].insert(theLink)\n",
+ "\n",
+ " def delete(self,key): # delete a DataItem\n",
+ " hashVal = self.hashFunc(key) # hash the key\n",
+ " self.hashArray[hashVal].delete(key) # delete link\n",
+ "\n",
+ " def find(self,key): # find link\n",
+ " hashVal = self.hashFunc(key)# hash the key\n",
+ " theLink = self.hashArray[hashVal].find(key) # get link\n",
+ " return theLink # return link\n",
+ "\n",
+ "keysPerCell = 100 \n",
+ "print 'Enter size of hash table: ',\n",
+ "size = int(raw_input())\n",
+ "print 'Enter initial number of items: ',\n",
+ "n = int(raw_input()) # make table\n",
+ "theHashTable = HashTable(size)\n",
+ "import random\n",
+ "for j in range(n): # insert data\n",
+ " aKey = int(random.random() * 2 * size)\n",
+ " aDataItem = Link(aKey) \n",
+ " theHashTable.insert(aDataItem)\n",
+ "\n",
+ "while(True):\n",
+ " print 'Enter self.first letter of show, '\n",
+ " print 'insert, find, delete, or show: ',\n",
+ " choice = raw_input()\n",
+ " if choice == 's':\n",
+ " theHashTable.displayTable()\n",
+ " elif choice == 'i':\n",
+ " print 'Enter value to key to insert: '\n",
+ " value = int(raw_input())\n",
+ " aDataItem = Link(aKey)\n",
+ " theHashTable.insert(aDataItem)\n",
+ " elif choice == 'f':\n",
+ " print 'Enter key value to find: ',\n",
+ " value = int(raw_input())\n",
+ " aDataItem = theHashTable.find(aKey)\n",
+ " if(aDataItem != None):\n",
+ " print 'Found ' , aKey\n",
+ " else:\n",
+ " print 'Could not find ' , aKey\n",
+ "\n",
+ " elif choice=='d':\n",
+ " print 'Enter key value to delete: ',\n",
+ " value = int(raw_input())\n",
+ " theHashTable.delete(value)\n",
+ " else:\n",
+ " print 'Invalid entry'\n"
+ ],
"language": "python",
"metadata": {},
- "outputs": [],
- "prompt_number": "*"
+ "outputs": []
},
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch12.ipynb b/Data_Structures_and_Algorithms_in_Java/ch12.ipynb
index 8343fffc..1be785c9 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch12.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch12"
+ "name": "",
+ "signature": "sha256:f213ff4fe3150e369b8ba77a058a36b9c6a812a3ac3196b559e262346daafa7b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,102 +12,316 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 12 : Heaps "
+ "source": [
+ "Chapter 12 : Heaps "
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 12.1 Page no : 592"
+ "source": [
+ "Example 12.1 Page no : 592"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 12.1\ndemonstrates heaps\n'''\n\nclass Node: \n def __init__(self,key):\n # constructorJava Code for Heaps\n self.iData = key\n \n def getKey(self):\n return self.iData\n\n def setKey(self,i):\n self.iData = i\n\nclass Heap:\n def __init__(self,mx):\n self.maxSize = mx\n self.currentSize = 0\n self.heapArray = []\n for i in range(self.maxSize):\n self.heapArray.append(Node(0))\n\n def isEmpty(self):\n return self.currentSize==0\n\n def insert(self,key):\n if(self.currentSize==self.maxSize):\n return False\n newNode = Node(key)\n self.heapArray[self.currentSize] = newNode\n self.trickleUp(self.currentSize)\n self.currentSize += 1\n return True\n\n def trickleUp(self,index):\n parent = (index-1) / 2\n bottom = self.heapArray[index]\n while( index > 0 and self.heapArray[parent].getKey() < bottom.getKey() ):\n self.heapArray[index] = self.heapArray[parent] # move it down\n index = parent\n parent = (parent-1) / 2\n self.heapArray[index] = bottom\n\n def remove(self): # delete item with max key\n # (assumes non-empty list)\n root = self.heapArray[0]\n self.currentSize -= 1\n self.heapArray[0] = self.heapArray[self.currentSize]\n self.trickleDown(0)\n return root\n\n def trickleDown(self,index):\n top = self.heapArray[index] # save root\n while(index < self.currentSize/2): # while node has at\n leftChild = 2*index+1\n rightChild = leftChild+1 # find larger child\n if(rightChild < self.currentSize and self.heapArray[leftChild].getKey() < self.heapArray[rightChild].getKey()):\n largerChild = rightChild\n else:\n largerChild = leftChild\n if( top.getKey() >= self.heapArray[largerChild].getKey() ):\n break\n # shift child up\n self.heapArray[index] = self.heapArray[largerChild]\n index = largerChild # go down\n\n self.heapArray[index] = top # root to indexJava Code for Heaps\n \n def change(self,index,newValue):\n if(index<0 or index>=self.currentSize):\n return False\n oldValue = self.heapArray[index].getKey() # remember old\n self.heapArray[index].setKey(newValue) # change to new\n if(oldValue < newValue): # if raised,\n trickleUp(index) # trickle it up\n else: # if lowered,\n trickleDown(index) # trickle it down\n return True\n\n def displayHeap(self):\n print 'self.heapArray: ', # array format\n for m in range(self.currentSize):\n if(self.heapArray[m] != None):\n print self.heapArray[m].getKey(),\n else:\n print '-- ' ,\n print ''\n nBlanks = 32\n itemsPerRow = 1\n column = 0\n j = 0\n # current item\n dots = '...............................'\n print dots+dots\n # dotted top line\n while(self.currentSize > 0):\n if(column == 0):\n for k in range(nBlanks):\n print ' ' ,\n print self.heapArray[j].getKey() ,\n j += 1 \n if(j == self.currentSize):\n break # done?\n column += 1\n if(column==itemsPerRow): # end of row?\n nBlanks /= 2 # half the blanks\n itemsPerRow *= 2 # twice the items\n column = 0 # start over on\n print ''\n else: # next item on row\n for k in range(nBlanks*2-2):\n print ' ', # interim blanks\n print '\\n' +dots+dots \n\ntheHeap = Heap(31) # make a Heap max size 31\ntheHeap.insert(70)\ntheHeap.insert(40)\ntheHeap.insert(50)\ntheHeap.insert(20)\ntheHeap.insert(60)\ntheHeap.insert(100)\ntheHeap.insert(80)\ntheHeap.insert(30)\ntheHeap.insert(10)\ntheHeap.insert(90)\nwhile(True):\n print 'Enter first letter of show, insert, remove, change: ',\n choice = raw_input()\n if choice == 's':\n theHeap.displayHeap()\n elif choice == 'i':\n print 'Enter value to key to insert: '\n value = int(raw_input())\n success = theHeap.insert(value)\n if not success:\n print \"Can't insert heap full\"\n elif choice == 'f':\n print 'Enter key value to find: ',\n value = int(raw_input())\n aDataItem = theHashTable.find(aKey)\n if(aDataItem != None):\n print 'Found ' , aKey\n else:\n print 'Could not find ' , aKey\n elif choice=='r':\n if not theHeap.isEmpty():\n theHeap.remove()\n else:\n print \"Can't remove heap empty\"\n elif choice=='c':\n print 'Enter current index of item: ',\n value = int(raw_input())\n print \"Enter new key: \",\n value2 = int(raw_input())\n success = theHeap.change(value, value2)\n if( not success ):\n print 'Invalid index'\n else:\n print \"Invalid entry\"\n break ",
+ "input": [
+ " \n",
+ "class Node: \n",
+ " def __init__(self,key):\n",
+ " # constructorJava Code for Heaps\n",
+ " self.iData = key\n",
+ " \n",
+ " def getKey(self):\n",
+ " return self.iData\n",
+ "\n",
+ " def setKey(self,i):\n",
+ " self.iData = i\n",
+ "\n",
+ "class Heap:\n",
+ " def __init__(self,mx):\n",
+ " self.maxSize = mx\n",
+ " self.currentSize = 0\n",
+ " self.heapArray = []\n",
+ " for i in range(self.maxSize):\n",
+ " self.heapArray.append(Node(0))\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return self.currentSize==0\n",
+ "\n",
+ " def insert(self,key):\n",
+ " if(self.currentSize==self.maxSize):\n",
+ " return False\n",
+ " newNode = Node(key)\n",
+ " self.heapArray[self.currentSize] = newNode\n",
+ " self.trickleUp(self.currentSize)\n",
+ " self.currentSize += 1\n",
+ " return True\n",
+ "\n",
+ " def trickleUp(self,index):\n",
+ " parent = (index-1) / 2\n",
+ " bottom = self.heapArray[index]\n",
+ " while( index > 0 and self.heapArray[parent].getKey() < bottom.getKey() ):\n",
+ " self.heapArray[index] = self.heapArray[parent] # move it down\n",
+ " index = parent\n",
+ " parent = (parent-1) / 2\n",
+ " self.heapArray[index] = bottom\n",
+ "\n",
+ " def remove(self): # delete item with max key\n",
+ " # (assumes non-empty list)\n",
+ " root = self.heapArray[0]\n",
+ " self.currentSize -= 1\n",
+ " self.heapArray[0] = self.heapArray[self.currentSize]\n",
+ " self.trickleDown(0)\n",
+ " return root\n",
+ "\n",
+ " def trickleDown(self,index):\n",
+ " top = self.heapArray[index] # save root\n",
+ " while(index < self.currentSize/2): # while node has at\n",
+ " leftChild = 2*index+1\n",
+ " rightChild = leftChild+1 # find larger child\n",
+ " if(rightChild < self.currentSize and self.heapArray[leftChild].getKey() < self.heapArray[rightChild].getKey()):\n",
+ " largerChild = rightChild\n",
+ " else:\n",
+ " largerChild = leftChild\n",
+ " if( top.getKey() >= self.heapArray[largerChild].getKey() ):\n",
+ " break\n",
+ " # shift child up\n",
+ " self.heapArray[index] = self.heapArray[largerChild]\n",
+ " index = largerChild # go down\n",
+ "\n",
+ " self.heapArray[index] = top # root to indexJava Code for Heaps\n",
+ " \n",
+ " def change(self,index,newValue):\n",
+ " if(index<0 or index>=self.currentSize):\n",
+ " return False\n",
+ " oldValue = self.heapArray[index].getKey() # remember old\n",
+ " self.heapArray[index].setKey(newValue) # change to new\n",
+ " if(oldValue < newValue): # if raised,\n",
+ " trickleUp(index) # trickle it up\n",
+ " else: # if lowered,\n",
+ " trickleDown(index) # trickle it down\n",
+ " return True\n",
+ "\n",
+ " def displayHeap(self):\n",
+ " print 'self.heapArray: ', # array format\n",
+ " for m in range(self.currentSize):\n",
+ " if(self.heapArray[m] != None):\n",
+ " print self.heapArray[m].getKey(),\n",
+ " else:\n",
+ " print '-- ' ,\n",
+ " print ''\n",
+ " nBlanks = 32\n",
+ " itemsPerRow = 1\n",
+ " column = 0\n",
+ " j = 0\n",
+ " # current item\n",
+ " dots = '...............................'\n",
+ " print dots+dots\n",
+ " # dotted top line\n",
+ " while(self.currentSize > 0):\n",
+ " if(column == 0):\n",
+ " for k in range(nBlanks):\n",
+ " print ' ' ,\n",
+ " print self.heapArray[j].getKey() ,\n",
+ " j += 1 \n",
+ " if(j == self.currentSize):\n",
+ " break # done?\n",
+ " column += 1\n",
+ " if(column==itemsPerRow): # end of row?\n",
+ " nBlanks /= 2 # half the blanks\n",
+ " itemsPerRow *= 2 # twice the items\n",
+ " column = 0 # start over on\n",
+ " print ''\n",
+ " else: # next item on row\n",
+ " for k in range(nBlanks*2-2):\n",
+ " print ' ', # interim blanks\n",
+ " print '\\n' +dots+dots \n",
+ "\n",
+ "theHeap = Heap(31) # make a Heap max size 31\n",
+ "theHeap.insert(70)\n",
+ "theHeap.insert(40)\n",
+ "theHeap.insert(50)\n",
+ "theHeap.insert(20)\n",
+ "theHeap.insert(60)\n",
+ "theHeap.insert(100)\n",
+ "theHeap.insert(80)\n",
+ "theHeap.insert(30)\n",
+ "theHeap.insert(10)\n",
+ "theHeap.insert(90)\n",
+ "while(True):\n",
+ " print 'Enter first letter of show, insert, remove, change: ',\n",
+ " choice = raw_input()\n",
+ " if choice == 's':\n",
+ " theHeap.displayHeap()\n",
+ " elif choice == 'i':\n",
+ " print 'Enter value to key to insert: '\n",
+ " value = int(raw_input())\n",
+ " success = theHeap.insert(value)\n",
+ " if not success:\n",
+ " print \"Can't insert heap full\"\n",
+ " elif choice == 'f':\n",
+ " print 'Enter key value to find: ',\n",
+ " value = int(raw_input())\n",
+ " aDataItem = theHashTable.find(aKey)\n",
+ " if(aDataItem != None):\n",
+ " print 'Found ' , aKey\n",
+ " else:\n",
+ " print 'Could not find ' , aKey\n",
+ " elif choice=='r':\n",
+ " if not theHeap.isEmpty():\n",
+ " theHeap.remove()\n",
+ " else:\n",
+ " print \"Can't remove heap empty\"\n",
+ " elif choice=='c':\n",
+ " print 'Enter current index of item: ',\n",
+ " value = int(raw_input())\n",
+ " print \"Enter new key: \",\n",
+ " value2 = int(raw_input())\n",
+ " success = theHeap.change(value, value2)\n",
+ " if( not success ):\n",
+ " print 'Invalid index'\n",
+ " else:\n",
+ " print \"Invalid entry\"\n",
+ " break "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter first letter of show, insert, remove, change: "
+ "text": [
+ " Enter first letter of show, insert, remove, change: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "s\n"
+ "text": [
+ "s\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " self.heapArray: 100 90 80 30 60 50 70 20 10 40 \n..............................................................\n 100 \n 90 80 \n 30 60 50 70 \n 20 10 40 \n..............................................................\nEnter first letter of show, insert, remove, change: "
+ "text": [
+ " self.heapArray: 100 90 80 30 60 50 70 20 10 40 \n",
+ "..............................................................\n",
+ " 100 \n",
+ " 90 80 \n",
+ " 30 60 50 70 \n",
+ " 20 10 40 \n",
+ "..............................................................\n",
+ "Enter first letter of show, insert, remove, change: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "i\n"
+ "text": [
+ "i\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter value to key to insert: \n"
+ "text": [
+ " Enter value to key to insert: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "53\n"
+ "text": [
+ "53\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter first letter of show, insert, remove, change: "
+ "text": [
+ "Enter first letter of show, insert, remove, change: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "s\n"
+ "text": [
+ "s\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " self.heapArray: 100 90 80 30 60 50 70 20 10 40 53 \n..............................................................\n 100 \n 90 80 \n 30 60 50 70 \n 20 10 40 53 \n..............................................................\nEnter first letter of show, insert, remove, change: "
+ "text": [
+ " self.heapArray: 100 90 80 30 60 50 70 20 10 40 53 \n",
+ "..............................................................\n",
+ " 100 \n",
+ " 90 80 \n",
+ " 30 60 50 70 \n",
+ " 20 10 40 53 \n",
+ "..............................................................\n",
+ "Enter first letter of show, insert, remove, change: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "r\n"
+ "text": [
+ "r\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter first letter of show, insert, remove, change: "
+ "text": [
+ " Enter first letter of show, insert, remove, change: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "s\n"
+ "text": [
+ "s\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " self.heapArray: 90 60 80 30 53 50 70 20 10 40 \n..............................................................\n 90 \n 60 80 \n 30 53 50 70 \n 20 10 40 \n..............................................................\nEnter first letter of show, insert, remove, change: "
+ "text": [
+ " self.heapArray: 90 60 80 30 53 50 70 20 10 40 \n",
+ "..............................................................\n",
+ " 90 \n",
+ " 60 80 \n",
+ " 30 53 50 70 \n",
+ " 20 10 40 \n",
+ "..............................................................\n",
+ "Enter first letter of show, insert, remove, change: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Invalid entry\n"
+ "text": [
+ " Invalid entry\n"
+ ]
}
],
"prompt_number": 2
@@ -115,30 +330,177 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 12.2 Page no : 605"
+ "source": [
+ "Example 12.2 Page no : 605"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 12.2\ndemonstrates heap sort\n'''\nclass Node: \n def __init__(self,key):\n # constructorJava Code for Heaps\n self.iData = key\n \n def getKey(self):\n return self.iData\n\n def setKey(self,i):\n self.iData = i\n\nclass Heap:\n def __init__(self,mx):\n self.maxSize = mx\n self.currentSize = 0\n self.heapArray = []\n for i in range(self.maxSize):\n self.heapArray.append(Node(0))\n\n def isEmpty(self):\n return self.currentSize==0\n\n def insert(self,key):\n if(self.currentSize==self.maxSize):\n return False\n newNode = Node(key)\n self.heapArray[self.currentSize] = newNode\n self.trickleUp(self.currentSize)\n self.currentSize += 1\n return True\n\n def remove(self): # delete item with max key\n # (assumes non-empty list)\n root = self.heapArray[0]\n self.currentSize -= 1\n self.heapArray[0] = self.heapArray[self.currentSize]\n self.trickleDown(0)\n return root\n\n def trickleDown(self,index):\n top = self.heapArray[index] # save root\n while(index < self.currentSize/2): # while node has at\n leftChild = 2*index+1\n rightChild = leftChild+1 # find larger child\n if(rightChild < self.currentSize and self.heapArray[leftChild].getKey() < self.heapArray[rightChild].getKey()):\n largerChild = rightChild\n else:\n largerChild = leftChild\n if( top.getKey() >= self.heapArray[largerChild].getKey() ):\n break\n # shift child up\n self.heapArray[index] = self.heapArray[largerChild]\n index = largerChild # go down\n self.heapArray[index] = top # root to indexJava Code for Heaps\n\n def displayHeap(self):\n print 'self.heapArray: ', # array format\n for m in range(self.currentSize):\n if(self.heapArray[m] != None):\n print self.heapArray[m].getKey(),\n else:\n print '-- ' ,\n print ''\n nBlanks = 32\n itemsPerRow = 1\n column = 0\n j = 0\n # current item\n dots = '...............................'\n print dots+dots\n # dotted top line\n while(self.currentSize > 0):\n if(column == 0):\n for k in range(nBlanks):\n print ' ' ,\n print self.heapArray[j].getKey() ,\n j += 1 \n if(j == self.currentSize):\n break # done?\n column += 1\n if(column==itemsPerRow): # end of row?\n nBlanks /= 2 # half the blanks\n itemsPerRow *= 2 # twice the items\n column = 0 # start over on\n print ''\n else: # next item on row\n for k in range(nBlanks*2-2):\n print ' ', # interim blanks\n print '\\n' +dots+dots \n \n def displayArray(self):\n for j in range(self.maxSize):\n print self.heapArray[j].getKey() ,\n print ''\n\n def insertAt(self,index,newNode):\n self.heapArray[index] = newNode\n\n def incrementSize(self):\n self.currentSize += 1\n\n\nprint 'Enter number of items: ',\nsize = int(raw_input())\ntheHeap = Heap(size)\nimport random\nfor j in range(size): # fill array with\n r = int(random.random()*100)\n newNode = Node(r)\n theHeap.insertAt(j, newNode)\n theHeap.incrementSize()\nprint 'Random: ',\ntheHeap.displayArray() # display random array\nj = size/2 - 1\nwhile j >= 0:\n theHeap.trickleDown(j)\n j -= 1\nprint 'Heap: ',\ntheHeap.displayArray()\ntheHeap.displayHeap()\nj = size - 1\nwhile j >= 0:\n biggestNode = theHeap.remove()\n theHeap.insertAt(j, biggestNode)\n j -= 1\n \nprint 'Sorted: ',\ntheHeap.displayArray()",
+ "input": [
+ " \n",
+ "class Node: \n",
+ " def __init__(self,key):\n",
+ " # constructorJava Code for Heaps\n",
+ " self.iData = key\n",
+ " \n",
+ " def getKey(self):\n",
+ " return self.iData\n",
+ "\n",
+ " def setKey(self,i):\n",
+ " self.iData = i\n",
+ "\n",
+ "class Heap:\n",
+ " def __init__(self,mx):\n",
+ " self.maxSize = mx\n",
+ " self.currentSize = 0\n",
+ " self.heapArray = []\n",
+ " for i in range(self.maxSize):\n",
+ " self.heapArray.append(Node(0))\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return self.currentSize==0\n",
+ "\n",
+ " def insert(self,key):\n",
+ " if(self.currentSize==self.maxSize):\n",
+ " return False\n",
+ " newNode = Node(key)\n",
+ " self.heapArray[self.currentSize] = newNode\n",
+ " self.trickleUp(self.currentSize)\n",
+ " self.currentSize += 1\n",
+ " return True\n",
+ "\n",
+ " def remove(self): # delete item with max key\n",
+ " # (assumes non-empty list)\n",
+ " root = self.heapArray[0]\n",
+ " self.currentSize -= 1\n",
+ " self.heapArray[0] = self.heapArray[self.currentSize]\n",
+ " self.trickleDown(0)\n",
+ " return root\n",
+ "\n",
+ " def trickleDown(self,index):\n",
+ " top = self.heapArray[index] # save root\n",
+ " while(index < self.currentSize/2): # while node has at\n",
+ " leftChild = 2*index+1\n",
+ " rightChild = leftChild+1 # find larger child\n",
+ " if(rightChild < self.currentSize and self.heapArray[leftChild].getKey() < self.heapArray[rightChild].getKey()):\n",
+ " largerChild = rightChild\n",
+ " else:\n",
+ " largerChild = leftChild\n",
+ " if( top.getKey() >= self.heapArray[largerChild].getKey() ):\n",
+ " break\n",
+ " # shift child up\n",
+ " self.heapArray[index] = self.heapArray[largerChild]\n",
+ " index = largerChild # go down\n",
+ " self.heapArray[index] = top # root to indexJava Code for Heaps\n",
+ "\n",
+ " def displayHeap(self):\n",
+ " print 'self.heapArray: ', # array format\n",
+ " for m in range(self.currentSize):\n",
+ " if(self.heapArray[m] != None):\n",
+ " print self.heapArray[m].getKey(),\n",
+ " else:\n",
+ " print '-- ' ,\n",
+ " print ''\n",
+ " nBlanks = 32\n",
+ " itemsPerRow = 1\n",
+ " column = 0\n",
+ " j = 0\n",
+ " # current item\n",
+ " dots = '...............................'\n",
+ " print dots+dots\n",
+ " # dotted top line\n",
+ " while(self.currentSize > 0):\n",
+ " if(column == 0):\n",
+ " for k in range(nBlanks):\n",
+ " print ' ' ,\n",
+ " print self.heapArray[j].getKey() ,\n",
+ " j += 1 \n",
+ " if(j == self.currentSize):\n",
+ " break # done?\n",
+ " column += 1\n",
+ " if(column==itemsPerRow): # end of row?\n",
+ " nBlanks /= 2 # half the blanks\n",
+ " itemsPerRow *= 2 # twice the items\n",
+ " column = 0 # start over on\n",
+ " print ''\n",
+ " else: # next item on row\n",
+ " for k in range(nBlanks*2-2):\n",
+ " print ' ', # interim blanks\n",
+ " print '\\n' +dots+dots \n",
+ " \n",
+ " def displayArray(self):\n",
+ " for j in range(self.maxSize):\n",
+ " print self.heapArray[j].getKey() ,\n",
+ " print ''\n",
+ "\n",
+ " def insertAt(self,index,newNode):\n",
+ " self.heapArray[index] = newNode\n",
+ "\n",
+ " def incrementSize(self):\n",
+ " self.currentSize += 1\n",
+ "\n",
+ "\n",
+ "print 'Enter number of items: ',\n",
+ "size = int(raw_input())\n",
+ "theHeap = Heap(size)\n",
+ "import random\n",
+ "for j in range(size): # fill array with\n",
+ " r = int(random.random()*100)\n",
+ " newNode = Node(r)\n",
+ " theHeap.insertAt(j, newNode)\n",
+ " theHeap.incrementSize()\n",
+ "print 'Random: ',\n",
+ "theHeap.displayArray() # display random array\n",
+ "j = size/2 - 1\n",
+ "while j >= 0:\n",
+ " theHeap.trickleDown(j)\n",
+ " j -= 1\n",
+ "print 'Heap: ',\n",
+ "theHeap.displayArray()\n",
+ "theHeap.displayHeap()\n",
+ "j = size - 1\n",
+ "while j >= 0:\n",
+ " biggestNode = theHeap.remove()\n",
+ " theHeap.insertAt(j, biggestNode)\n",
+ " j -= 1\n",
+ " \n",
+ "print 'Sorted: ',\n",
+ "theHeap.displayArray()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of items: "
+ "text": [
+ "Enter number of items: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Random: 21 55 43 65 70 16 47 22 51 73 \nHeap: 73 70 47 65 55 16 43 22 51 21 \nself.heapArray: 73 70 47 65 55 16 43 22 51 21 \n..............................................................\n 73 \n 70 47 \n 65 55 16 43 \n 22 51 21 \n..............................................................\nSorted: 16 21 22 43 47 51 55 65 70 73 \n"
+ "text": [
+ " Random: 21 55 43 65 70 16 47 22 51 73 \n",
+ "Heap: 73 70 47 65 55 16 43 22 51 21 \n",
+ "self.heapArray: 73 70 47 65 55 16 43 22 51 21 \n",
+ "..............................................................\n",
+ " 73 \n",
+ " 70 47 \n",
+ " 65 55 16 43 \n",
+ " 22 51 21 \n",
+ "..............................................................\n",
+ "Sorted: 16 21 22 43 47 51 55 65 70 73 \n"
+ ]
}
],
"prompt_number": 3
@@ -146,7 +508,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch13.ipynb b/Data_Structures_and_Algorithms_in_Java/ch13.ipynb
index cab6d6e8..ab8fea53 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch13.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch13"
+ "name": "",
+ "signature": "sha256:e4ee94b1921cc19d6665af422d1e40ebb2336538caa9a0070a2828a133297159"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,116 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 13 : Graphs"
+ "source": [
+ "Chapter 13 : Graphs"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.1 Page no: 631"
+ "source": [
+ "Example 13.1 Page no: 631"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 13.1\ndemonstrates depth-first search\n'''\nclass StackX:\n def __init__(self):\n self.st = [] # make array\n self.top = -1\n\n def push(self,j): # put item on stack\n self.top += 1\n self.st.append(j)\n\n def pop(self): # take item off stack\n self.top -= 1\n return self.st.pop()\n\n def peek(self): # peek at top of stack\n return self.st[self.top]\n \n def isEmpty(self): # true if nothing on stack-\n return self.top == -1\n\nclass Vertex:\n def __init__(self,lab): # constructor\n self.label = lab\n self.wasVisited = False\n\nclass Graph:\n def __init__(self):\n self.vertexList = [] # adjacency matrix\n self.adjMat = []\n self.nVerts = 0\n for j in range(20): # set adjacency\n l = []\n for k in range(20):\n l.append(0)\n self.adjMat.append(l)\n self.theStack = StackX()\n\n def addVertex(self,lab):\n self.vertexList.append( Vertex(lab))\n self.nVerts += 1\n\n def addEdge(self,start, end):\n self.adjMat[start][end] = 1\n self.adjMat[end][start] = 1\n\n def displayVertex(self,v):\n print self.vertexList[v].label ,\n\n def dfs(self): # depth-first search # begin at vertex 0\n self.vertexList[0].wasVisited = True # mark it\n self.displayVertex(0) # display it\n self.theStack.push(0) # push it\n while( not self.theStack.isEmpty() ): # until stack empty,\n # get an unvisited vertex adjacent to stack top\n v = self.getAdjUnvisitedVertex( self.theStack.peek() )\n if(v == -1): # if no such vertex,\n self.theStack.pop()\n else: # if it exists,\n self.vertexList[v].wasVisited = True # mark it\n self.displayVertex(v) # display it\n self.theStack.push(v) # push it\n\n # stack is empty, so we're done\n for j in range(self.nVerts): # reset flags\n self.vertexList[j].wasVisited = False # end dfs\n\n def getAdjUnvisitedVertex(self,v):\n for j in range(self.nVerts):\n if(self.adjMat[v][j]==1 and self.vertexList[j].wasVisited==False):\n return j\n return -1\n\ntheGraph = Graph()\ntheGraph.addVertex('A') # 0 (start for dfs)\ntheGraph.addVertex('B') # 1\ntheGraph.addVertex('C') # 2\ntheGraph.addVertex('D') # 3\ntheGraph.addVertex('E') # 4\ntheGraph.addEdge(0,1)\ntheGraph.addEdge(1,2)\ntheGraph.addEdge(0,3)\ntheGraph.addEdge(3,4)\nprint 'Visits: ',\ntheGraph.dfs() # depth-first search",
+ "input": [
+ " \n",
+ "class StackX:\n",
+ " def __init__(self):\n",
+ " self.st = [] # make array\n",
+ " self.top = -1\n",
+ "\n",
+ " def push(self,j): # put item on stack\n",
+ " self.top += 1\n",
+ " self.st.append(j)\n",
+ "\n",
+ " def pop(self): # take item off stack\n",
+ " self.top -= 1\n",
+ " return self.st.pop()\n",
+ "\n",
+ " def peek(self): # peek at top of stack\n",
+ " return self.st[self.top]\n",
+ " \n",
+ " def isEmpty(self): # true if nothing on stack-\n",
+ " return self.top == -1\n",
+ "\n",
+ "class Vertex:\n",
+ " def __init__(self,lab): # constructor\n",
+ " self.label = lab\n",
+ " self.wasVisited = False\n",
+ "\n",
+ "class Graph:\n",
+ " def __init__(self):\n",
+ " self.vertexList = [] # adjacency matrix\n",
+ " self.adjMat = []\n",
+ " self.nVerts = 0\n",
+ " for j in range(20): # set adjacency\n",
+ " l = []\n",
+ " for k in range(20):\n",
+ " l.append(0)\n",
+ " self.adjMat.append(l)\n",
+ " self.theStack = StackX()\n",
+ "\n",
+ " def addVertex(self,lab):\n",
+ " self.vertexList.append( Vertex(lab))\n",
+ " self.nVerts += 1\n",
+ "\n",
+ " def addEdge(self,start, end):\n",
+ " self.adjMat[start][end] = 1\n",
+ " self.adjMat[end][start] = 1\n",
+ "\n",
+ " def displayVertex(self,v):\n",
+ " print self.vertexList[v].label ,\n",
+ "\n",
+ " def dfs(self): # depth-first search # begin at vertex 0\n",
+ " self.vertexList[0].wasVisited = True # mark it\n",
+ " self.displayVertex(0) # display it\n",
+ " self.theStack.push(0) # push it\n",
+ " while( not self.theStack.isEmpty() ): # until stack empty,\n",
+ " # get an unvisited vertex adjacent to stack top\n",
+ " v = self.getAdjUnvisitedVertex( self.theStack.peek() )\n",
+ " if(v == -1): # if no such vertex,\n",
+ " self.theStack.pop()\n",
+ " else: # if it exists,\n",
+ " self.vertexList[v].wasVisited = True # mark it\n",
+ " self.displayVertex(v) # display it\n",
+ " self.theStack.push(v) # push it\n",
+ "\n",
+ " # stack is empty, so we're done\n",
+ " for j in range(self.nVerts): # reset flags\n",
+ " self.vertexList[j].wasVisited = False # end dfs\n",
+ "\n",
+ " def getAdjUnvisitedVertex(self,v):\n",
+ " for j in range(self.nVerts):\n",
+ " if(self.adjMat[v][j]==1 and self.vertexList[j].wasVisited==False):\n",
+ " return j\n",
+ " return -1\n",
+ "\n",
+ "theGraph = Graph()\n",
+ "theGraph.addVertex('A') # 0 (start for dfs)\n",
+ "theGraph.addVertex('B') # 1\n",
+ "theGraph.addVertex('C') # 2\n",
+ "theGraph.addVertex('D') # 3\n",
+ "theGraph.addVertex('E') # 4\n",
+ "theGraph.addEdge(0,1)\n",
+ "theGraph.addEdge(1,2)\n",
+ "theGraph.addEdge(0,3)\n",
+ "theGraph.addEdge(3,4)\n",
+ "print 'Visits: ',\n",
+ "theGraph.dfs() # depth-first search"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Visits: A B C D E\n"
+ "text": [
+ "Visits: A B C D E\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +130,113 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.2 Page no : 639"
+ "source": [
+ "Example 13.2 Page no : 639"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 13.2\ndemonstrates breadth-first search\n'''\nclass Queue:\n def __init__(self): # constructor\n self.SIZE = 20\n self.queArray = []\n for i in range(20):\n self.queArray.append(0)\n self.front = 0\n self.rear = -1\n\n def insert(self,j): # put item at self.rear of queue\n if(self.rear == self.SIZE-1):\n self.rear = -1\n self.rear += 1\n self.queArray[self.rear] = j\n\n def remove(self): # take item from front of queue\n temp = self.queArray[self.front]\n self.front += 1\n if(self.front == self.SIZE):\n self.front = 0\n return temp\n\n def isEmpty(self): # true if queue is empty\n return ( self.rear+1==self.front or (self.front+self.SIZE-1==self.rear) )\n\nclass Vertex:\n def __init__(self,lab): # constructor\n self.label = lab\n self.wasVisited = False\n\nclass Graph:\n def __init__(self):\n self.vertexList = [] # adjacency matrix\n self.adjMat = []\n self.nVerts = 0\n for j in range(20): # set adjacency\n l = []\n for k in range(20):\n l.append(0)\n self.adjMat.append(l)\n self.theQueue = Queue()\n\n def addVertex(self,lab):\n self.vertexList.append( Vertex(lab))\n self.nVerts += 1\n\n def addEdge(self,start, end):\n self.adjMat[start][end] = 1\n self.adjMat[end][start] = 1\n\n def displayVertex(self,v):\n print self.vertexList[v].label ,\n\n def bfs(self): # breadth-first search\n # begin at vertex 0\n self.vertexList[0].wasVisited = True # mark it\n self.displayVertex(0) # display it\n self.theQueue.insert(0) # insert at tail\n while( not self.theQueue.isEmpty() ): # until queue empty,\n v1 = self.theQueue.remove() # remove vertex at head\n # until it has no unvisited neighbors\n while( self.getAdjUnvisitedVertex(v1) != -1 ):\n v2 = self.getAdjUnvisitedVertex(v1)\n self.vertexList[v2].wasVisited = True # mark it\n self.displayVertex(v2) # display it\n self.theQueue.insert(v2) # insert it\n for j in range(self.nVerts): # reset flags\n self.vertexList[j].wasVisited = False\n\n def getAdjUnvisitedVertex(self,v):\n for j in range(self.nVerts):\n if(self.adjMat[v][j]==1 and self.vertexList[j].wasVisited==False):\n return j\n return -1\n\n\ntheGraph = Graph()\ntheGraph.addVertex('A') # 0 (start for dfs)\ntheGraph.addVertex('B') # 1\ntheGraph.addVertex('C') # 2\ntheGraph.addVertex('D') # 3\ntheGraph.addVertex('E') # 4\ntheGraph.addEdge(0,1)\ntheGraph.addEdge(1,2)\ntheGraph.addEdge(0,3)\ntheGraph.addEdge(3,4)\nprint 'Visits: ',\ntheGraph.bfs() # breadth-first search",
+ "input": [
+ " \n",
+ "class Queue:\n",
+ " def __init__(self): # constructor\n",
+ " self.SIZE = 20\n",
+ " self.queArray = []\n",
+ " for i in range(20):\n",
+ " self.queArray.append(0)\n",
+ " self.front = 0\n",
+ " self.rear = -1\n",
+ "\n",
+ " def insert(self,j): # put item at self.rear of queue\n",
+ " if(self.rear == self.SIZE-1):\n",
+ " self.rear = -1\n",
+ " self.rear += 1\n",
+ " self.queArray[self.rear] = j\n",
+ "\n",
+ " def remove(self): # take item from front of queue\n",
+ " temp = self.queArray[self.front]\n",
+ " self.front += 1\n",
+ " if(self.front == self.SIZE):\n",
+ " self.front = 0\n",
+ " return temp\n",
+ "\n",
+ " def isEmpty(self): # true if queue is empty\n",
+ " return ( self.rear+1==self.front or (self.front+self.SIZE-1==self.rear) )\n",
+ "\n",
+ "class Vertex:\n",
+ " def __init__(self,lab): # constructor\n",
+ " self.label = lab\n",
+ " self.wasVisited = False\n",
+ "\n",
+ "class Graph:\n",
+ " def __init__(self):\n",
+ " self.vertexList = [] # adjacency matrix\n",
+ " self.adjMat = []\n",
+ " self.nVerts = 0\n",
+ " for j in range(20): # set adjacency\n",
+ " l = []\n",
+ " for k in range(20):\n",
+ " l.append(0)\n",
+ " self.adjMat.append(l)\n",
+ " self.theQueue = Queue()\n",
+ "\n",
+ " def addVertex(self,lab):\n",
+ " self.vertexList.append( Vertex(lab))\n",
+ " self.nVerts += 1\n",
+ "\n",
+ " def addEdge(self,start, end):\n",
+ " self.adjMat[start][end] = 1\n",
+ " self.adjMat[end][start] = 1\n",
+ "\n",
+ " def displayVertex(self,v):\n",
+ " print self.vertexList[v].label ,\n",
+ "\n",
+ " def bfs(self): # breadth-first search\n",
+ " # begin at vertex 0\n",
+ " self.vertexList[0].wasVisited = True # mark it\n",
+ " self.displayVertex(0) # display it\n",
+ " self.theQueue.insert(0) # insert at tail\n",
+ " while( not self.theQueue.isEmpty() ): # until queue empty,\n",
+ " v1 = self.theQueue.remove() # remove vertex at head\n",
+ " # until it has no unvisited neighbors\n",
+ " while( self.getAdjUnvisitedVertex(v1) != -1 ):\n",
+ " v2 = self.getAdjUnvisitedVertex(v1)\n",
+ " self.vertexList[v2].wasVisited = True # mark it\n",
+ " self.displayVertex(v2) # display it\n",
+ " self.theQueue.insert(v2) # insert it\n",
+ " for j in range(self.nVerts): # reset flags\n",
+ " self.vertexList[j].wasVisited = False\n",
+ "\n",
+ " def getAdjUnvisitedVertex(self,v):\n",
+ " for j in range(self.nVerts):\n",
+ " if(self.adjMat[v][j]==1 and self.vertexList[j].wasVisited==False):\n",
+ " return j\n",
+ " return -1\n",
+ "\n",
+ "\n",
+ "theGraph = Graph()\n",
+ "theGraph.addVertex('A') # 0 (start for dfs)\n",
+ "theGraph.addVertex('B') # 1\n",
+ "theGraph.addVertex('C') # 2\n",
+ "theGraph.addVertex('D') # 3\n",
+ "theGraph.addVertex('E') # 4\n",
+ "theGraph.addEdge(0,1)\n",
+ "theGraph.addEdge(1,2)\n",
+ "theGraph.addEdge(0,3)\n",
+ "theGraph.addEdge(3,4)\n",
+ "print 'Visits: ',\n",
+ "theGraph.bfs() # breadth-first search"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Visits: A B D C E\n"
+ "text": [
+ "Visits: A B D C E\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +245,126 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.3 Page no : 645"
+ "source": [
+ "Example 13.3 Page no : 645"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 13.3\ndemonstrates minimum spanning tree\n'''\nclass StackX:\n def __init__(self):\n self.st = [] # make array\n self.top = -1\n\n def push(self,j): # put item on stack\n self.top += 1\n self.st.append(j)\n\n def pop(self): # take item off stack\n self.top -= 1\n return self.st.pop()\n\n def peek(self): # peek at top of stack\n return self.st[self.top]\n \n def isEmpty(self): # true if nothing on stack-\n return self.top == -1\n\nclass Vertex:\n def __init__(self,lab): # constructor\n self.label = lab\n self.wasVisited = False\n\nclass Graph:\n def __init__(self):\n self.vertexList = [] # adjacency matrix\n self.adjMat = []\n self.nVerts = 0\n for j in range(20): # set adjacency\n l = []\n for k in range(20):\n l.append(0)\n self.adjMat.append(l)\n self.theStack = StackX()\n\n def addVertex(self,lab):\n self.vertexList.append( Vertex(lab))\n self.nVerts += 1\n\n def addEdge(self,start, end):\n self.adjMat[start][end] = 1\n self.adjMat[end][start] = 1\n\n def displayVertex(self,v):\n print self.vertexList[v].label ,\n\n def mst(self): # minimum spanning tree (depth first)\n # start at 0\n self.vertexList[0].wasVisited =True\n # mark it\n self.theStack.push(0)\n # push it\n while(not self.theStack.isEmpty() ):\n # until stack empty\n # get stack top\n currentVertex = self.theStack.peek()\n # get next unvisited neighbor \n v = self.getAdjUnvisitedVertex(currentVertex)\n if(v == -1):\n # if no more neighbors\n self.theStack.pop()\n else:\n # got a neighbor\n self.vertexList[v].wasVisited = True # mark it\n self.theStack.push(v)\n # push it\n # display edge\n self.displayVertex(currentVertex)\n # from currentV\n self.displayVertex(v)\n # to v\n print ' ',\n for j in range(self.nVerts):\n # reset flags\n self.vertexList[j].wasVisited = False\n\n def getAdjUnvisitedVertex(self, v):\n for j in range(self.nVerts):\n if(self.adjMat[v][j]==1 and self.vertexList[j].wasVisited==False):\n return j\n return -1\n\ntheGraph = Graph()\ntheGraph.addVertex('A') # 0 (start for mst)\ntheGraph.addVertex('B') # 1\ntheGraph.addVertex('C') # 2\ntheGraph.addVertex('D') # 3Topological Sorting with Directed Graphs\ntheGraph.addVertex('E') # 4\ntheGraph.addEdge(0,1) \ntheGraph.addEdge(0,2)\ntheGraph.addEdge(0,3) \ntheGraph.addEdge(0,4) \ntheGraph.addEdge(1,2) \ntheGraph.addEdge(1,3)\ntheGraph.addEdge(1,4) \ntheGraph.addEdge(2,3) \ntheGraph.addEdge(2,4) \ntheGraph.addEdge(3,4) \nprint 'Minimum spanning tree: ',\ntheGraph.mst() # minimum spanning tree",
+ "input": [
+ " \n",
+ "class StackX:\n",
+ " def __init__(self):\n",
+ " self.st = [] # make array\n",
+ " self.top = -1\n",
+ "\n",
+ " def push(self,j): # put item on stack\n",
+ " self.top += 1\n",
+ " self.st.append(j)\n",
+ "\n",
+ " def pop(self): # take item off stack\n",
+ " self.top -= 1\n",
+ " return self.st.pop()\n",
+ "\n",
+ " def peek(self): # peek at top of stack\n",
+ " return self.st[self.top]\n",
+ " \n",
+ " def isEmpty(self): # true if nothing on stack-\n",
+ " return self.top == -1\n",
+ "\n",
+ "class Vertex:\n",
+ " def __init__(self,lab): # constructor\n",
+ " self.label = lab\n",
+ " self.wasVisited = False\n",
+ "\n",
+ "class Graph:\n",
+ " def __init__(self):\n",
+ " self.vertexList = [] # adjacency matrix\n",
+ " self.adjMat = []\n",
+ " self.nVerts = 0\n",
+ " for j in range(20): # set adjacency\n",
+ " l = []\n",
+ " for k in range(20):\n",
+ " l.append(0)\n",
+ " self.adjMat.append(l)\n",
+ " self.theStack = StackX()\n",
+ "\n",
+ " def addVertex(self,lab):\n",
+ " self.vertexList.append( Vertex(lab))\n",
+ " self.nVerts += 1\n",
+ "\n",
+ " def addEdge(self,start, end):\n",
+ " self.adjMat[start][end] = 1\n",
+ " self.adjMat[end][start] = 1\n",
+ "\n",
+ " def displayVertex(self,v):\n",
+ " print self.vertexList[v].label ,\n",
+ "\n",
+ " def mst(self): # minimum spanning tree (depth first)\n",
+ " # start at 0\n",
+ " self.vertexList[0].wasVisited =True\n",
+ " # mark it\n",
+ " self.theStack.push(0)\n",
+ " # push it\n",
+ " while(not self.theStack.isEmpty() ):\n",
+ " # until stack empty\n",
+ " # get stack top\n",
+ " currentVertex = self.theStack.peek()\n",
+ " # get next unvisited neighbor \n",
+ " v = self.getAdjUnvisitedVertex(currentVertex)\n",
+ " if(v == -1):\n",
+ " # if no more neighbors\n",
+ " self.theStack.pop()\n",
+ " else:\n",
+ " # got a neighbor\n",
+ " self.vertexList[v].wasVisited = True # mark it\n",
+ " self.theStack.push(v)\n",
+ " # push it\n",
+ " # display edge\n",
+ " self.displayVertex(currentVertex)\n",
+ " # from currentV\n",
+ " self.displayVertex(v)\n",
+ " # to v\n",
+ " print ' ',\n",
+ " for j in range(self.nVerts):\n",
+ " # reset flags\n",
+ " self.vertexList[j].wasVisited = False\n",
+ "\n",
+ " def getAdjUnvisitedVertex(self, v):\n",
+ " for j in range(self.nVerts):\n",
+ " if(self.adjMat[v][j]==1 and self.vertexList[j].wasVisited==False):\n",
+ " return j\n",
+ " return -1\n",
+ "\n",
+ "theGraph = Graph()\n",
+ "theGraph.addVertex('A') # 0 (start for mst)\n",
+ "theGraph.addVertex('B') # 1\n",
+ "theGraph.addVertex('C') # 2\n",
+ "theGraph.addVertex('D') # 3Topological Sorting with Directed Graphs\n",
+ "theGraph.addVertex('E') # 4\n",
+ "theGraph.addEdge(0,1) \n",
+ "theGraph.addEdge(0,2)\n",
+ "theGraph.addEdge(0,3) \n",
+ "theGraph.addEdge(0,4) \n",
+ "theGraph.addEdge(1,2) \n",
+ "theGraph.addEdge(1,3)\n",
+ "theGraph.addEdge(1,4) \n",
+ "theGraph.addEdge(2,3) \n",
+ "theGraph.addEdge(2,4) \n",
+ "theGraph.addEdge(3,4) \n",
+ "print 'Minimum spanning tree: ',\n",
+ "theGraph.mst() # minimum spanning tree"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Minimum spanning tree: A B B C C D D E \n"
+ "text": [
+ "Minimum spanning tree: A B B C C D D E \n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +373,126 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.4 page No : 657"
+ "source": [
+ "Example 13.4 page No : 657"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 13.4\ndemonstrates topological sorting\n'''\nclass Vertex:\n def __init__(self,lab): # constructor\n self.label = lab\n self.wasVisited = False\n\nclass Graph:\n def __init__(self):\n self.vertexList = [] # adjacency matrix\n self.adjMat = []\n self.nVerts = 0\n for j in range(20): # set adjacency\n l = []\n for k in range(20):\n l.append(0)\n self.adjMat.append(l)\n\n def addVertex(self,lab):\n self.vertexList.append( Vertex(lab))\n self.nVerts += 1\n\n def addEdge(self,start, end):\n self.adjMat[start][end] = 1\n self.adjMat[end][start] = 1\n\n def displayVertex(self,v):\n print self.vertexList[v].label ,\n\n def topo(self): # topological sort\n orig_nVerts = self.nVerts # remember how many verts\n while(self.nVerts > 0): # while vertices remain,\n # get a vertex with no successors, or -1\n currentVertex = self.noSuccessors()\n if(currentVertex == -1):\n # must be a cycleTopological Sorting with Directed Graphs\n print 'ERROR: Graph has cycles'\n return\n\n # insert vertex label in sorted array (start at end)\n self.sortedArray[nVerts-1] = self.vertexList[currentVertex].label\n self.deleteVertex(currentVertex)\n print 'Topologically sorted order: '\n for j in range(orig_nVerts):\n print sortedArray[j] ,\n print ''\n\n def noSuccessors(self): # returns vert with no successors\n # (or -1 if no such verts)\n isEdge = None\n for row in range(self.nVerts): # for each vertex,\n isEdge = False\n # check edges\n for col in range(self.nVerts):\n if( self.adjMat[row][col] > 0 ): # if edge to\n # another,\n isEdge = True\n break\n if( not isEdge ):\n # if no edges,\n return row\n return -1\n\n def deleteVertex(self,delVert):\n if(delVert != self.nVerts-1):\n # if not last vertex,\n # delete from vertexList\n for j in range(self.nVerts-1):\n self.vertexList[j] = self.vertexList[j+1]\n # delete row from adjMat\n for row in range(self.nVerts-1):\n self.moveRowUp(row, nVerts)\n # delete col from adjMat\n for col in range(self.nVerts-1):\n self.moveColLeft(col, nVerts-1)\n self.nVerts -= 1\n\n def moveRowUp(self,row,length):\n for col in range(length):\n self.adjMat[row][col] = self.adjMat[row+1][col]\n\n def moveColLeft(self,col, length):\n for row in range(self.length):\n self.adjMat[row][col] = self.adjMat[row][col+1]\n\ntheGraph = Graph()\ntheGraph.addVertex('A') # 0\ntheGraph.addVertex('B') # 1\ntheGraph.addVertex('C') # 2\ntheGraph.addVertex('D') # 3\ntheGraph.addVertex('E') # 4\ntheGraph.addVertex('F') # 5\ntheGraph.addVertex('G') # 6\ntheGraph.addVertex('H') # 7Connectivity in Directed Graphs\ntheGraph.addEdge(0,3)\ntheGraph.addEdge(0,4)\ntheGraph.addEdge(1,4)\ntheGraph.addEdge(2,5)\ntheGraph.addEdge(3,6)\ntheGraph.addEdge(4,6)\ntheGraph.addEdge(5,7)\ntheGraph.addEdge(6,7)\ntheGraph.topo() # do the sort",
+ "input": [
+ " \n",
+ "class Vertex:\n",
+ " def __init__(self,lab): # constructor\n",
+ " self.label = lab\n",
+ " self.wasVisited = False\n",
+ "\n",
+ "class Graph:\n",
+ " def __init__(self):\n",
+ " self.vertexList = [] # adjacency matrix\n",
+ " self.adjMat = []\n",
+ " self.nVerts = 0\n",
+ " for j in range(20): # set adjacency\n",
+ " l = []\n",
+ " for k in range(20):\n",
+ " l.append(0)\n",
+ " self.adjMat.append(l)\n",
+ "\n",
+ " def addVertex(self,lab):\n",
+ " self.vertexList.append( Vertex(lab))\n",
+ " self.nVerts += 1\n",
+ "\n",
+ " def addEdge(self,start, end):\n",
+ " self.adjMat[start][end] = 1\n",
+ " self.adjMat[end][start] = 1\n",
+ "\n",
+ " def displayVertex(self,v):\n",
+ " print self.vertexList[v].label ,\n",
+ "\n",
+ " def topo(self): # topological sort\n",
+ " orig_nVerts = self.nVerts # remember how many verts\n",
+ " while(self.nVerts > 0): # while vertices remain,\n",
+ " # get a vertex with no successors, or -1\n",
+ " currentVertex = self.noSuccessors()\n",
+ " if(currentVertex == -1):\n",
+ " # must be a cycleTopological Sorting with Directed Graphs\n",
+ " print 'ERROR: Graph has cycles'\n",
+ " return\n",
+ "\n",
+ " # insert vertex label in sorted array (start at end)\n",
+ " self.sortedArray[nVerts-1] = self.vertexList[currentVertex].label\n",
+ " self.deleteVertex(currentVertex)\n",
+ " print 'Topologically sorted order: '\n",
+ " for j in range(orig_nVerts):\n",
+ " print sortedArray[j] ,\n",
+ " print ''\n",
+ "\n",
+ " def noSuccessors(self): # returns vert with no successors\n",
+ " # (or -1 if no such verts)\n",
+ " isEdge = None\n",
+ " for row in range(self.nVerts): # for each vertex,\n",
+ " isEdge = False\n",
+ " # check edges\n",
+ " for col in range(self.nVerts):\n",
+ " if( self.adjMat[row][col] > 0 ): # if edge to\n",
+ " # another,\n",
+ " isEdge = True\n",
+ " break\n",
+ " if( not isEdge ):\n",
+ " # if no edges,\n",
+ " return row\n",
+ " return -1\n",
+ "\n",
+ " def deleteVertex(self,delVert):\n",
+ " if(delVert != self.nVerts-1):\n",
+ " # if not last vertex,\n",
+ " # delete from vertexList\n",
+ " for j in range(self.nVerts-1):\n",
+ " self.vertexList[j] = self.vertexList[j+1]\n",
+ " # delete row from adjMat\n",
+ " for row in range(self.nVerts-1):\n",
+ " self.moveRowUp(row, nVerts)\n",
+ " # delete col from adjMat\n",
+ " for col in range(self.nVerts-1):\n",
+ " self.moveColLeft(col, nVerts-1)\n",
+ " self.nVerts -= 1\n",
+ "\n",
+ " def moveRowUp(self,row,length):\n",
+ " for col in range(length):\n",
+ " self.adjMat[row][col] = self.adjMat[row+1][col]\n",
+ "\n",
+ " def moveColLeft(self,col, length):\n",
+ " for row in range(self.length):\n",
+ " self.adjMat[row][col] = self.adjMat[row][col+1]\n",
+ "\n",
+ "theGraph = Graph()\n",
+ "theGraph.addVertex('A') # 0\n",
+ "theGraph.addVertex('B') # 1\n",
+ "theGraph.addVertex('C') # 2\n",
+ "theGraph.addVertex('D') # 3\n",
+ "theGraph.addVertex('E') # 4\n",
+ "theGraph.addVertex('F') # 5\n",
+ "theGraph.addVertex('G') # 6\n",
+ "theGraph.addVertex('H') # 7Connectivity in Directed Graphs\n",
+ "theGraph.addEdge(0,3)\n",
+ "theGraph.addEdge(0,4)\n",
+ "theGraph.addEdge(1,4)\n",
+ "theGraph.addEdge(2,5)\n",
+ "theGraph.addEdge(3,6)\n",
+ "theGraph.addEdge(4,6)\n",
+ "theGraph.addEdge(5,7)\n",
+ "theGraph.addEdge(6,7)\n",
+ "theGraph.topo() # do the sort"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "ERROR: Graph has cycles\n"
+ "text": [
+ "ERROR: Graph has cycles\n"
+ ]
}
],
"prompt_number": 4
@@ -100,7 +500,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch14.ipynb b/Data_Structures_and_Algorithms_in_Java/ch14.ipynb
index 7895bf4f..46aa59dc 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch14.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch14"
+ "name": "",
+ "signature": "sha256:2dd04a4aee1b7409691d218147433fe56bcbf7998733e71f7ca224eaa4cea307"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,18 +12,174 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 14 : Weighted Graphs"
+ "source": [
+ "Chapter 14 : Weighted Graphs"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 14.1 Page no: 681"
+ "source": [
+ "Example 14.1 Page no: 681"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 14.1\ndemonstrates minimum spanning tree with weighted graphs\n'''\nclass Edge:\n def __init__(self,sv,dv,d): # constructor\n self.srcVert = sv\n self.destVert = dv\n self.distance = d\n\nclass PriorityQ:\n def __init__(self):\n # constructor\n self.queArray = []\n self.size = 0\n def insert(self,item): # insert item in sorted order\n self.queArray.append(item)\n b = self.size\n for j in range(self.size): # find place to insert\n if( item.distance >= self.queArray[j].distance ):\n b = j\n break\n for k in range(self.size-1,b-1,-1):#=self.size-1 k>=j k--) # move items up\n self.queArray[k+1] = self.queArray[k]\n self.queArray[b] = item\n # insert item\n self.size += 1\n\n def removeMin(self): # remove minimum item\n self.size -= 1\n return self.queArray[self.size] \n\n def removeN(self,n): # remove item at n\n for j in range(n,self.size-1): # move items down\n self.queArray[j] = self.queArray[j+1]\n self.size -= 1\n\n def peekMin(self): # peek at minimum item\n return self.self.queArray[self.size-1] \n\n def size(self): # return number of items\n return self.size\n\n def isEmpty(self): # true if queue is empty\n return (self.size==0) \n\n def peekN(self,n): # peek at item n\n return self.queArray[n]\n\n def find(self,findDex): # find item with specified\n # self.destVert value\n for j in range(self.size-1):\n if(self.queArray[j].destVert == findDex):\n return j\n return -1\n\nclass Vertex:\n def __init__(self,lab): # constructor\n self.label = lab\n self.isInTree = False\n\nclass Graph:\n def __init__(self):\n self.vertexList = [] # adjacency matrix\n self.adjMat = []\n self.nVerts = 0\n for j in range(20): # set adjacency\n l = []\n for k in range(20):\n l.append(1000000)\n self.adjMat.append(l)\n self.thePQ = PriorityQ()\n self.nTree = 0\n self.currentVert = 0\n\n def addVertex(self,lab):\n self.vertexList.append( Vertex(lab))\n self.nVerts += 1\n\n def addEdge(self,start, end,weight):\n self.adjMat[start][end] = weight\n self.adjMat[end][start] = weight\n\n\n def displayVertex(self,v):\n print self.vertexList[v].label ,\n\n def mstw(self):\n self.currentVert = 0 # minimum spanning tree\n # start at 0\n while(self.nTree < self.nVerts-1): # while not all verts in tree\n # put self.currentVert in tree\n self.vertexList[self.currentVert].isInTree = True\n self.nTree += 1\n # insert edges adjacent to self.currentVert into PQ\n for j in range(self.nVerts): # for each vertex,\n if(j==self.currentVert): # skip if its us\n continue\n if(self.vertexList[j].isInTree): # skip if in the tree\n continue\n self.distance = self.adjMat[self.currentVert][j]\n if( self.distance == 1000000): # skip if no edge\n continue\n self.putInPQ(j, self.distance) # put it in PQ (maybe)\n if(self.thePQ.size==0): # no vertices in PQ?\n print 'GRAPH NOT CONNECTED',\n return\n # remove edge with minimum self.distance, from PQ\n theEdge = self.thePQ.removeMin()\n sourceVert = theEdge.srcVert\n self.currentVert = theEdge.destVert\n # display edge from source to current\n print self.vertexList[sourceVert].label ,self.vertexList[self.currentVert].label, \" \",\n\n for j in range(self.nVerts): # unmark vertices\n self.vertexList[j].isIsTree = False\n\n def putInPQ(self,newVert,newDist): # is there another edge with the same destination vertex?\n queueIndex = self.thePQ.find(newVert)\n if(queueIndex != -1): # got edges index\n tempEdge = self.thePQ.peekN(queueIndex) # get edge\n oldDist = tempEdge.distance\n if(oldDist > newDist): # if new edge shorter,\n self.thePQ.removeN(queueIndex) # remove old edge\n theEdge = Edge(self.currentVert, newVert, newDist)\n self.thePQ.insert(theEdge)# insert new edge\n # else no action just leave the old vertex there\n else: # no edge with same destination vertex\n # so insert new one\n theEdge = Edge(self.currentVert, newVert, newDist)\n self.thePQ.insert(theEdge)\n\n\ntheGraph = Graph()\ntheGraph.addVertex('A') # 0 (start for mst)\ntheGraph.addVertex('B') # 1\ntheGraph.addVertex('C') # 2\ntheGraph.addVertex('D') # 3\ntheGraph.addVertex('E') # 4\ntheGraph.addVertex('F') # 5\ntheGraph.addEdge(0, 1, 16) # AB\ntheGraph.addEdge(0, 3, 24) # AD\n\ntheGraph.addEdge(1,2,1)\ntheGraph.addEdge(1,3,5)\ntheGraph.addEdge(1,4,2)\ntheGraph.addEdge(2,3,6)\ntheGraph.addEdge(2,4,8)\ntheGraph.addEdge(2,5,26)\ntheGraph.addEdge(3,4,142)\ntheGraph.addEdge(4,5,17)\n\nprint 'Minimum spanning tree: ',\ntheGraph.mstw() # minimum spanning tree",
+ "input": [
+ " \n",
+ "class Edge:\n",
+ " def __init__(self,sv,dv,d): # constructor\n",
+ " self.srcVert = sv\n",
+ " self.destVert = dv\n",
+ " self.distance = d\n",
+ "\n",
+ "class PriorityQ:\n",
+ " def __init__(self):\n",
+ " # constructor\n",
+ " self.queArray = []\n",
+ " self.size = 0\n",
+ " def insert(self,item): # insert item in sorted order\n",
+ " self.queArray.append(item)\n",
+ " b = self.size\n",
+ " for j in range(self.size): # find place to insert\n",
+ " if( item.distance >= self.queArray[j].distance ):\n",
+ " b = j\n",
+ " break\n",
+ " for k in range(self.size-1,b-1,-1):#=self.size-1 k>=j k--) # move items up\n",
+ " self.queArray[k+1] = self.queArray[k]\n",
+ " self.queArray[b] = item\n",
+ " # insert item\n",
+ " self.size += 1\n",
+ "\n",
+ " def removeMin(self): # remove minimum item\n",
+ " self.size -= 1\n",
+ " return self.queArray[self.size] \n",
+ "\n",
+ " def removeN(self,n): # remove item at n\n",
+ " for j in range(n,self.size-1): # move items down\n",
+ " self.queArray[j] = self.queArray[j+1]\n",
+ " self.size -= 1\n",
+ "\n",
+ " def peekMin(self): # peek at minimum item\n",
+ " return self.self.queArray[self.size-1] \n",
+ "\n",
+ " def size(self): # return number of items\n",
+ " return self.size\n",
+ "\n",
+ " def isEmpty(self): # true if queue is empty\n",
+ " return (self.size==0) \n",
+ "\n",
+ " def peekN(self,n): # peek at item n\n",
+ " return self.queArray[n]\n",
+ "\n",
+ " def find(self,findDex): # find item with specified\n",
+ " # self.destVert value\n",
+ " for j in range(self.size-1):\n",
+ " if(self.queArray[j].destVert == findDex):\n",
+ " return j\n",
+ " return -1\n",
+ "\n",
+ "class Vertex:\n",
+ " def __init__(self,lab): # constructor\n",
+ " self.label = lab\n",
+ " self.isInTree = False\n",
+ "\n",
+ "class Graph:\n",
+ " def __init__(self):\n",
+ " self.vertexList = [] # adjacency matrix\n",
+ " self.adjMat = []\n",
+ " self.nVerts = 0\n",
+ " for j in range(20): # set adjacency\n",
+ " l = []\n",
+ " for k in range(20):\n",
+ " l.append(1000000)\n",
+ " self.adjMat.append(l)\n",
+ " self.thePQ = PriorityQ()\n",
+ " self.nTree = 0\n",
+ " self.currentVert = 0\n",
+ "\n",
+ " def addVertex(self,lab):\n",
+ " self.vertexList.append( Vertex(lab))\n",
+ " self.nVerts += 1\n",
+ "\n",
+ " def addEdge(self,start, end,weight):\n",
+ " self.adjMat[start][end] = weight\n",
+ " self.adjMat[end][start] = weight\n",
+ "\n",
+ "\n",
+ " def displayVertex(self,v):\n",
+ " print self.vertexList[v].label ,\n",
+ "\n",
+ " def mstw(self):\n",
+ " self.currentVert = 0 # minimum spanning tree\n",
+ " # start at 0\n",
+ " while(self.nTree < self.nVerts-1): # while not all verts in tree\n",
+ " # put self.currentVert in tree\n",
+ " self.vertexList[self.currentVert].isInTree = True\n",
+ " self.nTree += 1\n",
+ " # insert edges adjacent to self.currentVert into PQ\n",
+ " for j in range(self.nVerts): # for each vertex,\n",
+ " if(j==self.currentVert): # skip if its us\n",
+ " continue\n",
+ " if(self.vertexList[j].isInTree): # skip if in the tree\n",
+ " continue\n",
+ " self.distance = self.adjMat[self.currentVert][j]\n",
+ " if( self.distance == 1000000): # skip if no edge\n",
+ " continue\n",
+ " self.putInPQ(j, self.distance) # put it in PQ (maybe)\n",
+ " if(self.thePQ.size==0): # no vertices in PQ?\n",
+ " print 'GRAPH NOT CONNECTED',\n",
+ " return\n",
+ " # remove edge with minimum self.distance, from PQ\n",
+ " theEdge = self.thePQ.removeMin()\n",
+ " sourceVert = theEdge.srcVert\n",
+ " self.currentVert = theEdge.destVert\n",
+ " # display edge from source to current\n",
+ " print self.vertexList[sourceVert].label ,self.vertexList[self.currentVert].label, \" \",\n",
+ "\n",
+ " for j in range(self.nVerts): # unmark vertices\n",
+ " self.vertexList[j].isIsTree = False\n",
+ "\n",
+ " def putInPQ(self,newVert,newDist): # is there another edge with the same destination vertex?\n",
+ " queueIndex = self.thePQ.find(newVert)\n",
+ " if(queueIndex != -1): # got edges index\n",
+ " tempEdge = self.thePQ.peekN(queueIndex) # get edge\n",
+ " oldDist = tempEdge.distance\n",
+ " if(oldDist > newDist): # if new edge shorter,\n",
+ " self.thePQ.removeN(queueIndex) # remove old edge\n",
+ " theEdge = Edge(self.currentVert, newVert, newDist)\n",
+ " self.thePQ.insert(theEdge)# insert new edge\n",
+ " # else no action just leave the old vertex there\n",
+ " else: # no edge with same destination vertex\n",
+ " # so insert new one\n",
+ " theEdge = Edge(self.currentVert, newVert, newDist)\n",
+ " self.thePQ.insert(theEdge)\n",
+ "\n",
+ "\n",
+ "theGraph = Graph()\n",
+ "theGraph.addVertex('A') # 0 (start for mst)\n",
+ "theGraph.addVertex('B') # 1\n",
+ "theGraph.addVertex('C') # 2\n",
+ "theGraph.addVertex('D') # 3\n",
+ "theGraph.addVertex('E') # 4\n",
+ "theGraph.addVertex('F') # 5\n",
+ "theGraph.addEdge(0, 1, 16) # AB\n",
+ "theGraph.addEdge(0, 3, 24) # AD\n",
+ "\n",
+ "theGraph.addEdge(1,2,1)\n",
+ "theGraph.addEdge(1,3,5)\n",
+ "theGraph.addEdge(1,4,2)\n",
+ "theGraph.addEdge(2,3,6)\n",
+ "theGraph.addEdge(2,4,8)\n",
+ "theGraph.addEdge(2,5,26)\n",
+ "theGraph.addEdge(3,4,142)\n",
+ "theGraph.addEdge(4,5,17)\n",
+ "\n",
+ "print 'Minimum spanning tree: ',\n",
+ "theGraph.mstw() # minimum spanning tree"
+ ],
"language": "python",
"metadata": {},
"outputs": []
@@ -31,19 +188,160 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 14.2 Page 703"
+ "source": [
+ "Example 14.2 Page 703"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 14.2\ndemonstrates shortest path with weighted, directed graphs\n'''\nclass DistPar:\n def __init__(self,pv,d): # constructor\n self.distance = d\n self.parentVert = pv\n\nclass Vertex:\n def __init__(self,lab): # constructor\n self.label = lab\n self.isInTree = False\n\nclass Graph:\n def __init__(self): # constructor\n self.vertexList = [] # adjacency matrix\n self.adjMat = []\n self.nVerts = 0\n self.nTree = 0\n for j in range(20): # set adjacency\n l = []\n for k in range(20):\n l.append(1000000)\n self.adjMat.append(l)\n self.currentVert = 0\n self.sPath = [] # shortest paths\n self.startToCurrent = 0\n\n def addVertex(self,lab):\n self.vertexList.append( Vertex(lab))\n self.nVerts += 1\n\n def addEdge(self,start, end,weight):\n self.adjMat[start][end] = weight\n\n\n def displayVertex(self,v):\n print self.vertexList[v].label ,\n\n def path(self): # find all shortest paths\n startTree = 0 # start at vertex 0\n self.vertexList[startTree].isInTree = True\n self.nTree = 1 # put it in tree\n # transfer row of distances from adjMat to sPath\n for j in range(self.nVerts):\n tempDist = self.adjMat[startTree][j]\n try:\n self.sPath[j] = DistPar(startTree, tempDist)\n except:\n self.sPath.append(DistPar(startTree, tempDist))\n # until all vertices are in the tree\n while(self.nTree < self.nVerts):\n indexMin = self.getMin() # get minimum from sPath\n minDist = self.sPath[indexMin].distance\n if(minDist == 1000000): # if all infinite\n # or in tree,\n print 'There are unreachable vertices'\n break # sPath is complete\n else:\n # reset self.currentVert\n self.currentVert = indexMin # to closest vert\n self.startToCurrent = self.sPath[indexMin].distance\n # minimum distance from startTree is\n # to self.currentVert, and is self.startToCurrent\n # put current vertex in tree\n self.vertexList[self.currentVert].isInTree = True\n self.nTree += 1\n self.adjust_sPath() # update sPath[] array\n\n self.displayPaths() # display sPath[] contents\n self.nTree = 0 # clear tree\n for j in range(self.nVerts):\n self.vertexList[j].isInTree = False \n\n def getMin(self): # get entry from sPath\n minDist = 1000000 # assume minimum\n indexMin = 0\n for j in range(self.nVerts): # for each vertex,\n # if its in tree and\n if( not self.vertexList[j].isInTree and self.sPath[j].distance < minDist ):\n minDist = self.sPath[j].distance\n indexMin = j # update minimum\n return indexMin\n\n def adjust_sPath(self):\n # adjust values in shortest-path array sPath\n column = 1\n # skip starting vertex\n while(column < self.nVerts): # go across columns\n # if this columns vertex already in tree, skip it\n if( self.vertexList[column].isInTree ):\n column += 1\n continue\n # calculate distance for one sPath entry get edge from self.currentVert to column\n currentToFringe = self.adjMat[self.currentVert][column]\n # add distance from start\n startToFringe = self.startToCurrent + currentToFringe\n # get distance of current sPath entry\n sPathDist = self.sPath[column].distance\n # compare distance from start with sPath entry\n if(startToFringe < sPathDist): # if shorter,\n # update sPath\n self.sPath[column].parentVert = self.currentVert\n self.sPath[column].distance = startToFringe\n column += 1\n\n def displayPaths(self):\n for j in range(self.nVerts): # display contents of sPath[]\n print self.vertexList[j].label ,' =' \n if(self.sPath[j].distance == 1000000):\n print 'inf', # inf\n else:\n print self.sPath[j].distance , # 50\n parent = self.vertexList[ self.sPath[j].parentVert ].label\n print '(' , parent , ')' , # (A)\n print ''\n \ntheGraph = Graph()\ntheGraph.addVertex('A') # 0 (start)\ntheGraph.addVertex('C') # 2\ntheGraph.addVertex('B') # 1\ntheGraph.addVertex('D') # 3\ntheGraph.addVertex('E') # 4\ntheGraph.addEdge(0,1,50)\ntheGraph.addEdge(0,3,80)\ntheGraph.addEdge(1,2,60)\ntheGraph.addEdge(1,3,90)\ntheGraph.addEdge(2,4,40)\ntheGraph.addEdge(3,2,20)\ntheGraph.addEdge(3,4,70)\ntheGraph.addEdge(4,1,50)\nprint 'Shortest paths' ,\ntheGraph.path() # shortest paths",
+ "input": [
+ " \n",
+ "class DistPar:\n",
+ " def __init__(self,pv,d): # constructor\n",
+ " self.distance = d\n",
+ " self.parentVert = pv\n",
+ "\n",
+ "class Vertex:\n",
+ " def __init__(self,lab): # constructor\n",
+ " self.label = lab\n",
+ " self.isInTree = False\n",
+ "\n",
+ "class Graph:\n",
+ " def __init__(self): # constructor\n",
+ " self.vertexList = [] # adjacency matrix\n",
+ " self.adjMat = []\n",
+ " self.nVerts = 0\n",
+ " self.nTree = 0\n",
+ " for j in range(20): # set adjacency\n",
+ " l = []\n",
+ " for k in range(20):\n",
+ " l.append(1000000)\n",
+ " self.adjMat.append(l)\n",
+ " self.currentVert = 0\n",
+ " self.sPath = [] # shortest paths\n",
+ " self.startToCurrent = 0\n",
+ "\n",
+ " def addVertex(self,lab):\n",
+ " self.vertexList.append( Vertex(lab))\n",
+ " self.nVerts += 1\n",
+ "\n",
+ " def addEdge(self,start, end,weight):\n",
+ " self.adjMat[start][end] = weight\n",
+ "\n",
+ "\n",
+ " def displayVertex(self,v):\n",
+ " print self.vertexList[v].label ,\n",
+ "\n",
+ " def path(self): # find all shortest paths\n",
+ " startTree = 0 # start at vertex 0\n",
+ " self.vertexList[startTree].isInTree = True\n",
+ " self.nTree = 1 # put it in tree\n",
+ " # transfer row of distances from adjMat to sPath\n",
+ " for j in range(self.nVerts):\n",
+ " tempDist = self.adjMat[startTree][j]\n",
+ " try:\n",
+ " self.sPath[j] = DistPar(startTree, tempDist)\n",
+ " except:\n",
+ " self.sPath.append(DistPar(startTree, tempDist))\n",
+ " # until all vertices are in the tree\n",
+ " while(self.nTree < self.nVerts):\n",
+ " indexMin = self.getMin() # get minimum from sPath\n",
+ " minDist = self.sPath[indexMin].distance\n",
+ " if(minDist == 1000000): # if all infinite\n",
+ " # or in tree,\n",
+ " print 'There are unreachable vertices'\n",
+ " break # sPath is complete\n",
+ " else:\n",
+ " # reset self.currentVert\n",
+ " self.currentVert = indexMin # to closest vert\n",
+ " self.startToCurrent = self.sPath[indexMin].distance\n",
+ " # minimum distance from startTree is\n",
+ " # to self.currentVert, and is self.startToCurrent\n",
+ " # put current vertex in tree\n",
+ " self.vertexList[self.currentVert].isInTree = True\n",
+ " self.nTree += 1\n",
+ " self.adjust_sPath() # update sPath[] array\n",
+ "\n",
+ " self.displayPaths() # display sPath[] contents\n",
+ " self.nTree = 0 # clear tree\n",
+ " for j in range(self.nVerts):\n",
+ " self.vertexList[j].isInTree = False \n",
+ "\n",
+ " def getMin(self): # get entry from sPath\n",
+ " minDist = 1000000 # assume minimum\n",
+ " indexMin = 0\n",
+ " for j in range(self.nVerts): # for each vertex,\n",
+ " # if its in tree and\n",
+ " if( not self.vertexList[j].isInTree and self.sPath[j].distance < minDist ):\n",
+ " minDist = self.sPath[j].distance\n",
+ " indexMin = j # update minimum\n",
+ " return indexMin\n",
+ "\n",
+ " def adjust_sPath(self):\n",
+ " # adjust values in shortest-path array sPath\n",
+ " column = 1\n",
+ " # skip starting vertex\n",
+ " while(column < self.nVerts): # go across columns\n",
+ " # if this columns vertex already in tree, skip it\n",
+ " if( self.vertexList[column].isInTree ):\n",
+ " column += 1\n",
+ " continue\n",
+ " # calculate distance for one sPath entry get edge from self.currentVert to column\n",
+ " currentToFringe = self.adjMat[self.currentVert][column]\n",
+ " # add distance from start\n",
+ " startToFringe = self.startToCurrent + currentToFringe\n",
+ " # get distance of current sPath entry\n",
+ " sPathDist = self.sPath[column].distance\n",
+ " # compare distance from start with sPath entry\n",
+ " if(startToFringe < sPathDist): # if shorter,\n",
+ " # update sPath\n",
+ " self.sPath[column].parentVert = self.currentVert\n",
+ " self.sPath[column].distance = startToFringe\n",
+ " column += 1\n",
+ "\n",
+ " def displayPaths(self):\n",
+ " for j in range(self.nVerts): # display contents of sPath[]\n",
+ " print self.vertexList[j].label ,' =' \n",
+ " if(self.sPath[j].distance == 1000000):\n",
+ " print 'inf', # inf\n",
+ " else:\n",
+ " print self.sPath[j].distance , # 50\n",
+ " parent = self.vertexList[ self.sPath[j].parentVert ].label\n",
+ " print '(' , parent , ')' , # (A)\n",
+ " print ''\n",
+ " \n",
+ "theGraph = Graph()\n",
+ "theGraph.addVertex('A') # 0 (start)\n",
+ "theGraph.addVertex('C') # 2\n",
+ "theGraph.addVertex('B') # 1\n",
+ "theGraph.addVertex('D') # 3\n",
+ "theGraph.addVertex('E') # 4\n",
+ "theGraph.addEdge(0,1,50)\n",
+ "theGraph.addEdge(0,3,80)\n",
+ "theGraph.addEdge(1,2,60)\n",
+ "theGraph.addEdge(1,3,90)\n",
+ "theGraph.addEdge(2,4,40)\n",
+ "theGraph.addEdge(3,2,20)\n",
+ "theGraph.addEdge(3,4,70)\n",
+ "theGraph.addEdge(4,1,50)\n",
+ "print 'Shortest paths' ,\n",
+ "theGraph.path() # shortest paths"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Shortest paths A =\ninf ( A ) C =\n50 ( A ) B =\n100 ( D ) D =\n80 ( A ) E =\n140 ( B ) \n"
+ "text": [
+ "Shortest paths A =\n",
+ "inf ( A ) C =\n",
+ "50 ( A ) B =\n",
+ "100 ( D ) D =\n",
+ "80 ( A ) E =\n",
+ "140 ( B ) \n"
+ ]
}
],
"prompt_number": 2
@@ -51,7 +349,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch2.ipynb b/Data_Structures_and_Algorithms_in_Java/ch2.ipynb
index 545d8433..ffbe7f1a 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch2.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch2"
+ "name": "",
+ "signature": "sha256:aab97f08438f435b57ec8f21a4d063e7bb3805bfb2401a475b716ab779bcb766"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,64 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 2 : Arrays"
+ "source": [
+ "Chapter 2 : Arrays"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.1 Page no :41"
+ "source": [
+ "Example 2.1 Page no :41"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 2.1\ndemonstrates arrays/lists\n'''\n\nnElems = 0\narr = [77,99,44,55,22,88,11,00,66,33]\n\nfor j in range(len(arr)):\n # display items\n print arr[j] ,\nprint ''\n\nsearchKey = 66\n# find item with key 66\nfor j in range(len(arr)):\n if(arr[j] == searchKey):\n break\nif(j == len(arr)):\n print 'Cant find ', searchKey\nelse:\n print 'Found ' ,searchKey\n\nsearchKey = 55\nfor j in arr:\n if(j == searchKey):\n arr.remove(searchKey)\n\n\nfor j in range(len(arr)):\n # display items\n print arr[j] ,\nprint ''\n",
+ "input": [
+ " \n",
+ "\n",
+ "nElems = 0\n",
+ "arr = [77,99,44,55,22,88,11,00,66,33]\n",
+ "\n",
+ "for j in range(len(arr)):\n",
+ " # display items\n",
+ " print arr[j] ,\n",
+ "print ''\n",
+ "\n",
+ "searchKey = 66\n",
+ "# find item with key 66\n",
+ "for j in range(len(arr)):\n",
+ " if(arr[j] == searchKey):\n",
+ " break\n",
+ "if(j == len(arr)):\n",
+ " print 'Cant find ', searchKey\n",
+ "else:\n",
+ " print 'Found ' ,searchKey\n",
+ "\n",
+ "searchKey = 55\n",
+ "for j in arr:\n",
+ " if(j == searchKey):\n",
+ " arr.remove(searchKey)\n",
+ "\n",
+ "\n",
+ "for j in range(len(arr)):\n",
+ " # display items\n",
+ " print arr[j] ,\n",
+ "print ''\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "77 99 44 55 22 88 11 0 66 33 \nFound 66\n77 99 44 22 88 11 0 66 33 \n"
+ "text": [
+ "77 99 44 55 22 88 11 0 66 33 \n",
+ "Found 66\n",
+ "77 99 44 22 88 11 0 66 33 \n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +78,83 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.2 Page No : 44"
+ "source": [
+ "Example 2.2 Page No : 44"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 2.2\n'''\n\nclass LowArray:\n def __init__(self,size):\n self.a = []\n for i in range(size):\n self.a.append(0.0)\n \n def setElem(self,index,value):\n # set value\n self.a[index] = value\n\n def getElem(self,index):\n return self.a[index]\n\narr = LowArray(100)\narr.setElem(0,77)\narr.setElem(1,99)\narr.setElem(2,44)\narr.setElem(3,55)\narr.setElem(4,22)\narr.setElem(5,88)\narr.setElem(6,11)\narr.setElem(7,00)\narr.setElem(8,66)\narr.setElem(9,33)\nnElems = 10\n\n# now 10 items in array\nfor j in range(nElems):\n # display items\n print arr.getElem(j) ,\n\nprint ''\n\nsearchKey = 26\nfind = False\n# search for data item\nfor j in range(nElems):\n # for each element,\n if(arr.getElem(j) == searchKey): # found item?\n find = True\n break\nif(not find):\n print \"Can't find \" , searchKey\nelse:\n print \"Found \" , searchKey\n\nfor j in range(nElems):\n if(arr.getElem(j) == 55):\n arr.a.remove(55)\n nElems -= 1\n\nfor j in range(nElems):\n # display items\n print arr.getElem(j) ,\n ",
+ "input": [
+ " \n",
+ "\n",
+ "class LowArray:\n",
+ " def __init__(self,size):\n",
+ " self.a = []\n",
+ " for i in range(size):\n",
+ " self.a.append(0.0)\n",
+ " \n",
+ " def setElem(self,index,value):\n",
+ " # set value\n",
+ " self.a[index] = value\n",
+ "\n",
+ " def getElem(self,index):\n",
+ " return self.a[index]\n",
+ "\n",
+ "arr = LowArray(100)\n",
+ "arr.setElem(0,77)\n",
+ "arr.setElem(1,99)\n",
+ "arr.setElem(2,44)\n",
+ "arr.setElem(3,55)\n",
+ "arr.setElem(4,22)\n",
+ "arr.setElem(5,88)\n",
+ "arr.setElem(6,11)\n",
+ "arr.setElem(7,00)\n",
+ "arr.setElem(8,66)\n",
+ "arr.setElem(9,33)\n",
+ "nElems = 10\n",
+ "\n",
+ "# now 10 items in array\n",
+ "for j in range(nElems):\n",
+ " # display items\n",
+ " print arr.getElem(j) ,\n",
+ "\n",
+ "print ''\n",
+ "\n",
+ "searchKey = 26\n",
+ "find = False\n",
+ "# search for data item\n",
+ "for j in range(nElems):\n",
+ " # for each element,\n",
+ " if(arr.getElem(j) == searchKey): # found item?\n",
+ " find = True\n",
+ " break\n",
+ "if(not find):\n",
+ " print \"Can't find \" , searchKey\n",
+ "else:\n",
+ " print \"Found \" , searchKey\n",
+ "\n",
+ "for j in range(nElems):\n",
+ " if(arr.getElem(j) == 55):\n",
+ " arr.a.remove(55)\n",
+ " nElems -= 1\n",
+ "\n",
+ "for j in range(nElems):\n",
+ " # display items\n",
+ " print arr.getElem(j) ,\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "77 99 44 55 22 88 11 0 66 33 \nCan't find 26\n77 99 44 22 88 11 0 66 33\n"
+ "text": [
+ "77 99 44 55 22 88 11 0 66 33 \n",
+ "Can't find 26\n",
+ "77 99 44 22 88 11 0 66 33\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +163,81 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.3 Page No : 49"
+ "source": [
+ "Example 2.3 Page No : 49"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 2.3\n'''\n\nclass HighArray:\n def __init__(self,size):\n self.a = []\n self.nElems = 0\n for i in range(size):\n self.a.append(0.0)\n \n def insert(self,value):\n # set value\n self.a[self.nElems] = value\n self.nElems += 1\n\n def find(self,searchKey):\n for j in range(self.nElems):\n if(self.a[j] == searchKey):\n return True\n return False\n \n def delete(self,value):\n for j in range(self.nElems):\n # look for it\n if (value == self.a[j]):\n self.a.remove(value)\n self.nElems -= 1\n \n def display(self):\n for j in range(self.nElems+1):\n print self.a[j] , \n print ''\n\narr = HighArray(100)\narr.insert(77)\narr.insert(99)\narr.insert(44)\narr.insert(55)\narr.insert(22)\narr.insert(88)\narr.insert(11)\narr.insert(00)\narr.insert(66)\narr.insert(33)\n\narr.display()\n\nsearchKey = 35\nif( arr.find(searchKey) ):\n print \"Found \" , searchKey\nelse:\n print \"Can't find \" , searchKey\narr.delete(00)\narr.delete(55)\narr.delete(99)\narr.display()",
+ "input": [
+ " \n",
+ "\n",
+ "class HighArray:\n",
+ " def __init__(self,size):\n",
+ " self.a = []\n",
+ " self.nElems = 0\n",
+ " for i in range(size):\n",
+ " self.a.append(0.0)\n",
+ " \n",
+ " def insert(self,value):\n",
+ " # set value\n",
+ " self.a[self.nElems] = value\n",
+ " self.nElems += 1\n",
+ "\n",
+ " def find(self,searchKey):\n",
+ " for j in range(self.nElems):\n",
+ " if(self.a[j] == searchKey):\n",
+ " return True\n",
+ " return False\n",
+ " \n",
+ " def delete(self,value):\n",
+ " for j in range(self.nElems):\n",
+ " # look for it\n",
+ " if (value == self.a[j]):\n",
+ " self.a.remove(value)\n",
+ " self.nElems -= 1\n",
+ " \n",
+ " def display(self):\n",
+ " for j in range(self.nElems+1):\n",
+ " print self.a[j] , \n",
+ " print ''\n",
+ "\n",
+ "arr = HighArray(100)\n",
+ "arr.insert(77)\n",
+ "arr.insert(99)\n",
+ "arr.insert(44)\n",
+ "arr.insert(55)\n",
+ "arr.insert(22)\n",
+ "arr.insert(88)\n",
+ "arr.insert(11)\n",
+ "arr.insert(00)\n",
+ "arr.insert(66)\n",
+ "arr.insert(33)\n",
+ "\n",
+ "arr.display()\n",
+ "\n",
+ "searchKey = 35\n",
+ "if( arr.find(searchKey) ):\n",
+ " print \"Found \" , searchKey\n",
+ "else:\n",
+ " print \"Can't find \" , searchKey\n",
+ "arr.delete(00)\n",
+ "arr.delete(55)\n",
+ "arr.delete(99)\n",
+ "arr.display()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "77 99 44 55 22 88 11 0 66 33 0.0 \nCan't find 35\n77 44 22 88 11 66 33 \n"
+ "text": [
+ "77 99 44 55 22 88 11 0 66 33 0.0 \n",
+ "Can't find 35\n",
+ "77 44 22 88 11 66 33 \n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +246,92 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.4 Page no : 59"
+ "source": [
+ "Example 2.4 Page no : 59"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 2.4\n'''\n\nclass OrdArray:\n def __init__(self,m):\n self.a = []\n self.nElems = 0\n \n def size(self):\n return self.nElems\n\n def find(self,searchKey):\n lowerBound = 0\n upperBound = self.nElems-1\n while True:\n curIn = (lowerBound + upperBound ) / 2\n if(self.a[curIn]==searchKey):\n return curIn\n elif(lowerBound > upperBound):\n return self.nElems\n else:\n if(self.a[curIn] < searchKey):\n lowerBound = curIn + 1\n else:\n upperBound = curIn - 1 \n\n def insert(self,value):\n self.a.append(value)\n self.a.sort()\n self.nElems += 1\n\n def delete(self,value):\n j = self.find(value)\n if(j==self.nElems):\n return False\n else:\n self.a.remove(value)\n self.nElems -=1\n \n def display(self):\n for i in self.a:\n print i ,\n print ''\n\nmaxSize = 100\narr = OrdArray(maxSize)\narr.insert(77)\narr.insert(99) \narr.insert(44) \narr.insert(55) \narr.insert(22) \narr.insert(88) \narr.insert(11) \narr.insert(00) \narr.insert(66) \narr.insert(33) \nsearchKey = 55\nif( arr.find(searchKey) != arr.size() ):\n print 'Found ' , searchKey\nelse:\n print \"Can't find \" , searchKey\n \narr.display()\narr.delete(00)\narr.delete(55) \narr.delete(99) \narr.display()",
+ "input": [
+ " \n",
+ "\n",
+ "class OrdArray:\n",
+ " def __init__(self,m):\n",
+ " self.a = []\n",
+ " self.nElems = 0\n",
+ " \n",
+ " def size(self):\n",
+ " return self.nElems\n",
+ "\n",
+ " def find(self,searchKey):\n",
+ " lowerBound = 0\n",
+ " upperBound = self.nElems-1\n",
+ " while True:\n",
+ " curIn = (lowerBound + upperBound ) / 2\n",
+ " if(self.a[curIn]==searchKey):\n",
+ " return curIn\n",
+ " elif(lowerBound > upperBound):\n",
+ " return self.nElems\n",
+ " else:\n",
+ " if(self.a[curIn] < searchKey):\n",
+ " lowerBound = curIn + 1\n",
+ " else:\n",
+ " upperBound = curIn - 1 \n",
+ "\n",
+ " def insert(self,value):\n",
+ " self.a.append(value)\n",
+ " self.a.sort()\n",
+ " self.nElems += 1\n",
+ "\n",
+ " def delete(self,value):\n",
+ " j = self.find(value)\n",
+ " if(j==self.nElems):\n",
+ " return False\n",
+ " else:\n",
+ " self.a.remove(value)\n",
+ " self.nElems -=1\n",
+ " \n",
+ " def display(self):\n",
+ " for i in self.a:\n",
+ " print i ,\n",
+ " print ''\n",
+ "\n",
+ "maxSize = 100\n",
+ "arr = OrdArray(maxSize)\n",
+ "arr.insert(77)\n",
+ "arr.insert(99) \n",
+ "arr.insert(44) \n",
+ "arr.insert(55) \n",
+ "arr.insert(22) \n",
+ "arr.insert(88) \n",
+ "arr.insert(11) \n",
+ "arr.insert(00) \n",
+ "arr.insert(66) \n",
+ "arr.insert(33) \n",
+ "searchKey = 55\n",
+ "if( arr.find(searchKey) != arr.size() ):\n",
+ " print 'Found ' , searchKey\n",
+ "else:\n",
+ " print \"Can't find \" , searchKey\n",
+ " \n",
+ "arr.display()\n",
+ "arr.delete(00)\n",
+ "arr.delete(55) \n",
+ "arr.delete(99) \n",
+ "arr.display()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Found 55\n0 11 22 33 44 55 66 77 88 99 \n11 22 33 44 66 77 88 \n"
+ "text": [
+ "Found 55\n",
+ "0 11 22 33 44 55 66 77 88 99 \n",
+ "11 22 33 44 66 77 88 \n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +340,118 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.5 Page no : 66"
+ "source": [
+ "Example 2.5 Page no : 66"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 2.5\n'''\n\nclass Person:\n def __init__(self,last,first,a):\n self.lastName = last\n self.firstName = first\n self.age = a\n\n def displayPerson(self):\n print \"Last name: \" , self.lastName ,\", First name: \" , self.firstName ,\n print \", Age: \" , self.age\n\n def getLast(self):\n return self.lastName\n\nclass ClassDataArray:\n def __init__(self,m):\n self.a = []\n self.nElems = 0\n\n def find(self,searchName):\n f = False\n for j in range(self.nElems):\n if( self.a[j].getLast() ==searchName ) :\n f = True\n break \n if(not f):\n return None\n else:\n return self.a[j]\n\n def insert(self,last,first,age):\n self.a.append(Person(last, first, age))\n self.nElems += 1\n\n def delete(self,searchName):\n f = False\n for j in range(self.nElems):\n if( self.a[j].getLast() == searchName) :\n self.a.remove(self.a[j])\n f = True\n self.nElems -= 1\n break\n if(not f):\n return False\n else:\n return True\n \n def displayA(self):\n for j in range(self.nElems):\n self.a[j].displayPerson()\n\nmaxSize = 100\narr = ClassDataArray(maxSize)\narr.insert(\"Evans\", \"Patty\", 24)\narr.insert(\"Smith\", \"Lorraine\", 37)\narr.insert(\"Yee\", \"Tom\", 43)\narr.insert(\"Adams\", \"Henry\", 63)\narr.insert(\"Hashimoto\", \"Sato\", 21)\narr.insert(\"Stimson\", \"Henry\", 29)\narr.insert(\"Velasquez\", \"Jose\", 72)\narr.insert(\"Lamarque\", \"Henry\", 54)\narr.insert(\"Vang\", \"Minh\", 22)\narr.insert(\"Creswell\", \"Lucinda\", 18)\narr.displayA()\nsearchKey = \"Stimson\"\nfound=arr.find(searchKey)\nif(found != None ):\n print \"Found \" ,\n found.displayPerson()\nelse:\n print \"Can't find \" , searchKey\nprint \"Deleting Smith, Yee, and Creswell\"\narr.delete(\"Smith\")\narr.delete(\"Yee\")\narr.delete(\"Creswell\")\narr.displayA()",
+ "input": [
+ " \n",
+ "class Person:\n",
+ " def __init__(self,last,first,a):\n",
+ " self.lastName = last\n",
+ " self.firstName = first\n",
+ " self.age = a\n",
+ "\n",
+ " def displayPerson(self):\n",
+ " print \"Last name: \" , self.lastName ,\", First name: \" , self.firstName ,\n",
+ " print \", Age: \" , self.age\n",
+ "\n",
+ " def getLast(self):\n",
+ " return self.lastName\n",
+ "\n",
+ "class ClassDataArray:\n",
+ " def __init__(self,m):\n",
+ " self.a = []\n",
+ " self.nElems = 0\n",
+ "\n",
+ " def find(self,searchName):\n",
+ " f = False\n",
+ " for j in range(self.nElems):\n",
+ " if( self.a[j].getLast() ==searchName ) :\n",
+ " f = True\n",
+ " break \n",
+ " if(not f):\n",
+ " return None\n",
+ " else:\n",
+ " return self.a[j]\n",
+ "\n",
+ " def insert(self,last,first,age):\n",
+ " self.a.append(Person(last, first, age))\n",
+ " self.nElems += 1\n",
+ "\n",
+ " def delete(self,searchName):\n",
+ " f = False\n",
+ " for j in range(self.nElems):\n",
+ " if( self.a[j].getLast() == searchName) :\n",
+ " self.a.remove(self.a[j])\n",
+ " f = True\n",
+ " self.nElems -= 1\n",
+ " break\n",
+ " if(not f):\n",
+ " return False\n",
+ " else:\n",
+ " return True\n",
+ " \n",
+ " def displayA(self):\n",
+ " for j in range(self.nElems):\n",
+ " self.a[j].displayPerson()\n",
+ "\n",
+ "maxSize = 100\n",
+ "arr = ClassDataArray(maxSize)\n",
+ "arr.insert(\"Evans\", \"Patty\", 24)\n",
+ "arr.insert(\"Smith\", \"Lorraine\", 37)\n",
+ "arr.insert(\"Yee\", \"Tom\", 43)\n",
+ "arr.insert(\"Adams\", \"Henry\", 63)\n",
+ "arr.insert(\"Hashimoto\", \"Sato\", 21)\n",
+ "arr.insert(\"Stimson\", \"Henry\", 29)\n",
+ "arr.insert(\"Velasquez\", \"Jose\", 72)\n",
+ "arr.insert(\"Lamarque\", \"Henry\", 54)\n",
+ "arr.insert(\"Vang\", \"Minh\", 22)\n",
+ "arr.insert(\"Creswell\", \"Lucinda\", 18)\n",
+ "arr.displayA()\n",
+ "searchKey = \"Stimson\"\n",
+ "found=arr.find(searchKey)\n",
+ "if(found != None ):\n",
+ " print \"Found \" ,\n",
+ " found.displayPerson()\n",
+ "else:\n",
+ " print \"Can't find \" , searchKey\n",
+ "print \"Deleting Smith, Yee, and Creswell\"\n",
+ "arr.delete(\"Smith\")\n",
+ "arr.delete(\"Yee\")\n",
+ "arr.delete(\"Creswell\")\n",
+ "arr.displayA()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Last name: Evans , First name: Patty , Age: 24\nLast name: Smith , First name: Lorraine , Age: 37\nLast name: Yee , First name: Tom , Age: 43\nLast name: Adams , First name: Henry , Age: 63\nLast name: Hashimoto , First name: Sato , Age: 21\nLast name: Stimson , First name: Henry , Age: 29\nLast name: Velasquez , First name: Jose , Age: 72\nLast name: Lamarque , First name: Henry , Age: 54\nLast name: Vang , First name: Minh , Age: 22\nLast name: Creswell , First name: Lucinda , Age: 18\nFound Last name: Stimson , First name: Henry , Age: 29\nDeleting Smith, Yee, and Creswell\nLast name: Evans , First name: Patty , Age: 24\nLast name: Adams , First name: Henry , Age: 63\nLast name: Hashimoto , First name: Sato , Age: 21\nLast name: Stimson , First name: Henry , Age: 29\nLast name: Velasquez , First name: Jose , Age: 72\nLast name: Lamarque , First name: Henry , Age: 54\nLast name: Vang , First name: Minh , Age: 22\n"
+ "text": [
+ "Last name: Evans , First name: Patty , Age: 24\n",
+ "Last name: Smith , First name: Lorraine , Age: 37\n",
+ "Last name: Yee , First name: Tom , Age: 43\n",
+ "Last name: Adams , First name: Henry , Age: 63\n",
+ "Last name: Hashimoto , First name: Sato , Age: 21\n",
+ "Last name: Stimson , First name: Henry , Age: 29\n",
+ "Last name: Velasquez , First name: Jose , Age: 72\n",
+ "Last name: Lamarque , First name: Henry , Age: 54\n",
+ "Last name: Vang , First name: Minh , Age: 22\n",
+ "Last name: Creswell , First name: Lucinda , Age: 18\n",
+ "Found Last name: Stimson , First name: Henry , Age: 29\n",
+ "Deleting Smith, Yee, and Creswell\n",
+ "Last name: Evans , First name: Patty , Age: 24\n",
+ "Last name: Adams , First name: Henry , Age: 63\n",
+ "Last name: Hashimoto , First name: Sato , Age: 21\n",
+ "Last name: Stimson , First name: Henry , Age: 29\n",
+ "Last name: Velasquez , First name: Jose , Age: 72\n",
+ "Last name: Lamarque , First name: Henry , Age: 54\n",
+ "Last name: Vang , First name: Minh , Age: 22\n"
+ ]
}
],
"prompt_number": 5
@@ -121,7 +459,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch3.ipynb b/Data_Structures_and_Algorithms_in_Java/ch3.ipynb
index 1cce57db..9081eaf8 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch3.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch3"
+ "name": "",
+ "signature": "sha256:3d75fa922b384c8005ae3c49ad4b92cedee585c19d876f3d1612e2a824146ea0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Example 3.1\n",
- "Bubble Sort\n",
- "'''\n",
+ " \n",
"\n",
"class ArrayBub:\n",
" def __init__(self,m):\n",
@@ -98,11 +96,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Example 3.2\n",
- "Selection Sort\n",
- "'''\n",
- "\n",
+ " \n",
"class ArraySel:\n",
" def __init__(self,m):\n",
" self.a = []\n",
@@ -167,10 +161,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Example 3.3\n",
- "demonstrates insertion sort\n",
- "'''\n",
+ " \n",
"class ArrayIns:\n",
" def __init__(self,m):\n",
" self.a = [] # create the array\n",
@@ -236,10 +227,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Example 3.4\n",
- "demonstrates sorting objects (uses insertion sort)\n",
- "'''\n",
+ " \n",
"class Person:\n",
" def __init__(self,last,first,a):\n",
" # constructor\n",
diff --git a/Data_Structures_and_Algorithms_in_Java/ch4.ipynb b/Data_Structures_and_Algorithms_in_Java/ch4.ipynb
index bfba5c3b..11002dc8 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch4.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch4"
+ "name": "",
+ "signature": "sha256:0a83dcc11d890f96092d5395b0fb08b80fd72d940b0b48dc460b2e496128cd71"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,66 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 4 : Stacks and Queues"
+ "source": [
+ "Chapter 4 : Stacks and Queues"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Exmaple 4.1 Page no : 120"
+ "source": [
+ "Exmaple 4.1 Page no : 120"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 4.1\nStack implemantation\n'''\nclass StackX:\n def __init__(self,s):\n self.maxSize = s\n self.stackArray = []\n self.top = -1\n\n def push(self,j):\n self.top += 1\n self.stackArray.append(j)\n \n def pop(self):\n p = self.stackArray[self.top]\n self.top -= 1\n self.stackArray.remove(p)\n return p\n \n def peek(self):\n return self.stackArray[self.top]\n\n def isEmpty(self):\n return (self.top == -1)\n\n def isFull(self):\n return (self.top == self.maxSize-1);\n\ntheStack = StackX(10) # make new stack\ntheStack.push(20)\ntheStack.push(40)\ntheStack.push(60)\ntheStack.push(80)\nwhile( not theStack.isEmpty() ):\n value = theStack.pop()\n print value,",
+ "input": [
+ " \n",
+ "class StackX:\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.stackArray = []\n",
+ " self.top = -1\n",
+ "\n",
+ " def push(self,j):\n",
+ " self.top += 1\n",
+ " self.stackArray.append(j)\n",
+ " \n",
+ " def pop(self):\n",
+ " p = self.stackArray[self.top]\n",
+ " self.top -= 1\n",
+ " self.stackArray.remove(p)\n",
+ " return p\n",
+ " \n",
+ " def peek(self):\n",
+ " return self.stackArray[self.top]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return (self.top == -1)\n",
+ "\n",
+ " def isFull(self):\n",
+ " return (self.top == self.maxSize-1);\n",
+ "\n",
+ "theStack = StackX(10) # make new stack\n",
+ "theStack.push(20)\n",
+ "theStack.push(40)\n",
+ "theStack.push(60)\n",
+ "theStack.push(80)\n",
+ "while( not theStack.isEmpty() ):\n",
+ " value = theStack.pop()\n",
+ " print value,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "80 60 40 20\n"
+ "text": [
+ "80 60 40 20\n"
+ ]
}
],
"prompt_number": 1
@@ -38,41 +80,108 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.2 Page No : 124"
+ "source": [
+ "Example 4.2 Page No : 124"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 4.2\nStack implemantation\n'''\nclass StackX:\n def __init__(self,s):\n self.maxSize = s\n self.stackArray = []\n self.top = -1\n\n def push(self,j):\n self.top += 1\n self.stackArray.append(j)\n \n def pop(self):\n p = self.stackArray[self.top]\n self.top -= 1\n self.stackArray.remove(p)\n return p\n \n def peek(self):\n return self.stackArray[self.top]\n\n def isEmpty(self):\n return (self.top == -1)\n\n def isFull(self):\n return (self.top == self.maxSize-1);\n\n\nclass Reverser:\n def __init__(self,i):\n self.input = i\n self.output = ''\n self.theStack = None\n\n def doRev(self):\n stackSize = len(self.input)\n self.theStack = StackX(stackSize)\n for j in range(stackSize):\n ch = self.input[j]\n self.theStack.push(ch)\n while( not self.theStack.isEmpty() ):\n ch = self.theStack.pop()\n self.output = self.output + ch\n return self.output\n\n\nwhile(True):\n print \"Enter a string: \" ,\n i = raw_input() \n if( i == \"\"):\n break\n theReverser = Reverser(i)\n output = theReverser.doRev()\n print \"Reversed: \" , output",
+ "input": [
+ " \n",
+ "class StackX:\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.stackArray = []\n",
+ " self.top = -1\n",
+ "\n",
+ " def push(self,j):\n",
+ " self.top += 1\n",
+ " self.stackArray.append(j)\n",
+ " \n",
+ " def pop(self):\n",
+ " p = self.stackArray[self.top]\n",
+ " self.top -= 1\n",
+ " self.stackArray.remove(p)\n",
+ " return p\n",
+ " \n",
+ " def peek(self):\n",
+ " return self.stackArray[self.top]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return (self.top == -1)\n",
+ "\n",
+ " def isFull(self):\n",
+ " return (self.top == self.maxSize-1);\n",
+ "\n",
+ "\n",
+ "class Reverser:\n",
+ " def __init__(self,i):\n",
+ " self.input = i\n",
+ " self.output = ''\n",
+ " self.theStack = None\n",
+ "\n",
+ " def doRev(self):\n",
+ " stackSize = len(self.input)\n",
+ " self.theStack = StackX(stackSize)\n",
+ " for j in range(stackSize):\n",
+ " ch = self.input[j]\n",
+ " self.theStack.push(ch)\n",
+ " while( not self.theStack.isEmpty() ):\n",
+ " ch = self.theStack.pop()\n",
+ " self.output = self.output + ch\n",
+ " return self.output\n",
+ "\n",
+ "\n",
+ "while(True):\n",
+ " print \"Enter a string: \" ,\n",
+ " i = raw_input() \n",
+ " if( i == \"\"):\n",
+ " break\n",
+ " theReverser = Reverser(i)\n",
+ " output = theReverser.doRev()\n",
+ " print \"Reversed: \" , output"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a string: "
+ "text": [
+ "Enter a string: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "part\n"
+ "text": [
+ "part\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Reversed: trap\nEnter a string: "
+ "text": [
+ " Reversed: trap\n",
+ "Enter a string: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -81,47 +190,120 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.3 Page No : 128"
+ "source": [
+ "Example 4.3 Page No : 128"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 4.3\n'''\nclass StackX:\n def __init__(self,s):\n self.maxSize = s\n self.stackArray = []\n self.top = -1\n\n def push(self,j):\n self.top += 1\n self.stackArray.append(j)\n \n def pop(self):\n p = self.stackArray[self.top]\n self.top -= 1\n self.stackArray.remove(p)\n return p\n \n def peek(self):\n return self.stackArray[self.top]\n\n def isEmpty(self):\n return (self.top == -1)\n\n def isFull(self):\n return (self.top == self.maxSize-1);\n\nclass BracketChecker:\n def __init__(self,i):\n self.input = i \n self.theStack = None\n\n def check(self):\n stackSize = len(self.input)\n self.theStack = StackX(stackSize)\n for j in range(stackSize):\n ch = self.input[j]\n if (ch == '{' or ch == '[' or ch=='('):\n self.theStack.push(ch)\n elif (ch=='}' or ch==']' or ch==')'):\n if( not self.theStack.isEmpty() ):\n chx = self.theStack.pop()\n if( (ch=='}' and chx!='{') or (ch==']' and chx!='[') or (ch==')' and chx!='(') ):\n print \"Error: \" , ch , \" at \" , j \n else:\n print 'Error: ', ch , ' at ' ,j\n else:\n pass\n if( not self.theStack.isEmpty() ):\n print 'Error: missing right delimiter'\n\nwhile(True):\n print 'Enter string containing delimiters: '\n i = raw_input()\n if( i == ''):\n break\n theChecker = BracketChecker(i)\n theChecker.check()",
+ "input": [
+ " \n",
+ "class StackX:\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.stackArray = []\n",
+ " self.top = -1\n",
+ "\n",
+ " def push(self,j):\n",
+ " self.top += 1\n",
+ " self.stackArray.append(j)\n",
+ " \n",
+ " def pop(self):\n",
+ " p = self.stackArray[self.top]\n",
+ " self.top -= 1\n",
+ " self.stackArray.remove(p)\n",
+ " return p\n",
+ " \n",
+ " def peek(self):\n",
+ " return self.stackArray[self.top]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return (self.top == -1)\n",
+ "\n",
+ " def isFull(self):\n",
+ " return (self.top == self.maxSize-1);\n",
+ "\n",
+ "class BracketChecker:\n",
+ " def __init__(self,i):\n",
+ " self.input = i \n",
+ " self.theStack = None\n",
+ "\n",
+ " def check(self):\n",
+ " stackSize = len(self.input)\n",
+ " self.theStack = StackX(stackSize)\n",
+ " for j in range(stackSize):\n",
+ " ch = self.input[j]\n",
+ " if (ch == '{' or ch == '[' or ch=='('):\n",
+ " self.theStack.push(ch)\n",
+ " elif (ch=='}' or ch==']' or ch==')'):\n",
+ " if( not self.theStack.isEmpty() ):\n",
+ " chx = self.theStack.pop()\n",
+ " if( (ch=='}' and chx!='{') or (ch==']' and chx!='[') or (ch==')' and chx!='(') ):\n",
+ " print \"Error: \" , ch , \" at \" , j \n",
+ " else:\n",
+ " print 'Error: ', ch , ' at ' ,j\n",
+ " else:\n",
+ " pass\n",
+ " if( not self.theStack.isEmpty() ):\n",
+ " print 'Error: missing right delimiter'\n",
+ "\n",
+ "while(True):\n",
+ " print 'Enter string containing delimiters: '\n",
+ " i = raw_input()\n",
+ " if( i == ''):\n",
+ " break\n",
+ " theChecker = BracketChecker(i)\n",
+ " theChecker.check()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter string containing delimiters: \n"
+ "text": [
+ "Enter string containing delimiters: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a{b(c]d}e\n"
+ "text": [
+ "a{b(c]d}e\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Error: ] at 5\nEnter string containing delimiters: \n"
+ "text": [
+ "Error: ] at 5\n",
+ "Enter string containing delimiters: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter string containing delimiters: \n"
+ "text": [
+ "Enter string containing delimiters: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 4
@@ -130,19 +312,82 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.4 Page No : 138"
+ "source": [
+ "Example 4.4 Page No : 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 4.4\n'''\nclass Queue:\n def __init__(self,s):\n self.maxSize = s\n self.queArray = []\n for i in range(s):\n self.queArray.append(0)\n self.front = 0\n self.rear = -1\n self.nItems = 0\n\n def insert(self,j):\n if(self.rear == self.maxSize-1):\n self.rear = -1\n self.rear += 1\n self.queArray[self.rear] = j\n self.nItems += 1\n\n def remove(self):\n temp = self.queArray[self.front]\n #self.queArray.remove(temp)\n self.front += 1\n if(self.front == self.maxSize):\n # deal with wraparound\n self.front = 0\n self.nItems-=1\n return temp\n\n def peekFront(self):\n return self.queArray[self.front]\n\n def isEmpty(self):\n # true if queue is empty\n return (self.nItems==0)\n\n def isFull(self):\n # true if queue is full\n return (self.nItems==self.maxSize)\n\n def size(self):\n # number of items in queue\n return self.nItems\n\ntheQueue = Queue(5) # queue holds 5 items\ntheQueue.insert(10) # insert 4 items\ntheQueue.insert(20) \ntheQueue.insert(30) \ntheQueue.insert(40) \ntheQueue.remove() # remove 3 items\ntheQueue.remove() \ntheQueue.remove()\ntheQueue.insert(50) # insert 4 more items\ntheQueue.insert(60)\ntheQueue.insert(70)\ntheQueue.insert(80)\nwhile( not theQueue.isEmpty() ): # // remove and display\n n = theQueue.remove()\n print n ,",
+ "input": [
+ " \n",
+ "class Queue:\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.queArray = []\n",
+ " for i in range(s):\n",
+ " self.queArray.append(0)\n",
+ " self.front = 0\n",
+ " self.rear = -1\n",
+ " self.nItems = 0\n",
+ "\n",
+ " def insert(self,j):\n",
+ " if(self.rear == self.maxSize-1):\n",
+ " self.rear = -1\n",
+ " self.rear += 1\n",
+ " self.queArray[self.rear] = j\n",
+ " self.nItems += 1\n",
+ "\n",
+ " def remove(self):\n",
+ " temp = self.queArray[self.front]\n",
+ " #self.queArray.remove(temp)\n",
+ " self.front += 1\n",
+ " if(self.front == self.maxSize):\n",
+ " # deal with wraparound\n",
+ " self.front = 0\n",
+ " self.nItems-=1\n",
+ " return temp\n",
+ "\n",
+ " def peekFront(self):\n",
+ " return self.queArray[self.front]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " # true if queue is empty\n",
+ " return (self.nItems==0)\n",
+ "\n",
+ " def isFull(self):\n",
+ " # true if queue is full\n",
+ " return (self.nItems==self.maxSize)\n",
+ "\n",
+ " def size(self):\n",
+ " # number of items in queue\n",
+ " return self.nItems\n",
+ "\n",
+ "theQueue = Queue(5) # queue holds 5 items\n",
+ "theQueue.insert(10) # insert 4 items\n",
+ "theQueue.insert(20) \n",
+ "theQueue.insert(30) \n",
+ "theQueue.insert(40) \n",
+ "theQueue.remove() # remove 3 items\n",
+ "theQueue.remove() \n",
+ "theQueue.remove()\n",
+ "theQueue.insert(50) # insert 4 more items\n",
+ "theQueue.insert(60)\n",
+ "theQueue.insert(70)\n",
+ "theQueue.insert(80)\n",
+ "while( not theQueue.isEmpty() ): # // remove and display\n",
+ " n = theQueue.remove()\n",
+ " print n ,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "40 50 60 70 80\n"
+ "text": [
+ "40 50 60 70 80\n"
+ ]
}
],
"prompt_number": 5
@@ -151,12 +396,59 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.5 Page No : 141"
+ "source": [
+ "Example 4.5 Page No : 141"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 4.5\n'''\nclass Queue:\n def __init__(self,s):\n self.maxSize = s\n self.queArray = []\n for i in range(s):\n self.queArray.append(0)\n self.front = 0\n self.rear = -1\n\n def insert(self,j):\n if(self.rear == self.maxSize-1):\n self.rear = -1\n self.rear += 1\n self.queArray[self.rear] = j\n\n def remove(self):\n temp = self.queArray[self.front]\n #self.queArray.remove(temp)\n self.front += 1\n if(self.front == self.maxSize):\n # deal with wraparound\n self.front = 0\n return temp\n\n def peek(self):\n return self.queArray[self.front]\n\n def isEmpty(self):\n # true if queue is empty\n return ( self.rear+1==self.front or (self.front+self.maxSize-1==self.rear) )\n\n def isFull(self):\n # true if queue is full\n return ( self.rear+2==self.front or (self.front+self.maxSize-2==self.rear) )\n\n def size(self):\n # number of items in queue\n if(self.rear >= self.front):\n # contiguous sequence\n return self.rear-self.front+1\n else:\n # broken sequence\n return (self.maxSize-self.front) + (self.rear+1)",
+ "input": [
+ " \n",
+ "class Queue:\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.queArray = []\n",
+ " for i in range(s):\n",
+ " self.queArray.append(0)\n",
+ " self.front = 0\n",
+ " self.rear = -1\n",
+ "\n",
+ " def insert(self,j):\n",
+ " if(self.rear == self.maxSize-1):\n",
+ " self.rear = -1\n",
+ " self.rear += 1\n",
+ " self.queArray[self.rear] = j\n",
+ "\n",
+ " def remove(self):\n",
+ " temp = self.queArray[self.front]\n",
+ " #self.queArray.remove(temp)\n",
+ " self.front += 1\n",
+ " if(self.front == self.maxSize):\n",
+ " # deal with wraparound\n",
+ " self.front = 0\n",
+ " return temp\n",
+ "\n",
+ " def peek(self):\n",
+ " return self.queArray[self.front]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " # true if queue is empty\n",
+ " return ( self.rear+1==self.front or (self.front+self.maxSize-1==self.rear) )\n",
+ "\n",
+ " def isFull(self):\n",
+ " # true if queue is full\n",
+ " return ( self.rear+2==self.front or (self.front+self.maxSize-2==self.rear) )\n",
+ "\n",
+ " def size(self):\n",
+ " # number of items in queue\n",
+ " if(self.rear >= self.front):\n",
+ " # contiguous sequence\n",
+ " return self.rear-self.front+1\n",
+ " else:\n",
+ " # broken sequence\n",
+ " return (self.maxSize-self.front) + (self.rear+1)"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -166,19 +458,78 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.6 Page No : 147"
+ "source": [
+ "Example 4.6 Page No : 147"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 4.6\n'''\n\nclass PriorityQ:\n # array in sorted order, from max at 0 to min at size-1\n def __init__(self,s):\n self.maxSize = s\n self.queArray = []\n for i in range(s):\n self.queArray.append(0)\n self.nItems = 0\n\n def insert(self,item):\n # insert item\n if(self.nItems==0):\n self.queArray[self.nItems] = item\n self.nItems += 1\n else:\n # if items,\n j = self.nItems\n while j >= 0:\n if( item > self.queArray[j] ):\n self.queArray[j+1] = self.queArray[j] # shift upward\n else:\n break\n j -= 1\n self.queArray[j+1] = item\n self.nItems += 1\n\n def remove(self):\n # remove minimum item\n self.nItems -= 1\n return self.queArray[self.nItems]\n\n def peekMin(self):\n # peek at minimum item\n return self.queArray[self.nItems-1]\n\n def isEmpty(self):\n # true if queue is empty\n return (self.nItems==0)\n\n def isFull(self):\n # true if queue is full\n return (self.nItems == self.maxSize)\n\nthePQ = PriorityQ(6)\nthePQ.insert(30)\nthePQ.insert(50)\nthePQ.insert(10)\nthePQ.insert(40)\nthePQ.insert(20)\nwhile(not thePQ.isEmpty() ):\n item = thePQ.remove()\n print item ,",
+ "input": [
+ " \n",
+ "\n",
+ "class PriorityQ:\n",
+ " # array in sorted order, from max at 0 to min at size-1\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.queArray = []\n",
+ " for i in range(s):\n",
+ " self.queArray.append(0)\n",
+ " self.nItems = 0\n",
+ "\n",
+ " def insert(self,item):\n",
+ " # insert item\n",
+ " if(self.nItems==0):\n",
+ " self.queArray[self.nItems] = item\n",
+ " self.nItems += 1\n",
+ " else:\n",
+ " # if items,\n",
+ " j = self.nItems\n",
+ " while j >= 0:\n",
+ " if( item > self.queArray[j] ):\n",
+ " self.queArray[j+1] = self.queArray[j] # shift upward\n",
+ " else:\n",
+ " break\n",
+ " j -= 1\n",
+ " self.queArray[j+1] = item\n",
+ " self.nItems += 1\n",
+ "\n",
+ " def remove(self):\n",
+ " # remove minimum item\n",
+ " self.nItems -= 1\n",
+ " return self.queArray[self.nItems]\n",
+ "\n",
+ " def peekMin(self):\n",
+ " # peek at minimum item\n",
+ " return self.queArray[self.nItems-1]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " # true if queue is empty\n",
+ " return (self.nItems==0)\n",
+ "\n",
+ " def isFull(self):\n",
+ " # true if queue is full\n",
+ " return (self.nItems == self.maxSize)\n",
+ "\n",
+ "thePQ = PriorityQ(6)\n",
+ "thePQ.insert(30)\n",
+ "thePQ.insert(50)\n",
+ "thePQ.insert(10)\n",
+ "thePQ.insert(40)\n",
+ "thePQ.insert(20)\n",
+ "while(not thePQ.isEmpty() ):\n",
+ " item = thePQ.remove()\n",
+ " print item ,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 20 30 40 50\n"
+ "text": [
+ "10 20 30 40 50\n"
+ ]
}
],
"prompt_number": 7
@@ -187,41 +538,201 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.7 Page No : 161"
+ "source": [
+ "Example 4.7 Page No : 161"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 4.7\ninfix : converts infix arithmetic expressions to postfix\n'''\n\nclass StackX:\n def __init__(self,s):\n self.maxSize = s\n self.stackArray = []\n self.top = -1\n\n def push(self,j):\n self.top += 1\n self.stackArray.append(j)\n \n def pop(self):\n p = self.stackArray[self.top]\n self.top -= 1\n self.stackArray.remove(p)\n return p\n \n def peek(self):\n return self.stackArray[self.top]\n\n def isEmpty(self):\n return (self.top == -1)\n\n def isFull(self):\n return (self.top == self.maxSize-1);\n\n def peekN(self,n): # return item at index n\n return self.stackArray[n]\n \n def size(self): # return size\n return self.top+1\n \n def displayStack(self,s):\n print s\n print 'Stack (bottom-->top): ',\n for j in range(self.size()):\n print self.peekN(j) ,\n print ''\n\nclass InToPost:\n # infix to postfix conversion\n def __init__(self,i):\n self.input = i\n self.stackSize = len(self.input)\n self.theStack = StackX(self.stackSize)\n self.output = ''\n\n def doTrans(self):\n # do translation to postfix\n for j in range(self.stackSize):\n ch = self.input[j]\n self.theStack.displayStack(\"For \"+ ch +\" \") # *diagnostic*\n if ch=='+' or ch=='-':\n self.gotOper(ch, 1)\n elif ch=='*' or ch=='/':\n self.gotOper(ch, 2)\n elif ch=='(':\n self.theStack.push(ch)\n elif ch==')':\n self.gotParen(ch)\n else:\n self.output = self.output + ch # write it to output\n while( not self.theStack.isEmpty() ): # pop remaining opers\n self.theStack.displayStack('While ') # *diagnostic*\n self.output = self.output + self.theStack.pop() # write to output\n self.theStack.displayStack(\"End\")\n return self.output\n\n def gotOper(self,opThis, prec1):\n # got operator from input\n while( not self.theStack.isEmpty() ):\n opTop = self.theStack.pop()\n if( opTop == '(' ):\n self.theStack.push(opTop)\n break\n else:\n prec2 = 0\n if(opTop=='+' or opTop=='-'): # find new op prec\n prec2 = 1\n else:\n prec2 = 2\n if(prec2 < prec1): # if prec of new op less\n self.theStack.push(opTop)\n break;\n else:\n self.output = self.output + opTop # than prec of old\n self.theStack.push(opThis)\n\n def gotParen(self,ch):\n # got right paren from input\n while( not self.theStack.isEmpty() ):\n chx = self.theStack.pop()\n if( chx == '(' ):\n # if popped '('\n break\n # we're done\n else:\n # if popped operator\n self.output = self.output + chx # output it\n\nwhile(True):\n print 'Enter infix: ',\n i = raw_input()\n # read a string from kbd\n if( i == ''):\n # quit if [Enter]\n break\n theTrans = InToPost(i)\n output = theTrans.doTrans() # do the translation\n print \"Postfix is \" , output",
+ "input": [
+ " \n",
+ "class StackX:\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.stackArray = []\n",
+ " self.top = -1\n",
+ "\n",
+ " def push(self,j):\n",
+ " self.top += 1\n",
+ " self.stackArray.append(j)\n",
+ " \n",
+ " def pop(self):\n",
+ " p = self.stackArray[self.top]\n",
+ " self.top -= 1\n",
+ " self.stackArray.remove(p)\n",
+ " return p\n",
+ " \n",
+ " def peek(self):\n",
+ " return self.stackArray[self.top]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return (self.top == -1)\n",
+ "\n",
+ " def isFull(self):\n",
+ " return (self.top == self.maxSize-1);\n",
+ "\n",
+ " def peekN(self,n): # return item at index n\n",
+ " return self.stackArray[n]\n",
+ " \n",
+ " def size(self): # return size\n",
+ " return self.top+1\n",
+ " \n",
+ " def displayStack(self,s):\n",
+ " print s\n",
+ " print 'Stack (bottom-->top): ',\n",
+ " for j in range(self.size()):\n",
+ " print self.peekN(j) ,\n",
+ " print ''\n",
+ "\n",
+ "class InToPost:\n",
+ " # infix to postfix conversion\n",
+ " def __init__(self,i):\n",
+ " self.input = i\n",
+ " self.stackSize = len(self.input)\n",
+ " self.theStack = StackX(self.stackSize)\n",
+ " self.output = ''\n",
+ "\n",
+ " def doTrans(self):\n",
+ " # do translation to postfix\n",
+ " for j in range(self.stackSize):\n",
+ " ch = self.input[j]\n",
+ " self.theStack.displayStack(\"For \"+ ch +\" \") # *diagnostic*\n",
+ " if ch=='+' or ch=='-':\n",
+ " self.gotOper(ch, 1)\n",
+ " elif ch=='*' or ch=='/':\n",
+ " self.gotOper(ch, 2)\n",
+ " elif ch=='(':\n",
+ " self.theStack.push(ch)\n",
+ " elif ch==')':\n",
+ " self.gotParen(ch)\n",
+ " else:\n",
+ " self.output = self.output + ch # write it to output\n",
+ " while( not self.theStack.isEmpty() ): # pop remaining opers\n",
+ " self.theStack.displayStack('While ') # *diagnostic*\n",
+ " self.output = self.output + self.theStack.pop() # write to output\n",
+ " self.theStack.displayStack(\"End\")\n",
+ " return self.output\n",
+ "\n",
+ " def gotOper(self,opThis, prec1):\n",
+ " # got operator from input\n",
+ " while( not self.theStack.isEmpty() ):\n",
+ " opTop = self.theStack.pop()\n",
+ " if( opTop == '(' ):\n",
+ " self.theStack.push(opTop)\n",
+ " break\n",
+ " else:\n",
+ " prec2 = 0\n",
+ " if(opTop=='+' or opTop=='-'): # find new op prec\n",
+ " prec2 = 1\n",
+ " else:\n",
+ " prec2 = 2\n",
+ " if(prec2 < prec1): # if prec of new op less\n",
+ " self.theStack.push(opTop)\n",
+ " break;\n",
+ " else:\n",
+ " self.output = self.output + opTop # than prec of old\n",
+ " self.theStack.push(opThis)\n",
+ "\n",
+ " def gotParen(self,ch):\n",
+ " # got right paren from input\n",
+ " while( not self.theStack.isEmpty() ):\n",
+ " chx = self.theStack.pop()\n",
+ " if( chx == '(' ):\n",
+ " # if popped '('\n",
+ " break\n",
+ " # we're done\n",
+ " else:\n",
+ " # if popped operator\n",
+ " self.output = self.output + chx # output it\n",
+ "\n",
+ "while(True):\n",
+ " print 'Enter infix: ',\n",
+ " i = raw_input()\n",
+ " # read a string from kbd\n",
+ " if( i == ''):\n",
+ " # quit if [Enter]\n",
+ " break\n",
+ " theTrans = InToPost(i)\n",
+ " output = theTrans.doTrans() # do the translation\n",
+ " print \"Postfix is \" , output"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter infix: "
+ "text": [
+ "Enter infix: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "A*(B+C)-D/(E+F)\n"
+ "text": [
+ "A*(B+C)-D/(E+F)\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " For A \nStack (bottom-->top): \nFor * \nStack (bottom-->top): \nFor ( \nStack (bottom-->top): * \nFor B \nStack (bottom-->top): * ( \nFor + \nStack (bottom-->top): * ( \nFor C \nStack (bottom-->top): * ( + \nFor ) \nStack (bottom-->top): * ( + \nFor - \nStack (bottom-->top): * \nFor D \nStack (bottom-->top): - \nFor / \nStack (bottom-->top): - \nFor ( \nStack (bottom-->top): - / \nFor E \nStack (bottom-->top): - / ( \nFor + \nStack (bottom-->top): - / ( \nFor F \nStack (bottom-->top): - / ( + \nFor ) \nStack (bottom-->top): - / ( + \nWhile \nStack (bottom-->top): - / \nWhile \nStack (bottom-->top): - \nEnd\nStack (bottom-->top): \nPostfix is ABC+*DEF+/-\nEnter infix: "
+ "text": [
+ " For A \n",
+ "Stack (bottom-->top): \n",
+ "For * \n",
+ "Stack (bottom-->top): \n",
+ "For ( \n",
+ "Stack (bottom-->top): * \n",
+ "For B \n",
+ "Stack (bottom-->top): * ( \n",
+ "For + \n",
+ "Stack (bottom-->top): * ( \n",
+ "For C \n",
+ "Stack (bottom-->top): * ( + \n",
+ "For ) \n",
+ "Stack (bottom-->top): * ( + \n",
+ "For - \n",
+ "Stack (bottom-->top): * \n",
+ "For D \n",
+ "Stack (bottom-->top): - \n",
+ "For / \n",
+ "Stack (bottom-->top): - \n",
+ "For ( \n",
+ "Stack (bottom-->top): - / \n",
+ "For E \n",
+ "Stack (bottom-->top): - / ( \n",
+ "For + \n",
+ "Stack (bottom-->top): - / ( \n",
+ "For F \n",
+ "Stack (bottom-->top): - / ( + \n",
+ "For ) \n",
+ "Stack (bottom-->top): - / ( + \n",
+ "While \n",
+ "Stack (bottom-->top): - / \n",
+ "While \n",
+ "Stack (bottom-->top): - \n",
+ "End\n",
+ "Stack (bottom-->top): \n",
+ "Postfix is ABC+*DEF+/-\n",
+ "Enter infix: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 8
@@ -230,41 +741,148 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.8 Page No : 168"
+ "source": [
+ "Example 4.8 Page No : 168"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 4.8\n'''\nclass StackX:\n def __init__(self,s):\n self.maxSize = s\n self.stackArray = []\n for i in range(s):\n self.stackArray.append(0.0)\n self.top = -1\n\n def push(self,j):\n self.top += 1\n self.stackArray[self.top] = j #.append(j)\n \n def pop(self):\n p = self.stackArray[self.top]\n self.top -= 1\n self.stackArray.remove(p)\n return p\n \n def peek(self):\n return self.stackArray[self.top]\n\n def isEmpty(self):\n return (self.top == -1)\n\n def isFull(self):\n return (self.top == self.maxSize-1);\n\n def peekN(self,n): # return item at index n\n return self.stackArray[n]\n \n def size(self): # return size\n return self.top+1\n \n def displayStack(self,s):\n print s ,\n print 'Stack (bottom-->top): ',\n for j in range(self.top+1):\n print self.peekN(j) ,\n print ''\n\nclass ParsePost:\n # infix to postfix conversion\n def __init__(self,i):\n self.input = i\n self.theStack = None\n\n def doParse(self):\n self.theStack = StackX(20)\n interAns = 0\n for j in range(len(self.input)):\n ch = self.input[j]\n self.theStack.displayStack(ch + ' ')\n if(ch >= '0' and ch <= '9'):\n self.theStack.push( ord(ch)-ord('0') )\n else:\n num2 = self.theStack.pop()\n num1 = self.theStack.pop()\n if ch=='+':\n interAns = num1 + num2\n elif ch=='-':\n interAns = num1 - num2\n elif ch=='*':\n interAns = num1 * num2\n elif ch=='/':\n interAns = num1 / num2\n else:\n interAns = 0\n self.theStack.push(interAns)\n interAns = self.theStack.pop()\n return interAns\n\nwhile(True):\n print 'Enter postfix: ',\n i = raw_input()\n # read a string from kbd\n if( i == ''):\n # quit if [Enter]\n break\n aParser = ParsePost(i)\n output = aParser.doParse() # do the evaluation\n print \"Evaluates to \" , output",
+ "input": [
+ " \n",
+ "class StackX:\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.stackArray = []\n",
+ " for i in range(s):\n",
+ " self.stackArray.append(0.0)\n",
+ " self.top = -1\n",
+ "\n",
+ " def push(self,j):\n",
+ " self.top += 1\n",
+ " self.stackArray[self.top] = j #.append(j)\n",
+ " \n",
+ " def pop(self):\n",
+ " p = self.stackArray[self.top]\n",
+ " self.top -= 1\n",
+ " self.stackArray.remove(p)\n",
+ " return p\n",
+ " \n",
+ " def peek(self):\n",
+ " return self.stackArray[self.top]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return (self.top == -1)\n",
+ "\n",
+ " def isFull(self):\n",
+ " return (self.top == self.maxSize-1);\n",
+ "\n",
+ " def peekN(self,n): # return item at index n\n",
+ " return self.stackArray[n]\n",
+ " \n",
+ " def size(self): # return size\n",
+ " return self.top+1\n",
+ " \n",
+ " def displayStack(self,s):\n",
+ " print s ,\n",
+ " print 'Stack (bottom-->top): ',\n",
+ " for j in range(self.top+1):\n",
+ " print self.peekN(j) ,\n",
+ " print ''\n",
+ "\n",
+ "class ParsePost:\n",
+ " # infix to postfix conversion\n",
+ " def __init__(self,i):\n",
+ " self.input = i\n",
+ " self.theStack = None\n",
+ "\n",
+ " def doParse(self):\n",
+ " self.theStack = StackX(20)\n",
+ " interAns = 0\n",
+ " for j in range(len(self.input)):\n",
+ " ch = self.input[j]\n",
+ " self.theStack.displayStack(ch + ' ')\n",
+ " if(ch >= '0' and ch <= '9'):\n",
+ " self.theStack.push( ord(ch)-ord('0') )\n",
+ " else:\n",
+ " num2 = self.theStack.pop()\n",
+ " num1 = self.theStack.pop()\n",
+ " if ch=='+':\n",
+ " interAns = num1 + num2\n",
+ " elif ch=='-':\n",
+ " interAns = num1 - num2\n",
+ " elif ch=='*':\n",
+ " interAns = num1 * num2\n",
+ " elif ch=='/':\n",
+ " interAns = num1 / num2\n",
+ " else:\n",
+ " interAns = 0\n",
+ " self.theStack.push(interAns)\n",
+ " interAns = self.theStack.pop()\n",
+ " return interAns\n",
+ "\n",
+ "while(True):\n",
+ " print 'Enter postfix: ',\n",
+ " i = raw_input()\n",
+ " # read a string from kbd\n",
+ " if( i == ''):\n",
+ " # quit if [Enter]\n",
+ " break\n",
+ " aParser = ParsePost(i)\n",
+ " output = aParser.doParse() # do the evaluation\n",
+ " print \"Evaluates to \" , output"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter postfix: "
+ "text": [
+ "Enter postfix: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "345+*612+/-\n"
+ "text": [
+ "345+*612+/-\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 3 Stack (bottom-->top): \n4 Stack (bottom-->top): 3 \n5 Stack (bottom-->top): 3 4 \n+ Stack (bottom-->top): 3 4 5 \n* Stack (bottom-->top): 3 9 \n6 Stack (bottom-->top): 27 \n1 Stack (bottom-->top): 27 6 \n2 Stack (bottom-->top): 27 6 1 \n+ Stack (bottom-->top): 27 6 1 2 \n/ Stack (bottom-->top): 27 6 3 \n- Stack (bottom-->top): 27 2 \nEvaluates to 25\nEnter postfix: "
+ "text": [
+ " 3 Stack (bottom-->top): \n",
+ "4 Stack (bottom-->top): 3 \n",
+ "5 Stack (bottom-->top): 3 4 \n",
+ "+ Stack (bottom-->top): 3 4 5 \n",
+ "* Stack (bottom-->top): 3 9 \n",
+ "6 Stack (bottom-->top): 27 \n",
+ "1 Stack (bottom-->top): 27 6 \n",
+ "2 Stack (bottom-->top): 27 6 1 \n",
+ "+ Stack (bottom-->top): 27 6 1 2 \n",
+ "/ Stack (bottom-->top): 27 6 3 \n",
+ "- Stack (bottom-->top): 27 2 \n",
+ "Evaluates to 25\n",
+ "Enter postfix: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 9
@@ -272,7 +890,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch5.ipynb b/Data_Structures_and_Algorithms_in_Java/ch5.ipynb
index 6ac7b766..ecd02576 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch5.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch5"
+ "name": "",
+ "signature": "sha256:78657e06ea6117b67568778cbd053fe193ae0df563d1cdc0a431335e7e291192"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,89 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 5 : Linked Lists"
+ "source": [
+ "Chapter 5 : Linked Lists"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.1 Page No : 190"
+ "source": [
+ "Example 5.1 Page No : 190"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 5.1\nLink List\n'''\n\nclass Link:\n def __init__(self,i,dd):\n self.iData = i\n self.dData = dd\n self.next = None\n\n def displayLink(self): # display ourself\n print '{' , self.iData , ', ' , self.dData , '} ' ,\n\nclass LinkList:\n def __init__(self):\n self.first = None\n\n def isEmpty(self): # true if list is empty\n return (self.first==None)\n\n # insert at start of list\n def insertFirst(self,i, dd):\n # make new link\n newLink = Link(i, dd)\n newLink.next = self.first\n # newLink --> old first\n self.first = newLink\n\n def deleteFirst(self):\n temp = self.first\n self.first = self.first.next\n return temp\n \n def displayList(self):\n print 'List (first-->last): ' ,\n current = self.first\n while(current != None):\n current.displayLink()\n current = current.next\n print ''\n\ntheList = LinkList() # make new list\ntheList.insertFirst(22,2.99)\ntheList.insertFirst(44,4.99)\ntheList.insertFirst(66,6.99)\ntheList.insertFirst(88,8.99)\ntheList.displayList()\n\nwhile( not theList.isEmpty() ): # until it's empty,\n aLink = theList.deleteFirst() # delete link\n print 'Deleted ' , # display it\n aLink.displayLink()\n print ''\n \ntheList.displayList()",
+ "input": [
+ " \n",
+ "class Link:\n",
+ " def __init__(self,i,dd):\n",
+ " self.iData = i\n",
+ " self.dData = dd\n",
+ " self.next = None\n",
+ "\n",
+ " def displayLink(self): # display ourself\n",
+ " print '{' , self.iData , ', ' , self.dData , '} ' ,\n",
+ "\n",
+ "class LinkList:\n",
+ " def __init__(self):\n",
+ " self.first = None\n",
+ "\n",
+ " def isEmpty(self): # true if list is empty\n",
+ " return (self.first==None)\n",
+ "\n",
+ " # insert at start of list\n",
+ " def insertFirst(self,i, dd):\n",
+ " # make new link\n",
+ " newLink = Link(i, dd)\n",
+ " newLink.next = self.first\n",
+ " # newLink --> old first\n",
+ " self.first = newLink\n",
+ "\n",
+ " def deleteFirst(self):\n",
+ " temp = self.first\n",
+ " self.first = self.first.next\n",
+ " return temp\n",
+ " \n",
+ " def displayList(self):\n",
+ " print 'List (first-->last): ' ,\n",
+ " current = self.first\n",
+ " while(current != None):\n",
+ " current.displayLink()\n",
+ " current = current.next\n",
+ " print ''\n",
+ "\n",
+ "theList = LinkList() # make new list\n",
+ "theList.insertFirst(22,2.99)\n",
+ "theList.insertFirst(44,4.99)\n",
+ "theList.insertFirst(66,6.99)\n",
+ "theList.insertFirst(88,8.99)\n",
+ "theList.displayList()\n",
+ "\n",
+ "while( not theList.isEmpty() ): # until it's empty,\n",
+ " aLink = theList.deleteFirst() # delete link\n",
+ " print 'Deleted ' , # display it\n",
+ " aLink.displayLink()\n",
+ " print ''\n",
+ " \n",
+ "theList.displayList()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "List (first-->last): { 88 , 8.99 } { 66 , 6.99 } { 44 , 4.99 } { 22 , 2.99 } \nDeleted { 88 , 8.99 } \nDeleted { 66 , 6.99 } \nDeleted { 44 , 4.99 } \nDeleted { 22 , 2.99 } \nList (first-->last): \n"
+ "text": [
+ "List (first-->last): { 88 , 8.99 } { 66 , 6.99 } { 44 , 4.99 } { 22 , 2.99 } \n",
+ "Deleted { 88 , 8.99 } \n",
+ "Deleted { 66 , 6.99 } \n",
+ "Deleted { 44 , 4.99 } \n",
+ "Deleted { 22 , 2.99 } \n",
+ "List (first-->last): \n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +103,108 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.2 Page No : 193"
+ "source": [
+ "Example 5.2 Page No : 193"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 5.2\ndemonstrates linked list\n'''\nclass Link:\n def __init__(self,i,dd):\n self.iData = i\n self.dData = dd\n self.next = None\n\n def displayLink(self): # display ourself\n print '{' , self.iData , ', ' , self.dData , '} ' ,\n\nclass LinkList:\n def __init__(self):\n self.first = None\n\n def isEmpty(self): # true if list is empty\n return (self.first==None)\n\n # insert at start of list\n def insertFirst(self,i, dd):\n # make new link\n newLink = Link(i, dd)\n newLink.next = self.first\n # newLink --> old first\n self.first = newLink\n\n def deleteFirst(self):\n temp = self.first\n self.first = self.first.next\n return temp\n \n def displayList(self):\n print 'List (first-->last): ' ,\n current = self.first\n while(current != None):\n current.displayLink()\n current = current.next\n print ''\n\n def find(self,key): # find link with given key\n current = self.first #start at first\n while(current.iData != key): # while no match,\n if(current.next == None): # if end of list,\n return None # didnt find it\n else:\n current = current.next # go to next link\n return current\n \n def delete(self,key): # delete link with given key\n current = self.first \n previous = self.first\n while(current.iData != key):\n if(current.next == None):\n return None # didnt find it\n else:\n previous = current\n current = current.next\n if(current == self.first): # if first link,\n self.first = self.first.next\n else:\n previous.next = current.next\n return current\n\n\ntheList = LinkList() # make list\ntheList.insertFirst(22,2.99)\ntheList.insertFirst(44,4.99)\ntheList.insertFirst(66,6.99)\ntheList.insertFirst(88,8.99)\ntheList.displayList() # display list\nf = theList.find(44) # find item\nif( f != None):\n print 'Found link with key ' , f.iData\nelse:\n print \"Can't find link\"\nd = theList.delete(66) # delete item\nif( d != None ):\n print \"Deleted link with key \" , d.iData\nelse:\n print \"Can't delete link\"\n\ntheList.displayList()",
+ "input": [
+ " \n",
+ "class Link:\n",
+ " def __init__(self,i,dd):\n",
+ " self.iData = i\n",
+ " self.dData = dd\n",
+ " self.next = None\n",
+ "\n",
+ " def displayLink(self): # display ourself\n",
+ " print '{' , self.iData , ', ' , self.dData , '} ' ,\n",
+ "\n",
+ "class LinkList:\n",
+ " def __init__(self):\n",
+ " self.first = None\n",
+ "\n",
+ " def isEmpty(self): # true if list is empty\n",
+ " return (self.first==None)\n",
+ "\n",
+ " # insert at start of list\n",
+ " def insertFirst(self,i, dd):\n",
+ " # make new link\n",
+ " newLink = Link(i, dd)\n",
+ " newLink.next = self.first\n",
+ " # newLink --> old first\n",
+ " self.first = newLink\n",
+ "\n",
+ " def deleteFirst(self):\n",
+ " temp = self.first\n",
+ " self.first = self.first.next\n",
+ " return temp\n",
+ " \n",
+ " def displayList(self):\n",
+ " print 'List (first-->last): ' ,\n",
+ " current = self.first\n",
+ " while(current != None):\n",
+ " current.displayLink()\n",
+ " current = current.next\n",
+ " print ''\n",
+ "\n",
+ " def find(self,key): # find link with given key\n",
+ " current = self.first #start at first\n",
+ " while(current.iData != key): # while no match,\n",
+ " if(current.next == None): # if end of list,\n",
+ " return None # didnt find it\n",
+ " else:\n",
+ " current = current.next # go to next link\n",
+ " return current\n",
+ " \n",
+ " def delete(self,key): # delete link with given key\n",
+ " current = self.first \n",
+ " previous = self.first\n",
+ " while(current.iData != key):\n",
+ " if(current.next == None):\n",
+ " return None # didnt find it\n",
+ " else:\n",
+ " previous = current\n",
+ " current = current.next\n",
+ " if(current == self.first): # if first link,\n",
+ " self.first = self.first.next\n",
+ " else:\n",
+ " previous.next = current.next\n",
+ " return current\n",
+ "\n",
+ "\n",
+ "theList = LinkList() # make list\n",
+ "theList.insertFirst(22,2.99)\n",
+ "theList.insertFirst(44,4.99)\n",
+ "theList.insertFirst(66,6.99)\n",
+ "theList.insertFirst(88,8.99)\n",
+ "theList.displayList() # display list\n",
+ "f = theList.find(44) # find item\n",
+ "if( f != None):\n",
+ " print 'Found link with key ' , f.iData\n",
+ "else:\n",
+ " print \"Can't find link\"\n",
+ "d = theList.delete(66) # delete item\n",
+ "if( d != None ):\n",
+ " print \"Deleted link with key \" , d.iData\n",
+ "else:\n",
+ " print \"Can't delete link\"\n",
+ "\n",
+ "theList.displayList()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "List (first-->last): { 88 , 8.99 } { 66 , 6.99 } { 44 , 4.99 } { 22 , 2.99 } \nFound link with key 44\nDeleted link with key 66\nList (first-->last): { 88 , 8.99 } { 44 , 4.99 } { 22 , 2.99 } \n"
+ "text": [
+ "List (first-->last): { 88 , 8.99 } { 66 , 6.99 } { 44 , 4.99 } { 22 , 2.99 } \n",
+ "Found link with key 44\n",
+ "Deleted link with key 66\n",
+ "List (first-->last): { 88 , 8.99 } { 44 , 4.99 } { 22 , 2.99 } \n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +213,87 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.3 Page NO :198"
+ "source": [
+ "Example 5.3 Page NO :198"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 5.3\ndemonstrates list with first and last references\n'''\nclass Link:\n def __init__(self,d):\n self.dData = d\n self.next = None\n\n def displayLink(self): # display ourself\n print self.dData , \n\nclass FirstLastList:\n def __init__(self):\n self.first = None\n self.last = None\n\n def isEmpty(self): # true if list is empty\n return (self.first==None)\n\n # insert at start of list\n def insertFirst(self, dd):\n # make new link\n newLink = Link(dd)\n if (self.isEmpty()):\n self.last = newLink\n newLink.next = self.first\n # newLink --> old first\n self.first = newLink\n\n def deleteFirst(self):\n temp = self.first\n if self.first.next ==None:\n self.last = None\n self.first = self.first.next\n return temp\n\n def insertLast(self,dd): # insert at end of list\n newLink = Link(dd) # make new link\n if( self.isEmpty() ): # if empty list,\n self.first = newLink # first --> newLink\n else:\n self.last.next = newLink # old last --> newLink\n self.last = newLink # newLink <-- last\n\n def displayList(self):\n print 'List (first-->last): ' ,\n current = self.first\n while(current != None):\n current.displayLink()\n current = current.next\n print ''\n\n\ntheList = FirstLastList()\ntheList.insertFirst(22) \ntheList.insertLast(11)\ntheList.insertFirst(44) \ntheList.insertLast(33) \ntheList.insertFirst(66) \ntheList.insertLast(55) \ntheList.displayList() # display the list\ntheList.deleteFirst() \ntheList.deleteFirst() \ntheList.displayList() # display again",
+ "input": [
+ " \n",
+ "class Link:\n",
+ " def __init__(self,d):\n",
+ " self.dData = d\n",
+ " self.next = None\n",
+ "\n",
+ " def displayLink(self): # display ourself\n",
+ " print self.dData , \n",
+ "\n",
+ "class FirstLastList:\n",
+ " def __init__(self):\n",
+ " self.first = None\n",
+ " self.last = None\n",
+ "\n",
+ " def isEmpty(self): # true if list is empty\n",
+ " return (self.first==None)\n",
+ "\n",
+ " # insert at start of list\n",
+ " def insertFirst(self, dd):\n",
+ " # make new link\n",
+ " newLink = Link(dd)\n",
+ " if (self.isEmpty()):\n",
+ " self.last = newLink\n",
+ " newLink.next = self.first\n",
+ " # newLink --> old first\n",
+ " self.first = newLink\n",
+ "\n",
+ " def deleteFirst(self):\n",
+ " temp = self.first\n",
+ " if self.first.next ==None:\n",
+ " self.last = None\n",
+ " self.first = self.first.next\n",
+ " return temp\n",
+ "\n",
+ " def insertLast(self,dd): # insert at end of list\n",
+ " newLink = Link(dd) # make new link\n",
+ " if( self.isEmpty() ): # if empty list,\n",
+ " self.first = newLink # first --> newLink\n",
+ " else:\n",
+ " self.last.next = newLink # old last --> newLink\n",
+ " self.last = newLink # newLink <-- last\n",
+ "\n",
+ " def displayList(self):\n",
+ " print 'List (first-->last): ' ,\n",
+ " current = self.first\n",
+ " while(current != None):\n",
+ " current.displayLink()\n",
+ " current = current.next\n",
+ " print ''\n",
+ "\n",
+ "\n",
+ "theList = FirstLastList()\n",
+ "theList.insertFirst(22) \n",
+ "theList.insertLast(11)\n",
+ "theList.insertFirst(44) \n",
+ "theList.insertLast(33) \n",
+ "theList.insertFirst(66) \n",
+ "theList.insertLast(55) \n",
+ "theList.displayList() # display the list\n",
+ "theList.deleteFirst() \n",
+ "theList.deleteFirst() \n",
+ "theList.displayList() # display again"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "List (first-->last): 66 44 22 11 33 55 \nList (first-->last): 22 11 33 55 \n"
+ "text": [
+ "List (first-->last): 66 44 22 11 33 55 \n",
+ "List (first-->last): 22 11 33 55 \n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +302,90 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.4 Page No : 204"
+ "source": [
+ "Example 5.4 Page No : 204"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 5.4\ndemonstrates a stack implemented as a list\n'''\nclass Link:\n def __init__(self,dd):\n self.dData = dd\n self.next = None\n\n def displayLink(self): # display ourself\n print self.dData , \n\nclass LinkList:\n def __init__(self):\n self.first = None\n\n def isEmpty(self): # true if list is empty\n return (self.first==None)\n\n # insert at start of list\n def insertFirst(self, dd):\n # make new link\n newLink = Link( dd)\n newLink.next = self.first\n # newLink --> old first\n self.first = newLink\n\n def deleteFirst(self):\n temp = self.first\n self.first = self.first.next\n return temp\n \n def displayList(self):\n current = self.first\n while(current != None):\n current.displayLink()\n current = current.next\n print ''\n\nclass LinkStack:\n def __init__(self):\n self.theList = LinkList()\n\n def push(self,j): # put item on top of stack\n self.theList.insertFirst(j)\n\n def pop(self): # take item from top of stack\n return self.theList.deleteFirst()\n\n def isEmpty(self):\n return ( self.theList.isEmpty() )\n\n def displayStack(self):\n print 'Stack (top-->bottom): ' ,\n self.theList.displayList()\n\ntheStack = LinkStack() # make stack\ntheStack.push(20)\ntheStack.push(40) \ntheStack.displayStack() # display stack\n\ntheStack.push(60) # push items\ntheStack.push(80) \ntheStack.displayStack() # display stack\ntheStack.pop() \ntheStack.pop() \ntheStack.displayStack() # display stack",
+ "input": [
+ " \n",
+ "class Link:\n",
+ " def __init__(self,dd):\n",
+ " self.dData = dd\n",
+ " self.next = None\n",
+ "\n",
+ " def displayLink(self): # display ourself\n",
+ " print self.dData , \n",
+ "\n",
+ "class LinkList:\n",
+ " def __init__(self):\n",
+ " self.first = None\n",
+ "\n",
+ " def isEmpty(self): # true if list is empty\n",
+ " return (self.first==None)\n",
+ "\n",
+ " # insert at start of list\n",
+ " def insertFirst(self, dd):\n",
+ " # make new link\n",
+ " newLink = Link( dd)\n",
+ " newLink.next = self.first\n",
+ " # newLink --> old first\n",
+ " self.first = newLink\n",
+ "\n",
+ " def deleteFirst(self):\n",
+ " temp = self.first\n",
+ " self.first = self.first.next\n",
+ " return temp\n",
+ " \n",
+ " def displayList(self):\n",
+ " current = self.first\n",
+ " while(current != None):\n",
+ " current.displayLink()\n",
+ " current = current.next\n",
+ " print ''\n",
+ "\n",
+ "class LinkStack:\n",
+ " def __init__(self):\n",
+ " self.theList = LinkList()\n",
+ "\n",
+ " def push(self,j): # put item on top of stack\n",
+ " self.theList.insertFirst(j)\n",
+ "\n",
+ " def pop(self): # take item from top of stack\n",
+ " return self.theList.deleteFirst()\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return ( self.theList.isEmpty() )\n",
+ "\n",
+ " def displayStack(self):\n",
+ " print 'Stack (top-->bottom): ' ,\n",
+ " self.theList.displayList()\n",
+ "\n",
+ "theStack = LinkStack() # make stack\n",
+ "theStack.push(20)\n",
+ "theStack.push(40) \n",
+ "theStack.displayStack() # display stack\n",
+ "\n",
+ "theStack.push(60) # push items\n",
+ "theStack.push(80) \n",
+ "theStack.displayStack() # display stack\n",
+ "theStack.pop() \n",
+ "theStack.pop() \n",
+ "theStack.displayStack() # display stack"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Stack (top-->bottom): 40 20 \nStack (top-->bottom): 80 60 40 20 \nStack (top-->bottom): 40 20 \n"
+ "text": [
+ "Stack (top-->bottom): 40 20 \n",
+ "Stack (top-->bottom): 80 60 40 20 \n",
+ "Stack (top-->bottom): 40 20 \n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +394,104 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.5 Page No : 207"
+ "source": [
+ "Example 5.5 Page No : 207"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 5.5\ndemonstrates queue implemented as double-ended list\n'''\n\nclass Link:\n def __init__(self,d): # constructor\n self.dData = d\n self.next = None\n\n def displayLink(self): # display this link\n print self.dData ,\n\nclass FirstLastList:\n def __init__(self):\n self.first = None\n self.last = None\n\n def isEmpty(self): # true if list is empty\n return (self.first==None)\n\n # insert at start of list\n def insertFirst(self, dd):\n # make new link\n newLink = Link(dd)\n if (self.isEmpty()):\n self.last = newLink\n newLink.next = self.first\n # newLink --> old first\n self.first = newLink\n\n def deleteFirst(self):\n temp = self.first\n if self.first.next ==None:\n self.last = None\n self.first = self.first.next\n return temp\n\n def insertLast(self,dd): # insert at end of list\n newLink = Link(dd) # make new link\n if( self.isEmpty() ): # if empty list,\n self.first = newLink # first --> newLink\n else:\n self.last.next = newLink # old last --> newLink\n self.last = newLink # newLink <-- last\n \n def displayList(self):\n print 'List (first-->last): ' ,\n current = self.first\n while(current != None):\n current.displayLink()\n current = current.next\n print ''\n\n\nclass LinkQueue:\n def __init__(self):\n self.theList = FirstLastList() # make a 2-ended list\n\n def isEmpty(self): # true if queue is empty\n return self.theList.isEmpty()\n \n def insert(self,j): # insert, rear of queue\n self.theList.insertLast(j)\n \n def remove(self): # remove, front of queue\n return self.theList.deleteFirst()\n \n def displayQueue(self):\n print 'Queue (front-->rear): ' , \n self.theList.displayList()\n\ntheQueue = LinkQueue()\ntheQueue.insert(20) # insert items\ntheQueue.insert(40) \ntheQueue.displayQueue() # display queue\ntheQueue.insert(60) # insert items\ntheQueue.insert(80) \ntheQueue.displayQueue() # display queue\ntheQueue.remove() # remove items\ntheQueue.remove() \ntheQueue.displayQueue() # display queue",
+ "input": [
+ " \n",
+ "class Link:\n",
+ " def __init__(self,d): # constructor\n",
+ " self.dData = d\n",
+ " self.next = None\n",
+ "\n",
+ " def displayLink(self): # display this link\n",
+ " print self.dData ,\n",
+ "\n",
+ "class FirstLastList:\n",
+ " def __init__(self):\n",
+ " self.first = None\n",
+ " self.last = None\n",
+ "\n",
+ " def isEmpty(self): # true if list is empty\n",
+ " return (self.first==None)\n",
+ "\n",
+ " # insert at start of list\n",
+ " def insertFirst(self, dd):\n",
+ " # make new link\n",
+ " newLink = Link(dd)\n",
+ " if (self.isEmpty()):\n",
+ " self.last = newLink\n",
+ " newLink.next = self.first\n",
+ " # newLink --> old first\n",
+ " self.first = newLink\n",
+ "\n",
+ " def deleteFirst(self):\n",
+ " temp = self.first\n",
+ " if self.first.next ==None:\n",
+ " self.last = None\n",
+ " self.first = self.first.next\n",
+ " return temp\n",
+ "\n",
+ " def insertLast(self,dd): # insert at end of list\n",
+ " newLink = Link(dd) # make new link\n",
+ " if( self.isEmpty() ): # if empty list,\n",
+ " self.first = newLink # first --> newLink\n",
+ " else:\n",
+ " self.last.next = newLink # old last --> newLink\n",
+ " self.last = newLink # newLink <-- last\n",
+ " \n",
+ " def displayList(self):\n",
+ " print 'List (first-->last): ' ,\n",
+ " current = self.first\n",
+ " while(current != None):\n",
+ " current.displayLink()\n",
+ " current = current.next\n",
+ " print ''\n",
+ "\n",
+ "\n",
+ "class LinkQueue:\n",
+ " def __init__(self):\n",
+ " self.theList = FirstLastList() # make a 2-ended list\n",
+ "\n",
+ " def isEmpty(self): # true if queue is empty\n",
+ " return self.theList.isEmpty()\n",
+ " \n",
+ " def insert(self,j): # insert, rear of queue\n",
+ " self.theList.insertLast(j)\n",
+ " \n",
+ " def remove(self): # remove, front of queue\n",
+ " return self.theList.deleteFirst()\n",
+ " \n",
+ " def displayQueue(self):\n",
+ " print 'Queue (front-->rear): ' , \n",
+ " self.theList.displayList()\n",
+ "\n",
+ "theQueue = LinkQueue()\n",
+ "theQueue.insert(20) # insert items\n",
+ "theQueue.insert(40) \n",
+ "theQueue.displayQueue() # display queue\n",
+ "theQueue.insert(60) # insert items\n",
+ "theQueue.insert(80) \n",
+ "theQueue.displayQueue() # display queue\n",
+ "theQueue.remove() # remove items\n",
+ "theQueue.remove() \n",
+ "theQueue.displayQueue() # display queue"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Queue (front-->rear): List (first-->last): 20 40 \nQueue (front-->rear): List (first-->last): 20 40 60 80 \nQueue (front-->rear): List (first-->last): 60 80 \n"
+ "text": [
+ "Queue (front-->rear): List (first-->last): 20 40 \n",
+ "Queue (front-->rear): List (first-->last): 20 40 60 80 \n",
+ "Queue (front-->rear): List (first-->last): 60 80 \n"
+ ]
}
],
"prompt_number": 5
@@ -122,19 +500,80 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.6 Page No : 215"
+ "source": [
+ "Example 5.6 Page No : 215"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 5.6\ndemonstrates sorted list\n'''\n\nclass Link:\n def __init__(self,d): # constructor\n self.dData = d\n self.next = None\n\n def displayLink(self): # display this link\n print self.dData ,\n\nclass SortedList:\n def __init__(self):\n self.first = None\n\n def isEmpty(self): # true if no links\n return (self.first==None)\n\n def insert(self,key): # insert, in order\n newLink = Link(key) # make new link\n previous = None\n current = self.first # until end of list,\n while(current != None and key > current.dData):\n previous = current\n current = current.next\n if(previous==None): # at beginning of list\n self.first = newLink\n else: # not at beginning\n previous.next = newLink\n newLink.next = current\n\n def remove(self): # return & delete first link\n temp = self.first # save first\n self.first = self.first.next # delete first\n return temp\n\n def displayList(self):\n print \"List (first-->last): \" ,\n current = self.first # start at beginning of listSorted Lists\n while(current != None): # until end of list,\n current.displayLink()\n current = current.next # move to next link\n print ''\n\n# create new list\ntheSortedList = SortedList()\ntheSortedList.insert(20) # insert 2 items\ntheSortedList.insert(40)\ntheSortedList.displayList() # display list\ntheSortedList.insert(10)\ntheSortedList.insert(30)\ntheSortedList.insert(50) # insert 3 more items\ntheSortedList.displayList() # display list\ntheSortedList.remove() # remove an item\ntheSortedList.displayList() # display list",
+ "input": [
+ " \n",
+ "\n",
+ "class Link:\n",
+ " def __init__(self,d): # constructor\n",
+ " self.dData = d\n",
+ " self.next = None\n",
+ "\n",
+ " def displayLink(self): # display this link\n",
+ " print self.dData ,\n",
+ "\n",
+ "class SortedList:\n",
+ " def __init__(self):\n",
+ " self.first = None\n",
+ "\n",
+ " def isEmpty(self): # true if no links\n",
+ " return (self.first==None)\n",
+ "\n",
+ " def insert(self,key): # insert, in order\n",
+ " newLink = Link(key) # make new link\n",
+ " previous = None\n",
+ " current = self.first # until end of list,\n",
+ " while(current != None and key > current.dData):\n",
+ " previous = current\n",
+ " current = current.next\n",
+ " if(previous==None): # at beginning of list\n",
+ " self.first = newLink\n",
+ " else: # not at beginning\n",
+ " previous.next = newLink\n",
+ " newLink.next = current\n",
+ "\n",
+ " def remove(self): # return & delete first link\n",
+ " temp = self.first # save first\n",
+ " self.first = self.first.next # delete first\n",
+ " return temp\n",
+ "\n",
+ " def displayList(self):\n",
+ " print \"List (first-->last): \" ,\n",
+ " current = self.first # start at beginning of listSorted Lists\n",
+ " while(current != None): # until end of list,\n",
+ " current.displayLink()\n",
+ " current = current.next # move to next link\n",
+ " print ''\n",
+ "\n",
+ "# create new list\n",
+ "theSortedList = SortedList()\n",
+ "theSortedList.insert(20) # insert 2 items\n",
+ "theSortedList.insert(40)\n",
+ "theSortedList.displayList() # display list\n",
+ "theSortedList.insert(10)\n",
+ "theSortedList.insert(30)\n",
+ "theSortedList.insert(50) # insert 3 more items\n",
+ "theSortedList.displayList() # display list\n",
+ "theSortedList.remove() # remove an item\n",
+ "theSortedList.displayList() # display list"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "List (first-->last): 20 40 \nList (first-->last): 10 20 30 40 50 \nList (first-->last): 20 30 40 50 \n"
+ "text": [
+ "List (first-->last): 20 40 \n",
+ "List (first-->last): 10 20 30 40 50 \n",
+ "List (first-->last): 20 30 40 50 \n"
+ ]
}
],
"prompt_number": 6
@@ -143,19 +582,97 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.7 Page No : 218"
+ "source": [
+ "Example 5.7 Page No : 218"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 5.7\ndemonstrates sorted list used for sorting\n'''\nclass Link:\n def __init__(self,d): # constructor\n self.dData = d\n self.next = None\n\n def displayLink(self): # display this link\n print self.dData ,\n\nclass SortedList:\n def __init__(self,linkArr = None):\n if linkArr == None:\n self.first = None\n else:\n self.first = None # initialize list\n for j in range(len(linkArr)):\n self.insert( linkArr[j] )\n\n def isEmpty(self): # true if no links\n return (self.first==None)\n\n def insert(self,k): # insert, in order\n previous = None\n current = self.first # until end of list,\n while(current != None and k.dData > current.dData):\n previous = current\n current = current.next\n if(previous==None): # at beginning of list\n self.first = k\n else: # not at beginning\n previous.next = k\n k.next = current\n\n def remove(self): # return & delete first link\n temp = self.first # save first\n self.first = self.first.next # delete first\n return temp\n\n def displayList(self):\n print \"List (first-->last): \" ,\n current = self.first # start at beginning of listSorted Lists\n while(current != None): # until end of list,\n current.displayLink()\n current = current.next # move to next link\n print ''\n\n\nsize = 10 # create array of links\nlinkArray = []\nimport random\nfor j in range(size): # fill array with links\n # random number\n n = int(random.random()*99)\n newLink = Link(n) # make link\n linkArray.append(newLink) # put in array\n\n# display array contents\nprint 'Unsorted array: ',\nfor j in range(size):\n print linkArray[j].dData , \nprint ''\n\n# create new list\n# initialized with array\ntheSortedList = SortedList(linkArray)\nlinkArray = []\nfor j in range(size): # links from list to array\n linkArray.append( theSortedList.remove())\n# display array contents\nprint 'Sorted Array: ',\nfor j in range(size):\n print linkArray[j].dData ,",
+ "input": [
+ " \n",
+ "class Link:\n",
+ " def __init__(self,d): # constructor\n",
+ " self.dData = d\n",
+ " self.next = None\n",
+ "\n",
+ " def displayLink(self): # display this link\n",
+ " print self.dData ,\n",
+ "\n",
+ "class SortedList:\n",
+ " def __init__(self,linkArr = None):\n",
+ " if linkArr == None:\n",
+ " self.first = None\n",
+ " else:\n",
+ " self.first = None # initialize list\n",
+ " for j in range(len(linkArr)):\n",
+ " self.insert( linkArr[j] )\n",
+ "\n",
+ " def isEmpty(self): # true if no links\n",
+ " return (self.first==None)\n",
+ "\n",
+ " def insert(self,k): # insert, in order\n",
+ " previous = None\n",
+ " current = self.first # until end of list,\n",
+ " while(current != None and k.dData > current.dData):\n",
+ " previous = current\n",
+ " current = current.next\n",
+ " if(previous==None): # at beginning of list\n",
+ " self.first = k\n",
+ " else: # not at beginning\n",
+ " previous.next = k\n",
+ " k.next = current\n",
+ "\n",
+ " def remove(self): # return & delete first link\n",
+ " temp = self.first # save first\n",
+ " self.first = self.first.next # delete first\n",
+ " return temp\n",
+ "\n",
+ " def displayList(self):\n",
+ " print \"List (first-->last): \" ,\n",
+ " current = self.first # start at beginning of listSorted Lists\n",
+ " while(current != None): # until end of list,\n",
+ " current.displayLink()\n",
+ " current = current.next # move to next link\n",
+ " print ''\n",
+ "\n",
+ "\n",
+ "size = 10 # create array of links\n",
+ "linkArray = []\n",
+ "import random\n",
+ "for j in range(size): # fill array with links\n",
+ " # random number\n",
+ " n = int(random.random()*99)\n",
+ " newLink = Link(n) # make link\n",
+ " linkArray.append(newLink) # put in array\n",
+ "\n",
+ "# display array contents\n",
+ "print 'Unsorted array: ',\n",
+ "for j in range(size):\n",
+ " print linkArray[j].dData , \n",
+ "print ''\n",
+ "\n",
+ "# create new list\n",
+ "# initialized with array\n",
+ "theSortedList = SortedList(linkArray)\n",
+ "linkArray = []\n",
+ "for j in range(size): # links from list to array\n",
+ " linkArray.append( theSortedList.remove())\n",
+ "# display array contents\n",
+ "print 'Sorted Array: ',\n",
+ "for j in range(size):\n",
+ " print linkArray[j].dData ,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Unsorted array: 28 87 63 12 73 91 30 91 85 65 \nSorted Array: 12 28 30 63 65 73 85 87 91 91\n"
+ "text": [
+ "Unsorted array: 28 87 63 12 73 91 30 91 85 65 \n",
+ "Sorted Array: 12 28 30 63 65 73 85 87 91 91\n"
+ ]
}
],
"prompt_number": 7
@@ -164,19 +681,155 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.8 Page no : 226"
+ "source": [
+ "Example 5.8 Page no : 226"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 5.8\ndemonstrates doubly-linked list\n'''\nclass Link:\n def __init__(self,d): # constructor\n self.dData = d\n self.next = None\n self.previous = None\n\n def displayLink(self): # display this link\n print self.dData ,\n\nclass DoublyLinkedList:\n def __init__(self):\n self.first = None # no items on list yet\n self.last = None\n\n def isEmpty(self): # true if no links\n return self.first==None\n\n def insertFirst(self,dd): # insert at front of list\n newLink = Link(dd) # make new link\n if( self.isEmpty() ): # if empty list, \n self.last = newLink # newLink <-- last\n else:\n self.first.previous = newLink # newLink <-- old first\n newLink.next = self.first # newLink --> old first\n self.first = newLink # first --> newLink\n\n def insertLast(self,dd): # insert at end of list\n newLink = Link(dd) # make new link\n if( self.isEmpty() ) : # if empty list,\n self.first = newLink # first --> newLink\n else:\n self.last.next = newLink # old last --> newLink\n newLink.previous = self.last # old last <-- newLink\n self.last = newLink # newLink <-- last\n\n def deleteFirst(self): # delete first link\n # (assumes non-empty list)\n temp = self.first\n if(self.first.next == None): # if only one item\n self.last = None # None <-- last\n else:\n self.first.next.previous = None # None <-- old next\n self.first = self.first.next # first --> old next\n return temp\n\n def deleteLast(self): # delete last link\n # (assumes non-empty list)\n temp = self.last\n if(self.first.next == None): # if only one item\n self.first = None # first --> None\n else:\n self.last.previous.next = None # old previous --> None\n self.last = self.last.previous # old previous <-- last\n return temp\n\n # insert dd just after key\n def insertAfter(self,key,dd):\n # (assumes non-empty list)\n current = self.first # start at beginning\n while(current.dData != key): # until match is found,\n current = current.next # move to next link\n if(current == None):\n return False # didnt find it\n newLink = Link(dd) # make new link\n if(current==self.last): # if last link,\n newLink.next = None # newLink --> None\n self.last = newLink# newLink <-- last\n else: # not last link,\n newLink.next = current.next # newLink --> old next # newLink <-- old next\n current.next.previous = newLink\n newLink.previous = current # old current <-- newLink\n current.next = newLink # old current --> newLink\n return True # found it, did insertion\n\n def deleteKey(self,key): # delete item w/ given key\n # (assumes non-empty list)\n current = self.first # start at beginningDoubly Linked Lists\n while(current.dData != key):\n current = current.next\n if(current == None):\n return None\n if(current==self.first):\n self.first = current.next\n else: \n # until match is found, move to next link didnt find it found it first item? first --> old next\n # not first old previous --> old next\n current.previous.next = current.next\n if(current==self.last):\n self.last = current.previous\n else:\n # last item? old previous <-- last not last old previous <-- old next \n current.next.previous = current.previous\n return current # return value\n\n def displayForward(self):\n print 'List (first-->last): ',\n current = self.first # start at beginning\n while(current != None): # until end of list,\n current.displayLink()# display data\n current = current.next # move to next link\n print ''\n\n def displayBackward(self):\n print 'List (last-->first): ' ,\n current = self.last # start at end\n while(current != None): # until start of list,\n current.displayLink() # display data\n current = current.previous # move to previous link\n print ''\n\n# make a new list\ntheList = DoublyLinkedList()\ntheList.insertFirst(22) # insert at front\ntheList.insertFirst(44) \ntheList.insertFirst(66) \ntheList.insertLast(11) # insert at rear\ntheList.insertLast(33) \ntheList.insertLast(55) \ntheList.displayForward() # display list forward\ntheList.displayBackward() # display list backward\ntheList.deleteFirst() # delete first item\ntheList.deleteLast() # delete last item\ntheList.deleteKey(11) # delete item with key 11\ntheList.displayForward() # display list forward\ntheList.insertAfter(22, 77) # insert 77 after 22\ntheList.insertAfter(33, 88) # insert 88 after 33\ntheList.displayForward() # display list forward",
+ "input": [
+ " \n",
+ "class Link:\n",
+ " def __init__(self,d): # constructor\n",
+ " self.dData = d\n",
+ " self.next = None\n",
+ " self.previous = None\n",
+ "\n",
+ " def displayLink(self): # display this link\n",
+ " print self.dData ,\n",
+ "\n",
+ "class DoublyLinkedList:\n",
+ " def __init__(self):\n",
+ " self.first = None # no items on list yet\n",
+ " self.last = None\n",
+ "\n",
+ " def isEmpty(self): # true if no links\n",
+ " return self.first==None\n",
+ "\n",
+ " def insertFirst(self,dd): # insert at front of list\n",
+ " newLink = Link(dd) # make new link\n",
+ " if( self.isEmpty() ): # if empty list, \n",
+ " self.last = newLink # newLink <-- last\n",
+ " else:\n",
+ " self.first.previous = newLink # newLink <-- old first\n",
+ " newLink.next = self.first # newLink --> old first\n",
+ " self.first = newLink # first --> newLink\n",
+ "\n",
+ " def insertLast(self,dd): # insert at end of list\n",
+ " newLink = Link(dd) # make new link\n",
+ " if( self.isEmpty() ) : # if empty list,\n",
+ " self.first = newLink # first --> newLink\n",
+ " else:\n",
+ " self.last.next = newLink # old last --> newLink\n",
+ " newLink.previous = self.last # old last <-- newLink\n",
+ " self.last = newLink # newLink <-- last\n",
+ "\n",
+ " def deleteFirst(self): # delete first link\n",
+ " # (assumes non-empty list)\n",
+ " temp = self.first\n",
+ " if(self.first.next == None): # if only one item\n",
+ " self.last = None # None <-- last\n",
+ " else:\n",
+ " self.first.next.previous = None # None <-- old next\n",
+ " self.first = self.first.next # first --> old next\n",
+ " return temp\n",
+ "\n",
+ " def deleteLast(self): # delete last link\n",
+ " # (assumes non-empty list)\n",
+ " temp = self.last\n",
+ " if(self.first.next == None): # if only one item\n",
+ " self.first = None # first --> None\n",
+ " else:\n",
+ " self.last.previous.next = None # old previous --> None\n",
+ " self.last = self.last.previous # old previous <-- last\n",
+ " return temp\n",
+ "\n",
+ " # insert dd just after key\n",
+ " def insertAfter(self,key,dd):\n",
+ " # (assumes non-empty list)\n",
+ " current = self.first # start at beginning\n",
+ " while(current.dData != key): # until match is found,\n",
+ " current = current.next # move to next link\n",
+ " if(current == None):\n",
+ " return False # didnt find it\n",
+ " newLink = Link(dd) # make new link\n",
+ " if(current==self.last): # if last link,\n",
+ " newLink.next = None # newLink --> None\n",
+ " self.last = newLink# newLink <-- last\n",
+ " else: # not last link,\n",
+ " newLink.next = current.next # newLink --> old next # newLink <-- old next\n",
+ " current.next.previous = newLink\n",
+ " newLink.previous = current # old current <-- newLink\n",
+ " current.next = newLink # old current --> newLink\n",
+ " return True # found it, did insertion\n",
+ "\n",
+ " def deleteKey(self,key): # delete item w/ given key\n",
+ " # (assumes non-empty list)\n",
+ " current = self.first # start at beginningDoubly Linked Lists\n",
+ " while(current.dData != key):\n",
+ " current = current.next\n",
+ " if(current == None):\n",
+ " return None\n",
+ " if(current==self.first):\n",
+ " self.first = current.next\n",
+ " else: \n",
+ " # until match is found, move to next link didnt find it found it first item? first --> old next\n",
+ " # not first old previous --> old next\n",
+ " current.previous.next = current.next\n",
+ " if(current==self.last):\n",
+ " self.last = current.previous\n",
+ " else:\n",
+ " # last item? old previous <-- last not last old previous <-- old next \n",
+ " current.next.previous = current.previous\n",
+ " return current # return value\n",
+ "\n",
+ " def displayForward(self):\n",
+ " print 'List (first-->last): ',\n",
+ " current = self.first # start at beginning\n",
+ " while(current != None): # until end of list,\n",
+ " current.displayLink()# display data\n",
+ " current = current.next # move to next link\n",
+ " print ''\n",
+ "\n",
+ " def displayBackward(self):\n",
+ " print 'List (last-->first): ' ,\n",
+ " current = self.last # start at end\n",
+ " while(current != None): # until start of list,\n",
+ " current.displayLink() # display data\n",
+ " current = current.previous # move to previous link\n",
+ " print ''\n",
+ "\n",
+ "# make a new list\n",
+ "theList = DoublyLinkedList()\n",
+ "theList.insertFirst(22) # insert at front\n",
+ "theList.insertFirst(44) \n",
+ "theList.insertFirst(66) \n",
+ "theList.insertLast(11) # insert at rear\n",
+ "theList.insertLast(33) \n",
+ "theList.insertLast(55) \n",
+ "theList.displayForward() # display list forward\n",
+ "theList.displayBackward() # display list backward\n",
+ "theList.deleteFirst() # delete first item\n",
+ "theList.deleteLast() # delete last item\n",
+ "theList.deleteKey(11) # delete item with key 11\n",
+ "theList.displayForward() # display list forward\n",
+ "theList.insertAfter(22, 77) # insert 77 after 22\n",
+ "theList.insertAfter(33, 88) # insert 88 after 33\n",
+ "theList.displayForward() # display list forward"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "List (first-->last): 66 44 22 11 33 55 \nList (last-->first): 55 33 11 22 44 66 \nList (first-->last): 44 22 33 \nList (first-->last): 44 22 77 33 88 \n"
+ "text": [
+ "List (first-->last): 66 44 22 11 33 55 \n",
+ "List (last-->first): 55 33 11 22 44 66 \n",
+ "List (first-->last): 44 22 33 \n",
+ "List (first-->last): 44 22 77 33 88 \n"
+ ]
}
],
"prompt_number": 8
@@ -185,140 +838,364 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.9 Page No : 235"
+ "source": [
+ "Example 5.9 Page No : 235"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 5.9\ndemonstrates iterators on a linked listListIterator\n'''\nclass Link:\n def __init__(self,d): # constructor\n self.dData = d\n self.next = None\n\n def displayLink(self): # display this link\n print self.dData ,\n\nclass LinkList:\n def __init__(self):\n self.first = None\n\n def isEmpty(self): # true if list is empty\n return (self.first==None)\n\n # insert at start of list\n def insertFirst(self,i, dd):\n # make new link\n newLink = Link(i, dd)\n newLink.next = self.first\n # newLink --> old first\n self.first = newLink\n\n def deleteFirst(self):\n temp = self.first\n self.first = self.first.next\n return temp\n \n def displayList(self):\n print 'List (first-->last): ' ,\n current = self.first\n while(current != None):\n current.displayLink()\n current = current.next\n print ''\n\n def find(self,key): # find link with given key\n current = self.first #start at first\n while(current.iData != key): # while no match,\n if(current.next == None): # if end of list,\n return None # didnt find it\n else:\n current = current.next # go to next link\n return current\n \n def delete(self,key): # delete link with given key\n current = self.first \n previous = self.first\n while(current.iData != key):\n if(current.next == None):\n return None # didnt find it\n else:\n previous = current\n current = current.next\n if(current == self.first): # if first link,\n self.first = self.first.next\n else:\n previous.next = current.next\n return current\n\n def getFirst(self): # get value of first\n return self.first\n\n def setFirst(self,f): # set first to new link\n self.first = f\n\n def getIterator(self): # return iterator\n return ListIterator(self) # initialized with\n\nclass ListIterator:\n def __init__(self,l): # constructor\n self.ourList = l\n self.reset()\n self.current = None\n self.previous = None\n\n def reset(self): # start at first\n self.current = self.ourList.getFirst()\n self.previous = None\n\n def atEnd(self): # true if last link\n return (self.current.next==None) \n \n def nextLink(self): # go to next link\n self.previous = self.current\n self.current = self.current.next\n\n def getCurrent(self): # get current link\n return self.current \n\n def insertAfter(self,dd): # insert after\n # current link\n newLink = Link(dd)\n if( self.ourList.isEmpty() ):# empty list\n self.ourList.setFirst(newLink)\n self.current = newLink\n else: # not empty\n newLink.next = self.current.next\n self.current.next = newLink\n self.nextLink() # point to new link\n\n def insertBefore(self,dd): # insert before\n # current link\n newLink = Link(dd)\n if(self.previous == None): # beginning of list (or empty list)\n newLink.next = self.ourList.getFirst()\n self.ourList.setFirst(newLink)\n self.reset()\n else: # not beginning\n newLink.next = self.previous.next\n self.previous.next = newLink\n self.current = newLink\n\n def deleteCurrent(self): # delete item at current\n value = self.current.dData\n if(self.previous == None): # beginning of list\n self.ourList.setFirst(self.current.next)\n self.reset()\n else: # not beginning\n self.previous.next = self.current.next\n if( self.atEnd() ):\n self.reset()\n else:\n current = current.next\n return value\n\ntheList = LinkList() # new list\niter1 = theList.getIterator() # new iter\niter1.insertAfter(20)\niter1.insertAfter(40)\niter1.insertAfter(80)\niter1.insertBefore(60) # insert items\nwhile(True):\n print 'Enter first letter of show, reset, ' , \n print 'next, get, before, after, delete: ' ,\n choice = raw_input() # get users option\n if choice == 's': # show list\n if( not theList.isEmpty() ):\n theList.displayList()\n else:\n print 'List is empty'\n elif choice == 'r': # reset (to first)\n iter1.reset()\n elif choice == 'n': # advance to next item\n if( not theList.isEmpty() and not iter1.atEnd() ):\n iter1.nextLink()\n else:\n print \"Cant go to next link\"\n elif choice=='g': # get current item\n if( not theList.isEmpty() ):\n value = iter1.getCurrent().dData\n print \"Returned \" , value\n else:\n print \"List is empty\"\n elif choice == 'b': # insert before current\n print \"Enter value to insert: \",\n value = raw_input()\n iter1.insertBefore(value)\n elif choice=='a': # insert after current\n print \"Enter value to insert: \",\n value = raw_input()\n iter1.insertAfter(value)\n elif choice == 'd': # delete current item\n if( not theList.isEmpty() ):\n value = iter1.deleteCurrent()\n print \"Deleted \" , value\n else:\n print \"Cant delete\"\n else:\n print \"Invalid entry\"\n break",
+ "input": [
+ " \n",
+ "class Link:\n",
+ " def __init__(self,d): # constructor\n",
+ " self.dData = d\n",
+ " self.next = None\n",
+ "\n",
+ " def displayLink(self): # display this link\n",
+ " print self.dData ,\n",
+ "\n",
+ "class LinkList:\n",
+ " def __init__(self):\n",
+ " self.first = None\n",
+ "\n",
+ " def isEmpty(self): # true if list is empty\n",
+ " return (self.first==None)\n",
+ "\n",
+ " # insert at start of list\n",
+ " def insertFirst(self,i, dd):\n",
+ " # make new link\n",
+ " newLink = Link(i, dd)\n",
+ " newLink.next = self.first\n",
+ " # newLink --> old first\n",
+ " self.first = newLink\n",
+ "\n",
+ " def deleteFirst(self):\n",
+ " temp = self.first\n",
+ " self.first = self.first.next\n",
+ " return temp\n",
+ " \n",
+ " def displayList(self):\n",
+ " print 'List (first-->last): ' ,\n",
+ " current = self.first\n",
+ " while(current != None):\n",
+ " current.displayLink()\n",
+ " current = current.next\n",
+ " print ''\n",
+ "\n",
+ " def find(self,key): # find link with given key\n",
+ " current = self.first #start at first\n",
+ " while(current.iData != key): # while no match,\n",
+ " if(current.next == None): # if end of list,\n",
+ " return None # didnt find it\n",
+ " else:\n",
+ " current = current.next # go to next link\n",
+ " return current\n",
+ " \n",
+ " def delete(self,key): # delete link with given key\n",
+ " current = self.first \n",
+ " previous = self.first\n",
+ " while(current.iData != key):\n",
+ " if(current.next == None):\n",
+ " return None # didnt find it\n",
+ " else:\n",
+ " previous = current\n",
+ " current = current.next\n",
+ " if(current == self.first): # if first link,\n",
+ " self.first = self.first.next\n",
+ " else:\n",
+ " previous.next = current.next\n",
+ " return current\n",
+ "\n",
+ " def getFirst(self): # get value of first\n",
+ " return self.first\n",
+ "\n",
+ " def setFirst(self,f): # set first to new link\n",
+ " self.first = f\n",
+ "\n",
+ " def getIterator(self): # return iterator\n",
+ " return ListIterator(self) # initialized with\n",
+ "\n",
+ "class ListIterator:\n",
+ " def __init__(self,l): # constructor\n",
+ " self.ourList = l\n",
+ " self.reset()\n",
+ " self.current = None\n",
+ " self.previous = None\n",
+ "\n",
+ " def reset(self): # start at first\n",
+ " self.current = self.ourList.getFirst()\n",
+ " self.previous = None\n",
+ "\n",
+ " def atEnd(self): # true if last link\n",
+ " return (self.current.next==None) \n",
+ " \n",
+ " def nextLink(self): # go to next link\n",
+ " self.previous = self.current\n",
+ " self.current = self.current.next\n",
+ "\n",
+ " def getCurrent(self): # get current link\n",
+ " return self.current \n",
+ "\n",
+ " def insertAfter(self,dd): # insert after\n",
+ " # current link\n",
+ " newLink = Link(dd)\n",
+ " if( self.ourList.isEmpty() ):# empty list\n",
+ " self.ourList.setFirst(newLink)\n",
+ " self.current = newLink\n",
+ " else: # not empty\n",
+ " newLink.next = self.current.next\n",
+ " self.current.next = newLink\n",
+ " self.nextLink() # point to new link\n",
+ "\n",
+ " def insertBefore(self,dd): # insert before\n",
+ " # current link\n",
+ " newLink = Link(dd)\n",
+ " if(self.previous == None): # beginning of list (or empty list)\n",
+ " newLink.next = self.ourList.getFirst()\n",
+ " self.ourList.setFirst(newLink)\n",
+ " self.reset()\n",
+ " else: # not beginning\n",
+ " newLink.next = self.previous.next\n",
+ " self.previous.next = newLink\n",
+ " self.current = newLink\n",
+ "\n",
+ " def deleteCurrent(self): # delete item at current\n",
+ " value = self.current.dData\n",
+ " if(self.previous == None): # beginning of list\n",
+ " self.ourList.setFirst(self.current.next)\n",
+ " self.reset()\n",
+ " else: # not beginning\n",
+ " self.previous.next = self.current.next\n",
+ " if( self.atEnd() ):\n",
+ " self.reset()\n",
+ " else:\n",
+ " current = current.next\n",
+ " return value\n",
+ "\n",
+ "theList = LinkList() # new list\n",
+ "iter1 = theList.getIterator() # new iter\n",
+ "iter1.insertAfter(20)\n",
+ "iter1.insertAfter(40)\n",
+ "iter1.insertAfter(80)\n",
+ "iter1.insertBefore(60) # insert items\n",
+ "while(True):\n",
+ " print 'Enter first letter of show, reset, ' , \n",
+ " print 'next, get, before, after, delete: ' ,\n",
+ " choice = raw_input() # get users option\n",
+ " if choice == 's': # show list\n",
+ " if( not theList.isEmpty() ):\n",
+ " theList.displayList()\n",
+ " else:\n",
+ " print 'List is empty'\n",
+ " elif choice == 'r': # reset (to first)\n",
+ " iter1.reset()\n",
+ " elif choice == 'n': # advance to next item\n",
+ " if( not theList.isEmpty() and not iter1.atEnd() ):\n",
+ " iter1.nextLink()\n",
+ " else:\n",
+ " print \"Cant go to next link\"\n",
+ " elif choice=='g': # get current item\n",
+ " if( not theList.isEmpty() ):\n",
+ " value = iter1.getCurrent().dData\n",
+ " print \"Returned \" , value\n",
+ " else:\n",
+ " print \"List is empty\"\n",
+ " elif choice == 'b': # insert before current\n",
+ " print \"Enter value to insert: \",\n",
+ " value = raw_input()\n",
+ " iter1.insertBefore(value)\n",
+ " elif choice=='a': # insert after current\n",
+ " print \"Enter value to insert: \",\n",
+ " value = raw_input()\n",
+ " iter1.insertAfter(value)\n",
+ " elif choice == 'd': # delete current item\n",
+ " if( not theList.isEmpty() ):\n",
+ " value = iter1.deleteCurrent()\n",
+ " print \"Deleted \" , value\n",
+ " else:\n",
+ " print \"Cant delete\"\n",
+ " else:\n",
+ " print \"Invalid entry\"\n",
+ " break"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter first letter of show, reset, next, get, before, after, delete: "
+ "text": [
+ " Enter first letter of show, reset, next, get, before, after, delete: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "s\n"
+ "text": [
+ "s\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " List (first-->last): 20 40 60 80 \nEnter first letter of show, reset, next, get, before, after, delete: "
+ "text": [
+ " List (first-->last): 20 40 60 80 \n",
+ "Enter first letter of show, reset, next, get, before, after, delete: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "r\n"
+ "text": [
+ "r\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter first letter of show, reset, next, get, before, after, delete: "
+ "text": [
+ " Enter first letter of show, reset, next, get, before, after, delete: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "n\n"
+ "text": [
+ "n\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter first letter of show, reset, next, get, before, after, delete: "
+ "text": [
+ " Enter first letter of show, reset, next, get, before, after, delete: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "n\n"
+ "text": [
+ "n\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter first letter of show, reset, next, get, before, after, delete: "
+ "text": [
+ " Enter first letter of show, reset, next, get, before, after, delete: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "g\n"
+ "text": [
+ "g\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Returned 60\nEnter first letter of show, reset, next, get, before, after, delete: "
+ "text": [
+ " Returned 60\n",
+ "Enter first letter of show, reset, next, get, before, after, delete: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "b\n"
+ "text": [
+ "b\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter value to insert: "
+ "text": [
+ " Enter value to insert: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "100\n"
+ "text": [
+ "100\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter first letter of show, reset, next, get, before, after, delete: "
+ "text": [
+ " Enter first letter of show, reset, next, get, before, after, delete: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a\n"
+ "text": [
+ "a\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter value to insert: "
+ "text": [
+ " Enter value to insert: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter first letter of show, reset, next, get, before, after, delete: "
+ "text": [
+ " Enter first letter of show, reset, next, get, before, after, delete: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "s\n"
+ "text": [
+ "s\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " List (first-->last): 20 40 100 7 60 80 \nEnter first letter of show, reset, next, get, before, after, delete: "
+ "text": [
+ " List (first-->last): 20 40 100 7 60 80 \n",
+ "Enter first letter of show, reset, next, get, before, after, delete: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Invalid entry\n"
+ "text": [
+ " Invalid entry\n"
+ ]
}
],
"prompt_number": 10
@@ -326,7 +1203,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch6.ipynb b/Data_Structures_and_Algorithms_in_Java/ch6.ipynb
index 483043b8..c95d1bf1 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch6.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch6"
+ "name": "",
+ "signature": "sha256:de38e9569976fe6e7666e16fc87eae62ca1e6843703b45eeabd018f73553dc8b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,36 +12,59 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 6 : Recursion"
+ "source": [
+ "Chapter 6 : Recursion"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.1 Page No : 255"
+ "source": [
+ "Example 6.1 Page No : 255"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 6.1\nevaluates triangular numbers\n'''\n\ndef triangle(n):\n if(n==1):\n return 1\n else:\n return( n + triangle(n-1) )\n\nprint 'Enter a number: ' ,\ntheNumber = int(raw_input())\ntheAnswer = triangle(theNumber)\nprint 'Triangle = ' , theAnswer\n",
+ "input": [
+ " \n",
+ "\n",
+ "def triangle(n):\n",
+ " if(n==1):\n",
+ " return 1\n",
+ " else:\n",
+ " return( n + triangle(n-1) )\n",
+ "\n",
+ "print 'Enter a number: ' ,\n",
+ "theNumber = int(raw_input())\n",
+ "theAnswer = triangle(theNumber)\n",
+ "print 'Triangle = ' , theAnswer\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Enter a number: "
+ "text": [
+ " Enter a number: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "50\n"
+ "text": [
+ "50\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Triangle = 1275\n"
+ "text": [
+ " Triangle = 1275\n"
+ ]
}
],
"prompt_number": 11
@@ -49,30 +73,88 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.2 Page No : 265"
+ "source": [
+ "Example 6.2 Page No : 265"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 6.2\ncreates anagrams\n'''\narrChar = []\nsize = 0\ncount = 0\ndef doAnagram(newSize):\n if(newSize == 1): # if too small,\n return\n for j in range(newSize): # for each position,\n doAnagram(newSize-1) # anagram remaining\n if(newSize==2): # if innermost,\n displayWord()\n rotate(newSize);\n\ndef rotate(newSize):\n global size\n global arrChar\n position = size - newSize\n temp = arrChar[position]\n for j in range(position+1,size):\n # shift others left\n arrChar[j-1] = arrChar[j]\n arrChar[size-1] = temp;\n\ndef displayWord():\n global count\n global size\n global arrChar\n if(count < 99):\n print ' ' ,\n if(count < 9):\n print ' ' ,\n count += 1\n print count ,\n for j in range(size):\n print arrChar[j] ,\n print '' ,\n if(count%6 == 0):\n print ''\n\nprint 'Enter a word: '\ni = raw_input()\n#global size\nsize = len(i)\nfor j in range(size):\n arrChar.append(i[j])\ndoAnagram(size)\n",
+ "input": [
+ " \n",
+ "arrChar = []\n",
+ "size = 0\n",
+ "count = 0\n",
+ "def doAnagram(newSize):\n",
+ " if(newSize == 1): # if too small,\n",
+ " return\n",
+ " for j in range(newSize): # for each position,\n",
+ " doAnagram(newSize-1) # anagram remaining\n",
+ " if(newSize==2): # if innermost,\n",
+ " displayWord()\n",
+ " rotate(newSize);\n",
+ "\n",
+ "def rotate(newSize):\n",
+ " global size\n",
+ " global arrChar\n",
+ " position = size - newSize\n",
+ " temp = arrChar[position]\n",
+ " for j in range(position+1,size):\n",
+ " # shift others left\n",
+ " arrChar[j-1] = arrChar[j]\n",
+ " arrChar[size-1] = temp;\n",
+ "\n",
+ "def displayWord():\n",
+ " global count\n",
+ " global size\n",
+ " global arrChar\n",
+ " if(count < 99):\n",
+ " print ' ' ,\n",
+ " if(count < 9):\n",
+ " print ' ' ,\n",
+ " count += 1\n",
+ " print count ,\n",
+ " for j in range(size):\n",
+ " print arrChar[j] ,\n",
+ " print '' ,\n",
+ " if(count%6 == 0):\n",
+ " print ''\n",
+ "\n",
+ "print 'Enter a word: '\n",
+ "i = raw_input()\n",
+ "#global size\n",
+ "size = len(i)\n",
+ "for j in range(size):\n",
+ " arrChar.append(i[j])\n",
+ "doAnagram(size)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a word: \n"
+ "text": [
+ "Enter a word: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "cats\n"
+ "text": [
+ "cats\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 1 c a t s 2 c a s t 3 c t s a 4 c t a s 5 c s a t 6 c s t a \n 7 a t s c 8 a t c s 9 a s c t 10 a s t c 11 a c t s 12 a c s t \n 13 t s c a 14 t s a c 15 t c a s 16 t c s a 17 t a s c 18 t a c s \n 19 s c a t 20 s c t a 21 s a t c 22 s a c t 23 s t c a 24 s t a c \n"
+ "text": [
+ " 1 c a t s 2 c a s t 3 c t s a 4 c t a s 5 c s a t 6 c s t a \n",
+ " 7 a t s c 8 a t c s 9 a s c t 10 a s t c 11 a c t s 12 a c s t \n",
+ " 13 t s c a 14 t s a c 15 t c a s 16 t c s a 17 t a s c 18 t a c s \n",
+ " 19 s c a t 20 s c t a 21 s a t c 22 s a c t 23 s t c a 24 s t a c \n"
+ ]
}
],
"prompt_number": 19
@@ -81,19 +163,82 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.3 Page No : 269"
+ "source": [
+ "Example 6.3 Page No : 269"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nLISTING 6.3\ndemonstrates recursive binary search\n'''\nclass ordArray:\n def __init__(self,m): # constructor\n self.a = []\n self.nElems = 0\n def size(self):\n return self.nElems\n\n def find(self,searchKey):\n return self.recFind(searchKey, 0, self.nElems-1)\n\n def recFind(self,searchKey,lowerBound,upperBound):\n curIn = (lowerBound + upperBound ) / 2\n if(self.a[curIn]==searchKey):\n return curIn # found it\n elif(lowerBound > upperBound):\n return self.nElems # cant find it\n else: # divide range\n if(self.a[curIn] < searchKey): # its in upper half\n return self.recFind(searchKey, curIn+1, upperBound)\n else: # its in lower half\n return self.recFind(searchKey, lowerBound, curIn-1)\n\n def insert(self,value): # put element into array\n self.a.append(value)\n self.a.sort()\n self.nElems += 1\n\n def display(self): # displays array contents\n for j in range(self.nElems): # for each element,\n print self.a[j] , \n print ''\n\nmaxSize = 100 # array size\narr = ordArray(maxSize) # create the array\narr.insert(72)\narr.insert(90)\narr.insert(45)\narr.insert(126)\narr.insert(54)\narr.insert(99)\narr.insert(144)\narr.insert(27)\narr.insert(135)\narr.insert(81)\narr.insert(18)\narr.insert(108)\narr.insert(9)\narr.insert(117)\narr.insert(63)\narr.insert(36)\narr.display() # display array\nsearchKey = 27 # search for item\nif( arr.find(searchKey) != arr.size()):\n print 'Found ' , searchKey\nelse:\n print \"Can't find \" , searchKey",
+ "input": [
+ " \n",
+ "class ordArray:\n",
+ " def __init__(self,m): # constructor\n",
+ " self.a = []\n",
+ " self.nElems = 0\n",
+ " def size(self):\n",
+ " return self.nElems\n",
+ "\n",
+ " def find(self,searchKey):\n",
+ " return self.recFind(searchKey, 0, self.nElems-1)\n",
+ "\n",
+ " def recFind(self,searchKey,lowerBound,upperBound):\n",
+ " curIn = (lowerBound + upperBound ) / 2\n",
+ " if(self.a[curIn]==searchKey):\n",
+ " return curIn # found it\n",
+ " elif(lowerBound > upperBound):\n",
+ " return self.nElems # cant find it\n",
+ " else: # divide range\n",
+ " if(self.a[curIn] < searchKey): # its in upper half\n",
+ " return self.recFind(searchKey, curIn+1, upperBound)\n",
+ " else: # its in lower half\n",
+ " return self.recFind(searchKey, lowerBound, curIn-1)\n",
+ "\n",
+ " def insert(self,value): # put element into array\n",
+ " self.a.append(value)\n",
+ " self.a.sort()\n",
+ " self.nElems += 1\n",
+ "\n",
+ " def display(self): # displays array contents\n",
+ " for j in range(self.nElems): # for each element,\n",
+ " print self.a[j] , \n",
+ " print ''\n",
+ "\n",
+ "maxSize = 100 # array size\n",
+ "arr = ordArray(maxSize) # create the array\n",
+ "arr.insert(72)\n",
+ "arr.insert(90)\n",
+ "arr.insert(45)\n",
+ "arr.insert(126)\n",
+ "arr.insert(54)\n",
+ "arr.insert(99)\n",
+ "arr.insert(144)\n",
+ "arr.insert(27)\n",
+ "arr.insert(135)\n",
+ "arr.insert(81)\n",
+ "arr.insert(18)\n",
+ "arr.insert(108)\n",
+ "arr.insert(9)\n",
+ "arr.insert(117)\n",
+ "arr.insert(63)\n",
+ "arr.insert(36)\n",
+ "arr.display() # display array\n",
+ "searchKey = 27 # search for item\n",
+ "if( arr.find(searchKey) != arr.size()):\n",
+ " print 'Found ' , searchKey\n",
+ "else:\n",
+ " print \"Can't find \" , searchKey"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "9 18 27 36 45 54 63 72 81 90 99 108 117 126 135 144 \nFound 27\n"
+ "text": [
+ "9 18 27 36 45 54 63 72 81 90 99 108 117 126 135 144 \n",
+ "Found 27\n"
+ ]
}
],
"prompt_number": 13
@@ -102,19 +247,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.4 Page No : 278"
+ "source": [
+ "Example 6.4 Page No : 278"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 6.4\nsolves the towers of Hanoi puzzle\n'''\ndef doTowers(topN,frm,inter,to):\n if(topN==1):\n print \"Disk 1 from \" , frm , \"to \" , to\n else:\n doTowers(topN-1, frm, to, inter) # from-->inter\n print \"Disk \" , topN ,\" from \" , frm , \" to \" , to\n doTowers(topN-1, inter, frm, to) # inter-->to\n\n\nnDisks = 3\ndoTowers(nDisks, 'A', 'B', 'C')\n",
+ "input": [
+ " \n",
+ "def doTowers(topN,frm,inter,to):\n",
+ " if(topN==1):\n",
+ " print \"Disk 1 from \" , frm , \"to \" , to\n",
+ " else:\n",
+ " doTowers(topN-1, frm, to, inter) # from-->inter\n",
+ " print \"Disk \" , topN ,\" from \" , frm , \" to \" , to\n",
+ " doTowers(topN-1, inter, frm, to) # inter-->to\n",
+ "\n",
+ "\n",
+ "nDisks = 3\n",
+ "doTowers(nDisks, 'A', 'B', 'C')\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Disk 1 from A to C\nDisk 2 from A to B\nDisk 1 from C to B\nDisk 3 from A to C\nDisk 1 from B to A\nDisk 2 from B to C\nDisk 1 from A to C\n"
+ "text": [
+ "Disk 1 from A to C\n",
+ "Disk 2 from A to B\n",
+ "Disk 1 from C to B\n",
+ "Disk 3 from A to C\n",
+ "Disk 1 from B to A\n",
+ "Disk 2 from B to C\n",
+ "Disk 1 from A to C\n"
+ ]
}
],
"prompt_number": 14
@@ -123,19 +291,59 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.5 Page no : 281"
+ "source": [
+ "Example 6.5 Page no : 281"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 6.5\ndemonstrates merging two arrays into a third\n'''\n# merge A and B into C\ndef merge(arrayA,sizeA,arrayB,sizeB,arrayC ):\n aDex=0\n bDex=0\n cDex=0\n while(aDex < sizeA and bDex < sizeB): # neither array empty\n if( arrayA[aDex] < arrayB[bDex] ):\n arrayC.append(arrayA[aDex])\n cDex += 1\n aDex += 1\n else:\n arrayC.append(arrayB[bDex])\n cDex += 1\n bDex += 1\n while(aDex < sizeA):\n arrayC.append(arrayA[aDex])\n cDex += 1\n aDex += 1\n while(bDex < sizeB):\n arrayC.append(arrayB[bDex]) # but arrayB isnt\n cDex +=1\n bDex += 1\n\ndef display(theArray,size):\n for j in range(size):\n print theArray[j],\n\n\n\narrayA = [23, 47, 81, 95]\narrayB = [7, 14, 39, 55, 62, 74]\narrayC = []\nmerge(arrayA, 4, arrayB, 6, arrayC)\ndisplay(arrayC, 10)\n",
+ "input": [
+ " \n",
+ "# merge A and B into C\n",
+ "def merge(arrayA,sizeA,arrayB,sizeB,arrayC ):\n",
+ " aDex=0\n",
+ " bDex=0\n",
+ " cDex=0\n",
+ " while(aDex < sizeA and bDex < sizeB): # neither array empty\n",
+ " if( arrayA[aDex] < arrayB[bDex] ):\n",
+ " arrayC.append(arrayA[aDex])\n",
+ " cDex += 1\n",
+ " aDex += 1\n",
+ " else:\n",
+ " arrayC.append(arrayB[bDex])\n",
+ " cDex += 1\n",
+ " bDex += 1\n",
+ " while(aDex < sizeA):\n",
+ " arrayC.append(arrayA[aDex])\n",
+ " cDex += 1\n",
+ " aDex += 1\n",
+ " while(bDex < sizeB):\n",
+ " arrayC.append(arrayB[bDex]) # but arrayB isnt\n",
+ " cDex +=1\n",
+ " bDex += 1\n",
+ "\n",
+ "def display(theArray,size):\n",
+ " for j in range(size):\n",
+ " print theArray[j],\n",
+ "\n",
+ "\n",
+ "\n",
+ "arrayA = [23, 47, 81, 95]\n",
+ "arrayB = [7, 14, 39, 55, 62, 74]\n",
+ "arrayC = []\n",
+ "merge(arrayA, 4, arrayB, 6, arrayC)\n",
+ "display(arrayC, 10)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "7 14 23 39 47 55 62 74 81 95\n"
+ "text": [
+ "7 14 23 39 47 55 62 74 81 95\n"
+ ]
}
],
"prompt_number": 15
@@ -144,19 +352,97 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.6 Page no : 288"
+ "source": [
+ "Example 6.6 Page no : 288"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 6.6\ndemonstrates recursive merge sort\n'''\n\nclass DArray:\n def __init__(self,m):\n self.theArray = []\n self.nElems = 0\n \n def insert(self,value):\n self.theArray.append(value)\n self.nElems += 1\n\n def display(self): # displays array contents\n for j in range(self.nElems):\n print self.theArray[j] ,\n print ''\n\n def mergeSort(self):\n workSpace = []\n for i in range(self.nElems):\n workSpace.append(0)\n self.recMergeSort(workSpace, 0, self.nElems-1)\n\n def recMergeSort(self,workSpace, lowerBound,upperBound):\n if(lowerBound == upperBound): # if range is 1,\n return\n else:\n mid = (lowerBound+upperBound) / 2\n self.recMergeSort(workSpace, lowerBound, mid)\n self.recMergeSort(workSpace, mid+1, upperBound)\n self.merge(workSpace, lowerBound, mid+1, upperBound)\n\n def merge(self,workSpace,lowPtr,highPtr,upperBound):\n j = 0\n lowerBound = lowPtr\n mid = highPtr-1\n n = upperBound-lowerBound+1\n while(lowPtr <= mid and highPtr <= upperBound):\n if( self.theArray[lowPtr] < self.theArray[highPtr] ):\n workSpace[j] = self.theArray[lowPtr]\n j += 1\n lowPtr += 1\n else:\n workSpace[j] = self.theArray[highPtr]\n j += 1\n highPtr += 1\n while(lowPtr <= mid):\n workSpace[j] = self.theArray[lowPtr]\n j += 1\n lowPtr += 1\n while(highPtr <= upperBound):\n workSpace[j] = self.theArray[highPtr]\n j += 1\n highPtr += 1\n for j in range(n):\n self.theArray[lowerBound+j] = workSpace[j]\n\nmaxSize = 100 # array size\narr = DArray(maxSize) # create the array\narr.insert(64) # insert items\narr.insert(21) \narr.insert(33) \narr.insert(70) \narr.insert(12) \narr.insert(85) \narr.insert(44) \narr.insert(3) \narr.insert(99) \narr.insert(0) \narr.insert(108) \narr.insert(36) \narr.display() # display items\narr.mergeSort() # merge sort the array\narr.display() # display items again",
+ "input": [
+ " \n",
+ "class DArray:\n",
+ " def __init__(self,m):\n",
+ " self.theArray = []\n",
+ " self.nElems = 0\n",
+ " \n",
+ " def insert(self,value):\n",
+ " self.theArray.append(value)\n",
+ " self.nElems += 1\n",
+ "\n",
+ " def display(self): # displays array contents\n",
+ " for j in range(self.nElems):\n",
+ " print self.theArray[j] ,\n",
+ " print ''\n",
+ "\n",
+ " def mergeSort(self):\n",
+ " workSpace = []\n",
+ " for i in range(self.nElems):\n",
+ " workSpace.append(0)\n",
+ " self.recMergeSort(workSpace, 0, self.nElems-1)\n",
+ "\n",
+ " def recMergeSort(self,workSpace, lowerBound,upperBound):\n",
+ " if(lowerBound == upperBound): # if range is 1,\n",
+ " return\n",
+ " else:\n",
+ " mid = (lowerBound+upperBound) / 2\n",
+ " self.recMergeSort(workSpace, lowerBound, mid)\n",
+ " self.recMergeSort(workSpace, mid+1, upperBound)\n",
+ " self.merge(workSpace, lowerBound, mid+1, upperBound)\n",
+ "\n",
+ " def merge(self,workSpace,lowPtr,highPtr,upperBound):\n",
+ " j = 0\n",
+ " lowerBound = lowPtr\n",
+ " mid = highPtr-1\n",
+ " n = upperBound-lowerBound+1\n",
+ " while(lowPtr <= mid and highPtr <= upperBound):\n",
+ " if( self.theArray[lowPtr] < self.theArray[highPtr] ):\n",
+ " workSpace[j] = self.theArray[lowPtr]\n",
+ " j += 1\n",
+ " lowPtr += 1\n",
+ " else:\n",
+ " workSpace[j] = self.theArray[highPtr]\n",
+ " j += 1\n",
+ " highPtr += 1\n",
+ " while(lowPtr <= mid):\n",
+ " workSpace[j] = self.theArray[lowPtr]\n",
+ " j += 1\n",
+ " lowPtr += 1\n",
+ " while(highPtr <= upperBound):\n",
+ " workSpace[j] = self.theArray[highPtr]\n",
+ " j += 1\n",
+ " highPtr += 1\n",
+ " for j in range(n):\n",
+ " self.theArray[lowerBound+j] = workSpace[j]\n",
+ "\n",
+ "maxSize = 100 # array size\n",
+ "arr = DArray(maxSize) # create the array\n",
+ "arr.insert(64) # insert items\n",
+ "arr.insert(21) \n",
+ "arr.insert(33) \n",
+ "arr.insert(70) \n",
+ "arr.insert(12) \n",
+ "arr.insert(85) \n",
+ "arr.insert(44) \n",
+ "arr.insert(3) \n",
+ "arr.insert(99) \n",
+ "arr.insert(0) \n",
+ "arr.insert(108) \n",
+ "arr.insert(36) \n",
+ "arr.display() # display items\n",
+ "arr.mergeSort() # merge sort the array\n",
+ "arr.display() # display items again"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "64 21 33 70 12 85 44 3 99 0 108 36 \n0 3 12 21 33 36 44 64 70 85 99 108 \n"
+ "text": [
+ "64 21 33 70 12 85 44 3 99 0 108 36 \n",
+ "0 3 12 21 33 36 44 64 70 85 99 108 \n"
+ ]
}
],
"prompt_number": 16
@@ -165,30 +451,120 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.7 Page No :295"
+ "source": [
+ "Example 6.7 Page No :295"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 6.7\nevaluates triangular numbers, stack replaces recursion\n'''\nclass Params: #parameters to save on stack\n def __init__(self,nn, ra):\n self.n=nn\n self.returnAddress=ra\n\nclass StackX:\n def __init__(self,s):\n self.maxSize = s\n self.stackArray = []\n self.top = -1\n\n def push(self,j):\n self.top += 1\n self.stackArray.append(j)\n \n def pop(self):\n p = self.stackArray[self.top]\n self.top -= 1\n self.stackArray.remove(p)\n return p\n \n def peek(self):\n return self.stackArray[self.top]\n\n def isEmpty(self):\n return (self.top == -1)\n\n def isFull(self):\n return (self.top == self.maxSize-1);\n\ntheNumber = 0\ntheAnswer = 0\ntheStack = None\ncodePart = 0\ntheseParams = None\ndef recTriangle():\n global theStack,codePart\n theStack = StackX(10000)\n codePart = 1\n while( step() == False): # call step() until it's true\n pass\n\ndef step():\n global theStack,codePart,theseParams,theAnswer,theNumber\n if codePart==1:\n # initial call\n theseParams = Params(theNumber, 6)\n theStack.push(theseParams);\n codePart = 2\n elif codePart==2:\n # method entry\n theseParams = theStack.peek()\n if(theseParams.n == 1):\n theAnswer = 1\n codePart = 5\n else:\n codePart = 3\n elif codePart==3:\n newParams = Params(theseParams.n - 1, 4)\n theStack.push(newParams)\n codePart = 2 # go enter method\n elif codePart==4:\n theseParams = theStack.peek()\n theAnswer = theAnswer + theseParams.n\n codePart = 5\n elif codePart==5: # method exit\n theseParams = theStack.peek()\n codePart = theseParams.returnAddress # (4 or 6)\n theStack.pop()\n elif codePart==6: # return point\n return True\n else:\n pass\n return False\n\nprint 'Enter a number: ' ,\ntheNumber = int(raw_input())\nrecTriangle()\nprint 'Triangle = ' ,theAnswer\n\n",
+ "input": [
+ " \n",
+ "class Params: #parameters to save on stack\n",
+ " def __init__(self,nn, ra):\n",
+ " self.n=nn\n",
+ " self.returnAddress=ra\n",
+ "\n",
+ "class StackX:\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.stackArray = []\n",
+ " self.top = -1\n",
+ "\n",
+ " def push(self,j):\n",
+ " self.top += 1\n",
+ " self.stackArray.append(j)\n",
+ " \n",
+ " def pop(self):\n",
+ " p = self.stackArray[self.top]\n",
+ " self.top -= 1\n",
+ " self.stackArray.remove(p)\n",
+ " return p\n",
+ " \n",
+ " def peek(self):\n",
+ " return self.stackArray[self.top]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return (self.top == -1)\n",
+ "\n",
+ " def isFull(self):\n",
+ " return (self.top == self.maxSize-1);\n",
+ "\n",
+ "theNumber = 0\n",
+ "theAnswer = 0\n",
+ "theStack = None\n",
+ "codePart = 0\n",
+ "theseParams = None\n",
+ "def recTriangle():\n",
+ " global theStack,codePart\n",
+ " theStack = StackX(10000)\n",
+ " codePart = 1\n",
+ " while( step() == False): # call step() until it's true\n",
+ " pass\n",
+ "\n",
+ "def step():\n",
+ " global theStack,codePart,theseParams,theAnswer,theNumber\n",
+ " if codePart==1:\n",
+ " # initial call\n",
+ " theseParams = Params(theNumber, 6)\n",
+ " theStack.push(theseParams);\n",
+ " codePart = 2\n",
+ " elif codePart==2:\n",
+ " # method entry\n",
+ " theseParams = theStack.peek()\n",
+ " if(theseParams.n == 1):\n",
+ " theAnswer = 1\n",
+ " codePart = 5\n",
+ " else:\n",
+ " codePart = 3\n",
+ " elif codePart==3:\n",
+ " newParams = Params(theseParams.n - 1, 4)\n",
+ " theStack.push(newParams)\n",
+ " codePart = 2 # go enter method\n",
+ " elif codePart==4:\n",
+ " theseParams = theStack.peek()\n",
+ " theAnswer = theAnswer + theseParams.n\n",
+ " codePart = 5\n",
+ " elif codePart==5: # method exit\n",
+ " theseParams = theStack.peek()\n",
+ " codePart = theseParams.returnAddress # (4 or 6)\n",
+ " theStack.pop()\n",
+ " elif codePart==6: # return point\n",
+ " return True\n",
+ " else:\n",
+ " pass\n",
+ " return False\n",
+ "\n",
+ "print 'Enter a number: ' ,\n",
+ "theNumber = int(raw_input())\n",
+ "recTriangle()\n",
+ "print 'Triangle = ' ,theAnswer\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a number: "
+ "text": [
+ "Enter a number: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "100\n"
+ "text": [
+ "100\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Triangle = 5050\n"
+ "text": [
+ " Triangle = 5050\n"
+ ]
}
],
"prompt_number": 17
@@ -197,30 +573,89 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.8 Page no : 301"
+ "source": [
+ "Example 6.8 Page no : 301"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 6.8\nevaluates triangular numbers, stack replaces recursion\n'''\n\n\nclass StackX:\n def __init__(self,s):\n self.maxSize = s\n self.stackArray = []\n self.top = -1\n\n def push(self,j):\n self.top += 1\n self.stackArray.append(j)\n \n def pop(self):\n p = self.stackArray[self.top]\n self.top -= 1\n self.stackArray.remove(p)\n return p\n \n def peek(self):\n return self.stackArray[self.top]\n\n def isEmpty(self):\n return (self.top == -1)\n\n def isFull(self):\n return (self.top == self.maxSize-1);\ntheNumber = 0\ntheAnswer = 0\ntheStack = None\ntheseParams = None\n\ndef stackTriangle():\n global theNumber,theAnswer,theStack,theNumber\n theStack = StackX(10000)\n theAnswer = 0\n while(theNumber > 0): # until n is 1,\n theStack.push(theNumber) # push value\n theNumber -= 1 # decrement value\n\n while( not theStack.isEmpty() ): # until stack empty,\n newN = theStack.pop() # pop value,\n theAnswer += newN\n\nprint 'Enter a number: ' ,\ntheNumber = int(raw_input())\nstackTriangle()\nprint 'Triangle = ' ,theAnswer\n\n\n",
+ "input": [
+ " \n",
+ "\n",
+ "\n",
+ "class StackX:\n",
+ " def __init__(self,s):\n",
+ " self.maxSize = s\n",
+ " self.stackArray = []\n",
+ " self.top = -1\n",
+ "\n",
+ " def push(self,j):\n",
+ " self.top += 1\n",
+ " self.stackArray.append(j)\n",
+ " \n",
+ " def pop(self):\n",
+ " p = self.stackArray[self.top]\n",
+ " self.top -= 1\n",
+ " self.stackArray.remove(p)\n",
+ " return p\n",
+ " \n",
+ " def peek(self):\n",
+ " return self.stackArray[self.top]\n",
+ "\n",
+ " def isEmpty(self):\n",
+ " return (self.top == -1)\n",
+ "\n",
+ " def isFull(self):\n",
+ " return (self.top == self.maxSize-1);\n",
+ "theNumber = 0\n",
+ "theAnswer = 0\n",
+ "theStack = None\n",
+ "theseParams = None\n",
+ "\n",
+ "def stackTriangle():\n",
+ " global theNumber,theAnswer,theStack,theNumber\n",
+ " theStack = StackX(10000)\n",
+ " theAnswer = 0\n",
+ " while(theNumber > 0): # until n is 1,\n",
+ " theStack.push(theNumber) # push value\n",
+ " theNumber -= 1 # decrement value\n",
+ "\n",
+ " while( not theStack.isEmpty() ): # until stack empty,\n",
+ " newN = theStack.pop() # pop value,\n",
+ " theAnswer += newN\n",
+ "\n",
+ "print 'Enter a number: ' ,\n",
+ "theNumber = int(raw_input())\n",
+ "stackTriangle()\n",
+ "print 'Triangle = ' ,theAnswer\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a number: "
+ "text": [
+ "Enter a number: "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "50\n"
+ "text": [
+ "50\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Triangle = 1275\n"
+ "text": [
+ " Triangle = 1275\n"
+ ]
}
],
"prompt_number": 18
@@ -228,7 +663,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch7.ipynb b/Data_Structures_and_Algorithms_in_Java/ch7.ipynb
index 52523fdc..8b6e1954 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch7.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch7"
+ "name": "",
+ "signature": "sha256:a1b30e83d81b2cbf128e785184057c842d4480c1f2796f1d1e7e78372f935c78"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,83 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 7 : Advanced Sorting "
+ "source": [
+ "Chapter 7 : Advanced Sorting "
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 7.1 Page no : 321"
+ "source": [
+ "Example 7.1 Page no : 321"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nExample 7.1\ndemonstrates shell sort\n'''\n\nclass ArraySh:\n def __init__(self,m): # constructor\n self.theArray = [] # create the array\n self.nElems = 0 # no items yet\n\n def insert(self,value): # put element into array\n self.theArray.append(value) # insert it\n self.nElems+=1 # increment size\n\n def display(self): # displays array contents\n print 'A=' , \n for j in range(self.nElems): # for each element,\n print self.theArray[j] , # display it\n print ''\n\n def shellSort(self):\n inner = 0\n outer = 0\n temp = 0\n h = 1\n while(h <= self.nElems/3):\n h = h*3 + 1\n while(h>0):\n # find initial value of h\n # (1, 4, 13, 40, 121, ...)\n # decreasing h, until h=1\n # h-sort the file\n for outer in range(h,self.nElems):\n temp = self.theArray[outer]\n inner = outer\n # one subpass (eg 0, 4, 8)\n while(inner > h-1 and self.theArray[inner-h] >= temp):\n self.theArray[inner] = self.theArray[inner-h]\n inner -= h\n self.theArray[inner] = temp\n h = (h-1) / 3\n\nmaxSize = 10 # array size\narr = ArraySh(maxSize) # create the array\nimport random\nfor j in range(maxSize): # fill array with\n # random numbers\n n = int(random.random()*99)\n arr.insert(n)\n\narr.display() # display unsorted array\narr.shellSort() # shell sort the array\narr.display() # display sorted array",
+ "input": [
+ " \n",
+ "\n",
+ "class ArraySh:\n",
+ " def __init__(self,m): # constructor\n",
+ " self.theArray = [] # create the array\n",
+ " self.nElems = 0 # no items yet\n",
+ "\n",
+ " def insert(self,value): # put element into array\n",
+ " self.theArray.append(value) # insert it\n",
+ " self.nElems+=1 # increment size\n",
+ "\n",
+ " def display(self): # displays array contents\n",
+ " print 'A=' , \n",
+ " for j in range(self.nElems): # for each element,\n",
+ " print self.theArray[j] , # display it\n",
+ " print ''\n",
+ "\n",
+ " def shellSort(self):\n",
+ " inner = 0\n",
+ " outer = 0\n",
+ " temp = 0\n",
+ " h = 1\n",
+ " while(h <= self.nElems/3):\n",
+ " h = h*3 + 1\n",
+ " while(h>0):\n",
+ " # find initial value of h\n",
+ " # (1, 4, 13, 40, 121, ...)\n",
+ " # decreasing h, until h=1\n",
+ " # h-sort the file\n",
+ " for outer in range(h,self.nElems):\n",
+ " temp = self.theArray[outer]\n",
+ " inner = outer\n",
+ " # one subpass (eg 0, 4, 8)\n",
+ " while(inner > h-1 and self.theArray[inner-h] >= temp):\n",
+ " self.theArray[inner] = self.theArray[inner-h]\n",
+ " inner -= h\n",
+ " self.theArray[inner] = temp\n",
+ " h = (h-1) / 3\n",
+ "\n",
+ "maxSize = 10 # array size\n",
+ "arr = ArraySh(maxSize) # create the array\n",
+ "import random\n",
+ "for j in range(maxSize): # fill array with\n",
+ " # random numbers\n",
+ " n = int(random.random()*99)\n",
+ " arr.insert(n)\n",
+ "\n",
+ "arr.display() # display unsorted array\n",
+ "arr.shellSort() # shell sort the array\n",
+ "arr.display() # display sorted array"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "A= 35 47 88 24 10 98 14 75 97 38 \nA= 10 14 24 35 38 47 75 88 97 98 \n"
+ "text": [
+ "A= 35 47 88 24 10 98 14 75 97 38 \n",
+ "A= 10 14 24 35 38 47 75 88 97 98 \n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +97,83 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 7.2 Page No 327"
+ "source": [
+ "Example 7.2 Page No 327"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 7.2\ndemonstrates partitioning an array\n'''\nclass ArrayPar:\n def __init__(self,m): # constructor\n self.theArray = [] # create the array\n self.nElems = 0 # no items yet\n\n def insert(self,value): # put element into array\n self.theArray.append(value) # insert it\n self.nElems += 1 # increment size\n\n def size(self): # return number of items\n return self.nElems \n\n def display(self): # displays array contents\n print 'A=' ,\n for j in range(self.nElems): # for each element,\n print self.theArray[j] , # display it\n print ''\n\n def partitionIt(self,left,right,pivot):\n leftPtr = left - 1 # right of first elem\n rightPtr = right + 1 # left of pivot\n while(True):\n leftPtr += 1\n while(leftPtr < right ):\n leftPtr += 1\n if self.theArray[leftPtr] < pivot:\n break\n while(rightPtr > left ):# find smaller item\n rightPtr -= 1\n if self.theArray[rightPtr] > pivot:\n break;\n if(leftPtr >= rightPtr): # if pointers cross,\n break\n else: # not crossed, so\n self.swap(leftPtr, rightPtr)\n return leftPtr\n\n def swap(self,dex1,dex2): # swap two elements\n temp = self.theArray[dex1] # A into temp\n self.theArray[dex1] = self.theArray[dex2] # B into A\n self.theArray[dex2] = temp # temp into BPartitioning\n\nmaxSize = 16 # array size\narr = ArrayPar(maxSize) # create the array\nimport random\nfor j in range(maxSize): # fill array with\n # random numbers\n n = int(random.random()*199)\n arr.insert(n)\narr.display() # display unsorted array\npivot = 99 # pivot value\nprint \"Pivot is \", pivot ,\nsize = arr.size() # partition array\npartDex = arr.partitionIt(0, size-1, pivot)\nprint \", Partition is at index \" , partDex \narr.display() # display partitioned array",
+ "input": [
+ " \n",
+ "class ArrayPar:\n",
+ " def __init__(self,m): # constructor\n",
+ " self.theArray = [] # create the array\n",
+ " self.nElems = 0 # no items yet\n",
+ "\n",
+ " def insert(self,value): # put element into array\n",
+ " self.theArray.append(value) # insert it\n",
+ " self.nElems += 1 # increment size\n",
+ "\n",
+ " def size(self): # return number of items\n",
+ " return self.nElems \n",
+ "\n",
+ " def display(self): # displays array contents\n",
+ " print 'A=' ,\n",
+ " for j in range(self.nElems): # for each element,\n",
+ " print self.theArray[j] , # display it\n",
+ " print ''\n",
+ "\n",
+ " def partitionIt(self,left,right,pivot):\n",
+ " leftPtr = left - 1 # right of first elem\n",
+ " rightPtr = right + 1 # left of pivot\n",
+ " while(True):\n",
+ " leftPtr += 1\n",
+ " while(leftPtr < right ):\n",
+ " leftPtr += 1\n",
+ " if self.theArray[leftPtr] < pivot:\n",
+ " break\n",
+ " while(rightPtr > left ):# find smaller item\n",
+ " rightPtr -= 1\n",
+ " if self.theArray[rightPtr] > pivot:\n",
+ " break;\n",
+ " if(leftPtr >= rightPtr): # if pointers cross,\n",
+ " break\n",
+ " else: # not crossed, so\n",
+ " self.swap(leftPtr, rightPtr)\n",
+ " return leftPtr\n",
+ "\n",
+ " def swap(self,dex1,dex2): # swap two elements\n",
+ " temp = self.theArray[dex1] # A into temp\n",
+ " self.theArray[dex1] = self.theArray[dex2] # B into A\n",
+ " self.theArray[dex2] = temp # temp into BPartitioning\n",
+ "\n",
+ "maxSize = 16 # array size\n",
+ "arr = ArrayPar(maxSize) # create the array\n",
+ "import random\n",
+ "for j in range(maxSize): # fill array with\n",
+ " # random numbers\n",
+ " n = int(random.random()*199)\n",
+ " arr.insert(n)\n",
+ "arr.display() # display unsorted array\n",
+ "pivot = 99 # pivot value\n",
+ "print \"Pivot is \", pivot ,\n",
+ "size = arr.size() # partition array\n",
+ "partDex = arr.partitionIt(0, size-1, pivot)\n",
+ "print \", Partition is at index \" , partDex \n",
+ "arr.display() # display partitioned array"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "A= 114 43 4 72 43 6 41 78 25 107 19 18 191 116 108 10 \nPivot is 99 , Partition is at index 9\nA= 114 108 4 116 43 191 41 107 25 78 19 18 6 72 43 10 \n"
+ "text": [
+ "A= 114 43 4 72 43 6 41 78 25 107 19 18 191 116 108 10 \n",
+ "Pivot is 99 , Partition is at index 9\n",
+ "A= 114 108 4 116 43 191 41 107 25 78 19 18 6 72 43 10 \n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +182,90 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 7.3 Page no : 337"
+ "source": [
+ "Example 7.3 Page no : 337"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 7.3\ndemonstrates simple version of quick sort\n'''\nclass ArrayIns:\n def __init__(self,m):\n self.theArray = [] # create the array\n self.nElems = 0 # no items yet\n\n def insert(self,value): # put element into array\n self.theArray.append( value) # insert it\n self.nElems += 1 # increment size\n\n def display(self): # displays array contents\n print 'A=' ,\n for j in range(self.nElems): # for each element,\n print self.theArray[j] , # display it\n print ''\n def quickSort(self):\n self.recQuickSort(0, self.nElems-1)\n\n def recQuickSort(self,left,right):\n if(right-left <= 0): # if size <= 1,\n return # already sorted\n else: # size is 2 or larger\n pivot = self.theArray[right] # rightmost item\n # partition range\n partition = self.partitionIt(left, right, pivot)\n self.recQuickSort(left, partition-1) # sort left side\n self.recQuickSort(partition+1, right) # sort right side\n\n def partitionIt(self,start, end,pivot):\n bottom = start-1 # Start outside the area to be partitioned\n top = end # Ditto\n done = 0\n while not done: # Until all elements are partitioned...\n while not done: # Until we find an out of place element...\n bottom = bottom+1 # ... move the bottom up.\n if bottom == top: # If we hit the top...\n done = 1 # ... we are done.\n break\n if self.theArray[bottom] > pivot: # Is the bottom out of place?\n self.theArray[top] = self.theArray[bottom] # Then put it at the top...\n break # ... and start searching from the top.\n while not done: # Until we find an out of place element...\n top = top-1 # ... move the top down.\n \n if top == bottom: # If we hit the bottom...\n done = 1 # ... we are done.\n break\n \n if self.theArray[top] < pivot: # Is the top out of place?\n self.theArray[bottom] = self.theArray[top] # Then put it at the bottom...\n break # ...and start searching from the bottom.\n\n self.theArray[top] = pivot # Put the pivot in its place.\n return top # Return the split point\n\nmaxSize = 16 # array size\narr = ArrayIns(maxSize) # create array\nimport random\nfor j in range(maxSize): # fill array with\n # random numbers\n n = int(random.random()*99)\n arr.insert(n)\narr.display() # display items\narr.quickSort() # quicksort them\narr.display() # display them again",
+ "input": [
+ " \n",
+ "class ArrayIns:\n",
+ " def __init__(self,m):\n",
+ " self.theArray = [] # create the array\n",
+ " self.nElems = 0 # no items yet\n",
+ "\n",
+ " def insert(self,value): # put element into array\n",
+ " self.theArray.append( value) # insert it\n",
+ " self.nElems += 1 # increment size\n",
+ "\n",
+ " def display(self): # displays array contents\n",
+ " print 'A=' ,\n",
+ " for j in range(self.nElems): # for each element,\n",
+ " print self.theArray[j] , # display it\n",
+ " print ''\n",
+ " def quickSort(self):\n",
+ " self.recQuickSort(0, self.nElems-1)\n",
+ "\n",
+ " def recQuickSort(self,left,right):\n",
+ " if(right-left <= 0): # if size <= 1,\n",
+ " return # already sorted\n",
+ " else: # size is 2 or larger\n",
+ " pivot = self.theArray[right] # rightmost item\n",
+ " # partition range\n",
+ " partition = self.partitionIt(left, right, pivot)\n",
+ " self.recQuickSort(left, partition-1) # sort left side\n",
+ " self.recQuickSort(partition+1, right) # sort right side\n",
+ "\n",
+ " def partitionIt(self,start, end,pivot):\n",
+ " bottom = start-1 # Start outside the area to be partitioned\n",
+ " top = end # Ditto\n",
+ " done = 0\n",
+ " while not done: # Until all elements are partitioned...\n",
+ " while not done: # Until we find an out of place element...\n",
+ " bottom = bottom+1 # ... move the bottom up.\n",
+ " if bottom == top: # If we hit the top...\n",
+ " done = 1 # ... we are done.\n",
+ " break\n",
+ " if self.theArray[bottom] > pivot: # Is the bottom out of place?\n",
+ " self.theArray[top] = self.theArray[bottom] # Then put it at the top...\n",
+ " break # ... and start searching from the top.\n",
+ " while not done: # Until we find an out of place element...\n",
+ " top = top-1 # ... move the top down.\n",
+ " \n",
+ " if top == bottom: # If we hit the bottom...\n",
+ " done = 1 # ... we are done.\n",
+ " break\n",
+ " \n",
+ " if self.theArray[top] < pivot: # Is the top out of place?\n",
+ " self.theArray[bottom] = self.theArray[top] # Then put it at the bottom...\n",
+ " break # ...and start searching from the bottom.\n",
+ "\n",
+ " self.theArray[top] = pivot # Put the pivot in its place.\n",
+ " return top # Return the split point\n",
+ "\n",
+ "maxSize = 16 # array size\n",
+ "arr = ArrayIns(maxSize) # create array\n",
+ "import random\n",
+ "for j in range(maxSize): # fill array with\n",
+ " # random numbers\n",
+ " n = int(random.random()*99)\n",
+ " arr.insert(n)\n",
+ "arr.display() # display items\n",
+ "arr.quickSort() # quicksort them\n",
+ "arr.display() # display them again"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "A= 63 42 31 37 74 79 6 76 0 5 7 6 82 48 26 70 \nA= 0 5 6 6 7 26 31 37 42 48 63 70 74 76 79 82 \n"
+ "text": [
+ "A= 63 42 31 37 74 79 6 76 0 5 7 6 82 48 26 70 \n",
+ "A= 0 5 6 6 7 26 31 37 42 48 63 70 74 76 79 82 \n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +274,122 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 7.4 Page No : 347"
+ "source": [
+ "Example 7.4 Page No : 347"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 7.4\ndemonstrates quick sort with median-of-three partitioning\n'''\nclass ArrayIns:\n def __init__(self,m):\n self.theArray = [] # create the array\n self.nElems = 0 # no items yet\n\n def insert(self,value): # put element into array\n self.theArray.append(value) # insert it\n self.nElems+=1 # increment size\n\n def display(self): # displays array contents\n print 'A=' ,\n for j in self.theArray:\n print j , \n print ''\n \n def quickSort(self):\n self.recQuickSort(0, self.nElems-1)\n\n def recQuickSort(self,left,right):\n size = right-left+1\n if(size <= 3): # manual sort if small\n self.manualSort(left, right)\n else:\n median = self.medianOf3(left, right)\n partition = self.partitionIt(left, right, median)\n self.recQuickSort(left, partition-1)\n self.recQuickSort(partition+1, right)\n\n def partitionIt(self,start, end,pivot):\n bottom = start-1 # Start outside the area to be partitioned\n top = end # Ditto\n done = 0\n while not done: # Until all elements are partitioned...\n while not done: # Until we find an out of place element...\n bottom = bottom+1 # ... move the bottom up.\n if bottom == top: # If we hit the top...\n done = 1 # ... we are done.\n break\n if self.theArray[bottom] > pivot: # Is the bottom out of place?\n self.theArray[top] = self.theArray[bottom] # Then put it at the top...\n break # ... and start searching from the top.\n while not done: # Until we find an out of place element...\n top = top-1 # ... move the top down.\n \n if top == bottom: # If we hit the bottom...\n done = 1 # ... we are done.\n break\n \n if self.theArray[top] < pivot: # Is the top out of place?\n self.theArray[bottom] = self.theArray[top] # Then put it at the bottom...\n break # ...and start searching from the bottom.\n\n self.theArray[top] = pivot # Put the pivot in its place.\n return top # Return the split point \n \n \n \n def medianOf3(self,left, right):\n center = (left+right)/2 # order left & center\n if( self.theArray[left] > self.theArray[center] ):\n self.theArray[left],self.theArray[center] = self.theArray[center],self.theArray[left]\n if( self.theArray[left] > self.theArray[right] ):\n self.theArray[left],self.theArray[right] = self.theArray[right],self.theArray[left]\n if( self.theArray[center] > self.theArray[right] ):\n self.theArray[right],self.theArray[center] = self.theArray[center],self.theArray[right]\n self.theArray[right-1],self.theArray[center] = self.theArray[center],self.theArray[right-1] # put pivot on right\n return self.theArray[right-1] # return median value\n\n def manualSort(self,left,right):\n size = right-left+1\n if(size <= 1):\n return # no sort necessary\n if(size == 2): # 2-sort left and right\n if( self.theArray[left] > self.theArray[right] ):\n self.theArray[right],self.theArray[left] = self.theArray[left],self.theArray[right]\n return\n else: # size is 3\n # 3-sort left, center, & right\n if( self.theArray[left] > self.theArray[right-1] ):\n self.theArray[right-1],self.theArray[left] = self.theArray[left],self.theArray[right-1] # left, center\n if( self.theArray[left] > self.theArray[right] ):\n self.theArray[right],self.theArray[left] = self.theArray[left],self.theArray[right] # left, right\n if( self.theArray[right-1] > self.theArray[right] ):\n self.theArray[right-1],self.theArray[right] = self.theArray[right],self.theArray[right-1] # center, right\n\n\nmaxSize = 16 # array size\narr = ArrayIns(maxSize) # create array\nimport random\nfor j in range(maxSize): # fill array with\n # random numbers\n n = int(random.random()*99)\n arr.insert(n)\narr.display() # display items\narr.quickSort() # quicksort them\narr.display() # display them again",
+ "input": [
+ " \n",
+ "class ArrayIns:\n",
+ " def __init__(self,m):\n",
+ " self.theArray = [] # create the array\n",
+ " self.nElems = 0 # no items yet\n",
+ "\n",
+ " def insert(self,value): # put element into array\n",
+ " self.theArray.append(value) # insert it\n",
+ " self.nElems+=1 # increment size\n",
+ "\n",
+ " def display(self): # displays array contents\n",
+ " print 'A=' ,\n",
+ " for j in self.theArray:\n",
+ " print j , \n",
+ " print ''\n",
+ " \n",
+ " def quickSort(self):\n",
+ " self.recQuickSort(0, self.nElems-1)\n",
+ "\n",
+ " def recQuickSort(self,left,right):\n",
+ " size = right-left+1\n",
+ " if(size <= 3): # manual sort if small\n",
+ " self.manualSort(left, right)\n",
+ " else:\n",
+ " median = self.medianOf3(left, right)\n",
+ " partition = self.partitionIt(left, right, median)\n",
+ " self.recQuickSort(left, partition-1)\n",
+ " self.recQuickSort(partition+1, right)\n",
+ "\n",
+ " def partitionIt(self,start, end,pivot):\n",
+ " bottom = start-1 # Start outside the area to be partitioned\n",
+ " top = end # Ditto\n",
+ " done = 0\n",
+ " while not done: # Until all elements are partitioned...\n",
+ " while not done: # Until we find an out of place element...\n",
+ " bottom = bottom+1 # ... move the bottom up.\n",
+ " if bottom == top: # If we hit the top...\n",
+ " done = 1 # ... we are done.\n",
+ " break\n",
+ " if self.theArray[bottom] > pivot: # Is the bottom out of place?\n",
+ " self.theArray[top] = self.theArray[bottom] # Then put it at the top...\n",
+ " break # ... and start searching from the top.\n",
+ " while not done: # Until we find an out of place element...\n",
+ " top = top-1 # ... move the top down.\n",
+ " \n",
+ " if top == bottom: # If we hit the bottom...\n",
+ " done = 1 # ... we are done.\n",
+ " break\n",
+ " \n",
+ " if self.theArray[top] < pivot: # Is the top out of place?\n",
+ " self.theArray[bottom] = self.theArray[top] # Then put it at the bottom...\n",
+ " break # ...and start searching from the bottom.\n",
+ "\n",
+ " self.theArray[top] = pivot # Put the pivot in its place.\n",
+ " return top # Return the split point \n",
+ " \n",
+ " \n",
+ " \n",
+ " def medianOf3(self,left, right):\n",
+ " center = (left+right)/2 # order left & center\n",
+ " if( self.theArray[left] > self.theArray[center] ):\n",
+ " self.theArray[left],self.theArray[center] = self.theArray[center],self.theArray[left]\n",
+ " if( self.theArray[left] > self.theArray[right] ):\n",
+ " self.theArray[left],self.theArray[right] = self.theArray[right],self.theArray[left]\n",
+ " if( self.theArray[center] > self.theArray[right] ):\n",
+ " self.theArray[right],self.theArray[center] = self.theArray[center],self.theArray[right]\n",
+ " self.theArray[right-1],self.theArray[center] = self.theArray[center],self.theArray[right-1] # put pivot on right\n",
+ " return self.theArray[right-1] # return median value\n",
+ "\n",
+ " def manualSort(self,left,right):\n",
+ " size = right-left+1\n",
+ " if(size <= 1):\n",
+ " return # no sort necessary\n",
+ " if(size == 2): # 2-sort left and right\n",
+ " if( self.theArray[left] > self.theArray[right] ):\n",
+ " self.theArray[right],self.theArray[left] = self.theArray[left],self.theArray[right]\n",
+ " return\n",
+ " else: # size is 3\n",
+ " # 3-sort left, center, & right\n",
+ " if( self.theArray[left] > self.theArray[right-1] ):\n",
+ " self.theArray[right-1],self.theArray[left] = self.theArray[left],self.theArray[right-1] # left, center\n",
+ " if( self.theArray[left] > self.theArray[right] ):\n",
+ " self.theArray[right],self.theArray[left] = self.theArray[left],self.theArray[right] # left, right\n",
+ " if( self.theArray[right-1] > self.theArray[right] ):\n",
+ " self.theArray[right-1],self.theArray[right] = self.theArray[right],self.theArray[right-1] # center, right\n",
+ "\n",
+ "\n",
+ "maxSize = 16 # array size\n",
+ "arr = ArrayIns(maxSize) # create array\n",
+ "import random\n",
+ "for j in range(maxSize): # fill array with\n",
+ " # random numbers\n",
+ " n = int(random.random()*99)\n",
+ " arr.insert(n)\n",
+ "arr.display() # display items\n",
+ "arr.quickSort() # quicksort them\n",
+ "arr.display() # display them again"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "A= 93 28 45 24 83 16 56 62 26 13 62 49 29 89 63 18 \nA= 13 16 18 18 24 26 28 28 29 45 45 62 62 63 83 83 \n"
+ "text": [
+ "A= 93 28 45 24 83 16 56 62 26 13 62 49 29 89 63 18 \n",
+ "A= 13 16 18 18 24 26 28 28 29 45 45 62 62 63 83 83 \n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +398,116 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 7.5 Page No : 351"
+ "source": [
+ "Example 7.5 Page No : 351"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 7.5\ndemonstrates quick sort uses insertion sort for cleanup\n'''\nclass ArrayIns:\n def __init__(self,m):\n self.theArray = [] # create the array\n self.nElems = 0 # no items yet\n\n def insert(self,value): # put element into array\n self.theArray.append(value) # insert it\n self.nElems+=1 # increment size\n\n def display(self): # displays array contents\n print 'A=' ,\n for j in self.theArray:\n print j , \n print ''\n \n def quickSort(self):\n self.recQuickSort(0, self.nElems-1)\n\n def recQuickSort(self,left,right):\n size = right-left+1\n if(size <= 10): \n self.insertionSort(left, right)\n else:\n median = self.medianOf3(left, right)\n partition = self.partitionIt(left, right, median)\n self.recQuickSort(left, partition-1)\n self.recQuickSort(partition+1, right)\n\n def partitionIt(self,start, end,pivot):\n bottom = start-1 # Start outside the area to be partitioned\n top = end # Ditto\n done = 0\n while not done: # Until all elements are partitioned...\n while not done: # Until we find an out of place element...\n bottom = bottom+1 # ... move the bottom up.\n if bottom == top: # If we hit the top...\n done = 1 # ... we are done.\n break\n if self.theArray[bottom] > pivot: # Is the bottom out of place?\n self.theArray[top] = self.theArray[bottom] # Then put it at the top...\n break # ... and start searching from the top.\n while not done: # Until we find an out of place element...\n top = top-1 # ... move the top down.\n \n if top == bottom: # If we hit the bottom...\n done = 1 # ... we are done.\n break\n \n if self.theArray[top] < pivot: # Is the top out of place?\n self.theArray[bottom] = self.theArray[top] # Then put it at the bottom...\n break # ...and start searching from the bottom.\n\n self.theArray[top] = pivot # Put the pivot in its place.\n return top # Return the split point \n \n \n \n def medianOf3(self,left, right):\n center = (left+right)/2 # order left & center\n if( self.theArray[left] > self.theArray[center] ):\n self.theArray[left],self.theArray[center] = self.theArray[center],self.theArray[left]\n if( self.theArray[left] > self.theArray[right] ):\n self.theArray[left],self.theArray[right] = self.theArray[right],self.theArray[left]\n if( self.theArray[center] > self.theArray[right] ):\n self.theArray[right],self.theArray[center] = self.theArray[center],self.theArray[right]\n self.theArray[right-1],self.theArray[center] = self.theArray[center],self.theArray[right-1] # put pivot on right\n return self.theArray[right-1] # return median value\n\n def insertionSort(self,left,right):\n i = 0\n out = 0 # sorted on left of out\n for out in range(left+1,right+1):\n temp = self.theArray[out] # remove marked item\n i = out # start shifts at out\n # until one is smaller,\n while(i >left and self.theArray[i-1] >= temp):\n self.theArray[i] = self.theArray[i-1] # shift item to right\n i -= 1 # go left one position\n self.theArray[i] = temp # insert marked item\n\nmaxSize = 16 # array size\narr = ArrayIns(maxSize) # create array\nimport random\nfor j in range(maxSize): # fill array with\n # random numbers\n n = int(random.random()*99)\n arr.insert(n)\narr.display() # display items\narr.quickSort() # quicksort them\narr.display() # display them again",
+ "input": [
+ " \n",
+ "class ArrayIns:\n",
+ " def __init__(self,m):\n",
+ " self.theArray = [] # create the array\n",
+ " self.nElems = 0 # no items yet\n",
+ "\n",
+ " def insert(self,value): # put element into array\n",
+ " self.theArray.append(value) # insert it\n",
+ " self.nElems+=1 # increment size\n",
+ "\n",
+ " def display(self): # displays array contents\n",
+ " print 'A=' ,\n",
+ " for j in self.theArray:\n",
+ " print j , \n",
+ " print ''\n",
+ " \n",
+ " def quickSort(self):\n",
+ " self.recQuickSort(0, self.nElems-1)\n",
+ "\n",
+ " def recQuickSort(self,left,right):\n",
+ " size = right-left+1\n",
+ " if(size <= 10): \n",
+ " self.insertionSort(left, right)\n",
+ " else:\n",
+ " median = self.medianOf3(left, right)\n",
+ " partition = self.partitionIt(left, right, median)\n",
+ " self.recQuickSort(left, partition-1)\n",
+ " self.recQuickSort(partition+1, right)\n",
+ "\n",
+ " def partitionIt(self,start, end,pivot):\n",
+ " bottom = start-1 # Start outside the area to be partitioned\n",
+ " top = end # Ditto\n",
+ " done = 0\n",
+ " while not done: # Until all elements are partitioned...\n",
+ " while not done: # Until we find an out of place element...\n",
+ " bottom = bottom+1 # ... move the bottom up.\n",
+ " if bottom == top: # If we hit the top...\n",
+ " done = 1 # ... we are done.\n",
+ " break\n",
+ " if self.theArray[bottom] > pivot: # Is the bottom out of place?\n",
+ " self.theArray[top] = self.theArray[bottom] # Then put it at the top...\n",
+ " break # ... and start searching from the top.\n",
+ " while not done: # Until we find an out of place element...\n",
+ " top = top-1 # ... move the top down.\n",
+ " \n",
+ " if top == bottom: # If we hit the bottom...\n",
+ " done = 1 # ... we are done.\n",
+ " break\n",
+ " \n",
+ " if self.theArray[top] < pivot: # Is the top out of place?\n",
+ " self.theArray[bottom] = self.theArray[top] # Then put it at the bottom...\n",
+ " break # ...and start searching from the bottom.\n",
+ "\n",
+ " self.theArray[top] = pivot # Put the pivot in its place.\n",
+ " return top # Return the split point \n",
+ " \n",
+ " \n",
+ " \n",
+ " def medianOf3(self,left, right):\n",
+ " center = (left+right)/2 # order left & center\n",
+ " if( self.theArray[left] > self.theArray[center] ):\n",
+ " self.theArray[left],self.theArray[center] = self.theArray[center],self.theArray[left]\n",
+ " if( self.theArray[left] > self.theArray[right] ):\n",
+ " self.theArray[left],self.theArray[right] = self.theArray[right],self.theArray[left]\n",
+ " if( self.theArray[center] > self.theArray[right] ):\n",
+ " self.theArray[right],self.theArray[center] = self.theArray[center],self.theArray[right]\n",
+ " self.theArray[right-1],self.theArray[center] = self.theArray[center],self.theArray[right-1] # put pivot on right\n",
+ " return self.theArray[right-1] # return median value\n",
+ "\n",
+ " def insertionSort(self,left,right):\n",
+ " i = 0\n",
+ " out = 0 # sorted on left of out\n",
+ " for out in range(left+1,right+1):\n",
+ " temp = self.theArray[out] # remove marked item\n",
+ " i = out # start shifts at out\n",
+ " # until one is smaller,\n",
+ " while(i >left and self.theArray[i-1] >= temp):\n",
+ " self.theArray[i] = self.theArray[i-1] # shift item to right\n",
+ " i -= 1 # go left one position\n",
+ " self.theArray[i] = temp # insert marked item\n",
+ "\n",
+ "maxSize = 16 # array size\n",
+ "arr = ArrayIns(maxSize) # create array\n",
+ "import random\n",
+ "for j in range(maxSize): # fill array with\n",
+ " # random numbers\n",
+ " n = int(random.random()*99)\n",
+ " arr.insert(n)\n",
+ "arr.display() # display items\n",
+ "arr.quickSort() # quicksort them\n",
+ "arr.display() # display them again"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "A= 32 49 43 84 84 76 63 70 37 50 13 46 46 19 60 72 \nA= 13 19 32 32 37 43 46 49 50 60 63 70 70 76 84 84 \n"
+ "text": [
+ "A= 32 49 43 84 84 76 63 70 37 50 13 46 46 19 60 72 \n",
+ "A= 13 19 32 32 37 43 46 49 50 60 63 70 70 76 84 84 \n"
+ ]
}
],
"prompt_number": 5
@@ -121,7 +515,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Data_Structures_and_Algorithms_in_Java/ch8.ipynb b/Data_Structures_and_Algorithms_in_Java/ch8.ipynb
index 6e978756..5f108760 100644
--- a/Data_Structures_and_Algorithms_in_Java/ch8.ipynb
+++ b/Data_Structures_and_Algorithms_in_Java/ch8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch8"
+ "name": "",
+ "signature": "sha256:8af7b49cf811d590bd7b25dd4e6ee061b1b9e37ea11f5e8572f545bc4780f1b4"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,18 +12,253 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 8 : Binary Trees"
+ "source": [
+ "Chapter 8 : Binary Trees"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Exmaple 8.1 Page No : 406"
+ "source": [
+ "Exmaple 8.1 Page No : 406"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 8.1\ndemonstrates binary tree\n'''\n\n# for Stack class\nclass Node:\n def __init__(self):\n self.iData = None # data item (key)\n self.dData = None # data item\n self.leftChild = None # this nodes left child\n self.rightChild = None # this nodes right child\n\n def displayNode(self):\n # display ourself\n print '{' , self.iData , ',' ,self.dData , '}',\n\nclass Tree:\n def __init__(self):\n # constructor\n self.root = None # no nodes in tree \n\n def find(self,key): # find node with given key\n # (assumes non-empty tree)\n current = self.root # start at self.root\n while(current.iData != key): # while no match,\n if(key < current.iData): # go left?\n current = current.leftChild\n else: # or go right?\n current = current.rightChild\n if(current == None): # if no child,\n return None # didnt find it\n return current\n\n def insert(self,i,dd):\n newNode = Node() # make new node\n newNode.iData = i # insert data\n newNode.dData = dd\n if(self.root==None):# no node in self.root\n self.root = newNode\n else: # self.root occupied\n current = self.root # start at self.root\n while(True): # (exits internally)\n parent = current\n if(i < current.iData): # go left?\n current = current.leftChild\n if(current == None): # if end of the line,\n # insert on left\n parent.leftChild = newNode\n return\n else:# or go right?\n current = current.rightChild\n if(current == None): # if end of the line \n # insert on right\n parent.rightChild = newNode\n return\n\n def delete(self,key): # delete node with given key\n # (assumes non-empty list)\n current = self.root\n parent = self.root\n isLeftChild = True\n while(current.iData != key):\n parent = current\n if(key < current.iData):\n isLeftChild = True\n current = current.leftChild\n else:\n isLeftChild = False\n current = current.rightChild\n if(current == None):\n return False\n # if no children, simply delete it\n if(current.leftChild==None and current.rightChild==None):\n if(current == self.root): # if self.root,\n self.root = None # tree is empty\n elif(isLeftChild):\n parent.leftChild = None\n else:\n parent.rightChild = None\n\n elif(current.rightChild==None):\n if(current == self.root):\n self.root = current.leftChild\n elif(isLeftChild):\n parent.leftChild = current.leftChild\n else:\n parent.rightChild = current.leftChild # if no left child, replace with right subtree\n elif(current.leftChild==None):\n if(current == self.root):\n self.root = current.rightChild\n elif(isLeftChild):\n parent.leftChild = current.rightChild\n else:\n parent.rightChild = current.rightChild\n else: # two children, so replace with inorder successor\n # get successor of node to delete (current)\n successor = self.getSuccessor(current)\n # connect parent of current to successor instead\n if(current == self.root):\n self.root = successor\n elif(isLeftChild):\n parent.leftChild = successor\n else:\n parent.rightChild = successor\n # connect successor to currents left child\n successor.leftChild = current.leftChild\n return True\n\n def getSuccessor(self,delNode):\n successorParent = delNode\n successor = delNode\n current = delNode.rightChild # go to right child\n while(current != None): # until no more\n # left children,\n successorParent = successor\n successor = current\n current = current.leftChild # go to left child\n # if successor not\n if(successor != delNode.rightChild): # right child,\n # make connections\n successorParent.leftChild = successor.rightChild\n successor.rightChild = delNode.rightChild\n return successor\n\n def traverse(self,traverseType):\n if traverseType == 1:\n print '\\nPreorder traversal: ',\n self.preOrder(self.root)\n elif traverseType == 2:\n print '\\nInorder traversal: ',\n self.inOrder(self.root)\n else:\n print '\\nPostorder traversal: ',\n self.postOrder(self.root)\n print ''\n\n def preOrder(self, localroot):\n if(localroot != None):\n print localroot.iData ,\n self.preOrder(localroot.leftChild)\n self.preOrder(localroot.rightChild)\n\n def inOrder(self, localroot):\n if(localroot != None):\n self.inOrder(localroot.leftChild)\n print localroot.iData ,\n self.inOrder(localroot.rightChild)\n \n def postOrder(self, localroot):\n if(localroot != None):\n self.postOrder(localroot.leftChild)\n self.postOrder(localroot.rightChild)\n print localroot.iData ,\n\n def displayTree(self):\n globalStack = list()\n globalStack.append(self.root)\n nBlanks = 32\n isRowEmpty = False\n print '\\n......................................................'\n while(isRowEmpty==False):\n localStack = list()\n isRowEmpty = True\n for j in range(nBlanks):\n print ' ',\n while(globalStack is not None):\n temp = globalStack.pop()\n if(temp != None):\n print temp.iData,\n localStack.append(temp.leftChild)\n localStack.append(temp.rightChild)\n if(temp.leftChild != None or temp.rightChild != None):\n isRowEmpty = False\n else:\n print '--' ,\n localStack.push(None)\n localStack.push(None)\n for j in range(nBlanks*2-2):\n print ' ', # end while globalStack not empty\n \n print ''\n nBlanks /= 2\n while(localStack is not None):\n globalStack.append( localStack.pop() ) # end while isRowEmpty is false\n \n print '\\n......................................................'\n\ntheTree = Tree()\ntheTree.insert(50,1.5)\ntheTree.insert(25,1.2)\ntheTree.insert(75,1.7)\ntheTree.insert(12,1.5)\ntheTree.insert(37,1.2)\ntheTree.insert(43,1.7)\ntheTree.insert(30,1.5)\ntheTree.insert(33,1.2)\ntheTree.insert(87,1.7)\ntheTree.insert(93,1.5)\ntheTree.insert(97,1.5)\nwhile(True):\n print 'Enter first letter of show, '\n print 'insert, find, delete, or traverse: ',\n choice = raw_input()\n if choice == 's':\n theTree.displayTree()\n elif choice == 'i':\n print 'Enter value to insert: '\n value = int(raw_input())\n theTree.insert(value, value + 0.9)\n elif choice == 'f':\n print 'Enter value to find: ',\n value = int(raw_input())\n found = theTree.find(value)\n if(found != None):\n print 'Found: ', \n found.displayNode()\n print ''\n else:\n print 'Could not find', value \n elif choice=='d':\n print 'Enter value to delete: ',\n value = int(raw_input())\n didDelete = theTree.delete(value)\n if(didDelete):\n print 'Deleted ' , value \n else:\n print 'Could not delete ',value\n elif choice=='t':\n print 'Enter type 1, 2 or 3: '\n value = int(raw_input())\n theTree.traverse(value)\n else:\n print 'Invalid entry'\n",
+ "input": [
+ " \n",
+ "# for Stack class\n",
+ "class Node:\n",
+ " def __init__(self):\n",
+ " self.iData = None # data item (key)\n",
+ " self.dData = None # data item\n",
+ " self.leftChild = None # this nodes left child\n",
+ " self.rightChild = None # this nodes right child\n",
+ "\n",
+ " def displayNode(self):\n",
+ " # display ourself\n",
+ " print '{' , self.iData , ',' ,self.dData , '}',\n",
+ "\n",
+ "class Tree:\n",
+ " def __init__(self):\n",
+ " # constructor\n",
+ " self.root = None # no nodes in tree \n",
+ "\n",
+ " def find(self,key): # find node with given key\n",
+ " # (assumes non-empty tree)\n",
+ " current = self.root # start at self.root\n",
+ " while(current.iData != key): # while no match,\n",
+ " if(key < current.iData): # go left?\n",
+ " current = current.leftChild\n",
+ " else: # or go right?\n",
+ " current = current.rightChild\n",
+ " if(current == None): # if no child,\n",
+ " return None # didnt find it\n",
+ " return current\n",
+ "\n",
+ " def insert(self,i,dd):\n",
+ " newNode = Node() # make new node\n",
+ " newNode.iData = i # insert data\n",
+ " newNode.dData = dd\n",
+ " if(self.root==None):# no node in self.root\n",
+ " self.root = newNode\n",
+ " else: # self.root occupied\n",
+ " current = self.root # start at self.root\n",
+ " while(True): # (exits internally)\n",
+ " parent = current\n",
+ " if(i < current.iData): # go left?\n",
+ " current = current.leftChild\n",
+ " if(current == None): # if end of the line,\n",
+ " # insert on left\n",
+ " parent.leftChild = newNode\n",
+ " return\n",
+ " else:# or go right?\n",
+ " current = current.rightChild\n",
+ " if(current == None): # if end of the line \n",
+ " # insert on right\n",
+ " parent.rightChild = newNode\n",
+ " return\n",
+ "\n",
+ " def delete(self,key): # delete node with given key\n",
+ " # (assumes non-empty list)\n",
+ " current = self.root\n",
+ " parent = self.root\n",
+ " isLeftChild = True\n",
+ " while(current.iData != key):\n",
+ " parent = current\n",
+ " if(key < current.iData):\n",
+ " isLeftChild = True\n",
+ " current = current.leftChild\n",
+ " else:\n",
+ " isLeftChild = False\n",
+ " current = current.rightChild\n",
+ " if(current == None):\n",
+ " return False\n",
+ " # if no children, simply delete it\n",
+ " if(current.leftChild==None and current.rightChild==None):\n",
+ " if(current == self.root): # if self.root,\n",
+ " self.root = None # tree is empty\n",
+ " elif(isLeftChild):\n",
+ " parent.leftChild = None\n",
+ " else:\n",
+ " parent.rightChild = None\n",
+ "\n",
+ " elif(current.rightChild==None):\n",
+ " if(current == self.root):\n",
+ " self.root = current.leftChild\n",
+ " elif(isLeftChild):\n",
+ " parent.leftChild = current.leftChild\n",
+ " else:\n",
+ " parent.rightChild = current.leftChild # if no left child, replace with right subtree\n",
+ " elif(current.leftChild==None):\n",
+ " if(current == self.root):\n",
+ " self.root = current.rightChild\n",
+ " elif(isLeftChild):\n",
+ " parent.leftChild = current.rightChild\n",
+ " else:\n",
+ " parent.rightChild = current.rightChild\n",
+ " else: # two children, so replace with inorder successor\n",
+ " # get successor of node to delete (current)\n",
+ " successor = self.getSuccessor(current)\n",
+ " # connect parent of current to successor instead\n",
+ " if(current == self.root):\n",
+ " self.root = successor\n",
+ " elif(isLeftChild):\n",
+ " parent.leftChild = successor\n",
+ " else:\n",
+ " parent.rightChild = successor\n",
+ " # connect successor to currents left child\n",
+ " successor.leftChild = current.leftChild\n",
+ " return True\n",
+ "\n",
+ " def getSuccessor(self,delNode):\n",
+ " successorParent = delNode\n",
+ " successor = delNode\n",
+ " current = delNode.rightChild # go to right child\n",
+ " while(current != None): # until no more\n",
+ " # left children,\n",
+ " successorParent = successor\n",
+ " successor = current\n",
+ " current = current.leftChild # go to left child\n",
+ " # if successor not\n",
+ " if(successor != delNode.rightChild): # right child,\n",
+ " # make connections\n",
+ " successorParent.leftChild = successor.rightChild\n",
+ " successor.rightChild = delNode.rightChild\n",
+ " return successor\n",
+ "\n",
+ " def traverse(self,traverseType):\n",
+ " if traverseType == 1:\n",
+ " print '\\nPreorder traversal: ',\n",
+ " self.preOrder(self.root)\n",
+ " elif traverseType == 2:\n",
+ " print '\\nInorder traversal: ',\n",
+ " self.inOrder(self.root)\n",
+ " else:\n",
+ " print '\\nPostorder traversal: ',\n",
+ " self.postOrder(self.root)\n",
+ " print ''\n",
+ "\n",
+ " def preOrder(self, localroot):\n",
+ " if(localroot != None):\n",
+ " print localroot.iData ,\n",
+ " self.preOrder(localroot.leftChild)\n",
+ " self.preOrder(localroot.rightChild)\n",
+ "\n",
+ " def inOrder(self, localroot):\n",
+ " if(localroot != None):\n",
+ " self.inOrder(localroot.leftChild)\n",
+ " print localroot.iData ,\n",
+ " self.inOrder(localroot.rightChild)\n",
+ " \n",
+ " def postOrder(self, localroot):\n",
+ " if(localroot != None):\n",
+ " self.postOrder(localroot.leftChild)\n",
+ " self.postOrder(localroot.rightChild)\n",
+ " print localroot.iData ,\n",
+ "\n",
+ " def displayTree(self):\n",
+ " globalStack = list()\n",
+ " globalStack.append(self.root)\n",
+ " nBlanks = 32\n",
+ " isRowEmpty = False\n",
+ " print '\\n......................................................'\n",
+ " while(isRowEmpty==False):\n",
+ " localStack = list()\n",
+ " isRowEmpty = True\n",
+ " for j in range(nBlanks):\n",
+ " print ' ',\n",
+ " while(globalStack is not None):\n",
+ " temp = globalStack.pop()\n",
+ " if(temp != None):\n",
+ " print temp.iData,\n",
+ " localStack.append(temp.leftChild)\n",
+ " localStack.append(temp.rightChild)\n",
+ " if(temp.leftChild != None or temp.rightChild != None):\n",
+ " isRowEmpty = False\n",
+ " else:\n",
+ " print '--' ,\n",
+ " localStack.push(None)\n",
+ " localStack.push(None)\n",
+ " for j in range(nBlanks*2-2):\n",
+ " print ' ', # end while globalStack not empty\n",
+ " \n",
+ " print ''\n",
+ " nBlanks /= 2\n",
+ " while(localStack is not None):\n",
+ " globalStack.append( localStack.pop() ) # end while isRowEmpty is false\n",
+ " \n",
+ " print '\\n......................................................'\n",
+ "\n",
+ "theTree = Tree()\n",
+ "theTree.insert(50,1.5)\n",
+ "theTree.insert(25,1.2)\n",
+ "theTree.insert(75,1.7)\n",
+ "theTree.insert(12,1.5)\n",
+ "theTree.insert(37,1.2)\n",
+ "theTree.insert(43,1.7)\n",
+ "theTree.insert(30,1.5)\n",
+ "theTree.insert(33,1.2)\n",
+ "theTree.insert(87,1.7)\n",
+ "theTree.insert(93,1.5)\n",
+ "theTree.insert(97,1.5)\n",
+ "while(True):\n",
+ " print 'Enter first letter of show, '\n",
+ " print 'insert, find, delete, or traverse: ',\n",
+ " choice = raw_input()\n",
+ " if choice == 's':\n",
+ " theTree.displayTree()\n",
+ " elif choice == 'i':\n",
+ " print 'Enter value to insert: '\n",
+ " value = int(raw_input())\n",
+ " theTree.insert(value, value + 0.9)\n",
+ " elif choice == 'f':\n",
+ " print 'Enter value to find: ',\n",
+ " value = int(raw_input())\n",
+ " found = theTree.find(value)\n",
+ " if(found != None):\n",
+ " print 'Found: ', \n",
+ " found.displayNode()\n",
+ " print ''\n",
+ " else:\n",
+ " print 'Could not find', value \n",
+ " elif choice=='d':\n",
+ " print 'Enter value to delete: ',\n",
+ " value = int(raw_input())\n",
+ " didDelete = theTree.delete(value)\n",
+ " if(didDelete):\n",
+ " print 'Deleted ' , value \n",
+ " else:\n",
+ " print 'Could not delete ',value\n",
+ " elif choice=='t':\n",
+ " print 'Enter type 1, 2 or 3: '\n",
+ " value = int(raw_input())\n",
+ " theTree.traverse(value)\n",
+ " else:\n",
+ " print 'Invalid entry'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": []
@@ -30,7 +266,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_10_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_10_2.ipynb
index 2a9ddf10..3ce6918a 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_10_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_10_2.ipynb
@@ -27,23 +27,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find annual electricity charge\n",
"\n",
- "#Variable declaration\n",
"max_dm_kW = 150.0 #Maximum demand(kW)\n",
"pf = 0.85 #Average power factor\n",
"rate = 90.0 #Cost of maximum demand(Rs/kVA)\n",
"E_rate = 0.3 #Cost of energy consumed(Rs)\n",
"lf = 0.65 #Annual load factor \n",
"\n",
- "#Calculation\n",
"max_dm_kVA = max_dm_kW/pf #Maximum demand(kVA)\n",
"annual_chg_kVA = rate*max_dm_kVA #Annual fixed charges based on max demand(Rs)\n",
"E_kWh = lf*365*24*max_dm_kW #Energy consumed per annum(kWh)\n",
"annual_E_chg = E_kWh*E_rate #Annual energy charges(Rs)\n",
"annual_elect_charge = annual_chg_kVA + annual_E_chg #Annual electricity charge to be paid(Rs)\n",
"\n",
- "#Result\n",
"print('Annual electricity charges to be paid by consumer = Rs %.2f' %annual_elect_charge)"
],
"language": "python",
@@ -71,9 +67,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Obtain two part tariff\n",
"\n",
- "#Variable declaration\n",
"P = 75.0 #Power(kW)\n",
"cost_plant = 3000.0 #Cost of plant(Rs/kW)\n",
"cost_td = 30.0*10**5 #Cost of transmission & distribution(Rs)\n",
@@ -89,12 +83,9 @@
"dividend = 10**6 #Dividend to shareholders(Rs/annum)\n",
"per_L = 0.10 #Total energy loss(% of generated energy)\n",
"\n",
- "#Calculation\n",
"cost = cost_plant*P*1000 #Cost of plant(Rs)\n",
- "#Fixed cost\n",
"per_value = interest+depreciation #Total interest & depreciation(/annum)\n",
"cost_fix_ann = (cost+cost_opr)*per_value+cost_fix_mt+dividend #Total fixed cost(Rs)\n",
- "#Variable cost\n",
"cost_var_ann = cost_fuel+cost_opr+cost_var_mt #Total running cost(Rs)\n",
"E_gen_ann = max_demand*1000*24*365*lf #Energy generated per annum(kWh)\n",
"E_loss = per_L*E_gen_ann #Energy losses(kWh)\n",
@@ -103,7 +94,6 @@
"charge_max_demand = cost_fix_ann/sum_max_demand #Charge to consumers per kW of max demand per year(Rs)\n",
"charge_energy = cost_var_ann/E_sold*100 #Charge for energy(paise per kWh)\n",
"\n",
- "#Result\n",
"print('Two-part tariff is :')\n",
"print('Rs %.2f per kW of maximum demand per year + %.1f paise per kWh consumed' %(charge_max_demand,charge_energy))"
],
@@ -133,9 +123,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find optimal scheduling & total cost\n",
"\n",
- "#Variable declaration\n",
"P_D = 500.0 #Total load(MW)\n",
"b_1 = 15.0 #Beta value of controllable thermal plant C1\n",
"g_1 = 0.012 #Gamma value of controllable thermal plant C1\n",
@@ -144,7 +132,6 @@
"b_3 = 19.0 #Beta value of controllable thermal plant C3\n",
"g_3 = 0.020 #Gamma value of controllable thermal plant C3\n",
"\n",
- "#Calculation\n",
"l = (P_D+((b_1/(2*g_1))+(b_2/(2*g_2))+(b_3/(2*g_3))))/((1/(2*g_1))+(1/(2*g_2))+(1/(2*g_3))) #Lambda value which is a Lagrange multiplier\n",
"P_G1 = (l - b_1)/(2*g_1) #(MW)\n",
"P_G2 = (l - b_2)/(2*g_2) #(MW)\n",
@@ -154,7 +141,6 @@
"C3 = 1000.0 + b_3*P_G3 + g_3*P_G3**2 #Fuel cost of plant C3(Rs/hr)\n",
"C = C1 + C2 + C3 #Total fuel cost(Rs/hr)\n",
"\n",
- "#Result\n",
"print('Value of \u03bb from equation(10.14) = %.3f' %l)\n",
"print('Optimal scheduling of thermal plant C1 = %.2f MW' %P_G1)\n",
"print('Optimal scheduling of thermal plant C2 = %.2f MW' %P_G2)\n",
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_12_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_12_2.ipynb
index 825a19ae..1ea7e5cb 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_12_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_12_2.ipynb
@@ -27,14 +27,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find reflected & refracted voltage & current\n",
"\n",
- "#Variable declaration\n",
"V_i = 100.0 #Incident voltage(kV)\n",
"Z_1 = 400.0 #Surge impedance(ohm)\n",
"Z_2 = 350.0 #Surge impedance(ohm)\n",
"\n",
- "#Calculation\n",
"beta = 2*Z_2/(Z_1+Z_2) #Refraction coeffeicient of voltage\n",
"alpha = (Z_2-Z_1)/(Z_1+Z_2) #Reflection coeffeicient of voltage\n",
"V_t = beta*V_i #Refracted voltage(kV)\n",
@@ -42,7 +39,6 @@
"I_t = V_t/Z_2*1000 #Refracted current(A)\n",
"I_r = -(V_r/Z_1)*1000 #Reflected current(A)\n",
"\n",
- "#Result\n",
"print('Reflected voltage , V_r = %.1f kV' %V_r)\n",
"print('Refracted voltage , V_t = %.1f kV' %V_t)\n",
"print('Reflected current , I_r = %.1f A' %I_r)\n",
@@ -76,15 +72,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find refracted voltage & current waves in overhead line & underground cable\n",
"\n",
- "#Variable declaration\n",
"V_i = 100.0 #Incident voltage(kV)\n",
"Z_1 = 400.0 #Surge impedance(ohm)\n",
"Z_21 = 350.0 #Surge impedance of line connected at T(ohm)\n",
"Z_22 = 50.0 #Surge impedance of cable connected at T(ohm)\n",
"\n",
- "#Calculation\n",
"Z_2 = Z_21*Z_22/(Z_21+Z_22) #Surge impedance(ohm)\n",
"V_t = 2*Z_2*V_i/(Z_1+Z_2) #Refracted voltage(kV)\n",
"V_r = (Z_2-Z_1)*V_i/(Z_1+Z_2) #Reflected voltage(kV)\n",
@@ -92,7 +85,6 @@
"I_t2 = V_t/Z_22*1000 #Refracted current in Z_22(A)\n",
"I_r = -(V_r/Z_1)*1000 #Reflected current in Z_1(A)\n",
"\n",
- "#Result\n",
"print('Refracted voltage , V_t = %.2f kV' %V_t)\n",
"print('Refracted current in overhead line , I_t1 = %.2f A' %I_t1)\n",
"print('Refracted current in underground cable , I_t2 = %.2f A' %I_t2)"
@@ -124,14 +116,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find reflected & refracted voltage & current\n",
"\n",
- "#Variable declaration\n",
"V_i = 100.0 #Incident voltage(kV)\n",
"Z_1 = 400.0 #Surge impedance of overhead line(ohm)\n",
"Z_2 = 50.0 #Surge impedance of underground cable(ohm)\n",
"\n",
- "#Calculation\n",
"beta = 2*Z_2/(Z_1+Z_2) #Refraction coeffeicient of voltage\n",
"alpha = (Z_2-Z_1)/(Z_1+Z_2) #Reflection coeffeicient of voltage\n",
"V_t = beta*V_i #Refracted voltage(kV)\n",
@@ -139,7 +128,6 @@
"I_t = V_t/Z_2*1000 #Refracted current(A)\n",
"I_r = -(V_r/Z_1)*1000 #Reflected current(A)\n",
"\n",
- "#Result\n",
"print('Reflected voltage , V_r = %.1f kV' %V_r)\n",
"print('Refracted voltage , V_t = %.1f kV' %V_t)\n",
"print('Reflected current , I_r = %.1f A' %I_r)\n",
@@ -173,20 +161,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find distance the surge travel to attenuate to half value\n",
"\n",
- "#Variable declaration\n",
"R = 74.0*10**-6 #Resistance of overhead line(ohm/meter)\n",
"L = 1.212*10**-6 #Inductance of overhead line(H/meter)\n",
"C = 9.577*10**-12 #Capacitance of overhead line(F/meter)\n",
"\n",
- "#Calculation\n",
"import math\n",
"Z_0 = (L/C)**0.5 #Surge impedance of line(ohm)\n",
"a = R/(2*Z_0)\n",
"x_1 = math.log(2)/a #Distance to be travelled(m)\n",
"\n",
- "#Result\n",
"print('The distance the surge must travel to attenuate to half value = %.2e meter = %.2e km' %(x_1,x_1*10**-3))"
],
"language": "python",
@@ -214,14 +198,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find current,arrester resistance,refraction & relection coefficient of voltage\n",
"\n",
- "#Variable declaration\n",
"V_i = 2000.0 #Incident voltage(kV)\n",
"Z = 300.0 #Surge impedance(ohm)\n",
"V_p = 1200.0 #Arrester protection level(kV)\n",
"\n",
- "#Calculation\n",
"I_surge = V_i/Z #Surge current(kA)\n",
"V_oc = 2*V_i #Open-circuit voltage(kV)\n",
"I_A = (V_oc-V_p)/Z #Current through the arrestor(kA)\n",
@@ -232,7 +213,6 @@
"V_t_coeff = V_t/V_i #Refracted coefficient of voltage\n",
"R_a = V_p/I_A #Arrestor resistance(ohm)\n",
"\n",
- "#Result\n",
"print('Case(a) :')\n",
"print('Current flowing in line before the surge voltage reaches the arrestor terminal = %.2f kA' %I_surge)\n",
"print('\\nCase(b) :')\n",
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_13_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_13_2.ipynb
index 84e2db43..a76135e2 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_13_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_13_2.ipynb
@@ -27,9 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find symmetrical fault & fault current shared\n",
"\n",
- "#Variable declaration\n",
"kv_gA = 11.0 #Voltage rating of generator A(kV)\n",
"MVA_gA = 40.0 #MVA rating of generator A\n",
"x_gA = 0.12 #Reactance of generator A(p.u)\n",
@@ -42,7 +40,6 @@
"kv_f = 66.0 #Feeder voltage(kV)\n",
"x_f = 30.0 #Reactance of feeder(ohm)\n",
"\n",
- "#Calculation\n",
"MVA_base = 75.0 #Base MVA\n",
"kv_base_lv = 11.0 #Base voltage on LT side(kV)\n",
"kv_base_hv = 66.0 #Base voltage on HT side(kV)\n",
@@ -50,7 +47,6 @@
"x_gB_new = x_gB*(MVA_base/MVA_gB) #New Reactance of generator B(p.u)\n",
"x_f_new = x_f*(MVA_base/kv_base_hv**2) #New reactance of feeder(p.u)\n",
"\n",
- "#For case(a)\n",
"x_eq = x_T+(x_gA_new*x_gB_new/(x_gA_new+x_gB_new)) #Equivalent reactance(p.u)\n",
"V_f = kv_Thv/kv_base_hv #Fault voltage by applying Thevenin's Theorem at FF(p.u)\n",
"I_f = V_f/complex(0,x_eq) #Fault current(A)\n",
@@ -62,7 +58,6 @@
"I_B = I_f*x_gA_new/(x_gA_new+x_gB_new) #Current in generator B(p.u)\n",
"I_B1 = I_B*MVA_base*1000/(3**0.5*kv_base_lv) #Current in generator B(A)\n",
"\n",
- "#For case(b)\n",
"x_eq2 = x_f_new+x_T+(x_gA_new*x_gB_new/(x_gA_new+x_gB_new)) #Equivalent reactance(p.u)\n",
"I_f2 = V_f/complex(0,x_eq2) #Fault current(p.u)\n",
"I_f_ht2 = I_f2*(MVA_base*1000/(3**0.5*kv_base_hv)) #Fault current on HT side(A)\n",
@@ -72,7 +67,6 @@
"I_B_pu = I_f2*x_gA_new/(x_gA_new+x_gB_new) #Current in generator B(p.u)\n",
"I_B2 = I_B_pu*MVA_base*1000/(3**0.5*kv_base_lv) #Current in generator B(A)\n",
"\n",
- "#Result\n",
"print('Case(a) :')\n",
"print('Fault MVA for symmetric fault at the high voltage terminals of transformer = %.2f MVA' %MVA_fault)\n",
"print('Fault current shared by generator A , I_A = %.2fj A' %(I_A1.imag))\n",
@@ -115,9 +109,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find the rating of the circuit breaker\n",
"\n",
- "#Variable declaration\n",
"MVA_base = 100.0 #Base MVA\n",
"x1 = 0.15 #Reactance b/w F & B(p.u) . (Refer textbook diagram for marking)\n",
"x2 = 0.1 #Reactance b/w F & B(p.u)\n",
@@ -129,7 +121,6 @@
"x8 = 0.12 #Reactance b/w C & F(p.u)\n",
"\n",
"\n",
- "#Calculation\n",
"V_f = 1.0 #Fault voltage by applying Thevenin's Theorem at FF(p.u)\n",
"x1_eq = x1+x2\n",
"x2_eq = x7+x8\n",
@@ -141,7 +132,6 @@
"X_eq = x7_eq+x5_eq #Equivalent reactance\n",
"MVA_SC = V_f*MVA_base/X_eq #Short circuit MVA at A\n",
"\n",
- "#Result\n",
"print('Rating of the circuit breaker at the location A = %.1f MVA' %MVA_SC)\n",
"print('\\nNOTE : ERROR : Delta to star reactance conversion mistake in textbook')"
],
@@ -172,15 +162,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find the possible short-circuit MVA at each station bus-bars\n",
"\n",
- "#Variable declaration\n",
"x = 1.2 #Reactance of interconnector(ohm per phase)\n",
"kv = 33.0 #Voltage of bus-bars(kV)\n",
"SC_MVA1 = 3000.0 #Short-circuit MVA at bus-bar of first station(MVA)\n",
"SC_MVA2 = 2000.0 #Short-circuit MVA at bus-bar of second station(MVA)\n",
"\n",
- "#Calculation\n",
"MVA_base = 3000.0 #Base MVA\n",
"kv_base = 33.0 #Base kV\n",
"x_c = x*(MVA_base/kv_base**2) #Cable reactance(p.u)\n",
@@ -192,7 +179,6 @@
"X_eq2 = x2*(x_c+x1)/(x1+x_c+x2) #Thevenin reactance for short-circuit at bus bars at station 2(p.u)\n",
"SC_MVA2_poss = V_f*MVA_base/X_eq2 #Possible short-circuit at station 2(MVA)\n",
"\n",
- "#Result\n",
"print('Possible short-circuit MVA at station 1 = %.2f MVA' %SC_MVA1_poss)\n",
"print('Possible short-circuit MVA at station 2 = %.2f MVA' %SC_MVA2_poss)"
],
@@ -222,9 +208,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find fault current fed by generator\n",
"\n",
- "#Variable declaration\n",
"MVA_G1 = 20.0 #MVA rating of generator 1(MVA)\n",
"kv_G1 = 13.2 #Voltage rating of generator 1(kV)\n",
"x_G1 = 0.14 #Reactance of generator 1(p.u)\n",
@@ -241,7 +225,6 @@
"x_T2 = 0.12 #Reactance of transformer 2(p.u)\n",
"x_L = 75.0 #Line reactance(ohm)\n",
"\n",
- "#Calculation\n",
"MVA_base = 45.0 #Base MVA\n",
"kv_lv_base = 13.2 #L.T base voltage(kV)\n",
"kv_hv_base = 132.0 #H.T base voltage(kV)\n",
@@ -259,7 +242,6 @@
"I_G2 = I_f*(x_G1_new+x_T1_new)/(x_G1_new+x_T1_new+x_G2_new+x_T2_new) #Fault current shared by generator 2(p.u)\n",
"I_f_G2 = I_G2*I_lt_base #Fault current shared by generator 2(A)\n",
"\n",
- "#Result\n",
"print('Fault current fed by generator 1 = %.1fj A' %I_f_G1.imag)\n",
"print('Fault current fed by generator 2 = %.1fj A' %I_f_G2.imag)\n",
"print('\\nNOTE : ERROR : MVA ratings of G2 & T2 are 30 MVA , not 25 MVA as in textbook question')"
@@ -292,12 +274,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find SCC of bus 1\n",
"\n",
- "#Variable declaration\n",
"MVA_base = 20.0 #Base MVA\n",
"\n",
- "#Calculation\n",
"V_f = 1.0 #Pre-fault voltage at bus 1(p.u).(Refer textbook diagram for marking.After circuit simplification)\n",
"x1 = 0.049 #Reactance(p.u)\n",
"x2 = 0.064 #Reactance(p.u)\n",
@@ -305,7 +284,6 @@
"x_eq = (x1+x2)*x3/(x1+x2+x3) #Equivalent reactance(p.u)\n",
"MVA_fault = V_f*MVA_base/x_eq #Fault MVA\n",
"\n",
- "#Result\n",
"print('SCC of bus 1 = %.f MVA' %MVA_fault)\n",
"print('\\nNOTE : Changes in answer is due to more decimal places')"
],
@@ -336,9 +314,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find SCC,total post-fault current & post-fault voltage\n",
"\n",
- "#Variable declaration\n",
"x_G1 = 0.15 #Sub-transient reactance of generator 1(p.u)\n",
"x_G2 = 0.15 #Sub-transient reactance of generator 2(p.u)\n",
"x_T1 = 0.12 #Leakage reactance of transformer 1(p.u)\n",
@@ -348,9 +324,7 @@
"S_12 = complex(0.75,0.25) #Load at tie line(p.u)\n",
"V1 = 1.0 #Pre-fault voltage at bus 1(p.u)\n",
"\n",
- "#Calculation\n",
"import cmath\n",
- "#Pre-fault current & voltages\n",
"V_f = 1.0 #Voltage at FF(p.u)\n",
"Y_s = 1/complex(0,x_s) #Series admittance of line(p.u)\n",
"V2 = (1-(S_12/Y_s.conjugate())).conjugate() #Voltage at bus 2(p.u)\n",
@@ -360,20 +334,16 @@
"I_L = V2/Z_L #Load current(p.u)\n",
"I2 = I_L - I_s #Pre-fault current from generator 2(p.u)\n",
"\n",
- "#Fault current\n",
"x_eq = (x_G1+x_T1)*(x_G2+x_T2+x_s)/(x_G1+x_T1+x_G2+x_T2+x_s) #Equivalent reactance of n/w(p.u)\n",
"I_f = 1/complex(0,x_eq) #Fault current(p.u)\n",
"I_f1 = I_f*(x_G2+x_T2+x_s)/(x_G1+x_T1+x_G2+x_T2+x_s) #Fault current through G1,T1 towards F(p.u)\n",
"I_f2 = I_f*(x_G1+x_T1)/(x_G1+x_T1+x_G2+x_T2+x_s) #Fault current through G2,T2 & tie-line towards F(p.u)\n",
"\n",
- "#Post-fault current & voltage\n",
"V_1f = 0 #Post-fault voltage at bus 1(p.u)\n",
"V_2f = V_1f+(I_f2-I_s)*complex(0,x_s) #Post-fault voltage at bus 2(p.u)\n",
"\n",
- "#Short-circuit capacity\n",
"SCC = V_f/x_eq #Fault MVA or SCC\n",
"\n",
- "#Result\n",
"print('Case(a) :')\n",
"print('SCC of bus 1 = %.2f p.u' %SCC)\n",
"print('\\nCase(b) :')\n",
@@ -415,21 +385,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find symmetrical components of line currents\n",
"\n",
- "#Variable declaration\n",
"import cmath\n",
"I_a = 10.0*cmath.exp(1j*90*cmath.pi/180) #Line current(A)\n",
"I_b = 10.0*cmath.exp(1j*-90*cmath.pi/180) #Line current(A)\n",
"I_c = 10.0*cmath.exp(1j*0*cmath.pi/180) #Line current(A)\n",
"\n",
- "#Calculation\n",
"a = 1.0*cmath.exp(1j*120*cmath.pi/180) #Operator\n",
"I_a0 = 1.0/3*(I_a+I_b+I_c) #Zero-sequence component(A)\n",
"I_a1 = 1.0/3*(I_a+a*I_b+a**2*I_c) #Positive-sequence component(A)\n",
"I_a2 = 1.0/3*(I_a+a**2*I_b+a*I_c) #Negative-sequence component(A)\n",
"\n",
- "#Result\n",
"print('Zero-sequence component , I_a0 = %.2f\u2220%.f\u00b0 A' %(abs(I_a0),cmath.phase(I_a0)*180/cmath.pi))\n",
"print('Positive-sequence component , I_a1 = %.3f\u2220%.f\u00b0 A' %(abs(I_a1),cmath.phase(I_a1)*180/cmath.pi))\n",
"print('Negative-sequence component , I_a2 = %.1f\u2220%.f\u00b0 A' %(abs(I_a2),cmath.phase(I_a2)*180/cmath.pi))"
@@ -461,16 +427,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find short-circuit current & terminal voltages\n",
"\n",
- "#Variable declaration\n",
"kv = 13.2 #Voltage rating of generator(kV)\n",
"MVA = 25.0 #MVA rating of generator\n",
"MVA_sc = 170.0 #Short circuit MVA\n",
"x0 = 0.05 #Zero sequence reactance(p.u)\n",
"x2 = 0.13 #Negative sequence reactance(p.u)\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"MVA_base = 25.0 #Base MVA\n",
@@ -481,7 +444,6 @@
"Z_f = 0 #Fault impedance\n",
"a = 1.0*cmath.exp(1j*120*cmath.pi/180) #Operator\n",
"\n",
- "#L-G fault\n",
"I_a1 = V_f/complex(0,(x0+x1+x2)) #Positive sequence current(p.u)\n",
"I_a2 = I_a1 #Negative sequence current(p.u)\n",
"I_a0 = I_a1 #Zero sequence current(p.u)\n",
@@ -498,7 +460,6 @@
"V_bc = (V_b-V_c) #Line voltages at terminal(kV)\n",
"V_ca = (V_c-V_a) #Line voltages at terminal(kV)\n",
"\n",
- "#L-L fault\n",
"I_a12 = V_f/complex(0,(x1+x2)) #Positive sequence current(p.u)\n",
"I_a22 = -I_a12 #Negative sequence current(p.u)\n",
"I_a02 = 0 #Zero sequence current(p.u)\n",
@@ -515,7 +476,6 @@
"V_bc2 = (V_b_2-V_c_2) #Line voltages at terminal(kV)\n",
"V_ca2 = (V_c_2-V_a_2) #Line voltages at terminal(kV)\n",
"\n",
- "#L-L-G fault\n",
"I_a13 = V_f/complex(0,(x1+(x0*x2/(x0+x2)))) #Positive sequence current(p.u)\n",
"I_a23 = -I_a13*x0/(x0+x2) #Negative sequence current(p.u)\n",
"I_a03 = -I_a13*x2/(x0+x2) #Zero sequence current(p.u)\n",
@@ -532,7 +492,6 @@
"V_bc3 = (V_b3-V_c3) #Line voltages at terminal(kV)\n",
"V_ca3 = (V_c3-V_a3) #Line voltages at terminal(kV)\n",
"\n",
- "#Result\n",
"print('Case(i) : L-G fault :')\n",
"print('Short circuit current , I_a = %.1fj A = %.1f\u2220%.f\u00b0 A' %(I_a.imag,abs(I_a),cmath.phase(I_a)*180/math.pi))\n",
"print('Short circuit current , I_b = %.f\u2220%.f\u00b0 A' %(abs(I_b),cmath.phase(I_b)*180/math.pi))\n",
@@ -605,15 +564,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find fault current & neutral potential\n",
"\n",
- "#Variable declaration\n",
"x0 = 0.05 #Zero sequence reactance(p.u)\n",
"x2 = 0.13 #Negative sequence reactance(p.u)\n",
"r = 1.0 #Resistance through which generator neutral is earthed(ohm)\n",
"MVA_sc = 170.0 #Short circuit MVA\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"MVA_base = 25.0 #Base MVA\n",
@@ -629,7 +585,6 @@
"I_a = 3*I_a1*I_base #Fault current(A)\n",
"V_n = 3*I_a0*Z_n*I_base #Potential of neutral(V)\n",
"\n",
- "#Result\n",
"print('Fault current for a L-G short-circuit at its terminals , I_a = %.2f\u2220%.2f\u00b0 A' %(abs(I_a),cmath.phase(I_a)*180/math.pi))\n",
"print('Neutral potential = %.3f\u2220%.2f\u00b0 V' %(abs(V_n),cmath.phase(V_n)*180/math.pi))\n",
"print('\\nNOTE : ERROR : For calculating neutral potential in textbook Z_n = 1 is taken instead of Z_n = 0.206611570248')"
@@ -662,9 +617,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find fault current & current contributed by G1 & G2\n",
"\n",
- "#Variable declaration\n",
"x1_G1 = complex(0,0.17) #Positive sequence reactance of G1(p.u)\n",
"x2_G1 = complex(0,0.14) #Negative sequence reactance of G1(p.u)\n",
"x0_G1 = complex(0,0.05) #Zero sequence reactance of G1(p.u)\n",
@@ -681,7 +634,6 @@
"x2_L = complex(0,0.22) #Negative sequence reactance of line(p.u)\n",
"x0_L = complex(0,0.60) #Zero sequence reactance of line(p.u)\n",
"\n",
- "#Calculation\n",
"import cmath\n",
"a = 1.0*cmath.exp(1j*120*cmath.pi/180) #Operator\n",
"Z_1T = (x1_G1+x1_T1)*(x1_G2+x1_T2+x1_L)/(x1_G1+x1_T1+x1_G2+x1_T2+x1_L) #Thevenin reactance of positive sequence(p.u)\n",
@@ -693,7 +645,6 @@
"I_a0 = I_a1 #Zero sequence current(p.u)\n",
"I_a = 3*I_a1 #Fault current(p.u)\n",
"\n",
- "#Generator G1\n",
"I_a1_G1 = I_a1*(x1_L+x1_T2+x1_G2)/(x1_L+x1_T1+x1_G1+x1_T2+x1_G2) #Positive sequence current shared by G1(p.u)\n",
"I_a2_G1 = I_a2*(x2_L+x2_T2+x2_G2)/(x2_L+x2_T1+x2_G1+x2_T2+x2_G2) #Negative sequence current shared by G1(p.u)\n",
"I_a0_G1 = I_a0*(x0_L+x0_T2)/(x0_L+x0_T1+x0_G1+x0_T2) #Zero sequence current shared by G1(p.u)\n",
@@ -701,7 +652,6 @@
"I_b_G1 = I_a0_G1+a**2*I_a1_G1+a*I_a2_G1 #Phase current through G1(p.u)\n",
"I_c_G1 = I_a0_G1+a*I_a1_G1+a**2*I_a2_G1 #Phase current through G1(p.u)\n",
"\n",
- "#Generator G2\n",
"I_a1_G2 = I_a1*(x1_T1+x1_G1)/(x1_L+x1_T1+x1_G1+x1_T2+x1_G2)*cmath.exp(1j*30*cmath.pi/180) #Positive sequence current shared by G1(p.u)\n",
"I_a2_G2 = I_a2*(x2_T1+x2_G1)/(x2_L+x2_T1+x2_G1+x2_T2+x2_G2)*cmath.exp(1j*-30*cmath.pi/180) #Negative sequence current shared by G1(p.u)\n",
"I_a0_G2 = 0 #Zero sequence current shared by G1(p.u)\n",
@@ -709,7 +659,6 @@
"I_b_G2 = I_a0_G2+a**2*I_a1_G2+a*I_a2_G2 #Phase current through G2(p.u)\n",
"I_c_G2 = I_a0_G2+a*I_a1_G2+a**2*I_a2_G2 #Phase current through G2(p.u)\n",
"\n",
- "#Result\n",
"print('Fault current for a L-G fault at bus 1 , I_a = %.3fj p.u' %I_a.imag)\n",
"print('\\nPhase currents contributed by G1 :')\n",
"print('I_a = %.3f\u2220%.1f\u00b0 p.u' %(abs(I_a_G1),cmath.phase(I_a_G1)*180/cmath.pi))\n",
@@ -758,9 +707,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find fault current & fault MVA for L-G fault\n",
"\n",
- "#Variable declaration\n",
"kv_G1 = 13.2 #Voltage rating of G1(kV)\n",
"MVA_G1 = 40.0 #MVA rating of G1\n",
"x1_G1 = 0.2 #Positive sequence reactance of G1(p.u)\n",
@@ -780,7 +727,6 @@
"xs_T2 = 0.045 #Secondary reactance of T2(p.u)\n",
"xt_T2 = 0.06 #Tertiary reactance of T2(p.u)\n",
"\n",
- "#Calculation\n",
"MVA_base = 40.0 #Base MVA\n",
"kv_base_G1 = 13.2 #Voltage base on generator side(kV)\n",
"kv_base_L = 132.0 #Voltage base on Line side(kV)\n",
@@ -799,7 +745,6 @@
"I_f1 = abs(I_f)*MVA_base*1000/(3**0.5*kv_base_T2s) #Fault current(A)\n",
"MVA_fault = abs(I_f)*MVA_base #Fault MVA\n",
"\n",
- "#Result\n",
"print('Fault current , I_f = %.2f A' %I_f1)\n",
"print('Fault MVA for L-G fault = %.2f MVA' %MVA_fault)"
],
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_14_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_14_2.ipynb
index 7e9e089f..4187d366 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_14_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_14_2.ipynb
@@ -27,21 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find operating time of relay\n",
"\n",
- "#Variable declaration\n",
"TMS = 0.5 #Time multiplier setting\n",
"I_f = 5000.0 #Fault current(A)\n",
"CT = 500.0/5 #CT ratio\n",
"set_plug = 1.0 #Relay plug set\n",
"I_relay = 5.0 #Rated relay current(A)\n",
"\n",
- "#Calculation\n",
"PSM = I_f/(CT*set_plug*I_relay) #Plug setting multiplier\n",
"T1 = 1.0 #Time of operation for obtained PSM & TMS of 1 from graph.Refer Fig 14.22\n",
"T2 = TMS*3/T1 #Time of operation(sec)\n",
"\n",
- "#Result\n",
"print('Operating time of the relay = %.1f sec' %T2)"
],
"language": "python",
@@ -69,9 +65,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find CT ratio,PSM,TMS for each IDMT relays\n",
"\n",
- "#Variable declaration\n",
"I_f_A = 6000.0 #3-phase fault current of substation A(A)\n",
"I_f_B = 5000.0 #3-phase fault current of substation B(A)\n",
"I_f_C = 3000.0 #3-phase fault current of substation C(A)\n",
@@ -80,40 +74,34 @@
"T = 0.5 #Operating time of breakers(sec)\n",
" \n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"I_set = 1.0 #Setting current(A)\n",
"\n",
- "#For relay D\n",
"I_L_maxD = I_L_max #Maximum load current at D(A)\n",
"CT_D = I_L_max/1 #CT ratio\n",
"PSM_D = I_f_D/(CT_D*I_set) #Plug setting multiplier\n",
"TMS_D = 0.1 #Time multiplier setting\n",
"T_D = 0.14*TMS_D/(PSM_D**0.02-1) #Time of operation(sec)\n",
"\n",
- "#For relay C\n",
"I_L_maxC = I_L_max+I_L_maxD #Maximum load current at C(A)\n",
"CT_C = I_L_maxC/1 #CT ratio\n",
"PSM_C = I_f_C/(CT_C*I_set) #Plug setting multiplier\n",
"T_C = T_D+T #Minimum time of operation(sec)\n",
"TMS_C = T_C*(PSM_C**0.02-1)/0.14 #Time multiplier setting\n",
"\n",
- "#For relay B\n",
"I_L_maxB = I_L_max+I_L_maxC #Maximum load current at B(A)\n",
"CT_B = I_L_maxB/1 #CT ratio\n",
"PSM_B = I_f_B/(CT_B*I_set) #Plug setting multiplier\n",
"T_B = T_C+T #Minimum time of operation(sec)\n",
"TMS_B = T_B*(PSM_B**0.02-1)/0.14 #Time multiplier setting\n",
"\n",
- "#For relay A\n",
"I_L_maxA = I_L_max+I_L_maxB #Maximum load current at A(A)\n",
"CT_A = I_L_maxA/1 #CT ratio\n",
"PSM_A = I_f_A/(CT_A*I_set) #Plug setting multiplier\n",
"T_A = T_B+T #Minimum time of operation(sec)\n",
"TMS_A = T_A*(PSM_A**0.02-1)/0.14 #Time multiplier setting\n",
"\n",
- "#Result\n",
"print('Relay A :')\n",
"print('CT ratio = %.f/1' %CT_A)\n",
"print('PSM of R_A = %.1f' %PSM_A)\n",
@@ -174,20 +162,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find ratio of CT on high tension side\n",
"\n",
- "#Variable declaration\n",
"kv_hv = 66.0 #Voltage rating of HV side of transformer(kV)\n",
"kv_lv = 11.0 #Voltage rating of LV side of transformer(kV)\n",
"CT = 300.0/5 #CT ratio on low tension side\n",
"\n",
- "#Calculation\n",
"I = 300.0 #Assumed current flowing at low tension side(A)\n",
"I_HT = kv_lv/kv_hv*I #Line current on HT side(A)\n",
"I_LT_CT = I/CT #Pilot wire current from LT side(A)\n",
"CT_ratio_HT = I_HT*3**0.5/I_LT_CT #Ratio of CT on HT side\n",
"\n",
- "#Result\n",
"print('Ratio of CT on high tension side = %.f\u221a3/%.f' %(I_HT,I_LT_CT))"
],
"language": "python",
@@ -215,22 +199,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find percentage of winding that remains unprotected\n",
"\n",
- "#Variable declaration\n",
"kv = 11.0 #Voltage rating(kV)\n",
"MVA = 5.0 #MVA rating\n",
"R = 10.0 #Resistance(ohm)\n",
"per_a = 0.15 #Armature winding reactance\n",
"per_trip = 0.3 #Relay trip for out-of-balance\n",
"\n",
- "#Calculation\n",
"x_p = per_a*kv**2/MVA #Winding Reactance(ohm)\n",
"V = kv/3**0.5*1000 #Phase voltage(V)\n",
"I = per_trip*MVA*1000/(3**0.5*kv) #Out of balance current(A)\n",
"p = (((R*I)**2/(V**2-(x_p*I)**2))**0.5)*100 #Percentage of winding remains unsupported\n",
"\n",
- "#Result\n",
"print('Percentage of winding that remains unprotected , p = %.1f percentage' %p)"
],
"language": "python",
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_15_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_15_2.ipynb
index 5631893f..4bf91cd7 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_15_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_15_2.ipynb
@@ -27,9 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find rotor angle & rotor velocity\n",
"\n",
- "#Variable declaration\n",
"G = 50.0 #Rating of machine(MVA)\n",
"f = 50.0 #Frequency of turbo generator(Hz)\n",
"V = 11.0 #Voltage rating of machine(kV)\n",
@@ -37,7 +35,6 @@
"P_0 = 40.0 #Pre-fault output power(MW)\n",
"delta_0 = 20.0 #Rotor angle at instant of fault(degree)\n",
"\n",
- "#Calculation\n",
"P_0_close = 0 #Output power at instant of reclosing(MW)\n",
"P_a = P_0 - P_0_close #Net accelerating power(MW)\n",
"delta_sqr = P_a*180*f/(G*H) #double derivative(elect.degrees/sec^2)\n",
@@ -53,7 +50,6 @@
"b, err = quad(integrand2, 0, 180*10**-3)\n",
"delta = delta_0 + b #Rotor angle(electrical degrees)\n",
"\n",
- "#Result\n",
"print('Rotor angle at the instant of reclosure = %.2f\u00b0 electrical degrees' %delta)\n",
"print('Rotor velocity at the instant of reclosure = %.1f electrical degrees/sec' %a)"
],
@@ -83,9 +79,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find if system is stable or not\n",
"\n",
- "#Variable declaration\n",
"V = 1.0 #Infinite bus voltage(p.u)\n",
"E = 1.0 #e.m.f of finite generator behind transient reactance(p.u)\n",
"X_T = 0.8 #Transfer reactance(p.u)\n",
@@ -94,7 +88,6 @@
"P_0 = 0.5 #Output power(p.u)\n",
"P = 0.5 #Power(p.u)\n",
"\n",
- "#Calculation\n",
"import math\n",
"P_m = E*V/X_T #Amplitude of power angle curve(p.u)\n",
"delta_0 = math.asin(P_i/P_m) #Radians\n",
@@ -103,7 +96,6 @@
"A_acc = P_i_d*(delta-delta_0)-P_m*(math.cos(delta_0)-math.cos(delta)) #Possible area of accceleration\n",
"A_dec = P_m*(math.cos(delta)-math.cos(delta_m))-P_i_d*(delta_m-delta) #Possible area of deceleration\n",
"\n",
- "#Result\n",
"if(A_acc < A_dec):\n",
" print('System is stable')\n",
" stability = A_dec/A_acc\n",
@@ -137,16 +129,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find if system is stable & transient stability limit\n",
"\n",
- "#Variable declaration\n",
"x = 0.25 #Transient reactance(p.u)\n",
"E = 1.0 #e.m.f of finite generator behind transient reactance(p.u)\n",
"x_T = 0.1 #Reactance of transformer(p.u)\n",
"x_L = 0.4 #Reactance of one line(p.u)\n",
"P_i = 0.25 #Pre-fault power(p.u)\n",
"\n",
- "#Calculation\n",
"import math\n",
"X_T = x+x_T+(x_L/2) #Transfer reactance at pre-fault state(p.u)\n",
"P_m = E**2/X_T #Amplitude of power angle curve at pre-fault state(p.u)\n",
@@ -169,7 +158,6 @@
"A_dec = b - P_i*(delta_m-delta_1)\n",
"limit = 0.5648 #Obtained by iterations.Refer textbook.Here assigned directly.\n",
"\n",
- "#Result\n",
"if(A_acc < A_dec):\n",
" print('System is Stable')\n",
" stability = A_dec/A_acc\n",
@@ -208,16 +196,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find the stability of system & critical clearing time\n",
"\n",
- "#Variable declaration\n",
"x = 0.25 #Transient reactance(p.u)\n",
"E = 1.0 #e.m.f of finite generator behind transient reactance(p.u)\n",
"x_T = 0.1 #Reactance of transformer(p.u)\n",
"x_L = 0.4 #Reactance of one line(p.u)\n",
"P_i = 0.7 #Pre-fault power(p.u)\n",
"\n",
- "#Calculation\n",
"import math\n",
"X_T = x+x_T+(x_L/2) #Transfer reactance at pre-fault state(p.u)\n",
"P_m = E**2/X_T #Amplitude of power angle curve at pre-fault state(p.u)\n",
@@ -245,7 +230,6 @@
"cos_delta_cr = ((delta_m-delta_0)*math.sin(delta_0)-r1*math.cos(delta_0)+r2*math.cos(delta_m))/(r2-r1)\n",
"delta_cr = math.acos(cos_delta_cr)*180/math.pi\n",
"\n",
- "#Result\n",
"if(A_acc < A_dec):\n",
" print('System is Stable')\n",
" stability = A_dec/A_acc\n",
@@ -283,9 +267,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find critical clearing angle & time for circuit breaker at bus 1\n",
"\n",
- "#Variable declaration\n",
"P_i = 0.75 #Pre-fault power(p.u)\n",
"f = 50.0 #Frequency(Hz)\n",
"H = 6.0 #Value of H for finite machine(sec)\n",
@@ -295,7 +277,6 @@
"V = 1.0 #Voltage of infinite bus(p.u)\n",
"E = 1.0 #e.m.f of finite generator behind transient reactance(p.u)\n",
"\n",
- "#Calculation\n",
"import math\n",
"X_T = x_G+x_T+(x_L) #Transfer reactance at pre-fault state(p.u)\n",
"P_m = E**2/X_T #Amplitude of power angle curve at pre-fault state(p.u)\n",
@@ -305,7 +286,6 @@
"delta_cra = delta_cr*180/math.pi\n",
"t_cr = ((delta_cra-delta_0a)*2*H/(180*f*P_i))**0.5\n",
"\n",
- "#Result\n",
"print('Critical clearing angle for circuit breaker at bus 1 = %.2f\u00b0' %delta_cra)\n",
"print('Time for circuit breaker at bus 1 ,t_cr = %.3f sec' %t_cr)"
],
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_2_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_2_2.ipynb
index 1ac5ff1b..caca2a2c 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_2_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_2_2.ipynb
@@ -27,16 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find p.u current,active & reactive power,impedance\n",
"\n",
- "#Variable declaration\n",
"MVA_base = 10.0 #Three-phase base MVA\n",
"kV_base = 13.8 #Line-line base kV\n",
"P = 7.0 #Power delivered(MW)\n",
"PF = 0.8 #Power factor lagging\n",
"Z = 5.7 #Impedance(ohm)\n",
"\n",
- "#Calculation\n",
"import math\n",
"I_base = (MVA_base) * (10**3)/((3**(0.5)) * kV_base) #Base current(A)\n",
"I_actual = P * (10**3)/((3**(0.5)) * kV_base*PF) #Actual current delivered by machine(A)\n",
@@ -48,7 +45,6 @@
"P_react = (P * y)/PF #Actual reactive power(MVAR)\n",
"P_react_pu = P_react/MVA_base #Actual p.u reactive power(p.u)\n",
"\n",
- "#Result\n",
"print('p.u current = %.3f p.u' %I_pu)\n",
"print('p.u impedance = %.1f p.u' %Z_pu)\n",
"print('p.u active power = %.1f p.u' %P_act_pu)\n",
@@ -82,21 +78,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find base & actual impedance on l.v,h.v sides in ohm\n",
"\n",
- "#Variable declaration\n",
"MVA_base = 5.0 #Base MVA on both sides\n",
"hv_base = 11.0 #Line to line base voltages in kV on h.v side\n",
"lv_base = 0.4 #Line to line base voltages in kV on l.v side\n",
"Z = 5.0/100 #Impedance of 5%\n",
"\n",
- "#Calculation\n",
"Z_base_hv = (hv_base)**2/MVA_base #Base impedance on h.v side(ohm)\n",
"Z_base_lv = (lv_base)**2/MVA_base #Base impedance on l.v side(ohm)\n",
"Z_act_hv = Z * Z_base_hv #Actual impedance viewed from h.v side(ohm)\n",
"Z_act_lv = Z * Z_base_lv #Actual impedance viewed from l.v side(ohm)\n",
"\n",
- "#Result\n",
"print('Base impedance on h.v side = %.1f ohm' %Z_base_hv)\n",
"print('Base impedance on l.v side = %.3f ohm' %Z_base_lv)\n",
"print('Actual impedance viewed from h.v side = %.2f ohm' %Z_act_hv)\n",
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_3_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_3_2.ipynb
index a6c97b20..7b594528 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_3_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_3_2.ipynb
@@ -27,9 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Compare size,volume,losses of conductor materials\n",
"\n",
- "#Variable declaration\n",
"P = 5.0 #Power(MW)\n",
"pf = 0.8 #lagging power factor\n",
"d = 15.0 #Distance of line(km)\n",
@@ -38,15 +36,12 @@
"kV_1 = 11.0 #Permissible voltage level(kV)\n",
"kV_2 = 22.0 #Permissible voltage level(kV)\n",
"\n",
- "#Calculation\n",
- "#For 11 kV level\n",
"I_1 = (P*10**3)/((3)**(0.5) * (kV_1) * pf) #Load current(A)\n",
"area_1 = I_1/J #Cross-sectional area of the phase conductor(mm^2)\n",
"volume_1 = 3 * (area_1/10**6) * (d*10**3) #Volume of conductors material(m^3)\n",
"R_1 = r * (d*10**3)/(area_1 * (10**-6)) #Resistance per phase(ohm)\n",
"PL_1 = 3 * (I_1**2) * (R_1*10**(-3)) #Power loss(kW)\n",
"\n",
- "#For 22 kV level\n",
"I_2 = (P*10**3)/((3)**(0.5) * (kV_2) * pf) #Load current(A)\n",
"area_2 = I_2/J #Cross-sectional area of the phase conductor(mm^2)\n",
"volume_2 = 3 * (area_2/10**6) * (d*10**3) #Volume of conductors material(m^3)\n",
@@ -56,7 +51,6 @@
"vol_ch = (volume_1-volume_2)/volume_1*100 #Change in volume of 22kV level from 11 kV level(%)\n",
"loss_ch = (PL_1-PL_2)/PL_1*100 #Change in losses of 22kV level from 11 kV level(%)\n",
"\n",
- "#Result\n",
"print('For 11 kV level :')\n",
"print('Cross-sectional area of the phase conductor = %d mm^2' %area_1)\n",
"print('Volume of conductors material = %.2f m^3' %volume_1)\n",
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_4_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_4_2.ipynb
index 87e5269f..038d3cb9 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_4_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_4_2.ipynb
@@ -27,27 +27,21 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find total loop inductance\n",
"\n",
- "#Variable declaration\n",
"l = 10.0 #Length of 1-phase line(km)\n",
"d = 100.0 #Spacing b/w conductors(cm)\n",
"r = 0.3 #Radius(cm)\n",
"u_r_1 = 1.0 #Relative permeability of copper\n",
"u_r_2 = 100.0 #Relative permeability of steel\n",
"\n",
- "#Calculation\n",
- "#For copper\n",
"r_1 = 0.7788*r #Radius of hypothetical conductor(cm)\n",
"import math\n",
"L_1 = 4 * 10**(-7) * math.log(d/r_1) #Loop inductance(H/m)\n",
"L_T1 = L_1 * l * 10**6 #Total loop inductance(mH)\n",
"\n",
- "#For steel\n",
"L_2 = 4 * 10**(-7) * (math.log(d/r) + (u_r_2/4))#Loop inductance(H/m)\n",
"L_T2 = L_2 * l * 10**6 #Total loop inductance(mH)\n",
"\n",
- "#Result\n",
"print('(i) Total loop inductance of copper conductor = %.2f mH' %L_T1)\n",
"print('(ii)Total loop inductance of steel conductor = %.2f mH' %L_T2)"
],
@@ -77,18 +71,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculate inductance per km\n",
"\n",
- "#Variable declaration\n",
"r = 0.4 #Radius of conductor(cm)\n",
"h = 1000 #Height of line(cm)\n",
"\n",
- "#Calculation\n",
"import math\n",
"d = 2*h #Spacing between conductors(cm)\n",
"L = 2 * 10**(-4) * math.log(2*h/(0.7788*r)) * 1000 #Inductance of conductor(mH/km)\n",
"\n",
- "#Result\n",
"print('Inductance of the conductor = %.3f mH/km' %L)"
],
"language": "python",
@@ -116,21 +106,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find line inductance per phase per km\n",
"\n",
- "#Variable declaration\n",
"d_ab = 4 #Distance b/w conductor a & b(m)\n",
"d_bc = 9 #Distance b/w conductor b & c(m)\n",
"d_ca = 6 #Distance b/w conductor c & a(m)\n",
"r = 1.0 #Radius of each conductor(cm)\n",
"\n",
- "#Calculation\n",
"import math\n",
"D_m = (d_ab * d_bc * d_ca)**(1.0/3) #Geometric mean separation(m)\n",
"r_1 = 0.7788 * (r/100) #Radius of hypothetical conductor(m)\n",
"L = 2 * 10**(-7) * math.log(D_m/r_1) * 10**6 #Line inductance(mH/phase/km)\n",
"\n",
- "#Result\n",
"print('Line inductance , L = %.2f mH/phase/km' %L)"
],
"language": "python",
@@ -158,9 +144,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find loop inductance per km\n",
"\n",
- "#Variable declaration\n",
"r = 1.0 #Radius of each conductor(cm)\n",
"d_11 = 30 #Distance b/w conductor 1 & 1'(cm)\n",
"d_22 = 30 #Distance b/w conductor 2 & 2'(cm)\n",
@@ -169,21 +153,18 @@
"d_112 = 100 #Distance b/w conductor 1' & 2(cm)\n",
"d_1122 = 130 #Distance b/w conductor 1' & 2'(cm)\n",
"\n",
- "#Calculation\n",
"import math\n",
"r_1 = 0.7788 * r #Radius of hypothetical conductor(cm)\n",
"D_s = (d_11 * r_1 * d_22 * r_1)**(1.0/4) #Geometric mean radius(cm)\n",
"D_m = (d_12 * d_122 * d_112 * d_1122)**(1.0/4) #Geometric mean separation(cm)\n",
"L = 4 * 10**(-7) * math.log(D_m/D_s) * 10**6 #Loop inductance(mH/km)\n",
"\n",
- "#Inductance of single phase system having 2 conductors only\n",
"R = 2**0.5 #Radius of single conductor(cm)\n",
"d = 130.0 #Conductor position(cm)\n",
"L_1 = 4*10**(-7)*math.log(d/(0.7788*R))*10**6 #Loop inductance(mH/km)\n",
"L_diff = (L_1 - L)/L*100 #Change in inductance(%)\n",
"r_diff = D_s - R #Effective radius difference\n",
"\n",
- "#Result\n",
"print('Loop inductance , L = %.3f mH/km' %L)\n",
"print('Loop inductance having two conductors only , L = %.3f mH/km' %L_1)\n",
"print('There is an Increase of %.f percent in inductance value ' %L_diff)\n",
@@ -217,9 +198,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find inductance/phase/km\n",
"\n",
- "#Variable declaration\n",
"r = 1.5 #Radius of each conductor(cm)\n",
"D_a1a2 = 0.3 #Distance b/w conductor a1 & a2(m)\n",
"D_a2a1 = 0.3 #Distance b/w conductor a2 & a1(m)\n",
@@ -236,7 +215,6 @@
"D_a2c1 = 30.3 #Distance b/w conductor a2 & c1(m)\n",
"D_a2c2 = 30.6 #Distance b/w conductor a2 & c2(m)\n",
"\n",
- "#Calculation\n",
"import math\n",
"r_1 = 0.7788 * (r/100) #Radius of hypothetical conductor(m)\n",
"D_s = (D_a1a2 * r_1 * D_a2a1 * r_1)**(1.0/4) #Geometric mean radius(m)\n",
@@ -246,7 +224,6 @@
"D_m = (D_ab * D_bc * D_ca)**(1.0/3) #Geometric mean separation(m)\n",
"L = 2 * 10**(-4) * math.log(D_m/D_s) * 1000 #Inductance(mH/km)\n",
"\n",
- "#Result\n",
"print('Inductance/phase/km = %.3f mH/km' %L)"
],
"language": "python",
@@ -274,21 +251,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find capacitance & charging current\n",
"\n",
- "#Variable declaration\n",
"r = 0.6 #Radius of each conductor(cm)\n",
"d = 150 #Separation distance(cm)\n",
"L = 40*10**3 #Length of overhead line(m)\n",
"f = 50 #Frequency(Hertz)\n",
"v = 50*10**3 #System voltage(V)\n",
"\n",
- "#Calculation\n",
"import math\n",
"C_ab = (math.pi * 8.854 * 10**(-12))/(math.log(d/r)) * L #Capacitance b/w conductors(F)\n",
"I = complex(0,v * 2 * math.pi * f * C_ab) #Charging current leads voltage by 90\u00b0(A)\n",
"\n",
- "#Result\n",
"print('Capacitance between two conductors , C_ab = %.3e F' %C_ab)\n",
"print('Charging current , I = j%.3f A' %I.imag)"
],
@@ -318,9 +291,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find capacitance per phase per km\n",
"\n",
- "#Variable declaration\n",
"r = 0.015 #Radius of each conductor(m)\n",
"D_a1a2 = 0.3 #Distance b/w conductor a1 & a2(m)\n",
"D_a2a1 = 0.3 #Distance b/w conductor a2 & a1(m)\n",
@@ -337,7 +308,6 @@
"D_a2c1 = 30.3 #Distance b/w conductor a2 & c1(m)\n",
"D_a2c2 = 30.6 #Distance b/w conductor a2 & c2(m)\n",
"\n",
- "#Calculation\n",
"import math\n",
"D_s = (D_a1a2 * r * D_a2a1 * r)**(1.0/4) #Geometric mean radius(m)\n",
"D_ab = (D_a1b1 * D_a1b2 * D_a2b1 * D_a2b2)**(1.0/4) #Mutual GMD b/w conductor a & b(m)\n",
@@ -346,7 +316,6 @@
"D_m = (D_ab * D_bc * D_ca)**(1.0/3) #Geometric mean separation(m)\n",
"C_n = 2 * math.pi * 8.854 * 10**(-9) /(math.log(D_m/D_s)) #Capacitance per phase(F/km)\n",
"\n",
- "#Result\n",
"print('Capacitance per phase , C_n = %.3e F/km' %C_n)"
],
"language": "python",
@@ -374,21 +343,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find capacitance/phase/km\n",
"\n",
- "#Variable declaration\n",
"r = 0.015 #Radius of each conductor(m)\n",
"D_ab = 15 #Horizontal distance b/w conductor a & b(m)\n",
"D_bc = 15 #Horizontal distance b/w conductor b & c(m)\n",
"D_ac = 30 #Horizontal distance b/w conductor a & c(m)\n",
"\n",
- "#Calculation\n",
"import math\n",
"D_m = (D_ab * D_bc * D_ac)**(1.0/3) #Geometric mean separation(m)\n",
"D_s = 2**(1.0/2) * r #Geometric mean radius(m)\n",
"C_n = 2 * math.pi * 8.854 * 10**(-9) /(math.log(D_m/D_s)) #Capacitance/phase/km(F/km)\n",
"\n",
- "#Result\n",
"print('Capacitance per phase , C_n = %.3e F/km' %C_n)"
],
"language": "python",
@@ -416,20 +381,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find line capacitance per km & compare\n",
"\n",
- "#Variable declaration\n",
"h = 5 #Height of conductor above ground(m)\n",
"d = 1.5 #Conductor spacing(m)\n",
"r = 0.006 #Radius of conductor(m)\n",
"\n",
- "#Calculation\n",
"import math\n",
"C_AB = math.pi * 8.854*10**-9/math.log(d/(r*(1+((d*d)/(4*h*h)))**0.5)) #Capacitance with effect of earth(F/km)\n",
"C_AB1 = math.pi * 8.854*10**-9/math.log(d/r) #Capacitance ignoring effect of earth(F/km)\n",
"ch = (C_AB - C_AB1)/C_AB * 100 #Change in capacitance with effect of earth(%)\n",
"\n",
- "#Result\n",
"print('Line capacitance with effect of earth , C_AB = %.3e F/km' %C_AB)\n",
"print('Line capacitance ignoring effect of earth , C_AB = %.3e F/km' %C_AB1)\n",
"print('With effect of earth slight increase in capacitance = %.1f percent' %ch)"
@@ -461,9 +422,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find sending end voltage,current,power factor & transmission loss\n",
"\n",
- "#Variable declaration\n",
"R = 0.16 #Resistance(ohm)\n",
"L = 1.26*10**(-3) #Inductance(H)\n",
"C = 8.77*10**(-9) #Capacitance(F)\n",
@@ -473,30 +432,24 @@
"V_r = 132000.0 #Receiving end voltage(V)\n",
"f = 50.0 #Frequency(Hz)\n",
"\n",
- "#Calculation\n",
- "#Step-I\n",
"import math\n",
"import cmath\n",
"w = 2 * math.pi * f\n",
"z = complex(R, w*L) #Series impedance per phase per km(ohm)\n",
"y = complex(0, w*C) #Shunt admittance per phase per km(mho)\n",
"\n",
- "#Step-II\n",
"g = (y*z)**(0.5) #propagation constant(/km)\n",
"gl = g * l\n",
"Z_c = (z/y)**(0.5) #Surge impedance(ohm)\n",
"\n",
- "#Step-III\n",
"cosh_gl = cmath.cosh(gl)\n",
"sinh_gl = cmath.sinh(gl)\n",
"\n",
- "#Step-IV\n",
"A = cosh_gl\n",
"B = Z_c * sinh_gl\n",
"C = (sinh_gl/Z_c)\n",
"D = cosh_gl\n",
"\n",
- "#Step-V\n",
"fi = math.acos(pf) #Power factor angle(radians)\n",
"V_R = V_r/(3**0.5) #Receiving end voltage(V)\n",
"I_R = (P*10**6/((3**0.5)*V_r))*(pf - complex(0,math.sin(fi)))#Receiving end current(A)\n",
@@ -508,7 +461,6 @@
"P_R = (P/3)*pf #Receiving end power/phase(MW)\n",
"P_L = 3*(P_S - P_R) #Total line loss(MW)\n",
"\n",
- "#Result\n",
"print('Sending end voltage , V_S = %.2f\u2220%.2f\u00b0 kV/phase' %(abs(V_S*10**-3),cmath.phase(V_S)*180/math.pi))\n",
"print('Sending end line voltage = %.2f kV' %abs(V_S_L))\n",
"print('Sending end current , I_S = %.2f\u2220%.2f\u00b0 A' %(abs(I_S),cmath.phase(I_S)*180/math.pi))\n",
@@ -547,16 +499,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find values of equivalent pi network\n",
"\n",
- "#Variable declaration\n",
"R = 0.1 #Resistance/phase/km(ohm)\n",
"D_m = 800.0 #Spacing b/w conductors(cm)\n",
"d = 1.5 #Diameter of each conductor(cm)\n",
"l = 300.0 #Length of transmission line(km)\n",
"f = 50.0 #Frequency(Hz)\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"L = 2*10**(-4)*math.log(D_m*2/d) #Inductance/phase/km(H)\n",
@@ -572,7 +521,6 @@
"Z_S = Z_c * sinh_gl #Series impedance(ohm)\n",
"Y_P = (1/Z_c)*cmath.tanh(gl/2) #Pillar admittance(mho)\n",
"\n",
- "#Result\n",
"print('Values of equivalent-pi network are :')\n",
"print('Series impedance , Z_S = (%.2f + j%.2f) ohm' %(Z_S.real,Z_S.imag))\n",
"print('Pillar admittance , Y_P = %.2e\u2220%.2f\u00b0 mho = j%.2e mho' %(abs(Y_P),(cmath.phase(Y_P)*180/math.pi),Y_P.imag))\n",
@@ -607,9 +555,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find efficiency,regulation,reactive power at sending end & absorbed by line\n",
"\n",
- "#Variable declaration\n",
"V_r = 220000.0 #Voltage(V)\n",
"P = 100.0 #Power(MW)\n",
"r = 0.08 #Series resistance(ohm)\n",
@@ -621,7 +567,6 @@
"l_3 = 300.0 #Transmission length(km) for case(iii)\n",
"l_4 = 500.0 #Transmission length(km) for case(iv)\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"z = complex(r,x) #Series impedance/km(ohm)\n",
@@ -633,7 +578,6 @@
"I_R = P*10**6/((3**0.5)*V_r*pf)*(pf - complex(0,math.sin(theta_R)))#Receiving end current(A)\n",
"Z_c = (z/y)**(0.5) #Surge impedance(ohm)\n",
"\n",
- "#case(i) - Short length line\n",
"A_1 = 1 #Constant A\n",
"B_1 = z*l_1 #Constant B(ohm)\n",
"C_1 = 0 #Constant C(mho)\n",
@@ -647,7 +591,6 @@
"Q_S_1 = V_S_1 * I_S_1.conjugate()*10**-6 #Sending end reactive power(MVAR)\n",
"Q_line_1 = Q_S_1.imag - Q_R #Reactive power absorbed by line(MVAR)\n",
"\n",
- "#case(ii) - Medium length line\n",
"Z_S_2 = z*l_2\n",
"Y_P_2 = y*l_2/2\n",
"A_2 = 1 + Y_P_2*Z_S_2\n",
@@ -662,7 +605,6 @@
"reg_2 = (abs(V_S_2/A_2) - V_R)/V_R*100 #Regulation(%)\n",
"Q_line_2 = S_S_2.imag - Q_R #Reactive power absorbed by line(MVAR)\n",
"\n",
- "#case(iii) - Long length line\n",
"g_3 = (y*z)**(0.5) #propagation constant(/km)\n",
"gl_3 = g_3 * l_3\n",
"cosh_gl_3 = cmath.cosh(gl_3)\n",
@@ -679,7 +621,6 @@
"reg_3 = (abs(V_S_3/A_3) - V_R)/V_R*100 #Regulation(%)\n",
"Q_line_3 = S_S_3.imag - Q_R #Reactive power absorbed by line(MVAR)\n",
"\n",
- "#case(iv) - Long length line\n",
"g_4 = (y*z)**(0.5) #propagation constant(/km)\n",
"gl_4 = g_4 * l_4\n",
"cosh_gl_4 = cmath.cosh(gl_4)\n",
@@ -696,7 +637,6 @@
"reg_4 = (abs(V_S_4/A_4) - V_R)/V_R*100 #Regulation(%)\n",
"Q_line_4 = S_S_4.imag - Q_R #Reactive power absorbed by line(MVAR)\n",
"\n",
- "#Result\n",
"print('Case(i) : For Length = 60 km')\n",
"print('Efficiency , n = %.2f percent' %n_1)\n",
"print('Regulation = %.3f percent' %reg_1)\n",
@@ -768,9 +708,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find reactive VARs\n",
"\n",
- "#Variable declaration\n",
"import math\n",
"import cmath\n",
"A = 0.8*cmath.exp(1j*1.4*math.pi/180) #Line constant\n",
@@ -780,11 +718,9 @@
"P = 75.0 #Power(MVA) for case(a)\n",
"pf = 0.8 #Power factor lagging\n",
"\n",
- "#Calculation\n",
"a = cmath.phase(A) #Phase angle of A(radian)\n",
"b = cmath.phase(B) #Phase angle of B(radian)\n",
"\n",
- "#Case(a)\n",
"P_R = P * pf #Active power demanded by load(MW)\n",
"P_React = P *(1-pf**2)**0.5 #Reactive power demanded by load(MVAR)\n",
"cos_b_delta_1 = P_R*abs(B)/(V_R*V_S) + abs(A)*math.cos(b-a) #cos(b-delta)[in radians]\n",
@@ -792,13 +728,11 @@
"Q_R_1 = (V_R*V_S/abs(B))*math.sin(b-delta_1) - (abs(A)*V_R**2/abs(B))*math.sin(b-a) #Reactive power at sending end(MVAR)\n",
"Reactive_power_1 = P_React - Q_R_1 #Reactive power to be supplied by compensating equipment(MVAR)\n",
"\n",
- "#Case(b)\n",
"cos_b_delta_2 = (abs(A)*V_R/V_S)*math.cos(b-a) #cos(b-delta)[in radians]\n",
"delta_2 = b - math.acos(cos_b_delta_2) #delta(radians)\n",
"Q_R_2 = (V_R*V_S/abs(B))*math.sin(b-delta_2) - (abs(A)*V_R**2/abs(B))*math.sin(b-a) #Reactive power at sending end(MVAR)\n",
"Reactive_power_2 = Q_R_2 #Reactive power to be absorbed by compensating equipment(MVAR)\n",
"\n",
- "#Result\n",
"print('(a) Reactive VARs to be supplied by compensating equipment = %.2f MVAR' %Reactive_power_1)\n",
"print('(b) Reactive VARs to be absorbed by compensating equipment = %.2f MVAR' %Reactive_power_2)"
],
@@ -828,9 +762,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find rating of device & power factor\n",
"\n",
- "#Variable declaration\n",
"r = 25.0 #Resistance/phase(ohm)\n",
"x = 90.0 #Reactance/phase(ohm)\n",
"V_S = 145.0 #Sending end voltage(kV)\n",
@@ -838,7 +770,6 @@
"P_R_1 = 0 #Power(MW)\n",
"P_R_2 = 50.0 #Power(MW)\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"A = 1.0*cmath.exp(1j*0*math.pi/180) #Line constant\n",
@@ -846,19 +777,16 @@
"a = cmath.phase(A) #Phase angle of A(radian)\n",
"b = cmath.phase(B) #Phase angle of B(radian)\n",
"\n",
- "#No load condition\n",
"cos_b_delta_1 = (V_R/V_S)*math.cos(b-a)\n",
"delta_1 = b - math.acos(cos_b_delta_1)\n",
"Q_R_1 = (V_R*V_S/abs(B))*math.sin(b-delta_1) - (abs(A)*V_R**2/abs(B))*math.sin(b-a)\n",
"\n",
- "#For 50 MW loading\n",
"cos_b_delta_2 = (P_R_2*abs(B)/(V_R*V_S))+(abs(A)*V_R/V_S)*math.cos(b-a)\n",
"delta_2 = (b - math.acos(cos_b_delta_2))\n",
"Q_R_2 = (V_R*V_S/abs(B))*math.sin(b-delta_2)-(abs(A)*V_R**2/abs(B))*math.sin(b-a) #Reactive power available at receiving end(MVAR)\n",
"Q_S_2 = Q_R_1 + Q_R_2 #Reactive power to be supplied by equipment(MVAR)\n",
"pf = math.cos(math.atan(Q_S_2/P_R_2)) #Power factor\n",
"\n",
- "#Result\n",
"print('Rating of device = %.2f MVAR' %Q_R_1)\n",
"print('Power factor = %.2f lagging' %pf)"
],
@@ -888,9 +816,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find rating,power angle,maximum power,reactive power & efficiency\n",
"\n",
- "#Variable declaration\n",
"import math\n",
"import cmath\n",
"A = 0.9*cmath.exp(1j*1.0*math.pi/180) #Line constant\n",
@@ -900,11 +826,9 @@
"P = 100.0 #Power(MVA)\n",
"pf = 0.8 #Power factor lagging\n",
"\n",
- "#Calculation\n",
"a = cmath.phase(A) #Phase angle of A(radian)\n",
"b = cmath.phase(B) #Phase angle of B(radian)\n",
"\n",
- "#Case(a)\n",
"P_R = P * pf #Active power at receiving end(MW)\n",
"cos_b_delta = (P_R*abs(B)/(V_R*V_S))+(abs(A)*V_R/V_S)*math.cos(b-a) #cos(b-delta)[in radians]\n",
"delta_1 = (b - math.acos(cos_b_delta))\n",
@@ -912,14 +836,12 @@
"P_Re = P *(1-pf**2)**0.5 #Reactive power(MVAR)\n",
"rating = P_Re - Q_R #Rating of phase modifier(MVAR)\n",
"\n",
- "#Case(b)\n",
"delta_2 = b #Maximum power is received when delta = b\n",
"P_Rmax = (V_R*V_S/abs(B))-(abs(A)*V_R**2/abs(B))*math.cos(b-a) #Maximum power at receiving end(MW)\n",
"Q_R = -(abs(A/B)*V_R**2)*math.sin(b-a) #Reactive power at receive end(MVAR)\n",
"P_S = (V_S**2*abs(A/B))*math.cos(b-a)-(V_S*V_R/abs(B))*math.cos(b+delta_2) #Sending end power(MW)\n",
"n_line = (P_Rmax/P_S)*100 #Line efficiency(%)\n",
"\n",
- "#Result\n",
"print('Case(a) :')\n",
"print('Rating of phase modifier = %.3f MVAR' %rating)\n",
"print('Power angle , delta = %.2f\u00b0' %(delta_1*180/math.pi))\n",
@@ -960,9 +882,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find active power,reactive power & efficiency\n",
"\n",
- "#Variable declaration\n",
"import math\n",
"import cmath\n",
"A = 0.96*cmath.exp(1j*1.0*math.pi/180) #Line constant\n",
@@ -972,26 +892,20 @@
"pf = 0.8 #Power factor lagging\n",
"delta = 15*math.pi/180 #Power angle(radians)\n",
"\n",
- "#Calculation\n",
"a = cmath.phase(A) #Phase angle of A(radian)\n",
"b = cmath.phase(B) #Phase angle of B(radian)\n",
"\n",
- "#Case(i)\n",
"P_R = (V_R*V_S/abs(B))*math.cos(b-delta) - (abs(A/B)*V_R**2)*math.cos(b-a) #Active power at receiving end(MW)\n",
"Q_RL = P_R*math.tan(math.acos(pf)) #Reactive power demanded by load(MVAR)\n",
"\n",
- "#Case(ii)\n",
"Q_R = (V_R*V_S/abs(B))*math.sin(b-delta) - (abs(A/B)*V_R**2)*math.sin(b-a) #Reactive power(MVAR)\n",
"rating = Q_RL - Q_R #Rating of device(MVAR)\n",
"\n",
- "#Case(iii)\n",
"P_S = (V_S**2*abs(A/B))*math.cos(b-a) - (V_R*V_S/abs(B))*math.cos(b+delta) #Sending end active power(MW)\n",
"n_line = (P_R/P_S)*100 #Efficiency of line(%)\n",
"\n",
- "#Case(iv)\n",
"Q_S = (V_S**2*abs(A/B))*math.sin(b-a) - (V_R*V_S/abs(B))*math.sin(b+delta) #Sending end reactive power(MVAR)\n",
"\n",
- "#Result\n",
"print('(i) Active power demanded by load , P_R = %.2f MW' %P_R)\n",
"print(' Reactive power demanded by load , Q_RL = %.2f MVAR' %Q_RL)\n",
"print('(ii) Rating of the device , Q_R = %.2f MVAR' %rating)\n",
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_5_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_5_2.ipynb
index 52614bb8..424e036e 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_5_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_5_2.ipynb
@@ -27,9 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find sag\n",
"\n",
- "#Variable declaration\n",
"L = 250.0 #Span(m)\n",
"d = 1.1*10**-2 #Conductor diameter(m)\n",
"w = 0.650*9.81 #Conductor weight(N/m)\n",
@@ -40,15 +38,12 @@
"t_3 = 10.0**-2 #Thickness of ice covering(m) for case(iii)\n",
"w_ice = 915.0 #Ice weight(kg/m^3)\n",
"\n",
- "#Calculation\n",
"import math\n",
"T_0 = (bl/sf)*9.81 #Allowable tension(N)\n",
"\n",
- "#Case(i)\n",
"S_1 = (T_0/w)*(math.cosh(w*L/(2*T_0))-1) #Sag(m)\n",
"S_1_1 = (w*L**2)/(8*T_0) #Sag using parabolic equation(m)\n",
"\n",
- "#Case(ii)\n",
"F_w_2 = P_w_2 * d #Wind force(N/m)\n",
"w_t_2 = (w**2 + F_w_2**2)**0.5 #Total force on conductor(N/m)\n",
"S_2 = (T_0/w_t_2)*(math.cosh(w_t_2*L/(2*T_0))-1) #Sag(m)\n",
@@ -56,7 +51,6 @@
"alpha_2 = math.atan(F_w_2/w) #w_t inclined vertical angle(radians)\n",
"S_v_2 = S_2 * math.cos(alpha_2) #Vertical component of sag(m)\n",
"\n",
- "#Case(iii)\n",
"D_3 = d + 2*t_3 #Diameter of conductor with ice(m)\n",
"F_w_3 = P_w_3 * D_3 #Wind force(N/m)\n",
"w_ice_3 = (math.pi/4)*(D_3**2 - d**2)*w_ice*9.81 #Weight of ice(N/m)\n",
@@ -66,7 +60,6 @@
"alpha_3 = math.atan(F_w_3/(w+w_ice_3)) #w_t inclined vertical angle(radians)\n",
"S_v_3 = S_3 * math.cos(alpha_3) #Vertical component of sag(m)\n",
"\n",
- "#Result\n",
"print('Case(i) :')\n",
"print('Sag using catenary equation = %.4f m ' %S_1)\n",
"print('Sag using parabolic equation = %.4f m \\n' %S_1_1)\n",
@@ -117,9 +110,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find sag & height of lowest cross arm\n",
"\n",
- "#Variable declaration\n",
"w = 0.85 #Weight of overhead line(kg/m)\n",
"T_0 = 3.5*10**4 #Maximum allowable tension(N)\n",
"L_1 = 160.0 #Span(m) for case(i)\n",
@@ -129,26 +120,20 @@
"g_c = 7.1 #Minimum ground clearance(m)\n",
"L_S = 1.5 #Length of suspension insulator string\n",
"\n",
- "#Calculation\n",
"w1 = w * 9.81 #Weight(N/m)\n",
"\n",
- "#Case(i)\n",
"S_1 = w1*L_1**2/(8*T_0) #Sag(m)\n",
"H_1 = g_c + S_1 + L_S #Height of lowest cross-arm(m)\n",
"\n",
- "#Case(ii)\n",
"S_2 = w1*L_2**2/(8*T_0) #Sag(m)\n",
"H_2 = g_c + S_2 + L_S #Height of lowest cross-arm(m)\n",
"\n",
- "#Case(iii)\n",
"S_3 = w1*L_3**2/(8*T_0) #Sag(m)\n",
"H_3 = g_c + S_3 + L_S #Height of lowest cross-arm(m)\n",
"\n",
- "#Case(iv)\n",
"S_4 = w1*L_4**2/(8*T_0) #Sag(m)\n",
"H_4 = g_c + S_4 + L_S #Height of lowest cross-arm(m)\n",
"\n",
- "#Result\n",
"print('Span in meters\\t %d\\t %d\\t %d\\t %d' %(L_1,L_2,L_3,L_4))\n",
"print('Sag in meters\\t %.3f\\t %.3f\\t %.3f\\t %.3f' %(S_1,S_2,S_3,S_4))\n",
"print('Height of lowest cross-arm in meters\\t %.3f\\t %.3f\\t %.3f\\t %.3f' %(H_1,H_2,H_3,H_4))\n",
@@ -185,16 +170,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find minimum clearance & sag\n",
"\n",
- "#Variable declaration\n",
"w = 0.63 #Weight of conductor(kg/m)\n",
"T_0 = 1350.0 #Maximum allowable load(kg)\n",
"h_1 = 20.0 #Height of first tower(m)\n",
"h_2 = 15.0 #Height of second tower(m)\n",
"L = 240.0 #Span(m)\n",
"\n",
- "#Calculation\n",
"h = h_1 - h_2 #Difference in levels of towers(m)\n",
"L_1 = (L/2)+(T_0*h/(w*L)) #Horizontal distance from higher support(m)\n",
"L_2 = (L/2)-(T_0*h/(w*L)) #Horizontal distance from lower support(m)\n",
@@ -202,7 +184,6 @@
"S_2 = w*L_2**2/(2*T_0) #Sag from lower support(m)\n",
"clearance = (h_1 - S_1) #Minimum clearance(m)\n",
"\n",
- "#Result\n",
"print('Minimum clearance between a line conductor & water surface = %.3f m' %clearance)\n",
"print('Sag from upper support = %.3f m' %S_1)"
],
@@ -232,15 +213,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find voltage across each disc & string efficiency\n",
"\n",
- "#Variable declaration\n",
"n = 3 #Number of discs\n",
"m = 0.1 #capacitance of each link pin to self capacitance\n",
"V = 33.0 #Voltage(kV)\n",
"\n",
- "#Calculation\n",
- "#Case(i)\n",
"a_1 = 1\n",
"a_2 = (1 + m)*a_1\n",
"a_3 = m*(a_1 + a_2) + a_2\n",
@@ -251,10 +228,8 @@
"s_v_2 = (v_2/V)*100 #Voltage across middle unit to string voltage(%)\n",
"s_v_3 = (v_3/V)*100 #Voltage across bottom unit to string voltage(%)\n",
"\n",
- "#Case(ii)\n",
"efficiency = V*100/(3*v_3) #String efficiency(%)\n",
"\n",
- "#Result\n",
"print('Case(i) :')\n",
"print('Voltage across top unit , v_1 = %.3f kV' %v_1)\n",
"print('Voltage across middle unit , v_2 = %.3f kV' %v_2)\n",
@@ -299,15 +274,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find voltage across each disc & system voltage\n",
"\n",
- "#Variable declaration\n",
"n = 8 #Number of discs\n",
"m = 1.0/6 #capacitance of each link pin to self capacitance\n",
"V = 30.0 #Voltage(kV)\n",
"\n",
- "#Calculation\n",
- "#Case(i)\n",
"a_1 = 1\n",
"a_2 = (1+m)*a_1\n",
"a_3 = m*(a_1+a_2)+a_2\n",
@@ -333,11 +304,9 @@
"s_v_7 = v_7/V*100 #Voltage across unit 7 as a % of V\n",
"s_v_8 = v_8/V*100 #Voltage across unit 8 as a % of V\n",
"\n",
- "#Case(ii)\n",
"V_2 = V*100/s_v_8\n",
"V_sys = (3**0.5)*V_2 #Permissible system voltage(kV)\n",
"\n",
- "#Result\n",
"print('Case(i) :')\n",
"print('____________________________________________________________________________________________')\n",
"print('Unit number 1 2 3 4 5 6 7 8\\n')\n",
@@ -379,9 +348,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find string efficiency & safety factor\n",
"\n",
- "#Variable declaration\n",
"v_dry = 65.0 #Dry power frequency flashover voltage for each disc(kV)\n",
"v_wet = 43.0 #Wet power frequency flashover voltage for each disc(kV)\n",
"V = 110 #Voltage of system to be insulated(kV)\n",
@@ -396,8 +363,6 @@
"v_wet_8 = 285.0 #Wet power frequency flashover voltage for 8 units(kV)\n",
"v_wet_10 = 345.0 #Wet power frequency flashover voltage for 10 units(kV)\n",
"\n",
- "#Calculation\n",
- "#For case(i)\n",
"eff_dry_4 = v_dry_4*100/(n_4*v_dry)\n",
"eff_dry_8 = v_dry_8*100/(n_8*v_dry)\n",
"eff_dry_10 = v_dry_10*100/(n_10*v_dry)\n",
@@ -405,7 +370,6 @@
"eff_wet_8 = v_wet_8*100/(n_8*v_wet)\n",
"eff_wet_10 = v_wet_10*100/(n_10*v_wet)\n",
"\n",
- "#For case(ii)\n",
"a_1 = 1\n",
"a_2 = (1+m)*a_1\n",
"a_3 = m*(a_1+a_2)+a_2\n",
@@ -421,7 +385,6 @@
"sf_dry = v_dry/voltage_2 #Factor of safety for dry flashover\n",
"sf_wet = v_wet/voltage_2 #Factor of safety for wet flashover\n",
"\n",
- "#Result\n",
"print('Case(i) :')\n",
"print('___________________________________________________________________________')\n",
"print(' No. of units Dry string efficiency(%) Wet string efficiency(%)')\n",
@@ -470,14 +433,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find conductor voltage & string efficiency\n",
"\n",
- "#Variable declaration\n",
"n = 4 #Number of disc\n",
"v_2 = 13.2 #Voltage across second unit(kV)\n",
"v_3 = 18.0 #Voltage across third unit(kV)\n",
"\n",
- "#Calculation\n",
"m = 0.198 #Obtained by solving the quadratic equation\n",
"a_1 = 1\n",
"a_2 = 1+m\n",
@@ -488,7 +448,6 @@
"V = v_1+v_2+v_3+v_4 #Conductor voltage(kV)\n",
"efficiency = V/(n*v_4)*100 #String efficiency(%)\n",
"\n",
- "#Result\n",
"print('Conductor voltage with respect to the cross-arm , V = %.2f kV' %V)\n",
"print('String efficiency = %.2f percent' %efficiency)"
],
@@ -518,24 +477,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find voltage distribution\n",
"\n",
- "#Variable declaration\n",
"n = 3 #Number of disc\n",
"\n",
- "#Calculation\n",
"unit_1 = 100/3.072 #Disc voltage as % of conductor voltage of Topmost unit\n",
"unit_2 = 1.014/3.072*100 #Disc voltage as % of conductor voltage of second unit\n",
"unit_3 = 1.058/3.072*100 #Disc voltage as % of conductor voltage of bottom unit\n",
"efficiency = 3.072*100/(n*1.058) #String efficiency(%)\n",
"\n",
- "#Without guard ring\n",
"unit_1g = 100/3.752 #Disc voltage as % of conductor voltage of Topmost unit\n",
"unit_2g = 1.18/3.752*100 #Disc voltage as % of conductor voltage of second unit\n",
"unit_3g = 1.5724/3.752*100 #Disc voltage as % of conductor voltage of bottom unit\n",
"efficiency1 = 3.752*100/(n*1.5724) #String efficiency(%)\n",
"\n",
- "#Result\n",
"print('Disc voltages as a percentage of the conductor voltage with guard ring are :')\n",
"print('Topmost unit = %.2f percent' %unit_1)\n",
"print('Second unit = %.2f percent' %unit_2)\n",
@@ -582,9 +536,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find corona inception voltage\n",
"\n",
- "#Variable declaration\n",
"v = 220.0 #Voltage(kV)\n",
"f = 50.0 #Frequency(Hertz)\n",
"p = 752.0 #Pressure(mm of Hg)\n",
@@ -593,13 +545,11 @@
"r = 1.2 #Conductor radius(cm)\n",
"d = 550.0 #Spacing(cm)\n",
"\n",
- "#Calculation\n",
"import math\n",
"delta = (0.392*p)/(273+t) #Air density correction factor\n",
"V_c = 21.1*delta*m*r*math.log(d/r) #Corona inception voltage(kv/phase)rms\n",
"V_c_l = 3**0.5*V_c #Line-line corona inception voltage(kV)\n",
"\n",
- "#Result\n",
"print('Corona inception voltage , V_c = %.2f kV/phase' %V_c)\n",
"print('Line-to-line corona inception voltage = %.2f kV' %V_c_l)"
],
@@ -629,9 +579,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find corona loss/km\n",
"\n",
- "#Variable declaration\n",
"v = 220.0 #Voltage(kV)\n",
"f = 50.0 #Frequency(Hertz)\n",
"v_o = 1.6 #Over voltage(p.u)\n",
@@ -641,7 +589,6 @@
"r = 1.2 #Conductor radius(cm)\n",
"d = 550.0 #Spacing(cm)\n",
"\n",
- "#Calculation\n",
"import math\n",
"delta = (0.392*p)/(273+t) #Air density correction factor\n",
"V_c = 21.1*delta*m*r*math.log(d/r) #Corona inception voltage(kv/phase)rms\n",
@@ -651,7 +598,6 @@
"F = 0.9 #Ratio of V_ph to V_c\n",
"peterson = 3*2.1*f*F*(V_c/math.log10(d/r))**2*10**-5 #Peterson's formula(kW/km)\n",
"\n",
- "#Result\n",
"print('Corona loss using Peeks formula , P = %.2f kW/km' %peek)\n",
"print('Corona loss using Petersons formula , P = %.2f kW/km' %peterson)"
],
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_6_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_6_2.ipynb
index 6374fe50..f73c195c 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_6_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_6_2.ipynb
@@ -27,21 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find charging current & total charging kVAR/km\n",
"\n",
- "#Variable declaration\n",
"C_m = 0.28 #Capacitance b/w ant 2 cores(micro-F/km)\n",
"f = 50.0 #Frequency(Hz)\n",
"V_L = 11.0 #Line voltage(kV)\n",
"\n",
- "#Calculation\n",
"import math\n",
"C = 2*C_m #Capacitance b/w any conductor & shield(micro-F/km)\n",
"w = 2*math.pi*f #Angular frequency\n",
"I_c = V_L*10**3*w*C*10**-6/3**0.5 #Charging current/phase/km(A)\n",
"Total = 3**0.5*I_c*V_L #Total charging kVAR/km\n",
"\n",
- "#Result\n",
"print('Charging current/phase/km , I_c = %.3f A' %I_c)\n",
"print('Total charging kVAR/km = %.2f ' %Total)"
],
@@ -71,26 +67,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find internal sheath radius\n",
"\n",
- "#Variable declaration\n",
"E_c = 100.0 #Safe working stress(kV/cm) rms\n",
"V = 130.0 #Operating voltage(kV) rms\n",
"d = 1.5 #Diameter of conductor(cm)\n",
"\n",
- "#Calculation\n",
- "#For case(i)\n",
"import math\n",
"ln_D = 2*V/(E_c*d)+math.log(d)\n",
"D = math.exp(ln_D)\n",
"thick_1 = (D-d)/2 #Insulation thickness(cm)\n",
"\n",
- "#For case(ii)\n",
"d_2 = 2*V/E_c\n",
"D_2 = 2.718*d_2 #Sheath diameter(cm)\n",
"thick_2 = (D_2-d_2)/2 #Insulation thickness(cm)\n",
"\n",
- "#Result\n",
"print('(i) Internal sheath radius = %.2f cm' %thick_1)\n",
"print('(ii) Internal sheath radius = %.2f cm' %thick_2)"
],
@@ -120,32 +110,25 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find thickness of each layer & conductor voltage\n",
"\n",
- "#Variable declaration\n",
"d = 3.0 #Diameter of conductor(cm)\n",
"D = 8.5 #Sheath diameter(cm)\n",
"e_r1 = 5.0 #Permittivity of inner dielectric\n",
"e_r2 = 3.0 #Permittivity of outer dielectric\n",
"E_c = 30.0 #Safe working stress(kV/cm) rms\n",
"\n",
- "#Calculation\n",
- "#For case(i)\n",
"import math\n",
"E_i = E_c\n",
"D_1 = e_r1/e_r2*d\n",
"thick_1 = (D_1-d)/2 #Thickness of first layer(cm)\n",
"thick_2 = (D-D_1)/2 #Thickness of second layer(cm)\n",
"\n",
- "#For case(ii)\n",
"V_1 = E_c*d*math.log(D_1/d)/2 #Voltage across first layer(kV)\n",
"V_2 = E_i*D_1*math.log(D/D_1)/2 #Voltage across second layer(kV)\n",
"V = V_1 + V_2 #Permissible conductor voltage(kV)\n",
"\n",
- "#For case(iii)\n",
"V_3 = E_c*d*math.log(D/d)/2 #Permissible conductor voltage(kV) for homogeneous permittivity of 5\n",
"\n",
- "#Result\n",
"print('Case(i) :')\n",
"print('Thickness of first layer = %.2f cm' %thick_1)\n",
"print('Thickness of second layer = %.2f cm' %thick_2)\n",
@@ -190,15 +173,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find safe working voltage with & without intersheath\n",
"\n",
- "#Variable declaration\n",
"E = 40.0 #Safe working stress(kV/cm) rms\n",
"d = 1.5 #Conductor diameter(cm)\n",
"D = 6.7 #Sheath diameter(cm)\n",
"t = 0.1 #Thickness of lead tube(cm)\n",
"\n",
- "#Calculation\n",
"import math\n",
"r = d/2 #Conductor radius(cm)\n",
"R = D/2 #Sheath radius(cm)\n",
@@ -209,7 +189,6 @@
"V = V_1 + V_2 #Safe working voltage with intersheath(kV)\n",
"V_no = E*r*math.log(R/r) #Safe working voltage without intersheath(kV)\n",
"\n",
- "#Result\n",
"print('Safe working voltage with intersheath , V = %.2f kV' %V)\n",
"print('Safe working voltage without intersheath , V = %.2f kV' %V_no)"
],
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_7_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_7_2.ipynb
index f7c5fe02..a2411da4 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_7_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_7_2.ipynb
@@ -27,9 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find overall cross-sectional area\n",
"\n",
- "#Variable declaration\n",
"V = 400.0 #Voltage supplied(V)\n",
"f = 50.0 #Frequency(Hz)\n",
"P_1 = 75.0 #Power of induction motor at middle of distributor(kVA)\n",
@@ -40,7 +38,6 @@
"diver_f = 1.2 #Diversity factor\n",
"L = 150.0 #Length of line(m)\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"theta_1 = math.acos(pf_1) #Power factor angle for 75 kVA(radians)\n",
@@ -51,8 +48,6 @@
"L_1 = L/2\n",
"V_per = 0.06*V/3**0.5 #Permissible voltage drop(V)\n",
"\n",
- "#From table 7.1 page number 235\n",
- "#For Ferret\n",
"R_f = 0.734*10**-3 #Resistance(ohm/m)\n",
"X_f = 0.336*10**-3 #Reactance(ohm/m)\n",
"I_2f = P_2*10**3/(3**0.5*V)\n",
@@ -61,7 +56,6 @@
"d_f = 9.0 #Overall conductor diameter(mm)\n",
"area_f = math.pi*d_f**2/4 #Area of ferret conductor(mm^2)\n",
"\n",
- "#For Rabbit\n",
"R_R = 0.587*10**-3 #Resistance(ohm/m)\n",
"X_R = 0.333*10**-3 #Reactance(ohm/m)\n",
"I_2R = P_2*10**3/(3**0.5*V)\n",
@@ -70,7 +64,6 @@
"d_R = 10.0 #Overall conductor diameter(mm)\n",
"area_R = math.pi*d_R**2/4 #Area of rabbit conductor(mm^2)\n",
"\n",
- "#Result\n",
"if(V_f > V_per):\n",
" print('Overall cross-sectional area of the 7/3.35 mm Rabbit ACSR conductors having overall conductor diameter of 10.0 mm = %.2f mm^2' %area_R)\n",
"else:\n",
@@ -101,9 +94,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find overall cross-sectional area\n",
"\n",
- "#Variable declaration\n",
"V = 400.0 #Voltage supplied(V)\n",
"i = 0.5 #Current per meter(A)\n",
"demand_f = 1.0 #Demand factor\n",
@@ -111,34 +102,29 @@
"L = 275.0 #Length of line(m)\n",
"pf = 0.9 #Power factor lagging\n",
"\n",
- "#Calculation\n",
"import math\n",
"I = i*L #Current in distributor/phase(A)\n",
"theta = math.acos(pf) #Power factor angle\n",
"V_per = 0.06*V/3**0.5 #Permissible voltage drop(V)\n",
"\n",
- "#For Weasel\n",
"r_w = 0.985 #Resistance(ohm/km)\n",
"x_w = 0.341 #Reactance(ohm/km)\n",
"V_w = 0.5*i*(r_w*pf+x_w*math.sin(theta))*L**2*10**-3 #Voltage drop for Weasel(V)\n",
"d_w = 7.77 #Diameter of weasel conductor(mm)\n",
"area_w = math.pi*d_w**2/4 #Area of weasel conductor(mm^2)\n",
"\n",
- "#For Ferret\n",
"r_f = 0.734 #Resistance(ohm/km)\n",
"x_f = 0.336 #Reactance(ohm/km)\n",
"V_f = 0.5*i*(r_f*pf+x_f*math.sin(theta))*L**2*10**-3 #Voltage drop for Ferret(V)\n",
"d_f = 9.00 #Diameter of Ferret conductor(mm)\n",
"area_f = math.pi*d_f**2/4 #Area of Ferret conductor(mm^2)\n",
"\n",
- "#For Rabbit\n",
"r_r = 0.587 #Resistance(ohm/km)\n",
"x_r = 0.333 #Reactance(ohm/km)\n",
"V_r = 0.5*i*(r_r*pf+x_r*math.sin(theta))*L**2*10**-3 #Voltage drop for Rabbit(V)\n",
"d_r = 10.0 #Diameter of Rabbit conductor(mm)\n",
"area_r = math.pi*d_r**2/4 #Area of Rabbit conductor(mm^2)\n",
"\n",
- "#Result\n",
"if(V_w < V_per):\n",
" print('Overall cross-sectional area of the 7/2.59 mm Weasel ACSR conductors having overall conductor diameter of 7.77 mm = %.2f mm^2' %area_w)\n",
"elif(V_f < V_per):\n",
@@ -171,9 +157,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find size of ACSR conductor\n",
"\n",
- "#Variable declaration\n",
"V = 400.0 #Voltage supplied(V)\n",
"f = 50.0 #Frequency(Hz)\n",
"L = 300.0 #Length of line(m)\n",
@@ -186,27 +170,23 @@
"i = 0.2 #Distributed load current(A/metre)\n",
"v_drop = 15.0 #Permissible voltage drop\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"theta_1 = math.acos(pf_1) #Power factor angle for 50 A(radians)\n",
"theta_2 = math.acos(pf_2) #Power factor angle for 25 A(radians)\n",
"\n",
- "#For Ferret conductor\n",
"r_f = 0.734*10**-3 #Resistance(ohm/m)\n",
"x_f = 0.336*10**-3 #Reactance(ohm/m)\n",
"V_con_f = I_1*L_1*(r_f*pf_1+x_f*math.sin(theta_1))+I_2*L*(r_f*pf_2+x_f*math.sin(theta_2)) #Voltage drop at B due to concentrated loading(V)\n",
"V_dis_f = 0.5*i*r_f*(L_1+L_2)**2 #Voltage drop at B due to distributed loading(V)\n",
"V_f = V_con_f+V_dis_f #Total voltage drop(V)\n",
"\n",
- "#For Rabbit conductor\n",
"r_r = 0.587*10**-3 #Resistance(ohm/m)\n",
"x_r = 0.333*10**-3 #Reactance(ohm/m)\n",
"V_con_r = I_1*L_1*(r_r*pf_1+x_r*math.sin(theta_1))+I_2*L*(r_r*pf_2+x_r*math.sin(theta_2)) #Voltage drop at B due to concentrated loading(V)\n",
"V_dis_r = 0.5*i*r_r*(L_1+L_2)**2 #Voltage drop at B due to distributed loading(V)\n",
"V_r = V_con_r+V_dis_r #Total voltage drop(V)\n",
"\n",
- "#Result\n",
"if(V_f < v_drop):\n",
" print('Ferret ACSR conductors of size 7/3.00 mm having an overall conductor diameter of 9.0 mm is to be used')\n",
" print('Total voltage drop = %.2f V, which is within limit' %V_f)\n",
@@ -243,9 +223,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find kVAR rating & capacitance value\n",
"\n",
- "#Variable declaration\n",
"P = 5.0 #Power of substation(MVA)\n",
"V_hv = 33.0 #High voltage(kV)\n",
"V_lv = 11.0 #Low voltage(kV)\n",
@@ -256,26 +234,21 @@
"pf_2 = 0.78 #Lagging power factor of maximum load\n",
"pf_i = 0.9 #Lagging power factor of incoming current\n",
"\n",
- "#Calculation\n",
"import math\n",
"theta_1 = math.acos(pf_1)\n",
"theta_2 = math.acos(pf_2)\n",
"theta_i = math.acos(pf_i)\n",
"\n",
- "#Minimum load condition\n",
"load_react = P_1*math.tan(theta_1)*1000 #Load reactive power(kVAR)\n",
"line_react = P_1*math.tan(theta_i)*1000 #Reactive power supplied by line(kVAR)\n",
"rating_fix = load_react - line_react #kVAR rating of fixed capacitor bank(kVAR)\n",
"\n",
- "#Maximum load condition\n",
"bank_react = P_2*(math.tan(theta_2)-math.tan(theta_i))*1000 #Reactive power to be supplied by capacitor banks(kVAR)\n",
"rating_swi = bank_react - rating_fix #Reactive power rating of switched unit(kVAR)\n",
"\n",
- "#Capacitor value\n",
"C_fix = rating_fix*10**-3/(3**0.5*V_lv**2*2*math.pi*f) #Capacitance for fixed bank\n",
"C_swi = rating_swi*10**-3/(3**0.5*V_lv**2*2*math.pi*f) #Capacitance for switched bank\n",
"\n",
- "#Result\n",
"print('kVAR rating of fixed capacitors = %.1f kVAR' %rating_fix)\n",
"print('kVAR rating of switched capacitors = %.1f kVAR' %rating_swi)\n",
"print('Capacitance of fixed bank , C = %.2e F/phase' %C_fix)\n",
@@ -309,16 +282,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find kVAR rating,line current & capacitance of bank\n",
"\n",
- "#Variable declaration\n",
"V = 400.0 #Voltage of induction motor(V)\n",
"f = 50.0 #Frequency(Hz)\n",
"I = 40.0 #Line current(A)\n",
"pf_1 = 0.78 #Lagging power factor of motor\n",
"pf_2 = 0.95 #Raised lagging power factor\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"theta_1 = math.acos(pf_1) #Motor power factor angle(radians)\n",
@@ -333,7 +303,6 @@
"I_phase = I_C/3**0.5 #Phase current of delta connected capacitor bank(A)\n",
"C = I_phase/(V*2*math.pi*f) #Per phase capacitance of bank(micro-F/phase)\n",
"\n",
- "#Result\n",
"print('kVAR rating of the bank = %.2f kVAR per phase' %rating)\n",
"print('Line current = %.2f\u2220%.2f\u00b0 A' %(abs(I_L),cmath.phase(I_L)*180/math.pi))\n",
"print('Per phase capacitance of the bank , C = %.2e F/phase' %C)"
@@ -365,9 +334,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find feeder power factor & load at unity power factor\n",
"\n",
- "#Variable declaration\n",
"P_1 = 250.0 #Load at unity power factor(kW)\n",
"pf_1 = 1 #Power factor\n",
"P_2 = 1500.0 #Load at 0.9 power factor(kW)\n",
@@ -377,7 +344,6 @@
"P_4 = 700.0 #Load at 0.78 power factor(kW)\n",
"pf_4 = 0.76 #Lagging power factor\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"theta_1 = math.acos(pf_1)\n",
@@ -390,7 +356,6 @@
"feeder_KVA = (kW_T**2+kVAR_T**2)**0.5 #Feeder kVA\n",
"feeder_kW = feeder_KVA #Load at unity pf(kW)\n",
"\n",
- "#Result\n",
"print('Feeder power factor = %.3f lagging' %pf_feed)\n",
"print('Load at unity power factor = %.f kW' %feeder_kW)\n",
"print('\\nNOTE : ERROR : The load data should be 700 kW at 0.76 pf lagging instead of 700 kW at 0.78 lagging')"
@@ -423,9 +388,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find line power factor during lean period\n",
"\n",
- "#Variable declaration\n",
"V = 400.0 #Voltage(V)\n",
"f = 50.0 #Frequency(Hz)\n",
"HP_1 = 75.0 #Power(H.P)\n",
@@ -438,11 +401,9 @@
"pf_5 = 0.74 #Power factor of 2nd motor at 2/3 of full load\n",
"pf_6 = 0.8 #Power factor of 3rd motor at full load\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"\n",
- "#Peak season\n",
"theta_1 = math.acos(pf_1)\n",
"theta_2 = math.acos(pf_2)\n",
"theta_3 = math.acos(pf_3)\n",
@@ -457,7 +418,6 @@
"P_react = kW_T*math.tan(theta_4) #Reactive power supplied by line for 0.9 pf(kVAR)\n",
"power = kVAR_T - P_react #Reactive power supplied by capacitor bank(kVAR)\n",
"\n",
- "#Lean season\n",
"theta_5 = math.acos(pf_5)\n",
"theta_6 = math.acos(pf_6)\n",
"S_2L = (2*HP_2*746*10**-3/(3*pf_5))*cmath.exp(1j*theta_5) #kVA demanded by second motor(kVA)\n",
@@ -466,7 +426,6 @@
"S_line = S_TL.real - complex(0,(power-S_TL.imag)) #kVA supplied by line(kVA)\n",
"pf_line = math.cos(cmath.phase(S_line)) #Line power factor\n",
"\n",
- "#Result\n",
"print('Line power factor with capacitor bank connected during lean period = %.2f leading' %pf_line)"
],
"language": "python",
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_8_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_8_2.ipynb
index e6edc8d5..4fd4268d 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_8_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_8_2.ipynb
@@ -27,17 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find overall efficiency\n",
"\n",
- "#Variable declaration\n",
"w = 0.8 #Coal to be burnt for every kWh of electric energy(kg)\n",
"C = 5000 #Calorific value of coal(kilo-calories/kg)\n",
"\n",
- "#Calculation\n",
"heat_energy = C*w/860 #Heat energy of combustion of given coal(kWh)\n",
"efficiency = 1/heat_energy #Overall efficiency\n",
"\n",
- "#Result\n",
"print('Overall efficiency of the plant = %.3f' %efficiency)"
],
"language": "python",
@@ -65,9 +61,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find out daily coal requirement\n",
"\n",
- "#Variable declaration\n",
"P = 250.0 #Power(MW)\n",
"C = 6100.0 #Calorific value(kcal/kg)\n",
"n_1 = 0.9 #Plant runs at full load\n",
@@ -77,14 +71,12 @@
"n_t = 0.3 #Thermal efficiency\n",
"n_g = 0.93 #Generator efficiency\n",
"\n",
- "#Calculation\n",
"E_T = (P*n_1*h_1+P*n_2*h_2)*1000 #Total electric energy produced by plant in a day(kWh)\n",
"efficiency = n_t * n_g #Overall efficiency of the plant\n",
"heat_energy = E_T*860/efficiency #Heat energy of combustion of coal(kcal)\n",
"coal_requ = heat_energy/C #Daily coal requirement(kg)\n",
"coal_requ_ton = coal_requ*10**-3 #Daily coal requirement(tonnes)\n",
"\n",
- "#Result\n",
"print('Daily coal requirement = %.2e kg = %.f tonnes' %(coal_requ,coal_requ_ton))"
],
"language": "python",
@@ -112,20 +104,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find electric power available & energy\n",
"\n",
- "#Variable declaration\n",
"Q = 1.0 #Water discharge(m^3/sec)\n",
"h = 200.0 #Height(m)\n",
"n_h = 0.85 #Hydraulic efficiency\n",
"n_e = 0.95 #Electric efficiency\n",
"\n",
- "#Calculation\n",
"n = n_h*n_e #Overall efficiency\n",
"P = (736.0/75)*Q*h*n #Electrical power available(kW)\n",
"E = P*1.0 #Energy available in an hour(kWh)\n",
"\n",
- "#Result\n",
"print('Electrical power available = %.2f kW' %P)\n",
"print('Energy available in an hour = %.2f kWh' %E)"
],
@@ -155,20 +143,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find percentage fall in reservoir level\n",
"\n",
- "#Variable declaration\n",
"Ad = 6.0*10**6 #Reservoir capacity(m^3)\n",
"h = 150.0 #Head(m)\n",
"n = 0.78 #Overall efficiency\n",
"P = 25.0*10**6 #Power(Watt)\n",
"t = 4.0 #Supply time(hour)\n",
"\n",
- "#Calculation\n",
"AX = P*75*3600*t/(736*h*n*1000) #unit(m^3)\n",
"X_d = AX/Ad*100 #Fall in reservoir level(%)\n",
"\n",
- "#Result\n",
"print('Percentage fall in reservoir level = %.2f percent' %X_d)"
],
"language": "python",
@@ -196,23 +180,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find excitation voltage,current,power factor,power angle,pull out power & electrical stiffness\n",
"\n",
- "#Variable declaration\n",
"X_s = 1.0 #Synchronous reactance of generator(p.u)\n",
"V_b = 1.0 #Terminal voltage of generator=voltage of infinite bus(p.u)\n",
"P_G = 0.5 #Real power output at unity pf(p.u)\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"\n",
- "#Case(a)\n",
"I = P_G/V_b #Generator current(p.u)\n",
"E = complex(V_b,I*X_s) #Excitation emf of finite machine(p.u)\n",
"delta = cmath.phase(E)*180/math.pi #Power angle = angle b/w E & V_b(degree)\n",
"\n",
- "#Case(b)\n",
"P_Gn = P_G/2 #Real power o/p when steam i/p is halved(p.u)\n",
"sin_delta_n = P_Gn*X_s/(abs(E)*V_b)\n",
"delta_n = math.asin(sin_delta_n) #New power angle(radian)\n",
@@ -220,14 +199,11 @@
"I_n = (E_n-V_b)/complex(0,X_s) #Current when steam i/p is halved(p.u)\n",
"pf_n = math.cos(cmath.phase(I_n)) #Power factor when steam i/p is halved\n",
"\n",
- "#Case(c)\n",
"P_po = abs(E)*V_b/X_s #Pull out power(p.u)\n",
"\n",
- "#Case(d)\n",
"stiff_a = abs(E)*V_b/X_s*math.cos(cmath.phase(E)) #Electrical stiffness in case(a) (p.u/radian)\n",
"stiff_b = abs(E)*V_b/X_s*math.cos(cmath.phase(I_n)) #Electrical stiffness in case(b) (p.u/radian)\n",
"\n",
- "#Result\n",
"print('Case(a) :')\n",
"print('Excitation voltage of finite machine , E = %.2f\u2220%.2f\u00b0 p.u' %(abs(E),delta))\n",
"print('Power angle = %.2f\u00b0' %delta)\n",
@@ -280,32 +256,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find power angle,reactive power output,active power & power angle\n",
"\n",
- "#Variable declaration\n",
"X_s = 1.1 #Synchronous reactance of generator(p.u)\n",
"V_b = 1.0 #Terminal voltage of generator=voltage of infinite bus(p.u)\n",
"E = 1.25 #Excitation emf of finite machine(p.u)\n",
"P_G = 0.3 #Active power output(p.u)\n",
"dec = 0.25 #Excitation is decreased\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"\n",
- "#Case(a)\n",
"sin_delta = P_G*X_s/(E*V_b)\n",
"delta = math.asin(sin_delta) #Power angle(radian)\n",
"Q_G = V_b/X_s*(E*math.cos(delta)-V_b) #Reactive power output(p.u)\n",
"\n",
- "#Case(b)\n",
"E_n = (1-dec)*E #New excitation emf of finite machine(p.u)\n",
"P_Gn = P_G #New active power output(p.u)\n",
"sin_delta_n = P_G*X_s/(E_n*V_b)\n",
"delta_n = math.asin(sin_delta_n) #New power angle(radian)\n",
"Q_Gn = V_b/X_s*(E_n*math.cos(delta_n)-V_b) #New reactive power output(p.u)\n",
"\n",
- "#Result\n",
"print('Case(a) :')\n",
"print('Power angle = %.2f\u00b0' %(delta*180/math.pi))\n",
"print('Reactive power output , Q_G = %.3f p.u' %Q_G)\n",
@@ -346,9 +316,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find change in active & reactive power\n",
"\n",
- "#Variable declaration\n",
"X_s = 1.05 #Synchronous reactance of generator(p.u)\n",
"V_b = 0.95 #Terminal voltage of generator=voltage of infinite bus(p.u)\n",
"X_L = 0.1 #Reactance of link(p.u)\n",
@@ -356,16 +324,13 @@
"P_G = 0.15 #Active power output(p.u)\n",
"inc = 1 #Turbine torque increased\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"\n",
- "#Initial condition\n",
"sin_delta = P_G*(X_s+X_L)/(E*V_b)\n",
"delta = math.asin(sin_delta) #Power angle(radian)\n",
"Q_G = V_b/(X_s+X_L)*(E*math.cos(delta)-V_b) #Reactive power output(p.u)\n",
"\n",
- "#Changed condition\n",
"P_Gn = (1+inc)*P_G #New active power output(p.u)\n",
"sin_delta_n = P_Gn*(X_s+X_L)/(E*V_b)\n",
"delta_n = math.asin(sin_delta_n) #Power angle(radian)\n",
@@ -373,7 +338,6 @@
"P_change = (P_Gn-P_G)/P_G*100 #Change in active power output(%)\n",
"Q_change = (Q_Gn-Q_G)/Q_G*100 #Change in reactive power output(%)\n",
"\n",
- "#Result\n",
"print('Change in active power supplied by generator = %.f percent' %P_change)\n",
"print('Change in reactive power supplied by generator = %.2f percent' %Q_change)"
],
@@ -403,15 +367,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find percentage change excitation voltage\n",
"\n",
- "#Variable declaration\n",
"X_s = 6.0 #Synchronous reactance of alternator(ohms/phase)\n",
"pf = 0.8 #Lagging power factor\n",
"P_G = 5.0 #Power delivered(MW)\n",
"V = 11.0 #Voltage of infinite bus(kV)\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"delta = math.acos(pf)\n",
@@ -424,7 +385,6 @@
"E_n = complex(V_b,I_n*X_s) #New excitation voltage(V)\n",
"excitation_change = (abs(E)-abs(E_n))/abs(E)*100 #Percentage change in excitation(%)\n",
"\n",
- "#Result\n",
"print('Percentage change in excitation = %.2f percent' %excitation_change)"
],
"language": "python",
diff --git a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_9_2.ipynb b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_9_2.ipynb
index 862e3df0..deaf5ff4 100644
--- a/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_9_2.ipynb
+++ b/Electrical_Power_Systems:_Concepts,_Theory_and_Practice/CHAPTER_9_2.ipynb
@@ -27,9 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find Y bus matrix\n",
"\n",
- "#Variable declaration\n",
"Y_s12 = complex(2.96,-20.16) #Line admittance b/w buses 1 & 2(*10^-3 mho)\n",
"Y_p12 = complex(0,0.152) #Line admittance b/w buses 1 & 2(*10^-3 mho)\n",
"Y_s15 = complex(2.72,-18.32) #Line admittance b/w buses 1 & 5(*10^-3 mho)\n",
@@ -43,11 +41,9 @@
"Y_s45 = complex(3.0,-22.8) #Line admittance b/w buses 4 & 5(*10^-3 mho)\n",
"Y_p45 = complex(0,0.110) #Line admittance b/w buses 4 & 5(*10^-3 mho)\n",
"\n",
- "#Calculation\n",
"import scipy\n",
"from numpy import *\n",
"\n",
- "#I row\n",
"Y_s13 = complex(0,0) #Line admittance b/w buses 1 & 3(*10^-3 mho)\n",
"Y_p13 = complex(0,0) #Line admittance b/w buses 1 & 3(*10^-3 mho)\n",
"Y_s14 = complex(0,0) #Line admittance b/w buses 1 & 4(*10^-3 mho)\n",
@@ -58,7 +54,6 @@
"Y_14 = -Y_s14\n",
"Y_15 = -Y_s15\n",
"\n",
- "#II row\n",
"Y_s21 = Y_s12\n",
"Y_p21 = Y_p12\n",
"Y_s24 = complex(0,0) #Line admittance b/w buses 2 & 4(*10^-3 mho)\n",
@@ -69,7 +64,6 @@
"Y_24 = -Y_s24\n",
"Y_25 = -Y_s25\n",
"\n",
- "#III row\n",
"Y_s31 = Y_s13\n",
"Y_p31 = Y_p13\n",
"Y_s32 = Y_s23\n",
@@ -85,7 +79,6 @@
"Y_34 = -Y_s34\n",
"Y_35 = -Y_s35\n",
"\n",
- "#IV row\n",
"Y_s41 = Y_s14\n",
"Y_p41 = Y_p14\n",
"Y_s42 = Y_s24\n",
@@ -98,7 +91,6 @@
"Y_44 = (Y_s41+Y_s42+Y_s43+Y_s45)+(Y_p41+Y_p42+Y_p43+Y_p45)\n",
"Y_45 = -Y_s45\n",
"\n",
- "#V row\n",
"Y_s51 = Y_s15\n",
"Y_p51 = Y_p15\n",
"Y_s52 = Y_s25\n",
@@ -119,7 +111,6 @@
" [Y_41, Y_42, Y_43, Y_44, Y_45],\n",
" [Y_51, Y_52, Y_53, Y_54, Y_55]]\n",
"\n",
- "#Result\n",
"print('The Y bus matrix for the five-bus system is :\\n')\n",
"print(array(Y_bus))"
],
@@ -154,9 +145,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find voltage,generated power,real & reactive power loss\n",
"\n",
- "#Variable declaration\n",
"V_1 = complex(1.04,0) #Voltage at bus 1(p.u)\n",
"S_D1 = complex(0.55,0.15) #Power at bus 1(p.u)\n",
"S_D2 = complex(1.0,0.3) #Power at bus 2(p.u)\n",
@@ -165,7 +154,6 @@
"Y_12 = complex(-0.988,9.9) #Admittance b/w bus 1 & 2(p.u)\n",
"Y_21 = Y_12 #Admittance b/w bus 2 & 1(p.u)\n",
"\n",
- "#Calculation\n",
"import math\n",
"import cmath\n",
"V_2_0 = complex(1,0) #Initial value of V_2 \n",
@@ -182,7 +170,6 @@
"P_L = S_G1.real - (S_D1.real + S_D2.real) #Real power loss(p.u)\n",
"Q_L = S_G1.imag - (S_D1.imag + S_D2.imag) #Reactive power loss(p.u)\n",
"\n",
- "#Result\n",
"print('Voltage at bus 2 , V_2 = %.4f\u2220%.2f\u00b0 p.u' %(abs(V_2),(cmath.phase(V_2)*180/math.pi)))\n",
"print('Generated power at bus 1 , S_G1 = (%.2f + j%.3f) p.u' %(S_G1.real,S_G1.imag))\n",
"print('Real power loss in the system = %.2f p.u' %P_L)\n",
diff --git a/Electronic_Devices_/Chapter1.ipynb b/Electronic_Devices_/Chapter1.ipynb
index 68dac58e..a4646948 100644
--- a/Electronic_Devices_/Chapter1.ipynb
+++ b/Electronic_Devices_/Chapter1.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Voltages of different models'''",
"",
"# variable declaration",
"V_bias=10.0; #bias voltage in volt",
@@ -92,7 +91,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''voltages of different models'''",
"",
"# variable declaration",
"V_bias=5; #bias voltage in volt",
diff --git a/Electronic_Devices_/Chapter10.ipynb b/Electronic_Devices_/Chapter10.ipynb
index 8864497b..696f96b2 100644
--- a/Electronic_Devices_/Chapter10.ipynb
+++ b/Electronic_Devices_/Chapter10.ipynb
@@ -1,719 +1,740 @@
{
"metadata": {
- "name": "Chapter_10"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:f003b1f1cd26176eb417b448a8cfca349700fbb49c6916dd3657fc77d5dd4cf3"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 10: Amplifier Frequency Response<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.1, Page Number: 311<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Gain in decibel'''",
- "",
- "import math",
- "#Pout/P in=250;",
- "A_p=250.0",
- "A_p_dB=10*math.log10(A_p)",
- "print('Power gain(dB) when power gain is 250 = %d'% math.ceil(A_p_dB));",
- "A_p=100.0",
- "A_p_dB=10*math.log10(A_p)",
- "print('Power gain(dB) when power gain is 100 = %d'%A_p_dB)",
- "A_p=10.0",
- "A_p_dB=20*math.log10(A_p)",
- "print('Voltage gain(dB) when Voltage gain is 10 = %d'%A_p_dB)",
- "A_p=0.50",
- "A_p_dB=10*math.log10(A_p)",
- "print('Power gain(dB) when voltage gain is 0.50 = %d'%A_p_dB)",
- "A_p=0.707",
- "A_p_dB=20*math.log10(A_p)",
+ "\n",
+ "import math\n",
+ "#Pout/P in=250;\n",
+ "A_p=250.0\n",
+ "A_p_dB=10*math.log10(A_p)\n",
+ "print('Power gain(dB) when power gain is 250 = %d'% math.ceil(A_p_dB));\n",
+ "A_p=100.0\n",
+ "A_p_dB=10*math.log10(A_p)\n",
+ "print('Power gain(dB) when power gain is 100 = %d'%A_p_dB)\n",
+ "A_p=10.0\n",
+ "A_p_dB=20*math.log10(A_p)\n",
+ "print('Voltage gain(dB) when Voltage gain is 10 = %d'%A_p_dB)\n",
+ "A_p=0.50\n",
+ "A_p_dB=10*math.log10(A_p)\n",
+ "print('Power gain(dB) when voltage gain is 0.50 = %d'%A_p_dB)\n",
+ "A_p=0.707\n",
+ "A_p_dB=20*math.log10(A_p)\n",
"print('Power gain(dB) when power gain is 0.707 = %d'%A_p_dB)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Power gain(dB) when power gain is 250 = 24",
- "Power gain(dB) when power gain is 100 = 20",
- "Voltage gain(dB) when Voltage gain is 10 = 20",
- "Power gain(dB) when voltage gain is 0.50 = -3",
+ "Power gain(dB) when power gain is 250 = 24\n",
+ "Power gain(dB) when power gain is 100 = 20\n",
+ "Voltage gain(dB) when Voltage gain is 10 = 20\n",
+ "Power gain(dB) when voltage gain is 0.50 = -3\n",
"Power gain(dB) when power gain is 0.707 = -3"
]
}
- ],
+ ],
"prompt_number": 19
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.2, Page Number: 313<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Gain in decibel'''",
- "",
- "",
- "#input voltage=10V",
- "#at -3dB voltage gain from table is 0.707",
- "v_out=0.707*10;",
- "print('output voltage in volts at -3dB gain = %.2f'%v_out)",
- "#at -6dB voltage gain from table is 0.5",
- "v_out=0.5*10;",
- "print('output voltage in volts at -6dB gain = %d'%v_out)",
- "#at -12dB voltage gain from table is 0.25",
- "v_out=0.25*10;",
- "print('output voltage in volts at -12dB gain = %.1f'%v_out)",
- "#at -24dB voltage gain from table is 0.0625",
- "v_out=0.0625*10;",
+ "\n",
+ "\n",
+ "\n",
+ "v_out=0.707*10;\n",
+ "print('output voltage in volts at -3dB gain = %.2f'%v_out)\n",
+ "#at -6dB voltage gain from table is 0.5\n",
+ "v_out=0.5*10;\n",
+ "print('output voltage in volts at -6dB gain = %d'%v_out)\n",
+ "#at -12dB voltage gain from table is 0.25\n",
+ "v_out=0.25*10;\n",
+ "print('output voltage in volts at -12dB gain = %.1f'%v_out)\n",
+ "#at -24dB voltage gain from table is 0.0625\n",
+ "v_out=0.0625*10;\n",
"print('output voltage in volts at -24dB gain = %.3f'%v_out)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "output voltage in volts at -3dB gain = 7.07",
- "output voltage in volts at -6dB gain = 5",
- "output voltage in volts at -12dB gain = 2.5",
+ "output voltage in volts at -3dB gain = 7.07\n",
+ "output voltage in volts at -6dB gain = 5\n",
+ "output voltage in volts at -12dB gain = 2.5\n",
"output voltage in volts at -24dB gain = 0.625"
]
}
- ],
+ ],
"prompt_number": 20
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.3, Page Number: 316<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Lower critical frequency'''",
- "",
- "import math",
- "R_in=1.0*10**3;",
- "C1=1.0*10**-6;",
- "A_v_mid=100.0; #mid range voltage gain",
- "f_c=1/(2*math.pi*R_in*C1);",
- "#at f_c, capacitive reactance is equal to resistance(X_C1=R_in)",
- "attenuation=0.707;",
- "#A_v is gain at lower critical frequency",
- "A_v=0.707*A_v_mid;",
- "print('lower critical frequency = %f Hz'%f_c)",
- "print('attenuation at lower critical frequency =%.3f'%attenuation)",
+ "\n",
+ "import math\n",
+ "R_in=1.0*10**3;\n",
+ "C1=1.0*10**-6;\n",
+ "A_v_mid=100.0; #mid range voltage gain\n",
+ "f_c=1/(2*math.pi*R_in*C1);\n",
+ "#at f_c, capacitive reactance is equal to resistance(X_C1=R_in)\n",
+ "attenuation=0.707;\n",
+ "#A_v is gain at lower critical frequency\n",
+ "A_v=0.707*A_v_mid;\n",
+ "print('lower critical frequency = %f Hz'%f_c)\n",
+ "print('attenuation at lower critical frequency =%.3f'%attenuation)\n",
"print('gain at lower critical frequency = %.1f'%A_v)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "lower critical frequency = 159.154943 Hz",
- "attenuation at lower critical frequency =0.707",
+ "lower critical frequency = 159.154943 Hz\n",
+ "attenuation at lower critical frequency =0.707\n",
"gain at lower critical frequency = 70.7"
]
}
- ],
+ ],
"prompt_number": 21
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.4, Page Number: 317<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Voltage gains'''",
- "",
- "A_v_mid=100.0;",
- "#At 1Hz frequency,voltage gain is 3 dB less than at midrange. At -3dB, the voltage is reduced by a factor of 0.707",
- "A_v=0.707*A_v_mid;",
- "print('actual voltage gain at 1Hz frequency = %.1f'%A_v)",
- "#At 100Hz frequency,voltage gain is 20 dB less than at critical frequency (f_c ). At -20dB, the voltage is reduced by a factor of 0.1",
- "A_v=0.1*A_v_mid;",
- "print('actual voltage gain at 100Hz frequency = %d'%A_v)",
- "#At 10Hz frequency,voltage gain is 40 dB less than at critical frequency (f_c). At -40dB, the voltage is reduced by a factor of 0.01",
- "A_v=0.01*A_v_mid;",
+ "\n",
+ "A_v_mid=100.0;\n",
+ "#At 1Hz frequency,voltage gain is 3 dB less than at midrange. At -3dB, the voltage is reduced by a factor of 0.707\n",
+ "A_v=0.707*A_v_mid;\n",
+ "print('actual voltage gain at 1Hz frequency = %.1f'%A_v)\n",
+ "#At 100Hz frequency,voltage gain is 20 dB less than at critical frequency (f_c ). At -20dB, the voltage is reduced by a factor of 0.1\n",
+ "A_v=0.1*A_v_mid;\n",
+ "print('actual voltage gain at 100Hz frequency = %d'%A_v)\n",
+ "#At 10Hz frequency,voltage gain is 40 dB less than at critical frequency (f_c). At -40dB, the voltage is reduced by a factor of 0.01\n",
+ "A_v=0.01*A_v_mid;\n",
"print('actual voltage gain at 10Hz frequency = %d'%A_v)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "actual voltage gain at 1Hz frequency = 70.7",
- "actual voltage gain at 100Hz frequency = 10",
+ "actual voltage gain at 1Hz frequency = 70.7\n",
+ "actual voltage gain at 100Hz frequency = 10\n",
"actual voltage gain at 10Hz frequency = 1"
]
}
- ],
+ ],
"prompt_number": 22
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.5, Page Number: 319<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Output RC circuit'''",
- "",
- "import math",
- "R_C=10.0*10**3;",
- "C3=0.1*10**-6;",
- "R_L=10*10**3;",
- "A_v_mid=50;",
- "f_c=1/(2*math.pi*(R_L+R_C)*C3);",
- "print('lower critical frequency = %f Hz'%f_c)",
- "#at midrange capacitive reactance is zero",
- "X_C3=0;",
- "attenuation=R_L/(R_L+R_C); ",
- "print('attenuation at midrange frequency = %.1f'%attenuation)",
- "#at critical frequency, capacitive reactance equals total resistance",
- "X_C3=R_L+R_C;",
- "attenuation=R_L/(math.sqrt((R_C+R_L)**2+X_C3**2));",
- "print('attenuation at critical frequency = %f'%attenuation)",
- "A_v=0.707*A_v_mid;",
+ "\n",
+ "import math\n",
+ "R_C=10.0*10**3;\n",
+ "C3=0.1*10**-6;\n",
+ "R_L=10*10**3;\n",
+ "A_v_mid=50;\n",
+ "f_c=1/(2*math.pi*(R_L+R_C)*C3);\n",
+ "print('lower critical frequency = %f Hz'%f_c)\n",
+ "#at midrange capacitive reactance is zero\n",
+ "X_C3=0;\n",
+ "attenuation=R_L/(R_L+R_C); \n",
+ "print('attenuation at midrange frequency = %.1f'%attenuation)\n",
+ "#at critical frequency, capacitive reactance equals total resistance\n",
+ "X_C3=R_L+R_C;\n",
+ "attenuation=R_L/(math.sqrt((R_C+R_L)**2+X_C3**2));\n",
+ "print('attenuation at critical frequency = %f'%attenuation)\n",
+ "A_v=0.707*A_v_mid;\n",
"print('gain at critical frequency = %.2f'%A_v)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "lower critical frequency = 79.577472 Hz",
- "attenuation at midrange frequency = 0.5",
- "attenuation at critical frequency = 0.353553",
+ "lower critical frequency = 79.577472 Hz\n",
+ "attenuation at midrange frequency = 0.5\n",
+ "attenuation at critical frequency = 0.353553\n",
"gain at critical frequency = 35.35"
]
}
- ],
+ ],
"prompt_number": 23
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.6, Page Number: 321<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Bypass RC circuit BJT'''",
- "",
- "import math",
- "B_ac=100.0;",
- "r_e=12.0;",
- "R1=62.0*10**3;",
- "R2=22.0*10**3;",
- "R_S=1.0*10**3;",
- "R_E=1.0*10**3;",
- "C2=100.0*10**-6;",
- "#Base circuit impedance= parallel combination of R1, R2, R_S",
- "R_th=(R1*R2*R_S)/(R1*R2+R2*R_S+R_S*R1);",
- "#Resistance looking at emitter",
- "R_in_emitter=r_e+(R_th/B_ac);",
- "#resistance of equivalent bypass RC is parallel combination of R_E,R_in_emitter",
- "R=(R_in_emitter*R_E)/(R_E+R_in_emitter);",
- "f_c=1/(2*math.pi*R*C2);",
+ "\n",
+ "import math\n",
+ "B_ac=100.0;\n",
+ "r_e=12.0;\n",
+ "R1=62.0*10**3;\n",
+ "R2=22.0*10**3;\n",
+ "R_S=1.0*10**3;\n",
+ "R_E=1.0*10**3;\n",
+ "C2=100.0*10**-6;\n",
+ "#Base circuit impedance= parallel combination of R1, R2, R_S\n",
+ "R_th=(R1*R2*R_S)/(R1*R2+R2*R_S+R_S*R1);\n",
+ "#Resistance looking at emitter\n",
+ "R_in_emitter=r_e+(R_th/B_ac);\n",
+ "#resistance of equivalent bypass RC is parallel combination of R_E,R_in_emitter\n",
+ "R=(R_in_emitter*R_E)/(R_E+R_in_emitter);\n",
+ "f_c=1/(2*math.pi*R*C2);\n",
"print('critical frequency of bypass RC circuit = %f Hz'%f_c)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"critical frequency of bypass RC circuit = 75.893960 Hz"
]
}
- ],
+ ],
"prompt_number": 24
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.7, Page Number:323<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''input RC circuit FET'''",
- "",
- "import math",
- "V_GS=-10.0;",
- "I_GSS=25.0*10**-9;",
- "R_G=10.0*10**6;",
- "C1=0.001*10**-6;",
- "R_in_gate=abs((V_GS/I_GSS));",
- "R_in=(R_in_gate*R_G)/(R_G+R_in_gate);",
- "f_c=1/(2*math.pi*R_in*C1);",
+ "\n",
+ "import math\n",
+ "V_GS=-10.0;\n",
+ "I_GSS=25.0*10**-9;\n",
+ "R_G=10.0*10**6;\n",
+ "C1=0.001*10**-6;\n",
+ "R_in_gate=abs((V_GS/I_GSS));\n",
+ "R_in=(R_in_gate*R_G)/(R_G+R_in_gate);\n",
+ "f_c=1/(2*math.pi*R_in*C1);\n",
"print('critical frequency = %f Hz'%f_c)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"critical frequency = 16.313382 Hz"
]
}
- ],
+ ],
"prompt_number": 25
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.8, Page Number: 324<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Low frequency response FET'''",
- "",
- "import math",
- "V_GS=-12.0;",
- "I_GSS=100.0*10**-9;",
- "R_G=10.0*10**6;",
- "R_D=10.0*10**3;",
- "C1=0.001*10**-6;",
- "C2=0.001*10**-6;",
- "R_in_gate=abs((V_GS/I_GSS));",
- "R_in=(R_in_gate*R_G)/(R_G+R_in_gate);",
- "R_L=R_in; #according to question",
- "f_c_input=1/(2*math.pi*R_in*C1);",
- "print('critical frequency of input RC circuit = %f Hz'%f_c_input)",
- "f_c_output=1/(2*math.pi*(R_D+R_L)*C2)",
+ "\n",
+ "import math\n",
+ "V_GS=-12.0;\n",
+ "I_GSS=100.0*10**-9;\n",
+ "R_G=10.0*10**6;\n",
+ "R_D=10.0*10**3;\n",
+ "C1=0.001*10**-6;\n",
+ "C2=0.001*10**-6;\n",
+ "R_in_gate=abs((V_GS/I_GSS));\n",
+ "R_in=(R_in_gate*R_G)/(R_G+R_in_gate);\n",
+ "R_L=R_in; #according to question\n",
+ "f_c_input=1/(2*math.pi*R_in*C1);\n",
+ "print('critical frequency of input RC circuit = %f Hz'%f_c_input)\n",
+ "f_c_output=1/(2*math.pi*(R_D+R_L)*C2)\n",
"print('critical frequency of output RC circuit = %f Hz'%f_c_output)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "critical frequency of input RC circuit = 17.241786 Hz",
+ "critical frequency of input RC circuit = 17.241786 Hz\n",
"critical frequency of output RC circuit = 17.223127 Hz"
]
}
- ],
+ ],
"prompt_number": 26
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.9, Page Number: 327<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Low frequency response BJT'''",
- "",
- "import math",
- "B_ac=100.0;",
- "r_e=16.0;",
- "R1=62.0*10**3;",
- "R2=22.0*10**3;",
- "R_S=600.0;",
- "R_E=1.0*10**3;",
- "R_C=2.2*10**3;",
- "R_L=10.0*10**3;",
- "C1=0.1*10**-6;",
- "C2=10.0*10**-6;",
- "C3=0.1*10**-6;",
- "#input RC circuit",
- "R_in=(B_ac*r_e*R1*R2)/(B_ac*r_e*R1+B_ac*r_e*R2+R1*R2);",
- "f_c_input=1/(2*math.pi*(R_S+R_in)*C1);",
- "print('input frequency = %f Hz'%f_c_input)",
- "#For bypass circuit; Base circuit impedance= parallel combination of R1, R2, R_S",
- "R_th=(R1*R2*R_S)/(R1*R2+R2*R_S+R_S*R1);",
- "#Resistance looking at emitter",
- "R_in_emitter=r_e+(R_th/B_ac);",
- "#resistance of equivalent bypass RC is parallel combination of R_E,R_in_emitter",
- "R=(R_in_emitter*R_E)/(R_E+R_in_emitter);",
- "f_c_bypass=1/(2*math.pi*R*C2);",
- "print('critical frequency of bypass RC circuit = %f Hz'%f_c_bypass)",
- "f_c_output=1/(2*math.pi*(R_C+R_L)*C3)",
- "print('output frequency circuit = %f Hz'%f_c_output)",
- "R_c=R_C*R_L/(R_C+R_L);",
- "A_v_mid=R_c/r_e;",
- "attenuation=R_in/(R_in+R_S);",
- "A_v=attenuation*A_v_mid; #overall voltage gain",
- "A_v_mid_dB=20*math.log10(A_v); ",
+ "\n",
+ "import math\n",
+ "B_ac=100.0;\n",
+ "r_e=16.0;\n",
+ "R1=62.0*10**3;\n",
+ "R2=22.0*10**3;\n",
+ "R_S=600.0;\n",
+ "R_E=1.0*10**3;\n",
+ "R_C=2.2*10**3;\n",
+ "R_L=10.0*10**3;\n",
+ "C1=0.1*10**-6;\n",
+ "C2=10.0*10**-6;\n",
+ "C3=0.1*10**-6;\n",
+ "#input RC circuit\n",
+ "R_in=(B_ac*r_e*R1*R2)/(B_ac*r_e*R1+B_ac*r_e*R2+R1*R2);\n",
+ "f_c_input=1/(2*math.pi*(R_S+R_in)*C1);\n",
+ "print('input frequency = %f Hz'%f_c_input)\n",
+ "#For bypass circuit; Base circuit impedance= parallel combination of R1, R2, R_S\n",
+ "R_th=(R1*R2*R_S)/(R1*R2+R2*R_S+R_S*R1);\n",
+ "#Resistance looking at emitter\n",
+ "R_in_emitter=r_e+(R_th/B_ac);\n",
+ "#resistance of equivalent bypass RC is parallel combination of R_E,R_in_emitter\n",
+ "R=(R_in_emitter*R_E)/(R_E+R_in_emitter);\n",
+ "f_c_bypass=1/(2*math.pi*R*C2);\n",
+ "print('critical frequency of bypass RC circuit = %f Hz'%f_c_bypass)\n",
+ "f_c_output=1/(2*math.pi*(R_C+R_L)*C3)\n",
+ "print('output frequency circuit = %f Hz'%f_c_output)\n",
+ "R_c=R_C*R_L/(R_C+R_L);\n",
+ "A_v_mid=R_c/r_e;\n",
+ "attenuation=R_in/(R_in+R_S);\n",
+ "A_v=attenuation*A_v_mid; #overall voltage gain\n",
+ "A_v_mid_dB=20*math.log10(A_v); \n",
"print('overall voltage gain in dB = %f'%A_v_mid_dB)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "input frequency = 773.916632 Hz",
- "critical frequency of bypass RC circuit = 746.446517 Hz",
- "output frequency circuit = 130.454871 Hz",
+ "input frequency = 773.916632 Hz\n",
+ "critical frequency of bypass RC circuit = 746.446517 Hz\n",
+ "output frequency circuit = 130.454871 Hz\n",
"overall voltage gain in dB = 38.042470"
]
}
- ],
+ ],
"prompt_number": 27
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.10, Page Number: 330<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''input RC circuit BJT'''",
- "",
- "import math",
- "B_ac=125.0;",
- "C_be=20.0*10**-12;",
- "C_bc=2.4*10**-12;",
- "R1=22.0*10**3;",
- "R2=4.7*10**3;",
- "R_E=470.0;",
- "R_S=600.0;",
- "R_L=2.2*10**3;",
- "V_CC=10.0;",
- "V_B=(R2/(R1+R2))*V_CC;",
- "V_E=V_B-0.7;",
- "I_E=V_E/R_E;",
- "r_e=25.0*10**-3/I_E;",
- "#total resistance of input circuit is parallel combination of R1,R2,R_s,B_ac*r_e",
- "R_in_tot=B_ac*r_e*R1*R2*R_S/(B_ac*r_e*R1*R2+B_ac*r_e*R1*R_S+B_ac*r_e*R2*R_S+R1*R2*R_S);",
- "R_c= 1100.0#R_C*R_L/(R_C+R_L)",
- "A_v_mid=R_c/r_e;",
- "C_in_Miller=C_bc*(A_v_mid+1)",
- "C_in_tot=C_in_Miller+C_be;",
- "C_in_tot=C_in_tot*10**10",
- "f_c=1/(2*math.pi*R_in_tot*C_in_tot);",
- "print('total resistance of circuit = %f Ohm'%R_in_tot)",
- "print('total capacitance = %f * 10^-10 F'%C_in_tot)",
+ "\n",
+ "import math\n",
+ "B_ac=125.0;\n",
+ "C_be=20.0*10**-12;\n",
+ "C_bc=2.4*10**-12;\n",
+ "R1=22.0*10**3;\n",
+ "R2=4.7*10**3;\n",
+ "R_E=470.0;\n",
+ "R_S=600.0;\n",
+ "R_L=2.2*10**3;\n",
+ "V_CC=10.0;\n",
+ "V_B=(R2/(R1+R2))*V_CC;\n",
+ "V_E=V_B-0.7;\n",
+ "I_E=V_E/R_E;\n",
+ "r_e=25.0*10**-3/I_E;\n",
+ "#total resistance of input circuit is parallel combination of R1,R2,R_s,B_ac*r_e\n",
+ "R_in_tot=B_ac*r_e*R1*R2*R_S/(B_ac*r_e*R1*R2+B_ac*r_e*R1*R_S+B_ac*r_e*R2*R_S+R1*R2*R_S);\n",
+ "R_c= 1100.0#R_C*R_L/(R_C+R_L)\n",
+ "A_v_mid=R_c/r_e;\n",
+ "C_in_Miller=C_bc*(A_v_mid+1)\n",
+ "C_in_tot=C_in_Miller+C_be;\n",
+ "C_in_tot=C_in_tot*10**10\n",
+ "f_c=1/(2*math.pi*R_in_tot*C_in_tot);\n",
+ "print('total resistance of circuit = %f Ohm'%R_in_tot)\n",
+ "print('total capacitance = %f * 10^-10 F'%C_in_tot)\n",
"print('critical frequency = %f Hz'%f_c)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "total resistance of circuit = 377.815676 Ohm",
- "total capacitance = 2.606290 * 10^-10 F",
+ "total resistance of circuit = 377.815676 Ohm\n",
+ "total capacitance = 2.606290 * 10^-10 F\n",
"critical frequency = 0.000162 Hz"
]
}
- ],
+ ],
"prompt_number": 28
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.11, Page Number: 333<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Critical frequency BJT output'''",
- "",
- "import math",
- "C_bc=2.4*10**-12; #from previous question",
- "A_v=99.0; #from previous question",
- "R_C=2.2*10**3;",
- "R_L=2.2*10**3;",
- "R_c=R_C*R_L/(R_C+R_L);",
- "C_out_Miller=C_bc*(A_v+1)/A_v;",
- "f_c=1/(2*math.pi*R_c*C_bc); #C_bc is almost equal to C_in_Miller",
- "C_out_Miller=C_out_Miller*10**12",
- "print('equivalent resistance = %d Ohm'%R_c)",
- "print('equivalent capacitance =%f *10^-12 F'%C_out_Miller)",
+ "\n",
+ "import math\n",
+ "C_bc=2.4*10**-12; #from previous question\n",
+ "A_v=99.0; #from previous question\n",
+ "R_C=2.2*10**3;\n",
+ "R_L=2.2*10**3;\n",
+ "R_c=R_C*R_L/(R_C+R_L);\n",
+ "C_out_Miller=C_bc*(A_v+1)/A_v;\n",
+ "f_c=1/(2*math.pi*R_c*C_bc); #C_bc is almost equal to C_in_Miller\n",
+ "C_out_Miller=C_out_Miller*10**12\n",
+ "print('equivalent resistance = %d Ohm'%R_c)\n",
+ "print('equivalent capacitance =%f *10^-12 F'%C_out_Miller)\n",
"print('critical frequency =%f Hz'%f_c)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "equivalent resistance = 1100 Ohm",
- "equivalent capacitance =2.424242 *10^-12 F",
+ "equivalent resistance = 1100 Ohm\n",
+ "equivalent capacitance =2.424242 *10^-12 F\n",
"critical frequency =60285963.292385 Hz"
]
}
- ],
+ ],
"prompt_number": 29
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.12, Page Number: 334<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''FET capacitors'''",
- "",
- "C_iss=6.0*10**-12;",
- "C_rss=2.0*10**-12;",
- "C_gd=C_rss;",
- "C_gs=C_iss-C_rss;",
- "C_gd=C_gd*10**12",
- "C_gs=C_gs*10**12",
- "print('gate to drain capacitance = %.1f * 10^-12 F'%C_gd)",
+ "\n",
+ "C_iss=6.0*10**-12;\n",
+ "C_rss=2.0*10**-12;\n",
+ "C_gd=C_rss;\n",
+ "C_gs=C_iss-C_rss;\n",
+ "C_gd=C_gd*10**12\n",
+ "C_gs=C_gs*10**12\n",
+ "print('gate to drain capacitance = %.1f * 10^-12 F'%C_gd)\n",
"print('gate to source capacitance = %.1f * 10^-12 F'%C_gs)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "gate to drain capacitance = 2.0 * 10^-12 F",
+ "gate to drain capacitance = 2.0 * 10^-12 F\n",
"gate to source capacitance = 4.0 * 10^-12 F"
]
}
- ],
+ ],
"prompt_number": 30
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.13, Page Number:335 <h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Critical frequency FET input'''",
- "",
- "import math",
- "C_iss=8.0*10**-12;",
- "C_rss=3.0*10**-12;",
- "g_m=6500.0*10**-6; #in Siemens",
- "R_D=1.0*10**3;",
- "R_L=10.0*10**6;",
- "R_s=50.0;",
- "C_gd=C_rss;",
- "C_gs=C_iss-C_rss;",
- "R_d=R_D*R_L/(R_D+R_L);",
- "A_v=g_m*R_d;",
- "C_in_Miller=C_gd*(A_v+1);",
- "C_in_tot=C_in_Miller+C_gs;",
- "f_c=1/(2*math.pi*C_in_tot*R_s);",
+ "\n",
+ "import math\n",
+ "C_iss=8.0*10**-12;\n",
+ "C_rss=3.0*10**-12;\n",
+ "g_m=6500.0*10**-6; #in Siemens\n",
+ "R_D=1.0*10**3;\n",
+ "R_L=10.0*10**6;\n",
+ "R_s=50.0;\n",
+ "C_gd=C_rss;\n",
+ "C_gs=C_iss-C_rss;\n",
+ "R_d=R_D*R_L/(R_D+R_L);\n",
+ "A_v=g_m*R_d;\n",
+ "C_in_Miller=C_gd*(A_v+1);\n",
+ "C_in_tot=C_in_Miller+C_gs;\n",
+ "f_c=1/(2*math.pi*C_in_tot*R_s);\n",
"print('critical frequency of input RC circuit =%.3f *10^8 Hz'%(f_c*10**-8))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"critical frequency of input RC circuit =1.158 *10^8 Hz"
]
}
- ],
+ ],
"prompt_number": 31
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.14, Page Number: 336<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Critical frequency FET input'''",
- "",
- "import math",
- "C_gd=3.0*10**-12; #from previous question",
- "A_v=6.5; #from previous question",
- "R_d=1.0*10**3; #from previous question",
- "C_out_Miller=C_gd*(A_v+1)/A_v;",
- "f_c=1/(2*math.pi*R_d*C_out_Miller);",
+ "\n",
+ "import math\n",
+ "C_gd=3.0*10**-12; #from previous question\n",
+ "A_v=6.5; #from previous question\n",
+ "R_d=1.0*10**3; #from previous question\n",
+ "C_out_Miller=C_gd*(A_v+1)/A_v;\n",
+ "f_c=1/(2*math.pi*R_d*C_out_Miller);\n",
"print('critical frequency of the output circuit = %d Hz'%f_c)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"critical frequency of the output circuit = 45978094 Hz"
]
}
- ],
+ ],
"prompt_number": 32
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.15, Page Number: 339<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Bandwidth'''",
- "",
- "f_cu=2000.0;",
- "f_cl=200.0;",
- "BW=f_cu-f_cl;",
+ "\n",
+ "f_cu=2000.0;\n",
+ "f_cl=200.0;\n",
+ "BW=f_cu-f_cl;\n",
"print('bandwidth = %d Hz'%BW)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"bandwidth = 1800 Hz"
]
}
- ],
+ ],
"prompt_number": 33
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.16, Page Number: 340<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Bandwidth transistor'''",
- "",
- "f_T=175.0*10**6; #in hertz",
- "A_v_mid=50.0;",
- "BW=f_T/A_v_mid;",
+ "\n",
+ "f_T=175.0*10**6; #in hertz\n",
+ "A_v_mid=50.0;\n",
+ "BW=f_T/A_v_mid;\n",
"print('bandwidth = %d Hz'%BW)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"bandwidth = 3500000 Hz"
]
}
- ],
+ ],
"prompt_number": 34
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.17, Page Number: 341<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Bandwidth 2stage amplifier'''",
- "",
- "f_cl=1.0*10**3; #lower critical frequency of 2nd stage in hertz",
- "f_cu=100.0*10**3; #upper critical frequency of 1st stage in hertz",
- "BW=f_cu-f_cl;",
+ "\n",
+ "f_cl=1.0*10**3; #lower critical frequency of 2nd stage in hertz\n",
+ "f_cu=100.0*10**3; #upper critical frequency of 1st stage in hertz\n",
+ "BW=f_cu-f_cl;\n",
"print('bandwidth = %d Hz'%BW)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"bandwidth = 99000 Hz"
]
}
- ],
+ ],
"prompt_number": 35
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 10.18, Page Number: 341<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Bandwidth 2stage amplifier'''",
- "",
- "import math",
- "n=2.0; #n is the number of stages of amplifier",
- "f_cl=500.0;",
- "f_cu=80.0*10**3;",
- "f_cl_new=f_cl/(math.sqrt(2**(1/n)-1));",
- "f_cu_new=f_cu*(math.sqrt(2**(1/n)-1));",
- "BW=f_cu_new-f_cl_new;",
+ "\n",
+ "import math\n",
+ "n=2.0; #n is the number of stages of amplifier\n",
+ "f_cl=500.0;\n",
+ "f_cu=80.0*10**3;\n",
+ "f_cl_new=f_cl/(math.sqrt(2**(1/n)-1));\n",
+ "f_cu_new=f_cu*(math.sqrt(2**(1/n)-1));\n",
+ "BW=f_cu_new-f_cl_new;\n",
"print('bandwidth = %f Hz'%BW)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"bandwidth = 50710.653245 Hz"
]
}
- ],
+ ],
"prompt_number": 36
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Electronic_Devices_/Chapter11.ipynb b/Electronic_Devices_/Chapter11.ipynb
index fc60eac9..966e3619 100644
--- a/Electronic_Devices_/Chapter11.ipynb
+++ b/Electronic_Devices_/Chapter11.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Four layer diode'''",
"",
"V_AK=20.0; #VOLTAGE ACROSS ANODE",
"I_A=1*10**-6;",
@@ -51,7 +50,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Anode current'''",
"",
"R_S=10**3;",
"V_BIAS=110.0;",
@@ -84,7 +82,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Unijunction transistor'''",
"",
"n=0.6;",
"V_BB=20.0;",
@@ -114,7 +111,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''turn on off UJT'''",
"",
"V_BB=30.0;",
"V_P=14.0;",
@@ -149,7 +145,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Critical Angle'''",
"",
"import math",
"n2=1.3; #cladding index",
diff --git a/Electronic_Devices_/Chapter12.ipynb b/Electronic_Devices_/Chapter12.ipynb
index 6ec53a3f..3f9f927c 100644
--- a/Electronic_Devices_/Chapter12.ipynb
+++ b/Electronic_Devices_/Chapter12.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''CMRR opamp'''",
"",
"import math",
"A_ol=100000.0; #open loop voltage gain",
@@ -55,7 +54,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Slew rate'''",
"",
"del_t=1.0; # in microseconds",
"#lower limit is -9V and upper limit is 9V from the graph",
@@ -85,7 +83,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Non inverting amplifier'''",
"",
"R_f=100*10**3;",
"R_i=4.7*10**3;",
@@ -114,7 +111,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Inverting amplifier'''",
"",
"R_i=2.2*10**3;",
"A_cl=-100.0; #closed loop voltage gain",
@@ -143,7 +139,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Impedance noninverting amplifier'''",
"",
"Z_in=2*10**6;",
"Z_out=75.0;",
@@ -183,7 +178,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Voltage follower impedance'''",
"",
"B=1.0; #voltage follower configuration",
"A_ol=200000.0;",
@@ -218,7 +212,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Impedance inverting amplifier'''",
"",
"R_i=1.0*10**3;",
"R_f=100.0*10**3;",
@@ -257,7 +250,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Open Loop gain'''",
"",
"import math",
"f_c_ol=100.0;",
@@ -300,7 +292,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''phase RC lag'''",
"",
"import math",
"f_c=100.0;",
@@ -352,7 +343,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Gain and phase lag'''",
"",
"import math",
"A_v1=40.0; #all gains are in decibels",
@@ -402,7 +392,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Closed loop bandwidth'''",
"",
"A_ol_mid=150000.0; #open loop midrange gain",
"B=0.002; #feedback attenuation",
@@ -432,7 +421,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Amplifier bandwidth'''",
"",
"BW=3*10**6; #unity gain bandwidth",
"A_ol=100.0; #open loop gain",
diff --git a/Electronic_Devices_/Chapter13.ipynb b/Electronic_Devices_/Chapter13.ipynb
index 5669d43d..14a01b6b 100644
--- a/Electronic_Devices_/Chapter13.ipynb
+++ b/Electronic_Devices_/Chapter13.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Comparator reference voltage'''",
"",
"import pylab",
"import numpy",
@@ -122,7 +121,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Trigger points'''",
"",
"R1=100.0*10**3;",
"R2=R1;",
@@ -155,7 +153,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Comparator hysteris Zener bounding'''",
"import pylab",
"import numpy",
"",
@@ -243,7 +240,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Summing amplifier unity gain'''",
"",
"V_IN1=3.0;",
"V_IN2=1.0;",
@@ -274,7 +270,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Summing amplifier'''",
"",
"R_f=10.0*10**3;",
"R1=1.0*10**3;",
@@ -307,7 +302,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Averaging amplifier'''",
"",
"R_f=25.0*10**3;",
"R1=100.0*10**3;",
@@ -349,7 +343,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Scaling adder'''",
"",
"V_IN1=3.0;",
"V_IN2=2.0;",
@@ -392,7 +385,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Opamp integrator'''",
"",
"import pylab",
"import numpy",
@@ -496,7 +488,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Opamp diferentiator'''",
"",
"import pylab",
"import numpy",
diff --git a/Electronic_Devices_/Chapter14.ipynb b/Electronic_Devices_/Chapter14.ipynb
index 556241af..453a369d 100644
--- a/Electronic_Devices_/Chapter14.ipynb
+++ b/Electronic_Devices_/Chapter14.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Gain setting resistor'''",
"",
"R1=25*10**3;",
"R2=R1;",
@@ -72,7 +71,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Voltage gain Instrumentation amplifier'''",
"",
"R1=25.25*10**3; #internal resistors",
"R2=R1;",
@@ -105,7 +103,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Voltage gain Isolation amplifier'''",
"",
"R_f1=22.0*10**3;",
"R_i1=2.2*10**3;",
@@ -138,7 +135,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Transconductance OTA'''",
"",
"g_m=1000.0*10**-6;",
"V_in=25*10**-3;",
@@ -167,7 +163,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Voltage gain OTA'''",
"",
"V_BIAS=9.0;",
"V=V_BIAS;",
@@ -201,7 +196,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Output OTA amplitude modulator'''",
"",
"import pylab",
"import numpy ",
@@ -264,7 +258,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Output log amplifier'''",
"",
"import math",
"V_in=2;",
@@ -296,7 +289,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Transistor log amplifier'''",
"",
"import math",
"V_in=3;",
@@ -328,7 +320,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Antilog amplifier'''",
"",
"import math",
"I_EBO=40.0*10**-9;",
diff --git a/Electronic_Devices_/Chapter15.ipynb b/Electronic_Devices_/Chapter15.ipynb
index 41cc02a1..51a03fc9 100644
--- a/Electronic_Devices_/Chapter15.ipynb
+++ b/Electronic_Devices_/Chapter15.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Band pass Filter'''",
"",
"f0=15*10**3; #center frequency in hertz",
"BW=1*10**3;",
@@ -72,7 +71,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Butterworth response'''",
"",
"R2=10*10**3;",
"R1=0.586*R2; #FOR BUTTERWORTH RESPONSE",
@@ -102,7 +100,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Sallen Key lowpass Filter'''",
"",
"import math",
"R_A=1*10**3;",
@@ -140,7 +137,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''4-pole Filter'''",
"",
"import math",
"f_c=2860.0;",
@@ -179,7 +175,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Sallen Key highpass Filter'''",
"",
"import math",
"f_c=10*10**3; #critical frequency in hertz",
@@ -218,7 +213,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Cascaded Filter'''",
"",
"import math",
"R1=68.0*10**3;",
@@ -257,7 +251,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''State variable Filter'''",
"",
"import math",
"R4=1000.0;",
@@ -298,7 +291,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Band stop Filters'''",
"",
"import math",
"R4=12.0*10**3;",
diff --git a/Electronic_Devices_/Chapter16.ipynb b/Electronic_Devices_/Chapter16.ipynb
index 8ab48487..b082e3ac 100644
--- a/Electronic_Devices_/Chapter16.ipynb
+++ b/Electronic_Devices_/Chapter16.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Wien bridge oscillator'''",
"",
"import math",
"R1=10*10**3;",
@@ -84,7 +83,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Phase shift oscillator'''",
"",
"import math",
"A_cl=29; #A_cl=R_f/R_i;",
@@ -121,7 +119,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''FET Colpitts oscillator'''",
"",
"import math",
"C1=0.1*10**-6;",
@@ -159,7 +156,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Triangular wave oscillator'''",
"",
"R1=10.0*10**3;",
"R2=33.0*10**3;",
@@ -197,7 +193,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Sawtooth VCO'''",
"",
"import pylab",
"import numpy",
@@ -276,7 +271,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''555 timer'''",
"",
"R1=2.2*10**3;",
"R2=4.7*10**3;",
diff --git a/Electronic_Devices_/Chapter17.ipynb b/Electronic_Devices_/Chapter17.ipynb
index 1f3eeb4d..6e48c896 100644
--- a/Electronic_Devices_/Chapter17.ipynb
+++ b/Electronic_Devices_/Chapter17.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Percentage line regulation'''",
"",
"#variable declaration",
"Del_V_out=0.25;",
@@ -77,7 +76,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Load regulation percentage'''",
"",
"# Variable Declaration",
"V_NL=12.0; #No load output voltage in Volts",
@@ -116,7 +114,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Series regulator'''",
"",
"",
"V_REF=5.1 #Zener voltage in volts",
@@ -147,7 +144,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Overload protection'''",
"",
"R4=1; #Resistance in Ohms",
"I_L_max=0.7/R4;",
@@ -175,7 +171,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Shunt regulator'''",
"",
"V_IN=12.5; #maximum input voltage in volts",
"R1=22; #In Ohms",
@@ -207,7 +202,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Positive linear voltage regulator'''",
"",
"print('SAME AS EX-2.8 in CHAPTER-2')"
],
@@ -233,7 +227,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''External pass Filter'''",
"",
"I_max=700*10**-3; #in Amperes",
"R_ext=0.7/I_max;",
@@ -261,7 +254,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Power rating 7824'''",
"",
"V_OUT=24.0; #Output voltage in Volts",
"R_L=10.0; #Load resistance in Ohms",
@@ -297,7 +289,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Current regulator'''",
"",
"V_out=5.0; #7805 gives output voltage of 5V",
"I_L=1.0; #constant current of 1A",
diff --git a/Electronic_Devices_/Chapter18.ipynb b/Electronic_Devices_/Chapter18.ipynb
index b651b596..e195b9f9 100644
--- a/Electronic_Devices_/Chapter18.ipynb
+++ b/Electronic_Devices_/Chapter18.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Switching capacitor'''",
"",
"import math",
"#Variable declaration",
diff --git a/Electronic_Devices_/Chapter2.ipynb b/Electronic_Devices_/Chapter2.ipynb
index 107fc334..ac5794a8 100644
--- a/Electronic_Devices_/Chapter2.ipynb
+++ b/Electronic_Devices_/Chapter2.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Average value of half wave rectifier'''",
"",
"import math",
"",
@@ -77,7 +76,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' half wave rectifier output'''",
"",
"import math",
"",
@@ -115,7 +113,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' half wave rectifier output'''",
"",
"import math",
"",
@@ -154,7 +151,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Average value of half wave rectifier'''",
"",
"import math",
"",
@@ -192,7 +188,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Average value of full wave rectifier'''",
"",
"import math",
"",
@@ -227,7 +222,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''PIV full wave'''",
"",
"V_p_pri=100.0; #Peak voltage across primary winding",
"n=1.0/2; #tun ratio is 2:1",
@@ -262,7 +256,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Peak voltage of diode'''",
"",
"import math",
"",
@@ -302,7 +295,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Ripple Factor'''",
"",
"import math",
"",
@@ -347,7 +339,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Min & Max voltage'''",
"",
"import math",
"",
@@ -391,7 +382,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Load regulation percentage'''",
"",
"V_NL=5.18 #No load output voltage",
"V_FL=5.15 #Full load output voltage",
@@ -420,7 +410,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Negative diode limiter'''",
"",
"import pylab as py",
"import numpy as np",
@@ -482,7 +471,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Positive and negative Diode limiter'''",
"",
"#from pylab import figure, show",
"#from numpy import arange, sin, pi,bool",
@@ -549,7 +537,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Positive diode limiter'''",
"",
"#variable declaration",
"V_p_in=18.0; #peak input voltage is 18V",
@@ -584,7 +571,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Negative Clamping circuit'''",
"",
"V_p_in=24.0;",
"V_DC=-(V_p_in-0.7); #DC level added to output",
diff --git a/Electronic_Devices_/Chapter3.ipynb b/Electronic_Devices_/Chapter3.ipynb
index 41e63a83..b0f770b6 100644
--- a/Electronic_Devices_/Chapter3.ipynb
+++ b/Electronic_Devices_/Chapter3.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find Zener Impedence'''",
"",
"# variable declaration",
"delVZ=50*10**-3; #voltage in volts, from graph",
@@ -76,7 +75,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Voltage accross zener terminals'''",
"",
"# variable declaration",
"I_ZT=37*10**-3; #IN AMPERES",
@@ -120,7 +118,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Zener Voltage'''",
"",
"# variable declaration",
"V_Z=8.2; #8.2 volt zener diode",
@@ -158,7 +155,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Power dissipation'''",
"",
"# variable declaration",
"P_D_max=400*10**-3; #power in watts",
@@ -194,7 +190,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Zener Diode voltage regulation'''",
"",
"# variable declaration",
"V_Z=5.1;",
@@ -238,7 +233,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Min & Max current'''",
"",
"# variable declaration",
"V_Z=12.0; #voltage in volt",
@@ -287,7 +281,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' to find load resistance'''",
"",
"# variable declaration",
"V_IN=24.0; #voltage in volt",
@@ -342,7 +335,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Zener limiting'''",
"",
"#variable declaration",
"V_p_in=10.0; #Peak input voltage",
diff --git a/Electronic_Devices_/Chapter4.ipynb b/Electronic_Devices_/Chapter4.ipynb
index b76b7b18..8aaa9760 100644
--- a/Electronic_Devices_/Chapter4.ipynb
+++ b/Electronic_Devices_/Chapter4.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find Emitter current'''",
"",
"# variable declaration",
"I_C=3.65*10**-3; #collector current in amperes",
@@ -79,7 +78,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Current and Voltage values'''",
"",
"# variable declaration",
"V_BE=0.7; # voltage in volt",
@@ -129,7 +127,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Ideal family of collector curve'''",
"",
"",
"import pylab as py",
@@ -199,7 +196,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Transistor saturtion condition'''",
"",
"# variable declaration",
"V_CE_sat=0.2; # voltage in volt",
@@ -243,7 +239,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''maximum collector current'''",
"",
"#Variable declaration",
"P_D_max=250*10**-3; #max power rating of transistor in watts",
@@ -285,7 +280,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''voltage drop across transistor''' ",
"",
"#Variable declaration",
"P_D_max=800*10**-3; #max power rating of transistor in watts",
@@ -333,7 +327,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Power dissipation'''",
"",
"#Variable declaration",
"df=5*10**-3; #derating factor in watts per degree celsius",
@@ -370,7 +363,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''voltage gain'''",
"",
"#Variable declaration",
"R_C=1*10**3; #resistance in ohm",
@@ -408,7 +400,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Power dissipation'''",
"",
"#Variable declaration",
"V_CC=10.0; #voltage in volt",
diff --git a/Electronic_Devices_/Chapter5.ipynb b/Electronic_Devices_/Chapter5.ipynb
index 1b456628..1bcf9f83 100644
--- a/Electronic_Devices_/Chapter5.ipynb
+++ b/Electronic_Devices_/Chapter5.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Peak base current'''",
"",
"# variable declaration",
"V_BB=10.0; #voltage in volt",
@@ -89,7 +88,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' DC input resistance'''",
"",
"# variable declaration",
"B_DC=125.0; #DC value",
@@ -123,7 +121,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Transistor saturation condition'''",
"",
"# variable declaration",
"B_DC=100; #DC value",
@@ -177,7 +174,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Emitter-Collector Voltage'''",
"",
"# variable declaration",
"V_EE=10.0; #voltage in volt",
@@ -228,7 +224,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Collector-Emitter Voltage'''",
"",
"# variable declaration",
"R1=68.0*10**3; #resistance in ohm",
@@ -280,7 +275,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' change in collector emitter voltage'''",
"",
"# variable declaration",
"V_CC=12.0; #voltage in volt",
@@ -328,7 +322,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' percent change in collector emitter voltage'''",
"",
"# variable declaration",
"V_CC=20.0; #voltage in volt",
@@ -391,7 +384,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Q point current and voltage'''",
"",
"# variable declaratio",
"V_CC=10.0; #voltage in volt",
diff --git a/Electronic_Devices_/Chapter6.ipynb b/Electronic_Devices_/Chapter6.ipynb
index b4e7e58a..22b56e17 100644
--- a/Electronic_Devices_/Chapter6.ipynb
+++ b/Electronic_Devices_/Chapter6.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Q point'''",
"# result",
"",
"print \"theoretical example\""
@@ -69,7 +68,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' AC Emitter resistance'''",
"",
"# variable declaration",
"I_E=2.0*10**-3; #emittor current",
@@ -102,7 +100,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' voltage at base of transistor'''",
"",
"# variable declaration",
"I_E=3.8*10**-3; #emittor current",
@@ -143,7 +140,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' bypass capacitor'''",
"",
"import math",
"# variable declaration",
@@ -179,7 +175,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' bypass capacitor'''",
"",
"import math",
"# variable declaration",
@@ -216,7 +211,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Gain with load'''",
"",
"# variable declaration",
"R_C=10.0**3; #resistance in ohm",
@@ -254,7 +248,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Voltage gain with bypass'''",
"",
"# variable declaration",
"R_C=3.3*10**3; #resistance in ohm",
@@ -288,7 +281,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Common emitter amplifier'''",
"",
"import math",
"B_DC=150.0;",
@@ -380,7 +372,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Power gain delievered to load'''",
"",
"# variable declaration",
"R_E=10.0**3; #emitter resistance",
@@ -442,7 +433,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Overall voltage gain'''",
"",
"# variable declaration",
"V_CC=12.0; #source voltage in volt",
@@ -502,7 +492,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' voltage,current and power gain'''",
"",
"# variable declaration",
"B_DC=250.0; #dc value",
@@ -559,7 +548,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' total voltage gain in decibel'''",
"",
"import math",
"# variable declaration",
diff --git a/Electronic_Devices_/Chapter7.ipynb b/Electronic_Devices_/Chapter7.ipynb
index c8920a17..ac08bd97 100644
--- a/Electronic_Devices_/Chapter7.ipynb
+++ b/Electronic_Devices_/Chapter7.ipynb
@@ -42,7 +42,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Constant current area of operation of JFET'''",
"",
"# variable declaration",
"V_GS_off=-4; # voltage in volt",
@@ -83,7 +82,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Drain current'''",
"",
"print('The p-channel JFET requires a positive gate to source voltage.')",
"print('The more positive the voltage, the lesser the drain current.')",
@@ -113,7 +111,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''JFET current voltage'''",
"",
"I_DSS=9.0*10**-3;",
"V_GS_off=-8.0;",
@@ -152,7 +149,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''JFET transconductance'''",
"",
"#Variable Declaration",
"I_DSS=3.0*10**-3;",
@@ -192,7 +188,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find input resistance'''",
"",
"# variable declaration",
"V_GS=-20.0; # voltage in volt",
@@ -227,7 +222,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find gate to source voltage'''",
"",
"# variable declaration",
"V_DD=15; # voltage in volt",
@@ -270,7 +264,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find Gate resistance'''",
"",
"# variable declaration",
"V_GS=-5.0; # voltage in volt",
@@ -304,7 +297,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Self bias Q point'''",
"",
"I_DSS=25.0*10**-3;",
"V_GS_off=15.0;",
@@ -337,7 +329,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find Drain resistance'''",
"",
"# variable declaration",
"V_D=6; # drain voltage in volt",
@@ -378,7 +369,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find transfer characteristic'''",
"",
"import pylab",
"import numpy",
@@ -456,7 +446,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find gate to source voltage'''",
"",
"# variable declaration",
"V_DD=12; # voltage in volt",
@@ -499,7 +488,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find transfer characteristic for Q-point'''",
"",
"# variable declaration",
"R_1=2.2*10**6; # resistance in ohm ",
@@ -547,7 +535,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''DMOSFET'''",
"",
"I_DSS=10.0*10**-3;",
"V_GS_off=-8.0;",
@@ -581,7 +568,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''EMOSFET'''",
"",
"#variable Declaration",
"I_D_on=500.0*10**-3;",
@@ -614,7 +600,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find drain to source voltage'''",
"",
"# variable declaration",
"I_DSS=12*10**-3; # currenin ampere",
@@ -650,7 +635,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''EMOSFET bias'''",
"",
"#variable Declaration",
"I_D_on=200.0*10**-3;",
@@ -694,7 +678,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find drain current'''",
"",
"# variable declaration",
"V_GS_on=3; # voltage in volt",
diff --git a/Electronic_Devices_/Chapter8.ipynb b/Electronic_Devices_/Chapter8.ipynb
index 68824e84..8cb0d972 100644
--- a/Electronic_Devices_/Chapter8.ipynb
+++ b/Electronic_Devices_/Chapter8.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Voltage gain'''",
"",
"# variable declaration",
"g_m=4.0*10**-3; #gm value",
@@ -56,7 +55,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' The Voltage gain'''",
"",
"# variable declaration",
"r_ds=10.0*10**3;",
@@ -91,7 +89,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find Voltage gain'''",
"",
"# variable declaration",
"R_s=560; #resistance in ohm",
@@ -126,7 +123,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Unloaded amplifier'''",
"",
"#Variable declaration",
"vdd=12.0 #volts",
@@ -170,7 +166,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' RMS voltage'''",
"",
"# variable declaration",
"R_D=3.3*10**3; #resistance in ohm",
@@ -207,7 +202,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Input resistance wrt signal source '''",
"",
"# variable declaration",
"I_GSS=30.0*10**-9; #current in ampere",
@@ -243,7 +237,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' AC and DC output voltage '''",
"",
"# variable declaration",
"I_DSS=200.0*10**-3;",
@@ -286,7 +279,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Drain Current '''",
"",
"# Theoretical example",
"# result",
@@ -336,7 +328,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' To find Voltage gain'''",
"",
"# variable declaration",
"R_1=47.0*10**3;",
@@ -393,7 +384,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' AC and DC output voltage''' ",
"",
"# variable declaration",
"V_DD=-15.0; #p=channel MOSFET",
diff --git a/Electronic_Devices_/Chapter9.ipynb b/Electronic_Devices_/Chapter9.ipynb
index a4cd060a..3bd19f57 100644
--- a/Electronic_Devices_/Chapter9.ipynb
+++ b/Electronic_Devices_/Chapter9.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Voltage gain'''",
"",
"# variable declaration",
"V_CC=15.0; #supply voltage",
@@ -91,7 +90,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' efficiency'''",
"",
"# variable declaration",
"V_in=176.0*10**-3;",
@@ -131,7 +129,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' ideal maximum current'''",
"",
"# variable declaration",
"V_CC=20.00; #supply voltage",
@@ -168,7 +165,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' ideal maximum current'''",
"",
"# variable declaration",
"V_CC=20.0; #supply volatge",
@@ -205,7 +201,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' ideal maximum current'''",
"",
"import math",
"# variable declaration",
@@ -252,7 +247,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' power accross load'''",
"",
"import math",
"# variable declaration",
@@ -308,7 +302,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' average power dissipation'''",
"",
"import math",
"# variable declaration",
@@ -346,7 +339,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' efficiency'''",
"",
"import math",
"# variable declaration",
diff --git a/Electronic_Principles_/Chapter_10_New.ipynb b/Electronic_Principles_/Chapter_10_New.ipynb
index 2a7ee3d8..c36aae9c 100644
--- a/Electronic_Principles_/Chapter_10_New.ipynb
+++ b/Electronic_Principles_/Chapter_10_New.ipynb
@@ -27,21 +27,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.1.py\n",
- "#What is the voltage gain & output voltage across the load resistor? \n",
"\n",
- "#Variable declaration\n",
"re=22.7 #Ac resistance as per example 9-5(Ohm)\n",
"RC=3.6 #Collector Resistance(KOhm)\n",
"RL=10 #Load Resistance(KOhm)\n",
"Vin=2 #Input voltage(mV)\n",
"\n",
- "#Calculation\n",
"rc=RC*RL/(RC+RL) #AC collector resistance(Ohm)\n",
"Av=(rc/re)*1000 #Voltage gain\n",
"Vout=Av*Vin #Output voltage(mV)\n",
"\n",
- "#Result\n",
"print 'Voltage gain Av = ',round(Av,2)\n",
"print 'Output voltage Vout = ',round(Vout,2),'mV'"
],
@@ -71,10 +66,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.2.py\n",
- "#What is the voltage gain & output voltage across the load resistor?\n",
"\n",
- "#Variable declaration\n",
"RC=3.6 #Collector Resistance(KOhm)\n",
"RL=2.2 #Load Resistance(KOhm)\n",
"Vin=5 #Input voltage(mV)\n",
@@ -82,14 +74,12 @@
"RE=10 #Emitter resistance(KOhm)\n",
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"\n",
- "#Calculation\n",
"rc=RC*RL/(RC+RL) #AC collector resistance(Ohm)\n",
"IE=(VEE-VBE)/RE #emitter current(mA)\n",
"re=25/IE #AC resistance(Ohm)\n",
"Av=(rc/re)*1000 #Voltage gain\n",
"Vout=Av*Vin #Output voltage(mV)\n",
"\n",
- "#Result\n",
"print 'Emitter current IE = ',IE,'mA'\n",
"print 'Voltage gain Av = ',round(Av,2)\n",
"print 'Output voltage Vout = ',round(Vout,2),'mV'"
@@ -121,10 +111,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.3.py\n",
- "#In figure 10-4, Rs = 600 Ohm. find output voltage for B=300.\n",
"\n",
- "#Variable declaration\n",
"re=22.7 #Ac resistance as per example 9-5(Ohm)\n",
"B=300 #current gain\n",
"R1=10 #Base resistance1 (KOhm)\n",
@@ -133,13 +120,11 @@
"Av=117 #Voltage gain as per example 10-1\n",
"Vs=2 #ac voltage supply(mV)\n",
"\n",
- "#Calculation\n",
"Zin_base=B*re/1000 #input impedance of base(KOhm)\n",
"Zin_stage=((R1**-1)+(Zin_base**-1)+(R2**-1))**-1 #input impedance of stage(KOhm)\n",
"Vin=(Zin_stage/(Rs+Zin_stage))*Vs #input voltage(mV)\n",
"Vout=Av*Vin #output voltage(mV)\n",
"\n",
- "#Result\n",
"print 'input impedance of stage Zin(stage) = ',round(Zin_stage,2),'KOhm'\n",
"print 'Output volatge Vout = ',round(Vout,2),'mV'"
],
@@ -169,10 +154,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.4.py\n",
- "#Repeat preceding example for B=50.\n",
"\n",
- "#Variable declaration\n",
"re=22.7 #Ac resistance as per example 9-5(Ohm)\n",
"B=50 #current gain\n",
"R1=10 #Base resistance1 (KOhm)\n",
@@ -181,13 +163,11 @@
"Av=117 #Voltage gain as per example 10-1\n",
"Vs=2 #ac voltage supply(mV)\n",
"\n",
- "#Calculation\n",
"Zin_base=B*re/1000 #input impedance of base(KOhm)\n",
"Zin_stage=((R1**-1)+(Zin_base**-1)+(R2**-1))**-1 #input impedance of stage(KOhm)\n",
"Vin=(Zin_stage/(Rs+Zin_stage))*Vs #input voltage(mV)\n",
"Vout=Av*Vin #output voltage(mV)\n",
"\n",
- "#Result\n",
"print 'input impedance of stage Zin(stage) = ',round(Zin_stage,2),'KOhm'\n",
"print 'Output volatge Vout = ',round(Vout,2),'mV'"
],
@@ -217,10 +197,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.5.py\n",
- "#Find ac collector voltage & output voltage across the load resistor in first stage. \n",
"\n",
- "#Variable declaration\n",
"re=22.7 #Ac resistance as per example 9-5(Ohm)\n",
"B=100 #current gain\n",
"R1=10 #Base resistance1 (KOhm)\n",
@@ -230,7 +207,6 @@
"Vs=1 #ac voltage supply(mV)\n",
"RL=10 #Load resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"Zin_base=B*re/1000 #input impedance of base(KOhm)\n",
"Zin_stage1=((R1**-1)+(Zin_base**-1)+(R2**-1))**-1 #input impedance of stage1(KOhm)\n",
"Vin=(Zin_stage1/(Rs+Zin_stage1))*Vs #input voltage(mV)\n",
@@ -244,7 +220,6 @@
"Av=Av1*Av2 #Overall voltage gain\n",
"Voutf=Av*Vin #AC output voltage across RL(V)\n",
"\n",
- "#Result\n",
"print 'AC collector voltage of first stage vc = ',round(vc*1000,2),'mV'\n",
"print 'AC output voltage across load resistor Vout = ',round(Voutf*1000,2),'V'"
],
@@ -274,10 +249,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.6.py\n",
- "#What is the output voltage across RL if B=200? Ignore re'. \n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
"re=0.18 #Emitter resistance (KOhm)\n",
@@ -289,7 +261,6 @@
"RL=10 #Load resistance(KOhm)\n",
"B=200 #current gain \n",
"\n",
- "#Calculation\n",
"Zin_base=B*re #input impedance of base(KOhm)\n",
"Zin_stage=((R1**-1)+(Zin_base**-1)+(R2**-1))**-1 #input impedance of stage(KOhm)\n",
"Vin=(Zin_stage/(Rs+Zin_stage))*Vs #input voltage(mV)\n",
@@ -297,7 +268,6 @@
"Av=rc/re #Voltage gain of stage\n",
"Vout=Av*Vin #output voltage(mV)\n",
"\n",
- "#Result\n",
"print 'input impedance of stage Zin(stage) = ',round(Zin_stage,2),'KOhm'\n",
"print 'Output volatge Vout = ',round(Vout,2),'mV'"
],
@@ -327,10 +297,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.7.py\n",
- "#Repeat preceding example, but this time include re' in calculations.\n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
"re=0.18 #Emitter resistance (KOhm)\n",
@@ -343,7 +310,6 @@
"RL=10 #Load resistance(KOhm)\n",
"B=200 #current gain \n",
"\n",
- "#Calculation\n",
"Zin_base=B*(re+re1) #input impedance of base(KOhm)\n",
"Zin_stage=((R1**-1)+(Zin_base**-1)+(R2**-1))**-1 #input impedance of stage(KOhm)\n",
"Vin=(Zin_stage/(Rs+Zin_stage))*Vs #input voltage(mV)\n",
@@ -351,7 +317,6 @@
"Av=rc/(re+re1) #Voltage gain of stage\n",
"Vout=Av*Vin #output voltage(mV)\n",
"\n",
- "#Result\n",
"print 'input impedance of stage Zin(stage) = ',round(Zin_stage,2),'KOhm'\n",
"print 'Output volatge Vout = ',round(Vout,2),'mV'"
],
@@ -381,10 +346,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.8.py\n",
- "#What is the output voltage in figure 10-9 if B=200? Ignore re'. \n",
"\n",
- "#Variable declaration\n",
"re=0.18 #emitter reistance(Ohm)\n",
"B=200 #current gain\n",
"R1=10 #Base resistance1 (KOhm)\n",
@@ -394,7 +356,6 @@
"Vs=1 #ac voltage supply(mV)\n",
"RL=10 #Load resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"Zin_base=B*re #input impedance of base(KOhm)\n",
"Zin_stage1=((R1**-1)+(Zin_base**-1)+(R2**-1))**-1 #input impedance of stage1(KOhm)\n",
"Vin=(Zin_stage1/(Rs+Zin_stage1))*Vs #input voltage(mV)\n",
@@ -408,7 +369,6 @@
"Av=Av1*Av2 #Overall voltage gain\n",
"Voutf=Av*Vin #AC output voltage across RL(V)\n",
"\n",
- "#Result\n",
"print 'AC collector voltage of first stage vc = ',round(vc,2),'mV'\n",
"print 'AC output voltage across load resistor Vout = ',round(Voutf,2),'mV'"
],
@@ -438,21 +398,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.9.py\n",
- "#A resistor can be varied from 0 to 10 KOhm. then What is the min & max voltage gain of the two-stage amplifier?\n",
"\n",
- "#Variable declaration\n",
"RV_min=0 #minimum variable resistance (KOhm)\n",
"RV_max=10 #maximum variable resistance (KOhm)\n",
"re=0.1 #Emitter resistance (KOhm)\n",
"\n",
- "#Calculation\n",
"rf_min=RV_min+1 #minimum feedback resistance(KOhm)\n",
"rf_max=RV_max+1 #maximum feedback resistance(KOhm)\n",
"Av_min=rf_min/re #minimum voltage gain\n",
"Av_max=rf_max/re #maximum voltage gain\n",
"\n",
- "#Result\n",
"print 'minimum voltage gain Av(min)= ',Av_min\n",
"print 'minimum voltage gain Av(max)= ',Av_max"
],
diff --git a/Electronic_Principles_/Chapter_11_New.ipynb b/Electronic_Principles_/Chapter_11_New.ipynb
index 5a7be77e..9065b138 100644
--- a/Electronic_Principles_/Chapter_11_New.ipynb
+++ b/Electronic_Principles_/Chapter_11_New.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.1.py\n",
- "#What is the input impedance of the base & stage. B=200.\n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RE=4.3 #Emitter resistance(KOhm)\n",
"R1=10 #Base resistance1 (KOhm)\n",
@@ -41,7 +38,6 @@
"RG=0.6 #internal resistance of source(KOhm)\n",
"B=200 #current gain \n",
"\n",
- "#Calculation\n",
"VBB=VCC/2 #Base voltage(V)\n",
"VE=VBB-VBE #Emitter voltage(V)\n",
"IE=VE/RE #Emitter current(mA)\n",
@@ -50,7 +46,6 @@
"Zin_base=(re+(re1/1000))*B #input impedance of base(KOhm)\n",
"Zin_stage=((R1**-1)+(Zin_base**-1)+(R2**-1))**-1 #input impedance of stage(KOhm)\n",
"\n",
- "#Result\n",
"print 'input impedance of stage Zin(base) = ',round(Zin_base,2),'KOhm'\n",
"print 'input impedance of stage Zin(stage) = ',round(Zin_stage,2),'KOhm'"
],
@@ -80,20 +75,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.2.py\n",
- "#Assuming B=200, What is ac input voltage to emitter follower of figure 11-3?\n",
"\n",
- "#Variable declaration\n",
"re=3.03 #Emitter resistance(KOhm)\n",
"VG=1 #Input voltage(mV)\n",
"RG=0.6 #internal resistance of source(KOhm)\n",
"B=200 #current gain \n",
"Zin=5 #input impedance(KOhm)\n",
"\n",
- "#Calculation\n",
"Vin=(Zin/(Zin+RG))*VG #input voltage(V)\n",
"\n",
- "#Result\n",
"print 'Input voltage Vin = ',round(Vin,2),'V'"
],
"language": "python",
@@ -121,10 +111,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.3.py\n",
- "#What is the voltage gain of the emitter follower of figure 11-5? If B=150, what is the ac load voltage? \n",
"\n",
- "#Variable declaration\n",
"VCC=15 #collector voltage(V)\n",
"RE=2.2 #Emitter resistance(KOhm)\n",
"R1=4.7 #Base resistance1 (KOhm)\n",
@@ -135,7 +122,6 @@
"RG=0.6 #internal resistance of source(KOhm)\n",
"B=150 #current gain \n",
"\n",
- "#Calculation\n",
"VBB=VCC/2.0 #Base voltage(V)\n",
"VE=VBB-VBE #Emitter voltage(V)\n",
"IE=VE/RE #Emitter current(mA)\n",
@@ -148,7 +134,6 @@
"Vout=Av*Vin #output voltage(V)\n",
"\n",
"\n",
- "#Result\n",
"print 'input impedance of stage Zin(base) = ',round(Zin_base,2),'KOhm'\n",
"print 'input impedance of stage Zin(stage) = ',Zin_stage,'KOhm'\n",
"print 'voltage gain of emitter follower Av = ',round(Av,3)\n",
@@ -182,17 +167,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.4.py\n",
- "#Calculate the output impedance of the emitter follower of figure 11-9a.\n",
"\n",
- "#Variable declaration\n",
"RG=600 #internal resistance of source(KOhm)\n",
"B=300 #current gain \n",
"\n",
- "#Calculation\n",
"Zout=RG/B #Output impedance(KOhm)\n",
"\n",
- "#Result\n",
"print 'Output impedance Zout = ',Zout,'Ohm'"
],
"language": "python",
@@ -220,10 +200,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.5.py\n",
- "#Calculate the output impedance in figure 11-9a.\n",
"\n",
- "#Variable declaration\n",
"VCC=30 #collector voltage(V)\n",
"RE=0.1 #Emitter resistance(KOhm)\n",
"R1=10 #Base resistance1 (KOhm)\n",
@@ -233,7 +210,6 @@
"RG=0.6 #internal resistance of source(KOhm)\n",
"B=300 #current gain \n",
"\n",
- "#Calculation\n",
"VBQ=VCC/2.0 #Base voltage(V)\n",
"VEQ=VBQ #Emitter voltage(V), ignore VBE\n",
"IEQ=VEQ/RE #Emitter current(mA)\n",
@@ -243,7 +219,6 @@
"Ze=Z+re #impedance looking back into emitter(Ohm)\n",
"Zout=(((RE*1000)**-1)+(Ze**-1))**-1 #Output impedance(Ohm)\n",
"\n",
- "#Result\n",
"print 'Output impedance is Zout = ',round(Zout,2),'Ohm'"
],
"language": "python",
@@ -271,10 +246,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.6.py\n",
- "#What is the voltage gain of the CE stage in figure 11-10 for B = 100? \n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RE=0.68 #Emitter resistance(KOhm)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
@@ -286,7 +258,6 @@
"RL=0.27 #Load resistance(KOhm)\n",
"B=100 #current gain \n",
"\n",
- "#Calculation\n",
"VBB=(R1*R2/(R1+R2)) #Base voltage(V)\n",
"VE=VBB-VBE #Emitter voltage(V)\n",
"IE=VE/RE #Emitter current(mA)\n",
@@ -295,7 +266,6 @@
"rc=((RC**-1)+(Zin**-1))**-1 #ac collector resistance(KOhm)\n",
"Av=rc/(re/1000) #voltage gain of stage\n",
"\n",
- "#Result\n",
"print 'voltage gain of CE stage Av = ',round(Av,2)"
],
"language": "python",
@@ -323,11 +293,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.7.py\n",
- "#Emitter follower is removed in fig 11-10 and capacitor is used to couple the ac signal to RL = 270 Ohm. \n",
- "#What is the voltage gain of CE amplifier?\n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RE=0.68 #Emitter resistance(KOhm)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
@@ -339,7 +305,6 @@
"RL=0.27 #Load resistance(KOhm)\n",
"B=100 #current gain \n",
"\n",
- "#Calculation\n",
"VBB=10*(R2/(R1+R2)) #Base voltage(V)\n",
"VE=VBB-VBE #Emitter voltage(V)\n",
"IE=VE/RE #Emitter current(mA)\n",
@@ -347,7 +312,6 @@
"rc=((RC**-1)+(RL**-1))**-1 #ac collector resistance(KOhm)\n",
"Av=rc/(re/1000) #voltage gain of stage\n",
"\n",
- "#Result\n",
"print 'voltage gain of CE stage Av = ',round(Av,2)"
],
"language": "python",
@@ -375,10 +339,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.8.py\n",
- "#If each transistor of figure 11-13 has B=100, find overall current gain, IB of Q1 & input impedance at base of Q1?\n",
"\n",
- "#Variable declaration\n",
"VCC=15 #collector voltage(V)\n",
"RE=0.06 #Emitter resistance(KOhm)\n",
"R1=10.0 #Base resistance1 (KOhm)\n",
@@ -389,7 +350,6 @@
"B1=100 #current gain of Q1\n",
"B2=100 #current gain of Q2\n",
"\n",
- "#Calculation\n",
"B=B1*B2 #Overall current gain\n",
"VBB=15*(R2/(R1+R2)) #Base voltage(V)\n",
"VE=VBB-(2*VBE) #Emitter voltage(V)\n",
@@ -400,7 +360,6 @@
"re=((RE**-1)+(RL**-1))**-1 #ac emitter resistance(KOhm)\n",
"Zin_base=B*re #input impedance of Q1(KOhm)\n",
"\n",
- "#Result\n",
"print 'Overall current gain B = ',B\n",
"print 'base current of Q1 IB1 = ',round(IB1,2),'uA'\n",
"print 'input impedance at base of Q1 Zin(base) = ',Zin_base,'KOhm'"
@@ -432,24 +391,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.9.py\n",
- "#Figure 11-16 shows a zener follower. find output voltage & zener current for Bdc=100.\n",
"\n",
- "#Variable declaration\n",
"Vin=20 #input voltage (V)\n",
"RL=15 #Load resistance(Ohm)\n",
"Vz=10 #voltage across zener(V)\n",
"B=100 #current gain\n",
"Rs=680.0 #series resistor(Ohm)\n",
"\n",
- "#Calculation\n",
"Vout=Vz-0.7 #Output voltage approx.(V)\n",
"Iout=Vout/RL #Load current(A)\n",
"IB=Iout*1000/B #base current(mA)\n",
"Is=(Vin-Vz)*1000/Rs #current through series resistor(mA)\n",
"Iz=Is-IB #zener current(mA)\n",
"\n",
- "#Result\n",
"print 'output voltage Vout = ',Vout,'V'\n",
"print 'Zener current Iz = ',round(Iz,2),'mA'"
],
@@ -479,10 +433,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.10.py\n",
- "#What is the output voltage in figure 11-17?\n",
"\n",
- "#Variable declaration\n",
"Vin=30 #input voltage (V)\n",
"RL=100 #Load resistance(Ohm)\n",
"Vz=6.2 #voltage across zener(V)\n",
@@ -491,12 +442,10 @@
"R1=1 #Resistor (KOhm)\n",
"R2=2 #Resistor (KOhm)\n",
"\n",
- "#Calculation\n",
"Vout=(Vz+0.7)*(R1+R2)/R1 #Output voltage approx.(V)\n",
"I1=(Vz+0.7)/R1 #Load current(A)\n",
"Vout=I1*(R1+R2) #Output voltage(V)\n",
"\n",
- "#Result\n",
"print 'output voltage Vout = ',Vout,'V'"
],
"language": "python",
@@ -524,10 +473,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.11.py\n",
- "#What is the output voltage in figure 11-20?\n",
"\n",
- "#Variable declaration\n",
"VG=2 #AC input voltage (mV)\n",
"Vs=10 #supply volatge(V)\n",
"RL=10 #Load resistance(KOhm)\n",
@@ -537,7 +483,6 @@
"RC=3.6 #collector resistor (KOhm)\n",
"RE=2.2 #emitter resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"VB=Vs*R2/(R1+R2) #Base voltage(V)\n",
"IE=(VB-0.7)*1000/RE #emitter current(uA)\n",
"re=(25/IE)*1000 #ac resistance(Ohm)\n",
@@ -548,7 +493,6 @@
"Vin=(Zin/(Zin+RG))*VG #input voltage(V)\n",
"Vout=Av*Vin #output voltage(mV)\n",
"\n",
- "#Result\n",
"print 'output voltage Vout = ',round(Vout,2),'mVpp'"
],
"language": "python",
diff --git a/Electronic_Principles_/Chapter_12_New.ipynb b/Electronic_Principles_/Chapter_12_New.ipynb
index 268348c4..9f88647a 100644
--- a/Electronic_Principles_/Chapter_12_New.ipynb
+++ b/Electronic_Principles_/Chapter_12_New.ipynb
@@ -27,12 +27,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.1.py\n",
- "#What are the values of ICQ,VCEQ,rc in figure 12-7?\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"VCC=30 #collector voltage(V)\n",
"RE=20 #Emitter resistance(Ohm)\n",
"R1=490.0 #Base resistance1 (Ohm)\n",
@@ -41,7 +38,6 @@
"RL=180 #Load Resistance(Ohm)\n",
"RC=120 #Collector resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"VB=VCC*(R2/(R1+R2)) #Base voltage(V)\n",
"VE=math.ceil(VB-VBE) #Emitter voltage(V)\n",
"IE=VE/RE #Emitter current(A)\n",
@@ -50,7 +46,6 @@
"VCEQ=VC-VE #collector-emitter voltage (V) \n",
"rc=RC*RL/(RC+RL) #ac collector resistance(Ohm)\n",
"\n",
- "#Result\n",
"print 'Collector current ICQ = ',ICQ*1000,'mA'\n",
"print 'collector-emitter voltage VCEQ = ',VCEQ,'V'\n",
"print 'ac collector resistance rc = ',rc,'Ohm'"
@@ -82,10 +77,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.2.py\n",
- "#Determine the ac load line saturation and cutoff points in figure 12-7 & find MPP output voltage. \n",
"\n",
- "#Variable declaration\n",
"\n",
"VCC=30 #collector voltage(V)\n",
"RE=20 #Emitter resistance(Ohm)\n",
@@ -95,19 +87,16 @@
"RL=180 #Load Resistance(Ohm)\n",
"RC=120 #Collector resistance(Ohm)\n",
"\n",
- "#values from previous example,\n",
"ICQ=150 #collector current (mA)\n",
"VCEQ=9 #collector-emitter voltage (V) \n",
"rc=72.0 #ac collector resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"ic_sat=ICQ+(VCEQ/rc)*1000 #ic(sarturation) (mA)\n",
"VCE_cut=VCEQ+((ICQ*rc)/1000) #VCE(cut-off) (V)\n",
"MP1=ICQ*RC\n",
"MP2=VCEQ\n",
"MPP=2*(min(MP1,MP2)) #maximum peak-to-peak voltage (V)\n",
"\n",
- "#Result\n",
"print 'ic(sarturation) = ',ic_sat,'mA'\n",
"print 'VCE(cut-off) = ',VCE_cut,'V'\n",
"print 'maximum peak-to-peak voltage MPP = ',MPP,'V'"
@@ -139,12 +128,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.3.py\n",
- "#If Vpp is 18V and the input impedance of base is 100 Ohm, what is power gain in figure 12-9a?\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"VCC=30 #collector voltage(V)\n",
"RE=20 #Emitter resistance(Ohm)\n",
"R1=490.0 #Base resistance1 (Ohm)\n",
@@ -156,13 +142,11 @@
"zin=100 #input impedance of base(Ohm)\n",
"MPP=18 #peak-to-peak voltage (V)\n",
"\n",
- "#Calculation\n",
"Zin_stage=((zin**-1)+(R1**-1)+(R2**-1))**-1 #input impedance of stage(KOhm)\n",
"Pin=vin**2/(Zin_stage*8)/1000 #ac input power (mW)\n",
"Pout=1000*MPP**2/(RL*8) #ac output power (mW)\n",
"Ap=Pout/Pin #power gain\n",
"\n",
- "#Result\n",
"print 'Power gain Ap = ',math.ceil(Ap)"
],
"language": "python",
@@ -190,12 +174,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.4.py\n",
- "#What is the transistor power dissipation and efficiency in figure 12-9a?\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"VCC=30 #collector voltage(V)\n",
"RE=20 #Emitter resistance(Ohm)\n",
"R1=490.0 #Base resistance1 (Ohm)\n",
@@ -204,7 +185,6 @@
"RL=180 #Load Resistance(Ohm)\n",
"RC=120 #Collector resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"VB=VCC*(R2/(R1+R2)) #Base voltage(V)\n",
"VE=math.ceil(VB-VBE) #Emitter voltage(V)\n",
"IE=VE/RE #Emitter current(A)\n",
@@ -218,7 +198,6 @@
"Pout=0.225 #Output power as per example 12-3 (W)\n",
"n=(Pout/Pdc)*100 #efficiency of stage\n",
"\n",
- "#Result\n",
"print 'Power dissipation PDQ = ',PDQ,'W'\n",
"print 'efficiency of stage n = ',round(n,2),'%'"
],
@@ -248,10 +227,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.6.py\n",
- "#What are the values of ICQ,VCEQ,rc in figure 12-13?\n",
"\n",
- "#Variable declaration\n",
"VCC=12 #collector voltage(V)\n",
"RE=16 #Emitter resistance(Ohm)\n",
"R1=50.0 #Base resistance1 (Ohm)\n",
@@ -259,7 +235,6 @@
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"RL=16 #Load Resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"VB=VCC*(R2/(R1+R2)) #Base voltage(V)\n",
"VE=(VB-VBE) #Emitter voltage(V)\n",
"IE=VE/RE #Emitter current(A)\n",
@@ -267,7 +242,6 @@
"VCEQ=VCC-VE #collector-emitter voltage (V) \n",
"re=RE*RL/(RE+RL) #ac emitter resistance(Ohm)\n",
"\n",
- "#Result\n",
"print 'Collector current ICQ = ',ICQ*1000,'mA'\n",
"print 'collector-emitter voltage VCEQ = ',VCEQ,'V'\n",
"print 'ac collector resistance re = ',re,'Ohm'"
@@ -299,10 +273,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.7.py\n",
- "#Determine the ac saturation and cutoff points in figure 12-13 & find the circuit's MPP output voltage. \n",
"\n",
- "#Variable declaration\n",
"VCC=12 #collector voltage(V)\n",
"RE=16 #Emitter resistance(Ohm)\n",
"R1=50.0 #Base resistance1 (Ohm)\n",
@@ -310,19 +281,16 @@
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"RL=16 #Load Resistance(Ohm)\n",
"\n",
- "#values from previous example,\n",
"ICQ=456 #collector current (mA)\n",
"VCEQ=4.7 #collector-emitter voltage (V) \n",
"re=8.0 #ac emitter resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"ic_sat=(1000*(VCEQ/re))+ICQ #ic(sarturation) (mA)\n",
"VCE_cut=VCEQ+(ICQ*re)/1000 #VCE(cut-off) (V)\n",
"MP1=ICQ*re/1000\n",
"MP2=VCEQ\n",
"MPP=2*(min(MP1,MP2)) #maximum peak-to-peak voltage (V)\n",
"\n",
- "#Result\n",
"print 'ic(sarturation) = ',ic_sat/1000,'A'\n",
"print 'VCE(cut-off) = ',VCE_cut,'V'\n",
"print 'maximum peak-to-peak voltage MPP = ',MPP,'V'"
@@ -354,22 +322,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.8.py\n",
- "#What is the max transistor power dissipation & max output power?\n",
"\n",
- "#Variable declaration\n",
"VCC=20 #collector voltage(V)\n",
"R1=100.0 #Base resistance1 (Ohm)\n",
"R2=100.0 #Base resistance2 (Ohm)\n",
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"RL=8.0 #Load Resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"MPP=VCC #maximum peak-to-peak voltage (V)\n",
"PD_max=MPP**2/(40*RL) #Maximum power dissipation(W)\n",
"Pout_max=MPP**2/(8*RL) #Maximum output power(W)\n",
"\n",
- "#Result\n",
"print 'Maximum power dissipation PD_max = ',PD_max,'W'\n",
"print 'Maximum output power Pout_max = ',Pout_max,'W'"
],
@@ -399,12 +362,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.9.py\n",
- "#If the adjustabe resistor is 15 Ohm, what is the efficiency in preceding example?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"VCC=20 #collector voltage(V)\n",
"R1=100.0 #Base resistance1 (Ohm)\n",
"R2=100.0 #Base resistance2 (Ohm)\n",
@@ -412,7 +372,6 @@
"RL=8.0 #Load Resistance(Ohm)\n",
"Ra=15 #adjustable resistor(Ohm)\n",
"\n",
- "#Calculation\n",
"VCEQ=VCC/2 #collector-emitter voltage (V) \n",
"I_bias=VCC/(R1+R2+Ra) #bias current(mA)\n",
"Ic_sat=VCEQ/RL #ic(sarturation) (mA)\n",
@@ -423,7 +382,6 @@
"n=(Pout/Pdc)*100 #efficiency of stage\n",
"\n",
"\n",
- "#Result\n",
"print 'efficiency of stage n = ',round(n,2),'%'"
],
"language": "python",
@@ -451,17 +409,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.10.py\n",
- "#What is the ICQ in figure 12-22 & maximum efficiency of the amplifier?\n",
"\n",
- "#Variable declaration\n",
"VCC=20 #collector voltage(V)\n",
"R1=3.9 #Base resistance1 (KOhm)\n",
"R2=3.9 #Base resistance2 (KOhm)\n",
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"RL=10.0 #Load Resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"VCEQ=VCC/2 #collector-emitter voltage (V) \n",
"I_bias=(VCC-(2*VBE))/(R1+R2) #bias current(mA)\n",
"Ic_sat=VCEQ/RL #ic(sarturation) (mA)\n",
@@ -471,7 +425,6 @@
"Pout=VCC**2/(8*RL) #Output power (W)\n",
"n=(Pout/Pdc)*100 #efficiency of stage\n",
"\n",
- "#Result\n",
"print 'efficiency of stage n = ',round(n,2),'%'"
],
"language": "python",
@@ -499,18 +452,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.11.py\n",
- "#Describe the action of figure 12-27?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"L=2*10**-6 #inductance (H)\n",
"C=470*10**-12 #capacitance(F)\n",
"\n",
- "#Calculation\n",
"fr=((2*math.pi)*((L*C)**0.5))**-1\n",
"\n",
- "#Result\n",
"print 'Resonant frequency fr = ',round((fr*10**-6),2),'MHz'"
],
"language": "python",
@@ -538,25 +486,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.12.py\n",
- "#If QL is 100 in figure 12-33, what is the band width of amplifier?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"fr=5.19*10**6 #frequency as per previous example(Hz)\n",
"L=2*10**-6 #inductance (H)\n",
"C=470*10**-12 #capacitance(F)\n",
"QL=100 #quality factor of coil\n",
"RL=1 #Load resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"XL=2*math.pi*fr*L #inductive impedance(Ohm)\n",
"Rp=QL*XL/1000 #Eq. parallel resistance of coil(KOhm)\n",
"rc=1000*Rp*RL/(Rp+RL) #ac collector resistance(Ohm)\n",
"Q=rc/XL #Q of overall circuit\n",
"BW=(fr/Q/1000) #band width of amplifier(KHz)\n",
"\n",
- "#Result\n",
"print 'band width of amplifier BW = ',round(BW,2),'KHz'"
],
"language": "python",
@@ -584,20 +527,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.13.py\n",
- "#In figure 12-33a, what is the worst-case power dissipation?\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"VCC=15 #collector voltage(V)\n",
"rc=867.0 #ac collector resistance as per preceding example (Ohm)\n",
"\n",
- "#Calculation\n",
"MPP=2*VCC #Maximum peak-to-peak voltage(V)\n",
"PD=1000*MPP**2/(40*rc) #worst-case power dissipation(mW)\n",
"\n",
- "#Result\n",
"print 'Worst-case power dissipation PD = ',math.ceil(PD),'mW'"
],
"language": "python",
@@ -625,20 +563,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.14.py\n",
- "#In circuit of figure 12-37 is to operate over range of 0 to 50 deg C. \n",
- "#Find the maximum power rating of the transistor for the worst-case temperature.\n",
"\n",
- "#Variable declaration\n",
"PD=625 #maximum power rating at 25 deg C(mW)\n",
"D=5 #Derating factor(mW/deg C)\n",
"TA=50 #ambient temperature(deg C)\n",
"\n",
- "#Calculation\n",
"DP=D*(TA-25) #difference in power(mW) \n",
"PD_max=PD-DP #maximum power rating(mW)\n",
"\n",
- "#Result\n",
"print 'Maximum power rating PD_max = ',PD_max,'mW'"
],
"language": "python",
diff --git a/Electronic_Principles_/Chapter_13_New.ipynb b/Electronic_Principles_/Chapter_13_New.ipynb
index 00c96741..2b92ce1a 100644
--- a/Electronic_Principles_/Chapter_13_New.ipynb
+++ b/Electronic_Principles_/Chapter_13_New.ipynb
@@ -27,17 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.1.py\n",
- "#JFET gate current is 1nA when the reverse gate voltage is 20 V. What is the Rin of this JFET?\n",
"\n",
- "#Variable declaration\n",
"VG=20 #Gate voltage(V)\n",
"IG=1*10**-9 #Gate current(A) \n",
"\n",
- "#Calculation\n",
"Rin=VG/IG #input resistance(Ohm)\n",
"\n",
- "#Result\n",
"print 'input resistance of JFET Rin = ',Rin/10**6,'MOhm'"
],
"language": "python",
@@ -65,18 +60,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.2.py\n",
- "#Vp=6V and IDSS=100 mA. What is the ohmic resistance & gate-source cutoff voltage?\n",
"\n",
- "#Variable declaration\n",
"Vp=6 #Pinch off voltage(V)\n",
"IDSS=100*10**-3 #current drain to source with shorted gate(A)\n",
"\n",
- "#Calculation\n",
"RDS=Vp/IDSS #Ohmic resistance(Ohm)\n",
"VGS_off=-Vp #gate-source cutoff voltage(V)\n",
"\n",
- "#Result\n",
"print 'Ohmic resistance RDS = ',RDS,'Ohm'\n",
"print 'Gate-source cutoff VGS(off) = ',VGS_off,'V'"
],
@@ -106,19 +96,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.3.py\n",
- "#VGS(off)=-4V and IDSS=5mA\n",
- "#Find VG & ID at the half cutoff point.\n",
"\n",
- "#Variable declaration\n",
"VGS_off=-4 #gate-source cutoff voltage(V)\n",
"IDSS=5 #current drain to source with shorted gate(mA)\n",
"\n",
- "#Calculation\n",
"VGS=VGS_off/2 #gate voltage(V)\n",
"ID=IDSS/4.0 #drain current(mA)\n",
"\n",
- "#Result\n",
"print 'Gate voltage VGS = ',VGS,'V'\n",
"print 'Drain current ID = ',ID,'mA'"
],
@@ -148,19 +132,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.4.py\n",
- "#VGS(off)=-8V and IDSS=16mA\n",
- "#What are VG & ID at the half cutoff point?\n",
"\n",
- "#Variable declaration\n",
"VGS_off=-8 #gate-source cutoff voltage(V)\n",
"IDSS=16 #current drain to source with shorted gate(mA)\n",
"\n",
- "#Calculation\n",
"VGS=VGS_off/2 #gate voltage(V)\n",
"ID=IDSS/4.0 #drain current(mA)\n",
"\n",
- "#Result\n",
"print 'Gate voltage VGS = ',VGS,'V'\n",
"print 'Drain current ID = ',ID,'mA'"
],
@@ -190,26 +168,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.5.py\n",
- "#What is the VD in figure 13-8a?\n",
"\n",
- "#Variable declaration\n",
"Vp=4 #pinchoff voltage(V)\n",
"Vin=-10 #input voltage(V)\n",
"RD=10.0 #drain resistor(KOhm)\n",
"IDSS=10.0 #IDSS (mA)\n",
"VDD=10.0 #Drain supply voltage(V)\n",
"\n",
- "#Calculation\n",
- "#Befor point A,\n",
"VGS_off=-Vp #VGS cutoff voltage(V)\n",
"VD=-Vin #drain voltage(V)\n",
- "#Between point A&B,\n",
"ID_sat=VD/RD #saturation drain current(mA)\n",
"RDS=Vp/IDSS #Ohmic resistance(Ohm)\n",
"VD=VDD*RDS/(RDS+RD) #drain votage(V)\n",
"\n",
- "#Result\n",
"print 'Drain voltage VD = ',round(VD,2),'V'"
],
"language": "python",
@@ -237,22 +208,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.6.py\n",
- "#Find medium source resistance & VD.\n",
"\n",
- "#Variable declaration\n",
"Vp=4 #pinchoff voltage(V)\n",
"RD=2.0 #drain resistor(KOhm)\n",
"RS=400 #source resistance(Ohm)\n",
"IDSS=10.0 #IDSS (mA)\n",
"VDD=30.0 #Drain supply voltage(V)\n",
"\n",
- "#Calculation\n",
"RDS=1000*Vp/IDSS #Ohmic resistance(Ohm)\n",
"ID=IDSS/4.0 #drain current(mA)\n",
"VD=VDD-(ID*RD) #drain votage(V)\n",
"\n",
- "#Result\n",
"print 'Ohmic resistance RDS = ',RDS,'Ohm'\n",
"print 'drain voltage VD = ',VD,'V'"
],
@@ -282,16 +248,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.7.py \n",
- "#determine the range of VGS and ID Q point values, optimum source resistor.\n",
"\n",
- "#Variable declaration\n",
"IDSS=20 #IDSS (mA)\n",
"RS=270 #Source resistance (Ohm)\n",
"\n",
- "#Calculation\n",
"VGS=-IDSS*RS #gate-source voltage(V)\n",
- "#after drawing (0,0) and seond point,\n",
"VGSQ_min=-0.8 #Q point minimum gate-source voltage(V)\n",
"VGSQ_max=-2.1 #Q point maximum gate-source voltage(V)\n",
"IDQ_min=2.8 #Q point minimum drain current(V)\n",
@@ -303,7 +264,6 @@
"Rs_min=1000*VGS_off_min/ID_min #Minimum value for Rs(Ohm)\n",
"Rs_max=1000*VGS_off_max/ID_max #Maximum value for Rs(Ohm)\n",
"\n",
- "#Result\n",
"print 'Maximum value for Rs =',Rs_max,'Ohm'\n",
"print 'Minimum value for Rs =',Rs_min,'Ohm'\n",
"print 'Choose approximately mid point between these two.'"
@@ -335,23 +295,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.8.py\n",
- "#Draw the dc load line and Q point for figure 13-15a usng ideal methods.\n",
"\n",
- "#Variable declaration\n",
"VS=10 #source voltage (V)\n",
"RS=2.0 #source resistance(KOhm)\n",
"VDD=30 #Drain supply voltage (V)\n",
"RD=1.0 #Drain resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"ID=VS/Rs #Drain current(mA)\n",
"VD=VDD-(ID*RD) #Drain voltage(V)\n",
"VDS=VD-VS #Drain to source voltage (V)\n",
"ID_sat=VDD/(RD+RS) #ID(dc-saturation) (mA)\n",
"VDS_cut=VDD #VDS(cutoff) (V)\n",
"\n",
- "#Result\n",
"print 'ID (saturation) = ',ID_sat,'mA'\n",
"print 'VDS (cutoff) = ',VDS_cut,'V'"
],
@@ -381,10 +336,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.9.py\n",
- "#Find minimum & maximum Q point for JFET.\n",
"\n",
- "#Variable declaration\n",
"IDSS=20 #IDSS (mA)\n",
"RS=270 #Source resistance (Ohm)\n",
"VDD=30 #Drain supply voltage (V)\n",
@@ -392,17 +344,14 @@
"R1=1*10**6 #Gate resistor1(Ohm) \n",
"R2=2*10**6 #Gate resistor2(Ohm) \n",
"\n",
- "#Calculation\n",
"VG=-VDD*R1/(R1+R2) #gate-source voltage(V)\n",
"ID=VG/RS #current for second point(mA)\n",
"\n",
- "#after drawing (0,0) and seond point,\n",
"VGSQ_min=-0.4 #Q point minimum gate-source voltage(V)\n",
"VGSQ_max=-2.4 #Q point maximum gate-source voltage(V)\n",
"IDQ_min=5.2 #Q point minimum drain current(V)\n",
"IDQ_max=6.3 #Q point maximum drain current(V)\n",
"\n",
- "#Result\n",
"print 'Maximum value for VGS =',VGSQ_max,'V'\n",
"print 'Minimum value for VGS =',VGSQ_min,'V'\n",
"print 'Maximum value for ID =',IDQ_max,'mA'\n",
@@ -436,19 +385,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.10.py\n",
- "#What is the ID & VD in figure 13-19a?\n",
"\n",
- "#Variable declaration\n",
"RS=3.0 #Source resistance (KOhm)\n",
"VDD=15 #Drain supply voltage (V)\n",
"RD=1.0 #Drain resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"ID=VDD/RS #drain current(mA)\n",
"VD=VDD-(ID*RD) #drain voltage(V)\n",
"\n",
- "#Result\n",
"print 'Drain current ID = ',ID,'mA'\n",
"print 'Drain voltage VD = ',VD,'V'"
],
@@ -478,20 +422,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.11.py\n",
- "#In figure 13-19b, What is the VD & ID? \n",
"\n",
- "#Variable declaration\n",
"RS=2.0 #Source resistance (KOhm)\n",
"VDD=10 #Drain supply voltage (V)\n",
"RD=1.0 #Drain resistance(KOhm)\n",
"VBE=0.7 #BJT transistor drop(V)\n",
"\n",
- "#Calculation\n",
"ID=((VDD/2)-VBE)/RS #drain current(mA)\n",
"VD=VDD-(ID*RD) #drain voltage(V)\n",
"\n",
- "#Result\n",
"print 'Drain current ID = ',ID,'mA'\n",
"print 'Drain voltage VD = ',VD,'V'"
],
@@ -521,18 +460,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.12.py\n",
- "#IDSS=5mA and gm0=5000 uS, What is the value of VGS(off) and gm when VGS=-1V?\n",
"\n",
- "#Variable declaration\n",
"IDSS=5.0 #IDSS current (mA)\n",
"gm0=5000.0 #transconductance at VGS=0(uS)\n",
"VGS=-1.0 #VGS (V)\n",
- "#Calculation\n",
"VGS_off=1000*-2*IDSS/gm0 #VGS (off) (V)\n",
"gm=gm0*(1-(VGS/VGS_off)) #gm at VGS=-1V\n",
"\n",
- "#Result\n",
"print 'VGS (Off) = ',VGS_off,'V'\n",
"print 'gm = ',gm,'uS'"
],
@@ -562,21 +496,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.13.py\n",
- "#If gm=5000 uS in figure 13-23, what is the output voltage?\n",
"\n",
- "#Variable declaration\n",
"RD=3.6 #drain resistance(KOhm)\n",
"RL=10 #Load resistance(KOhm)\n",
"gm=5000 #transconductance (uS)\n",
"Vin=1 #input(mVpp)\n",
"\n",
- "#Calculation\n",
"rd=RD*RL/(RD+RL) #ac drain resistance(KOhm)\n",
"Av=gm*rd/1000 #voltage gain\n",
"Vout=Av*Vin #Output voltage(V)\n",
"\n",
- "#Result\n",
"print 'ac drain resistance rd = ',round(rd,2),'KOhm'\n",
"print 'voltage gain Av = ',round(Av,2)\n",
"print 'output voltage Vout = ',round(Vout,2),'mVpp'"
@@ -608,21 +537,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.14.py\n",
- "#If gm=2500 uS in figure 13-24, what is the output voltage of source follower?\n",
"\n",
- "#Variable declaration\n",
"RS=1.0 #source resistance(KOhm)\n",
"RL=1.0 #Load resistance(KOhm)\n",
"gm=2500.0*10**-6 #transconductance (S)\n",
"Vin=1 #input(mVpp)\n",
"\n",
- "#Calculation\n",
"rs=1000*RS*RL/(RS+RL) #ac source resistance(Ohm)\n",
"Av=gm*rs/(1+(gm*rs)) #voltage gain\n",
"Vout=Av*Vin #Output voltage(V)\n",
"\n",
- "#Result\n",
"print 'ac source resistance rs = ',round(rs,2),'Ohm'\n",
"print 'voltage gain Av = ',round(Av,2)\n",
"print 'output voltage Vout = ',round(Vout,2),'mVpp'"
@@ -654,23 +578,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.15.py\n",
- "#Figure 13-25 includes variable resistor of 1KOhm.\n",
- "#If this is adjusted to 780 Ohm, what is the voltage gain?\n",
"\n",
- "#Variable declaration\n",
"Ra=780 #Adjustaed resistance(Ohm)\n",
"RS1=220 #source resistance(Ohm)\n",
"VDD=30 #Drain supply voltage(V)\n",
"RL=3 #Load resistance(KOhm)\n",
"gm=2000.0*10**-6 #transconductance (S)\n",
"\n",
- "#Calculation\n",
"RS=(RS1+Ra)/1000 #total source resistance(KOhm)\n",
"rs=1000*RS*RL/(RS+RL) #ac source resistance(Ohm)\n",
"Av=gm*rs/(1+(gm*rs)) #voltage gain\n",
"\n",
- "#Result\n",
"print 'Ac source resistance rs = ',rs,'Ohm'\n",
"print 'voltage gain Av = ',Av"
],
@@ -700,10 +618,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.16.py\n",
- "#In figure 13-26, What is the ID & Av? \n",
"\n",
- "#Variable declaration\n",
"RS=2.2 #source resistance(Ohm)\n",
"VDD=30 #Drain supply voltage(V)\n",
"RL=3.3 #Load resistance(KOhm)\n",
@@ -711,13 +626,11 @@
"R1=2*10**-6 #Base resistor 1(Ohm)\n",
"R2=1*10**-6 #Base resistor 2(Ohm) \n",
"\n",
- "#Calculation\n",
"VD=VDD*(R2/(R1+R2)) #drain voltage(V)\n",
"ID=VD/RS #drain current(mA)\n",
"rs=1000*RS*RL/(RS+RL) #ac source resistance(Ohm)\n",
"Av=gm*rs/(1+(gm*rs)) #voltage gain\n",
"\n",
- "#Result\n",
"print 'Ac source resistance rs = ',rs/1000,'KOhm'\n",
"print 'voltage gain Av = ',round(Av,2)"
],
@@ -747,11 +660,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.17.py\n",
- "#A JFET shunt switch has RD = 10 KOhm, IDSS=10 mA, and VGS(Off)=-2V. If vin =10 mVpp, \n",
- "#what are output voltages & on-off ratio?\n",
"\n",
- "#Variable declaration\n",
"RD=10.0 #Drain resistance(KOhm)\n",
"R1=0.2 #resistance(KOhm)\n",
"IDSS=10.0 #IDSS current(mA)\n",
@@ -759,13 +668,11 @@
"gm=3500.0*10**-6 #transconductance (S)\n",
"Vin=10.0 #input voltage (mVpp)\n",
"\n",
- "#Calculation\n",
"RDS=-VGS_off/IDSS #Ohmic resistance(Ohm)\n",
"Vout_on=Vin*RDS/(RD+R1) #Output voltage when JFET is on(V)\n",
"Vout_off=Vin #Output voltage when JFET is off(V)\n",
"ratio=Vout_off/Vout_on #on-off ratio\n",
"\n",
- "#Result\n",
"print 'output voltage Vout = ',round(Vout_on,2),'mVpp'\n",
"print 'on-off ratio = ',ratio"
],
@@ -795,10 +702,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.18.py\n",
- "#What are output voltages? Resistance of 10 MOhm when JFET is off, What is the on-off ratio?\n",
"\n",
- "#Variable declaration\n",
"RD=10.0 #Drain resistance(KOhm)\n",
"R1=0.2 #resistance(KOhm)\n",
"R2=10*10**6 #resistance(Ohm)\n",
@@ -807,12 +711,10 @@
"gm=3500.0*10**-6 #transconductance (S)\n",
"Vin=10.0 #input voltage (mVpp)\n",
"\n",
- "#Calculation\n",
"Vout_on=Vin*(RD/(RD+R1)) #Output voltage when JFET is on(V)\n",
"Vout_off=Vin*(RD/R2) #Output voltage when JFET is off(V)\n",
"ratio=Vout_on/Vout_off/1000 #on-off ratio\n",
"\n",
- "#Result\n",
"print 'output voltage Vout when on = ',round(Vout_on,2),'mVpp'\n",
"print 'output voltage Vout when off = ',Vout_off*10**6,'uVpp'\n",
"print 'on-off ratio = ',round(ratio,2)"
@@ -844,20 +746,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 13.19.py\n",
- "#The square wave on the gate has frequency of 20KHz. what is frequency of the chopped output?\n",
- "#If RDS = 50 Ohm, what is the peak value of chopped output?\n",
"\n",
- "#Variable declaration\n",
"fout=20 #frequency(KHz)\n",
"RDS=50.0 #Ohmic resistance(Ohm)\n",
"RL=10*10**3 #Load resistance(Ohm)\n",
"Vin=100 #input voltage (mV)\n",
"\n",
- "#Calculation\n",
"Vpeak=Vin*RL/(RL+RDS) #peak voltage(V)\n",
"\n",
- "#Result\n",
"print 'Outout Vpeak = ',round(Vpeak,2),'mV'"
],
"language": "python",
diff --git a/Electronic_Principles_/Chapter_14_New.ipynb b/Electronic_Principles_/Chapter_14_New.ipynb
index 9d13545e..d16f054a 100644
--- a/Electronic_Principles_/Chapter_14_New.ipynb
+++ b/Electronic_Principles_/Chapter_14_New.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.1.py\n",
- "#A D-MOSFET has VGS_Off=-3V and IDSS = 6mA. What will the ID when VGS equals -1V,-2V, 0V,1V and 2V ?\n",
"\n",
- "#Variable declaration\n",
"VGS_off=-3.0 #Gate-source cutoff voltage(V)\n",
"IDSS=6 #IDSS current(mA) \n",
"VGS1=-1 #VGS voltage(V)\n",
@@ -39,7 +36,6 @@
"VGS4=1\n",
"VGS5=2\n",
"\n",
- "#Calculation\n",
"ID1=IDSS*((1-(VGS1/VGS_off))**2)\n",
"ID2=IDSS*((1-(VGS2/VGS_off))**2)\n",
"ID3=IDSS*((1-(VGS3/VGS_off))**2)\n",
@@ -47,7 +43,6 @@
"ID5=IDSS*((1-(VGS5/VGS_off))**2)\n",
"\n",
"\n",
- "#Result\n",
"print 'Drain current ID1 = ',round(ID1,2),'mA'\n",
"print 'Drain current ID2 = ',round(ID2,2),'mA'\n",
"print 'Drain current ID3 = ',ID3,'mA'\n",
@@ -83,11 +78,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.2.py\n",
- "#The D-MOSFET has VGS(off) =-2V, IDSS=4mA and gm0=2000 uS. \n",
- "#What is the circuit's output voltage?\n",
"\n",
- "#Variable declaration\n",
"VGS_off=-2.0 #Gate-source cutoff voltage(V)\n",
"IDSS=4 #IDSS current(mA) \n",
"gm0=2000*10**-6 #transconductance(S)\n",
@@ -97,13 +88,11 @@
"RL=10.0 #Load resistance(KOhm)\n",
"Vin=20 #input voltage(mV)\n",
"\n",
- "#Calculation\n",
"VDS=VDD-(IDSS*RD) #Drain-source voltage(V)\n",
"rd=RD*RL/(RD+RL) #ac drain resistance(KOhm) \n",
"Av=gm0*rd*1000 #voltage gain\n",
"Vout=Vin*Av #output voltage (mV)\n",
"\n",
- "#Result\n",
"print 'Output voltage Vout = ',round(Vout,2),'mV'"
],
"language": "python",
@@ -131,10 +120,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.3.py\n",
- "#What is the output voltage in figure 14-14a?\n",
"\n",
- "#Variable declaration\n",
"VGS_on=4.5 #Gate-source voltage(V)\n",
"ID_on=75 #ID current(mA) \n",
"RDS=6 #Ohmic resistance(Ohm)\n",
@@ -142,14 +128,10 @@
"RD=1.0 #Drain resistance(KOhm)\n",
"RL=10.0 #Load resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"ID_sat=VDD/RD #drain saturation current(mA)\n",
- "#VGS is high,\n",
"Vout1=VDD*(RDS/(RDS+(RD*1000)))#output voltage when VGS is high(V)\n",
- "#VGS is low, \n",
"Vout2=VDD #output voltage when VGS is low(V) \n",
"\n",
- "#Result\n",
"print 'output voltage when VGS is high = ',round(Vout1,2),'V'\n",
"print 'output voltage when VGS is low = ',Vout2,'V'"
],
@@ -179,18 +161,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.4.py\n",
- "#What is the LED current ib figure 14-15?\n",
"\n",
- "#Variable declaration\n",
"ID=20 #ID current as per previous example(mA) \n",
"Vled=2 #Led drop(V)\n",
"RD=1.0 #Drain resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"ID=(VDD-Vled)/RD #drain current considering LED drop\n",
"\n",
- "#Result\n",
"print 'drain current considering LED drop ID = ',ID,'mA'"
],
"language": "python",
@@ -218,17 +195,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.5.py\n",
- "#What does the circuit of figure 14-16a do if a coil current of 30 mA or more closes the relay contacts? \n",
"\n",
- "#Variable declaration\n",
"Rrc=500.0 #Resistance of relay(V)\n",
"VDD=24 #drain supply voltage(V)\n",
"\n",
- "#Calculation\n",
"ID_sat=VDD/Rrc #drain saturation current(A)\n",
"\n",
- "#Result\n",
"print 'Drain saturaion current ID(sat) = ',ID_sat*1000,'mA'"
],
"language": "python",
@@ -256,19 +228,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.6.py\n",
- "#What is the output voltage in figure 14-20a when the input is low & high?\n",
"\n",
- "#Variable declaration\n",
"VDD=20.0 #drain supply voltage (V)\n",
"RD=10*10**3 #drain resistance(Ohm)\n",
"RDS=50.0 #Ohmic resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"Vout1=VDD #Output voltage when i/p is low (V)\n",
"Vout2=VDD*RDS/(RDS+RD) #Output voltage when i/p is high (V)\n",
"\n",
- "#Result\n",
"print 'Output voltage when input is low Vout1 = ',Vout1,'V'\n",
"print 'Output voltage when input is high Vout2 = ',round((Vout2*1000),2),'mV'"
],
@@ -298,19 +265,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.7.py\n",
- "#What is the output voltage in figure 14-20b?\n",
"\n",
- "#Variable declaration\n",
"VDD=10.0 #drain supply voltage (V)\n",
"RD=2*10**3 #drain resistance(Ohm)\n",
"RDS=500.0 #Ohmic resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"Vout1=VDD #Output voltage when i/p is low (V)\n",
"Vout2=VDD*RDS/(RDS+RD) #Output voltage when i/p is high (V)\n",
"\n",
- "#Result\n",
"print 'Output voltage when input is low Vout1 = ',Vout1,'V'\n",
"print 'Output voltage when input is high Vout2 = ',Vout2,'V'"
],
@@ -340,13 +302,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.8.py\n",
- "#The MOSFET of figure 14-22a have RDS(ON)=100 Ohm, RDS(off)=1 MOhm. What does output waveform look like?\n",
"\n",
"import matplotlib.pyplot as plt\n",
"%pylab inline\n",
"\n",
- "#calculation & plotting\n",
"print 'Input signal switches from 0 to 15 V at pt. A & 15 to 0 V at pt. B'\n",
"x=[1,2,3,4,5,6,7,8,9,10]\n",
"y=[0,0,0,15,15,15,15,0,0,0]\n",
@@ -408,21 +367,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.9.py\n",
- "#What is the current through the motor winding of figure 14-28?\n",
"\n",
- "#Variable declaration\n",
"VDD=30.0 #drain supply voltage (V)\n",
"RD=30 #drain resistance(Ohm)\n",
"RDS=1.95 #Ohmic resistance(Ohm)\n",
"ID_on=2 #ID for MOSFET on (A)\n",
"\n",
- "#Calculation\n",
"ID_sat=VDD/RD #drain saturation current(A)\n",
- "#ID_sat<ID(On) so, considering RDS,\n",
"ID=VDD/(RDS+RD) #drain current(A)\n",
"\n",
- "#Result\n",
"print 'current through motor winding is ID = ',round(ID,2),'A'"
],
"language": "python",
@@ -450,22 +403,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.10.py\n",
- "#If photodiode is off, gate voltage rises to 10 V.\n",
- "#what is ac current through lamp?\n",
"\n",
- "#Variable declaration\n",
"VDD=30.0 #drain supply voltage (V)\n",
"RD=10 #drain resistance(Ohm)\n",
"RDS=1.07 #Ohmic resistance(Ohm)\n",
"ID_on=5 #ID for MOSFET on (A)\n",
"\n",
- "#Calculation\n",
"ID_sat=VDD/RD #drain saturation current(A)\n",
- "#ID_sat<ID(On) so, considering RDS,\n",
"ID=VDD/(RDS+RD) #drain current(A)\n",
"\n",
- "#Result\n",
"print 'current through lamp is ID = ',round(ID,2),'A'"
],
"language": "python",
@@ -493,20 +439,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.11.py\n",
- "#The circuit of figure 14-30 automatically filled swimming pool.\n",
- "#Find current through water valve of if power FET has RDS(on)=0.5 Ohm\n",
"\n",
- "#Variable declaration\n",
"VDD=10.0 #drain supply voltage (V)\n",
"RD=10 #drain resistance(Ohm)\n",
"RDS=0.5 #Ohmic resistance(Ohm)\n",
"ID_on=5 #ID for MOSFET on (A)\n",
"\n",
- "#Calculation\n",
"ID=VDD/(RDS+RD) #drain current(A)\n",
"\n",
- "#Result\n",
"print 'current through water valve is ID = ',round(ID,2),'A'"
],
"language": "python",
@@ -534,10 +474,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.12.py\n",
- "#What is the RC time constant & lamp power at full brightness?\n",
"\n",
- "#Variable declaration\n",
"VDD=30.0 #drain supply voltage (V)\n",
"RD=10 #drain resistance(Ohm)\n",
"RDS=1.07 #Ohmic resistance(Ohm)\n",
@@ -545,13 +482,11 @@
"R2=1*10**6 #Resistance2 at gate (Ohm)\n",
"C=10*10**-6 #Capacitance at gate(F)\n",
"\n",
- "#Calculation\n",
"RTH=R1*R2/(R1+R2) #Thevenin resistance(Ohm)\n",
"RC=RTH*C #RC Time constant(s)\n",
"ID=VDD/(RDS+RD) #drain current through lamp(A)\n",
"P=(ID**2)*RD #Lamp Power(W)\n",
"\n",
- "#Result\n",
"print 'RC Time constant = ',round(RC,2),'s'\n",
"print 'current through lamp is ID = ',round(ID,2),'A'\n",
"print 'Lamp power P = ',round(P,2),'W'"
@@ -583,22 +518,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.13.py\n",
- "#find constant k value and ID at VGSvalues of 3 V & 4.5V \n",
"\n",
- "#Variable declaration\n",
"ID_on=0.6 #ID for MOSFET on (A)\n",
"VGS_on=4.5 #VGS for MOSFET on(V)\n",
"VGS_th=2.1 #VGS threshold(V)\n",
"VGS1=3 #Gate-source voltage1(V)\n",
"VGS2=4.5 #Gate-source voltage2(V)\n",
"\n",
- "#Calculation\n",
"k=ID_on/(VGS_on-VGS_th)**2 #constant(A/V2)\n",
"ID1=1000*k*(VGS1-VGS_th)**2 #ID for VGS=3 (mA)\n",
"ID2=1000*k*(VGS2-VGS_th)**2 #ID for VGS=4.5 (mA)\n",
"\n",
- "#Result\n",
"print 'ID1 (for VGS = 3V) = ',round(ID1,2),'mA'\n",
"print 'ID2 (for VGS = 4.5V) = ',ID2,'mA'"
],
@@ -628,19 +558,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.14.py\n",
- "#E-MOSFET has ID(on) = 3mA and VDS(on) = 10V. \n",
- "#If VDD=25V,find RD that allows MOSFET to operate at specified Q point.\n",
"\n",
- "#Variable declaration\n",
"ID_on=3 #ID (On) (mA)\n",
"VDS_on=10 #VDS(On) (V) \n",
"VDD=25 #Drain supply voltage (V)\n",
"\n",
- "#Calculation\n",
"RD=(VDD-VDS_on)/ID_on #Drain resistance(KOhm)\n",
"\n",
- "#Result\n",
"print 'Drain resistance RD = ',RD,'KOhm'"
],
"language": "python",
@@ -668,11 +592,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 14.15.py\n",
- "#Find VGS,ID,gm and Vout. \n",
- "# k=104*10-3 A/V2 ,ID(On)=600mA, VGS(th)=2.1V\n",
"\n",
- "#Variable declaration\n",
"ID_on=600 #ID (On) (mA)\n",
"VGS_th=2.1 #VGS(threshold) (V) \n",
"VDD=12 #Drain supply voltage (V)\n",
@@ -683,7 +603,6 @@
"RD=68.0 #Drain resistance(Ohm)\n",
"RL=1.0*10**3 #Load resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"VGS=VDD*R2/(R1+R2) #Gate-source voltage(V)\n",
"ID=1000*k*(VGS1-VGS_th)**2 #Drain current (mA)\n",
"gm=2*k*(VGS-VGS_th) #transconductance (S)\n",
@@ -691,7 +610,6 @@
"Av=gm*rd #voltage gain\n",
"Vout=Vin*Av #Output voltage (V)\n",
"\n",
- "#Result\n",
"print 'Gate-source voltage VGS = ',round(VGS,2),'V'\n",
"print 'transconductance gm = ',round((gm*1000),2),'mS'\n",
"print 'Ac drain resistance rd = ',round(rd,2),'Ohm'\n",
diff --git a/Electronic_Principles_/Chapter_15_New.ipynb b/Electronic_Principles_/Chapter_15_New.ipynb
index 3e39f907..b47db517 100644
--- a/Electronic_Principles_/Chapter_15_New.ipynb
+++ b/Electronic_Principles_/Chapter_15_New.ipynb
@@ -27,22 +27,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 15.1.py\n",
- "#The diode of figure 15-5 has a brekover voltage of 10 V. if Vin is increased to 15V, what is the ID?\n",
"\n",
- "#Variable declaration\n",
"VB=10 #breakover voltage(V)\n",
"Vin=15 #input voltage(V)\n",
"R=100.0 #resistance (Ohm)\n",
"\n",
- "#Calculation\n",
- "#Vin>VB so diode breaks over\n",
"I1=1000*Vin/R #diode current ideally(mA)\n",
"I2=1000*(Vin-0.7)/R #diode current with second approx.(mA)\n",
- "#To get more accurate answer, as per figure 15-3e , Voltage=0.9V when I=150mA\n",
"I3=1000*(Vin-0.9)/R #diode current more accurately(mA)\n",
"\n",
- "#Result\n",
"print 'Diode current ideally ID1 = ',I1,'mA'\n",
"print 'Diode current with second approx. ID2 = ',I2,'mA'\n",
"print 'Diode current more accurately ID3 = ',I3,'mA'"
@@ -74,19 +67,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 15.2.py\n",
- "#The diode of figure 15-5 has Ih of 4 mA. Vin is increased to 15 V ,then decreased to open the diode. \n",
- "#What is the input voltage that opens the diode?\n",
"\n",
- "#Variable declaration\n",
"Ih=4*10**-3 #holding current(mA)\n",
"R=100.0 #resistance (Ohm)\n",
"Vs=15 #input voltage (V)\n",
"\n",
- "#Calculation\n",
"Vin=0.7+(Ih*R) #new input voltage(V)\n",
"\n",
- "#Result\n",
"print 'New input voltage Vin = ',Vin,'V'"
],
"language": "python",
@@ -114,23 +101,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 15.3.py\n",
- "#Figure 15-6a shows a sawtooth generator. \n",
- "#when capacitor voltage reaches +10V, diode breaks over. \n",
- "#What is RC time constant for capacitor charging? \n",
- "#What is frequency of the sawtooth wave if its period is approximately 20% of time constant.\n",
"\n",
- "#Variable declaration\n",
"R=2.0*10**3 #resistance (Ohm)\n",
"C=0.02*10**-6 #capacitance (F)\n",
"VB=10 #breakdown voltage(V)\n",
"\n",
- "#Calculation\n",
"RC=R*C #Time constant(s)\n",
"T=0.2*RC #period (s)\n",
"f=T**-1 #frequency(Hz) \n",
"\n",
- "#Result\n",
"print 'time constant RC = ',RC*10**6,'us'\n",
"print 'Period T = ',T*10**6,'us'\n",
"print 'Frequency = ',f/1000,'KHz'"
@@ -162,22 +141,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 15.4.py\n",
- "#In figure 15-14 the SCR has a trigger voltage 0.75 V and trigger current 7mA. What is Vin that turns SCR on?\n",
- "#If Ih is 6mA, what is supply voltage that turns it off?\n",
"\n",
- "#Variable declaration\n",
"It=7*10**-3 #trigger current(mA)\n",
"R1=100.0 #resistance (Ohm)\n",
"R2=1*10**3 #resistance (Ohm)\n",
"Vt=0.75 #trigger voltage (V)\n",
"Ih=6*10**-3 #holding current(mA)\n",
"\n",
- "#Calculation\n",
"Vin=Vt+(It*R2) #minimum input voltage(V)\n",
"VCC=0.7+(Ih*R1) #supply voltage for turning of SCR(V)\n",
"\n",
- "#Result\n",
"print 'Minimum input voltage Vin = ',Vin,'V'\n",
"print 'supply voltage for turning of SCR VCC = ',VCC,'V'"
],
@@ -207,10 +180,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 15.5.py\n",
- "#What is peak output voltage? What is frequency of sawtooth wave if its period is approximately 20% of time constant?\n",
"\n",
- "#Variable declaration\n",
"IGT=200*10**-6 #trigger current(mA)\n",
"VGT=1 #trigger voltage(V) \n",
"R1=900.0 #resistance (Ohm)\n",
@@ -220,7 +190,6 @@
"Ih=6*10**-3 #holding current(mA)\n",
"R=1*10**3 #Resistance (Ohm) \n",
"\n",
- "#Calculation\n",
"RTH=R1*R2/(R1+R2) #Thevenin resistance (Ohm)\n",
"Vin=VGT+(IGT*RTH) #input voltage needed to trigger(V)\n",
"Vp=10*Vin #Output voltage at SCR firing point(V)\n",
@@ -228,7 +197,6 @@
"T=RC*0.2 #period (s)\n",
"f=1/T #frequency (Hz)\n",
"\n",
- "#Result\n",
"print 'peak output voltage Vpeak = ',Vp,'V'\n",
"print 'time constant RC = ',RC*10**6,'us'\n",
"print 'Period T = ',T*10**6,'us'\n",
@@ -262,20 +230,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 15.6.py\n",
- "#Calculate supply voltage that turns on crowbar of figure 15-21.\n",
"\n",
- "#Variable declaration\n",
"Vz=5.6 #breakdown voltage(V)\n",
"VGT1=0.75 #trigger voltage (V) \n",
"VGT2=1.5 #worst case maximum trigger voltage(V) \n",
"Vz2=6.16 #break down voltage with 10% tolerance (V)\n",
"\n",
- "#Calculation\n",
"VCC1=Vz+VGT1 #supply voltage(V) \n",
"VCC2=VGT2+Vz2 #Over voltage (V)\n",
"\n",
- "#Result\n",
"print 'supply voltage VCC1 = ',VCC1,'V'\n",
"print 'supply over voltage VCC2 = ',VCC2,'V'"
],
@@ -305,18 +268,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 15.7.py\n",
- "#Using figure 15-22a, find approximate firing angle & conduction angle when R=26KOhm\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"C=0.1*10**-6 #capacitance (F)\n",
"f=60 #frequency (Hz)\n",
"R=26*10**3 #resistance(KOhm)\n",
"Vm=120 #input ac voltage(V)\n",
"\n",
- "#Calculation\n",
"XC=(2*math.pi*f*C)**-1 #capacitive reactance(Ohm)\n",
"ZT=((R**2)+(XC**2))**0.5 #impedance (Ohm)\n",
"thetaz=math.atan2(-XC,R)*180/math.pi #angle (deg)\n",
@@ -324,7 +283,6 @@
"VC=IC*XC #voltage across C(V)\n",
"thetac=180+thetaz #conduction angle(deg)\n",
"\n",
- "#Result\n",
"print 'Capacitor reactance XC = ',round((XC/1000),2),'KOhm'\n",
"print 'impedance ZT = ',round((ZT/1000),2),'KOhm'\n",
"print 'firing angle = ',round(thetaz,2),'deg'\n",
@@ -362,19 +320,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 15.8.py\n",
- "#If the triac has fired, what is the approximate current through 22Ohm resistor?\n",
"\n",
- "#Variable declaration\n",
"C=1*10**-6 #capacitance (F)\n",
"R1=22.0 #resistance (Ohm)\n",
"R2=82*10**3 #resistance(KOhm)\n",
"Vs=75 #input voltage(V)\n",
"\n",
- "#Calculation\n",
"I=Vs/R1 #current through 22Ohm resistor (A)\n",
"\n",
- "#Result\n",
"print 'current through 22Ohm resistor I = ',round(I,2),'A'"
],
"language": "python",
@@ -402,18 +355,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 15.9.py\n",
- "#diac has breakover voltage of 32V. \n",
- "#If the triac has a trigger voltage of 1V and a trigger current of 10mA, what is the Vc that triggers the triac?\n",
"\n",
- "#Variable declaration\n",
"Vdb=32.0 #diac break down voltage (V)\n",
"VTT=1 #triac trigger voltage(V)\n",
"\n",
- "#Calculation\n",
"Vin=VTT+Vdb #input voltage for triggering triac\n",
"\n",
- "#Result\n",
"print 'input voltage for triggering triac vin = ',Vin,'V'"
],
"language": "python",
diff --git a/Electronic_Principles_/Chapter_16_New.ipynb b/Electronic_Principles_/Chapter_16_New.ipynb
index 82ef1353..847a3379 100644
--- a/Electronic_Principles_/Chapter_16_New.ipynb
+++ b/Electronic_Principles_/Chapter_16_New.ipynb
@@ -27,23 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.1.py\n",
- "#Amplifier has midband Av of 200, with cutoff frequencies f1=20 Hz, f2=20KHz. \n",
- "#Find voltage gain for 5Hz & 200KHz input frequencies.\n",
"\n",
- "#Variable declaration\n",
"Avm=200 #mid band voltage gain\n",
"f1=20 #cutoff frequency1 (Hz)\n",
"f2=20*10**3 #cutoff frequency2 (Hz)\n",
"fi1=5 #input frequency1(Hz)\n",
"fi2=200*10**3 #input frequency2(Hz)\n",
"\n",
- "#Calculation\n",
"Av=0.707*Avm #voltage gain at either frequency\n",
"Av1=Avm/(1+(f1/fi1)**2)**0.5 #voltage gain for 5Hz\n",
"Av2=Avm/(1+(fi2/f2)**2)**0.5 #voltage gain for 200KHz\n",
"\n",
- "#Result\n",
"print 'voltage gain for 200KHz = ',round(Av1,2)\n",
"print 'voltage gain for 5Hz = ',round(Av2,2)"
],
@@ -73,18 +67,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.2.py\n",
- "#In figure 16-4a OP-Amp with midband Av of 100,000. \n",
- "#if f2=10Hz, then what does frequency response look like? \n",
"\n",
- "#Variable declaration\n",
"Avm=100000 #mid band voltage gain\n",
"f2=10 #cutoff frequency (Hz)\n",
"\n",
- "#Calculation\n",
"Av=0.707*Avm #voltage gain at cutoff frequency\n",
"\n",
- "#Result\n",
"print 'voltage gain for 10Hz = ',Av"
],
"language": "python",
@@ -112,12 +100,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.3.py\n",
- "#In preceding example , what is Av if input frequencies: 100Hz, 1KHz, 10KHZ, 100 KHz, 1MHz?\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"Avm=100000 #mid band voltage gain\n",
"fc=10.0 #cutoff frequency (Hz)\n",
"fi1=100.0 #input frequency1(Hz)\n",
@@ -126,14 +111,12 @@
"fi4=100*10**3 #input frequency4(Hz)\n",
"fi5=1*10**6 #input frequency5(Hz)\n",
"\n",
- "#Calculation\n",
"Av1=Avm/(1+(fi1/fc)**2)**0.5 #voltage gain for 100Hz\n",
"Av2=Avm/(1+(fi2/fc)**2)**0.5 #voltage gain for 1KHz\n",
"Av3=Avm/(1+(fi3/fc)**2)**0.5 #voltage gain for 10KHz\n",
"Av4=Avm/(1+(fi4/fc)**2)**0.5 #voltage gain for 100KHz\n",
"Av5=Avm/(1+(fi5/fc)**2)**0.5 #voltage gain for 1MHz\n",
"\n",
- "#Result\n",
"print 'voltage gain for 100Hz = ',math.ceil(Av1)\n",
"print 'voltage gain for 1KHz = ',math.ceil(Av2)\n",
"print 'voltage gain for 10KHz = ',math.ceil(Av3)\n",
@@ -169,24 +152,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.4.py\n",
- "#Calculate power gain(dB) for following values Ap=1,2,4,8\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"Ap1=1 #power gain1\n",
"Ap2=2 #power gain2\n",
"Ap3=4 #power gain3\n",
"Ap4=8 #power gain4\n",
"\n",
- "#Calculation\n",
"Ap_db1=10*math.log10(Ap1) #decibel power gain(dB)\n",
"Ap_db2=10*math.log10(Ap2) #decibel power gain(dB)\n",
"Ap_db3=10*math.log10(Ap3) #decibel power gain(dB)\n",
"Ap_db4=10*math.log10(Ap4) #decibel power gain(dB)\n",
"\n",
- "#Result\n",
"print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
"print 'decibel power gain Ap2(dB) = ',round(Ap_db2,2),'dB'\n",
"print 'decibel power gain Ap3(dB) = ',round(Ap_db3,2),'dB'\n",
@@ -222,24 +200,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.5.py\n",
- "#Calculate decibel power gain for following values Ap=1,0.5,0.25,0.125\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"Ap1=1 #power gain1\n",
"Ap2=0.5 #power gain2\n",
"Ap3=0.25 #power gain3\n",
"Ap4=0.125 #power gain4\n",
"\n",
- "#Calculation\n",
"Ap_db1=10*math.log10(Ap1) #decibel power gain(dB)\n",
"Ap_db2=10*math.log10(Ap2) #decibel power gain(dB)\n",
"Ap_db3=10*math.log10(Ap3) #decibel power gain(dB)\n",
"Ap_db4=10*math.log10(Ap4) #decibel power gain(dB)\n",
"\n",
- "#Result\n",
"print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
"print 'decibel power gain Ap2(dB) = ',round(Ap_db2,2),'dB'\n",
"print 'decibel power gain Ap3(dB) = ',round(Ap_db3,2),'dB'\n",
@@ -275,24 +248,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.6.py\n",
- "#Calculate decibel power gain for following values Ap=1,10,100,1000\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"Ap1=1 #power gain1\n",
"Ap2=10 #power gain2\n",
"Ap3=100 #power gain3\n",
"Ap4=1000 #power gain4\n",
"\n",
- "#Calculation\n",
"Ap_db1=10*math.log10(Ap1) #decibel power gain(dB)\n",
"Ap_db2=10*math.log10(Ap2) #decibel power gain(dB)\n",
"Ap_db3=10*math.log10(Ap3) #decibel power gain(dB)\n",
"Ap_db4=10*math.log10(Ap4) #decibel power gain(dB)\n",
"\n",
- "#Result\n",
"print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
"print 'decibel power gain Ap2(dB) = ',Ap_db2,'dB'\n",
"print 'decibel power gain Ap3(dB) = ',Ap_db3,'dB'\n",
@@ -328,24 +296,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.7.py\n",
- "#Calculate decibel power gain for following values Ap=1,0.1,0.01,0.001\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"Ap1=1 #power gain1\n",
"Ap2=0.1 #power gain2\n",
"Ap3=0.01 #power gain3\n",
"Ap4=0.001 #power gain4\n",
"\n",
- "#Calculation\n",
"Ap_db1=10*math.log10(Ap1) #decibel power gain(dB)\n",
"Ap_db2=10*math.log10(Ap2) #decibel power gain(dB)\n",
"Ap_db3=10*math.log10(Ap3) #decibel power gain(dB)\n",
"Ap_db4=10*math.log10(Ap4) #decibel power gain(dB)\n",
"\n",
- "#Result\n",
"print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
"print 'decibel power gain Ap2(dB) = ',Ap_db2,'dB'\n",
"print 'decibel power gain Ap3(dB) = ',Ap_db3,'dB'\n",
@@ -381,24 +344,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.8.py\n",
- "#What is total voltage gain in decibels?\n",
- "#find decibel voltage gain of each stage and total.\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"Av1=100 #voltage gain1\n",
"Av2=200 #voltage gain2\n",
"\n",
- "#Calculation\n",
"Av=Av1*Av2 #total voltage gain\n",
"Av_db=20*math.log10(Av) #decibel total voltage gain(dB)\n",
"Av_db1=20*math.log10(Av1) #decibel voltage gain(dB)\n",
"Av_db2=20*math.log10(Av2) #decibel voltage gain(dB)\n",
"Avt_db=Av_db1+Av_db2 #decibel total voltage gain(dB)\n",
"\n",
- "#Result \n",
"print 'decibel total voltage gain Av(dB) = ',round(Av_db,2),'dB'\n",
"print 'decibel voltage gain Av1(dB) = ',Av_db1,'dB'\n",
"print 'decibel voltage gain Av2(dB) = ',round(Av_db2,2),'dB'\n",
@@ -432,23 +389,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.9.py\n",
- "#Impedance matched stages with R=50 Ohm. \n",
- "#Find total decibel gain, total power gain & total voltage gain.\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"Av_db1=23 #voltage gain1(dB)\n",
"Av_db2=36 #voltage gain2(dB)\n",
"Av_db3=31 #voltage gain3(dB)\n",
"\n",
- "#Calculation\n",
"Avt_db=Av_db1+Av_db2+Av_db3 #decibel total voltage gain(dB)\n",
"Ap=10**(Avt_db/10) #power gain by taking antilog\n",
"Avt=10**(Avt_db/20.0) #total voltage gain by taking antilog\n",
"\n",
- "#Result \n",
"print 'decibel total voltage gain Avt(dB) = ',Avt_db,'dB'\n",
"print 'power gain Ap = ',Ap\n",
"print 'total voltage gain Avt = ',math.ceil(Avt)"
@@ -480,20 +431,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.10.py\n",
- "#In preceding example, What is ordinary Av of each stage?\n",
"\n",
- "#Variable declaration\n",
"Av_db1=23 #voltage gain1(dB)\n",
"Av_db2=36 #voltage gain2(dB)\n",
"Av_db3=31 #voltage gain3(dB)\n",
"\n",
- "#Calculation\n",
"Av1=10**(Av_db1/20.0) #voltage gain of stage 1 by taking antilog\n",
"Av2=10**(Av_db2/20.0) #voltage gain of stage 2 by taking antilog\n",
"Av3=10**(Av_db3/20.0) #voltage gain of stage 3 by taking antilog\n",
"\n",
- "#Result \n",
"print 'voltage gain of stage 1 : Av1 = ',round(Av1,2)\n",
"print 'voltage gain of stage 1 : Av2 = ',round(Av2,2)\n",
"print 'voltage gain of stage 1 : Av3 = ',round(Av3,2)"
@@ -525,16 +471,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.11.py\n",
- "#Output of an amplifier is 24 dBm. What is output power?\n",
"\n",
- "#Variable declaration\n",
"Ap_dbm=24 #power gain(dBm)\n",
"\n",
- "#Calculation\n",
"P=10**(Ap_dbm/10.0) #Output power(mW)\n",
"\n",
- "#Result \n",
"print 'Output power P = ',round(P,2),'mW'"
],
"language": "python",
@@ -562,18 +503,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.12.py\n",
- "#Output of an amplifier is -34 dBV. What is output voltage?\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"Av_dbV=-34 #voltage gain(dBV)\n",
"\n",
- "#Calculation\n",
"V=10**(Av_dbV/20.0) #Output voltage(V)\n",
"\n",
- "#Result \n",
"print 'Output voltage V = ',math.ceil(V*1000),'mV'"
],
"language": "python",
@@ -601,18 +537,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.13.py\n",
- "#OP-Amp gives midband Av of 100,000. \n",
- "#a cutoff f=10Hz, and roll off rate of 20 dB per decade. find ordinary voltage gain at 1MHz.\n",
"\n",
- "#Variable declaration\n",
"Avm=100000 #mid band voltage gain\n",
"f2=10 #cutoff frequency (Hz)\n",
"\n",
- "#Calculation\n",
"Av_db=20*math.log10(Avm) #decibel total voltage gain(dB)\n",
"\n",
- "#Result\n",
"print 'voltage gain for 10Hz = ',Av_db1,'dB'\n",
"print 'At 1MHz, due to roll off factor of 20 dB, voltage gain reduce to 0 dB'"
],
@@ -642,18 +572,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.14.py\n",
- "#Draw ideal bode plot for lag circuit of figure 16-18a.\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R=5*10**3 #resistance(Ohm)\n",
"C=100*10**-12 #Capacitance (F)\n",
"\n",
- "#Calculation\n",
"f2=(2*math.pi*R*C)**-1 #cutoff frequency (Hz)\n",
"\n",
- "#Result\n",
"print 'cutoff frequency f2 = ',round((f2/1000),2),'KHz'\n",
"print 'After f2, response rolls off at rate of 20 dB/decade'"
],
@@ -683,19 +608,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.15.py\n",
- "#dc amplifier stage has a midband Av of 100. \n",
- "#If RTH facing bypass capacitor is 2KOhm. What is the ideal bode plot?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R=2*10**3 #resistance(Ohm)\n",
"C=500*10**-12 #Capacitance (F)\n",
"\n",
- "#Calculation\n",
"f2=(2*math.pi*R*C)**-1 #cutoff frequency (Hz)\n",
"\n",
- "#Result\n",
"print 'cutoff frequency f2 = ',round((f2/1000),2),'KHz'\n",
"print 'After f2, response rolls off at rate of 20 dB/decade up to funity of 15.9 MHz'"
],
@@ -725,21 +644,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.17.py\n",
- "#The amplifier of figure 16-22a has a Av of 100,000.\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R=5.3*10**3 #resistance(Ohm)\n",
"C=30*10**-12 #Capacitance (F)\n",
"Av=100000 #voltage gain\n",
"\n",
- "#Calculation\n",
"Cout_M=C #input Miller Capacitance (F)\n",
"Cin_M=Av*C #input Miller Capacitance (F)\n",
"f2=(2*math.pi*R*Cin_M)**-1 #cutoff frequency (Hz)\n",
"\n",
- "#Result\n",
"print 'cutoff frequency f2 = ',round(f2,3),'Hz'"
],
"language": "python",
@@ -767,16 +681,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.18.py\n",
- "#What is upper cutoff frequency for circuit shown in figure 16-24a?\n",
"\n",
- "#Variable declaration\n",
"TR=1*10**-6 #rise time(s)\n",
"\n",
- "#Calculation\n",
"f2=0.35/TR #cutoff frequency (Hz)\n",
"\n",
- "#Result\n",
"print 'cutoff frequency f2 = ',f2/1000,'KHz'"
],
"language": "python",
@@ -804,11 +713,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.19.py\n",
- "#calculate low-cutoff frequency for each coupling and by-pass capacitor. \n",
"import math\n",
"\n",
- "#Variable declaration\n",
"re=22.7 #from past dc calculation (example:9-5)(Ohm)\n",
"VCC=10 #collector voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
@@ -823,7 +729,6 @@
"C3=2.2*10**-6 #output capacitance(F)\n",
"C2=10*10**-6 #emitter capacitance(F)\n",
"\n",
- "#Calculation\n",
"Rinb=B*re/1000 #Rin(base) (KOhm)\n",
"Ri=RG+((R1**-1)+(Rinb**-1)+(R2**-1))**-1 #thevenin resistance facing i/p capacitor\n",
"f1i=((2*math.pi*Ri*C1)**-1)/1000 #input cutoff frequency (Hz)\n",
@@ -833,7 +738,6 @@
"f1z=((2*math.pi*Zout*C2)**-1)/1000 #cutoff frequency for bypass circuit (Hz)\n",
"\n",
"\n",
- "#Result\n",
"print 'input cutoff frequency f1 = ',round(f1i,2),'Hz'\n",
"print 'output cutoff frequency f1 = ',round(f1o,2),'Hz'\n",
"print 'cutoff frequency for bypass circuit f1 = ',round(f1z,2),'Hz'"
@@ -865,13 +769,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.20.py\n",
- "#calculate high cutoff frequency for base bypass and collector bypass circuit. \n",
- "#B=150 & Cstray=10pF.\n",
"\n",
"import math # This will import math module\n",
"\n",
- "#Variable declaration\n",
"re=22.7 #from past dc calculation (example:9-5)(Ohm)\n",
"VCC=10 #collector voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
@@ -886,7 +786,6 @@
"Cs=10*10**-12 #stray capacitance(F)\n",
"\n",
"\n",
- "#Calculation\n",
"Rinb=B*re/1000 #Rin(base) (KOhm)\n",
"Ce1=((2*math.pi*re*fT)**-1) #capacitance Ce'(F)\n",
"rc=RC*RL/(RC+RL) #collector resistance(KOhm) \n",
@@ -901,7 +800,6 @@
"R2=1000*RC*RL/(RC+RL) #resistance facing this capacitance(Ohm)\n",
"f21=((2*math.pi*R2*C2)**-1) #collector bypass circuit cutoff frequency (Hz)\n",
"\n",
- "#Result\n",
"print 'base bypass circuit cutoff frequency f2 = ',round((f2/10**6),2),'MHz'\n",
"print 'collector bypass circuit cutoff frequency f21 = ',round((f21/10**6),2),'MHz'"
],
@@ -931,11 +829,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.21.py\n",
- "#Determine input-coupling & output coupling circuit low-frequency cutoff points.\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"re=22.7 #from past dc calculation (example:9-5)(Ohm)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
"R1=2*10**6 #Base resistance1 (Ohm)\n",
@@ -947,13 +842,11 @@
"Cout=10*10**-6 #Cout capacitance(F)\n",
"\n",
"\n",
- "#Calculation\n",
"Rthi=RG+((R1**-1)+(R2**-1))**-1 #Thevenin resistance facing input coupling capacitor resistance (Ohm)\n",
"f1=((2*math.pi*Rthi*Cin)**-1) #base bypass circuit cutoff frequency (Hz)\n",
"Rtho=RD+RL #Thevenin resistance facing output coupling capacitor resistance (Ohm)\n",
"f2=((2*math.pi*Rtho*Cout)**-1) #base bypass circuit cutoff frequency (Hz)\n",
"\n",
- "#Result\n",
"print 'base bypass circuit cutoff frequency f1 = ',round(f1,2),'Hz'\n",
"print 'collector bypass circuit cutoff frequency f2 = ',round(f2,2),'Hz'"
],
@@ -983,12 +876,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 16.22.py\n",
- "#In figure 16-32, capacitances are: Ciss=60 pF, Coss=25 pF, Crss=5 pF.\n",
- "#gm=97mS then find high frequency cut off values for gate & drain circuits.\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Ciss=60 #Capacitance Ciss (pF)\n",
"Coss=25 #Capacitance Coss (pF)\n",
"Crss=5 #Capacitance Crss (pF)\n",
@@ -999,7 +888,6 @@
"RD=150 #resiatance(Ohm)\n",
"RL=1*10**3 #load resiatance(Ohm)\n",
"\n",
- "#Calculation\n",
"Cgd=Crss #Internal Capacitance Cgd (pF)\n",
"Cgs=Ciss-Crss #Internal Capacitance Cgs (pF)\n",
"Cds=Coss-Crss #Internal Capacitance Cds (pF)\n",
@@ -1013,7 +901,6 @@
"C1=Cds+Cout_M #drain bypass capacitance(pF)\n",
"f21=((2*math.pi*rd*C1*10**-12)**-1) #drain bypass cutoff frequency (Hz)\n",
"\n",
- "#Result\n",
"print 'Gate bypass cutoff frequency = ',round(f2*10**-6,2),'MHz'\n",
"print 'Drain bypass cutoff frequency = ',round(f21*10**-6,2),'MHz'"
],
diff --git a/Electronic_Principles_/Chapter_17_New.ipynb b/Electronic_Principles_/Chapter_17_New.ipynb
index 3de7e129..a6647813 100644
--- a/Electronic_Principles_/Chapter_17_New.ipynb
+++ b/Electronic_Principles_/Chapter_17_New.ipynb
@@ -27,18 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.1.py\n",
- "#What are the ideal currents & voltages in figure 17-6a?\n",
"\n",
- "#Variable declaration\n",
"VCC=15 #supply voltage(V)\n",
"RE=7.5 #Emitter resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"IT=VCC/RE #tail current (mA)\n",
"IE=IT/2 #emitter current (mA)\n",
"\n",
- "#Result\n",
"print 'tail current = ',IT,'mA'\n",
"print 'emitter current = ',IE,'mA'"
],
@@ -68,21 +63,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.2.py\n",
- "#Recalculate the currents and voltages for figure 17-6a using second approximation.\n",
"\n",
- "#Variable declaration\n",
"VCC=15 #supply voltage(V)\n",
"RE=7.5 #Emitter resistance(KOhm)\n",
"VBE=0.7 #base-emitter voltage(V)\n",
"RC=5 #collector resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"IT=(VCC-VBE)/RE #tail current (mA)\n",
"IE=IT/2 #emitter current (mA)\n",
"VC=VCC-(IE*RC) #collector quiescent voltage(V) \n",
"\n",
- "#Result\n",
"print 'tail current = ',round(IT,2),'mA'\n",
"print 'emitter current = ',round(IE,2),'mA'\n",
"print 'collector quiescent voltage VC = ',round(VC,2),'V'"
@@ -114,24 +104,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.3.py\n",
- "#What are the ideal currents & voltages in figure 17-7a?\n",
"\n",
- "#Variable declaration\n",
"VCC=12.0 #supply voltage(V)\n",
"RE=5.0 #Emitter resistance(KOhm)\n",
"RC=3.0 #collector resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"IT=VCC/RE #tail current (mA)\n",
"IE=IT/2 #emitter current (mA)\n",
"VC=VCC-(IE*RC) #collector quiescent voltage(V) \n",
- "#with second approximation,\n",
"IT1=(VCC-VBE)/RE #tail current (mA)\n",
"IE1=IT1/2 #emitter current (mA)\n",
"VC1=VCC-(IE1*RC) #collector quiescent voltage(V) \n",
"\n",
- "#Result\n",
"print 'tail current = ',IT,'mA'\n",
"print 'emitter current = ',IE,'mA'\n",
"print 'collector quiescent voltage VC = ',VC,'V'\n",
@@ -171,10 +155,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.4.py\n",
- "#In figure 17-11, what is the ac output voltage? If B = 300, what is input impedance?\n",
"\n",
- "#Variable declaration\n",
"VCC=12.0 #supply voltage(V)\n",
"RE=7.5 #Emitter resistance(KOhm)\n",
"RC=5.0 #collector resistance(KOhm)\n",
@@ -182,13 +163,11 @@
"Vin=1 #input ac voltage(mV)\n",
"B=300 #current gain\n",
"\n",
- "#Calculation\n",
"re=25/IE #ac emitter resistance(Ohm)\n",
"Av=1000*RC/re #voltage gain\n",
"Vout=Av*Vin #Output voltage(mV)\n",
"Zinb=2*B*re #input impedance of diff amp(Ohm)\n",
"\n",
- "#Result\n",
"print 'voltage gain Av = ',Av\n",
"print 'Output voltage Vout = ',Vout,'mV'\n",
"print 'input impedance of diff amplifier, Zin(base) = ',Zinb/1000,'KOhm'"
@@ -220,10 +199,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.5.py\n",
- "#Repeat preceding example using second approximation to calculate ICQ.\n",
"\n",
- "#Variable declaration\n",
"VCC=12.0 #supply voltage(V)\n",
"RE=7.5 #Emitter resistance(KOhm)\n",
"RC=5.0 #collector resistance(KOhm)\n",
@@ -231,13 +207,11 @@
"Vin=1 #input ac voltage(mV)\n",
"B=300 #current gain\n",
"\n",
- "#Calculation\n",
"re=25/IE #ac emitter resistance(Ohm)\n",
"Av=1000*RC/re #voltage gain\n",
"Vout=Av*Vin #Output voltage(mV)\n",
"Zinb=2*B*re #input impedance of diff amp(Ohm)\n",
"\n",
- "#Result\n",
"print 'voltage gain Av = ',Av\n",
"print 'Output voltage Vout = ',Vout,'mV'\n",
"print 'input impedance of diff amplifier, Zin(base) = ',round((Zinb/1000),2),'KOhm'"
@@ -269,10 +243,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.6.py\n",
- "#Repeat example 17-4 for v2=1mV & v1=0.\n",
"\n",
- "#Variable declaration\n",
"VCC=12.0 #supply voltage(V)\n",
"RE=7.5 #Emitter resistance(KOhm)\n",
"RC=5.0 #collector resistance(KOhm)\n",
@@ -280,13 +251,11 @@
"V2=1 #input ac voltage(mV)\n",
"B=300 #current gain\n",
"\n",
- "#Calculation\n",
"re=25/IE #ac emitter resistance(Ohm)\n",
"Av=1000*RC/re #voltage gain\n",
"Vout=Av*V2 #Output voltage(mV)\n",
"Zinb=2*B*re #input impedance of diff amp(Ohm)\n",
"\n",
- "#Result\n",
"print 'V2 input is at inverting input, So, ideally same as previous case.'\n",
"print 'Voltage gain Av = ',Av\n",
"print 'Output voltage Vout = ',Vout,'mV'\n",
@@ -320,10 +289,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.7.py\n",
- "#What is ac output voltage in figure 17-12? if B=300, what is input impedance?\n",
"\n",
- "#Variable declaration\n",
"VCC=15.0 #supply voltage(V)\n",
"RC=1.0**10**6 #collector resistance(Ohm)\n",
"RE=1.0**10**6 #emitter resistance(Ohm)\n",
@@ -331,7 +297,6 @@
"Vin=7 #input ac voltage(mV)\n",
"B=300 #current gain\n",
"\n",
- "#Calculation\n",
"IT=VCC/RE #tail current (uA)\n",
"IE=IT/2 #emitter current (uA)\n",
"re=25/IE/1000 #ac emitter resistance(Ohm)\n",
@@ -339,7 +304,6 @@
"Vout=Av*Vin #Output voltage(V)\n",
"Zinb=2*B*re #input impedance of diff amp(MOhm)\n",
"\n",
- "#Result\n",
"print 'Voltage gain Av = ',Av\n",
"print 'Output voltage Vout = ',Vout/1000,'V'\n",
"print 'input impedance of diff amplifier, Zin(base) = ',Zinb,'MOhm'"
@@ -371,11 +335,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.8.py\n",
- "#The diff amp of figure 17-17 has Av=200, Iin(bias)=3uA, Iin(off) =0.5 uA. and Vin(off)= 1mV. What is output error voltage?\n",
- "#what is output error voltage?\n",
"\n",
- "#Variable declaration\n",
"VCC=15.0 #supply voltage(V)\n",
"RC=5.0*10**3 #collector resistance(Ohm)\n",
"RE=7.5*10**3 #emitter resistance(Ohm)\n",
@@ -386,18 +346,15 @@
"Iino =0.5*10**-6 #Iin(off) (A) \n",
"Vino=1.0 #Vin(off) (mV)\n",
"\n",
- "#Calculation\n",
"V1err=RB*Iinb*1000 #dc error input1 (mV)\n",
"V2err=RB*(Iino/2)*1000 #dc error input2 (mV)\n",
"V3err=Vino #dc error input3 (mV)\n",
"Verror=Av*(V1err+V2err+V3err) #output error voltage(mV)\n",
- "#if matching base resistor is used,\n",
"V1err1=0 #dc error input1 (mV)\n",
"V2err1=RB*Iino*1000 #dc error input2 (mV)\n",
"V3err1=Vino #dc error input3 (mV)\n",
"Verror1=Av*(V1err1+V2err1+V3err1) #output error voltage(mV)\n",
"\n",
- "#Result\n",
"print 'output error voltage Verror = ',Verror,'mV'\n",
"print 'output error voltage Verror = ',Verror1,'mV'"
],
@@ -427,10 +384,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.9.py\n",
- "#The diff amp of figure 17-18 has Av=300, Iin(bias)=80nA, Iin(off) =20 nA. and Vin(off)= 5mV. What is output error voltage?\n",
"\n",
- "#Variable declaration\n",
"VCC=15.0 #supply voltage(V)\n",
"RC=1.0*10**6 #collector resistance(Ohm)\n",
"RE=1.0*10**6 #emitter resistance(Ohm)\n",
@@ -441,13 +395,11 @@
"Iino=20*10**-9 #Iin(off) (A) \n",
"Vino=5.0 #Vin(off) (mV)\n",
"\n",
- "#Calculation\n",
"V1err=0 #dc error input1 (mV)\n",
"V2err=RB*(Iino/2)*1000 #dc error input2 (mV)\n",
"V3err=Vino #dc error input3 (mV)\n",
"Verror=Av*(V1err+V2err+V3err) #output error voltage(mV)\n",
"\n",
- "#Result\n",
"print 'output error voltage Verror = ',Verror/1000,'V'"
],
"language": "python",
@@ -475,20 +427,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.10.py\n",
- "#In figure 17-2, what is common-node voltage gain & output voltage?\n",
"\n",
- "#Variable declaration\n",
"VCC=15.0 #supply voltage(V)\n",
"RC=1.0*10**6 #collector resistance(Ohm)\n",
"RE=1.0*10**6 #emitter resistance(Ohm)\n",
"Vin=1 #input ac voltage(mV)\n",
"\n",
- "#Calculation\n",
"Av_CM=RC/(2*RE) #common mode voltage gain\n",
"Vout=Av_CM*Vin #output voltage(mV) \n",
"\n",
- "#Result \n",
"print 'common mode voltage gain : Av(CM) = ',Av_CM\n",
"print 'Output voltage Vout = ',Vout,'mV'"
],
@@ -518,21 +465,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.11.py\n",
- "#In figure 17-22 has Av=150, Av(CM)=0.5, Vin =1 mV. \n",
- "#If base leads are picking up a common-mode signal of 1mV, what is the output voltage?\n",
"\n",
- "#Variable declaration\n",
"Vin=1 #input ac voltage(mV)\n",
"Av=150 #voltage gain\n",
"Av_CM=0.5 #common mode voltage gain\n",
"\n",
- "#Calculation\n",
"Vout1=Av*Vin #output voltage1(mV)\n",
"Vout2=Av_CM*Vin #output voltage2(mV)\n",
"Vout=Vout1+Vout2 #output volatge(mV)\n",
"\n",
- "#Result\n",
"print 'output voltage Vout1 = ',Vout1,'mV'\n",
"print 'output voltage Vout2 = ',Vout2,'mV'\n",
"print 'output voltage Vout = ',Vout,'mV'"
@@ -564,22 +505,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.12.py\n",
- "#OP-AMP with Av=2,00,000 & CMRR(dB)=90dB. what is the common mode voltage gain? \n",
- "#If desired & common-mode signal is of 1uV, what is the output voltage?\n",
"\n",
- "#Variable declaration\n",
"CMRR_dB=90 #CMRR(dB)\n",
"Av=200000 #voltage gain\n",
"Vin=1*10**-6 #input voltage(V)\n",
"\n",
- "#Calculation\n",
"CMRR=10**(CMRR_dB/20.0) #CMRR \n",
"Av_CM=Av/CMRR #common mode voltage gain \n",
"Vout1=Av*Vin #desired output: voltage1(V)\n",
"Vout2=Av_CM*Vin #common mode output: voltage2(V)\n",
"\n",
- "#Result\n",
"print 'output voltage Vout1 = ',Vout1,'V'\n",
"print 'output voltage Vout2 = ',round((Vout2*10**6),2),'uV'\n",
"print 'see, desired output is much larger than common mode output.'"
@@ -611,10 +546,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.13.py\n",
- "#What is load voltage in figure 17-32a when RL=15KOhm?\n",
"\n",
- "#Variable declaration\n",
"VCC=15.0 #supply voltage(V)\n",
"RC=7.5*10**3 #collector resistance(Ohm)\n",
"RE=7.5*10**3 #emitter resistance(Ohm)\n",
@@ -622,13 +554,11 @@
"re=25 #as per example 17-4 (Ohm) \n",
"RL=15*10**3 #load resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"Av=RC/re #voltage gain\n",
"Vout=Av*V1/1000 #output voltage(V) \n",
"RTH=2*RC #Thevenin resistance(Ohm)\n",
"VL=(RL/(RL+RTH))*Vout #load voltage(V)\n",
"\n",
- "#Result \n",
"print 'Load voltage VL = ',VL,'V'"
],
"language": "python",
@@ -656,17 +586,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 17.14.py\n",
- "#An ammeter is used for load resistance. find current through the ammeter?\n",
"\n",
- "#Variable declaration\n",
"RL=15.0 #load resistance as per previous example(Ohm)\n",
"VL=3 #load voltage as per previous example(V)\n",
"\n",
- "#Calculation\n",
"iL=VL/RL #load current(mA)\n",
"\n",
- "#Result\n",
"print 'Load current iL = ',iL,'mA'"
],
"language": "python",
diff --git a/Electronic_Principles_/Chapter_18_New.ipynb b/Electronic_Principles_/Chapter_18_New.ipynb
index 1fbf3765..a06bb044 100644
--- a/Electronic_Principles_/Chapter_18_New.ipynb
+++ b/Electronic_Principles_/Chapter_18_New.ipynb
@@ -27,17 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.1.py\n",
- "#How much inverting input voltage required to drive the 741C of figure 18-11a into negative saturation?\n",
"\n",
- "#Variable declaration\n",
"Vout=13.5 #As per figure 18-7b(V)\n",
"Aov=100000 #open loop voltage gain\n",
"\n",
- "#Calculation\n",
"V2=Vout/Aov #required input voltage(V)\n",
"\n",
- "#Result\n",
"print 'Required input voltage V2 = ',V2*10**6,'uV'"
],
"language": "python",
@@ -65,16 +60,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.2.py\n",
- "#What is the CMRR of a 741C when the input frequency is 100KHz?\n",
"\n",
- "#Variable declaration\n",
"CMRR_dB=40 #As per figure 18-7a at 100KHz(dB)\n",
"\n",
- "#Calculation\n",
"CMRR=10**(CMRR_dB/20)\n",
"\n",
- "#Result\n",
"print 'Common-mode rejection ratio = ',CMRR"
],
"language": "python",
@@ -102,16 +92,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.3.py\n",
- "#what is the open loop voltage gain of 741C when input frequency is 1KHz? 10KHZ? 100KHz?\n",
"\n",
- "#Variable declaration / Calculation\n",
"\n",
"Av1=1000 #Voltage gain as per figure 18-7c for 1KHZ\n",
"Av10=100 #Voltage gain as per figure 18-7c for 10KHZ\n",
"Av100=10 #Voltage gain as per figure 18-7c for 100KHZ\n",
"\n",
- "#Result\n",
"print 'Voltage gain for 1KHZ = ',Av1\n",
"print 'Voltage gain for 1KHZ = ',Av10\n",
"print 'Voltage gain for 1KHZ = ',Av100"
@@ -143,17 +129,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.4.py\n",
- "#the output changes to 0.25 V in 0.1us. What is te slew rate of the op amp?\n",
"\n",
- "#Variable declaration\n",
"Vout=0.25 #output changes in 0.1us (V)\n",
"t=0.1 #time for output change(us) \n",
"\n",
- "#Calculation\n",
"SR=Vout/t #slew rate(V/us)\n",
"\n",
- "#Result\n",
"print 'Slew rate SR = ',SR,'V/us'"
],
"language": "python",
@@ -181,17 +162,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.5.py\n",
- "#The LF411A has a slew ratwe of 15 V/us. what is power bandwidth for peak output voltage of 10V?\n",
"import math\n",
- "#Variable declaration\n",
"SR=15 #slew rate(V/us)\n",
"Vp=10 #Peak output voltage(V)\n",
"\n",
- "#Calculation\n",
"fmax=1000*SR/(2*math.pi*Vp) #power bandwidth (KHz) \n",
"\n",
- "#Result\n",
"print 'Power bandwidth = ',round(fmax),'KHz'"
],
"language": "python",
@@ -219,23 +195,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.6.py\n",
- "#What is the power bandwidth for each of following?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"SR1=0.5 #Slew rate1(V/us)\n",
"SR2=5 #Slew rate2(V/us)\n",
"SR3=50 #Slew rate3(V/us)\n",
"Vp=8 #peak voltage(V)\n",
"\n",
- "#Calculation\n",
"fmax1=1000*SR1/(2*math.pi*Vp) #power bandwidth1 (KHz) \n",
"fmax2=1000*SR2/(2*math.pi*Vp) #power bandwidth2 (KHz) \n",
"fmax3=SR3/(2*3*math.pi*Vp) #power bandwidth3 (MHz) \n",
"\n",
- "#Result\n",
"print 'Power bandwidth1 = ',math.ceil(fmax1),'KHz'\n",
"print 'Power bandwidth2 = ',math.ceil(fmax2),'KHz'\n",
"print 'Power bandwidth3 = ',math.ceil(fmax3),'MHz'"
@@ -267,22 +238,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.7.py\n",
- "#What are closed-loop voltage gain and bandwidth? what is output voltage at 1KHz & 1MHz?\n",
"\n",
- "#Variable declaration\n",
"Vin=10 #input voltage(mV)\n",
"Rf=75 #feedback path resistance Rf (KOhm)\n",
"R1=1.5 #inverting input resistance R1(KOhm)\n",
"Funity=1 #Funity (MHz)\n",
"\n",
- "#Calculation\n",
"Av_CL=-Rf/R1 #closed loop voltage gain\n",
"f2_CL1=Funity/-Av_CL #closed loop bandwidth1(KHz)\n",
"Vout1=Av_CL*Vin #output voltage1(mV)\n",
"Vout2=-Vin #output voltage2(mV)\n",
"\n",
- "#Result\n",
"print 'Output voltage for 1KHz = ',Vout1,'mVpp'\n",
"print 'Output voltage for 1MHz = ',Vout2,'mVpp'"
],
@@ -312,10 +278,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.8.py\n",
- "#What is output voltage in figure 18-17 when Vin=0?\n",
"\n",
- "#Variable declaration\n",
"Vin=10 #input voltage(mV)\n",
"Rf=75 #feedback path resistance Rf (KOhm)\n",
"R1=1.5 #inverting input resistance R1(KOhm)\n",
@@ -325,14 +288,12 @@
"Av=50 #voltage gain \n",
"RB1=0 #resistance at noninverting input(KOhm) \n",
"\n",
- "#Calculation\n",
"RB2=R1*Rf/(Rf+R1) #thevenin resistance at inverting input(KOhm) \n",
"V1err=(RB1-RB2)*Iinb*10**6 #dc error input1 (mV)\n",
"V2err=(RB1+RB2)*(Iino/2)*10**6 #dc error input2 (mV)\n",
"V3err=Vino #dc error input3 (mV)\n",
"Verror=Av*(abs(V1err)+V2err+V3err) #output error voltage(mV)\n",
"\n",
- "#Result\n",
"print 'output error voltage Verror = ',round(Verror,2),'mV'"
],
"language": "python",
@@ -360,11 +321,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.9.py\n",
- "#Iin(bias)=500nA, Iin(off) =200 nA. and Vin(off)= 6mV. \n",
- "#Calculate output voltage for Vin=0.\n",
"\n",
- "#Variable declaration\n",
"Vin=10 #input voltage(mV)\n",
"Rf=75 #feedback path resistance Rf (KOhm)\n",
"R1=1.5 #inverting input resistance R1(KOhm)\n",
@@ -374,14 +331,12 @@
"Av=50 #voltage gain \n",
"RB1=0 #resistance at noninverting input(KOhm) \n",
"\n",
- "#Calculation\n",
"RB2=R1*Rf/(Rf+R1) #thevenin resistance at inverting input(KOhm) \n",
"V1err=(RB1-RB2)*Iinb*10**6 #dc error input1 (mV)\n",
"V2err=(RB1+RB2)*(Iino/2)*10**6 #dc error input2 (mV)\n",
"V3err=Vino #dc error input3 (mV)\n",
"Verror=Av*(abs(V1err)+V2err+V3err) #output error voltage(mV)\n",
"\n",
- "#Result\n",
"print 'output error voltage Verror = ',round(Verror,2),'mV'"
],
"language": "python",
@@ -409,24 +364,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.10.py\n",
- "#In figure 18-22a, What is closed-loop voltage gain, bandwidth and output voltage at 250KHz?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Vin=50 #input voltage(mV)\n",
"Rf=3.9*10**3 #feedback path resistance Rf (Ohm)\n",
"R1=100 #inverting input resistance R1(Ohm)\n",
"Funity=1*10**6 #Funity (Hz)\n",
"\n",
- "#Calculation\n",
"Av_CL=1+(Rf/R1) #closed loop voltage gain\n",
"f2_CL1=Funity/Av_CL #closed loop bandwidth1(KHz)\n",
"Av_CL1=math.ceil(10**(12/20.0)) #Av for 12 dB at 250 KHz \n",
"Vout=Av_CL1*Vin #output voltage(mV)\n",
"\n",
- "#Result\n",
"print 'Output voltage for 250KHz = ',Vout,'mVpp'"
],
"language": "python",
@@ -454,11 +404,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.11.py\n",
- "#Iin(bias)=500nA, Iin(off) =200 nA. and Vin(off)= 6mV. \n",
- "#What is the output voltage?\n",
"\n",
- "#Variable declaration\n",
"Vin=10 #input voltage(mV)\n",
"Rf=3.9*10**3 #feedback path resistance Rf (Ohm)\n",
"R1=100 #inverting input resistance R1(Ohm)\n",
@@ -468,14 +414,12 @@
"Av=40 #voltage gain \n",
"RB1=0 #resistance at noninverting input(KOhm) \n",
"\n",
- "#Calculation\n",
"RB2=R1*Rf/(Rf+R1) #thevenin resistance at inverting input(KOhm) \n",
"V1err=(RB1-RB2)*Iinb #dc error input1 (mV)\n",
"V2err=(RB1+RB2)*(Iino/2) #dc error input2 (mV)\n",
"V3err=Vino #dc error input3 (mV)\n",
"Verror=Av*(abs(V1err)+V2err+V3err) #output error voltage(mV)\n",
"\n",
- "#Result\n",
"print 'output error voltage Verror = ',Verror*1000,'mV'"
],
"language": "python",
@@ -503,10 +447,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.12.py\n",
- "#Three audio signals drive the summing amplifier of figure 18-25. What is the ac output voltage?\n",
"\n",
- "#Variable declaration\n",
"Vin1=100*10**-3 #input voltage1(V)\n",
"Vin2=200*10**-3 #input voltage2(V)\n",
"Vin3=300*10**-3 #input voltage3(V)\n",
@@ -515,14 +456,12 @@
"R2=10.0 #inverting input resistance R2(KOhm)\n",
"R3=50.0 #inverting input resistance R3(KOhm)\n",
"\n",
- "#Calculation\n",
"Av1_CL=-Rf/R1 #closed loop voltage gain\n",
"Av2_CL=-Rf/R1 #closed loop voltage gain\n",
"Av3_CL=-Rf/R1 #closed loop voltage gain\n",
"Vout=Av1_CL*Vin1+Av2_CL*Vin2+Av3_CL*Vin3 #output voltage1(mV)\n",
"RB2=(R1**-1+R2**-1+R3**-1+Rf**-1)**-1 #thevenin resistance at inverting input(KOhm) \n",
"\n",
- "#Result\n",
"print 'Output voltage = ',Vout,'Vpp'\n",
"print 'thevenin resistance at inverting input RB2 = ',round(RB2,2),'KOhm'"
],
@@ -552,20 +491,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.13.py\n",
- "#An ac voltage source of 10 mVpp with an internal resistance of 100 KOhm drives voltage follower. \n",
- "#RL is 1 Ohm. Find output voltage & bandwidth.\n",
"\n",
- "#Variable declaration\n",
"Vin=10 #ac voltage source (mVpp)\n",
"Av=1 #voltage gain\n",
"Funity=1 #unity frequency (MHz) \n",
"\n",
- "#Calculation\n",
"Vout=Av*Vin #output voltage(V) \n",
"f2_CL=Funity #bandwidth(MHz) \n",
"\n",
- "#Result \n",
"print 'Output voltage = ',Vout,'mVpp'\n",
"print 'Bandwidth f2(CL) = ',f2_CL,'MHz'"
],
@@ -595,20 +528,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 18.14.py\n",
- "#In voltage follower of figure 18-26a, the output voltage across the 1 Ohm load is 9.99 mV. \n",
- "#calculate closed loop output impedance.\n",
"\n",
- "#Variable declaration\n",
"RL=1.0 #load resistance(Ohm)\n",
"Vout=9.99 #load voltage(mV)\n",
"Vz=0.01 #voltage across Zout(CL) (mV)\n",
"\n",
- "#Calculation\n",
"iout=Vout/RL #load current(mA)\n",
"Zout_CL=Vz/iout #output impedance(Ohm)\n",
"\n",
- "#Result\n",
"print 'Load current iout = ',iout,'mA'\n",
"print 'closed loop output impedance Zout(CL) = ',round(Zout_CL,3),'Ohm'"
],
diff --git a/Electronic_Principles_/Chapter_19_New.ipynb b/Electronic_Principles_/Chapter_19_New.ipynb
index 6edb4ee9..2cb36ac1 100644
--- a/Electronic_Principles_/Chapter_19_New.ipynb
+++ b/Electronic_Principles_/Chapter_19_New.ipynb
@@ -27,24 +27,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.1.py\n",
- "#Calculate feedback fraction, the ideal closed-loop voltage gain, the percent error & exact closed loop voltage gain. \n",
- "#AVOL= 100,000 for 741C. \n",
"\n",
- "#Variable declaration\n",
"Vin=50 #input voltage(mV)\n",
"Rf=3.9 #feedback path resistance Rf (KOhm)\n",
"R1=0.1 #inverting input resistance R1(KOhm)\n",
"AVOL=100000 #open loop voltage gain\n",
"\n",
- "#Calculation\n",
"B=R1/(Rf+R1) #feedback fraction\n",
"Av=B**-1 #closed loop voltage gain\n",
"Err=100/(1+AVOL*B) #percent error (%)\n",
"Av1=Av-((Av/100)*Err) #closed loop voltage gain1\n",
"Av2=AVOL/(1+AVOL*B) #closed loop voltage gain2\n",
"\n",
- "#Result\n",
"print 'closed loop voltage gain by approach 1 = ',round(Av1,2)\n",
"print 'closed loop voltage gain by approach 2 = ',round(Av2,2)"
],
@@ -74,10 +68,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.2.py\n",
- "#741C has an Rin of 2MOhm and an RCM of 200MOhm. What is closed loop input impedance?\n",
"\n",
- "#Variable declaration\n",
"Vin=50 #input voltage(mV)\n",
"Rf=3.9*10**3 #feedback path resistance Rf (Ohm)\n",
"R1=100 #inverting input resistance R1(Ohm)\n",
@@ -86,12 +77,9 @@
"Rin=2*10**6 #open loop input resistance(Ohm)\n",
"RCM=200*10**6 #common mode input resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"Zin_CL=(1+(AVOL*B))*Rin #closed loop input impedance(Ohm)\n",
- "#for answer>100MOHM use equation 19-8\n",
"Zin_CL1=RCM*Zin_CL/(RCM+Zin_CL) #closed loop input impedance(Ohm)\n",
"\n",
- "#Result\n",
"print 'closed loop input impedance Zin(CL) = ',round((Zin_CL1/10**6),2),'MOhm'"
],
"language": "python",
@@ -119,19 +107,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.3.py\n",
- "#calculate the closed loop output impedance in figure 19-6.\n",
- "#AVOL of 100,000 and Rout of 75 Ohm.\n",
"\n",
- "#Variable declaration \n",
"Rout=75 #open loop output resistance(Ohm)\n",
"AVOL=100000 #open loop voltage gain\n",
"B=0.025 #feedback fraction\n",
"\n",
- "#Calculation\n",
"Zout_CL=Rout/(1+AVOL*B) #closed loop input impedance(Ohm)\n",
"\n",
- "#Result\n",
"print 'closed loop output impedance Zout(CL) = ',round(Zout_CL,2),'Ohm'"
],
"language": "python",
@@ -159,19 +141,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.4.py\n",
- "#Amplifier has an open loop total harmonic distortion of 7.5%. \n",
- "#what is the closed loop total harmonic distribution?\n",
"\n",
- "#Variable declaration\n",
"THD=7.5 #open loop total harmonic distortion (%)\n",
"AVOL=100000 #open loop voltage gain\n",
"B=0.025 #feedback fraction\n",
"\n",
- "#Calculation\n",
"THD_CL=THD/(1+AVOL*B) #closed loop total harmonic distortion (%)\n",
"\n",
- "#Result\n",
"print 'Closed loop total harmonic distortion THD(CL) = ',round(THD_CL,3),'%'"
],
"language": "python",
@@ -199,17 +175,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.5.py\n",
- "#In figure 19-9, what is output voltage for input frequency 1 KHz?\n",
"\n",
- "#Variable declaration\n",
"Iin=1 #input current(mA)\n",
"Rf=5 #feedback path resistance Rf (KOhm)\n",
"\n",
- "#Calculation\n",
"Vout=-(Iin*Rf) #Output voltage at 1KHz (Vpp) \n",
"\n",
- "#Result\n",
"print 'Output ac voltage at 1KHz Vout = ',Vout,'Vpp'"
],
"language": "python",
@@ -237,19 +208,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.6.py\n",
- "#What are the closed loop input & output impedances in figure 19-9?\n",
"\n",
- "#Variable declaration \n",
"Rout=75.0 #open loop output resistance(Ohm)\n",
"AVOL=100000 #open loop voltage gain\n",
"Rf=5.0*10**3 #feedback path resistance(Ohm)\n",
"\n",
- "#Calculation \n",
"Zin_CL=Rf/(1+AVOL) #closed loop input impedance(Ohm)\n",
"Zout_CL=Rout/(1+AVOL) #closed loop input impedance(Ohm)\n",
"\n",
- "#Result\n",
"print 'closed loop input impedance Zin(CL) = ',round(Zin_CL,2),'Ohm'\n",
"print 'closed loop output impedance Zout(CL) = ',round(Zout_CL,5),'Ohm'"
],
@@ -279,21 +245,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.7.py\n",
- "#what is IL & PL ? What happens if RL = 4 Ohm?\n",
"\n",
- "#Variable declaration\n",
"Vin=2 #input voltage(Vrms)\n",
"RL1=2 #load resistance (KOhm)\n",
"R1=1 #inverting input resistance R1(KOhm)\n",
"RL2=4 #load resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"iout=Vin/R1 #output current (mA)\n",
"PL1=(iout**2)*RL1 #load power for 2 Ohm (W) \n",
"PL2=(iout**2)*RL2 #load power for 4 Ohm (W) \n",
"\n",
- "#Result\n",
"print 'load power for 2 Ohm = ',PL1,'W'\n",
"print 'load power for 4 Ohm = ',PL2,'W'"
],
@@ -323,25 +284,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.8.py\n",
- "#what is IL & PL? What happens if RL = 2 Ohm?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Iin=1.5*10**-3 #input current(mA)\n",
"RL1=1 #load resistance (KOhm)\n",
"R1=1 #inverting input resistance R1(KOhm)\n",
"RL2=2 #load resistance (KOhm)\n",
"Rf=1*10**3 #feedback path resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"Ai=math.ceil(1+(Rf/R1)) #current gain\n",
"iout=Iin*Ai #output current (mA)\n",
"PL1=(iout**2)*RL1 #load power for 1 Ohm (W) \n",
"PL2=(iout**2)*RL2 #load power for 2 Ohm (W) \n",
"\n",
- "#Result\n",
"print 'load power for 2 Ohm = ',round(PL1,2),'W'\n",
"print 'load power for 4 Ohm = ',round(PL2,2),'W'"
],
@@ -371,17 +327,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.9.py\n",
- "#LF411A with (1+AvolB)=1000 and f2(OL)=160 Hz, what is closed loop bandwidth?\n",
"\n",
- "#Variable declaration\n",
"AB=1000 #(1+AvolB) term \n",
"f2_OL=160 #open loop bandwidth(Hz)\n",
"\n",
- "#Calculation\n",
"f2_CL=f2_OL*AB/1000 #closed loop bandwidth(KHz)\n",
"\n",
- "#Result\n",
"print 'closed loop bandwidth f2(CL)= ',f2_CL,'KHZ'"
],
"language": "python",
@@ -409,19 +360,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.10.py\n",
- "#LF308 with AVOL=250,000 and f2(OL)=1.2 Hz, \n",
- "#what is closed loop bandwidth for Av(CL)=50?\n",
"\n",
- "#Variable declaration\n",
"AVOL=250000 #open loop voltage gain\n",
"f2_OL=1.2 #open loop bandwidth(Hz)\n",
"Av_CL=50 #closed loop voltage gain\n",
"\n",
- "#Calculation\n",
"f2_CL=f2_OL*AVOL/Av_CL/1000 #closed loop bandwidth(KHz)\n",
"\n",
- "#Result\n",
"print 'closed loop bandwidth for Av(CL) = 50, f2(CL)= ',f2_CL,'KHZ'"
],
"language": "python",
@@ -449,17 +394,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.11.py\n",
- "#LM12 with AVOL =50000 and f2(OL)=14 Hz, what is closed loop bandwidth?\n",
"\n",
- "#Variable declaration\n",
"AVOL=50000 #open loop voltage gain\n",
"f2_OL=14 #open loop bandwidth(Hz)\n",
"\n",
- "#Calculation\n",
"f2_CL=f2_OL*(1+AVOL)/1000 #closed loop bandwidth(KHz)\n",
"\n",
- "#Result\n",
"print 'closed loop bandwidth f2(CL)= ',f2_CL,'KHZ'"
],
"language": "python",
@@ -487,17 +427,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.12.py\n",
- "#OP-07A with (1+AvolB)=2500 and f2(OL)=20 Hz, what is closed loop bandwidth?\n",
"\n",
- "#Variable declaration\n",
"AB=2500 #(1+AvolB) term \n",
"f2_OL=20 #open loop bandwidth(Hz)\n",
"\n",
- "#Calculation\n",
"f2_CL=f2_OL*AB/1000 #closed loop bandwidth(KHz)\n",
"\n",
- "#Result\n",
"print 'closed loop bandwidth f2(CL)= ',f2_CL,'KHZ'"
],
"language": "python",
@@ -525,22 +460,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 19.13.py\n",
- "#LM741C with Funity 1MHz, Sr=0.5 V/us. \n",
- "#Av(CL) =10. Find closed loop bandwidth & largest peak output voltage at f2(CL)?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Av_CL=10.0 #voltage gain\n",
"Funity=1*10**6 #unity frequency (Hz) \n",
"Sr=0.5 #slew rate (V/us)\n",
"\n",
- "#Calculation\n",
"f2_CL=Funity/Av_CL/1000 #closed loop bandwidth(KHz)\n",
"Vp_max=1000*Sr/(2*math.pi*f2_CL) #largest peak output voltage(V)\n",
"\n",
- "#Result \n",
"print 'closed loop bandwidth f2(CL)= ',f2_CL,'KHZ'\n",
"print 'largest peak output voltage Vp(max)= ',round(Vp_max,3),'V'"
],
diff --git a/Electronic_Principles_/Chapter_1_New.ipynb b/Electronic_Principles_/Chapter_1_New.ipynb
index e0a4b799..5245d442 100644
--- a/Electronic_Principles_/Chapter_1_New.ipynb
+++ b/Electronic_Principles_/Chapter_1_New.ipynb
@@ -27,16 +27,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.1.py\n",
- "#Ac voltage source has Rs 50 ohms. For what load resistance is the source stiff?\n",
"\n",
- "#Variable declaration\n",
"Rs=50 #source resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"RL=100*Rs/1000 #Minimum Load resistance(KOhm)\n",
"\n",
- "#Result\n",
"print 'Minimum Load resistance =',RL,'KOhm'"
],
"language": "python",
@@ -64,17 +59,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.2.py\n",
- "#Current source of 2 mA has Rs of 10Mohm. Over what range of load resistance is the current source stiff?\n",
"\n",
- "#Variable declaration\n",
"Is=0.002 #Current source(A)\n",
"Rs=10000000 #internal resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"Rl_Max=0.01*Rs/1000 #Maximum load resistance(KOhm)\n",
"\n",
- "#Result\n",
"print 'With 100:1 Rule, Maximum Load resistance =',Rl_Max,'KOhm'\n",
"print 'Stiff range for current source is load resistance from 0 KOhm to',Rl_Max,'KOhm'"
],
@@ -104,17 +94,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.3.py\n",
- "#If a transistor is pumping 2 mA through RL of 10KOhm then find load voltage.\n",
"\n",
- "#Variable declaration\n",
"Il=0.002 #current source(A)\n",
"Rl=10000 #load resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"Vl=Il*Rl #load voltage(V)\n",
"\n",
- "#Result\n",
"print 'Load Voltage =',Vl,'V'"
],
"language": "python",
@@ -142,24 +127,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.4.py\n",
- "#What are the Thevenin voltage & resistance in Fig. 1-9a?\n",
"\n",
"print 'As per figure 1-9a, Calculate Thevenin resistor by opening load resistor'\n",
"\n",
- "#Variable declaration\n",
"Vs=72 #source voltage\n",
"R1=6 #Resistance (KOhm)\n",
"R2=3 #Resistance (KOhm)\n",
"R3=4 #Resistance (KOhm)\n",
"\n",
- "#Calculation\n",
"Ro=R1+R2 #Resistance (KOhm)\n",
"I=Vs/Ro\n",
"Vab=R2*Vs/(R1+R2) #Thevenin voltage(V)\n",
"Rth=((R1*R2)/(R1+R2))+R3 #Thevenin Resistance(KOhm)\n",
"\n",
- "#Result\n",
"print 'After removing Rl current flowing through 6KOhm is',I,'mA'\n",
"print 'Thevenin Voltage Vth =',Vab,'V'\n",
"print 'Calculating Thevenin Resistance with considering R1 & R2 in parallel'\n",
@@ -194,10 +174,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.5.py\n",
- "#In circuit shown in figure 1-11a, measure thevenin voltage and resistance.\n",
"\n",
- "#Variable declaration\n",
"Vs=72 #source voltage\n",
"R1=2 #resistance1 (KOhm)\n",
"R2=2 #resistance1 (KOhm)\n",
@@ -208,12 +185,9 @@
"R7=0.5 #resistance1 (KOhm)\n",
"RL=1 #load resistance (KOhm)\n",
"\n",
- "#Calculation\n",
- "#from multimeter following values will be measured.\n",
"Vth=9 #Thevenin voltage(V)\n",
"Rth=1.5 #Thevenin resistance(KOhm)\n",
"\n",
- "#Result\n",
"print 'Thevenin Voltage Vth =',Vth,'V'\n",
"print 'Thevenin Resistance =',Rth,'KOhm'"
],
@@ -243,18 +217,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.6.py\n",
- "#Convert thevenin circuit of figure 1-14a into norton circuit.\n",
"\n",
- "#Variable declaration\n",
"Vs=10 #source voltage\n",
"Rs=2 #series source resistance (KOhm)\n",
"\n",
- "#Calculation\n",
"IN=Vs/Rs #Norton current(mA)\n",
"Rp=Rs #parallel source resistance(KOhm)\n",
"\n",
- "#Result\n",
"print 'Norton current IN =',IN,'mA'\n",
"print 'Norton Resistance =',Rp,'KOhm'"
],
diff --git a/Electronic_Principles_/Chapter_20_New.ipynb b/Electronic_Principles_/Chapter_20_New.ipynb
index 1b58e3b8..1bf81dd2 100644
--- a/Electronic_Principles_/Chapter_20_New.ipynb
+++ b/Electronic_Principles_/Chapter_20_New.ipynb
@@ -27,19 +27,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.1.py\n",
- "#In figure 20-6, R1=100KOhm, Rf=100KOhm, R2=1KOhm, what is the voltage gain when JFET is On & off?\n",
"\n",
- "#Variable declaration\n",
"Rf=100.0 #feedback path resistance Rf (KOhm)\n",
"R1=100.0 #inverting input resistance R1(KOhm)\n",
"R2=1.0 #inverting input & drain resistance R2(KOhm)\n",
"\n",
- "#Calculation\n",
"Av1=(Rf/(R1**-1+R2**-1)**-1)+1 #maximum voltage gain\n",
"Av2=(Rf/R1)+1 #minimum voltage gain\n",
"\n",
- "#Result\n",
"print 'maximum voltage gain = ',Av1\n",
"print 'minimum voltage gain = ',Av2"
],
@@ -69,18 +64,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.2.py\n",
- "#In figure 20-10. R1=1.2KOhm, R2=91KOhm, what are the max & min Av?\n",
"\n",
- "#Variable declaration\n",
"R1=1.2 #inverting input resistance R1(KOhm)\n",
"R2=91.0 #feedback resistance R2(KOhm)\n",
"\n",
- "#Calculation\n",
"Av1=-R2/R1 #maximum voltage gain\n",
"Av2=0 #minimum voltage gain\n",
"\n",
- "#Result\n",
"print 'maximum voltage gain = ',round(Av1,2)\n",
"print 'minimum voltage gain = ',Av2"
],
@@ -110,18 +100,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.3.py\n",
- "#If R=1.5KOhm, nR=7.5KOhm in figure 20-10, what is the maximum positive voltage gain & other fixed resistance?\n",
"\n",
- "#Variable declaration\n",
"R=1.5 #inverting input resistance R1(KOhm)\n",
"nR=7.5 #feedback resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"n=nR/R #max. limit of voltage gain \n",
"rf=nR/(n-1) #fixed resistor (KOhm)\n",
"\n",
- "#Result\n",
"print 'maximum positive voltage gain = ',n\n",
"print 'other fixed resistor = ',rf,'KOhm'"
],
@@ -151,11 +136,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.4.py\n",
- "#In figure 20-18 R1=1KOhm, R2=100KOhm, R=10KOhm. what is differential voltage gain & common mode voltage gain? \n",
- "#resistance tolerance is 0.01% ,Vin=10mV, Vin(CM)=20V, what are the values of differential & common mode output signals?\n",
"\n",
- "#Variable declaration\n",
"R1=1.0 #inverting input resistance R1(KOhm)\n",
"R2=100.0 #feedback resistance R2(KOhm)\n",
"R=10.0 #resistor of opamp in seconnd stage(KOhm)\n",
@@ -163,13 +144,11 @@
"Vin_CM=10 #common mode input voltage(V)\n",
"T=0.0001 #tolerance of resistor \n",
"\n",
- "#Calculation\n",
"Av=(R2/R1)+1 #preamp voltage gain\n",
"Av_CM=2*T #common mode voltage gain of 2nd stage\n",
"Vout=-Av*Vin #output siganl voltage(V)\n",
"Vout_CM=Av_CM*Vin_CM #output siganl voltage for common mode signal(V)\n",
"\n",
- "#Result\n",
"print 'output siganl voltage for common mode signal Vout(CM) = ',Vout_CM,'V'\n",
"print 'output siganl voltage Vout = ',Vout,'V'"
],
@@ -199,10 +178,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.5.py\n",
- "#In figure 20-22, R1=1KOhm, R2=2KOhm, R3=3KOhm, R4=4KOhm, R5=5KOhm ,Rf=6KOhm. what is voltage gain of each channel?\n",
"\n",
- "#Variable declaration\n",
"Rf=6.0 #feedback path resistance Rf (KOhm)\n",
"R1=1.0 #inverting input resistance R1(KOhm)\n",
"R2=2.0 #inverting input resistance R2(KOhm)\n",
@@ -210,13 +186,11 @@
"R4=4.0 #non-inverting input resistance R4(KOhm)\n",
"R5=5.0 #non-inverting input resistance R5(KOhm)\n",
"\n",
- "#Calculation\n",
"Av1=(-Rf/R1) #voltage gain1\n",
"Av2=(-Rf/R2) #voltage gain2\n",
"Av3=(1+(Rf/((R1**-1+R2**-1)**-1)))*(((R4**-1+R5**-1)**-1)/(R3+((R4**-1+R5**-1)**-1))) #voltage gain3\n",
"Av4=(1+(Rf/((R1**-1+R2**-1)**-1)))*(((R3**-1+R5**-1)**-1)/(R4+((R3**-1+R5**-1)**-1))) #voltage gain4\n",
"\n",
- "#Result\n",
"print 'Voltage gain channel-1 Av1 = ',Av1\n",
"print 'Voltage gain channel-2 Av2 = ',Av2\n",
"print 'Voltage gain channel-3 Av3 = ',round(Av3,2)\n",
@@ -250,11 +224,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.6.py\n",
- "#In figure 20-25, D0=1,D1=0,D2=0, and D3=1. using Vref =5V, \n",
- "#determine decimal equivalent of BIN and output voltage of converter.\n",
"\n",
- "#Variable declaration \n",
"D0=1 #digital input0 (binary)\n",
"D1=0 #digital input1 (binary)\n",
"D2=0 #digital input2 (binary)\n",
@@ -262,11 +232,9 @@
"Vref=5 #reference voltage(V)\n",
"N=4 #no. of inputs\n",
"\n",
- "#Calculation \n",
"BIN=(D0*2**0)+(D1*2**1)+(D2*2**2)+(D3*2**3) #decimal equivalent BIN\n",
"Vout=-((2*Vref*BIN)/2.0**N) #output voltage of converter(V)\n",
"\n",
- "#Result\n",
"print 'decimal equivalent BIN = ',BIN\n",
"print 'output voltage of converter Vout = ',Vout,'V'"
],
@@ -296,25 +264,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.7.py\n",
- "#In figure 20-27, R1=1KOhm, R2=51 KOhm, what is voltage gain & closed loop output impedance? \n",
- "#what is shorted load current of circuit if each transistor has B = 125?\n",
"\n",
- "#Variable declaration\n",
"R2=51 #feedback path resistance (KOhm)\n",
"R1=1 #inverting input resistance R1(KOhm)\n",
"Bdc=125 #current gain\n",
"Zout=75 #open loop output impedance(Ohm)\n",
"AVOL=100000 #741C voltage gain\n",
"\n",
- "#Calculation\n",
"Av=-R2/R1 #closed loop voltage gain\n",
"B=R1/(R1+R2) #feedback fraction\n",
"Zout_CL=Zout/(1+(AVOL*B)) #closed loop output impedance(Ohm)\n",
"Isc=25.0/1000 #shorted current for 741C op-amp(A)\n",
"Imax=Bdc*Isc #maximum load current(A)\n",
"\n",
- "#Result\n",
"print 'closed loop output impedance Zout(CL) = ',Zout_CL,'Ohm'\n",
"print 'maximum load current Imax = ',Imax,'A'"
],
@@ -344,21 +306,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.8.py\n",
- "#if the current source of figure 20-28 has R=10KOhm, Vin =1 V, VCC=15V. what is output current? \n",
- "#what is maximum load resistance for vin = 10V?\n",
"\n",
- "#Variable declaration\n",
"Vin=1.0 #input voltage(V)\n",
"VCC=15 #supply voltage(V)\n",
"R=10 #inverting input resistance(KOhm)\n",
"Vin2=10.0 #larger input(V)\n",
"\n",
- "#Calculation\n",
"iout=Vin/R #output current(mA)\n",
"RL_max=R*(VCC/Vin2-1) #Maximum load resistance(KOhm) \n",
"\n",
- "#Result\n",
"print 'Output current iout = ',iout,'mA'\n",
"print 'Maximum load resistance RL(max) = ',RL_max,'KOhm'"
],
@@ -388,21 +344,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.9.py\n",
- "#figure 20-31 has R=15KOhm, Vin =3 V, VCC=15V. what is output current? \n",
- "#what is maximum load resistance for maximum Vin = 9V?\n",
"\n",
- "#Variable declaration\n",
"Vin=3.0 #input voltage(V)\n",
"VCC=15 #supply voltage(V)\n",
"R=15 #inverting input resistance(KOhm)\n",
"Vin2=12.0 #larger input(V)\n",
"\n",
- "#Calculation\n",
"iout=-Vin/R #output current(mA)\n",
"RL_max=(R/2.0)*(VCC/Vin2-1) #Maximum load resistance(KOhm) \n",
"\n",
- "#Result\n",
"print 'Output current iout = ',iout,'mA'\n",
"print 'Maximum load resistance RL(max) = ',RL_max,'KOhm'"
],
@@ -432,21 +382,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 20.10.py\n",
- "#If rds varies from 50 Ohm to 120 KOhm in figure 20-32, what is the maximum & minimum voltage gain?\n",
"\n",
- "#Variable declaration\n",
"R2=47 #feedback path resistance (KOhm)\n",
"R1=1.0 #inverting input resistance R1(KOhm)\n",
"R3=100 #non-inverting input resistance R3(KOhm)\n",
"rds1=0.050 #ohmic resistance of JFET (KOhm)\n",
"rds2=120.0 #ohmic resistance of JFET (KOhm)\n",
"\n",
- "#Calculation\n",
"Av1=((R2/R1)+1)*(rds1/(rds1+R3)) #minimum voltage gain\n",
"Av2=((R2/R1)+1)*(rds2/(rds2+R3)) #maximum voltage gain\n",
"\n",
- "#Result\n",
"print 'Maximum voltage gain Av = ',round(Av2,2)\n",
"print 'Minimum voltage gain Av = ',round(Av1,3)"
],
diff --git a/Electronic_Principles_/Chapter_21_New.ipynb b/Electronic_Principles_/Chapter_21_New.ipynb
index 23c2ea5f..93fb24ec 100644
--- a/Electronic_Principles_/Chapter_21_New.ipynb
+++ b/Electronic_Principles_/Chapter_21_New.ipynb
@@ -27,22 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.1.py\n",
- "#what is the voltage gain, cutoff frequency & the frequency response?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Rf=39.0 #feedback path resistance Rf (KOhm)\n",
"R1=1.0 #inverting input resistance R1(KOhm)\n",
"R2=12.0*10**3 #non-inverting input resistance R2(Ohm)\n",
"C=680*10**-12 #capacitance at non-inverting input(F)\n",
"\n",
- "#Calculation\n",
"Av=(Rf/R1)+1 # voltage gain\n",
"fc=(2*math.pi*R2*C)**-1 #cutoff frequency(Hz)\n",
"\n",
- "#Result\n",
"print 'voltage gain Av = ',Av\n",
"print 'cutoff frequency fc = ',round((fc/1000),2),'KHz'\n",
"print 'frequency response:'\n",
@@ -76,20 +71,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.2.py\n",
- "#what is the voltage gain, cutoff frequency & frequency response?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Rf=43.0 #feedback path resistance Rf (KOhm)\n",
"R1=0.220 #non-inverting input resistance R1(KOhm)\n",
"C=100*10**-12 #capacitance (F)\n",
"\n",
- "#Calculation\n",
"Av=(-Rf/R1) # voltage gain\n",
"fc=((2*math.pi*Rf*C)**-1)/10**6 #cutoff frequency(KHz)\n",
"\n",
- "#Result\n",
"print 'voltage gain Av = ',round(Av,2)\n",
"print 'cutoff frequency fc = ',round(fc,2),'KHz'\n",
"print 'voltage gain is 45.8 dB in pass band. response breaks at 37 KHz.'"
@@ -121,22 +111,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.3.py\n",
- "#what are pole frequency, Q and cutoff frequency?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=30 #non-inverting input resistance R1(KOhm)\n",
"R2=30 #non-inverting input resistance R2(KOhm)\n",
"C2=1.64*10**-9 #feedback path capacitance (F)\n",
"C1=820*10**-12 #non-inverting input capacitance (F)\n",
"\n",
- "#Calculation\n",
"Q=0.5*((C2/C1)**0.5) #Q\n",
"fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
"fc=fp #cutoff frequency(KHz)\n",
"\n",
- "#Result\n",
"print ' Q = ',round(Q,3)\n",
"print 'pole frequency fp = ',round(fp,2),'KHz'\n",
"print 'cutoff frequency fc = fp, ',round(fc,2),'KHz'"
@@ -168,23 +153,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.4.py\n",
- "#In figure 21-28, what are pole frequency, Q & cutoff frequency?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=51 #non-inverting input resistance R1(KOhm)\n",
"R2=51 #non-inverting input resistance R2(KOhm)\n",
"C2=440*10**-12 #feedback path capacitance (F)\n",
"C1=330*10**-12 #non-inverting input capacitance (F)\n",
"kc=0.786 #constant for bessel response \n",
"\n",
- "#Calculation\n",
"Q=0.5*((C2/C1)**0.5) #Q\n",
"fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
"fc=kc*fp #cutoff frequency(KHz) \n",
"\n",
- "#Result\n",
"print ' Q = ',round(Q,2)\n",
"print 'pole frequency fp = ',round(fp,2),'KHz'\n",
"print 'cutoff frequency fc = ',round(fc,2),'KHz'"
@@ -216,12 +196,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.5.py\n",
- "#what are pole frequency and Q & cutoff and 3-dB frequencies?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=22 #non-inverting input resistance R1(KOhm)\n",
"R2=22 #non-inverting input resistance R2(KOhm)\n",
"C2=27*10**-9 #feedback path capacitance (F)\n",
@@ -230,13 +207,11 @@
"k0=0.99 #constant for bessel response\n",
"k3=1.54 #constant for bessel response\n",
"\n",
- "#Calculation\n",
"Q=0.5*((C2/C1)**0.5) #Q\n",
"fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
"fc=kc*fp #cutoff frequency(KHz) \n",
"f3=k3*fp #3-dB frequency(KHz)\n",
"\n",
- "#Result\n",
"print 'Q = ',round(Q,2)\n",
"print 'pole frequency fp = ',round(fp,2),'KHz'\n",
"print 'cutoff frequency fc = ',round(fc,2),'KHz'\n",
@@ -270,11 +245,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.6.py\n",
- "#what are pole frequency, Q & cutoff frequency?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=47 #non-inverting input resistance R1(KOhm)\n",
"R2=47 #non-inverting input resistance R2(KOhm)\n",
"C2=330*10**-12 #feedback path capacitance (F)\n",
@@ -282,13 +254,11 @@
"R3=51 #inverting input resistance R3(KOhm)\n",
"Rf=30.0 #feedback path resistance Rf (KOhm)\n",
"\n",
- "#Calculation\n",
"Av=(Rf/R3)+1 #voltage gain \n",
"Q=(3-Av)**-1 #Q\n",
"fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
"fc=fp #cutoff frequency(KHz) \n",
"\n",
- "#Result\n",
"print ' Q = ',round(Q,2)\n",
"print 'pole frequency fp = ',round(fp,2),'KHz'\n",
"print 'cutoff frequency fc = ',round(fc,2),'KHz'"
@@ -320,11 +290,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.7.py\n",
- "#In figure 21-33, what are pole frequency, Q & cutoff frequency?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=82 #non-inverting input resistance R1(KOhm)\n",
"R2=82 #non-inverting input resistance R2(KOhm)\n",
"C2=100*10**-12 #feedback path capacitance (F)\n",
@@ -333,13 +300,11 @@
"Rf=15.0 #feedback path resistance Rf (KOhm)\n",
"kc=0.786 #constant for bessel response \n",
"\n",
- "#Calculation\n",
"Av=(Rf/R3)+1 #voltage gain \n",
"Q=(3-Av)**-1 #Q\n",
"fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
"fc=kc*fp #cutoff frequency(KHz) \n",
"\n",
- "#Result\n",
"print 'Q = ',round(Q,2)\n",
"print 'pole frequency fp = ',round(fp,2),'KHz'\n",
"print 'cutoff frequency fc = ',round(fc,2),'KHz'"
@@ -371,11 +336,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.8.py\n",
- "#In figure 21-34, what are pole frequency, Q, cutoff,resosnant & 3-dB frequencies, ripple depth in decibles?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=56 #non-inverting input resistance R1(KOhm)\n",
"R2=56 #non-inverting input resistance R2(KOhm)\n",
"C2=220*10**-12 #feedback path capacitance (F)\n",
@@ -386,7 +348,6 @@
"k0=1.0 #constant for bessel response\n",
"k3=1.55 #constant for bessel response\n",
"\n",
- "#Calculation\n",
"Av=(Rf/R3)+1 #voltage gain \n",
"Q=(3-Av)**-1 #Q\n",
"fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
@@ -396,7 +357,6 @@
"Av1=((1.01*Rf)/(0.99*R3))+1 #voltage gain considering 1% tolerance \n",
"Q1=(3-Av1)**-1 #Q\n",
"\n",
- "#Result\n",
"print 'Q = ',Q\n",
"print 'pole frequency fp = ',round(fp,2),'KHz'\n",
"print 'cutoff frequency fc = ',round(fc,2),'KHz'\n",
@@ -436,22 +396,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.9.py\n",
- "#what are pole frequency, Q & cutoff frequency?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=24 #non-inverting input resistance R1(KOhm)\n",
"R2=12 #feedback path resistance R2(KOhm)\n",
"C=4.7*10**-9 #non-inverting input capacitance (F)\n",
"\n",
- "#Calculation\n",
"Q=0.5*((R1/R2)**0.5) #Q\n",
"fp=((2*math.pi*C*(R1*R2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
"fc=fp #cutoff frequency(KHz) \n",
"\n",
- "#Result\n",
"print 'Q = ',round(Q,2)\n",
"print 'pole frequency fp = ',math.ceil(fp),'KHz'\n",
"print 'cutoff frequency fc = ',math.ceil(fc),'KHz'"
@@ -483,11 +438,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.10.py\n",
- "#In figure 21-37, what are pole frequency, Q, cutoff,resosnant & 3-dB frequencies and ripple depth in decibles?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=30 #non-inverting input resistance R1(KOhm)\n",
"R2=30 #feedback path resistance R2(KOhm)\n",
"C=1*10**-9 #non-inverting input capacitance (F)\n",
@@ -497,7 +449,6 @@
"k0=0.94 #constant for bessel response\n",
"k3=1.48 #constant for bessel response\n",
"\n",
- "#Calculation\n",
"Av=(Rf/R3)+1 #voltage gain \n",
"Q=(3-Av)**-1 #Q\n",
"fp=((2*math.pi*R1*C)**-1)/10**6 #pole frequency(KHz)\n",
@@ -505,7 +456,6 @@
"f0=fp/k0 #resosnant frequency(KHz)\n",
"f3=fp/k3 #3-dB frequency (KHz)\n",
"\n",
- "#Result\n",
"print 'Q = ',Q\n",
"print 'pole frequency fp = ',round(fp,2),'KHz'\n",
"print 'cutoff frequency fc = ',round(fc,2),'KHz'\n",
@@ -543,23 +493,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.11.py\n",
- "#In figure 21-42, gate voltage varies from 15 to 80 Ohm. Find bandwidth and minimum & maximum frequencies.\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=18 #non-inverting input resistance R1(KOhm)\n",
"R2=30 #feedback path resistance R2(KOhm)\n",
"C=8.2*10**-9 #non-inverting input capacitance (F)\n",
"R31=0.080 #inverting max input resistance R3(KOhm)\n",
"R32=0.015 #inverting min input resistance R3(KOhm)\n",
"\n",
- "#Calculation\n",
"BW=((2*math.pi*R1*C)**-1)/10**6 #bandwidth(KHz)\n",
"f0=((2*math.pi*C*((2*R1*((R1**-1+R31**-1)**-1))**0.5))**-1)/10**6 #minimum center frequency(KHz)\n",
"f01=((2*math.pi*C*((2*R1*((R1**-1+R32**-1)**-1))**0.5))**-1)/10**6 #minimum center frequency(KHz)\n",
"\n",
- "#Result\n",
"print 'bandwidth BW = ',round(BW,2),'KHz'\n",
"print 'minimum center frequency f0 = ',round(f0,2),'KHz'\n",
"print 'maximum center frequency f0 = ',round(f01,2),'KHz'"
@@ -591,23 +536,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.12.py\n",
- "#In figure 21-43, what are the voltage gain, center frequency and Q for bandstop filter, \n",
- "#if R=22KOhm, C=120nF, R1=13KOhm, R2=10KOhm.\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R=22.0 #non-inverting input resistance(KOhm)\n",
"C=120*10**-9 #non-inverting input capacitance (F)\n",
"R1=13.0 #inverting input resistance(KOhm)\n",
"R2=10.0 #feedback path resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"Av=(R2/R1)+1 #voltage gain \n",
"Q=0.5/(2-Av) #Q\n",
"f0=((2*math.pi*R*C)**-1)/10**3 #center frequency(KHz)\n",
"\n",
- "#Result\n",
"print 'voltage gain Av = ',round(Av,2)\n",
"print 'Q = ',round(Q,2)\n",
"print 'center frequency f0 = ',round(f0,2),'KHz'"
@@ -639,21 +578,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 21.13.py\n",
- "#In figure 21-45b, R=1KOhm, C=100nF. what is phase shift of output voltage when f=1KHz?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R=1.0 #non-inverting input resistance(KOhm)\n",
"C=100*10**-9 #non-inverting input capacitance (F)\n",
"f=1.0 #frequency given(KHz)\n",
"\n",
- "#Calculation\n",
"f0=((2*math.pi*R*C)**-1)/10**6 #center frequency(KHz)\n",
"phi=(2*math.atan(f0/f))*180/math.pi #phase shift(deg)\n",
"\n",
- "#Result\n",
"print 'center frequency f0 = ',round(f0,2),'KHz'\n",
"print 'phase shift = ',math.ceil(phi),'degrees'"
],
diff --git a/Electronic_Principles_/Chapter_22_New.ipynb b/Electronic_Principles_/Chapter_22_New.ipynb
index 789ac110..ebbb0124 100644
--- a/Electronic_Principles_/Chapter_22_New.ipynb
+++ b/Electronic_Principles_/Chapter_22_New.ipynb
@@ -27,22 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.4.py\n",
- "#Input voltage is a sine wave with a peak value of 10V. what is the trip point & cutoff frequency of bypass circuit?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Vin=10 #ac input(V)\n",
"Vs=15 #non-inverting input voltage(V)\n",
"R1=200.0*10**3 #non-inverting input resistance R1(Ohm)\n",
"R2=100.0*10**3 #non-inverting input resistance R2(Ohm)\n",
"C=10*10**-6 #capacitance at non-inverting input(F)\n",
"\n",
- "#Calculation\n",
"Vref=Vs/3 #reference voltage at trip point(V)\n",
"fc=(2*math.pi*((R1**-1+R2**-1)**-1)*C)**-1 #cutoff frequency(Hz)\n",
"\n",
- "#Result\n",
"print 'trip point voltage Vref = ',Vref,'V'\n",
"print 'cutoff frequency of bypass circuit fc = ',round(fc,2),'Hz'"
],
@@ -72,22 +67,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.5.py\n",
- "#what is the duty cycle of output waveform in figure 22-15b?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Vp=10.0 #sine peak(V)\n",
"Vin=5.0 #input voltage(V) \n",
"\n",
- "#Calculation\n",
- "#1st solution\n",
"theta=math.ceil((math.asin(Vin/Vp))*180/math.pi) #angle theta (deg)\n",
- "#2nd solution\n",
"D=(150-theta)/360.0 #duty cycle\n",
"\n",
- "#Result\n",
"print 'theta = ',theta,'degrees'\n",
"print 'duty cycle D = ',round((D*100),2),'%'"
],
@@ -117,21 +105,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.6.py\n",
- "#If Vsat=13.5V, what are the trip points & hysteresis in figure 22-21?\n",
"\n",
- "#Variable declaration\n",
"R1=1.0 #non-inverting input resistance R1(KOhm)\n",
"R2=47.0 #feedback path resistance R2(KOhm)\n",
"Vsat=13.5 #saturation voltage(V)\n",
"\n",
- "#Calculation\n",
"B=R1/(R1+R2) #feedback fraction\n",
"UTP=B*Vsat #upper trip point\n",
"LTP=-B*Vsat #lower trip point\n",
"H=UTP-LTP #hysteresis\n",
"\n",
- "#Result\n",
"print 'lower trip point LTP = ',round(LTP,2),'V'\n",
"print 'upper trip point LTP = ',round(UTP,2),'V'\n",
"print 'hysteresis is ',round(H,2),'V'"
@@ -163,22 +146,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.7.py\n",
- "#what is the output voltage at end of input pulse & closed loop time constant of integrator? \n",
- "#open loop voltage gain of 100,000.\n",
"\n",
- "#Variable declaration\n",
"R=2 #inverting input resistance R1(KOhm)\n",
"C=1*10**-6 #feedback path capacitance (F)\n",
"T=1*10**-3 #time period(s)\n",
"Vin=8 #input pulse voltage(V)\n",
"AVOL=100000 #open loop voltage gain\n",
"\n",
- "#Calculation\n",
"V=Vin*T/(R*C)/1000 #output voltage(V)\n",
"t=R*C*(AVOL+1)*1000 #time constant(s)\n",
"\n",
- "#Result\n",
"print 'Magnitude of negative output voltage at end of the pulse = ',V,'V'\n",
"print 'closed loop time constant = ',t,'s'"
],
@@ -208,20 +185,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.5.py\n",
- "#what is the output voltage in figure 22-30 if the input frequency is 1 KHz?\n",
"\n",
- "#Variable declaration\n",
"R1=1*10**3 #inverting input resistance R1(Ohm)\n",
"R2=10*10**3 #feedback path resistance R2(Ohm)\n",
"C=10*10**-6 #feedback path capacitance (F)\n",
"Vin=5 #input pulse voltage(V)\n",
"f=1*10**3 #input frequency(Hz)\n",
"\n",
- "#Calculation\n",
"Vout=Vin/(2*f*R1*C) #output voltage(V)\n",
"\n",
- "#Result\n",
"print 'peak to peak output voltage = ',Vout,'Vpp'"
],
"language": "python",
@@ -249,24 +221,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.9.py\n",
- "#The variable resistance has a maximum value of 10 KOhm. \n",
- "#what is duty cyale when wiper is at middle of its range for traingular input frequency = 1KHz.\n",
"\n",
- "#Variable declaration\n",
"Vs=15.0 #non-inverting input voltage(V)\n",
"Rw=5.0*10**3 #inverting input wiper resistance(Ohm)\n",
"R1=10.0*10**3 #inverting input resistance R1(Ohm)\n",
"f=1.0 #input frequency(KHz) \n",
"\n",
- "#Calculation\n",
"Vref=Vs*(Rw/(Rw+R1)) #reference voltage(V)\n",
"T=1/f #period of signal(s)\n",
- "#As per geometry in 22-31b\n",
"W=2*(T/2)*((Vs/2)-Vref)/Vs #output pulse width\n",
"D=W/T #duty cycle\n",
"\n",
- "#Result\n",
"print 'duty cycle D = ',round((D*100),2),'%'"
],
"language": "python",
@@ -294,23 +259,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.10.py\n",
- "#In figure 22-34, what is the frequency of output signal?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=18.0 #non-inverting input resistance R1(KOhm)\n",
"R2=2.0 #feedback path resistance R2(KOhm)\n",
"R=1.0 #feedback path resistance R(KOhm)\n",
"C=0.1*10**-6 #feedback path capacitance (F)\n",
"\n",
- "#Calculation\n",
"B=R1/(R1+R2) #feedback fraction\n",
"T=10**9*2*R*C*math.log((1+B)/(1-B)) #period of output(us)\n",
"f=1000*1/T #frequency(KHz)\n",
"\n",
- "#Result\n",
"print 'period T = ',round(T,2),'us'\n",
"print 'frequency f = ',round(f,2),'KHz'"
],
@@ -340,20 +300,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.11.py\n",
- "#In figure 22-33 peak outout voltage is 13.5V. R4=10KOhm,C2=10uF,\n",
- "#what is the peak to peak value of triangular output wave?\n",
"\n",
- "#Variable declaration\n",
"Vsat=13.5 #saturation voltage given(V)\n",
"R4=10*10**3 #given resistance R4(Ohm)\n",
"C2=10*10**-6 #given capacitance C2(F)\n",
"T=589*10**-6 #period from preceding example(s)\n",
"\n",
- "#Calculation\n",
"Vout=Vsat*T/(2*R4*C2) #output voltage (V) \n",
"\n",
- "#Result\n",
"print 'Output voltage = ',round((Vout*1000),2),'mVpp'"
],
"language": "python",
@@ -381,22 +335,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.12.py\n",
- "#In figure 22-35a R1=1KOhm, R2=100KOhm, R3=10KOhm, R4=100KOhm and C=10uF.\n",
- "#what is peak to peak output if Vsat =13V? what is frequency of triangular wave?\n",
"\n",
- "#Variable declaration\n",
"R1=1*10**3 #resistance R1(Ohm)\n",
"R2=100*10**3 #resistance R2(Ohm)\n",
"R3=10*10**3 #resistance R3(Ohm)\n",
"C=10*10**-6 #capacitance (F)\n",
"\n",
- "#Calculation\n",
"UTP=Vsat*R1/R2 #UTP value (V)\n",
"Vout=2*UTP #output voltage/hysteresis (V)\n",
"f=R2/(4*R1*R3*C) #frequency(Hz)\n",
"\n",
- "#Result\n",
"print 'Vout = H = ',Vout,'V'\n",
"print 'frequency f = ',f,'Hz'"
],
diff --git a/Electronic_Principles_/Chapter_23_New.ipynb b/Electronic_Principles_/Chapter_23_New.ipynb
index a5d3197f..a842cb81 100644
--- a/Electronic_Principles_/Chapter_23_New.ipynb
+++ b/Electronic_Principles_/Chapter_23_New.ipynb
@@ -27,22 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.1.py\n",
- "#Calculate the minimum and maximum frequencies in figure 23-9.\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"R1=100.0*10**3 #non-inverting input resistance wiper R1(Ohm)\n",
"R2=1.0*10**3 #non-inverting input resistance R2(Ohm)\n",
"C=0.01*10**-6 #capacitance at non-inverting input(F)\n",
"\n",
- "#Calculation\n",
"R=R1+R2 #max. total resistance(Ohm)\n",
"fr1=(2*math.pi*R*C)**-1 #minimum frequency(Hz)\n",
"R=R2 #min. total resistance(Ohm)\n",
"fr2=(2*math.pi*R*C)**-1 #maximum frequency(Hz)\n",
"\n",
- "#Result\n",
"print 'minimum frequency fr = ',round(fr1,2),'Hz'\n",
"print 'maximum frequency fr = ',round((fr2/1000),2),'KHz'"
],
@@ -72,19 +67,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.2.py\n",
- "#if the lamp voltage is expressed in rms volts,what is the output voltage of oscillator?\n",
"\n",
- "#Variable declaration\n",
"Rf=2 #feedback resistance(KOhm)\n",
"Rl=1 #lamp resistance(KOhm)\n",
"Vl=2 #lamp voltage(V)\n",
"\n",
- "#Calculation\n",
"Il=Vl/Rl #lamp current(mA)\n",
"Vout=Il*(Rf+Rl) #output voltage of oscillator(V)\n",
"\n",
- "#Result\n",
"print 'Lamp current = ',Il,'mA'\n",
"print 'output voltage of oscillator = ',Vout,'Vrms'"
],
@@ -114,21 +104,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.3.py\n",
- "#What is frequency of oscillation, feedback fraction & voltage gain needed to start oscillating.\n",
"\n",
- "#Variable declaration\n",
"C1=0.001*10**-6 #capacitance in oscillator(F)\n",
"C2=0.01*10**-6 #capacitance in oscillator(F)\n",
"L=15*10**-6 #inductance(H)\n",
"\n",
- "#Calculation\n",
"C=C1*C2/(C1+C2) #equivalent capacitance(F)\n",
"fr=(2*math.pi*((L*C)**0.5))**-1 #oscillation frequency(Hz)\n",
"B=C1/C2 #feedback fraction\n",
"Av_min=C2/C1 #minimum voltage gain\n",
"\n",
- "#Result\n",
"print 'feedback fraction B = ',B\n",
"print 'oscillation frequency fr = ',round((fr*10**-6),2),'MHz'\n",
"print 'minimum voltage gain Av(min) = ',Av_min"
@@ -160,20 +145,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.4.py\n",
- "#50 pF is added in series with 15uH inductor. what is the frequency of oscillation?\n",
"\n",
- "#Variable declaration\n",
"C1=0.001*10**-6 #capacitance in oscillator(F)\n",
"C2=0.01*10**-6 #capacitance in oscillator(F)\n",
"C3=50.0*10**-12 #capacitance in oscillator(F)\n",
"L=15*10**-6 #inductance(H)\n",
"\n",
- "#Calculation\n",
"C=(C1**-1+C2**-1+C3**-1)**-1 #equivalent capacitance(F)\n",
"fr=(2*math.pi*((L*C)**0.5))**-1 #oscillation frequency(Hz)\n",
"\n",
- "#Result\n",
"print 'oscillation frequency fr = ',round((fr*10**-6),2),'MHz'"
],
"language": "python",
@@ -201,24 +181,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.5.py\n",
- "#A crystal has values L=3H, Cs=0.05pF, R=2KOhm,Cm=10pF.\n",
- "#what are the series and parallel resonant frequencies of the crystal?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Cs=0.05*10**-12 #series capacitance in oscillator(F)\n",
"Cm=10.0*10**-12 #capacitance in oscillator(F)\n",
"R=2.0*10**3 #resistance in oscillator(Ohm)\n",
"L=3 #inductance(H)\n",
"\n",
- "#Calculation\n",
"fs=(2*math.pi*((L*Cs)**0.5))**-1 #series resonant frequency(Hz)\n",
"Cp=Cs*Cm/(Cs+Cm) #equvalent parallel capacitance(F)\n",
"fp=(2*math.pi*((L*Cp)**0.5))**-1 #parallel resonant frequency(Hz)\n",
"\n",
- "#Result\n",
"print 'series resonant frequency fs = ',math.ceil(fs*10**-3),'KHz'\n",
"print 'parallel resonant frequency fp = ',math.ceil(fp*10**-3),'KHz'"
],
@@ -248,21 +222,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 22.9.py\n",
- "#VCC=12 V, R=33KOhm, C=0.47 uF. What is minimum trigger voltage that produces an output pulse?\n",
- "#what is maximum capacitor voltage & width of output pulse?\n",
"\n",
- "#Variable declaration\n",
"VCC=12.0 #given supply voltage(V)\n",
"R=33*10**3 #given resistance(Ohm)\n",
"C=0.47*10**-6 #given capacitance(F)\n",
"\n",
- "#Calculation\n",
"LTP=VCC/3 #trip point LTP (V)\n",
"UTP=2*LTP #trip point UTP (V)\n",
"W=1.1*R*C #pulse width of output(s)\n",
"\n",
- "#Result\n",
"print 'trigger voltage LTP = ',LTP,'V'\n",
"print 'trigger voltage UTP = ',UTP,'V'\n",
"print 'pulse width W = ',W*10**3,'ms'"
@@ -294,17 +262,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.7.py\n",
- "#what is the pulse width in figure 23-24 if R=10MOhm and C=470 uF?\n",
"\n",
- "#Variable declaration\n",
"R=10*10**6 #given resistance(Ohm)\n",
"C=470*10**-6 #given capacitance(F)\n",
"\n",
- "#Calculation\n",
"W=1.1*R*C #pulse width of output(s)\n",
"\n",
- "#Result\n",
"print 'pulse width W = ',W,'s = ',round((W/3600),2),'hours'"
],
"language": "python",
@@ -332,19 +295,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.8.py\n",
- "#R1=75KOhm, R2=30KOhm, C=47nF. what is frequency of the output signal & duty cycle?\n",
"\n",
- "#Variable declaration\n",
"R1=75.0*10**3 #given resistance1(Ohm)\n",
"R2=30.0*10**3 #given resistance2(Ohm)\n",
"C=47.0*10**-9 #given capacitance(F)\n",
"\n",
- "#Calculation\n",
"f=1.44/((R1+(2*R2))*C) #frequency (Hz)\n",
"D=(R1+R2)/(R1+(2*R2)) #duty cycle \n",
"\n",
- "#Result\n",
"print 'frequency f = ',round(f,2),'Hz' \n",
"print 'duty cycle D = ',round((D*100),2),'%'"
],
@@ -374,12 +332,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.9.py\n",
- "#what are the frequency & duty cycle when Vcon is 11V & 1V?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"VCC=12.0 #given supply voltage(V)\n",
"R1=75.0*10**3 #given resistance1(Ohm)\n",
"R2=30.0*10**3 #given resistance2(Ohm)\n",
@@ -387,19 +342,15 @@
"Vcon1=11 #given Vcon(V) \n",
"Vcon2=1 #given Vcon(V) \n",
"\n",
- "#Calculation\n",
- "#for Vcon=11V\n",
"W1=-(R1+R2)*C*(math.log((VCC-Vcon1)/(VCC-(0.5*Vcon1)))) #pulse width(s)\n",
"T1=W1+(0.693*R2*C) #period(s)\n",
"D1=W1/T1 #duty cycle\n",
"f1=1/T1 #frequency(Hz)\n",
- "#for Vcon=11V\n",
"W2=-(R1+R2)*C*(math.log((VCC-Vcon2)/(VCC-(0.5*Vcon2)))) #pulse width(s)\n",
"T2=W2+(0.693*R2*C) #period(s)\n",
"D2=W2/T2 #duty cycle\n",
"f2=1/T2 #frequency(Hz)\n",
"\n",
- "#Result\n",
"print 'For Vcon = 11V,'\n",
"print 'frequency f = ',round(f1,2),'Hz'\n",
"print 'duty cycle D = ',round((D1*100),2),'%'\n",
@@ -437,19 +388,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.10.py\n",
- "#VCC=12V, R=9.1KOhm, C=0.01uF. clock frequency is 2.5KHz.\n",
- "#if modulating signal has peak value of 2V, what is the period of output pulses, quiescent pulse width,\n",
- "#minimum & maximum pulse widths & duty cycles?\n",
"\n",
- "#Variable declaration\n",
"VCC=12.0 #given supply voltage(V)\n",
"R=9.1*10**3 #given resistance(Ohm)\n",
"C=0.01*10**-6 #given capacitance(F)\n",
"f=2.5*10**3 #given frequency(Hz)\n",
"Vmod=2 #peak value of modulating signal(V) \n",
"\n",
- "#Calculation\n",
"T=1/f #period of output pulse(s)\n",
"W=1.1*R*C #pulse width(s)\n",
"UTP_max=(2*VCC/3)+Vmod #maximum UTP(V)\n",
@@ -459,7 +404,6 @@
"Dmin=Wmin/T #minimum duty cycle\n",
"Dmax=Wmax/T #maximum duty cycle\n",
"\n",
- "#Result\n",
"print 'period of output pulse T = ',T*10**6,'us'\n",
"print 'Quiscent pulse width W = ',W*10**6,'us'\n",
"print 'minimum UTP = ',UTP_min,'V'\n",
@@ -501,19 +445,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.11.py\n",
- "#VCC=12V, R1=3.9KOhm,R2=3KOhm, C=0.01uF.\n",
- "#if modulating signal has peak value of 1.5V, what is the period of output pulses, quiescent pulse width,\n",
- "#minimum & maximum pulse widths & space between pulses?\n",
"\n",
- "#Variable declaration\n",
"VCC=12.0 #given supply voltage(V)\n",
"R1=3.9*10**3 #given resistance(Ohm)\n",
"R2=3*10**3 #given resistance(Ohm)\n",
"C=0.01*10**-6 #given capacitance(F)\n",
"Vmod=1.5 #peak value of modulating signal(V) \n",
"\n",
- "#Calculation \n",
"W=0.693*(R1+R2)*C #pulse width(s)\n",
"T=0.693*(R1+(2*R2))*C #period of output pulse(s)\n",
"UTP_max=(2*VCC/3)+Vmod #maximum UTP(V)\n",
@@ -524,7 +462,6 @@
"Tmax=Wmax+(0.693*R2*C) #maximum period(s)\n",
"s=0.693*R2*C #space(s)\n",
"\n",
- "#Result\n",
"print 'period of output pulse T = ',T*10**6,'us'\n",
"print 'Quiscent pulse width W = ',W*10**6,'us'\n",
"print 'minimum UTP = ',UTP_min,'V'\n",
@@ -568,21 +505,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.12.py\n",
- "#A ramp generator of figure 23-43 has a constant collector current of 1mA. If VCC=15V, C=100nF. \n",
- "#what is slope of output ramp, its peak value & its duration?\n",
"\n",
- "#Variable declaration\n",
"VCC=15.0 #given supply voltage(V)\n",
"C=100*10**-9 #given capacitance(F)\n",
"Ic=1*10**-3 #collector current (A)\n",
"\n",
- "#Calculation \n",
"S=Ic/C #slope(V/s) \n",
"V=2*VCC/3 #peak value(V)\n",
"T=V/S #duration of ramp(s) \n",
"\n",
- "#Result\n",
"print 'slope is ',S/1000,'V/ms'\n",
"print 'Peak value V = ',V,'V'\n",
"print 'duration of ramp = ',T*10**3,'ms'"
@@ -614,17 +545,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.13.py\n",
- "#In figure 23-50, R=10KOhm,C=0.01uF with s1 closed, what are the output waveforms and frequency at pins 2 & 11?\n",
"\n",
- "#Variable declaration\n",
"R=10*10**3 #given resistance(Ohm)\n",
"C=0.01*10**-6 #given capacitance(F)\n",
"\n",
- "#Calculation \n",
"f0=(R*C)**-1 #output frequency(Hz)\n",
"\n",
- "#Result\n",
"print 'output frequency f0 = ',f0/1000,'KHz' "
],
"language": "python",
@@ -652,19 +578,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 23.14.py\n",
- "#In figure 23-51, R1=1KOhm,R2=2KOhm,C=0.1uF,Determine square wave output frequency & duty cycle.\n",
"\n",
- "#Variable declaration\n",
"R1=1.0*10**3 #given resistance(Ohm)\n",
"R2=2.0*10**3 #given resistance(Ohm)\n",
"C=0.1*10**-6 #given capacitance(F)\n",
"\n",
- "#Calculation \n",
"f=(2/C)*((R1+R2)**-1) #output frequency(Hz)\n",
"D=R1/(R1+R2) #duty cycle\n",
"\n",
- "#Result\n",
"print 'output frequency f = ',round((f/1000),2),'KHz' \n",
"print 'duty cycle = ',round((D*100),2),'%'"
],
diff --git a/Electronic_Principles_/Chapter_24_New.ipynb b/Electronic_Principles_/Chapter_24_New.ipynb
index 7b020fb6..ab177723 100644
--- a/Electronic_Principles_/Chapter_24_New.ipynb
+++ b/Electronic_Principles_/Chapter_24_New.ipynb
@@ -27,24 +27,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.1.py\n",
- "#Vin=15V, Rs=10 Ohm, Vz=9.1V, VBE=0.8V, RL=40 Ohm.\n",
- "#what are the value of Vout, Iin, IL, IC.\n",
"\n",
- "#Variable declaration\n",
"Rs=10 #given source resistance Rs(Ohm)\n",
"RL=40 #given load resistance RL(Ohm)\n",
"Vin=15 #input voltage(V)\n",
"VBE=0.8 #base-emitter voltage drop(V) \n",
"Vz=9.1 #voltage across diode(V)\n",
"\n",
- "#Calculation\n",
"Vout=Vz+VBE #output voltage(V) \n",
"Is=1000*(Vin-Vout)/Rs #input current(mA) \n",
"IL=1000*Vout/RL #load current(mA)\n",
"IC=Is-IL #collector current(mA)\n",
"\n",
- "#Result\n",
"print 'Output voltage Vout = ',Vout,'V'\n",
"print 'input current Is = ',Is,'mA'\n",
"print 'load current IL = ',IL,'mA'\n",
@@ -78,11 +72,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.2.py\n",
- "#Vin=15V, Rs=10 Ohm, Vz=6.2V, VBE=0.81V, RL=40 Ohm , R1=750 Ohm, R2=250 Ohm.\n",
- "#what are the value of Vout, Iin, IL, IC.\n",
"\n",
- "#Variable declaration\n",
"Rs=10 #given source resistance Rs(Ohm)\n",
"RL=40 #given load resistance RL(Ohm)\n",
"Vin=15 #input voltage(V)\n",
@@ -91,13 +81,11 @@
"R1=750 #base input resistance(Ohm)\n",
"R2=250 #base input resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"Vout=(Vz+VBE)*(R1+R2)/R1 #output voltage(V) \n",
"Is=1000*(Vin-Vout)/Rs #input current(mA) \n",
"IL=1000*Vout/RL #load current(mA)\n",
"IC=Is-IL #collector current(mA)\n",
"\n",
- "#Result\n",
"print 'Output voltage Vout = ',round(Vout,2),'V'\n",
"print 'input current Is = ',round(Is,2),'mA'\n",
"print 'load current IL = ',round(IL,2),'mA'\n",
@@ -131,24 +119,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.3.py\n",
- "#What is the approximate efficiency in the preceding example?\n",
- "#How much power does the regulator dissipate?\n",
"\n",
- "#Variable declaration\n",
- "#data from preceding example\n",
"Vout=9.35 #output voltage(V)\n",
"IL=234 #load current(mA)\n",
"Is=565 #input current(mA)\n",
"Vin=15.0 #input voltage(V)\n",
"\n",
- "#Calculation\n",
"Pout=Vout*IL/1000 #output power(W)\n",
"Pin=Vin*Is/1000 #input power(W)\n",
"eff=Pout/Pin #efficiency\n",
"preg=Pin-Pout #power dissipated by regulator(W)\n",
"\n",
- "#Result\n",
"print 'input power Pin = ',Pin,'W'\n",
"print 'Output power Pout = ',round(Pout,2),'W'\n",
"print 'Effifciency = ',round((eff*100),2),'%'\n",
@@ -182,11 +163,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.4.py\n",
- "#Vin=15V, Rs=10 Ohm, Vz=6.8V, RL=40 Ohm , R1=7.5 KOhm, R2=2.5 KOhm.\n",
- "#what are the value of Vout, Iin, IL, IC.\n",
"\n",
- "#Variable declaration\n",
"Rs=10 #given source resistance Rs(Ohm)\n",
"RL=40 #given load resistance RL(Ohm)\n",
"Vin=15 #input voltage(V)\n",
@@ -194,13 +171,11 @@
"R1=7.5*10**3 #base input resistance(Ohm)\n",
"R2=2.5*10**3 #base input resistance(Ohm)\n",
"\n",
- "#Calculation\n",
"Vout=Vz*(R1+R2)/R1 #output voltage(V) \n",
"Is=1000*(Vin-Vout)/Rs #input current(mA) \n",
"IL=1000*Vout/RL #load current(mA)\n",
"IC=Is-IL #collector current(mA)\n",
"\n",
- "#Result\n",
"print 'Output voltage Vout = ',round(Vout,2),'V'\n",
"print 'input current Is = ',round(Is,2),'mA'\n",
"print 'load current IL = ',round(IL,2),'mA'\n",
@@ -234,20 +209,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.5.py\n",
- "#Calculate maximum load currents for examples 24-1,2,4.\n",
"\n",
- "#Variable declaration\n",
"Is1=510 #input current in ex. 24-1 (mA)\n",
"Is2=565 #input current in ex. 24-2 (mA)\n",
"Is4=593 #input current in ex. 24-4 (mA)\n",
"\n",
- "#Calculation\n",
"Imax1=Is1 #maximum load current (mA) \n",
"Imax2=Is2 #maximum load current (mA) \n",
"Imax4=Is4 #maximum load current (mA) \n",
"\n",
- "#Result\n",
"print 'maximum load current Imax1 = ',Imax1,'mA'\n",
"print 'maximum load current Imax2 = ',Imax2,'mA'\n",
"print 'maximum load current Imax4 = ',Imax4,'mA'"
@@ -279,20 +249,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.6.py\n",
- "#VNL=9.91V, VFL=9.81V, VHL=9.94V, and VLL=9.79V. What is load regulation & line regulation?\n",
"\n",
- "#Variable declaration\n",
"VNL=9.91 #given VNL(V)\n",
"VFL=9.81 #given VFL(V)\n",
"VHL=9.94 #given VHL(V) \n",
"VLL=9.79 #given VLL(V)\n",
"\n",
- "#Calculation\n",
"LoR=(VNL-VFL)*100/VFL #Load regulation(%)\n",
"LiR=(VHL-VLL)*100/VLL #Line regulation(%)\n",
"\n",
- "#Result\n",
"print 'Load regulation = ',round(LoR,2),'%'\n",
"print 'Line regulation = ',round(LiR,2),'%'"
],
@@ -322,10 +287,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.7.py\n",
- "#Calculate approx. output voltage in figure 24-14, what is the power dissipation in pass transistor?\n",
"\n",
- "#Variable declaration\n",
"RL=40.0 #given load resistance RL(Ohm)\n",
"VBE=0.7 #base-emitter voltage drop(V) \n",
"Vz=6.2 #voltage across diode(V)\n",
@@ -333,12 +295,10 @@
"R2=1.0 #base input resistance(KOhm)\n",
"Vin=15 #input voltage(V)\n",
"\n",
- "#Calculation\n",
"Vout=(Vz+VBE)*(R1+R2)/R1 #output voltage(V)\n",
"IC=Vout/RL #transistor current(A)\n",
"PD=(Vin-Vout)*IC #power dissipation(W)\n",
"\n",
- "#Result\n",
"print 'Output voltage Vout = ',Vout,'V'\n",
"print 'transistor current = load current = IC = ',IC*1000,'mA'\n",
"print 'Power dissipation PD = ',PD,'W'"
@@ -377,22 +337,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.3.py\n",
- "#What is the approximate efficiency in the preceding example 24-7?\n",
"\n",
- "#Variable declaration\n",
- "#data from preceding example\n",
"Vout=9.2 #output voltage(V)\n",
"IL=230 #load current(mA)\n",
"Vin=15.0 #input voltage(V)\n",
"\n",
- "#Calculation\n",
"Pout=Vout*IL/1000 #output power(W)\n",
"Pin=Vin*IL/1000 #input power(W)\n",
"eff1=Pout/Pin #efficiency\n",
"eff2=Vout/Vin #efficiency\n",
"\n",
- "#Result\n",
"print 'input power Pin = ',Pin,'W'\n",
"print 'Output power Pout = ',Pout,'W'\n",
"print 'Effifciency 1= ',round((eff1*100),2),'%'\n",
@@ -426,10 +380,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.9.py\n",
- "#What is the approx. output voltage in figure 24-15,Why is a darlington transistor is used?\n",
"\n",
- "#Variable declaration\n",
"RL=4.0 #given load resistance RL(Ohm)\n",
"Vz=5.6 #voltage across diode(V)\n",
"R1=2.7 #base input resistance(KOhm)\n",
@@ -437,12 +388,10 @@
"Vin=15 #input voltage(V)\n",
"B=100 #current gain\n",
"\n",
- "#Calculation\n",
"Vout=Vz*(R1+R2)/R1 #output voltage(V)\n",
"IL=Vout/RL #load current(A)\n",
"IB=IL/B #base current(A)\n",
"\n",
- "#Result\n",
"print 'Output voltage Vout = ',round(Vout,2),'V'\n",
"print 'Load current IL = ',round(IL,2),'A'\n",
"print 'base current IB = ',round((IB*1000),2),'mA'"
@@ -474,20 +423,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.10.py\n",
- "#VNL=10.16V, VFL=10.15V, VHL=10.16V, and VLL=10.07V. What is load regulation & line regulation?\n",
"\n",
- "#Variable declaration\n",
"VNL=10.16 #given VNL(V)\n",
"VFL=10.15 #given VFL(V)\n",
"VHL=10.16 #given VHL(V) \n",
"VLL=10.07 #given VLL(V)\n",
"\n",
- "#Calculation\n",
"LoR=(VNL-VFL)*100/VFL #Load regulation(%)\n",
"LiR=(VHL-VLL)*100/VLL #Line regulation(%)\n",
"\n",
- "#Result\n",
"print 'Load regulation = ',round(LoR,3),'%'\n",
"print 'Line regulation = ',round(LiR,2),'%'"
],
@@ -517,11 +461,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.11.py\n",
- "#vin can vary from 17.5 to 22.5V, what is the maximum zener current, min & max regulated output voltages?\n",
- "#If regulated voltage is 12.5V, what is the load resistance where current limiting starts & approx. shorted-load current?\n",
"\n",
- "#Variable declaration\n",
"RL=3.0 #given load resistance RL(Ohm)\n",
"Vz=4.7 #voltage across diode(V)\n",
"R11=1750 #base input resistance with max. potentiometer(Ohm)\n",
@@ -534,7 +474,6 @@
"Vcs=0.7 #voltage across current sensing resistor(V)\n",
"Vo=12.5 #regulated voltage given(V)\n",
"\n",
- "#Calculation\n",
"Iz=(Vin-Vz)/Rs #max. zener current(A)\n",
"Vout1=Vz*(R11+R2)/R11 #min. regulated output voltage(V)\n",
"Vout2=Vz*(R12+R2)/R12 #max. regulated output voltage(V)\n",
@@ -542,7 +481,6 @@
"RL1=Vo/IL #load resistance(Ohm)\n",
"ISL=Vcs/RL #shorted-load current(A)\n",
"\n",
- "#Result\n",
"print 'maximum zener current Iz = ',round((Iz*1000),2),'mA'\n",
"print 'Load current IL = ',IL*1000,'mA'\n",
"print 'load resistance RL = ',RL1,'Ohm'\n",
@@ -576,10 +514,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.12.py\n",
- "#what is load current in figure 24-21? what is the output ripple?\n",
"\n",
- "#Variable declaration\n",
"Vout=12.0 #regulated output voltage(V)\n",
"RL=100.0 #given load resistance RL(Ohm)\n",
"\n",
@@ -587,13 +522,11 @@
"f=120 #frequency(Hz)\n",
"RR_dB=72.0 #ripple rejection(dB)\n",
"\n",
- "#Calculation \n",
"IL=Vout/RL #load current(A)\n",
"VRi=IL/(f*C) #peak to peak input ripple (V)\n",
"RR=10**(RR_dB/20) #ripple rejection\n",
"VRo=VRi/RR #peak to peak output ripple (V)\n",
"\n",
- "#Result\n",
"print 'Load current IL = ',IL*1000,'mA'\n",
"print 'peak to peak input ripple = ',VRi,'V'\n",
"print 'peak to peak output ripple = ',round((VRo*1000),2),'mV'"
@@ -625,19 +558,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.13.py\n",
- "#If R1=2KOhm, R2=22KOhm in figure 24-20, what is the output voltage? If R2 is increased to 46 KOhm. What is the output voltage?\n",
"\n",
- "#Variable declaration\n",
"R1=2.0 #given resistance(KOhm)\n",
"R2=22.0 #given resistance(KOhm)\n",
"R21=46.0 #given resistance increased(KOhm)\n",
"\n",
- "#Calculation\n",
"Vout1=1.25*(R1+R2)/R1 #output voltage(V)\n",
"Vout2=1.25*(R1+R21)/R1 #output voltage with increased R2(V)\n",
"\n",
- "#Result\n",
"print 'Output voltage Vout1 = ',Vout1,'V'\n",
"print 'output voltage with increased R2, Vout2 = ',Vout2,'V' "
],
@@ -667,21 +595,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.14.py\n",
- "#The LM7805 can regulate to specifications with input voltage between 7.5 & 20V.\n",
- "#what is the maximum & minimum efficiency? \n",
"\n",
- "#Variable declaration\n",
- "#data from preceding example\n",
"Vout=5.0 #output voltage(V)\n",
"Vin_min=7.5 #min. input voltage(V)\n",
"Vin_max=20.0 #max. input voltage(V)\n",
"\n",
- "#Calculation\n",
"eff_max=Vout/Vin_min #maximum efficiency\n",
"eff_min=Vout/Vin_max #minimum efficiency\n",
"\n",
- "#Result\n",
"print 'Minimum Effifciency = ',eff_min*100,'%'\n",
"print 'Maximum Effifciency = ',round((eff_max*100),2),'%'"
],
@@ -711,19 +632,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.15.py\n",
- "#R1=2.21 KOhm, R2=2.8 KOhm, what is the output voltage, minimum input voltage that can be used with the output voltage?\n",
"\n",
- "#Variable declaration\n",
"R1=2.21 #given resistance(KOhm)\n",
"R2=2.8 #given resistance(KOhm)\n",
"R21=46.0 #given resistance increased(KOhm)\n",
"VREF=2.21 #Reference voltage(V)\n",
"\n",
- "#Calculation\n",
"Vout=VREF*(R1+R2)/R1 #output voltage(V)\n",
"\n",
- "#Result\n",
"print 'Output voltage Vout = ',Vout,'V'\n",
"print 'Input voltage should be 2V greater than output voltage So, Vin = 7 V'"
],
@@ -753,18 +669,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 24.15.py\n",
- "#In buck-boost regulator of figure 24-32, If R1=1 KOhm, R2=5.79 KOhm, what is the output voltage? \n",
"\n",
- "#Variable declaration\n",
"R1=1 #given resistance(KOhm)\n",
"R2=5.79 #given resistance(KOhm)\n",
"VREF=2.21 #Reference voltage(V)\n",
"\n",
- "#Calculation\n",
"Vout=VREF*(R1+R2)/R1 #output voltage(V)\n",
"\n",
- "#Result\n",
"print 'Output voltage Vout = ',round(Vout,2),'V'"
],
"language": "python",
diff --git a/Electronic_Principles_/Chapter_2_New.ipynb b/Electronic_Principles_/Chapter_2_New.ipynb
index cf7eaae1..4404a233 100644
--- a/Electronic_Principles_/Chapter_2_New.ipynb
+++ b/Electronic_Principles_/Chapter_2_New.ipynb
@@ -27,23 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.5.py\n",
- "#A barrier potential of 0.7V at an ambient temperature of 25 deg C,\n",
- "#Find arrier potential of a silicon diode when the junction temperature is 100 deg C. At 0 deg C.\n",
"\n",
- "#Variable declaration\n",
"Tj=100 #junction temperature 1(C)\n",
"Vb=0.7 #Barrier potential(V)\n",
"Tamb=25 #Ambient temperature(C)\n",
"T1=0 #junction temperature 2(C)\n",
"\n",
- "#Calculation\n",
"Vd=-0.002*(Tj-Tamb) #Change in barrier potential(V)\n",
"Vbn=Vb+Vd #Barrier potential(V)\n",
"Vd1=-0.002*(T1-Tamb) #Change in barrier potential(V)\n",
"Vb1n=Vb+Vd1 #Barrier potential(V)\n",
"\n",
- "#Result\n",
"print 'Change in barrier potential = Vd =',Vd,'V'\n",
"print 'Brrier potential = Vbn =',Vbn,'V'\n",
"print 'For junction temperature 0 C'\n",
@@ -79,21 +73,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.6.py\n",
- "#A silicon diode has a saturation current of 5 nA at 25 deg C. What is the saturation current at 100 deg C?\n",
"\n",
"\n",
- "#Variable declaration\n",
"T2=100 #Temperature(C)\n",
"T1=25 #Temperature(C)\n",
"Isat1=5 #Current(nA)\n",
"\n",
- "#Calculation\n",
"Td=T2-T1 #Temperature change(C)\n",
"Is1=(2**7)*Isat1 #Current(nA)\n",
"Is2=(1.07**5)*Is1 #Current(nA)\n",
"\n",
- "#Result\n",
"print 'Change in temperature = Td = T2-T1 =',Td,'C'\n",
"print 'For first 70 C change seven doublings are there.'\n",
"print 'Is1 = (2^7)*Isat1 =',Is1,'nA'\n",
@@ -129,20 +118,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.7.py\n",
- "#surface-leakage current is 2nA for a reverse voltage of 25 V, \n",
- "#find surface leakage current for a reverse voltage of 35V.\n",
"\n",
- "#Variable declaration\n",
"Isl=2*(10**-9) #surface leakage current(nA)\n",
"Vr=25 #Reverse voltage(V)\n",
"Vr1=35 #Reverse voltage(V)\n",
"\n",
- "#Calculation\n",
"Rsl=Vr/Isl #surface leakage reistance(Ohm)\n",
"Isl1=(Vr1/Rsl)*(10**9) #surface leakage current(nA)\n",
"\n",
- "#Result\n",
"print 'surface-leakage reistance Rsl = Vr/Isl =',Rsl*10**-6,'MOhm'\n",
"print 'for Vr1 = 35 V,'\n",
"print 'surface-leakage reistance Isl1 = Vr1/Rsl =',Isl1,'nA'"
diff --git a/Electronic_Principles_/Chapter_3_New.ipynb b/Electronic_Principles_/Chapter_3_New.ipynb
index e2552e78..e4397d8b 100644
--- a/Electronic_Principles_/Chapter_3_New.ipynb
+++ b/Electronic_Principles_/Chapter_3_New.ipynb
@@ -27,19 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.2.py\n",
- "#A diode has a power rating of 5W. If diode voltage is 1.2V and diode current is 1.75A,\n",
- "#What is the power dissipation? Will the diode be destroyed?\n",
"\n",
- "#Variable declaration\n",
"Pr=5 #Power rating(W)\n",
"Vd=1.2 #diode voltage(V)\n",
"Id=1.75 #diode current(A)\n",
"\n",
- "#Calculation\n",
"PD=Vd*Id #Power dissipaion(W)\n",
"\n",
- "#Result\n",
"print 'Power Dissipation =',PD,'W'\n",
"print 'PD(',PD,'W) < ''Pr(',Pr,'W), So diode will not be destroyed.'"
],
@@ -69,19 +63,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.3.py\n",
- "#Use the ideal diode to calculate the VL & IL in Fig. 3-6a.\n",
"\n",
"\n",
- "#Variable declaration\n",
"Vs=10 #Source voltage(V)\n",
"RL=1 #Load resistance(KOhm)\n",
"VL=Vs #LOad voltage(V)\n",
"\n",
- "#Calculation\n",
"IL=VL/RL #Load current(mA)\n",
"\n",
- "#Result\n",
"print 'Vs will be appearing across RL'\n",
"print 'Load voltage VL =',Vs,'V'\n",
"print 'Load current IL =',IL,'mA'"
@@ -113,24 +102,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.4.py\n",
- "#Calculate the VL & IL in Fig. 3-6b using an ideal diode.\n",
"\n",
- "#Variable Declaration\n",
"print 'As per figure 3-6b, Thevenize the circuit to the left of the diode'\n",
"R1=6 #Resistance(KOhm)\n",
"R2=3 #Resistance(KOhm)\n",
"RL=1 #Load Resistance(KOhm)\n",
"Vs=36 #Supply voltage(V)\n",
"\n",
- "#Calculation\n",
"Vth=R2*Vs/(R1+R2) #ThCevenin voltage(V)\n",
"Rth=(R1*R2)/(R1+R2) #Thevenin resistance(KOhm)\n",
"Rt=Rth+RL #total resistance(KOhm)\n",
"IL=Vth/Rt #Load current(mA)\n",
"VL=IL*RL #Load voltage(V)\n",
"\n",
- "#Result\n",
"print 'Vth =',Vth,'V & Rth =',Rth,'KOhm'\n",
"print 'Visualize diode as closed switch,'\n",
"print 'IL =',IL,'mA'\n",
@@ -165,21 +149,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.5.py\n",
- "#Use the second approximation to calculate the VL, IL & PD in Fig 3-8. \n",
"\n",
- "#Variable Declaration\n",
"print 'As per Second approximation in Fig.3-8,'\n",
"Vd=0.7 #diode voltgage(V)\n",
"Vs=10 #supply voltage(V)\n",
"RL=1 #Load resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"VL=Vs-Vd #Load voltage(v)\n",
"IL=VL/RL #Load current(mA)\n",
"PD=Vd*IL #diode power(mW)\n",
"\n",
- "#Result\n",
"print 'IL =',IL,'mA & VL =',VL,'V'\n",
"print 'Diode power PD =',PD,'mW'"
],
@@ -210,10 +189,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.6.py\n",
- "#Calculate the VL, IL & PD in fig. 3-9a using the second approximation.\n",
"\n",
- "#Variable Declaration\n",
"print 'As per Second approximation in Fig.3-9a,'\n",
"Vd=0.7 #diode voltgage(V)\n",
"Vs=36 #supply voltage(V)\n",
@@ -221,14 +197,12 @@
"R2=3 #Resistance(KOhm)\n",
"RL=1 #Load resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"Vth=R2*Vs/(R1+R2)#Thevenin Voltage(V)\n",
"Rth=(R1*R2)/(R1+R2)#Thevenin resistance(KOhm)\n",
"IL=(Vth-Vd)/R2#Load current(mA)\n",
"VL=IL*RL#Load voltage(V)\n",
"PD=Vd*IL#diode power(mW)\n",
"\n",
- "#Result\n",
"print 'Thevenize the circuit to the left of the diode'\n",
"print 'Vth =',Vth,'V & Rth =',Rth,'KOhm'\n",
"print 'VL =',round(VL,2),'V & IL =',round(IL,2),'mA'\n",
@@ -263,17 +237,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.7.py\n",
- "#The IN4001 has a bulk resistance of 0.23 Ohm. What is VL, IL & PD?\n",
"\n",
- "#Variable Declaration\n",
"print 'In Fig.3-11a,'\n",
"Vd=0.7 #diode voltgage(V)\n",
"Vs=10 #supply voltage(V)\n",
"RL=1000L #Load resistance(Ohm)\n",
"Rb=0.23 #bulk resistance\n",
"\n",
- "#Calculation\n",
"print 'As per third approximation, we get fig.3-11b'\n",
"if Rb<(RL/100):\n",
" print'If Rb < 0.01RL than ignore Rb & use second approximation.'\n",
@@ -281,7 +251,6 @@
" IL=(VL/RL)*1000 #Load current(mA)\n",
" PD=Vd*IL #diode power(mW)\n",
"\n",
- "#Result \n",
" print 'IL =',IL,'mA & VL =',VL,'V'\n",
" print 'Diode power PD =',PD,'mW'"
],
@@ -314,10 +283,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.8.py\n",
- "#Repeat the preceding example for RL of 10 Ohm.\n",
"\n",
- "#Variable Declaration\n",
"print 'In Fig.3-11a, take RL = 10 Ohm'\n",
"Vd=0.7 #diode voltgage(V)\n",
"Vs=10 #supply voltage(V)\n",
@@ -326,14 +292,12 @@
"RT=Rb+RL #Total reistance(Ohm)\n",
"VT=Vs-Vd #total voltage(V)\n",
"\n",
- "#Calculation\n",
"print 'RT =',RT,'Ohm & VT =',VT,'V'\n",
"IL=VT/RT #Load current(mA)\n",
"VL=IL*RL #Load voltage(V)\n",
"VD=Vd+(IL*Rb) \n",
"PD=VD*IL #diode power(W)\n",
"\n",
- "#Result\n",
"print 'IL =',round(IL,2),'mA & VL =',round(VL,2),'V'\n",
"print 'VD =',round(VD,2),'V'\n",
"print 'Diode power PD =',round(PD,2),'W'"
diff --git a/Electronic_Principles_/Chapter_4_New.ipynb b/Electronic_Principles_/Chapter_4_New.ipynb
index af0210e1..b02a4e3e 100644
--- a/Electronic_Principles_/Chapter_4_New.ipynb
+++ b/Electronic_Principles_/Chapter_4_New.ipynb
@@ -27,23 +27,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.1.py\n",
- "#Calculate peak load voltage and the dc load voltage.\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Vrms=10 #RMS Value of sine wave(V)\n",
"f=60 #frequency(Hz)\n",
"\n",
- "#Calculation\n",
"Vp=Vrms/0.707 #peak source voltage(V)\n",
"Vpout=Vp #peak load voltage(V)\n",
"Vdc=Vp/math.pi #dc load voltage(V)\n",
"Vpouts=Vp-0.7 #peak load voltage in 2nd approx.\n",
"Vdc=Vpouts/math.pi #dc load voltage(V)\n",
"\n",
- "#Result\n",
"print 'Vp=',round(Vp,2),'V'\n",
"print 'With an ideal diode, Vpout =',round(Vpout,2),'V'\n",
"print 'DC load voltage, Vdc =',round(Vdc,2),'V'\n",
@@ -79,15 +74,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.2.py\n",
- "#What are the peak load voltage and dc load voltage in Figure 4.5?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Vs=120 #supply voltage(V)\n",
"\n",
- "#Calculation\n",
"V2=Vs/5 #Secondary voltage(V)\n",
"Vp=V2/0.707 #peak secondary voltage\n",
"Vpout=Vp #peak load voltage(V)\n",
@@ -95,7 +86,6 @@
"Vpouts=Vp-0.7 #peak load voltage in 2nd approx.(V)\n",
"Vdc2=Vpouts/math.pi #dc load voltage(V)\n",
"\n",
- "#Result\n",
"print 'As per fig.4-5, Transformer turns ratio is 5:1'\n",
"print 'V2=',round(V2,2),'V'\n",
"print 'Vp=',round(Vp,2),'V'\n",
@@ -135,21 +125,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.3.py\n",
- "#Figure 4.7 shows full wave rectifier, Calculate the peak input and output voltages.\n",
"\n",
- "#Variable declaration\n",
"Vrms=120 #RMS value of supply(V)\n",
"N12=10 #turn ratio\n",
"\n",
- "#Calculation\n",
"Vp1=Vrms/0.707 #peak primary voltage(V)\n",
"Vp2=Vp1/N12 #peak secondary voltage(V)\n",
"Vpin=0.5*Vp2 #input voltage(V)\n",
"Vpout=Vpin #Output voltage (V)\n",
"Vpouts=Vpin-0.7 #Output voltage in 2nd approx.(V)\n",
"\n",
- "#Result\n",
"print 'Peak primary voltage Vp1=',round(Vp1,2),'V'\n",
"print 'Peak secondary voltage Vp2=',round(Vp2,2),'V'\n",
"print 'Due to center-tap,' \n",
@@ -187,21 +172,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.4.py\n",
- "#Figure 4.7 shows full wave rectifier. If one of the diodes were open then, calculate the peak input and output voltages.\n",
"\n",
- "#Variable declaration\n",
"Vrms=120 #RMS value of supply(V)\n",
"N12=10 #turn ratio\n",
"\n",
- "#Calculation\n",
"Vp1=Vrms/0.707 #peak primary voltage(V)\n",
"Vp2=Vp1/N12 #peak secondary voltage(V)\n",
"Vpin=0.5*Vp2 #input voltage(V)\n",
"Vpout=Vpin #Output voltage(V)\n",
"Vpouts=Vpin-0.7 #Output voltage in 2nd approx.(V)\n",
"\n",
- "#Result\n",
"print 'Peak primary voltage Vp1=',round(Vp1,2),'V'\n",
"print 'Peak secondary voltage Vp2=',round(Vp2,2),'V'\n",
"print 'Due to one of the diodes were open, load voltage will be the half wave signal'\n",
@@ -239,19 +219,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.5.py\n",
- "#Calculate peak & output voltages in figure 4.9\n",
"\n",
- "#variable declaration\n",
"Vrms=120 #RMS value of supply(V)\n",
"N12=10 #turn ratio\n",
"\n",
- "#Calculation\n",
"Vp1=Vrms/0.707 #peak primary voltage(V)\n",
"Vp2=Vp1/N12 #peak secondary voltage(V)\n",
"Vpout=Vp2 #Output voltage(V)\n",
"\n",
- "#Result\n",
"print 'Peak primary voltage Vp1=',round(Vp1,2),'V'\n",
"print 'Peak secondary voltage Vp2=',round(Vp2,2),'V'\n",
"print 'secondary voltage is input of rectifier'\n",
@@ -285,24 +260,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.6.py\n",
- "#What is the dc load voltage and ripple in figure 4.14?\n",
"\n",
- "#Variable declaration\n",
"Vrms=120 #RMS value of supply(V)\n",
"N12=5 #turn ratio\n",
"RL=5 #Load resistance(KOhm)\n",
"C=100 #Capacitance(uF)\n",
"f=60 #Frequency(Hz)\n",
"\n",
- "#Calculation\n",
"V2=Vrms/N12 #RMS secondary voltage(V)\n",
"Vp=V2/0.707 #peak secondary voltage(V)\n",
"VL=Vp #dc load voltage(V)\n",
"IL=VL/RL #Load current(mA)\n",
"VR=(IL/(f*C))*(10**3) #ripple voltage(V)\n",
"\n",
- "#Result\n",
"print 'RMS secondary voltage V2=',V2,'V'\n",
"print 'Peak secondary voltage Vp=',round(Vp,2),'V'\n",
"print 'with ideal diode and small ripple, dc load voltage, VL =',round(VL,2),'V'\n",
@@ -342,24 +312,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.7.py\n",
- "#What is the dc load voltage and ripple in figure 4.15?\n",
"\n",
- "#Variable declaration\n",
"Vrms=120 #RMS value of supply(V)\n",
"N12=5 #turn ratio\n",
"RL=5 #Load resistance(KOhm)\n",
"C=100 #Capacitance(uF)\n",
"f=60 #Frequency(Hz)\n",
"\n",
- "#Calculation\n",
"V2=Vrms/N12 #RMS secondary voltage(V)\n",
"Vp=V2/0.707 #peak secondary voltage(V)\n",
"VL=Vp/2 #dc load voltage(V)\n",
"IL=VL/RL #Load current(mA)\n",
"VR=(IL/(2*f*C))*(10**3) #ripple voltage(V)\n",
"\n",
- "#Result\n",
"print 'RMS secondary voltage V2=',V2,'V'\n",
"print 'Peak secondary voltage Vp=',round(Vp,2),'V'\n",
"print 'Half this voltage is input to each half-wave section, with ideal diode and small ripple, dc load voltage, VL =',round(VL,2),'V'\n",
@@ -401,24 +366,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.8.py\n",
- "#What is the dc load voltage and ripple in figure 4.16?\n",
"\n",
- "#Variable declaration\n",
"Vrms=120 #RMS value of supply(V)\n",
"N12=5 #turn ratio\n",
"RL=5 #Load resistance(KOhm)\n",
"C=100 #Capacitance(uF)\n",
"f=60 #Frequency(Hz)\n",
"\n",
- "#Calculation\n",
"V2=Vrms/N12 #RMS secondary voltage(V)\n",
"Vp=V2/0.707 #peak secondary voltage(V)\n",
"VL=Vp #dc load voltage(V)\n",
"IL=VL/RL #Load current(mA)\n",
"VR=(IL/(2*f*C))*(10**3) #ripple voltage(V)\n",
"\n",
- "#Result\n",
"print 'RMS secondary voltage V2=',V2,'V'\n",
"print 'Peak secondary voltage Vp=',round(Vp,2),'V'\n",
"print 'with ideal diode and small ripple, dc load voltage, VL =',round(VL,2),'V'\n",
@@ -460,24 +420,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.9.py\n",
- "#Calculate the dc load voltage and ripple in figure 4.17\n",
"\n",
- "#Variable declaration\n",
"Vrms=120 #RMS value of supply(V)\n",
"N12=15 #turn ratio\n",
"RL=0.5 #Load resistance(KOhm)\n",
"C=4700 #Capacitance(uF)\n",
"f=60 #Frequency(Hz)\n",
"\n",
- "#Calculation\n",
"V2=Vrms/N12 #RMS secondary voltage(V)\n",
"Vp=V2/0.707 #peak secondary voltage(V)\n",
"VL=Vp-1.4 #dc load voltage(V)\n",
"IL=VL/RL #Load current(mA)\n",
"VR=(IL/(2*f*C))*(10**3) #ripple voltage(V)\n",
"\n",
- "#Result\n",
"print 'RMS secondary voltage V2=',V2,'V'\n",
"print 'Peak secondary voltage Vp=',round(Vp,2),'V'\n",
"print 'with ideal diode and small ripple & due to 1.4V across two conducting diodes actual dc voltage is, VL =',round(VL,2),'V'\n",
@@ -517,21 +472,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.10.py\n",
- "#What is the peak inverse voltage for turns ratio is 8:1?\n",
- "#Breakdown voltage of 50V.\n",
"\n",
- "#Variable declaration\n",
"Vrms=120 #RMS value of supply(V)\n",
"N12=8 #turn ratio\n",
"f=60 #Frequency(Hz)\n",
"\n",
- "#Calculation\n",
"V2=Vrms/N12 #RMS secondary voltage(V)\n",
"Vp=V2/0.707 #peak secondary voltage(V)\n",
"PIV = Vp #Peak Inverse Voltage(V)\n",
"\n",
- "#Result\n",
"print 'RMS secondary voltage V2=',V2,'V'\n",
"print 'Peak inverse voltage PIV =',round(PIV,2),'V'\n",
"print 'PIV << breakdown voltage(50V), So, it is safe to use IN4001'"
diff --git a/Electronic_Principles_/Chapter_5_New.ipynb b/Electronic_Principles_/Chapter_5_New.ipynb
index 44f83157..cfea03f3 100644
--- a/Electronic_Principles_/Chapter_5_New.ipynb
+++ b/Electronic_Principles_/Chapter_5_New.ipynb
@@ -27,23 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.1.py\n",
- "#Zener diode of figure 5.4a has breakdown voltage of 10V. \n",
- "#What are the minimum & maximum zener currents? \n",
"\n",
- "#Variable declaration\n",
"Vsmin=20 #Source voltage minimum(V)\n",
"Vsmax=40 #Source voltage maximum(V)\n",
"Vbd=10 #Breakdown voltage(V)\n",
"R=0.82 #Resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"Vr1=Vsmin-Vbd #voltage across resistor(V)\n",
"Is1=Vr1/R #Minimum current(mA)\n",
"Vr2=Vsmax-Vbd #voltage across resistor(V)\n",
"Is2=Vr2/R #Maximum current(mA)\n",
"\n",
- "#Result\n",
"print 'Ideally, zener diode acts as a battery(of breakdown voltage = 10V) shown in figure 5-4b'\n",
"print 'Minimum current Is1=',round(Is1,2),'mA'\n",
"print 'Maximum current Is1=',round(Is2,2),'mA'"
@@ -75,19 +69,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.2.py\n",
- "#Is the zener diode of figure 5-6a operating in the breakdown region?\n",
"\n",
- "#Variable declaration\n",
"Vs=18 #supply voltage(V)\n",
"Rs=0.27 #source resistance(KOhm)\n",
"RL=1 #Load resistance(KOhm)\n",
"Vz=10 #Zener voltage(V)\n",
"\n",
- "#Calculation\n",
"VTH=(RL/(Rs+RL))*Vs #Thevenin voltage(V)\n",
"\n",
- "#Result\n",
"print 'Thevenin voltage VTH = ',round(VTH,2),'V'\n",
"print 'Thevenin voltage is greater than zener voltage, zener diode is operating in breakdown region.'"
],
@@ -117,22 +106,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.3.py\n",
- "#What does the zener current equal in Figure 5-6b?\n",
"\n",
- "#Variable declaration\n",
"Vs=18 #supply voltage(V)\n",
"Rs=0.27 #source resistance(KOhm)\n",
"RL=1 #Load resistance(KOhm)\n",
"Vbd=10 #Zener voltage(V)\n",
"\n",
- "#Calculation\n",
"Vr=Vs-Vbd #voltage across resistor(V)\n",
"Is=Vr/Rs #Current(mA)\n",
"IL=Vbd/RL #Current(mA)\n",
"Iz=Is-IL #Zener current(mA)\n",
"\n",
- "#Result\n",
"print 'Load current IL = ',IL,'mA'\n",
"print 'Zener current Iz = ',round(Iz,2),'mA'"
],
@@ -162,20 +146,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.7.py\n",
- "#The zener diode of figure 5-12 has a breakdown voltage of 10V and a zener resistance of 8.5 Ohm.\n",
- "#Use second approx. to calculate load voltage when zener current is 20 mA.\n",
"\n",
- "#Variable declaration\n",
"Iz=20 #zener current(mA)\n",
"Rz=8.5 #zener resistance(Ohm)\n",
"Vbd=10 #Zener voltage(V)\n",
"\n",
- "#Calculation\n",
"DVL=Iz*Rz/1000 #change in load voltage(V)\n",
"VL=Vbd+DVL #Load voltage(V)\n",
"\n",
- "#Result\n",
"print 'Change in load voltage DVL =',DVL,'V'\n",
"print 'Load voltage with second approx., VL =',VL,'V'"
],
@@ -205,19 +183,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.8.py\n",
- "#In figure 5-12, Rs = 270 Ohm, Rz=8.5 Ohm and VR(in)=2V. \n",
- "#What is the approximate ripple voltage across the load?\n",
"\n",
- "#Variable declaration\n",
"Rs=270 #Source resistance (Ohm)\n",
"Rz=8.5 #zener resistance(Ohm)\n",
"VRin=2 #Zener voltage(V)\n",
"\n",
- "#Calculation\n",
"VRout=(Rz/Rs)*VRin*1000 #Load ripple voltage(V)\n",
"\n",
- "#Result\n",
"print 'Load ripple voltage VRout=',round(VRout,2),'mV'"
],
"language": "python",
@@ -245,21 +217,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.10.py\n",
- "#A zener regulator has an i/p voltage varies from 22 to 30 V. \n",
- "#If the regulated output voltage is 12 V & load resistance varies from 140 Ohm to 10 KOhm, Find maximum allowable series resistance.\n",
"\n",
- "#Variable declaration\n",
"Vil=22 #input voltage range low(V)\n",
"Vih=30 #input voltage range high(V)\n",
"Vz=12 #regulated output voltage(V)\n",
"Rl=140 #Load resistance low(KOhm)\n",
"Rh=10 #Load resistance high(KOhm)\n",
"\n",
- "#Calculation\n",
"RSmax=Rl*(float(Vil)/float(Vz)-1) #Maximum series resistance\n",
"\n",
- "#Result\n",
"print 'Maximum series resistance RSmax =',round(RSmax,2),'V'"
],
"language": "python",
@@ -287,22 +253,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.11.py\n",
"\n",
- "#A zener regulator has an input voltage varies from 15 to 20 V. \n",
- "#If zenerge is 6.8V and load current varies from 5 mA to 20 mA,find maximum allowable series resistance.\n",
"\n",
- "#Variable declaration\n",
"Vil=15 #input voltage range low(V)\n",
"Vih=20 #input voltage range high(V)\n",
"Vz=6.8 #regulated output voltage(V)\n",
"Il=5 #Load current low(mA)\n",
"Ih=20 #Load current high(mA)\n",
"\n",
- "#Calculation\n",
"RSmax=(Vil-float(Vz))/Ih*1000 #Maximum series resistance\n",
"\n",
- "#Result\n",
"print 'Maximum series resistance RSmax =',RSmax,'V'"
],
"language": "python",
@@ -330,18 +290,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.12.py\n",
- "#Figure 5-23a shows voltage-polarity tester. Find approx. LED current if the dc input voltage is 50V & series resistance is 2.2 KOhm.\n",
"\n",
- "#Variable declaration\n",
"Vi=50 #voatage supply(V)\n",
"Rs=2.2 #series resistance(KOhm)\n",
"Vf=2 #forward approx. voltage\n",
" \n",
- "#Calculation\n",
"Is=(Vi-Vf)/Rs\n",
"\n",
- "#Result\n",
"print 'LED current Is =',round(Is,2),'mA'"
],
"language": "python",
@@ -369,18 +324,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.13.py\n",
- "#Figure 5-23b shows continuity tester. find approx. LED current if the series resistance is 470 Ohm.\n",
"\n",
- "#Variable declaration\n",
"Vs=9 #voatage supply(V)\n",
"Rs=470.0 #series resistance(Ohm)\n",
"Vf=2 #forward approx. voltage\n",
" \n",
- "#Calculation\n",
"Is=(Vs-Vf)/Rs\n",
"\n",
- "#Result\n",
"print 'LED current Is =',round((Is*1000),2),'mA'"
],
"language": "python",
@@ -408,23 +358,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.14.py\n",
- "#In figure 5-24, find avg. LED current if the ac source voltage is 20V rms and series resistance is 680 Ohm.\n",
- "#Also calculate approx. power dissipation in series resistor.\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Vac=20 #AC voatage supply(V)\n",
"Rs=680.0 #series resistance(KOhm)\n",
" \n",
- "#Calculation\n",
"Vacp=1.414*Vac #peak source voltage(V)\n",
"Is1=(Vacp/Rs)*1000 #approx. peak current(mA)\n",
"Is2=Is1/math.pi #average of half-wave current through LED(mA)\n",
"P=(Vac)**2/Rs #Power dissipation(W)\n",
"\n",
- "#Result\n",
"print 'approx. peak LED current Is1 =',round(Is1,2),'mA'\n",
"print 'average of half-wave current through LED Is2 =',round(Is2,2),'mA'\n",
"print 'Power dissipation P =',round(P,2),'W'"
@@ -456,24 +400,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.15.py\n",
- "#Figure 5-25, find capacitor is used instead of resistor. \n",
- "#what is average LED current if the capacitance is 0.68 uf?\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"Vs=120 #AC voatage supply(V)\n",
"f=60 #frequency(Hz)\n",
"C=0.68 #series resistance(KOhm)\n",
" \n",
- "#Calculation\n",
"Xc=1/(2*math.pi*f*C)*1000 #capacitive reactance(KOhm)\n",
"Vacp=Vs*1.414\n",
"Is1=(Vacp/Xc) #approx. peak current(mA)\n",
"Is2=Is1/math.pi #average current through LED(mA)\n",
"\n",
- "#Result\n",
"print 'Capacitance reactance Xc = ',round(Xc,2),'KOhm'\n",
"print 'approx. peak LED current Is1 =',round(Is1,2),'mA'\n",
"print 'average current through LED Is2 =',round(Is2,2),'mA'"
diff --git a/Electronic_Principles_/Chapter_6_New.ipynb b/Electronic_Principles_/Chapter_6_New.ipynb
index 6cc29f0f..990f6ef8 100644
--- a/Electronic_Principles_/Chapter_6_New.ipynb
+++ b/Electronic_Principles_/Chapter_6_New.ipynb
@@ -27,17 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.1.py\n",
- "#A transistor has a collector current of 10 mA and a base current of 40 uA. find current gain. \n",
"\n",
- "#Variable declaration\n",
"Ic=10 #collector current(mA)\n",
"Ib=40.0/1000.0 #base current (mA)\n",
"\n",
- "#Calculation\n",
"Bdc=Ic/Ib #Current gain\n",
"\n",
- "#Result\n",
"print 'Current gain Bdc =',Bdc"
],
"language": "python",
@@ -65,17 +60,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.2.py\n",
- "#A transistor has a currrent gain of 175 and a base current of 0.1 mA. find collector current. \n",
"\n",
- "#Variable declaration\n",
"Bdc=175 #current gain\n",
"Ib=0.1 #base current (mA)\n",
"\n",
- "#Calculation\n",
"Ic=Bdc*Ib #Current gain\n",
"\n",
- "#Result\n",
"print 'Collector current Ic =',Ic,'mA'"
],
"language": "python",
@@ -103,17 +93,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.3.py\n",
- "#A transistor has a collector current of 2 mA. If the currrent gain of 135. find base current. \n",
"\n",
- "#Variable declaration\n",
"Bdc=135.0 #current gain\n",
"Ic=2.0 #collector current (mA)\n",
"\n",
- "#Calculation\n",
"Ib=(Ic/Bdc)*1000 #Current gain\n",
"\n",
- "#Result\n",
"print 'Base current Ib =',round(Ib,2),'uA'"
],
"language": "python",
@@ -141,21 +126,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.4.py\n",
- "#Use the second approx. to calculate the base current in figure 6-8b. \n",
- "#Find voltage across the base resistor & collector current if Bdc=200. \n",
"\n",
- "#Variable declaration\n",
"Vbb=2 #base source voltage(V)\n",
"Rb=100 #base resistor (KOhm)\n",
"Bdc=200 #current gain\n",
"Vbe=0.7 #base-emitter voltage drop(V)\n",
"\n",
- "#Calculation\n",
"Ib=((Vbb-Vbe)/Rb)*1000 #base current(uA)\n",
"Ic=Bdc*Ib/1000 #Collector current(mA)\n",
"\n",
- "#Result\n",
"print 'Base current Ib =',Ib,'uA'\n",
"print 'Collector current Ic =',Ic,'mA'"
],
@@ -185,10 +164,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.5.py\n",
- "#The transistor of Figure 6-11a has Bdc=300. Calculate IB,IC,VCE & PD\n",
"\n",
- "#Variable declaration\n",
"VBB=10 #Base voltage (V)\n",
"RC=2 #Collector resistance(KOhm)\n",
"VCC=10 #collector voltage(V)\n",
@@ -196,13 +172,11 @@
"RB=1 #base resistance (MOhm)\n",
"VBE=0.7 #base-emitter voltage drop(V) \n",
"\n",
- "#Calculation\n",
"IB=((VBB-VBE)/RB) #base current(uA)\n",
"IC=Bdc*IB/1000 #Collector current(mA)\n",
"VCE=VCC-(IC*RC) #Collector-emitter voltage(V)\n",
"PD=VCE*IC #Collector power dissipation(W)\n",
"\n",
- "#Result\n",
"print 'Base current IB =',IB,'uA'\n",
"print 'Collector current IC =',IC,'mA'\n",
"print 'Collector-emitter voltage VCE =',VCE,'V'\n",
@@ -236,10 +210,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.6.py\n",
- "#Calculate current gain of the 2N4424 shown in figure 6-12.\n",
"\n",
- "#Variable declaration\n",
"VBB=10 #Base voltage (V)\n",
"RC=470 #Collector resistance(Ohm)\n",
"VCC=10 #collector voltage(V)\n",
@@ -248,13 +219,11 @@
"RB=330 #base resistance (KOhm)\n",
"VBE=0.7 #base-emitter voltage drop \n",
"\n",
- "#Calculation\n",
"IB=((VBB-VBE)/RB)*1000 #base current(uA)\n",
"V=VCC-VCE #voltage across Rc\n",
"IC=(V/RC)*1000 #Collector current(mA)\n",
"Bdc=int((IC/IB)*1000) #Collector-emitter voltage\n",
"\n",
- "#Result\n",
"print 'Base current IB =',round(IB,2),'uA'\n",
"print 'voltage across Rc VRc = ',round(V,2),'V'\n",
"print 'Collector current IC =',round(IC,2),'mA'\n",
@@ -288,10 +257,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.7.py\n",
- "#What is the collector-emitter voltage in figure 6-14? Use the ideal transistor.\n",
"\n",
- "#Variable declaration\n",
"VBB=15 #Base voltage (V)\n",
"RC=3.6 #Collector resistance(KOhm)\n",
"VCC=15 #collector voltage(V)\n",
@@ -299,13 +265,11 @@
"RB=470 #base resistance (KOhm)\n",
"VBE=0 #base-emitter voltage drop(V) \n",
"\n",
- "#Calculation\n",
"IB=((VBB-VBE)/float(RB))*1000 #base current(uA)\n",
"IC=Bdc*IB/1000 #Collector current(mA)\n",
"VCE=VCC-(IC*RC) #Collector-emitter voltage(V)\n",
"IE=IC+(IB/1000) #emitter current(mA)\n",
"\n",
- "#Result\n",
"print 'Base current IB =',round(IB,2),'uA'\n",
"print 'Collector current IC =',round(IC,2),'mA'\n",
"print 'Collector-emitter voltage VCE = ',round(VCE,2),'V'\n",
@@ -339,10 +303,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.8.py\n",
- "#What is the collector-emitter voltage in figure 6-14? Use the second approximation.\n",
"\n",
- "#Variable declaration\n",
"VBB=15 #Base voltage (V)\n",
"RC=3.6 #Collector resistance(KOhm)\n",
"VCC=15 #collector voltage(V)\n",
@@ -350,12 +311,10 @@
"RB=470 #base resistance (KOhm)\n",
"VBE=0.7 #base-emitter voltage drop(V) \n",
"\n",
- "#Calculation\n",
"IB=((VBB-VBE)/float(RB))*1000 #base current(uA)\n",
"IC=Bdc*IB/1000 #Collector current(mA)\n",
"VCE=VCC-(IC*RC) #Collector-emitter voltage(V)\n",
"\n",
- "#Result\n",
"print 'Base current IB =',round(IB,2),'uA'\n",
"print 'Collector current IC =',round(IC,2),'mA'\n",
"print 'Collector-emitter voltage VCE = ',round(VCE,2),'V'"
@@ -387,10 +346,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.9.py\n",
- "#suppose you measure a VBE 1V. What is the collector-emitter voltage in figure 6-14?\n",
"\n",
- "#Variable declaration\n",
"VBB=15 #Base voltage (V)\n",
"RC=3.6 #Collector resistance(KOhm)\n",
"VCC=15 #collector voltage(V)\n",
@@ -398,12 +354,10 @@
"RB=470 #base resistance (KOhm)\n",
"VBE=1 #base-emitter voltage drop(V) \n",
"\n",
- "#Calculation\n",
"IB=((VBB-VBE)/float(RB))*1000 #base current(uA)\n",
"IC=Bdc*IB/1000 #Collector current(mA)\n",
"VCE=VCC-(IC*RC) #Collector-emitter voltage(V)\n",
"\n",
- "#Result\n",
"print 'Base current IB =',round(IB,2),'uA'\n",
"print 'Collector current IC =',round(IC,2),'mA'\n",
"print 'Collector-emitter voltage VCE = ',round(VCE,2),'V'"
@@ -435,10 +389,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.10.py\n",
- "#What is the collector-emitter voltage in preceding examples if base supply voltage is 5V?\n",
"\n",
- "#Variable declaration\n",
"VBB=5 #Base voltage (V)\n",
"RC=3.6 #Collector resistance(KOhm)\n",
"VCC=15 #collector voltage(V)\n",
@@ -448,7 +399,6 @@
"VBE2=0.7 #base-emitter voltage drop2(V)\n",
"VBE3=1 #base-emitter voltage drop3(V)\n",
"\n",
- "#Calculation\n",
"IB1=((VBB-VBE1)/float(RB))*1000 #base current1(uA)\n",
"IC1=Bdc*IB1/1000 #Collector current1(mA)\n",
"VCE1=VCC-(IC1*RC) #Collector-emitter voltage1(V)\n",
@@ -461,7 +411,6 @@
"IC3=Bdc*IB3/1000 #Collector current3(mA)\n",
"VCE3=VCC-(IC3*RC) #Collector-emitter voltage3(V)\n",
"\n",
- "#Result\n",
"print 'Base current IB1 =',round(IB1,2),'uA'\n",
"print 'Collector current IC1 =',round(IC1,2),'mA'\n",
"print 'Collector-emitter voltage VCE1 = ',round(VCE1,2),'V'\n",
@@ -507,19 +456,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.11.py\n",
- "#A 2N3904 has VCE = 10V and Ic = 20mA. find power dissipation. \n",
- "#How safe is this level of power dissipation if the ambient temperature is 25 deg C?\n",
"\n",
- "#Variable declaration\n",
"VCE=10 #Collector-emitter voltage(V)\n",
"IC=20 #Collector current(mA)\n",
"T=25 #Ambient temperature(deg C)\n",
" \n",
- "#Calculation\n",
"PD = VCE*IC #Power dissipation(mW)\n",
"\n",
- "#Result\n",
"print 'Power dissipation PD = ',PD,'mW'\n",
"print 'for 25 deg C, power rating is 625 mW So, transistor is well within power rating.'"
],
@@ -549,21 +492,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.12.py\n",
- "#How safe is the level of power dissipation if the ambient temeprature is 100 deg C in example 6-11?\n",
"\n",
- "#Variable declaration\n",
"T1=100 #Ambient temperature(deg C)\n",
"T2=25 #Reference temperature(deg C)\n",
"mf=5 #Multiply factor(mW/deg C) \n",
"Pr=625 #power rating(mW)\n",
"\n",
- "#Calculation\n",
"Td=T1-T2 #Temperature difference(deg C)\n",
"Pd=mf*Td #Difference in power(mW)\n",
"PDmax=Pr-Pd #Maximum power dissipation(mW)\n",
"\n",
- "#Result\n",
"print 'Maximum Power dissipation PDmax = ',PDmax,'mW'\n",
"print 'for 25 deg C, power rating is 625 mW So, transistor is yet within power rating.'"
],
diff --git a/Electronic_Principles_/Chapter_7_New.ipynb b/Electronic_Principles_/Chapter_7_New.ipynb
index 5f237c0c..bf956ac7 100644
--- a/Electronic_Principles_/Chapter_7_New.ipynb
+++ b/Electronic_Principles_/Chapter_7_New.ipynb
@@ -27,18 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.1.py\n",
- "#Find saturation current and the cutoff voltage in Figure 7-4a.\n",
"\n",
- "#Variable declaration\n",
"VCC=30 #collector voltage(V)\n",
"RC=3 #Collector resistance (KOhm)\n",
"\n",
- "#Calculation\n",
"ICsat=VCC/RC #Saturation current(mA)\n",
"VCEc=VCC #VCE cutoff voltage(V)\n",
"\n",
- "#Result\n",
"print 'Saturation current IC(saturation) = ',ICsat,'mA'\n",
"print 'Collector emitter cutoff VCE(cutoff) = ',VCEc,'V'"
],
@@ -68,18 +63,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.2.py\n",
- "#What are the saturation current and the cutoff voltage in Figure 7-4b? \n",
"\n",
- "#Variable declaration\n",
"VCC=9 #collector voltage(V)\n",
"RC=3 #Collector resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"ICsat=VCC/RC #Saturation current(mA)\n",
"VCEc=VCC #VCE cutoff voltage(V)\n",
"\n",
- "#Result\n",
"print 'Saturation current IC(saturation) = ',ICsat,'mA'\n",
"print 'Collector emitter cutoff VCE(cutoff) = ',VCEc,'V'"
],
@@ -109,18 +99,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.3.py\n",
- "#What are the saturation current and the cutoff voltage in Figure 7-5a? \n",
"\n",
- "#Variable declaration\n",
"VCC=15 #collector voltage(V)\n",
"RC=1 #Collector resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"ICsat=VCC/RC #Saturation current(mA)\n",
"VCEc=VCC #VCE cutoff voltage(V)\n",
"\n",
- "#Result\n",
"print 'Saturation current IC(saturation) = ',ICsat,'mA'\n",
"print 'Collector emitter cutoff VCE(cutoff) = ',VCEc,'V'"
],
@@ -150,18 +135,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.4.py\n",
- "#What are the saturation current and the cutoff voltage in Figure 7-5b? \n",
"\n",
- "#Variable declaration\n",
"VCC=15 #collector voltage(V)\n",
"RC=3 #Collector resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"ICsat=VCC/RC #Saturation current(mA)\n",
"VCEc=VCC #VCE cutoff voltage(V)\n",
"\n",
- "#Result\n",
"print 'Saturation current IC(saturation) = ',ICsat,'mA'\n",
"print 'Collector emitter cutoff VCE(cutoff) = ',VCEc,'V'"
],
@@ -191,27 +171,21 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.5.py\n",
- "#Base resistance is increased to 1MOhm. What happens to the collector-emitter voltage if Bdc is 100?\n",
"\n",
- "#Variable declaration\n",
"VCC=15.0 #collector voltage(V)\n",
"RC=3 #collector resistance (KOhm)\n",
"VBB=15.0 #base voltage(V)\n",
"RB=1 #base resistance (MOhm)\n",
"Bdc=100 #current gain\n",
"\n",
- "#Calculation\n",
"IB1=(VBB/RB) #base current(uA)\n",
"IC1=Bdc*IB1/1000 #Collector current(mA)\n",
"VCE1=VCC-(IC1*RC) #Collector-emitter voltage(V)\n",
"\n",
- "#second approx. calculation\n",
"IB2=((VBB-0.7)/RB) #base current(uA)\n",
"IC2=Bdc*IB2/1000 #Collector current(mA)\n",
"VCE2=VCC-(IC2*RC) #Collector-emitter voltage(V)\n",
"\n",
- "#Result\n",
"print 'Collector emitter voltage VCE1 = ',VCE1,'V'\n",
"print 'For second approx., collector emitter voltage VCE2 = ',VCE2,'V'"
],
@@ -241,23 +215,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.6.py\n",
- "#Base resistance of figure 7-7a is increased to 1MOhm. \n",
- "#Is the saturation still saturated?\n",
"\n",
- "#Variable declaration\n",
"VCC=20.0 #collector voltage(V)\n",
"RC=10 #collector resistance (KOhm)\n",
"VBB=10.0 #base voltage(V)\n",
"RB=1 #base resistance (MOhm)\n",
"Bdc=50 #current gain\n",
"\n",
- "#Calculation\n",
"IB=(VBB/RB) #base current(uA)\n",
"IC=Bdc*IB/1000 #Collector current(mA)\n",
"VCE=VCC-(IC*RC) #Collector-emitter voltage(V)\n",
"\n",
- "#Result\n",
"print 'Collector emitter voltage VCE = ',VCE,'V'\n",
"print 'So, transistor is in active region.'"
],
@@ -287,17 +255,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.7.py\n",
- "#Collector resistance of figure 7-7a is decreased to 5KOhm. Does the transistor remain in the saturation region?\n",
"\n",
- "#Variable declaration\n",
"VCC=20.0 #collector voltage(V)\n",
"RC=5 #collector resistance (KOhm)\n",
"VBB=10.0 #base voltage(V)\n",
"RB=100 #base resistance(KOhm)\n",
"Bdco=50 #old current gain\n",
"\n",
- "#Calculation\n",
"ICsat=VCC/RC #Saturation current(mA)\n",
"IB=VBB/RB #base current(mA)\n",
"IC=Bdc*IB/1000 #Collector current(mA)\n",
@@ -305,7 +269,6 @@
"Bdcn=ICsat/IB #New current gain\n",
" \n",
"\n",
- "#Result\n",
"print 'ICsat = ',ICsat,'mA'\n",
"print 'Bdc = ',int(Bdcn)\n",
"print 'Current can not be more than ICsat So, current gain will decrease.'\n",
@@ -339,11 +302,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.8.py\n",
- "#VCC is decreased to 5V. What are the two values of the output voltage?\n",
- "#If VCE(sat) is 0.15 V and ICEO is 50 nA, What are two values of the output voltage?\n",
"\n",
- "#Variable declaration\n",
"VCC=5.0 #collector voltage(V)\n",
"ICEO=50 #Collector leakage current(nA)\n",
"RC=1 #collector resistance (KOhm)\n",
@@ -351,10 +310,8 @@
"RB=10 #base resistance(KOhm)\n",
"VCEs=0.15 #VCE saturation(V)\n",
"\n",
- "#Calculation\n",
"VCE=VCC-((ICEO*RC)*10**-6) #Collector-emitter voltage(V)\n",
"\n",
- "#Result\n",
"print 'Two values of output voltage are 0 and 5 V'\n",
"print 'first voltage is voltage across saturated transistor = ',VCEs,'V' \n",
"print 'Second voltage is: VCE = ',round(VCE,2),'V'"
@@ -386,10 +343,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.9.py\n",
- "#What is the VC & VCE in figure 7-11?\n",
"\n",
- "#Variable declaration\n",
"VCC=15 #collector voltage(V)\n",
"VBB=5 #Base voltage(V)\n",
"RC=2 #collector resistance (KOhm)\n",
@@ -398,7 +352,6 @@
"RE=1 #emitter resistance(KOhm)\n",
"\n",
"\n",
- "#Calculation\n",
"VE=VBB-VBE #Emitter voltage(V)\n",
"IE=(VE/RE) #emitter current(mA)\n",
"IC=IE #Collector current(mA)\n",
@@ -406,7 +359,6 @@
"VCE=VC-VE #Collector-emitter voltage(V)\n",
" \n",
"\n",
- "#Result\n",
"print 'Emitter current IE = ',IE,'mA'\n",
"print 'Emitter voltage VE = ',VE,'V'\n",
"print 'Collector emitter voltage VCE = ',VCE,'V'"
@@ -438,22 +390,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.10.py\n",
- "#We want 25 mA of LED current when the switch is closed in figure 7-12b. How can we do it?\n",
"\n",
- "#Variable declaration\n",
"VCC=20 #collector voltage(V)\n",
"VBB=15 #Base voltage(V)\n",
"VBE=0.7 #base voltage(V)\n",
"RE=1.5 #emitter resistance(KOhm)\n",
"IE=25.0 #emitter current(mA)\n",
"\n",
- "#Calculation\n",
"VE=IE*RE #emitter current(mA)\n",
"RE=(VBB/IE)*1000 #emitter resistance(KOhm)\n",
"RE2=((VBB-VBE)/IE)*1000 #emitter resistance(KOhm)\n",
" \n",
- "#Result\n",
"print 'Emitter voltage VE = ',VE,'V'\n",
"print 'Emitter resistance RE = ',RE,'Ohm'\n",
"print 'Emitter resistance RE2 = ',RE2,'Ohm'"
diff --git a/Electronic_Principles_/Chapter_8_New.ipynb b/Electronic_Principles_/Chapter_8_New.ipynb
index e3c2894e..5db68b59 100644
--- a/Electronic_Principles_/Chapter_8_New.ipynb
+++ b/Electronic_Principles_/Chapter_8_New.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.1.py\n",
- "#What is the collector-emitter voltage in Figure 8-2? \n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
"RE=1 #Emitter resistance (KOhm)\n",
@@ -38,7 +35,6 @@
"R2=2.2 #Base resistance2 (KOhm)\n",
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"\n",
- "#Calculation\n",
"VBB=(R2/(R1+R2))*VCC #Base voltage(V)\n",
"VE=VBB-VBE #Emitter voltage(V)\n",
"IE=VE/RE #Emitter current(mA)\n",
@@ -46,7 +42,6 @@
"VC=VCC-(IC*RC) #collector to ground voltage(V)\n",
"VCE=VC-VE #Collector-emitter voltage(V)\n",
"\n",
- "#Result\n",
"print 'Collector current IC = ',round(IC,2),'mA'\n",
"print 'Collector-emitter voltage VCE = ',round(VCE,2),'V'"
],
@@ -76,10 +71,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.3.py\n",
- "#Is the voltage divider of figure 8-5 stiff? Calculate emitter current.\n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
"RE=1 #Emitter resistance (KOhm)\n",
@@ -88,7 +80,6 @@
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"Bdc=200 #current gain\n",
"\n",
- "#Calculation\n",
"R=(R1*R2)/(R1+R2) #Thevenin resistance(KOhm)\n",
"Ri=Bdc*RE #Base input resistance(KOhm)\n",
"R100=0.01*Ri #100th of Ri(KOhm)\n",
@@ -96,7 +87,6 @@
"VE=VBB-VBE #Emitter voltage(V)\n",
"IE=VE/(RE+(R/Ri)) #Emitter current(mA)\n",
"\n",
- "#Result\n",
"print 'As per stiff voltage divider rule, R1||R2 < 0.01 Bdc*RE, So, Voltage divider is stiff.'\n",
"print 'Emitter current IE = ',round(IE,2),'mA'"
],
@@ -126,17 +116,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.4.py\n",
- "#For the circuit shown in figure 8-7, design resistor values.\n",
- "#VCC=10 V, VCE @ mid point, IC=10mA, 2N3904's Bdc=100-300.\n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"IC=10 #Collector current(mA)\n",
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"Bdc=100 #current gain\n",
"\n",
- "#Calculation\n",
"IE=IC #Emitter current(mA)\n",
"VE=0.1*VCC #Emitter voltage(V)\n",
"RE=(VE/IE)*1000 #Emitter resistance (Ohm)\n",
@@ -146,7 +131,6 @@
"V1=VCC-V2 #voltage across R2(V)\n",
"R1=(V1/V2)*R2 #Base input resistance1(Ohm)\n",
"\n",
- "#Result\n",
"print 'Emitter resistance RE = ',RE,'Ohm'\n",
"print 'Collector resistance RC = ',RC,'Ohm'\n",
"print 'Base resistance R1 = ',round(R1,2),'Ohm'\n",
@@ -180,10 +164,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.5.py\n",
- "#What is the collector voltage in Figure 8-10 if emitter resistor is increased to 1.8 KOhm? \n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
"RE=1.8 #Emitter resistance (KOhm)\n",
@@ -191,14 +172,12 @@
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"VEE=2 #emitter voltage(V)\n",
"\n",
- "#Calculation\n",
"VBB=0 #Base voltage(V)\n",
"VE=VEE-VBE #Emitter to ground voltage(V)\n",
"IE=VE/RE #Emitter current(mA)\n",
"IC=IE #Collector current(mA)\n",
"VC=VCC-(IC*RC) #collector to ground voltage(V)\n",
"\n",
- "#Result\n",
"print 'Emitter current IE = ',round(IE,2),'mA'\n",
"print 'Collector voltage VC = ',VC,'V'"
],
@@ -228,24 +207,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.6.py\n",
- "#Figure 8-11 shows 3 stage circuit using TSEB. Find VC.\n",
"\n",
- "#Variable declaration\n",
"VCC=15 #collector voltage(V)\n",
"RC=10 #Collector resistance (KOhm)\n",
"RE=20 #Emitter resistance (KOhm)\n",
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"VEE=15 #emitter voltage(V)\n",
"\n",
- "#Calculation\n",
"VBB=0 #Base voltage(V)\n",
"VE=VEE-VBE #Emitter to ground voltage(V)\n",
"IE=VE/RE #Emitter current(mA)\n",
"IC=IE #Collector current(mA)\n",
"VC=VCC-(IC*RC) #collector to ground voltage(V)\n",
"\n",
- "#Result\n",
"print 'Emitter current IE = ',IE,'mA'\n",
"print 'Collector voltage VC = ',VC,'V'"
],
@@ -275,10 +249,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.7.py\n",
- "#Calculate the three transistor voltages for the PNP circuit of figure 8-19b?\n",
"\n",
- "#Variable declaration\n",
"VCC=-10 #collector supply voltage(V)\n",
"VEE=-VCC #Emitter supply voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
@@ -287,14 +258,12 @@
"R2=2.2 #Base resistance2 (KOhm)\n",
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"\n",
- "#Calculation\n",
"V2=(R2/(R1+R2))*VEE #Base voltage(V)\n",
"IE=(V2-VBE)/RE #Emitter current(mA)\n",
"VC=IE*RC #collector to ground voltage(V)\n",
"VB=VEE-V2 #Base to ground voltage(V)\n",
"VE=VEE-(V2-VBE) #Emitter to ground voltage(V)\n",
"\n",
- "#Result\n",
"print 'Emitter current IE = ',round(IE,2),'mA'\n",
"print 'Collector to ground voltage VC = ',round(VC,2),'V'\n",
"print 'Base to ground voltage VB = ',round(VB,2),'V'\n",
diff --git a/Electronic_Principles_/Chapter_9_New.ipynb b/Electronic_Principles_/Chapter_9_New.ipynb
index f0e0aec7..3fb67bca 100644
--- a/Electronic_Principles_/Chapter_9_New.ipynb
+++ b/Electronic_Principles_/Chapter_9_New.ipynb
@@ -27,21 +27,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.1.py\n",
- "#Using figure 9-1a, if R=2KOhm & the frequency range is from 20Hz to 20 KHz, \n",
- "#find C nedded to act as a good coupling capacitor.\n",
"\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"f=20 #frequency(Hz)\n",
"R=2 #Resistance(KOhm)\n",
"\n",
- "#Calculation\n",
"XC=0.1*R #Capacitive reactance(Ohm)\n",
"C=(1/(2*math.pi*f*XC))*1000 #Capacitance(uF)\n",
"\n",
- "#Result\n",
"print 'Capacitance C = ',round(C,2),'uF'"
],
"language": "python",
@@ -69,23 +63,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.2.py\n",
- "#In figure 9-7, the input frequency of V is 1KHz. \n",
- "#What value of C nedded to effectively short point E to ground?\n",
"import math\n",
"\n",
- "#Variable declaration\n",
"f=1 #frequency(KHz)\n",
"R1=600 #Resistance1(Ohm)\n",
"R2=1000 #Resistance2(Ohm)\n",
"\n",
- "#Calculation\n",
"\n",
"RTH=R1*R2/(R1+R2) #Thevenin resistance(Ohm)\n",
"XC=0.1*RTH #Capacitive reactance(Ohm)\n",
"C=(1/(2*math.pi*f*XC))*1000 #Capacitance(uF)\n",
"\n",
- "#Result\n",
"print 'Capacitance C = ',round(C,2),'uF'"
],
"language": "python",
@@ -113,20 +101,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.3.py\n",
- "#Using figure 9-9, find the maximum small signal emitter current.\n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RE=1 #Emitter resistance(KOhm)\n",
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"VEE=2 #Emitter supply voltage(V)\n",
"\n",
- "#Calculation\n",
"IEQ=(VEE-VBE)/RE #Q point emitter current(mA)\n",
"iepp=0.1*IEQ*1000 #small signal emitter current(uA) \n",
"\n",
- "#Result\n",
"print 'Q point emitter current IEQ = ',IEQ,'mA'\n",
"print 'Small signal emitter current iepp = ',iepp,'uApp'"
],
@@ -156,10 +139,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.4.py\n",
- "#What does re' equal in the base-biased amplifier of figure 9-15a? \n",
"\n",
- "#Variable declaration\n",
"VCC=30 #Supply voltage(V)\n",
"RC=5 #Collector resistance (KOhm)\n",
"RL=100 #Emitter resistance (KOhm)\n",
@@ -167,12 +147,10 @@
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"Bdc=100 #current gain\n",
"\n",
- "#Calculation\n",
"IB=(VCC-VBE)/RB #Base current(mA)\n",
"IE=Bdc*IB/1000 #Emitter current(mA)\n",
"re=25/IE #AC resistance(Ohm)\n",
"\n",
- "#Result\n",
"print 'Emitter current IE = ',IE,'mA'\n",
"print 'AC resistance re\\' = ',round(re,2),'Ohm'"
],
@@ -202,10 +180,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.5.py\n",
- "#What does re' equal in figure 9-15b? \n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
"RE=1 #Emitter resistance (KOhm)\n",
@@ -213,13 +188,11 @@
"R2=2.2 #Base resistance2 (KOhm)\n",
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"\n",
- "#Calculation\n",
"VBB=(R2/(R1+R2))*VCC #Base voltage(V)\n",
"VE=VBB-VBE #Emitter voltage(V)\n",
"IE=VE/RE #Emitter current(mA)\n",
"re=25/IE #AC resistance(Ohm)\n",
"\n",
- "#Result\n",
"print 'Emitter current IE = ',round(IE,2),'mA'\n",
"print 'AC resistance re\\' = ',round(re,2),'Ohm'"
],
@@ -249,10 +222,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.6.py\n",
- "#What is the ac resistance of emitter diode for the TSEB amplifier of figure 9-15c? \n",
"\n",
- "#Variable declaration\n",
"VCC=10 #collector voltage(V)\n",
"RC=3.6 #Collector resistance (KOhm)\n",
"RE=1 #Emitter resistance (KOhm)\n",
@@ -260,12 +230,10 @@
"VBE=0.7 #Base-emitter voltage drop(V)\n",
"VEE=2 #emitter voltage(V)\n",
"\n",
- "#Calculation\n",
"VE=VEE-VBE #Emitter to ground voltage(V)\n",
"IE=VE/RE #Emitter current(mA)\n",
"re=25/IE #AC resistance(Ohm)\n",
"\n",
- "#Result\n",
"print 'Emitter current IE = ',IE,'mA'\n",
"print 'AC resistance re\\' = ',round(re,2),'Ohm'"
],
diff --git a/Elements_Of_Mass_Transfer_Part_1/ch2.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch2.ipynb
index b72246a4..db1c8564 100644
--- a/Elements_Of_Mass_Transfer_Part_1/ch2.ipynb
+++ b/Elements_Of_Mass_Transfer_Part_1/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:63ec039d8e0cb7cbcf7792965630fc54de76590123e48dd89f9e70d5575deae0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusivity of nitrogen carbondioxide mixture\n",
- "\n",
- "# let A denote nitrogen and B denote carboondioxide\n",
"\n",
"# variable declaration \n",
"rA=.3798;\n",
@@ -80,10 +78,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#diffusivity of hydrogen chloride mixture\n",
- "# let A denote Hydrogen chloride and B denote air\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"\n",
"#\"part(ii)\"\n",
"rA=.3339;\n",
@@ -136,8 +131,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# the diffusivity of isoamyl alcohol\n",
- "#kopp's law is valid\n",
+ " \n",
"\n",
"# variable declaration \n",
"\n",
@@ -180,9 +174,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusivity of ccl4 through oxygen\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"\n",
"pa1=(33./760)*1.013*10**5; #vapour pressure of ccl4 at 273 in pascal\n",
"pa2=0;\n",
@@ -233,10 +225,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate at which crystal dissolves\n",
- "\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"\n",
"z=.0305*10**-3; #wall thickness sorrounding the crystal\n",
"x1=0.0229;\n",
@@ -288,16 +277,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate of diffusion of alcohol water vapour mixture\n",
- "#position 1 moles molefraction\n",
- "# air 80 0.8\n",
- "# water 20 0.2\n",
- "\n",
- "#position 2 moles molefraction\n",
- "# air 10 0.1\n",
- "# water 90 0.9\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"\n",
"ya1=0.8;\n",
"ya2=0.1;\n",
@@ -341,9 +321,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate of diffusion if water layer is stagnant\n",
- "\n",
- "# variable declaration \n",
"\n",
"ya1=0.8;\n",
"ya2=0.1;\n",
@@ -389,9 +366,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate of loss of hydrogen\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"T=298.; #temperature in kelvin\n",
"pt=1.*1.013*10**5; #total pressure in pascal\n",
"ID=25.*10**-3; #internal diameter in m of unvulcanised rubber in m\n",
@@ -441,9 +416,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# ammonia diffusion through nitrogen\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"pa1=(1.5)*10**4; #vapour pressure of ammonia at pt.1 \n",
"pa2=(0.5)*10**4; #vapour pressure of ammonia at pt.2\n",
"Dab=2.3*10**-5 #molecular diffusivity in m**2/s\n",
@@ -486,17 +459,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate at which crystal dissolves\n",
- "#position 1 moles molefraction weight\n",
- "# ethanol 0.1478 0.02775 6.80\n",
- "# water 5.18 0.9722 93.20\n",
"\n",
"import math\n",
- "#position 2 moles molefraction weight\n",
- "# ethanol 0.235 0.0453 10.8\n",
- "# water 4.96 0.9547 89.20\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"\n",
"z=0.4*10**-2; #film thickness sorrounding the crystal\n",
"xa1=0.0453; #mole fraction of ethanol at pos.2\n",
@@ -549,14 +514,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusion rate of acetic acid\n",
- "#position 1 kmoles molefraction weight\n",
- "# acetic acid 0.167 0.0323 10\n",
- "# water 5 0.9677 90\n",
- "\n",
- "#position 2 kmoles molefraction weight\n",
- "# aceitic acid 0.067 0.0124 4\n",
- "# water 5.33 0.9876 96\n",
+ " \n",
"import math\n",
"# variable declaration \n",
"\n",
@@ -612,10 +570,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate of mass transfer\n",
- "# variable declaration \n",
+ " \n",
"\n",
- "#part (i)\n",
+ " \n",
"r=(50./2)*10**-3; #radius pf circular tube\n",
"pa1=190; #vapour pressure of ammonia at pt.1 \n",
"pa2=95; #vapour pressure of ammonia at pt.2\n",
@@ -661,9 +618,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# partial pressure of co2\n",
- "#part (i)\n",
- "# variable declaration \n",
+ " \n",
"\n",
"r=(50./2)*10**-3; #radius pf circular tube\n",
"pa1=(190.); #vapour pressure of ammonia at pt.1 \n",
@@ -714,10 +669,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusion flux if N2 is non diffusing\n",
- "\n",
- "# variable declaration \n",
- "\n",
+ " \n",
"ya1=0.2; #initial mole fraction\n",
"ya2=0.1; #final mole fraction\n",
"T=298 #temperature in kelvin\n",
@@ -762,10 +714,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusion flux of oxygen\n",
- "\n",
- "# variable declaration \n",
- "\n",
+ " \n",
"ya1=0.2;\n",
"ya2=0.1;\n",
"T=(298); #temperature in kelvin\n",
@@ -808,10 +757,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusion flux through inert air\n",
- "\n",
- "# variable declaration \n",
- "# ammonia diffusing through inert air and air is non-diffusing\n",
+ " \n",
"ya1=0.1;\n",
"ya2=0;\n",
"T=293. #temperature in kelvin\n",
@@ -871,14 +817,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusion rate of acetic acid\n",
- "#position 1 moles molefraction weight\n",
- "# acetic acid 0.15 0.0288 9\n",
- "# water 5 0.9712 91\n",
- "\n",
- "#position 2 moles molefraction weight\n",
- "# aceitic acid 0.05 0.0092 4\n",
- "# water 5.389 0.9908 96\n",
+ " \n",
"# variable declaration \n",
"T=290.0; #temperature in kelvin\n",
"z=2*10**-3; #film thickness sorrounding the water\n",
@@ -933,9 +872,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusion flux of nitrogen\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"\n",
"ya1=0.2; #molefraction at pos.1\n",
"ya2=0.1; #molefraction at pos.2\n",
@@ -988,9 +925,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusion rate of loss of benzene\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"\n",
"pa1=0.2*10**5; #partial pressure at pos.1\n",
"pa2=0; #partial pressure at pos.2\n",
@@ -1037,9 +972,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate of diffusion of alcohol water vapour mixture\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"\n",
"ya2=0.1; #molefraction at pos.2\n",
"ya1=0.8; #molefraction at pos.1\n",
@@ -1093,9 +1026,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusion rate of ammonia\n",
- "\n",
- "# variable declaration \n",
+ " \n",
"\n",
"ya2=0; #molefraction at pos.2\n",
"ya1=0.1; #molefraction at pos.1\n",
@@ -1163,8 +1094,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#ate of evaporation\n",
- "\n",
+ " \n",
"# variable declaration \n",
"pa1=0.418*10**5; #partial pressure initially\n",
"pa2=0; #partial pressure of pure air\n",
@@ -1213,8 +1143,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusivity of the mixture in stefan tube of toluene in air\n",
- "\n",
+ " \n",
"# variable declaration \n",
"\n",
"#stefan tube experiment\n",
@@ -1271,9 +1200,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusion flux of a mixture of benzene and toluene\n",
- "\n",
- "#this is the case of equimolar counter diffusion as the latent heat of vaporisation are very close to each other\n",
+ " \n",
"# variable declaration \n",
"\n",
"T=(360); #temperature in kelvin\n",
@@ -1325,9 +1252,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusivity of the mixture in stefan tube\n",
- "\n",
- "#stefan tube experiment(pseudo steady state diffusion)\n",
+ " \n",
"# variable declaration \n",
"\n",
"Ml=92.; #molecular weight of toluene\n",
@@ -1382,8 +1307,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusivity of ccl4\n",
- "# variable declaration \n",
+ " \n",
"#variation in liquid level with respect to time is given below\n",
"%pylab inline\n",
"t=[26,185,456,1336,1958,2810,3829,4822,6385]\n",
@@ -1472,9 +1396,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate of transfer of nitrogen and hydrogen\n",
- "# variable declaration \n",
- "#it is the case of equimolar conter diffusion as the tube is perfectly sealed to two bulbs at the end and the pressure throughout is constant\n",
+ "\n",
"d=0.001;\n",
"area=3.14*(d/2)**2; #area of the bulb\n",
"T=298.; #temperature in kelvin \n",
@@ -1521,10 +1443,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusivity of methanol in carbon tetrachloride\n",
- "# variable declaration \n",
- "#using wilke and chang empirical correlation\n",
- "#Dab=(117.3*10**-18)*(phi*Mb)**0.5*T/(u*va**0.6);\n",
+ " \n",
"\n",
"T=288; #temperature in kelvin\n",
"Mb=32; #molecular weight of methanol\n",
@@ -1565,11 +1484,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusivity of methanol in water\n",
- "\n",
- "#using wilke and chang empirical correlation\n",
- "#Dab=(117.3*10**-18)*(phi*Mb)**0.5*T/(u*va**0.6);\n",
- "# variable declaration \n",
+ " \n",
"T=288.0; #temperature in kelvin\n",
"Mb=18.0; #molecular weight of methanol\n",
"phi=2.26; #association factor for solvent\n",
@@ -1609,8 +1524,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate of passage of hydrogen\n",
- "# variable declaration \n",
+ " \n",
"u=20.*10**-6; #viscosity in Ns/m**2\n",
"pt=2666.; #total pressure in N/m**2\n",
"pa1=pt; #pressure at 1\n",
diff --git a/Elements_Of_Mass_Transfer_Part_1/ch3.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch3.ipynb
index ab9df3da..42c74db2 100644
--- a/Elements_Of_Mass_Transfer_Part_1/ch3.ipynb
+++ b/Elements_Of_Mass_Transfer_Part_1/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:3744cb249ffd9e10c950b9110990dfac9cd54ad63b8fe61f5671a88b4822fb4c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate of sublimation\n",
"\n",
"# Variable Declaration \n",
"v=6.; #velocity in m/s\n",
@@ -80,8 +80,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# rate of sublimation of solid naphthalene\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"v=0.30; #velocity of parallelair in m/s\n",
"t=300; #temperature of air in kelvin\n",
@@ -134,8 +133,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#rate of absorption and mass transfer coefficient\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"# a is CO2 and b is water\n",
"p=2.; #total pressure at 1 in atm \n",
@@ -192,8 +190,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# mass transfer coefficient and film thickness\n",
- "# Variable Declaration \n",
+ " \n",
"NA=7.5*10**-7; #mass flux in gmol/cm**2*s\n",
"Dab=1.7*10**-5; #diffusivity if SO2 in water in cm**2/s\n",
"c=1./18.02; #concentration is density/molecular weight in gmol/cm**2*s\n",
@@ -241,8 +238,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# value of liquid and gas film coefficient\n",
- "# Variable Declaration \n",
+ "\n",
"Kg=2.72*10**-4; #overall gas phase mass transfer coefficient in kmol/m**2*S*atm\n",
"r_gas=0.85*(1/Kg); #given that gas phase resisitance is 0.85 times overall resistance\n",
"kg=1.0/r_gas; \n",
@@ -304,10 +300,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# concentration of ammonia and interfacial partial pressure\n",
- "# Variable Declaration \n",
- "#kg/kl=0.9=t \n",
- "#Pai=0.3672*Cai so; \n",
+ " \n",
"m=0.3672;\n",
"t=.9;\n",
" #Pai and Cai indicates interfacial pressure and conc.\n",
@@ -358,7 +351,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# diffusivity of gas overall transfer cofficient\n",
+ " \n",
"# Variable Declaration \n",
"D=.1;\n",
"l=3; # l is length of bubble in cm\n",
@@ -418,7 +411,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# overall gas phase mass transfer flux\n",
+ " \n",
"# Variable Declaration \n",
"Kg=7.36*10**-10;\n",
"p=1.013*10**5;\n",
@@ -543,7 +536,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# concentration of acid at outlet\n",
+ " \n",
"# Variable Declaration \n",
"Cas=1.521*10**-7;\n",
"v=1525; #velocity in m/s\n",
diff --git a/Elements_Of_Mass_Transfer_Part_1/ch5.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch5.ipynb
index 8e575f33..5acdca48 100644
--- a/Elements_Of_Mass_Transfer_Part_1/ch5.ipynb
+++ b/Elements_Of_Mass_Transfer_Part_1/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:2ee4e5f8137c7268975819ca4a31ef66c4a59076a802f56667cecd1c3f67b2a9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# properties through humidity chart\n",
+ " \n",
"\n",
"# Variable Declaration \n",
"#dry bulb temperature=50 and wet bulb temperature=35 \n",
@@ -125,8 +126,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# properties if DBT is 25 and WBT is 22\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"\n",
"#dry bulb temperature=25 and wet bulb temperature=22\n",
@@ -206,8 +206,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# properties of nitrogen oxygen vapour mixture\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"\n",
"#part(i)\n",
@@ -278,7 +277,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# properties at a temperature of 60 degree celcius\n",
+ " \n",
"\n",
"# Variable Declaration \n",
"\n",
@@ -348,7 +347,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# properties if DBT is 30 and WBT is 25\n",
+ " \n",
"\n",
"# Variable Declaration \n",
"\n",
@@ -421,8 +420,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# properties when dry bulb temperature is 55\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"\n",
"#part(i)\n",
@@ -485,13 +483,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of final temperature\n",
+ " \n",
"\n",
"# Variable Declaration \n",
"\n",
- "#given o.03 kg of water vapour/kg of dry air is contacted with water at an adiabatic temperature and humidified and cooled to 70 percent saturtion\n",
- " \n",
- "#from pyschometric chart\n",
+ " \n",
"ft=46; #final temperature in degree celcius\n",
"# Calculation and Result\n",
"print \"\\n final temperature is (from chart):%f degree celcius\"%ft\n",
@@ -528,8 +524,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of molal humidity\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"\n",
"pa1=4.24 #data: vapour pressure of water at 30degree = 4.24 kpa\n",
@@ -612,8 +607,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of relative humidity and humid volume\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"\n",
"#part(i)\n",
@@ -691,8 +685,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of film coefficient and make up water\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"\n",
"%pylab inline\n",
@@ -879,12 +872,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the make up water needed and the velocity of air\n",
- "\n",
- "# Variable Declaration \n",
- "\n",
- "#air leaves at 19 degree at fully saturated condition\n",
- "\n",
+ " \n",
+ " \n",
"T1=30.; #temperature at the inlet in degree celcius\n",
"T2=17.; #temperature at the exit in degree celcius\n",
"f=100000.; #flow rate of water in kg/hr\n",
@@ -940,11 +929,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the length of the chamber\n",
+ " \n",
"import math\n",
- "#horizontal spray with recirculated water . air is cooled and humidified to 34 and leaves at 90percent saturation\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"T1=65; #dry bulb temperature at the inlet in degree celcius\n",
"f=3.5; #flow rate of air in m**3/s\n",
diff --git a/Elements_Of_Mass_Transfer_Part_1/ch6.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch6.ipynb
index ab63d6e7..d6c3df87 100644
--- a/Elements_Of_Mass_Transfer_Part_1/ch6.ipynb
+++ b/Elements_Of_Mass_Transfer_Part_1/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:a29072d0985b8dbf41dbd6153642bf709b504655904069bc08292ea01d2d0ef9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the solid temp\n",
- "\n",
- "# Variable Declaration \n",
- "#air leaves the pre-heater of the dryer at 325K\n",
+ " \n",
"\n",
"H1=.005; #humidity of incoming air per kg of dry air\n",
"T1=25.; #wet bulb temperature\n",
@@ -89,9 +87,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying\n",
- "# Variable Declaration \n",
- "\n",
+ " \n",
"%pylab inline\n",
"#table X*100,(kgmoisture/kg dry solid) N*100 (kg moisture evaporated /hr*m**2)\n",
" \n",
@@ -174,8 +170,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# plots of drying rate curve\n",
- "\n",
+ " \n",
"#part(i)\n",
"#table wt of wet slab,kg -- 5.0 4.0 3.6 3.5 3.4 3.06 2.85\n",
"# drying rate,kg/m**2s-- 5.0 5.0 4.5 4.0 3.5 2.00 1.00\n",
@@ -247,8 +242,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# total time for drying\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"#part(ii)\n",
"w1=5.; #wet of wet solid\n",
@@ -305,10 +299,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the sheets\n",
"\n",
- "#table X-- .30 .20 .18 .15 .14 .11 .07 .05\n",
- "# N-- 1.22 1.22 1.14 .90 .80 .56 .22 .05\n",
"#let Ls/A=p\n",
"# Variable Declaration \n",
"p=48.; #mass of bone dry solid ais the drying surface\n",
@@ -377,26 +368,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation and plot of drying rates\n",
- "\n",
- "#table 6.5.1\n",
- "#S.NO. Time (Hr) weight of wet material(kg)\n",
- "# 0.0 5.314\n",
- "# 0.4 5.238\n",
- "# 0.8 5.162\n",
- "# 1.0 5.124\n",
- "# 1.4 5.048\n",
- "# 1.8 4.972\n",
- "# 2.2 4.895\n",
- "# 2.6 4.819\n",
- "# 3.0 4.743\n",
- "# 3.4 4.667\n",
- "# 4.2 4.524\n",
- "# 4.6 4.468\n",
- "# 5.0 4.426\n",
- "# 6.0 4.340\n",
- "# infinite 4.120\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"w=[5.314,5.238,5.162,5.124,5.048,4.972,4.895,4.819,4.743,4.667,4.524,4.468,4.426,4.340,4.120]\n",
"t=[0.0,0.4,0.8,1.0,1.4,1.8,2.2,2.6,3.0,3.4,4.2,4.6,5.0,6.0]\n",
@@ -503,8 +475,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# amount of air required\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"#part(ii)\n",
"w1=4.934; #weight after two hours\n",
@@ -548,8 +519,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# actual time of the falling peroid\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"#part(iii)\n",
"#let us choose the consistency of 11 and 13 readings\n",
@@ -597,9 +567,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time saved in drying\n",
- "\n",
- "#wooden cloth is dried from 100 to 10 and then th efinal moisture content is changed to 16 percent from 10;\n",
+ " \n",
"# Variable Declaration \n",
"Xcr=0.55; #crtical moisture content\n",
"X1=1; #moisture content on dry basis intially\n",
@@ -651,10 +619,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the sheets from 30 to 6 percent\n",
- "\n",
- "#assume rate of drying in the falling rate period is directly prporional to the free moisture content\n",
- "\n",
+ " \n",
"#Ls/ A*Nc is unknown;\n",
"# Variable Declaration \n",
"Xcr=0.14; #crtical moisture content\n",
@@ -705,7 +670,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the material\n",
+ " \n",
"# Variable Declaration \n",
"Ls=1000.; #mass of bone dry solid ais the drying surface\n",
"A=55.; #both upper surafce and lower surface are exposed\n",
@@ -751,14 +716,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time saved if air velocity is increased\n",
- "\n",
- "#tbar=(Ls/(A*Nc))*((Xcr-Xbar)*log((Xcr-Xbar)/(X2-Xbar)));\n",
- "#part(i)\n",
- "# assuming only surface evaporation and assuming air moves parellel to surface\n",
- "\n",
- "#Nc=G**0.71; G=V*d\n",
- "#so NC = k* V**.71\n",
+ " \n",
"# Variable Declaration \n",
"Ls=1000.; #mass of bone dry solid ais the drying surface\n",
"A=55.; #both upper surafce and lower surface are exposed\n",
@@ -810,10 +768,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the fibreboard\n",
- "\n",
- "#determine the drying condition of sample 0.3*0.3 size.sheet lost weight at rate of 10**-4 kg/s until the moisture fell to 60 percent\n",
- "# Variable Declaration \n",
+ " \n",
"x1=.75; #moisture content on wet basis\n",
"xbar=0.1; #equilllibrium moisture on dry basis\n",
"xcr=0.6; #critical moisture content\n",
@@ -861,11 +816,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the moist material\n",
- "\n",
- "#determine the drying condition of sample 0.3*0.3 size.sheet lost weight at rate of 10**-4 kg/s until the moisture fell to 60 percent\n",
- "\n",
- "#Ls/ A*Nc is unknown;\n",
+ " \n",
"# Variable Declaration \n",
"Xcr=0.16; #crtical moisture content\n",
"X1=.33; #moisture content on dry basis intially\n",
@@ -914,8 +865,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the slab from 65 to 30 percent\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"d=.22; #density of dry pulp in g/cc;\n",
"x1=.65; #moisture content on wet basis\n",
@@ -964,7 +914,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the slab\n",
+ "\n",
"# Variable Declaration \n",
"d=.22; #density of dry pulp in g/cc;\n",
"\n",
@@ -1015,9 +965,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the filter cake\n",
- "#Ls/ A*Nc is unknown;\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"import math\n",
"Xcr=0.14; #crtical moisture content\n",
@@ -1071,8 +1019,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the sheets\n",
- "# Variable Declaration \n",
+ " \n",
"d=450.; #density of dry pulp in kg/m**3;\n",
"thickness=0.05; #thickness in m**2\n",
"Ls=d*thickness; #mass of bone dry solid ais the drying surface\n",
@@ -1125,8 +1072,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# heater load per unit mass of dry air\n",
- "\n",
+ " \n",
"# Variable Declaration \n",
"t1=20.; #ambient air temperature \n",
"t2=70.; #exhaust air temperature \n",
@@ -1192,8 +1138,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# surface area of the roller\n",
- "# Variable Declaration \n",
+ " \n",
"m1=.12; #initial moisture content\n",
"dT=85.; #product of 85 degree is used in design purpose\n",
"U=1700.; #overall heat transfer coefficient\n",
@@ -1241,9 +1186,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# time for drying the sheets\n",
- "\n",
- "#moisture content reduces from 25 to 2\n",
+ " \n",
"\n",
"# Variable Declaration \n",
"r=7.5*10**-5; #constant drying rate in kg/s\n",
diff --git a/Elements_Of_Mass_Transfer_Part_1/ch7.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch7.ipynb
index 0c7c641e..9dcbb1df 100644
--- a/Elements_Of_Mass_Transfer_Part_1/ch7.ipynb
+++ b/Elements_Of_Mass_Transfer_Part_1/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:9c280dff7f4e1d5ae99e0fbadb3fa83466c67b9a415e20bbef76992fab6df294"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# total weight of the solution\n",
- "\n",
- "#let x be the weight of water in the quantity of solution needed\n",
- "# Variable Declaration \n",
+ " \n",
"c=.498; #solute content afetr crystallisation\n",
"W1=111.; #molecular weight of CaCl2\n",
"W2=219.; #molecular weight of CaCl2.6H2O\n",
@@ -80,9 +78,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# percentage saturation and yield\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"#part(i)\n",
"w1=1000.; #weight of solution to be cooled\n",
@@ -138,9 +134,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# temperature to which solution should be cooled\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"s1=19.75; #solubility at 70 degree per 100 gm of water\n",
"s2=16.5; #solubility at 50 degree per 100 gm of water\n",
@@ -186,9 +180,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# percentage saturation and yield\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"#part(i)\n",
"a1=146.; #solubility at 70 degree\n",
@@ -243,9 +235,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# the weight of Na2SO4 hydrate crystal\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"p1=.3; #percentage of the solute in the solution\n",
"w1=1000.; #weight of the solution taken\n",
@@ -291,9 +281,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# percentage yield of Na2CO3 hydrated crysta\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"s1=12.5; #solubility of Na2CO3 at 10 degree per 100 gm of water\n",
"p1=.3; #percentage of the solute in the solution\n",
@@ -343,10 +331,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# percentage yield of K2CO3 hydrated crystal\n",
- "\n",
- "# Variable Declaration \n",
- "\n",
+ " \n",
"s1=139.8; #solubility at 80 degree per 100 gm of water\n",
"s2=110.5; #solubility at 20 degree per 100 gm of water\n",
"w2=174.2; #molecular weight of K2CO3.10H2O\n",
@@ -393,9 +378,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# percentage yield FeSO4 hydrate crystal\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"s1=20.51; #solubility at 10 degree per 100 gm of water\n",
"w2=277.85; #molecular weight of FeSO4.7H2O\n",
@@ -439,10 +422,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# percentage saturation and weight of Cesium chloride crystal\n",
- "\n",
- "# Variable Declaration \n",
- "\n",
+ " \n",
"#part(i)\n",
"a1=229.7; #solubility at 60 degree\n",
"a2=174.7; #solubility at 60 degree\n",
@@ -495,9 +475,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# weight of Na2CO3hydrate needed to dissolve Na2CO3\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"s1=38.8; #solubility at 30 degree per 100 gm of water\n",
"s2=12.5; #solubility at 10 degree per 100 gm of water\n",
@@ -551,9 +529,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# weight of Na2CO3 hydrated formed\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"s1=35.; #percentage of solution\n",
"x1=6000.; #weight of Na2CO3 solution\n",
@@ -601,9 +577,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# feed rate of FeSO4 hydrated crystal produced per hour\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"C=1000.; #crystal formed in kg\n",
"hf=26.002; #enthalpy of the feed at 80 degree in cal/g\n",
@@ -664,9 +638,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# cooling water requirement\n",
- "\n",
- "# Variable Declaration \n",
+ " \n",
"\n",
"import math\n",
"C=800.; #crystal formed in kg/hr\n",
diff --git a/Elements_of_Electromagnetics/chapter_1.ipynb b/Elements_of_Electromagnetics/chapter_1.ipynb
index ae4e75b3..d44c3a90 100644
--- a/Elements_of_Electromagnetics/chapter_1.ipynb
+++ b/Elements_of_Electromagnetics/chapter_1.ipynb
@@ -1,420 +1,381 @@
-{
- "metadata": {
- "name": "chapter_1.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 1: Vector Analysis<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 1.1, Page number: 8<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "If A= 1Oa_x - 4a_y + 6a_z and B == 2a_x + a_y, find: \n",
- "(a) the component of A along a_y ,\n",
- "(b) the magnitude of 3A - B,\n",
- "(c) a unit vector along A + 2B. '''\n",
- "\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "A=array([10,-4,6]) \n",
- "B=array([2,1,0])\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Ay=dot(A,ay) #Component of A along y direction\n",
- "l=scipy.sqrt(dot(3*A-B,3*A-B)) #Magnitude of the vector 3A-B\n",
- "\n",
- " #Defining the x,y and z components of the unit vector along A+2B\n",
- " \n",
- "ux=round(dot(A+2*B,ax)/scipy.sqrt(dot(A+2*B,A+2*B)),4)\n",
- "uy=round(dot(A+2*B,ay)/scipy.sqrt(dot(A+2*B,A+2*B)),4)\n",
- "uz=round(dot(A+2*B,az)/scipy.sqrt(dot(A+2*B,A+2*B)),4)\n",
- "\n",
- "u=array([ux,uy,uz])\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The component of A along y direction is',Ay\n",
- "print 'Magnitude of 3A-B =',round(l,2)\n",
- "print 'Unit vector along A+2B is',u"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The component of A along y direction is -4\n",
- "Magnitude of 3A-B = 35.74\n",
- "Unit vector along A+2B is [ 0.9113 -0.1302 0.3906]\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 1.2, Page number: 9<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Points P and Q are located at (0, 2, 4) and (- 3, 1, 5). Calculate \n",
- "(a) The position vector P \n",
- "(b) The distance vector from P to Q \n",
- "(c) The distance between P and Q \n",
- "(d) A vector parallel to PQ with magntude of 10 '''\n",
- "\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "P=array([0,2,4]) \n",
- "Q=array([-3,1,5])\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "origin=array([0,0,0]) #Defining the origin\n",
- "\n",
- "#Calculations\n",
- "\n",
- "PosP=P-origin #The position vector P\n",
- "Dpq=Q-P #The distance vector from P to Q\n",
- "l=scipy.sqrt(dot(Dpq,Dpq)) #Magnitude of the distance vector from P to Q\n",
- "\n",
- " #Defining the x,y and z components of the unit vector along Dpq\n",
- " \n",
- "ux=round(dot(Dpq,ax)/l,4)\n",
- "uy=round(dot(Dpq,ay)/l,4)\n",
- "uz=round(dot(Dpq,az)/l,4)\n",
- "\n",
- "vect=array([ux*10,uy*10,uz*10]) #Vector parallel to PQ with magntude of 10\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The position vector P is',PosP\n",
- "print 'The distance vector from P to Q is',Dpq\n",
- "print 'The distance between P and Q is',round(l,3)\n",
- "print 'Vector parallel to PQ with magntude of 10 is',vect"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The position vector P is [0 2 4]\n",
- "The distance vector from P to Q is [-3 -1 1]\n",
- "The distance between P and Q is 3.317\n",
- "Vector parallel to PQ with magntude of 10 is [-9.045 -3.015 3.015]\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 1.3, Page number: 10<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A river flows southeast at 10 km/hr and a boat flows upon it \n",
- "with its bow pointed in the direction of travel. A man walks upon\n",
- "the deck at 2 km/hr in a direction to the right and perpendicular\n",
- "to the direction of the boat's movement. \n",
- "Find the velocity of the man with respect to the earth. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "vriver=10 #Speed of river in km/hr\n",
- "vman=2 #Speed of man relative to boat in km/hr\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "\n",
- "#Calculations\n",
- "\n",
- " #Velocity of boat\n",
- "\n",
- "Vboat=vriver*(scipy.cos(scipy.pi/4)*ax- \n",
- " scipy.sin(scipy.pi/4)*ay) \n",
- " \n",
- " #Relative velocity of man with respect to boat\n",
- "\n",
- "Vrelman=vman*(-scipy.cos(scipy.pi/4)*ax- \n",
- " scipy.sin(scipy.pi/4)*ay) \n",
- " \n",
- " #Absolute velocity of man\n",
- " \n",
- "Vabs=Vboat+Vrelman\n",
- " \n",
- "mag=scipy.sqrt(dot(Vabs,Vabs)) #Magnitude of the velocity of man\n",
- "Vabsx=dot(Vabs,ax) #X component of absolute velocity\n",
- "Vabsy=dot(Vabs,ay) #Y component of absolute velocity\n",
- "angle=scipy.arctan(Vabsy/Vabsx)*180/scipy.pi #Angle made with east in degrees\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The velocity of the man is',round(mag,1),'km/hr at an angle of'\n",
- "print -round(angle,1),'degrees south of east'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The velocity of the man is 10.2 km/hr at an angle of\n",
- "56.3 degrees south of east\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 1.4, Page number: 17<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Given vectors A = 3a_x + 4a_y + a_z and B = 2a_y - 5a_z , \n",
- "find the angle between A and B. '''\n",
- " \n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "A=array([3,4,1])\n",
- "B=array([0,2,-5])\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "\n",
- "#Calculations\n",
- "\n",
- "magA=scipy.sqrt(dot(A,A)) #Magnitude of A\n",
- "magB=scipy.sqrt(dot(B,B)) #Magnitude of B\n",
- "angle=scipy.arccos(dot(A,B)/(magA*magB)) #Angle between A and B in radians\n",
- "angled=angle*180/scipy.pi #Angle between A and B in degrees\n",
- "\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The angle between A and B =',round(angled,2),'degrees'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The angle between A and B = 83.73 degrees\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 1.5, Page number: 17<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Three field quantities are given by \n",
- "P = 2a_x - a_z \n",
- "Q = 2a_x - a_y + 2a_z \n",
- "R = 2a_x - 3a_y + a_z\n",
- "\n",
- "Determine \n",
- "\n",
- "(a) (P + Q) X (P - Q) \n",
- "(b) Q.(R X P)\n",
- "(c) P.(Q X R)\n",
- "(d) Sin(theta_QR) \n",
- "(e) P X (Q X R) \n",
- "(f) A unit vector perpendicular to both Q and R \n",
- "(g) The component of P along Q '''\n",
- "\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "P=array([2,0,-1])\n",
- "Q=array([2,-1,2])\n",
- "R=array([2,-3,1])\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "\n",
- "#Calculations\n",
- "\n",
- "ansa=cross((P+Q),(P-Q))\n",
- "ansb=dot(Q,cross(R,P))\n",
- "ansc=dot(P,cross(Q,R))\n",
- "lqxr=scipy.sqrt(dot(cross(Q,R),cross(Q,R))) #Magnitude of QXR\n",
- "lq=scipy.sqrt(dot(Q,Q)) #Magnitude of Q\n",
- "lr=scipy.sqrt(dot(R,R)) #Magnitude of R\n",
- "ansd=lqxr/(lq*lr)\n",
- "anse=cross(P,cross(Q,R))\n",
- "\n",
- "#Finding unit vector perpendicular to Q and R\n",
- "\n",
- "ux=dot(cross(Q,R),ax)/lqxr #X component of the unit vector\n",
- "uy=dot(cross(Q,R),ay)/lqxr #Y component of the unit vector\n",
- "uz=dot(cross(Q,R),az)/lqxr #Z component of the unit vector\n",
- "\n",
- "ansf=array([round(ux,3),round(uy,3),round(uz,3)])\n",
- "\n",
- "ansg=round((float(dot(P,Q))/dot(Q,Q)),4)*Q\n",
- "\n",
- "\n",
- "#Results\n",
- "\n",
- "print '(P+Q)X(P-Q) =',ansa\n",
- "print 'Q.(R X P) =',ansb\n",
- "print 'P.(Q X R) =',ansc\n",
- "print 'Sin(theta_QR) =',round(ansd,4)\n",
- "print 'P X (Q X R) =',anse\n",
- "print 'A unit vector perpendicular to both Q and R =',ansf\n",
- "print 'The component of P along Q =',ansg\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "(P+Q)X(P-Q) = [ 2 12 4]\n",
- "Q.(R X P) = 14\n",
- "P.(Q X R) = 14\n",
- "Sin(theta_QR) = 0.5976\n",
- "P X (Q X R) = [2 3 4]\n",
- "A unit vector perpendicular to both Q and R = [ 0.745 0.298 -0.596]\n",
- "The component of P along Q = [ 0.4444 -0.2222 0.4444]\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 1.7, Page number: 21<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Show that points P1(5,2,-4), P2(1,1,2), and P3( -3,0,8) all \n",
- "lie on a straight line. Determine the shortest distance between \n",
- "the line and point P4(3,- 1,0). '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "P1=array([5,2,-4])\n",
- "P2=array([1,1,2])\n",
- "P3=array([-3,0,8])\n",
- "P4=array([3,-1,0])\n",
- "\n",
- "#Calculations\n",
- "\n",
- "R12=P2-P1; #Distance vector from P1 to P2\n",
- "R13=P3-P1; #Distance vector from P1 to P3\n",
- "R14=P4-P1; #Distance vector from P1 to P4\n",
- "s=cross(R12,R13)\n",
- "x=cross(R14,R12)\n",
- "d=scipy.sqrt(dot(x,x))/scipy.sqrt(dot(R12,R12)) #Distance from line to P4 \n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The cross product of the distance vectors R12 and R14 =',s\n",
- "print 'So they are along same direction and hence P1, P2 and P3 are collinear.'\n",
- "print 'The shortest distance from the line to point P4 =',round(d,3)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The cross product of the distance vectors R12 and R14 = [0 0 0]\n",
- "So they are along same direction and hence P1, P2 and P3 are collinear.\n",
- "The shortest distance from the line to point P4 = 2.426\n"
- ]
- }
- ],
- "prompt_number": 6
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:eb36bd65b4a83ec123fa29550d3c2d667495d3d3383848faa667d8b6a5548ac3"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 1: Vector Analysis<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1.1, Page number: 8<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "A=array([10,-4,6]) \n",
+ "B=array([2,1,0])\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Ay=dot(A,ay) #Component of A along y direction\n",
+ "l=scipy.sqrt(dot(3*A-B,3*A-B)) #Magnitude of the vector 3A-B\n",
+ "\n",
+ " #Defining the x,y and z components of the unit vector along A+2B\n",
+ " \n",
+ "ux=round(dot(A+2*B,ax)/scipy.sqrt(dot(A+2*B,A+2*B)),4)\n",
+ "uy=round(dot(A+2*B,ay)/scipy.sqrt(dot(A+2*B,A+2*B)),4)\n",
+ "uz=round(dot(A+2*B,az)/scipy.sqrt(dot(A+2*B,A+2*B)),4)\n",
+ "\n",
+ "u=array([ux,uy,uz])\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The component of A along y direction is',Ay\n",
+ "print 'Magnitude of 3A-B =',round(l,2)\n",
+ "print 'Unit vector along A+2B is',u"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The component of A along y direction is -4\n",
+ "Magnitude of 3A-B = 35.74\n",
+ "Unit vector along A+2B is [ 0.9113 -0.1302 0.3906]\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1.2, Page number: 9<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "P=array([0,2,4]) \n",
+ "Q=array([-3,1,5])\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "origin=array([0,0,0]) #Defining the origin\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "PosP=P-origin #The position vector P\n",
+ "Dpq=Q-P #The distance vector from P to Q\n",
+ "l=scipy.sqrt(dot(Dpq,Dpq)) #Magnitude of the distance vector from P to Q\n",
+ "\n",
+ " #Defining the x,y and z components of the unit vector along Dpq\n",
+ " \n",
+ "ux=round(dot(Dpq,ax)/l,4)\n",
+ "uy=round(dot(Dpq,ay)/l,4)\n",
+ "uz=round(dot(Dpq,az)/l,4)\n",
+ "\n",
+ "vect=array([ux*10,uy*10,uz*10]) #Vector parallel to PQ with magntude of 10\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The position vector P is',PosP\n",
+ "print 'The distance vector from P to Q is',Dpq\n",
+ "print 'The distance between P and Q is',round(l,3)\n",
+ "print 'Vector parallel to PQ with magntude of 10 is',vect"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The position vector P is [0 2 4]\n",
+ "The distance vector from P to Q is [-3 -1 1]\n",
+ "The distance between P and Q is 3.317\n",
+ "Vector parallel to PQ with magntude of 10 is [-9.045 -3.015 3.015]\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1.3, Page number: 10<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "vriver=10 #Speed of river in km/hr\n",
+ "vman=2 #Speed of man relative to boat in km/hr\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ " #Velocity of boat\n",
+ "\n",
+ "Vboat=vriver*(scipy.cos(scipy.pi/4)*ax- \n",
+ " scipy.sin(scipy.pi/4)*ay) \n",
+ " \n",
+ " #Relative velocity of man with respect to boat\n",
+ "\n",
+ "Vrelman=vman*(-scipy.cos(scipy.pi/4)*ax- \n",
+ " scipy.sin(scipy.pi/4)*ay) \n",
+ " \n",
+ " #Absolute velocity of man\n",
+ " \n",
+ "Vabs=Vboat+Vrelman\n",
+ " \n",
+ "mag=scipy.sqrt(dot(Vabs,Vabs)) #Magnitude of the velocity of man\n",
+ "Vabsx=dot(Vabs,ax) #X component of absolute velocity\n",
+ "Vabsy=dot(Vabs,ay) #Y component of absolute velocity\n",
+ "angle=scipy.arctan(Vabsy/Vabsx)*180/scipy.pi #Angle made with east in degrees\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The velocity of the man is',round(mag,1),'km/hr at an angle of'\n",
+ "print -round(angle,1),'degrees south of east'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity of the man is 10.2 km/hr at an angle of\n",
+ "56.3 degrees south of east\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1.4, Page number: 17<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "A=array([3,4,1])\n",
+ "B=array([0,2,-5])\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "magA=scipy.sqrt(dot(A,A)) #Magnitude of A\n",
+ "magB=scipy.sqrt(dot(B,B)) #Magnitude of B\n",
+ "angle=scipy.arccos(dot(A,B)/(magA*magB)) #Angle between A and B in radians\n",
+ "angled=angle*180/scipy.pi #Angle between A and B in degrees\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The angle between A and B =',round(angled,2),'degrees'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The angle between A and B = 83.73 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1.5, Page number: 17<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "P=array([2,0,-1])\n",
+ "Q=array([2,-1,2])\n",
+ "R=array([2,-3,1])\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "ansa=cross((P+Q),(P-Q))\n",
+ "ansb=dot(Q,cross(R,P))\n",
+ "ansc=dot(P,cross(Q,R))\n",
+ "lqxr=scipy.sqrt(dot(cross(Q,R),cross(Q,R))) #Magnitude of QXR\n",
+ "lq=scipy.sqrt(dot(Q,Q)) #Magnitude of Q\n",
+ "lr=scipy.sqrt(dot(R,R)) #Magnitude of R\n",
+ "ansd=lqxr/(lq*lr)\n",
+ "anse=cross(P,cross(Q,R))\n",
+ "\n",
+ "#Finding unit vector perpendicular to Q and R\n",
+ "\n",
+ "ux=dot(cross(Q,R),ax)/lqxr #X component of the unit vector\n",
+ "uy=dot(cross(Q,R),ay)/lqxr #Y component of the unit vector\n",
+ "uz=dot(cross(Q,R),az)/lqxr #Z component of the unit vector\n",
+ "\n",
+ "ansf=array([round(ux,3),round(uy,3),round(uz,3)])\n",
+ "\n",
+ "ansg=round((float(dot(P,Q))/dot(Q,Q)),4)*Q\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print '(P+Q)X(P-Q) =',ansa\n",
+ "print 'Q.(R X P) =',ansb\n",
+ "print 'P.(Q X R) =',ansc\n",
+ "print 'Sin(theta_QR) =',round(ansd,4)\n",
+ "print 'P X (Q X R) =',anse\n",
+ "print 'A unit vector perpendicular to both Q and R =',ansf\n",
+ "print 'The component of P along Q =',ansg\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(P+Q)X(P-Q) = [ 2 12 4]\n",
+ "Q.(R X P) = 14\n",
+ "P.(Q X R) = 14\n",
+ "Sin(theta_QR) = 0.5976\n",
+ "P X (Q X R) = [2 3 4]\n",
+ "A unit vector perpendicular to both Q and R = [ 0.745 0.298 -0.596]\n",
+ "The component of P along Q = [ 0.4444 -0.2222 0.4444]\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1.7, Page number: 21<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "P1=array([5,2,-4])\n",
+ "P2=array([1,1,2])\n",
+ "P3=array([-3,0,8])\n",
+ "P4=array([3,-1,0])\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "R12=P2-P1; #Distance vector from P1 to P2\n",
+ "R13=P3-P1; #Distance vector from P1 to P3\n",
+ "R14=P4-P1; #Distance vector from P1 to P4\n",
+ "s=cross(R12,R13)\n",
+ "x=cross(R14,R12)\n",
+ "d=scipy.sqrt(dot(x,x))/scipy.sqrt(dot(R12,R12)) #Distance from line to P4 \n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The cross product of the distance vectors R12 and R14 =',s\n",
+ "print 'So they are along same direction and hence P1, P2 and P3 are collinear.'\n",
+ "print 'The shortest distance from the line to point P4 =',round(d,3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The cross product of the distance vectors R12 and R14 = [0 0 0]\n",
+ "So they are along same direction and hence P1, P2 and P3 are collinear.\n",
+ "The shortest distance from the line to point P4 = 2.426\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_10.ipynb b/Elements_of_Electromagnetics/chapter_10.ipynb
index ed7744f3..86a61c5f 100644
--- a/Elements_of_Electromagnetics/chapter_10.ipynb
+++ b/Elements_of_Electromagnetics/chapter_10.ipynb
@@ -1,566 +1,521 @@
-{
- "metadata": {
- "name": "chapter_10.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 10: Electromagnetic Wave Propagation<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 10.1, Page number: 416<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The elcctric field in free space is given by \n",
- "E=50 cos(10^8t + Bx) a_y V/m \n",
- "(a) Find the direction of wave propagation. \n",
- "(b) Calculate B and the time it takes to travel a distance of lambda/2. \n",
- "(c) Sketch the wave at t = 0, T/4, and T/2. '''\n",
- "\n",
- "import scipy\n",
- "from pylab import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "w=10**8 \n",
- "c=3.0*10**8\n",
- "\n",
- "#Calculations\n",
- "\n",
- "T=2*scipy.pi/w #timeperiod of the wave in sec\n",
- "B=(w/c) #in rad/m\n",
- "lam=2*scipy.pi/B #wavelength in m\n",
- "t1=lam*10**9/(2*c) #time taken to travel half the wavelength in ns \n",
- "\n",
- "x=arange(-6*scipy.pi,6*scipy.pi,0.1)\n",
- "\n",
- "t=0\n",
- "E=50*scipy.cos(10**8*t+x*w/c)\n",
- "\n",
- "subplot(3,1,1)\n",
- "xlabel(\"x\")\n",
- "ylabel(\"E for t=0\")\n",
- "plot(x,E,'r')\n",
- "\n",
- "subplot(3,1,2)\n",
- "t=T/4\n",
- "E=50*scipy.cos(10**8*t+x*w/c)\n",
- "xlabel(\"x\")\n",
- "ylabel(\"E for t=T/4\")\n",
- "plot(x,E)\n",
- "\n",
- "subplot(3,1,3)\n",
- "t=T/2\n",
- "E=50*scipy.cos(10**8*t+x*w/c)\n",
- "xlabel(\"x\")\n",
- "ylabel(\"E for t=T/2\")\n",
- "plot(x,E,'g')\n",
- "show()\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Since the argument of cosine function is positive, '\n",
- "print 'the wave is propagating in the negative x direction.'\n",
- "print' B =',round(B,4),'rad/m'\n",
- "print 'Time taken to travel a distance of lambda/2 =',round(t1,2),'n sec'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "display_data",
- "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEICAYAAABF82P+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzsnXlcVNX7xz+DG5bmhjurggyLMqgsmho7pCIq+hVzK7EU\nNVyyfmYlZmXhjpZroqlZmaXigoIimyaoWCjhlii448aObM/vj5MTKOswM/fOcN6vF6/g0sz5cL1z\nn3vOeZ7PIyEiAofD4XA4L6AjtAAOh8PhiBMeIDgcDodTKTxAcDgcDqdSeIDgcDgcTqXwAMHhcDic\nSuEBgsPhcDiVIliAyMvLw6RJk9CjRw9YWloiISEBOTk58PHxgaGhIYYPH47c3Fyh5HE4HE6DR7AA\nERQUBENDQyQnJyM5ORlSqRTr16+HoaEhrl69Cn19fWzYsEEoeRwOh9PgESxAHDt2DAsWLICuri4a\nN26MVq1aITExEf7+/mjWrBkmT56MhIQEoeRxOBxOg0ciRCX1rVu34ObmBkdHR6SmpmLkyJEIDAyE\nVCrF5cu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IbppLKyMnh7e+Pu3bu4c+cOPD09cfr0aa5jMUyn\nsbuYGMYAFi9ejObmZqhUKjg4OGDhwoVcR2KYTmMFgmEMoKWlBcOGDYOFhQWOHDnC5k9nngjsEhPD\nGMCNGzdw584d3L59GyqVius4DGMQ7AyCYQxg0qRJmD59Oi5cuIArV64gMTGR60gM02m8Gc2VYczV\n9u3b0b17d0RERECj0WDUqFEoKCiAv78/19EYplPYGQTDMAyjE+uDYBiGYXRiBYJhGIbRiRUIhmEY\nRidWIBiGYRidWIFgGIZhdGIFgmEYhtHp/wBv2SibrE7lggAAAABJRU5ErkJggg==\n",
- "text": [
- "<matplotlib.figure.Figure at 0x60587d0>"
- ]
- },
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Since the argument of cosine function is positive, \n",
- "the wave is propagating in the negative x direction.\n",
- " B = 0.3333 rad/m\n",
- "Time taken to travel a distance of lambda/2 = 31.42 n sec\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 10.2, Page number: 428<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A lossy dielectric has an intrinsic impedance of 200 /30degree ohms at\n",
- "a particular frequency. If, at that frequency, the plane wave propagating \n",
- "through the dielectric has the magnetic field component \n",
- "\n",
- "H = 10 e^-ax cos(wt-0.5x)a_y A/m \n",
- "find E and a. Determine the skin depth and wave polarization. '''\n",
- "\n",
- "import cmath\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Ho=10 \n",
- "n=200*scipy.exp(1)**(1j*scipy.pi/6) \n",
- "b=0.5\n",
- "\n",
- "#Calclations\n",
- "\n",
- "Eo=n*Ho #amplitude of electric field in kV/m\n",
- "P=scipy.arctan(scipy.sqrt(3)) \n",
- "a=b*((scipy.sqrt(((1+(scipy.tan(P))**2)**0.5)-1))/(scipy.sqrt(((1+(scipy.tan(P)\n",
- ")**2)**0.5)+1)))\n",
- "delta=1/a\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'E has the same form as H except for amplitude and phase.'\n",
- "print 'The amplitude and phase of E =',Eo,'kV/m'\n",
- "print '= magnitude of 2000 and angle of pi/6'\n",
- "print 'a =',round(a,4),'Np/m'\n",
- "print 'Skin depth =',round(delta,3),'m'\n",
- "print 'The polarization of wave is in z direction since it has an z component.'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "E has the same form as H except for amplitude and phase.\n",
- "The amplitude and phase of E = (1732.05080757+1000j) kV/m\n",
- "= magnitude of 2000 and angle of pi/6\n",
- "a = 0.2887 Np/m\n",
- "Skin depth = 3.464 m\n",
- "The polarization of wave is in z direction since it has an z component.\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 10.3, Page number: 430<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "In a loss]ess medium for which eta = 60 pi, mu_r = 1 and \n",
- "H= -0.1 Cos(Wt - z)a_x + 0.5 sin(wt - z)a_y A/m, \n",
- "calculate epison_r, w and E. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "B=1\n",
- "n=60*scipy.pi \n",
- "Ur=1 #relative permeability\n",
- "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Er=Uo*Ur/(n**2*Eo) #relative permittivity\n",
- "w=B/scipy.sqrt(Eo*Er*Uo*Ur) #in rad/sec\n",
- "eps=Eo*Er #permittivity of the medium in Farad/m\n",
- "H1o=-0.1\n",
- "H2o=0.5\n",
- "Ex=H2o/(eps*w) #amplitude of x component of E in V/m\n",
- "Ey=H1o/(eps*w) #amplitude of y component of E in V/m\n",
- "\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'er =',Er\n",
- "print 'w =',w,'rad/sec'\n",
- "print 'E =',round(Ex,2),'sin(wt-z)ax +',round(-Ey,2),'cos(wt-z)ay V/m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "er = 4.0\n",
- "w = 150000000.0 rad/sec\n",
- "E = 94.25 sin(wt-z)ax + 18.85 cos(wt-z)ay V/m\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 10.4, Page number: 432<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A uniform plane wave propagating in a medium has \n",
- "E = 2e^(-az) sin(10^8t-Bz)a_y V/m. \n",
- "If the medium is characterized by epsilon_r=1, mu_r=20 and sigma=3 mhos/m, \n",
- "find a,B and H. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "E=2 #amplitude of E in V/m\n",
- "sigma=3 #in mhos/m\n",
- "w=10**8 #in rad/sec\n",
- "Ur=20 #relative permeability\n",
- "Eo=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n",
- "Er=1 #relative permittivity\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "\n",
- "#Calculations\n",
- "\n",
- "a=round(scipy.sqrt(Uo*Ur*w*sigma/2),1) #in Np/m\n",
- "B=a #rad/m\n",
- "theta=scipy.arctan(sigma/(w*Eo*Er))*0.5 #in radians\n",
- "thetad=round(theta*180/scipy.pi,0) #in degrees\n",
- "H=E/(scipy.sqrt(Uo*Ur*w/sigma))*10**3 #amplitude of H in mA/m\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'alpha =',a,'Np/m'\n",
- "print 'beta =',B,'rad/m'\n",
- "print 'H =',round(H,1),'e^ (',a,'z ) sin(wt - Bz -',thetad,') mA/m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "alpha = 61.4 Np/m\n",
- "beta = 61.4 rad/m\n",
- "H = 69.1 e^ ( 61.4 z ) sin(wt - Bz - 45.0 ) mA/m\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 10.6, Page number: 434<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "For the copper coaxial cable of Figure 7.12, let a = 2 mm, b = 6 mm\n",
- "and t = 1 mm. Calculate the resistance of 2 m length of the cablc at dc\n",
- "and at 100 MHz. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- " \n",
- "a=2*10**-3 #in m\n",
- "b=6*10**-3 #in m \n",
- "t=10**-3 #in m\n",
- "l=2 #in m\n",
- "c=5.8*10**7 #conductivity in seimens\n",
- "f=100*10**6 #frequency in Hz\n",
- "mu=4*scipy.pi*10**-7 #permeability of free space\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Ri=l/(c*scipy.pi*a*a) #dc resistance of inner cable in ohms\n",
- "Ro=l/(c*scipy.pi*((b+t)**2-b**2)) #dc resistance of outer cable in ohms\n",
- "Rdc=Ro+Ri #total dc resistance in ohms\n",
- "\n",
- "Ria=round(l/(2*scipy.pi*a)*scipy.sqrt(scipy.pi*f*mu/c),1)\n",
- "Roa=round(l/(2*scipy.pi*b)*scipy.sqrt(scipy.pi*f*mu/c),4)\n",
- "Rac=Ria+Roa #ac resistance in ohms\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Rdc =',round(Rdc*10**3,3),'m ohms'\n",
- "print 'Rac =',round(Rac,4),'ohms'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Rdc = 3.588 m ohms\n",
- "Rac = 0.5384 ohms\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 10.7, Page number: 439<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "In a nonmagnetic medium \n",
- "E= 4 sin (2pi X 10^7t - 0.8x) a_z V/m \n",
- "Find\n",
- "(a) epsilon_r,eta\n",
- "(b) The time-average power carried by the wave \n",
- "(c) The total power crossing 100 cm^2 of plane 2x + y = 5 '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "a=0 #alpha in m^-1\n",
- "b=0.8 #beta in m^-1\n",
- "Eo=10**-9/(36*scipy.pi) #permittivity of free space in farad/m\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "Ur=1 #relative permeability of medium\n",
- "w=2*scipy.pi*10**7 #omega in rad/s\n",
- "Eamp=4 #amplitude of the field in V/m\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Er=b**2/(Uo*Eo*w*w) #relative permittivity of the medium\n",
- "n=scipy.sqrt(Uo/(Eo*Er)) #eta in ohms\n",
- "Pav=Eamp**2/(2*n)*ax #average power in W/m^2\n",
- "an=(2*ax+ay)/scipy.sqrt(5) #normal to the plane\n",
- "S=100*10**-4*an #area in m^2\n",
- "P=dot(Pav,S)*10**6 #power through the plane in micro W\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Er=',round(Er,2)\n",
- "print 'eta= ',round(n,1),'ohms'\n",
- "print 'The time-average power =',round(dot(Pav,ax)*10**3,0),'ax mW/m^2'\n",
- "print 'The total power crossing 100 cm^2 of the plane =',round(P,2),'micro W'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Er= 14.59\n",
- "eta= 98.7 ohms\n",
- "The time-average power = 81.0 ax mW/m^2\n",
- "The total power crossing 100 cm^2 of the plane = 725.0 micro W\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 10.10, Page number: 458<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "An EM wave travels in free space with the electric field component \n",
- "E =:100 e^j(0.866x-0.5z) ax V/m \n",
- "Determine \n",
- "(a) w and lambda\n",
- "(b) The magnetic field component \n",
- "(c) The time average power in the wave '''\n",
- "\n",
- "import scipy \n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "kx=0 #in m^-1\n",
- "ky=0.866 #in m^-1\n",
- "kz=0.5 #in m^-1\n",
- "Eo=10**-9/(36*scipy.pi) #permittivity of free space in farad/m\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "c=1/(scipy.sqrt(Uo*Eo)) #speed of light in m/s\n",
- "kvect=kx*ax+ky*ay+kz*az #propogation vector in m^-1\n",
- "Eo=100 #amplitude of electric field\n",
- "\n",
- "#Calculations\n",
- "\n",
- "k=round(scipy.sqrt(kx*kx+ky*ky+kz*kz),0) #magnitude of k in m^-1\n",
- "w=k*c #omega in rad/sec\n",
- "lam=2*scipy.pi/k #wavelength in m\n",
- "Ho=cross(kvect,Eo*ax*10)/(Uo*w) #amplitude of magnetic field in mA/m\n",
- "Hoy=round(dot(Ho,ay),2) #y component of Ho\n",
- "Hoz=round(dot(Ho,az),1) #z component of Ho\n",
- "Hr=array([0,Hoy,Hoz]) #Ho with components rounded off\n",
- "P=Eo**2/(2*120*scipy.pi)*kvect #average power in W/m^2\n",
- "Py=round(dot(P,ay),2) #y component of P\n",
- "Pz=round(dot(P,az),3) #z component of P\n",
- "Pr=array([0,Py,Pz]) #P with components rounded off\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'w =',w,'rad/sec'\n",
- "print 'lambda =',round(lam,3),'m'\n",
- "print 'The magnetic field component =',Hr,'e^j(0.866x-0.5z) mA/m'\n",
- "print 'The time average power in the wave =',Pr,'W/m^2'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "w = 300000000.0 rad/sec\n",
- "lambda = 6.283 m\n",
- "The magnetic field component = [ 0. 1.33 -2.3 ] e^j(0.866x-0.5z) mA/m\n",
- "The time average power in the wave = [ 0. 11.49 6.631] W/m^2\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 10.11, Page number: 459"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A uniform plane wave in air with \n",
- "\u001f\u001d",
- "E = 8 cos(wt - 4x - 3z) ay V/m \n",
- "\u001f\u001d",
- "is incident on a dielectric slah (z>= 0) with mur= 1.0\u001f epsilonr = 2.5\u001f ,sigma=0. Find \n",
- "(a) The polarization of the wave \n",
- "(b) The angle of incidence \n",
- "(c) The reflected E field \n",
- "(d) The transmitted H field '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "Ei=8 #incident wave amplitude\n",
- "k=5 #propogation constant\n",
- "Eo=10**-9/36*scipy.pi #permittivity of free space\n",
- "Erel=2.5 #relative permittivity\n",
- "muo=4*scipy.pi*10**-7 #permeability of free space\n",
- "mur=1 #relative permeability\n",
- "c=3*10**8 #speed of light\n",
- "etao=377\n",
- "\n",
- "#Calculations\n",
- "\n",
- "w=k*c #frequency in rad\n",
- "theta=scipy.arctan(4/3.0) #angle of incidence in rad\n",
- "eta1=etao\n",
- "eta2=377/scipy.sqrt(2.5)\n",
- "thetai=scipy.arcsin(sin(theta)/scipy.sqrt(2.5))\n",
- "gamm=(eta2*cos(theta)-eta1*cos(thetai))/(eta2*cos(theta)+eta1*cos(thetai))\n",
- "Er=Ei*gamm #reflected E field amplitude in V/m\n",
- "kt=w*scipy.sqrt(mur*Erel)/c\n",
- "tao=2*eta2*cos(theta)/((eta2*cos(theta)+eta1*cos(thetai)))\n",
- "Et=tao*Ei*ay\n",
- "Ht=cross((4*ax+6.819*az)/(eta2*kt),Et)*10**3\n",
- "Htx=round(dot(Ht,ax),2)\n",
- "Hty=round(dot(Ht,ay),2)\n",
- "Htz=round(dot(Ht,az),2)\n",
- "Htc=array([Htx,Hty,Htz]) #transmitted H field amplitude\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Polarisation is perpendicular polarization'\n",
- "print 'Angle of incidence is ',round(180*theta/scipy.pi,2),'degrees'\n",
- "print 'Er =',round(Er,3),'cos(',w,'t - 4x + 3z) V/m'\n",
- "print 'Ht =',Htc,'cos(',w,'t - 4x - 6.819z) mA/m'\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Polarisation is perpendicular polarization\n",
- "Angle of incidence is 53.13 degrees\n",
- "Er = -3.112 cos( 1500000000 t - 4x + 3z) V/m\n",
- "Ht = [-17.68 0. 10.37] cos( 1500000000 t - 4x - 6.819z) mA/m\n"
- ]
- }
- ],
- "prompt_number": 25
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:cdf18287acc82150753d10351b24abe70a503e3715e5a7f68621619ab02a6a02"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 10: Electromagnetic Wave Propagation<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 10.1, Page number: 416<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from pylab import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "w=10**8 \n",
+ "c=3.0*10**8\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "T=2*scipy.pi/w #timeperiod of the wave in sec\n",
+ "B=(w/c) #in rad/m\n",
+ "lam=2*scipy.pi/B #wavelength in m\n",
+ "t1=lam*10**9/(2*c) #time taken to travel half the wavelength in ns \n",
+ "\n",
+ "x=arange(-6*scipy.pi,6*scipy.pi,0.1)\n",
+ "\n",
+ "t=0\n",
+ "E=50*scipy.cos(10**8*t+x*w/c)\n",
+ "\n",
+ "subplot(3,1,1)\n",
+ "xlabel(\"x\")\n",
+ "ylabel(\"E for t=0\")\n",
+ "plot(x,E,'r')\n",
+ "\n",
+ "subplot(3,1,2)\n",
+ "t=T/4\n",
+ "E=50*scipy.cos(10**8*t+x*w/c)\n",
+ "xlabel(\"x\")\n",
+ "ylabel(\"E for t=T/4\")\n",
+ "plot(x,E)\n",
+ "\n",
+ "subplot(3,1,3)\n",
+ "t=T/2\n",
+ "E=50*scipy.cos(10**8*t+x*w/c)\n",
+ "xlabel(\"x\")\n",
+ "ylabel(\"E for t=T/2\")\n",
+ "plot(x,E,'g')\n",
+ "show()\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Since the argument of cosine function is positive, '\n",
+ "print 'the wave is propagating in the negative x direction.'\n",
+ "print' B =',round(B,4),'rad/m'\n",
+ "print 'Time taken to travel a distance of lambda/2 =',round(t1,2),'n sec'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "metadata": {},
+ "output_type": "display_data",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEICAYAAABF82P+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJ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exc+dOhIaG\ncpzob8899xwAoKioCFVVVcjJyYGfnx/HqR7W1NSkvfyhVCqRlZWFkJAQjlO1z8/PD8nJyVCpVEhO\nTsaLL77IdSSd+LZvEhGioqLg6emJefPmaZfr1Z7GqV+GJRKJyNHRUedtogkJCeTi4kLu7u5UVFTE\nYUqi1NRUsre3px49epCNjQ2FhIQQEdHevXvJw8ODvL29KSwsjAoLC3mZk4hf7dlaZGQkeXl50dCh\nQ2n+/Pm8uxOnoKCAxGIxubi40Nq1a7mOo9OFCxfI29ubvL29KSAggLZs2cJ1JK2IiAiys7Ojbt26\nkb29PSUnJ/PyNtf/5ezatSvZ29vTli1beLdvFhcXk0AgIG9v7za33urTnmY1YRDDMAxjOmZxiYlh\nGIYxPVYgGIZhGJ1YgWAYhmF0YgWCYRiG0YkVCIbppLKyMnh7e+Pu3bu4c+cOPD09cfr0aa5jMUyn\nsbuYGMYAFi9ejObmZqhUKjg4OGDhwoVcR2KYTmMFgmEMoKWlBcOGDYOFhQWOHDnC5k9nngjsEhPD\nGMCNGzdw584d3L59GyqVius4DGMQ7AyCYQxg0qRJmD59Oi5cuIArV64gMTGR60gM02m8Gc2VYczV\n9u3b0b17d0RERECj0WDUqFEoKCiAv78/19EYplPYGQTDMAyjE+uDYBiGYXRiBYJhGIbRiRUIhmEY\nRidWIBiGYRidWIFgGIZhdGIFgmEYhtHp/wBv2SibrE7lggAAAABJRU5ErkJggg==\n",
+ "text": [
+ "<matplotlib.figure.Figure at 0x60587d0>"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Since the argument of cosine function is positive, \n",
+ "the wave is propagating in the negative x direction.\n",
+ " B = 0.3333 rad/m\n",
+ "Time taken to travel a distance of lambda/2 = 31.42 n sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 10.2, Page number: 428<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import cmath\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Ho=10 \n",
+ "n=200*scipy.exp(1)**(1j*scipy.pi/6) \n",
+ "b=0.5\n",
+ "\n",
+ "#Calclations\n",
+ "\n",
+ "Eo=n*Ho #amplitude of electric field in kV/m\n",
+ "P=scipy.arctan(scipy.sqrt(3)) \n",
+ "a=b*((scipy.sqrt(((1+(scipy.tan(P))**2)**0.5)-1))/(scipy.sqrt(((1+(scipy.tan(P)\n",
+ ")**2)**0.5)+1)))\n",
+ "delta=1/a\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'E has the same form as H except for amplitude and phase.'\n",
+ "print 'The amplitude and phase of E =',Eo,'kV/m'\n",
+ "print '= magnitude of 2000 and angle of pi/6'\n",
+ "print 'a =',round(a,4),'Np/m'\n",
+ "print 'Skin depth =',round(delta,3),'m'\n",
+ "print 'The polarization of wave is in z direction since it has an z component.'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "E has the same form as H except for amplitude and phase.\n",
+ "The amplitude and phase of E = (1732.05080757+1000j) kV/m\n",
+ "= magnitude of 2000 and angle of pi/6\n",
+ "a = 0.2887 Np/m\n",
+ "Skin depth = 3.464 m\n",
+ "The polarization of wave is in z direction since it has an z component.\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 10.3, Page number: 430<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "B=1\n",
+ "n=60*scipy.pi \n",
+ "Ur=1 #relative permeability\n",
+ "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Er=Uo*Ur/(n**2*Eo) #relative permittivity\n",
+ "w=B/scipy.sqrt(Eo*Er*Uo*Ur) #in rad/sec\n",
+ "eps=Eo*Er #permittivity of the medium in Farad/m\n",
+ "H1o=-0.1\n",
+ "H2o=0.5\n",
+ "Ex=H2o/(eps*w) #amplitude of x component of E in V/m\n",
+ "Ey=H1o/(eps*w) #amplitude of y component of E in V/m\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'er =',Er\n",
+ "print 'w =',w,'rad/sec'\n",
+ "print 'E =',round(Ex,2),'sin(wt-z)ax +',round(-Ey,2),'cos(wt-z)ay V/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "er = 4.0\n",
+ "w = 150000000.0 rad/sec\n",
+ "E = 94.25 sin(wt-z)ax + 18.85 cos(wt-z)ay V/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 10.4, Page number: 432<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "E=2 #amplitude of E in V/m\n",
+ "sigma=3 #in mhos/m\n",
+ "w=10**8 #in rad/sec\n",
+ "Ur=20 #relative permeability\n",
+ "Eo=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n",
+ "Er=1 #relative permittivity\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "a=round(scipy.sqrt(Uo*Ur*w*sigma/2),1) #in Np/m\n",
+ "B=a #rad/m\n",
+ "theta=scipy.arctan(sigma/(w*Eo*Er))*0.5 #in radians\n",
+ "thetad=round(theta*180/scipy.pi,0) #in degrees\n",
+ "H=E/(scipy.sqrt(Uo*Ur*w/sigma))*10**3 #amplitude of H in mA/m\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'alpha =',a,'Np/m'\n",
+ "print 'beta =',B,'rad/m'\n",
+ "print 'H =',round(H,1),'e^ (',a,'z ) sin(wt - Bz -',thetad,') mA/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "alpha = 61.4 Np/m\n",
+ "beta = 61.4 rad/m\n",
+ "H = 69.1 e^ ( 61.4 z ) sin(wt - Bz - 45.0 ) mA/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 10.6, Page number: 434<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ " \n",
+ "a=2*10**-3 #in m\n",
+ "b=6*10**-3 #in m \n",
+ "t=10**-3 #in m\n",
+ "l=2 #in m\n",
+ "c=5.8*10**7 #conductivity in seimens\n",
+ "f=100*10**6 #frequency in Hz\n",
+ "mu=4*scipy.pi*10**-7 #permeability of free space\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Ri=l/(c*scipy.pi*a*a) #dc resistance of inner cable in ohms\n",
+ "Ro=l/(c*scipy.pi*((b+t)**2-b**2)) #dc resistance of outer cable in ohms\n",
+ "Rdc=Ro+Ri #total dc resistance in ohms\n",
+ "\n",
+ "Ria=round(l/(2*scipy.pi*a)*scipy.sqrt(scipy.pi*f*mu/c),1)\n",
+ "Roa=round(l/(2*scipy.pi*b)*scipy.sqrt(scipy.pi*f*mu/c),4)\n",
+ "Rac=Ria+Roa #ac resistance in ohms\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Rdc =',round(Rdc*10**3,3),'m ohms'\n",
+ "print 'Rac =',round(Rac,4),'ohms'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rdc = 3.588 m ohms\n",
+ "Rac = 0.5384 ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 10.7, Page number: 439<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "a=0 #alpha in m^-1\n",
+ "b=0.8 #beta in m^-1\n",
+ "Eo=10**-9/(36*scipy.pi) #permittivity of free space in farad/m\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "Ur=1 #relative permeability of medium\n",
+ "w=2*scipy.pi*10**7 #omega in rad/s\n",
+ "Eamp=4 #amplitude of the field in V/m\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Er=b**2/(Uo*Eo*w*w) #relative permittivity of the medium\n",
+ "n=scipy.sqrt(Uo/(Eo*Er)) #eta in ohms\n",
+ "Pav=Eamp**2/(2*n)*ax #average power in W/m^2\n",
+ "an=(2*ax+ay)/scipy.sqrt(5) #normal to the plane\n",
+ "S=100*10**-4*an #area in m^2\n",
+ "P=dot(Pav,S)*10**6 #power through the plane in micro W\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Er=',round(Er,2)\n",
+ "print 'eta= ',round(n,1),'ohms'\n",
+ "print 'The time-average power =',round(dot(Pav,ax)*10**3,0),'ax mW/m^2'\n",
+ "print 'The total power crossing 100 cm^2 of the plane =',round(P,2),'micro W'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Er= 14.59\n",
+ "eta= 98.7 ohms\n",
+ "The time-average power = 81.0 ax mW/m^2\n",
+ "The total power crossing 100 cm^2 of the plane = 725.0 micro W\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 10.10, Page number: 458<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy \n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "kx=0 #in m^-1\n",
+ "ky=0.866 #in m^-1\n",
+ "kz=0.5 #in m^-1\n",
+ "Eo=10**-9/(36*scipy.pi) #permittivity of free space in farad/m\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "c=1/(scipy.sqrt(Uo*Eo)) #speed of light in m/s\n",
+ "kvect=kx*ax+ky*ay+kz*az #propogation vector in m^-1\n",
+ "Eo=100 #amplitude of electric field\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "k=round(scipy.sqrt(kx*kx+ky*ky+kz*kz),0) #magnitude of k in m^-1\n",
+ "w=k*c #omega in rad/sec\n",
+ "lam=2*scipy.pi/k #wavelength in m\n",
+ "Ho=cross(kvect,Eo*ax*10)/(Uo*w) #amplitude of magnetic field in mA/m\n",
+ "Hoy=round(dot(Ho,ay),2) #y component of Ho\n",
+ "Hoz=round(dot(Ho,az),1) #z component of Ho\n",
+ "Hr=array([0,Hoy,Hoz]) #Ho with components rounded off\n",
+ "P=Eo**2/(2*120*scipy.pi)*kvect #average power in W/m^2\n",
+ "Py=round(dot(P,ay),2) #y component of P\n",
+ "Pz=round(dot(P,az),3) #z component of P\n",
+ "Pr=array([0,Py,Pz]) #P with components rounded off\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'w =',w,'rad/sec'\n",
+ "print 'lambda =',round(lam,3),'m'\n",
+ "print 'The magnetic field component =',Hr,'e^j(0.866x-0.5z) mA/m'\n",
+ "print 'The time average power in the wave =',Pr,'W/m^2'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "w = 300000000.0 rad/sec\n",
+ "lambda = 6.283 m\n",
+ "The magnetic field component = [ 0. 1.33 -2.3 ] e^j(0.866x-0.5z) mA/m\n",
+ "The time average power in the wave = [ 0. 11.49 6.631] W/m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.11, Page number: 459"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "Ei=8 #incident wave amplitude\n",
+ "k=5 #propogation constant\n",
+ "Eo=10**-9/36*scipy.pi #permittivity of free space\n",
+ "Erel=2.5 #relative permittivity\n",
+ "muo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "mur=1 #relative permeability\n",
+ "c=3*10**8 #speed of light\n",
+ "etao=377\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "w=k*c #frequency in rad\n",
+ "theta=scipy.arctan(4/3.0) #angle of incidence in rad\n",
+ "eta1=etao\n",
+ "eta2=377/scipy.sqrt(2.5)\n",
+ "thetai=scipy.arcsin(sin(theta)/scipy.sqrt(2.5))\n",
+ "gamm=(eta2*cos(theta)-eta1*cos(thetai))/(eta2*cos(theta)+eta1*cos(thetai))\n",
+ "Er=Ei*gamm #reflected E field amplitude in V/m\n",
+ "kt=w*scipy.sqrt(mur*Erel)/c\n",
+ "tao=2*eta2*cos(theta)/((eta2*cos(theta)+eta1*cos(thetai)))\n",
+ "Et=tao*Ei*ay\n",
+ "Ht=cross((4*ax+6.819*az)/(eta2*kt),Et)*10**3\n",
+ "Htx=round(dot(Ht,ax),2)\n",
+ "Hty=round(dot(Ht,ay),2)\n",
+ "Htz=round(dot(Ht,az),2)\n",
+ "Htc=array([Htx,Hty,Htz]) #transmitted H field amplitude\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Polarisation is perpendicular polarization'\n",
+ "print 'Angle of incidence is ',round(180*theta/scipy.pi,2),'degrees'\n",
+ "print 'Er =',round(Er,3),'cos(',w,'t - 4x + 3z) V/m'\n",
+ "print 'Ht =',Htc,'cos(',w,'t - 4x - 6.819z) mA/m'\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Polarisation is perpendicular polarization\n",
+ "Angle of incidence is 53.13 degrees\n",
+ "Er = -3.112 cos( 1500000000 t - 4x + 3z) V/m\n",
+ "Ht = [-17.68 0. 10.37] cos( 1500000000 t - 4x - 6.819z) mA/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_11.ipynb b/Elements_of_Electromagnetics/chapter_11.ipynb
index 28188144..dede4d2e 100644
--- a/Elements_of_Electromagnetics/chapter_11.ipynb
+++ b/Elements_of_Electromagnetics/chapter_11.ipynb
@@ -1,673 +1,613 @@
-{
- "metadata": {
- "name": "chapter_11.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 11: Transmission Lines<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 11.1, Page number: 482<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "An air line has characteristic impedance of 70 ohms and phase constant\n",
- "of 3 rad/m at 100 MHz. Calculate the inductance per meter and the \n",
- "capacitance per meter of the line. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "R=0\n",
- "G=0\n",
- "a=0\n",
- "Ro=70 #characteristic impedence in ohms\n",
- "B=3 #phase constant in rad/sec\n",
- "f=100*10**6 #frequency in Hz\n",
- "w=2*scipy.pi*f #omega in rad/sec\n",
- "\n",
- "#Calculations\n",
- "\n",
- "C=B/(w*Ro) #capacitance in F/m\n",
- "L=Ro*Ro*C #inductance in H/m\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'inductance per meter =',round(L*10**9,1),'nH/m'\n",
- "print 'capacitance per meter =',round(C*10**12,1),'pF/m'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "inductance per meter = 334.2 nH/m\n",
- "capacitance per meter = 68.2 pF/m\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 11.2, Page number: 483<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A distortion less line has Z_o = 60 ohms, a = 20 mNp/m, u = 0.6c, where c\n",
- "is the speed of light in a vacuum. Find R, L, G, C and lambda at 100 MHz. '''\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Zo=60 #in ohms\n",
- "a=20*10**-3 #in Np/m\n",
- "u=0.6*3*10**8 #in m/sec\n",
- "f=100*10**6 #in Hz\n",
- "\n",
- "#Calculations\n",
- "\n",
- "R=a*Zo #resistance in ohms/m\n",
- "L=Zo/u #inductance in H/m\n",
- "G=a*a/R #conductivity in S/m\n",
- "C=1/(u*Zo) #capacitance in F/m\n",
- "lam=u/f #wavelentgh in m\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'R =',R,'ohm/m'\n",
- "print 'L =',round(L*10**9,0),'nH/m'\n",
- "print 'G =',round(G*10**6,0),'micro S/m'\n",
- "print 'C =',round(C*10**12,2),'pF/m'\n",
- "print 'lambda =',lam,'m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "R = 1.2 ohm/m\n",
- "L = 333.0 nH/m\n",
- "G = 333.0 micro S/m\n",
- "C = 92.59 pF/m\n",
- "lambda = 1.8 m\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 11.3, Page number: 490<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A certain transmission line operating at w = 10^6 rad/sec has a=8 dB/m,\n",
- "B = 1 rad/m, and Zo = 60 + j40 ohms, and is 2 m long. If the line is \n",
- "connected to a source of 10/0 V, Zg = 40 ohms and terminated by a load of\n",
- "20 + j50 ohms, deternline \n",
- "\n",
- "(a) The input impedance \n",
- "(b) The sending-end current \n",
- "(c) The current at the middle of the line '''\n",
- "\n",
- "import scipy\n",
- "import cmath\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "w=10**6 #omega in rad/sec\n",
- "B=1 #phase factor in rad/m\n",
- "a=8.0/8.686 #alpha in Np/m\n",
- "Y=a+1j #in m^-1\n",
- "l=2 #length in m\n",
- "Vg=10 #source voltage in volts\n",
- "Zo=60+40j #in ohms\n",
- "Zg=40 #in ohms\n",
- "Zl=20+50j #load impedance in ohms\n",
- "\n",
- "#Calculations\n",
- "\n",
- "s=scipy.tanh(Y*l)\n",
- "Zin=Zo*(Zl+Zo*s)/(Zo+Zl*s) #input impedance in ohms\n",
- "Zinr=round(Zin.real,2) #real part of Zin rounded to 2 decimal places\n",
- "Zini=round(Zin.imag,2) #imaginary part of Zin rounded to 2 decimal places\n",
- "Io=Vg/(Zin+Zg) #in A\n",
- "absIo=round(abs(Io),6) #absolute value of Io rounded to 6 decimal place\n",
- "Ior=Io.real #real part of Io\n",
- "Ioi=Io.imag #imaginary part of Io\n",
- "angIo=scipy.arctan(Ioi/Ior)*180/scipy.pi \n",
- " #in degrees\n",
- "Vo=Zin*Io\n",
- "Vop=(Vo+Zo*Io)/2\n",
- "Vom =(Vo-Zo*Io)/2\n",
- "Im=((Vop*scipy.e**(-Y)/Zo))-((Vom*scipy.e**Y)/Zo)\n",
- " #current at the middle in A\n",
- "absIm=round(abs(Im),5) #absolute value of Im rounded to 6 decimal place\n",
- "Imr=Im.real #real part of Im \n",
- "Imi=Im.imag #imaginary part of Im\n",
- "angIm=360+scipy.arctan(Imi/Imr)*180/scipy.pi \n",
- " #in degrees\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The input impedance =',Zinr,'+',Zini,'j ohms'\n",
- "print 'The sending-end current is'\n",
- "print 'mod =',absIo*10**3,'mA, angle =',round(angIo,2),'degrees'\n",
- "print 'The current at the middle is'\n",
- "print 'mod =',absIm*10**3,'mA, angle =',round(angIm,0),'degrees'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The input impedance = 60.25 + 38.79 j ohms\n",
- "The sending-end current is\n",
- "mod = 93.03 mA, angle = -21.15 degrees\n",
- "The current at the middle is\n",
- "mod = 34.92 mA, angle = 281.0 degrees\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 11.4, Page number: 499<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A 30-m long loss less transmission line with Zo = 50 ohms operating at 2 MHz\n",
- "is terminated with a load Zl = 60 + j40 ohms. If u = 0.6c on the line, find \n",
- "\n",
- "(a)The reflection coefficient r \n",
- "(b)The standing wave ratio s \n",
- "(c)The input impedance '''\n",
- "\n",
- "import scipy\n",
- "import cmath\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "l=30 #length in m\n",
- "Zo=50 #in ohms\n",
- "f=2*10**6 #frequency in Hz\n",
- "Zl=60+40j #load impedence in ohms\n",
- "u=0.6*3*10**8 #in m/s\n",
- "w=2*scipy.pi*f #omega in rad/sec\n",
- "\n",
- "#Calculations\n",
- "\n",
- "T=(Zl-Zo)/(Zl+Zo) #reflection coefficient\n",
- "ang=scipy.arctan(T.imag/T.real)*180/scipy.pi #argument of T is degrees\n",
- "s=(1+abs(T))/(1-abs(T)) #standing wave ratio \n",
- "B=w/u #propogation vector in m^-1\n",
- "Zin=Zo*(Zl+Zo*scipy.tan(B*l)*1j)/(Zo+Zl*scipy.tan(B*l)*1j)\n",
- "Zinr=round(Zin.real,2) #real part of Zin rounded to 2 decimal places\n",
- "Zini=round(Zin.imag,2) #imaginary part of Zin rounded to 2 decimal places\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The reflection coefficient is'\n",
- "print 'mod =',round(abs(T),4),'angle =',round(ang,0),'degrees'\n",
- "print 'The standing wave ratio s =',round(s,3)\n",
- "print 'The input impedance =',Zinr,'+',Zini,'j ohms'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The reflection coefficient is\n",
- "mod = 0.3523 angle = 56.0 degrees\n",
- "The standing wave ratio s = 2.088\n",
- "The input impedance = 23.97 + 1.35 j ohms\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 11.5, Page number: 501<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A 100 + j150-ohms load is connected to a 75-ohm lossless line. Find: \n",
- "\n",
- "(a) r \n",
- "(b) s \n",
- "(c) The load admittance Yl\n",
- "(d) Zin at O.4 lambda from the load \n",
- "(e) The locations of V max and V min with respect to the load if the line is\n",
- "O.6 lambda long \n",
- "(f) Zin at the generator '''\n",
- "\n",
- "\n",
- "import scipy\n",
- "import cmath\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Zl=100+150j #load impedance in ohms\n",
- "Zo=75 #impedance of line in ohms\n",
- "B=2*scipy.pi \n",
- "\n",
- "#Calculations\n",
- "\n",
- "T=(Zl-Zo)/(Zl+Zo)\n",
- "angT=scipy.arctan(T.imag/T.real)*180/scipy.pi \n",
- "s=(1+abs(T))/(1-abs(T))\n",
- "Yl=(1/Zl)*10**3 #admittance in mS\n",
- "Ylr=round(Yl.real,2) #real part of Yl rounded to 2 decimal places\n",
- "Yli=round(Yl.imag,2) #imaginary part of Yl rounded to 2 decimal places\n",
- "l1=0.4\n",
- "Zin=Zo*(Zl+Zo*scipy.tan(B*l1)*1j)/(Zo+Zl*scipy.tan(B*l1)*1j)\n",
- "Zinr=round(Zin.real,2) #real part of Zin rounded to 2 decimal places\n",
- "Zini=round(Zin.imag,2) #imaginary part of Zin rounded to 2 decimal places\n",
- "\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'r is mod =',round(abs(T),3),',angle =',round(angT,0),'degrees'\n",
- "print 's =',round(s,2)\n",
- "print 'The load admittance Yl =',Ylr,'+',Yli,'j mS'\n",
- "print 'Zin at O.4 lambda from the load =',Zinr,'+',Zini,'j ohms'\n",
- "#part (e) and (f) don't require computations"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "r is mod = 0.66 ,angle = 40.0 degrees\n",
- "s = 4.88\n",
- "The load admittance Yl = 3.08 + -4.62 j mS\n",
- "Zin at O.4 lambda from the load = 21.96 + 47.61 j ohms\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 11.6, Page number: 509<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "With an unknown load connected to a slotted air line, s = 2 is recorded by \n",
- "a standing wave indicator and minima are found at 11 cm, 19 cm, . . . on \n",
- "the scale. When the load is replaced by a short circuit, the minima are at\n",
- "16 cm, 24 cm,. . . . If Zo = 50 ohms, calculate lambda,f, and ZL '''\n",
- "\n",
- "import scipy\n",
- "import cmath\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "s=2\n",
- "l1=11 \n",
- "l2=19\n",
- "ma=24 \n",
- "mi=16\n",
- "u=3*10**8 #speed of wave in m/s\n",
- "Zo=50 #in ohms\n",
- "\n",
- "#Calculations\n",
- "\n",
- "l=(l2-l1)*2 #lambda in cm\n",
- "f=(u/l)*10**-7 #frequency in GHz\n",
- "L=(24-19)/l #Let us assume load is at 24cm\n",
- "zl=1.4+0.75j # by smith chart\n",
- "Zl=Zo*zl #ZL in ohms\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'lambda =',l,'cm'\n",
- "print 'f =',f,'GHz'\n",
- "print 'ZL =',Zl,'ohms'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "lambda = 16 cm\n",
- "f = 1.875 GHz\n",
- "ZL = (70+37.5j) ohms\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 11.7, Page number: 510<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Antenna with impedance 40 + j30 ohms is to be matched to a 100-ohm lossless \n",
- "line with a shorted stub. Determine \n",
- "(a) The required stub admittance \n",
- "(b) The distance between the stub and the antenna \n",
- "(c) The stub length \n",
- "(d) The standing wave ratio on each ratio of the system '''\n",
- "\n",
- "import scipy\n",
- "import cmath\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Zo=100 #in ohms\n",
- "Zl=40+30j #in ohms\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Yo=1.0/Zo #in S\n",
- "yl=Zo/Zl\n",
- "ys1=1.04j #By smith chart\n",
- "ys2=-1.04j #By smith chart\n",
- "Ys1=Yo*ys1 #in S\n",
- "Ys2=Yo*ys2 #in S\n",
- "la=round(0.5-(62-(-39))/720.0,2) #in units of lambda\n",
- "lb=round((62-39)/720.0,3) #in units of lambda\n",
- "da=round(88/720.0,4) #in units of lambda\n",
- "db=round(272/720.0,4) #in units of lambda\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The required stub admittance values in mS are',Ys1*1000,'and',Ys2*1000\n",
- "print 'The distance between stub and antenna at A =',la,'in units of lambda'\n",
- "print 'The distance between stub and antenna at B =',lb,'in units of lambda'\n",
- "print 'The stub lengths =',da,'and',db,'in units of lambda'\n",
- "print 'Part (d) is done using smith chart'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The required stub admittance values in mS are 10.4j and -10.4j\n",
- "The distance between stub and antenna at A = 0.36 in units of lambda\n",
- "The distance between stub and antenna at B = 0.032 in units of lambda\n",
- "The stub lengths = 0.1222 and 0.3778 in units of lambda\n",
- "Part (d) is done using smith chart\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 11.9, Page number: 521"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A 75 ohm transmission line of length 60 m is terminated by a 100 ohm load. If a rectangular \n",
- "pulse of width 5 micro sec and magnitude 4V is sent out by the generator connected to the line, \n",
- "sketch I(0, t) and I( l, t) for 0 < t < 15 microS. Take Zg = 25 ohm and u = 0.1 c. '''\n",
- "\n",
- "import scipy\n",
- "import matplotlib.pyplot as plt\n",
- "\n",
- "#Variable Declarataion\n",
- "\n",
- "zo=75 #in ohms\n",
- "zg=25 #in ohms\n",
- "zl=100 #in ohms\n",
- "vg=4 #in volts\n",
- "l=60 #in m\n",
- "c=3*10**8 #speed of light in m/s\n",
- "u=0.1*c #in m/s\n",
- "\n",
- "#Calculations\n",
- "\n",
- "gammag=(zg-zo)/(zg+zo)\n",
- "gammal=(zl-zo)/(zl+zo)\n",
- "Vo=zo*vg/(zo+zg) #in V\n",
- "t1=l/u #in micro sec\n",
- "Io=vg/(zo+zg) #in mA\n",
- "\n",
- "#Results\n",
- "\n",
- "t1=[0,4,5,8,9,12,13,15]\n",
- "I1=[40,31.43,-8.571,-7.959,0.6123,0.5685,-0.0438,-0.438]\n",
- "fig = plt.figure()\n",
- "ax = fig.add_subplot(111)\n",
- "ax.step(t1,I1,where='post')\n",
- "ax.set_xlabel('Time (micro s)')\n",
- "ax.set_ylabel(r'I(0,t) in mA')\n",
- "plt.show()\n",
- "\n",
- "t2=[0,2,6,7,10,11,14]\n",
- "I2=[0,34.3,31.9,-2.46,-2.28,0.176,0.176]\n",
- "fig = plt.figure()\n",
- "ax = fig.add_subplot(111)\n",
- "ax.step(t2,I2,where='post')\n",
- "ax.set_xlabel('Time (micro s)')\n",
- "ax.set_ylabel(r'I(l,t) in mA')\n",
- "plt.show()\n",
- "\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "display_data",
- "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEMCAYAAADeYiHoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGzFJREFUeJzt3X1wVNXhxvFn0SZgQUQtIMaQFCibgJAFQhIYwqqAVYxh\nFEaiQEdCRaryoradsdRGfzO0Gq1CLQlVY0dRUaqOjIIg6vJSQjaY2CImApUIqMibms0kwRDP7w+G\nLSEnDeTt3pDvZ2ZnsjfZex83sk/OuWfveowxRgAAnKaT0wEAAO5EQQAArCgIAIAVBQEAsKIgAABW\nFAQAwMrRgqitrZXP51NaWpokKRQKKT09XdHR0Zo0aZIqKiqcjAcAHZqjBbF48WLFx8fL4/FIknJy\nchQdHa1du3YpKipKubm5Ts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GrUKP35z3/WV199FS6jzz77TAMHDmxyRkCiIHAOOvmX86nz/qd+ferPnH5/\n6dKl+uCDD8InnPPz8+vtPyEhoc6l50/fT0N/uZ/cHhsbqwceeEDTpk1TQkKCHn/8cWuu3NxcZWdn\nKzU1VaNHj653Fdva2lpNnz5dQ4YM0TXXXKOsrKzwqKi0tFQ+n8+aAzhTLHMFmiAlJUVr167VhRde\n6HSUeo4dO6ZRo0Zp27ZtTDOhWRhBAE3wy1/+Ui+++KLTMazefPNNZWRkUA5oNkYQAAArRhAAACsK\nAgBgRUEAAKwoCACAFQUBALCiIAAAVv8PIrVuLX2NSRcAAAAASUVORK5CYII=\n",
- "text": [
- "<matplotlib.figure.Figure at 0x5f89c90>"
- ]
- },
- {
- "output_type": "display_data",
- "png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEMCAYAAADJQLEhAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHKVJREFUeJzt3Xlw1PXh//HXoiRAWRBECBiSMFw5OLLGsAkMmcUK2tgQ\nqDI19WBIam1ia2mEsWOpBp3SagZBqYKjxo6DIRWPQquAOHUFBHOYcBjDkUoQbQyXkI0JkYT9/eGX\n/IjkDpvPZ/k8HzOZ2d1kP/sib/J57ed6r83r9XoFALCsXkYHAAAYiyIAAIujCADA4igCALA4igAA\nLI4iAACL82kRnD17Vk6nU9HR0YqLi9OKFSskSVlZWQoODpbD4ZDD4dDmzZt9GQMA0Aabr68jqK2t\nVb9+/VRfX6+YmBi9/fbbys3Nld1uV2Zmpi9fGgDQAT7fNdSvXz9JUk1NjRoaGhQYGChJ4jo2ADCH\nq339AufPn5fD4VBpaalWrlypkJAQSdKqVau0fv16zZ07VxkZGbLb7c2eZ7PZfB0NAK5InX6j7e0h\nhw8f9kZERHiLi4u9VVVV3vPnz3tPnz7tve+++7zZ2dmX/HwPRvOJxx57zOgI3eLP+f05u9dLfqP5\ne/6urDt77KyhsLAwJSYmKj8/X0OHDpXNZtP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1cvxcfHKyoqSqNHj1b//v01cuRI\nffbZZ81+dv369brzzjs1YsQISdI111zT9L1f/OIXCggI0P/+9z+dO3dOTqdTffv21V133aWNGzde\nkuXGG29USkqK3njjjWYTGI4ePVoHDhzozq8MkMQWAa4wF+aqCggIUGBgoAIDA5vuf/fdd2psbNS1\n116rkpKSdpf1w8NnF1bmAQEBzVbsAQEBqq+vb/f5F1wohx9+v7WfX7t2rXbu3Km1a9cqOzu7aX7/\n8+fPc3wAlwVbBLhitHfeg9frVVBQkEaNGqU333xTXq9X586du+TdvPT95HUVFRVdznLHHXcoLy9P\nX331lSTpm2++uSTn9ddfr8DAQBUUFKiurk55eXmXzFbr9XpVUVGhqVOn6umnn1ZlZWVT6Xz++eca\nP358lzMCF1AE8EsX3glfvF/+4tsX/8wP7z///PP64IMPmg787tq165LlR0dHN5sO/YfLae2d+IXH\nR40apUceeUR33323oqOjtXz58hZzrVmzRtnZ2UpISNC0adMumS21sbFR99xzjyZNmqQf//jHysrK\natrK2b9/vxwOR4s5gM7g9FGgFfHx8dqyZYsGDBhgdJRL1NfXa+rUqSoqKmL3ELqNLQKgFffdd59e\ne+01o2O0aMOGDUpJSaEEcFmwRQAAFscWAQBYHEUAABZHEQCAxVEEAGBxFAEAWBxFAAAW9/8AjjI6\n8BSLXDoAAAAASUVORK5CYII=\n",
- "text": [
- "<matplotlib.figure.Figure at 0x6342070>"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 11.10, Page number: 527<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A certain microstrip line has fused quartz (Er=3.8) as a substrate. \n",
- "If the ratio of line width to substrate thickness is w/h = 4.5, determine \n",
- "\n",
- "(a) The effective relative permittivity of the substrate \n",
- "(b) The characteristic impedance of the line \n",
- "(c) The wavelength of the line at 10 GHz '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Er=3.8 #relative permittivity\n",
- "c=3*10**8 #speed of wave in m/s\n",
- "r=4.5 #ratio of line width to substrate thickness\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Eeff=((Er+1)/2)+((Er-1)/(2*(1+12/r)**0.5))\n",
- "Zo=(120*scipy.pi)/((r+1.393+(0.667*scipy.log(r+1.444)))*((Eeff)**0.5))\n",
- "f=10**10\n",
- "l=c/(f*scipy.sqrt(Eeff))\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The effective relative permittivity of the substrate =',round(Eeff,3)\n",
- "print 'The characteristic impedance of the line =',round(Zo,2),'ohms'\n",
- "print 'The wavelength of the line at 10 GHz =',round(l*1000,2),'mm'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The effective relative permittivity of the substrate = 3.131\n",
- "The characteristic impedance of the line = 30.08 ohms\n",
- "The wavelength of the line at 10 GHz = 16.95 mm\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 11.11, Page number: 527<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "At 10 GHz, a microstrip line has the following parameters: \n",
- "h = 1 mm \n",
- "w = 0.8 mm \n",
- "Er = 6.6 \n",
- "tan(theta) = 10^-4 \n",
- "sigma_r = 5.8 X 10^7 S/m \n",
- "Calculate the attenuation due to conduction loss and dielectric loss. '''\n",
- "\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "h=1 #in mm\n",
- "w=0.8 #in mm\n",
- "Er=6.6 #relative permittivity\n",
- "P=scipy.arctan(0.0001) \n",
- "c=5.8*10**7 #conductivity in S/m\n",
- "f=10**10 #frequency in Hz\n",
- "mu=4*scipy.pi*10**-7 #permeability of free space\n",
- "C=3*10**8 #speed of wave in m/s\n",
- "r=w/h\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Ee=((Er+1)/2.0)+((Er-1)/(2.0*(1+12/r)**0.5))\n",
- "Zo=(120.0*scipy.pi)/((r+1.393+(0.667*scipy.log(r+1.444)))*((Ee)**0.5))\n",
- "Rs=scipy.sqrt((scipy.pi*f*mu)/c)\n",
- "ac=8.686*Rs/(w*(10**-3)*Zo)\n",
- "l=C/(f*(Ee)**0.5)\n",
- "ad=27.3*(Ee-1)*Er*scipy.tan(P)/((Er-1)*Ee*l)\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'attenuation due to conduction loss =',round(ac,2),'dB/m'\n",
- "print 'attenuation due to dielectric loss =',round(ad,3),'dB/m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "attenuation due to conduction loss = 4.35 dB/m\n",
- "attenuation due to dielectric loss = 0.177 dB/m\n"
- ]
- }
- ],
- "prompt_number": 9
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b3709cc764fd68911c53d14fdc3847f8e66fbdd5fcd89885b01f065610802430"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 11: Transmission Lines<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11.1, Page number: 482<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "R=0\n",
+ "G=0\n",
+ "a=0\n",
+ "Ro=70 #characteristic impedence in ohms\n",
+ "B=3 #phase constant in rad/sec\n",
+ "f=100*10**6 #frequency in Hz\n",
+ "w=2*scipy.pi*f #omega in rad/sec\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "C=B/(w*Ro) #capacitance in F/m\n",
+ "L=Ro*Ro*C #inductance in H/m\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'inductance per meter =',round(L*10**9,1),'nH/m'\n",
+ "print 'capacitance per meter =',round(C*10**12,1),'pF/m'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "inductance per meter = 334.2 nH/m\n",
+ "capacitance per meter = 68.2 pF/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11.2, Page number: 483<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "#Variable Declaration\n",
+ "\n",
+ "Zo=60 #in ohms\n",
+ "a=20*10**-3 #in Np/m\n",
+ "u=0.6*3*10**8 #in m/sec\n",
+ "f=100*10**6 #in Hz\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "R=a*Zo #resistance in ohms/m\n",
+ "L=Zo/u #inductance in H/m\n",
+ "G=a*a/R #conductivity in S/m\n",
+ "C=1/(u*Zo) #capacitance in F/m\n",
+ "lam=u/f #wavelentgh in m\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'R =',R,'ohm/m'\n",
+ "print 'L =',round(L*10**9,0),'nH/m'\n",
+ "print 'G =',round(G*10**6,0),'micro S/m'\n",
+ "print 'C =',round(C*10**12,2),'pF/m'\n",
+ "print 'lambda =',lam,'m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "R = 1.2 ohm/m\n",
+ "L = 333.0 nH/m\n",
+ "G = 333.0 micro S/m\n",
+ "C = 92.59 pF/m\n",
+ "lambda = 1.8 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11.3, Page number: 490<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import cmath\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "w=10**6 #omega in rad/sec\n",
+ "B=1 #phase factor in rad/m\n",
+ "a=8.0/8.686 #alpha in Np/m\n",
+ "Y=a+1j #in m^-1\n",
+ "l=2 #length in m\n",
+ "Vg=10 #source voltage in volts\n",
+ "Zo=60+40j #in ohms\n",
+ "Zg=40 #in ohms\n",
+ "Zl=20+50j #load impedance in ohms\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "s=scipy.tanh(Y*l)\n",
+ "Zin=Zo*(Zl+Zo*s)/(Zo+Zl*s) #input impedance in ohms\n",
+ "Zinr=round(Zin.real,2) #real part of Zin rounded to 2 decimal places\n",
+ "Zini=round(Zin.imag,2) #imaginary part of Zin rounded to 2 decimal places\n",
+ "Io=Vg/(Zin+Zg) #in A\n",
+ "absIo=round(abs(Io),6) #absolute value of Io rounded to 6 decimal place\n",
+ "Ior=Io.real #real part of Io\n",
+ "Ioi=Io.imag #imaginary part of Io\n",
+ "angIo=scipy.arctan(Ioi/Ior)*180/scipy.pi \n",
+ " #in degrees\n",
+ "Vo=Zin*Io\n",
+ "Vop=(Vo+Zo*Io)/2\n",
+ "Vom =(Vo-Zo*Io)/2\n",
+ "Im=((Vop*scipy.e**(-Y)/Zo))-((Vom*scipy.e**Y)/Zo)\n",
+ " #current at the middle in A\n",
+ "absIm=round(abs(Im),5) #absolute value of Im rounded to 6 decimal place\n",
+ "Imr=Im.real #real part of Im \n",
+ "Imi=Im.imag #imaginary part of Im\n",
+ "angIm=360+scipy.arctan(Imi/Imr)*180/scipy.pi \n",
+ " #in degrees\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The input impedance =',Zinr,'+',Zini,'j ohms'\n",
+ "print 'The sending-end current is'\n",
+ "print 'mod =',absIo*10**3,'mA, angle =',round(angIo,2),'degrees'\n",
+ "print 'The current at the middle is'\n",
+ "print 'mod =',absIm*10**3,'mA, angle =',round(angIm,0),'degrees'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The input impedance = 60.25 + 38.79 j ohms\n",
+ "The sending-end current is\n",
+ "mod = 93.03 mA, angle = -21.15 degrees\n",
+ "The current at the middle is\n",
+ "mod = 34.92 mA, angle = 281.0 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11.4, Page number: 499<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import cmath\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "l=30 #length in m\n",
+ "Zo=50 #in ohms\n",
+ "f=2*10**6 #frequency in Hz\n",
+ "Zl=60+40j #load impedence in ohms\n",
+ "u=0.6*3*10**8 #in m/s\n",
+ "w=2*scipy.pi*f #omega in rad/sec\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "T=(Zl-Zo)/(Zl+Zo) #reflection coefficient\n",
+ "ang=scipy.arctan(T.imag/T.real)*180/scipy.pi #argument of T is degrees\n",
+ "s=(1+abs(T))/(1-abs(T)) #standing wave ratio \n",
+ "B=w/u #propogation vector in m^-1\n",
+ "Zin=Zo*(Zl+Zo*scipy.tan(B*l)*1j)/(Zo+Zl*scipy.tan(B*l)*1j)\n",
+ "Zinr=round(Zin.real,2) #real part of Zin rounded to 2 decimal places\n",
+ "Zini=round(Zin.imag,2) #imaginary part of Zin rounded to 2 decimal places\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The reflection coefficient is'\n",
+ "print 'mod =',round(abs(T),4),'angle =',round(ang,0),'degrees'\n",
+ "print 'The standing wave ratio s =',round(s,3)\n",
+ "print 'The input impedance =',Zinr,'+',Zini,'j ohms'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The reflection coefficient is\n",
+ "mod = 0.3523 angle = 56.0 degrees\n",
+ "The standing wave ratio s = 2.088\n",
+ "The input impedance = 23.97 + 1.35 j ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11.5, Page number: 501<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "import cmath\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Zl=100+150j #load impedance in ohms\n",
+ "Zo=75 #impedance of line in ohms\n",
+ "B=2*scipy.pi \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "T=(Zl-Zo)/(Zl+Zo)\n",
+ "angT=scipy.arctan(T.imag/T.real)*180/scipy.pi \n",
+ "s=(1+abs(T))/(1-abs(T))\n",
+ "Yl=(1/Zl)*10**3 #admittance in mS\n",
+ "Ylr=round(Yl.real,2) #real part of Yl rounded to 2 decimal places\n",
+ "Yli=round(Yl.imag,2) #imaginary part of Yl rounded to 2 decimal places\n",
+ "l1=0.4\n",
+ "Zin=Zo*(Zl+Zo*scipy.tan(B*l1)*1j)/(Zo+Zl*scipy.tan(B*l1)*1j)\n",
+ "Zinr=round(Zin.real,2) #real part of Zin rounded to 2 decimal places\n",
+ "Zini=round(Zin.imag,2) #imaginary part of Zin rounded to 2 decimal places\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'r is mod =',round(abs(T),3),',angle =',round(angT,0),'degrees'\n",
+ "print 's =',round(s,2)\n",
+ "print 'The load admittance Yl =',Ylr,'+',Yli,'j mS'\n",
+ "print 'Zin at O.4 lambda from the load =',Zinr,'+',Zini,'j ohms'\n",
+ "#part (e) and (f) don't require computations"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "r is mod = 0.66 ,angle = 40.0 degrees\n",
+ "s = 4.88\n",
+ "The load admittance Yl = 3.08 + -4.62 j mS\n",
+ "Zin at O.4 lambda from the load = 21.96 + 47.61 j ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11.6, Page number: 509<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import cmath\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "s=2\n",
+ "l1=11 \n",
+ "l2=19\n",
+ "ma=24 \n",
+ "mi=16\n",
+ "u=3*10**8 #speed of wave in m/s\n",
+ "Zo=50 #in ohms\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "l=(l2-l1)*2 #lambda in cm\n",
+ "f=(u/l)*10**-7 #frequency in GHz\n",
+ "L=(24-19)/l #Let us assume load is at 24cm\n",
+ "zl=1.4+0.75j # by smith chart\n",
+ "Zl=Zo*zl #ZL in ohms\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'lambda =',l,'cm'\n",
+ "print 'f =',f,'GHz'\n",
+ "print 'ZL =',Zl,'ohms'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "lambda = 16 cm\n",
+ "f = 1.875 GHz\n",
+ "ZL = (70+37.5j) ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11.7, Page number: 510<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import cmath\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Zo=100 #in ohms\n",
+ "Zl=40+30j #in ohms\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Yo=1.0/Zo #in S\n",
+ "yl=Zo/Zl\n",
+ "ys1=1.04j #By smith chart\n",
+ "ys2=-1.04j #By smith chart\n",
+ "Ys1=Yo*ys1 #in S\n",
+ "Ys2=Yo*ys2 #in S\n",
+ "la=round(0.5-(62-(-39))/720.0,2) #in units of lambda\n",
+ "lb=round((62-39)/720.0,3) #in units of lambda\n",
+ "da=round(88/720.0,4) #in units of lambda\n",
+ "db=round(272/720.0,4) #in units of lambda\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The required stub admittance values in mS are',Ys1*1000,'and',Ys2*1000\n",
+ "print 'The distance between stub and antenna at A =',la,'in units of lambda'\n",
+ "print 'The distance between stub and antenna at B =',lb,'in units of lambda'\n",
+ "print 'The stub lengths =',da,'and',db,'in units of lambda'\n",
+ "print 'Part (d) is done using smith chart'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The required stub admittance values in mS are 10.4j and -10.4j\n",
+ "The distance between stub and antenna at A = 0.36 in units of lambda\n",
+ "The distance between stub and antenna at B = 0.032 in units of lambda\n",
+ "The stub lengths = 0.1222 and 0.3778 in units of lambda\n",
+ "Part (d) is done using smith chart\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 11.9, Page number: 521"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import matplotlib.pyplot as plt\n",
+ "\n",
+ "#Variable Declarataion\n",
+ "\n",
+ "zo=75 #in ohms\n",
+ "zg=25 #in ohms\n",
+ "zl=100 #in ohms\n",
+ "vg=4 #in volts\n",
+ "l=60 #in m\n",
+ "c=3*10**8 #speed of light in m/s\n",
+ "u=0.1*c #in m/s\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "gammag=(zg-zo)/(zg+zo)\n",
+ "gammal=(zl-zo)/(zl+zo)\n",
+ "Vo=zo*vg/(zo+zg) #in V\n",
+ "t1=l/u #in micro sec\n",
+ "Io=vg/(zo+zg) #in mA\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "t1=[0,4,5,8,9,12,13,15]\n",
+ "I1=[40,31.43,-8.571,-7.959,0.6123,0.5685,-0.0438,-0.438]\n",
+ "fig = plt.figure()\n",
+ "ax = fig.add_subplot(111)\n",
+ "ax.step(t1,I1,where='post')\n",
+ "ax.set_xlabel('Time (micro s)')\n",
+ "ax.set_ylabel(r'I(0,t) in mA')\n",
+ "plt.show()\n",
+ "\n",
+ "t2=[0,2,6,7,10,11,14]\n",
+ "I2=[0,34.3,31.9,-2.46,-2.28,0.176,0.176]\n",
+ "fig = plt.figure()\n",
+ "ax = fig.add_subplot(111)\n",
+ "ax.step(t2,I2,where='post')\n",
+ "ax.set_xlabel('Time (micro s)')\n",
+ "ax.set_ylabel(r'I(l,t) in mA')\n",
+ "plt.show()\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "metadata": {},
+ "output_type": "display_data",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEMCAYAAADeYiHoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGzFJREFUeJzt3X1wVNXhxvFn0SZgQUQtIMaQFCibgJAFQhIYwqqAVYxh\nFEaiQEdCRaryoradsdRGfzO0Gq1CLQlVY0dRUaqOjIIg6vJSQjaY2CImApUIqMibms0kwRDP7w+G\nLSEnDeTt3pDvZ2ZnsjfZex83sk/OuWfveowxRgAAnKaT0wEAAO5EQQAArCgIAIAVBQEAsKIgAABW\nFAQAwMrRgqitrZXP51NaWpok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b+gAEDVFZW1uQskydP1ooVK/TFF19Ikr755pt6OS+//HJFRkYqGAyqqqpK\nK1asqHdVYGOMysrKNGrUKP35z3/WV199FS6jzz77TAMHDmxyRkCiIHAOOvmX86nz/qd+ferPnH5/\n6dKl+uCDD8InnPPz8+vtPyEhoc6l50/fT0N/uZ/cHhsbqwceeEDTpk1TQkKCHn/8cWuu3NxcZWdn\nKzU1VaNHj653Fdva2lpNnz5dQ4YM0TXXXKOsrKzwqKi0tFQ+n8+aAzhTLHMFmiAlJUVr167VhRde\n6HSUeo4dO6ZRo0Zp27ZtTDOhWRhBAE3wy1/+Ui+++KLTMazefPNNZWRkUA5oNkYQAAArRhAAACsK\nAgBgRUEAAKwoCACAFQUBALCiIAAAVv8PIrVuLX2NSRcAAAAASUVORK5CYII=\n",
+ "text": [
+ "<matplotlib.figure.Figure at 0x5f89c90>"
+ ]
+ },
+ {
+ "metadata": {},
+ "output_type": "display_data",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEMCAYAAADJQLEhAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHKVJREFUeJzt3Xlw1PXh//HXoiRAWRBECBiSMFw5OLLGsAkMmcUK2tgQ\nqDI19WBIam1ia2mEsWOpBp3SagZBqYKjxo6DIRWPQquAOHUFBHOYcBjDkUoQbQyXkI0JkYT9/eGX\n/IjkDpvPZ/k8HzOZ2d1kP/sib/J57ed6r83r9XoFALCsXkYHAAAYiyIAAIujCADA4igCALA4igAA\nLI4iAACL82kRnD17Vk6nU9HR0YqLi9OKFSskSVlZWQoODpbD4ZDD4dDmzZt9GQMA0Aabr68jqK2t\nVb9+/VRfX6+YmBi9/fbbys3Nld1uV2Zmpi9fGgDQAT7fNdSvXz9JUk1NjRoaGhQYGChJ4jo2ADCH\nq339AufPn5fD4VBpaalWrlypkJAQSdKqVau0fv16zZ07VxkZGbLb7c2eZ7PZfB0NAK5InX6j7e0h\nhw8f9kZERHiLi4u9VVVV3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cNms2n27Nmy2+2Kj49XfX297rzzTtlsNjmdTu3a\ntUvHjx/X9u3bNXv2bDkcDq1Zs6bFz8suLy9XWFhYs8dSUlLUq1cvxcfHKyoqSqNHj1b//v01cuRI\nffbZZ81+dv369brzzjs1YsQISdI111zT9L1f/OIXCggI0P/+9z+dO3dOTqdTffv21V133aWNGzde\nkuXGG29USkqK3njjjWYTGI4ePVoHDhzozq8MkMQWAa4wF+aqCggIUGBgoAIDA5vuf/fdd2psbNS1\n116rkpKSdpf1w8NnF1bmAQEBzVbsAQEBqq+vb/f5F1wohx9+v7WfX7t2rXbu3Km1a9cqOzu7aX7/\n8+fPc3wAlwVbBLhitHfeg9frVVBQkEaNGqU333xTXq9X586du+TdvPT95HUVFRVdznLHHXcoLy9P\nX331lSTpm2++uSTn9ddfr8DAQBUUFKiurk55eXmXzFbr9XpVUVGhqVOn6umnn1ZlZWVT6Xz++eca\nP358lzMCF1AE8EsX3glfvF/+4tsX/8wP7z///PP64IMPmg787tq165LlR0dHN5sO/YfLae2d+IXH\nR40apUceeUR33323oqOjtXz58hZzrVmzRtnZ2UpISNC0adMumS21sbFR99xzjyZNmqQf//jHysrK\natrK2b9/vxwOR4s5gM7g9FGgFfHx8dqyZYsGDBhgdJRL1NfXa+rUqSoqKmL3ELqNLQKgFffdd59e\ne+01o2O0aMOGDUpJSaEEcFmwRQAAFscWAQBYHEUAABZHEQCAxVEEAGBxFAEAWBxFAAAW9/8AjjI6\n8BSLXDoAAAAASUVORK5CYII=\n",
+ "text": [
+ "<matplotlib.figure.Figure at 0x6342070>"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11.10, Page number: 527<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Er=3.8 #relative permittivity\n",
+ "c=3*10**8 #speed of wave in m/s\n",
+ "r=4.5 #ratio of line width to substrate thickness\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Eeff=((Er+1)/2)+((Er-1)/(2*(1+12/r)**0.5))\n",
+ "Zo=(120*scipy.pi)/((r+1.393+(0.667*scipy.log(r+1.444)))*((Eeff)**0.5))\n",
+ "f=10**10\n",
+ "l=c/(f*scipy.sqrt(Eeff))\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The effective relative permittivity of the substrate =',round(Eeff,3)\n",
+ "print 'The characteristic impedance of the line =',round(Zo,2),'ohms'\n",
+ "print 'The wavelength of the line at 10 GHz =',round(l*1000,2),'mm'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The effective relative permittivity of the substrate = 3.131\n",
+ "The characteristic impedance of the line = 30.08 ohms\n",
+ "The wavelength of the line at 10 GHz = 16.95 mm\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 11.11, Page number: 527<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "h=1 #in mm\n",
+ "w=0.8 #in mm\n",
+ "Er=6.6 #relative permittivity\n",
+ "P=scipy.arctan(0.0001) \n",
+ "c=5.8*10**7 #conductivity in S/m\n",
+ "f=10**10 #frequency in Hz\n",
+ "mu=4*scipy.pi*10**-7 #permeability of free space\n",
+ "C=3*10**8 #speed of wave in m/s\n",
+ "r=w/h\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Ee=((Er+1)/2.0)+((Er-1)/(2.0*(1+12/r)**0.5))\n",
+ "Zo=(120.0*scipy.pi)/((r+1.393+(0.667*scipy.log(r+1.444)))*((Ee)**0.5))\n",
+ "Rs=scipy.sqrt((scipy.pi*f*mu)/c)\n",
+ "ac=8.686*Rs/(w*(10**-3)*Zo)\n",
+ "l=C/(f*(Ee)**0.5)\n",
+ "ad=27.3*(Ee-1)*Er*scipy.tan(P)/((Er-1)*Ee*l)\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'attenuation due to conduction loss =',round(ac,2),'dB/m'\n",
+ "print 'attenuation due to dielectric loss =',round(ad,3),'dB/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "attenuation due to conduction loss = 4.35 dB/m\n",
+ "attenuation due to dielectric loss = 0.177 dB/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_12.ipynb b/Elements_of_Electromagnetics/chapter_12.ipynb
index b6ded6a6..e098f292 100644
--- a/Elements_of_Electromagnetics/chapter_12.ipynb
+++ b/Elements_of_Electromagnetics/chapter_12.ipynb
@@ -1,452 +1,419 @@
-{
- "metadata": {
- "name": "chapter_12.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 12: Waveguides<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 12.1, Page number: 557<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "from __future__ import division\n",
- "'''\n",
- "A rectangular waveguide with dimensions a = 2.5 cm, b = 1 cm is to \n",
- "operate below 15.1 GHz. How many TE and TM modes can the waveguide transmit\n",
- "if the guide is filled with a medium characterized by sigma = 0, epsilon = 4\n",
- "epsilon_o,mu_r = 1? Calculate the cutoff frequencies of the modes. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "a=2.5*10**-2 #in m\n",
- "b=1*10**-2 #in m\n",
- "c=0\n",
- "Ur=1 #relative permeability\n",
- "Er=4 #relative permittivity\n",
- "C=3*10**8 #speed of wave in m/s\n",
- "fc=0\n",
- "m=0\n",
- "n=0\n",
- "\n",
- "#Calculations\n",
- "\n",
- "while (fc*10**-9 < 15.1) :\n",
- " fc = (C/(4*a))*scipy.sqrt(m**2+(a*n/b)**2)\n",
- " if (( fc*10**-9) < 15.1) :\n",
- " n=n+1\n",
- " else:\n",
- " print 'Maximum value of n is ',n-1\n",
- "\n",
- "nmax=n-1 \n",
- "fc=0\n",
- "m=0\n",
- "n=0\n",
- "while(fc*10**-9 < 15.1):\n",
- " fc =(C/(4*a))*scipy.sqrt(m**2+(a*n/b)**2)\n",
- " if((fc*10**-9) < 15.1):\n",
- " m=m+1\n",
- " else:\n",
- " print 'Maximum value of m is ',m-1 \n",
- "\n",
- "mmax=m-1\n",
- "m=0\n",
- "while(m<mmax+1):\n",
- " n=0\n",
- " while(n<nmax+1):\n",
- " p=(C/(4*a))*scipy.sqrt(m**2+(a*n/b)**2)\n",
- " if((p*10**-9) < 15.1) :\n",
- " print m,n,'transmission mode is possible'\n",
- " print 'frequency is',round(p*10**-9,2),'GHz'\n",
- " else:\n",
- " print m,n,'transmission mode is not possible'\n",
- " n=n+1\n",
- " \n",
- " m=m+1\n",
- " "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Maximum value of n is 2\n",
- "Maximum value of m is 5\n",
- "0 0 transmission mode is possible\n",
- "frequency is 0.0 GHz\n",
- "0 1 transmission mode is possible\n",
- "frequency is 7.5 GHz\n",
- "0 2 transmission mode is possible\n",
- "frequency is 15.0 GHz\n",
- "1 0 transmission mode is possible\n",
- "frequency is 3.0 GHz\n",
- "1 1 transmission mode is possible\n",
- "frequency is 8.08 GHz\n",
- "1 2 transmission mode is not possible\n",
- "2 0 transmission mode is possible\n",
- "frequency is 6.0 GHz\n",
- "2 1 transmission mode is possible\n",
- "frequency is 9.6 GHz\n",
- "2 2 transmission mode is not possible\n",
- "3 0 transmission mode is possible\n",
- "frequency is 9.0 GHz\n",
- "3 1 transmission mode is possible\n",
- "frequency is 11.72 GHz\n",
- "3 2 transmission mode is not possible\n",
- "4 0 transmission mode is possible\n",
- "frequency is 12.0 GHz\n",
- "4 1 transmission mode is possible\n",
- "frequency is 14.15 GHz\n",
- "4 2 transmission mode is not possible\n",
- "5 0 transmission mode is possible\n",
- "frequency is 15.0 GHz\n",
- "5 1 transmission mode is not possible\n",
- "5 2 transmission mode is not possible\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 12.3, Page number: 561<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "In a rectangular waveguide for which a = 1.5 cm, b = 0.8 cm, sigma = 0, \n",
- "mu = mu_o and epsilon = 4epsilon_o,\n",
- "\n",
- "Hx=2sin(pi x/a) cos(3pi y/b)sin(pi X 10^11t - Bz) A/m\n",
- "\n",
- "Determine \n",
- "(a) The mode of operation \n",
- "(b) The cutoff frequency \n",
- "(c) The phase constant B \n",
- "(d) The propagation constant gamma\n",
- "(e) The intrinsic wave impedance eta '''\n",
- "\n",
- "import scipy\n",
- "import cmath\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "a=1.5*10**-2 #in m\n",
- "b=0.8*10**-2 #in m\n",
- "c=0\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "Ur=1 #relative permeability\n",
- "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
- "Er=4 #relative permittivity\n",
- "C=3*10**8 #speed of light in m/s\n",
- "w=scipy.pi*10**11 #omega in rad/s\n",
- "m=1\n",
- "n=3\n",
- "u=C/2 #speed of wave in m/s\n",
- "\n",
- "#Calculations\n",
- "\n",
- "f=w/(2*scipy.pi) #frequency of wave in Hz\n",
- "fc=u*((m*m)/(a*a)+(n*n)/(b*b))**0.5/2 #cutoff frequency in Hz\n",
- "B=w*scipy.sqrt(1-(fc/f)**2)/u #phase constant in rad/m\n",
- "eta=377/scipy.sqrt(Er)*scipy.sqrt(1-(fc/f)**2) #intrinsic wave impedance in ohm\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The cutoff frequency =',round(fc*10**-9,2),'GHz'\n",
- "print 'The phase constant =',round(B,2),'rad/m'\n",
- "print 'The propagation constant =',round(B,2),'j /m'\n",
- "print 'The intrinsic wave impedance =',round(eta,1),'ohms'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The cutoff frequency = 28.57 GHz\n",
- "The phase constant = 1718.93 rad/m\n",
- "The propagation constant = 1718.93 j /m\n",
- "The intrinsic wave impedance = 154.7 ohms\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 12.4, Page number: 565<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A standard air-filled rectangular waveguide with dimensions a = 8.636 cm,\n",
- "b = 4.318 cm is fed by a 4-GHz carrier from a coaxial cable. Determine if a \n",
- "TE_10 mode will be propagated. If so, calculate the phase velocity and \n",
- "the group velocity. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "a=8.636*10**-2 #in m\n",
- "b=4.318*10**-2 #in m\n",
- "f=4*10**9 #in Hz\n",
- "u=3*10**8 #speed of wave in m/s\n",
- "\n",
- "#Calculations\n",
- "\n",
- "fc=u/(2*a)\n",
- "if(f>fc):\n",
- " print 'As f>fc, TE10 mode will propogate'\n",
- "else:\n",
- " print 'It will not propogate'\n",
- "\n",
- "Up=u/scipy.sqrt(1-(fc/f)**2) #phase velocity in m/s\n",
- "Ug=u*u/Up #group velocity in m/s\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Phase velocity =',round(Up*10**-6,0),'Mm/s'\n",
- "print 'Group velocity =',round(Ug*10**-6,1),'Mm/s'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "As f>fc, TE10 mode will propogate\n",
- "Phase velocity = 333.0 Mm/s\n",
- "Group velocity = 270.2 Mm/s\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 12.5, Page number: 570<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "An air-filled rectangular waveguide of dimensions a = 4 cm, b = 2 cm \n",
- "transports energy in the dominant mode at a rate of 2 mW. If the frequency of\n",
- "operation is lO GHz. Determine the peak value of the electric field \n",
- "in the waveguide. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "f=10*10**9 #frequency of operation in Hz\n",
- "a=4*10**-2 #in m\n",
- "b=2*10**-2 #in m\n",
- "u=3*10**8 #velocity in m/s\n",
- "Pavg=2*10**-3 #average power in W\n",
- "\n",
- "#Calculations\n",
- "\n",
- "fc=u/(2*a) #cutoff frequency in Hz\n",
- "n=377/scipy.sqrt(1-(fc/f)**2) #intrinsic wave impedance in ohms\n",
- "E=scipy.sqrt(4*n*Pavg/(a*b)) #peak value of electric field in V/m\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'Peak value of electric field =',round(E,2),'V/m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Peak value of electric field = 63.77 V/m\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 12.6, Page number: 571<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A copper-plated waveguide (sigma_e = 5.8 X 10 7 S/m) operating at 4.8 GHz \n",
- "is supposed to deliver a minimum power of 1.2 kW to an antenna. If the guide\n",
- "is fillcd with polystyrene (sigma = 10^17 S/m, epsilon = 2.55 epsilon_o) and\n",
- "its dimensions are a = 4.2 cm, b = 2.6 cm, calculate the power dissipated in \n",
- "a length 60 cm of the guide in the TE_10 mode. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable declaration\n",
- "\n",
- "cc=5.8*10**7 #in S/m\n",
- "f=4.8*10**9 #in Hz\n",
- "c=10**-17 #in S/m\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
- "Er=2.55 #relative permittivity\n",
- "z=60*10**-2 #in m\n",
- "l=4.2*10**-2 #in m\n",
- "b=2.6*10**-2 #in m\n",
- "P=1.2*10**3 #in W\n",
- "\n",
- "#Calculations\n",
- "\n",
- "n=377/scipy.sqrt(Er)\n",
- "u=3*10**8/scipy.sqrt(Er)\n",
- "fc=u/(2*l)\n",
- "ad=c*n/(2*scipy.sqrt(1-(fc/f)**2))\n",
- "Rs=scipy.sqrt(scipy.pi*f*Uo/cc)\n",
- "ac=2*Rs*(0.5+(b/l)*(fc/f)**2)/(b*n*scipy.sqrt(1-(fc/f)**2))\n",
- "a=ac\n",
- "Pd=P*(scipy.e**(2*a*z)-1)\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'power dissipated =',round(Pd,3),'W'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "power dissipated = 6.096 W\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 12.8, Page number: 579<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "An air-filled resonant cavity with dimensions a = 5 cm, b = 4 cm, and \n",
- "c = 10 cm is made of copper (sigma_e = 5.8 X 10^7 mhos/m). Find \n",
- "(a) The five lowest order modes \n",
- "(b) The quality factor for TE_101 mode '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- " \n",
- "a=5*10**-2 #in m\n",
- "b=4*10**-2 #in m\n",
- "c=10*10**-2 #in m\n",
- "C=5.8*10**7 #in mhos/m\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "u=3*10**8 #speed of wave in m/s\n",
- "\n",
- "#Calculations\n",
- "\n",
- "def f(m,n,p):\n",
- " fr=scipy.sqrt((m/a)**2+(n/b)**2+(p/c)**2)*u/2 #resonant frequency in Hz\n",
- " print round(fr*10**-9,3)\n",
- " \n",
- "\n",
- "f101=3.35*10**9\n",
- "d=scipy.sqrt(1/(scipy.pi*f101*Uo*C))\n",
- "Q=(a*a+c*c)*a*b*c/(d*(2*b*(a**3+c**3)+a*c*(a*a+c*c))) #quality factor\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Thus the five lowest order modes in ascending order are '\n",
- "print 'TE101, frequency in GHz ='\n",
- "f(1,0,1)\n",
- "print 'TE011, frequency in GHz ='\n",
- "f(0,1,1)\n",
- "print 'TE102, frequency in GHz ='\n",
- "f(1,0,2)\n",
- "print 'TE110, frequency in GHz ='\n",
- "f(1,1,0)\n",
- "print 'TE111 or TM111, frequency in GHz ='\n",
- "f(1,1,1)\n",
- "print 'Quality factor =',round(Q,0)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Thus the five lowest order modes in ascending order are \n",
- "TE101, frequency in GHz =\n",
- "3.354\n",
- "TE011, frequency in GHz =\n",
- "4.039\n",
- "TE102, frequency in GHz =\n",
- "4.243\n",
- "TE110, frequency in GHz =\n",
- "4.802\n",
- "TE111 or TM111, frequency in GHz =\n",
- "5.031\n",
- "Quality factor = 14358.0\n"
- ]
- }
- ],
- "prompt_number": 6
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:7e2f43e6e0f517c2aac74f69be1d132b3ab84b5c247c20e556eb69dbe9aedae5"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 12: Waveguides<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 12.1, Page number: 557<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ " \n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "a=2.5*10**-2 #in m\n",
+ "b=1*10**-2 #in m\n",
+ "c=0\n",
+ "Ur=1 #relative permeability\n",
+ "Er=4 #relative permittivity\n",
+ "C=3*10**8 #speed of wave in m/s\n",
+ "fc=0\n",
+ "m=0\n",
+ "n=0\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "while (fc*10**-9 < 15.1) :\n",
+ " fc = (C/(4*a))*scipy.sqrt(m**2+(a*n/b)**2)\n",
+ " if (( fc*10**-9) < 15.1) :\n",
+ " n=n+1\n",
+ " else:\n",
+ " print 'Maximum value of n is ',n-1\n",
+ "\n",
+ "nmax=n-1 \n",
+ "fc=0\n",
+ "m=0\n",
+ "n=0\n",
+ "while(fc*10**-9 < 15.1):\n",
+ " fc =(C/(4*a))*scipy.sqrt(m**2+(a*n/b)**2)\n",
+ " if((fc*10**-9) < 15.1):\n",
+ " m=m+1\n",
+ " else:\n",
+ " print 'Maximum value of m is ',m-1 \n",
+ "\n",
+ "mmax=m-1\n",
+ "m=0\n",
+ "while(m<mmax+1):\n",
+ " n=0\n",
+ " while(n<nmax+1):\n",
+ " p=(C/(4*a))*scipy.sqrt(m**2+(a*n/b)**2)\n",
+ " if((p*10**-9) < 15.1) :\n",
+ " print m,n,'transmission mode is possible'\n",
+ " print 'frequency is',round(p*10**-9,2),'GHz'\n",
+ " else:\n",
+ " print m,n,'transmission mode is not possible'\n",
+ " n=n+1\n",
+ " \n",
+ " m=m+1\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum value of n is 2\n",
+ "Maximum value of m is 5\n",
+ "0 0 transmission mode is possible\n",
+ "frequency is 0.0 GHz\n",
+ "0 1 transmission mode is possible\n",
+ "frequency is 7.5 GHz\n",
+ "0 2 transmission mode is possible\n",
+ "frequency is 15.0 GHz\n",
+ "1 0 transmission mode is possible\n",
+ "frequency is 3.0 GHz\n",
+ "1 1 transmission mode is possible\n",
+ "frequency is 8.08 GHz\n",
+ "1 2 transmission mode is not possible\n",
+ "2 0 transmission mode is possible\n",
+ "frequency is 6.0 GHz\n",
+ "2 1 transmission mode is possible\n",
+ "frequency is 9.6 GHz\n",
+ "2 2 transmission mode is not possible\n",
+ "3 0 transmission mode is possible\n",
+ "frequency is 9.0 GHz\n",
+ "3 1 transmission mode is possible\n",
+ "frequency is 11.72 GHz\n",
+ "3 2 transmission mode is not possible\n",
+ "4 0 transmission mode is possible\n",
+ "frequency is 12.0 GHz\n",
+ "4 1 transmission mode is possible\n",
+ "frequency is 14.15 GHz\n",
+ "4 2 transmission mode is not possible\n",
+ "5 0 transmission mode is possible\n",
+ "frequency is 15.0 GHz\n",
+ "5 1 transmission mode is not possible\n",
+ "5 2 transmission mode is not possible\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 12.3, Page number: 561<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import cmath\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "a=1.5*10**-2 #in m\n",
+ "b=0.8*10**-2 #in m\n",
+ "c=0\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "Ur=1 #relative permeability\n",
+ "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
+ "Er=4 #relative permittivity\n",
+ "C=3*10**8 #speed of light in m/s\n",
+ "w=scipy.pi*10**11 #omega in rad/s\n",
+ "m=1\n",
+ "n=3\n",
+ "u=C/2 #speed of wave in m/s\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "f=w/(2*scipy.pi) #frequency of wave in Hz\n",
+ "fc=u*((m*m)/(a*a)+(n*n)/(b*b))**0.5/2 #cutoff frequency in Hz\n",
+ "B=w*scipy.sqrt(1-(fc/f)**2)/u #phase constant in rad/m\n",
+ "eta=377/scipy.sqrt(Er)*scipy.sqrt(1-(fc/f)**2) #intrinsic wave impedance in ohm\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The cutoff frequency =',round(fc*10**-9,2),'GHz'\n",
+ "print 'The phase constant =',round(B,2),'rad/m'\n",
+ "print 'The propagation constant =',round(B,2),'j /m'\n",
+ "print 'The intrinsic wave impedance =',round(eta,1),'ohms'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The cutoff frequency = 28.57 GHz\n",
+ "The phase constant = 1718.93 rad/m\n",
+ "The propagation constant = 1718.93 j /m\n",
+ "The intrinsic wave impedance = 154.7 ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 12.4, Page number: 565<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "a=8.636*10**-2 #in m\n",
+ "b=4.318*10**-2 #in m\n",
+ "f=4*10**9 #in Hz\n",
+ "u=3*10**8 #speed of wave in m/s\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "fc=u/(2*a)\n",
+ "if(f>fc):\n",
+ " print 'As f>fc, TE10 mode will propogate'\n",
+ "else:\n",
+ " print 'It will not propogate'\n",
+ "\n",
+ "Up=u/scipy.sqrt(1-(fc/f)**2) #phase velocity in m/s\n",
+ "Ug=u*u/Up #group velocity in m/s\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Phase velocity =',round(Up*10**-6,0),'Mm/s'\n",
+ "print 'Group velocity =',round(Ug*10**-6,1),'Mm/s'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "As f>fc, TE10 mode will propogate\n",
+ "Phase velocity = 333.0 Mm/s\n",
+ "Group velocity = 270.2 Mm/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 12.5, Page number: 570<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "f=10*10**9 #frequency of operation in Hz\n",
+ "a=4*10**-2 #in m\n",
+ "b=2*10**-2 #in m\n",
+ "u=3*10**8 #velocity in m/s\n",
+ "Pavg=2*10**-3 #average power in W\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "fc=u/(2*a) #cutoff frequency in Hz\n",
+ "n=377/scipy.sqrt(1-(fc/f)**2) #intrinsic wave impedance in ohms\n",
+ "E=scipy.sqrt(4*n*Pavg/(a*b)) #peak value of electric field in V/m\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'Peak value of electric field =',round(E,2),'V/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Peak value of electric field = 63.77 V/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 12.6, Page number: 571<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable declaration\n",
+ "\n",
+ "cc=5.8*10**7 #in S/m\n",
+ "f=4.8*10**9 #in Hz\n",
+ "c=10**-17 #in S/m\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
+ "Er=2.55 #relative permittivity\n",
+ "z=60*10**-2 #in m\n",
+ "l=4.2*10**-2 #in m\n",
+ "b=2.6*10**-2 #in m\n",
+ "P=1.2*10**3 #in W\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "n=377/scipy.sqrt(Er)\n",
+ "u=3*10**8/scipy.sqrt(Er)\n",
+ "fc=u/(2*l)\n",
+ "ad=c*n/(2*scipy.sqrt(1-(fc/f)**2))\n",
+ "Rs=scipy.sqrt(scipy.pi*f*Uo/cc)\n",
+ "ac=2*Rs*(0.5+(b/l)*(fc/f)**2)/(b*n*scipy.sqrt(1-(fc/f)**2))\n",
+ "a=ac\n",
+ "Pd=P*(scipy.e**(2*a*z)-1)\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'power dissipated =',round(Pd,3),'W'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "power dissipated = 6.096 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 12.8, Page number: 579<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ " \n",
+ "a=5*10**-2 #in m\n",
+ "b=4*10**-2 #in m\n",
+ "c=10*10**-2 #in m\n",
+ "C=5.8*10**7 #in mhos/m\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "u=3*10**8 #speed of wave in m/s\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "def f(m,n,p):\n",
+ " fr=scipy.sqrt((m/a)**2+(n/b)**2+(p/c)**2)*u/2 #resonant frequency in Hz\n",
+ " print round(fr*10**-9,3)\n",
+ " \n",
+ "\n",
+ "f101=3.35*10**9\n",
+ "d=scipy.sqrt(1/(scipy.pi*f101*Uo*C))\n",
+ "Q=(a*a+c*c)*a*b*c/(d*(2*b*(a**3+c**3)+a*c*(a*a+c*c))) #quality factor\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Thus the five lowest order modes in ascending order are '\n",
+ "print 'TE101, frequency in GHz ='\n",
+ "f(1,0,1)\n",
+ "print 'TE011, frequency in GHz ='\n",
+ "f(0,1,1)\n",
+ "print 'TE102, frequency in GHz ='\n",
+ "f(1,0,2)\n",
+ "print 'TE110, frequency in GHz ='\n",
+ "f(1,1,0)\n",
+ "print 'TE111 or TM111, frequency in GHz ='\n",
+ "f(1,1,1)\n",
+ "print 'Quality factor =',round(Q,0)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Thus the five lowest order modes in ascending order are \n",
+ "TE101, frequency in GHz =\n",
+ "3.354\n",
+ "TE011, frequency in GHz =\n",
+ "4.039\n",
+ "TE102, frequency in GHz =\n",
+ "4.243\n",
+ "TE110, frequency in GHz =\n",
+ "4.802\n",
+ "TE111 or TM111, frequency in GHz =\n",
+ "5.031\n",
+ "Quality factor = 14358.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_13.ipynb b/Elements_of_Electromagnetics/chapter_13.ipynb
index 0aaf4534..8e4967c6 100644
--- a/Elements_of_Electromagnetics/chapter_13.ipynb
+++ b/Elements_of_Electromagnetics/chapter_13.ipynb
@@ -1,428 +1,390 @@
-{
- "metadata": {
- "name": "chapter_13.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 13: Antennas<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 13.1, Page number: 601<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A magnetic field strength of 5 muA/m is required at a point on theta = pi/2,\n",
- "2 km from an antenna in air. Neglecting ohmic loss, how much power must \n",
- "the antenna transmit if it is \n",
- "\n",
- "(a) A Hertzian dipole of length lambda/25?\n",
- "(b) A half-wave dipole? \n",
- "(c) A quarter-wave monopole? \n",
- "(d) A 10-turn loop antenna of radius Po = lambda/20? '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "H=5*10**-6 #magnetic field strentgh in A/m\n",
- "theta=scipy.pi/2 \n",
- "r=2*10**3 #distance in m\n",
- "Bdl=2*scipy.pi/25\n",
- "N=10 #number of turns\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Ia=4*scipy.pi*r*H/(Bdl*scipy.sin(theta)) #current for part (a) in A\n",
- "Pa=40*scipy.pi**2*(1/25.0)**2*Ia**2 #power for part (a) in W\n",
- "def pow(Io,Rrad):\n",
- " P=0.5*Io**2*Rrad\n",
- " print round(P*10**3,0),'mW'\n",
- "\n",
- "denom=scipy.cos(scipy.pi*scipy.cos(theta)/2) \n",
- "Ib=H*2*scipy.pi*r*scipy.sin(theta)/denom #current for part (b) in A\n",
- "Rradb=73 #wave impedance in ohms for (b)\n",
- "Ic=Ib #current for part (c) in A\n",
- "Rradc=36.56 #wave impedance in ohms for (c)\n",
- "Id=H*r*400/(10*scipy.pi**2) #current for part (d) in A\n",
- "Rradd=320*scipy.pi**6*N**2/20**4 #wave impedance in ohms for (d)\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The power transmitted in mW if antenna is ;'\n",
- "print '(a) A Hertzian dipole of length lambda/25 =','\\n',round(Pa*10**3,0),'mW'\n",
- "print '(b) A half-wave dipole ='\n",
- "pow(Ib,Rradb)\n",
- "print '(c) A quarter-wave monopole ='\n",
- "pow(Ic,Rradc)\n",
- "print '(d) A 10-turn loop antenna of radius Po = lambda/20 ='\n",
- "pow(Id,Rradd)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The power transmitted in mW if antenna is ;\n",
- "(a) A Hertzian dipole of length lambda/25 = \n",
- "158.0 mW\n",
- "(b) A half-wave dipole =\n",
- "144.0 mW\n",
- "(c) A quarter-wave monopole =\n",
- "72.0 mW\n",
- "(d) A 10-turn loop antenna of radius Po = lambda/20 =\n",
- "158.0 mW\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 13.2, Page number: 603<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "An electric field strength of 10 micro V/m is to be measured at an observation \n",
- "point theta=pi/2, 500 km from a half-wave (resonant) dipole antenna operating\n",
- "in air at 50 MHz. \n",
- "(a) What is the length of the dipole? \n",
- "(b) Calculate the current that must be fed to the antenna. \n",
- "(c) Find the average power radiated by the antenna. \n",
- "(d) If a transmission line with Zo = 75 ohms is connected to the antenna,\n",
- "determine the standing wave ratio. '''\n",
- "\n",
- "import scipy\n",
- "import cmath\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "c=3*10**8 #speed of wave in m/s\n",
- "f=50*10**6 #frequency in Hz\n",
- "E=10*10**-6 #field strength in V/m\n",
- "theta=scipy.pi/2\n",
- "r=500*10**3 #distance in m\n",
- "eta=120*scipy.pi #wave impedance in ohms\n",
- "Rrad=73 #in ohms\n",
- "Zo=75 #in ohms\n",
- "Zl=73+42.5j\n",
- "\n",
- "#Calculations\n",
- "\n",
- "l=c/(2*f)\n",
- "I=E*2*r*scipy.pi*sin(theta)/(eta*(cos((scipy.pi/2)*cos(theta))))\n",
- "P=0.5*I**2*Rrad\n",
- "T=(Zl-Zo)/(Zl+Zo)\n",
- "s=(1+abs(T))/(1-abs(T))\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The length of the dipole =',l,'m'\n",
- "print 'The current that must be fed to the antenna =',round(I*10**3,2),'mA'\n",
- "print 'The average power radiated by the antenna =',round(P*10**3,1),'mW'\n",
- "print 'The standing wave ratio =',round(s,4)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The length of the dipole = 3 m\n",
- "The current that must be fed to the antenna = 83.33 mA\n",
- "The average power radiated by the antenna = 253.5 mW\n",
- "The standing wave ratio = 1.7636\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 13.4, Page number: 610<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Determine the electric field intensity at a distance of 10 km from an antenna \n",
- "having a directive gain of 5 dB and radiating a total power of 20 kW. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "G=5\n",
- "r=10*10**3 #in m\n",
- "P=20*10**3 #power in W\n",
- "n=120*scipy.pi #wave impedance in ohms\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Gd=10**(G/10.0)\n",
- "E=scipy.sqrt(n*Gd*P/(2*scipy.pi*r*r)) #field intensity in V/m\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'electric field intensity =',round(E,4),'V/m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "electric field intensity = 0.1948 V/m\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 13.5, Page number: 611<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The radiation intensity of a certain antenna is \n",
- "\n",
- "U(theta,phi) = 2sin(theta) sin^3(phi) , 0<theta<pi,0<phi<pi\n",
- " = 0, elsewhere\n",
- "\n",
- "Determine the directivity of the antenna. '''\n",
- "\n",
- "import scipy\n",
- "import scipy.integrate\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Umax=2.0\n",
- "\n",
- "def U(phi,theta):\n",
- " s=2*scipy.sin(theta)*(scipy.sin(phi))**3/(4.0*scipy.pi)\n",
- " return s\n",
- " \n",
- "#Calculations\n",
- "\n",
- "if __name__ == '__main__':\n",
- " \n",
- " Uav,er=scipy.integrate.dblquad(lambda theta,phi:U(phi,theta)*scipy.sin(theta), \n",
- " 0, scipy.pi, lambda theta: 0, lambda theta: scipy.pi)\n",
- "\n",
- "D=Umax/Uav #Directivity\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'directivity of the antenna =',D"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "directivity of the antenna = 6.0\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 13.8, Page number: 624<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Find the maximum effective area of a lamba/2 wire dipole operating at 30 MHz.\n",
- "How much power is received with an incident plane wave of strength 2 mV/m.'''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "c=3*10**8 #speed of wave in m/s\n",
- "f=30*10**6 #frequency in Hz\n",
- "E=2*10**-3 #field strength in V/m\n",
- "n=120*scipy.pi\n",
- "R=73 \n",
- "\n",
- "#Calculations\n",
- "\n",
- "l=c/f #wavelength in m\n",
- "Gdmax=round(n/(scipy.pi*R),2) \n",
- "Amax=(l**2/(4*scipy.pi))*Gdmax #maximum effective area in m^2\n",
- "Pr=(E*E*Amax)/(2*n) #power received in W\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'maximum effective area =',round(Amax,2),'m^2'\n",
- "print 'power received =',round(Pr*10**9,2),'nW'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "maximum effective area = 13.05 m^2\n",
- "power received = 69.24 nW\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 13.9, Page number: 624<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The transmitting and receiving antennas are separated by a distance of \n",
- "200 lambda and have directive gains of 25 and 18 dB, respectively. If 5 mW\n",
- "of power is to be received, calculate the minimum transmitted power. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Gt=25 #in dB\n",
- "Gr=18 #in dB\n",
- "r=200 #in units of lambda\n",
- "Pr=5*10**-3 #power received in W\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Gdt=10**(Gt/10.0) \n",
- "Gdr=10**(Gr/10.0)\n",
- "Pt=Pr*(4*scipy.pi*r)**2/(Gdr*Gdt)\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'minimum transmitted power =',round(Pt,3),'W'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "minimum transmitted power = 1.583 W\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 13.10, Page number: 627<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "An S-band radar transmitting at 3 GHz radiates 200 kW. Determine the signal\n",
- "power density at ranges 100 and 400 nautical miles if the effective area of \n",
- "the radar antenna is 9 m^2 . With a 20-m^2 target at 300 nautical miles, \n",
- "calculate the power of the reflected signal at the radar. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "c=3*(10)**8 #speed of wave in m/s\n",
- "f=3.0*(10)**9 #frequency in Hz\n",
- "Aet=9 #effective area in m^2\n",
- "r1=1.852*(10)**5 #distance in m\n",
- "r2=4*r1 #distance in m\n",
- "r3=5.556*10**5 #distance in m\n",
- "Pr=200*(10)**3 #in W\n",
- "a=20 #target area in m^2\n",
- "\n",
- "#Calculations\n",
- "\n",
- "l=c/f #wavelength in m\n",
- "Gdt=4*scipy.pi*Aet/(l*l)\n",
- "P1=Gdt*Pr/(4*scipy.pi*r1*r1) #power at 100 nmiles in W/m^2\n",
- "P2=Gdt*Pr/(4*scipy.pi*r2*r2) #power at 400 nmiles in W/m^2\n",
- "Pr=Aet*a*Gdt*Pr/(4*scipy.pi*r3*r3)**2 #power of reflected signal in W\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Signal power density at 100 nautical miles =',round(P1*1000,3),'mW/m^2'\n",
- "print 'Signal power density at 400 nautical miles =',round(P2*1000,3),'mW/m^2'\n",
- "print 'Power of reflected signal =',round(Pr*10**12,5),'pico W'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Signal power density at 100 nautical miles = 5.248 mW/m^2\n",
- "Signal power density at 400 nautical miles = 0.328 mW/m^2\n",
- "Power of reflected signal = 0.02706 pico W\n"
- ]
- }
- ],
- "prompt_number": 8
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:5168da214feed4bdafc5432918593870d207c98c8ad5626a85639886ab07fdcb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 13: Antennas<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 13.1, Page number: 601<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "H=5*10**-6 #magnetic field strentgh in A/m\n",
+ "theta=scipy.pi/2 \n",
+ "r=2*10**3 #distance in m\n",
+ "Bdl=2*scipy.pi/25\n",
+ "N=10 #number of turns\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Ia=4*scipy.pi*r*H/(Bdl*scipy.sin(theta)) #current for part (a) in A\n",
+ "Pa=40*scipy.pi**2*(1/25.0)**2*Ia**2 #power for part (a) in W\n",
+ "def pow(Io,Rrad):\n",
+ " P=0.5*Io**2*Rrad\n",
+ " print round(P*10**3,0),'mW'\n",
+ "\n",
+ "denom=scipy.cos(scipy.pi*scipy.cos(theta)/2) \n",
+ "Ib=H*2*scipy.pi*r*scipy.sin(theta)/denom #current for part (b) in A\n",
+ "Rradb=73 #wave impedance in ohms for (b)\n",
+ "Ic=Ib #current for part (c) in A\n",
+ "Rradc=36.56 #wave impedance in ohms for (c)\n",
+ "Id=H*r*400/(10*scipy.pi**2) #current for part (d) in A\n",
+ "Rradd=320*scipy.pi**6*N**2/20**4 #wave impedance in ohms for (d)\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The power transmitted in mW if antenna is ;'\n",
+ "print '(a) A Hertzian dipole of length lambda/25 =','\\n',round(Pa*10**3,0),'mW'\n",
+ "print '(b) A half-wave dipole ='\n",
+ "pow(Ib,Rradb)\n",
+ "print '(c) A quarter-wave monopole ='\n",
+ "pow(Ic,Rradc)\n",
+ "print '(d) A 10-turn loop antenna of radius Po = lambda/20 ='\n",
+ "pow(Id,Rradd)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The power transmitted in mW if antenna is ;\n",
+ "(a) A Hertzian dipole of length lambda/25 = \n",
+ "158.0 mW\n",
+ "(b) A half-wave dipole =\n",
+ "144.0 mW\n",
+ "(c) A quarter-wave monopole =\n",
+ "72.0 mW\n",
+ "(d) A 10-turn loop antenna of radius Po = lambda/20 =\n",
+ "158.0 mW\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 13.2, Page number: 603<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import scipy\n",
+ "import cmath\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "c=3*10**8 #speed of wave in m/s\n",
+ "f=50*10**6 #frequency in Hz\n",
+ "E=10*10**-6 #field strength in V/m\n",
+ "theta=scipy.pi/2\n",
+ "r=500*10**3 #distance in m\n",
+ "eta=120*scipy.pi #wave impedance in ohms\n",
+ "Rrad=73 #in ohms\n",
+ "Zo=75 #in ohms\n",
+ "Zl=73+42.5j\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "l=c/(2*f)\n",
+ "I=E*2*r*scipy.pi*sin(theta)/(eta*(cos((scipy.pi/2)*cos(theta))))\n",
+ "P=0.5*I**2*Rrad\n",
+ "T=(Zl-Zo)/(Zl+Zo)\n",
+ "s=(1+abs(T))/(1-abs(T))\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The length of the dipole =',l,'m'\n",
+ "print 'The current that must be fed to the antenna =',round(I*10**3,2),'mA'\n",
+ "print 'The average power radiated by the antenna =',round(P*10**3,1),'mW'\n",
+ "print 'The standing wave ratio =',round(s,4)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The length of the dipole = 3 m\n",
+ "The current that must be fed to the antenna = 83.33 mA\n",
+ "The average power radiated by the antenna = 253.5 mW\n",
+ "The standing wave ratio = 1.7636\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 13.4, Page number: 610<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "G=5\n",
+ "r=10*10**3 #in m\n",
+ "P=20*10**3 #power in W\n",
+ "n=120*scipy.pi #wave impedance in ohms\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Gd=10**(G/10.0)\n",
+ "E=scipy.sqrt(n*Gd*P/(2*scipy.pi*r*r)) #field intensity in V/m\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'electric field intensity =',round(E,4),'V/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "electric field intensity = 0.1948 V/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 13.5, Page number: 611<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import scipy.integrate\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Umax=2.0\n",
+ "\n",
+ "def U(phi,theta):\n",
+ " s=2*scipy.sin(theta)*(scipy.sin(phi))**3/(4.0*scipy.pi)\n",
+ " return s\n",
+ " \n",
+ "#Calculations\n",
+ "\n",
+ "if __name__ == '__main__':\n",
+ " \n",
+ " Uav,er=scipy.integrate.dblquad(lambda theta,phi:U(phi,theta)*scipy.sin(theta), \n",
+ " 0, scipy.pi, lambda theta: 0, lambda theta: scipy.pi)\n",
+ "\n",
+ "D=Umax/Uav #Directivity\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'directivity of the antenna =',D"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "directivity of the antenna = 6.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 13.8, Page number: 624<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "c=3*10**8 #speed of wave in m/s\n",
+ "f=30*10**6 #frequency in Hz\n",
+ "E=2*10**-3 #field strength in V/m\n",
+ "n=120*scipy.pi\n",
+ "R=73 \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "l=c/f #wavelength in m\n",
+ "Gdmax=round(n/(scipy.pi*R),2) \n",
+ "Amax=(l**2/(4*scipy.pi))*Gdmax #maximum effective area in m^2\n",
+ "Pr=(E*E*Amax)/(2*n) #power received in W\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'maximum effective area =',round(Amax,2),'m^2'\n",
+ "print 'power received =',round(Pr*10**9,2),'nW'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "maximum effective area = 13.05 m^2\n",
+ "power received = 69.24 nW\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 13.9, Page number: 624<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Gt=25 #in dB\n",
+ "Gr=18 #in dB\n",
+ "r=200 #in units of lambda\n",
+ "Pr=5*10**-3 #power received in W\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Gdt=10**(Gt/10.0) \n",
+ "Gdr=10**(Gr/10.0)\n",
+ "Pt=Pr*(4*scipy.pi*r)**2/(Gdr*Gdt)\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'minimum transmitted power =',round(Pt,3),'W'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "minimum transmitted power = 1.583 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 13.10, Page number: 627<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "c=3*(10)**8 #speed of wave in m/s\n",
+ "f=3.0*(10)**9 #frequency in Hz\n",
+ "Aet=9 #effective area in m^2\n",
+ "r1=1.852*(10)**5 #distance in m\n",
+ "r2=4*r1 #distance in m\n",
+ "r3=5.556*10**5 #distance in m\n",
+ "Pr=200*(10)**3 #in W\n",
+ "a=20 #target area in m^2\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "l=c/f #wavelength in m\n",
+ "Gdt=4*scipy.pi*Aet/(l*l)\n",
+ "P1=Gdt*Pr/(4*scipy.pi*r1*r1) #power at 100 nmiles in W/m^2\n",
+ "P2=Gdt*Pr/(4*scipy.pi*r2*r2) #power at 400 nmiles in W/m^2\n",
+ "Pr=Aet*a*Gdt*Pr/(4*scipy.pi*r3*r3)**2 #power of reflected signal in W\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Signal power density at 100 nautical miles =',round(P1*1000,3),'mW/m^2'\n",
+ "print 'Signal power density at 400 nautical miles =',round(P2*1000,3),'mW/m^2'\n",
+ "print 'Power of reflected signal =',round(Pr*10**12,5),'pico W'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Signal power density at 100 nautical miles = 5.248 mW/m^2\n",
+ "Signal power density at 400 nautical miles = 0.328 mW/m^2\n",
+ "Power of reflected signal = 0.02706 pico W\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_14.ipynb b/Elements_of_Electromagnetics/chapter_14.ipynb
index 1a5d389b..fcb4fac5 100644
--- a/Elements_of_Electromagnetics/chapter_14.ipynb
+++ b/Elements_of_Electromagnetics/chapter_14.ipynb
@@ -1,172 +1,160 @@
-{
- "metadata": {
- "name": "chapter_14.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 14: Modern Topics<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.1, Page number: 643<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The following S-parameters are obtained for a microwave transistor operating \n",
- "at 2.5 GHz: S11 = 0.85 / 30\u00b0 ,S12 = 0.07 /56\u00b0 , S21 = 1.68 /120\u00b0 , \n",
- "S22 = O.85 /-40 . Determine the input reflection coefficient when ZL=Zo=75 ohm. '''\n",
- "\n",
- "import scipy\n",
- "import cmath\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "S11=0.85*scipy.e**(-30j*scipy.pi/180)\n",
- "S12=0.07*scipy.e**(56j*scipy.pi/180)\n",
- "S21=1.68*scipy.e**(120j*scipy.pi/180)\n",
- "S22=0.85*scipy.e**(-40j*scipy.pi/180)\n",
- "Zl=75 \n",
- "Zo=75\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Tl=(Zl-Zo)/(Zl+Zo)\n",
- "Ti=S11+(S12*S21*Tl)/(1-S22*Tl) #reflection coefficient\n",
- "Timod=abs(Ti) #mod of Ti\n",
- "Tiang=scipy.arctan(Ti.imag/Ti.real)*180/scipy.pi #argument of Ti in degrees\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'input reflection coefficient =',Timod,'/',Tiang,'degrees'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "input reflection coefficient = 0.85 / -30.0 degrees\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.2, Page number: 654<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A step-index fiber has a core diameter of 80 micro m, a core refractive index \n",
- "of 1.62, and a numerical aperture of 0.21. Calculate: \n",
- "(a) the acceptance angle, (b) the refractive index that the fiber can \n",
- "propagate at a wavelength of 0.8 micro m, (c) the number of modes that the\n",
- "fiber can propagate at a wavelength of 0.8 micro m.'''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "d=80*(10)**-6 #diameter in m\n",
- "n1=1.62 #core refractive index\n",
- "NA=0.21 #numerical aperture\n",
- "L=8*(10)**-7 #wavelength in m\n",
- "\n",
- "#Calculations\n",
- "\n",
- "P=scipy.arcsin(NA)*180/scipy.pi #acceptance angle\n",
- "n2=scipy.sqrt(n1**2-NA**2) #refractive index\n",
- "V=(scipy.pi*d/L)*scipy.sqrt(n1**2-n2**2)\n",
- "N=V**2/2 #number of modes\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Acceptance angle =',round(P,2),'degrees'\n",
- "print 'Refractive index =',round(n2,3)\n",
- "print 'No. of modes =',round(N,0)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Acceptance angle = 12.12 degrees\n",
- "Refractive index = 1.606\n",
- "No. of modes = 2176.0\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.3, Page number: 655<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Light pulses propagate through a fiber cable with an attenuation of 0.25 dB/km.\n",
- "Determine the distance through which the power of pulses is reduced by 40%. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "a=0.25 #in dB/km\n",
- "P=1-0.4 #strength of pulse im %\n",
- "\n",
- "#Calculation\n",
- "\n",
- "l=(10/a)*scipy.log(1/P)/scipy.log(10) #distance in km\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'distance through which the power is reduced by 40% =',round(l,3),'km'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "distance through which the power is reduced by 40% = 8.874 km\n"
- ]
- }
- ],
- "prompt_number": 3
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:8b3ccd88c7aadd311b6269c4809d3b632a222a912e8231c54428ad90a16f0d12"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 14: Modern Topics<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.1, Page number: 643<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import cmath\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "S11=0.85*scipy.e**(-30j*scipy.pi/180)\n",
+ "S12=0.07*scipy.e**(56j*scipy.pi/180)\n",
+ "S21=1.68*scipy.e**(120j*scipy.pi/180)\n",
+ "S22=0.85*scipy.e**(-40j*scipy.pi/180)\n",
+ "Zl=75 \n",
+ "Zo=75\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Tl=(Zl-Zo)/(Zl+Zo)\n",
+ "Ti=S11+(S12*S21*Tl)/(1-S22*Tl) #reflection coefficient\n",
+ "Timod=abs(Ti) #mod of Ti\n",
+ "Tiang=scipy.arctan(Ti.imag/Ti.real)*180/scipy.pi #argument of Ti in degrees\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'input reflection coefficient =',Timod,'/',Tiang,'degrees'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "input reflection coefficient = 0.85 / -30.0 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.2, Page number: 654<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "d=80*(10)**-6 #diameter in m\n",
+ "n1=1.62 #core refractive index\n",
+ "NA=0.21 #numerical aperture\n",
+ "L=8*(10)**-7 #wavelength in m\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "P=scipy.arcsin(NA)*180/scipy.pi #acceptance angle\n",
+ "n2=scipy.sqrt(n1**2-NA**2) #refractive index\n",
+ "V=(scipy.pi*d/L)*scipy.sqrt(n1**2-n2**2)\n",
+ "N=V**2/2 #number of modes\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Acceptance angle =',round(P,2),'degrees'\n",
+ "print 'Refractive index =',round(n2,3)\n",
+ "print 'No. of modes =',round(N,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Acceptance angle = 12.12 degrees\n",
+ "Refractive index = 1.606\n",
+ "No. of modes = 2176.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.3, Page number: 655<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "a=0.25 #in dB/km\n",
+ "P=1-0.4 #strength of pulse im %\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "l=(10/a)*scipy.log(1/P)/scipy.log(10) #distance in km\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'distance through which the power is reduced by 40% =',round(l,3),'km'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "distance through which the power is reduced by 40% = 8.874 km\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_2.ipynb b/Elements_of_Electromagnetics/chapter_2.ipynb
index 042db1c8..9c2ffc15 100644
--- a/Elements_of_Electromagnetics/chapter_2.ipynb
+++ b/Elements_of_Electromagnetics/chapter_2.ipynb
@@ -1,318 +1,299 @@
-{
- "metadata": {
- "name": "chapter_2.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 2: Coordinate Systems and Transformation<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.1, Page number: 36<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Given point P(-2,6,3) and vector A = y a_x + (x+z) a_y ,\n",
- "express P and A in cylindrical and spherical coordinates.\n",
- "Evaluate A at P in the Cartesian, cylindrical, and spherical systems. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "x=-2\n",
- "y=6\n",
- "z=3 \n",
- "\n",
- "#Calculations\n",
- "\n",
- "r=scipy.sqrt(x**2+y**2)\n",
- "phi=scipy.arctan(-y/x) #phi in radians in 1st quadrant\n",
- "phid=180-(phi*180/scipy.pi) #phi in degrees in second quadrant\n",
- "phic=scipy.pi*phid/180.0 #phi in radians in second quadrant\n",
- "R=scipy.sqrt(x**2+y**2+z**2) \n",
- "theta=scipy.arctan(r/z) \n",
- "\n",
- " #P in cylindrical coordinates\n",
- " \n",
- "Pcyl=array([round(r,2),round(phid,2),z]) \n",
- "\n",
- " #P in spherical coordinates\n",
- " \n",
- "Psph=array([round(R,2),round(theta*180/scipy.pi,2),\n",
- " round(phid,2)]) \n",
- "\n",
- " #Vector A in cylindrical coordinate system\n",
- "\n",
- "Xc=r*scipy.cos(phic)\n",
- "Yc=r*scipy.sin(phic)\n",
- "Zc=z \n",
- "Ar=Yc*scipy.cos(phic)+(Xc+Zc)*scipy.sin(phic)\n",
- "Aphi=-Yc*scipy.sin(phic)+(Xc+Zc)*scipy.cos(phic)\n",
- "Az=0\n",
- "Acyl=array([round(Ar,4),round(Aphi,3),Az])\n",
- "\n",
- " #Vector A in spherical coordinate system\n",
- "\n",
- "Xs=R*scipy.cos(phic)*scipy.sin(theta)\n",
- "Ys=R*scipy.sin(phic)*scipy.sin(theta)\n",
- "Zs=R*scipy.cos(theta)\n",
- "AR=Ys*scipy.sin(theta)*scipy.cos(phic)+(Xs+Zs)*scipy.sin(theta)*scipy.sin(phic) \n",
- "Ath=Ys*scipy.cos(theta)*scipy.cos(phic)+(Xs+Zs)*scipy.cos(theta)*scipy.sin(phic) \n",
- "Aph=-Ys*scipy.sin(phic)+(Xs+Zs)*scipy.cos(phic)\n",
- "Asph=array([round(AR,4),round(Ath,4),round(Aph,3)])\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'P in cylindrical coordinates =',Pcyl\n",
- "print 'P in spherical coordinates =',Psph\n",
- "print 'A in cylindrical coordinates =',Acyl\n",
- "print 'A in spherical coordinates =',Asph"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "P in cylindrical coordinates = [ 6.32 108.43 3. ]\n",
- "P in spherical coordinates = [ 7. 64.62 108.43]\n",
- "A in cylindrical coordinates = [-0.9487 -6.008 0. ]\n",
- "A in spherical coordinates = [-0.8571 -0.4066 -6.008 ]\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.2, Page number: 39<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Express vector B = 10/R a_r+ r cos(theta) a_(theta) + a(phi)\n",
- "in Cartesian and cylindrical coordinates. \n",
- "Find B (- 3, 4, 0) and B (5, pi/2, - 2). '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- " \n",
- "#Variable Declaration\n",
- "\n",
- "x=-3\n",
- "y=4\n",
- "z=0\n",
- "p=5\n",
- "phi=scipy.pi/2 \n",
- "Zc=-2\n",
- "\n",
- "#Calculations\n",
- "\n",
- " #B in cartesian coordinates\n",
- "\n",
- "R=scipy.sqrt(x**2+y**2+z**2)\n",
- "r=scipy.sqrt(x**2+y**2) \n",
- "P=scipy.arcsin(r/R) #in radians\n",
- "Q=scipy.arccos(x/r) #in radians \n",
- "f=10/R \n",
- "Bx=f*scipy.sin(P)*scipy.cos(Q)+R*(scipy.cos(P))**2*scipy.cos(Q)-scipy.sin(Q) \n",
- "By=f*scipy.sin(P)*scipy.sin(Q)+R*(scipy.cos(P))**2*scipy.sin(Q)+scipy.cos(Q) \n",
- "Bz=f*scipy.cos(P)-R*scipy.cos(P)*scipy.sin(P) \n",
- "Bcart=array([round(Bx,0),round(By,0),round(-Bz,0)])\n",
- "\n",
- " #B in cylindrical coordinates\n",
- " \n",
- "Rc=sqrt(p**2+Zc**2) \n",
- "Pc=scipy.arccos(Zc/Rc) #in radians\n",
- "Br=(10/Rc)*scipy.sin(Pc)+Rc*(scipy.cos(Pc))**2 \n",
- "Bp=1 \n",
- "Bzc=(10/Rc)*scipy.cos(Pc)-Rc*scipy.cos(Pc)*scipy.sin(Pc) \n",
- "Bcyl=array([round(Br,3),Bp,round(Bzc,3)])\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'B(-3,4,0) in cartesian coordinates is',Bcart\n",
- "print 'B(5,pi/2,-2) in cylindrical coordinates is',Bcyl"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "B(-3,4,0) in cartesian coordinates is [-2. 1. 0.]\n",
- "B(5,pi/2,-2) in cylindrical coordinates is [ 2.467 1. 1.167]\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.3, Page number: 44<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Two uniform vector fields are gIven by E=-5a_p+10a_phi+3a_z and\n",
- "F=a_p+2a_phi-6a_z. Calculate \n",
- "(a) |E X F|\n",
- "(b) The vector component of E at P(5, pi/2, 3) parallel to the line x=2, z=3 \n",
- "(c) The angle E makes with the surface z = 3 at P '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "E=array([-5,10,3]) #in cylindrical coordinates\n",
- "F=array([1,2,-6]) #in cylindrical coordinates\n",
- "P=array([5,scipy.pi/2,3]) #in cylindrical coordinates\n",
- "\n",
- "#Calculations\n",
- "\n",
- "exf=cross(E,F)\n",
- "ansa=scipy.sqrt(dot(exf,exf)) #|EXF|\n",
- "ay=array([round(scipy.sin(scipy.pi/2),0),\n",
- " round(scipy.cos(scipy.pi/2),0),0])\n",
- "ansb=dot(E,ay)*ay\n",
- "modE=scipy.sqrt(dot(E,E))\n",
- "az=array([0,0,1])\n",
- "thetaEz=(180/scipy.pi)*arccos(dot(E,az)/modE) #in degrees\n",
- "ansc=90-thetaEz #in degrees\n",
- "\n",
- "#Results\n",
- "\n",
- "print '|EXF| =',round(ansa,2)\n",
- "print 'The vector component of E at P parallel to the line x=2,z=3 =',ansb,','\n",
- "print 'in spherical coordinates'\n",
- "print 'The angle E makes with the surface z = 3 at P =',round(ansc,2),'degrees'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "|EXF| = 74.06\n",
- "The vector component of E at P parallel to the line x=2,z=3 = [-5. -0. -0.] ,\n",
- "in spherical coordinates\n",
- "The angle E makes with the surface z = 3 at P = 15.02 degrees\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.4, Page number: 45<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- " '''\n",
- "Given a vector field \n",
- "D = r*sin(phi)a_r-(1/r)*sin(theta)*cos(phi)a_theta+ r^2*a_phi, determine\n",
- "(a) D at P(10,150\u00b0,330\u00b0) \n",
- "(b) The component of D tangential to the spherical surface r = 10 at P \n",
- "(c) A unit vector at P perpendicular to D and tangential to the cone 0 = 150\u00b0 '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "aR=array([1,0,0]) #Unit vector along radial direction\n",
- "ath=array([0,1,0]) #Unit vector along theta direction\n",
- "aph=array([0,0,1]) #Unit vector along phi direction\n",
- "P=array([10,scipy.pi*150/180,scipy.pi*330/180])\n",
- "\n",
- "#Calculations\n",
- "\n",
- "r=dot(P,aR)\n",
- "q=dot(P,aph)\n",
- "p=dot(P,ath)\n",
- "R=r*scipy.sin(q)\n",
- "Ph=-scipy.sin(p)*scipy.cos(q)/r\n",
- "Q=r*r\n",
- "D=array([R,Ph,Q]) #D at P(10,150\u00b0,330\u00b0)\n",
- "rDr=round(dot(aR,D),0) #radial component of D\n",
- "rDth=round(dot(-ath,D),3) #theta component of D\n",
- "rDph=round(dot(aph,D),0) #phi component of D\n",
- "\n",
- "Dn=array([r*scipy.sin(q),0,0]) #Component of D normal to surface r=10\n",
- "Dt=D-Dn #Component of D tangential to surface r=10\n",
- "Dtr=round(dot(aR,Dt),0) #radial component of Dt\n",
- "Dtth=round(dot(-ath,Dt),3) #theta component of Dt\n",
- "Dtph=round(dot(aph,Dt),0) #phi component of Dt\n",
- "rDt=array([Dtr,Dtth,Dtph])\n",
- "\n",
- " #Unit vector normal to D and tangential to cone theta=45 degrees\n",
- "\n",
- "U=cross(D,ath)\n",
- "u=U/scipy.sqrt(dot(U,U)) \n",
- "ru=array([round(dot(aR,u),4),round(dot(ath,u),4),round(dot(aph,u),4)])\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'D at P(10,150\u00b0,330\u00b0) = [',rDr,' ',rDth,' ',rDph,']'\n",
- "print 'The component of D tangential to the spherical surface r = 10 at P ='\n",
- "print '[',Dtr,' ',Dtth,' ',Dtph,']'\n",
- "print 'A unit vector at P perpendicular to D and tangential to cone 0 = 150\u00b0 ='\n",
- "print ru"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "D at P(10,150\u00b0,330\u00b0) = [ -5.0 0.043 100.0 ]\n",
- "The component of D tangential to the spherical surface r = 10 at P =\n",
- "[ 0.0 0.043 100.0 ]\n",
- "A unit vector at P perpendicular to D and tangential to cone 0 = 150\u00b0 =\n",
- "[-0.9988 0. -0.0499]\n"
- ]
- }
- ],
- "prompt_number": 10
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:d78c85d754b20d2817dcaff01d1e4d9adbe09676da8e1b1ab97dcc0ae047a88a"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 2: Coordinate Systems and Transformation<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.1, Page number: 36<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "x=-2\n",
+ "y=6\n",
+ "z=3 \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "r=scipy.sqrt(x**2+y**2)\n",
+ "phi=scipy.arctan(-y/x) #phi in radians in 1st quadrant\n",
+ "phid=180-(phi*180/scipy.pi) #phi in degrees in second quadrant\n",
+ "phic=scipy.pi*phid/180.0 #phi in radians in second quadrant\n",
+ "R=scipy.sqrt(x**2+y**2+z**2) \n",
+ "theta=scipy.arctan(r/z) \n",
+ "\n",
+ " #P in cylindrical coordinates\n",
+ " \n",
+ "Pcyl=array([round(r,2),round(phid,2),z]) \n",
+ "\n",
+ " #P in spherical coordinates\n",
+ " \n",
+ "Psph=array([round(R,2),round(theta*180/scipy.pi,2),\n",
+ " round(phid,2)]) \n",
+ "\n",
+ " #Vector A in cylindrical coordinate system\n",
+ "\n",
+ "Xc=r*scipy.cos(phic)\n",
+ "Yc=r*scipy.sin(phic)\n",
+ "Zc=z \n",
+ "Ar=Yc*scipy.cos(phic)+(Xc+Zc)*scipy.sin(phic)\n",
+ "Aphi=-Yc*scipy.sin(phic)+(Xc+Zc)*scipy.cos(phic)\n",
+ "Az=0\n",
+ "Acyl=array([round(Ar,4),round(Aphi,3),Az])\n",
+ "\n",
+ " #Vector A in spherical coordinate system\n",
+ "\n",
+ "Xs=R*scipy.cos(phic)*scipy.sin(theta)\n",
+ "Ys=R*scipy.sin(phic)*scipy.sin(theta)\n",
+ "Zs=R*scipy.cos(theta)\n",
+ "AR=Ys*scipy.sin(theta)*scipy.cos(phic)+(Xs+Zs)*scipy.sin(theta)*scipy.sin(phic) \n",
+ "Ath=Ys*scipy.cos(theta)*scipy.cos(phic)+(Xs+Zs)*scipy.cos(theta)*scipy.sin(phic) \n",
+ "Aph=-Ys*scipy.sin(phic)+(Xs+Zs)*scipy.cos(phic)\n",
+ "Asph=array([round(AR,4),round(Ath,4),round(Aph,3)])\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'P in cylindrical coordinates =',Pcyl\n",
+ "print 'P in spherical coordinates =',Psph\n",
+ "print 'A in cylindrical coordinates =',Acyl\n",
+ "print 'A in spherical coordinates =',Asph"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "P in cylindrical coordinates = [ 6.32 108.43 3. ]\n",
+ "P in spherical coordinates = [ 7. 64.62 108.43]\n",
+ "A in cylindrical coordinates = [-0.9487 -6.008 0. ]\n",
+ "A in spherical coordinates = [-0.8571 -0.4066 -6.008 ]\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.2, Page number: 39<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ " \n",
+ "#Variable Declaration\n",
+ "\n",
+ "x=-3\n",
+ "y=4\n",
+ "z=0\n",
+ "p=5\n",
+ "phi=scipy.pi/2 \n",
+ "Zc=-2\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ " #B in cartesian coordinates\n",
+ "\n",
+ "R=scipy.sqrt(x**2+y**2+z**2)\n",
+ "r=scipy.sqrt(x**2+y**2) \n",
+ "P=scipy.arcsin(r/R) #in radians\n",
+ "Q=scipy.arccos(x/r) #in radians \n",
+ "f=10/R \n",
+ "Bx=f*scipy.sin(P)*scipy.cos(Q)+R*(scipy.cos(P))**2*scipy.cos(Q)-scipy.sin(Q) \n",
+ "By=f*scipy.sin(P)*scipy.sin(Q)+R*(scipy.cos(P))**2*scipy.sin(Q)+scipy.cos(Q) \n",
+ "Bz=f*scipy.cos(P)-R*scipy.cos(P)*scipy.sin(P) \n",
+ "Bcart=array([round(Bx,0),round(By,0),round(-Bz,0)])\n",
+ "\n",
+ " #B in cylindrical coordinates\n",
+ " \n",
+ "Rc=sqrt(p**2+Zc**2) \n",
+ "Pc=scipy.arccos(Zc/Rc) #in radians\n",
+ "Br=(10/Rc)*scipy.sin(Pc)+Rc*(scipy.cos(Pc))**2 \n",
+ "Bp=1 \n",
+ "Bzc=(10/Rc)*scipy.cos(Pc)-Rc*scipy.cos(Pc)*scipy.sin(Pc) \n",
+ "Bcyl=array([round(Br,3),Bp,round(Bzc,3)])\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'B(-3,4,0) in cartesian coordinates is',Bcart\n",
+ "print 'B(5,pi/2,-2) in cylindrical coordinates is',Bcyl"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "B(-3,4,0) in cartesian coordinates is [-2. 1. 0.]\n",
+ "B(5,pi/2,-2) in cylindrical coordinates is [ 2.467 1. 1.167]\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.3, Page number: 44<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "E=array([-5,10,3]) #in cylindrical coordinates\n",
+ "F=array([1,2,-6]) #in cylindrical coordinates\n",
+ "P=array([5,scipy.pi/2,3]) #in cylindrical coordinates\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "exf=cross(E,F)\n",
+ "ansa=scipy.sqrt(dot(exf,exf)) #|EXF|\n",
+ "ay=array([round(scipy.sin(scipy.pi/2),0),\n",
+ " round(scipy.cos(scipy.pi/2),0),0])\n",
+ "ansb=dot(E,ay)*ay\n",
+ "modE=scipy.sqrt(dot(E,E))\n",
+ "az=array([0,0,1])\n",
+ "thetaEz=(180/scipy.pi)*arccos(dot(E,az)/modE) #in degrees\n",
+ "ansc=90-thetaEz #in degrees\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print '|EXF| =',round(ansa,2)\n",
+ "print 'The vector component of E at P parallel to the line x=2,z=3 =',ansb,','\n",
+ "print 'in spherical coordinates'\n",
+ "print 'The angle E makes with the surface z = 3 at P =',round(ansc,2),'degrees'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "|EXF| = 74.06\n",
+ "The vector component of E at P parallel to the line x=2,z=3 = [-5. -0. -0.] ,\n",
+ "in spherical coordinates\n",
+ "The angle E makes with the surface z = 3 at P = 15.02 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.4, Page number: 45<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "aR=array([1,0,0]) #Unit vector along radial direction\n",
+ "ath=array([0,1,0]) #Unit vector along theta direction\n",
+ "aph=array([0,0,1]) #Unit vector along phi direction\n",
+ "P=array([10,scipy.pi*150/180,scipy.pi*330/180])\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "r=dot(P,aR)\n",
+ "q=dot(P,aph)\n",
+ "p=dot(P,ath)\n",
+ "R=r*scipy.sin(q)\n",
+ "Ph=-scipy.sin(p)*scipy.cos(q)/r\n",
+ "Q=r*r\n",
+ "D=array([R,Ph,Q]) #D at P(10,150\u00b0,330\u00b0)\n",
+ "rDr=round(dot(aR,D),0) #radial component of D\n",
+ "rDth=round(dot(-ath,D),3) #theta component of D\n",
+ "rDph=round(dot(aph,D),0) #phi component of D\n",
+ "\n",
+ "Dn=array([r*scipy.sin(q),0,0]) #Component of D normal to surface r=10\n",
+ "Dt=D-Dn #Component of D tangential to surface r=10\n",
+ "Dtr=round(dot(aR,Dt),0) #radial component of Dt\n",
+ "Dtth=round(dot(-ath,Dt),3) #theta component of Dt\n",
+ "Dtph=round(dot(aph,Dt),0) #phi component of Dt\n",
+ "rDt=array([Dtr,Dtth,Dtph])\n",
+ "\n",
+ " #Unit vector normal to D and tangential to cone theta=45 degrees\n",
+ "\n",
+ "U=cross(D,ath)\n",
+ "u=U/scipy.sqrt(dot(U,U)) \n",
+ "ru=array([round(dot(aR,u),4),round(dot(ath,u),4),round(dot(aph,u),4)])\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'D at P(10,150\u00b0,330\u00b0) = [',rDr,' ',rDth,' ',rDph,']'\n",
+ "print 'The component of D tangential to the spherical surface r = 10 at P ='\n",
+ "print '[',Dtr,' ',Dtth,' ',Dtph,']'\n",
+ "print 'A unit vector at P perpendicular to D and tangential to cone 0 = 150\u00b0 ='\n",
+ "print ru"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "D at P(10,150\u00b0,330\u00b0) = [ -5.0 0.043 100.0 ]\n",
+ "The component of D tangential to the spherical surface r = 10 at P =\n",
+ "[ 0.0 0.043 100.0 ]\n",
+ "A unit vector at P perpendicular to D and tangential to cone 0 = 150\u00b0 =\n",
+ "[-0.9988 0. -0.0499]\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_3.ipynb b/Elements_of_Electromagnetics/chapter_3.ipynb
index 88c80683..c8dcfb12 100644
--- a/Elements_of_Electromagnetics/chapter_3.ipynb
+++ b/Elements_of_Electromagnetics/chapter_3.ipynb
@@ -1,389 +1,370 @@
-{
- "metadata": {
- "name": "chapter_3.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 3: Vector Calculus<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.1, Page number: 58<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Consider the object shown in Figure 3.7. Calculate \n",
- "(a) The distance BC \n",
- "(b) The distance CD \n",
- "(c) The surface area ABCD \n",
- "(d) The surface area ABO \n",
- "(e) The surface area AOFD \n",
- "(f) The volume ABDCFO '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "import scipy.integrate\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "A=array([5,0,0])\n",
- "B=array([0,5,0])\n",
- "C=array([0,5,10])\n",
- "D=array([5,0,10])\n",
- "\n",
- "#Calculations\n",
- "\n",
- " #A,B,C,D in cylindrical coordinates\n",
- " \n",
- "A=array([5,0,0])\n",
- "B=array([5,scipy.pi,0])\n",
- "C=array([5,scipy.pi,10])\n",
- "D=array([5,0,10])\n",
- "\n",
- "p=5\n",
- "\n",
- "def BC(z): \n",
- " return 1\n",
- "ansa, erra = scipy.integrate.quad(BC, 0, 10)\n",
- " \n",
- "def CD(phi): \n",
- " return p\n",
- "ansb, errb = scipy.integrate.quad(CD, 0, scipy.pi/2)\n",
- "ansbb=ansb/scipy.pi #answer in multiples of pi\n",
- "\n",
- "def ABCD(phi,z): \n",
- " return p\n",
- "ansc, errc = scipy.integrate.dblquad(lambda z , phi: ABCD(phi,z), \n",
- " 0, scipy.pi/2, lambda z: 0, lambda z: 10) \n",
- "anscc=ansc/scipy.pi #answer in multiples of pi\n",
- " \n",
- "def ABO(phi,rho): \n",
- " return rho\n",
- "ansd, errd = scipy.integrate.dblquad(lambda rho , phi: ABO(phi,rho), \n",
- " 0, scipy.pi/2, lambda rho: 0, lambda rho: 5)\n",
- "ansdd=ansd/scipy.pi #answer in multiples of pi\n",
- "\n",
- "def AOFD(rho,z): \n",
- " return 1\n",
- "anse, erre = scipy.integrate.dblquad(lambda z , rho: AOFD(rho,z), \n",
- " 0, 10, lambda z: 0, lambda z: 5)\n",
- " \n",
- "def ABDCFO(z,phi,rho):\n",
- " return rho\n",
- "ansf, errf=scipy.integrate.tplquad(ABDCFO,0,5,lambda rho:0,\n",
- " lambda rho:scipy.pi/2,lambda rho,phi:0,lambda rho,phi:10)\n",
- "ansff=ansf/scipy.pi #answer in multiples of pi\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The distance BC =',ansa\n",
- "print 'The distance CD =',ansbb,'pi'\n",
- "print 'The surface area ABCD =',anscc,'pi'\n",
- "print 'The surface area ABO =',ansdd,'pi'\n",
- "print 'The surface area AOFD =',anse\n",
- "print 'The volume ABDCFO =',ansff,'pi'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The distance BC = 10.0\n",
- "The distance CD = 2.5 pi\n",
- "The surface area ABCD = 25.0 pi\n",
- "The surface area ABO = 6.25 pi\n",
- "The surface area AOFD = 50.0\n",
- "The volume ABDCFO = 62.5 pi\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.2, Page number: 61<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Given that F = x^2 a_x - xza_y - y^2 a_z , calculate the \n",
- "circulation of F around the (closed) path shown in Figure 3.10. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "import scipy.integrate\n",
- "from fractions import Fraction\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "\n",
- "#Calculations\n",
- "\n",
- "def C1(x): \n",
- " return x**2\n",
- "seg1, err1 = scipy.integrate.quad(C1, 1, 0) #segment 1\n",
- "Seg1=Fraction(seg1).limit_denominator(100) #converting to fraction\n",
- "\n",
- "def C2(y): \n",
- " return 0\n",
- "seg2, err2 = scipy.integrate.quad(C2, 0, 1) #segment 2\n",
- "\n",
- "def C3(x): \n",
- " return (x**2-1)\n",
- "seg3, err3 = scipy.integrate.quad(C3, 0, 1) #segment 3\n",
- "Seg3=Fraction(seg3).limit_denominator(100) #converting to fraction\n",
- "\n",
- "def C4(y): \n",
- " return (-y-y**2)\n",
- "seg4, err4 = scipy.integrate.quad(C4, 1, 0) #segment 4\n",
- "Seg4=Fraction(seg4).limit_denominator(100) #converting to fraction\n",
- "\n",
- "seg=Seg1+seg2+Seg3+Seg4 #total circulation around path\n",
- "Seg=Fraction(seg).limit_denominator(100) #converting to fraction\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'F along segment 1 is',Seg1\n",
- "print 'F along segment 2 is',seg2\n",
- "print 'F along segment 3 is',Seg3\n",
- "print 'F along segment 4 is',Seg4\n",
- "print 'Circulation of F around the path is',Seg"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "F along segment 1 is -1/3\n",
- "F along segment 2 is 0.0\n",
- "F along segment 3 is -2/3\n",
- "F along segment 4 is 5/6\n",
- "Circulation of F around the path is -1/6\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 3.4, Page number: 68"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Given W = x^2 y^2 + xyz, compute VW and the direction derivative dW/dl in the direction \n",
- "3a_x + 4a_y + 12a_z at (2, -1, 0). '''\n",
- "\n",
- "import scipy\n",
- "from fractions import Fraction\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "Al=array([3,4,12])\n",
- "x=2\n",
- "y=-1\n",
- "z=0\n",
- "\n",
- "#Calculations\n",
- "\n",
- "gradW=(2*x*y**2+y*z)*ax+(2*x**2*y+x*z)*ay+(x*y)*az\n",
- "gradWl=Fraction(dot(gradW,Al)/scipy.sqrt(dot(Al,Al))).limit_denominator(1000)\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'dW/dl =',gradWl\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "dW/dl = -44/13\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 3.7, Page number: 74"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "If G(r) = lOe^-2z(pa_p + a_z\u001f), determine the flux of G out of the entire surface of the cylinder \n",
- "p = 1, 0 < Z < 1. Confirm the result using the divergence theorem. '''\n",
- "\n",
- "import scipy\n",
- "import scipy.integrate\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ap=array([1,0,0]) #Unit vector along radial direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "\n",
- "#Calculations\n",
- "\n",
- "def psi1(phi,p): \n",
- " return 10*scipy.e**(-2)*p\n",
- "psit, errt = scipy.integrate.dblquad(lambda p , phi: psi1(phi,p), #flux through top\n",
- " 0, 2*scipy.pi, lambda p: 0, lambda p: 1) \n",
- "\n",
- "def psi2(phi,p): \n",
- " return -10*p\n",
- "psib, errb = scipy.integrate.dblquad(lambda p , phi: psi2(phi,p), #flux through bottom\n",
- " 0, 2*scipy.pi, lambda p: 0, lambda p: 1) \n",
- "\n",
- "def psi3(phi,z): \n",
- " return 10*scipy.exp(-2*z)\n",
- "psis, errs = scipy.integrate.dblquad(lambda z , phi: psi3(phi,z), #flux through side\n",
- " 0, scipy.pi*2, lambda z: 0, lambda z: 1) \n",
- "\n",
- "psi=psit+psib+psis #total flux through cylinder\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The total flux through the cylinder is',psi\n",
- "print 'The total flux through cylinder using divergence theorem is also 0'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The total flux through the cylinder is 0.0\n",
- "The total flux through cylinder using divergence theorem is also 0\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.9, Page number: 81<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "If A = p cos(phi) a_p + sin(phi)a_phi, evaluate closed integral A\u00b7dl\n",
- "around the path shown in Figure 3.22. \n",
- "Confirm this using Stokes's theorem. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "import scipy.integrate\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ap=array([1,0,0]) #Unit vector along radial direction\n",
- "ath=array([0,1,0]) #Unit vector along theta direction\n",
- "aph=array([0,0,1]) #Unit vector along phi direction\n",
- "\n",
- "#Calculations\n",
- "\n",
- " #segment 1\n",
- "def ab(phi): \n",
- " return 2*scipy.sin(phi)\n",
- "seg1,err1 = scipy.integrate.quad(ab,scipy.pi*60/180,scipy.pi*30/180) \n",
- "\n",
- " #segment 2\n",
- "def bc(p): \n",
- " return p*scipy.cos(scipy.pi*30/180)\n",
- "seg2,err2 = scipy.integrate.quad(bc,2,5) \n",
- "\n",
- " #segment 3\n",
- "def cd(phi): \n",
- " return 5*scipy.sin(phi)\n",
- "seg3,err3 = scipy.integrate.quad(cd,-scipy.pi*30/180,scipy.pi*60/180)\n",
- "\n",
- " #segment 4\n",
- "def da(p): \n",
- " return p*scipy.cos(scipy.pi*60/180)\n",
- "seg4,err4 = scipy.integrate.quad(da,5,2)\n",
- "\n",
- "I1=seg1+seg2+seg3+seg4\n",
- "\n",
- " #using stoke's theorem\n",
- "\n",
- "def curlA(phi,p): \n",
- " return ((1+p)*scipy.sin(phi))\n",
- "I2, err = scipy.integrate.dblquad(lambda p , phi: curlA(phi,p), \n",
- " scipy.pi*30/180, scipy.pi*60/180, lambda p: 2, lambda p: 5)\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The integral calculated segment wise =',round(I1,3)\n",
- "print 'The integral calculated using Stokes Theorem =',round(I2,3)\n",
- "print 'Since I1 = I2, Stokes theorem is verified'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The integral calculated segment wise = 4.941\n",
- "The integral calculated using Stokes Theorem = 4.941\n",
- "Since I1 = I2, Stokes theorem is verified\n"
- ]
- }
- ],
- "prompt_number": 3
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:02fdf3d71909ffefa3365717544dbd108f534a28cb15d60e71866e85ef9ac76f"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 3: Vector Calculus<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.1, Page number: 58<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "import scipy.integrate\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "A=array([5,0,0])\n",
+ "B=array([0,5,0])\n",
+ "C=array([0,5,10])\n",
+ "D=array([5,0,10])\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ " #A,B,C,D in cylindrical coordinates\n",
+ " \n",
+ "A=array([5,0,0])\n",
+ "B=array([5,scipy.pi,0])\n",
+ "C=array([5,scipy.pi,10])\n",
+ "D=array([5,0,10])\n",
+ "\n",
+ "p=5\n",
+ "\n",
+ "def BC(z): \n",
+ " return 1\n",
+ "ansa, erra = scipy.integrate.quad(BC, 0, 10)\n",
+ " \n",
+ "def CD(phi): \n",
+ " return p\n",
+ "ansb, errb = scipy.integrate.quad(CD, 0, scipy.pi/2)\n",
+ "ansbb=ansb/scipy.pi #answer in multiples of pi\n",
+ "\n",
+ "def ABCD(phi,z): \n",
+ " return p\n",
+ "ansc, errc = scipy.integrate.dblquad(lambda z , phi: ABCD(phi,z), \n",
+ " 0, scipy.pi/2, lambda z: 0, lambda z: 10) \n",
+ "anscc=ansc/scipy.pi #answer in multiples of pi\n",
+ " \n",
+ "def ABO(phi,rho): \n",
+ " return rho\n",
+ "ansd, errd = scipy.integrate.dblquad(lambda rho , phi: ABO(phi,rho), \n",
+ " 0, scipy.pi/2, lambda rho: 0, lambda rho: 5)\n",
+ "ansdd=ansd/scipy.pi #answer in multiples of pi\n",
+ "\n",
+ "def AOFD(rho,z): \n",
+ " return 1\n",
+ "anse, erre = scipy.integrate.dblquad(lambda z , rho: AOFD(rho,z), \n",
+ " 0, 10, lambda z: 0, lambda z: 5)\n",
+ " \n",
+ "def ABDCFO(z,phi,rho):\n",
+ " return rho\n",
+ "ansf, errf=scipy.integrate.tplquad(ABDCFO,0,5,lambda rho:0,\n",
+ " lambda rho:scipy.pi/2,lambda rho,phi:0,lambda rho,phi:10)\n",
+ "ansff=ansf/scipy.pi #answer in multiples of pi\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The distance BC =',ansa\n",
+ "print 'The distance CD =',ansbb,'pi'\n",
+ "print 'The surface area ABCD =',anscc,'pi'\n",
+ "print 'The surface area ABO =',ansdd,'pi'\n",
+ "print 'The surface area AOFD =',anse\n",
+ "print 'The volume ABDCFO =',ansff,'pi'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The distance BC = 10.0\n",
+ "The distance CD = 2.5 pi\n",
+ "The surface area ABCD = 25.0 pi\n",
+ "The surface area ABO = 6.25 pi\n",
+ "The surface area AOFD = 50.0\n",
+ "The volume ABDCFO = 62.5 pi\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.2, Page number: 61<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "import scipy.integrate\n",
+ "from fractions import Fraction\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "def C1(x): \n",
+ " return x**2\n",
+ "seg1, err1 = scipy.integrate.quad(C1, 1, 0) #segment 1\n",
+ "Seg1=Fraction(seg1).limit_denominator(100) #converting to fraction\n",
+ "\n",
+ "def C2(y): \n",
+ " return 0\n",
+ "seg2, err2 = scipy.integrate.quad(C2, 0, 1) #segment 2\n",
+ "\n",
+ "def C3(x): \n",
+ " return (x**2-1)\n",
+ "seg3, err3 = scipy.integrate.quad(C3, 0, 1) #segment 3\n",
+ "Seg3=Fraction(seg3).limit_denominator(100) #converting to fraction\n",
+ "\n",
+ "def C4(y): \n",
+ " return (-y-y**2)\n",
+ "seg4, err4 = scipy.integrate.quad(C4, 1, 0) #segment 4\n",
+ "Seg4=Fraction(seg4).limit_denominator(100) #converting to fraction\n",
+ "\n",
+ "seg=Seg1+seg2+Seg3+Seg4 #total circulation around path\n",
+ "Seg=Fraction(seg).limit_denominator(100) #converting to fraction\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'F along segment 1 is',Seg1\n",
+ "print 'F along segment 2 is',seg2\n",
+ "print 'F along segment 3 is',Seg3\n",
+ "print 'F along segment 4 is',Seg4\n",
+ "print 'Circulation of F around the path is',Seg"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "F along segment 1 is -1/3\n",
+ "F along segment 2 is 0.0\n",
+ "F along segment 3 is -2/3\n",
+ "F along segment 4 is 5/6\n",
+ "Circulation of F around the path is -1/6\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.4, Page number: 68"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from fractions import Fraction\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "Al=array([3,4,12])\n",
+ "x=2\n",
+ "y=-1\n",
+ "z=0\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "gradW=(2*x*y**2+y*z)*ax+(2*x**2*y+x*z)*ay+(x*y)*az\n",
+ "gradWl=Fraction(dot(gradW,Al)/scipy.sqrt(dot(Al,Al))).limit_denominator(1000)\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'dW/dl =',gradWl\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "dW/dl = -44/13\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.7, Page number: 74"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import scipy.integrate\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ap=array([1,0,0]) #Unit vector along radial direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "def psi1(phi,p): \n",
+ " return 10*scipy.e**(-2)*p\n",
+ "psit, errt = scipy.integrate.dblquad(lambda p , phi: psi1(phi,p), #flux through top\n",
+ " 0, 2*scipy.pi, lambda p: 0, lambda p: 1) \n",
+ "\n",
+ "def psi2(phi,p): \n",
+ " return -10*p\n",
+ "psib, errb = scipy.integrate.dblquad(lambda p , phi: psi2(phi,p), #flux through bottom\n",
+ " 0, 2*scipy.pi, lambda p: 0, lambda p: 1) \n",
+ "\n",
+ "def psi3(phi,z): \n",
+ " return 10*scipy.exp(-2*z)\n",
+ "psis, errs = scipy.integrate.dblquad(lambda z , phi: psi3(phi,z), #flux through side\n",
+ " 0, scipy.pi*2, lambda z: 0, lambda z: 1) \n",
+ "\n",
+ "psi=psit+psib+psis #total flux through cylinder\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The total flux through the cylinder is',psi\n",
+ "print 'The total flux through cylinder using divergence theorem is also 0'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total flux through the cylinder is 0.0\n",
+ "The total flux through cylinder using divergence theorem is also 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.9, Page number: 81<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "import scipy.integrate\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ap=array([1,0,0]) #Unit vector along radial direction\n",
+ "ath=array([0,1,0]) #Unit vector along theta direction\n",
+ "aph=array([0,0,1]) #Unit vector along phi direction\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ " #segment 1\n",
+ "def ab(phi): \n",
+ " return 2*scipy.sin(phi)\n",
+ "seg1,err1 = scipy.integrate.quad(ab,scipy.pi*60/180,scipy.pi*30/180) \n",
+ "\n",
+ " #segment 2\n",
+ "def bc(p): \n",
+ " return p*scipy.cos(scipy.pi*30/180)\n",
+ "seg2,err2 = scipy.integrate.quad(bc,2,5) \n",
+ "\n",
+ " #segment 3\n",
+ "def cd(phi): \n",
+ " return 5*scipy.sin(phi)\n",
+ "seg3,err3 = scipy.integrate.quad(cd,-scipy.pi*30/180,scipy.pi*60/180)\n",
+ "\n",
+ " #segment 4\n",
+ "def da(p): \n",
+ " return p*scipy.cos(scipy.pi*60/180)\n",
+ "seg4,err4 = scipy.integrate.quad(da,5,2)\n",
+ "\n",
+ "I1=seg1+seg2+seg3+seg4\n",
+ "\n",
+ " #using stoke's theorem\n",
+ "\n",
+ "def curlA(phi,p): \n",
+ " return ((1+p)*scipy.sin(phi))\n",
+ "I2, err = scipy.integrate.dblquad(lambda p , phi: curlA(phi,p), \n",
+ " scipy.pi*30/180, scipy.pi*60/180, lambda p: 2, lambda p: 5)\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The integral calculated segment wise =',round(I1,3)\n",
+ "print 'The integral calculated using Stokes Theorem =',round(I2,3)\n",
+ "print 'Since I1 = I2, Stokes theorem is verified'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The integral calculated segment wise = 4.941\n",
+ "The integral calculated using Stokes Theorem = 4.941\n",
+ "Since I1 = I2, Stokes theorem is verified\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_4.ipynb b/Elements_of_Electromagnetics/chapter_4.ipynb
index 14ac4af2..d64b61ce 100644
--- a/Elements_of_Electromagnetics/chapter_4.ipynb
+++ b/Elements_of_Electromagnetics/chapter_4.ipynb
@@ -1,699 +1,652 @@
-{
- "metadata": {
- "name": "chapter_4.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 4: Electrostatic Fields<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.1, Page number: 107<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Point charges 1 mC and -2 mC are located at (3,2,-1) and (-1,-1,4),\n",
- "respectively. Calculate the electric force on a 10 nC charge located\n",
- "at (0,3,1) and the electric field intensity at that point. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "Q1=1*10**-3 #charge 1 at (-1,-1,4) in C\n",
- "Q2=-2*10**-3 #charge 2 at (3,2,-1) in C\n",
- "Q=10*10**-9 #charge 3 at (0,3,1) in C\n",
- "P1=array([0,3,1])-array([3,2,-1]) #distance vector from charge 3 to 1\n",
- "P2=array([0,3,1])-array([-1,-1,4]) #distance vector from charge 3 to 2\n",
- "e=10**-9/(36*scipy.pi) #permittivity in Farad/m \n",
- "\n",
- "#Calculations\n",
- "\n",
- "modP1=scipy.sqrt(dot(P1,P1))\n",
- "modP2=scipy.sqrt(dot(P2,P2))\n",
- "F1=(Q*Q1)*P1*10**3/(4*scipy.pi*e*modP1**3) #force on charge 3 by 1 in mN\n",
- "F2=(Q*Q2)*P2*10**3/(4*scipy.pi*e*modP2**3) #force on charge 3 by 2 in mN\n",
- "\n",
- " #Total force on charge 3\n",
- " \n",
- "Fx=round(dot(F1+F2,ax),3)\n",
- "Fy=round(dot(F1+F2,ay),3)\n",
- "Fz=round(dot(F1+F2,az),3)\n",
- "F=array([Fx,Fy,Fz]) #Total force in mN\n",
- "E=(10**-6)*(F/Q) #Electric field in kV/m\n",
- "\n",
- "#Results \n",
- "\n",
- "print 'Total force on charge at (0,3,1) =',F,'in mN'\n",
- "print 'Electric field at (0,3,1) =',E,'kV/m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Total force on charge at (0,3,1) = [-6.512 -3.713 7.509] in mN\n",
- "Electric field at (0,3,1) = [-651.2 -371.3 750.9] kV/m\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 4.3, Page number: 109"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A practical application of electrostatics is in electrostatic separation of solids. For example, \n",
- "Florida phosphate ore, consisting of small panicles of quartz and phosphate rock, can be \n",
- "separated into its components by applying a uniform electric field as in Figure 4.4. Assum- \n",
- "ing zero initial velocity and displacement, determine the separation between the particles \n",
- "after falling 80 cm. Take E = 500 kV/m and Q/m = 9 microC/kg for both positively and neg- \n",
- "atively charged particles. '''\n",
- "\n",
- "import scipy\n",
- "#Variable Declaration\n",
- "\n",
- "E=500*10**3 #electric field in V/m\n",
- "Qm=9*10**-6 #Q/m in C/kg\n",
- "y=0.8 #distance fallen in m\n",
- "g=9.8 #acceleration due to gravity in m/s^2\n",
- "\n",
- "#Calculations\n",
- "\n",
- "t=scipy.sqrt(2*y/g) #time taken to fall in seconds\n",
- "x=Qm*E*t**2/2 #half the separation between particles in m\n",
- "sep=2*x #separation between particles in m\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The separation between particles is',round(sep*100,2),'cm'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The separation between particles is 73.47 cm\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 4.5, Page number: 120"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The finite sheet 0 <= x <= 1, 0 <= y <= 1 on the z = 0 plane has a charge density \n",
- "Ps=xy(x^2 + y^2 + 25)^3/2 nC/m^2 . Find \n",
- "\u001f\u001d",
- "(a) The total charge on the sheet \n",
- "(b) The e1ectric field at (0, 0, 5) \n",
- "(c) The force experienced by a -1 mC charge located at (0, 0, 5) '''\n",
- "\n",
- "import scipy\n",
- "import scipy.integrate\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "q=-1 #charge in mC\n",
- "\n",
- "#Calculations\n",
- "\n",
- "def charge(x,y): \n",
- " return x*y*(x**2+y**2+25)**(1.5)\n",
- "Q, errq = scipy.integrate.dblquad(lambda y , x: charge(x,y), #total charge in nC\n",
- " 0, 1, lambda y: 0, lambda y: 1) \n",
- "\n",
- "d=(4*scipy.pi*Eo*(x**2+y**2+25)**(1.5))\n",
- "\n",
- "def elecx(x,y): \n",
- " return 10**-9*x*y*(x**2+y**2+25)**(1.5)*(-x)/d #x component of electric field\n",
- "Ex, errx = scipy.integrate.dblquad(lambda y , x: elecx(x,y), \n",
- " 0, 1, lambda y: 0, lambda y: 1) \n",
- "\n",
- "def elecy(x,y): \n",
- " return 10**-9*x*y*(x**2+y**2+25)**(1.5)*(-y)/d #y component of electric field\n",
- "Ey, erry = scipy.integrate.dblquad(lambda y , x: elecy(x,y), \n",
- " 0, 1, lambda y: 0, lambda y: 1) \n",
- "\n",
- "def elecz(x,y): \n",
- " return 10**-9*x*y*(5)/(4*scipy.pi*Eo) #z component of electric field\n",
- "Ez, errz = scipy.integrate.dblquad(lambda y , x: elecz(x,y), \n",
- " 0, 1, lambda y: 0, lambda y: 1) \n",
- "\n",
- "E=array([round(Ex,1),round(Ey,1),round(Ez,2)]) #electric field in V/m\n",
- "\n",
- "F=q*E #force in mN \n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Total charge =',round(Q,2),'nC'\n",
- "print 'Electric field at (0,0,5) =',E,'V/m'\n",
- "print 'Force experienced by -1mC =',F,'mN'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Total charge = 33.15 nC\n",
- "Electric field at (0,0,5) = [ -1.5 -1.5 11.25] V/m\n",
- "Force experienced by -1mC = [ 1.5 1.5 -11.25] mN\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.6, Page number: 121<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Planes x=2 and y=-3, respectively, carry charges 10 nC/m^2 and 15 nC/m^2 .\n",
- "If the line x=0, z=2 carries charge 10 pi nC/m, calculate E at (1,1,-1)\n",
- "due to the three charge distributions. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "ps1=10*10**-9 #Surface charge density of plane 1\n",
- "ps2=15*10**-9 #Surface charge density of plane 2\n",
- "pl=10*scipy.pi*10**-9 #charge density of line\n",
- "e=(10**-9)/(36*scipy.pi) #permittivity of free space in Farad/m\n",
- "\n",
- "#Calculations\n",
- "\n",
- "E1=(ps1/(2*e))*-ax/scipy.pi #field due to plane 1 in multiples of pi in V/m\n",
- "E2=(ps2/(2*e))*ay/scipy.pi #field due to plane 2 in multiples of pi in V/m\n",
- "\n",
- " #field due to line charge in multiples of pi in V/m\n",
- " \n",
- "a=(ax-3*az) \n",
- "moda=scipy.sqrt(dot((ax-3*az),(ax-3*az)))\n",
- "e3=(pl/(2*scipy.pi*e*moda**2))*a\n",
- "E3=array([dot(e3,ax)/scipy.pi,0,dot(e3,az)/scipy.pi])\n",
- "\n",
- " #total field in multiples of pi in V/m\n",
- " \n",
- "E=E1+E2+E3 \n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The total electric field at (1,1,-1) =',E,'Pi V/m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The total electric field at (1,1,-1) = [-162. 270. -54.] Pi V/m\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.7, Page number: 123<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Determine D at (4, 0, 3) if there is a point charge - 5pi mC\n",
- "at (4, 0, 0) and a line charge 3pi mC/m along the y-axis. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "Q=-5*scipy.pi*10**-3 #charge at (4,0,0) in C\n",
- "pl=3*scipy.pi*10**-3 #charge density of line charge in C/m\n",
- "r=array([4,0,3]) #point where D is to be found \n",
- "rp=array([4,0,0]) #position of point charge\n",
- "\n",
- "#Calculations \n",
- "\n",
- "R=r-rp \n",
- "modR=scipy.sqrt(dot(R,R)) \n",
- "Dq=(Q*R)/(4*scipy.pi*modR**3) #flux density due to point charge in C/m^2\n",
- "p=scipy.sqrt(dot(r,r))\n",
- "ap=r/p \n",
- "Dl=(pl/(2*scipy.pi*p))*ap #flux density due to line charge in C/m^2\n",
- "D=(Dq+Dl)*10**6 #total flux density in micro C/m^2\n",
- "Dz=round(dot(D,az),0)\n",
- "Dx=round(dot(D,ax),0)\n",
- "Dy=round(dot(D,ay),0)\n",
- "Dround=array([Dx,Dy,Dz]) #value of D rounded to 0 decimal points\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'D at (4,0,0) due to point charge and line charge =',Dround,'micro C/m^2'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "D at (4,0,0) due to point charge and line charge = [ 240. 0. 41.] micro C/m^2\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.8, Page number: 130<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Given that D = zp cos^2(phi) a_z C/m^2 , calculate the charge density \n",
- "at (1,pi/4, 3) and the total charge enclosed by the cylinder of \n",
- "radius 1 m with -2< Z <2 m. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "import scipy.integrate\n",
- "from fractions import Fraction\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ap=array([1,0,0]) #Unit vector along rho direction\n",
- "aph=array([0,1,0]) #Unit vector along phi direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "point=array([1,scipy.pi/4,3])\n",
- "p1=0\n",
- "p2=1\n",
- "ph1=0\n",
- "ph2=2*scipy.pi\n",
- "\n",
- "#Calculations\n",
- "\n",
- "pointp=dot(point,ap)\n",
- "pointph=dot(point,aph)\n",
- "pv=pointp*scipy.cos(pointph)**2 #charge density at (1,pi/4,3) in C/m^3\n",
- "\n",
- "def ctop(phi,p): \n",
- " return 2*p**2*(scipy.cos(phi)**2)\n",
- "psya, erra = scipy.integrate.dblquad(lambda p , phi: ctop(phi,p), \n",
- " ph1, ph2, lambda p: p1, lambda p: p2)\n",
- "\n",
- "def cbot(phi,p): \n",
- " return 2*p**2*(scipy.cos(phi)**2)\n",
- "psyb, errb = scipy.integrate.dblquad(lambda p , phi: cbot(phi,p), \n",
- " ph1, ph2, lambda p: p1, lambda p: p2)\n",
- " \n",
- "psy=psya+psyb #Charge in C\n",
- "psyp=psy/scipy.pi #Charge in multiples of Pi in C\n",
- "psyf=Fraction(psyp).limit_denominator(100) #converting to fraction\n",
- "\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Charge density at (1,pi/4,3) =',pv,'C/m^3'\n",
- "print 'Total charge enclosed by the cylinder =',psyf,'Pi C'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Charge density at (1,pi/4,3) = 0.5 C/m^3\n",
- "Total charge enclosed by the cylinder = 4/3 Pi C\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.10, Page number: 136<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Two point charges -4 micro C and 5 micro C are located at (2, -1, 3) \n",
- "and (0, 4, -2), respectively. Find the potential at (1, 0, 1) \n",
- "assuming zero potential at infinity. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Q1=-4 #charge 1 in micro C\n",
- "Q2=5 #charge 2 in micro C\n",
- "e=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m \n",
- "\n",
- "#Calculations\n",
- "\n",
- "R1=array([1,0,1])-array([2,-1,3]) #distance vector from (1,0,1) to charge 1\n",
- "R2=array([1,0,1])-array([0,4,-2]) #distance vector from (1,0,1) to charge 2\n",
- "modR1=scipy.sqrt(dot(R1,R1))\n",
- "modR2=scipy.sqrt(dot(R2,R2)) \n",
- "V=10**-9*((Q1/modR1)+(Q2/modR2))/(4*scipy.pi*e) #potential in kV\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The potential at (1, 0, 1) =',round(V,3),'kV'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The potential at (1, 0, 1) = -5.872 kV\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 4.11, Page number: 136"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A point charge 5 nC is located at (-3, 4, 0) while line y = 1, z = 1 carries uniform charge \n",
- "2 nC/m. \n",
- "\u001f\u001d",
- "(a) If V = 0V at O(0, 0, 0), find V at A(5, 0, ]). \n",
- "(b) If V = 100V at B(1, 2, 1), find V at C(-2, 5, 3). \n",
- "(c) If V = -5V at O, find V_BC '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
- "Vo=0 #potential at O in V\n",
- "Vb=100 #potential at B in V\n",
- "po=scipy.sqrt(2)\n",
- "ro=5\n",
- "pa=1\n",
- "ra=9\n",
- "pb=1\n",
- "rb=scipy.sqrt(21)\n",
- "pc=scipy.sqrt(20)\n",
- "rc=scipy.sqrt(11)\n",
- "pl=2*10**-9 #charge density of the line in C/m\n",
- "Q=5*10**-9 #point charge at (-3,4,0) in C\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Va=Vo-(-pl*scipy.log(po/pa)/(2*scipy.pi*Eo)+Q*(ra-ro)/(4*scipy.pi*Eo*ra*ro))\n",
- "Vc=Vb+(-pl*scipy.log(pc/pb)/(2*scipy.pi*Eo)+Q*(rb-rc)/(4*scipy.pi*Eo*rb*rc))\n",
- "Vbc=Vc-Vb\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Va =',round(Va,3),'V'\n",
- "print 'Vc =',round(Vc,3),'V'\n",
- "print 'Vbc =',round(Vbc,3),'V'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Va = 8.477 V\n",
- "Vc = 49.825 V\n",
- "Vbc = -50.175 V\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.12, Page number: 140<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Given the potential V = (10/r**2)sin(theta)cos(phi), \n",
- "(a) Find the electric flux density D at (2, pi/2, 0). \n",
- "(b) Calculate the work done in moving a 10 micro C charge from \n",
- "point A( 1, 30\u00b0, 120\u00b0) to B( 4, 90\u00b0, 60\u00b0). '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ar=array([1,0,0]) #Unit vector along radial direction\n",
- "ath=array([0,1,0]) #Unit vector along theta direction\n",
- "aph=array([0,0,1]) #Unit vector along phi direction\n",
- "e=(10**-9)/(36*scipy.pi) #permittivity of free space in Farad/m\n",
- "\n",
- " #The point (2, pi/2, 0)\n",
- "r=2\n",
- "th=scipy.pi/2\n",
- "ph=0\n",
- " #Point A\n",
- "ra=1\n",
- "tha=scipy.pi*30/180\n",
- "pha=scipy.pi*120/180\n",
- " #Point B\n",
- "rb=4\n",
- "thb=scipy.pi/2\n",
- "phb=scipy.pi*60/180\n",
- "\n",
- "q=10*10**-6 \n",
- "\n",
- "#Calculations\n",
- "\n",
- "Er=(20.0/r**3)*scipy.sin(th)*scipy.cos(ph) #Radial component of E in V/m\n",
- "Eth=-(10/r**3)*scipy.cos(th)*scipy.cos(ph) #Theta component of E in V/m\n",
- "Eph=(10/r**3)*scipy.sin(ph) #Phi component of E in V/m\n",
- "E=array([Er,Eth,Eph])\n",
- "D=E*e*10**12 #Electric flux density D in pC/m^2\n",
- "Dr=round(dot(D,ar),1) #Radial component of D in V/m rounded to 1 decimal\n",
- "Dth=round(dot(D,ath),0) #Theta component of D in pC/m^2 rounded to 0 decimal\n",
- "Dph=round(dot(D,aph),0) #Phi component of D in pC/m^2 rounded to 0 decimal\n",
- "Dc=array([Dr,Dth,Dph]) #Rounded D in pC/m^2\n",
- "\n",
- "Va=10*scipy.sin(tha)*cos(pha)/ra**2 #potential at point A in V\n",
- "Vb=10*scipy.sin(thb)*cos(phb)/rb**2 #potential at point B in V\n",
- "W=q*(Vb-Va)*10**6 #work done in micro J\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The electric flux density D at (2, pi/2, 0) =',Dc,'pC/m^2'\n",
- "print 'Work done in moving the charge =',W,'micro J'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The electric flux density D at (2, pi/2, 0) = [ 22.1 -0. 0. ] pC/m^2\n",
- "Work done in moving the charge = 28.125 micro J\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.13, Page number: 145<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Two dipoles with dipole moments -5 a_z nC/m and 9 a_z nC/m are\n",
- "located at points (0,0,-2) and (0,0,3), respectively.\n",
- "Find the potential at the origin. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "p1=-5*10**-9 #dipole moment of dipole 1 in C/m\n",
- "p2=9*10**-9 #dipole moment of dipole 2 in C/m\n",
- "z1=2 #z component of position vector of dipole 1\n",
- "z2=-3 #z component of position vector of dipole 2\n",
- "e=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n",
- "\n",
- "#Calculation\n",
- "\n",
- "V=(1/(4*scipy.pi*e))*((p1*abs(z1)/z1**3)+(p2*abs(z2)/z2**3))\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'Potential at origin =',V, 'V'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Potential at origin = -20.25 V\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.14, Page number: 148<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Three point charges - 1 nC, 4 nC, and 3 nC are located at (0, 0, 0), \n",
- "(0, 0, 1), and (1, 0, 0), respectively. Find the energy in the system. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Q1=-1*10**-9 #Charge 1 in C\n",
- "Q2=4*10**-9 #Charge 2 in C\n",
- "Q3=3*10**-9 #Charge 3 in C\n",
- "e=10**-9/(36*scipy.pi) #permittivity of free space in farad/m\n",
- "\n",
- "#Calculations\n",
- "\n",
- "V1=(1/(4*scipy.pi*e)*(Q2+Q3))\n",
- "V2=(1/(4*scipy.pi*e)*(Q1+Q3/(2**.5)))\n",
- "V3=(1/(4*scipy.pi*e)*(Q1+Q2/(2**.5)))\n",
- "W=0.5*((V1*Q1)+(V2*Q2)+(V3*Q3))*10**9 #Energy in nJ\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'Energy in the system =',round(W,2),'nJ'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Energy in the system = 13.37 nJ\n"
- ]
- }
- ],
- "prompt_number": 8
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:891c986a46f113e35878dc6d6a0b8d702286ad7b4ea91bae03f716286f9bdeaa"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 4: Electrostatic Fields<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.1, Page number: 107<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "Q1=1*10**-3 #charge 1 at (-1,-1,4) in C\n",
+ "Q2=-2*10**-3 #charge 2 at (3,2,-1) in C\n",
+ "Q=10*10**-9 #charge 3 at (0,3,1) in C\n",
+ "P1=array([0,3,1])-array([3,2,-1]) #distance vector from charge 3 to 1\n",
+ "P2=array([0,3,1])-array([-1,-1,4]) #distance vector from charge 3 to 2\n",
+ "e=10**-9/(36*scipy.pi) #permittivity in Farad/m \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "modP1=scipy.sqrt(dot(P1,P1))\n",
+ "modP2=scipy.sqrt(dot(P2,P2))\n",
+ "F1=(Q*Q1)*P1*10**3/(4*scipy.pi*e*modP1**3) #force on charge 3 by 1 in mN\n",
+ "F2=(Q*Q2)*P2*10**3/(4*scipy.pi*e*modP2**3) #force on charge 3 by 2 in mN\n",
+ "\n",
+ " #Total force on charge 3\n",
+ " \n",
+ "Fx=round(dot(F1+F2,ax),3)\n",
+ "Fy=round(dot(F1+F2,ay),3)\n",
+ "Fz=round(dot(F1+F2,az),3)\n",
+ "F=array([Fx,Fy,Fz]) #Total force in mN\n",
+ "E=(10**-6)*(F/Q) #Electric field in kV/m\n",
+ "\n",
+ "#Results \n",
+ "\n",
+ "print 'Total force on charge at (0,3,1) =',F,'in mN'\n",
+ "print 'Electric field at (0,3,1) =',E,'kV/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total force on charge at (0,3,1) = [-6.512 -3.713 7.509] in mN\n",
+ "Electric field at (0,3,1) = [-651.2 -371.3 750.9] kV/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.3, Page number: 109"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "#Variable Declaration\n",
+ "\n",
+ "E=500*10**3 #electric field in V/m\n",
+ "Qm=9*10**-6 #Q/m in C/kg\n",
+ "y=0.8 #distance fallen in m\n",
+ "g=9.8 #acceleration due to gravity in m/s^2\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "t=scipy.sqrt(2*y/g) #time taken to fall in seconds\n",
+ "x=Qm*E*t**2/2 #half the separation between particles in m\n",
+ "sep=2*x #separation between particles in m\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The separation between particles is',round(sep*100,2),'cm'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The separation between particles is 73.47 cm\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.5, Page number: 120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import scipy.integrate\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "q=-1 #charge in mC\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "def charge(x,y): \n",
+ " return x*y*(x**2+y**2+25)**(1.5)\n",
+ "Q, errq = scipy.integrate.dblquad(lambda y , x: charge(x,y), #total charge in nC\n",
+ " 0, 1, lambda y: 0, lambda y: 1) \n",
+ "\n",
+ "d=(4*scipy.pi*Eo*(x**2+y**2+25)**(1.5))\n",
+ "\n",
+ "def elecx(x,y): \n",
+ " return 10**-9*x*y*(x**2+y**2+25)**(1.5)*(-x)/d #x component of electric field\n",
+ "Ex, errx = scipy.integrate.dblquad(lambda y , x: elecx(x,y), \n",
+ " 0, 1, lambda y: 0, lambda y: 1) \n",
+ "\n",
+ "def elecy(x,y): \n",
+ " return 10**-9*x*y*(x**2+y**2+25)**(1.5)*(-y)/d #y component of electric field\n",
+ "Ey, erry = scipy.integrate.dblquad(lambda y , x: elecy(x,y), \n",
+ " 0, 1, lambda y: 0, lambda y: 1) \n",
+ "\n",
+ "def elecz(x,y): \n",
+ " return 10**-9*x*y*(5)/(4*scipy.pi*Eo) #z component of electric field\n",
+ "Ez, errz = scipy.integrate.dblquad(lambda y , x: elecz(x,y), \n",
+ " 0, 1, lambda y: 0, lambda y: 1) \n",
+ "\n",
+ "E=array([round(Ex,1),round(Ey,1),round(Ez,2)]) #electric field in V/m\n",
+ "\n",
+ "F=q*E #force in mN \n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Total charge =',round(Q,2),'nC'\n",
+ "print 'Electric field at (0,0,5) =',E,'V/m'\n",
+ "print 'Force experienced by -1mC =',F,'mN'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total charge = 33.15 nC\n",
+ "Electric field at (0,0,5) = [ -1.5 -1.5 11.25] V/m\n",
+ "Force experienced by -1mC = [ 1.5 1.5 -11.25] mN\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.6, Page number: 121<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "ps1=10*10**-9 #Surface charge density of plane 1\n",
+ "ps2=15*10**-9 #Surface charge density of plane 2\n",
+ "pl=10*scipy.pi*10**-9 #charge density of line\n",
+ "e=(10**-9)/(36*scipy.pi) #permittivity of free space in Farad/m\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "E1=(ps1/(2*e))*-ax/scipy.pi #field due to plane 1 in multiples of pi in V/m\n",
+ "E2=(ps2/(2*e))*ay/scipy.pi #field due to plane 2 in multiples of pi in V/m\n",
+ "\n",
+ " #field due to line charge in multiples of pi in V/m\n",
+ " \n",
+ "a=(ax-3*az) \n",
+ "moda=scipy.sqrt(dot((ax-3*az),(ax-3*az)))\n",
+ "e3=(pl/(2*scipy.pi*e*moda**2))*a\n",
+ "E3=array([dot(e3,ax)/scipy.pi,0,dot(e3,az)/scipy.pi])\n",
+ "\n",
+ " #total field in multiples of pi in V/m\n",
+ " \n",
+ "E=E1+E2+E3 \n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The total electric field at (1,1,-1) =',E,'Pi V/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total electric field at (1,1,-1) = [-162. 270. -54.] Pi V/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.7, Page number: 123<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "Q=-5*scipy.pi*10**-3 #charge at (4,0,0) in C\n",
+ "pl=3*scipy.pi*10**-3 #charge density of line charge in C/m\n",
+ "r=array([4,0,3]) #point where D is to be found \n",
+ "rp=array([4,0,0]) #position of point charge\n",
+ "\n",
+ "#Calculations \n",
+ "\n",
+ "R=r-rp \n",
+ "modR=scipy.sqrt(dot(R,R)) \n",
+ "Dq=(Q*R)/(4*scipy.pi*modR**3) #flux density due to point charge in C/m^2\n",
+ "p=scipy.sqrt(dot(r,r))\n",
+ "ap=r/p \n",
+ "Dl=(pl/(2*scipy.pi*p))*ap #flux density due to line charge in C/m^2\n",
+ "D=(Dq+Dl)*10**6 #total flux density in micro C/m^2\n",
+ "Dz=round(dot(D,az),0)\n",
+ "Dx=round(dot(D,ax),0)\n",
+ "Dy=round(dot(D,ay),0)\n",
+ "Dround=array([Dx,Dy,Dz]) #value of D rounded to 0 decimal points\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'D at (4,0,0) due to point charge and line charge =',Dround,'micro C/m^2'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "D at (4,0,0) due to point charge and line charge = [ 240. 0. 41.] micro C/m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.8, Page number: 130<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "import scipy.integrate\n",
+ "from fractions import Fraction\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ap=array([1,0,0]) #Unit vector along rho direction\n",
+ "aph=array([0,1,0]) #Unit vector along phi direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "point=array([1,scipy.pi/4,3])\n",
+ "p1=0\n",
+ "p2=1\n",
+ "ph1=0\n",
+ "ph2=2*scipy.pi\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "pointp=dot(point,ap)\n",
+ "pointph=dot(point,aph)\n",
+ "pv=pointp*scipy.cos(pointph)**2 #charge density at (1,pi/4,3) in C/m^3\n",
+ "\n",
+ "def ctop(phi,p): \n",
+ " return 2*p**2*(scipy.cos(phi)**2)\n",
+ "psya, erra = scipy.integrate.dblquad(lambda p , phi: ctop(phi,p), \n",
+ " ph1, ph2, lambda p: p1, lambda p: p2)\n",
+ "\n",
+ "def cbot(phi,p): \n",
+ " return 2*p**2*(scipy.cos(phi)**2)\n",
+ "psyb, errb = scipy.integrate.dblquad(lambda p , phi: cbot(phi,p), \n",
+ " ph1, ph2, lambda p: p1, lambda p: p2)\n",
+ " \n",
+ "psy=psya+psyb #Charge in C\n",
+ "psyp=psy/scipy.pi #Charge in multiples of Pi in C\n",
+ "psyf=Fraction(psyp).limit_denominator(100) #converting to fraction\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Charge density at (1,pi/4,3) =',pv,'C/m^3'\n",
+ "print 'Total charge enclosed by the cylinder =',psyf,'Pi C'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Charge density at (1,pi/4,3) = 0.5 C/m^3\n",
+ "Total charge enclosed by the cylinder = 4/3 Pi C\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.10, Page number: 136<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Q1=-4 #charge 1 in micro C\n",
+ "Q2=5 #charge 2 in micro C\n",
+ "e=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "R1=array([1,0,1])-array([2,-1,3]) #distance vector from (1,0,1) to charge 1\n",
+ "R2=array([1,0,1])-array([0,4,-2]) #distance vector from (1,0,1) to charge 2\n",
+ "modR1=scipy.sqrt(dot(R1,R1))\n",
+ "modR2=scipy.sqrt(dot(R2,R2)) \n",
+ "V=10**-9*((Q1/modR1)+(Q2/modR2))/(4*scipy.pi*e) #potential in kV\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The potential at (1, 0, 1) =',round(V,3),'kV'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The potential at (1, 0, 1) = -5.872 kV\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.11, Page number: 136"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n",
+ "Vo=0 #potential at O in V\n",
+ "Vb=100 #potential at B in V\n",
+ "po=scipy.sqrt(2)\n",
+ "ro=5\n",
+ "pa=1\n",
+ "ra=9\n",
+ "pb=1\n",
+ "rb=scipy.sqrt(21)\n",
+ "pc=scipy.sqrt(20)\n",
+ "rc=scipy.sqrt(11)\n",
+ "pl=2*10**-9 #charge density of the line in C/m\n",
+ "Q=5*10**-9 #point charge at (-3,4,0) in C\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Va=Vo-(-pl*scipy.log(po/pa)/(2*scipy.pi*Eo)+Q*(ra-ro)/(4*scipy.pi*Eo*ra*ro))\n",
+ "Vc=Vb+(-pl*scipy.log(pc/pb)/(2*scipy.pi*Eo)+Q*(rb-rc)/(4*scipy.pi*Eo*rb*rc))\n",
+ "Vbc=Vc-Vb\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Va =',round(Va,3),'V'\n",
+ "print 'Vc =',round(Vc,3),'V'\n",
+ "print 'Vbc =',round(Vbc,3),'V'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Va = 8.477 V\n",
+ "Vc = 49.825 V\n",
+ "Vbc = -50.175 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.12, Page number: 140<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ar=array([1,0,0]) #Unit vector along radial direction\n",
+ "ath=array([0,1,0]) #Unit vector along theta direction\n",
+ "aph=array([0,0,1]) #Unit vector along phi direction\n",
+ "e=(10**-9)/(36*scipy.pi) #permittivity of free space in Farad/m\n",
+ "\n",
+ " #The point (2, pi/2, 0)\n",
+ "r=2\n",
+ "th=scipy.pi/2\n",
+ "ph=0\n",
+ " #Point A\n",
+ "ra=1\n",
+ "tha=scipy.pi*30/180\n",
+ "pha=scipy.pi*120/180\n",
+ " #Point B\n",
+ "rb=4\n",
+ "thb=scipy.pi/2\n",
+ "phb=scipy.pi*60/180\n",
+ "\n",
+ "q=10*10**-6 \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Er=(20.0/r**3)*scipy.sin(th)*scipy.cos(ph) #Radial component of E in V/m\n",
+ "Eth=-(10/r**3)*scipy.cos(th)*scipy.cos(ph) #Theta component of E in V/m\n",
+ "Eph=(10/r**3)*scipy.sin(ph) #Phi component of E in V/m\n",
+ "E=array([Er,Eth,Eph])\n",
+ "D=E*e*10**12 #Electric flux density D in pC/m^2\n",
+ "Dr=round(dot(D,ar),1) #Radial component of D in V/m rounded to 1 decimal\n",
+ "Dth=round(dot(D,ath),0) #Theta component of D in pC/m^2 rounded to 0 decimal\n",
+ "Dph=round(dot(D,aph),0) #Phi component of D in pC/m^2 rounded to 0 decimal\n",
+ "Dc=array([Dr,Dth,Dph]) #Rounded D in pC/m^2\n",
+ "\n",
+ "Va=10*scipy.sin(tha)*cos(pha)/ra**2 #potential at point A in V\n",
+ "Vb=10*scipy.sin(thb)*cos(phb)/rb**2 #potential at point B in V\n",
+ "W=q*(Vb-Va)*10**6 #work done in micro J\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The electric flux density D at (2, pi/2, 0) =',Dc,'pC/m^2'\n",
+ "print 'Work done in moving the charge =',W,'micro J'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The electric flux density D at (2, pi/2, 0) = [ 22.1 -0. 0. ] pC/m^2\n",
+ "Work done in moving the charge = 28.125 micro J\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.13, Page number: 145<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "p1=-5*10**-9 #dipole moment of dipole 1 in C/m\n",
+ "p2=9*10**-9 #dipole moment of dipole 2 in C/m\n",
+ "z1=2 #z component of position vector of dipole 1\n",
+ "z2=-3 #z component of position vector of dipole 2\n",
+ "e=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "V=(1/(4*scipy.pi*e))*((p1*abs(z1)/z1**3)+(p2*abs(z2)/z2**3))\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'Potential at origin =',V, 'V'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Potential at origin = -20.25 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.14, Page number: 148<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Q1=-1*10**-9 #Charge 1 in C\n",
+ "Q2=4*10**-9 #Charge 2 in C\n",
+ "Q3=3*10**-9 #Charge 3 in C\n",
+ "e=10**-9/(36*scipy.pi) #permittivity of free space in farad/m\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "V1=(1/(4*scipy.pi*e)*(Q2+Q3))\n",
+ "V2=(1/(4*scipy.pi*e)*(Q1+Q3/(2**.5)))\n",
+ "V3=(1/(4*scipy.pi*e)*(Q1+Q2/(2**.5)))\n",
+ "W=0.5*((V1*Q1)+(V2*Q2)+(V3*Q3))*10**9 #Energy in nJ\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'Energy in the system =',round(W,2),'nJ'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Energy in the system = 13.37 nJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_5.ipynb b/Elements_of_Electromagnetics/chapter_5.ipynb
index 882e9145..db757859 100644
--- a/Elements_of_Electromagnetics/chapter_5.ipynb
+++ b/Elements_of_Electromagnetics/chapter_5.ipynb
@@ -1,523 +1,468 @@
-{
- "metadata": {
- "name": "chapter_5.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 5: Electric Fields in Material Space<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.1, Page number: 167<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "If the current density J=1/r^3(2cos(theta) a_r + sin(theta) a_t) Ampere/m^2,\n",
- "calculate the current passing through\n",
- "(a) A hemispherical shell of radius 20 cm.\n",
- "(b) A spherical shell of radius 10 cm. '''\n",
- "\n",
- "import scipy\n",
- "import scipy.integrate\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "r1= 0.2 # radius of hemispherical shell in metres\n",
- "r2= 0.1 # radius of spherical shell in metres\n",
- "\n",
- "#Calculations\n",
- "\n",
- "#Calculation of current through hemispherical shell \n",
- "\n",
- "def J1(phi,theta):\n",
- "\ts1=(1/r1)*(2* scipy.cos(theta)* scipy.sin(theta))\n",
- "\treturn s1\n",
- "\n",
- "if __name__ == '__main__':\n",
- "\n",
- " I1, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n",
- " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi/2) \n",
- "\t \n",
- "#Calculation of current through spherical shell \n",
- "\n",
- "def J2(phi,theta):\n",
- "\ts2=(1/r2)*(2* scipy.cos(theta)* scipy.sin(theta))\n",
- "\treturn s2\n",
- "\n",
- "if __name__ == '__main__':\n",
- "\n",
- " I2, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n",
- " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi) \n",
- "\t \n",
- "#Results\n",
- "\n",
- "print 'Current through hemispherical shell=',round(I1,1),'A' \n",
- "print 'Current through spherical shell=',round(I2,0),'A'\n",
- "\t"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Current through hemispherical shell= 31.4 A\n",
- "Current through spherical shell= 0.0 A\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.2, Page number: 168<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A typical example of convective charge transport is found \n",
- "in the Van de Graaff generator where charge is transported \n",
- "on a moving belt from the base to the dome.\n",
- "If a surface charge density 10^7 C/m^2 is transported at a velocity of 2 m/s, \n",
- "calculate the charge collected in 5 s. Take the width of the belt as 10 cm. '''\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ps=10**-7 #Surface charge density of the belt in Couloumb/metre^2\n",
- "u=2 #Speed of the belt in metres/sec\n",
- "w=0.1 #Width of the belt in metres\n",
- "t=5 #Time taken in seconds \n",
- "\n",
- "#Calculations\n",
- "\n",
- "I=ps*u*w #Current in amperes\n",
- "Q=I*t*10**9 #Charge collected in 5 seconds in nano Coloumbs\n",
- "\n",
- "#Result\n",
- "\n",
- "print \"The charge collected in 5 seconds is \",Q,\"nC\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The charge collected in 5 seconds is 100.0 nC\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.3, Page number: 169<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A wire of diameter 1mm and conductivity 5X10^7 S/m has 10^29 \n",
- "free electrons/m^3 when an electric field of 10mV /m is applied. Determine \n",
- "(a) The charge density of free electrons \n",
- "(b) The current density \n",
- "(c) The current in the wire \n",
- "(d) The drift velocity of the electrons. \n",
- "Take the electronic charge as e = -1.6X10^-19 C. '''\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "n=10**29 #Number density of electrons in m^-3\n",
- "e=-1.6*10**-19 #Electronic charge in Coloumbs\n",
- "sigma=5*10**7 #Current density in S/m\n",
- "E=10**-2 #Electric Field in V/m\n",
- "S=(3.14*10**-6)/4 #Cross sectional area of the wire in m^2\n",
- "\n",
- "#Calculations\n",
- "\n",
- "pv=n*e #Charge density of free electrons in C/m^3\n",
- "J=sigma*E*10**-3 #Current density in kA/m^2\n",
- "I=J*S*10**3 #Current in amperes\n",
- "u=J*10**3/pv #Drift velocity in m/s\n",
- "\n",
- "#Results\n",
- "\n",
- "print \"The charge density is \",pv,\"C/m^3\" \n",
- "print \"The current density is \",J,\"kA/m^2\" \n",
- "print \"The current is \",round(I,3), \"A\"\n",
- "print \"The drift velocity is \",-u,\"m/s\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The charge density is -16000000000.0 C/m^3\n",
- "The current density is 500.0 kA/m^2\n",
- "The current is 0.393 A\n",
- "The drift velocity is 3.125e-05 m/s\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.4, Page number: 170<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A lead (sigma=5X10^6 S/m) bar of square cross section has a\n",
- "hole bored along its length of 4 cm so that its cross section \n",
- "becomes a square of side 3 cm with a hole of diameter 1 cm \n",
- "drilled through the centre,\n",
- "Find the resistance between the square ends. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "l=4 #Length of the lead bar in m\n",
- "d=3 #Width of the lead bar in cm\n",
- "r=0.5 #Radius of the hole drilled in cm\n",
- "sigma=5*10**6 #Conductivity of the bar in S/m\n",
- "\n",
- "#Calculation\n",
- "\n",
- "S=(d**2-(scipy.pi*r**2)) #Cross sectional area in cm^2\n",
- "R=l/(S*sigma*10**-4) #Resistance in ohms\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The resistance between the square ends is',round(R*10**6),'micro ohms'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The resistance between the square ends is 974.0 micro ohms\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.6, Page number: 177<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The electric field intensity in polystyrene (epsilon_r= 2.55) filling\n",
- "the space between the plates of a parallel-plate capacitor is 10 kV/m. \n",
- "The distance between the plates is 1.5 mm. Calculate: \n",
- "(a) D \n",
- "(b) P \n",
- "(c) The surface charge density of free charge on the plates \n",
- "(d) The surface density of polarization charge \n",
- "(e) The potential difference between the plates '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "e0=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n",
- "er=2.55 #relative permittivity (dimensionless)\n",
- "E=10*10**3 #Electric field in V/m\n",
- "chi=er-1.0 #Electric susceptibility (dimensionless)\n",
- "d=1.5 #Distance between plates in mm\n",
- "\n",
- "#Calculations\n",
- "\n",
- "D=e0*er*E*10**9 #D in nC/m^2\n",
- "\n",
- "P=chi*e0*E*10**9 #P in nC/m^2\n",
- "\n",
- "ps=D #The surface charge density of \n",
- " #free charge in nC/m^2\n",
- " \n",
- "pps =P #The surface charge density of\n",
- " #polarization charge in nC/m^2\n",
- " \n",
- "V=E*d*10**-3 #The potential difference between \n",
- " #the plates in volts\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'D =',round(D,2),'nC/m^2'\n",
- "print 'P =',round(P,0),'nC/m^2'\n",
- "print 'Surface charge density of free charge =',round(ps,2),'nC/m^2'\n",
- "print 'Surface charge density of polarization charge =',round(pps,0),'nC/m^2'\n",
- "print 'The potential difference between the plates =',V,'V'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "D = 225.47 nC/m^2\n",
- "P = 137.0 nC/m^2\n",
- "Surface charge density of free charge = 225.47 nC/m^2\n",
- "Surface charge density of polarization charge = 137.0 nC/m^2\n",
- "The potential difference between the plates = 15.0 V\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.7, Page number: 178<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A dielectric sphere (epsilon_r = 5.7) of radius 10 cm \n",
- "has a point charge 2 pC placed at its center. \n",
- "Calculate: \n",
- "(a)The surface density of polarization charge on\n",
- " the surface of the sphere \n",
- "(b)The force exerted by the charge on a -4 pC \n",
- " point charge placed on the sphere '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "e0=10**-9/(36*scipy.pi) #permittivity of free space\n",
- " #in Farad/m\n",
- " \n",
- "er=5.7 #relative permittivity\n",
- " #(dimensionless)\n",
- " \n",
- "chi=er-1 #Electric susceptibility\n",
- " #(dimensionless)\n",
- " \n",
- "r=0.1 #radius of sphere in m\n",
- "\n",
- "q1=2 #charge on sphere in pC\n",
- "\n",
- "q2=-4 #value of point charge in pC\n",
- "\n",
- "#Calculations\n",
- "\n",
- "E=q1/(4*scipy.pi*e0*er*r**2) #Electric field on the\n",
- " #sphere in pV/m\n",
- " \n",
- "P=chi*e0*E #Polarisation in pC/m^2\n",
- "\n",
- "pps=P #The surface density of polarization \n",
- " #charge in pC/m^2\n",
- " \n",
- "F=(q1*q2*10**-12)/(4*scipy.pi*e0*er*r**2) #Force exerted on point charge in pN\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The surface density of polarization'\n",
- "print 'charge on the surface of the sphere =',round(pps,2),'pC/m^2'\n",
- "print 'Force exerted on -4 pC charge =',round(F,3),'pN in the radial direction'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The surface density of polarization\n",
- "charge on the surface of the sphere = 13.12 pC/m^2\n",
- "Force exerted on -4 pC charge = -1.263 pN in the radial direction\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.9, Page number: 188<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Two extensive homogeneous isotropic dielectrics meet on \n",
- "plane z = O. For z >=0, epsilon_r1 = 4 and for z <= 0, \n",
- "epsilon_r2 = 3. A uniform electric field E1= 5 a_x - 2 a_y + 3 a_z kV/m \n",
- "exists for z >= O. Find \n",
- "(a) E2 for z <= 0 \n",
- "(b) The angles El and E2 make with the interface \n",
- "(c) The energy densities in J/m^3 in both dielectrics \n",
- "(d) The energy within a cube of side 2 m centered at (3,4,-5) '''\n",
- "\n",
- "#Variable Declarartion\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "an=array([0,0,1]) #Unit vector normal to the interface\n",
- "E1=array([5,-2,3]) #Electric field for z >=0 in kV/m\n",
- "e_r1=4 #Relative permittivity for z >=0 (dimensionless)\n",
- "e_r2=3 #Relative permittivity for z <=0 (dimensionless)\n",
- "e0=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n",
- "V=2*2*2 #Volume of cube placed in region 2 in m^3\n",
- "\n",
- "#Calculations\n",
- "\n",
- "E1n=array([0,0,dot(E1,an)]) #The normal component of E1 in kV/m\n",
- "E1t=E1-E1n #Transverse component of E1 in kV/m\n",
- "E2t=E1t #Transverse component of E2 in kV/m\n",
- "E2n=e_r1*E1n/e_r2 #Normal Component of E2 in kV/m\n",
- "E2=E2n+E2t #The total field E2 in kV/m\n",
- "\n",
- "theta1= 90- 180*scipy.arccos(dot(E1,an)/ #Angle between E1 and \n",
- " scipy.sqrt(dot(E1,E1)))/scipy.pi #interface in degrees\n",
- " \n",
- "theta2= 90- 180*scipy.arccos(dot(E2,an)/ #Angle between E2 and \n",
- " scipy.sqrt(dot(E2,E2)))/scipy.pi #interface in degrees\n",
- "\n",
- "\n",
- "We1= 0.5*e0*e_r1*dot(E1,E1)*10**6 # The energy density of E1 in J/m^3\n",
- "We2= 0.5*e0*e_r2*dot(E2,E2)*10**6 # The energy density of E2 in J/m^3\n",
- "W= We2*V # The energy within the cube in J\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The electric field for the region z <=0 is',E2,'kV/m'\n",
- "print 'The angle E1 makes with the boundary is',round(theta1,1),'degrees'\n",
- "print 'The angle E2 makes with the boundary is',round(theta2,1),'degrees'\n",
- "print 'The energy density in dielectric 1 is',round(We1*10**6,0),'J/m^3'\n",
- "print 'The energy density in dielectric 2 is',round(We2*10**6,0),'J/m^3'\n",
- "print 'The energy within the cube is',round(W*1000,3),'mJ'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The electric field for the region z <=0 is [ 5 -2 4] kV/m\n",
- "The angle E1 makes with the boundary is 29.1 degrees\n",
- "The angle E2 makes with the boundary is 36.6 degrees\n",
- "The energy density in dielectric 1 is 672.0 J/m^3\n",
- "The energy density in dielectric 2 is 597.0 J/m^3\n",
- "The energy within the cube is 4.775 mJ\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.10, Page number: 190<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Region y <= 0 consists of a perfect conductor while region y >= 0 \n",
- "is a dielectric medium (epsilon_1r = 2). If there is a surface charge\n",
- "of 2 nC/m^2 on the conductor, determine E and D at \n",
- "(a) A(3, -2,2) \n",
- "(b) B(-4, 1,5) '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "e=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n",
- "er=2 #Relative permittivity (dimensionless)\n",
- "ps=2 #Surface charge in nC/m^2\n",
- "\n",
- "#Calculations\n",
- "\n",
- "#Point A is in the region y <=0. Hence E=D=0\n",
- "#For point B which is in the region y >=0,\n",
- "\n",
- "Dn=ps #Displacement current in nC/m^2\n",
- "En=Dn*10**-9/(e*er) #Electric Field\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'E at point A= 0'\n",
- "print 'D at point A= 0'\n",
- "print 'E at point B=',round(En,2),'V/m along positive y direction'\n",
- "print 'D at point B=',Dn,'nC/m^2 along positive y direction'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "E at point A= 0\n",
- "D at point A= 0\n",
- "E at point B= 113.1 V/m along positive y direction\n",
- "D at point B= 2 nC/m^2 along positive y direction\n"
- ]
- }
- ],
- "prompt_number": 8
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:08d693988f55ded7946a3910c4b750b4a1419d79f72e5b56719c0d924a66fd5a"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 5: Electric Fields in Material Space<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.1, Page number: 167<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import scipy.integrate\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "r1= 0.2 # radius of hemispherical shell in metres\n",
+ "r2= 0.1 # radius of spherical shell in metres\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "#Calculation of current through hemispherical shell \n",
+ "\n",
+ "def J1(phi,theta):\n",
+ "\ts1=(1/r1)*(2* scipy.cos(theta)* scipy.sin(theta))\n",
+ "\treturn s1\n",
+ "\n",
+ "if __name__ == '__main__':\n",
+ "\n",
+ " I1, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n",
+ " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi/2) \n",
+ "\t \n",
+ "#Calculation of current through spherical shell \n",
+ "\n",
+ "def J2(phi,theta):\n",
+ "\ts2=(1/r2)*(2* scipy.cos(theta)* scipy.sin(theta))\n",
+ "\treturn s2\n",
+ "\n",
+ "if __name__ == '__main__':\n",
+ "\n",
+ " I2, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n",
+ " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi) \n",
+ "\t \n",
+ "#Results\n",
+ "\n",
+ "print 'Current through hemispherical shell=',round(I1,1),'A' \n",
+ "print 'Current through spherical shell=',round(I2,0),'A'\n",
+ "\t"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Current through hemispherical shell= 31.4 A\n",
+ "Current through spherical shell= 0.0 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.2, Page number: 168<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "#Variable Declaration\n",
+ "\n",
+ "ps=10**-7 #Surface charge density of the belt in Couloumb/metre^2\n",
+ "u=2 #Speed of the belt in metres/sec\n",
+ "w=0.1 #Width of the belt in metres\n",
+ "t=5 #Time taken in seconds \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "I=ps*u*w #Current in amperes\n",
+ "Q=I*t*10**9 #Charge collected in 5 seconds in nano Coloumbs\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print \"The charge collected in 5 seconds is \",Q,\"nC\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The charge collected in 5 seconds is 100.0 nC\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.3, Page number: 169<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "#Variable Declaration\n",
+ "\n",
+ "n=10**29 #Number density of electrons in m^-3\n",
+ "e=-1.6*10**-19 #Electronic charge in Coloumbs\n",
+ "sigma=5*10**7 #Current density in S/m\n",
+ "E=10**-2 #Electric Field in V/m\n",
+ "S=(3.14*10**-6)/4 #Cross sectional area of the wire in m^2\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "pv=n*e #Charge density of free electrons in C/m^3\n",
+ "J=sigma*E*10**-3 #Current density in kA/m^2\n",
+ "I=J*S*10**3 #Current in amperes\n",
+ "u=J*10**3/pv #Drift velocity in m/s\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print \"The charge density is \",pv,\"C/m^3\" \n",
+ "print \"The current density is \",J,\"kA/m^2\" \n",
+ "print \"The current is \",round(I,3), \"A\"\n",
+ "print \"The drift velocity is \",-u,\"m/s\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The charge density is -16000000000.0 C/m^3\n",
+ "The current density is 500.0 kA/m^2\n",
+ "The current is 0.393 A\n",
+ "The drift velocity is 3.125e-05 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.4, Page number: 170<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "l=4 #Length of the lead bar in m\n",
+ "d=3 #Width of the lead bar in cm\n",
+ "r=0.5 #Radius of the hole drilled in cm\n",
+ "sigma=5*10**6 #Conductivity of the bar in S/m\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "S=(d**2-(scipy.pi*r**2)) #Cross sectional area in cm^2\n",
+ "R=l/(S*sigma*10**-4) #Resistance in ohms\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The resistance between the square ends is',round(R*10**6),'micro ohms'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The resistance between the square ends is 974.0 micro ohms\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.6, Page number: 177<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "e0=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n",
+ "er=2.55 #relative permittivity (dimensionless)\n",
+ "E=10*10**3 #Electric field in V/m\n",
+ "chi=er-1.0 #Electric susceptibility (dimensionless)\n",
+ "d=1.5 #Distance between plates in mm\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "D=e0*er*E*10**9 #D in nC/m^2\n",
+ "\n",
+ "P=chi*e0*E*10**9 #P in nC/m^2\n",
+ "\n",
+ "ps=D #The surface charge density of \n",
+ " #free charge in nC/m^2\n",
+ " \n",
+ "pps =P #The surface charge density of\n",
+ " #polarization charge in nC/m^2\n",
+ " \n",
+ "V=E*d*10**-3 #The potential difference between \n",
+ " #the plates in volts\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'D =',round(D,2),'nC/m^2'\n",
+ "print 'P =',round(P,0),'nC/m^2'\n",
+ "print 'Surface charge density of free charge =',round(ps,2),'nC/m^2'\n",
+ "print 'Surface charge density of polarization charge =',round(pps,0),'nC/m^2'\n",
+ "print 'The potential difference between the plates =',V,'V'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "D = 225.47 nC/m^2\n",
+ "P = 137.0 nC/m^2\n",
+ "Surface charge density of free charge = 225.47 nC/m^2\n",
+ "Surface charge density of polarization charge = 137.0 nC/m^2\n",
+ "The potential difference between the plates = 15.0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.7, Page number: 178<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "e0=10**-9/(36*scipy.pi) #permittivity of free space\n",
+ " #in Farad/m\n",
+ " \n",
+ "er=5.7 #relative permittivity\n",
+ " #(dimensionless)\n",
+ " \n",
+ "chi=er-1 #Electric susceptibility\n",
+ " #(dimensionless)\n",
+ " \n",
+ "r=0.1 #radius of sphere in m\n",
+ "\n",
+ "q1=2 #charge on sphere in pC\n",
+ "\n",
+ "q2=-4 #value of point charge in pC\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "E=q1/(4*scipy.pi*e0*er*r**2) #Electric field on the\n",
+ " #sphere in pV/m\n",
+ " \n",
+ "P=chi*e0*E #Polarisation in pC/m^2\n",
+ "\n",
+ "pps=P #The surface density of polarization \n",
+ " #charge in pC/m^2\n",
+ " \n",
+ "F=(q1*q2*10**-12)/(4*scipy.pi*e0*er*r**2) #Force exerted on point charge in pN\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The surface density of polarization'\n",
+ "print 'charge on the surface of the sphere =',round(pps,2),'pC/m^2'\n",
+ "print 'Force exerted on -4 pC charge =',round(F,3),'pN in the radial direction'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The surface density of polarization\n",
+ "charge on the surface of the sphere = 13.12 pC/m^2\n",
+ "Force exerted on -4 pC charge = -1.263 pN in the radial direction\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.9, Page number: 188<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "#Variable Declarartion\n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "an=array([0,0,1]) #Unit vector normal to the interface\n",
+ "E1=array([5,-2,3]) #Electric field for z >=0 in kV/m\n",
+ "e_r1=4 #Relative permittivity for z >=0 (dimensionless)\n",
+ "e_r2=3 #Relative permittivity for z <=0 (dimensionless)\n",
+ "e0=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n",
+ "V=2*2*2 #Volume of cube placed in region 2 in m^3\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "E1n=array([0,0,dot(E1,an)]) #The normal component of E1 in kV/m\n",
+ "E1t=E1-E1n #Transverse component of E1 in kV/m\n",
+ "E2t=E1t #Transverse component of E2 in kV/m\n",
+ "E2n=e_r1*E1n/e_r2 #Normal Component of E2 in kV/m\n",
+ "E2=E2n+E2t #The total field E2 in kV/m\n",
+ "\n",
+ "theta1= 90- 180*scipy.arccos(dot(E1,an)/ #Angle between E1 and \n",
+ " scipy.sqrt(dot(E1,E1)))/scipy.pi #interface in degrees\n",
+ " \n",
+ "theta2= 90- 180*scipy.arccos(dot(E2,an)/ #Angle between E2 and \n",
+ " scipy.sqrt(dot(E2,E2)))/scipy.pi #interface in degrees\n",
+ "\n",
+ "\n",
+ "We1= 0.5*e0*e_r1*dot(E1,E1)*10**6 # The energy density of E1 in J/m^3\n",
+ "We2= 0.5*e0*e_r2*dot(E2,E2)*10**6 # The energy density of E2 in J/m^3\n",
+ "W= We2*V # The energy within the cube in J\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The electric field for the region z <=0 is',E2,'kV/m'\n",
+ "print 'The angle E1 makes with the boundary is',round(theta1,1),'degrees'\n",
+ "print 'The angle E2 makes with the boundary is',round(theta2,1),'degrees'\n",
+ "print 'The energy density in dielectric 1 is',round(We1*10**6,0),'J/m^3'\n",
+ "print 'The energy density in dielectric 2 is',round(We2*10**6,0),'J/m^3'\n",
+ "print 'The energy within the cube is',round(W*1000,3),'mJ'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The electric field for the region z <=0 is [ 5 -2 4] kV/m\n",
+ "The angle E1 makes with the boundary is 29.1 degrees\n",
+ "The angle E2 makes with the boundary is 36.6 degrees\n",
+ "The energy density in dielectric 1 is 672.0 J/m^3\n",
+ "The energy density in dielectric 2 is 597.0 J/m^3\n",
+ "The energy within the cube is 4.775 mJ\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.10, Page number: 190<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "e=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n",
+ "er=2 #Relative permittivity (dimensionless)\n",
+ "ps=2 #Surface charge in nC/m^2\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "#Point A is in the region y <=0. Hence E=D=0\n",
+ "#For point B which is in the region y >=0,\n",
+ "\n",
+ "Dn=ps #Displacement current in nC/m^2\n",
+ "En=Dn*10**-9/(e*er) #Electric Field\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'E at point A= 0'\n",
+ "print 'D at point A= 0'\n",
+ "print 'E at point B=',round(En,2),'V/m along positive y direction'\n",
+ "print 'D at point B=',Dn,'nC/m^2 along positive y direction'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "E at point A= 0\n",
+ "D at point A= 0\n",
+ "E at point B= 113.1 V/m along positive y direction\n",
+ "D at point B= 2 nC/m^2 along positive y direction\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_6.ipynb b/Elements_of_Electromagnetics/chapter_6.ipynb
index 21f353b6..2e3b83ef 100644
--- a/Elements_of_Electromagnetics/chapter_6.ipynb
+++ b/Elements_of_Electromagnetics/chapter_6.ipynb
@@ -1,80 +1,78 @@
-{
- "metadata": {
- "name": "chapter_6.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 6: Electrostatic Boundary Value Problems<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 6.12, Page number: 238<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Determine the capacitance of each of the capacitors in Figure 6.20.\n",
- "Take epsilon_r1 = 4, epsilon_r2 = 6, d = 5 mm, S = 30 cm^2 '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "e0=10**-9/(36*scipy.pi) #Permittivity of free space in Farad/m\n",
- "er1=4 #Relative permittivity of material 1 (dimensionless)\n",
- "er2=6 #Relative permittivity of material 2 (dimensionless)\n",
- "d=5*10** -3 #The spacing between the capacitor plates in m\n",
- "S=30*10** -4 #The surface area of the plates\n",
- "\n",
- "#Calculations\n",
- "\n",
- "#Calculation for Capacitor 1\n",
- "\n",
- "C1=e0*er1*S*2/d #Capacitance in Farads\n",
- "C2=e0*er2*S*2/d #Capacitance in Farads\n",
- "Ca=C1*C2/(C1+C2) #Total capacitance in Farads\n",
- "\n",
- "#Calculation for Capacitor 2\n",
- "\n",
- "C1= e0*er1*S/(2*d) #Capacitance in Farads\n",
- "C2= e0*er2*S/(2*d) #Capacitance in Farads\n",
- "Cb= C1+C2 #Total capacitance in Farads\n",
- "\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The capacitance of capacitor 1 =',round(Ca*10**12,2),'pF'\n",
- "print 'The capacitance of capacitor 2 =',round(Cb*10**12,2),'pF'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The capacitance of capacitor 1 = 25.46 pF\n",
- "The capacitance of capacitor 2 = 26.53 pF\n"
- ]
- }
- ],
- "prompt_number": 1
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:0404b66522ba62c52bb8d112f6cb8c3bcc64527b3152c58a7bd723197eac9b68"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 6: Electrostatic Boundary Value Problems<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 6.12, Page number: 238<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "e0=10**-9/(36*scipy.pi) #Permittivity of free space in Farad/m\n",
+ "er1=4 #Relative permittivity of material 1 (dimensionless)\n",
+ "er2=6 #Relative permittivity of material 2 (dimensionless)\n",
+ "d=5*10** -3 #The spacing between the capacitor plates in m\n",
+ "S=30*10** -4 #The surface area of the plates\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "#Calculation for Capacitor 1\n",
+ "\n",
+ "C1=e0*er1*S*2/d #Capacitance in Farads\n",
+ "C2=e0*er2*S*2/d #Capacitance in Farads\n",
+ "Ca=C1*C2/(C1+C2) #Total capacitance in Farads\n",
+ "\n",
+ "#Calculation for Capacitor 2\n",
+ "\n",
+ "C1= e0*er1*S/(2*d) #Capacitance in Farads\n",
+ "C2= e0*er2*S/(2*d) #Capacitance in Farads\n",
+ "Cb= C1+C2 #Total capacitance in Farads\n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'The capacitance of capacitor 1 =',round(Ca*10**12,2),'pF'\n",
+ "print 'The capacitance of capacitor 2 =',round(Cb*10**12,2),'pF'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The capacitance of capacitor 1 = 25.46 pF\n",
+ "The capacitance of capacitor 2 = 26.53 pF\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_7.ipynb b/Elements_of_Electromagnetics/chapter_7.ipynb
index 0c96dd8d..d7af4c23 100644
--- a/Elements_of_Electromagnetics/chapter_7.ipynb
+++ b/Elements_of_Electromagnetics/chapter_7.ipynb
@@ -1,224 +1,212 @@
-{
- "metadata": {
- "name": "chapter_7.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 7: Magnetostatic Fields<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 7.1, Page number: 266<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The conducting triangular loop in Figure 7.6(a) carries a current of lOA.\n",
- "Find H at (0, 0, 5) due to side 1 of the loop. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "p=5 #Distance from side 1 of loop to (0,0,5) in m\n",
- "l=2 #Length of the side in m\n",
- "I=10 #Current through loop in A\n",
- "\n",
- "#Calculation\n",
- "\n",
- "a1=scipy.arccos(l/(scipy.sqrt(l**2+p**2))) #Angle in radians\n",
- "a2=scipy.pi/2 #Angle in radians\n",
- "H=I*(scipy.cos(a1)-scipy.cos(a2))/(4*scipy.pi*p) #Field Intensity in A/m\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'H=',round(H*1000,1),'mA/m in the negative y direction'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "H= 59.1 mA/m in the negative y direction\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 7.2, Page number: 268<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- " Find H at (-3, 4, 0) due to the current filament shown in Figure 7.7 (a). '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "a1=scipy.arccos(0)\n",
- "a2=scipy.arccos(1)\n",
- "b1=scipy.arccos(0.6)\n",
- "b2=scipy.arccos(1)\n",
- "p1=5\n",
- "p2=4\n",
- "I1=3 #current in A\n",
- "I2=3 #current in A\n",
- "\n",
- "#Calculations\n",
- "\n",
- "Hz=I1/(4*scipy.pi*p1)*(cos(a2)-cos(a1))*array([0.8,0.6,0])\n",
- "Hx=I2/(4*scipy.pi*p2)*(cos(b2)-cos(b1))*array([0,0,1])\n",
- "Hzcyl=-I1/(4*scipy.pi*p1)*array([0,1,0])\n",
- "Hzx=round(dot(Hz,ax),4)\n",
- "Hzy=round(dot(Hz,ay),5)\n",
- "Hxz=round(dot(Hx,az),5)\n",
- "Hxr=array([0,0,Hxz])\n",
- "Hzr=array([Hzx,Hzy,0])\n",
- "Hzcyly=round(dot(Hzcyl,ay),5)\n",
- "Hzcylr=array([0,Hzcyly,0])\n",
- "Hcart=(Hxr+Hzr)*10**3 #H in cartesian coordinates in mA \n",
- "Hcyl=(Hxr+Hzcylr)*10**3 #H in cylindrical coordinates in mA\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'H at (-3, 4, 0) in cartesian coordnates =',Hcart,'mA/m'\n",
- "print 'H at (-3, 4, 0) in cylindrical coordnates =',Hcyl,'mA/m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "H at (-3, 4, 0) in cartesian coordnates = [ 38.2 28.65 23.87] mA/m\n",
- "H at (-3, 4, 0) in cylindrical coordnates = [ 0. -47.75 23.87] mA/m\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 7.5, Page number: 279<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Planes z=0 and z=4 carry current K=-10a_x A/m and K=10a_x A/m, respectively. \n",
- "Determine H at \n",
- "(a) (1,1,1) \n",
- "(b) (0,-3,10) '''\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "i0=-10 #current through plane z=0 in A/m\n",
- "i4=10 #current through plane z=4 in A/m\n",
- "\n",
- "#Calculations\n",
- "\n",
- "H0a=0.5*i0*-1 #H in positive Y direction in A/m\n",
- "H4a=0.5*i4*-1*-1 #H in positive Y direction in A/m\n",
- "Ha=H0a+H4a #H at (1,1,1) in A/m \n",
- "H0b=0.5*i0*-1 #H in positive Y direction in A/m\n",
- "H4b=0.5*i4*-1 #H in negative Y direction in A/m\n",
- "Hb=H0b+H4b #H at (0,-3,10) in A/m\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'H at (1,1,1) =',Ha,'A/m'\n",
- "print 'H at (0,-3,10) =',Hb,'A/m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "H at (1,1,1) = 10.0 A/m\n",
- "H at (0,-3,10) = 0.0 A/m\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 7.7, Page number: 287<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Given the magnetic vector potential A=-p^2/4 a_z Wb/m, calculate \n",
- "the total magnetic flux crossing the surface phi=pi/2, 1 <= p <= 2 m,\n",
- "0 <= Z <= 5 m. '''\n",
- "\n",
- "import scipy.integrate\n",
- "\n",
- "#Calculation\n",
- "\n",
- "def B(z,p): \n",
- " return 0.5*p\n",
- "psy, err = scipy.integrate.dblquad(lambda p , z: B(z,p), \n",
- " 0, 5, lambda p: 1, lambda p: 2)\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'Total magnetic flux crossing the surface phi=pi/2 is',psy,'Wb'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Total magnetic flux crossing the surface phi=pi/2 is 3.75 Wb\n"
- ]
- }
- ],
- "prompt_number": 4
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:07eafc200928a1fc85942d637323ac709731a49898cf69ec16ea9de55515ee47"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 7: Magnetostatic Fields<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 7.1, Page number: 266<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "p=5 #Distance from side 1 of loop to (0,0,5) in m\n",
+ "l=2 #Length of the side in m\n",
+ "I=10 #Current through loop in A\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "a1=scipy.arccos(l/(scipy.sqrt(l**2+p**2))) #Angle in radians\n",
+ "a2=scipy.pi/2 #Angle in radians\n",
+ "H=I*(scipy.cos(a1)-scipy.cos(a2))/(4*scipy.pi*p) #Field Intensity in A/m\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'H=',round(H*1000,1),'mA/m in the negative y direction'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "H= 59.1 mA/m in the negative y direction\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 7.2, Page number: 268<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "a1=scipy.arccos(0)\n",
+ "a2=scipy.arccos(1)\n",
+ "b1=scipy.arccos(0.6)\n",
+ "b2=scipy.arccos(1)\n",
+ "p1=5\n",
+ "p2=4\n",
+ "I1=3 #current in A\n",
+ "I2=3 #current in A\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Hz=I1/(4*scipy.pi*p1)*(cos(a2)-cos(a1))*array([0.8,0.6,0])\n",
+ "Hx=I2/(4*scipy.pi*p2)*(cos(b2)-cos(b1))*array([0,0,1])\n",
+ "Hzcyl=-I1/(4*scipy.pi*p1)*array([0,1,0])\n",
+ "Hzx=round(dot(Hz,ax),4)\n",
+ "Hzy=round(dot(Hz,ay),5)\n",
+ "Hxz=round(dot(Hx,az),5)\n",
+ "Hxr=array([0,0,Hxz])\n",
+ "Hzr=array([Hzx,Hzy,0])\n",
+ "Hzcyly=round(dot(Hzcyl,ay),5)\n",
+ "Hzcylr=array([0,Hzcyly,0])\n",
+ "Hcart=(Hxr+Hzr)*10**3 #H in cartesian coordinates in mA \n",
+ "Hcyl=(Hxr+Hzcylr)*10**3 #H in cylindrical coordinates in mA\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'H at (-3, 4, 0) in cartesian coordnates =',Hcart,'mA/m'\n",
+ "print 'H at (-3, 4, 0) in cylindrical coordnates =',Hcyl,'mA/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "H at (-3, 4, 0) in cartesian coordnates = [ 38.2 28.65 23.87] mA/m\n",
+ "H at (-3, 4, 0) in cylindrical coordnates = [ 0. -47.75 23.87] mA/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 7.5, Page number: 279<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "#Variable Declaration\n",
+ "\n",
+ "i0=-10 #current through plane z=0 in A/m\n",
+ "i4=10 #current through plane z=4 in A/m\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "H0a=0.5*i0*-1 #H in positive Y direction in A/m\n",
+ "H4a=0.5*i4*-1*-1 #H in positive Y direction in A/m\n",
+ "Ha=H0a+H4a #H at (1,1,1) in A/m \n",
+ "H0b=0.5*i0*-1 #H in positive Y direction in A/m\n",
+ "H4b=0.5*i4*-1 #H in negative Y direction in A/m\n",
+ "Hb=H0b+H4b #H at (0,-3,10) in A/m\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'H at (1,1,1) =',Ha,'A/m'\n",
+ "print 'H at (0,-3,10) =',Hb,'A/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "H at (1,1,1) = 10.0 A/m\n",
+ "H at (0,-3,10) = 0.0 A/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 7.7, Page number: 287<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy.integrate\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "def B(z,p): \n",
+ " return 0.5*p\n",
+ "psy, err = scipy.integrate.dblquad(lambda p , z: B(z,p), \n",
+ " 0, 5, lambda p: 1, lambda p: 2)\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'Total magnetic flux crossing the surface phi=pi/2 is',psy,'Wb'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total magnetic flux crossing the surface phi=pi/2 is 3.75 Wb\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_8.ipynb b/Elements_of_Electromagnetics/chapter_8.ipynb
index e9adf8d2..b1d61d92 100644
--- a/Elements_of_Electromagnetics/chapter_8.ipynb
+++ b/Elements_of_Electromagnetics/chapter_8.ipynb
@@ -1,454 +1,421 @@
-{
- "metadata": {
- "name": "chapter_8.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 8: Magnetic Forces, Materials and Devices<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 8.1, Page number: 308<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A charged particle of mass 2 kg and charge 3 C starts at point (1,-2,0)\n",
- "with velocity 4a_x+3a_z m/s in an electric field 12a_x+10a_y V/m.\n",
- "At time t=1s, determine \n",
- "(a) The acceleration of the particle \n",
- "(b) Its velocity \n",
- "(c) Its kinetic energy \n",
- "(d) Its position '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "m=2 #mass in kg\n",
- "q=3 #charge in C\n",
- "v=array([4,0,3]) #initial velocity in m/s\n",
- "E=array([12,10,0]) #electric field in V/m\n",
- "t=1 #time in sec\n",
- "\n",
- "#Calculations\n",
- "\n",
- "a=q*E/m #acceleration in m/s^2 after 1 sec\n",
- "u=array([18*t+4,15*t,3]) #velocity in m/s after 1 sec\n",
- "modofu=scipy.sqrt(dot(u,u))\n",
- "KE=0.5*m*(modofu)**2 #kinetic energy in J at t=1 sec\n",
- "s=array([9*t**2+4*t+1,7.5*t**2-2,3*t]) #position after 1 sec in m\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'At time t=1 sec,'\n",
- "print' The acceleration of the particle =',a,'m/s^2'\n",
- "print 'Its velocity =',u,'m/s' \n",
- "print 'Its kinetic energy =',KE,'J'\n",
- "print 'Its position =',s,'m'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "At time t=1 sec,\n",
- " The acceleration of the particle = [18 15 0] m/s^2\n",
- "Its velocity = [22 15 3] m/s\n",
- "Its kinetic energy = 718.0 J\n",
- "Its position = [ 14. 5.5 3. ] m\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 8.6, Page number: 322"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A small current loop L1 with magnetic moment 5a_z A/m^2 is located at the origin while \n",
- "another small loop current I2 with magnetic moment 3a_y A/m^2 is located at (4, - 3, 10). \n",
- "Determine the torque on L2 . '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ar=array([1,0,0]) #Unit vector along radial direction\n",
- "ath=array([0,1,0]) #Unit vector along theta direction\n",
- "aph=array([0,0,1]) #Unit vector along phi direction \n",
- "x=4\n",
- "y=-3\n",
- "z=10\n",
- "muo=4*scipy.pi*10**-7 #permeability of free space\n",
- "m1=5 #magnetic moment in A/m^2\n",
- "\n",
- "#Calculations\n",
- "\n",
- "r=scipy.sqrt(x**2+y**2+z**2)\n",
- "p=scipy.sqrt(x**2+y**2)\n",
- "sinphi=y/p\n",
- "cosphi=x/p\n",
- "sintheta=1/scipy.sqrt(5)\n",
- "costheta=2/scipy.sqrt(5)\n",
- "B1=muo*m1*(2*costheta*ar+sintheta*ath)/(4*scipy.pi*r**3)\n",
- "m2=3*(sintheta*sinphi*ar+costheta*sinphi*ath+cosphi*aph)\n",
- "T2=cross(m2,B1)*10**9\n",
- "T2x=round(dot(T2,ar),3)\n",
- "T2y=round(dot(T2,ath),3)\n",
- "T2z=round(dot(T2,aph),3)\n",
- "T2r=array([T2x,T2y,T2z]) #torque in nNm\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'Torque T2 =',T2r,'nNm'\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Torque T2 = [-0.384 1.536 0.902]\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 8.7, Page number: 330"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Region 0 < Z < 2 m is occupied by an infinite slab of permeable material (mur = 2.5). If \n",
- "B = IOy ax - 5x ay mWb/m^2 within the slab, determine: (a) J, (b) Jb, (c) M, (d) Kb on \n",
- "z=0 '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "muo=4*scipy.pi*10**-7 #permeability of free space\n",
- "mur=2 #relative permeability\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction\n",
- "\n",
- "\n",
- "#Calculations\n",
- "\n",
- "J=(-5-10)*10**-6/(4*scipy.pi*10**-7*2.5) #in kA/m^2\n",
- "Jb=1.5*J #in kA/m^2\n",
- "MbyB=(1.5)*10**4/(4*scipy.pi*2.5) \n",
- "Mv=MbyB*10*10**-3*ax+MbyB*5*10**-3*ay\n",
- "Kb=cross(az,Mv)\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'J =',round(J,3),'kA/m^2'\n",
- "print 'Jb =',round(Jb,3),'kA/m^2'\n",
- "print 'M =(',round(dot(Mv,ax),3),'y,',round(dot(Mv,ay),3),'x, 0) kA/m'\n",
- "print 'Kb =(',round(dot(Kb,ax),3),'x,',round(dot(Kb,ay),3),'y, 0) kA/m' \n",
- " \n",
- "\n",
- " \n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "J = -4.775 kA/m^2\n",
- "Jb = -7.162 kA/m^2\n",
- "M =( 4.775 y, 2.387 x, 0) kA/m\n",
- "Kb =( -2.387 x, 4.775 y, 0) kA/m\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 8.8, Page number: 332<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Given that H=-2a_x + 6a_y + 4 a_z A/m in region y - x - 2 <= 0 where \n",
- "mu_1=5mu_0 , calculate \n",
- "(a) M_1 and B_1 \n",
- "(b) H_2 and B_2 in region y - x - 2 >= 0 where mu_2=2mu_0 '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ax=array([1,0,0]) #Unit vector along x direction\n",
- "ay=array([0,1,0]) #Unit vector along y direction\n",
- "az=array([0,0,1]) #Unit vector along z direction \n",
- "H1=array([-2,6,4]) #in A/m\n",
- "mu0=4*scipy.pi*10**-7 #permeability of free space\n",
- "mur1=5 #relative permeabililty in region 1\n",
- "mur2=2 #relative permeabililty in region 2\n",
- "an=array([-1,1,0])/scipy.sqrt(2)\n",
- "\n",
- "#Calculatios\n",
- "\n",
- "mu1=mu0*mur1\n",
- "mu2=mu0*mur2\n",
- "M1=(mur1-1)*H1 # magnetisation in region 1 in A/m\n",
- "B1=mu1*H1*10**6 # field in micro Wb/m^2\n",
- "B1x=round(dot(B1,ax),2) # x component of B1\n",
- "B1y=round(dot(B1,ay),1) # y component of B1\n",
- "B1z=round(dot(B1,az),2) # z component of B1\n",
- "B1r=array([B1x,B1y,B1z]) # B1 rounded to 2 decimal places\n",
- "H1n=dot(H1,an)*an \n",
- "H1t=H1-H1n\n",
- "H2t=H1t # using transverse boundary condition\n",
- "H2n=(mu1/mu2)*H1n # using normal boundary condition\n",
- "H2=H2t+H2n # in A/m\n",
- "B2=mu2*H2*10**6 # field in micro Wb/m^2\n",
- "B2x=round(dot(B2,ax),2) # x component of B2\n",
- "B2y=round(dot(B2,ay),2) # y component of B2\n",
- "B2z=round(dot(B2,az),2) # z component of B2\n",
- "B2r=array([B2x,B2y,B2z]) # B2 rounded to 2 decimal places\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'M1= ',M1,'A/m'\n",
- "print 'B1= ',B1r,'micro Wb/m^2'\n",
- "print 'H2= ',H2,'A/m'\n",
- "print 'B2= ',B2r,'micro Wb/m^2'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "M1= [-8 24 16] A/m\n",
- "B1= [-12.57 37.7 25.13] micro Wb/m^2\n",
- "H2= [ -8. 12. 4.] A/m\n",
- "B2= [-20.11 30.16 10.05] micro Wb/m^2\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 8.14, Page number: 350<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The toroidal core of Figure 8.26(a) has p_o = 10 cm and a circular cross \n",
- "section with a = 1 cm. If the core is made of steel (mu = 1000mu_o) and \n",
- "has a coil with 200 turns. calculate the amount of current that will\n",
- "produce a flux of 0.5 mWb in the core. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable declaration\n",
- "\n",
- "p=10*10**-2 #in m\n",
- "a=1*10**-2 #in m\n",
- "Ur=1000 #relative permeability\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "n=200 #number of turns\n",
- "phi=0.5*10**-3 #flux in the core in Wb\n",
- "U=Uo*Ur #permeability of steel core\n",
- "\n",
- "#Calculation\n",
- "\n",
- "I=phi*2*scipy.pi*p/(U*n*scipy.pi*a*a) #current in A\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The current that will produce a flux of 0.5 mWb =',round(I,3),'A'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The current that will produce a flux of 0.5 mWb = 3.979 A\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 8.15, Page number: 351<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "In the magnetic circuit of Figure 8.27, calculate the current in the coil \n",
- "that will produce a magnetic flux density of 1.5 Wb/m^2 in the air gap\n",
- "assuming that mu_1 = 50 mu_o and that all branches have the same\n",
- "cross-sectional area of 10 cm^2 . '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "Ur=50 #relative permeability of coil\n",
- "l1=30*10**-2\n",
- "s=10*10**-4 \n",
- "l3=9*10**-2\n",
- "la=1*10**-2 \n",
- "B=1.5 #flux density in Wb/m^2\n",
- "N=400 #number of turns\n",
- "\n",
- "#Calculations\n",
- "\n",
- "R1=l1/(Uo*Ur*s)\n",
- "R2=R1\n",
- "R3=l3/(Uo*Ur*s)\n",
- "Ra=la/(Uo*s)\n",
- "R=R1*R2/(R1+R2)\n",
- "Req=R3+Ra+R\n",
- "I=B*s*Req/N #current in A\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The current required =',round(I,3),'A'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The current required = 44.165 A\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 8.16, Page number: 353<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A U-shaped electromagnet shown in Figure 8.29 is designed to lift a \n",
- "400-kg mass (which includes the mass of the keeper). The iron\n",
- "yoke (mu_r = 3000) has a cross section of 40 cm^2 and mean length of 50 cm,\n",
- "and the air gaps are each 0.1 mm long. Neglecting the reluctance of \n",
- "the keeper, calculate the number of turns in the coil when\n",
- "the excitation current is 1 A. '''\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "m=400 #mass in kg\n",
- "g=9.8 #acceleration due to gravity in m/s^2\n",
- "Ur=3000 #relative permeability of the iron yoke\n",
- "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
- "S=40*10**-4 #cross sectional area of iron yoke in m^2\n",
- "la=1*10**-4 #air gaps in m\n",
- "li=50*10**-2 #mean length of yoke in m\n",
- "I=1 #excitation current in A \n",
- "\n",
- "#Calculations\n",
- "\n",
- "B=scipy.sqrt(m*g*Uo/S) #field in Wb/m^2\n",
- "Ra=2*la/(Uo*S) \n",
- "Ri=li/(Uo*Ur*S) \n",
- "N=(Ra+Ri)/(Ra*Uo)*B*la #number of turns\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The nmber of turns in the coil when the excitation current is 1 A ='\n",
- "print round(N,0)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The nmber of turns in the coil when the excitation current is 1 A =\n",
- "162.0\n"
- ]
- }
- ],
- "prompt_number": 5
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:3a0360df3c22e5e4c6f88ae6f9ab32945c496822bb8898446d53149d9f1116ec"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 8: Magnetic Forces, Materials and Devices<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.1, Page number: 308<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "m=2 #mass in kg\n",
+ "q=3 #charge in C\n",
+ "v=array([4,0,3]) #initial velocity in m/s\n",
+ "E=array([12,10,0]) #electric field in V/m\n",
+ "t=1 #time in sec\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "a=q*E/m #acceleration in m/s^2 after 1 sec\n",
+ "u=array([18*t+4,15*t,3]) #velocity in m/s after 1 sec\n",
+ "modofu=scipy.sqrt(dot(u,u))\n",
+ "KE=0.5*m*(modofu)**2 #kinetic energy in J at t=1 sec\n",
+ "s=array([9*t**2+4*t+1,7.5*t**2-2,3*t]) #position after 1 sec in m\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'At time t=1 sec,'\n",
+ "print' The acceleration of the particle =',a,'m/s^2'\n",
+ "print 'Its velocity =',u,'m/s' \n",
+ "print 'Its kinetic energy =',KE,'J'\n",
+ "print 'Its position =',s,'m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "At time t=1 sec,\n",
+ " The acceleration of the particle = [18 15 0] m/s^2\n",
+ "Its velocity = [22 15 3] m/s\n",
+ "Its kinetic energy = 718.0 J\n",
+ "Its position = [ 14. 5.5 3. ] m\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.6, Page number: 322"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ar=array([1,0,0]) #Unit vector along radial direction\n",
+ "ath=array([0,1,0]) #Unit vector along theta direction\n",
+ "aph=array([0,0,1]) #Unit vector along phi direction \n",
+ "x=4\n",
+ "y=-3\n",
+ "z=10\n",
+ "muo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "m1=5 #magnetic moment in A/m^2\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "r=scipy.sqrt(x**2+y**2+z**2)\n",
+ "p=scipy.sqrt(x**2+y**2)\n",
+ "sinphi=y/p\n",
+ "cosphi=x/p\n",
+ "sintheta=1/scipy.sqrt(5)\n",
+ "costheta=2/scipy.sqrt(5)\n",
+ "B1=muo*m1*(2*costheta*ar+sintheta*ath)/(4*scipy.pi*r**3)\n",
+ "m2=3*(sintheta*sinphi*ar+costheta*sinphi*ath+cosphi*aph)\n",
+ "T2=cross(m2,B1)*10**9\n",
+ "T2x=round(dot(T2,ar),3)\n",
+ "T2y=round(dot(T2,ath),3)\n",
+ "T2z=round(dot(T2,aph),3)\n",
+ "T2r=array([T2x,T2y,T2z]) #torque in nNm\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'Torque T2 =',T2r,'nNm'\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Torque T2 = [-0.384 1.536 0.902]\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.7, Page number: 330"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "muo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "mur=2 #relative permeability\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "J=(-5-10)*10**-6/(4*scipy.pi*10**-7*2.5) #in kA/m^2\n",
+ "Jb=1.5*J #in kA/m^2\n",
+ "MbyB=(1.5)*10**4/(4*scipy.pi*2.5) \n",
+ "Mv=MbyB*10*10**-3*ax+MbyB*5*10**-3*ay\n",
+ "Kb=cross(az,Mv)\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'J =',round(J,3),'kA/m^2'\n",
+ "print 'Jb =',round(Jb,3),'kA/m^2'\n",
+ "print 'M =(',round(dot(Mv,ax),3),'y,',round(dot(Mv,ay),3),'x, 0) kA/m'\n",
+ "print 'Kb =(',round(dot(Kb,ax),3),'x,',round(dot(Kb,ay),3),'y, 0) kA/m' \n",
+ " \n",
+ "\n",
+ " \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "J = -4.775 kA/m^2\n",
+ "Jb = -7.162 kA/m^2\n",
+ "M =( 4.775 y, 2.387 x, 0) kA/m\n",
+ "Kb =( -2.387 x, 4.775 y, 0) kA/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.8, Page number: 332<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction \n",
+ "H1=array([-2,6,4]) #in A/m\n",
+ "mu0=4*scipy.pi*10**-7 #permeability of free space\n",
+ "mur1=5 #relative permeabililty in region 1\n",
+ "mur2=2 #relative permeabililty in region 2\n",
+ "an=array([-1,1,0])/scipy.sqrt(2)\n",
+ "\n",
+ "#Calculatios\n",
+ "\n",
+ "mu1=mu0*mur1\n",
+ "mu2=mu0*mur2\n",
+ "M1=(mur1-1)*H1 # magnetisation in region 1 in A/m\n",
+ "B1=mu1*H1*10**6 # field in micro Wb/m^2\n",
+ "B1x=round(dot(B1,ax),2) # x component of B1\n",
+ "B1y=round(dot(B1,ay),1) # y component of B1\n",
+ "B1z=round(dot(B1,az),2) # z component of B1\n",
+ "B1r=array([B1x,B1y,B1z]) # B1 rounded to 2 decimal places\n",
+ "H1n=dot(H1,an)*an \n",
+ "H1t=H1-H1n\n",
+ "H2t=H1t # using transverse boundary condition\n",
+ "H2n=(mu1/mu2)*H1n # using normal boundary condition\n",
+ "H2=H2t+H2n # in A/m\n",
+ "B2=mu2*H2*10**6 # field in micro Wb/m^2\n",
+ "B2x=round(dot(B2,ax),2) # x component of B2\n",
+ "B2y=round(dot(B2,ay),2) # y component of B2\n",
+ "B2z=round(dot(B2,az),2) # z component of B2\n",
+ "B2r=array([B2x,B2y,B2z]) # B2 rounded to 2 decimal places\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'M1= ',M1,'A/m'\n",
+ "print 'B1= ',B1r,'micro Wb/m^2'\n",
+ "print 'H2= ',H2,'A/m'\n",
+ "print 'B2= ',B2r,'micro Wb/m^2'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "M1= [-8 24 16] A/m\n",
+ "B1= [-12.57 37.7 25.13] micro Wb/m^2\n",
+ "H2= [ -8. 12. 4.] A/m\n",
+ "B2= [-20.11 30.16 10.05] micro Wb/m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.14, Page number: 350<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable declaration\n",
+ "\n",
+ "p=10*10**-2 #in m\n",
+ "a=1*10**-2 #in m\n",
+ "Ur=1000 #relative permeability\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "n=200 #number of turns\n",
+ "phi=0.5*10**-3 #flux in the core in Wb\n",
+ "U=Uo*Ur #permeability of steel core\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "I=phi*2*scipy.pi*p/(U*n*scipy.pi*a*a) #current in A\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The current that will produce a flux of 0.5 mWb =',round(I,3),'A'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The current that will produce a flux of 0.5 mWb = 3.979 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.15, Page number: 351<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "Ur=50 #relative permeability of coil\n",
+ "l1=30*10**-2\n",
+ "s=10*10**-4 \n",
+ "l3=9*10**-2\n",
+ "la=1*10**-2 \n",
+ "B=1.5 #flux density in Wb/m^2\n",
+ "N=400 #number of turns\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "R1=l1/(Uo*Ur*s)\n",
+ "R2=R1\n",
+ "R3=l3/(Uo*Ur*s)\n",
+ "Ra=la/(Uo*s)\n",
+ "R=R1*R2/(R1+R2)\n",
+ "Req=R3+Ra+R\n",
+ "I=B*s*Req/N #current in A\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The current required =',round(I,3),'A'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The current required = 44.165 A\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.16, Page number: 353<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "m=400 #mass in kg\n",
+ "g=9.8 #acceleration due to gravity in m/s^2\n",
+ "Ur=3000 #relative permeability of the iron yoke\n",
+ "Uo=4*scipy.pi*10**-7 #permeability of free space\n",
+ "S=40*10**-4 #cross sectional area of iron yoke in m^2\n",
+ "la=1*10**-4 #air gaps in m\n",
+ "li=50*10**-2 #mean length of yoke in m\n",
+ "I=1 #excitation current in A \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "B=scipy.sqrt(m*g*Uo/S) #field in Wb/m^2\n",
+ "Ra=2*la/(Uo*S) \n",
+ "Ri=li/(Uo*Ur*S) \n",
+ "N=(Ra+Ri)/(Ra*Uo)*B*la #number of turns\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'The nmber of turns in the coil when the excitation current is 1 A ='\n",
+ "print round(N,0)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The nmber of turns in the coil when the excitation current is 1 A =\n",
+ "162.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Elements_of_Electromagnetics/chapter_9.ipynb b/Elements_of_Electromagnetics/chapter_9.ipynb
index 02dee160..3bdc4e61 100644
--- a/Elements_of_Electromagnetics/chapter_9.ipynb
+++ b/Elements_of_Electromagnetics/chapter_9.ipynb
@@ -1,200 +1,186 @@
-{
- "metadata": {
- "name": "chapter_9.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 9: Maxwells Equations<h1>"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 9.1, Page number: 375"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A conducting bar can slide freely over two conducting rails as shown in Figure 9_6. Calcu- \n",
- "late the induced voltage in the bar \n",
- "(a) If the bar is stationed at y = 8 cm and B = 4 cos(10^6t) az mWb/m^2 \n",
- "(b) If the bar slides at a velocity u = 20ay m/s and B = 4az. m Wb/m 2 \n",
- "(c) If the bar slides at a velocity u = 20ay m/s and B = 4cos(10^6t - y) az\u001f mWb/m^2 '''\n",
- "\n",
- "import scipy\n",
- "import scipy.integrate\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "u2=20\n",
- "B2=4\n",
- "l=0.06\n",
- "#Calculations\n",
- "\n",
- "def ansa(x,y): \n",
- " return 4*10**3\n",
- "Va, erra = scipy.integrate.dblquad(lambda y , x: ansa(x,y), #in V \n",
- " 0, 0.06, lambda y: 0, lambda y: 0.08)\n",
- "\n",
- "Vb=-u2*B2*l #in mV\n",
- "\n",
- "def ansc(x,y): \n",
- " return 4\n",
- "psic, errc = scipy.integrate.dblquad(lambda y , x: ansc(x,y), #in mWb \n",
- " 0, 0.06, lambda y: 0, lambda y: 1)\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'Va =',Va,'sin(10^6t) V'\n",
- "print 'Vb =',Vb,'mV'\n",
- "print 'Vc= ',psic*10**3,'cos(10^6t-y) -',psic*10**3,'cos(10^6t) V'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Va = 19.2 sin(10^6t) V\n",
- "Vb = -4.8 mV\n",
- "Vc= 240.0 cos(10^6t-y) - 240.0 cos(10^6t) V\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 9.3, Page number: 379"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The magnetic circuit of Figure 9.8 has a uniform cross section of 10^-3 m^2 . If the circuit is \n",
- "energized by a current I1(t) = 3 sin(100pit) A in the coil of N1 = 200 turns, find the emf \n",
- "induced in the coil of N2 = 100 turns. Assume that mu = 500 muo '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "n1=200\n",
- "n2=100 \n",
- "S=10**-3 #cross section in m^2\n",
- "muo=4*scipy.pi*10**-7 #permeabiility of free space\n",
- "mur=500 #relative permeability\n",
- "r=10*10**-3 #radius in m\n",
- "\n",
- "#Calculations\n",
- "\n",
- "psiI=n1*muo*mur*S/(2*scipy.pi*r)\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'V2 =',psiI*n2*300*scipy.pi,'cos(100pi t) V'\n",
- "print '= 6Pi cos(100pi t) V'\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "V2 = 188.495559215 cos(100pi t) V\n",
- "= 6Pi cos(100pi t) V\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 9.5, Page number: 393<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Evaluate the complex numbers \n",
- " \n",
- "(a) Zl=(j(3-j4)*)/(-I+j6)(2+j)^2 \n",
- "(b) Z2=((1+j)/(4-j8))^1/2 '''\n",
- "\n",
- "import scipy\n",
- "import cmath\n",
- "from numpy import *\n",
- "\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "z3=1j\n",
- "z4=3+4j \n",
- "z5=-1+6j \n",
- "z6=3+4j\n",
- "z7=1+1j\n",
- "z8=4-8j\n",
- "\n",
- "#Calculations\n",
- "\n",
- "z1=(z3*z4/(z5*z6))\n",
- "z2=scipy.sqrt(z7/z8)\n",
- "z1r=round(z1.real,4) #real part of z1 rounded to 4 decimal places\n",
- "z1i=round(z1.imag,4) #imaginary part of z1 rounded to 4 decimal places\n",
- "z2r=round(z2.real,4) #real part of z2 rounded to 4 decimal places\n",
- "z2i=round(z2.imag,4) #imaginary part of z2 rounded to 4 decimal places\n",
- "\n",
- "absz2=round(abs(z2),4) #absolute value of z2 rounded to 4 decimal places\n",
- "\n",
- "ang=scipy.arctan(z2i/z2r)*180/scipy.pi #in degrees\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'z1 =',z1r,'+',z1i,'j'\n",
- "print 'z2 ='\n",
- "print 'mod =',absz2,'and angle=',round(ang,1),'degrees'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "z1 = 0.1622 + -0.027 j\n",
- "z2 =\n",
- "mod = 0.3976 and angle= 54.2 degrees\n"
- ]
- }
- ],
- "prompt_number": 1
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:25d377db4166fc7d1439fb19889672d7cd5de596e5478e8198d3671878cf5493"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 9: Maxwells Equations<h1>"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.1, Page number: 375"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import scipy.integrate\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "u2=20\n",
+ "B2=4\n",
+ "l=0.06\n",
+ "#Calculations\n",
+ "\n",
+ "def ansa(x,y): \n",
+ " return 4*10**3\n",
+ "Va, erra = scipy.integrate.dblquad(lambda y , x: ansa(x,y), #in V \n",
+ " 0, 0.06, lambda y: 0, lambda y: 0.08)\n",
+ "\n",
+ "Vb=-u2*B2*l #in mV\n",
+ "\n",
+ "def ansc(x,y): \n",
+ " return 4\n",
+ "psic, errc = scipy.integrate.dblquad(lambda y , x: ansc(x,y), #in mWb \n",
+ " 0, 0.06, lambda y: 0, lambda y: 1)\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'Va =',Va,'sin(10^6t) V'\n",
+ "print 'Vb =',Vb,'mV'\n",
+ "print 'Vc= ',psic*10**3,'cos(10^6t-y) -',psic*10**3,'cos(10^6t) V'\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Va = 19.2 sin(10^6t) V\n",
+ "Vb = -4.8 mV\n",
+ "Vc= 240.0 cos(10^6t-y) - 240.0 cos(10^6t) V\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.3, Page number: 379"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "n1=200\n",
+ "n2=100 \n",
+ "S=10**-3 #cross section in m^2\n",
+ "muo=4*scipy.pi*10**-7 #permeabiility of free space\n",
+ "mur=500 #relative permeability\n",
+ "r=10*10**-3 #radius in m\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "psiI=n1*muo*mur*S/(2*scipy.pi*r)\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'V2 =',psiI*n2*300*scipy.pi,'cos(100pi t) V'\n",
+ "print '= 6Pi cos(100pi t) V'\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "V2 = 188.495559215 cos(100pi t) V\n",
+ "= 6Pi cos(100pi t) V\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 9.5, Page number: 393<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ " \n",
+ "import scipy\n",
+ "import cmath\n",
+ "from numpy import *\n",
+ "\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "z3=1j\n",
+ "z4=3+4j \n",
+ "z5=-1+6j \n",
+ "z6=3+4j\n",
+ "z7=1+1j\n",
+ "z8=4-8j\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "z1=(z3*z4/(z5*z6))\n",
+ "z2=scipy.sqrt(z7/z8)\n",
+ "z1r=round(z1.real,4) #real part of z1 rounded to 4 decimal places\n",
+ "z1i=round(z1.imag,4) #imaginary part of z1 rounded to 4 decimal places\n",
+ "z2r=round(z2.real,4) #real part of z2 rounded to 4 decimal places\n",
+ "z2i=round(z2.imag,4) #imaginary part of z2 rounded to 4 decimal places\n",
+ "\n",
+ "absz2=round(abs(z2),4) #absolute value of z2 rounded to 4 decimal places\n",
+ "\n",
+ "ang=scipy.arctan(z2i/z2r)*180/scipy.pi #in degrees\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'z1 =',z1r,'+',z1i,'j'\n",
+ "print 'z2 ='\n",
+ "print 'mod =',absz2,'and angle=',round(ang,1),'degrees'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "z1 = 0.1622 + -0.027 j\n",
+ "z2 =\n",
+ "mod = 0.3976 and angle= 54.2 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Engineering_Heat_Transfer/CHAPTER1.ipynb b/Engineering_Heat_Transfer/CHAPTER1.ipynb
index d020ad30..9b33caee 100644
--- a/Engineering_Heat_Transfer/CHAPTER1.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER1.ipynb
@@ -27,23 +27,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of surface temperature on one side of a firewall\n",
"\n",
- "#Given\n",
"k=9.4 # thermal conductivity in [BTU/hr.ft. \u02daRankine]\n",
"q=6.3 # heat flux in [BTU/s. sq.ft]\n",
"T1=350 # the outside surface temperature of one aide of the wall [\u02daF]\n",
"\n",
- "#Calculation\n",
- "# converting heat flux into BTU/hr sq.ft\n",
"Q=6.3*3600 # [BTU/hr.sq.ft]\n",
"dx=0.5 # thickness in [inch]\n",
- "#converting distance into ft\n",
"Dx=0.5/12.0 # thickness in [ft]\n",
- "# solving for temeprature T2\n",
"T2=T1-(Q*Dx/k) # [\u02daF]\n",
"\n",
- "#Result\n",
"print\"The required temperature on the other side of the firewall is \",round(T2,1),\"F\"\n"
],
"language": "python",
@@ -71,19 +64,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of thermal conductivity of aluminium\n",
"\n",
- "#Given\n",
"k_ss=14.4 # thermal conductivity of stainless steel in [W/m.K]\n",
"dt_ss=40 # [K]\n",
"dt_al=8.65 # [K]\n",
"dz_ss=1 # [cm]\n",
"dz_al=3 # [cm]\n",
"\n",
- "#calculation\n",
"k_al=k_ss*dt_ss*dz_al/(dt_al*dz_ss);# thermal conductivity of Al in [W/m.K]\n",
"\n",
- "#result\n",
"print\"The thermal conductivity of aluminium is\",round(k_al,0),\"W/m.K\"\n"
],
"language": "python",
@@ -111,19 +100,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of heat transferred by convection\n",
"\n",
- "#Given\n",
"h_c=3 # convective coefficient in [BTU/hr.ft**2\n",
"A=30*18 # Cross sectional area in ft**2\n",
"T_w=140 # Roof surface temperature in degree Fahrenheit\n",
"T_inf=85 # Ambient temperature in degree Fahrenheit\n",
"\n",
- "#Calculation\n",
"dT= (T_w-T_inf)\n",
"Q_c=h_c*A*dT # Convective heat transfer in BTU/hr\n",
"\n",
- "#Result\n",
"print\"The heat transferred by convection is\",round(Q_c,2),\"BTU/hr\"\n"
],
"language": "python",
@@ -151,9 +136,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determining average film conductance\n",
"\n",
- "#Given\n",
"D=0.0243 # diameter in meter\n",
"L=0.2 # length in meter\n",
"A=3.14*D*L # cross-sectional area in sq.m\n",
@@ -164,12 +147,9 @@
"Q=500.0 # volumetric flow rate in cc/s\n",
"density=1000 # density of water in kg/cu.m\n",
"\n",
- "#calculation\n",
"m=Q*density/10**6 # mass flowa rate in kg/s\n",
- "# using definition of specific heat and Newton's law of cooling\n",
"hc=m*cp*(T_b2-T_in)/(A*(T_w-T_in))\n",
"\n",
- "#result\n",
"print\"The average film conductance is \",round(hc,0),\"W/sq.m. K\"\n"
],
"language": "python",
@@ -197,9 +177,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of heat loss rate by radiation\n",
"\n",
- "#Given\n",
"W=14 # width in ft\n",
"L=30.0 # length in ft\n",
"A=W*L # area in ft**2\n",
@@ -207,12 +185,10 @@
"T1=120+460 # driveway surface temperature in degree Rankine\n",
"T2=0 # space temperature assumed to be 0 degree Rankine\n",
"\n",
- "#Calculation\n",
"sigma=0.1714*10**(-8) # value of Stefan-Boltzmann's constant in BTU/(hr.ft**2.(degree Rankine)**4)\n",
"e=0.9 # surface emissivity\n",
"q=sigma*A*e*F_12*((T1)**4-(T2)**4);\n",
"\n",
- "#result\n",
"print\"The heat loss rate by radiation is \",round(q,0),\"BTU/hr\"\n"
],
"language": "python",
@@ -240,18 +216,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of radiation thermal conductance\n",
"\n",
- "#Given\n",
"A=420.0 # area in sq.ft\n",
"T1=580.0 # driveway surface temperature in degree Rankine\n",
"T2=0 # surface temperature assumed to be 0 degree Rankine\n",
"Qr=73320 # heat loss rate in BTU/hr\n",
"\n",
- "#calculation\n",
"hr=Qr/(A*(T1-T2)) # radiation thermal conductance in BTU/(hr.ft**2.(degree Rankine)\n",
"\n",
- "#result\n",
"print\"the radiation thermal conductance is \",round(hr,2),\"BTU/(hr. sq.ft R)\"\n"
],
"language": "python",
@@ -289,18 +261,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Identification of all resistances and their values\n",
- "# Estimation of heat transfer per unit area\n",
- "# Determination of the inside and outside wall temperatures\n",
"\n",
- "#Given\n",
"A=1.0 # assuming A=1 m**2 for convenience\n",
"hc1_avg=15.0 # taking average of extreme values for hc [W/m**2.K]\n",
"k=(0.38+0.52)/2.0 # thermal conductivity of common brick in W/M.k\n",
"L=0.1 #10 cm converted into m\n",
"Rk=(L/(k*A)) # resistance of construction material, assume common brick\n",
"\n",
- "#calcultion\n",
"T_inf1=1000.0 # temperature of exhaust gases in K\n",
"T_inf2=283.0 # temperature of ambient air in K\n",
"Rcl=1/(hc1_avg*A) # resistance on left side of wall [K/W]\n",
@@ -309,7 +276,6 @@
"T_in=T_inf1-Rcl*q #inlet temprature \n",
"T_out=T_inf2+Rc2*q\n",
"\n",
- "#result\n",
"print\"(b)\"\n",
"print\"The resistance on left side of wall is \",round(Rcl,2),\"K/W\"\n",
"print\"The resistance of construction material of wall is\",round(Rk,2),\"K/W\"\n",
@@ -319,7 +285,6 @@
"print\"The inside wall temperature is \",round(T_in,0),\"K\"\n",
"print\"The outside wall temperature is\",round(T_out,1),\"K\"\n",
"\n",
- "#Plot\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -408,9 +373,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of surface temperature\n",
"\n",
- "#Given\n",
"k=0.604 # [BTU/(hr.ft.degree Rankine)]\n",
"hc=3.0 # average value for natural convection in BTU/(hr.ft**2.degree Rankine)\n",
"ew=0.93 \n",
@@ -421,12 +384,9 @@
"T_inf=20+460 # temperature of ambient air in degree Rankine\n",
"T_r=0 # assuming space temperature to be 0 degree Rankine\n",
"\n",
- "#Calculation\n",
- "# LHS of the form a*Tw+b*Tw**4=c\n",
"a=((k/L)+hc) #Coefficient of Tw in the equation\n",
"b=(sigma*ew*f_wr) #Coefficient of Tw**4 in the equation\n",
"c=(k*T1/L)+(hc*T_inf)+(sigma*f_wr*ew*T_r**4) #right hans side of the equation\n",
- "#Soving by try and error\n",
"Tw1=470 #assumed first value of temprature\n",
"LHS1=a*Tw1+b*Tw1**4\n",
"Tw2=480 #assumed 2nd value of temprature\n",
@@ -438,7 +398,6 @@
"Tw5=484.5 #assumed fifth value of temprature\n",
"LHS5=a*Tw5+b*Tw5**4\n",
"\n",
- "#result\n",
"print\"RHS\",round(c,1)\n",
"print\"LHS at surface Temprature 1=\",round(LHS1,1)\n",
"print\"LHS at surface Temprature 2=\",round(LHS2,1)\n",
diff --git a/Engineering_Heat_Transfer/CHAPTER10.ipynb b/Engineering_Heat_Transfer/CHAPTER10.ipynb
index f7b3f4b6..b9bac11c 100644
--- a/Engineering_Heat_Transfer/CHAPTER10.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER10.ipynb
@@ -37,10 +37,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the heat-transfer rate and the amount of steam condensed\n",
"\n",
- "#Given\n",
- "# properties of engine oil at (328 + 325)/2 = 326.5 degree F = 320\u00b0F from appendix table C11\n",
"rou_f=0.909*62.4 # density in lbm/ft**3 \n",
"cp=1.037 # specific heat BTU/(lbm-degree Rankine) \n",
"v_f=0.204e-5 # viscosity in ft**2/s \n",
@@ -57,8 +54,6 @@
"W=3.0 # width in ft\n",
"z=0.204*10**-5 # distance from entry of plate in ft\n",
"\n",
- "#Calculation\n",
- "# film thickness is given as follows\n",
"y=((4*kf*v_f*(Tg-Tw)/3600.0)/(rou_f*g*hfg*(1-(rou_v/rou_f))))**(1/4.0) #let y=delta/z**(1/4)\n",
"hz=1665 #From Table 10.1\n",
"hL=(4/3.0)*hz # at plate end\n",
@@ -66,11 +61,9 @@
"q=mf*hfg\n",
"Re=(4*mf/3600)/(W*rou_f*v_f)\n",
"\n",
- "#Result\n",
"print\"The amount of steam condensed is \",round(mf,1),\"lbm/h\"\n",
"print\"The heat transfer rate is \",round(q,0),\"BTU/hr\"\n",
"\n",
- "#plot\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -121,10 +114,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of both the heat that the cooling fluid must remove and the condensation rate. \n",
"\n",
- "#Given\n",
- "# properties of water at (100 + 60)/2 = 80\u00b0C from appendix table C11\n",
"rou_f=974.0 # density in kg/m**3 \n",
"cp_1=4196.0 # specific heat in J/(kg*K) \n",
"v_1=0.364e-6 # viscosity in m**2/s \n",
@@ -139,8 +129,6 @@
"Tw=60\n",
"L=1\n",
"\n",
- "#Calculation\n",
- "# specifications of 1 nominal schedule 40 pipe from appendix F1\n",
"OD=0.03340\n",
"hD=0.782*((g*rou_f*(1-(rou_v/rou_f))*(kf**3)*hfg)/(v_1*OD*(Tg-Tw)))**(1/4.0)\n",
"hD=10720 #According to the book\n",
@@ -148,7 +136,6 @@
"q=hD*math.pi*OD*L*(Tg-Tw)\n",
"mf=q/hfg\n",
"\n",
- "#Result\n",
"print\"The heat flow rate is \",round(q,0),\"W\"\n",
"print\"The rate at which steam condenses is \",round(mf*3600,0),\"kg/hr\"\n"
],
@@ -178,10 +165,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of (a) the power input to the water for boiling to occur, (b) the evaporation rate of water, and (c) the critical heat flux.\n",
"\n",
- "#Given\n",
- "# properties of water at 100\u00b0C = 373 K from appendix table 10.3\n",
"rou_f=958 # density in kg/m**3\n",
"cp_f= 4217 # specific heat in J/(kg*K) \n",
"v_f= 2.91e-7 # viscosity in m**2/s \n",
@@ -195,8 +179,6 @@
"g=9.81\n",
"gc=1\n",
"\n",
- "#calculation\n",
- "# nucleate boiling regime\n",
"Cw=0.0132 # formechanically polished stainless steel from table 10.2\n",
"q_A=(rou_f*v_f*hfg)*((g*rou_f*(1-(rou_g/rou_f)))/(sigma*gc))**(0.5)*((cp_f*(Tw-Tg))/(Cw*hfg*Pr_f**1.7))**3\n",
"A=math.pi*D**2/4.0\n",
@@ -204,7 +186,6 @@
"mf=q/hfg # water evaporation rate\n",
"q_cr=0.18*hfg*(sigma*g*gc*rou_f*rou_g**2)**(0.25)\n",
"\n",
- "#Result\n",
"print\"(a)The power delivered to the water is kW\",round(q/1000,2),\"KW\"\n",
"print\"(b)The water evaporation rate is \",round(mf*3600,2),\"kg/h\"\n",
"print\"(c)The critical heat flux is \",round(q_cr,0),\"W/sq.m\"\n"
diff --git a/Engineering_Heat_Transfer/CHAPTER11.ipynb b/Engineering_Heat_Transfer/CHAPTER11.ipynb
index af58990e..30fa585c 100644
--- a/Engineering_Heat_Transfer/CHAPTER11.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER11.ipynb
@@ -27,15 +27,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the value of the solid angle subtended by surfaces dA2 and dA3 with respect to dA1 (b) the intensity of emission from dA, in the direction of the other areas (c) the rate at which radiation emitted by dA, is intercepted by the other areas\n",
"\n",
- "#Given\n",
- "# solid angle is calculate using the equation dw=dA*cos(Beta)/r**2\n",
- "# Beta is the angle between the surface normal of a receiver surface and the line connecting the two surfaces\n",
- "# For area A2\n",
- "# dimensions are 1X1 in, so\n",
"\n",
- "#Calculation\n",
"import math\n",
"dA2=(1*1)/144.0\n",
"Beta1=40*math.pi/180.0\n",
@@ -54,7 +47,6 @@
"dq1_2=I_theta2*dA1*math.cos(theta2)*dw2_1 #In book calculation mistake\n",
"dq1_3=I_theta3*dA1*math.cos(theta2)*dw3_1\n",
"\n",
- "#Result\n",
"print\"(a)The solid angle subtended by area dA2 with respect to dA1 is \",round(dw2_1,4),\"sr\"\n",
"print\" The solid angle subtended by area dA3 with respect to dA1 is \",round(dw3_1,4),\"sr\"\n",
"print\"(b) The intensity of radiation emitted from dA1 in the direction of dA2 is \",round(I_theta2,0),\"BTU/(hr.sq.ft.sr)\"\n",
@@ -92,26 +84,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the value of the solid angle subtended by surfaces dA2 with respect to dA1 (b) the rate at which radiation emitted by dA1 is intercepted by dA2 (c) the irradiation associated with dA2\n",
"\n",
- "#Given\n",
- "# solid angle is calculate using the equation dw=dA*cos(Beta)/r**2\n",
- "# The angle Beta is 0 because the surface normal of dA2 is directed at dA1\n",
"dA2=0.02*0.02\n",
"Beta=0\n",
"r=1\n",
"\n",
- "#Calculation\n",
"import math\n",
"dw2_1=dA2*math.cos(Beta)/r**2\n",
"dA1=dA2\n",
"theta=math.pi*30/180.0\n",
"I_theta=1000# The intensity of radiation leaving dA1 in any direction is 1 000 W/(m**2.sr\n",
"dq1_2=I_theta*dA1*cos(theta)*dw2_1\n",
- "# The irradiation associated with dA2 can be found by dividing the incident radiation by the receiver area\n",
"dQ1_2=dq1_2/dA2\n",
"\n",
- "#Result\n",
"print\"(a)The solid angle subtended by area dA2 with respect to dA1 is \",round(dw2_1,4),\"sr\"\n",
"print\"(b)The rate at which radiation emitted by dA1 is intercepted by dA2 is\",round(dq1_2,5),\"W\"\n",
"print\"(c)The irradiation associated with dA2 is \",round(dQ1_2,3),\"W/sq.m\"\n"
@@ -143,18 +128,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) Calculation of the emissivity of the hole.(b) the rate of radiant emission from the hole\n",
"\n",
- "#Given\n",
"D=2.5/12.0 # diameter in ft\n",
"L=4.5/12.0 # length in ft\n",
"\n",
- "#Calculation\n",
"import math\n",
"A=(2*math.pi*D**2/4)+(math.pi*D*L)\n",
"A_hole=math.pi*(1/(8.0*12.0))**2/4.0\n",
"f=A_hole/A # fraction of area removed\n",
- "# for rolled and polished aluminum, that emissivity = 0.039 from appendix table E1\n",
"emissivity=0.039\n",
"emissivity_hole=emissivity/(emissivity+(1-emissivity)*f)\n",
"\n",
@@ -163,7 +144,6 @@
"qe=emissivity_hole*sigma*T**4\n",
"Qe=A_hole*qe\n",
"\n",
- "#Result\n",
"print\"(a)The emissivity of the hole is %.4f\",round(emissivity_hole,4)\n",
"print\"(b)The heat lost by the hole is \",round(Qe,4),\"BTU/hr\"\n"
],
@@ -193,21 +173,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the percentage of total emitted energy that lies in the visible range. \n",
"\n",
- "#Given\n",
"T=2800 #Temprature\n",
"lambda1=4e-7 #Wavelength\n",
"lambda2=7e-7\n",
"hT=lambda1*T\n",
"\n",
- "#Calculation\n",
"lambdaT=lambda2*T\n",
"I1=0.0051 #Fraction of Total Radiation Emitted for lower Wavelength-Temperature Product from Table 11.1\n",
"I2=0.065 #Fraction of Total Radiation Emitted for upper Wavelength-Temperature Product from Table 11.1\n",
"dI=I2-I1\n",
"\n",
- "#Result\n",
"print\"The percentage of total emitted energy that lies in the visible range is\",round(dI*100,0),\"percant\"\n"
],
"language": "python",
@@ -235,17 +211,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of the surface temperature of the sun and the emitted heat flux\n",
"\n",
- "#Given\n",
"lambda_max=0.5e-6 # maximum wavelength in m\n",
- "# From Wien\u2019s Displacement Law we can write lambda_max*T=2.898e-3 m.K\n",
"T=2.898e-3/lambda_max\n",
- "# The heat flux is given by the Stefan-Boltzmann Equation as q=sigma*T**4\n",
"sigma=5.675e-8 # value of Stefan-Boltzmann constant in W/(m**2.K**4)\n",
"q=sigma*T**4\n",
"\n",
- "#result\n",
"print\"The Surface Temperature of the Sun is \",round(T,2),\"K\"\n",
"print\"The heat flux emitted is \",round(q,0),\"W/sq.m\"\n"
],
@@ -275,9 +246,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) Calculation of the rate at which the sun\u2019s radiant energy is transmitted through the glass windshield. The interior of the car is considered to be a black body that radiates at 100\u00b0F. (b) Calculation of the rate at which radiant energy from the car interior is transmitted through the glass windshield. \n",
"\n",
- "#Given\n",
"lambda1=300e-9 # lower limit of wavelength\n",
"lambda2=380e-9 # upper limit of wavelength\n",
"T=5800\n",
@@ -291,7 +260,6 @@
"q_in=t*q # energy transmitted from the sun through the glass\n",
"\n",
"\n",
- "#Calculation\n",
"Tb=311 # temperature of black body source in K\n",
"lambda1_Tb=lambda1*Tb\n",
"lambda2_Tb=lambda2*Tb\n",
@@ -299,7 +267,6 @@
"t_b=dI_b*0.68 # transmissivity\n",
"q_out=t_b*q\n",
"\n",
- "#Result\n",
"print\"(a)The energy transmitted from the sun through the glass is \",round(q_in,1),\"W/sq.m\"\n",
"print\"(b)the rate at which radiant energy from the car interior is transmitted through the glass windshield is\",q_out,\"W/sq.m\"\n"
],
diff --git a/Engineering_Heat_Transfer/CHAPTER12.ipynb b/Engineering_Heat_Transfer/CHAPTER12.ipynb
index 1d32142c..dacb5289 100644
--- a/Engineering_Heat_Transfer/CHAPTER12.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER12.ipynb
@@ -27,27 +27,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the heat transferred by radiation from dA1 to A. \n",
"\n",
- "#Given\n",
- "# The view factor Fd1_2 can be calculated as Fd1_2=Fd1_3+Fd1_4+Fd1_5\n",
- "# For Fd1_3\n",
"a_13=100.0\n",
"b_13=250.0\n",
"c_13=100.0\n",
"X_13=a_13/c_13\n",
"Y_13=b_13/c_13\n",
"Fd1_3=0.17 # value for Fd1_3 corresponding to above calculated values of a/c and b/c\n",
- "# For Fd1_4\n",
"a_14=300\n",
"b_14=50\n",
"c_14=100\n",
"\n",
- "#Calculation\n",
"X_14=a_14/c_14\n",
"Y_14=b_14/c_14\n",
"Fd1_4=0.11 #value for Fd1_4 corresponding to above calculated values of a/c and b/c\n",
- "# For Fd1_5\n",
"a_15=100\n",
"b_15=50\n",
"c_15=100\n",
@@ -60,7 +53,6 @@
"T2=560\n",
"q12_A1=sigma*Fd1_2*(T1**4-T2**4)\n",
"\n",
- "#result\n",
"print\"The net heat transferred is \",round(q12_A1,1),\"BTU/(hr.sq.ft)\"\n"
],
"language": "python",
@@ -88,9 +80,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the heat transferred to the conveyed parts for the conditions given\n",
"\n",
- "#Given\n",
"import math\n",
"L1=1\n",
"angle=math.pi*45/180.0\n",
@@ -99,12 +89,10 @@
"T1=303\n",
"T2=473\n",
"\n",
- "#Calculation\n",
"sigma=5.67e-8 # Stefan-Boltzmann constant\n",
"q21_A2=sigma*(T2**4-T1**4)*((L1/L2)+1-(L3/L2))/2.0\n",
"q31_A3=sigma*(T2**4-T1**4)*((L1/L2)-1+(L3/L2))/2.0\n",
"\n",
- "#result\n",
"print\"The heat transferred from A3 to A1 is \",round(q31_A3,0),\" W/sq.m\"\n"
],
"language": "python",
@@ -132,17 +120,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the heat exchanged between the two plates\n",
"\n",
- "#Given\n",
- "# The view factor can be found with the crossed-string method\n",
- "# from figure 12.13(b)\n",
"ac=1\n",
"bd=1\n",
"ad=(9+1)**0.5\n",
"bc=ad\n",
"\n",
- "#calculation\n",
"crossed_strings=ad+bc\n",
"uncrossed_strings=ac+bd\n",
"L1_F12=(1/2.0)*(crossed_strings-uncrossed_strings)\n",
@@ -153,7 +136,6 @@
"T2=460\n",
"q12_A1=sigma*(T1**4-T2**4)*F12\n",
"\n",
- "#Result\n",
"print\"The heat transfer rate is \",round(q12_A1,0),\"W/sq m\"\n"
],
"language": "python",
@@ -181,14 +163,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the heat that must be supplied to each of the isothermal surfaces, and also the temperature of the insulated surface. \n",
"\n",
- "#Given\n",
- "# we can apply the equations as follows\n",
- "# q1=sigma*A1*[(T1**4-T2**4)F12+(T1**4-T3**4)F13]..... (1)\n",
- "# q2=sigma*A2*[(T2**4-T1**4)F21+(T2**4-T3**4)F23]..... (2)\n",
- "# q3=sigma*A3*[(T3**4-T1**4)F31+(T3**4-T2**4)F32]..... (3)\n",
- "# given data:\n",
"T1=1000.0\n",
"T3=500.0\n",
"q2=0\n",
@@ -199,13 +174,11 @@
"F31=1/2.0\n",
"F32=1/2.0\n",
"\n",
- "#Calculation\n",
"T2=((T1**4+T3**4)/2.0)**(1/4.0) # using equation (2)\n",
"sigma=0.1714e-8 # Stefan-Boltzmann constant\n",
"q1_A1=sigma*((T1**4-T2**4)*F12+(T1**4-T3**4)*F13) # using equation (1)\n",
"q3_A3=sigma*((T3**4-T1**4)*F31+(T3**4-T2**4)*F32) # using equation (3)\n",
"\n",
- "#result\n",
"print\"The temperature is \",round(T2,1),\"R\"\n",
"print\"The heat flux through area A1 is\",round(q1_A1,0),\"BTU/(hr.sq.ft)\"\n",
"print\"The heat flux through area A3 is\",round(q3_A3,0),\"BTU/(hr.sq.ft)\"\n",
@@ -239,10 +212,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the heat lost by the oven through its top surface. \n",
"\n",
- "#Given\n",
- "# all energy leaving A1 is intercepted by A2 and vice versa\n",
"F12=1\n",
"F21=1\n",
"F11=0 # the surfaces are flat\n",
@@ -253,11 +223,9 @@
"T2=323\n",
"sigma=5.67e-8 # Stefan-Boltzmann constant\n",
"\n",
- "#Calculation\n",
"q1=(sigma*(T1**4-T2**4))/((1/emissivity1)+(1/emissivity2)-1)\n",
"q2=-q1\n",
"\n",
- "#Result\n",
"print\"The heat lost through bottom surface is \",round(q1,1),\"W/sq m\"\n",
"print\"The heat lost through top surface is \",round(q2,1),\"W/sq m\"\n"
],
@@ -287,13 +255,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the net heat exchanged between the dish and the surroundings by radiation at the instant the dish is removed from the oven. Perform the calculations (a) if the dish and surroundings behave like black bodies, and again (b) if the dish has an emissivity of 0.82 and the surroundings have an emissivity of 0.93.\n",
"\n",
- "#Given\n",
"D=1.0 # diameter in ft\n",
"L=6/12.0 # length in ft\n",
"\n",
- "#Calculation\n",
"A=2*math.pi*D**2/4+math.pi*D*L\n",
"F12=1 # the view factor between the dish and the surroundings is unity\n",
"T1=810\n",
@@ -301,15 +266,11 @@
"sigma=0.1714e-8 # Stefan-Boltzmann constant\n",
"q1=sigma*A*(T1**4-T2**4)*F12\n",
"\n",
- "# For gray-surface behavior, we can apply the following Equation\n",
- "# q1/(A1e1)-[F11*(q1/A1)*(1-e1)/e1+F12*(q2/A2)*(1-e2)/e2]=sigma*T1**4-(F11*sigma*T1**4+F12*sigma*T2**4)... equation (1)\n",
"F11=0\n",
"e1=0.82\n",
"e2=0.93\n",
- "# putting q2/A2=0 in equation (1) as A2 tends to infinity\n",
"q1_=A*e1*(sigma*T1**4-F12*sigma*T2**4)\n",
"\n",
- "#Result\n",
"print\"(a)The heat exchanged between the dish and the surroundings is\",round(q1,0),\"BTU/hr\"\n",
"print\"(b)The heat exchanged between the dish and the surroundings for the second case is \",round(q1_,0),\"BTU/hr\"\n"
],
diff --git a/Engineering_Heat_Transfer/CHAPTER2.ipynb b/Engineering_Heat_Transfer/CHAPTER2.ipynb
index 556700c2..6e5857d6 100644
--- a/Engineering_Heat_Transfer/CHAPTER2.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER2.ipynb
@@ -27,13 +27,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#determination of the heat flow through a composite wall\n",
"\n",
- "#Given\n",
"T3=-10.00\t\t# temperature of inside wall in degree Fahrenheit\n",
"T0=70.0 \t \t# temperature of outside wall in degree Fahrenheit\n",
"dT=T0-T3 # overall temperature difference\n",
- "# values of thermal conductivity in BTU/(hr.ft.degree Rankine) from appendix table B3\n",
"k1=0.38 # brick masonry\n",
"k2=0.02 # glass fibre\n",
"k3=0.063 # plywood\n",
@@ -42,13 +39,11 @@
"dx3=0.5/12.0 # thickness of plywood layer in ft\n",
"A=1.0 # cross sectional area taken as 1 ft**2\n",
"\n",
- "#Calculation\n",
"R1=dx1/(k1*A) # resistance of brick layer in (hr.degree Rankine)/BTU\n",
"R2=dx2/(k2*A) # resistance of glass fibre layer in (hr.degree Rankine)/BTU\n",
"R3=dx3/(k3*A) # resistance of plywood layer in (hr.degree Rankine)/BTU\n",
"qx=(T0-T3)/(R1+R2+R3) \n",
"\n",
- "#Result\n",
"print\"Resistance of brick layer is \",round(R1,3),\"(hr.degree Rankine)/BTU\"\n",
"print\"Resistance of glass fibre layer is \",round(R2,1),\"(hr.degree Rankine)/BTU\"\n",
"print\"Resistance of plywood layer is \",round(R3,3),\"(hr.degree Rankine)/BTU\"\n",
@@ -82,15 +77,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of heat transfer through composite wall for materials in parallel\n",
"\n",
- "#Given\n",
- "# values of thermal conductivities in W/(m.K) from appendix table B3\n",
"k1=0.45 # thermal conductivity of brick\n",
"k2a=0.15 # thermal conductivity of pine\n",
"k3=0.814 # thermal conductivity of plaster board\n",
"k2b=0.025 # thermal conductivity of air from appendix table D1\n",
- "# Areas needed fpor evaluating heat transfer in sq.m\n",
"A1=0.41*3 # cross sectional area of brick layer \n",
"A2a=0.038*3 # cross sectional area of wall stud\n",
"A2b=(41-3.8)*0.01*3 # cross sectional area of air layer\n",
@@ -99,7 +90,6 @@
"dx2=0.089 # thickness of wall stud and air layer in m\n",
"dx3=0.013 # thickness of plastic layer in m\n",
"\n",
- "#Calculation\n",
"R1=dx1/(k1*A1) # Resistance of brick layer in K/W\n",
"R2=dx2/(k2a*A2a+k2b*A2b) # Resistance of wall stud and air layer in K/W\n",
"R3=dx3/(k3*A3) # Resistance of plastic layer in K/W\n",
@@ -107,7 +97,6 @@
"T0=0 # temperature of outside wall in degree celsius\n",
"qx=(T1-T0)/(R1+R2+R3) # heat transfer through the composite wall in W\n",
"\n",
- "#result\n",
"print\"Resistance of brick layer is \",round(R1,3),\"k/W\"\n",
"print\"Resistance of wall stud and air layer is \",round(R2,2),\"k/W\"\n",
"print\"Resistance of plastic layer is \",round(R3,3),\"k/W\"\n",
@@ -141,9 +130,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of heat transfer rate and overall heat transfer coefficient\n",
"\n",
- "#Given\n",
"k1=24.8 # thermal conductivity of 1C steel in BTU/(hr.ft.degree Rankine)from appendix table B2 \n",
"k2=0.02 # thermal conductivity of styrofoam steel in BTU/(hr.ft.degree Rankine)\n",
"k3=0.09 # thermal conductivity of fibreglass in BTU/(hr.ft.degree Rankine)\n",
@@ -154,9 +141,7 @@
"dx2=0.75/12.0 # thickness of styrofoam in ft\n",
"dx3=0.25/12.0 # thickness of fiberglass in ft\n",
"\n",
- "#Calculation \n",
"\n",
- "# Resistances in (degree Fahrenheit.hr)/BTU\n",
"Rc1=1/(hc1*A) # Resistance from air to sheet metal\n",
"Rk1=dx1/(k1*A) # Resistance of steel layer\n",
"Rk2=dx2/(k2*A) # Resistance of styrofoam layer\n",
@@ -167,7 +152,6 @@
"T_inf2=32 # temperature of mixture of ice and water in degree F\n",
"q=U*A*(T_inf1-T_inf2)\n",
"\n",
- "#result\n",
"print\"Resistance from air to sheet metal: \",round(Rc1,3),\"degree F.hr/BTU\"\n",
"print\"Resistance of steel layer is \",round(Rk1,4),\"degree F.hr/BTU\"\n",
"print\"Resistance of styrofoam layer is \",round(Rk2,3),\"degree F.hr/BTU\"\n",
@@ -208,21 +192,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of the heat transfer through the pipe wall per unit length of pipe.\n",
"\n",
- "#given\n",
"k=14.4 # thermal conductivity of 304 stainless steel in W/(m.K) from appendix table B2\n",
- "# dimensions of steel pipes in cm from appendix table F1\n",
"D2=32.39 #Diameter (cm)\n",
"D1=29.53\n",
"T1=40 #Temprature\n",
"T2=38\n",
"\n",
- "#Calculation\n",
"import math\n",
"Qr_per_length=(2*3.14*k)*(T1-T2)/math.log(D2/D1)#format(6)\n",
"\n",
- "#Result\n",
"print\"The heat transfer through the pipe wall per unit length of pipe is \",round(Qr_per_length/1000,2),\"kw/m\"\n"
],
"language": "python",
@@ -250,12 +229,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of the heat gain per unit length\n",
"\n",
- "#Given\n",
"k1=231 # thermal conductivity of copper in BTU/(hr.ft.degree Rankine)from appendix table B1 \n",
"k2=0.02 # thermal conductivity of insuLtion in BTU/(hr.ft.degree Rankine)\n",
- "# Specifications of 1 standard type M copper tubing from appendix table F2 are as follows\n",
"D2=1.125/12 # outer diameter in ft\n",
"D1=0.08792 # inner diameter in ft\n",
"R2=D2/2 # outer radius\n",
@@ -268,7 +244,6 @@
"T3=70 # temperature of surface temperature of insulation degree fahrenheit\n",
"q_per_L=(T1-T3)/(LRk1+LRk2) # heat transferred per unit length in BTU/(hr.ft)\n",
"\n",
- "#Result\n",
"print\"The heat transferred per unit length is \",round(q_per_L,2),\" BTU/(hr.ft\"\n"
],
"language": "python",
@@ -296,12 +271,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the overall heat transfer coefficient\n",
"\n",
- "#Given data\n",
"k12=24.8 # thermal conductivity of 1C steel in BTU/(hr.ft.degree Rankine)from appendix table B2 \n",
"k23=.023 # thermal conductivity of glass wool insulation in BTU/(hr.ft.degree Rankine)from appendix table B3 \n",
- "# Specifications of 6 nominal, schedule 40 pipe (no schedule was specified, so the standard is assumed) from appendix table F1 are as follows\n",
"D2=6.625/12.0 # outer diameter in ft\n",
"D1=0.5054 # inner diameter in ft\n",
"t=2/12.0 # wall thickness of insulation in ft\n",
@@ -309,10 +281,8 @@
"hc1=12 # convection coefficient between the air and the pipe wall in BTU/(hr. sq.ft.degree Rankine).\n",
"hc2=1.5 # convection coefficient between the glass wool and the ambient air in BTU/(hr. sq.ft.degree Rankine).\n",
"\n",
- "#calculation\n",
"U=1/((1/hc1)+(D1*log(D2/D1)/k12)+(D1*log(D3/D2)/k23)+(D1/(hc2*D3)))\n",
"\n",
- "#Result\n",
"print\"Overall heat transfer coefficient is \",round(U,4),\" BTU/(hr.sq.ft. Fahrenheit)\"\n"
],
"language": "python",
@@ -340,9 +310,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the thermal contact resistance\n",
"\n",
- "#Given\n",
"k=14.4 # thermal conductivity of 304 stainless steel in W/(m.K)from appendix table B2 \n",
"T1=543.0 # temperature in K at point 1\n",
"T2=460.0 # temperature in K at point 2\n",
@@ -360,14 +328,12 @@
"T7=349 # temperature in K at point 7\n",
"T8=337 # temperature in K at point 8\n",
"\n",
- "#Calculation\n",
"qz_per_A=k*dT/dz12 # heat flow calculated in W/m**2 calculated using Fourier's law\n",
"T_ial=T5-(dz5i*(T5-T6)/dz56) # temperature of aluminium interface in K\n",
"T_img=dzi8*(T7-T8)/dz78+T8 # temperature of magnesium interface in K\n",
"T_img_=355.8 #Approx value in the book\n",
"Rtc=(T_ial-T_img_)/(qz_per_A)\n",
"\n",
- "#Result\n",
"\n",
"print\"The required thermal contact resistance is\",round(Rtc,7),\"K sq.m/W\"\n"
],
@@ -406,36 +372,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of temperature profile, heat transferred, efficiency, effectiveness.\n",
"\n",
- "#Given\n",
"import math\n",
"k=24.8 # thermal conductivity of 1C steel in BTU/(hr.ft.degree Rankine)from appendix table B2\n",
"D=(5.0/16.0)/12.0 # diameter of the rod in ft\n",
"P=(math.pi*D) # Circumference of the rod in ft\n",
- "#print\"The perimeter is %.4f ft\",P)\n",
"A=(math.pi/4)*D**2 # Cross sectional area of the rod in sq.ft\n",
- "#print\"The Cross sectional area is %.6f sq.ft\",A)\n",
"hc=1.0 # assuming the convective heat transfer coefficient as 1 BTU/(hr. sq.ft. degree Rankine)\n",
"\n",
- "#Calculation\n",
"m=math.sqrt(hc*P/(k*A))\n",
- "#print\"The value of parameter m is: /ft\",m)\n",
"L=(9/2.0)/12.0 # length of rod in ft\n",
- "# using the equation (T-T_inf)/(T_w-T_inf)=(cosh[m(L-z)])/(cosh(mL)) for temperature profile\n",
"T_inf=70.0\n",
"T_w=200.0\n",
"dT=T_w-T_inf\n",
"const=dT/math.cosh(m*L)\n",
"\n",
- "#(b) the heat transferred can be calculated using the equation qz=k*A*m*(T_w-T_inf)*tanh(m*L)\n",
"qz=k*A*m*dT*tanh(m*L)\n",
"\n",
- "#(c)\n",
"mL=m*L\n",
"efficiency=0.78 # from fig. 2.30\n",
"\n",
- "#(d)\n",
"effectiveness=math.sqrt(k*P/(hc*A))*tanh(mL)\n",
"\n",
"\n",
@@ -444,7 +400,6 @@
"print\"(d)The effectiveness is found to be\",round(effectiveness,1)\n",
"\n",
"\n",
- "#Plot\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -534,9 +489,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of heat transferred\n",
"\n",
- "#Given\n",
"k=136.0 # thermal conductivity of aluminium in BTU/(hr.ft.degree Rankine)from appendix table B1\n",
"L=9/(8*12.0) #length in ft\n",
"W=9/(4*12.0) #width in ft\n",
@@ -545,7 +498,6 @@
"T_w=1000.0 # the root temperature in degree fahrenheit\n",
"T_inf=90.0 # the ambient temperature in degree fahrenheit\n",
"\n",
- "#Calculation\n",
"import math\n",
"m=math.sqrt(hc/(k*delta))\n",
"P=2*W\n",
@@ -555,7 +507,6 @@
"Lc=L+delta\n",
"qz3=k*A*m*(T_w-T_inf)*math.tanh(m*L*(1+delta/Lc))\n",
"\n",
- "#Result\n",
"print\"(a)The heat transferred is \",round(qz1,2),\"BTU/hr\"\n",
"print\"(b)The heat transferred is \",round(qz2,2),\"BTU/hr In the book the answer is incorrect\"\n",
"print\"(c)The heat transferred is \",round(qz3,2),\" BTU/hr\"\n"
@@ -587,20 +538,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of optimum fin length and heat transferred by fin\n",
"\n",
- "#Given\n",
"k=8.32 # thermal conductivity BTU/(hr.ft.degree Rankine)\n",
"hc=400.0 # the convective heat transfer coefficient given in BTU/(hr.ft**2. degree Rankine)\n",
"\n",
- "#Calculation\n",
"import math\n",
"delta_opt=0.55/(12*2)\n",
- "# determination of dimension of one fin using the equation delta_opt=0.583*hc*Lc**2/k\n",
"Lc=math.sqrt(delta_opt*k/(0.583*hc))\n",
"\n",
"A=Lc*delta_opt\n",
- "# determination of parameter for finding out efficiency from graph\n",
"parameter=Lc**1.5*math.sqrt(hc/(k*A))\n",
"efficiency=0.6\n",
"W=1/(2.0*12.0) # width in ft\n",
@@ -610,7 +556,6 @@
"delta=W/2.0 \n",
"q_ac=efficiency*hc*2*W*math.sqrt(L**2+delta**2)*(T_w-T_inf)\n",
"\n",
- "#Result\n",
"print\"(a)The optimum length is \",round(Lc*12,2),\"inch\"\n",
"print\"(b)The actual heat transferred is \",round(q_ac,2),\"BTU/hr. NOTE: In the book answer is incorrect\"\n"
],
@@ -640,10 +585,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of heat transferred and fin effectiveness\n",
"\n",
- "#Given\n",
- "#parameters of the problem are\n",
"N=9 # number of fins\n",
"delta=0.003/2.0 \n",
"L=0.025\n",
@@ -656,9 +598,7 @@
"hc=15 \n",
"k=52 # thermal conductivity of cast iron in W/(m.K)from appendix table B2\n",
"\n",
- "#calculation\n",
"import math\n",
- "#(a)\n",
"Ap=2*delta*Lc\n",
"As=2*math.pi*(R2c**2-R1**2)\n",
"radius_ratio=R2c/R1 # for finding efficiency from figure 2.38\n",
@@ -670,15 +610,12 @@
"qw=hc*Asw*(T_w-T_inf)\n",
"q=qf+qw\n",
"\n",
- "#(b)H=N*(Sp+2*delta) # height of cylinder\n",
"H=N*(Sp+2*delta)\n",
"Aso=2*math.pi*R1*H # surface area without fins\n",
"qo=hc*Aso*(T_w-T_inf)\n",
"\n",
- "#(c)\n",
"effectiveness=q/qo # effectiveness defined as ratio of heat transferred with fins to heat transferred without fins\n",
"\n",
- "#Result\n",
"print\"(a)The total heat transferred from the cylinder is \",round(q,0),\"W\"\n",
"print\"(b)The Heat transferred without fins is W\",round(qo,0),\"W\"\n",
"print\"(c)The fin effectiveness is \",round(effectiveness,2)\n"
diff --git a/Engineering_Heat_Transfer/CHAPTER4.ipynb b/Engineering_Heat_Transfer/CHAPTER4.ipynb
index 918045d0..a15cf189 100644
--- a/Engineering_Heat_Transfer/CHAPTER4.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER4.ipynb
@@ -27,9 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of response time\n",
"\n",
- "#Given\n",
"k=12.0 # thermal conductivity in BTU/(hr.ft.degree Rankine) \n",
"c=0.1 # specific heat in BTU/(lbm.degree Rankine) \n",
"D=0.025/12.0 # diameter in ft\n",
@@ -40,15 +38,11 @@
"As=3.14*D**2 # surface area in sq.ft\n",
"Vs=3.14*D**(0.5) # volume in cu.ft\n",
"\n",
- "#calculation\n",
- "#As/Vs=6/D\n",
"import math\n",
"reciprocal_timeconstant=(hc*6)/(density*D*c)\n",
- "# selecting T=139 F as T=140 gives an infinite time through the equation (T-T_inf)/(T_i-T_inf)=exp(-hc*As/density*Vs*c)t\n",
"T=139\n",
"t=math.log((T-T_inf)/(T_i-T_inf))/(-reciprocal_timeconstant)\n",
"\n",
- "#result\n",
"print\"The response time of the junction is %.1f s\",round(t*3600,2),\"s\"\n"
],
"language": "python",
@@ -76,10 +70,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of temperature of metal and cumulative heat rate\n",
- "# properties of aluminium from appendix table B1\n",
"\n",
- "#Given\n",
"k=236.0 # thermal conductivity in W/(m.K)\n",
"Cp=896.0 # specific heat in J/(kg.K)\n",
"sp_gr=2.702 # specific gravity\n",
@@ -88,13 +79,11 @@
"L=0.60 # length in m\n",
"hc=550.0 # unit surface conductance between the metal and the bath in W/(K.sq.m)\n",
"\n",
- "#calculation\n",
"import math\n",
"Vs=(math.pi*D**2*L)/4.0 # Volume in cu.m\n",
"As=(2*math.pi*D**2/4.0)+(math.pi*D*L) # surface area in sq.m\n",
"import math\n",
"Bi=(hc*Vs)/(k*As) # Biot Number\n",
- "# Biot number is less than 1 hence lump capacitance equations apply\n",
"T_i=50.0 # initial temperature in degree celsius\n",
"T_inf=2.0 # temperature of ice water bath in degree celsius\n",
"t=60.0 # time=1 minute=60 s\n",
@@ -102,7 +91,6 @@
"T=T_inf+(T_i-T_inf)*math.exp(-(hc*As_*t)/(density*Vs*Cp))\n",
"Q=density*Vs*Cp*(T_inf-T_i)*(1-math.exp(-(hc*As_*t)/(density*Vs*Cp)))\n",
"\n",
- "#result\n",
"print\"(a)The temperature of aluminium is\",round(T,1),\"C\"\n",
"print\"(b)The cumulative heat transferred is \",round(-Q/1000,1),\"KJ\"\n"
],
@@ -132,9 +120,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determine the time required and temprature profile\n",
"\n",
- "#Given\n",
"hc=30\n",
"L=0.24\n",
"k=1.25 #Conductivity\n",
@@ -142,7 +128,6 @@
"rou=550\n",
"Fo=0.4 #Fourier no\n",
"\n",
- "#Calculation\n",
"Bi=hc*L/k\n",
"alpha=k/(rou*c)\n",
"Tc=150\n",
@@ -150,7 +135,6 @@
"T_i=50\n",
"t=(L**2*Fo)/(alpha)\n",
"TC1=0.82 #Centreline temprature\n",
- "#from table at x/l=0.4\n",
"T=0.71*(T_i-T_inf)*TC1\n",
"x=0.4*L\n",
"Ti=149\n",
@@ -182,7 +166,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculate the time required\n",
"hc=6 #Surface Conductance\n",
"D=0.105 #Orange Diameter\n",
"k=0.431 #Thermal conductivity \n",
@@ -190,11 +173,9 @@
"rou=998 #Density\n",
"Fo=1.05 #Fourier no.\n",
"\n",
- "#Calculation\n",
"import math\n",
"Vs=math.pi*D**3/6\n",
"As=math.pi*D**2\n",
- "# calculating Biot Number for lumped capacitance approach\n",
"Bi=hc*Vs/(k*As)\n",
"Bi_=hc*(D/2)/(k)\n",
"alpha=k/(rou*c)\n",
@@ -205,7 +186,6 @@
"a=Bi_**2*Fo\n",
"Q=0.7*rou*c*(math.pi/6.0*(Fo**3))*(T_i-T_inf)\n",
"\n",
- "#Result\n",
"print\"The time required is \",round(t/3600,2),\"hr\"\n",
"print\"The heat transfered is\",round(Q/1000,2),\"kj\""
],
@@ -235,7 +215,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Estimate the depth of freeze line\n",
" \n",
"D=0.105 #diameter\n",
"k=0.3 #Thermal conductivity \n",
@@ -245,8 +224,6 @@
"alpha=k/(sp_gr*rou_water*c)\n",
"t=3*30*24\n",
"\n",
- "#Calculation\n",
- "# Bi_math.sqrt(Fo) is infinite\n",
"T_inf=10\n",
"Ts=10\n",
"T=32\n",
@@ -255,7 +232,6 @@
"variable_fig4_12=0.38 #The value of x/(2*(alpha*t)**0.5) from figure 4.12\n",
"x=2*math.sqrt(alpha*t)*variable_fig4_12\n",
"\n",
- "#result\n",
"print\"The depth of the freeze line in soil is ft\",round(x,2),\"ft\"\n"
],
"language": "python",
@@ -283,18 +259,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# properties of aluminium from appendix table B1\n",
"\n",
- "#Given\n",
"k_al=236\n",
"p_al=2.7*1000\n",
"c_al=896\n",
- "# properties of oak from appendix table B3\n",
"k_oak=0.19\n",
"p_oak=0.705*1000\n",
"c_oak=2390\n",
"\n",
- "#Calculation\n",
"import math\n",
"math.sqrt_kpc_al=math.sqrt(k_al*p_al*c_al)\n",
"kpc_R=4\n",
@@ -304,7 +276,6 @@
"math.sqrt_kpc_oak=math.sqrt(k_oak*p_oak*c_oak)\n",
"T_oak=(T_Li*(math.sqrt_kpc_oak)+T_Ri*math.sqrt(kpc_R))/(math.sqrt_kpc_oak+math.sqrt(kpc_R))\n",
"\n",
- "#Result\n",
"print\"The temperature of aluminium is felt as \",round(T_al,2),\"C\"\n",
"print\"The temperature of oak is felt as %.1f degree celsius\",round(T_oak,1),\"C\"\n",
"print\"So oak will feel warmer to the touch than will the aluminium\"\n"
@@ -336,10 +307,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# properties of water at 68 degree fahrenheit from appendix table C11\n",
"\n",
- "#Given\n",
- "# The given properties are\n",
"rou=62.46\n",
"cp=0.9988\n",
"k=0.345\n",
@@ -347,7 +315,6 @@
"D=2.5/12.0\n",
"L=4.75/12.0\n",
"\n",
- "#Calculation\n",
"Vs=math.pi*D**2*L/4\n",
"As=(math.pi*D*L)+(math.pi*D**2)/2\n",
"Lc=Vs/As\n",
@@ -355,19 +322,16 @@
"Bi=hc*Lc/k\n",
"t=4\n",
"\n",
- "# for the cylinder solution\n",
"Fo_cylinder=alpha*t/(D/2)**2\n",
"Bi_cylinder=hc*(D/2)/k\n",
"reciprocal_Bi_cylinder=1/Bi_cylinder\n",
"dim_T_cylinder=0.175 #The value of dimensionless temperature of cylinder from figure 4.7a at corresponding values of Fo and 1/Bi\n",
"\n",
- "# for the infinite plate solution\n",
"Fo_plate=alpha*t/(L/2)**2\n",
"Bi_plate=hc*L/(2*k)\n",
"reciprocal_Bi_plate=1/Bi_plate\n",
"dim_T_plate=0.55 #The value of dimensionless temperature of infinite plate from figure 4.7a at corresponding values of Fo and 1/Bi\n",
"\n",
- "# For short cylinder problem\n",
"dim_T_shortcylinder=dim_T_cylinder*dim_T_plate\n",
"T_inf=30\n",
"T_i=72\n",
@@ -377,7 +341,6 @@
"dim_Tw_shortcylinder=dim_Tw_cylinder*dim_Tw_plate\n",
"Tw=dim_Tw_shortcylinder*(Tc-T_inf)+T_inf\n",
"\n",
- "#Result\n",
"print\"The temperature at centre of can is %.1f degree celsius\",round(Tc,0),\"F\"\n",
"print\"The bear temperature near the metal of the can is\",round(Tw,0),\"F\"\n",
"\n"
@@ -408,15 +371,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determine the time to reach centre temp. 50 C\n",
"\n",
- "#Given Data\n",
- "#The given properties are\n",
"rou=7817 #Density\n",
"c=461 #Specific heat \n",
"k=14.4 #Thermal conductivity \n",
"alpha=.387e-5\n",
- "#The dimension are\n",
"L1=0.03\n",
"L2=0.03\n",
"L3=0.04\n",
@@ -424,19 +383,14 @@
"T_i=95 #Internal temprature \n",
"T_inf=17 #Temprature at infinity\n",
"\n",
- "#Calculation\n",
- "# for infinite plate\n",
"L=L1/2\n",
"hc=50\n",
"reciprocal_Bi_plate=k/(hc*L)\n",
"Tinf=0.085 #Temprature distribution for infinite plate\n",
"Tsi=0.225 #Temprature distribution for semi infinite plate\n",
- "#Temprature at a depth of 4 cm\n",
"T=(Tinf**2)*(1-Tsi)*(T_i-T_inf)+T_inf\n",
- "#From the table\n",
"t=350\n",
"\n",
- "#Result\n",
"print\"At a time 3000s The temprature is \",round(T,1),\"C\"\n",
"print\"From the table The time requires to reach tempratue 50C is \",t,\"s\""
],
@@ -476,19 +430,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determine the time that will pass before the heat added\n",
"\n",
- "#Given\n",
"rou=0.5*1000\n",
"cp=837\n",
"k=0.128\n",
"alpha=0.049e-5\n",
"Ti=20 #Initial temprature\n",
- "# let Fo=0.5 and dx=0.05\n",
"dt=0.5*(0.05)**2/alpha\n",
"\n",
- "#Calculation\n",
- "#Temprature at 1<m<6 and p>0 till T6>20\n",
"p=0\n",
"T0=200\n",
"m=1\n",
@@ -504,7 +453,6 @@
"m=6\n",
"T61=(Ti+Ti)/2.0\n",
"\n",
- "#For next time interval\n",
"p=1\n",
"m=1\n",
"T12=(Ti+T0)/2.0\n",
@@ -518,11 +466,9 @@
"T52=(Ti+T41)/2.0\n",
"m=6\n",
"T62=(Ti+T51)/2.0\n",
- "#Repeating it\n",
"t=4.97\n",
"print\"The time that will pass before the heat added\",t,\"hr\"\n",
"\n",
- "#Plot\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -567,24 +513,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of time required to cool to a certain temperature\n",
"\n",
- "#Given\n",
- "#The properties are\n",
"rou=7.817*62.4 #density\n",
"c=0.110\n",
"k=8.32\n",
"alpha=0.417e-4\n",
"dx=1/12.0\n",
- "# taking Fo=1\n",
"Fo=1\n",
"\n",
- "#Calculation\n",
"dt=Fo*dx**2/alpha\n",
"n=8 #Enter the number of time intervals from Saulev plot\n",
"time=n*dt\n",
"\n",
- "#result\n",
"print\"The required time is hr\",round(time/3600,2),\"hr\"\n"
],
"language": "python",
diff --git a/Engineering_Heat_Transfer/CHAPTER5.ipynb b/Engineering_Heat_Transfer/CHAPTER5.ipynb
index 9ab19382..eed3e1b0 100644
--- a/Engineering_Heat_Transfer/CHAPTER5.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER5.ipynb
@@ -27,21 +27,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#How much heat must be added for the two cases.\n",
"\n",
- "#Given\n",
- "# properties of CO at 300K from appendix table D2\n",
"Cp=871\n",
"Gamma=1.3\n",
"\n",
- "#calculation\n",
"Cv=Cp/Gamma\n",
"dT=20\n",
"m=5\n",
"Qp=m*Cp*dT\n",
"Qv=m*Cv*dT\n",
"\n",
- "#Result\n",
"print\" The heat required at constant pressure is \",Qp/1000,\"kj\"\n",
"print\"The heat required at constant volume is \",Qv/1000,\"kj\"\n"
],
@@ -71,27 +66,21 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#verify the valve for Voluemetric thermal coefficient\n",
"\n",
- "#Given\n",
- "# properties of Freon-12 from appendix table C3\n",
"T1_Fr=-50\n",
"T2_Fr=-40\n",
"rou1_Fr=1.546*1000\n",
"rou2_Fr=1.518*1000\n",
"\n",
- "#Calculation\n",
"beta_Fr=-(rou1_Fr-rou2_Fr)/(rou1_Fr*(T1_Fr-T2_Fr))\n",
"beta_acc_Fr=2.63e-3 # the accurate value of volumetric thermal expansion coefficient for Freon-12\n",
"error_Fr=(beta_acc_Fr-beta_Fr)*100/beta_acc_Fr\n",
- "# properties of helium from appendix table D3\n",
"T1_He=366\n",
"T2_He=477\n",
"rou1_He=0.13280\n",
"rou2_He=0.10204\n",
"beta_He=-(rou1_He-rou2_He)/(rou1_He*(T1_He-T2_He))\n",
"\n",
- "#REsult\n",
"print\"The volumetric thermal expansion coefficient calculated for Freon-12 is \",round(beta_Fr,6),\"1/K\"\n",
"print\"The error introduced in the case of Freon-12 is percent\",round(error_Fr,0),\"percent\"\n",
"print\"The volumetric thermal expansion coefficient calculated for Freon-12 is \",round(beta_He,6),\"1/K\"\n"
diff --git a/Engineering_Heat_Transfer/CHAPTER6.ipynb b/Engineering_Heat_Transfer/CHAPTER6.ipynb
index f8b8ec9f..318545d4 100644
--- a/Engineering_Heat_Transfer/CHAPTER6.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER6.ipynb
@@ -27,38 +27,29 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the fluid outlet tetnperature and the tube-wall temperature at the outlet.\n",
"\n",
- "#Given\n",
- "#properties of ethylene glycol at 20 degree celsius from appendix table C5\n",
"Cp_20=2382\n",
"rou_20=1.116*1000\n",
"v_20=19.18e-6\n",
"kf_20=0.249\n",
"a_20=0.939e-7\n",
"Pr_20=204.0\n",
- "# specifications of 1/2 standard type M seamless copper water tubing from appendix table F2\n",
"OD=1.588/100.0\n",
"ID=1.446/100.0\n",
"A=1.642e-4\n",
"Q=3.25e-6\n",
"\n",
- "#Calculation\n",
"V=Q/A\n",
- "# calculation of Reynold's Number to check flow regime\n",
"Re=V*ID/v_20\n",
- "# since Re>he 2100, the flow regime is laminar and the hydrodynamic length can be calculated as\n",
"Z_h=0.05*ID*Re\n",
"Tbi=20 # bulk-fluid inlet temperature in degree celsius\n",
"qw=2200 # incident heat flux in W/m**2\n",
"L=3 # Length of copper tube in m\n",
"R=ID/2 # inner radius in m\n",
"Tbo=Tbi+(2*qw*a_20*L)/(V*kf_20*R)\n",
- "# This result is based on fluid properties evaluated at 20\u00b0C. taken as a first approximation\n",
"Z_t=0.05*ID*Re*Pr_20\n",
"Two=Tbo+(11*qw*ID)/(48*kf_20) # The wall temperature at outlet in degree celsius\n",
"\n",
- "#Result\n",
"print\"The bulk-fluid outlet temperature is degree celsius\",round(Tbo,0),\"C\"\n",
"print\"The wall temperature at outlet is degree celsius\",round(Two,0),\"C\"\n"
],
@@ -88,18 +79,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of average convection coefficient\n",
"\n",
- "#Given\n",
"T_avg=(140+70)/2.0\n",
- "# properties of water at average bulk temperature from appendix table C11\n",
"rou=0.994*62.4\n",
"kf=0.363\n",
"cp=0.9980\n",
"a=5.86e-3\n",
"v=0.708e-5\n",
"Pr=4.34\n",
- "# specifications of 1 standard type M copper tube from appendix table F2\n",
"OD=1.125/12.0 # outer diameter in ft\n",
"ID=0.8792 # inner diameter in ft\n",
"A=0.006071 # cross sectional area in sq.ft\n",
@@ -112,7 +99,6 @@
"Tbi=70.0\n",
"hL=-(rou*V*ID*cp*math.log((Tw-Tbo)/(Tw-Tbi)))/(4*L)\n",
"\n",
- "#result\n",
"print\"The average convective coefficient is \",round(hL/10,1),\"BTU/(hr. sq.ft.degree Rankine\"\n"
],
"language": "python",
@@ -151,15 +137,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the variation of wall temperature with length up to the point where the flow becomes fully developed.\n",
"\n",
- "#Given\n",
- "# properties of milk \n",
"kf=0.6 # thermal conductivity in W/(m-K)\n",
"cp=3.85*1000 # specific heat in J/(kg*K)\n",
"rou=1030 # density in kg/m**3\n",
"mu=2.12e3 # viscosity in N s/m**2\n",
- "# specifications of 1/2 standard type K tubing from appendix table F2\n",
"OD=1.588/100 # outer diameter in m\n",
"ID=1.340/100 # inner diameter in m\n",
"A=1.410e-4 # cross sectional area in m**2\n",
@@ -167,10 +149,7 @@
"V=0.1\n",
"mu=2.12e-3\n",
"\n",
- "#Calculation\n",
- "# determination of flow regime\n",
"Re=rou*V*ID/(mu)\n",
- "# The flow being laminar, the hydrodynamic entry length is calculated as follows\n",
"ze=0.05*ID*Re\n",
"Tbo=71.7 # final temperature in degree celsius\n",
"Tbi=20 # initial temperature in degree celsius\n",
@@ -180,11 +159,9 @@
"Pr=(cp*mu)/kf # Prandtl Number\n",
"zf=0.05*ID*Re*Pr\n",
"\n",
- "#result\n",
"print\"The heat flux is \",round(qw,0),\"W/sq.m\"\n",
"print\"The power required is \",round(q,0),\"W\"\n",
"print\"The length required for flow to be thermally developed is\",round(zf,1),\"m\"\n",
- "#plot\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -257,56 +234,40 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Graph the variation between fluid and wall bulb tempratures.\n",
- "#and how long it will take for the water volume to solidify.\n",
"\n",
- "#Given\n",
- "# The average bulk temperature of the Freon-12 is [-4O +(-4)]/2 = -22\u00b0F\n",
- "# properties of Freon-12 at average bulk temperature\n",
"kf=0.04 # thermal conductivity in BTU/(hr.ft.\u00b0R) \n",
"cp=0.2139 # specific heat in BTU/(lbm-\u00b0R)\n",
"rou= 1.489*(62.4) # density in lbm/cu.ft\n",
"v=0.272e-5 # viscosity in sq.ft/s\n",
"a=2.04e-3 # diffusivity in sq.ft/hr\n",
"Pr=4.8 # Prandtl Number\n",
- "# specifications of 3/8 standard type K copper tubing from appendix table F2\n",
"OD=0.5/12.0 # outer diameter in ft\n",
"ID=0.03350 # inner diameter in ft\n",
"A=0.0008814 # cross sectional area in sq.ft\n",
- "# Laminar conditions are asssumed\n",
"z=5.0\n",
"Tw=32.0\n",
"Tbo=-4.0\n",
"Tbi=-40.0\n",
"L=5.0\n",
"\n",
- "#Calculation\n",
"x=2*a*L/((kf*ID/2.0)*(math.log((Tw-Tbo)/(Tw-Tbi)))) #x=V/hl\n",
- "#1/Gz=9.09/V\n",
- "#from the table unless convergence is achieved\n",
"V=336.0 #ft/h\n",
"V_final=V/3600.0 #ft/s\n",
"hl_=V_final/(x) #\n",
"\n",
- "# checking the laminar-flow assumption by calculating the Reynolds number\n",
"Re=(V_final/3600.0)*ID/v\n",
- "# The flow is laminar\n",
"m_Fr=rou*A*V_final\n",
"As=math.pi*ID*L\n",
"q=hl_*As*((Tw-Tbo)-(Tw-Tbi))/(log((Tw-Tbo)/(Tw-Tbi)))\n",
"q_check=m_Fr*cp*(Tbo-Tbi)\n",
"rou_water=1.002*62.4 # density of water in lbm/ft**3 from appendix table C11\n",
"m_water=rou_water*L*(2/12.0)*(3/12.0)\n",
- "# to remove 144 BTU/lbm of water, the time required is caalculated as below\n",
"t=144*m_water/(-q*3600)\n",
"\n",
- "#result\n",
"print\"The mass flow rate of Freon-12 is \",round(m_Fr*3600,2),\"lbm/hr\"\n",
"print\"The required time is \",round(t,0),\"hr\"\n",
"\n",
"\n",
- "#plot\n",
- "#Constant wall temprature with length\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -336,8 +297,6 @@
"show(a2)\n",
"show(a3)\n",
"\n",
- "#2nd Plot\n",
- "#Nusslet number with dimensionless length\n",
"x1=[0.001,0.01,0.1,1]\n",
"Nu1=[31,11,5.5,5.2]\n",
"Nu2=[25,10,5.3,5.1]\n",
@@ -412,18 +371,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination for the power required for heating and the wall temperature at the outlet. \n",
"\n",
- "#Given\n",
- "# The liquid properties are evaluated at the mean temperature of (80 + 20)/2 = 50\u00b0C.\n",
- "# specifications of 1 standard type K copper water tubing from appendix table F2\n",
"OD = 2.858/100.0 # outer diameter in m \n",
"ID = 2.528/100.0 # inner diameter in m \n",
"A = 5.019e-4 # cross sectional area in sq.m\n",
- "# 1 oz = 2.957e-5 m**3\n",
"Q=80*2.957e-5/120 # The volume flow rate of water (at 20\u00b0C) in cu.m/s\n",
"p_20= 1.000*1000 # density of water at 20\u00b0C in kg/cu.m\n",
- "# properties of water at 50\u00b0C from appendix table C11\n",
"p_50= 0.990*(1000) # density in kg/m3 \n",
"cp= 4181 # specific heat in J/(kg*K) \n",
"v = 0.586e-6 # viscosity in sq.m/s \n",
@@ -431,7 +384,6 @@
"a = 1.533e-7 # diffusivity in sq.m/s \n",
"Pr = 3.68 # Prandtl number\n",
"\n",
- "#CALCULATION\n",
"import math\n",
"mass_flow=p_20*Q # mass flow rate through the tube in kg/s\n",
"L=3 # length of tube in m\n",
@@ -444,7 +396,6 @@
"print\"The power required is\",round(q,0),\"W\"\n",
"V=mass_flow/(p_50*A) # average velocity at 50 \u00b0C\n",
"Re=(V*ID)/v # Reynold's Number\n",
- "# The flow is laminar so we can use Figure 6.12 to obtain the information needed on Nusselt number and to find hz\n",
"inv_Gz=L/(Re*ID*Pr) # The inverse Graetz number at tube end, based on 50\u00b0C conditions\n",
"Nu=6.9 #value of corresponding Nusselts Number from figure 6.12\n",
"hz=(Nu*kf)/ID\n",
@@ -478,12 +429,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determine heat gained by the duct and wall temprature\n",
"\n",
- "#Given\n",
- "# determibation of heat gained\n",
- "# air properties to be calculated at T=(72+45)/2=58.5 degree Fahrenheit\n",
- "# properties at T=58.5 degree fahrenheit from appendix table D1\n",
"p = 0.077 # density in lbm/ft^3 \n",
"cp = 0.240 # specific heat in BTU/(lbm.degree Rankine) \n",
"v = 15.28e-5 # viscosity in ft^2/s \n",
@@ -495,16 +441,12 @@
"Tbo=72 # outlet temperature in degree Fahrenheit\n",
"Tbi=45 # inlet temperature in degree Fahrenheit\n",
"A=math.pi*(D**2)/4 # cross sectional area of duct in ft^2\n",
- "# density at outlet temperature in lbm/ft^3 \n",
"rou_o=.0748\n",
"V=10 # average velocity in ft/s\n",
"mass_flow=rou_o*A*V\n",
"\n",
- "#Calculation\n",
- "# average velocity evaluated by using the average bulk temperature\n",
"V_avg=mass_flow/(p*A)\n",
"Re=(V_avg*D)/v\n",
- "# the flow is in turbulent regime\n",
"q=mass_flow*cp*(Tbo-Tbi)\n",
"hc=1 # convection coefficient between the outside duct wall \n",
"T_inf=105 # The temperature of attic air surrounding the duct in degree Fahrenheit\n",
@@ -512,7 +454,6 @@
"qw=(T_inf-Tbo)/((1/hc)+(1/hz)) \n",
"Two=qw*(1/hz)+Tbo # The wall temperature at exit in degree Fahrenheit\n",
"\n",
- "#result\n",
"print\"The heat gained by air is\",round(q,3),\"BTU\"\n",
"print\"The wall temperature at exit is \",round(Two,1),\"F\"\n"
],
diff --git a/Engineering_Heat_Transfer/CHAPTER7.ipynb b/Engineering_Heat_Transfer/CHAPTER7.ipynb
index 3c0bf86c..b246db44 100644
--- a/Engineering_Heat_Transfer/CHAPTER7.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER7.ipynb
@@ -37,18 +37,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of boundary layer growth with length\n",
"\n",
- "#Given\n",
- "# properties of air at 27 degree celsius from appendix table D.1\n",
"rou=1.177 # density in kg/cu.m\n",
"v=15.68e-6 # viscosity in sq.m/s\n",
"L=0.5 # length in m\n",
"V_inf=1; # air velocity in m/s\n",
"Re= (V_inf*L)/v # Reynolds Number\n",
"\n",
- "#(a)plot\n",
- "#delta=1.98*10**-2*x**(1/2)\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -61,7 +56,6 @@
"plt.ylim((0,0.015))\n",
"a1=plot(x,t)\n",
"\n",
- "#(b)plot\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -74,14 +68,12 @@
"plt.ylim((0,0.010))\n",
"a1=plot(x,t)\n",
"\n",
- "# (c)calculation of absolute viscosity\n",
"gc=1\n",
"mu=rou*v/gc\n",
"b=1 # width in m\n",
"Df=0.664*V_inf*mu*b*(Re)**0.5\n",
"\n",
"\n",
- "#result\n",
"print\"(a)plot between boundary layer growth with distance\"\n",
"print\"(b)velocity distribution with distance\"\n",
"print\"(c)The skin-drag including both sides of plate is \",round(2*Df,4),\"n\"\n"
@@ -131,10 +123,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of temperature profile\n",
"\n",
- "#Given\n",
- "# properties of water at (40 + 100)/2 = 70\u00b0F = 68\u00b0F from appendix table C11\n",
"rou= 62.4 # density in Ibm/ft^3 \n",
"cp=0.9988 # specific heat BTU/(lbm-degree Rankine) \n",
"v= 1.083e-5 # viscosity in sq.ft/s \n",
@@ -143,10 +132,8 @@
"Pr = 7.02 # Prandtl Number\n",
"V=1.2 # velocity in ft/s\n",
"\n",
- "#Calculation\n",
"x1=1\n",
"Re1=(V*x1)/v # Reynolds Number at x=1 ft\n",
- "# since Reynolds Number is less than 5*10^5, the flow is laminar\n",
"hL1=0.664*Pr**(1/3.0)*Re1**0.5*kf/x1\n",
"Tw=100 # temperature of metal plate in degree fahrenheit\n",
"T_inf=40 # temperature of water in degree fahrenheit\n",
@@ -156,7 +143,6 @@
"print\"The heat transferred to water over the plate is\",round(q1,0),\"BTU/hr\"\n",
"x2=2\n",
"Re2=(V*x2)/v # Reynolds Number at x=1 ft\n",
- "# since Reynolds Number is less than 5*10^5, the flow is laminar\n",
"hL2=0.664*Pr**(1/3.0)*Re2**0.5*kf/x2\n",
"Tw=100 # temperature of metal plate in degree fahrenheit\n",
"T_inf=40 # temperature of water in degree fahrenheit\n",
@@ -164,7 +150,6 @@
"q2=hL2*A2*(Tw-T_inf)\n",
"print\"The heat transferred to water over the plate is \",round(q2,0),\"BTU/hr\"\n",
"\n",
- "#PLot for temprature distribution\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -177,7 +162,6 @@
"plt.ylim((0,0.004))\n",
"a1=plot(T,y)\n",
"\n",
- "#PLot for influence of prandtl no on boundary layer thickness\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -232,10 +216,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the average convection coefficient and the total drag force exerted on the plate.\n",
"\n",
- "#Given\n",
- "# properties of air at (300 + 400)/2 = 350 K from appendix table D1\n",
"rou=0.998\t # density in kg/cu.m\n",
"cp=1009 \t\t# specific heat in J/(kg*K) \n",
"v=20.76e-6 \t# viscosity in sq.m/s \n",
@@ -247,15 +228,12 @@
"b=0.5 \t\t# width in m\n",
"Re=V*L/v \t# Reynolds number at plate end\n",
"\n",
- "#calculation\n",
- "# Nu=h*L/k= 0.664 Re**(1/2)Pr**(1/3)\n",
"h=k*0.664*Re**(0.5)*Pr**(1/3.0)/L\t # The average convection coefficient in W/(sq.m.K)\n",
"Df=0.664*V*rou*v*b*(Re)**0.5 \t # drag force in N\n",
"hx=(1/2.0)*h # local convective coefficient\n",
"delta=5*L/(Re)**0.5 # The boundary-layer thickness at plate end\n",
"delta_t=delta/(Pr)**(1/3.0)\n",
"\n",
- "#Result\n",
"print\"The local convective coefficient is \",round(hx,2),\"W/(sq.m.K)\"\n",
"print\"The boundary-layer thickness at plate end is \",round(delta*100,2),\"cm\"\n",
"print\"The thermal-boundary-layer thickness is \",round(delta_t*100,2),\"cm\""
@@ -287,10 +265,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the maximum heater-surface temperature for given conditions\n",
"\n",
- "#Given\n",
- "# fluid properties at (300 degree R + 800 degree R)/2 = 550 degree R=540degree R from Appendix Table D.6\n",
"rou= 0.0812 # density in Ibm/ft^3 \n",
"cp=0.2918 # specific heat BTU/(lbm-degree Rankine) \n",
"v= 17.07e-5 # viscosity in ft^2/s \n",
@@ -298,16 +273,13 @@
"a = 0.8862 # diffusivity in ft^2/hr \n",
"Pr = 0.709 # Prandtl Number\n",
"\n",
- "#calculation\n",
"qw=10/(1.5*10.125)*(1/.2918)*144 # The wall flux \n",
"V_inf=20 # velocity in ft/s\n",
"L=1.5/12 # length in ft\n",
"Re_L=V_inf*10*L/v # Reynolds number at plate end\n",
- "# So the flow is laminar and we can find the wall temperature at plate end as follows\n",
"T_inf=300 # free stream temperature in degree Rankine\n",
"Tw=T_inf+(qw*L*10/(kf*0.453*(Re_L)**0.5*(Pr)**(1/3.0)))\n",
"\n",
- "#Result\n",
"print\"The maximum heater surface temperature is \",round(Tw,0),\"R\"\n"
],
"language": "python",
@@ -335,10 +307,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# validation of the equation st.(Pr)**(2/3)=Cd/2 where St: Stanton Number Pr:Prandtl Number Cd: Drag Coefficient\n",
"\n",
- "#Given\n",
- "# values of parameters from example 7.4\n",
"rou= 0.0812 # density in Ibm/ft**3 \n",
"cp=0.2918 # specific heat BTU/(lbm-degree Rankine) \n",
"v= 17.07e-5 # viscosity in ft**2/s \n",
@@ -350,14 +319,12 @@
"qw=324.0 # The wall flux in BTU/(hr.ft**2)\n",
"V_inf=20 # velocity in ft/s\n",
"\n",
- "#Calculation\n",
"hx=qw/(Tw-T_inf) # The convection coefficient\n",
"LHS=(hx/3600.0)*(Pr)**(2/3.0)/(rou*cp*V_inf)\n",
"Re_L=1.46e+005 # Reynolds number at plate end\n",
"RHS=0.332*(Re_L)**(-0.5)\n",
"err=(LHS-RHS)*100/LHS\n",
"\n",
- "#Result\n",
"print\"The convection coefficient is BTU/(hr.sq.ft.degree R)\",hx\n",
"print\"The error is \",round(err,0),\"percent\"\n",
"print\"Since the error is only 3 percent, the agreement is quite good\"\n"
@@ -389,10 +356,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of the drag due to skin friction\n",
"\n",
- "#Given\n",
- "# properties of water at 68\u00b0F from Appendix Table C.11\n",
"rou= 62.4 # density in Ibm/cu.ft\n",
"v= 1.083e-5 # viscosity in sq.ft/s \n",
"V_inf=5*.5144/.3048 # barge velocity in ft/s using conversion factors from appendix table A1\n",
@@ -402,10 +366,8 @@
"gc=32.2\n",
"b=12 # width in ft\n",
"\n",
- "#Calculation\n",
"Df=(Cd*rou*V_inf**2*b*L)/(2*gc)\n",
"\n",
- "#Result\n",
"print\"The drag force is \",round(Df,0),\"lbf\"\n"
],
"language": "python",
@@ -433,10 +395,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of wattage requirement\n",
"\n",
- "#Given\n",
- "# properties of carbon dioxide at a film temperature of (400+600)/2 = 500 K from appendix table D2\n",
"rou= 1.0732 # density in kg/m**3 \n",
"cp= 1013 # specific heat in J/(kg*K) \n",
"v= 21.67e-6 # viscosity in m**2/s \n",
@@ -452,8 +411,6 @@
"Tw=600 # temperature of heater surface in K\n",
"T_inf=400 # temperature of carbon dioxide in K\n",
"\n",
- "#calculation\n",
- "#Nux=0.664*Rex**(1/2)*Pr**(1/3)\n",
"y=0.664*Pr**(1/3.0)*k*(vel/v)**(1/2.0) #y=h1*x1**(1/2)\n",
"x1=0.04 # m\n",
"h1=y/x1**(0.5)\n",
@@ -474,24 +431,19 @@
"Q2=h4*x4*(b)*(Tw-T_inf) #Q=q1+q2+q3+q4\n",
"q4=Q2-Q1\n",
"\n",
- "#at the end of 5th heater\n",
"Re5=vel*5*x1/(v)\n",
"\n",
- "#Nux=10.0359*(Rex**(0.8)-830)*Pr**(1/3)\n",
"h5=0.0359*(Re5**(0.8)-830)*Pr**(1/3.0)*(k/(11.9*x1))\n",
"x5=0.2\n",
"Q3=h5*x5*(b)*(Tw-T_inf) #Q3=q1+q2+q3+q4+q5\n",
"q5=Q3-Q2\n",
"\n",
- "#at the end of 6th heater\n",
"Re6=vel*6*x1/(v)\n",
- "#Nux=10.0359*(Rex**(0.8)-830)*Pr**(1/3)\n",
"h6=0.0359*(Re5**(0.8)-830)*Pr**(1/3.0)*(k/(10.3*x1))\n",
"x6=0.24\n",
"Q4=h6*x6*(b)*(Tw-T_inf) #Q4=q1+q2+q3+q4+q5+q6\n",
"q6=round(Q4,0)-round(Q3,0)\n",
"\n",
- "#Result\n",
"print\"The wattage required for 1st heater is \",round(q1,0),\"W\"\n",
"print\"The wattage required for 2nd heater is \",round(q2,0),\"W\"\n",
"print\"The wattage required for 3rd heater is \",round(q3,1),\"W\"\n",
@@ -529,10 +481,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimation of force exerted on the pole\n",
"\n",
- "#Given\n",
- "# properties of air at given conditions from appendix table D1\n",
"rou= 0.0735 # density in Ibm/ft**3 \n",
"v= 16.88e-5 # viscosity in ft**2/s \n",
"V=20*5280/3600.0 # flow velocity in ft/s\n",
@@ -543,7 +492,6 @@
"Cd_cylinder=1.1 # value of Cd for smooth cylinder from figure 7.22\n",
"A_cylinder=D*L # frontal area of pole\n",
"\n",
- "#Calculation\n",
"Df_cylinder=Cd_cylinder*(0.5)*rou*V**2*A_cylinder/gc\n",
"D_square=2/12.0 # length of square part of pole\n",
"L_square=4\n",
@@ -579,10 +527,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of required current\n",
"\n",
- "#Given\n",
- "# properties of air at film temperature (300 + 500)/2 = 400 K from appendix table D1\n",
"rou= 0.883 # density in kg/cu.m\n",
"cp= 1014 # specific heat in J/(kg*K) \n",
"v= 25.90e-6 # viscosity in sq.m/s \n",
@@ -596,7 +541,6 @@
"C=0.911 #value of C for cylinder from table 7.4\n",
"m=0.385 #value of m for cylinder from table 7.4\n",
"\n",
- "#calculation\n",
"hc=kf*C*(Re_D)**m*(Pr)**(1/3)/D # the convection coefficient in W/(m**2.K)\n",
"Tw=500 # air stream temperature in K\n",
"T_inf=300 # wire surface temperature in K\n",
@@ -606,7 +550,6 @@
"Resistance=resistivity*(L/(math.pi*D**2)) # resistance in ohm\n",
"i=(qw*100/Resistance)**0.5 # current in ampere\n",
"\n",
- "#Result\n",
"print\"The current is %.1f A\",round(i,1),\"A\"\n"
],
"language": "python",
@@ -634,17 +577,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of the pressure drop for the air passing over the tubes and the heat transferred to the air.\n",
"\n",
- "#Given\n",
- "# properties of air at 70 + 460 = 530 degree R = 540 degree R from appendix table D1\n",
"rou= 0.0735 # density in Ibm/cu.ft \n",
"cp=0.240 # specific heat BTU/(lbm-degree Rankine) \n",
"v= 16.88e-5 # viscosity in sq.ft/s \n",
"kf = 0.01516 # thermal conductivity in BTU/(hr.ft.degree Rankine) \n",
"a = 0.859 # diffusivity in sq.ft/hr \n",
"Pr = 0.708 # Prandtl Number\n",
- "# specifications of 3/4 standard type K copper tubing from appendix table F2\n",
"OD=0.875/12 # outer diameter in ft\n",
"ID=0.06208 # inner diameter in ft\n",
"A=0.003027 # cross sectional area in sq.ft\n",
@@ -653,7 +592,6 @@
"sT=1.3/12\n",
"V_inf=12 # velocity of air in ft/s\n",
"\n",
- "#calculation\n",
"V1=(sT*V_inf)/(sT-OD) # velocity at area A1 in ft/s\n",
"sD=((sL)**2+(sT/2)**2)**0.5 # diagonal pitch in inch\n",
"V2=(sT*V_inf)/(2*(sD-OD))\n",
@@ -676,7 +614,6 @@
"T_inf=70 # air temperature in degree F\n",
"q=hc*As*(Tw-T_inf) # heat transferred\n",
"\n",
- "#result\n",
"print\"The pressure drop is \",round(dP/147,3),\"psi\"\n",
"print\"The heat transferred is\",round(q,1),\" BTU/hr\"\n"
],
diff --git a/Engineering_Heat_Transfer/CHAPTER8.ipynb b/Engineering_Heat_Transfer/CHAPTER8.ipynb
index a70f7944..759f39bd 100644
--- a/Engineering_Heat_Transfer/CHAPTER8.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER8.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the heat transferred to the wall.\n",
"\n",
- "#Given\n",
- "# air properties at (400+120)/2 =260 degree F = 720 degree R from Appendix Table D1\n",
"rou= 0.0551 # density in Ibm/cu.ft \n",
"cp=0.2420 # specific heat BTU/(lbm-degree Rankine) \n",
"v= 27.88e-5 # viscosity in sq.ft/s \n",
@@ -41,8 +38,6 @@
"Tw=400.0+460.0 # inside wall temperature in degree R\n",
"Beta=1/T_inf\n",
"\n",
- "#IN THE BOOK THERE IS CALCULATION MISTAKE IN Beta\n",
- "#Accoding to book Beta=0.00116 /R\n",
"Beta_=0.00116\n",
"gc=32.2\n",
"L=1.0 # length of wall in ft\n",
@@ -53,7 +48,6 @@
"A=L*W # cross sectional area in sq.ft\n",
"qw=hL*A*(Tw-T_inf)\n",
"\n",
- "#Result\n",
"print\"The heat transferred is\",round(qw,0),\"BTU/hr\"\n"
],
"language": "python",
@@ -81,10 +75,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of heat lost through the glass per unit area\n",
"\n",
- "#Given\n",
- "# properties of air at 0 + 273 K=273 K from appendix table D1\n",
"rou1=1.295 # density in kg/cu.m\n",
"cp1=1005.5 # specific heat in J/(kg*K) \n",
"v1=12.59e-6 # viscosity in sq.m/s \n",
@@ -94,7 +85,6 @@
"T_inf1=0 # inside and outside temperature in K\n",
"Beta1=1/(T_inf1+273.0) # volumetric thermal expansion coefficient at 295 K and 273 K\n",
"\n",
- "# properties of air at 22 + 273 = 295 K = 300 K(approx) \n",
"rou2=1.177 # density in kg/cu.m\n",
"cp2=1005 # specific heat in J/(kg*K) \n",
"v2=15.68e-6 # viscosity in sq.m/s \n",
@@ -108,7 +98,6 @@
"t=0.005 # thickness of glass\n",
"L=0.60 # window length in m\n",
"k=0.81 # thermal conductivity of glass from appendix table B3\n",
- "# for first guess\n",
"Tw1=18\n",
"Tw2=4\n",
"Ra1=(g*Beta1*(Tw2-T_inf1)*L**3)/(v1*a1)\n",
@@ -119,18 +108,15 @@
"Tw2_=T_inf2-(q1/hL2)\n",
"Tw1_=q1/hL1+T_inf1\n",
"\n",
- "#Using these temprature as second estimates\n",
"Ra1_=3.7*10**8\n",
"hL1_=2.92\n",
"Ra2_=2.31*10**8\n",
"hL2_=2.80\n",
"q2=(T_inf2-T_inf1)/((1/hL2_)+(t/k)+(1/hL1_))\n",
"\n",
- "#The wall temprature are\n",
"Tw2final=q2-T_inf2\n",
"Tw1final=10.7\n",
"\n",
- "#result\n",
"print\"The heat loss is \",round(q2,1),\" W/sq.m\"\n",
"\n",
"\n"
@@ -160,9 +146,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of heat loss through the side.\n",
"\n",
- "#Given\n",
"rou= 0.0735 # density in Ibm/cu.ft \n",
"cp=0.240 # specific heat BTU/(lbm-degree Rankine) \n",
"v= 16.88e-5 # viscosity in sq.ft/s \n",
@@ -179,7 +163,6 @@
"hc=(kf/L)*(0.825+((0.387*(Ra)**(1/6.0))/(1+(0.492/Pr)**(9/16.0))**(8/27.0)))**2\n",
"q=hc*L*W*(Tw-T_inf)\n",
"\n",
- "#Result\n",
"print\"The heat gained is %d BTU/hr\",round(q,0),\"BTU/hr\"\n"
],
"language": "python",
@@ -207,8 +190,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the variation of average convection coefficient with distance\n",
- "# properties of air at (65 + 20)/2 = 42.5 degree C =315 K. from appendix table D1\n",
"rou= 1123 # density in kg/m^3 \n",
"cp= 1006.7 # specific heat in J/(kg*K) \n",
"v= 17.204e-6 # vismath.cosity in m^2/s \n",
@@ -222,9 +203,7 @@
"Tw=65 # roof surface temperature in degree C\n",
"Beta=1/(T_inf+273.0) # volumetric thermal math.expansion coefficient in per K\n",
"\n",
- "#Calculation\n",
"import math\n",
- "# determination of Laminar-turbulent transition length by Vliet equation Ra=3x10^5xmath.exp(0.1368math.cos(90-theta))\n",
"x=((3e5*math.exp(0.1368*math.cos(90-theta))*v*a)/(g*math.cos(theta)*Beta*(Tw-T_inf)))**(1/3.0)\n",
"x=0.051\n",
"print\"The Laminar-turbulent transition length by Vliet equation is \",round(x,3),\"m\\n\\n\"\n",
@@ -290,10 +269,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine if heat is lost lose more heat through its upper surface or one of its vertical sides\n",
"\n",
- "#Given\n",
- "# properties of air at (100 + 60)/2 = 80\u00b0F = 540 degree R from appendix table D1\n",
"rou= 0.0735 # density in lbm/cu.ft\n",
"cp=0.240 # specific heat BTU/(lbm-degree Rankine) \n",
"v= 16.88e-5 # viscosity in sq.ft/s \n",
@@ -306,18 +282,15 @@
"L=2.0 # length in ft\n",
"W=2.0 # width in ft\n",
"\n",
- "#Calculation\n",
"Beta=1/(T_inf+460.0) # volumetric thermal expansion coefficient in per degree Rankine\n",
"Ra=(g*Beta*(Tw-T_inf)*L**3)/(v*a/3600.0)\n",
"hc=(kf/L)*(0.68+(0.670*Ra**(0.25))/(1+(0.492/Pr)**(9/16.0))**(4/9.0))\n",
"q1side=hc*L*W*(Tw-T_inf)\n",
- "# For the top, we have a heated surface facing upward, The characteristic length is determined as follows\n",
"Lc=0.5\n",
"Ra_L=(g*Beta*(Tw-T_inf)*Lc**3)/(v*a/3600.0) # Rayleigh number based on characteristic length\n",
"hc_L=(kf/Lc)*0.54*(Ra_L)**(1/4.0)\n",
"qtop=hc_L*L*W*(Tw-T_inf)\n",
"\n",
- "#Result\n",
"print\"The heat transferred from one side is \",round(q1side,1),\"BTU/hr\"\n",
"print\"The heat transferred from top is \",round(qtop,0),\"BTU/hr\"\n",
"\n",
@@ -355,10 +328,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of heat lost from the insulation by convection\n",
"\n",
- "#Given\n",
- "# properties of air at (50 + 5)/2 = 27.5 degree C = 300 K from appendix table D1\n",
"rou= 1.177 # density in kg/cu.m\n",
"cp= 1005.7 # specific heat in J/(kg*K) \n",
"v= 15.68e-6 # viscosity in sq.m/s \n",
@@ -371,20 +341,16 @@
"T_inf=5.0 # ambient air temperature in degree C\n",
"Tw=50.0 # outside surface temperature in degree C\n",
"\n",
- "#Calculation\n",
"import math\n",
"Beta=1/(T_inf+273.0) # volumetric thermal expansion coefficient in per K\n",
"Ra=(g*Beta*(Tw-T_inf)*D**3)/(v*a)\n",
- "# for horizontal pipe, the convective coefficient is determined as follows\n",
"hc_h=(kf/D)*(0.60+(0.387*Ra**(1/6.0))/(1+(0.559/Pr)**(9/16.0))**(8/27.0))**2\n",
"As=math.pi*D*L\n",
"q_hor=hc_h*As*(Tw-T_inf)\n",
- "# for vertical pipe, the convective coefficient is determined as follows\n",
"hc_v=(kf/D)*0.6*(Ra*(D/L))**(1/4.0)\n",
"q_ver=hc_v*As*(Tw-T_inf)\n",
"q=round(q_ver,0)+round(q_hor,0)\n",
"\n",
- "#Result\n",
"print\"The heat transferred from the horizontal length of 4 m is \",round(q_hor,0),\"W\"\n",
"print\"The heat transferred from the vertical length of 4 m is \",round(q_ver,0),\"W\"\n",
"print\"nThe total heat lost from the pipe is \",round(q,2),\"W\"\n"
@@ -416,10 +382,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determinion of the convection coefficient about the ice cube\n",
"\n",
- "#Given\n",
- "# properties of air at (0 + 70)/2 = 35\u00b0F == 495 degree R from appendix table D1\n",
"rou= 0.0809 # density in lbm/cu.ft \n",
"cp=0.240 # specific heat BTU/(lbm-degree Rankine) \n",
"v= 13.54e-5 # viscosity in sq.ft/s \n",
@@ -430,12 +393,10 @@
"T_inf=70.0 # ambient temperature in degree F\n",
"g=32.2\n",
"Beta=1/(T_inf+460.0) # volumetric thermal expansion coefficient in per degree Rankine\n",
- "# The characteristic length is found by using King Equation\n",
"Lc=1/((1/1)+(1/1.2))\n",
"Ra=(g*Beta*abs(Tw-T_inf)*Lc**3)/(v*a/3600.0)\n",
"hc=(kf/Lc)*0.6*(Ra)**(1/4.0)\n",
"\n",
- "#Result\n",
"print\"The value of convection coefficient is \",round(hc,2),\"BTU/(hr.sq.ft.degree R)\"\n"
],
"language": "python",
@@ -463,10 +424,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of the maximum amount of heat that fins can transfer\n",
"\n",
- "#Given\n",
- "# properties of air at (100 + 35)/2 = 67.5 degree C from appendix table D1\n",
"rou= 0.998 # density in kg/cu.m\n",
"cp= 1009.0 # specific heat in J/(kg*K) \n",
"v= 20.76e-6 # viscosity in sq.m/s \n",
@@ -477,7 +435,6 @@
"T_inf=35 # ambient air temperature in degree C\n",
"Tw=100 # surface temperature in degree C\n",
"Beta=1/(T_inf+273.0) # volumetric thermal expansion coefficient in per K\n",
- "# properties of aluminium from appendix table B1\n",
"rou_Al=2702 # density in kg/cu.m\n",
"k_Al=236 # thermal conductivity in W/(m.K)\n",
"cp_Al=896 # specific heat in J/(kg*K) \n",
@@ -485,15 +442,12 @@
"b=46/100.0\n",
"w=24/100.0\n",
"\n",
- "#Calculation\n",
- "# Applying the Bar-Cohen Equations\n",
"zeta=((w*v**2)/(g*Beta*(Tw-T_inf)*Pr))**(1/4.0)\n",
"L=1.54*(k_Al/kf)**(1/2)*zeta\n",
"S=2.89*zeta\n",
"q=(b*w*(Tw-T_inf)*1.3*(k_Al*kf)**(1/2.0))/(6*zeta)\n",
"N=b/(2*S)\n",
"\n",
- "#result\n",
"print\"The heat transfer rate is \",round(q,0),\"W\"\n",
"print\"The number of fins can be atmost\",round(N,0)\n",
"\n"
diff --git a/Engineering_Heat_Transfer/CHAPTER9.ipynb b/Engineering_Heat_Transfer/CHAPTER9.ipynb
index c1ada237..d66004ef 100644
--- a/Engineering_Heat_Transfer/CHAPTER9.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER9.ipynb
@@ -27,24 +27,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determination of counterflow and parallel-flow configurations. \n",
"\n",
- "#Given\n",
- "# temperatures of hot fluid in degree C\n",
"T1=100.0 \n",
"T2=75.0\n",
- "# temperatures of cold fluid in degree C\n",
"t1=5.0\n",
"t2=50.0\n",
"\n",
- "#Calculation\n",
- "# for counterflow\n",
"import math\n",
"LMTD_counter=((T1-t2)-(T2-t1))/(math.log((T1-t2)/(T2-t1)))\n",
- "# for parallel flow\n",
"LMTD_parallel=((T1-t1)-(T2-t2))/(math.log((T1-t1)/(T2-t2)))\n",
"\n",
- "#Result\n",
"print\"The LMTD for counter flow configuration is \",round(LMTD_counter,1),\"C\"\n",
"print\"The LMTD for parallel flow configuration is \",round(LMTD_parallel,2),\"C\""
],
@@ -74,24 +66,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the LMTD for both counterflow and parallel-flow configurations. \n",
"\n",
- "#Given\n",
- "# temperatures of hot fluid in degree F\n",
"T1=250\n",
"T2=150\n",
- "# temperatures of cold fluid in degree F\n",
"t1=100\n",
"t2=150\n",
"\n",
- "#calculation\n",
- "# for counterflow\n",
"import math\n",
"LMTD_counter=((T1-t2)-(T2-t1))/(math.log((T1-t2)/(T2-t1)));\n",
- "# for parallel flow\n",
"LMTD_parrelel=0\n",
"\n",
- "#Result\n",
"print\"The LMTD for counter flow configuration is\",round(LMTD_counter,1),\"C\"\n",
"print\"if parallel flow is to give equal outlet temperatures,then the area needed must be infinite which is not feasible economically.\"\n",
"print\"The LMTD for parrelel flow configuration is\",LMTD_parrelel,\"C\"\n"
@@ -123,10 +107,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the outlet temperature of the ethylene glycol for counterflow.\n",
"\n",
- "#Given\n",
- "# properties of air at (195 + 85)/2 = 140\u00b0F. from appendix table CII\n",
"rou_1= 0.985*62.4 # density in lbm/ft**3 \n",
"cp_1=0.9994 # specific heat BTU/(lbm-degree Rankine) \n",
"v_1= 0.514e-5 # viscosity in ft**2/s \n",
@@ -135,7 +116,6 @@
"Pr_1 = 3.02 # Prandtl Number \n",
"m_1=5000 # mass flow rate in lbm/hr\n",
"T_1=195 # temperature in degree F\n",
- "# properties of ethylene glycol at 140 degree F from Appendix Table C.5\n",
"rou_2= 1.087*62.4 # density in lbm/ft**3 \n",
"cp_2=0.612 # specific heat BTU/(lbm-degree Rankine) \n",
"v_2= 5.11e-5 # viscosity in ft**2/s \n",
@@ -144,32 +124,25 @@
"Pr_2 = 51 # Prandtl Number \n",
"m_2=12000 # mass flow rate in lbm/hr\n",
"T_2=85 # temperature in degree F\n",
- "# specifications of seamless copper water tubing (subscripts: a = annulus, p = inner pipe or tube) from appendix table F2\n",
"ID_a=0.1674\n",
"ID_p=0.1076\n",
"OD_p=1.375/12\n",
- "# Flow Areas\n",
"A_p=math.pi*ID_p**2/4\n",
"A_a=math.pi*((ID_a)**2-(OD_p)**2)/4\n",
"\n",
- "# Annulus Equivalent Diameters\n",
"D_h=ID_a-OD_p\n",
"D_e=(ID_a**2-OD_p**2)/(OD_p)\n",
"\n",
- "# Reynolds Numbers \n",
"Re_1=(m_1/3600.0)*(ID_p)/(v_1*rou_1*A_p)\n",
"Re_2=(m_2/3600.0)*(D_e)/(v_2*rou_2*A_a)\n",
"\n",
- "# Nusselt numbers\n",
"Nu_1=0.023*(Re_1)**(4/5.0)*(Pr_1)**0.3\n",
"Nu_2=0.023*(Re_2)**(4/5.0)*(Pr_2)**0.4\n",
"\n",
- "# Convection Coefficients \n",
"h_1i=Nu_1*kf_1/ID_p\n",
"h_1o=h_1i*ID_p/OD_p\n",
"h_2=Nu_2*kf_2/D_e\n",
"\n",
- "# Exchanger Coefficient \n",
"Uo=1/((1/h_1o)+(1/h_2))\n",
"R=(m_2*cp_2)/(m_1*cp_1)\n",
"L=20\n",
@@ -205,11 +178,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of (a) no. of exchangers required, (b) the overall coefficient of (all) the exchanger(s), and (c) the pressure drop for each stream. \n",
"\n",
- "#Given\n",
- "# assuming counterflow arrangement\n",
- "# properties of air at 323 K. from appendix table D1\n",
"rou_1= 1.088 \t\t# density in kg/m**3 \n",
"cp_1= 1007\t\t # specific heat in J/(kg*K) \n",
"v_1= 18.2e-6\t\t # viscosity in m**2/s \n",
@@ -217,10 +186,8 @@
"kf_1= 0.02814 \t\t# thermal conductivity in W/(m.K)\n",
"a_1 = 0.26e-4 \t\t# diffusivity in m**2/s \n",
"m_1=100 \t\t # mass flow rate in kg/hr\n",
- "# temperatures in K\n",
"t1_air=20+273 \n",
"t2_air=80+273\n",
- "# properties of carbon dioxide at [600 + (20 + 273)]/2 = 480 = 500 K. from appendix table D2\n",
"rou_2= 1.0732\t\t # density in kg/m**3 \n",
"cp_2= 1013 \t\t# specific heat in J/(kg*K) \n",
"v_2= 21.67e-6 \t #viscosity in m**2/s \n",
@@ -228,71 +195,53 @@
"kf_2= 0.03352 \t\t# thermal conductivity in W/(m.K)\n",
"a_2 = 0.3084e-4 \t\t# diffusivity in m**2/s \n",
"m_2=90\t\t\t # mass flow rate in kg/hr\n",
- "# temperatures in K\n",
"T1_CO2=600 \n",
- "# specifications of seamless copper tubing from appendix table F2\n",
"ID_a=.098\n",
"ID_p=.07384\n",
"OD_p=.07938\n",
"\n",
- "#calculation\n",
"import math\n",
- "# Flow Areas\n",
"A_p=math.pi*ID_p**(2)/4.0\n",
"A_a=math.pi*((ID_a)**2-(OD_p)**2)/4.0\n",
"\n",
- "# Heat Balance \n",
"q_air=(m_1/3600.0)*(cp_1)*(t2_air-t1_air)\n",
"T2_CO2=T1_CO2-(q_air/(m_2*cp_2/3600.0))\n",
"\n",
- "# Log-Mean Temperature Difference\n",
"LMTD_counter=((T1_CO2-t2_air)-(T2_CO2-t1_air))/(log((T1_CO2-t2_air)/(T2_CO2-t1_air)))\n",
- "# Annulus Equivalent Diameters\n",
"D_h=ID_a-OD_p\n",
"D_e=(ID_a**2-OD_p**2)/(OD_p)\n",
"\n",
- "# Reynolds Numbers \n",
"Re_1=(m_1/3600.0)*(ID_p)/(v_1*rou_1*A_p)\n",
"Re_2=(m_2/3600.0)*(D_e)/(v_2*rou_2*A_a)\n",
"\n",
- "# Nusselt numbers\n",
"Nu_1=0.023*(Re_1)**(0.8)*(Pr_1)**0.3\n",
"Nu_2=0.023*(Re_2)**(0.8)*(Pr_2)**0.4\n",
"\n",
- "# Convection Coefficients \n",
"\n",
"h_1i=Nu_1*kf_1/ID_p\n",
"h_1o=h_1i*ID_p/OD_p\n",
"h_2=Nu_2*kf_2/D_e\n",
"\n",
- "# Fouling Factors in (m**2.K)/W\n",
"Rd_air=0.0004\n",
"Rd_CO2=0.002\n",
"\n",
- "# exchanger coefficients\n",
"Uo=1/((1/h_1o)+(1/h_2))\n",
"Uo=1/((1/Uo)+Rd_air+Rd_CO2)\n",
"\n",
- "# area required\n",
"A=q_air/(Uo*LMTD_counter)\n",
"\n",
- "# surface area of one exchanger is A=math.pi*OD*L, so\n",
"L=(A/(math.pi*OD_p)) # length of each exchanger\n",
"L_available=2 # available exchanger length\n",
"N=L_available/L # no. of exchangers\n",
"\n",
- "#friction factors\n",
"fp=0.0245 #friction factor for air fom figure 6.14 corresponding to Re\n",
"fa=0.033 #friction factor for cCO2fom figure 6.14 corresponding to Re\n",
- "# Velocities\n",
"V_air=(m_1/3600.0)/(rou_1*A_p)\n",
"V_CO2=(m_2/3600.0)/(rou_2*A_a)\n",
"\n",
- "# pressure drops\n",
"dP_p=(fp*L_available*rou_1*V_air**2)/(ID_p*2)\n",
"dP_a=((rou_2*V_CO2**2)/2.0)*((fa*L_available/D_h)+1)\n",
"\n",
- "#Result\n",
"print\"(a)The number of exchangers is \",round(N,0)\n",
"print\"(b)The overall exchanger coefficient is \",round(Uo,1),\" W/(sq.m.K)\"\n",
"print\"(c)The pressure drop for tube side is \",round(dP_p,2),\"Pa\"\n",
@@ -326,10 +275,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the outlet temperature of the distilled water and the pressure drop for each stream. \n",
"\n",
- "#Given\n",
- "# properties of (distilled) water at 104\u00b0F from appendix table CII\n",
"rou_1= 0.994*62.4 # density in lbm/ft**3 \n",
"cp_1=0.998 # specific heat BTU/(lbm-degree Rankine) \n",
"v_1= 0.708e-5 # viscosity in ft**2/s \n",
@@ -338,7 +284,6 @@
"Pr_1 = 4.34 # Prandtl Number \n",
"m_1=170000 # mass flow rate in lbm/hr\n",
"T1=110.0 # temperature in degree F\n",
- "# properties of (raw) water at 68\u00b0F from Appendix Table C11\n",
"rou_2= 62.4 # density in lbm/ft**3 \n",
"cp_2=0.9988 # specific heat BTU/(lbm-degree Rankine) \n",
"v_2= 1.083e-5 # viscosity in ft**2/s \n",
@@ -347,40 +292,32 @@
"Pr_2 = 7.02 # Prandtl Number \n",
"m_2=150000 # mass flow rate in lbm/hr\n",
"t1=65 # temperature in degree F\n",
- "# specifications of 3/4-in-OD, 18-BWG tubes, from table 9.2\n",
"OD=3/(4*12.0)\n",
"ID=0.652/12.0\n",
"OD_p=1.375/12.0\n",
"Nt=224.0 # from table 9.3\n",
"Np=2 # no. of tube passes\n",
- "# Shell dimensions and other miscellaneous data\n",
"Ds=17.25/12.0\n",
"Nb=15.0 # no. of baffles\n",
"B=1\n",
"sT=15/(16*12.0)\n",
"C=sT-OD\n",
"\n",
- "#CALCULATION\n",
"import math\n",
- "# flow areas\n",
"At=(Nt*math.pi*ID**2)/(4*Np)\n",
"As=(Ds*C*B)/sT\n",
"\n",
- "# Shell Equivalent Diameter \n",
"De=4*((sT/2.0)*(0.86*sT)-(math.pi*OD**2/8.0))/(math.pi*OD/2.0)\n",
"\n",
- "# Reynolds Numbers \n",
"Re_s=(m_1/3600.0)*(De)/(v_1*rou_1*As)\n",
"Re_t=(m_2/3600.0)*(ID)/(v_2*rou_2*At)\n",
"\n",
- "# Nusselt numbers\n",
"Nu_t=0.023*(Re_t)**(0.8)*(Pr_2)**0.4\n",
"Nu_s=0.36*(Re_s)**(0.55)*(Pr_1)**(1/3.0)\n",
"h_ti=Nu_t*kf_2/ID\n",
"h_to=h_ti*ID/OD\n",
"h_s=Nu_s*kf_1/De\n",
"\n",
- "# Exchanger Coefficient \n",
"Uo=1/((1/h_to)+(1/h_s))\n",
"R=(m_2*cp_2)/(m_1*cp_1)\n",
"L=16\n",
@@ -389,20 +326,16 @@
"S=0.58 #value of S from fig. 9.13 Ten Broeck graph corresponding to the value of (UoAo)/(McCpc)\n",
"t2=S*(T1-t1)+t1\n",
"T2=T1-R*(t2-t1)\n",
- "#friction factors\n",
"ft=0.029 #friction factor for raw water fom figure 6.14 corresponding to Reynolds Number calculated above\n",
"fs=0.281 #friction factor for distilled water fom figure 6.14 corresponding to Reynolds Number calculated above\n",
"\n",
- "# Velocities\n",
"V_t=(m_2/3600.0)/(rou_2*At)\n",
"V_s=(m_1/3600.0)/(rou_1*As)\n",
"\n",
- "# pressure drops\n",
"gc=32.2\n",
"dP_t=(rou_2*V_t**2)*((ft*L*Np/ID)+4*Np)/(2*gc)\n",
"dP_s=((rou_1*V_s**2)*(fs*Ds*(Nb+1)))/(2*gc*De)\n",
"\n",
- "#Result\n",
"print\"Outlet Temperatures of raw water is \",round(t2,1),\"F\"\n",
"print\"Outlet Temperatures of distilled water is \",round(T2,1),\"F\"\n",
"print\"\\nThe pressure drop for tube side is\",round(dP_t/147,1),\"psi\"\n",
@@ -424,26 +357,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Using the effectiveness-NTU method to calculate the outlet temperatures of the fluids\n",
"\n",
- "#Given\n",
- "# Data from Example 9.5\n",
- "# properties of (distilled) water at 104\u00b0F \n",
"m_1=170000 \t\t# mass flow rate in lbm/hr\n",
"T1=110 \t\t\t# temperature in degree F\n",
"cp_1=0.998\t\t # specific heat BTU/(lbm-degree Rankine) \n",
- "# properties of (raw) water at 68\u00b0F \n",
"m_2=150000 \t\t# mass flow rate in lbm/hr\n",
"t1=65 \t\t\t# temperature in degree F\n",
"cp_2=0.9988\t # specific heat BTU/(lbm-degree Rankine) \n",
"Uo=350 \t\t\t# exchanger coefficient\n",
"Ao=703.7\n",
- "# The effectiveness-NTU approach is used when the overall heat transfer coefficient is known\n",
- "# determining the capacitances\n",
"mcp_raw=m_2*cp_2\n",
"mcp_distilled=m_1*cp_1\n",
"\n",
- "# determination of parameters for determining effectiveness\n",
"mcp_min_max=mcp_raw/mcp_distilled\n",
"UA_mcpmin=(Uo*Ao)/(mcp_raw)\n",
"effectiveness=0.58 \t\t#value of effectiveness from figure 9.15 corresponding to the above calculated values of capacitance ratio and (UoAo/mcp_min)\n",
@@ -452,7 +377,6 @@
"t2=(q/mcp_raw)+t1\n",
"T2=T1-(q/mcp_distilled)\n",
"\n",
- "#Result\n",
"print\"The Outlet temperature is Raw Water is\",round(t2,1),\"F\"\n",
"print\"The Outlet temperature is disilled Water is\",round(T2,1),\"F\"\n"
],
@@ -482,8 +406,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) Determine the UA product for the exchanger. (b) Calculate the exit temperatures for the exchanger, assuming that only the inlet temperatures are known\n",
- "# properties of engine oil at (190 + 158)/2 = 174\u00b0F = 176 degree F from appendix table C4\n",
"rou_1= 0.852*62.4\t\t # density in lbm/ft**3 \n",
"cp_1=0.509\t\t # specific heat BTU/(lbm-degree Rankine) \n",
"v_1=0.404e-3 \t\t# viscosity in ft**2/s \n",
@@ -491,10 +413,8 @@
"a_1=2.98e-3 \t# diffusivity in ft**2/hr \n",
"Pr_1=490.0 \t\t# Prandtl Number \n",
"m_1=39.8 \t\t # mass flow rate in lbm/min\n",
- "# temperatures in degree F\n",
"T1=190.0\n",
"T2=158.0\n",
- "# properties of air at (126 + 166)/2 = 146\u00b0F = 606 degree R from appendix table D1\n",
"rou_2= 0.0653\t\t # density in lbm/ft**3 \n",
"cp_2=0.241\t\t # specific heat BTU/(lbm-degree Rankine) \n",
"v_2= 20.98e-5 \t\t# viscosity in ft**2/s \n",
@@ -502,38 +422,29 @@
"a_2 = 1.066 \t\t# diffusivity in ft**2/hr \n",
"Pr_2 = 0.706 \t\t# Prandtl Number \n",
"m_2=67.0 \t\t\t# mass flow rate in lbm/min\n",
- "# temperatures in degree F\n",
"t1=126.0\n",
"t2=166.0\n",
- "# Heat Balance\n",
"q_air=m_2*cp_2*60*(t2-t1)\n",
"q_oil=m_1*cp_1*60*(T1-T2)\n",
"\n",
- "# for counterflow\n",
"import math\n",
"LMTD=((T1-t2)-(T2-t1))/(math.log((T1-t2)/(T2-t1)))\n",
- "# Frontal Areas for Each Fluid Stream\n",
"Area_air=(9.82*8)/144.0\n",
"Area_oil=(3.25*9.82)/144.0\n",
"\n",
- "# Correction Factors (parameters calculated first)\n",
"S=(t2-t1)/(T1-t1)\n",
"R=(T1-T2)/(t2-t1)\n",
"F=0.87 #value of correction factor from figure 9.21a corresponding to above calculated values of S and R\n",
- "# Overall Coefficient (q = U*A*F*LMTD)\n",
"UA=q_air/(F*LMTD)\n",
- "# determining the capacitances\n",
"mcp_air=m_2*cp_2*60\n",
"mcp_oil=m_1*cp_1*60\n",
"\n",
- "# determination of parameters for determining effectiveness\n",
"mcp_min_max=mcp_air/mcp_oil\n",
"NTU=(UA/mcp_air)\n",
"effectiveness=0.62 \t\t#effectiveness from fig 9.21b corresponding to the values of capacitance ratio \n",
"t2_c=(T1-t1)*effectiveness+t1\n",
"T2_c=T1-(mcp_air)*(t2_c-t1)/(mcp_oil)\n",
"\n",
- "#Result\n",
"print\"The Overall Coefficient is \",round(UA,0),\" BTU/(hr. degree R)\"\n",
"print\"Calculated outlet temprature are:\"\n",
"print\"Outlet temprature for air\",round(t2_c,1),\"F\"\n",
diff --git a/Engineering_Heat_Transfer/CHAPTER_3.ipynb b/Engineering_Heat_Transfer/CHAPTER_3.ipynb
index 93f29ad1..98a7ff3d 100644
--- a/Engineering_Heat_Transfer/CHAPTER_3.ipynb
+++ b/Engineering_Heat_Transfer/CHAPTER_3.ipynb
@@ -27,12 +27,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the heat-flow rate from one tube \n",
- "# specifications of 1 standard type K from table F2\n",
"\n",
- "#iven\n",
"OD=0.02858 # outer diameter in m\n",
- "# from figure 3.11\n",
"M=8.0 # total number of heat-flow lanes\n",
"N=6.0 # number of squares per lane\n",
"S_L=M/N # conduction shape factor\n",
@@ -40,11 +36,9 @@
"T1=85 # temperature of tube surface\n",
"T2=0 # temperature of ground beneath the slab\n",
"\n",
- "#Calculation\n",
"q_half=k*S_L*(T1-T2)\n",
"q=2*q_half\n",
"\n",
- "#Result\n",
"print\"The total heat flow per tube is\",round(q,0),\" W/m\"\n"
],
"language": "python",
@@ -72,11 +66,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the heat transferred from the buried pipe per unit length\n",
- "# shape factor number 8 is selected from table 3.1\n",
- "# specifications of 10 nominal, schedule 80 pipe from table F1\n",
"\n",
- "#Given\n",
"import math\n",
"OD=10.74/12 # diameter in ft\n",
"R=OD/2\n",
@@ -113,34 +103,25 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the heat lost through the walls, using the shape-factor method. \n",
- "#(b) Repeat the calculations but neglect the effects of the corners that is, . \n",
"\n",
- "#Given\n",
"k = 1.07 # thermal conductivity of silica brick from appendix table B3 in W/(m.K)\n",
"S1_A=0.138*0.138/0.006\n",
"nA=2\n",
"\n",
- "# Calculation of total shape factor\n",
- "# From figure 3.12, for component A\n",
"St_A=nA*S1_A # Total shape factor of component A\n",
"\n",
- "# For component B\n",
"S1_B=0.138*0.188/0.006\n",
"nB=4\n",
"St_B=nB*S1_B # Total shape factor of component B\n",
"\n",
- "# For component C\n",
"S3_C=0.15*0.006\n",
"nC=8\n",
"St_C=nC*S3_C # Total shape factor of component C\n",
"\n",
- "# For component D\n",
"S2_D=0.54*0.188\n",
"nD=4\n",
"St_D=nD*S2_D # Total shape factor of component D\n",
"\n",
- "# For component E\n",
"S2_E=0.138*0.54\n",
"nE=8\n",
"St_E=nE*S2_E # Total shape factor of component E\n",
@@ -153,9 +134,7 @@
"q_1=k*S*(T1-T2)\n",
"Error=(q-q_1)/q\n",
"\n",
- "#result\n",
"print\"(a)The heat transferred through the walls of the furnace is \",round(q/1000,1),\"kw\"\n",
- "# Neglecting the effects of the edges and corners, the shape factor for all walls is found as \n",
"print\"(b The heat transferred is\",q_1/1000,1,\"kw\"\n",
"print\" The error introduced by neglecting heat flow through the edges and corners is \",round(Error*100,1),\" percent\"\n"
],
@@ -186,26 +165,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determination of the conduction shape factor for the underground portion of the configuration\n",
- "# specifications of 4 nominal, schedule 40 pipe from table F1\n",
"\n",
- "#Given\n",
"OD=4.5/12.0 # diameter in ft\n",
"R=OD/2.0\n",
"\n",
- "# For pipe A\n",
- "#calculation\n",
"import math\n",
"L_A=4.5 # length in ft\n",
- "# shape factor number 9 is selected from table 3.1\n",
"S_A=(2*math.pi*L_A)/(math.log(2*(L_A)/R))\n",
- "# For pipe B\n",
"L_B=18 # length in ft\n",
- "# shape factor number 9 is selected from table 3.1\n",
"S_B=(2*math.pi*L_B)/(math.acosh(L_A/R))\n",
"S=2*S_A+S_B\n",
"\n",
- "#Result\n",
"print\"The total conduction shape factor for the system is\",round(S,1)\n"
],
"language": "python",
@@ -243,18 +213,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#(a)plot graph the temperature distribution existing within the rod. \n",
- "#(b) Use the numerical formulation of this section to obtain the temperature distribution.\n",
- "#(c) Compare the two models to determine how well the numerical results approximate the exact results\n",
"\n",
- "#Given\n",
"h=1.1 # convective coefficient in BTU/(hr.ft^2. degree R)\n",
"Tw=200.0\n",
"T_inf=68.0 # ambient temperature\n",
"k=0.47 # thermal conductivity in BTU/(hr.ft.degree R) from table B3\n",
"D=0.25/12 # diameter in ft\n",
"\n",
- "#Calculation\n",
"A=math.pi*D**(2)/4.0 # cross sectional area in ft^2\n",
"P=math.pi*D # perimeter in ft\n",
"L=6/12.0 # length in ft\n",
@@ -264,19 +229,16 @@
"de=dz/L\n",
"K=2+(mL*de)**2\n",
"\n",
- "#Tempature can be calculated as\n",
"T4=T_inf+(Tw-T_inf)*(2/(K**4-4*K**2+2))\n",
"T3=T_inf+(Tw-T_inf)*(K/(K**4-4*K**2+2))\n",
"T2=T_inf+(Tw-T_inf)*((K**2-1)/(K**4-4*K**2+2))\n",
"T1=T_inf+(Tw-T_inf)*((K**3-3*K)/(K**4-4*K**2+2))\n",
"\n",
- "#result\n",
"print\"The temprature distribution is T4=\",round(T4,2),\"F\"\n",
"print\"The temprature distribution is T3=\",round(T3,2),\"F\"\n",
"print\"The temprature distribution is T2=\",round(T2,2),\"F\"\n",
"print\"The temprature distribution is T1=\",round(T1,2),\"F\"\n",
"\n",
- "#(b)plot\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"T=[200.0,77.33,68.66,68.05,68]\n",
diff --git a/Engineering_Physics/Chapter10_1.ipynb b/Engineering_Physics/Chapter10_1.ipynb
index b31ad5ec..b2bd25cb 100644
--- a/Engineering_Physics/Chapter10_1.ipynb
+++ b/Engineering_Physics/Chapter10_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter10"
+ "name": "",
+ "signature": "sha256:4b61028c3be5c168cde4c3aa75ae23500168dbc119942b73de7c79e4a037fd53"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,52 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "10: Statistical Mechanics"
+ "source": [
+ "10: Statistical Mechanics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.1, Page number 222"
+ "source": [
+ "Example number 10.1, Page number 222"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ratio of occupancy of the excited to the ground state\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nk = 1.38*10**-23; #Boltzmann constant(J/K)\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\ng1 = 2; #The degeneracy of ground state\ng2 = 8; #The degeneracy of excited state\ndelta_E = 10.2; #Energy of excited state above the ground state(eV)\nT = 6000; #Temperature of the state(K)\n\n#Calculation\nD_ratio = g2/g1; #Ratio of degeneracy of states\nx = k*T/e;\nN_ratio = D_ratio*math.exp(-delta_E/x); #Ratio of occupancy of the excited to the ground state\n\n#Result\nprint \"The ratio of occupancy of the excited to the ground state is\",N_ratio",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "g1 = 2; #The degeneracy of ground state\n",
+ "g2 = 8; #The degeneracy of excited state\n",
+ "delta_E = 10.2; #Energy of excited state above the ground state(eV)\n",
+ "T = 6000; #Temperature of the state(K)\n",
+ "\n",
+ "#Calculation\n",
+ "D_ratio = g2/g1; #Ratio of degeneracy of states\n",
+ "x = k*T/e;\n",
+ "N_ratio = D_ratio*math.exp(-delta_E/x); #Ratio of occupancy of the excited to the ground state\n",
+ "\n",
+ "#Result\n",
+ "print \"The ratio of occupancy of the excited to the ground state is\",N_ratio"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The ratio of occupancy of the excited to the ground state is 1.10167326887e-08\n"
+ "text": [
+ "The ratio of occupancy of the excited to the ground state is 1.10167326887e-08\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +66,30 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.2, Page number 222"
+ "source": [
+ "Example number 10.2, Page number 222"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ground state energy of 10 non-interacting bosons\n\n#Calculation\n#an energy level can accomodate any number of bosons. Hence 10 bosons will be in n=1 state\n#energy is given by E1 = (pi**2*h**2)/(2*m*a**2)\na = 10/2;\n#enegy of 10 bosons is E = (10*pi**2*h**2)/(2*m*a**2) = (5*pi**2*h**2)/(m*a**2)\n\n#Result\nprint \"enegy of 10 bosons is E = \",int(a),\"(pi**2*h**2)/(m*a**2)\"",
+ "input": [
+ "\n",
+ "a = 10/2;\n",
+ "#enegy of 10 bosons is E = (10*pi**2*h**2)/(2*m*a**2) = (5*pi**2*h**2)/(m*a**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"enegy of 10 bosons is E = \",int(a),\"(pi**2*h**2)/(m*a**2)\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "enegy of 10 bosons is E = 5 (pi**2*h**2)/(m*a**2)\n"
+ "text": [
+ "enegy of 10 bosons is E = 5 (pi**2*h**2)/(m*a**2)\n"
+ ]
}
],
"prompt_number": 5
@@ -59,19 +98,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.3, Page number 223"
+ "source": [
+ "Example number 10.3, Page number 223"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ground state energy of the system\n\n#importing modules\nimport math\n\n#Variable declaration\nn1=1; #1st level\nn2=2; #2nd level\nn3=3; #3rd level\nn4=4; #4th level\nn5=5; #5th level\n\n#Calculation\n#an energy level can accomodate only 2 fermions. hence there will be 2 fermions in each level\n#thus total ground state energy will be E = (2*E1)+(2*E2)+(2*E3)+(2*E4)+E5\n#let X = ((pi**2)*(h**2)/(2*m*a**2)). E = X*((2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2))\nA = (2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2);\n#thus E = A*X\n\n#Result\nprint \"the ground state energy of the system is\",A,\"(pi**2)*(h**2)/(2*m*a**2)\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1; #1st level\n",
+ "n2=2; #2nd level\n",
+ "n3=3; #3rd level\n",
+ "n4=4; #4th level\n",
+ "n5=5; #5th level\n",
+ "\n",
+ "#Calculation\n",
+ "#an energy level can accomodate only 2 fermions. hence there will be 2 fermions in each level\n",
+ "#thus total ground state energy will be E = (2*E1)+(2*E2)+(2*E3)+(2*E4)+E5\n",
+ "#let X = ((pi**2)*(h**2)/(2*m*a**2)). E = X*((2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2))\n",
+ "A = (2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2);\n",
+ "#thus E = A*X\n",
+ "\n",
+ "#Result\n",
+ "print \"the ground state energy of the system is\",A,\"(pi**2)*(h**2)/(2*m*a**2)\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "the ground state energy of the system is 85 (pi**2)*(h**2)/(2*m*a**2)\n"
+ "text": [
+ "the ground state energy of the system is 85 (pi**2)*(h**2)/(2*m*a**2)\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +144,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.4, Page number 223"
+ "source": [
+ "Example number 10.4, Page number 223"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number density of conduction electrons and Fermi energy of silver\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nN_A = 6.02*10**23; #Avogadro's number\nh = 6.626*10**-34; #Planck's constant(Js)\nme = 9.1*10**-31; #Mass of electron(kg)\nrho = 10.5; #Density of silver(g/cm)\nm = 108; #Molecular mass of silver(g/mol)\n\n#Calculation\nN_D = rho*N_A/m; #Number density of conduction electrons(per cm**3)\nN_D = N_D*10**6; #Number density of conduction electrons(per m**3)\nE_F = ((h**2)/(8*me))*(3/math.pi*N_D)**(2/3); #fermi energy(J)\nE_F = E_F/e; #fermi energy(eV)\nE_F = math.ceil(E_F*10**2)/10**2; #rounding off the value of E_F to 2 decimals\n\n#Result\nprint \"The number density of conduction electrons is\",N_D, \"per metre cube\"\nprint \"The Fermi energy of silver is\",E_F, \"eV\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "N_A = 6.02*10**23; #Avogadro's number\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "me = 9.1*10**-31; #Mass of electron(kg)\n",
+ "rho = 10.5; #Density of silver(g/cm)\n",
+ "m = 108; #Molecular mass of silver(g/mol)\n",
+ "\n",
+ "#Calculation\n",
+ "N_D = rho*N_A/m; #Number density of conduction electrons(per cm**3)\n",
+ "N_D = N_D*10**6; #Number density of conduction electrons(per m**3)\n",
+ "E_F = ((h**2)/(8*me))*(3/math.pi*N_D)**(2/3); #fermi energy(J)\n",
+ "E_F = E_F/e; #fermi energy(eV)\n",
+ "E_F = math.ceil(E_F*10**2)/10**2; #rounding off the value of E_F to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The number density of conduction electrons is\",N_D, \"per metre cube\"\n",
+ "print \"The Fermi energy of silver is\",E_F, \"eV\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The number density of conduction electrons is 5.85277777778e+28 per metre cube\nThe Fermi energy of silver is 5.51 eV\n"
+ "text": [
+ "The number density of conduction electrons is 5.85277777778e+28 per metre cube\n",
+ "The Fermi energy of silver is 5.51 eV\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +194,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.5, Page number 224"
+ "source": [
+ "Example number 10.5, Page number 224"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic contribution to molar specific heat of sodium\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN_A = 6.02*10**23; #Avogadro's number\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nT = 293; #Temperature of sodium(K)\nE_F = 3.24; #Fermi energy of sodium(eV)\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n\n#Calculation\nC_v = math.pi**2*N_A*k**2*T/(2*E_F*e); #Molar specific heat of sodium(per mole)\nC_v = math.ceil(C_v*10**2)/10**2; #rounding off the value of C_v to 2 decimals\n\n#Result\nprint \"The electronic contribution to molar specific heat of sodium is\",C_v, \"per mole\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N_A = 6.02*10**23; #Avogadro's number\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "T = 293; #Temperature of sodium(K)\n",
+ "E_F = 3.24; #Fermi energy of sodium(eV)\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "\n",
+ "#Calculation\n",
+ "C_v = math.pi**2*N_A*k**2*T/(2*E_F*e); #Molar specific heat of sodium(per mole)\n",
+ "C_v = math.ceil(C_v*10**2)/10**2; #rounding off the value of C_v to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic contribution to molar specific heat of sodium is\",C_v, \"per mole\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic contribution to molar specific heat of sodium is 0.32 per mole\n"
+ "text": [
+ "The electronic contribution to molar specific heat of sodium is 0.32 per mole\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +238,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.6, Page number 224"
+ "source": [
+ "Example number 10.6, Page number 224"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Fermi energy and mean energy of the electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nh = 6.626*10**-34; #Planck's constant(Js)\nm = 9.1*10**-31; #Mass of the electron(kg)\nN_D = 18.1*10**28; #Number density of conduction electrons in Al(per metre cube)\n\n#Calculation\nE_F = h**2/(8*m)*(3/math.pi*N_D)**(2/3); #N_D = N/V. Fermi energy of aluminium(J)\nE_F = E_F/e; #Fermi energy of aluminium(eV)\nE_F = math.ceil(E_F*10**3)/10**3; #rounding off the value of E_F to 3 decimals\nEm_0 = 3/5*E_F; #Mean energy of the electron at 0K(eV)\nEm_0 = math.ceil(Em_0*10**3)/10**3; #rounding off the value of Em_0 to 3 decimals\n\n#Result\nprint \"The Fermi energy of aluminium is\",E_F, \"eV\"\nprint \"The mean energy of the electron is\",Em_0, \"eV\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "m = 9.1*10**-31; #Mass of the electron(kg)\n",
+ "N_D = 18.1*10**28; #Number density of conduction electrons in Al(per metre cube)\n",
+ "\n",
+ "#Calculation\n",
+ "E_F = h**2/(8*m)*(3/math.pi*N_D)**(2/3); #N_D = N/V. Fermi energy of aluminium(J)\n",
+ "E_F = E_F/e; #Fermi energy of aluminium(eV)\n",
+ "E_F = math.ceil(E_F*10**3)/10**3; #rounding off the value of E_F to 3 decimals\n",
+ "Em_0 = 3/5*E_F; #Mean energy of the electron at 0K(eV)\n",
+ "Em_0 = math.ceil(Em_0*10**3)/10**3; #rounding off the value of Em_0 to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The Fermi energy of aluminium is\",E_F, \"eV\"\n",
+ "print \"The mean energy of the electron is\",Em_0, \"eV\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Fermi energy of aluminium is 11.696 eV\nThe mean energy of the electron is 7.018 eV\n"
+ "text": [
+ "The Fermi energy of aluminium is 11.696 eV\n",
+ "The mean energy of the electron is 7.018 eV\n"
+ ]
}
],
"prompt_number": 9
@@ -142,7 +285,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter11_1.ipynb b/Engineering_Physics/Chapter11_1.ipynb
index 733fe6b7..d9dc8a6d 100644
--- a/Engineering_Physics/Chapter11_1.ipynb
+++ b/Engineering_Physics/Chapter11_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter11"
+ "name": "",
+ "signature": "sha256:9d08f8379ee15c99ce5ad85c8c37d7ad2a3a702f52e1db068a113b3963c85435"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,55 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "11: Lasers"
+ "source": [
+ "11: Lasers"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.1, Page number 249"
+ "source": [
+ "Example number 11.1, Page number 249"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ratio of spontaneous emission to stimulated emission for visible and microwave region\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 6.626*10**-34; #Planck's constant(Js)\nc = 3*10**8; #Speed of light in free space(m/s)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nT = 300; #Temperature at absolute scale(K)\nlamda1 = 5500; #Wavelength of visible light(A)\nlamda2 = 10**-2; #Wavelength of microwave(m)\n\n#Calculation\nlamda1 = lamda1*10**-10; #Wavelength of visible light(m)\nrate_ratio = math.exp(h*c/(lamda1*k*T))-1; #Ratio of spontaneous emission to stimulated emission\nrate_ratio1 = math.exp(h*c/(lamda2*k*T))-1; #Ratio of spontaneous emission to stimulated emission\nrate_ratio1 = math.ceil(rate_ratio1*10**5)/10**5; #rounding off the value of rate_ratio1 to 5 decimals\n\n#Result\nprint \"The ratio of spontaneous emission to stimulated emission for visible region is\",rate_ratio\nprint \"The ratio of spontaneous emission to stimulated emission for microwave region is\", rate_ratio1",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "c = 3*10**8; #Speed of light in free space(m/s)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "T = 300; #Temperature at absolute scale(K)\n",
+ "lamda1 = 5500; #Wavelength of visible light(A)\n",
+ "lamda2 = 10**-2; #Wavelength of microwave(m)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda1 = lamda1*10**-10; #Wavelength of visible light(m)\n",
+ "rate_ratio = math.exp(h*c/(lamda1*k*T))-1; #Ratio of spontaneous emission to stimulated emission\n",
+ "rate_ratio1 = math.exp(h*c/(lamda2*k*T))-1; #Ratio of spontaneous emission to stimulated emission\n",
+ "rate_ratio1 = math.ceil(rate_ratio1*10**5)/10**5; #rounding off the value of rate_ratio1 to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The ratio of spontaneous emission to stimulated emission for visible region is\",rate_ratio\n",
+ "print \"The ratio of spontaneous emission to stimulated emission for microwave region is\", rate_ratio1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The ratio of spontaneous emission to stimulated emission for visible region is 8.19422217477e+37\nThe ratio of spontaneous emission to stimulated emission for microwave region is 0.00482\n"
+ "text": [
+ "The ratio of spontaneous emission to stimulated emission for visible region is 8.19422217477e+37\n",
+ "The ratio of spontaneous emission to stimulated emission for microwave region is 0.00482\n"
+ ]
}
],
"prompt_number": 3
@@ -38,19 +69,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.2, Page number 250"
+ "source": [
+ "Example number 11.2, Page number 250"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy of excited state\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nh = 6.626*10**-34; #Planck's constant(Js)\nc = 3*10**8; #Speed of light in free space(m/s)\nlamda = 690; #Wavelength of laser light(nm)\nE_lower = 30.5; #Energy of lower state(eV)\n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of laser light(m)\nE = h*c/lamda; #Energy of the laser light(J)\nE = E/e; #Energy of the laser light(eV)\nE_ex = E_lower + E; #Energy of excited state of laser system(eV)\nE_ex = math.ceil(E_ex*10**2)/10**2; #rounding off the value of E_ex to 2 decimals\n\n#Result\nprint \"The energy of excited state of laser system is\",E_ex, \"eV\"",
+ "input": [
+ " \n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "c = 3*10**8; #Speed of light in free space(m/s)\n",
+ "lamda = 690; #Wavelength of laser light(nm)\n",
+ "E_lower = 30.5; #Energy of lower state(eV)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of laser light(m)\n",
+ "E = h*c/lamda; #Energy of the laser light(J)\n",
+ "E = E/e; #Energy of the laser light(eV)\n",
+ "E_ex = E_lower + E; #Energy of excited state of laser system(eV)\n",
+ "E_ex = math.ceil(E_ex*10**2)/10**2; #rounding off the value of E_ex to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The energy of excited state of laser system is\",E_ex, \"eV\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The energy of excited state of laser system is 32.31 eV\n"
+ "text": [
+ "The energy of excited state of laser system is 32.31 eV\n"
+ ]
}
],
"prompt_number": 4
@@ -59,19 +115,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.3, Page number 250"
+ "source": [
+ "Example number 11.3, Page number 250"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To determine the condition under which stimulated emission equals spontaneous emission\n\n#importing modules\nimport math\nfrom __future__ import division\nimport numpy as np\n\n#Variable declaration\nh = 6.626*10**-34; #Planck's constant(Js)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\n\n#Calculation\n#Stimulated Emission = Spontaneous Emission <=> exp(h*f/(k*T))-1 = 1 i.e.\n#f/T = log(2)*k/h = A\nA = np.log(2)*k/h; #Frequency per unit temperature(Hz/K)\nA = A/10**10;\nA = math.ceil(A*10**3)/10**3; #rounding off the value of A to 3 decimals\n\n#Result\nprint \"The stimulated emission equals spontaneous emission iff f/T =\",A,\"*10**10 Hz/k\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "\n",
+ "#Calculation\n",
+ "#Stimulated Emission = Spontaneous Emission <=> exp(h*f/(k*T))-1 = 1 i.e.\n",
+ "#f/T = log(2)*k/h = A\n",
+ "A = np.log(2)*k/h; #Frequency per unit temperature(Hz/K)\n",
+ "A = A/10**10;\n",
+ "A = math.ceil(A*10**3)/10**3; #rounding off the value of A to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The stimulated emission equals spontaneous emission iff f/T =\",A,\"*10**10 Hz/k\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The stimulated emission equals spontaneous emission iff f/T = 1.444 *10**10 Hz/k\n"
+ "text": [
+ "The stimulated emission equals spontaneous emission iff f/T = 1.444 *10**10 Hz/k\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +160,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.4, Page number 250"
+ "source": [
+ "Example number 11.4, Page number 250"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the area of the spot and intensity at the focus \n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 500; #Wavelength of laser light(nm)\nf = 15; #Focal length of the lens(cm)\nd = 2; #Diameter of the aperture of source(cm)\nP = 5; #Power of the laser(mW)\n\n#Calculation\nP = P*10**-3; #Power of the laser(W)\nlamda = lamda*10**-9; #Wavelength of laser light(m)\nd = d*10**-2; #Diameter of the aperture of source(m)\nf = f*10**-2; #Focal length of the lens(m)\na = d/2; #Radius of the aperture of source(m)\nA = math.pi*lamda**2*f**2/a**2; #Area of the spot at the focal plane, metre square\nI = P/A; #Intensity at the focus(W/m**2)\nI = I/10**7;\nI = math.ceil(I*10**4)/10**4; #rounding off the value of I to 1 decimal\n\n#Result\nprint \"The area of the spot at the focal plane is\",A, \"m**2\"\nprint \"The intensity at the focus is\",I,\"*10**7 W/m**2\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 500; #Wavelength of laser light(nm)\n",
+ "f = 15; #Focal length of the lens(cm)\n",
+ "d = 2; #Diameter of the aperture of source(cm)\n",
+ "P = 5; #Power of the laser(mW)\n",
+ "\n",
+ "#Calculation\n",
+ "P = P*10**-3; #Power of the laser(W)\n",
+ "lamda = lamda*10**-9; #Wavelength of laser light(m)\n",
+ "d = d*10**-2; #Diameter of the aperture of source(m)\n",
+ "f = f*10**-2; #Focal length of the lens(m)\n",
+ "a = d/2; #Radius of the aperture of source(m)\n",
+ "A = math.pi*lamda**2*f**2/a**2; #Area of the spot at the focal plane, metre square\n",
+ "I = P/A; #Intensity at the focus(W/m**2)\n",
+ "I = I/10**7;\n",
+ "I = math.ceil(I*10**4)/10**4; #rounding off the value of I to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The area of the spot at the focal plane is\",A, \"m**2\"\n",
+ "print \"The intensity at the focus is\",I,\"*10**7 W/m**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The area of the spot at the focal plane is 1.76714586764e-10 m**2\nThe intensity at the focus is 2.8295 *10**7 W/m**2\n"
+ "text": [
+ "The area of the spot at the focal plane is 1.76714586764e-10 m**2\n",
+ "The intensity at the focus is 2.8295 *10**7 W/m**2\n"
+ ]
}
],
"prompt_number": 14
@@ -101,19 +212,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.5, Page number 251"
+ "source": [
+ "Example number 11.5, Page number 251"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy released per pulse and number of photons\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 6.626*10**-34; #Planck's constant(Js)\nc = 3*10**8; #Speed of light in free space(m/s)\nlamda = 1064; #Wavelength of laser light(nm)\nP = 0.8; #Average power output per laser pulse(W)\ndt = 25; #Pulse width of laser(ms)\n\n#Calculation\ndt = dt*10**-3; #Pulse width of laser(s)\nlamda = lamda*10**-9; #Wavelength of laser light(m)\nE = P*dt; #Energy released per pulse(J)\nE1 = E*10**3;\nN = E/(h*c/lamda); #Number of photons in a pulse\n\n#Result\nprint \"The energy released per pulse is\",E1,\"*10**-3 J\"\nprint \"The number of photons in a pulse is\", N\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "c = 3*10**8; #Speed of light in free space(m/s)\n",
+ "lamda = 1064; #Wavelength of laser light(nm)\n",
+ "P = 0.8; #Average power output per laser pulse(W)\n",
+ "dt = 25; #Pulse width of laser(ms)\n",
+ "\n",
+ "#Calculation\n",
+ "dt = dt*10**-3; #Pulse width of laser(s)\n",
+ "lamda = lamda*10**-9; #Wavelength of laser light(m)\n",
+ "E = P*dt; #Energy released per pulse(J)\n",
+ "E1 = E*10**3;\n",
+ "N = E/(h*c/lamda); #Number of photons in a pulse\n",
+ "\n",
+ "#Result\n",
+ "print \"The energy released per pulse is\",E1,\"*10**-3 J\"\n",
+ "print \"The number of photons in a pulse is\", N\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The energy released per pulse is 20.0 *10**-3 J\nThe number of photons in a pulse is 1.07053023443e+17\n"
+ "text": [
+ "The energy released per pulse is 20.0 *10**-3 J\n",
+ "The number of photons in a pulse is 1.07053023443e+17\n"
+ ]
}
],
"prompt_number": 17
@@ -122,19 +261,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.6, Page number 251"
+ "source": [
+ "Example number 11.6, Page number 251"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angular spread and diameter of the beam\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 693; #Wavelength of laser beam(nm)\nD = 3; #Diameter of laser beam(mm)\nd = 300; #Height of a satellite above the surface of earth(km)\n\n#Calculation\nD = D*10**-3; #Diameter of laser beam(m)\nlamda = lamda*10**-9; #Wavelength of laser beam(m)\nd = d*10**3; #Height of a satellite above the surface of earth(m)\nd_theta = 1.22*lamda/D; #Angular spread of laser beam(rad)\ndtheta = d_theta*10**4;\ndtheta = math.ceil(dtheta*10**2)/10**2; #rounding off the value of dtheta to 2 decimals\na = d_theta*d; #Diameter of the beam on the satellite(m)\na = math.ceil(a*10)/10; #rounding off the value of a to 1 decimal\n\n#Result\nprint \"The height of a satellite above the surface of earth is\",dtheta,\"*10**-4 rad\"\nprint \"The diameter of the beam on the satellite is\",a, \"m\"\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 693; #Wavelength of laser beam(nm)\n",
+ "D = 3; #Diameter of laser beam(mm)\n",
+ "d = 300; #Height of a satellite above the surface of earth(km)\n",
+ "\n",
+ "#Calculation\n",
+ "D = D*10**-3; #Diameter of laser beam(m)\n",
+ "lamda = lamda*10**-9; #Wavelength of laser beam(m)\n",
+ "d = d*10**3; #Height of a satellite above the surface of earth(m)\n",
+ "d_theta = 1.22*lamda/D; #Angular spread of laser beam(rad)\n",
+ "dtheta = d_theta*10**4;\n",
+ "dtheta = math.ceil(dtheta*10**2)/10**2; #rounding off the value of dtheta to 2 decimals\n",
+ "a = d_theta*d; #Diameter of the beam on the satellite(m)\n",
+ "a = math.ceil(a*10)/10; #rounding off the value of a to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The height of a satellite above the surface of earth is\",dtheta,\"*10**-4 rad\"\n",
+ "print \"The diameter of the beam on the satellite is\",a, \"m\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The height of a satellite above the surface of earth is 2.82 *10**-4 rad\nThe diameter of the beam on the satellite is 84.6 m\n"
+ "text": [
+ "The height of a satellite above the surface of earth is 2.82 *10**-4 rad\n",
+ "The diameter of the beam on the satellite is 84.6 m\n"
+ ]
}
],
"prompt_number": 25
@@ -142,7 +310,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter12_1.ipynb b/Engineering_Physics/Chapter12_1.ipynb
index 440b2d59..c394fc3a 100644
--- a/Engineering_Physics/Chapter12_1.ipynb
+++ b/Engineering_Physics/Chapter12_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter12"
+ "name": "",
+ "signature": "sha256:435dc2503f7ab5f5c4bb167df36c6ef12f8211207bc52e60997787c4d2bd8d5c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,59 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "12: Holography and Fibre Optics"
+ "source": [
+ "12: Holography and Fibre Optics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.1, Page number 271"
+ "source": [
+ "Example number 12.1, Page number 271"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical angle, critical propagation angle and numerical aperture \n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nn1 = 1.43; #Refractive index of fibre core\nn2 = 1.4; #Refractive index of fibre cladding\n\n#Calculation\n#As sin (alpha_c) = n2/n1, solving for alpha_c\nalpha_c = math.asin(n2/n1); #Critical angle for optical fibre(rad)\nalpha_c = alpha_c*57.2957795; #Critical angle for optical fibre(degrees)\nalpha_c = math.ceil(alpha_c*10**3)/10**3; #rounding off the value of alpha_c to 3 decimals\n#AS cos(theta_c) = n2/n1, solving for theta_c\ntheta_c = math.acos(n2/n1); #Critical propagation angle for optical fibre(rad)\ntheta_c = theta_c*57.2957795; #Critical propagation angle for optical fibre(degrees)\ntheta_c = math.ceil(theta_c*10**2)/10**2; #rounding off the value of theta_c to 2 decimals\nNA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\nNA = math.ceil(NA*10**3)/10**3; #rounding off the value of NA to 3 decimals\n\n#Result\nprint \"The critical angle for optical fibre is\",alpha_c, \"degrees\"\nprint \"The critical propagation angle for optical fibre is\",theta_c, \"degrees\"\nprint \"Numerical aperture for optical fibre is\",NA\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1 = 1.43; #Refractive index of fibre core\n",
+ "n2 = 1.4; #Refractive index of fibre cladding\n",
+ "\n",
+ "#Calculation\n",
+ "#As sin (alpha_c) = n2/n1, solving for alpha_c\n",
+ "alpha_c = math.asin(n2/n1); #Critical angle for optical fibre(rad)\n",
+ "alpha_c = alpha_c*57.2957795; #Critical angle for optical fibre(degrees)\n",
+ "alpha_c = math.ceil(alpha_c*10**3)/10**3; #rounding off the value of alpha_c to 3 decimals\n",
+ "#AS cos(theta_c) = n2/n1, solving for theta_c\n",
+ "theta_c = math.acos(n2/n1); #Critical propagation angle for optical fibre(rad)\n",
+ "theta_c = theta_c*57.2957795; #Critical propagation angle for optical fibre(degrees)\n",
+ "theta_c = math.ceil(theta_c*10**2)/10**2; #rounding off the value of theta_c to 2 decimals\n",
+ "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n",
+ "NA = math.ceil(NA*10**3)/10**3; #rounding off the value of NA to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The critical angle for optical fibre is\",alpha_c, \"degrees\"\n",
+ "print \"The critical propagation angle for optical fibre is\",theta_c, \"degrees\"\n",
+ "print \"Numerical aperture for optical fibre is\",NA\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The critical angle for optical fibre is 78.244 degrees\nThe critical propagation angle for optical fibre is 11.76 degrees\nNumerical aperture for optical fibre is 0.292\n"
+ "text": [
+ "The critical angle for optical fibre is 78.244 degrees\n",
+ "The critical propagation angle for optical fibre is 11.76 degrees\n",
+ "Numerical aperture for optical fibre is 0.292\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +73,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.2, Page number 271"
+ "source": [
+ "Example number 12.2, Page number 271"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture, acceptance angle and relative refractive index difference\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nn1 = 1.45; #Refractive index of fibre core\nn2 = 1.4; #Refractive index of fibre cladding\n\n#Calculation\nNA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\nNA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n#As sin(theta_a) = sqrt(n1^2 - n2^2), solving for theta_a\ntheta_a = math.asin(math.sqrt(n1**2 - n2**2)); #Half of acceptance angle of optical fibre(rad)\ntheta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\ntheta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\ntheta_accp = math.ceil(theta_accp*10**2)/10**2; #rounding off the value of theta_accp to 2 decimals\nDelta = (n1 - n2)/n1; #Relative refractive index difference\nDelta = math.ceil(Delta*10**4)/10**4; #rounding off the value of Delta to 4 decimals\n\n#Result\nprint \"Numerical aperture for optical fibre is\", NA\nprint \"The acceptance angle of optical fibre is\",theta_accp, \"degrees\"\nprint \"Relative refractive index difference is\", Delta\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1 = 1.45; #Refractive index of fibre core\n",
+ "n2 = 1.4; #Refractive index of fibre cladding\n",
+ "\n",
+ "#Calculation\n",
+ "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n",
+ "NA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n",
+ "#As sin(theta_a) = sqrt(n1^2 - n2^2), solving for theta_a\n",
+ "theta_a = math.asin(math.sqrt(n1**2 - n2**2)); #Half of acceptance angle of optical fibre(rad)\n",
+ "theta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\n",
+ "theta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n",
+ "theta_accp = math.ceil(theta_accp*10**2)/10**2; #rounding off the value of theta_accp to 2 decimals\n",
+ "Delta = (n1 - n2)/n1; #Relative refractive index difference\n",
+ "Delta = math.ceil(Delta*10**4)/10**4; #rounding off the value of Delta to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"Numerical aperture for optical fibre is\", NA\n",
+ "print \"The acceptance angle of optical fibre is\",theta_accp, \"degrees\"\n",
+ "print \"Relative refractive index difference is\", Delta\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Numerical aperture for optical fibre is 0.3775\nThe acceptance angle of optical fibre is 44.36 degrees\nRelative refractive index difference is 0.0345\n"
+ "text": [
+ "Numerical aperture for optical fibre is 0.3775\n",
+ "The acceptance angle of optical fibre is 44.36 degrees\n",
+ "Relative refractive index difference is 0.0345\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +125,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.3, Page number 271"
+ "source": [
+ "Example number 12.3, Page number 271"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture and acceptance angle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nn1 = 1.55; #Refractive index of fibre core\nn2 = 1.53; #Refractive index of fibre cladding\nn0 = 1.3; #Refractive index of medium\n\n#Calculation\nNA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\nNA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n#n0*sin(theta_a) = sqrt(n1^2 - n2^2) = NA, solving for theta_a\ntheta_a = math.asin(math.sqrt(n1**2 - n2**2)/n0); #Half of acceptance angle of optical fibre(rad)\ntheta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\ntheta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n\n#Result\nprint \"Numerical aperture for step index fibre is\",NA\nprint \"The acceptance angle of step index fibre is\",int(theta_accp), \"degrees\"\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1 = 1.55; #Refractive index of fibre core\n",
+ "n2 = 1.53; #Refractive index of fibre cladding\n",
+ "n0 = 1.3; #Refractive index of medium\n",
+ "\n",
+ "#Calculation\n",
+ "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n",
+ "NA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n",
+ "#n0*sin(theta_a) = sqrt(n1^2 - n2^2) = NA, solving for theta_a\n",
+ "theta_a = math.asin(math.sqrt(n1**2 - n2**2)/n0); #Half of acceptance angle of optical fibre(rad)\n",
+ "theta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\n",
+ "theta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"Numerical aperture for step index fibre is\",NA\n",
+ "print \"The acceptance angle of step index fibre is\",int(theta_accp), \"degrees\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Numerical aperture for step index fibre is 0.2482\nThe acceptance angle of step index fibre is 22 degrees\n"
+ "text": [
+ "Numerical aperture for step index fibre is 0.2482\n",
+ "The acceptance angle of step index fibre is 22 degrees\n"
+ ]
}
],
"prompt_number": 5
@@ -80,25 +173,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.4, Page number 271 Theoritical proof"
+ "source": [
+ "Example number 12.4, Page number 271 Theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.5, Page number 272"
+ "source": [
+ "Example number 12.5, Page number 272"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture and acceptance angle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nalpha = 2; #Power loss through optical fibre(dB/km)\nP_in = 500; #Poer input of optical fibre(micro-watt)\nz = 10; #Length of the optical fibre(km)\n\n#Calculation\n#As alpha = 10/z*log10(P_in/P_out), solving for P_out\nP_out = P_in/10**(alpha*z/10); #Output power in fibre optic communication(micro-Watt)\n\n#Result\nprint \"The output power in fibre optic communication is\",P_out, \"micro-Watt\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "alpha = 2; #Power loss through optical fibre(dB/km)\n",
+ "P_in = 500; #Poer input of optical fibre(micro-watt)\n",
+ "z = 10; #Length of the optical fibre(km)\n",
+ "\n",
+ "#Calculation\n",
+ "#As alpha = 10/z*log10(P_in/P_out), solving for P_out\n",
+ "P_out = P_in/10**(alpha*z/10); #Output power in fibre optic communication(micro-Watt)\n",
+ "\n",
+ "#Result\n",
+ "print \"The output power in fibre optic communication is\",P_out, \"micro-Watt\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The output power in fibre optic communication is 5.0 micro-Watt\n"
+ "text": [
+ "The output power in fibre optic communication is 5.0 micro-Watt\n"
+ ]
}
],
"prompt_number": 6
@@ -106,7 +222,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter13_1.ipynb b/Engineering_Physics/Chapter13_1.ipynb
index 2366432d..75d0d1f7 100644
--- a/Engineering_Physics/Chapter13_1.ipynb
+++ b/Engineering_Physics/Chapter13_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter13"
+ "name": "",
+ "signature": "sha256:be254bf95838dd01a87a63582117a886c3167a80cf387f9901b2e2de7a990b8e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "13: Dielectric Properties of Materials"
+ "source": [
+ "13: Dielectric Properties of Materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.1, Page number 287"
+ "source": [
+ "Example number 13.1, Page number 287"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability \n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0 = 8.85*10**-12; #Absolute electrical permittivity of free space(F/m)\nR = 0.52; #Radius of hydrogen atom(A)\nn = 9.7*10**26; #Number density of hydrogen(per metre cube)\n\n#Calculation\nR = R*10**-10; #Radius of hydrogen atom(m)\nalpha_e = 4*math.pi*epsilon_0*R**3; #Electronic polarizability of hydrogen atom(Fm**2)\n\n#Result\nprint \"The electronic polarizability of hydrogen atom is\", alpha_e, \"Fm**2\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0 = 8.85*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "R = 0.52; #Radius of hydrogen atom(A)\n",
+ "n = 9.7*10**26; #Number density of hydrogen(per metre cube)\n",
+ "\n",
+ "#Calculation\n",
+ "R = R*10**-10; #Radius of hydrogen atom(m)\n",
+ "alpha_e = 4*math.pi*epsilon_0*R**3; #Electronic polarizability of hydrogen atom(Fm**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic polarizability of hydrogen atom is\", alpha_e, \"Fm**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic polarizability of hydrogen atom is 1.56373503182e-41 Fm**2\n"
+ "text": [
+ "The electronic polarizability of hydrogen atom is 1.56373503182e-41 Fm**2\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +62,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.2, Page number 287"
+ "source": [
+ "Example number 13.2, Page number 287"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the capacitance of capacitor and charge on the plates\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nA = 100; #Area of a plate of parallel plate capacitor(cm**2)\nd = 1; #Distance between the plates of the capacitor(cm)\nV = 100; #Potential applied to the plates of the capacitor(V)\n\n#Calculation\nA= A*10**-4; #Area of a plate of parallel plate capacitor(m**2)\nd = d*10**-2; #Distance between the plates of the capacitor(m)\nC = epsilon_0*A/d; #Capacitance of parallel plate capacitor(F)\nQ = C*V; #Charge on the plates of the capacitor(C)\n\n#Result\nprint \"The capacitance of parallel plate capacitor is\",C, \"F\"\nprint \"The charge on the plates of the capacitor is\",Q, \"C\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "A = 100; #Area of a plate of parallel plate capacitor(cm**2)\n",
+ "d = 1; #Distance between the plates of the capacitor(cm)\n",
+ "V = 100; #Potential applied to the plates of the capacitor(V)\n",
+ "\n",
+ "#Calculation\n",
+ "A= A*10**-4; #Area of a plate of parallel plate capacitor(m**2)\n",
+ "d = d*10**-2; #Distance between the plates of the capacitor(m)\n",
+ "C = epsilon_0*A/d; #Capacitance of parallel plate capacitor(F)\n",
+ "Q = C*V; #Charge on the plates of the capacitor(C)\n",
+ "\n",
+ "#Result\n",
+ "print \"The capacitance of parallel plate capacitor is\",C, \"F\"\n",
+ "print \"The charge on the plates of the capacitor is\",Q, \"C\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The capacitance of parallel plate capacitor is 8.854e-12 F\nThe charge on the plates of the capacitor is 8.854e-10 C\n"
+ "text": [
+ "The capacitance of parallel plate capacitor is 8.854e-12 F\n",
+ "The charge on the plates of the capacitor is 8.854e-10 C\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +110,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.3, Page number 288"
+ "source": [
+ "Example number 13.3, Page number 288"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the dielectric displacement\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nepsilon_r = 5.0; #Dielectric constant of the material between the plates of capacitor\nV = 15; #Potential difference applied between the plates of the capacitor(V)\nd = 1.5; #Separation between the plates of the capacitor(mm)\n\n#Calculation\nd = d*10**-3; #Separation between the plates of the capacitor(m)\n#Electric displacement, D = epsilon_0*epsilon_r*E, as E = V/d, so \nD = epsilon_0*epsilon_r*V/d; #Dielectric displacement(C/m**2)\n\n#Result\nprint \"The dielectric displacement is\",D, \"C/m**2\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "epsilon_r = 5.0; #Dielectric constant of the material between the plates of capacitor\n",
+ "V = 15; #Potential difference applied between the plates of the capacitor(V)\n",
+ "d = 1.5; #Separation between the plates of the capacitor(mm)\n",
+ "\n",
+ "#Calculation\n",
+ "d = d*10**-3; #Separation between the plates of the capacitor(m)\n",
+ "#Electric displacement, D = epsilon_0*epsilon_r*E, as E = V/d, so \n",
+ "D = epsilon_0*epsilon_r*V/d; #Dielectric displacement(C/m**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"The dielectric displacement is\",D, \"C/m**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The dielectric displacement is 4.427e-07 C/m**2\n"
+ "text": [
+ "The dielectric displacement is 4.427e-07 C/m**2\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +155,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.4, Page number 288"
+ "source": [
+ "Example number 13.4, Page number 288"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative dielectric constant\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nN = 3*10**28; #Number density of solid elemental dielectric(atoms/metre cube)\nalpha_e = 10**-40; #Electronic polarizability(Fm**2)\n\n#Calculation\nepsilon_r = 1 + (N*alpha_e/epsilon_0); #Relative dielectric constant of the material\nepsilon_r = math.ceil(epsilon_r*10**3)/10**3; #rounding off the value of epsilon_r to 3 decimals\n\n#Result\nprint \"The Relative dielectric constant of the material is\",epsilon_r\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "N = 3*10**28; #Number density of solid elemental dielectric(atoms/metre cube)\n",
+ "alpha_e = 10**-40; #Electronic polarizability(Fm**2)\n",
+ "\n",
+ "#Calculation\n",
+ "epsilon_r = 1 + (N*alpha_e/epsilon_0); #Relative dielectric constant of the material\n",
+ "epsilon_r = math.ceil(epsilon_r*10**3)/10**3; #rounding off the value of epsilon_r to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The Relative dielectric constant of the material is\",epsilon_r\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Relative dielectric constant of the material is 1.339\n"
+ "text": [
+ "The Relative dielectric constant of the material is 1.339\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +197,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.5, Page number 288"
+ "source": [
+ "Example number 13.5, Page number 288"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN_A = 6.02*10**23; #Avogadro's number(per mole)\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nepsilon_r = 3.75; #Relative dielectric constant\nd = 2050; #Density of sulphur(kg/metre cube)\ny = 1/3; #Internal field constant\nM = 32; #Atomic weight of sulphur(g/mol)\n\n#Calculation\nN = N_A*10**3*d/M; #Number density of atoms of sulphur(per metre cube)\n#Lorentz relation for local fields give E_local = E + P/(3*epsilon_0) which gives\n#(epsilon_r - 1)/(epsilon_r + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\nalpha_e = (epsilon_r - 1)/(epsilon_r + 2)*3*epsilon_0/N; #Electronic polarizability of sulphur(Fm**2)\n\n#Result\nprint \"The electronic polarizability of sulphur is\",alpha_e, \"Fm**2\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N_A = 6.02*10**23; #Avogadro's number(per mole)\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "epsilon_r = 3.75; #Relative dielectric constant\n",
+ "d = 2050; #Density of sulphur(kg/metre cube)\n",
+ "y = 1/3; #Internal field constant\n",
+ "M = 32; #Atomic weight of sulphur(g/mol)\n",
+ "\n",
+ "#Calculation\n",
+ "N = N_A*10**3*d/M; #Number density of atoms of sulphur(per metre cube)\n",
+ "#Lorentz relation for local fields give E_local = E + P/(3*epsilon_0) which gives\n",
+ "#(epsilon_r - 1)/(epsilon_r + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\n",
+ "alpha_e = (epsilon_r - 1)/(epsilon_r + 2)*3*epsilon_0/N; #Electronic polarizability of sulphur(Fm**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic polarizability of sulphur is\",alpha_e, \"Fm**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic polarizability of sulphur is 3.2940125351e-40 Fm**2\n"
+ "text": [
+ "The electronic polarizability of sulphur is 3.2940125351e-40 Fm**2\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +245,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.6, Page number 289"
+ "source": [
+ "Example number 13.6, Page number 289"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN = 3*10**28; #Number density of atoms of dielectric material(per metre cube)\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nn = 1.6; #Refractive index of dielectric material\n\n#Calculation\n#As (n^2 - 1)/(n^2 + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\nalpha_e = (n**2 - 1)/(n**2 + 2)*3*epsilon_0/N; #Electronic polarizability of dielectric material(Fm**2)\n\n#Result\nprint \"The electronic polarizability of dielectric material is\",alpha_e, \"Fm**2\"",
+ "input": [
+ " \n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N = 3*10**28; #Number density of atoms of dielectric material(per metre cube)\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "n = 1.6; #Refractive index of dielectric material\n",
+ "\n",
+ "#Calculation\n",
+ "#As (n^2 - 1)/(n^2 + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\n",
+ "alpha_e = (n**2 - 1)/(n**2 + 2)*3*epsilon_0/N; #Electronic polarizability of dielectric material(Fm**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic polarizability of dielectric material is\",alpha_e, \"Fm**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic polarizability of dielectric material is 3.029e-40 Fm**2\n"
+ "text": [
+ "The electronic polarizability of dielectric material is 3.029e-40 Fm**2\n"
+ ]
}
],
"prompt_number": 8
@@ -143,19 +286,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.7, Page number 289"
+ "source": [
+ "Example number 13.7, Page number 289"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ratio of electronic polarizability to ionic polarizability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nepsilon_r = 4.9; #Absolute relative dielectric constant of material(F/m)\nn = 1.6; #Refractive index of dielectric material\n\n#Calculation\n#As (n^2 - 1)/(n^2 + 2)*(alpha_e + alpha_i)/alpha_e = N*(alpha_e + alpha_i)/(3*epsilon_0) = (epsilon_r - 1)/(epsilon_r + 2)\n#let alpha_ratio = alpha_i/alpha_e\nalpha_ratio = ((epsilon_r - 1)/(epsilon_r + 2)*(n**2 + 2)/(n**2 - 1) - 1)**(-1); #Ratio of electronic polarizability to ionic polarizability\nalpha_ratio = math.ceil(alpha_ratio*10**3)/10**3; #rounding off the value of alpha_ratio to 3 decimals\n\n#Result\nprint \"The ratio of electronic polarizability to ionic polarizability is\",alpha_ratio",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_r = 4.9; #Absolute relative dielectric constant of material(F/m)\n",
+ "n = 1.6; #Refractive index of dielectric material\n",
+ "\n",
+ "#Calculation\n",
+ "#As (n^2 - 1)/(n^2 + 2)*(alpha_e + alpha_i)/alpha_e = N*(alpha_e + alpha_i)/(3*epsilon_0) = (epsilon_r - 1)/(epsilon_r + 2)\n",
+ "#let alpha_ratio = alpha_i/alpha_e\n",
+ "alpha_ratio = ((epsilon_r - 1)/(epsilon_r + 2)*(n**2 + 2)/(n**2 - 1) - 1)**(-1); #Ratio of electronic polarizability to ionic polarizability\n",
+ "alpha_ratio = math.ceil(alpha_ratio*10**3)/10**3; #rounding off the value of alpha_ratio to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The ratio of electronic polarizability to ionic polarizability is\",alpha_ratio"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The ratio of electronic polarizability to ionic polarizability is 1.534\n"
+ "text": [
+ "The ratio of electronic polarizability to ionic polarizability is 1.534\n"
+ ]
}
],
"prompt_number": 9
@@ -163,7 +328,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter14_1.ipynb b/Engineering_Physics/Chapter14_1.ipynb
index eb6cc153..1191c56f 100644
--- a/Engineering_Physics/Chapter14_1.ipynb
+++ b/Engineering_Physics/Chapter14_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter14"
+ "name": "",
+ "signature": "sha256:03a15735237144f42a49956ccb15694e3ce619fee35260180caccfe8f848e036"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,53 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "14: Magnetic Properties of Materials"
+ "source": [
+ "14: Magnetic Properties of Materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.1, Page number 306"
+ "source": [
+ "Example number 14.1, Page number 306"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the spontaneous magnetisation\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN = 6.02*10**23; #Avogadro's number(per mole)\nA = 56; #Atomic weight of the substance(g/mole)\nd = 7.9; #Density of the substance(g/cm**3)\nm_B = 9.27*10**-24; #Bohr's Magneton(J/T)\n\n#Calculation\nm = 2.2*m_B; #Magnetic moment of substance(J/T)\nn = d*N/A ; #Number of atoms per unit volume of the substance(per cm**3)\nn = n*10**6; #Number of atoms per unit volume of the substance(per m**3)\nM = n*m; #Spontaneous magnetisation of the substance(A/m)\nM = M/10**6;\nM = math.ceil(M*10**3)/10**3; #rounding off the value of M to 3 decimals\n\n#Result\nprint \"The spontaneous magnetisation of the substance is\",M,\"*10**6 A/m\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N = 6.02*10**23; #Avogadro's number(per mole)\n",
+ "A = 56; #Atomic weight of the substance(g/mole)\n",
+ "d = 7.9; #Density of the substance(g/cm**3)\n",
+ "m_B = 9.27*10**-24; #Bohr's Magneton(J/T)\n",
+ "\n",
+ "#Calculation\n",
+ "m = 2.2*m_B; #Magnetic moment of substance(J/T)\n",
+ "n = d*N/A ; #Number of atoms per unit volume of the substance(per cm**3)\n",
+ "n = n*10**6; #Number of atoms per unit volume of the substance(per m**3)\n",
+ "M = n*m; #Spontaneous magnetisation of the substance(A/m)\n",
+ "M = M/10**6;\n",
+ "M = math.ceil(M*10**3)/10**3; #rounding off the value of M to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The spontaneous magnetisation of the substance is\",M,\"*10**6 A/m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The spontaneous magnetisation of the substance is 1.732 *10**6 A/m\n"
+ "text": [
+ "The spontaneous magnetisation of the substance is 1.732 *10**6 A/m\n"
+ ]
}
],
"prompt_number": 5
@@ -38,19 +67,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.2, Page number 307"
+ "source": [
+ "Example number 14.2, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative permeability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nH = 200; #Field strength to which the ferromagnetic material is subjected(A/m)\nM = 3100; #Magnetisation of the ferromagnetic material(A/m)\n\n#Calculation\nchi = M/H; #Magnetic susceptibility\nmew_r = 1 + chi; #Relative permeability of ferromagnetic material\n\n#Result\nprint \"The relative permeability of ferromagnetic material is\",mew_r",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "H = 200; #Field strength to which the ferromagnetic material is subjected(A/m)\n",
+ "M = 3100; #Magnetisation of the ferromagnetic material(A/m)\n",
+ "\n",
+ "#Calculation\n",
+ "chi = M/H; #Magnetic susceptibility\n",
+ "mew_r = 1 + chi; #Relative permeability of ferromagnetic material\n",
+ "\n",
+ "#Result\n",
+ "print \"The relative permeability of ferromagnetic material is\",mew_r"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The relative permeability of ferromagnetic material is 16.5\n"
+ "text": [
+ "The relative permeability of ferromagnetic material is 16.5\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +108,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.3, Page number 307"
+ "source": [
+ "Example number 14.3, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative permeability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nH = 300; #Field strength to which the ferromagnetic material is subjected(A/m)\nM = 4400; #Magnetisation of the ferromagnetic material(A/m)\n\n#Calculation\nchi = M/H; #Magnetic susceptibility\nmew_r = 1 + chi; #Relative permeability of ferromagnetic material\nmew_r = math.ceil(mew_r*100)/100; #rounding off the value of mew_r to 2 decimals\n\n#Result\nprint \"The relative permeability of ferromagnetic material is\",mew_r\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "H = 300; #Field strength to which the ferromagnetic material is subjected(A/m)\n",
+ "M = 4400; #Magnetisation of the ferromagnetic material(A/m)\n",
+ "\n",
+ "#Calculation\n",
+ "chi = M/H; #Magnetic susceptibility\n",
+ "mew_r = 1 + chi; #Relative permeability of ferromagnetic material\n",
+ "mew_r = math.ceil(mew_r*100)/100; #rounding off the value of mew_r to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The relative permeability of ferromagnetic material is\",mew_r\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The relative permeability of ferromagnetic material is 15.67\n"
+ "text": [
+ "The relative permeability of ferromagnetic material is 15.67\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +150,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.4, Page number 307"
+ "source": [
+ "Example number 14.4, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetisation and flux density\n\n#importing modules\nimport math\n\n#Variable declaration\nmew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\nH = 10000; #Field strength to which the diamagnetic material is subjected(A/m)\nchi = -0.4*10**-5; #Magnetic susceptibility\n\n#Calculation\nM = chi*H; #Magnetisation of the diamagnetic material(A/m)\nB = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\nB = math.ceil(B*10**4)/10**4; #rounding off the value of B to 4 decimals\n\n#Result\nprint \"The magnetisation of diamagnetic material is\",M, \"A/m\"\nprint \"The magnetic flux density of diamagnetic material is\",B, \"T\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n",
+ "H = 10000; #Field strength to which the diamagnetic material is subjected(A/m)\n",
+ "chi = -0.4*10**-5; #Magnetic susceptibility\n",
+ "\n",
+ "#Calculation\n",
+ "M = chi*H; #Magnetisation of the diamagnetic material(A/m)\n",
+ "B = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\n",
+ "B = math.ceil(B*10**4)/10**4; #rounding off the value of B to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The magnetisation of diamagnetic material is\",M, \"A/m\"\n",
+ "print \"The magnetic flux density of diamagnetic material is\",B, \"T\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The magnetisation of diamagnetic material is -0.04 A/m\nThe magnetic flux density of diamagnetic material is 0.0126 T\n"
+ "text": [
+ "The magnetisation of diamagnetic material is -0.04 A/m\n",
+ "The magnetic flux density of diamagnetic material is 0.0126 T\n"
+ ]
}
],
"prompt_number": 8
@@ -101,19 +194,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.5, Page number 307"
+ "source": [
+ "Example number 14.5, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetisation, relative permeability and flux density\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nmew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\nH = 1.2*10**5; #Field strength to which the diamagnetic material is subjected(A/m)\nchi = -4.2*10**-6; #Magnetic susceptibility\n\n#Calculation\nM = chi*H; #Magnetisation of the diamagnetic material(A/m)\nB = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\nB = math.ceil(B*10**3)/10**3; #rounding off the value of B to 3 decimals\nmew_r = M/H + 1; #The relative permeability of diamagnetic material\nmew_r = math.ceil(mew_r*10**6)/10**6; #rounding off the value of mew_r to 6 decimals\n\n#Result\nprint \"The magnetisation of diamagnetic material is\",M, \"A/m\"\nprint \"The magnetic flux density of diamagnetic material is\",B, \"T\"\nprint \"The relative permeability of diamagnetic material is\",mew_r\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n",
+ "H = 1.2*10**5; #Field strength to which the diamagnetic material is subjected(A/m)\n",
+ "chi = -4.2*10**-6; #Magnetic susceptibility\n",
+ "\n",
+ "#Calculation\n",
+ "M = chi*H; #Magnetisation of the diamagnetic material(A/m)\n",
+ "B = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\n",
+ "B = math.ceil(B*10**3)/10**3; #rounding off the value of B to 3 decimals\n",
+ "mew_r = M/H + 1; #The relative permeability of diamagnetic material\n",
+ "mew_r = math.ceil(mew_r*10**6)/10**6; #rounding off the value of mew_r to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The magnetisation of diamagnetic material is\",M, \"A/m\"\n",
+ "print \"The magnetic flux density of diamagnetic material is\",B, \"T\"\n",
+ "print \"The relative permeability of diamagnetic material is\",mew_r\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The magnetisation of diamagnetic material is -0.504 A/m\nThe magnetic flux density of diamagnetic material is 0.151 T\nThe relative permeability of diamagnetic material is 0.999996\n"
+ "text": [
+ "The magnetisation of diamagnetic material is -0.504 A/m\n",
+ "The magnetic flux density of diamagnetic material is 0.151 T\n",
+ "The relative permeability of diamagnetic material is 0.999996\n"
+ ]
}
],
"prompt_number": 10
@@ -122,19 +243,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.6, Page number 308"
+ "source": [
+ "Example number 14.6, Page number 308"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mean radius of the atom\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nchi = 5.6*10**-6; #Magnetic susceptibility of diamagnetic material\nm = 9.1*10**-31; #Mass of an electron(kg)\nmew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\nZ = 1; #Atomic number\ne = 1.6*10**-19; #Electronic charge(C)\na = 2.53; #Lattice parameter of bcc structure(A)\n\n#Calculation\na = a*10**-10; #Lattice parameter of bcc structure(m)\nN = 2/a**3; #The number of electrons per unit volume(per metre cube)\nr = math.sqrt(chi*6*m/(mew_0*Z*e**2*N)); #Mean radius of body centered cubic structure(m)\nr = r*10**10; #Mean radius of body centered cubic structure(A)\nr = math.ceil(r*100)/100; #rounding off the value of r to 2 decimals\n\n#Result\nprint \"The mean radius of body centered cubic structure is\",r, \"A\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "chi = 5.6*10**-6; #Magnetic susceptibility of diamagnetic material\n",
+ "m = 9.1*10**-31; #Mass of an electron(kg)\n",
+ "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n",
+ "Z = 1; #Atomic number\n",
+ "e = 1.6*10**-19; #Electronic charge(C)\n",
+ "a = 2.53; #Lattice parameter of bcc structure(A)\n",
+ "\n",
+ "#Calculation\n",
+ "a = a*10**-10; #Lattice parameter of bcc structure(m)\n",
+ "N = 2/a**3; #The number of electrons per unit volume(per metre cube)\n",
+ "r = math.sqrt(chi*6*m/(mew_0*Z*e**2*N)); #Mean radius of body centered cubic structure(m)\n",
+ "r = r*10**10; #Mean radius of body centered cubic structure(A)\n",
+ "r = math.ceil(r*100)/100; #rounding off the value of r to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The mean radius of body centered cubic structure is\",r, \"A\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The mean radius of body centered cubic structure is 0.88 A\n"
+ "text": [
+ "The mean radius of body centered cubic structure is 0.88 A\n"
+ ]
}
],
"prompt_number": 11
@@ -143,19 +291,55 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.7, Page number 308"
+ "source": [
+ "Example number 14.7, Page number 308"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetic susceptibility and magnetisation\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nmew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\nN_A = 6.02*10**26; #Avogadro's number(per kmol)\nrho = 4370; #Density of paramegnetic salt(kg/metre cube)\nM = 168.5; #Molecular weight of paramagnetic salt(g/mol)\nT = 27; #Temperature of paramagnetic salt(C)\nH = 2*10**5; #Field strength to which the paramagnetic salt is subjected(A/m)\nmew_B = 9.27*10**-24; #Bohr's magneton(Am**2)\np = 2; #Number of Bohr magnetons per molecule\nk = 1.38*10**-23; #Boltzmann constant(J/K)\n\n#Calculation\nT = T+273; #Temperature of paramagnetic salt(K)\nN = rho*N_A/M; #Total density of atoms in the paramagnetic salt(per meter cube)\nchi_para = mew_0*N*p**2*mew_B**2/(3*k*T); #Magnetic susceptibility of paramagnetic salt\nchi_para = chi_para*10**4;\nchi_para = math.ceil(chi_para*10**2)/10**2; #rounding off the value of chi_para to 2 decimals\nM = chi*H; #Magnetisation of paramagnetic salt(A/m)\nM = math.ceil(M*10)/10; #rounding off the value of M to 1 decimal\n\n#Result\nprint \"The magnetic susceptibility of paramagnetic salt is\",chi_para,\"*10**-4\"\nprint \"The magnetisation of paramagnetic salt is\",M, \"A/m\"\n\n#answer for magnetisation is not given in the textbook",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n",
+ "N_A = 6.02*10**26; #Avogadro's number(per kmol)\n",
+ "rho = 4370; #Density of paramegnetic salt(kg/metre cube)\n",
+ "M = 168.5; #Molecular weight of paramagnetic salt(g/mol)\n",
+ "T = 27; #Temperature of paramagnetic salt(C)\n",
+ "H = 2*10**5; #Field strength to which the paramagnetic salt is subjected(A/m)\n",
+ "mew_B = 9.27*10**-24; #Bohr's magneton(Am**2)\n",
+ "p = 2; #Number of Bohr magnetons per molecule\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "\n",
+ "#Calculation\n",
+ "T = T+273; #Temperature of paramagnetic salt(K)\n",
+ "N = rho*N_A/M; #Total density of atoms in the paramagnetic salt(per meter cube)\n",
+ "chi_para = mew_0*N*p**2*mew_B**2/(3*k*T); #Magnetic susceptibility of paramagnetic salt\n",
+ "chi_para = chi_para*10**4;\n",
+ "chi_para = math.ceil(chi_para*10**2)/10**2; #rounding off the value of chi_para to 2 decimals\n",
+ "M = chi*H; #Magnetisation of paramagnetic salt(A/m)\n",
+ "M = math.ceil(M*10)/10; #rounding off the value of M to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The magnetic susceptibility of paramagnetic salt is\",chi_para,\"*10**-4\"\n",
+ "print \"The magnetisation of paramagnetic salt is\",M, \"A/m\"\n",
+ "\n",
+ "#answer for magnetisation is not given in the textbook"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The magnetic susceptibility of paramagnetic salt is 5.43 *10**-4\nThe magnetisation of paramagnetic salt is 1.2 A/m\n"
+ "text": [
+ "The magnetic susceptibility of paramagnetic salt is 5.43 *10**-4\n",
+ "The magnetisation of paramagnetic salt is 1.2 A/m\n"
+ ]
}
],
"prompt_number": 14
@@ -163,7 +347,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter15_1.ipynb b/Engineering_Physics/Chapter15_1.ipynb
index cfabc2c6..feff19f4 100644
--- a/Engineering_Physics/Chapter15_1.ipynb
+++ b/Engineering_Physics/Chapter15_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter15"
+ "name": "",
+ "signature": "sha256:16c7c597c3247782caaceb2ade68420e223aff8e960ccd80320d3e5521140cc3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "15: Thermal Properties "
+ "source": [
+ "15: Thermal Properties "
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.1, Page number 323"
+ "source": [
+ "Example number 15.1, Page number 323"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Debye temperature\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\nf_D = 64*10**11; #Debye frequency for Al(Hz)\n\n#Calculation\ntheta_D = h*f_D/k; #Debye temperature(K)\ntheta_D = math.ceil(theta_D*10)/10; #rounding off the value of theta_D to 1 decimal\n\n#Result\nprint \"The Debye temperature of aluminium is\",theta_D, \"K\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "f_D = 64*10**11; #Debye frequency for Al(Hz)\n",
+ "\n",
+ "#Calculation\n",
+ "theta_D = h*f_D/k; #Debye temperature(K)\n",
+ "theta_D = math.ceil(theta_D*10)/10; #rounding off the value of theta_D to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The Debye temperature of aluminium is\",theta_D, \"K\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Debye temperature of aluminium is 307.3 K\n"
+ "text": [
+ "The Debye temperature of aluminium is 307.3 K\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +62,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.2, Page number 323"
+ "source": [
+ "Example number 15.2, Page number 323"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lattice specific heat\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN = 6.02*10**26; #Avogadro's number(per kmol)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\nf_D = 40.5*10**12; #Debye frequency for Al(Hz)\nT = 30; #Temperature of carbon(Ks)\n\n#Calculation\ntheta_D = h*f_D/k; #Debye temperature(K)\nC_l = 12/5*math.pi**4*N*k*(T/theta_D)**3; #Lattice specific heat of carbon(J/k-mol/K)\nC_l = math.ceil(C_l*10**3)/10**3; #rounding off the value of C_l to 3 decimals\n\n#Result\nprint \"The lattice specific heat of carbon is\",C_l, \"J/k-mol/K\"\n\n#answer given in the book is wrong in the 2nd decimal",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N = 6.02*10**26; #Avogadro's number(per kmol)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "f_D = 40.5*10**12; #Debye frequency for Al(Hz)\n",
+ "T = 30; #Temperature of carbon(Ks)\n",
+ "\n",
+ "#Calculation\n",
+ "theta_D = h*f_D/k; #Debye temperature(K)\n",
+ "C_l = 12/5*math.pi**4*N*k*(T/theta_D)**3; #Lattice specific heat of carbon(J/k-mol/K)\n",
+ "C_l = math.ceil(C_l*10**3)/10**3; #rounding off the value of C_l to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The lattice specific heat of carbon is\",C_l, \"J/k-mol/K\"\n",
+ "\n",
+ "#answer given in the book is wrong in the 2nd decimal"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The lattice specific heat of carbon is 7.132 J/k-mol/K\n"
+ "text": [
+ "The lattice specific heat of carbon is 7.132 J/k-mol/K\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +109,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.3, Page number 323"
+ "source": [
+ "Example number 15.3, Page number 323"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To show that the frequency falls in the infrared region\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\ntheta_E = 1990; #Einstein temperature of Cu(K)\n\n#Calculation\nf_E = k*theta_E/h; #Einstein frequency for Cu(K)\n\n#Result\nprint \"The Einstein frequency for Cu is\",f_E, \"Hz\"\nprint \"The frequency falls in the near infrared region\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "theta_E = 1990; #Einstein temperature of Cu(K)\n",
+ "\n",
+ "#Calculation\n",
+ "f_E = k*theta_E/h; #Einstein frequency for Cu(K)\n",
+ "\n",
+ "#Result\n",
+ "print \"The Einstein frequency for Cu is\",f_E, \"Hz\"\n",
+ "print \"The frequency falls in the near infrared region\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Einstein frequency for Cu is 4.14458194989e+13 Hz\nThe frequency falls in the near infrared region\n"
+ "text": [
+ "The Einstein frequency for Cu is 4.14458194989e+13 Hz\n",
+ "The frequency falls in the near infrared region\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +152,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.4, Page number 323"
+ "source": [
+ "Example number 15.4, Page number 323"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic and lattice heat capacities\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nN = 6.02*10**23; #Avogadro's number(per mol)\nT = 0.05; #Temperature of Cu(K)\nE_F = 7; #Fermi energy of Cu(eV)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\ntheta_D = 348; #Debye temperature of Cu(K)\n\n#Calculation\nC_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Cu(J/mol/K)\nC_V = (12/5)*math.pi**4*(N*k)*(T/theta_D)**3; #Lattice heat capacity of Cu(J/mol/K)\n\n#Result\nprint \"The electronic heat capacity of Cu is\",C_e, \"J/mol/K\"\nprint \"The lattice heat capacity of Cu is\",C_V, \"J/mol/K\"\n\n#answer for lattice heat capacity given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "N = 6.02*10**23; #Avogadro's number(per mol)\n",
+ "T = 0.05; #Temperature of Cu(K)\n",
+ "E_F = 7; #Fermi energy of Cu(eV)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "theta_D = 348; #Debye temperature of Cu(K)\n",
+ "\n",
+ "#Calculation\n",
+ "C_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Cu(J/mol/K)\n",
+ "C_V = (12/5)*math.pi**4*(N*k)*(T/theta_D)**3; #Lattice heat capacity of Cu(J/mol/K)\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic heat capacity of Cu is\",C_e, \"J/mol/K\"\n",
+ "print \"The lattice heat capacity of Cu is\",C_V, \"J/mol/K\"\n",
+ "\n",
+ "#answer for lattice heat capacity given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic heat capacity of Cu is 2.52566877726e-05 J/mol/K\nThe lattice heat capacity of Cu is 5.76047891492e-09 J/mol/K\n"
+ "text": [
+ "The electronic heat capacity of Cu is 2.52566877726e-05 J/mol/K\n",
+ "The lattice heat capacity of Cu is 5.76047891492e-09 J/mol/K\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +202,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.5, Page number 324"
+ "source": [
+ "Example number 15.5, Page number 324"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the heat capacity\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nT = 1; #For simplicity assume temperature to be unity(K)\nR = 1; #For simplicity assume molar gas constant to be unity(J/mol/K)\ntheta_E = T; #Einstein temperature(K)\n\n#Calculation\nC_V = 3*R*(theta_E/T)**2*math.exp(theta_E/T)/(math.exp(theta_E/T)-1)**2; #Einstein lattice specific heat(J/mol/K)\nC_V = C_V/3;\nC_V = math.ceil(C_V*10**3)/10**3; #rounding off the value of C_V to 3 decimals\n\n#Result\nprint \"The Einstein lattice specific heat is\",C_V, \"X 3R\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "T = 1; #For simplicity assume temperature to be unity(K)\n",
+ "R = 1; #For simplicity assume molar gas constant to be unity(J/mol/K)\n",
+ "theta_E = T; #Einstein temperature(K)\n",
+ "\n",
+ "#Calculation\n",
+ "C_V = 3*R*(theta_E/T)**2*math.exp(theta_E/T)/(math.exp(theta_E/T)-1)**2; #Einstein lattice specific heat(J/mol/K)\n",
+ "C_V = C_V/3;\n",
+ "C_V = math.ceil(C_V*10**3)/10**3; #rounding off the value of C_V to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The Einstein lattice specific heat is\",C_V, \"X 3R\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Einstein lattice specific heat is 0.921 X 3R\n"
+ "text": [
+ "The Einstein lattice specific heat is 0.921 X 3R\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +245,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.6, Page number 324"
+ "source": [
+ "Example number 15.6, Page number 324"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the molar electronic heat capacity\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nv = 2; #Valency of Zn atom\nN = v*6.02*10**23; #Avogadro's number(per mol)\nT = 300; #Temperature of Zn(K)\nE_F = 9.38; #Fermi energy of Zn(eV)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\n\n#Calculation\nN = v*6.02*10**23; #Avogadro's number(per mol)\nC_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Zn(J/mol/K)\nC_e = math.ceil(C_e*10**4)/10**4; #rounding off the value of C_e to 4 decimals\n\n#Result\nprint \"The molar electronic heat capacity of zinc is\",C_e, \"J/mol/K\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "v = 2; #Valency of Zn atom\n",
+ "N = v*6.02*10**23; #Avogadro's number(per mol)\n",
+ "T = 300; #Temperature of Zn(K)\n",
+ "E_F = 9.38; #Fermi energy of Zn(eV)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "\n",
+ "#Calculation\n",
+ "N = v*6.02*10**23; #Avogadro's number(per mol)\n",
+ "C_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Zn(J/mol/K)\n",
+ "C_e = math.ceil(C_e*10**4)/10**4; #rounding off the value of C_e to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The molar electronic heat capacity of zinc is\",C_e, \"J/mol/K\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The molar electronic heat capacity of zinc is 0.2262 J/mol/K\n"
+ "text": [
+ "The molar electronic heat capacity of zinc is 0.2262 J/mol/K\n"
+ ]
}
],
"prompt_number": 8
@@ -142,7 +291,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter17_1.ipynb b/Engineering_Physics/Chapter17_1.ipynb
index f0df2691..38e069ca 100644
--- a/Engineering_Physics/Chapter17_1.ipynb
+++ b/Engineering_Physics/Chapter17_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter17"
+ "name": "",
+ "signature": "sha256:8879a312d81dca096153a38216868ea90a0e18845d7af1e07069b08fc5353d2b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "17: Ultrasonics"
+ "source": [
+ "17: Ultrasonics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 17.1, Page number 352"
+ "source": [
+ "Example number 17.1, Page number 352"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the thickness of vibrating quartz\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nf = 3; #Fundamental vibrational frequency of quartz crystal(MHz)\nY = 7.9*10**10; #Young's modulus of quartz(N/m**2)\nrho = 2650; #Density of quartz(kg/m**3)\n\n#Calculation\nf = f*10**6; #Fundamental vibrational frequency of quartz crystal(Hz)\nl = 1/(2*f)*math.sqrt(Y/rho); #Thickness of vibrating quartz at resonance(m)\nl = l*10**3; #Thickness of vibrating quartz at resonance(mm)\nl = math.ceil(l*100)/100; #rounding off the value of l to 2 decimals\n\n#Result\nprint \"The thickness of vibrating quartz at resonance is\",l, \"mm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "f = 3; #Fundamental vibrational frequency of quartz crystal(MHz)\n",
+ "Y = 7.9*10**10; #Young's modulus of quartz(N/m**2)\n",
+ "rho = 2650; #Density of quartz(kg/m**3)\n",
+ "\n",
+ "#Calculation\n",
+ "f = f*10**6; #Fundamental vibrational frequency of quartz crystal(Hz)\n",
+ "l = 1/(2*f)*math.sqrt(Y/rho); #Thickness of vibrating quartz at resonance(m)\n",
+ "l = l*10**3; #Thickness of vibrating quartz at resonance(mm)\n",
+ "l = math.ceil(l*100)/100; #rounding off the value of l to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The thickness of vibrating quartz at resonance is\",l, \"mm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The thickness of vibrating quartz at resonance is 0.91 mm\n"
+ "text": [
+ "The thickness of vibrating quartz at resonance is 0.91 mm\n"
+ ]
}
],
"prompt_number": 1
@@ -37,7 +63,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter18_1.ipynb b/Engineering_Physics/Chapter18_1.ipynb
index aca20375..0a7b2021 100644
--- a/Engineering_Physics/Chapter18_1.ipynb
+++ b/Engineering_Physics/Chapter18_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter18"
+ "name": "",
+ "signature": "sha256:3bec68600cdf231538bf44a09963d76f89f72c71634091075e5c4136c75bb4a6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "18: Acoustics of Buildings"
+ "source": [
+ "18: Acoustics of Buildings"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.1, Page number 361"
+ "source": [
+ "Example number 18.1, Page number 361"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the output power of the sound source\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nr = 200; #Distance of the point of reduction from the source(m)\nI_0 = 10**-12; #Final intensity of sound(W/m**2)\nI_f = 60; #Intensity gain of sound at the point of reduction(dB)\n\n#Calculation\n#As A_I = 10*log10(I/I_0), solving for I\nI = I_0*10**(I_f/10); #Initial Intensity of sound(W/m**2)\nP = 4*math.pi*r**2*I; #Output power of the sound source(W)\nP = math.ceil(P*100)/100; #rounding off the value of P to 2 decimals\n\n#Result\nprint \"The output power of the sound source is\",P, \"W\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "r = 200; #Distance of the point of reduction from the source(m)\n",
+ "I_0 = 10**-12; #Final intensity of sound(W/m**2)\n",
+ "I_f = 60; #Intensity gain of sound at the point of reduction(dB)\n",
+ "\n",
+ "#Calculation\n",
+ "#As A_I = 10*log10(I/I_0), solving for I\n",
+ "I = I_0*10**(I_f/10); #Initial Intensity of sound(W/m**2)\n",
+ "P = 4*math.pi*r**2*I; #Output power of the sound source(W)\n",
+ "P = math.ceil(P*100)/100; #rounding off the value of P to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The output power of the sound source is\",P, \"W\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The output power of the sound source is 0.51 W\n"
+ "text": [
+ "The output power of the sound source is 0.51 W\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +64,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.2, Page number 361"
+ "source": [
+ "Example number 18.2, Page number 361"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the change in sound level\n\n#importing modules\nimport math\nfrom __future__ import division\nimport numpy as np\n\n#Variable declaration\nI1 = 1; #For simplicity assume first intensity level to be unity(W/m**2)\n\n#Calculation\nI2 = 2*I1; #Intensity level after doubling(W/m**2)\ndA_I = 10*np.log10(I2/I1); #Difference in gain level(dB)\n\n#Result\nprint \"The sound intensity level is increased by\",int(dA_I), \"dB\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "I1 = 1; #For simplicity assume first intensity level to be unity(W/m**2)\n",
+ "\n",
+ "#Calculation\n",
+ "I2 = 2*I1; #Intensity level after doubling(W/m**2)\n",
+ "dA_I = 10*np.log10(I2/I1); #Difference in gain level(dB)\n",
+ "\n",
+ "#Result\n",
+ "print \"The sound intensity level is increased by\",int(dA_I), \"dB\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sound intensity level is increased by 3 dB\n"
+ "text": [
+ "The sound intensity level is increased by 3 dB\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +105,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.3, Page number 361"
+ "source": [
+ "Example number 18.3, Page number 361"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the total absorption of sound in the hall\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nV = 8000; #Volume of the hall(m**3)\nT = 1.5; #Reverbration time of the hall(s)\n\n#Calculation\nalpha_s = 0.167*V/T; #Sabine Formula giving total absorption of sound in the hall(OWU)\nalpha_s = math.ceil(alpha_s*10)/10; #rounding off the value of alpha_s to 1 decimal\n\n#Result\nprint \"The total absorption of sound in the hall is\",alpha_s, \"OWU\"\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 8000; #Volume of the hall(m**3)\n",
+ "T = 1.5; #Reverbration time of the hall(s)\n",
+ "\n",
+ "#Calculation\n",
+ "alpha_s = 0.167*V/T; #Sabine Formula giving total absorption of sound in the hall(OWU)\n",
+ "alpha_s = math.ceil(alpha_s*10)/10; #rounding off the value of alpha_s to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The total absorption of sound in the hall is\",alpha_s, \"OWU\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The total absorption of sound in the hall is 890.7 OWU\n"
+ "text": [
+ "The total absorption of sound in the hall is 890.7 OWU\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +146,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.4, Page number 362"
+ "source": [
+ "Example number 18.4, Page number 362"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the average absorption coefficient of the surfaces\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nV = 25*20*8; #Volume of the hall(m**3)\nT = 4; #Reverbration time of the hall(s)\n\n#Calculation\nS = 2*(25*20+25*8+20*8); #Total surface area of the hall(m**2)\nalpha = 0.167*V/(T*S); #Sabine Formule giving total absorption in the hall(OWU)\nalpha = math.ceil(alpha*10**4)/10**4; #rounding off the value of alpha to 4 decimals\n\n#Result\nprint \"The average absorption coefficient of the surfaces is\",alpha, \"OWU/m**2\"\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 25*20*8; #Volume of the hall(m**3)\n",
+ "T = 4; #Reverbration time of the hall(s)\n",
+ "\n",
+ "#Calculation\n",
+ "S = 2*(25*20+25*8+20*8); #Total surface area of the hall(m**2)\n",
+ "alpha = 0.167*V/(T*S); #Sabine Formule giving total absorption in the hall(OWU)\n",
+ "alpha = math.ceil(alpha*10**4)/10**4; #rounding off the value of alpha to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The average absorption coefficient of the surfaces is\",alpha, \"OWU/m**2\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The average absorption coefficient of the surfaces is 0.0971 OWU/m**2\n"
+ "text": [
+ "The average absorption coefficient of the surfaces is 0.0971 OWU/m**2\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +188,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.5, Page number 362"
+ "source": [
+ "Example number 18.5, Page number 362"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the reverbration time for the hall\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nV = 475; #Volume of the hall(m**3)\nA_f = 100; #Area of the floor(m**2)\nA_c = 100; #Area of the ceiling(m**2)\nA_w = 200; #Area of the wall(m**2)\nalpha_w = 0.025; #Absorption coefficients of the wall(OWU/m**2)\nalpha_c = 0.02; #Absorption coefficients of the ceiling(OWU/m**2)\nalpha_f = 0.55; #Absorption coefficients of the floor(OWU/m**2)\n\n#Calculation\nalpha_s = (A_w*alpha_w)+(A_c*alpha_c)+(A_f*alpha_f); \nT = 0.167*V/alpha_s; #Sabine Formula for reverbration time(s)\nT = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n\n#Result\nprint \"The reverbration time for the hall is\",T, \"s\"\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 475; #Volume of the hall(m**3)\n",
+ "A_f = 100; #Area of the floor(m**2)\n",
+ "A_c = 100; #Area of the ceiling(m**2)\n",
+ "A_w = 200; #Area of the wall(m**2)\n",
+ "alpha_w = 0.025; #Absorption coefficients of the wall(OWU/m**2)\n",
+ "alpha_c = 0.02; #Absorption coefficients of the ceiling(OWU/m**2)\n",
+ "alpha_f = 0.55; #Absorption coefficients of the floor(OWU/m**2)\n",
+ "\n",
+ "#Calculation\n",
+ "alpha_s = (A_w*alpha_w)+(A_c*alpha_c)+(A_f*alpha_f); \n",
+ "T = 0.167*V/alpha_s; #Sabine Formula for reverbration time(s)\n",
+ "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The reverbration time for the hall is\",T, \"s\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The reverbration time for the hall is 1.28 s\n"
+ "text": [
+ "The reverbration time for the hall is 1.28 s\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +235,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.6, Page number 362"
+ "source": [
+ "Example number 18.6, Page number 362"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the reverbration time for the hall\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nI0 = 1; #For simplicity assume initial sound intensity to be unity(W/m**2)\nA_I1 = 80; #First intensity gain of sound(dB)\nA_I2 = 70; #Second intensity gain of sound(dB)\n\n#Calculation\n#As A_I = 10*log10(I/I_0), solving for I1 and I2\nI1 = 10**(A_I1/10)*I0; #First intensity of sound(W/m**2)\nI2 = 10**(A_I2/10)*I0; #Second intensity of sound(W/m**2)\nI = I1 + I2; #Resultant intensity level of sound(W/m**2)\nA_I = 10*np.log10(I/I0); #Intensity gain of resultant sound(dB)\nA_I = math.ceil(A_I*10**3)/10**3; #rounding off the value of A_I to 3 decimals\n\n#Result\nprint \"The intensity gain of resultant sound is\",A_I, \"dB\"\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "I0 = 1; #For simplicity assume initial sound intensity to be unity(W/m**2)\n",
+ "A_I1 = 80; #First intensity gain of sound(dB)\n",
+ "A_I2 = 70; #Second intensity gain of sound(dB)\n",
+ "\n",
+ "#Calculation\n",
+ "#As A_I = 10*log10(I/I_0), solving for I1 and I2\n",
+ "I1 = 10**(A_I1/10)*I0; #First intensity of sound(W/m**2)\n",
+ "I2 = 10**(A_I2/10)*I0; #Second intensity of sound(W/m**2)\n",
+ "I = I1 + I2; #Resultant intensity level of sound(W/m**2)\n",
+ "A_I = 10*np.log10(I/I0); #Intensity gain of resultant sound(dB)\n",
+ "A_I = math.ceil(A_I*10**3)/10**3; #rounding off the value of A_I to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The intensity gain of resultant sound is\",A_I, \"dB\"\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The intensity gain of resultant sound is 80.414 dB\n"
+ "text": [
+ "The intensity gain of resultant sound is 80.414 dB\n"
+ ]
}
],
"prompt_number": 7
@@ -142,7 +282,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter1_1.ipynb b/Engineering_Physics/Chapter1_1.ipynb
index c487a981..9c835441 100644
--- a/Engineering_Physics/Chapter1_1.ipynb
+++ b/Engineering_Physics/Chapter1_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter1"
+ "name": "",
+ "signature": "sha256:078983e30b4c728fb3bac2d9363145a8f1fffb1522bc3df76d2595e630af4298"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,51 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "1: Oscillations and Waves"
+ "source": [
+ "1: Oscillations and Waves"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.1, Page number 23"
+ "source": [
+ "Example number 1.1, Page number 23"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the period of motion\n\n#import modules\nimport math\n\n#Variable declaration\nS=4; #SHM described by a particle(cm)\nx=0; #mean position\nv=12; #velocity at mean position(cm/s)\n\n#Calculation\nA=S/2; #amplitude of motion(cm)\nomega=v/A; #angular frequency(sec-1)\nT=(2*math.pi)/omega; #time period(sec)\nT=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint \"time period of motion is\",T, \"sec\"\nprint \"time period of motion is pi/3 sec\"",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "S=4; #SHM described by a particle(cm)\n",
+ "x=0; #mean position\n",
+ "v=12; #velocity at mean position(cm/s)\n",
+ "\n",
+ "#Calculation\n",
+ "A=S/2; #amplitude of motion(cm)\n",
+ "omega=v/A; #angular frequency(sec-1)\n",
+ "T=(2*math.pi)/omega; #time period(sec)\n",
+ "T=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"time period of motion is\",T, \"sec\"\n",
+ "print \"time period of motion is pi/3 sec\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "time period of motion is 1.048 sec\ntime period of motion is pi/3 sec\n"
+ "text": [
+ "time period of motion is 1.048 sec\n",
+ "time period of motion is pi/3 sec\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +65,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.2, Page number 23"
+ "source": [
+ "Example number 1.2, Page number 23"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the acceleration and maximum velocity\n\n#import modules\nimport math\n\n#Variable declaration\nT=0.1; #time period(sec)\nA=4; #amplitude of motion(cm)\nx=0.2; #distance from mean position(cm)\n\n#Calculation\nomega=(2*math.pi)/T; #angular frequency(sec-1)\na=(omega**2)*x; #acceleration(cm/sec^2)\na=math.ceil(a*10**2)/10**2; #rounding off to 2 decimals\n#maximum velocity is when particle is in the mean position\nv_max=omega*A; #maximum velocity(cm/sec)\nv_max=math.ceil(v_max*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint \"acceleration is\",a, \"cm/sec^2\"\nprint \"maximum velocity is\",v_max, \"cm/sec\"\n\n#answers given in the book are wrong",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T=0.1; #time period(sec)\n",
+ "A=4; #amplitude of motion(cm)\n",
+ "x=0.2; #distance from mean position(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "omega=(2*math.pi)/T; #angular frequency(sec-1)\n",
+ "a=(omega**2)*x; #acceleration(cm/sec^2)\n",
+ "a=math.ceil(a*10**2)/10**2; #rounding off to 2 decimals\n",
+ "#maximum velocity is when particle is in the mean position\n",
+ "v_max=omega*A; #maximum velocity(cm/sec)\n",
+ "v_max=math.ceil(v_max*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"acceleration is\",a, \"cm/sec^2\"\n",
+ "print \"maximum velocity is\",v_max, \"cm/sec\"\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "acceleration is 789.57 cm/sec^2\nmaximum velocity is 251.33 cm/sec\n"
+ "text": [
+ "acceleration is 789.57 cm/sec^2\n",
+ "maximum velocity is 251.33 cm/sec\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +114,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.3, Page number 24"
+ "source": [
+ "Example number 1.3, Page number 24"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the damping constant\n\n#import modules\nimport math\nimport numpy as np\n\n#Variable declaration\nA1 = 40; #First amplitude of oscillation(cm)\nAn_plus_1 = 4; #Amplitude after 100 oscillations(cm)\nn = 100; #Number of oscillations\nT = 2.5; #Time period of oscillations(s)\n\n#Calculation\nt = T/4; #Time taken to reach the first amplitude from the mean position(s)\n#Now A1 = x0*math.exp(-lambda*t) and An_plus_1 = x0*math.exp(-lambda*(t+nT))\n#A1/An_plus_1 = math.exp(n*lambda*T)\nx=A1/An_plus_1;\nlamda=np.log(x)/(n*T); #Damping constant(per sec)\nlamda=lamda*10**2;\nlamda=math.ceil(lamda*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint \"Damping constant is\",lamda,\"*10**-2 per sec\"",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "A1 = 40; #First amplitude of oscillation(cm)\n",
+ "An_plus_1 = 4; #Amplitude after 100 oscillations(cm)\n",
+ "n = 100; #Number of oscillations\n",
+ "T = 2.5; #Time period of oscillations(s)\n",
+ "\n",
+ "#Calculation\n",
+ "t = T/4; #Time taken to reach the first amplitude from the mean position(s)\n",
+ "#Now A1 = x0*math.exp(-lambda*t) and An_plus_1 = x0*math.exp(-lambda*(t+nT))\n",
+ "#A1/An_plus_1 = math.exp(n*lambda*T)\n",
+ "x=A1/An_plus_1;\n",
+ "lamda=np.log(x)/(n*T); #Damping constant(per sec)\n",
+ "lamda=lamda*10**2;\n",
+ "lamda=math.ceil(lamda*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"Damping constant is\",lamda,\"*10**-2 per sec\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Damping constant is 0.922 *10**-2 per sec\n"
+ "text": [
+ "Damping constant is 0.922 *10**-2 per sec\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +162,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.4, Page number 24"
+ "source": [
+ "Example number 1.4, Page number 24"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the amplitude and period of oscillation\n\n#import modules\nimport math\n\n#Variable declaration\nx1 = 3; #First position of the particle(cm)\nx2 = 4; #Second position of the particle(cm)\nv1 = 16; #Velocity of particle executing SHM at 1st position(cm/s)\nv2 = 12; #Velocity of particle executing SHM at 2nd position (cm/s)\n\n#Calculation\n#As v = omega*sqrt(A**2 - x**2) so\n#(v1/v2)**2=(A**2 - x1**2)/(A**2 - x2**2)\n#RHS gives (A**2-9)/(A**2-16)\n#(v2**2)*(A**2 - x1**2)=(v1**2)*(A**2 - x2**2), on solving we get\nA=math.sqrt((((v1**2)*(x2**2))-((v2**2)*(x1**2)))/((v1**2)-(v2**2))); #amplitude in cm\nomega=v1/math.sqrt(A**2-x1**2); #Angular speed of the particle(per sec)\nT=2*math.pi/omega; #Time period of oscillation(sec)\nT=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint \"The amplitude of SHM is\",A, \"cm\"\nprint \"The time period of oscillation is\",T, \"sec\"",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "x1 = 3; #First position of the particle(cm)\n",
+ "x2 = 4; #Second position of the particle(cm)\n",
+ "v1 = 16; #Velocity of particle executing SHM at 1st position(cm/s)\n",
+ "v2 = 12; #Velocity of particle executing SHM at 2nd position (cm/s)\n",
+ "\n",
+ "#Calculation\n",
+ "#As v = omega*sqrt(A**2 - x**2) so\n",
+ "#(v1/v2)**2=(A**2 - x1**2)/(A**2 - x2**2)\n",
+ "#RHS gives (A**2-9)/(A**2-16)\n",
+ "#(v2**2)*(A**2 - x1**2)=(v1**2)*(A**2 - x2**2), on solving we get\n",
+ "A=math.sqrt((((v1**2)*(x2**2))-((v2**2)*(x1**2)))/((v1**2)-(v2**2))); #amplitude in cm\n",
+ "omega=v1/math.sqrt(A**2-x1**2); #Angular speed of the particle(per sec)\n",
+ "T=2*math.pi/omega; #Time period of oscillation(sec)\n",
+ "T=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The amplitude of SHM is\",A, \"cm\"\n",
+ "print \"The time period of oscillation is\",T, \"sec\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The amplitude of SHM is 5.0 cm\nThe time period of oscillation is 1.571 sec\n"
+ "text": [
+ "The amplitude of SHM is 5.0 cm\n",
+ "The time period of oscillation is 1.571 sec\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +212,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.5, Page number 25"
+ "source": [
+ "Example number 1.5, Page number 25"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the spring constant, amplitude and maximum velocity\n\n#import modules\nimport math\n\n#Variable declaration\nm = 0.3; #Mass attached to the string(kg)\ng = 9.8; #Acceleration due to gravity(m/sec**2)\nx = 0.15; #Stretchness produced in the spring(m)\ns = 0.1; #spring is stretched and released(m)\n\n#Calculation\nF = m*g; #Restoring force acting on the mass(N)\nk = F/x; #Spring constant(N/m)\nA = s; #amplitude equals to the spring stretched and released\nomega = math.sqrt(k/m); #Angular frequency of oscillation(rad per sec)\nv0 = omega*A; #Maximum velocity during the oscillations(m/s)\nv0=math.ceil(v0*100)/100; #rounding off to 2 decimals\n\n#Result\nprint \"The spring constant is\",k, \"N/m\"\nprint \"The amplitude of oscillation is\",A, \"m\"\nprint \"The maximum velocity during oscillations is\",v0, \"m/s\"",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "m = 0.3; #Mass attached to the string(kg)\n",
+ "g = 9.8; #Acceleration due to gravity(m/sec**2)\n",
+ "x = 0.15; #Stretchness produced in the spring(m)\n",
+ "s = 0.1; #spring is stretched and released(m)\n",
+ "\n",
+ "#Calculation\n",
+ "F = m*g; #Restoring force acting on the mass(N)\n",
+ "k = F/x; #Spring constant(N/m)\n",
+ "A = s; #amplitude equals to the spring stretched and released\n",
+ "omega = math.sqrt(k/m); #Angular frequency of oscillation(rad per sec)\n",
+ "v0 = omega*A; #Maximum velocity during the oscillations(m/s)\n",
+ "v0=math.ceil(v0*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The spring constant is\",k, \"N/m\"\n",
+ "print \"The amplitude of oscillation is\",A, \"m\"\n",
+ "print \"The maximum velocity during oscillations is\",v0, \"m/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The spring constant is 19.6 N/m\nThe amplitude of oscillation is 0.1 m\nThe maximum velocity during oscillations is 0.81 m/s\n"
+ "text": [
+ "The spring constant is 19.6 N/m\n",
+ "The amplitude of oscillation is 0.1 m\n",
+ "The maximum velocity during oscillations is 0.81 m/s\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +262,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.6, Page number 25"
+ "source": [
+ "Example number 1.6, Page number 25"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the frequency equivalent of visible region\n\n#import modules\nimport math\n\n#Variable declaration\nlambda1 = 400; #Lower limit of wavelength of visible region(nm)\nlambda2 = 700; #Upper limit of wavelength of visible region(nm)\nc = 3*10**8; #Speed of light in vacuum(m/s)\n\n#Calculation\nlambda1 = lambda1*10**-9 #Lower limit of wavelength(m) \nlambda2 = lambda2*10**-9 #upper limit of wavelength(m) \nnew_1 = c/lambda1; #Upper limit of frequency of visible region(m)\nnew_2 = c/lambda2; #Lower limit of frequency of visible region(m)\n\n#Result\nprint \"The frequency equivalent of 400 nm is\",new_1, \"Hz\"\nprint \"The frequency equivalent of 700 nm is\",new_2, \"Hz\"\n",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lambda1 = 400; #Lower limit of wavelength of visible region(nm)\n",
+ "lambda2 = 700; #Upper limit of wavelength of visible region(nm)\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "lambda1 = lambda1*10**-9 #Lower limit of wavelength(m) \n",
+ "lambda2 = lambda2*10**-9 #upper limit of wavelength(m) \n",
+ "new_1 = c/lambda1; #Upper limit of frequency of visible region(m)\n",
+ "new_2 = c/lambda2; #Lower limit of frequency of visible region(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The frequency equivalent of 400 nm is\",new_1, \"Hz\"\n",
+ "print \"The frequency equivalent of 700 nm is\",new_2, \"Hz\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The frequency equivalent of 400 nm is 7.5e+14 Hz\nThe frequency equivalent of 700 nm is 4.28571428571e+14 Hz\n"
+ "text": [
+ "The frequency equivalent of 400 nm is 7.5e+14 Hz\n",
+ "The frequency equivalent of 700 nm is 4.28571428571e+14 Hz\n"
+ ]
}
],
"prompt_number": 9
@@ -143,19 +307,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.7, Page number 26"
+ "source": [
+ "Example number 1.7, Page number 26"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the amplitude, wavelength, frequency and velocity of the wave\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\n#Comparing the standard equation u(x,t) = A*sin(2*%pi(x/lambda-t/T)) with the given equation, we get\nA = 1.5*10**-3; #Amplitude of the sound wave(m)\nlamda = 8; #Wavelength of the sound wave(m)\nT = 1/40; #Time period of the sound wave(s)\n\n#Calculation\nA = A*10**3;\nnew = 1/T; #Frequency of the sound wave(Hz)\nv = new*lamda; #Velocity of the sound wave(m/s)\nT=math.ceil(T*100)/100; #rounding off to 2 decimals\n\n#Result\nprint \"The amplitude of the sound wave is\",A,\"*10**-3 m\"\nprint \"The wavelength of the sound wave is\",lamda, \"m\"\nprint \"The time period of the sound wave is\",T, \"s\"\nprint \"The frequency of the sound wave is\",new, \"Hz\"\nprint \"The velocity of the sound wave is\",v, \"m/s\"",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "#Comparing the standard equation u(x,t) = A*sin(2*%pi(x/lambda-t/T)) with the given equation, we get\n",
+ "A = 1.5*10**-3; #Amplitude of the sound wave(m)\n",
+ "lamda = 8; #Wavelength of the sound wave(m)\n",
+ "T = 1/40; #Time period of the sound wave(s)\n",
+ "\n",
+ "#Calculation\n",
+ "A = A*10**3;\n",
+ "new = 1/T; #Frequency of the sound wave(Hz)\n",
+ "v = new*lamda; #Velocity of the sound wave(m/s)\n",
+ "T=math.ceil(T*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The amplitude of the sound wave is\",A,\"*10**-3 m\"\n",
+ "print \"The wavelength of the sound wave is\",lamda, \"m\"\n",
+ "print \"The time period of the sound wave is\",T, \"s\"\n",
+ "print \"The frequency of the sound wave is\",new, \"Hz\"\n",
+ "print \"The velocity of the sound wave is\",v, \"m/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The amplitude of the sound wave is 1.5 *10**-3 m\nThe wavelength of the sound wave is 8 m\nThe time period of the sound wave is 0.03 s\nThe frequency of the sound wave is 40.0 Hz\nThe velocity of the sound wave is 320.0 m/s\n"
+ "text": [
+ "The amplitude of the sound wave is 1.5 *10**-3 m\n",
+ "The wavelength of the sound wave is 8 m\n",
+ "The time period of the sound wave is 0.03 s\n",
+ "The frequency of the sound wave is 40.0 Hz\n",
+ "The velocity of the sound wave is 320.0 m/s\n"
+ ]
}
],
"prompt_number": 12
@@ -164,19 +360,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.8, Page number 26"
+ "source": [
+ "Example number 1.8, Page number 26"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the equation of a wave\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nA = 2; #Amplitude of the wave(cm)\nT = 0.5; #Time period of the wave(sec)\nv = 200; #Wave velocity(cm/s)\n\n#Calculation\nf = 1/T; #Frequency of the wave(Hz)\nlamda = v/f; #Wavelength of the wave(cm)\n\n#Result\nprint \"frequency of wave is\",f, \"Hz\"\nprint \"wavelength of wave is\",lamda, \"cm\"\nprint \"The Equation of the wave moving along X-axis :\"\nprint \"u = \",A,\"*sin*2*math.pi*(x/\",lamda,\"- t/\",T,\")\" #x and y are in cm and t is in sec",
+ "input": [
+ "\n",
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "A = 2; #Amplitude of the wave(cm)\n",
+ "T = 0.5; #Time period of the wave(sec)\n",
+ "v = 200; #Wave velocity(cm/s)\n",
+ "\n",
+ "#Calculation\n",
+ "f = 1/T; #Frequency of the wave(Hz)\n",
+ "lamda = v/f; #Wavelength of the wave(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"frequency of wave is\",f, \"Hz\"\n",
+ "print \"wavelength of wave is\",lamda, \"cm\"\n",
+ "print \"The Equation of the wave moving along X-axis :\"\n",
+ "print \"u = \",A,\"*sin*2*math.pi*(x/\",lamda,\"- t/\",T,\")\" #x and y are in cm and t is in sec"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "frequency of wave is 2.0 Hz\nwavelength of wave is 100.0 cm\nThe Equation of the wave moving along X-axis :\nu = 2 *sin*2*math.pi*(x/ 100.0 - t/ 0.5 )\n"
+ "text": [
+ "frequency of wave is 2.0 Hz\n",
+ "wavelength of wave is 100.0 cm\n",
+ "The Equation of the wave moving along X-axis :\n",
+ "u = 2 *sin*2*math.pi*(x/ 100.0 - t/ 0.5 )\n"
+ ]
}
],
"prompt_number": 13
@@ -185,19 +409,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.9, Page number 27"
+ "source": [
+ "Example number 1.9, Page number 27"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the velocity and frequency of the wave\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nT = 1000; #Tension in the wire(N)\nM=15; #mass of the wire(kg)\nl=300; #length of the wire(m)\nlamda = 0.30; #Wavelength of wave along wire(m)\n\n#Calculation\nm = M/l; #Mass per unit length of the wire(kg/m)\nv = math.sqrt(T/m); #Velocity of wave through wire(m/s)\nv=math.ceil(v*100)/100; #rounding off to 2 decimals\nnew = v/lamda; #Frequency of wave through string(Hz)\nnew=math.ceil(new*100)/100; #rounding off to 2 decimals\n\n#Result\nprint \"The velocity of the wave through wire is\",v, \"m/s\"\nprint \"The frequency of the wave through wire is\",new, \"Hz\"\n\n#answer for frequency of the wave is wrong in the textbook",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "T = 1000; #Tension in the wire(N)\n",
+ "M=15; #mass of the wire(kg)\n",
+ "l=300; #length of the wire(m)\n",
+ "lamda = 0.30; #Wavelength of wave along wire(m)\n",
+ "\n",
+ "#Calculation\n",
+ "m = M/l; #Mass per unit length of the wire(kg/m)\n",
+ "v = math.sqrt(T/m); #Velocity of wave through wire(m/s)\n",
+ "v=math.ceil(v*100)/100; #rounding off to 2 decimals\n",
+ "new = v/lamda; #Frequency of wave through string(Hz)\n",
+ "new=math.ceil(new*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The velocity of the wave through wire is\",v, \"m/s\"\n",
+ "print \"The frequency of the wave through wire is\",new, \"Hz\"\n",
+ "\n",
+ "#answer for frequency of the wave is wrong in the textbook"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The velocity of the wave through wire is 141.43 m/s\nThe frequency of the wave through wire is 471.44 Hz\n"
+ "text": [
+ "The velocity of the wave through wire is 141.43 m/s\n",
+ "The frequency of the wave through wire is 471.44 Hz\n"
+ ]
}
],
"prompt_number": 15
@@ -205,7 +458,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter2_1.ipynb b/Engineering_Physics/Chapter2_1.ipynb
index f002fd31..3d6c503f 100644
--- a/Engineering_Physics/Chapter2_1.ipynb
+++ b/Engineering_Physics/Chapter2_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter2"
+ "name": "",
+ "signature": "sha256:2693d83b10c8e62fc8d3ef78c9959c4d8327c36ed1f7884372585d33796bcbc3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,60 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "2: Electromagnetic Theory"
+ "source": [
+ "2: Electromagnetic Theory"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.1, Page number 46"
+ "source": [
+ "Example number 2.1, Page number 46"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To determine the peak value of displacement current\n\n#importing modules\nfrom __future__ import division\nfrom sympy import *\nimport math\n\n#Variable declaration\nC = 10; #Capacitance of the capacitor(pF)\n#given V=0.2*sin(120*math.pi*t) in volts\n\n#Calculation\nC=C*10**-12; #Capacitance of the capacitor(F)\nx, y, z, t = symbols('x y z t')\nk, m, n = symbols('k m n', integer=True)\nf, g, h = symbols('f g h', cls=Function)\n#I = C*dV/dt\n#let dV/dt be a\na=diff(0.2*sin(120*math.pi*t),t) #dV/dt\n#value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n#for cosine function peak value occurs when 120*math.pi*t = 0\n#therefore value of dV/dt becomes d = 75.398223686155\nd = 75.398223686155; #value of dV/dt \nI=C*d; #displacement current(A)\n\n#Result\nprint \"value of dV/dt is\",a\nprint \"displacement current is\",I, \"A\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "from sympy import *\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "C = 10; #Capacitance of the capacitor(pF)\n",
+ "#given V=0.2*sin(120*math.pi*t) in volts\n",
+ "\n",
+ "#Calculation\n",
+ "C=C*10**-12; #Capacitance of the capacitor(F)\n",
+ "x, y, z, t = symbols('x y z t')\n",
+ "k, m, n = symbols('k m n', integer=True)\n",
+ "f, g, h = symbols('f g h', cls=Function)\n",
+ "#I = C*dV/dt\n",
+ "#let dV/dt be a\n",
+ "a=diff(0.2*sin(120*math.pi*t),t) #dV/dt\n",
+ "#value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n",
+ "#for cosine function peak value occurs when 120*math.pi*t = 0\n",
+ "#therefore value of dV/dt becomes d = 75.398223686155\n",
+ "d = 75.398223686155; #value of dV/dt \n",
+ "I=C*d; #displacement current(A)\n",
+ "\n",
+ "#Result\n",
+ "print \"value of dV/dt is\",a\n",
+ "print \"displacement current is\",I, \"A\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "value of dV/dt is 75.398223686155*cos(376.991118430775*t)\ndisplacement current is 7.53982236862e-10 A\n"
+ "text": [
+ "value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n",
+ "displacement current is 7.53982236862e-10 A\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +74,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.2, Page number 46"
+ "source": [
+ "Example number 2.2, Page number 46"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the peak value of displacement current density in a good conductor\n\n#importing modules\nfrom __future__ import division\nfrom sympy import *\nimport math\n\n#Variable declaration\nepsilon_r = 1; #Relative electrical permittivity of free space\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n#given E=sin(120*math.pi*t) in volts\n\n#Calculation\nx, y, z, t = symbols('x y z t')\nk, m, n = symbols('k m n', integer=True)\nf, g, h = symbols('f g h', cls=Function)\n#J2 = epsilon*dE/dt\nepsilon=epsilon_0*epsilon_r;\n#let dE/dt be a\na=diff(sin(120*math.pi*t),t) #dE/dt\n#value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n#for cosine function peak value occurs when 120*math.pi*t = 0\n#therefore value of dE/dt becomes d = 376.991118430775\nd = 376.991118430775; #value of dE/dt\nJ2=epsilon*d; #displacement current density(A/m**2)\n\n#Result\nprint \"value of dE/dt is\",a\nprint \"The peak value of displacement current density is\",J2, \"A/m**2\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "from sympy import *\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_r = 1; #Relative electrical permittivity of free space\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "#given E=sin(120*math.pi*t) in volts\n",
+ "\n",
+ "#Calculation\n",
+ "x, y, z, t = symbols('x y z t')\n",
+ "k, m, n = symbols('k m n', integer=True)\n",
+ "f, g, h = symbols('f g h', cls=Function)\n",
+ "#J2 = epsilon*dE/dt\n",
+ "epsilon=epsilon_0*epsilon_r;\n",
+ "#let dE/dt be a\n",
+ "a=diff(sin(120*math.pi*t),t) #dE/dt\n",
+ "#value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n",
+ "#for cosine function peak value occurs when 120*math.pi*t = 0\n",
+ "#therefore value of dE/dt becomes d = 376.991118430775\n",
+ "d = 376.991118430775; #value of dE/dt\n",
+ "J2=epsilon*d; #displacement current density(A/m**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"value of dE/dt is\",a\n",
+ "print \"The peak value of displacement current density is\",J2, \"A/m**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "value of dE/dt is 376.991118430775*cos(376.991118430775*t)\nThe peak value of displacement current density is 3.33787936259e-09 A/m**2\n"
+ "text": [
+ "value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n",
+ "The peak value of displacement current density is 3.33787936259e-09 A/m**2\n"
+ ]
}
],
"prompt_number": 3
@@ -59,25 +129,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.3, Page number 47 (Theoritical proof)"
+ "source": [
+ "Example number 2.3, Page number 47 (Theoritical proof)"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.4, Page number 47"
+ "source": [
+ "Example number 2.4, Page number 47"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To determine the peak value of displacement current\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\np = 60; #Power rating of bulb(W)\nd = 0.5; #Distance from the bulb(m)\n\n#Calculation\nA=4*math.pi*d**2; #area(m**2)\nP = p/A; #Value of Poynting vector(W/m**2)\nP = math.ceil(P*100)/100; #rounding off value of P to 1 decimal\n\n#Result\nprint \"The value of Poynting vector is\",P, \"W/m**2\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "p = 60; #Power rating of bulb(W)\n",
+ "d = 0.5; #Distance from the bulb(m)\n",
+ "\n",
+ "#Calculation\n",
+ "A=4*math.pi*d**2; #area(m**2)\n",
+ "P = p/A; #Value of Poynting vector(W/m**2)\n",
+ "P = math.ceil(P*100)/100; #rounding off value of P to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The value of Poynting vector is\",P, \"W/m**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The value of Poynting vector is 19.1 W/m**2\n"
+ "text": [
+ "The value of Poynting vector is 19.1 W/m**2\n"
+ ]
}
],
"prompt_number": 4
@@ -86,19 +179,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.5, Page number 47"
+ "source": [
+ "Example number 2.5, Page number 47"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To determine the velocity of wave, intrinsic impedence and peak value of magnetic intensity\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nE_peak = 6; #Peak value of electric field intensity(V/m)\nc = 3*10**8; #Speed of electromagnetic wave in free space(m/s)\nmew_0 = 4*math.pi*10**-7; #Absolute permeability of free space(Tm/A)\nepsilon_0 = 8.854*10**-12; #Absolute permittivity of free space(F/m)\nmew_r = 1; #Relative permeability of medium\nepsilon_r = 3; #Relative permittivity of the medium\n\n#Calculation\nv = c/math.sqrt(mew_r*epsilon_r); #Wave velocity(m/s)\nv = v/10**8;\nv = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\neta = math.sqrt((mew_0/epsilon_0)*(mew_r/epsilon_r)); #Intrinsic impedance of the medium(ohm)\neta = math.ceil(eta*10)/10; #rounding off the value of v to 1 decimal\nH_P = E_peak/eta; #Peak value of the magnetic intensity(A/m)\nH_P = H_P*10**2;\nH_P = math.ceil(H_P*10**2)/10**2; #rounding off the value of v to 2 decimals\n\n#Result\nprint \"The wave velocity is\",v,\"*10**8 m/s\"\nprint \"The intrinsic impedance of the medium is\",eta, \"ohm\"\nprint \"The peak value of the magnetic intensity is\",H_P,\"*10**-2 A/m\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "E_peak = 6; #Peak value of electric field intensity(V/m)\n",
+ "c = 3*10**8; #Speed of electromagnetic wave in free space(m/s)\n",
+ "mew_0 = 4*math.pi*10**-7; #Absolute permeability of free space(Tm/A)\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute permittivity of free space(F/m)\n",
+ "mew_r = 1; #Relative permeability of medium\n",
+ "epsilon_r = 3; #Relative permittivity of the medium\n",
+ "\n",
+ "#Calculation\n",
+ "v = c/math.sqrt(mew_r*epsilon_r); #Wave velocity(m/s)\n",
+ "v = v/10**8;\n",
+ "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n",
+ "eta = math.sqrt((mew_0/epsilon_0)*(mew_r/epsilon_r)); #Intrinsic impedance of the medium(ohm)\n",
+ "eta = math.ceil(eta*10)/10; #rounding off the value of v to 1 decimal\n",
+ "H_P = E_peak/eta; #Peak value of the magnetic intensity(A/m)\n",
+ "H_P = H_P*10**2;\n",
+ "H_P = math.ceil(H_P*10**2)/10**2; #rounding off the value of v to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The wave velocity is\",v,\"*10**8 m/s\"\n",
+ "print \"The intrinsic impedance of the medium is\",eta, \"ohm\"\n",
+ "print \"The peak value of the magnetic intensity is\",H_P,\"*10**-2 A/m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wave velocity is 1.7321 *10**8 m/s\nThe intrinsic impedance of the medium is 217.6 ohm\nThe peak value of the magnetic intensity is 2.76 *10**-2 A/m\n"
+ "text": [
+ "The wave velocity is 1.7321 *10**8 m/s\n",
+ "The intrinsic impedance of the medium is 217.6 ohm\n",
+ "The peak value of the magnetic intensity is 2.76 *10**-2 A/m\n"
+ ]
}
],
"prompt_number": 11
@@ -106,7 +233,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter3_1.ipynb b/Engineering_Physics/Chapter3_1.ipynb
index e20ce99f..7f02f8be 100644
--- a/Engineering_Physics/Chapter3_1.ipynb
+++ b/Engineering_Physics/Chapter3_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter3"
+ "name": "",
+ "signature": "sha256:366ab969956cd234404db0091b17960805856ec3ff44007e36b0efdbe1414f5e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,51 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "3: Interference"
+ "source": [
+ "3: Interference"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.1, Page number 71"
+ "source": [
+ "Example number 3.1, Page number 71"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the velocity of light\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nbeta = 0.51; #Fringe width(mm)\nd = 2.2; #Distance between the slits(mm)\nD = 2; #Distance between the slits and the screen(m)\n\n#Calculation\nbeta = beta*10**-1; #Fringe width(cm)\nd = d*10**-1; #Distance between the slits(cm)\nD=D*10**2; #Distance between the slits and the screen(cm)\nlamda = beta*d/D; #Wavelength of light(cm)\nlamda = lamda*10**8; #Wavelength of light(A)\n\n#Result\nprint \"The wavelength of light is\",lamda, \"angstrom\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "beta = 0.51; #Fringe width(mm)\n",
+ "d = 2.2; #Distance between the slits(mm)\n",
+ "D = 2; #Distance between the slits and the screen(m)\n",
+ "\n",
+ "#Calculation\n",
+ "beta = beta*10**-1; #Fringe width(cm)\n",
+ "d = d*10**-1; #Distance between the slits(cm)\n",
+ "D=D*10**2; #Distance between the slits and the screen(cm)\n",
+ "lamda = beta*d/D; #Wavelength of light(cm)\n",
+ "lamda = lamda*10**8; #Wavelength of light(A)\n",
+ "\n",
+ "#Result\n",
+ "print \"The wavelength of light is\",lamda, \"angstrom\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wavelength of light is 5610.0 angstrom\n"
+ "text": [
+ "The wavelength of light is 5610.0 angstrom\n"
+ ]
}
],
"prompt_number": 4
@@ -38,19 +65,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.2, Page number 71"
+ "source": [
+ "Example number 3.2, Page number 71"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the seperation between the third fringe\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nlambda1 = 4250; #First wavelength emitted by source of light(A)\nlambda2 = 5050; #Second wavelength emitted by source of light(A)\nD = 1.5; #Distance between the source and the screen(m)\nd = 0.025; #Distance between the slits(mm)\nn = 3; #Number of fringe from the centre\n\n#Calculation\nlambda1 = lambda1*10**-10; #First wavelength emitted(m)\nlambda2 = lambda2*10**-10; #Second wavelength emitted(m)\nd = d*10**-3; #Distance between the slits(m)\nx3 = n*lambda1*D/d; #Position of third bright fringe due to lambda1(m)\nx3_prime = n*lambda2*D/d; #Position of third bright fringe due to lambda2(m)\nx = x3_prime-x3; #separation between the third bright fringe(m)\nx = x*10**2; #separation between the third bright fringe(cm)\n\n#Result\nprint \"The separation between the third bright fringe due to the two wavelengths is\",x, \"cm\"\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lambda1 = 4250; #First wavelength emitted by source of light(A)\n",
+ "lambda2 = 5050; #Second wavelength emitted by source of light(A)\n",
+ "D = 1.5; #Distance between the source and the screen(m)\n",
+ "d = 0.025; #Distance between the slits(mm)\n",
+ "n = 3; #Number of fringe from the centre\n",
+ "\n",
+ "#Calculation\n",
+ "lambda1 = lambda1*10**-10; #First wavelength emitted(m)\n",
+ "lambda2 = lambda2*10**-10; #Second wavelength emitted(m)\n",
+ "d = d*10**-3; #Distance between the slits(m)\n",
+ "x3 = n*lambda1*D/d; #Position of third bright fringe due to lambda1(m)\n",
+ "x3_prime = n*lambda2*D/d; #Position of third bright fringe due to lambda2(m)\n",
+ "x = x3_prime-x3; #separation between the third bright fringe(m)\n",
+ "x = x*10**2; #separation between the third bright fringe(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The separation between the third bright fringe due to the two wavelengths is\",x, \"cm\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The separation between the third bright fringe due to the two wavelengths is 1.44 cm\n"
+ "text": [
+ "The separation between the third bright fringe due to the two wavelengths is 1.44 cm\n"
+ ]
}
],
"prompt_number": 5
@@ -59,19 +114,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.3, Page number 71"
+ "source": [
+ "Example number 3.3, Page number 71"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the refractive index of the sheet of glass\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda = 5.5*10**-5; #Wavelength emitted by source of light(cm)\nn = 4; #Number of fringes shifted\nt = 3.9*10**-4; #Thickness of the thin glass sheet(cm)\n\n#Calculation\nmew = (n*lamda/t)+1; #Refractive index of the sheet of glass\nmew = math.ceil(mew*10**4)/10**4; #rounding off the value of v to 4 decimals\n\n#Result\nprint \"The refractive index of the sheet of glass is\",mew",
+ "input": [
+ " \n",
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 5.5*10**-5; #Wavelength emitted by source of light(cm)\n",
+ "n = 4; #Number of fringes shifted\n",
+ "t = 3.9*10**-4; #Thickness of the thin glass sheet(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "mew = (n*lamda/t)+1; #Refractive index of the sheet of glass\n",
+ "mew = math.ceil(mew*10**4)/10**4; #rounding off the value of v to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The refractive index of the sheet of glass is\",mew"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The refractive index of the sheet of glass is 1.5642\n"
+ "text": [
+ "The refractive index of the sheet of glass is 1.5642\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +156,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.4, Page number 72"
+ "source": [
+ "Example number 3.4, Page number 72"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the least thickness of the film that appears bright and dark\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda = 5893; #Wavelength of monochromatic lihgt used(A)\nn = 1; #Number of fringe for the least thickness of the film\ncosr = 1; #for normal incidence\nmew = 1.42; #refractive index of the soap film\n\n#Calculation\n#As for constructive interference, \n#2*mew*t*cos(r) = (2*n-1)*lambda/2, solving for t\nt = (2*n-1)*lamda/(4*mew*cosr); #Thickness of the film that appears bright(A)\n#As for destructive interference, \n#2*mu*t*cos(r) = n*lambda, solving for t\nt1 = n*lamda/(2*mew*cosr); #Thickness of the film that appears bright(A)\n\n#Result\nprint \"The thickness of the film that appears bright is\",t, \"angstrom\"\nprint \"The thickness of the film that appears dark is\",t1, \"angstrom\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 5893; #Wavelength of monochromatic lihgt used(A)\n",
+ "n = 1; #Number of fringe for the least thickness of the film\n",
+ "cosr = 1; #for normal incidence\n",
+ "mew = 1.42; #refractive index of the soap film\n",
+ "\n",
+ "#Calculation\n",
+ "#As for constructive interference, \n",
+ "#2*mew*t*cos(r) = (2*n-1)*lambda/2, solving for t\n",
+ "t = (2*n-1)*lamda/(4*mew*cosr); #Thickness of the film that appears bright(A)\n",
+ "#As for destructive interference, \n",
+ "#2*mu*t*cos(r) = n*lambda, solving for t\n",
+ "t1 = n*lamda/(2*mew*cosr); #Thickness of the film that appears bright(A)\n",
+ "\n",
+ "#Result\n",
+ "print \"The thickness of the film that appears bright is\",t, \"angstrom\"\n",
+ "print \"The thickness of the film that appears dark is\",t1, \"angstrom\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The thickness of the film that appears bright is 1037.5 angstrom\nThe thickness of the film that appears dark is 2075.0 angstrom\n"
+ "text": [
+ "The thickness of the film that appears bright is 1037.5 angstrom\n",
+ "The thickness of the film that appears dark is 2075.0 angstrom\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +204,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.5, Page number 72"
+ "source": [
+ "Example number 3.5, Page number 72"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle of the wedge\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda = 5893; #Wavelength of monochromatic lihgt used(A)\nn = 10; #Number of fringe that are found \nd = 1; #Distance of 10 fringes(cm)\n\n#Calculation\nbeta = d/n; #Fringe width(cm)\nlamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\ntheta = lamda/(2*beta); #Angle of the wedge(rad)\ntheta = theta*10**4;\ntheta = math.ceil(theta*10**4)/10**4; #rounding off the value of theta to 4 decimals\n\n#Result\nprint \"The angle of the wedge is\",theta,\"*10**-4 rad\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 5893; #Wavelength of monochromatic lihgt used(A)\n",
+ "n = 10; #Number of fringe that are found \n",
+ "d = 1; #Distance of 10 fringes(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "beta = d/n; #Fringe width(cm)\n",
+ "lamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\n",
+ "theta = lamda/(2*beta); #Angle of the wedge(rad)\n",
+ "theta = theta*10**4;\n",
+ "theta = math.ceil(theta*10**4)/10**4; #rounding off the value of theta to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The angle of the wedge is\",theta,\"*10**-4 rad\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The angle of the wedge is 2.9465 *10**-4 rad\n"
+ "text": [
+ "The angle of the wedge is 2.9465 *10**-4 rad\n"
+ ]
}
],
"prompt_number": 12
@@ -122,19 +248,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.6, Page number 72"
+ "source": [
+ "Example number 3.6, Page number 72"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the separation between consecutive bright fringes\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 5900; #Wavelength of monochromatic lihgt used(A)\nt = 0.010; #Spacer thickness(mm)\nl = 10; #Wedge length(cm)\n\n#Calculation\nt = t*10**-1; #Spacer thickness(cm)\ntheta = t/l; #Angle of the wedge(rad)\nlamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\nbeta = lamda/(2*theta); #Fringe width(cm)\n\n#Result\nprint \"The separation between consecutive bright fringes is\",beta, \"cm\"",
+ "input": [
+ " \n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 5900; #Wavelength of monochromatic lihgt used(A)\n",
+ "t = 0.010; #Spacer thickness(mm)\n",
+ "l = 10; #Wedge length(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "t = t*10**-1; #Spacer thickness(cm)\n",
+ "theta = t/l; #Angle of the wedge(rad)\n",
+ "lamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\n",
+ "beta = lamda/(2*theta); #Fringe width(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The separation between consecutive bright fringes is\",beta, \"cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The separation between consecutive bright fringes is 0.295 cm\n"
+ "text": [
+ "The separation between consecutive bright fringes is 0.295 cm\n"
+ ]
}
],
"prompt_number": 13
@@ -143,19 +291,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.7, Page number 72"
+ "source": [
+ "Example number 3.7, Page number 72"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the diameter of 20th dark ring\n\n#importing modules\nimport math\n\n#Variable declaration\nD4 = 0.4; #Diameter of 4th dark ring(cm)\nD12 = 0.7; #Diameter of 12th dark ring(cm)\n\n#Calculation\n#We have (dn_plus_k**2)-Dn**2 = 4*k*R*lamda\n#D12**2-D4**2 = 32*R*lamda and D20**2-D12**2 = 32*R*lamda for k = 8\n#since RHS are equal, by equating the LHS we get D12**2-D4**2 = D20**2-D12**2\nD20 = math.sqrt((2*D12**2)-D4**2); #Diameter of 20th dark ring(cm)\nD20 = math.ceil(D20*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n\n#Result\nprint \"The diameter of 20th dark ring is\",D20, \"cm\"",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "D4 = 0.4; #Diameter of 4th dark ring(cm)\n",
+ "D12 = 0.7; #Diameter of 12th dark ring(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "#We have (dn_plus_k**2)-Dn**2 = 4*k*R*lamda\n",
+ "#D12**2-D4**2 = 32*R*lamda and D20**2-D12**2 = 32*R*lamda for k = 8\n",
+ "#since RHS are equal, by equating the LHS we get D12**2-D4**2 = D20**2-D12**2\n",
+ "D20 = math.sqrt((2*D12**2)-D4**2); #Diameter of 20th dark ring(cm)\n",
+ "D20 = math.ceil(D20*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The diameter of 20th dark ring is\",D20, \"cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The diameter of 20th dark ring is 0.9056 cm\n"
+ "text": [
+ "The diameter of 20th dark ring is 0.9056 cm\n"
+ ]
}
],
"prompt_number": 14
@@ -164,19 +333,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.8, Page number 73"
+ "source": [
+ "Example number 3.8, Page number 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the refractive index of the liquid\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nDn = 0.30; #Diameter of nth dark ring with air film(cm)\ndn = 0.25; #Diameter of nth dark ring with liquid film(cm)\n\n#Calculation\nmew = (Dn/dn)**2; #Refractive index of the liquid\n\n#Result\nprint \"The refractive index of the liquid is\", mew\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Dn = 0.30; #Diameter of nth dark ring with air film(cm)\n",
+ "dn = 0.25; #Diameter of nth dark ring with liquid film(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "mew = (Dn/dn)**2; #Refractive index of the liquid\n",
+ "\n",
+ "#Result\n",
+ "print \"The refractive index of the liquid is\", mew\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The refractive index of the liquid is 1.44\n"
+ "text": [
+ "The refractive index of the liquid is 1.44\n"
+ ]
}
],
"prompt_number": 15
@@ -185,19 +373,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.9, Page number 73"
+ "source": [
+ "Example number 3.9, Page number 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of light\n\n#importing modules\nimport math\n\n#Variable declaration\nx = 0.002945; #Distance through which movable mirror is shifted(cm)\nN = 100; #Number of fringes shifted\n\n#Calculation\nx = x*10**-2; #Distance through which movable mirror is shifted(m)\nlamda = 2*x/N; #Wavelength of light(m)\nlamda = lamda*10**10; #Wavelength of light(A)\n\n#Result\nprint \"The wavelength of light is\",lamda, \"angstrom\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "x = 0.002945; #Distance through which movable mirror is shifted(cm)\n",
+ "N = 100; #Number of fringes shifted\n",
+ "\n",
+ "#Calculation\n",
+ "x = x*10**-2; #Distance through which movable mirror is shifted(m)\n",
+ "lamda = 2*x/N; #Wavelength of light(m)\n",
+ "lamda = lamda*10**10; #Wavelength of light(A)\n",
+ "\n",
+ "#Result\n",
+ "print \"The wavelength of light is\",lamda, \"angstrom\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wavelength of light is 5890.0 angstrom\n"
+ "text": [
+ "The wavelength of light is 5890.0 angstrom\n"
+ ]
}
],
"prompt_number": 16
@@ -206,19 +414,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.10, Page number 73"
+ "source": [
+ "Example number 3.10, Page number 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the shift in movable mirror\n\n#importing modules\nimport math\n\n#Variable declaration\nlambda1 = 5896; #Wavelength of D1 line of sodium(A)\nlambda2 = 5890; #Wavelength of D2 line of sodium(A)\n\n#Calculation\nlamda = (lambda1+lambda2)/2;\nx = (lamda**2)/(2*(lambda1-lambda2)); #Shift in movable mirror of Michelson Interferometer(A)\nx = x*10**-7; #Shift in movable mirror of Michelson Interferometer(mm)\nx = math.ceil(x*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n\n#Result\nprint \"The shift in movable mirror is\",x, \"mm\"",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lambda1 = 5896; #Wavelength of D1 line of sodium(A)\n",
+ "lambda2 = 5890; #Wavelength of D2 line of sodium(A)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = (lambda1+lambda2)/2;\n",
+ "x = (lamda**2)/(2*(lambda1-lambda2)); #Shift in movable mirror of Michelson Interferometer(A)\n",
+ "x = x*10**-7; #Shift in movable mirror of Michelson Interferometer(mm)\n",
+ "x = math.ceil(x*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The shift in movable mirror is\",x, \"mm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The shift in movable mirror is 0.2894 mm\n"
+ "text": [
+ "The shift in movable mirror is 0.2894 mm\n"
+ ]
}
],
"prompt_number": 17
@@ -226,7 +454,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter4_1.ipynb b/Engineering_Physics/Chapter4_1.ipynb
index 4cd8a196..c2e7944f 100644
--- a/Engineering_Physics/Chapter4_1.ipynb
+++ b/Engineering_Physics/Chapter4_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter4"
+ "name": "",
+ "signature": "sha256:bd975238ecc341317a545ed613e73ea0b105f0af115e6d7857237510924e96a0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,61 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "4: Diffraction"
+ "source": [
+ "4: Diffraction"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.1, Page number 91"
+ "source": [
+ "Example number 4.1, Page number 91"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the velocity of light\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nD = 50; #Distance between source and the screen(cm)\nlamda = 6563; #Wavelength of light of parallel rays(A)\nd = 0.385; #Width of the slit(mm)\nn1 = 1; #Order of diffraction for first minimum\nn2 = 5; #Order of diffraction for fifth minimum\n\n#Calculation\nlamda = lamda*10**-8; #Wavelength of light of parallel rays(cm)\nd = d*10**-1; #Width of the slit(cm)\n#As sin(theta1) = n*lambda/d = x1/D, solving for x1\nx1 = n1*lamda*D/d; #Distance from the centre of the principal maximum to the first minimum(cm)\nx1 = x1*10; #Distance from the centre of the principal maximum to the first minimum(mm)\nx1 = math.ceil(x1*10**3)/10**3; #rounding off the value of x1 to 3 decimals\nx2 = n2*lamda*D/d; #Distance from the centre of the principal maximum to the fifth minimum(cm)\nx2 = x2*10; #Distance from the centre of the principal maximum to the fifth minimum(mm)\nx2 = math.ceil(x2*10**3)/10**3; #rounding off the value of x2 to 3 decimals\n\n#Result\nprint \"The Distance from the centre of the principal maximum to the first minimum is\",x1, \"mm\"\nprint \"The Distance from the centre of the principal maximum to the fifth minimum is\",x2, \"mm\"\n\n#answer for x2 given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "D = 50; #Distance between source and the screen(cm)\n",
+ "lamda = 6563; #Wavelength of light of parallel rays(A)\n",
+ "d = 0.385; #Width of the slit(mm)\n",
+ "n1 = 1; #Order of diffraction for first minimum\n",
+ "n2 = 5; #Order of diffraction for fifth minimum\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-8; #Wavelength of light of parallel rays(cm)\n",
+ "d = d*10**-1; #Width of the slit(cm)\n",
+ "#As sin(theta1) = n*lambda/d = x1/D, solving for x1\n",
+ "x1 = n1*lamda*D/d; #Distance from the centre of the principal maximum to the first minimum(cm)\n",
+ "x1 = x1*10; #Distance from the centre of the principal maximum to the first minimum(mm)\n",
+ "x1 = math.ceil(x1*10**3)/10**3; #rounding off the value of x1 to 3 decimals\n",
+ "x2 = n2*lamda*D/d; #Distance from the centre of the principal maximum to the fifth minimum(cm)\n",
+ "x2 = x2*10; #Distance from the centre of the principal maximum to the fifth minimum(mm)\n",
+ "x2 = math.ceil(x2*10**3)/10**3; #rounding off the value of x2 to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The Distance from the centre of the principal maximum to the first minimum is\",x1, \"mm\"\n",
+ "print \"The Distance from the centre of the principal maximum to the fifth minimum is\",x2, \"mm\"\n",
+ "\n",
+ "#answer for x2 given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Distance from the centre of the principal maximum to the first minimum is 0.853 mm\nThe Distance from the centre of the principal maximum to the fifth minimum is 4.262 mm\n"
+ "text": [
+ "The Distance from the centre of the principal maximum to the first minimum is 0.853 mm\n",
+ "The Distance from the centre of the principal maximum to the fifth minimum is 4.262 mm\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +75,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.2, Page number 91"
+ "source": [
+ "Example number 4.2, Page number 91"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the radii of first two dark rings\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nD = 0.04; #Diameter of circular aperture(cm)\nf = 20; #Focal length of convex lens(cm)\nlamda = 6000; #Wavelength of light used(A)\n\n#Calculation\nlamda = lamda*10**-8; #Wavelength of light used(cm)\n#We have sin(theta) = 1.22*lambda/D = theta, for small theta\n#For first dark ring\ntheta = 1.22*lamda/D; #The half angular width at central maximum(rad)\nr1 = theta*f; #The half width of central maximum for first dark ring(cm)\nr1 = r1*10**2;\n#We have sin(theta) = 5.136*lambda/(%pi*D) = theta, for small theta\n#For second dark ring\ntheta = 5.136*lamda/(math.pi*D); #The half angular width at central maximum(rad)\nr2 = theta*f; #The half width of central maximum for second dark ring(cm)\nr2 = r2*10**2;\nr2 = math.ceil(r2*100)/100; #rounding off the value of r2 to 2 decimals\n\n#Result\nprint \"The radius of first dark ring is\",r1,\"*10**-2 cm\"\nprint \"The radius of second dark ring is\",r2,\"*10**-2 cm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "D = 0.04; #Diameter of circular aperture(cm)\n",
+ "f = 20; #Focal length of convex lens(cm)\n",
+ "lamda = 6000; #Wavelength of light used(A)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-8; #Wavelength of light used(cm)\n",
+ "#We have sin(theta) = 1.22*lambda/D = theta, for small theta\n",
+ "#For first dark ring\n",
+ "theta = 1.22*lamda/D; #The half angular width at central maximum(rad)\n",
+ "r1 = theta*f; #The half width of central maximum for first dark ring(cm)\n",
+ "r1 = r1*10**2;\n",
+ "#We have sin(theta) = 5.136*lambda/(%pi*D) = theta, for small theta\n",
+ "#For second dark ring\n",
+ "theta = 5.136*lamda/(math.pi*D); #The half angular width at central maximum(rad)\n",
+ "r2 = theta*f; #The half width of central maximum for second dark ring(cm)\n",
+ "r2 = r2*10**2;\n",
+ "r2 = math.ceil(r2*100)/100; #rounding off the value of r2 to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The radius of first dark ring is\",r1,\"*10**-2 cm\"\n",
+ "print \"The radius of second dark ring is\",r2,\"*10**-2 cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The radius of first dark ring is 3.66 *10**-2 cm\nThe radius of second dark ring is 4.91 *10**-2 cm\n"
+ "text": [
+ "The radius of first dark ring is 3.66 *10**-2 cm\n",
+ "The radius of second dark ring is 4.91 *10**-2 cm\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +129,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.3, Page number 92"
+ "source": [
+ "Example number 4.3, Page number 92"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle at which the light produces a second order maximum\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nn = 2; #Order of diffraction\nlamda = 650; #Wavelength of light used(nm)\nd = 1.2*10**-3; #Distance between two consecutive slits of grating(cm)\n\n#Calculation\n#We have sin(theta) = n*N*lambda = n*lambda/d, solving for theta\nlamda = lamda*10**-9; #Wavelength of light used(m)\nd = d*10**-2; #Distance between two consecutive slits of grating(m)\na=n*lamda/d;\ntheta = math.asin(a); #Angle at which the 650 nm light produces a second order maximum(rad)\ntheta = theta*57.2957795; #angle in degrees\ntheta = math.ceil(theta*10**2)/10**2; #rounding off the value of theta to 2 decimals\n\n#Result\nprint \"The angle at which the light produces a second order maximum is\",theta, \"degrees\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n = 2; #Order of diffraction\n",
+ "lamda = 650; #Wavelength of light used(nm)\n",
+ "d = 1.2*10**-3; #Distance between two consecutive slits of grating(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "#We have sin(theta) = n*N*lambda = n*lambda/d, solving for theta\n",
+ "lamda = lamda*10**-9; #Wavelength of light used(m)\n",
+ "d = d*10**-2; #Distance between two consecutive slits of grating(m)\n",
+ "a=n*lamda/d;\n",
+ "theta = math.asin(a); #Angle at which the 650 nm light produces a second order maximum(rad)\n",
+ "theta = theta*57.2957795; #angle in degrees\n",
+ "theta = math.ceil(theta*10**2)/10**2; #rounding off the value of theta to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The angle at which the light produces a second order maximum is\",theta, \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The angle at which the light produces a second order maximum is 6.22 degrees\n"
+ "text": [
+ "The angle at which the light produces a second order maximum is 6.22 degrees\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +176,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.4, Page number 92"
+ "source": [
+ "Example number 4.4, Page number 92"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the highest order of spectra\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 650; #Wavelength of light used(nm)\nN = 6000; #Number of lines per cm on grating\ntheta = 90; #Angle at which the highest spectral order is obtained(degrees)\n\n#Calculation\ntheta = theta*0.0174532925; #Angle at which the highest spectral order is obtained(rad)\n#We have sin(theta) = n*N*lambda, solving for n\nlamda = lamda*10**-9; #Wavelength of light used(m)\nN = N*10**2; #Number of lines per m on grating\nn = math.sin(theta)/(N*lamda); #The highest order of spectra with diffraction grating\nn = math.ceil(n*10**3)/10**3; #rounding off the value of theta to 3 decimals\ni,d = divmod(n, 1); #divides the value of n into integer and decimal parts where i is integer\n\n#Result\nprint \"value of n is\",n\nprint \"The highest order of spectra obtained with diffraction grating is\",i\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 650; #Wavelength of light used(nm)\n",
+ "N = 6000; #Number of lines per cm on grating\n",
+ "theta = 90; #Angle at which the highest spectral order is obtained(degrees)\n",
+ "\n",
+ "#Calculation\n",
+ "theta = theta*0.0174532925; #Angle at which the highest spectral order is obtained(rad)\n",
+ "#We have sin(theta) = n*N*lambda, solving for n\n",
+ "lamda = lamda*10**-9; #Wavelength of light used(m)\n",
+ "N = N*10**2; #Number of lines per m on grating\n",
+ "n = math.sin(theta)/(N*lamda); #The highest order of spectra with diffraction grating\n",
+ "n = math.ceil(n*10**3)/10**3; #rounding off the value of theta to 3 decimals\n",
+ "i,d = divmod(n, 1); #divides the value of n into integer and decimal parts where i is integer\n",
+ "\n",
+ "#Result\n",
+ "print \"value of n is\",n\n",
+ "print \"The highest order of spectra obtained with diffraction grating is\",i\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "value of n is 2.565\nThe highest order of spectra obtained with diffraction grating is 2.0\n"
+ "text": [
+ "value of n is 2.565\n",
+ "The highest order of spectra obtained with diffraction grating is 2.0\n"
+ ]
}
],
"prompt_number": 8
@@ -101,19 +225,55 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.5, Page number 92"
+ "source": [
+ "Example number 4.5, Page number 92"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To show that the blue line and red line overlap\n\n#importing modules\nimport math\n\n#Variable declaration\nN = 4000; #Number of lines per cm on grating\n#For Blue Line\nlamda1 = 450; #Wavelength of blue light(nm)\nn1 = 3; #Order of diffraction spectrum\n#For Red Line\nlamda2 = 700; #Wavelength of red light(nm)\nn2 = 2; #Order of diffraction spectrum\n\n#Calculation\nN = N*10**2; #Number of lines per m on grating\nlamda1 = lamda1*10**-9; #Wavelength of blue light(m)\nlamda2 = lamda2*10**-9; #Wavelength of red light(m)\n#We have sin(theta) = n*N*lambda, solving for sin(theta)\nsin_theta_3 = n1*N*lamda1; #Sine of angle at third order diffraction \nsin_theta_2 = n2*N*lamda2; #Sine of angle at second order diffraction\n\n#Result\nprint \"Sine of angle at third order diffraction is\",sin_theta_3\nprint \"Sine of angle at second order diffraction is\",sin_theta_2 \n#Check for overlapping\nif (sin_theta_2-sin_theta_3)<0.05:\n print \"The two orders overlap\"\nelse:\n print \"The two orders do not overlap\" ",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "N = 4000; #Number of lines per cm on grating\n",
+ "#For Blue Line\n",
+ "lamda1 = 450; #Wavelength of blue light(nm)\n",
+ "n1 = 3; #Order of diffraction spectrum\n",
+ "#For Red Line\n",
+ "lamda2 = 700; #Wavelength of red light(nm)\n",
+ "n2 = 2; #Order of diffraction spectrum\n",
+ "\n",
+ "#Calculation\n",
+ "N = N*10**2; #Number of lines per m on grating\n",
+ "lamda1 = lamda1*10**-9; #Wavelength of blue light(m)\n",
+ "lamda2 = lamda2*10**-9; #Wavelength of red light(m)\n",
+ "#We have sin(theta) = n*N*lambda, solving for sin(theta)\n",
+ "sin_theta_3 = n1*N*lamda1; #Sine of angle at third order diffraction \n",
+ "sin_theta_2 = n2*N*lamda2; #Sine of angle at second order diffraction\n",
+ "\n",
+ "#Result\n",
+ "print \"Sine of angle at third order diffraction is\",sin_theta_3\n",
+ "print \"Sine of angle at second order diffraction is\",sin_theta_2 \n",
+ "#Check for overlapping\n",
+ "if (sin_theta_2-sin_theta_3)<0.05:\n",
+ " print \"The two orders overlap\"\n",
+ "else:\n",
+ " print \"The two orders do not overlap\" "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Sine of angle at third order diffraction is 0.54\nSine of angle at second order diffraction is 0.56\nThe two orders overlap\n"
+ "text": [
+ "Sine of angle at third order diffraction is 0.54\n",
+ "Sine of angle at second order diffraction is 0.56\n",
+ "The two orders overlap\n"
+ ]
}
],
"prompt_number": 9
@@ -122,19 +282,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.6, Page number 93"
+ "source": [
+ "Example number 4.6, Page number 93"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the width of first order spectrum on the screen\n\n#importing modules\nimport math\n\n#Variable declaration\nn = 1; #Order of diffraction spectrum\nN = 6000; #Number of lines per cm on diffraction grating\nD = 2; #Distance of screen from the source(m)\nlamda1 = 400; #Wavelength of blue light(nm)\nlamda2 = 750; #Wavelength of blue light(nm)\n\n#Calculation\nN = N*10**2; #Number of lines per m on grating\nlamda1 = lamda1*10**-9; #Wavelength of blue light(m)\nlamda2 = lamda2*10**-9; #Wavelength of blue light(m)\n#We have sin(theta1) = n*N*lamda1, solving for theta1\ntheta1 = math.asin(n*N*lamda1); #Angle at first order diffraction for Blue light(rad)\ntheta1_d = theta1*57.2957795; #Angle at first order diffraction for Blue light(degrees)\ntheta2 = math.asin(n*N*lamda2); #Angle at first order diffraction for Red light(rad)\ntheta2_d = theta2*57.2957795; #Angle at first order diffraction for Red light(degrees)\nx1 = D*math.tan(theta1); #Half width position at central maximum for blue color(m)\nx2 = D*math.tan(theta2); #Half width position at central maximum for red color(m)\nx = x2-x1; #width of first order spectrum on the screen(m)\nx = x*10**2; #width of first order spectrum on the screen(cm)\nx = math.ceil(x*10**2)/10**2; #rounding off the value of x to 2 decimals\n\n#Result\nprint \"The width of first order spectrum on the screen is\",x, \"cm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n = 1; #Order of diffraction spectrum\n",
+ "N = 6000; #Number of lines per cm on diffraction grating\n",
+ "D = 2; #Distance of screen from the source(m)\n",
+ "lamda1 = 400; #Wavelength of blue light(nm)\n",
+ "lamda2 = 750; #Wavelength of blue light(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "N = N*10**2; #Number of lines per m on grating\n",
+ "lamda1 = lamda1*10**-9; #Wavelength of blue light(m)\n",
+ "lamda2 = lamda2*10**-9; #Wavelength of blue light(m)\n",
+ "#We have sin(theta1) = n*N*lamda1, solving for theta1\n",
+ "theta1 = math.asin(n*N*lamda1); #Angle at first order diffraction for Blue light(rad)\n",
+ "theta1_d = theta1*57.2957795; #Angle at first order diffraction for Blue light(degrees)\n",
+ "theta2 = math.asin(n*N*lamda2); #Angle at first order diffraction for Red light(rad)\n",
+ "theta2_d = theta2*57.2957795; #Angle at first order diffraction for Red light(degrees)\n",
+ "x1 = D*math.tan(theta1); #Half width position at central maximum for blue color(m)\n",
+ "x2 = D*math.tan(theta2); #Half width position at central maximum for red color(m)\n",
+ "x = x2-x1; #width of first order spectrum on the screen(m)\n",
+ "x = x*10**2; #width of first order spectrum on the screen(cm)\n",
+ "x = math.ceil(x*10**2)/10**2; #rounding off the value of x to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The width of first order spectrum on the screen is\",x, \"cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The width of first order spectrum on the screen is 51.34 cm\n"
+ "text": [
+ "The width of first order spectrum on the screen is 51.34 cm\n"
+ ]
}
],
"prompt_number": 10
@@ -143,19 +336,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.7, Page number 93"
+ "source": [
+ "Example number 4.7, Page number 93"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the least separation between wavelengths\n\n#importing modules\nimport math\n\n#Variable declaration\nw = 5; #Width of the grating(cm)\nN = 32; #Number of lines per mm on grating\nlamda = 640; #Wavelength of light(nm)\nn = 2; #Order of diffraction\n\n#Calculation\nN= N*10; #Number of lines per cm on grating\nN0 = w*N; #Total number of lines on the grating\nd_lambda = lamda/(n*N0); #Separation between wavelengths(nm)\n\n#Result\nprint \"The separation between wavelengths which the grating can just resolve is\",d_lambda, \"nm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "w = 5; #Width of the grating(cm)\n",
+ "N = 32; #Number of lines per mm on grating\n",
+ "lamda = 640; #Wavelength of light(nm)\n",
+ "n = 2; #Order of diffraction\n",
+ "\n",
+ "#Calculation\n",
+ "N= N*10; #Number of lines per cm on grating\n",
+ "N0 = w*N; #Total number of lines on the grating\n",
+ "d_lambda = lamda/(n*N0); #Separation between wavelengths(nm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The separation between wavelengths which the grating can just resolve is\",d_lambda, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The separation between wavelengths which the grating can just resolve is 0.2 nm\n"
+ "text": [
+ "The separation between wavelengths which the grating can just resolve is 0.2 nm\n"
+ ]
}
],
"prompt_number": 11
@@ -164,19 +379,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.8, Page number 93"
+ "source": [
+ "Example number 4.8, Page number 93"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the separation of the centres of the images in the focal plane\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda = 550; #Wavelength of light(nm)\nD = 3.2; #Diameter of circular lens(cm)\nf = 24; #Focal length of the lens(cm) \n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of light(m)\nD = D*10**-2; #Diameter of circular lens(m)\ntheta_min = 1.22*lamda/D; #Minimum angle of resolution provided by the lens(rad)\n#As delta_x/f = theta_min, solving for delta_x\nf = f*10**-2; #Focal length of the lens(m) \ndelta_x = theta_min*f; #Separation of the centres of the images in the focal plane of lens(m)\ndelta_x = delta_x*10**6; #Separation of the centres of the images in the focal plane of lens(micro m)\n \n#Result\nprint \"The separation of the centres of the images in the focal plane is\",round(delta_x), \"micro-metre\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 550; #Wavelength of light(nm)\n",
+ "D = 3.2; #Diameter of circular lens(cm)\n",
+ "f = 24; #Focal length of the lens(cm) \n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of light(m)\n",
+ "D = D*10**-2; #Diameter of circular lens(m)\n",
+ "theta_min = 1.22*lamda/D; #Minimum angle of resolution provided by the lens(rad)\n",
+ "#As delta_x/f = theta_min, solving for delta_x\n",
+ "f = f*10**-2; #Focal length of the lens(m) \n",
+ "delta_x = theta_min*f; #Separation of the centres of the images in the focal plane of lens(m)\n",
+ "delta_x = delta_x*10**6; #Separation of the centres of the images in the focal plane of lens(micro m)\n",
+ " \n",
+ "#Result\n",
+ "print \"The separation of the centres of the images in the focal plane is\",round(delta_x), \"micro-metre\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The separation of the centres of the images in the focal plane is 5.0 micro-metre\n"
+ "text": [
+ "The separation of the centres of the images in the focal plane is 5.0 micro-metre\n"
+ ]
}
],
"prompt_number": 12
@@ -185,19 +425,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.9, Page number 94"
+ "source": [
+ "Example number 4.9, Page number 94"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the linear separation between two points\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 550; #Wavelength of light(nm)\nD = 20; #Diameter of objective of telescope(cm)\nd = 6; #Distance of two points from the objective of telescope(km)\n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of light(m)\nD = D*10**-2; #Diameter of objective of telescope(m)\nd = d*10**3; #Distance of two points from the objective of telescope(m)\ntheta = 1.22*lamda/D; #Angular separation between two points(rad)\nx = theta*d; #Linear separation between two points(m)\nx = x*10**3; #Linear separation between two points(mm)\n\n#Result\nprint \"The linear separation between two points is\",x, \"mm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 550; #Wavelength of light(nm)\n",
+ "D = 20; #Diameter of objective of telescope(cm)\n",
+ "d = 6; #Distance of two points from the objective of telescope(km)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of light(m)\n",
+ "D = D*10**-2; #Diameter of objective of telescope(m)\n",
+ "d = d*10**3; #Distance of two points from the objective of telescope(m)\n",
+ "theta = 1.22*lamda/D; #Angular separation between two points(rad)\n",
+ "x = theta*d; #Linear separation between two points(m)\n",
+ "x = x*10**3; #Linear separation between two points(mm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The linear separation between two points is\",x, \"mm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The linear separation between two points is 20.13 mm\n"
+ "text": [
+ "The linear separation between two points is 20.13 mm\n"
+ ]
}
],
"prompt_number": 13
@@ -205,7 +470,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter5_1.ipynb b/Engineering_Physics/Chapter5_1.ipynb
index 3731e0ad..86db7d36 100644
--- a/Engineering_Physics/Chapter5_1.ipynb
+++ b/Engineering_Physics/Chapter5_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter5"
+ "name": "",
+ "signature": "sha256:7539e2f35ea93dc5f143cbd45df18f4d6a1bee4d35a1729fab5d759b4b27d8ff"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,58 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "5: Polarization"
+ "source": [
+ "5: Polarization"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.1, Page number 113"
+ "source": [
+ "Example number 5.1, Page number 113"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle of incidence for complete polarization\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nmew_g = 1.72; #Refractive index of glass\nmew_w = 4/3; #Refractive index of water\n\n#Calculation\n#For polarization to occur on flint glass, tan(i) = mew_g/mew_w\n#Solving for i\ni_g = math.atan(mew_g/mew_w); #angle of incidence for complete polarization for flint glass(rad)\na = 180/math.pi; #conversion factor from radians to degrees\ni_g = i_g*a; #angle of incidence(degrees)\ni_g = math.ceil(i_g*10**2)/10**2; #rounding off the value of i_g to 2 decimals\n#For polarization to occur on water, tan(i) = mew_w/mew_g\n#Solving for i\ni_w = math.atan(mew_w/mew_g); #angle of incidence for complete polarization for water(rad)\ni_w = i_w*a; #angle of incidence(degrees)\ni_w = math.ceil(i_w*10**3)/10**3; #rounding off the value of i_w to 3 decimals\n\n#Result\nprint \"The angle of incidence for complete polarization to occur on flint glass is\",i_g, \"degrees\"\nprint \"The angle of incidence for complete polarization to occur on water is\",i_w, \"degrees\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_g = 1.72; #Refractive index of glass\n",
+ "mew_w = 4/3; #Refractive index of water\n",
+ "\n",
+ "#Calculation\n",
+ "#For polarization to occur on flint glass, tan(i) = mew_g/mew_w\n",
+ "#Solving for i\n",
+ "i_g = math.atan(mew_g/mew_w); #angle of incidence for complete polarization for flint glass(rad)\n",
+ "a = 180/math.pi; #conversion factor from radians to degrees\n",
+ "i_g = i_g*a; #angle of incidence(degrees)\n",
+ "i_g = math.ceil(i_g*10**2)/10**2; #rounding off the value of i_g to 2 decimals\n",
+ "#For polarization to occur on water, tan(i) = mew_w/mew_g\n",
+ "#Solving for i\n",
+ "i_w = math.atan(mew_w/mew_g); #angle of incidence for complete polarization for water(rad)\n",
+ "i_w = i_w*a; #angle of incidence(degrees)\n",
+ "i_w = math.ceil(i_w*10**3)/10**3; #rounding off the value of i_w to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The angle of incidence for complete polarization to occur on flint glass is\",i_g, \"degrees\"\n",
+ "print \"The angle of incidence for complete polarization to occur on water is\",i_w, \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The angle of incidence for complete polarization to occur on flint glass is 52.22 degrees\nThe angle of incidence for complete polarization to occur on water is 37.783 degrees\n"
+ "text": [
+ "The angle of incidence for complete polarization to occur on flint glass is 52.22 degrees\n",
+ "The angle of incidence for complete polarization to occur on water is 37.783 degrees\n"
+ ]
}
],
"prompt_number": 5
@@ -38,19 +72,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.2, Page number 113"
+ "source": [
+ "Example number 5.2, Page number 113"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the percentage transmission of incident light\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nI0 = 1; #For simplicity, we assume the intensity of light falling on the second Nicol prism to be unity(W/m**2)\ntheta = 30; #Angle through which the crossed Nicol is rotated(degrees)\n\n#Calculation\ntheeta = 90-theta; #angle between the planes of transmission after rotating through 30 degrees\na = math.pi/180; #conversion factor from degrees to radians\ntheeta = theeta*a; ##angle between the planes of transmission(rad)\nI = I0*math.cos(theeta)**2; #Intensity of the emerging light from second Nicol(W/m**2)\nT = (I/(2*I0))*100; #Percentage transmission of incident light\nT = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n\n#Result\nprint \"The percentage transmission of incident light after emerging through the Nicol prism is\",T, \"%\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "I0 = 1; #For simplicity, we assume the intensity of light falling on the second Nicol prism to be unity(W/m**2)\n",
+ "theta = 30; #Angle through which the crossed Nicol is rotated(degrees)\n",
+ "\n",
+ "#Calculation\n",
+ "theeta = 90-theta; #angle between the planes of transmission after rotating through 30 degrees\n",
+ "a = math.pi/180; #conversion factor from degrees to radians\n",
+ "theeta = theeta*a; ##angle between the planes of transmission(rad)\n",
+ "I = I0*math.cos(theeta)**2; #Intensity of the emerging light from second Nicol(W/m**2)\n",
+ "T = (I/(2*I0))*100; #Percentage transmission of incident light\n",
+ "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The percentage transmission of incident light after emerging through the Nicol prism is\",T, \"%\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The percentage transmission of incident light after emerging through the Nicol prism is 12.51 %\n"
+ "text": [
+ "The percentage transmission of incident light after emerging through the Nicol prism is 12.51 %\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +117,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.3, Page number 113"
+ "source": [
+ "Example number 5.3, Page number 113"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the thickness of Quarter Wave plate\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nlamda = 6000; #Wavelength of incident light(A)\nmew_e = 1.55; #Refractive index of extraordinary ray\nmew_o = 1.54; #Refractive index of ordinary ray\n\n#Calculation\nlamda = lamda*10**-8; #Wavelength of incident light(cm)\nt = lamda/(4*(mew_e-mew_o)); #Thickness of Quarter Wave plate of positive crystal(cm)\n\n#Result\nprint \"The thickness of Quarter Wave plate is\",t, \"cm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 6000; #Wavelength of incident light(A)\n",
+ "mew_e = 1.55; #Refractive index of extraordinary ray\n",
+ "mew_o = 1.54; #Refractive index of ordinary ray\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-8; #Wavelength of incident light(cm)\n",
+ "t = lamda/(4*(mew_e-mew_o)); #Thickness of Quarter Wave plate of positive crystal(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The thickness of Quarter Wave plate is\",t, \"cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The thickness of Quarter Wave plate is 0.0015 cm\n"
+ "text": [
+ "The thickness of Quarter Wave plate is 0.0015 cm\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +159,31 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.4, Page number 114"
+ "source": [
+ "Example number 5.4, Page number 114"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To show the behaviour of the plate\n\n#Calculation\n#the thickness of a half wave plate of calcite for wavelength lamda is\n#t = lamda/(2*(mew_e - mew_o)) = (2*lamda)/(4*(mew_e - mew_o))\n\n#Result\nprint \"The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\"",
+ "input": [
+ " \n",
+ "#Calculation\n",
+ "#the thickness of a half wave plate of calcite for wavelength lamda is\n",
+ "#t = lamda/(2*(mew_e - mew_o)) = (2*lamda)/(4*(mew_e - mew_o))\n",
+ "\n",
+ "#Result\n",
+ "print \"The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\n"
+ "text": [
+ "The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\n"
+ ]
}
],
"prompt_number": 8
@@ -101,19 +192,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.5, Page number 114"
+ "source": [
+ "Example number 5.5, Page number 114"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the phase retardation\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nlamda = 500; #Wavelength of incident light(nm)\nmew_e = 1.5508; #Refractive index of extraordinary ray\nmew_o = 1.5418; #Refractive index of ordinary ray\nt = 0.032; #Thickness of quartz plate(mm)\n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of incident light(m)\nt = t*10**-3; #Thickness of quartz plate(m)\ndx = (mew_e - mew_o)*t; #Path difference between E-ray and O-ray(m)\ndphi = (2*math.pi)/lamda*dx; #Phase retardation for quartz for given wavelength(rad)\ndphi = dphi/math.pi;\n\n#Result\nprint \"The phase retardation for quartz for given wavelength is\",dphi, \"pi rad\"",
+ "input": [
+ " \n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 500; #Wavelength of incident light(nm)\n",
+ "mew_e = 1.5508; #Refractive index of extraordinary ray\n",
+ "mew_o = 1.5418; #Refractive index of ordinary ray\n",
+ "t = 0.032; #Thickness of quartz plate(mm)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of incident light(m)\n",
+ "t = t*10**-3; #Thickness of quartz plate(m)\n",
+ "dx = (mew_e - mew_o)*t; #Path difference between E-ray and O-ray(m)\n",
+ "dphi = (2*math.pi)/lamda*dx; #Phase retardation for quartz for given wavelength(rad)\n",
+ "dphi = dphi/math.pi;\n",
+ "\n",
+ "#Result\n",
+ "print \"The phase retardation for quartz for given wavelength is\",dphi, \"pi rad\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The phase retardation for quartz for given wavelength is 1.152 pi rad\n"
+ "text": [
+ "The phase retardation for quartz for given wavelength is 1.152 pi rad\n"
+ ]
}
],
"prompt_number": 9
@@ -122,19 +239,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.6, Page number 114"
+ "source": [
+ "Example number 5.6, Page number 114"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Brewster angle at the boundary\n\n#importing modules\nimport math\n\n#Variable declaration\nC = 52; #Critical angle for total internal reflection(degrees)\n\n#Calculation\na = math.pi/180; #conversion factor from degrees to radians\nC = C*a; #Critical angle for total internal reflection(rad)\n#From Brewster's law, math.tan(i_B) = 1_mew_2\n#Also math.sin(C) = 1_mew_2, so that math.tan(i_B) = math.sin(C), solving for i_B\ni_B = math.atan(math.sin(C)); #Brewster angle at the boundary(rad)\nb = 180/math.pi; #conversion factor from radians to degrees\ni_B = i_B*b; #Brewster angle at the boundary(degrees)\n\n#Result\nprint \"The Brewster angle at the boundary between two materials is\",int(i_B), \"degrees\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "C = 52; #Critical angle for total internal reflection(degrees)\n",
+ "\n",
+ "#Calculation\n",
+ "a = math.pi/180; #conversion factor from degrees to radians\n",
+ "C = C*a; #Critical angle for total internal reflection(rad)\n",
+ "#From Brewster's law, math.tan(i_B) = 1_mew_2\n",
+ "#Also math.sin(C) = 1_mew_2, so that math.tan(i_B) = math.sin(C), solving for i_B\n",
+ "i_B = math.atan(math.sin(C)); #Brewster angle at the boundary(rad)\n",
+ "b = 180/math.pi; #conversion factor from radians to degrees\n",
+ "i_B = i_B*b; #Brewster angle at the boundary(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"The Brewster angle at the boundary between two materials is\",int(i_B), \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Brewster angle at the boundary between two materials is 38 degrees\n"
+ "text": [
+ "The Brewster angle at the boundary between two materials is 38 degrees\n"
+ ]
}
],
"prompt_number": 13
@@ -142,7 +282,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": [],
diff --git a/Engineering_Physics/Chapter6_1.ipynb b/Engineering_Physics/Chapter6_1.ipynb
index 889b1e18..63de6fa0 100644
--- a/Engineering_Physics/Chapter6_1.ipynb
+++ b/Engineering_Physics/Chapter6_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter6"
+ "name": "",
+ "signature": "sha256:761cc333c24ab0bff41cc769407ab239595ed8749ad7bd7c5ee14e4e733b1604"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "6: Crystallography"
+ "source": [
+ "6: Crystallography"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.1, Page number 134"
+ "source": [
+ "Example number 6.1, Page number 134"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lattice parameter\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nM = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\nd = 2.18*10**3; #Density of rock salt(kg/m**3)\nn = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\nN = 6.02*10**26; #Avogadro's No., atoms/k-mol\n\n#Calculation\na = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\na = a*10**9; ##Lattice constant of unit cell of NaCl(nm)\na = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n\n#Result\nprint \"Lattice parameter for the NaCl crystal is\",a, \"nm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n",
+ "d = 2.18*10**3; #Density of rock salt(kg/m**3)\n",
+ "n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\n",
+ "N = 6.02*10**26; #Avogadro's No., atoms/k-mol\n",
+ "\n",
+ "#Calculation\n",
+ "a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\n",
+ "a = a*10**9; ##Lattice constant of unit cell of NaCl(nm)\n",
+ "a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"Lattice parameter for the NaCl crystal is\",a, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Lattice parameter for the NaCl crystal is 0.563 nm\n"
+ "text": [
+ "Lattice parameter for the NaCl crystal is 0.563 nm\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +64,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.2, Page number 134"
+ "source": [
+ "Example number 6.2, Page number 134"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the miller indices of the plane\n\n#importing modules\nimport math\n\n#Variable declaration\nm = 3;\nn = 2; \np = 1; #Coefficients of intercepts along three axes\n\n#Calculation\n#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/3, 1/2, 1\n#multiplying by LCM the reciprocals become 2, 3, 6\n\n#Result\nprint \"The required miller indices are : (2, 3, 6)\"\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "m = 3;\n",
+ "n = 2; \n",
+ "p = 1; #Coefficients of intercepts along three axes\n",
+ "\n",
+ "#Calculation\n",
+ "#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/3, 1/2, 1\n",
+ "#multiplying by LCM the reciprocals become 2, 3, 6\n",
+ "\n",
+ "#Result\n",
+ "print \"The required miller indices are : (2, 3, 6)\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required miller indices are : (2, 3, 6)\n"
+ "text": [
+ "The required miller indices are : (2, 3, 6)\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +105,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.3, Page number 135"
+ "source": [
+ "Example number 6.3, Page number 135"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the miller indices of the plane\n\n#importing modules\nimport math\n\n#Variable declaration\nm = 2; #Coefficient of intercept along x-axis\n#n = infinite Coefficient of intercept along y-axis\np = 3/2; #Coefficient of intercept along z-axis\n\n#Calculation\n#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/2, 0, 2/3\n#multiplying by LCM the reciprocals become 3, 0, 4\n\n#Result\nprint \"The required miller indices are : (3, 0, 4)\"\n",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "m = 2; #Coefficient of intercept along x-axis\n",
+ "#n = infinite Coefficient of intercept along y-axis\n",
+ "p = 3/2; #Coefficient of intercept along z-axis\n",
+ "\n",
+ "#Calculation\n",
+ "#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/2, 0, 2/3\n",
+ "#multiplying by LCM the reciprocals become 3, 0, 4\n",
+ "\n",
+ "#Result\n",
+ "print \"The required miller indices are : (3, 0, 4)\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required miller indices are : (3, 0, 4)\n"
+ "text": [
+ "The required miller indices are : (3, 0, 4)\n"
+ ]
}
],
"prompt_number": 3
@@ -80,25 +145,59 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.4, Sketching not possible"
+ "source": [
+ "Example number 6.4, Sketching not possible"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.5, Page number 136"
+ "source": [
+ "Example number 6.5, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the interplanar spacing between planes\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\n#For (110) planes\nh1 = 1;\nk1 = 1;\nl1 = 0; #Miller Indices for planes in a cubic crystal\na1 = 0.43; #Interatomic spacing(nm)\n#For (212) planes\nh2 = 2; \nk2 = 1;\nl2 = 2; #Miller Indices for planes in a cubic crystal\na2 = 0.43; #Interatomic spacing(nm)\n\n#Calculation\nd1 = a1/(h1**2+k1**2+l1**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\nd1 = math.ceil(d1*10**4)/10**4; #rounding off the value of d1 to 4 decimals\nd2 = a2/(h2**2+k2**2+l2**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\nd2 = math.ceil(d2*10**4)/10**4; #rounding off the value of d2 to 4 decimals\n\n#Result\nprint \"The interplanar spacing between consecutive (110) planes is\",d1, \"nm\";\nprint \"The interplanar spacing between consecutive (212) planes is\",d2, \"nm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "#For (110) planes\n",
+ "h1 = 1;\n",
+ "k1 = 1;\n",
+ "l1 = 0; #Miller Indices for planes in a cubic crystal\n",
+ "a1 = 0.43; #Interatomic spacing(nm)\n",
+ "#For (212) planes\n",
+ "h2 = 2; \n",
+ "k2 = 1;\n",
+ "l2 = 2; #Miller Indices for planes in a cubic crystal\n",
+ "a2 = 0.43; #Interatomic spacing(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "d1 = a1/(h1**2+k1**2+l1**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n",
+ "d1 = math.ceil(d1*10**4)/10**4; #rounding off the value of d1 to 4 decimals\n",
+ "d2 = a2/(h2**2+k2**2+l2**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n",
+ "d2 = math.ceil(d2*10**4)/10**4; #rounding off the value of d2 to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The interplanar spacing between consecutive (110) planes is\",d1, \"nm\";\n",
+ "print \"The interplanar spacing between consecutive (212) planes is\",d2, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The interplanar spacing between consecutive (110) planes is 0.3041 nm\nThe interplanar spacing between consecutive (212) planes is 0.1434 nm\n"
+ "text": [
+ "The interplanar spacing between consecutive (110) planes is 0.3041 nm\n",
+ "The interplanar spacing between consecutive (212) planes is 0.1434 nm\n"
+ ]
}
],
"prompt_number": 4
@@ -107,19 +206,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.6, Page number 136"
+ "source": [
+ "Example number 6.6, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the interplanar spacing between planes\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 2;\nk = 3;\nl = 1; #Miller Indices for planes in a cubic crystal\nr = 0.175; #Atomic radius of fcc lattice(nm)\n\n#Calculation\na = 2*math.sqrt(2)*r; #Interatomic spacing of fcc lattice(nm)\nd = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\nd = math.ceil(d*10**4)/10**4; #rounding off the value of d to 4 decimals\n\n#Result\nprint \"The interplanar spacing between consecutive (231) planes is\",d, \"nm\"\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 2;\n",
+ "k = 3;\n",
+ "l = 1; #Miller Indices for planes in a cubic crystal\n",
+ "r = 0.175; #Atomic radius of fcc lattice(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "a = 2*math.sqrt(2)*r; #Interatomic spacing of fcc lattice(nm)\n",
+ "d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n",
+ "d = math.ceil(d*10**4)/10**4; #rounding off the value of d to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The interplanar spacing between consecutive (231) planes is\",d, \"nm\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The interplanar spacing between consecutive (231) planes is 0.1323 nm\n"
+ "text": [
+ "The interplanar spacing between consecutive (231) planes is 0.1323 nm\n"
+ ]
}
],
"prompt_number": 5
@@ -128,19 +250,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.7, Page number 136"
+ "source": [
+ "Example number 6.7, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle of diffraction\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 1.44; #Wavelength of X-rays(A)\nd = 2.8; #Interplanar spacing of rocksalt crystal(A)\nn1 = 1; #For 1st Order diffraction\nn2 = 2; #For 2nd Order diffraction\n\n#Calculation\ntheta1 = math.asin(n1*lamda/(2*d)); #Angle of diffraction(radians)\ntheeta1 = theta1*57.2957795; #Angle of diffraction(degrees)\ntheeta1 = math.ceil(theeta1*10**2)/10**2; #rounding off the value of theeta1 to 2 decimals\ntheta2 = math.asin(n2*lamda/(2*d)); #Angle of diffraction(radians)\ntheeta2 = theta2*57.2957795; #Angle of diffraction(degrees)\ntheeta2 = math.ceil(theeta2*10**2)/10**2; #rounding off the value of theeta2 to 2 decimals\n\n#Result\nprint \"The angle of diffraction for first order maxima is\",theeta1, \"degrees\"\nprint \"The angle of diffraction for second order maxima is\",theeta2, \"degrees\"\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 1.44; #Wavelength of X-rays(A)\n",
+ "d = 2.8; #Interplanar spacing of rocksalt crystal(A)\n",
+ "n1 = 1; #For 1st Order diffraction\n",
+ "n2 = 2; #For 2nd Order diffraction\n",
+ "\n",
+ "#Calculation\n",
+ "theta1 = math.asin(n1*lamda/(2*d)); #Angle of diffraction(radians)\n",
+ "theeta1 = theta1*57.2957795; #Angle of diffraction(degrees)\n",
+ "theeta1 = math.ceil(theeta1*10**2)/10**2; #rounding off the value of theeta1 to 2 decimals\n",
+ "theta2 = math.asin(n2*lamda/(2*d)); #Angle of diffraction(radians)\n",
+ "theeta2 = theta2*57.2957795; #Angle of diffraction(degrees)\n",
+ "theeta2 = math.ceil(theeta2*10**2)/10**2; #rounding off the value of theeta2 to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The angle of diffraction for first order maxima is\",theeta1, \"degrees\"\n",
+ "print \"The angle of diffraction for second order maxima is\",theeta2, \"degrees\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The angle of diffraction for first order maxima is 14.91 degrees\nThe angle of diffraction for second order maxima is 30.95 degrees\n"
+ "text": [
+ "The angle of diffraction for first order maxima is 14.91 degrees\n",
+ "The angle of diffraction for second order maxima is 30.95 degrees\n"
+ ]
}
],
"prompt_number": 6
@@ -149,19 +299,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.8, Page number 136"
+ "source": [
+ "Example number 6.8, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the percentage of actual volume occupied by the spheres\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\na = 1; #For convenience, assume interatomic spacing to be unity(m)\n\n#Calculation\nN = 8*(1/8) + 6*(1/2); #total number of spheres in a unit cell\nr = a/(2*math.sqrt(2)); #The atomic radius(m)\nV_atom = N*(4/3)*math.pi*r**3; #Volume of atoms(m**3)\nV_uc = a**3; #Volume of unit cell(m**3)\nPV = (V_atom/V_uc)*100; #percentage of actual volume\nPV = math.ceil(PV*10)/10; #rounding off the value of PV to 1 decimal\n\n#Result\nprint \"The percentage of actual volume occupied by the spheres in fcc structure is\",PV, \"percent\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "a = 1; #For convenience, assume interatomic spacing to be unity(m)\n",
+ "\n",
+ "#Calculation\n",
+ "N = 8*(1/8) + 6*(1/2); #total number of spheres in a unit cell\n",
+ "r = a/(2*math.sqrt(2)); #The atomic radius(m)\n",
+ "V_atom = N*(4/3)*math.pi*r**3; #Volume of atoms(m**3)\n",
+ "V_uc = a**3; #Volume of unit cell(m**3)\n",
+ "PV = (V_atom/V_uc)*100; #percentage of actual volume\n",
+ "PV = math.ceil(PV*10)/10; #rounding off the value of PV to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The percentage of actual volume occupied by the spheres in fcc structure is\",PV, \"percent\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The percentage of actual volume occupied by the spheres in fcc structure is 74.1 percent\n"
+ "text": [
+ "The percentage of actual volume occupied by the spheres in fcc structure is 74.1 percent\n"
+ ]
}
],
"prompt_number": 7
@@ -170,19 +343,56 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.9, Page number 137"
+ "source": [
+ "Example number 6.9, Page number 137"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the interplanar spacing, wavelength and angle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\n#For (221) planes\nh = 2; \nk = 2; \nl = 1; #Miller Indices for planes in a cubic crystal\na = 2.68; #Interatomic spacing(A)\nn1 = 1; #First Order of diffraction \nn2 = 2; #Second order of diffraction\ntheta1 = 8.5; #Glancing angle at which Bragg's reflection occurs(degrees)\n\n#Calculation\ntheta1 = theta1*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\na = a*10**-10; #Interatomic spacing(m)\nd = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystal(m)\nlamda = 2*d*math.sin(theta1)/n1; #Bragg's Law for wavelength of X-rays(m)\nlamda_A = lamda*10**10; #Bragg's Law for wavelength of X-rays(A)\nlamda_A = math.ceil(lamda_A*10**4)/10**4; #rounding off the value of lamda_A to 4 decimals\ntheta2 = math.asin(n2*lamda/(2*d)); #Angle at which second order Bragg reflection occurs(radians)\ntheta2 = theta2*57.2957795; #Angle at which second order Bragg reflection occurs(degrees)\ntheta2 = math.ceil(theta2*10)/10; #rounding off the value of theta2 to 1 decimal\n\n#Result\nprint \"The interplanar spacing between consecutive (221) planes is\",d, \"m\"\nprint \"The wavelength of X-rays is\",lamda_A, \"angstrom\"\nprint \"The angle at which second order Bragg reflection occurs is\",theta2, \"degrees\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "#For (221) planes\n",
+ "h = 2; \n",
+ "k = 2; \n",
+ "l = 1; #Miller Indices for planes in a cubic crystal\n",
+ "a = 2.68; #Interatomic spacing(A)\n",
+ "n1 = 1; #First Order of diffraction \n",
+ "n2 = 2; #Second order of diffraction\n",
+ "theta1 = 8.5; #Glancing angle at which Bragg's reflection occurs(degrees)\n",
+ "\n",
+ "#Calculation\n",
+ "theta1 = theta1*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n",
+ "a = a*10**-10; #Interatomic spacing(m)\n",
+ "d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystal(m)\n",
+ "lamda = 2*d*math.sin(theta1)/n1; #Bragg's Law for wavelength of X-rays(m)\n",
+ "lamda_A = lamda*10**10; #Bragg's Law for wavelength of X-rays(A)\n",
+ "lamda_A = math.ceil(lamda_A*10**4)/10**4; #rounding off the value of lamda_A to 4 decimals\n",
+ "theta2 = math.asin(n2*lamda/(2*d)); #Angle at which second order Bragg reflection occurs(radians)\n",
+ "theta2 = theta2*57.2957795; #Angle at which second order Bragg reflection occurs(degrees)\n",
+ "theta2 = math.ceil(theta2*10)/10; #rounding off the value of theta2 to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The interplanar spacing between consecutive (221) planes is\",d, \"m\"\n",
+ "print \"The wavelength of X-rays is\",lamda_A, \"angstrom\"\n",
+ "print \"The angle at which second order Bragg reflection occurs is\",theta2, \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The interplanar spacing between consecutive (221) planes is 8.93333333333e-11 m\nThe wavelength of X-rays is 0.2641 angstrom\nThe angle at which second order Bragg reflection occurs is 17.2 degrees\n"
+ "text": [
+ "The interplanar spacing between consecutive (221) planes is 8.93333333333e-11 m\n",
+ "The wavelength of X-rays is 0.2641 angstrom\n",
+ "The angle at which second order Bragg reflection occurs is 17.2 degrees\n"
+ ]
}
],
"prompt_number": 9
@@ -191,19 +401,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.10, Page number 137"
+ "source": [
+ "Example number 6.10, Page number 137"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lattice parameter for cubic crystal\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 1; \nk = 1;\nl = 0; #Miller Indices for planes in a cubic crystal\nn = 1; #First Order of diffraction \ntheta = 25; #Glancing angle at which Bragg's reflection occurs(degrees)\nlamda = 0.7; #Wavelength of X-rays(A)\n\n#Calculation\ntheta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\nd = n*lamda/(2*math.sin(theta)); #Interplanar spacing of cubic crystal(A)\na = d*(h**2+k**2+l**2)**(1/2); #The lattice parameter for cubic crystal(A)\na = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n\n#Result\nprint \"The lattice parameter for cubic crystal is\",a, \"angstrom\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 1; \n",
+ "k = 1;\n",
+ "l = 0; #Miller Indices for planes in a cubic crystal\n",
+ "n = 1; #First Order of diffraction \n",
+ "theta = 25; #Glancing angle at which Bragg's reflection occurs(degrees)\n",
+ "lamda = 0.7; #Wavelength of X-rays(A)\n",
+ "\n",
+ "#Calculation\n",
+ "theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n",
+ "d = n*lamda/(2*math.sin(theta)); #Interplanar spacing of cubic crystal(A)\n",
+ "a = d*(h**2+k**2+l**2)**(1/2); #The lattice parameter for cubic crystal(A)\n",
+ "a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The lattice parameter for cubic crystal is\",a, \"angstrom\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The lattice parameter for cubic crystal is 1.172 angstrom\n"
+ "text": [
+ "The lattice parameter for cubic crystal is 1.172 angstrom\n"
+ ]
}
],
"prompt_number": 10
@@ -212,19 +448,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.11, Page number 138"
+ "source": [
+ "Example number 6.11, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of X-rays and maximum possible order of diffraction\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nd = 0.31; #Interplanar spacing(nm)\nn = 1; #First Order of diffraction \ntheta = 9.25; #Glancing angle at which Bragg's reflection occurs(degrees)\ntheta_max = 90; #Maximum possible angle at which reflection can occur(degrees)\ntheta_max = theta_max*0.0174532925; #Maximum possible angle at which reflection can occur(radians)\n\n#Calculation\ntheta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\nlamda = 2*d*math.sin(theta)/n; #Wavelength of X-rays(nm) (Bragg's Law)\nlamda = math.ceil(lamda*10**5)/10**5; #rounding off the value of lamda to 5 decimals\nn = 2*d*math.sin(theta_max)/lamda; #Maximum possible order of diffraction\n\n#Result\nprint \"The wavelength of X-rays is\",lamda, \"nm\"\nprint \"The Maximum possible order of diffraction is\",round(n)",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "d = 0.31; #Interplanar spacing(nm)\n",
+ "n = 1; #First Order of diffraction \n",
+ "theta = 9.25; #Glancing angle at which Bragg's reflection occurs(degrees)\n",
+ "theta_max = 90; #Maximum possible angle at which reflection can occur(degrees)\n",
+ "theta_max = theta_max*0.0174532925; #Maximum possible angle at which reflection can occur(radians)\n",
+ "\n",
+ "#Calculation\n",
+ "theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n",
+ "lamda = 2*d*math.sin(theta)/n; #Wavelength of X-rays(nm) (Bragg's Law)\n",
+ "lamda = math.ceil(lamda*10**5)/10**5; #rounding off the value of lamda to 5 decimals\n",
+ "n = 2*d*math.sin(theta_max)/lamda; #Maximum possible order of diffraction\n",
+ "\n",
+ "#Result\n",
+ "print \"The wavelength of X-rays is\",lamda, \"nm\"\n",
+ "print \"The Maximum possible order of diffraction is\",round(n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wavelength of X-rays is 0.09967 nm\nThe Maximum possible order of diffraction is 6.0\n"
+ "text": [
+ "The wavelength of X-rays is 0.09967 nm\n",
+ "The Maximum possible order of diffraction is 6.0\n"
+ ]
}
],
"prompt_number": 11
@@ -233,19 +496,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.12, Page number 138"
+ "source": [
+ "Example number 6.12, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Bragg reflection angle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\n#For (110) planes\nh1 = 1;\nk1 = 1;\nl1 = 0; #Miller indices for (110) planes\nd_110 = 0.195; #Interplanar spacing between (110) planes(nm)\n#For (210) planes\nh2 = 2;\nk2 = 1; \nl2 = 0; #Miller indices for (110) planes\nn = 2; #Second Order of diffraction \nlamda = 0.071; #Wavelength of X-rays(nm)\n\n#Calculation\na = d_110*(h1**2 + k1**2 + l1**2)**(1/2); #Lattice parameter for bcc crystal(nm)\nd_210 = a/(h2**2 + k2**2 + l2**2)**(1/2); #Interplanar spacing between (210) planes(nm)\ntheta = math.asin(n*lamda/(2*d_210)); #Bragg reflection angle for the second order diffraction(radians)\ntheeta = theta*57.2957795; #Bragg reflection angle for the second order diffraction(degrees)\ntheeta = math.ceil(theeta*10**3)/10**3; #rounding off the value of theeta to 3 decimals\n\n#Result\nprint \"Bragg reflection angle for the second order diffraction is\",theeta, \"degrees\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "#For (110) planes\n",
+ "h1 = 1;\n",
+ "k1 = 1;\n",
+ "l1 = 0; #Miller indices for (110) planes\n",
+ "d_110 = 0.195; #Interplanar spacing between (110) planes(nm)\n",
+ "#For (210) planes\n",
+ "h2 = 2;\n",
+ "k2 = 1; \n",
+ "l2 = 0; #Miller indices for (110) planes\n",
+ "n = 2; #Second Order of diffraction \n",
+ "lamda = 0.071; #Wavelength of X-rays(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "a = d_110*(h1**2 + k1**2 + l1**2)**(1/2); #Lattice parameter for bcc crystal(nm)\n",
+ "d_210 = a/(h2**2 + k2**2 + l2**2)**(1/2); #Interplanar spacing between (210) planes(nm)\n",
+ "theta = math.asin(n*lamda/(2*d_210)); #Bragg reflection angle for the second order diffraction(radians)\n",
+ "theeta = theta*57.2957795; #Bragg reflection angle for the second order diffraction(degrees)\n",
+ "theeta = math.ceil(theeta*10**3)/10**3; #rounding off the value of theeta to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"Bragg reflection angle for the second order diffraction is\",theeta, \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Bragg reflection angle for the second order diffraction is 35.149 degrees\n"
+ "text": [
+ "Bragg reflection angle for the second order diffraction is 35.149 degrees\n"
+ ]
}
],
"prompt_number": 12
@@ -254,19 +549,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.13, Page number 138"
+ "source": [
+ "Example number 6.13, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the distance between nearest neighbours\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nd = 2182; #Density of rock salt(kg/m**3)\nn = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\nN = 6.02*10**26; #Avogadro's number(atoms/k-mol)\n\n#Calculation\nM = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n#V = a^3 = M*n/(N*d)\na = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\nD = a/2; #distance between nearest neighbours(m)\nD = D*10**9; #distance between nearest neighbours(nm)\nD = math.ceil(D*10**4)/10**4; #rounding off the value of D to 4 decimals\n\n#Result\nprint \"The distance between nearest neighbours of NaCl structure is\",D, \"nm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "d = 2182; #Density of rock salt(kg/m**3)\n",
+ "n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\n",
+ "N = 6.02*10**26; #Avogadro's number(atoms/k-mol)\n",
+ "\n",
+ "#Calculation\n",
+ "M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n",
+ "#V = a^3 = M*n/(N*d)\n",
+ "a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\n",
+ "D = a/2; #distance between nearest neighbours(m)\n",
+ "D = D*10**9; #distance between nearest neighbours(nm)\n",
+ "D = math.ceil(D*10**4)/10**4; #rounding off the value of D to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The distance between nearest neighbours of NaCl structure is\",D, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The distance between nearest neighbours of NaCl structure is 0.2814 nm\n"
+ "text": [
+ "The distance between nearest neighbours of NaCl structure is 0.2814 nm\n"
+ ]
}
],
"prompt_number": 13
@@ -275,19 +595,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.14, Page number 139"
+ "source": [
+ "Example number 6.14, Page number 139"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the percentage change in volume\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nr1 = 1.258; #Atomic radius of bcc structure of iron(A)\nN1 = 2; #Number of atoms per unit cell in bcc structure\n#For fcc structure\nr2 = 1.292; #Atomic radius of fcc structure of iron(A)\nN2 = 4; #Number of atoms per unit cell in fcc structure\n\n#Calculation\na1 = 4*r1/math.sqrt(3); #Lattice parameter of bcc structure of iron(A)\nV1 = a1**3; #Volume of bcc unit cell(A)\nV_atom_bcc = V1/N1; #Volume occupied by one atom(A)\na2 = 2*math.sqrt(2)*r2; #Lattice parameter of fcc structure of iron(A)\nV2 = a2**3; #Volume of fcc unit cell(A)\nV_atom_fcc = V2/N2; #Volume occupied by one atom(A)\ndelta_V = (V_atom_bcc-V_atom_fcc)/V_atom_bcc*100; #Percentage change in volume due to structural change of iron\ndelta_V = math.ceil(delta_V*10**3)/10**3; #rounding off the value of delta_V to 3 decimals\n\n#Result\nprint \"The percentage change in volume of iron is\",delta_V, \"percent\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "r1 = 1.258; #Atomic radius of bcc structure of iron(A)\n",
+ "N1 = 2; #Number of atoms per unit cell in bcc structure\n",
+ "#For fcc structure\n",
+ "r2 = 1.292; #Atomic radius of fcc structure of iron(A)\n",
+ "N2 = 4; #Number of atoms per unit cell in fcc structure\n",
+ "\n",
+ "#Calculation\n",
+ "a1 = 4*r1/math.sqrt(3); #Lattice parameter of bcc structure of iron(A)\n",
+ "V1 = a1**3; #Volume of bcc unit cell(A)\n",
+ "V_atom_bcc = V1/N1; #Volume occupied by one atom(A)\n",
+ "a2 = 2*math.sqrt(2)*r2; #Lattice parameter of fcc structure of iron(A)\n",
+ "V2 = a2**3; #Volume of fcc unit cell(A)\n",
+ "V_atom_fcc = V2/N2; #Volume occupied by one atom(A)\n",
+ "delta_V = (V_atom_bcc-V_atom_fcc)/V_atom_bcc*100; #Percentage change in volume due to structural change of iron\n",
+ "delta_V = math.ceil(delta_V*10**3)/10**3; #rounding off the value of delta_V to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The percentage change in volume of iron is\",delta_V, \"percent\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The percentage change in volume of iron is 0.494 percent\n"
+ "text": [
+ "The percentage change in volume of iron is 0.494 percent\n"
+ ]
}
],
"prompt_number": 15
@@ -295,7 +644,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter7_1.ipynb b/Engineering_Physics/Chapter7_1.ipynb
index 5b1859d1..cd558c19 100644
--- a/Engineering_Physics/Chapter7_1.ipynb
+++ b/Engineering_Physics/Chapter7_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter7"
+ "name": "",
+ "signature": "sha256:7187247d22d4e816cffb8e16cb739591c46b8ff453a1af7a76514de7cc4fae35"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "7: Superconductivity"
+ "source": [
+ "7: Superconductivity"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.1, Page number 152"
+ "source": [
+ "Example number 7.1, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical field\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nTc=3.722; #critical temperature(K)\nT=2; #temperature(K)\nBc_0=0.0305; #critical field(T)\n\n#Calculation\nBc_T=Bc_0*(1-(T/Tc)**2); #critical field at 2K(T)\nBc_T = math.ceil(Bc_T*10**4)/10**4; #rounding off the value of Bc_T to 4 decimals\n\n#Result\nprint \"The critical field at 2K is\",Bc_T, \"T\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc=3.722; #critical temperature(K)\n",
+ "T=2; #temperature(K)\n",
+ "Bc_0=0.0305; #critical field(T)\n",
+ "\n",
+ "#Calculation\n",
+ "Bc_T=Bc_0*(1-(T/Tc)**2); #critical field at 2K(T)\n",
+ "Bc_T = math.ceil(Bc_T*10**4)/10**4; #rounding off the value of Bc_T to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The critical field at 2K is\",Bc_T, \"T\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The critical field at 2K is 0.0217 T\n"
+ "text": [
+ "The critical field at 2K is 0.0217 T\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +62,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.2, Page number 152"
+ "source": [
+ "Example number 7.2, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the frequency of Josephson current\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nV = 1; #DC voltage applied across the Josephson junction(micro-volt)\ne = 1.6*10**-19; #Charge on an electron(C)\nh = 6.626*10**-34; #Planck's constant(Js)\n\n#Calculation\nV = V*10**-6; #DC voltage applied across the Josephson junction(V)\nf = 2*e*V/h; #Frequency of Josephson current(Hz)\nf = f*10**-6; #Frequency of Josephson current(MHz)\nf = math.ceil(f*10**2)/10**2; #rounding off the value of f to 2 decimals\n\n#Result\nprint \"The frequency of Josephson current is\",f, \"MHz\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 1; #DC voltage applied across the Josephson junction(micro-volt)\n",
+ "e = 1.6*10**-19; #Charge on an electron(C)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "\n",
+ "#Calculation\n",
+ "V = V*10**-6; #DC voltage applied across the Josephson junction(V)\n",
+ "f = 2*e*V/h; #Frequency of Josephson current(Hz)\n",
+ "f = f*10**-6; #Frequency of Josephson current(MHz)\n",
+ "f = math.ceil(f*10**2)/10**2; #rounding off the value of f to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The frequency of Josephson current is\",f, \"MHz\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The frequency of Josephson current is 482.95 MHz\n"
+ "text": [
+ "The frequency of Josephson current is 482.95 MHz\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +106,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.3, Page number 152"
+ "source": [
+ "Example number 7.3, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the superconducting energy gap\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nT_c = 0.517; #Critical temperature for cadmium(K)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n\n#Calculation\nE_g = 3.5*k*T_c/e; #Superconducting energy gap at absolute zero(eV)\nE_g = E_g*10**4;\nE_g = math.ceil(E_g*10**3)/10**3; #rounding off the value of E_g to 3 decimals\n\n#Result\nprint \"The superconducting energy gap for Cd at absolute zero is\",E_g,\"*10**-4 eV\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T_c = 0.517; #Critical temperature for cadmium(K)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "\n",
+ "#Calculation\n",
+ "E_g = 3.5*k*T_c/e; #Superconducting energy gap at absolute zero(eV)\n",
+ "E_g = E_g*10**4;\n",
+ "E_g = math.ceil(E_g*10**3)/10**3; #rounding off the value of E_g to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The superconducting energy gap for Cd at absolute zero is\",E_g,\"*10**-4 eV\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The superconducting energy gap for Cd at absolute zero is 1.561 *10**-4 eV\n"
+ "text": [
+ "The superconducting energy gap for Cd at absolute zero is 1.561 *10**-4 eV\n"
+ ]
}
],
"prompt_number": 8
@@ -80,19 +149,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.4, Page number 152"
+ "source": [
+ "Example number 7.4, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of photon\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nc = 3*10**8; #Speed of light in free space(m/s)\nh = 6.626*10**-34; #Planck's constant(Js)\nE_g = 1.5*10**-4; #Superconducting energy gap for a material(eV)\n\n#Calculation\n#As E_g = h*new = h*c/lamda, solving for lambda\nlamda = h*c/(E_g*e); #Wavelength of photon to break up a Cooper-pair(m)\nlamda = lamda*10**3;\nlamda = math.ceil(lamda*10**3)/10**3; #rounding off the value of lamda to 3 decimals\n\n#Result\nprint \"The wavelength of photon to break up a Cooper-pair is\",lamda,\"*10**-3 m\"",
+ "input": [
+ " \n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "c = 3*10**8; #Speed of light in free space(m/s)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "E_g = 1.5*10**-4; #Superconducting energy gap for a material(eV)\n",
+ "\n",
+ "#Calculation\n",
+ "#As E_g = h*new = h*c/lamda, solving for lambda\n",
+ "lamda = h*c/(E_g*e); #Wavelength of photon to break up a Cooper-pair(m)\n",
+ "lamda = lamda*10**3;\n",
+ "lamda = math.ceil(lamda*10**3)/10**3; #rounding off the value of lamda to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The wavelength of photon to break up a Cooper-pair is\",lamda,\"*10**-3 m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wavelength of photon to break up a Cooper-pair is 8.283 *10**-3 m\n"
+ "text": [
+ "The wavelength of photon to break up a Cooper-pair is 8.283 *10**-3 m\n"
+ ]
}
],
"prompt_number": 12
@@ -101,19 +193,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.5, Page number 153"
+ "source": [
+ "Example number 7.5, Page number 153"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the London penetration depth of lead\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nlambda_0 = 37; #Penetration depth of lead at 0 kelvin(nm)\nT_c = 7.193; #Critical temperature of superconducting transition for lead(kelvin)\nT = 5.2; #Temperature at which penetration depth for lead becomes lambda_T(kelvin) \n\n#Calculation\nlambda_T = lambda_0*(1-(T/T_c)**4)**(-1/2); #Penetration depth of lead at 5.2 kelvin(nm)\nlambda_T = math.ceil(lambda_T*10)/10; #rounding off the value of lamda_T to 1 decimal\n\n#Result\nprint \"The penetration depth of lead is\",lambda_T, \"nm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lambda_0 = 37; #Penetration depth of lead at 0 kelvin(nm)\n",
+ "T_c = 7.193; #Critical temperature of superconducting transition for lead(kelvin)\n",
+ "T = 5.2; #Temperature at which penetration depth for lead becomes lambda_T(kelvin) \n",
+ "\n",
+ "#Calculation\n",
+ "lambda_T = lambda_0*(1-(T/T_c)**4)**(-1/2); #Penetration depth of lead at 5.2 kelvin(nm)\n",
+ "lambda_T = math.ceil(lambda_T*10)/10; #rounding off the value of lamda_T to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The penetration depth of lead is\",lambda_T, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The penetration depth of lead is 43.4 nm\n"
+ "text": [
+ "The penetration depth of lead is 43.4 nm\n"
+ ]
}
],
"prompt_number": 13
@@ -122,19 +235,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.6, Page number 153"
+ "source": [
+ "Example number 7.6, Page number 153"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mass of isotope of mercury\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nM1 = 199; #Mass of an isotope of mercury(amu)\nT_C1 = 4.185; #Transition temperature of the isoptope of Hg(K)\nT_C2 = 4.153; #Transition temperature of another isoptope of Hg(K)\nalpha = 0.5; #Isotope coefficient\n\n#Calculation\nM2 = M1*(T_C1/T_C2)**(1/alpha); #Mass of another isotope of mercury(amu)\nM2 = math.ceil(M2*100)/100; #rounding off the value of M2 to 2 decimals\n\n#Result\nprint \"The mass of another isotope of mercury is\",M2, \"amu\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "M1 = 199; #Mass of an isotope of mercury(amu)\n",
+ "T_C1 = 4.185; #Transition temperature of the isoptope of Hg(K)\n",
+ "T_C2 = 4.153; #Transition temperature of another isoptope of Hg(K)\n",
+ "alpha = 0.5; #Isotope coefficient\n",
+ "\n",
+ "#Calculation\n",
+ "M2 = M1*(T_C1/T_C2)**(1/alpha); #Mass of another isotope of mercury(amu)\n",
+ "M2 = math.ceil(M2*100)/100; #rounding off the value of M2 to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The mass of another isotope of mercury is\",M2, \"amu\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The mass of another isotope of mercury is 202.08 amu\n"
+ "text": [
+ "The mass of another isotope of mercury is 202.08 amu\n"
+ ]
}
],
"prompt_number": 16
@@ -142,7 +277,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter8_1.ipynb b/Engineering_Physics/Chapter8_1.ipynb
index 8ec25fcf..809f0bc8 100644
--- a/Engineering_Physics/Chapter8_1.ipynb
+++ b/Engineering_Physics/Chapter8_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter8"
+ "name": "",
+ "signature": "sha256:6cf74f56ec30435213713191af54de81cab98f4f30811b6d81fe0fb6a9021553"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,49 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "8: Special Theory of Relativity"
+ "source": [
+ "8: Special Theory of Relativity"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.1, Page number 171"
+ "source": [
+ "Example number 8.1, Page number 171"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nL_0 = 1; #For simplicity, we assume classical length to be unity(m)\nc = 1; #For simplicity assume speed of light to be unity(m/s)\n\n#Calculation\nL = (1-1/100)*L_0; #Relativistic length(m)\n#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\nv = math.sqrt(1-(L/L_0)**2)*c; #Speed at which relativistic length is 1 percent of the classical length(m/s)\nv = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n\n#Result\nprint \"The speed at which relativistic length is 1 percent of the classical length is\",v, \"c\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "L_0 = 1; #For simplicity, we assume classical length to be unity(m)\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "L = (1-1/100)*L_0; #Relativistic length(m)\n",
+ "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n",
+ "v = math.sqrt(1-(L/L_0)**2)*c; #Speed at which relativistic length is 1 percent of the classical length(m/s)\n",
+ "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed at which relativistic length is 1 percent of the classical length is\",v, \"c\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed at which relativistic length is 1 percent of the classical length is 0.1411 c\n"
+ "text": [
+ "The speed at which relativistic length is 1 percent of the classical length is 0.1411 c\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +63,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.2, Page number 171"
+ "source": [
+ "Example number 8.2, Page number 171"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the proper lifetime of particle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\ndelta_t = 5*10**-6; #Mean lifetime of particles as observed in the lab frame(s)\n\n#Calculation\nv = 0.9*c; #Speed at which beam of particles travel(m/s)\ndelta_tau = delta_t*math.sqrt(1-(v/c)**2); #Proper lifetime of particle as per Time Dilation rule(s)\n\n#Result\nprint \"The proper lifetime of particle is\",delta_tau, \"s\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "delta_t = 5*10**-6; #Mean lifetime of particles as observed in the lab frame(s)\n",
+ "\n",
+ "#Calculation\n",
+ "v = 0.9*c; #Speed at which beam of particles travel(m/s)\n",
+ "delta_tau = delta_t*math.sqrt(1-(v/c)**2); #Proper lifetime of particle as per Time Dilation rule(s)\n",
+ "\n",
+ "#Result\n",
+ "print \"The proper lifetime of particle is\",delta_tau, \"s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The proper lifetime of particle is 2.17944947177e-06 s\n"
+ "text": [
+ "The proper lifetime of particle is 2.17944947177e-06 s\n"
+ ]
}
],
"prompt_number": 2
@@ -59,25 +104,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.3, Page number 171. theoritical proof"
+ "source": [
+ "Example number 8.3, Page number 171. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.4, Page number 172"
+ "source": [
+ "Example number 8.4, Page number 172"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed of second rocket for same and opposite direction\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\n\n#Calculation\nv = 0.6*c; #Speed with which the rocket leaves the earth(m/s)\nu_prime = 0.9*c; #Relative speed of second rocket w.r.t. the first rocket(m/s)\nu1 = (u_prime+v)/(1+(u_prime*v)/c**2); #Speed of second rocket for same direction of firing as per Velocity Addition Rule(m/s)\nu1 = math.ceil(u1*10**4)/10**4; #rounding off the value of u1 to 4 decimals\nu2 = (-u_prime+v)/(1-(u_prime*v)/c**2); #Speed of second rocket for opposite direction of firing as per Velocity Addition Rule(m/s)\nu2 = math.ceil(u2*10**4)/10**4; #rounding off the value of u2 to 4 decimals\n\n#Result\nprint \"The speed of second rocket for same direction of firing is\",u1,\"c\"\nprint \"The speed of second rocket for opposite direction of firing is\",u2,\"c\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "v = 0.6*c; #Speed with which the rocket leaves the earth(m/s)\n",
+ "u_prime = 0.9*c; #Relative speed of second rocket w.r.t. the first rocket(m/s)\n",
+ "u1 = (u_prime+v)/(1+(u_prime*v)/c**2); #Speed of second rocket for same direction of firing as per Velocity Addition Rule(m/s)\n",
+ "u1 = math.ceil(u1*10**4)/10**4; #rounding off the value of u1 to 4 decimals\n",
+ "u2 = (-u_prime+v)/(1-(u_prime*v)/c**2); #Speed of second rocket for opposite direction of firing as per Velocity Addition Rule(m/s)\n",
+ "u2 = math.ceil(u2*10**4)/10**4; #rounding off the value of u2 to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed of second rocket for same direction of firing is\",u1,\"c\"\n",
+ "print \"The speed of second rocket for opposite direction of firing is\",u2,\"c\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed of second rocket for same direction of firing is 0.9741 c\nThe speed of second rocket for opposite direction of firing is -0.6521 c\n"
+ "text": [
+ "The speed of second rocket for same direction of firing is 0.9741 c\n",
+ "The speed of second rocket for opposite direction of firing is -0.6521 c\n"
+ ]
}
],
"prompt_number": 4
@@ -86,19 +158,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.5, Page number 172"
+ "source": [
+ "Example number 8.5, Page number 172"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed and time dilation of spaceship\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\nL0 = 1; #For simplicity assume length in spaceship's frame to be unity(m)\ntau = 1; #Unit time in the spaceship's frame(s)\n\n#Calculation\nL = 1/2*L0; #Length as observed on earth(m)\n#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\nv = math.sqrt(1-(L/L0)**2)*c; #Speed at which length of spaceship is observed as half from the earth frame(m/s)\nt = tau/math.sqrt(1-(v/c)**2); #Time dilation of the spaceship's unit time(s)\nv = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n\n#Result\nprint \"The speed at which length of spaceship is observed as half from the earth frame is\",v, \"c\"\nprint \"The time dilation of the spaceship unit time is\",t,\"delta_tau\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "L0 = 1; #For simplicity assume length in spaceship's frame to be unity(m)\n",
+ "tau = 1; #Unit time in the spaceship's frame(s)\n",
+ "\n",
+ "#Calculation\n",
+ "L = 1/2*L0; #Length as observed on earth(m)\n",
+ "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n",
+ "v = math.sqrt(1-(L/L0)**2)*c; #Speed at which length of spaceship is observed as half from the earth frame(m/s)\n",
+ "t = tau/math.sqrt(1-(v/c)**2); #Time dilation of the spaceship's unit time(s)\n",
+ "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed at which length of spaceship is observed as half from the earth frame is\",v, \"c\"\n",
+ "print \"The time dilation of the spaceship unit time is\",t,\"delta_tau\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed at which length of spaceship is observed as half from the earth frame is 0.8661 c\nThe time dilation of the spaceship unit time is 2.0 delta_tau\n"
+ "text": [
+ "The speed at which length of spaceship is observed as half from the earth frame is 0.8661 c\n",
+ "The time dilation of the spaceship unit time is 2.0 delta_tau\n"
+ ]
}
],
"prompt_number": 5
@@ -107,19 +205,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.6, Page number 172"
+ "source": [
+ "Example number 8.6, Page number 172"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the time difference and distance between the events\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\nt1 = 2*10**-7; #Time for which first event occurs(s)\nt2 = 3*10**-7; #Time for which second event occurs(s)\nx1 = 10; #Position at which first event occurs(m)\nx2 = 40; #Position at which second event occurs(m)\n\n#Calculation\nv = 0.6*c; #Velocity with which S2 frame moves relative to S1 frame(m/s)\nL_factor = 1/math.sqrt(1-(v/c)**2); #Lorentz factor\ndelta_t = L_factor*(t2 - t1)+L_factor*v/c**2*(x1 - x2); #Time difference between the events(s)\ndelta_x = L_factor*(x2 - x1)-L_factor*v*(t2 - t1); #Distance between the events(m)\n\n#Result\nprint \"The time difference between the events is\",delta_t, \"s\" \nprint \"The distance between the events is\",delta_x, \"m\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "t1 = 2*10**-7; #Time for which first event occurs(s)\n",
+ "t2 = 3*10**-7; #Time for which second event occurs(s)\n",
+ "x1 = 10; #Position at which first event occurs(m)\n",
+ "x2 = 40; #Position at which second event occurs(m)\n",
+ "\n",
+ "#Calculation\n",
+ "v = 0.6*c; #Velocity with which S2 frame moves relative to S1 frame(m/s)\n",
+ "L_factor = 1/math.sqrt(1-(v/c)**2); #Lorentz factor\n",
+ "delta_t = L_factor*(t2 - t1)+L_factor*v/c**2*(x1 - x2); #Time difference between the events(s)\n",
+ "delta_x = L_factor*(x2 - x1)-L_factor*v*(t2 - t1); #Distance between the events(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The time difference between the events is\",delta_t, \"s\" \n",
+ "print \"The distance between the events is\",delta_x, \"m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The time difference between the events is 5e-08 s\nThe distance between the events is 15.0 m\n"
+ "text": [
+ "The time difference between the events is 5e-08 s\n",
+ "The distance between the events is 15.0 m\n"
+ ]
}
],
"prompt_number": 6
@@ -128,19 +253,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.7, Page number 173"
+ "source": [
+ "Example number 8.7, Page number 173"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed of the unstable particle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\ntau = 2.6*10**-8; #Mean lifetime the particle in its own frame(s)\nd = 20; #Distance which the unstable particle travels before decaying(m)\n\n#Calculation\n#As t = d/v and also t = tau/sqrt(1-(v/c)^2), so that\n#d/v = tau/sqrt(1-(v/c)^2), solving for v\nv = math.sqrt(d**2/(tau**2+(d/c)**2)); #Speed of the unstable particle in lab frame(m/s)\nv = v/10**8;\nv = math.ceil(v*10)/10; #rounding off the value of v to 1 decimal\n\n#Result\nprint \"The speed of the unstable particle in lab frame is\",v,\"*10**8 m/s\"\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "tau = 2.6*10**-8; #Mean lifetime the particle in its own frame(s)\n",
+ "d = 20; #Distance which the unstable particle travels before decaying(m)\n",
+ "\n",
+ "#Calculation\n",
+ "#As t = d/v and also t = tau/sqrt(1-(v/c)^2), so that\n",
+ "#d/v = tau/sqrt(1-(v/c)^2), solving for v\n",
+ "v = math.sqrt(d**2/(tau**2+(d/c)**2)); #Speed of the unstable particle in lab frame(m/s)\n",
+ "v = v/10**8;\n",
+ "v = math.ceil(v*10)/10; #rounding off the value of v to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed of the unstable particle in lab frame is\",v,\"*10**8 m/s\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed of the unstable particle in lab frame is 2.8 *10**8 m/s\n"
+ "text": [
+ "The speed of the unstable particle in lab frame is 2.8 *10**8 m/s\n"
+ ]
}
],
"prompt_number": 9
@@ -149,19 +298,55 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.8, Page number 174"
+ "source": [
+ "Example number 8.8, Page number 174"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed, effective mass and kinetic energy of mu-meson\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\nme = 1; #For simplicity assume mass of electron to be unity(kg)\ntau = 2.3*10**-6; #Average lifetime of mu-meson in rest frame(s)\nt = 6.9*10**-6; #Average lifetime of mu-meson in laboratory frame(s)\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nC = 3*10**8; #Speed of light in vacuum(m/s)\nm_e = 9.1*10**-31; #Mass of an electron(kg)\n\n#Calculation\n#Fromm Time Dilation Rule, tau = t*sqrt(1-(v/c)^2), solving for v\nv = c*math.sqrt(1-(tau/t)**2); #Speed of mu-meson in the laboratory frame(m/s)\nv = math.ceil(v*10**5)/10**5; #rounding off the value of v to 5 decimals\nm0 = 207*me; #Rest mass of mu-meson(kg)\nm = m0/math.sqrt(1-(v/c)**2); #Relativistic variation of mass with velocity(kg)\nm = math.ceil(m*10)/10; #rounding off the value of m to 1 decimal\nT = (m*m_e*C**2 - m0*m_e*C**2)/e; #Kinetic energy of mu-meson(eV)\nT = T*10**-6; #Kinetic energy of mu-meson(MeV)\nT = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n \n#Result\nprint \"The speed of mu-meson in the laboratory frame is\",v, \"c\"\nprint \"The effective mass of mu-meson is\",m, \"me\"\nprint \"The kinetic energy of mu-meson is\",T, \"MeV\"\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "me = 1; #For simplicity assume mass of electron to be unity(kg)\n",
+ "tau = 2.3*10**-6; #Average lifetime of mu-meson in rest frame(s)\n",
+ "t = 6.9*10**-6; #Average lifetime of mu-meson in laboratory frame(s)\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "C = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "m_e = 9.1*10**-31; #Mass of an electron(kg)\n",
+ "\n",
+ "#Calculation\n",
+ "#Fromm Time Dilation Rule, tau = t*sqrt(1-(v/c)^2), solving for v\n",
+ "v = c*math.sqrt(1-(tau/t)**2); #Speed of mu-meson in the laboratory frame(m/s)\n",
+ "v = math.ceil(v*10**5)/10**5; #rounding off the value of v to 5 decimals\n",
+ "m0 = 207*me; #Rest mass of mu-meson(kg)\n",
+ "m = m0/math.sqrt(1-(v/c)**2); #Relativistic variation of mass with velocity(kg)\n",
+ "m = math.ceil(m*10)/10; #rounding off the value of m to 1 decimal\n",
+ "T = (m*m_e*C**2 - m0*m_e*C**2)/e; #Kinetic energy of mu-meson(eV)\n",
+ "T = T*10**-6; #Kinetic energy of mu-meson(MeV)\n",
+ "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n",
+ " \n",
+ "#Result\n",
+ "print \"The speed of mu-meson in the laboratory frame is\",v, \"c\"\n",
+ "print \"The effective mass of mu-meson is\",m, \"me\"\n",
+ "print \"The kinetic energy of mu-meson is\",T, \"MeV\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed of mu-meson in the laboratory frame is 0.94281 c\nThe effective mass of mu-meson is 621.1 me\nThe kinetic energy of mu-meson is 211.97 MeV\n"
+ "text": [
+ "The speed of mu-meson in the laboratory frame is 0.94281 c\n",
+ "The effective mass of mu-meson is 621.1 me\n",
+ "The kinetic energy of mu-meson is 211.97 MeV\n"
+ ]
}
],
"prompt_number": 13
@@ -170,19 +355,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.9, Page number 174"
+ "source": [
+ "Example number 8.9, Page number 174"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed of moving body\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\nm0 = 1; #For simplicity assume rest mass to be unity(kg)\n\n#Calculation\nm = (20/100+1)*m0; #Mass in motion(kg)\n#As m = m0/sqrt(1-(u/c)^2), solving for u\nu = math.sqrt(1-(m0/m)**2)*c; #Speed of moving mass(m/s) \nu = math.ceil(u*10**3)/10**3; #rounding off the value of u to 3 decimals\n\n#Result\nprint \"The speed of moving body is\",u, \"c\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "m0 = 1; #For simplicity assume rest mass to be unity(kg)\n",
+ "\n",
+ "#Calculation\n",
+ "m = (20/100+1)*m0; #Mass in motion(kg)\n",
+ "#As m = m0/sqrt(1-(u/c)^2), solving for u\n",
+ "u = math.sqrt(1-(m0/m)**2)*c; #Speed of moving mass(m/s) \n",
+ "u = math.ceil(u*10**3)/10**3; #rounding off the value of u to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed of moving body is\",u, \"c\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed of moving body is 0.553 c\n"
+ "text": [
+ "The speed of moving body is 0.553 c\n"
+ ]
}
],
"prompt_number": 14
@@ -191,19 +398,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.10, Page number 175"
+ "source": [
+ "Example number 8.10, Page number 175"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the rate of decrease of mass\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\ndE = 4*10**26; #Energy radiated per second my the sun(J/s)\n\n#Calculation\ndm = dE/c**2; #Rate of decrease of mass of sun(kg/s)\ndm = dm/10**9;\ndm = math.ceil(dm*10**3)/10**3; #rounding off the value of dm to 3 decimals\n\n#Result\nprint \"The rate of decrease of mass of sun is\",dm,\"*10**9 kg/s\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "dE = 4*10**26; #Energy radiated per second my the sun(J/s)\n",
+ "\n",
+ "#Calculation\n",
+ "dm = dE/c**2; #Rate of decrease of mass of sun(kg/s)\n",
+ "dm = dm/10**9;\n",
+ "dm = math.ceil(dm*10**3)/10**3; #rounding off the value of dm to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The rate of decrease of mass of sun is\",dm,\"*10**9 kg/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of decrease of mass of sun is 4.445 *10**9 kg/s\n"
+ "text": [
+ "The rate of decrease of mass of sun is 4.445 *10**9 kg/s\n"
+ ]
}
],
"prompt_number": 18
@@ -212,19 +440,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.11, Page number 175"
+ "source": [
+ "Example number 8.11, Page number 175"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the momentum and velocity of the electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\nm0 = 9.1*10**-31; #Mass of the electron(kg)\nE0 = 0.512; #Rest energy of electron(MeV)\nT = 10; #Kinetic energy of electron(MeV)\n\n#Calculation\nE = T + E0; #Total energy of electron(MeV)\n# From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for p\np = math.sqrt(E**2-m0**2*c**4)/c; #Momentum of the electron(MeV)\np = math.ceil(p*100)/100; #rounding off the value of p to 2 decimals\n#As E = E0/sqrt(1-(u/c)^2), solving for u\nu = math.sqrt(1-(E0/E)**2)*c; #Velocity of the electron(m/s)\nu = math.ceil(u*10**4)/10**4; #rounding off the value of u to 4 decimals\n\n#Result\nprint \"The momentum of the electron is\",p,\"/c MeV\"\nprint \"The velocity of the electron is\",u, \"c\"\n\n#answer for velocity given in the book is wrong",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "m0 = 9.1*10**-31; #Mass of the electron(kg)\n",
+ "E0 = 0.512; #Rest energy of electron(MeV)\n",
+ "T = 10; #Kinetic energy of electron(MeV)\n",
+ "\n",
+ "#Calculation\n",
+ "E = T + E0; #Total energy of electron(MeV)\n",
+ "# From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for p\n",
+ "p = math.sqrt(E**2-m0**2*c**4)/c; #Momentum of the electron(MeV)\n",
+ "p = math.ceil(p*100)/100; #rounding off the value of p to 2 decimals\n",
+ "#As E = E0/sqrt(1-(u/c)^2), solving for u\n",
+ "u = math.sqrt(1-(E0/E)**2)*c; #Velocity of the electron(m/s)\n",
+ "u = math.ceil(u*10**4)/10**4; #rounding off the value of u to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The momentum of the electron is\",p,\"/c MeV\"\n",
+ "print \"The velocity of the electron is\",u, \"c\"\n",
+ "\n",
+ "#answer for velocity given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The momentum of the electron is 10.52 /c MeV\nThe velocity of the electron is 0.9989 c\n"
+ "text": [
+ "The momentum of the electron is 10.52 /c MeV\n",
+ "The velocity of the electron is 0.9989 c\n"
+ ]
}
],
"prompt_number": 19
@@ -233,25 +492,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.12, Page number 175. theoritical proof"
+ "source": [
+ "Example number 8.12, Page number 175. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.13, Page number 176"
+ "source": [
+ "Example number 8.13, Page number 176"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the rest mass of the body\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\nE = 4.5*10**17; #Total energy of object(J)\npx = 3.8*10**8; #X-component of momentum(kg-m/s)\npy = 3*10**8; #Y-component of momentum(kg-m/s)\npz = 3*10**8; #Z-component of momentum(kg-m/s)\n\n#Calculation\np = math.sqrt(px**2+py**2+pz**2); #Total momentum of the object(kg-m/s)\n#From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for m0\nm0 = math.sqrt(E**2/c**4 - p**2/c**2); #Rest mass of the body(kg)\nm0 = math.ceil(m0*100)/100; #rounding off the value of m0 to 2 decimals\n\n#Result\nprint \"The rest mass of the body is\",m0, \"kg\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "E = 4.5*10**17; #Total energy of object(J)\n",
+ "px = 3.8*10**8; #X-component of momentum(kg-m/s)\n",
+ "py = 3*10**8; #Y-component of momentum(kg-m/s)\n",
+ "pz = 3*10**8; #Z-component of momentum(kg-m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "p = math.sqrt(px**2+py**2+pz**2); #Total momentum of the object(kg-m/s)\n",
+ "#From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for m0\n",
+ "m0 = math.sqrt(E**2/c**4 - p**2/c**2); #Rest mass of the body(kg)\n",
+ "m0 = math.ceil(m0*100)/100; #rounding off the value of m0 to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The rest mass of the body is\",m0, \"kg\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rest mass of the body is 4.63 kg\n"
+ "text": [
+ "The rest mass of the body is 4.63 kg\n"
+ ]
}
],
"prompt_number": 20
@@ -260,19 +546,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.14, Page number 176"
+ "source": [
+ "Example number 8.14, Page number 176"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the momentum of the high speed probe\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\nm = 50000; #Mass of high speed probe(kg)\n\n#Calculation\nu = 0.8*c; #Speed of the probe(m/s)\np = m*u/math.sqrt(1-(u/c)**2); #Momentum of the probe(kg-m/s)\n\n#Result\nprint \"The momentum of the high speed probe is\",p, \"kg-m/s\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "m = 50000; #Mass of high speed probe(kg)\n",
+ "\n",
+ "#Calculation\n",
+ "u = 0.8*c; #Speed of the probe(m/s)\n",
+ "p = m*u/math.sqrt(1-(u/c)**2); #Momentum of the probe(kg-m/s)\n",
+ "\n",
+ "#Result\n",
+ "print \"The momentum of the high speed probe is\",p, \"kg-m/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The momentum of the high speed probe is 2e+13 kg-m/s\n"
+ "text": [
+ "The momentum of the high speed probe is 2e+13 kg-m/s\n"
+ ]
}
],
"prompt_number": 21
@@ -281,19 +587,55 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.15, Page number 177"
+ "source": [
+ "Example number 8.15, Page number 177"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the change in mass, work done and accelerating potential\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Electronic charge, C = Energy equivalent of 1 eV(J/eV)\nm0 = 9.11*10**-31; #Rest mass of electron(kg)\nc = 3*10**8; #Speed of light in vacuum(m/s)\n\n#Calculation\nu1 = 0.98*c; #Inital speed of electron(m/s)\nu2 = 0.99*c; #Final speed of electron(m/s)\nm1 = m0/math.sqrt(1-(u1/c)**2); #Initial relativistic mass of electron(kg)\nm2 = m0/math.sqrt(1-(u2/c)**2); #Final relativistic mass of electron(kg)\ndm = m2 - m1; #Change in relativistic mass of the electron(kg)\nW = dm*c**2/e; #Work done on the electron to change its velocity(eV)\nW = W*10**-6; #Work done on the electron to change its velocity(MeV)\nW = math.ceil(W*100)/100; #rounding off the value of W to 2 decimals\n#As W = eV, V = accelerating potential, solving for V\nV = W*10**6; #Accelerating potential(volt)\nV = V/10**6;\n\n#Result\nprint \"The change in relativistic mass of the electron is\",dm, \"kg\"\nprint \"The work done on the electron to change its velocity is\",W, \"MeV\"\nprint \"The accelerating potential is\",V, \"*10**6 volt\"\n\n#answers given in the book are wrong",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Electronic charge, C = Energy equivalent of 1 eV(J/eV)\n",
+ "m0 = 9.11*10**-31; #Rest mass of electron(kg)\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "u1 = 0.98*c; #Inital speed of electron(m/s)\n",
+ "u2 = 0.99*c; #Final speed of electron(m/s)\n",
+ "m1 = m0/math.sqrt(1-(u1/c)**2); #Initial relativistic mass of electron(kg)\n",
+ "m2 = m0/math.sqrt(1-(u2/c)**2); #Final relativistic mass of electron(kg)\n",
+ "dm = m2 - m1; #Change in relativistic mass of the electron(kg)\n",
+ "W = dm*c**2/e; #Work done on the electron to change its velocity(eV)\n",
+ "W = W*10**-6; #Work done on the electron to change its velocity(MeV)\n",
+ "W = math.ceil(W*100)/100; #rounding off the value of W to 2 decimals\n",
+ "#As W = eV, V = accelerating potential, solving for V\n",
+ "V = W*10**6; #Accelerating potential(volt)\n",
+ "V = V/10**6;\n",
+ "\n",
+ "#Result\n",
+ "print \"The change in relativistic mass of the electron is\",dm, \"kg\"\n",
+ "print \"The work done on the electron to change its velocity is\",W, \"MeV\"\n",
+ "print \"The accelerating potential is\",V, \"*10**6 volt\"\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The change in relativistic mass of the electron is 1.87996052912e-30 kg\nThe work done on the electron to change its velocity is 1.06 MeV\nThe accelerating potential is 1.06 *10**6 volt\n"
+ "text": [
+ "The change in relativistic mass of the electron is 1.87996052912e-30 kg\n",
+ "The work done on the electron to change its velocity is 1.06 MeV\n",
+ "The accelerating potential is 1.06 *10**6 volt\n"
+ ]
}
],
"prompt_number": 24
@@ -301,7 +643,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter9_1.ipynb b/Engineering_Physics/Chapter9_1.ipynb
index 50e4b6bd..bea06702 100644
--- a/Engineering_Physics/Chapter9_1.ipynb
+++ b/Engineering_Physics/Chapter9_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter9"
+ "name": "",
+ "signature": "sha256:1c769d85a6ecede1e3083e9252f10446216c71537365688b1cba3c5693bdfee6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,45 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "9: Quantum Mechanics"
+ "source": [
+ "9: Quantum Mechanics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.1, Page number 202"
+ "source": [
+ "Example number 9.1, Page number 202"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the De-Broglie wavelength of electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nV = 100; #Accelerating potential for electron(volt)\n\n#Calculation\nlamda = math.sqrt(150/V)*10**-10; #de-Broglie wavelength of electron(m)\n\n#Result\nprint \"The De-Broglie wavelength of electron is\",lamda, \"m\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 100; #Accelerating potential for electron(volt)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = math.sqrt(150/V)*10**-10; #de-Broglie wavelength of electron(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The De-Broglie wavelength of electron is\",lamda, \"m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The De-Broglie wavelength of electron is 1.22474487139e-10 m\n"
+ "text": [
+ "The De-Broglie wavelength of electron is 1.22474487139e-10 m\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +59,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.2, Page number 203"
+ "source": [
+ "Example number 9.2, Page number 203"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the De-Broglie wavelength of electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nh = 6.626*10**-34; #Planck's constant(Js)\nm = 9.11*10**-31; #Mass of the electron(kg)\nEk = 10; #Kinetic energy of electron(eV)\n\n#Calculation\np = math.sqrt(2*m*Ek*e); #Momentum of the electron(kg-m/s)\nlamda = h/p ; #de-Broglie wavelength of electron from De-Broglie relation(m)\nlamda = lamda*10**9; #de-Broglie wavelength of electron from De-Broglie relation(nm)\nlamda = math.ceil(lamda*10**2)/10**2; #rounding off the value of lamda to 2 decimals\n\n#Result\nprint \"The de-Broglie wavelength of electron is\",lamda, \"nm\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "m = 9.11*10**-31; #Mass of the electron(kg)\n",
+ "Ek = 10; #Kinetic energy of electron(eV)\n",
+ "\n",
+ "#Calculation\n",
+ "p = math.sqrt(2*m*Ek*e); #Momentum of the electron(kg-m/s)\n",
+ "lamda = h/p ; #de-Broglie wavelength of electron from De-Broglie relation(m)\n",
+ "lamda = lamda*10**9; #de-Broglie wavelength of electron from De-Broglie relation(nm)\n",
+ "lamda = math.ceil(lamda*10**2)/10**2; #rounding off the value of lamda to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The de-Broglie wavelength of electron is\",lamda, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The de-Broglie wavelength of electron is 0.39 nm\n"
+ "text": [
+ "The de-Broglie wavelength of electron is 0.39 nm\n"
+ ]
}
],
"prompt_number": 2
@@ -59,25 +104,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.3, Page number 203. theoritical proof"
+ "source": [
+ "Example number 9.3, Page number 203. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.4, Page number 203"
+ "source": [
+ "Example number 9.4, Page number 203"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the uncertainty in position of electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 6.626*10**-34; #Planck's constant(Js)\nm = 9.11*10**-31; #Mass of the electron(kg)\nv = 1.1*10**6; #Speed of the electron(m/s)\npr = 0.1; #precision in percent\n\n#Calculation\np = m*v; #Momentum of the electron(kg-m/s)\ndp = pr/100*p; #Uncertainty in momentum(kg-m/s)\nh_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\ndx = h_bar/(2*dp); #Uncertainty in position(m)\n\n#Result\nprint \"The uncertainty in position of electron is\",dx, \"m\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "m = 9.11*10**-31; #Mass of the electron(kg)\n",
+ "v = 1.1*10**6; #Speed of the electron(m/s)\n",
+ "pr = 0.1; #precision in percent\n",
+ "\n",
+ "#Calculation\n",
+ "p = m*v; #Momentum of the electron(kg-m/s)\n",
+ "dp = pr/100*p; #Uncertainty in momentum(kg-m/s)\n",
+ "h_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\n",
+ "dx = h_bar/(2*dp); #Uncertainty in position(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The uncertainty in position of electron is\",dx, \"m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The uncertainty in position of electron is 5.26175358211e-08 m\n"
+ "text": [
+ "The uncertainty in position of electron is 5.26175358211e-08 m\n"
+ ]
}
],
"prompt_number": 3
@@ -86,19 +157,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.5, Page number 203"
+ "source": [
+ "Example number 9.5, Page number 203"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the uncertainty in energy of the excited state\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nh = 6.626*10**-34; #Planck's constant(Js)\ndt = 10**-8; #Uncertainty in time(s)\n\n#Calculation\nh_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\ndE = h_bar/(2*dt*e); #Uncertainty in energy of the excited state(m)\n\n#Result\nprint \"The uncertainty in energy of the excited state is\",dE, \"eV\"\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "dt = 10**-8; #Uncertainty in time(s)\n",
+ "\n",
+ "#Calculation\n",
+ "h_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\n",
+ "dE = h_bar/(2*dt*e); #Uncertainty in energy of the excited state(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The uncertainty in energy of the excited state is\",dE, \"eV\"\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The uncertainty in energy of the excited state is 3.2955020404e-08 eV\n"
+ "text": [
+ "The uncertainty in energy of the excited state is 3.2955020404e-08 eV\n"
+ ]
}
],
"prompt_number": 4
@@ -107,19 +201,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.6, Page number 204"
+ "source": [
+ "Example number 9.6, Page number 204"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the width of spectral line\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light(m/s)\ndt = 10**-8; #Average lifetime(s)\nlamda = 400; #Wavelength of spectral line(nm)\n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of spectral line(m)\n#From Heisenberg uncertainty principle,\n#dE = h_bar/(2*dt) and also dE = h*c/lambda^2*d_lambda, which give\n#h_bar/(2*dt) = h*c/lambda^2*d_lambda, solving for d_lambda\nd_lamda = (lamda**2)/(4*math.pi*c*dt); #Width of spectral line(m)\n\n#Result\nprint \"The width of spectral line is\",d_lamda, \"m\"",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light(m/s)\n",
+ "dt = 10**-8; #Average lifetime(s)\n",
+ "lamda = 400; #Wavelength of spectral line(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of spectral line(m)\n",
+ "#From Heisenberg uncertainty principle,\n",
+ "#dE = h_bar/(2*dt) and also dE = h*c/lambda^2*d_lambda, which give\n",
+ "#h_bar/(2*dt) = h*c/lambda^2*d_lambda, solving for d_lambda\n",
+ "d_lamda = (lamda**2)/(4*math.pi*c*dt); #Width of spectral line(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The width of spectral line is\",d_lamda, \"m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The width of spectral line is 4.24413181578e-15 m\n"
+ "text": [
+ "The width of spectral line is 4.24413181578e-15 m\n"
+ ]
}
],
"prompt_number": 5
@@ -128,61 +246,98 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.7, Page number 204. theoritical proof"
+ "source": [
+ "Example number 9.7, Page number 204. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.8, Page number 204. theoritical proof"
+ "source": [
+ "Example number 9.8, Page number 204. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.9, Page number 205. theoritical proof"
+ "source": [
+ "Example number 9.9, Page number 205. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.10, Page number 205. theoritical proof"
+ "source": [
+ "Example number 9.10, Page number 205. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.11, Page number 205. theoritical proof"
+ "source": [
+ "Example number 9.11, Page number 205. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.12, Page number 206. theoritical proof"
+ "source": [
+ "Example number 9.12, Page number 206. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.13, Page number 206. theoritical proof "
+ "source": [
+ "Example number 9.13, Page number 206. theoritical proof "
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.14, Page number 207"
+ "source": [
+ "Example number 9.14, Page number 207"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the probability of finding the electron\n\n#importing modules\nimport math\nfrom __future__ import division\nfrom scipy.integrate import quad\n\n#Variable declaration\na = 2*10**-10; # Width of 1D box(m)\nx1=0; # Position of first extreme of the box(m)\nx2=1*10**-10; # Position of second extreme of the box(m)\n\n#Calculation\ndef intg(x):\n return ((2/a)*(math.sin(2*math.pi*x/a))**2)\nS=quad(intg,x1,x2)[0]\n\n#Result\nprint \"The probability of finding the electron between x = 0 and x = 10**-10 is\",S",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "from scipy.integrate import quad\n",
+ "\n",
+ "#Variable declaration\n",
+ "a = 2*10**-10; # Width of 1D box(m)\n",
+ "x1=0; # Position of first extreme of the box(m)\n",
+ "x2=1*10**-10; # Position of second extreme of the box(m)\n",
+ "\n",
+ "#Calculation\n",
+ "def intg(x):\n",
+ " return ((2/a)*(math.sin(2*math.pi*x/a))**2)\n",
+ "S=quad(intg,x1,x2)[0]\n",
+ "\n",
+ "#Result\n",
+ "print \"The probability of finding the electron between x = 0 and x = 10**-10 is\",S"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The probability of finding the electron between x = 0 and x = 10**-10 is 0.5\n"
+ "text": [
+ "The probability of finding the electron between x = 0 and x = 10**-10 is 0.5\n"
+ ]
}
],
"prompt_number": 7
@@ -190,7 +345,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_1.ipynb b/Engineering_Physics/Chapter_1.ipynb
index 4392ba50..080a49e2 100644
--- a/Engineering_Physics/Chapter_1.ipynb
+++ b/Engineering_Physics/Chapter_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 1"
+ "name": "",
+ "signature": "sha256:f155f4255421e223741f26abb6caa1287b63505ee5f432c40968d5b5ff6fb505"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,49 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Ultrasonics"
+ "source": [
+ "Ultrasonics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.1, Page number 28 "
+ "source": [
+ "Example number 1.1, Page number 28 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the fundamental frequency of vibration\n\n#importing modules\nimport math\n\n#Variable declaration\nt=0.15*10**-2; #thickness of the quartz crystal in m\nY=7.9*10**10; #young's modulus of quartz in N/m^2\nrho=2650; #density of quartz in kg/m^3\n\n#Calculation\nx=math.sqrt(Y/rho);\nf=x/(2*t);\nf=f*10**-6; #converting f from Hz to MHz\nf=math.ceil(f*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"fundamental frequency of vibration in MHz is\",f);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "t=0.15*10**-2; #thickness of the quartz crystal in m\n",
+ "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n",
+ "rho=2650; #density of quartz in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "x=math.sqrt(Y/rho);\n",
+ "f=x/(2*t);\n",
+ "f=f*10**-6; #converting f from Hz to MHz\n",
+ "f=math.ceil(f*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fundamental frequency of vibration in MHz is\",f);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fundamental frequency of vibration in MHz is', 1.819992)\n"
+ "text": [
+ "('fundamental frequency of vibration in MHz is', 1.819992)\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +63,56 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.2, Page number 28 "
+ "source": [
+ "Example number 1.2, Page number 28 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the fundamental frequency and the first overtone\n\n#importing modules\nimport math\n\n#Variable declaration\nt=1e-03; #thickness of the quartz crystal in m\nY=7.9*10**10; #young's modulus of quartz in N/m^2\nrho=2650; #density of quartz in kg/m^3\n\n#Calculation\nx=math.sqrt(Y/rho);\np1=1; #for fundamental frequency p=1\nf1=(p1*x)/(2*t);\nF1=f1/10**6;\nF1=math.ceil(F1*10**5)/10**5; #rounding off to 5 decimals\nf_1=f1*10**-6; #converting f1 from Hz to MHz\nf_1=math.ceil(f_1*10**5)/10**5; #rounding off to 5 decimals\np2=2; #for first overtone p=2\nf2=(p2*x)/(2*t);\nF2=f2/10**6;\nF2=math.ceil(F2*10**5)/10**5; #rounding off to 5 decimals\nf_2=f2*10**-6; #converting f2 from Hz to MHz\nf_2=math.ceil(f_2*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"fundamental frequency in Hz is\",F1,\"*10**6\");\nprint(\"fundamental frequency in MHz is\",f_1);\nprint(\"frequency of the first overtone in Hz is\",F2,\"*10**6\");\nprint(\"frequency of the first overtone in MHz is\",f_2);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "t=1e-03; #thickness of the quartz crystal in m\n",
+ "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n",
+ "rho=2650; #density of quartz in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "x=math.sqrt(Y/rho);\n",
+ "p1=1; #for fundamental frequency p=1\n",
+ "f1=(p1*x)/(2*t);\n",
+ "F1=f1/10**6;\n",
+ "F1=math.ceil(F1*10**5)/10**5; #rounding off to 5 decimals\n",
+ "f_1=f1*10**-6; #converting f1 from Hz to MHz\n",
+ "f_1=math.ceil(f_1*10**5)/10**5; #rounding off to 5 decimals\n",
+ "p2=2; #for first overtone p=2\n",
+ "f2=(p2*x)/(2*t);\n",
+ "F2=f2/10**6;\n",
+ "F2=math.ceil(F2*10**5)/10**5; #rounding off to 5 decimals\n",
+ "f_2=f2*10**-6; #converting f2 from Hz to MHz\n",
+ "f_2=math.ceil(f_2*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fundamental frequency in Hz is\",F1,\"*10**6\");\n",
+ "print(\"fundamental frequency in MHz is\",f_1);\n",
+ "print(\"frequency of the first overtone in Hz is\",F2,\"*10**6\");\n",
+ "print(\"frequency of the first overtone in MHz is\",f_2);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fundamental frequency in Hz is', 2.72999, '*10**6')\n('fundamental frequency in MHz is', 2.72999)\n('frequency of the first overtone in Hz is', 5.45998, '*10**6')\n('frequency of the first overtone in MHz is', 5.45998)\n"
+ "text": [
+ "('fundamental frequency in Hz is', 2.72999, '*10**6')\n",
+ "('fundamental frequency in MHz is', 2.72999)\n",
+ "('frequency of the first overtone in Hz is', 5.45998, '*10**6')\n",
+ "('frequency of the first overtone in MHz is', 5.45998)\n"
+ ]
}
],
"prompt_number": 1
@@ -59,19 +121,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.3, Page number 29 "
+ "source": [
+ "Example number 1.3, Page number 29 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the velocity of ultrasonic wave\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda=589.3*10**-9; #wavelength of light in m\nf=100*10**6; #frequency of ultrasonic transducer in Hz\nn=1; #order of diffraction\ntheta=2.25; #angle of diffraction in degrees\ntheta=theta*0.0174532925; #converting degrees to radians\n\n#Calculation\nd=(n*lamda)/(2*math.sin(theta));\nd1=d*10**6; #converting d from m to micro m\nlamda1=2*d;\nv=f*lamda1;\nv=math.ceil(v*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"wavelength of ultrasonic wave in m is\",lamda1);\nprint(\"velocity of ultrasonic wave in m/sec\",int(v));",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda=589.3*10**-9; #wavelength of light in m\n",
+ "f=100*10**6; #frequency of ultrasonic transducer in Hz\n",
+ "n=1; #order of diffraction\n",
+ "theta=2.25; #angle of diffraction in degrees\n",
+ "theta=theta*0.0174532925; #converting degrees to radians\n",
+ "\n",
+ "#Calculation\n",
+ "d=(n*lamda)/(2*math.sin(theta));\n",
+ "d1=d*10**6; #converting d from m to micro m\n",
+ "lamda1=2*d;\n",
+ "v=f*lamda1;\n",
+ "v=math.ceil(v*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of ultrasonic wave in m is\",lamda1);\n",
+ "print(\"velocity of ultrasonic wave in m/sec\",int(v));"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('wavelength of ultrasonic wave in m is', 1.5010258944908707e-05)\n('velocity of ultrasonic wave in m/sec', 1501)\n"
+ "text": [
+ "('wavelength of ultrasonic wave in m is', 1.5010258944908707e-05)\n",
+ "('velocity of ultrasonic wave in m/sec', 1501)\n"
+ ]
}
],
"prompt_number": 19
@@ -80,19 +169,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.4, Page number 29 "
+ "source": [
+ "Example number 1.4, Page number 29 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Doppler shifted frequency\n\n#importing modules\nimport math\n\n#Variable declaration\nf=2*10**6; #frequency of transducer in MHz\nv=3; #speed of blood in m/s\nc=800; #velocity of ultrasonic wave in m/s\ntheta=30; #angle of inclination in degrees\ntheta=theta*0.0174532925; #converting degrees to radians\n\n#Calculation\ndeltaf=(2*f*v*math.cos(theta))/c;\ndeltaf=deltaf*10**-6; #converting deltaf from Hz to MHz\ndeltaf=math.ceil(deltaf*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"doppler shifted frequency in MHz is\",deltaf);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "f=2*10**6; #frequency of transducer in MHz\n",
+ "v=3; #speed of blood in m/s\n",
+ "c=800; #velocity of ultrasonic wave in m/s\n",
+ "theta=30; #angle of inclination in degrees\n",
+ "theta=theta*0.0174532925; #converting degrees to radians\n",
+ "\n",
+ "#Calculation\n",
+ "deltaf=(2*f*v*math.cos(theta))/c;\n",
+ "deltaf=deltaf*10**-6; #converting deltaf from Hz to MHz\n",
+ "deltaf=math.ceil(deltaf*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"doppler shifted frequency in MHz is\",deltaf);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('doppler shifted frequency in MHz is', 0.012991)\n"
+ "text": [
+ "('doppler shifted frequency in MHz is', 0.012991)\n"
+ ]
}
],
"prompt_number": 20
@@ -101,19 +213,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.5, Page number 30 "
+ "source": [
+ "Example number 1.5, Page number 30 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the velocity of ultrasonic wave\n\n#importing modules\nimport math\n\n#Variable declaration\nY=7.9*10**10; #young's modulus of quartz in N/m^2\nrho=2650; #density of quartz in kg/m^3\n\n#Calculation\nv=math.sqrt(Y/rho);\nv=math.ceil(v*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"velocity of ultrasonic waves in m/s is\",v);\n",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n",
+ "rho=2650; #density of quartz in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "v=math.sqrt(Y/rho);\n",
+ "v=math.ceil(v*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"velocity of ultrasonic waves in m/s is\",v);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('velocity of ultrasonic waves in m/s is', 5459.975)\n"
+ "text": [
+ "('velocity of ultrasonic waves in m/s is', 5459.975)\n"
+ ]
}
],
"prompt_number": 21
@@ -121,7 +251,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_10.ipynb b/Engineering_Physics/Chapter_10.ipynb
index d1968a2f..22ab6eae 100644
--- a/Engineering_Physics/Chapter_10.ipynb
+++ b/Engineering_Physics/Chapter_10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 10"
+ "name": "",
+ "signature": "sha256:d58d66ad9738120c070e76177ecbb4c809f35b6cd83a911351fcdee8be9798f2"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Magnetic materials"
+ "source": [
+ "Magnetic materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.1, Page number 305"
+ "source": [
+ "Example number 10.1, Page number 305"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the intensity of magnetisation and flux density\n\n#importing modules\nimport math\n\n#Variable declaration\nH=10**6; #magnetic field strength in A/m\nchi=0.5*10**-5; #magnetic susceptibility\n\n#Calculation\nmew0=4*math.pi*10**-7;\nM=chi*H;\nB=mew0*(M+H);\nB=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"intensity of magnetisation in A/m is\",M);\nprint(\"flux density in Wb/m^2 is\",B);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "H=10**6; #magnetic field strength in A/m\n",
+ "chi=0.5*10**-5; #magnetic susceptibility\n",
+ "\n",
+ "#Calculation\n",
+ "mew0=4*math.pi*10**-7;\n",
+ "M=chi*H;\n",
+ "B=mew0*(M+H);\n",
+ "B=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"intensity of magnetisation in A/m is\",M);\n",
+ "print(\"flux density in Wb/m^2 is\",B);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('intensity of magnetisation in A/m is', 5.0)\n('flux density in Wb/m^2 is', 1.257)\n"
+ "text": [
+ "('intensity of magnetisation in A/m is', 5.0)\n",
+ "('flux density in Wb/m^2 is', 1.257)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +64,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.2, Page number 306"
+ "source": [
+ "Example number 10.2, Page number 306"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetic moment\n\n#importing modules\nimport math\n\n#Variable declaration\nA=6.022*10**23; #avagadro number\nmew0=4*math.pi*10**-7;\nw=58.7; #atomic weight of Ni\nB=0.65; #saturation magnetic induction in Wb/m^2\nrho=8906; #density in kg/m^3\n\n#Calculation\nrho=rho*10**3; #converting into gm/m^3\nN=(rho*A)/w;\nmew_m=B/(N*mew0);\n#mew_m/(9.27*10^-24) gives mew_m in mewB\nmew_m=mew_m/(9.27*10**-24);\nmew_m=math.ceil(mew_m*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"magnetic moment of Ni is\",mew_m,\"mew_b\");\n#that is mew_m=0.61 mew_b",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "A=6.022*10**23; #avagadro number\n",
+ "mew0=4*math.pi*10**-7;\n",
+ "w=58.7; #atomic weight of Ni\n",
+ "B=0.65; #saturation magnetic induction in Wb/m^2\n",
+ "rho=8906; #density in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "rho=rho*10**3; #converting into gm/m^3\n",
+ "N=(rho*A)/w;\n",
+ "mew_m=B/(N*mew0);\n",
+ "#mew_m/(9.27*10^-24) gives mew_m in mewB\n",
+ "mew_m=mew_m/(9.27*10**-24);\n",
+ "mew_m=math.ceil(mew_m*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic moment of Ni is\",mew_m,\"mew_b\");\n",
+ "#that is mew_m=0.61 mew_b"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetic moment of Ni is', 0.611, 'mew_b')\n"
+ "text": [
+ "('magnetic moment of Ni is', 0.611, 'mew_b')\n"
+ ]
}
],
"prompt_number": 5
@@ -59,19 +112,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.3, Page number 306"
+ "source": [
+ "Example number 10.3, Page number 306"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the permeability\n\n#importing modules\nimport math\n\n#Variable declaration\nmew_0=4*math.pi*10**-7;\nH=1800; #magnetic field in A/m\nphi=3*10**-5; #magnetic flux in Wb\nA=0.2; #area of cross section in cm^2\n\n#Calculation\nA=A*10**-4; #area in m^2\nB=phi/A;\nmew_r=B/(mew_0*H);\nmew_r=math.ceil(mew_r*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"permeability of material is\",mew_r);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "H=1800; #magnetic field in A/m\n",
+ "phi=3*10**-5; #magnetic flux in Wb\n",
+ "A=0.2; #area of cross section in cm^2\n",
+ "\n",
+ "#Calculation\n",
+ "A=A*10**-4; #area in m^2\n",
+ "B=phi/A;\n",
+ "mew_r=B/(mew_0*H);\n",
+ "mew_r=math.ceil(mew_r*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"permeability of material is\",mew_r);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('permeability of material is', 663.146)\n"
+ "text": [
+ "('permeability of material is', 663.146)\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +156,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.4, Page number 307"
+ "source": [
+ "Example number 10.4, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the saturation magnetisation \n\n#importing modules\nimport math\n\n#Variable declaration\nmew=18.4; #magnetic moment in mew_b\na=0.835; #lattice parameter in nm\n\n#Calculation\nmew=mew*9.27*10**-24;\na=a*10**-9; #converting nm to m\nV=a**3;\nM=mew/V;\nM=M/10**5;\nM=math.ceil(M*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"saturation magnetisation in A/m is\",M,\"*10**5\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew=18.4; #magnetic moment in mew_b\n",
+ "a=0.835; #lattice parameter in nm\n",
+ "\n",
+ "#Calculation\n",
+ "mew=mew*9.27*10**-24;\n",
+ "a=a*10**-9; #converting nm to m\n",
+ "V=a**3;\n",
+ "M=mew/V;\n",
+ "M=M/10**5;\n",
+ "M=math.ceil(M*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"saturation magnetisation in A/m is\",M,\"*10**5\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('saturation magnetisation in A/m is', 2.9299, '*10**5')\n"
+ "text": [
+ "('saturation magnetisation in A/m is', 2.9299, '*10**5')\n"
+ ]
}
],
"prompt_number": 8
@@ -101,19 +200,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.5, Page number 307"
+ "source": [
+ "Example number 10.5, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the value of B and M\n\n#importing modules\nimport math\n\n#Variable declaration\nmew_0=4*math.pi*10**-7;\nH=2*10**5; #magnetic field strength in A/m\nmew_r=1.01; #relative permeability\n\n#Calculation\nB=mew_0*mew_r*H;\nB=math.ceil(B*10**5)/10**5; #rounding off to 3 decimals\nM=(B/mew_0)-H;\nM=math.ceil(M*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"magnetic flux density in Wb/m^2 is\",B);\nprint(\"magnetisation in A/m is\",M);\n\n#answer for magnetisation given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "H=2*10**5; #magnetic field strength in A/m\n",
+ "mew_r=1.01; #relative permeability\n",
+ "\n",
+ "#Calculation\n",
+ "B=mew_0*mew_r*H;\n",
+ "B=math.ceil(B*10**5)/10**5; #rounding off to 3 decimals\n",
+ "M=(B/mew_0)-H;\n",
+ "M=math.ceil(M*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic flux density in Wb/m^2 is\",B);\n",
+ "print(\"magnetisation in A/m is\",M);\n",
+ "\n",
+ "#answer for magnetisation given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetic flux density in Wb/m^2 is', 0.25385)\n('magnetisation in A/m is', 2007.42)\n"
+ "text": [
+ "('magnetic flux density in Wb/m^2 is', 0.25385)\n",
+ "('magnetisation in A/m is', 2007.42)\n"
+ ]
}
],
"prompt_number": 9
@@ -122,19 +247,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.6, Page number 307"
+ "source": [
+ "Example number 10.6, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetic flux density\n\n#importing modules\nimport math\n\n#Variable declaration\nmew_0=4*math.pi*10**-7;\nH=500; #magnetic field strength in A/m\nchi=1.2; #susceptibility\n\n#Calculation\nM=chi*H;\nB=mew_0*(M+H);\nB=B*10**3;\nB=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"magnetic flux density in Wb/m^2 is\",B,\"*10**-3\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "H=500; #magnetic field strength in A/m\n",
+ "chi=1.2; #susceptibility\n",
+ "\n",
+ "#Calculation\n",
+ "M=chi*H;\n",
+ "B=mew_0*(M+H);\n",
+ "B=B*10**3;\n",
+ "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic flux density in Wb/m^2 is\",B,\"*10**-3\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetic flux density in Wb/m^2 is', 1.3824, '*10**-3')\n"
+ "text": [
+ "('magnetic flux density in Wb/m^2 is', 1.3824, '*10**-3')\n"
+ ]
}
],
"prompt_number": 14
@@ -142,7 +289,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_11.ipynb b/Engineering_Physics/Chapter_11.ipynb
index 6e1a896d..d8455a9b 100644
--- a/Engineering_Physics/Chapter_11.ipynb
+++ b/Engineering_Physics/Chapter_11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 11"
+ "name": "",
+ "signature": "sha256:3ff449f1ffe03bd2c9931a55b263d24ea75427a65a897e285709531b99dfed25"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Dielectric materials"
+ "source": [
+ "Dielectric materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.1, Page number 335"
+ "source": [
+ "Example number 11.1, Page number 335"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative dielectric constant\n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nA=10*10*10**-6; #area of capacitor in m^2\nd=2*10**-3; #distance of seperation in m\nC=10**-9; #capacitance in F\n\n#Calculation\nepsilon_r=(C*d)/(epsilon_0*A);\nepsilon_r=math.ceil(epsilon_r*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"dielectric constant of material is\",epsilon_r);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "A=10*10*10**-6; #area of capacitor in m^2\n",
+ "d=2*10**-3; #distance of seperation in m\n",
+ "C=10**-9; #capacitance in F\n",
+ "\n",
+ "#Calculation\n",
+ "epsilon_r=(C*d)/(epsilon_0*A);\n",
+ "epsilon_r=math.ceil(epsilon_r*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"dielectric constant of material is\",epsilon_r);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('dielectric constant of material is', 2258.87)\n"
+ "text": [
+ "('dielectric constant of material is', 2258.87)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +62,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.2, Page number 335"
+ "source": [
+ "Example number 11.2, Page number 335"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability of atoms\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nepsilon_r=1.0000684; #dielectric constant of He gas\nN=2.7*10**25; #concentration of dipoles per m^3\n\n#Calculation\n#alpha_e=P/(N*E) and P=epsilon_0(epsilon_r-1)*E\n#therefore alpha_e=epsilon_0(epsilon_r-1)/N\nalpha_e=(epsilon_0*(epsilon_r-1))/N;\n\n#Result\nprint(\"electronic polarizability of He gas in Fm^2 is\",alpha_e);\n",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "epsilon_r=1.0000684; #dielectric constant of He gas\n",
+ "N=2.7*10**25; #concentration of dipoles per m^3\n",
+ "\n",
+ "#Calculation\n",
+ "#alpha_e=P/(N*E) and P=epsilon_0(epsilon_r-1)*E\n",
+ "#therefore alpha_e=epsilon_0(epsilon_r-1)/N\n",
+ "alpha_e=(epsilon_0*(epsilon_r-1))/N;\n",
+ "\n",
+ "#Result\n",
+ "print(\"electronic polarizability of He gas in Fm^2 is\",alpha_e);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electronic polarizability of He gas in Fm^2 is', 2.2430133333322991e-41)\n"
+ "text": [
+ "('electronic polarizability of He gas in Fm^2 is', 2.2430133333322991e-41)\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +101,35 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.3, Page number 336"
+ "source": [
+ "Example number 11.3, Page number 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the polarisation\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nepsilon_r=6; #dielectric constant\nE=100; #electric field intensity in V/m\n\n#Calculation\nP=epsilon_0*(epsilon_r-1)*E;\n\n#Result\nprint(\"polarization in C/m^2 is\",P);\n",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "epsilon_r=6; #dielectric constant\n",
+ "E=100; #electric field intensity in V/m\n",
+ "\n",
+ "#Calculation\n",
+ "P=epsilon_0*(epsilon_r-1)*E;\n",
+ "\n",
+ "#Result\n",
+ "print(\"polarization in C/m^2 is\",P);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('polarization in C/m^2 is', 4.426999999999999e-09)\n"
+ "text": [
+ "('polarization in C/m^2 is', 4.426999999999999e-09)\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +138,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.4, Page number 336"
+ "source": [
+ "Example number 11.4, Page number 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability of Ne\n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nR=0.158; #radius of Ne in nm\n\n#Calculation\nR=R*10**-9; #converting nm to m\nalpha_e=4*math.pi*epsilon_0*R**3;\n\n#Result\nprint(\"electronic polarizability in Fm^2 is\",alpha_e);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "R=0.158; #radius of Ne in nm\n",
+ "\n",
+ "#Calculation\n",
+ "R=R*10**-9; #converting nm to m\n",
+ "alpha_e=4*math.pi*epsilon_0*R**3;\n",
+ "\n",
+ "#Result\n",
+ "print(\"electronic polarizability in Fm^2 is\",alpha_e);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electronic polarizability in Fm^2 is', 4.3885458748002144e-40)\n"
+ "text": [
+ "('electronic polarizability in Fm^2 is', 4.3885458748002144e-40)\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +178,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.5, Page number 336"
+ "source": [
+ "Example number 11.5, Page number 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the area of metal sheet\n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nC=0.02; #capacitance in micro farad\nepsilon_r=6; #dielectric constant\nt=0.002; #thickness of mica in cm\nd=0.002; #thickness of metal sheet in cm\n\n#Calculation\nC=C*10**-6; #converting micro farad to farad\nd=d*10**-2; #converting cm to m\nA=(C*d)/(epsilon_0*epsilon_r);\nA=A*10**3;\nA=math.ceil(A*10**4)/10**4; #rounding off to 4 decimals\nA1=A*10; #converting m**2 to cm**2\nA1=math.ceil(A1*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"area of metal sheet in m^2 is\",A,\"*10**-3\");\nprint(\"area of metal sheet in cm^2 is\",A1);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "C=0.02; #capacitance in micro farad\n",
+ "epsilon_r=6; #dielectric constant\n",
+ "t=0.002; #thickness of mica in cm\n",
+ "d=0.002; #thickness of metal sheet in cm\n",
+ "\n",
+ "#Calculation\n",
+ "C=C*10**-6; #converting micro farad to farad\n",
+ "d=d*10**-2; #converting cm to m\n",
+ "A=(C*d)/(epsilon_0*epsilon_r);\n",
+ "A=A*10**3;\n",
+ "A=math.ceil(A*10**4)/10**4; #rounding off to 4 decimals\n",
+ "A1=A*10; #converting m**2 to cm**2\n",
+ "A1=math.ceil(A1*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"area of metal sheet in m^2 is\",A,\"*10**-3\");\n",
+ "print(\"area of metal sheet in cm^2 is\",A1);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('area of metal sheet in m^2 is', 7.5296, '*10**-3')\n('area of metal sheet in cm^2 is', 75.296)\n"
+ "text": [
+ "('area of metal sheet in m^2 is', 7.5296, '*10**-3')\n",
+ "('area of metal sheet in cm^2 is', 75.296)\n"
+ ]
}
],
"prompt_number": 9
@@ -122,19 +228,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.6, Page number 336"
+ "source": [
+ "Example number 11.6, Page number 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative permitivity of the crystal\n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nE=1000; #electric field in V/m\nP=4.3*10**-8; #polarization in C/m^2\n\n#Calculation\nepsilon_r=(P/(E*epsilon_0)+1);\nepsilon_r=math.ceil(epsilon_r*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"dielectric constant is\",epsilon_r);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "E=1000; #electric field in V/m\n",
+ "P=4.3*10**-8; #polarization in C/m^2\n",
+ "\n",
+ "#Calculation\n",
+ "epsilon_r=(P/(E*epsilon_0)+1);\n",
+ "epsilon_r=math.ceil(epsilon_r*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"dielectric constant is\",epsilon_r);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('dielectric constant is', 5.8566)\n"
+ "text": [
+ "('dielectric constant is', 5.8566)\n"
+ ]
}
],
"prompt_number": 10
@@ -143,19 +269,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.7, Page number 337"
+ "source": [
+ "Example number 11.7, Page number 337"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the polarisability of the material\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nchi=4.94; #relative susceptibility\nN=10**28; #number of dipoles per m^3\n\n#Calculation\n#polarisation P=N*alpha*E and P=epsilon_0*chi*E. equate the two equations\n#epsilon_0*chi*E=N*alpha*E\nalpha=(epsilon_0*chi)/N;\n\n#Result\nprint(\"polarisability of material in F/m^2 is\",alpha);\n",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "chi=4.94; #relative susceptibility\n",
+ "N=10**28; #number of dipoles per m^3\n",
+ "\n",
+ "#Calculation\n",
+ "#polarisation P=N*alpha*E and P=epsilon_0*chi*E. equate the two equations\n",
+ "#epsilon_0*chi*E=N*alpha*E\n",
+ "alpha=(epsilon_0*chi)/N;\n",
+ "\n",
+ "#Result\n",
+ "print(\"polarisability of material in F/m^2 is\",alpha);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('polarisability of material in F/m^2 is', 4.373876e-39)\n"
+ "text": [
+ "('polarisability of material in F/m^2 is', 4.373876e-39)\n"
+ ]
}
],
"prompt_number": 11
@@ -163,7 +307,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_12.ipynb b/Engineering_Physics/Chapter_12.ipynb
index 5d0b74d0..4fdbd6c5 100644
--- a/Engineering_Physics/Chapter_12.ipynb
+++ b/Engineering_Physics/Chapter_12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 12"
+ "name": "",
+ "signature": "sha256:50b83ee4e84906dcabb2d002b372255d1153b0b8a78afbf0a4be018e0c342780"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,47 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Superconducting Materials"
+ "source": [
+ "Superconducting Materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.1, Page number 356"
+ "source": [
+ "Example number 12.1, Page number 356"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical field\n\n#importing modules\nimport math\n\n#Variable declaration\nTc=3.7; #critical temperature in K\nH0=0.0306; #magnetic field in T\nT=2; #temperature in K\n\n#Calculation\nHc=H0*(1-(T**2/Tc**2));\nHc=math.ceil(Hc*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"critical field in T is\",Hc);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc=3.7; #critical temperature in K\n",
+ "H0=0.0306; #magnetic field in T\n",
+ "T=2; #temperature in K\n",
+ "\n",
+ "#Calculation\n",
+ "Hc=H0*(1-(T**2/Tc**2));\n",
+ "Hc=math.ceil(Hc*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"critical field in T is\",Hc);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('critical field in T is', 0.02166)\n"
+ "text": [
+ "('critical field in T is', 0.02166)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +61,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.2, Page number 356"
+ "source": [
+ "Example number 12.2, Page number 356"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical field\n\n#importing modules\nimport math\n\n#Variable declaration\nTc=7.26; #critical temperature in K\nH0=6.4*10**3; #magnetic field in T\nT=5; #temperature in K\n\n#Calculation\nHc=H0*(1-(T**2/Tc**2));\nHc=math.ceil(Hc*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"critical field in T is\",Hc);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc=7.26; #critical temperature in K\n",
+ "H0=6.4*10**3; #magnetic field in T\n",
+ "T=5; #temperature in K\n",
+ "\n",
+ "#Calculation\n",
+ "Hc=H0*(1-(T**2/Tc**2));\n",
+ "Hc=math.ceil(Hc*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"critical field in T is\",Hc);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('critical field in T is', 3364.385)\n"
+ "text": [
+ "('critical field in T is', 3364.385)\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +102,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.3, Page number 357"
+ "source": [
+ "Example number 12.3, Page number 357"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the value of Tc\n\n#importing modules\nimport math\n\n#Variable declaration\nTc1=4.185; #critical temperature in K\nM1=199.5; #atomic mass\nM2=203.4; #atomic mass after changing\n\n#Calculation\n#according to maxwell equation Tc*M^0.5=constant\n#Tc1*M1^0.5=Tc2*M2^0.5\nTc2=(Tc1*M1**0.5)/M2**0.5;\nTc2=math.ceil(Tc2*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"critical temperature of Hg in K is\",Tc2);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc1=4.185; #critical temperature in K\n",
+ "M1=199.5; #atomic mass\n",
+ "M2=203.4; #atomic mass after changing\n",
+ "\n",
+ "#Calculation\n",
+ "#according to maxwell equation Tc*M^0.5=constant\n",
+ "#Tc1*M1^0.5=Tc2*M2^0.5\n",
+ "Tc2=(Tc1*M1**0.5)/M2**0.5;\n",
+ "Tc2=math.ceil(Tc2*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"critical temperature of Hg in K is\",Tc2);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('critical temperature of Hg in K is', 4.144685)\n"
+ "text": [
+ "('critical temperature of Hg in K is', 4.144685)\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +145,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.4, Page number 357"
+ "source": [
+ "Example number 12.4, Page number 357"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical current density\n\n#importing modules\nimport math\n\n#Variable declaration\nd=1; #diameter of wire in mm\nT=4.2; #temperature in K\nTc=7.18; #critical temperature in K\nH0=6.5*10**4; #magnetic field\n\n#Calculation\nd=d*10**-3; #diameter in m\nR=d/2;\nHc=H0*(1-(T**2/Tc**2));\nHC=Hc/10**4;\nHC=math.ceil(HC*10**3)/10**3; #rounding off to 2 decimals\nIc=2*math.pi*R*Hc;\nIc=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\nA=math.pi*R**2;\nJ=Ic/A;\nJ=J/10**8;\nJ=math.ceil(J*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"critical magnetic field at 4.2K in A/m is\",HC,\"*10**4\");\nprint(\"critical current in A is\",Ic);\nprint(\"critical current density in A/m^2 is\",J,\"*10**8\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=1; #diameter of wire in mm\n",
+ "T=4.2; #temperature in K\n",
+ "Tc=7.18; #critical temperature in K\n",
+ "H0=6.5*10**4; #magnetic field\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**-3; #diameter in m\n",
+ "R=d/2;\n",
+ "Hc=H0*(1-(T**2/Tc**2));\n",
+ "HC=Hc/10**4;\n",
+ "HC=math.ceil(HC*10**3)/10**3; #rounding off to 2 decimals\n",
+ "Ic=2*math.pi*R*Hc;\n",
+ "Ic=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n",
+ "A=math.pi*R**2;\n",
+ "J=Ic/A;\n",
+ "J=J/10**8;\n",
+ "J=math.ceil(J*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"critical magnetic field at 4.2K in A/m is\",HC,\"*10**4\");\n",
+ "print(\"critical current in A is\",Ic);\n",
+ "print(\"critical current density in A/m^2 is\",J,\"*10**8\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('critical magnetic field at 4.2K in A/m is', 4.276, '*10**4')\n('critical current in A is', 134.33)\n('critical current density in A/m^2 is', 1.71035, '*10**8')\n"
+ "text": [
+ "('critical magnetic field at 4.2K in A/m is', 4.276, '*10**4')\n",
+ "('critical current in A is', 134.33)\n",
+ "('critical current density in A/m^2 is', 1.71035, '*10**8')\n"
+ ]
}
],
"prompt_number": 15
@@ -101,19 +200,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.5, Page number 358"
+ "source": [
+ "Example number 12.5, Page number 358"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the frequency of radiation\n\n#importing modules\nimport math\n\n#Variable declaration\ne=1.6*10**-19;\nh=6.626*10**-34;\nV=6; #voltage applied in micro volts\n\n#Calculation\nV=V*10**-6; #converting micro volts to volts\nnew=(2*e*V)/h;\nnew=new/10**9;\nnew=math.ceil(new*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"frequency of ac signal in Hz is\",new,\"*10**9\");",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "e=1.6*10**-19;\n",
+ "h=6.626*10**-34;\n",
+ "V=6; #voltage applied in micro volts\n",
+ "\n",
+ "#Calculation\n",
+ "V=V*10**-6; #converting micro volts to volts\n",
+ "new=(2*e*V)/h;\n",
+ "new=new/10**9;\n",
+ "new=math.ceil(new*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of ac signal in Hz is\",new,\"*10**9\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('frequency of ac signal in Hz is', 2.8977, '*10**9')\n"
+ "text": [
+ "('frequency of ac signal in Hz is', 2.8977, '*10**9')\n"
+ ]
}
],
"prompt_number": 16
@@ -122,19 +242,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.6, Page number 358"
+ "source": [
+ "Example number 12.6, Page number 358"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the band gap\n\n#importing modules\nimport math\n\n#Variable declaration\nKb=1.38*10**-23;\nTc=7.19; #critical temperature in K\n\n#Calculation\nEg=3.5*Kb*Tc;\nEg=Eg/(1.6*10**-19); #converting J to eV\nEg=Eg*10**3; #converting eV into milli eV\nEg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"band gap of superconducting lead in meV is\",Eg);",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Kb=1.38*10**-23;\n",
+ "Tc=7.19; #critical temperature in K\n",
+ "\n",
+ "#Calculation\n",
+ "Eg=3.5*Kb*Tc;\n",
+ "Eg=Eg/(1.6*10**-19); #converting J to eV\n",
+ "Eg=Eg*10**3; #converting eV into milli eV\n",
+ "Eg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"band gap of superconducting lead in meV is\",Eg);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('band gap of superconducting lead in meV is', 2.171)\n"
+ "text": [
+ "('band gap of superconducting lead in meV is', 2.171)\n"
+ ]
}
],
"prompt_number": 17
@@ -142,7 +282,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_2.ipynb b/Engineering_Physics/Chapter_2.ipynb
index f57dc5cb..82d0d7af 100644
--- a/Engineering_Physics/Chapter_2.ipynb
+++ b/Engineering_Physics/Chapter_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 2"
+ "name": "",
+ "signature": "sha256:3d73f6bba1b33a0bbd48c706ad53709f1f38f4b901966e1c9494931ace163899"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,53 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Laser"
+ "source": [
+ "Laser"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.1, Page number 59 "
+ "source": [
+ "Example number 2.1, Page number 59 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of photons emitted by laser\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34;\nc=3*10**8;\nlamda=632.8*10**-9; #wavelength in m\nP=5*10**-3; #output power in W\n\n#Calculation\nE=(h*c)/lamda; #energy of one photon\nE_eV=E/(1.6*10**-19); #converting J to eV\nE_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\nN=P/E; #number of photons emitted\n\n\n#Result\nprint(\"energy of one photon in eV is\",E_eV);\nprint(\"number of photons emitted per second is\",N);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "lamda=632.8*10**-9; #wavelength in m\n",
+ "P=5*10**-3; #output power in W\n",
+ "\n",
+ "#Calculation\n",
+ "E=(h*c)/lamda; #energy of one photon\n",
+ "E_eV=E/(1.6*10**-19); #converting J to eV\n",
+ "E_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n",
+ "N=P/E; #number of photons emitted\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy of one photon in eV is\",E_eV);\n",
+ "print(\"number of photons emitted per second is\",N);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy of one photon in eV is', 1.964)\n('number of photons emitted per second is', 1.5917094275077976e+16)\n"
+ "text": [
+ "('energy of one photon in eV is', 1.964)\n",
+ "('number of photons emitted per second is', 1.5917094275077976e+16)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +67,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.2, Page number 60"
+ "source": [
+ "Example number 2.2, Page number 60"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy of emitted photons\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34;\nc=3*10**8;\nlamda=632.8*10**-9; #wavelength in m\n\n#Calculation\nE=(h*c)/lamda; #energy of one photon\nE_eV=E/(1.6*10**-19); #converting J to eV\nE_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n\n#Result\nprint(\"energy of one photon in eV is\",E_eV);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "lamda=632.8*10**-9; #wavelength in m\n",
+ "\n",
+ "#Calculation\n",
+ "E=(h*c)/lamda; #energy of one photon\n",
+ "E_eV=E/(1.6*10**-19); #converting J to eV\n",
+ "E_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy of one photon in eV is\",E_eV);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy of one photon in eV is', 1.964)\n"
+ "text": [
+ "('energy of one photon in eV is', 1.964)\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +109,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.3, Page number 60"
+ "source": [
+ "Example number 2.3, Page number 60"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the value of E3\n\n#importing modules\nimport math\n\n#Variable declaration\nE1=0; #value of 1st energy level in eV\nE2=1.4; #value of 2nd energy level in eV\nlamda=1.15*10**-6;\nh=6.626*10**-34;\nc=3*10**8;\n\n#Calculation\nE=(h*c)/lamda; #energy of one photon\nE_eV=E/(1.6*10**-19); #converting J to eV\nE3=E2+E_eV;\nE3=math.ceil(E3*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"value of E3 in eV is\",E3);\n\n#answer given in the book for E3 is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "E1=0; #value of 1st energy level in eV\n",
+ "E2=1.4; #value of 2nd energy level in eV\n",
+ "lamda=1.15*10**-6;\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "\n",
+ "#Calculation\n",
+ "E=(h*c)/lamda; #energy of one photon\n",
+ "E_eV=E/(1.6*10**-19); #converting J to eV\n",
+ "E3=E2+E_eV;\n",
+ "E3=math.ceil(E3*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"value of E3 in eV is\",E3);\n",
+ "\n",
+ "#answer given in the book for E3 is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('value of E3 in eV is', 2.49)\n"
+ "text": [
+ "('value of E3 in eV is', 2.49)\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +156,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.4, Page number 60"
+ "source": [
+ "Example number 2.4, Page number 60"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of laser beam\n\n#Variable declaration\nh=6.626*10**-34;\nc=3*10**8;\nE2=3.2; #value of higher energy level in eV\nE1=1.6; #value of lower energy level in eV\n\n#Calculation\nE=E2-E1; #energy difference in eV\nE_J=E*1.6*10**-19; #converting E from eV to J\nlamda=(h*c)/E_J; #wavelength of photon\n\n#Result\nprint(\"energy difference in eV\",E);\nprint(\"wavelength of photon in m\",lamda);\n",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "E2=3.2; #value of higher energy level in eV\n",
+ "E1=1.6; #value of lower energy level in eV\n",
+ "\n",
+ "#Calculation\n",
+ "E=E2-E1; #energy difference in eV\n",
+ "E_J=E*1.6*10**-19; #converting E from eV to J\n",
+ "lamda=(h*c)/E_J; #wavelength of photon\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy difference in eV\",E);\n",
+ "print(\"wavelength of photon in m\",lamda);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy difference in eV', 1.6)\n('wavelength of photon in m', 7.76484375e-07)\n"
+ "text": [
+ "('energy difference in eV', 1.6)\n",
+ "('wavelength of photon in m', 7.76484375e-07)\n"
+ ]
}
],
"prompt_number": 6
@@ -101,19 +198,35 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.5, Page number 60"
+ "source": [
+ "Example number 2.5, Page number 60"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of laser beam\n\n#Variable declaration\nh=6.626*10**-34;\nc=3*10**8;\nE=1.42*1.6*10**-19; #band gap of GaAs in J\n\n#Calculation\nlamda=(h*c)/E; #wavelength of laser\n\n#Result\nprint(\"wavelength of laser emitted by GaAs in m\",lamda);\n",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "E=1.42*1.6*10**-19; #band gap of GaAs in J\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=(h*c)/E; #wavelength of laser\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of laser emitted by GaAs in m\",lamda);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('wavelength of laser emitted by GaAs in m', 8.74911971830986e-07)\n"
+ "text": [
+ "('wavelength of laser emitted by GaAs in m', 8.74911971830986e-07)\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +235,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.6, Page number 61"
+ "source": [
+ "Example number 2.6, Page number 61"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative population of energy levels\n\n#importing modules\nimport math\n\n#Variable declaration\nT=300; #temperature in K\nlamda=500*10**-9; #wavelength in m\nh=6.626*10**-34;\nc=3*10**8;\nk=1.38*10**-23;\n\n#Calculation\n#from maxwell and boltzmann law, relative population is given by\n#N1/N2=exp(-E1/kT)/exp(-E2/kT)\n#hence N1/N2=exp(-(E1-E2)/kT)=exp((h*new)/(k*T));\n#new=c/lambda\nR=(h*c)/(lamda*k*T);\nRP=math.exp(R);\n\n#Result\nprint(\"relative population between N1 and N2 is\",RP);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T=300; #temperature in K\n",
+ "lamda=500*10**-9; #wavelength in m\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "#from maxwell and boltzmann law, relative population is given by\n",
+ "#N1/N2=exp(-E1/kT)/exp(-E2/kT)\n",
+ "#hence N1/N2=exp(-(E1-E2)/kT)=exp((h*new)/(k*T));\n",
+ "#new=c/lambda\n",
+ "R=(h*c)/(lamda*k*T);\n",
+ "RP=math.exp(R);\n",
+ "\n",
+ "#Result\n",
+ "print(\"relative population between N1 and N2 is\",RP);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('relative population between N1 and N2 is', 5.068255595981255e+41)\n"
+ "text": [
+ "('relative population between N1 and N2 is', 5.068255595981255e+41)\n"
+ ]
}
],
"prompt_number": 9
@@ -143,19 +282,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.7, Page number 61"
+ "source": [
+ "Example number 2.7, Page number 61"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To examine the possibility of stimulated emission\n\n#importing modules\nimport math\n\n#Variable declaration\nT=300; #temperature in K\nh=6.626*10**-34;\nc=3*10**8;\nk=1.38*10**-23;\nlamda=600*10**-9; #wavelength in m\n\n#Calculation\nR=(h*c)/(lamda*k*T);\nRs=1/(math.exp(R)-1);\n\n#Result\nprint(\"the ratio between stimulated emission to spontaneous emission is\",Rs);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T=300; #temperature in K\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "k=1.38*10**-23;\n",
+ "lamda=600*10**-9; #wavelength in m\n",
+ "\n",
+ "#Calculation\n",
+ "R=(h*c)/(lamda*k*T);\n",
+ "Rs=1/(math.exp(R)-1);\n",
+ "\n",
+ "#Result\n",
+ "print(\"the ratio between stimulated emission to spontaneous emission is\",Rs);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the ratio between stimulated emission to spontaneous emission is', 1.7617782449453023e-35)\n"
+ "text": [
+ "('the ratio between stimulated emission to spontaneous emission is', 1.7617782449453023e-35)\n"
+ ]
}
],
"prompt_number": 11
@@ -164,19 +325,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.8, Page number 62"
+ "source": [
+ "Example number 2.8, Page number 62"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the efficiency of a He-Ne laser\n\n#importing modules\nimport math\n\n#Variable declaration\nP=5*10**-3; #output power in W\nI=10*10**-3; #current in A\nV=3*10**3; #voltage in V\n\n#Calculation\ne=(P*100)/(I*V);\ne=math.ceil(e*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"efficiency of laser in % is\",e);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "P=5*10**-3; #output power in W\n",
+ "I=10*10**-3; #current in A\n",
+ "V=3*10**3; #voltage in V\n",
+ "\n",
+ "#Calculation\n",
+ "e=(P*100)/(I*V);\n",
+ "e=math.ceil(e*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"efficiency of laser in % is\",e);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('efficiency of laser in % is', 0.016667)\n"
+ "text": [
+ "('efficiency of laser in % is', 0.016667)\n"
+ ]
}
],
"prompt_number": 14
@@ -185,19 +366,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.9, Page number 62"
+ "source": [
+ "Example number 2.9, Page number 62"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the intensity of laser beam\n\n#importing modules\nimport math\n\n#Variable declaration\nP=1e-03; #output power in W\nd=1e-06; #diameter in m\n\n#Calculation\nr=d/2; #radius in m\nI=P/(math.pi*r**2); #intensity\nI=I/10**9;\nI=math.ceil(I*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"intensity of laser in W/m^2 is\",I,\"*10**9\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "P=1e-03; #output power in W\n",
+ "d=1e-06; #diameter in m\n",
+ "\n",
+ "#Calculation\n",
+ "r=d/2; #radius in m\n",
+ "I=P/(math.pi*r**2); #intensity\n",
+ "I=I/10**9;\n",
+ "I=math.ceil(I*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"intensity of laser in W/m^2 is\",I,\"*10**9\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('intensity of laser in W/m^2 is', 1.2733, '*10**9')\n"
+ "text": [
+ "('intensity of laser in W/m^2 is', 1.2733, '*10**9')\n"
+ ]
}
],
"prompt_number": 1
@@ -206,19 +408,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.10, Page number 62"
+ "source": [
+ "Example number 2.10, Page number 62"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angular speed and divergence of laser beam\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda=632.8*10**-9; #wavelength in m\nD=5; #distance in m\nd=1*10**-3; #diameter in m\n\n#Calculation\ndeltatheta=lamda/d; #angular speed\ndelta_theta=deltatheta*10**4;\nr=D*deltatheta;\nr1=r*10**3; #converting r from m to mm\nA=math.pi*r**2; #area of the spread\n\n#Result \nprint(\"angular speed in radian is\",delta_theta,\"*10**-4\");\nprint(\"radius of the spread in mm is\",r1);\nprint(\"area of the spread in m^2 is\",A);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda=632.8*10**-9; #wavelength in m\n",
+ "D=5; #distance in m\n",
+ "d=1*10**-3; #diameter in m\n",
+ "\n",
+ "#Calculation\n",
+ "deltatheta=lamda/d; #angular speed\n",
+ "delta_theta=deltatheta*10**4;\n",
+ "r=D*deltatheta;\n",
+ "r1=r*10**3; #converting r from m to mm\n",
+ "A=math.pi*r**2; #area of the spread\n",
+ "\n",
+ "#Result \n",
+ "print(\"angular speed in radian is\",delta_theta,\"*10**-4\");\n",
+ "print(\"radius of the spread in mm is\",r1);\n",
+ "print(\"area of the spread in m^2 is\",A);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('angular speed in radian is', 6.328, '*10**-4')\n('radius of the spread in mm is', 3.164)\n('area of the spread in m^2 is', 3.1450157329451454e-05)\n"
+ "text": [
+ "('angular speed in radian is', 6.328, '*10**-4')\n",
+ "('radius of the spread in mm is', 3.164)\n",
+ "('area of the spread in m^2 is', 3.1450157329451454e-05)\n"
+ ]
}
],
"prompt_number": 2
@@ -226,7 +455,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_3.ipynb b/Engineering_Physics/Chapter_3.ipynb
index 59daaddd..eaf6dcb1 100644
--- a/Engineering_Physics/Chapter_3.ipynb
+++ b/Engineering_Physics/Chapter_3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 3"
+ "name": "",
+ "signature": "sha256:638145e2db582b1570b31e3d891635b15bb11943d1ff2ba0aa0dc17ebaf02200"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,46 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Fibre Optics"
+ "source": [
+ "Fibre Optics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.1, Page number 98 "
+ "source": [
+ "Example number 3.1, Page number 98 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture of an optical fibre\n\n#importing modules\nimport math\n\n#Variable declaration\nn1=1.6; #refractive index of core\nn2=1.5; #refractive index of cladding\n\n#Calculation\nNA=math.sqrt((n1**2)-(n2**2));\nNA=math.ceil(NA*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"the numerical aperture of the fibre is\",NA);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.6; #refractive index of core\n",
+ "n2=1.5; #refractive index of cladding\n",
+ "\n",
+ "#Calculation\n",
+ "NA=math.sqrt((n1**2)-(n2**2));\n",
+ "NA=math.ceil(NA*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the numerical aperture of the fibre is\",NA);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the numerical aperture of the fibre is', 0.5568)\n"
+ "text": [
+ "('the numerical aperture of the fibre is', 0.5568)\n"
+ ]
}
],
"prompt_number": 4
@@ -38,19 +60,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.2, Page number 98 "
+ "source": [
+ "Example number 3.2, Page number 98 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture and acceptance angle of a fibre\n\n#importing modules\nimport math\n\n#Variable declaration\nn1=1.54; #refractive index of core\nn2=1.5; #refractive index of cladding\nn0=1;\n\n#Calculation\nNA=math.sqrt((n1**2)-(n2**2)); #numerical aperture of fibre\nNA=math.ceil(NA*10**5)/10**5; #rounding off to 5 decimals\nalpha=math.asin(NA/n0); #acceptance angle in radians\nalpha=alpha*57.2957795; #converting radians to degrees\nalpha=math.ceil(alpha*10**5)/10**5; #rounding off to 5 decimals\ndeg=int(alpha); #converting to degrees\nt=60*(alpha-deg); \nmi=int(t); #converting to minutes\nsec=60*(t-mi); #converting to seconds\nsec=math.ceil(sec*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"the numerical aperture of the fibre is\",NA);\nprint(\"the acceptance angle of the fibre in degrees is\",alpha);\nprint(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n\n#answer for the angle given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.54; #refractive index of core\n",
+ "n2=1.5; #refractive index of cladding\n",
+ "n0=1;\n",
+ "\n",
+ "#Calculation\n",
+ "NA=math.sqrt((n1**2)-(n2**2)); #numerical aperture of fibre\n",
+ "NA=math.ceil(NA*10**5)/10**5; #rounding off to 5 decimals\n",
+ "alpha=math.asin(NA/n0); #acceptance angle in radians\n",
+ "alpha=alpha*57.2957795; #converting radians to degrees\n",
+ "alpha=math.ceil(alpha*10**5)/10**5; #rounding off to 5 decimals\n",
+ "deg=int(alpha); #converting to degrees\n",
+ "t=60*(alpha-deg); \n",
+ "mi=int(t); #converting to minutes\n",
+ "sec=60*(t-mi); #converting to seconds\n",
+ "sec=math.ceil(sec*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the numerical aperture of the fibre is\",NA);\n",
+ "print(\"the acceptance angle of the fibre in degrees is\",alpha);\n",
+ "print(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n",
+ "\n",
+ "#answer for the angle given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the numerical aperture of the fibre is', 0.34872)\n('the acceptance angle of the fibre in degrees is', 20.40905)\n('acceptance angle of the fibre is', 20, 'degrees', 24, 'minutes', 32.581, 'seconds')\n"
+ "text": [
+ "('the numerical aperture of the fibre is', 0.34872)\n",
+ "('the acceptance angle of the fibre in degrees is', 20.40905)\n",
+ "('acceptance angle of the fibre is', 20, 'degrees', 24, 'minutes', 32.581, 'seconds')\n"
+ ]
}
],
"prompt_number": 7
@@ -59,19 +115,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.3, Page number 99"
+ "source": [
+ "Example number 3.3, Page number 99"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical angle\n\n#importing modules\nimport math\n\n#Variable declaration\nn1=1.6; #refractive index of core\nn2=1.49; #refractive index of cladding\n\n#Calculation\nthetac=math.asin(n2/n1); #critical angle in radians\nthetac=thetac*57.2957795; #converting radians to degrees\ntheta_c=math.ceil(thetac*10**3)/10**3; #rounding off to 3 decimals\ndeg=int(thetac); #converting to degrees\nt=60*(thetac-deg); \nmi=int(t); #converting to minutes\nsec=60*(t-mi); #converting to seconds\nsec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"the critical angle of the fibre in degrees is\",theta_c);\nprint(\"critical angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.6; #refractive index of core\n",
+ "n2=1.49; #refractive index of cladding\n",
+ "\n",
+ "#Calculation\n",
+ "thetac=math.asin(n2/n1); #critical angle in radians\n",
+ "thetac=thetac*57.2957795; #converting radians to degrees\n",
+ "theta_c=math.ceil(thetac*10**3)/10**3; #rounding off to 3 decimals\n",
+ "deg=int(thetac); #converting to degrees\n",
+ "t=60*(thetac-deg); \n",
+ "mi=int(t); #converting to minutes\n",
+ "sec=60*(t-mi); #converting to seconds\n",
+ "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical angle of the fibre in degrees is\",theta_c);\n",
+ "print(\"critical angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical angle of the fibre in degrees is', 68.631)\n('critical angle of the fibre is', 68, 'degrees', 37, 'minutes', 49.85, 'seconds')\n"
+ "text": [
+ "('the critical angle of the fibre in degrees is', 68.631)\n",
+ "('critical angle of the fibre is', 68, 'degrees', 37, 'minutes', 49.85, 'seconds')\n"
+ ]
}
],
"prompt_number": 10
@@ -80,19 +163,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.4, Page number 99"
+ "source": [
+ "Example number 3.4, Page number 99"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the acceptance angle of a fibre\n\n#importing modules\nimport math\n\n#Variable declaration\nNA=0.15; #numerical aperture\nn2=1.55; #refractive index of cladding\nn0=1.33; #refractive index of water\n\n#Calculation\nn1=math.sqrt((NA**2)+(n2**2)); #refractive index\nn_1=math.ceil(n1*10**5)/10**5; #rounding off to 5 decimals\nalpha=math.asin(math.sqrt(n1**2-n2**2)/n0); #acceptance angle in radians\nalpha=alpha*57.2957795; #converting radians to degrees\nalphaa=math.ceil(alpha*10**3)/10**3; #rounding off to 3 decimals\ndeg=int(alpha); #converting to degrees\nt=60*(alpha-deg); \nmi=int(t); #converting to minutes\nsec=60*(t-mi); #converting to seconds\nsec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"refractive index of the core is\",n_1);\nprint(\"the acceptance angle of the fibre in degrees is\",alphaa);\nprint(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n\n#answer for acceptance angle given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "NA=0.15; #numerical aperture\n",
+ "n2=1.55; #refractive index of cladding\n",
+ "n0=1.33; #refractive index of water\n",
+ "\n",
+ "#Calculation\n",
+ "n1=math.sqrt((NA**2)+(n2**2)); #refractive index\n",
+ "n_1=math.ceil(n1*10**5)/10**5; #rounding off to 5 decimals\n",
+ "alpha=math.asin(math.sqrt(n1**2-n2**2)/n0); #acceptance angle in radians\n",
+ "alpha=alpha*57.2957795; #converting radians to degrees\n",
+ "alphaa=math.ceil(alpha*10**3)/10**3; #rounding off to 3 decimals\n",
+ "deg=int(alpha); #converting to degrees\n",
+ "t=60*(alpha-deg); \n",
+ "mi=int(t); #converting to minutes\n",
+ "sec=60*(t-mi); #converting to seconds\n",
+ "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"refractive index of the core is\",n_1);\n",
+ "print(\"the acceptance angle of the fibre in degrees is\",alphaa);\n",
+ "print(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n",
+ "\n",
+ "#answer for acceptance angle given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('refractive index of the core is', 1.55725)\n('the acceptance angle of the fibre in degrees is', 6.476)\n('acceptance angle of the fibre is', 6, 'degrees', 28, 'minutes', 32.55, 'seconds')\n"
+ "text": [
+ "('refractive index of the core is', 1.55725)\n",
+ "('the acceptance angle of the fibre in degrees is', 6.476)\n",
+ "('acceptance angle of the fibre is', 6, 'degrees', 28, 'minutes', 32.55, 'seconds')\n"
+ ]
}
],
"prompt_number": 13
@@ -101,19 +218,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.5, Page number 100"
+ "source": [
+ "Example number 3.5, Page number 100"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the refractive index of cladding\n\n#importing modules\nimport math\n\n#Variable declaration\nNA=0.26; #numerical aperture\nn1=1.5; #refractive index of core\nd=100; #core diameter in micro meter\n\n#Calculation\nd=100*(10**-6); #core diameter in metre\nn2=math.sqrt((n1**2)-(NA**2));\nn2=math.ceil(n2*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"refractive index of the cladding is\",n2);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "NA=0.26; #numerical aperture\n",
+ "n1=1.5; #refractive index of core\n",
+ "d=100; #core diameter in micro meter\n",
+ "\n",
+ "#Calculation\n",
+ "d=100*(10**-6); #core diameter in metre\n",
+ "n2=math.sqrt((n1**2)-(NA**2));\n",
+ "n2=math.ceil(n2*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"refractive index of the cladding is\",n2);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('refractive index of the cladding is', 1.4773)\n"
+ "text": [
+ "('refractive index of the cladding is', 1.4773)\n"
+ ]
}
],
"prompt_number": 16
@@ -122,19 +260,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.6, Page number 100"
+ "source": [
+ "Example number 3.6, Page number 100"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the refractive indices of core and cladding\n\n#importing modules\nimport math\n\n#Variable declaration\nNA=0.26; #numerical aperture\ndelta=0.015; #refractive index difference\n\n#Calculation\n#NA=math.sqrt(n1**2-n2**2)\n#let A=n1**2-n2**2\n#therefore A=NA**2\nA=NA**2;\n#delta=(n1**2-n2**2)/2*(n1**2)\n#let 2*(n1**2) be B\n#therefore B=A/delta\nB=A/delta;\nn1=math.sqrt(B/2);\nn1=math.ceil(n1*100)/100; #rounding off to 2 decimals\nn2=math.sqrt(n1**2-NA**2);\nn2=math.ceil(n2*10**3)/10**3; #rounding off to 4 decimals\n\n#Result\nprint(\"refractive index of the core is\",n1);\nprint(\"refractive index of the cladding is\",n2);\n\n#answer for refractive index of cladding given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "NA=0.26; #numerical aperture\n",
+ "delta=0.015; #refractive index difference\n",
+ "\n",
+ "#Calculation\n",
+ "#NA=math.sqrt(n1**2-n2**2)\n",
+ "#let A=n1**2-n2**2\n",
+ "#therefore A=NA**2\n",
+ "A=NA**2;\n",
+ "#delta=(n1**2-n2**2)/2*(n1**2)\n",
+ "#let 2*(n1**2) be B\n",
+ "#therefore B=A/delta\n",
+ "B=A/delta;\n",
+ "n1=math.sqrt(B/2);\n",
+ "n1=math.ceil(n1*100)/100; #rounding off to 2 decimals\n",
+ "n2=math.sqrt(n1**2-NA**2);\n",
+ "n2=math.ceil(n2*10**3)/10**3; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"refractive index of the core is\",n1);\n",
+ "print(\"refractive index of the cladding is\",n2);\n",
+ "\n",
+ "#answer for refractive index of cladding given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('refractive index of the core is', 1.51)\n('refractive index of the cladding is', 1.488)\n"
+ "text": [
+ "('refractive index of the core is', 1.51)\n",
+ "('refractive index of the cladding is', 1.488)\n"
+ ]
}
],
"prompt_number": 19
@@ -142,7 +313,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_4.ipynb b/Engineering_Physics/Chapter_4.ipynb
index 02198aef..d93ccbff 100644
--- a/Engineering_Physics/Chapter_4.ipynb
+++ b/Engineering_Physics/Chapter_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 4"
+ "name": "",
+ "signature": "sha256:2a55c0c681215b0dc959ddeda0187458e8ed07320f22e00a7385acd5044d2ee9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,47 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Quantum Physics"
+ "source": [
+ "Quantum Physics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.1, Page number 133 "
+ "source": [
+ "Example number 4.1, Page number 133 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the change in wavelength\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.63*10**-34; #plancks constant in Js\nm0=9.1*10**-31; #mass of the electron in kg\nc=3*10**8; #velocity of light in m/s\nphi=135; #angle of scattering in degrees\nphi=phi*0.0174532925 #converting degrees to radians \n\n#Calculation\ndelta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n\n#Result\nprint(\"change in wavelength in metres is\",delta_lamda);",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.63*10**-34; #plancks constant in Js\n",
+ "m0=9.1*10**-31; #mass of the electron in kg\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "phi=135; #angle of scattering in degrees\n",
+ "phi=phi*0.0174532925 #converting degrees to radians \n",
+ "\n",
+ "#Calculation\n",
+ "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n",
+ "\n",
+ "#Result\n",
+ "print(\"change in wavelength in metres is\",delta_lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('change in wavelength in metres is', 4.1458307496867315e-12)\n"
+ "text": [
+ "('change in wavelength in metres is', 4.1458307496867315e-12)\n"
+ ]
}
],
"prompt_number": 6
@@ -38,19 +61,63 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.2, Page number 134 "
+ "source": [
+ "Example number 4.2, Page number 134 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the compton shift, wavelength,energy and angle\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.63*10**-34; #plancks constant in Js\nm0=9.1*10**-31; #mass of the electron in kg\nc=3*10**8; #velocity of light in m/s\nlamda=2; #wavelength in angstrom\nlamdaA=lamda*10**-10; #converting lamda from Angstrom to m\nphi=90; #angle of scattering in degrees\nphi=phi*0.0174532925 #converting degrees to radians \n\n#Calculation\ndelta_lamda=(h*(1-math.cos(phi)))/(m0*c);\ndelta_lamda=delta_lamda*10**10; #converting delta_lamda from m to Angstrom\ndelta_lamda=math.ceil(delta_lamda*10**5)/10**5; #rounding off to 5 decimals\nlamda_dash=delta_lamda+lamda;\nlamdaA_dash=lamda_dash*10**-10; #converting lamda_dash from Angstrom to m\n#energy E=h*new-h*new_dash\nE=h*c*((1/lamdaA)-(1/lamdaA_dash));\nEeV=E/(1.602176565*10**-19); #converting J to eV\nEeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\nnew=c/lamda;\nnew_dash=c/lamda_dash;\ntheta=math.atan((h*new*math.sin(phi))/((h*new)-(h*new_dash*math.cos(phi))));\ntheta=theta*57.2957795; #converting radians to degrees\n\n#Result\nprint(\"change in compton shift in Angstrom is\",delta_lamda);\nprint(\"wavelength of scattered photons in Angstrom is\",lamda_dash);\nprint(\"energy of recoiling electron in J is\",E);\nprint(\"energy of recoiling electron in eV is\",EeV);\nprint(\"angle at which recoiling electron appears in degrees is\",int(theta));\n\n#answers given in the book are wrong",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.63*10**-34; #plancks constant in Js\n",
+ "m0=9.1*10**-31; #mass of the electron in kg\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "lamda=2; #wavelength in angstrom\n",
+ "lamdaA=lamda*10**-10; #converting lamda from Angstrom to m\n",
+ "phi=90; #angle of scattering in degrees\n",
+ "phi=phi*0.0174532925 #converting degrees to radians \n",
+ "\n",
+ "#Calculation\n",
+ "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n",
+ "delta_lamda=delta_lamda*10**10; #converting delta_lamda from m to Angstrom\n",
+ "delta_lamda=math.ceil(delta_lamda*10**5)/10**5; #rounding off to 5 decimals\n",
+ "lamda_dash=delta_lamda+lamda;\n",
+ "lamdaA_dash=lamda_dash*10**-10; #converting lamda_dash from Angstrom to m\n",
+ "#energy E=h*new-h*new_dash\n",
+ "E=h*c*((1/lamdaA)-(1/lamdaA_dash));\n",
+ "EeV=E/(1.602176565*10**-19); #converting J to eV\n",
+ "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n",
+ "new=c/lamda;\n",
+ "new_dash=c/lamda_dash;\n",
+ "theta=math.atan((h*new*math.sin(phi))/((h*new)-(h*new_dash*math.cos(phi))));\n",
+ "theta=theta*57.2957795; #converting radians to degrees\n",
+ "\n",
+ "#Result\n",
+ "print(\"change in compton shift in Angstrom is\",delta_lamda);\n",
+ "print(\"wavelength of scattered photons in Angstrom is\",lamda_dash);\n",
+ "print(\"energy of recoiling electron in J is\",E);\n",
+ "print(\"energy of recoiling electron in eV is\",EeV);\n",
+ "print(\"angle at which recoiling electron appears in degrees is\",int(theta));\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('change in compton shift in Angstrom is', 0.02429)\n('wavelength of scattered photons in Angstrom is', 2.02429)\n('energy of recoiling electron in J is', 1.1933272900621974e-17)\n('energy of recoiling electron in eV is', 74.482)\n('angle at which recoiling electron appears in degrees is', 45)\n"
+ "text": [
+ "('change in compton shift in Angstrom is', 0.02429)\n",
+ "('wavelength of scattered photons in Angstrom is', 2.02429)\n",
+ "('energy of recoiling electron in J is', 1.1933272900621974e-17)\n",
+ "('energy of recoiling electron in eV is', 74.482)\n",
+ "('angle at which recoiling electron appears in degrees is', 45)\n"
+ ]
}
],
"prompt_number": 10
@@ -59,19 +126,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.3, Page number 135"
+ "source": [
+ "Example number 4.3, Page number 135"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the compton shift, wavelength of the scattered photon\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nm0=9.1*10**-31; #mass of the electron in kg\nc=3*10**8; #velocity of light in m/s\nphi=60; #angle of scattering in degrees\nphi=phi*0.0174532925; #converting degrees to radians\nE=10**6; #energy of photon in eV\nE=E*1.6*10**-19; #converting eV into J\n\n#Calculation\ndelta_lamda=(h*(1-math.cos(phi)))/(m0*c);\ndelta_lamda=delta_lamda*10**10; #converting metre to angstrom\ndelta_lamda=math.ceil(delta_lamda*10**4)/10**4; #rounding off to 4 decimals\nlamda=(h*c)/E;\nlamdaA=lamda*10**10; #converting metre to angstrom\nlamda_dash=delta_lamda+lamdaA;\nlamda_dash=math.ceil(lamda_dash*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"compton shift in angstrom is\",delta_lamda);\nprint(\"energy of incident photon in m\",lamda);\nprint(\"wavelength of scattered photons in angstrom is\",lamda_dash);\n\n#answer for wavelength of scattered photon given in the book is wrong",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m0=9.1*10**-31; #mass of the electron in kg\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "phi=60; #angle of scattering in degrees\n",
+ "phi=phi*0.0174532925; #converting degrees to radians\n",
+ "E=10**6; #energy of photon in eV\n",
+ "E=E*1.6*10**-19; #converting eV into J\n",
+ "\n",
+ "#Calculation\n",
+ "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n",
+ "delta_lamda=delta_lamda*10**10; #converting metre to angstrom\n",
+ "delta_lamda=math.ceil(delta_lamda*10**4)/10**4; #rounding off to 4 decimals\n",
+ "lamda=(h*c)/E;\n",
+ "lamdaA=lamda*10**10; #converting metre to angstrom\n",
+ "lamda_dash=delta_lamda+lamdaA;\n",
+ "lamda_dash=math.ceil(lamda_dash*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"compton shift in angstrom is\",delta_lamda);\n",
+ "print(\"energy of incident photon in m\",lamda);\n",
+ "print(\"wavelength of scattered photons in angstrom is\",lamda_dash);\n",
+ "\n",
+ "#answer for wavelength of scattered photon given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('compton shift in angstrom is', 0.0122)\n('energy of incident photon in m', 1.242375e-12)\n('wavelength of scattered photons in angstrom is', 0.025)\n"
+ "text": [
+ "('compton shift in angstrom is', 0.0122)\n",
+ "('energy of incident photon in m', 1.242375e-12)\n",
+ "('wavelength of scattered photons in angstrom is', 0.025)\n"
+ ]
}
],
"prompt_number": 13
@@ -80,19 +181,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.4, Page number 135"
+ "source": [
+ "Example number 4.4, Page number 135"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of photons emitted\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nc=3*10**8; #velocity of light in m/s\nlamda=5893; #wavelength in angstrom\nP=60; #output power in Watt\n\n#Calculation\nlamda=lamda*10**-10; #wavelength in metre\nE=(h*c)/lamda;\nEeV=E/(1.602176565*10**-19); #converting J to eV\nEeV=math.ceil(EeV*10**4)/10**4; #rounding off to 4 decimals\nN=P/E;\n\n#Result\nprint(\"energy of photon in J is\",E);\nprint(\"energy of photon in eV is\",EeV);\nprint(\"number of photons emitted per se cond is\",N);\n\n#answer for energy in eV given in the book is wrong",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "lamda=5893; #wavelength in angstrom\n",
+ "P=60; #output power in Watt\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=lamda*10**-10; #wavelength in metre\n",
+ "E=(h*c)/lamda;\n",
+ "EeV=E/(1.602176565*10**-19); #converting J to eV\n",
+ "EeV=math.ceil(EeV*10**4)/10**4; #rounding off to 4 decimals\n",
+ "N=P/E;\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy of photon in J is\",E);\n",
+ "print(\"energy of photon in eV is\",EeV);\n",
+ "print(\"number of photons emitted per se cond is\",N);\n",
+ "\n",
+ "#answer for energy in eV given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy of photon in J is', 3.373154590191753e-19)\n('energy of photon in eV is', 2.1054)\n('number of photons emitted per se cond is', 1.7787503773015396e+20)\n"
+ "text": [
+ "('energy of photon in J is', 3.373154590191753e-19)\n",
+ "('energy of photon in eV is', 2.1054)\n",
+ "('number of photons emitted per se cond is', 1.7787503773015396e+20)\n"
+ ]
}
],
"prompt_number": 15
@@ -101,19 +231,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.5, Page number 136"
+ "source": [
+ "Example number 4.5, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the momentum, energy and mass of a photon\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nc=3*10**8; #velocity of light in m/s\nlamda=10; #wavelength in angstrom\n\n#Calculation\nlamda=lamda*10**-10; #wavelength in metre\nE=(h*c)/lamda;\nEeV=E/(1.602176565*10**-19); #converting J to eV\nEeV=EeV*10**-3; #converting eV to keV\nEeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\nP=h/lamda;\nM=h/(lamda*c);\n\n#Result\nprint(\"energy of photon in J is\",E);\nprint(\"energy of photon in keV is\",EeV);\nprint(\"momentum in kg m/sec is\",P);\nprint(\"mass of photon in kg is\",M);\n\n#answer for energy of photon in keV given in the book is wrong by 1 decimal",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "lamda=10; #wavelength in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=lamda*10**-10; #wavelength in metre\n",
+ "E=(h*c)/lamda;\n",
+ "EeV=E/(1.602176565*10**-19); #converting J to eV\n",
+ "EeV=EeV*10**-3; #converting eV to keV\n",
+ "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n",
+ "P=h/lamda;\n",
+ "M=h/(lamda*c);\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy of photon in J is\",E);\n",
+ "print(\"energy of photon in keV is\",EeV);\n",
+ "print(\"momentum in kg m/sec is\",P);\n",
+ "print(\"mass of photon in kg is\",M);\n",
+ "\n",
+ "#answer for energy of photon in keV given in the book is wrong by 1 decimal"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy of photon in J is', 1.9878e-16)\n('energy of photon in keV is', 1.241)\n('momentum in kg m/sec is', 6.626e-25)\n('mass of photon in kg is', 2.2086666666666664e-33)\n"
+ "text": [
+ "('energy of photon in J is', 1.9878e-16)\n",
+ "('energy of photon in keV is', 1.241)\n",
+ "('momentum in kg m/sec is', 6.626e-25)\n",
+ "('mass of photon in kg is', 2.2086666666666664e-33)\n"
+ ]
}
],
"prompt_number": 18
@@ -122,19 +284,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.6, Page number 136"
+ "source": [
+ "Example number 4.6, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\ne=1.602*10**-19;\nV=1.25; #potential difference in kV\n\n#Calculation\nV=V*10**3; #converting kV to V\nlamda=h/math.sqrt(2*m*e*V);\nlamda=lamda*10**10; #converting metre to angstrom\nlamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"de Broglie wavelength in angstrom is\",lamda);",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "e=1.602*10**-19;\n",
+ "V=1.25; #potential difference in kV\n",
+ "\n",
+ "#Calculation\n",
+ "V=V*10**3; #converting kV to V\n",
+ "lamda=h/math.sqrt(2*m*e*V);\n",
+ "lamda=lamda*10**10; #converting metre to angstrom\n",
+ "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"de Broglie wavelength in angstrom is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('de Broglie wavelength in angstrom is', 0.3471)\n"
+ "text": [
+ "('de Broglie wavelength in angstrom is', 0.3471)\n"
+ ]
}
],
"prompt_number": 21
@@ -143,19 +327,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.7, Page number 136"
+ "source": [
+ "Example number 4.7, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the de Broglie wavelength\n\n#importing modules\nimport math\n\n#Variable declaration\nE=45; #energy of electron in eV\nE=E*1.6*10**-19; #energy in J\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\n\n#Calculation\nlamda=h/math.sqrt(2*m*E);\nlamda=lamda*10**10; #converting metres to angstrom\nlamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"de Broglie wavelength in angstrom is\",lamda);",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "E=45; #energy of electron in eV\n",
+ "E=E*1.6*10**-19; #energy in J\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=h/math.sqrt(2*m*E);\n",
+ "lamda=lamda*10**10; #converting metres to angstrom\n",
+ "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"de Broglie wavelength in angstrom is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('de Broglie wavelength in angstrom is', 1.8305)\n"
+ "text": [
+ "('de Broglie wavelength in angstrom is', 1.8305)\n"
+ ]
}
],
"prompt_number": 24
@@ -164,19 +369,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.8, Page number 137"
+ "source": [
+ "Example number 4.8, Page number 137"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the de Broglie wavelength\n\n#importing modules\nimport math\n\n#Variable declaration\nv=10**7; #velocity of electron in m/sec\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\n\n#Calculation\nlamda=h/(m*v);\nlamda=lamda*10**10; #converting metres to angstrom\nlamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"de Broglie wavelength in angstrom is\",lamda);",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "v=10**7; #velocity of electron in m/sec\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=h/(m*v);\n",
+ "lamda=lamda*10**10; #converting metres to angstrom\n",
+ "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"de Broglie wavelength in angstrom is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('de Broglie wavelength in angstrom is', 0.7282)\n"
+ "text": [
+ "('de Broglie wavelength in angstrom is', 0.7282)\n"
+ ]
}
],
"prompt_number": 25
@@ -185,19 +410,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.9, Page number 137"
+ "source": [
+ "Example number 4.9, Page number 137"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the de Broglie wavelength of alpha particle\n\n#importing modules\nimport math\n\n#Variable declaration\nV=1000; #potential difference in V\nh=6.626*10**-34; #plancks constant in Js\nm=1.67*10**-27; #mass of proton in kg\ne=1.6*10**-19; #charge of electron in J\n\n#Calculation\nlamda=h/math.sqrt(2*m*e*V);\n\n#Result\nprint(\"de Broglie wavelength of alpha particle in metre is\",lamda);",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "V=1000; #potential difference in V\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=1.67*10**-27; #mass of proton in kg\n",
+ "e=1.6*10**-19; #charge of electron in J\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=h/math.sqrt(2*m*e*V);\n",
+ "\n",
+ "#Result\n",
+ "print(\"de Broglie wavelength of alpha particle in metre is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('de Broglie wavelength of alpha particle in metre is', 9.063964727801313e-13)\n"
+ "text": [
+ "('de Broglie wavelength of alpha particle in metre is', 9.063964727801313e-13)\n"
+ ]
}
],
"prompt_number": 26
@@ -206,19 +450,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.10, Page number 138"
+ "source": [
+ "Example number 4.10, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the probability of finding the particle\n\n#importing modules\nimport math\n\n#Variable declaration\nL=25; #width of potential in armstrong\ndelta_x=0.05; #interval in armstrong\nn=1; #particle is in its least energy\nx=L/2; #particle is at the centre\npi=180; #angle in degrees\n\n#Calculation\npi=pi*0.0174532925; #angle in radians\nL=L*10**-10; #width in m\ndelta_x=delta_x*10**-10; #interval in m\n#probability P = integration of (A**2)*(math.sin(n*pi*x/L))**2*delta_x\n#but A=math.sqrt(2/L)\n#since the particle is in a small interval integration need not be applied\n#therefore P=2*(L**(-1))*(math.sin(n*pi*x/L))**2*delta_x\nP=2*(L**(-1))*((math.sin(n*pi*x/L))**2)*delta_x;\nP=math.ceil(P*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"probability of finding the particle is\",P);",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "L=25; #width of potential in armstrong\n",
+ "delta_x=0.05; #interval in armstrong\n",
+ "n=1; #particle is in its least energy\n",
+ "x=L/2; #particle is at the centre\n",
+ "pi=180; #angle in degrees\n",
+ "\n",
+ "#Calculation\n",
+ "pi=pi*0.0174532925; #angle in radians\n",
+ "L=L*10**-10; #width in m\n",
+ "delta_x=delta_x*10**-10; #interval in m\n",
+ "#probability P = integration of (A**2)*(math.sin(n*pi*x/L))**2*delta_x\n",
+ "#but A=math.sqrt(2/L)\n",
+ "#since the particle is in a small interval integration need not be applied\n",
+ "#therefore P=2*(L**(-1))*(math.sin(n*pi*x/L))**2*delta_x\n",
+ "P=2*(L**(-1))*((math.sin(n*pi*x/L))**2)*delta_x;\n",
+ "P=math.ceil(P*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"probability of finding the particle is\",P);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('probability of finding the particle is', 0.004)\n"
+ "text": [
+ "('probability of finding the particle is', 0.004)\n"
+ ]
}
],
"prompt_number": 27
@@ -227,19 +499,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.11, Page number 138"
+ "source": [
+ "Example number 4.11, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lowest energy of electron in eV\n\n#importing modules\nimport math\n\n#Variable declaration\nn=1;\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\nL=1; #width of potential well in angstrom\n\n#Calculation\nL=L*10**-10; #converting angstrom into metre\nE=((n**2)*h**2)/(8*m*L**2);\nEeV=E/(1.6*10**-19); #converting J to eV\nEeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"lowest energy of electron in J is\",E);\nprint(\"lowest energy of electron in eV is\",EeV);",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=1;\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "L=1; #width of potential well in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-10; #converting angstrom into metre\n",
+ "E=((n**2)*h**2)/(8*m*L**2);\n",
+ "EeV=E/(1.6*10**-19); #converting J to eV\n",
+ "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lowest energy of electron in J is\",E);\n",
+ "print(\"lowest energy of electron in eV is\",EeV);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lowest energy of electron in J is', 6.030752197802197e-18)\n('lowest energy of electron in eV is', 37.693)\n"
+ "text": [
+ "('lowest energy of electron in J is', 6.030752197802197e-18)\n",
+ "('lowest energy of electron in eV is', 37.693)\n"
+ ]
}
],
"prompt_number": 28
@@ -248,19 +544,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.12, Page number 139"
+ "source": [
+ "Example number 4.12, Page number 139"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lowest energy of the system\n\n#importing modules\nimport math\n\n#Variable declaration\nn=1;\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\nL=1; #width of potential well in angstrom\n\n#Calculation\nL=L*10**-10; #converting angstrom into metre\nE=(2*(n**2)*h**2)/(8*m*L**2);\nE=E/(1.6*10**-19); #converting J to eV\nE=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"lowest energy of system in eV is\",E);",
+ "input": [
+ " \n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=1;\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "L=1; #width of potential well in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-10; #converting angstrom into metre\n",
+ "E=(2*(n**2)*h**2)/(8*m*L**2);\n",
+ "E=E/(1.6*10**-19); #converting J to eV\n",
+ "E=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lowest energy of system in eV is\",E);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lowest energy of system in eV is', 75.385)\n"
+ "text": [
+ "('lowest energy of system in eV is', 75.385)\n"
+ ]
}
],
"prompt_number": 29
@@ -269,19 +587,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.13, Page number 139"
+ "source": [
+ "Example number 4.13, Page number 139"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lowest energy of the system and quantum numbers\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\nL=1; #width of potential well in angstrom\n\n#Calculation\nL=L*10**-10; #converting angstrom into metre\n#according to pauli's exclusion principle, 1st electron occupies n1=1 and second electron occupies n2=2\nn1=1;\nn2=2;\nE=((2*(n1**2)*h**2)/(8*m*L**2))+(((n2**2)*h**2)/(8*m*L**2));\nE=E/(1.6*10**-19); #converting J to eV\nE=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"lowest energy of system in eV is\",E);\nprint(\"quantum numbers are\");\nprint(\"n=1,l=0,mL=0,mS=+1/2\");\nprint(\"n=1,l=0,mL=0,mS=-1/2\");\nprint(\"n=2,l=0,mL=0,mS=+1/2\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "L=1; #width of potential well in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-10; #converting angstrom into metre\n",
+ "#according to pauli's exclusion principle, 1st electron occupies n1=1 and second electron occupies n2=2\n",
+ "n1=1;\n",
+ "n2=2;\n",
+ "E=((2*(n1**2)*h**2)/(8*m*L**2))+(((n2**2)*h**2)/(8*m*L**2));\n",
+ "E=E/(1.6*10**-19); #converting J to eV\n",
+ "E=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lowest energy of system in eV is\",E);\n",
+ "print(\"quantum numbers are\");\n",
+ "print(\"n=1,l=0,mL=0,mS=+1/2\");\n",
+ "print(\"n=1,l=0,mL=0,mS=-1/2\");\n",
+ "print(\"n=2,l=0,mL=0,mS=+1/2\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lowest energy of system in eV is', 226.154)\nquantum numbers are\nn=1,l=0,mL=0,mS=+1/2\nn=1,l=0,mL=0,mS=-1/2\nn=2,l=0,mL=0,mS=+1/2\n"
+ "text": [
+ "('lowest energy of system in eV is', 226.154)\n",
+ "quantum numbers are\n",
+ "n=1,l=0,mL=0,mS=+1/2\n",
+ "n=1,l=0,mL=0,mS=-1/2\n",
+ "n=2,l=0,mL=0,mS=+1/2\n"
+ ]
}
],
"prompt_number": 30
@@ -290,19 +641,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.14, Page number 140"
+ "source": [
+ "Example number 4.14, Page number 140"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mass of the particle\n\n#Variable declaration\nn=1;\nh=6.626*10**-34; #plancks constant in Js\nL=100; #width of potential well in angstrom\n\n#Calculation\nL=L*10**-10; #converting angstrom into metre\nE=0.025; #lowest energy in eV\nE=E*(1.6*10**-19); #converting eV to J\nm=((n**2)*h**2)/(8*E*L**2);\n\n#Result\nprint(\"mass of the particle in kg is\",m);",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "n=1;\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "L=100; #width of potential well in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-10; #converting angstrom into metre\n",
+ "E=0.025; #lowest energy in eV\n",
+ "E=E*(1.6*10**-19); #converting eV to J\n",
+ "m=((n**2)*h**2)/(8*E*L**2);\n",
+ "\n",
+ "#Result\n",
+ "print(\"mass of the particle in kg is\",m);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('mass of the particle in kg is', 1.3719961249999998e-31)\n"
+ "text": [
+ "('mass of the particle in kg is', 1.3719961249999998e-31)\n"
+ ]
}
],
"prompt_number": 31
@@ -311,19 +681,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.15, Page number 141"
+ "source": [
+ "Example number 4.15, Page number 141"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy density\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nT=6000; #temperature in K\nh=6.626*10**-34; #plancks constant in Js\nc=3*10**8; #velocity of light in m/s\nlamda1=450; #wavelength in nm\nlamda2=460; #wavelength in nm\n\n#Calculation\nlamda1=lamda1*10**-9; #converting nm to metre\nlamda2=lamda2*10**-9; #converting nm to metre\nnew1=c/lamda1;\nnew2=c/lamda2;\nnew=(new1+new2)/2;\nA=math.exp((h*new)/(k*T));\nrho_v=(8*math.pi*h*new**3)/(A*c**3);\n\n#Result\nprint(\"energy density of the black body in J/m^3 is\",rho_v);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k=1.38*10**-23;\n",
+ "T=6000; #temperature in K\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "lamda1=450; #wavelength in nm\n",
+ "lamda2=460; #wavelength in nm\n",
+ "\n",
+ "#Calculation\n",
+ "lamda1=lamda1*10**-9; #converting nm to metre\n",
+ "lamda2=lamda2*10**-9; #converting nm to metre\n",
+ "new1=c/lamda1;\n",
+ "new2=c/lamda2;\n",
+ "new=(new1+new2)/2;\n",
+ "A=math.exp((h*new)/(k*T));\n",
+ "rho_v=(8*math.pi*h*new**3)/(A*c**3);\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy density of the black body in J/m^3 is\",rho_v);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy density of the black body in J/m^3 is', 9.033622836188887e-16)\n"
+ "text": [
+ "('energy density of the black body in J/m^3 is', 9.033622836188887e-16)\n"
+ ]
}
],
"prompt_number": 32
@@ -331,7 +731,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_6.ipynb b/Engineering_Physics/Chapter_6.ipynb
index 1445b978..df63cdce 100644
--- a/Engineering_Physics/Chapter_6.ipynb
+++ b/Engineering_Physics/Chapter_6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 6"
+ "name": "",
+ "signature": "sha256:95589aa74fb7b8b919d364696d403ce9619ba363e3435f491e57c82d78d5e42c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,53 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Crystallography"
+ "source": [
+ "Crystallography"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.1, Page number 185"
+ "source": [
+ "Example number 6.1, Page number 185"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the density of diamond\n\n#importing modules\nimport math\n\n#Variable declaration\nr=0.071; #radius in nm\nN=6.022*10**26; \n\n#Calculation\nr=r*10**-9; #converting r from nm to m\n#mass of carbon atom m = 12/N\nm=12/N;\n#mass of diamond M = 8*mass of one carbon atom\nM=8*m;\n#volume of diamond V = (8*r/sqrt(3))^3\nV=(8*r/math.sqrt(3))**3;\nd=M/V; #density in kg/m^3\nd=math.ceil(d*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"density of diamond in kg/m^3 is\",d);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "r=0.071; #radius in nm\n",
+ "N=6.022*10**26; \n",
+ "\n",
+ "#Calculation\n",
+ "r=r*10**-9; #converting r from nm to m\n",
+ "#mass of carbon atom m = 12/N\n",
+ "m=12/N;\n",
+ "#mass of diamond M = 8*mass of one carbon atom\n",
+ "M=8*m;\n",
+ "#volume of diamond V = (8*r/sqrt(3))^3\n",
+ "V=(8*r/math.sqrt(3))**3;\n",
+ "d=M/V; #density in kg/m^3\n",
+ "d=math.ceil(d*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"density of diamond in kg/m^3 is\",d);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('density of diamond in kg/m^3 is', 4520.31)\n"
+ "text": [
+ "('density of diamond in kg/m^3 is', 4520.31)\n"
+ ]
}
],
"prompt_number": 3
@@ -38,19 +67,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.2, Page number 185"
+ "source": [
+ "Example number 6.2, Page number 185"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the percentage volume change\n\n#importing modules\nimport math\n\n#Variable declaration\naBCC=0.332; #lattice constant in nm\naHCP=0.296; #lattice constant in nm\nc=0.468; #c in nm\n\n#Calculation\naBCC=aBCC*10**-9; #converting nm to m\nVbcc=aBCC**3;\naHCP=aHCP*10**-9; #converting nm to m\nc=c*10**-9; #converting nm to m\nVhcp=6*(math.sqrt(3)/4)*aHCP**2*c;\nV=Vhcp-Vbcc;\nVch=(V*100)/Vbcc;\nVch=math.ceil(Vch*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"percentage change in volume is\",Vch);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "aBCC=0.332; #lattice constant in nm\n",
+ "aHCP=0.296; #lattice constant in nm\n",
+ "c=0.468; #c in nm\n",
+ "\n",
+ "#Calculation\n",
+ "aBCC=aBCC*10**-9; #converting nm to m\n",
+ "Vbcc=aBCC**3;\n",
+ "aHCP=aHCP*10**-9; #converting nm to m\n",
+ "c=c*10**-9; #converting nm to m\n",
+ "Vhcp=6*(math.sqrt(3)/4)*aHCP**2*c;\n",
+ "V=Vhcp-Vbcc;\n",
+ "Vch=(V*100)/Vbcc;\n",
+ "Vch=math.ceil(Vch*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"percentage change in volume is\",Vch);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('percentage change in volume is', 191.12)\n"
+ "text": [
+ "('percentage change in volume is', 191.12)\n"
+ ]
}
],
"prompt_number": 4
@@ -59,19 +116,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.3, Page number 186"
+ "source": [
+ "Example number 6.3, Page number 186"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the density\n\n#importing modules\nimport math\n\n#Variable declaration\nr=1.278; #atomic radius of Cu in Angstrom\nA=63.54; #atomic weight of Cu\nn=4; #for FCC n=4\nNa=6.022*10**26;\n\n#Calculation\nr=r*10**-10; #converting atomic radius from Angstrom to m\na=2*math.sqrt(2)*r; \nrho=(n*A)/(Na*a**3);\nrho=math.ceil(rho*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"density of Cu in kg/m^3 is\",rho);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "r=1.278; #atomic radius of Cu in Angstrom\n",
+ "A=63.54; #atomic weight of Cu\n",
+ "n=4; #for FCC n=4\n",
+ "Na=6.022*10**26;\n",
+ "\n",
+ "#Calculation\n",
+ "r=r*10**-10; #converting atomic radius from Angstrom to m\n",
+ "a=2*math.sqrt(2)*r; \n",
+ "rho=(n*A)/(Na*a**3);\n",
+ "rho=math.ceil(rho*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"density of Cu in kg/m^3 is\",rho);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('density of Cu in kg/m^3 is', 8935.92)\n"
+ "text": [
+ "('density of Cu in kg/m^3 is', 8935.92)\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +162,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.4, Page number 186"
+ "source": [
+ "Example number 6.4, Page number 186"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the distance between adjacent atoms\n\n#importing modules\nimport math\nimport numpy as np\n\n#Variable declaration\nrho=2180; #density of NaCl in kg/m^3\nwNa=23; #atomic weight of Na\nwCl=35.5; #atomic weight of Cl\nn=4; #for FCC n=4\nNa=6.022*10**26;\n\n#Calculation\nA=wNa+wCl; #molecular weight of NaCl\nx=np.reciprocal(3.);\na=((n*A)/(Na*rho))**x;\n\n#Result\nprint(\"interatomic distance in NaCl in m is\",a); \n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho=2180; #density of NaCl in kg/m^3\n",
+ "wNa=23; #atomic weight of Na\n",
+ "wCl=35.5; #atomic weight of Cl\n",
+ "n=4; #for FCC n=4\n",
+ "Na=6.022*10**26;\n",
+ "\n",
+ "#Calculation\n",
+ "A=wNa+wCl; #molecular weight of NaCl\n",
+ "x=np.reciprocal(3.);\n",
+ "a=((n*A)/(Na*rho))**x;\n",
+ "\n",
+ "#Result\n",
+ "print(\"interatomic distance in NaCl in m is\",a); \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('interatomic distance in NaCl in m is', 5.6278114346454509e-10)\n"
+ "text": [
+ "('interatomic distance in NaCl in m is', 5.6278114346454509e-10)\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +207,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.5, Page number 187"
+ "source": [
+ "Example number 6.5, Page number 187"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the interplanar spacing\n\n#importing modules\nimport math\n\n#Variable declaration\na=0.42; #lattice constant in nm\nh1=1;\nk1=0;\nl1=1; #indices of the plane (101)\nh2=2;\nk2=2;\nl2=1; #indices of the plane (221)\n\n#Calculation\na=a*10**-9; #converting from nm to m\nd1=a/math.sqrt((h1**2)+(k1**2)+(l1**2)); #interplanar spacing for plane (101)\nd1=d1*10**9; #converting from m to nm\nd1=math.ceil(d1*10**5)/10**5; #rounding off to 5 decimals\nd2=a/math.sqrt((h2**2)+(k2**2)+(l2**2)); #interplanar spacing for plane (221)\nd2=d2*10**9; #converting from m to nm\n\n#Result\nprint(\"interplanar spacing for (101) in nm is\",d1);\nprint(\"interplanar spacing for (221) in nm is\",d2);\n\n",
+ "input": [
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=0.42; #lattice constant in nm\n",
+ "h1=1;\n",
+ "k1=0;\n",
+ "l1=1; #indices of the plane (101)\n",
+ "h2=2;\n",
+ "k2=2;\n",
+ "l2=1; #indices of the plane (221)\n",
+ "\n",
+ "#Calculation\n",
+ "a=a*10**-9; #converting from nm to m\n",
+ "d1=a/math.sqrt((h1**2)+(k1**2)+(l1**2)); #interplanar spacing for plane (101)\n",
+ "d1=d1*10**9; #converting from m to nm\n",
+ "d1=math.ceil(d1*10**5)/10**5; #rounding off to 5 decimals\n",
+ "d2=a/math.sqrt((h2**2)+(k2**2)+(l2**2)); #interplanar spacing for plane (221)\n",
+ "d2=d2*10**9; #converting from m to nm\n",
+ "\n",
+ "#Result\n",
+ "print(\"interplanar spacing for (101) in nm is\",d1);\n",
+ "print(\"interplanar spacing for (221) in nm is\",d2);\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('interplanar spacing for (101) in nm is', 0.29699)\n('interplanar spacing for (221) in nm is', 0.14)\n"
+ "text": [
+ "('interplanar spacing for (101) in nm is', 0.29699)\n",
+ "('interplanar spacing for (221) in nm is', 0.14)\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +257,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.6, Page number 187"
+ "source": [
+ "Example number 6.6, Page number 187"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To identify the axial intercepts\n\n#Variable declaration\nh1=1;\nk1=0;\nl1=2; #indices for plane (102)\nh2=2;\nk2=3;\nl2=1; #indices for plane (231)\nh3=3;\nk3=-1;\nl3=2; #indices for plane (31'2)\n\n#Calculation\n#intercepts made by the plane is a/h, b/k, c/l\n#for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n#for plane (231) intercepts are a/2, b/3, c/1=c\n#for plane (31'2) intercepts are a/3=a, b/-1=-b, c/2\n\n#Result\nprint(\"for plane (102) intercepts are a/1=a, b/0=infinite, c/2\");\nprint(\"for plane (231) intercepts are a/2, b/3, c/1=c\");\nprint(\"for plane (312) intercepts are a/3=a, b/-1=-b, c/2\");\n",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "h1=1;\n",
+ "k1=0;\n",
+ "l1=2; #indices for plane (102)\n",
+ "h2=2;\n",
+ "k2=3;\n",
+ "l2=1; #indices for plane (231)\n",
+ "h3=3;\n",
+ "k3=-1;\n",
+ "l3=2; #indices for plane (31'2)\n",
+ "\n",
+ "#Calculation\n",
+ "#intercepts made by the plane is a/h, b/k, c/l\n",
+ "#for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n",
+ "#for plane (231) intercepts are a/2, b/3, c/1=c\n",
+ "#for plane (31'2) intercepts are a/3=a, b/-1=-b, c/2\n",
+ "\n",
+ "#Result\n",
+ "print(\"for plane (102) intercepts are a/1=a, b/0=infinite, c/2\");\n",
+ "print(\"for plane (231) intercepts are a/2, b/3, c/1=c\");\n",
+ "print(\"for plane (312) intercepts are a/3=a, b/-1=-b, c/2\");\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "for plane (102) intercepts are a/1=a, b/0=infinite, c/2\nfor plane (231) intercepts are a/2, b/3, c/1=c\nfor plane (312) intercepts are a/3=a, b/-1=-b, c/2\n"
+ "text": [
+ "for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n",
+ "for plane (231) intercepts are a/2, b/3, c/1=c\n",
+ "for plane (312) intercepts are a/3=a, b/-1=-b, c/2\n"
+ ]
}
],
"prompt_number": 10
@@ -143,19 +307,57 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.7, Page number 188"
+ "source": [
+ "Example number 6.7, Page number 188"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle between 2 planes\n\n#importing modules\nimport math\n\n#Variable declaration\nu1=1;\nv1=1;\nw1=1; #indices for plane (111)\nu2=2;\nv2=1;\nw2=2; #indices for plane (212)\n\n#Calculation\nA=u1*u2+v1*v2+w1*w2; \nB1=math.sqrt((u1**2)+(v1**2)+(w1**2));\nB2=math.sqrt((u2**2)+(v2**2)+(w2**2));\nB=A/(B1*B2);\nB=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\ntheta=math.acos(B); #angle in radian\ntheta=theta*57.2957795; #converting radian to degrees\ntheeta=math.ceil(theta*10**3)/10**3; #rounding off to 3 decimals\ndeg=int(theta); #converting to degrees\nt=60*(theta-deg);\nmi=int(t); #converting to minutes\nsec=60*(t-mi); #converting to seconds\nsec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"angle between the planes in degrees is\",theeta);\nprint(\"angle between the planes is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "u1=1;\n",
+ "v1=1;\n",
+ "w1=1; #indices for plane (111)\n",
+ "u2=2;\n",
+ "v2=1;\n",
+ "w2=2; #indices for plane (212)\n",
+ "\n",
+ "#Calculation\n",
+ "A=u1*u2+v1*v2+w1*w2; \n",
+ "B1=math.sqrt((u1**2)+(v1**2)+(w1**2));\n",
+ "B2=math.sqrt((u2**2)+(v2**2)+(w2**2));\n",
+ "B=A/(B1*B2);\n",
+ "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n",
+ "theta=math.acos(B); #angle in radian\n",
+ "theta=theta*57.2957795; #converting radian to degrees\n",
+ "theeta=math.ceil(theta*10**3)/10**3; #rounding off to 3 decimals\n",
+ "deg=int(theta); #converting to degrees\n",
+ "t=60*(theta-deg);\n",
+ "mi=int(t); #converting to minutes\n",
+ "sec=60*(t-mi); #converting to seconds\n",
+ "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"angle between the planes in degrees is\",theeta);\n",
+ "print(\"angle between the planes is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('angle between the planes in degrees is', 15.783)\n('angle between the planes is', 15, 'degrees', 46, 'minutes', 57.85, 'seconds')\n"
+ "text": [
+ "('angle between the planes in degrees is', 15.783)\n",
+ "('angle between the planes is', 15, 'degrees', 46, 'minutes', 57.85, 'seconds')\n"
+ ]
}
],
"prompt_number": 13
@@ -164,12 +366,16 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.8, Page number 188"
+ "source": [
+ "Example number 6.8, Page number 188"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#sketching the crystallographic planes",
+ "input": [
+ "#sketching the crystallographic planes"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -179,19 +385,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.9, Page number 189"
+ "source": [
+ "Example number 6.9, Page number 189"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lattice constant\n\n#importing modules\nimport math\n\n#Variable declaration\nd=0.2338; #interplanar distance in nm\nh=-1;\nk=1;\nl=1; #indices of the plane (1'11)\n\n#Calculation\nd=d*10**-9; #converting from nm to m\na=d*math.sqrt((h**2)+(k**2)+(l**2));\na=a*10**9; #converting lattice constant from m to nm\na=math.ceil(a*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"lattice constant in nm is\",a);\n\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=0.2338; #interplanar distance in nm\n",
+ "h=-1;\n",
+ "k=1;\n",
+ "l=1; #indices of the plane (1'11)\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**-9; #converting from nm to m\n",
+ "a=d*math.sqrt((h**2)+(k**2)+(l**2));\n",
+ "a=a*10**9; #converting lattice constant from m to nm\n",
+ "a=math.ceil(a*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lattice constant in nm is\",a);\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lattice constant in nm is', 0.40496)\n"
+ "text": [
+ "('lattice constant in nm is', 0.40496)\n"
+ ]
}
],
"prompt_number": 15
@@ -200,19 +430,63 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.10, Page number 189"
+ "source": [
+ "Example number 6.10, Page number 189"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To show that for a simple cubic system d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n\n#importing modules\nimport math\n\n#variable declaration\nh1=1;\nk1=0;\nl1=0; #indices for plane (100)\nh2=1;\nk2=1;\nl2=0; #indices for plane (110)\nh3=1;\nk3=1;\nl3=1; #indices for plane (111)\n\n#Calculation\n#d=a/math.sqrt((h**2)+(k**2)+(l**2))\n#d100=a/math.sqrt((h1**2)+(k1**2)+(l1**2))\nx1=math.sqrt((h1**2)+(k1**2)+(l1**2));\n#d100=a/x1 = a/1 = a\n#d110=a/math.sqrt((h2**2)+(k2**2)+(l2**2))\nx2=math.sqrt((h2**2)+(k2**2)+(l2**2));\nx2=math.ceil(x2*10**4)/10**4; #rounding off to 4 decimals\n#d110=a/x2 = a/sqrt(2)\n#d111=a/math.sqrt((h3**2)+(k3**2)+(l3**2))\nx3=math.sqrt((h3**2)+(k3**2)+(l3**2));\nx3=math.ceil(x3*10**4)/10**4; #rounding off to 4 decimals\n#d111=a/x3 = a/sqrt(3)\n#hence d100:d110:d111=a:a/sqrt(2):a/sqrt(3)\n#multiplying RHS by sqrt(6) we get d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n\n#Result\nprint(\"value of x1 is\",x1);\nprint(\"value of x2 is\",x2);\nprint(\"value of x3 is\",x3);\nprint(\"d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "h1=1;\n",
+ "k1=0;\n",
+ "l1=0; #indices for plane (100)\n",
+ "h2=1;\n",
+ "k2=1;\n",
+ "l2=0; #indices for plane (110)\n",
+ "h3=1;\n",
+ "k3=1;\n",
+ "l3=1; #indices for plane (111)\n",
+ "\n",
+ "#Calculation\n",
+ "#d=a/math.sqrt((h**2)+(k**2)+(l**2))\n",
+ "#d100=a/math.sqrt((h1**2)+(k1**2)+(l1**2))\n",
+ "x1=math.sqrt((h1**2)+(k1**2)+(l1**2));\n",
+ "#d100=a/x1 = a/1 = a\n",
+ "#d110=a/math.sqrt((h2**2)+(k2**2)+(l2**2))\n",
+ "x2=math.sqrt((h2**2)+(k2**2)+(l2**2));\n",
+ "x2=math.ceil(x2*10**4)/10**4; #rounding off to 4 decimals\n",
+ "#d110=a/x2 = a/sqrt(2)\n",
+ "#d111=a/math.sqrt((h3**2)+(k3**2)+(l3**2))\n",
+ "x3=math.sqrt((h3**2)+(k3**2)+(l3**2));\n",
+ "x3=math.ceil(x3*10**4)/10**4; #rounding off to 4 decimals\n",
+ "#d111=a/x3 = a/sqrt(3)\n",
+ "#hence d100:d110:d111=a:a/sqrt(2):a/sqrt(3)\n",
+ "#multiplying RHS by sqrt(6) we get d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"value of x1 is\",x1);\n",
+ "print(\"value of x2 is\",x2);\n",
+ "print(\"value of x3 is\",x3);\n",
+ "print(\"d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('value of x1 is', 1.0)\n('value of x2 is', 1.4143)\n('value of x3 is', 1.7321)\nd100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n"
+ "text": [
+ "('value of x1 is', 1.0)\n",
+ "('value of x2 is', 1.4143)\n",
+ "('value of x3 is', 1.7321)\n",
+ "d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n"
+ ]
}
],
"prompt_number": 16
@@ -221,19 +495,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.11, Page number 190"
+ "source": [
+ "Example number 6.11, Page number 190"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the ratio of intercepts in a simple cubic crystal\n\n#variable declaration\nh=2;\nk=3;\nl=1; #indices for plane (231)\n\n#Calculation\n#intercepts made by the plane is a/h, b/k, c/l\n#for a cubic unit cell, a=b=c\n#for plane (231) intercepts are a/2, a/3, a/1 = a\n#ratio of the intercepts is 1/2:1/3:1\n#LCM is 6. multiplying by LCM, we get ratio l1:l2:l3 = 3:2:6\n\n#Result\nprint(\"l1:l2:l3 = 3:2:6\");",
+ "input": [
+ " \n",
+ "#variable declaration\n",
+ "h=2;\n",
+ "k=3;\n",
+ "l=1; #indices for plane (231)\n",
+ "\n",
+ "#Calculation\n",
+ "#intercepts made by the plane is a/h, b/k, c/l\n",
+ "#for a cubic unit cell, a=b=c\n",
+ "#for plane (231) intercepts are a/2, a/3, a/1 = a\n",
+ "#ratio of the intercepts is 1/2:1/3:1\n",
+ "#LCM is 6. multiplying by LCM, we get ratio l1:l2:l3 = 3:2:6\n",
+ "\n",
+ "#Result\n",
+ "print(\"l1:l2:l3 = 3:2:6\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "l1:l2:l3 = 3:2:6\n"
+ "text": [
+ "l1:l2:l3 = 3:2:6\n"
+ ]
}
],
"prompt_number": 17
@@ -242,19 +536,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.12, Page number 190"
+ "source": [
+ "Example number 6.12, Page number 190"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the lengths of intercepts along Y and Z axes\n\n#variable declaration\nh=1;\nk=2;\nl=3; #indices for plane (123)\nl1=0.8; #l1 in armstrong\na=0.8; #a in armstrong\nb=1.2; #b in armstrong\nc=1.5; #c in armstrong\n\n#Calculation\n#intercepts made by the plane is a/h, b/k, c/l\n#for plane (123) intercepts are a/1 = a, b/2, c/3\n#ratio of the intercepts l1:l2:l3 = a:b/2:c/3\n#thus 0.8:l2:l3 = 0.8:1.2/2:1.5/3\nl2=1.2/2; #l2 in armstrong\nl3=1.5/3; #l3 in armstrong\n\n#Result\nprint(\"value of l2 in armstrong is\",l2);\nprint(\"value of l3 in armstrong is\",l3);",
+ "input": [
+ " \n",
+ "#variable declaration\n",
+ "h=1;\n",
+ "k=2;\n",
+ "l=3; #indices for plane (123)\n",
+ "l1=0.8; #l1 in armstrong\n",
+ "a=0.8; #a in armstrong\n",
+ "b=1.2; #b in armstrong\n",
+ "c=1.5; #c in armstrong\n",
+ "\n",
+ "#Calculation\n",
+ "#intercepts made by the plane is a/h, b/k, c/l\n",
+ "#for plane (123) intercepts are a/1 = a, b/2, c/3\n",
+ "#ratio of the intercepts l1:l2:l3 = a:b/2:c/3\n",
+ "#thus 0.8:l2:l3 = 0.8:1.2/2:1.5/3\n",
+ "l2=1.2/2; #l2 in armstrong\n",
+ "l3=1.5/3; #l3 in armstrong\n",
+ "\n",
+ "#Result\n",
+ "print(\"value of l2 in armstrong is\",l2);\n",
+ "print(\"value of l3 in armstrong is\",l3);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('value of l2 in armstrong is', 0.6)\n('value of l3 in armstrong is', 0.5)\n"
+ "text": [
+ "('value of l2 in armstrong is', 0.6)\n",
+ "('value of l3 in armstrong is', 0.5)\n"
+ ]
}
],
"prompt_number": 18
@@ -263,19 +584,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.13, Page number 191"
+ "source": [
+ "Example number 6.13, Page number 191"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the nearest neighbour distance\n\n#Calculation\n#in simple cubic unit cell, corner atom is the nearest neighbour to another corner atom. \n#Hence nearest neighbour distance is a.\n#in BCC the body centered atom is the nearest neighbour to a corner atom.\n#the distance between body centered atom and corner atom is 2r\n#but r=sqrt(3)*a/4\n#distance = 2*sqrt(3)*a/4 = sqrt(3)*a/2\n#in FCC the face centered atom is the nearest neighbour to a corner atom.\n#the distance between face centered atom and corner atom is 2r\n#but r = a/sqrt(8)\n#distance = 2*a/sqrt(8) = a/sqrt(2)\n\n#Result\nprint(\"in simple cubic unit cell nearest neighbour distance is a\");\nprint(\"in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\");\nprint(\"in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\");",
+ "input": [
+ " \n",
+ "#Calculation\n",
+ "#in simple cubic unit cell, corner atom is the nearest neighbour to another corner atom. \n",
+ "#Hence nearest neighbour distance is a.\n",
+ "#in BCC the body centered atom is the nearest neighbour to a corner atom.\n",
+ "#the distance between body centered atom and corner atom is 2r\n",
+ "#but r=sqrt(3)*a/4\n",
+ "#distance = 2*sqrt(3)*a/4 = sqrt(3)*a/2\n",
+ "#in FCC the face centered atom is the nearest neighbour to a corner atom.\n",
+ "#the distance between face centered atom and corner atom is 2r\n",
+ "#but r = a/sqrt(8)\n",
+ "#distance = 2*a/sqrt(8) = a/sqrt(2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"in simple cubic unit cell nearest neighbour distance is a\");\n",
+ "print(\"in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\");\n",
+ "print(\"in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "in simple cubic unit cell nearest neighbour distance is a\nin body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\nin face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\n"
+ "text": [
+ "in simple cubic unit cell nearest neighbour distance is a\n",
+ "in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\n",
+ "in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\n"
+ ]
}
],
"prompt_number": 19
@@ -284,19 +629,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.14, Page number 191"
+ "source": [
+ "Example number 6.14, Page number 191"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the spacing of the lattice plane\n\n#importing modules\nimport math\n\n#variable declaration\na=2.04; #lattice parameter in armstrong\nh=2;\nk=1;\nl=2; #indices for plane (212)\n\n#Calculation\na=a*10**-10; #converting from armstrong to m\nd=a/math.sqrt((h**2)+(k**2)+(l**2));\nd=d*10**10; #converting from m to armstrong\nd=math.ceil(d*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"interplanar distance in armstrong is\",d);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "a=2.04; #lattice parameter in armstrong\n",
+ "h=2;\n",
+ "k=1;\n",
+ "l=2; #indices for plane (212)\n",
+ "\n",
+ "#Calculation\n",
+ "a=a*10**-10; #converting from armstrong to m\n",
+ "d=a/math.sqrt((h**2)+(k**2)+(l**2));\n",
+ "d=d*10**10; #converting from m to armstrong\n",
+ "d=math.ceil(d*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"interplanar distance in armstrong is\",d);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('interplanar distance in armstrong is', 0.681)\n"
+ "text": [
+ "('interplanar distance in armstrong is', 0.681)\n"
+ ]
}
],
"prompt_number": 20
@@ -305,19 +673,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.15, Page number 191"
+ "source": [
+ "Example number 6.15, Page number 191"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of atoms per unit cell\n\n#importing modules\nimport math\n\n#variable declaration\nr=1.278; #radius of Cu in armstrong\nM=63.54; #atomic weight of Cu\nrho=8980; #density in kg/m^3\nNa=6.022*10**26;\n\n#Calculation\nr=r*10**-10; #radius in m\na=math.sqrt(8)*r;\nn=(rho*Na*a**3)/M;\n\n#Result\nprint(\"interatomic distance in m is\",a);\nprint(\"number of atoms per Cu unit cell is\",int(n));",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "r=1.278; #radius of Cu in armstrong\n",
+ "M=63.54; #atomic weight of Cu\n",
+ "rho=8980; #density in kg/m^3\n",
+ "Na=6.022*10**26;\n",
+ "\n",
+ "#Calculation\n",
+ "r=r*10**-10; #radius in m\n",
+ "a=math.sqrt(8)*r;\n",
+ "n=(rho*Na*a**3)/M;\n",
+ "\n",
+ "#Result\n",
+ "print(\"interatomic distance in m is\",a);\n",
+ "print(\"number of atoms per Cu unit cell is\",int(n));"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('interatomic distance in m is', 3.6147298654256317e-10)\n('number of atoms per Cu unit cell is', 4)\n"
+ "text": [
+ "('interatomic distance in m is', 3.6147298654256317e-10)\n",
+ "('number of atoms per Cu unit cell is', 4)\n"
+ ]
}
],
"prompt_number": 21
@@ -326,19 +718,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.16, Page number 192"
+ "source": [
+ "Example number 6.16, Page number 192"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Miller indices \n\n#variable declaration\na=0.429;\nb=1;\nc=0.379; #intercepts of an orthorhombic crystal\n\n#Calculation\n#ratio of intercepts are 0.214:1:0.188 = (a/0.429)*0.214:1:(c/0.379)*0.188 = a/2:b:c/2\n#thus the coefficients are 1/2:1:1/2. inverses are 2,1,2.\n#thus miller indices for the first plane are (212)\n#ratio of intercepts are 0.858:1:0.754 = (a/0.429)*0.0.858:1:(c/0.379)*0.754 = 2a:b:2c\n#thus the coefficients are 2:1:2. inverses are 1/2,1,1/2. LCM is 2. multiplying with LCM we get 1,2,1\n#thus miller indices for the second plane are (121)\n#ratio of intercepts are 0.429:infinite:0.126 = (a/0.429)*0.429:infinite:(c/0.379)*0.126 = a:infiniteb:c/3\n#thus the coefficients are 1:infinte:1/3. inverses are 1,0,3.\n#thus miller indices for the third plane are (103)\n\n#Result\nprint(\"miller indices for the first plane are (212)\");\nprint(\"miller indices for the second plane are (121)\");\nprint(\"miller indices for the third plane are (103)\");\n",
+ "input": [
+ " \n",
+ "#variable declaration\n",
+ "a=0.429;\n",
+ "b=1;\n",
+ "c=0.379; #intercepts of an orthorhombic crystal\n",
+ "\n",
+ "#Calculation\n",
+ "#ratio of intercepts are 0.214:1:0.188 = (a/0.429)*0.214:1:(c/0.379)*0.188 = a/2:b:c/2\n",
+ "#thus the coefficients are 1/2:1:1/2. inverses are 2,1,2.\n",
+ "#thus miller indices for the first plane are (212)\n",
+ "#ratio of intercepts are 0.858:1:0.754 = (a/0.429)*0.0.858:1:(c/0.379)*0.754 = 2a:b:2c\n",
+ "#thus the coefficients are 2:1:2. inverses are 1/2,1,1/2. LCM is 2. multiplying with LCM we get 1,2,1\n",
+ "#thus miller indices for the second plane are (121)\n",
+ "#ratio of intercepts are 0.429:infinite:0.126 = (a/0.429)*0.429:infinite:(c/0.379)*0.126 = a:infiniteb:c/3\n",
+ "#thus the coefficients are 1:infinte:1/3. inverses are 1,0,3.\n",
+ "#thus miller indices for the third plane are (103)\n",
+ "\n",
+ "#Result\n",
+ "print(\"miller indices for the first plane are (212)\");\n",
+ "print(\"miller indices for the second plane are (121)\");\n",
+ "print(\"miller indices for the third plane are (103)\");\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "miller indices for the first plane are (212)\nmiller indices for the second plane are (121)\nmiller indices for the third plane are (103)\n"
+ "text": [
+ "miller indices for the first plane are (212)\n",
+ "miller indices for the second plane are (121)\n",
+ "miller indices for the third plane are (103)\n"
+ ]
}
],
"prompt_number": 12
@@ -347,19 +767,66 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.17, Page number 193"
+ "source": [
+ "Example number 6.17, Page number 193"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of atoms per unit area\n\n#importing modules\nimport math\nimport numpy as np\n\n#variable declaration\nh1=1;\nk1=0;\nl1=0; #indices of the first plane (100)\nh2=1;\nk2=1;\nl2=0; #indices of the second plane (110)\nh3=1;\nk3=1;\nl3=1; #indices of the third plane (111)\n\n#Calculation\nn_1=np.reciprocal(4.);\nn_2=np.reciprocal(2.);\nn_3=np.reciprocal(6.);\nn1=(n_1*4)+1; #number of atoms per unit cell in (100)\n#number of atoms per m^2 is 2/a**2. but a=sqrt(8)*r.\n#hence number of atoms per m^2 is 1/(4*r**2)\nn2=(n_1*4)+(2*n_2); #number of atoms per unit cell in (110)\n#number of atoms per m^2 is 1/a*sqrt(2)*a. but a=sqrt(8)*r.\n#hence number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\nn3=(n_3*3)+(3*n_2); #number of atoms per unit cell in (111)\n#number of atoms per m^2 is 2/(sqrt(3)/4)*a**2. but a=4*r.\n#hence number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n\n#Result\nprint(\"number of atoms per unit cell in (100)\",n1);\nprint(\"number of atoms per m^2 is 1/(4*r**2)\");\nprint(\"number of atoms per unit cell in (110)\",n2);\nprint(\"number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\");\nprint(\"number of atoms per unit cell in (111)\",n3);\nprint(\"number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\");\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "import numpy as np\n",
+ "\n",
+ "#variable declaration\n",
+ "h1=1;\n",
+ "k1=0;\n",
+ "l1=0; #indices of the first plane (100)\n",
+ "h2=1;\n",
+ "k2=1;\n",
+ "l2=0; #indices of the second plane (110)\n",
+ "h3=1;\n",
+ "k3=1;\n",
+ "l3=1; #indices of the third plane (111)\n",
+ "\n",
+ "#Calculation\n",
+ "n_1=np.reciprocal(4.);\n",
+ "n_2=np.reciprocal(2.);\n",
+ "n_3=np.reciprocal(6.);\n",
+ "n1=(n_1*4)+1; #number of atoms per unit cell in (100)\n",
+ "#number of atoms per m^2 is 2/a**2. but a=sqrt(8)*r.\n",
+ "#hence number of atoms per m^2 is 1/(4*r**2)\n",
+ "n2=(n_1*4)+(2*n_2); #number of atoms per unit cell in (110)\n",
+ "#number of atoms per m^2 is 1/a*sqrt(2)*a. but a=sqrt(8)*r.\n",
+ "#hence number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n",
+ "n3=(n_3*3)+(3*n_2); #number of atoms per unit cell in (111)\n",
+ "#number of atoms per m^2 is 2/(sqrt(3)/4)*a**2. but a=4*r.\n",
+ "#hence number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"number of atoms per unit cell in (100)\",n1);\n",
+ "print(\"number of atoms per m^2 is 1/(4*r**2)\");\n",
+ "print(\"number of atoms per unit cell in (110)\",n2);\n",
+ "print(\"number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\");\n",
+ "print(\"number of atoms per unit cell in (111)\",n3);\n",
+ "print(\"number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\");\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('number of atoms per unit cell in (100)', 2.0)\nnumber of atoms per m^2 is 1/(4*r**2)\n('number of atoms per unit cell in (110)', 2.0)\nnumber of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n('number of atoms per unit cell in (111)', 2.0)\nnumber of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n"
+ "text": [
+ "('number of atoms per unit cell in (100)', 2.0)\n",
+ "number of atoms per m^2 is 1/(4*r**2)\n",
+ "('number of atoms per unit cell in (110)', 2.0)\n",
+ "number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n",
+ "('number of atoms per unit cell in (111)', 2.0)\n",
+ "number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n"
+ ]
}
],
"prompt_number": 22
@@ -368,19 +835,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.18, Page number 194"
+ "source": [
+ "Example number 6.18, Page number 194"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the atomic packing fraction and ionic packing fraction of NaCl\n\n#importing modules\nimport math\n\n#variable declaration\nr=0.97; #radius of Na+ ion in armstrong\nR=1.81; #radius of Cl- ion in armstrong\n\n#Calculation\n#atomic packing factor=packing density PD\n#PD=Volume of atoms/Volume of unit cell\n#volume of unit cell=a**3\n#volume of atoms=number of atoms*volume of 1 atom = 4*(4/3)*math.pi*r**3\n#but r=a/sqrt(8). hence PD = 4*(4/3)*math.pi*(a/(2*sqrt(2)))**3*(1/a**3) = 0.74\n#atomic packing factor = 0.74\nr=r*10**-10; #radius of Na+ ion in m\nR=R*10**-10; #radius of Cl- ion in m\nVna = (4*4*math.pi*r**3)/3; #volume of Na atoms\nVcl = (4*4*math.pi*R**3)/3; #volume of Cl atoms \nV=(2*(r+R))**3; #volume of unit cell\nIPF=(Vna+Vcl)/V; #ionic packing factor\nIPF=math.ceil(IPF*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"atomic packing factor = 0.74\");\nprint(\"ionic packing factor of NaCl crystal is\",IPF);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "r=0.97; #radius of Na+ ion in armstrong\n",
+ "R=1.81; #radius of Cl- ion in armstrong\n",
+ "\n",
+ "#Calculation\n",
+ "#atomic packing factor=packing density PD\n",
+ "#PD=Volume of atoms/Volume of unit cell\n",
+ "#volume of unit cell=a**3\n",
+ "#volume of atoms=number of atoms*volume of 1 atom = 4*(4/3)*math.pi*r**3\n",
+ "#but r=a/sqrt(8). hence PD = 4*(4/3)*math.pi*(a/(2*sqrt(2)))**3*(1/a**3) = 0.74\n",
+ "#atomic packing factor = 0.74\n",
+ "r=r*10**-10; #radius of Na+ ion in m\n",
+ "R=R*10**-10; #radius of Cl- ion in m\n",
+ "Vna = (4*4*math.pi*r**3)/3; #volume of Na atoms\n",
+ "Vcl = (4*4*math.pi*R**3)/3; #volume of Cl atoms \n",
+ "V=(2*(r+R))**3; #volume of unit cell\n",
+ "IPF=(Vna+Vcl)/V; #ionic packing factor\n",
+ "IPF=math.ceil(IPF*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"atomic packing factor = 0.74\");\n",
+ "print(\"ionic packing factor of NaCl crystal is\",IPF);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "atomic packing factor = 0.74\n('ionic packing factor of NaCl crystal is', 0.6671)\n"
+ "text": [
+ "atomic packing factor = 0.74\n",
+ "('ionic packing factor of NaCl crystal is', 0.6671)\n"
+ ]
}
],
"prompt_number": 24
@@ -388,7 +887,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_7.ipynb b/Engineering_Physics/Chapter_7.ipynb
index c59443c9..acb1144d 100644
--- a/Engineering_Physics/Chapter_7.ipynb
+++ b/Engineering_Physics/Chapter_7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 7"
+ "name": "",
+ "signature": "sha256:0a8ebb52dee60395969030b1d2962543e204a93314e21a66724d3bafb10b7ddf"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,59 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Crystal Imperfections"
+ "source": [
+ "Crystal Imperfections"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.1, Page number 207 "
+ "source": [
+ "Example number 7.1, Page number 207 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of vacancies and vacancy fraction\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nEv=0.98; #energy in eV/atom\nT1=900; #temperature in C\nT2=1000;\nA=6.022*10**26; #avagadro's constant\nw=196.9; #atomic weight in g/mol\nd=18.63; #density in g/cm^3\n\n#Calculation\nEv=Ev*1.6*10**-19; #converting eV to J\nd=d*10**3; #converting g/cm^3 into kg/m^3\nN=(A*d)/w;\nn=N*math.exp(-Ev/(k*T1));\n#let valency fraction n/N be V\nV=math.exp(-Ev/(k*T2));\n\n#Result\nprint(\"concentration of atoms per m^3 is\",N);\nprint(\"number of vacancies per m^3 is\",n);\nprint(\"valency fraction is\",V);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k=1.38*10**-23;\n",
+ "Ev=0.98; #energy in eV/atom\n",
+ "T1=900; #temperature in C\n",
+ "T2=1000;\n",
+ "A=6.022*10**26; #avagadro's constant\n",
+ "w=196.9; #atomic weight in g/mol\n",
+ "d=18.63; #density in g/cm^3\n",
+ "\n",
+ "#Calculation\n",
+ "Ev=Ev*1.6*10**-19; #converting eV to J\n",
+ "d=d*10**3; #converting g/cm^3 into kg/m^3\n",
+ "N=(A*d)/w;\n",
+ "n=N*math.exp(-Ev/(k*T1));\n",
+ "#let valency fraction n/N be V\n",
+ "V=math.exp(-Ev/(k*T2));\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of atoms per m^3 is\",N);\n",
+ "print(\"number of vacancies per m^3 is\",n);\n",
+ "print(\"valency fraction is\",V);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of atoms per m^3 is', 5.69780904012189e+28)\n('number of vacancies per m^3 is', 1.8742498047705634e+23)\n('valency fraction is', 1.1625392535344139e-05)\n"
+ "text": [
+ "('concentration of atoms per m^3 is', 5.69780904012189e+28)\n",
+ "('number of vacancies per m^3 is', 1.8742498047705634e+23)\n",
+ "('valency fraction is', 1.1625392535344139e-05)\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +73,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.2, Page number 208 "
+ "source": [
+ "Example number 7.2, Page number 208 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy for vacancy formation\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nA=6.022*10**26; #avagadro's constant\nT=1073; #temperature in K\nn=3.6*10**23; #number of vacancies\nd=9.5; #density in g/cm^3\nw=107.9; #atomic weight in g/mol\n\n#Calculation\nd=d*10**3; #converting g/cm^3 into kg/m^3\nN=(A*d)/w; #concentration of atoms\nE=k*T*math.log((N/n), ); #energy in J\nEeV=E/(1.602176565*10**-19); #energy in eV\nEeV=math.ceil(EeV*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"concentration of atoms per m^3 is\",N);\nprint(\"energy for vacancy formation in J\",E);\nprint(\"energy for vacancy formation in eV\",EeV);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k=1.38*10**-23;\n",
+ "A=6.022*10**26; #avagadro's constant\n",
+ "T=1073; #temperature in K\n",
+ "n=3.6*10**23; #number of vacancies\n",
+ "d=9.5; #density in g/cm^3\n",
+ "w=107.9; #atomic weight in g/mol\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**3; #converting g/cm^3 into kg/m^3\n",
+ "N=(A*d)/w; #concentration of atoms\n",
+ "E=k*T*math.log((N/n), ); #energy in J\n",
+ "EeV=E/(1.602176565*10**-19); #energy in eV\n",
+ "EeV=math.ceil(EeV*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of atoms per m^3 is\",N);\n",
+ "print(\"energy for vacancy formation in J\",E);\n",
+ "print(\"energy for vacancy formation in eV\",EeV);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of atoms per m^3 is', 5.3020389249304915e+28)\n('energy for vacancy formation in J', 1.762092900344914e-19)\n('energy for vacancy formation in eV', 1.1)\n"
+ "text": [
+ "('concentration of atoms per m^3 is', 5.3020389249304915e+28)\n",
+ "('energy for vacancy formation in J', 1.762092900344914e-19)\n",
+ "('energy for vacancy formation in eV', 1.1)\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +124,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.3, Page number 209 "
+ "source": [
+ "Example number 7.3, Page number 209 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of Schotky defect\n\n#importing modules\nimport math\n\n#Variable declaration\nA=6.022*10**26; #avagadro's constant\nk=1.38*10**-23;\nw1=39.1; #atomic weight of K\nw2=35.45; #atomic weight of Cl\nEs=2.6; #energy formation in eV\nT=500; #temperature in C\nd=1.955; #density in g/cm^3\n\n#Calculation\nEs=Es*1.6*10**-19; #converting eV to J\nT=T+273; #temperature in K\nd=d*10**3; #converting g/cm^3 into kg/m^3\nN=(A*d)/(w1+w2);\nn=N*math.exp(-Es/(2*k*T));\n\n#Result\nprint(\"number of Schotky defect per m^3 is\",n);\n\n#answer given in the book is wrong by 3rd decimal point",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "A=6.022*10**26; #avagadro's constant\n",
+ "k=1.38*10**-23;\n",
+ "w1=39.1; #atomic weight of K\n",
+ "w2=35.45; #atomic weight of Cl\n",
+ "Es=2.6; #energy formation in eV\n",
+ "T=500; #temperature in C\n",
+ "d=1.955; #density in g/cm^3\n",
+ "\n",
+ "#Calculation\n",
+ "Es=Es*1.6*10**-19; #converting eV to J\n",
+ "T=T+273; #temperature in K\n",
+ "d=d*10**3; #converting g/cm^3 into kg/m^3\n",
+ "N=(A*d)/(w1+w2);\n",
+ "n=N*math.exp(-Es/(2*k*T));\n",
+ "\n",
+ "#Result\n",
+ "print(\"number of Schotky defect per m^3 is\",n);\n",
+ "\n",
+ "#answer given in the book is wrong by 3rd decimal point"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('number of Schotky defect per m^3 is', 5.373777171020081e+19)\n"
+ "text": [
+ "('number of Schotky defect per m^3 is', 5.373777171020081e+19)\n"
+ ]
}
],
"prompt_number": 7
@@ -79,7 +173,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_8.ipynb b/Engineering_Physics/Chapter_8.ipynb
index 40606862..be4820c5 100644
--- a/Engineering_Physics/Chapter_8.ipynb
+++ b/Engineering_Physics/Chapter_8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 8"
+ "name": "",
+ "signature": "sha256:a97623c1294ef4fbd99f1423addadcfc2341e13ca402c26d0b2a69dd71e1782a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,44 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Conducting materials"
+ "source": [
+ "Conducting materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.1, Page number 231"
+ "source": [
+ "Example number 8.1, Page number 231"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electrical resistivity\n\n#Variable declaration\nm=9.1*10**-31; #mass of the electron in kg\nn=2.533*10**28; #concentration of electrons per m^3\ne=1.6*10**-19;\ntow_r=3.1*10**-14; #relaxation time in sec\n\n#Calculation\nrho=m/(n*(e**2*tow_r));\n\n#Result\nprint(\"electrical resistivity in ohm metre is\",rho);",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "n=2.533*10**28; #concentration of electrons per m^3\n",
+ "e=1.6*10**-19;\n",
+ "tow_r=3.1*10**-14; #relaxation time in sec\n",
+ "\n",
+ "#Calculation\n",
+ "rho=m/(n*(e**2*tow_r));\n",
+ "\n",
+ "#Result\n",
+ "print(\"electrical resistivity in ohm metre is\",rho);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electrical resistivity in ohm metre is', 4.526937967219795e-08)\n"
+ "text": [
+ "('electrical resistivity in ohm metre is', 4.526937967219795e-08)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +58,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.2, Page number 231"
+ "source": [
+ "Example number 8.2, Page number 231"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the band gap of semiconductor\n\n#importing modules\nimport math\n\n#Variable declaration\ns=3.75*10**3; #slope\nk=1.38*10**-23;\n\n#Calculation\nEg=2*k*s;\nEg=Eg/(1.6*10**-19); #converting J to eV\nEg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"band gap of semiconductor in eV is\",Eg);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "s=3.75*10**3; #slope\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "Eg=2*k*s;\n",
+ "Eg=Eg/(1.6*10**-19); #converting J to eV\n",
+ "Eg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"band gap of semiconductor in eV is\",Eg);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('band gap of semiconductor in eV is', 0.647)\n"
+ "text": [
+ "('band gap of semiconductor in eV is', 0.647)\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +99,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.3, Page number 231"
+ "source": [
+ "Example number 8.3, Page number 231"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the probability of occupation of electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nT=989; #temperature in C\nk=1.38*10**-23;\n#let E-EF be E\nE=0.5; #occupied level of electron in eV\n\n#Calculation\nT=T+273; #temperature in K\nE=E*1.6*10**-19; #converting eV to J\n#let fermi=dirac distribution function f(E) be f\nf=1/(1+math.exp(E/(k*T)));\nf=math.ceil(f*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"probability of occupation of electrons is\",f);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T=989; #temperature in C\n",
+ "k=1.38*10**-23;\n",
+ "#let E-EF be E\n",
+ "E=0.5; #occupied level of electron in eV\n",
+ "\n",
+ "#Calculation\n",
+ "T=T+273; #temperature in K\n",
+ "E=E*1.6*10**-19; #converting eV to J\n",
+ "#let fermi=dirac distribution function f(E) be f\n",
+ "f=1/(1+math.exp(E/(k*T)));\n",
+ "f=math.ceil(f*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"probability of occupation of electrons is\",f);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('probability of occupation of electrons is', 0.011)\n"
+ "text": [
+ "('probability of occupation of electrons is', 0.011)\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +144,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.4, Page number 232"
+ "source": [
+ "Example number 8.4, Page number 232"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the drift velocity of free electrons\n\n#Variable declaration\nmew_e=0.0035; #mobility of electrons in m^2/Vs\nE=0.5; #electric field strength in V/m\n\n#Calculation\nvd=mew_e*E;\nvd=vd*10**3;\n\n#Result\nprint(\"drift velocity of free electrons in m/sec is\",vd,\"*10**-3\");\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "mew_e=0.0035; #mobility of electrons in m^2/Vs\n",
+ "E=0.5; #electric field strength in V/m\n",
+ "\n",
+ "#Calculation\n",
+ "vd=mew_e*E;\n",
+ "vd=vd*10**3;\n",
+ "\n",
+ "#Result\n",
+ "print(\"drift velocity of free electrons in m/sec is\",vd,\"*10**-3\");\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('drift velocity of free electrons in m/sec is', 1.75, '*10**-3')\n"
+ "text": [
+ "('drift velocity of free electrons in m/sec is', 1.75, '*10**-3')\n"
+ ]
}
],
"prompt_number": 1
@@ -101,19 +182,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.5, Page number 232"
+ "source": [
+ "Example number 8.5, Page number 232"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mobility of electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nA=6.022*10**23; #avagadro number\ne=1.6*10**-19;\nrho=1.73*10**-8; #resistivity of Cu in ohm metre\nw=63.5; #atomic weight \nd=8.92*10**3; #density in kg/m^3\n\n#Calculation\nd=d*10**3;\nsigma=1/rho;\nsigmaa=sigma/10**7;\nsigmaa=math.ceil(sigmaa*10**3)/10**3; #rounding off to 3 decimals\nn=(d*A)/w;\nmew=sigma/(n*e); #mobility of electrons\nmew=mew*10**3;\nmew=math.ceil(mew*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"electrical conductivity in ohm-1 m-1\",sigmaa,\"*10**7\");\nprint(\"concentration of carriers per m^3\",n);\nprint(\"mobility of electrons in m^2/Vsec is\",mew,\"*10**-3\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "A=6.022*10**23; #avagadro number\n",
+ "e=1.6*10**-19;\n",
+ "rho=1.73*10**-8; #resistivity of Cu in ohm metre\n",
+ "w=63.5; #atomic weight \n",
+ "d=8.92*10**3; #density in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**3;\n",
+ "sigma=1/rho;\n",
+ "sigmaa=sigma/10**7;\n",
+ "sigmaa=math.ceil(sigmaa*10**3)/10**3; #rounding off to 3 decimals\n",
+ "n=(d*A)/w;\n",
+ "mew=sigma/(n*e); #mobility of electrons\n",
+ "mew=mew*10**3;\n",
+ "mew=math.ceil(mew*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"electrical conductivity in ohm-1 m-1\",sigmaa,\"*10**7\");\n",
+ "print(\"concentration of carriers per m^3\",n);\n",
+ "print(\"mobility of electrons in m^2/Vsec is\",mew,\"*10**-3\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electrical conductivity in ohm-1 m-1', 5.781, '*10**7')\n('concentration of carriers per m^3', 8.459250393700786e+28)\n('mobility of electrons in m^2/Vsec is', 4.2708, '*10**-3')\n"
+ "text": [
+ "('electrical conductivity in ohm-1 m-1', 5.781, '*10**7')\n",
+ "('concentration of carriers per m^3', 8.459250393700786e+28)\n",
+ "('mobility of electrons in m^2/Vsec is', 4.2708, '*10**-3')\n"
+ ]
}
],
"prompt_number": 16
@@ -122,19 +235,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.6, Page number 232"
+ "source": [
+ "Example number 8.6, Page number 232"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the fermi energy\n\n#importing modules\nimport math\n\n#Variable declaration\nn=18.1*10**28; #concentration of electrons per m^3\nh=6.62*10**-34; #planck constant in Js\nme=9.1*10**-31; #mass of electron in kg\n\n#Calculation\nX=h**2/(8*me);\nE_F0=X*(((3*n)/math.pi)**(2/3));\nE_F0=E_F0/(1.6*10**-19); #converting J to eV\n\n#Result\nprint(\"Fermi energy in eV is\",E_F0);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=18.1*10**28; #concentration of electrons per m^3\n",
+ "h=6.62*10**-34; #planck constant in Js\n",
+ "me=9.1*10**-31; #mass of electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "X=h**2/(8*me);\n",
+ "E_F0=X*(((3*n)/math.pi)**(2/3));\n",
+ "E_F0=E_F0/(1.6*10**-19); #converting J to eV\n",
+ "\n",
+ "#Result\n",
+ "print(\"Fermi energy in eV is\",E_F0);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('Fermi energy in eV is', 3.762396978021977e-19)\n"
+ "text": [
+ "('Fermi energy in eV is', 3.762396978021977e-19)\n"
+ ]
}
],
"prompt_number": 18
@@ -143,19 +279,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.7, Page number 233"
+ "source": [
+ "Example number 8.7, Page number 233"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the concentration of free electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nE_F0=5.5; #fermi energy in eV\nh=6.63*10**-34; #planck constant in Js\nme=9.1*10**-31; #mass of electron in kg\n\n#Calculation\nE_F0=E_F0*1.6*10**-19; #converting eV to J\nn=((2*me*E_F0)**(3/2))*((8*math.pi)/(3*h**3));\n\n#Result\nprint(\"concentration of free electrons per unit volume of silver per m^3 is\",n);\n\n#answer given in the book is wrong\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "E_F0=5.5; #fermi energy in eV\n",
+ "h=6.63*10**-34; #planck constant in Js\n",
+ "me=9.1*10**-31; #mass of electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "E_F0=E_F0*1.6*10**-19; #converting eV to J\n",
+ "n=((2*me*E_F0)**(3/2))*((8*math.pi)/(3*h**3));\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of free electrons per unit volume of silver per m^3 is\",n);\n",
+ "\n",
+ "#answer given in the book is wrong\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of free electrons per unit volume of silver per m^3 is', 4.603965704817037e+52)\n"
+ "text": [
+ "('concentration of free electrons per unit volume of silver per m^3 is', 4.603965704817037e+52)\n"
+ ]
}
],
"prompt_number": 19
@@ -164,19 +322,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.8, Page number 233"
+ "source": [
+ "Example number 8.8, Page number 233"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the probability of an electron\n\n#importing modules\nimport math\n\n#Variable declaration\nEg=1.07; #energy gap of silicon in eV\nk=1.38*10**-23;\nT=298; #temperature in K\n\n#Calculation\nEg=Eg*1.6*10**-19; #converting eV to J\n#let the probability of electron f(E) be X\n#X=1/(1+exp((E-Ef)/(k*T)))\n#but E=Ec and Ec-Ef=Eg/2\nX=1/(1+math.exp(Eg/(2*k*T)))\n\n#Result\nprint(\"probability of an electron thermally excited is\",X);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Eg=1.07; #energy gap of silicon in eV\n",
+ "k=1.38*10**-23;\n",
+ "T=298; #temperature in K\n",
+ "\n",
+ "#Calculation\n",
+ "Eg=Eg*1.6*10**-19; #converting eV to J\n",
+ "#let the probability of electron f(E) be X\n",
+ "#X=1/(1+exp((E-Ef)/(k*T)))\n",
+ "#but E=Ec and Ec-Ef=Eg/2\n",
+ "X=1/(1+math.exp(Eg/(2*k*T)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"probability of an electron thermally excited is\",X);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('probability of an electron thermally excited is', 9.122602463573379e-10)\n"
+ "text": [
+ "('probability of an electron thermally excited is', 9.122602463573379e-10)\n"
+ ]
}
],
"prompt_number": 21
@@ -185,19 +366,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.9, Page number 234"
+ "source": [
+ "Example number 8.9, Page number 234"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the fermi energy and temperature\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nm=9.1*10**-31; #mass of the electron in kg\nvf=0.86*10**6; #fermi velocity in m/sec\n\n#Calculation\nEfj=(m*vf**2)/2;\nEf=Efj/(1.6*10**-19); #converting J to eV\nEf=math.ceil(Ef*10**3)/10**3; #rounding off to 3 decimals\nTf=Efj/k;\nTf=Tf/10**4;\nTf=math.ceil(Tf*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"fermi energy of metal in J is\",Efj);\nprint(\"fermi energy of metal in eV is\",Ef);\nprint(\"fermi temperature in K is\",Tf,\"*10**4\");\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k=1.38*10**-23;\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "vf=0.86*10**6; #fermi velocity in m/sec\n",
+ "\n",
+ "#Calculation\n",
+ "Efj=(m*vf**2)/2;\n",
+ "Ef=Efj/(1.6*10**-19); #converting J to eV\n",
+ "Ef=math.ceil(Ef*10**3)/10**3; #rounding off to 3 decimals\n",
+ "Tf=Efj/k;\n",
+ "Tf=Tf/10**4;\n",
+ "Tf=math.ceil(Tf*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fermi energy of metal in J is\",Efj);\n",
+ "print(\"fermi energy of metal in eV is\",Ef);\n",
+ "print(\"fermi temperature in K is\",Tf,\"*10**4\");\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fermi energy of metal in J is', 3.3651800000000002e-19)\n('fermi energy of metal in eV is', 2.104)\n('fermi temperature in K is', 2.4386, '*10**4')\n"
+ "text": [
+ "('fermi energy of metal in J is', 3.3651800000000002e-19)\n",
+ "('fermi energy of metal in eV is', 2.104)\n",
+ "('fermi temperature in K is', 2.4386, '*10**4')\n"
+ ]
}
],
"prompt_number": 24
@@ -206,19 +415,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.10, Page number 234"
+ "source": [
+ "Example number 8.10, Page number 234"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Lorentz number\n\n#Variable declaration\nsigma=5.82*10**7; #electrical conductivity in ohm^-1m^-1\nK=387; #thermal conductivity of Cu in W/mK\nT=27; #temperature in C\n\n#Calculation\nT=T+273; #temperature in K\nL=K/(sigma*T);\n\n#Result\nprint(\"lorentz number in W ohm/K^2 is\",L);\n",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "sigma=5.82*10**7; #electrical conductivity in ohm^-1m^-1\n",
+ "K=387; #thermal conductivity of Cu in W/mK\n",
+ "T=27; #temperature in C\n",
+ "\n",
+ "#Calculation\n",
+ "T=T+273; #temperature in K\n",
+ "L=K/(sigma*T);\n",
+ "\n",
+ "#Result\n",
+ "print(\"lorentz number in W ohm/K^2 is\",L);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lorentz number in W ohm/K^2 is', 2.2164948453608246e-08)\n"
+ "text": [
+ "('lorentz number in W ohm/K^2 is', 2.2164948453608246e-08)\n"
+ ]
}
],
"prompt_number": 25
@@ -227,19 +453,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.11, Page number 235"
+ "source": [
+ "Example number 8.11, Page number 235"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electrical conductivity, thermal conductivity and Lorentz number\n\n#importing modules\nimport math\n\n#Variable declaration\nm=9.1*10**-31; #mass of the electron in kg\ne=1.6*10**-19;\nk=1.38*10**-23;\nn=8.49*10**28; #concentration of electrons in Cu per m^3\ntow_r=2.44*10**-14; #relaxation time in sec\nT=20; #temperature in C\n\n#Calculation\nT=T+273; #temperature in K\nsigma=(n*(e**2)*tow_r)/m;\nsigmaa=sigma/10**7;\nsigmaa=math.ceil(sigmaa*10**4)/10**4; #rounding off to 4 decimals\nK=(n*(math.pi**2)*(k**2)*T*tow_r)/(3*m);\nK=math.ceil(K*100)/100; #rounding off to 2 decimals\nL=K/(sigma*T);\n\n#Result\nprint(\"electrical conductivity in ohm^-1 m^-1 is\",sigmaa,\"*10**7\");\nprint(\"thermal conductivity in W/mK is\",K);\nprint(\"Lorentz number in W ohm/K^2 is\",L);\n\n#answer for lorentz number given in the book is wrong\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "e=1.6*10**-19;\n",
+ "k=1.38*10**-23;\n",
+ "n=8.49*10**28; #concentration of electrons in Cu per m^3\n",
+ "tow_r=2.44*10**-14; #relaxation time in sec\n",
+ "T=20; #temperature in C\n",
+ "\n",
+ "#Calculation\n",
+ "T=T+273; #temperature in K\n",
+ "sigma=(n*(e**2)*tow_r)/m;\n",
+ "sigmaa=sigma/10**7;\n",
+ "sigmaa=math.ceil(sigmaa*10**4)/10**4; #rounding off to 4 decimals\n",
+ "K=(n*(math.pi**2)*(k**2)*T*tow_r)/(3*m);\n",
+ "K=math.ceil(K*100)/100; #rounding off to 2 decimals\n",
+ "L=K/(sigma*T);\n",
+ "\n",
+ "#Result\n",
+ "print(\"electrical conductivity in ohm^-1 m^-1 is\",sigmaa,\"*10**7\");\n",
+ "print(\"thermal conductivity in W/mK is\",K);\n",
+ "print(\"Lorentz number in W ohm/K^2 is\",L);\n",
+ "\n",
+ "#answer for lorentz number given in the book is wrong\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electrical conductivity in ohm^-1 m^-1 is', 5.8277, '*10**7')\n('thermal conductivity in W/mK is', 417.89)\n('Lorentz number in W ohm/K^2 is', 2.4473623172034308e-08)\n"
+ "text": [
+ "('electrical conductivity in ohm^-1 m^-1 is', 5.8277, '*10**7')\n",
+ "('thermal conductivity in W/mK is', 417.89)\n",
+ "('Lorentz number in W ohm/K^2 is', 2.4473623172034308e-08)\n"
+ ]
}
],
"prompt_number": 29
@@ -247,7 +507,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/Chapter_9.ipynb b/Engineering_Physics/Chapter_9.ipynb
index 4524cd7c..f85c8366 100644
--- a/Engineering_Physics/Chapter_9.ipynb
+++ b/Engineering_Physics/Chapter_9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 9"
+ "name": "",
+ "signature": "sha256:5fb520695164101d75312a7c320e0464f4d51d8732e4ed917802ba694545ac3e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,45 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Semiconducting materials"
+ "source": [
+ "Semiconducting materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.1, Page number 266"
+ "source": [
+ "Example number 9.1, Page number 266"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of charge carriers\n\n#Variable declaration\nmew_e=0.36; #mobility of electrons in m^2/Vs\nmew_h=0.14; #mobility of holes in m^2/Vs\nsigma=2.2; #conductivity in ohm-1 m-1\nT=300; #temperature in K\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nni=sigma/(e*(mew_e+mew_h)); #carrier concentration per m^3\n\n#Result\nprint(\"carrier concentration of an intrinsic semiconductor per m^3 is\",ni);",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "mew_e=0.36; #mobility of electrons in m^2/Vs\n",
+ "mew_h=0.14; #mobility of holes in m^2/Vs\n",
+ "sigma=2.2; #conductivity in ohm-1 m-1\n",
+ "T=300; #temperature in K\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "ni=sigma/(e*(mew_e+mew_h)); #carrier concentration per m^3\n",
+ "\n",
+ "#Result\n",
+ "print(\"carrier concentration of an intrinsic semiconductor per m^3 is\",ni);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('carrier concentration of an intrinsic semiconductor per m^3 is', 2.75e+19)\n"
+ "text": [
+ "('carrier concentration of an intrinsic semiconductor per m^3 is', 2.75e+19)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +59,65 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.2, Page number 266"
+ "source": [
+ "Example number 9.2, Page number 266"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the band gap\n\n#importing modules\nimport math\nimport numpy as np\nfrom __future__ import division\n\n#Variable declaration\nT1=20; #temperature in C\nT2=100; #temperature in C\nsigma_i20=250; #conductivity in ohm-1 m-1\nsigma_i100=1100; #conductivity in ohm-1 m-1\nk=1.38*10**-23;\n\n#Calculation\nT1K=T1+273; #temperature in K\nT2K=T2+273; #temperature in K\nT_1K=T1K**(-1);\nT_2K=T2K**(-1);\nT_1=T_2K-T_1K;\nT_2=T2K/T1K;\nTk=T_1**(-1);\nT_k=(T_2)**(3/2);\n#intrinsic carrier concentration at T1K is ni20 = 2*((2*math.pi*k*m*293)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*293))\n#intrinsic carrier concentration at T2K is ni100 = 2*((2*math.pi*k*m*373)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*373))\n#dividing ni20/ni100 = (293/373)**(3/2)*(math.exp(-Eg/(2*k*293))/math.exp(-Eg/(2*k*373)))\n#ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n#sigma_i20/sigma_i100 = (ni20*e*(mew_e+mew_h))/(ni100*e*(mew_e+mew_h)) = ni20/ni100\n#therefore sigma_i20/sigma_i100 = ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n#math.exp((-Eg/(2*k))*((1/293)-(1/373))) = (sigma_i20/sigma_i100)*(373/293)**(3/2)\n#by taking log on both sides we get (-Eg/(2*k))*((1/293)-(1/373)) = np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n#Eg=2*k*(((1/373)-(1/293))**(-1))*np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\nEg=2*k*Tk*np.log((sigma_i20/sigma_i100)*T_k); #band gap in J\nEgeV=Eg*6.241*10**18; #converting J to eV\nEgeV=math.ceil(EgeV*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"band gap of the semiconductor in J is\",Eg);\nprint(\"band gap of the semiconductor in eV is\",EgeV);\n\n#answer for band gap in eV given in the book is wrong in the 4th decimal point",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "import numpy as np\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "T1=20; #temperature in C\n",
+ "T2=100; #temperature in C\n",
+ "sigma_i20=250; #conductivity in ohm-1 m-1\n",
+ "sigma_i100=1100; #conductivity in ohm-1 m-1\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "T1K=T1+273; #temperature in K\n",
+ "T2K=T2+273; #temperature in K\n",
+ "T_1K=T1K**(-1);\n",
+ "T_2K=T2K**(-1);\n",
+ "T_1=T_2K-T_1K;\n",
+ "T_2=T2K/T1K;\n",
+ "Tk=T_1**(-1);\n",
+ "T_k=(T_2)**(3/2);\n",
+ "#intrinsic carrier concentration at T1K is ni20 = 2*((2*math.pi*k*m*293)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*293))\n",
+ "#intrinsic carrier concentration at T2K is ni100 = 2*((2*math.pi*k*m*373)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*373))\n",
+ "#dividing ni20/ni100 = (293/373)**(3/2)*(math.exp(-Eg/(2*k*293))/math.exp(-Eg/(2*k*373)))\n",
+ "#ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n",
+ "#sigma_i20/sigma_i100 = (ni20*e*(mew_e+mew_h))/(ni100*e*(mew_e+mew_h)) = ni20/ni100\n",
+ "#therefore sigma_i20/sigma_i100 = ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n",
+ "#math.exp((-Eg/(2*k))*((1/293)-(1/373))) = (sigma_i20/sigma_i100)*(373/293)**(3/2)\n",
+ "#by taking log on both sides we get (-Eg/(2*k))*((1/293)-(1/373)) = np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n",
+ "#Eg=2*k*(((1/373)-(1/293))**(-1))*np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n",
+ "Eg=2*k*Tk*np.log((sigma_i20/sigma_i100)*T_k); #band gap in J\n",
+ "EgeV=Eg*6.241*10**18; #converting J to eV\n",
+ "EgeV=math.ceil(EgeV*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"band gap of the semiconductor in J is\",Eg);\n",
+ "print(\"band gap of the semiconductor in eV is\",EgeV);\n",
+ "\n",
+ "#answer for band gap in eV given in the book is wrong in the 4th decimal point"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('band gap of the semiconductor in J is', 4.2210259829756855e-20)\n('band gap of the semiconductor in eV is', 0.2635)\n"
+ "text": [
+ "('band gap of the semiconductor in J is', 4.2210259829756855e-20)\n",
+ "('band gap of the semiconductor in eV is', 0.2635)\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +126,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.3, Page number 267"
+ "source": [
+ "Example number 9.3, Page number 267"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Hall voltage\n\n#Variable declaration\nI=10**-2; #current in Ampere\nl=100; #length in mm\nd=1; #thickness in mm\nw=10; #breadth in mm\nB=0.5; #magnetic field in Wb/m^2\nRH=3.66*10**-4; #hall coefficient in m^3/C\n\n#Calculation\nw=w*10**-3; #width in m\nVH=(B*I*RH)/w; #hall voltage\nVH=VH*10**4;\n\n#Result\nprint(\"Hall voltage in V is\",VH,\"*10**-4\");",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "I=10**-2; #current in Ampere\n",
+ "l=100; #length in mm\n",
+ "d=1; #thickness in mm\n",
+ "w=10; #breadth in mm\n",
+ "B=0.5; #magnetic field in Wb/m^2\n",
+ "RH=3.66*10**-4; #hall coefficient in m^3/C\n",
+ "\n",
+ "#Calculation\n",
+ "w=w*10**-3; #width in m\n",
+ "VH=(B*I*RH)/w; #hall voltage\n",
+ "VH=VH*10**4;\n",
+ "\n",
+ "#Result\n",
+ "print(\"Hall voltage in V is\",VH,\"*10**-4\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('Hall voltage in V is', 1.83, '*10**-4')\n"
+ "text": [
+ "('Hall voltage in V is', 1.83, '*10**-4')\n"
+ ]
}
],
"prompt_number": 1
@@ -80,19 +168,57 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.4, Page number 268"
+ "source": [
+ "Example number 9.4, Page number 268"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the concentration of holes and electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nsigma=300; #conductivity in S/cm\nT=300; #temperature in K\nni=1.5*10**10 #carrier concentration per cm^3\nmew_e=1300; #mobility of electrons in cm^2/Vs\nmew_h=500; #mobility of holes in cm^2/Vs\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nsigma=sigma*10**2; #sigma in S/m\nmew_e=mew_e*10**-4; #mobility of electrons in m^2/Vs\nND=sigma/(e*mew_e); #concentration of electron per m^3\nni=ni*10**6; #carrier concentration per m^3\np=ni**2/ND; #hole concentration per m^3\np=p/10**8;\np=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\nmew_h=mew_h*10**-4; #mobility of holes in m^2/Vs\nNA=sigma/(e*mew_h); #concentration of hole per m^3\nn=ni**2/NA; #electron concentration per m^3\nn=n/10**7;\n\n#Result\nprint(\"concentration of electron for N-type semiconductor per m^3\",ND);\nprint(\"hole concentration per m^3\",p,\"*10**8\");\nprint(\"concentration of hole for P-type semiconductor per m^3\",NA);\nprint(\"electron concentration per m^3\",int(n),\"*10**7\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "sigma=300; #conductivity in S/cm\n",
+ "T=300; #temperature in K\n",
+ "ni=1.5*10**10 #carrier concentration per cm^3\n",
+ "mew_e=1300; #mobility of electrons in cm^2/Vs\n",
+ "mew_h=500; #mobility of holes in cm^2/Vs\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "sigma=sigma*10**2; #sigma in S/m\n",
+ "mew_e=mew_e*10**-4; #mobility of electrons in m^2/Vs\n",
+ "ND=sigma/(e*mew_e); #concentration of electron per m^3\n",
+ "ni=ni*10**6; #carrier concentration per m^3\n",
+ "p=ni**2/ND; #hole concentration per m^3\n",
+ "p=p/10**8;\n",
+ "p=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n",
+ "mew_h=mew_h*10**-4; #mobility of holes in m^2/Vs\n",
+ "NA=sigma/(e*mew_h); #concentration of hole per m^3\n",
+ "n=ni**2/NA; #electron concentration per m^3\n",
+ "n=n/10**7;\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of electron for N-type semiconductor per m^3\",ND);\n",
+ "print(\"hole concentration per m^3\",p,\"*10**8\");\n",
+ "print(\"concentration of hole for P-type semiconductor per m^3\",NA);\n",
+ "print(\"electron concentration per m^3\",int(n),\"*10**7\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of electron for N-type semiconductor per m^3', 1.4423076923076921e+24)\n('hole concentration per m^3', 1.561, '*10**8')\n('concentration of hole for P-type semiconductor per m^3', 3.7499999999999995e+24)\n('electron concentration per m^3', 6, '*10**7')\n"
+ "text": [
+ "('concentration of electron for N-type semiconductor per m^3', 1.4423076923076921e+24)\n",
+ "('hole concentration per m^3', 1.561, '*10**8')\n",
+ "('concentration of hole for P-type semiconductor per m^3', 3.7499999999999995e+24)\n",
+ "('electron concentration per m^3', 6, '*10**7')\n"
+ ]
}
],
"prompt_number": 11
@@ -101,19 +227,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.5, Page number 269"
+ "source": [
+ "Example number 9.5, Page number 269"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the type of charge carriers and the carrier concentration\n\n#importing modules\nimport math\n\n#Variable declaration\nRH=-3.68*10**-5; #hall coefficient in m^3/C\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\n#hall coefficient is negative implies charge carriers are electrons\nn=(3*math.pi)/(8*(-RH)*e); #carrier concentration\n\n#Result\nprint(\"charge carriers are electrons\");\nprint(\"carrier concentration per m^3 is\",n);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "RH=-3.68*10**-5; #hall coefficient in m^3/C\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "#hall coefficient is negative implies charge carriers are electrons\n",
+ "n=(3*math.pi)/(8*(-RH)*e); #carrier concentration\n",
+ "\n",
+ "#Result\n",
+ "print(\"charge carriers are electrons\");\n",
+ "print(\"carrier concentration per m^3 is\",n);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "charge carriers are electrons\n('carrier concentration per m^3 is', 2.000844505937792e+23)\n"
+ "text": [
+ "charge carriers are electrons\n",
+ "('carrier concentration per m^3 is', 2.000844505937792e+23)\n"
+ ]
}
],
"prompt_number": 13
@@ -122,19 +269,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.6, Page number 269"
+ "source": [
+ "Example number 9.6, Page number 269"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To compare the intrinsic carrier density\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nEg1=0.36; #energy gap of 1st material in eV\nEg2=0.72; #energy gap of 2nd material in eV\nT=300; #temperature in K\nmh=9*10**-31;\nme=9*10**-31; \n#given that 2*k*T=0.052; \n#consider X=2*k*T\nX=0.052;\n\n#Calculation\n#intrinsic carrier concentration for A niA = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.36/(2*k*T))\n#intrinsic carrier concentration for B niB = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.72/(2*k*T))\n#dividing niA/niB = math.exp(-0.36/(2*k*T))*math.exp(0.72/(2*k*T))\n#let niA/niB be A\nA = math.exp(-0.36/X)*math.exp(0.72/X);\nA=A/10**3;\nA=math.ceil(A*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"ratio of intrinsic carrier densities of A and B is\",A,\"*10**3\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Eg1=0.36; #energy gap of 1st material in eV\n",
+ "Eg2=0.72; #energy gap of 2nd material in eV\n",
+ "T=300; #temperature in K\n",
+ "mh=9*10**-31;\n",
+ "me=9*10**-31; \n",
+ "#given that 2*k*T=0.052; \n",
+ "#consider X=2*k*T\n",
+ "X=0.052;\n",
+ "\n",
+ "#Calculation\n",
+ "#intrinsic carrier concentration for A niA = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.36/(2*k*T))\n",
+ "#intrinsic carrier concentration for B niB = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.72/(2*k*T))\n",
+ "#dividing niA/niB = math.exp(-0.36/(2*k*T))*math.exp(0.72/(2*k*T))\n",
+ "#let niA/niB be A\n",
+ "A = math.exp(-0.36/X)*math.exp(0.72/X);\n",
+ "A=A/10**3;\n",
+ "A=math.ceil(A*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio of intrinsic carrier densities of A and B is\",A,\"*10**3\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('ratio of intrinsic carrier densities of A and B is', 1.01544, '*10**3')\n"
+ "text": [
+ "('ratio of intrinsic carrier densities of A and B is', 1.01544, '*10**3')\n"
+ ]
}
],
"prompt_number": 16
@@ -143,19 +321,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.7, Page number 270"
+ "source": [
+ "Example number 9.7, Page number 270"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mobility of electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nND=2*10**22; #concentration of electron per m^3\nsigma=112; #conductivity in ohm-1 m-1\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nmew=sigma/(ND*e); #mobility of electrons \nmew=math.ceil(mew*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"mobility of electrons in m^2/Vs is\",mew);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "ND=2*10**22; #concentration of electron per m^3\n",
+ "sigma=112; #conductivity in ohm-1 m-1\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "mew=sigma/(ND*e); #mobility of electrons \n",
+ "mew=math.ceil(mew*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"mobility of electrons in m^2/Vs is\",mew);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('mobility of electrons in m^2/Vs is', 0.035)\n"
+ "text": [
+ "('mobility of electrons in m^2/Vs is', 0.035)\n"
+ ]
}
],
"prompt_number": 17
@@ -164,19 +362,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.8, Page number 270"
+ "source": [
+ "Example number 9.8, Page number 270"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Hall voltage\n\n#importing modules\nimport math\n\n#Variable declaration\nw=500; #thickness in micrometre\nA=2.5*10**-3; #area of cross section in cm^-2\nIx=1; #current in ampere\nBz=10; #magnetic field in Wb/cm^2\nn=10**16; #donor concentration in m^-3\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nBz=Bz*10**-4; #magnetic field in Wb/m^2\nw=w*10**-6; #thickness in m\nRH=(3*math.pi)/(8*n*e); #hall coefficient\nVH=(Bz*Ix*RH)/w; #hall voltage\nVH=VH/10**3;\nVH=math.ceil(VH*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"hall voltage in V is\",VH,\"*10**3\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "w=500; #thickness in micrometre\n",
+ "A=2.5*10**-3; #area of cross section in cm^-2\n",
+ "Ix=1; #current in ampere\n",
+ "Bz=10; #magnetic field in Wb/cm^2\n",
+ "n=10**16; #donor concentration in m^-3\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "Bz=Bz*10**-4; #magnetic field in Wb/m^2\n",
+ "w=w*10**-6; #thickness in m\n",
+ "RH=(3*math.pi)/(8*n*e); #hall coefficient\n",
+ "VH=(Bz*Ix*RH)/w; #hall voltage\n",
+ "VH=VH/10**3;\n",
+ "VH=math.ceil(VH*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"hall voltage in V is\",VH,\"*10**3\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('hall voltage in V is', 1.4727, '*10**3')\n"
+ "text": [
+ "('hall voltage in V is', 1.4727, '*10**3')\n"
+ ]
}
],
"prompt_number": 23
@@ -185,19 +410,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.9, Page number 271"
+ "source": [
+ "Example number 9.9, Page number 271"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the ratio between conductivity of intrinsic semiconductor\n\n#importing modules\nimport math\nfrom __future__ import division\nimport numpy as np\n\n#Variable declaration\nEg=1.2; #energy gap in eV\nT1=300; #temperature in K\nT2=600; #temperature in K\nk=1.38*10**-23;\n\n#Calculation\nT_1=T1**(-1);\nT_2=T2**(-1);\nT=T_1-T_2;\nEg=Eg*1.602*10**-19; #Eg in J\n#sigma_300=ni300*e*(mew_e+mew_h)\n#sigma_600=ni600*e*(mew_e+mew_h)\n#sigma_600/sigma_300 = ni600/ni300\n#ni600/ni300 =((T2/T1)**(3/2))*math.exp(-Eg/(2*k*T2))*math.exp(Eg/(2*k*T1));\n#ni600/ni300 =((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T;\n#let ni600/ni300 be X\nX=((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T);\n\n\n#Result\nprint(\"ratio between the conductivity of material is\",int(X));\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "import math\n",
+ "from __future__ import division\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "Eg=1.2; #energy gap in eV\n",
+ "T1=300; #temperature in K\n",
+ "T2=600; #temperature in K\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "T_1=T1**(-1);\n",
+ "T_2=T2**(-1);\n",
+ "T=T_1-T_2;\n",
+ "Eg=Eg*1.602*10**-19; #Eg in J\n",
+ "#sigma_300=ni300*e*(mew_e+mew_h)\n",
+ "#sigma_600=ni600*e*(mew_e+mew_h)\n",
+ "#sigma_600/sigma_300 = ni600/ni300\n",
+ "#ni600/ni300 =((T2/T1)**(3/2))*math.exp(-Eg/(2*k*T2))*math.exp(Eg/(2*k*T1));\n",
+ "#ni600/ni300 =((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T;\n",
+ "#let ni600/ni300 be X\n",
+ "X=((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T);\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio between the conductivity of material is\",int(X));\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('ratio between the conductivity of material is', 311270)\n"
+ "text": [
+ "('ratio between the conductivity of material is', 311270)\n"
+ ]
}
],
"prompt_number": 25
@@ -206,19 +465,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.10, Page number 272"
+ "source": [
+ "Example number 9.10, Page number 272"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the intrinsic carrier concentration\n\n#importing modules\nimport math\n\n#Variable declaration\nsigma=10**-6; #electrical conductivity in ohm-1 m-1\nmew_e=0.85; #electron mobility in m^2/Vs\nmew_h=0.04; #hole mobility in m^2/Vs\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nni=sigma/(e*(mew_e+mew_h)); #intrinsic carrier concentration\nni=ni/10**12;\nni=math.ceil(ni*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"intrinsic carrier concentration per m^3 is\",ni,\"*10**12\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "sigma=10**-6; #electrical conductivity in ohm-1 m-1\n",
+ "mew_e=0.85; #electron mobility in m^2/Vs\n",
+ "mew_h=0.04; #hole mobility in m^2/Vs\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "ni=sigma/(e*(mew_e+mew_h)); #intrinsic carrier concentration\n",
+ "ni=ni/10**12;\n",
+ "ni=math.ceil(ni*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"intrinsic carrier concentration per m^3 is\",ni,\"*10**12\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('intrinsic carrier concentration per m^3 is', 7.0225, '*10**12')\n"
+ "text": [
+ "('intrinsic carrier concentration per m^3 is', 7.0225, '*10**12')\n"
+ ]
}
],
"prompt_number": 27
@@ -227,19 +508,61 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.11, Page number 272"
+ "source": [
+ "Example number 9.11, Page number 272"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the density of impurity atoms and concentration of minority carriers\n\n#importing modules\nimport math\n\n#Variable declaration\nrho_p=10; #resistivity of p-type Si in ohm cm\nrho_n=10; #resistivity of n-type Si in ohm cm\nmew_e=1350; #electron mobility in cm^2/Vs\nmew_h=480; #hole mobility in cm^2/Vs\nni=1.5*10**10; #carrier concentration in cm^-3\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nrho_p=rho_p*10**-2;#resistivity of p-type Si in ohm m\nsigma_p=1/rho_p; #electrical conductivity\nmew_h=mew_h*10**-3;\nNA=sigma_p/(e*mew_h); #acceptor concentration\nni=ni*10**6; #carrier concentration in m^-3\nn=ni**2/NA; #concentration of minority carriers in m^-3\nn=n/10**12;\nn=math.ceil(n*10**4)/10**4; #rounding off to 4 decimals\nrho_n=rho_n*10**-2; #resistivity of n-type Si in ohm m\nsigma_n=1/rho_n; #electrical conductivity\nmew_e=mew_e*10**-3;\nND=sigma_n/(e*mew_e); #donor concentration\np=(ni**2)/ND; #concentration of minority carriers in m^-3\np=p/10**12;\np=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"donor concentration per m^3 is\",ND);\nprint(\"concentration of minority carriers per m^3\",p,\"*10**12\");\nprint(\"acceptor concentration per m^3 is\",NA);\nprint(\"concentration of minority carriers per m^3 is\",n,\"*10**12\");",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho_p=10; #resistivity of p-type Si in ohm cm\n",
+ "rho_n=10; #resistivity of n-type Si in ohm cm\n",
+ "mew_e=1350; #electron mobility in cm^2/Vs\n",
+ "mew_h=480; #hole mobility in cm^2/Vs\n",
+ "ni=1.5*10**10; #carrier concentration in cm^-3\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "rho_p=rho_p*10**-2;#resistivity of p-type Si in ohm m\n",
+ "sigma_p=1/rho_p; #electrical conductivity\n",
+ "mew_h=mew_h*10**-3;\n",
+ "NA=sigma_p/(e*mew_h); #acceptor concentration\n",
+ "ni=ni*10**6; #carrier concentration in m^-3\n",
+ "n=ni**2/NA; #concentration of minority carriers in m^-3\n",
+ "n=n/10**12;\n",
+ "n=math.ceil(n*10**4)/10**4; #rounding off to 4 decimals\n",
+ "rho_n=rho_n*10**-2; #resistivity of n-type Si in ohm m\n",
+ "sigma_n=1/rho_n; #electrical conductivity\n",
+ "mew_e=mew_e*10**-3;\n",
+ "ND=sigma_n/(e*mew_e); #donor concentration\n",
+ "p=(ni**2)/ND; #concentration of minority carriers in m^-3\n",
+ "p=p/10**12;\n",
+ "p=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"donor concentration per m^3 is\",ND);\n",
+ "print(\"concentration of minority carriers per m^3\",p,\"*10**12\");\n",
+ "print(\"acceptor concentration per m^3 is\",NA);\n",
+ "print(\"concentration of minority carriers per m^3 is\",n,\"*10**12\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('donor concentration per m^3 is', 4.6296296296296284e+19)\n('concentration of minority carriers per m^3', 4.861, '*10**12')\n('acceptor concentration per m^3 is', 1.3020833333333331e+20)\n('concentration of minority carriers per m^3 is', 1.7281, '*10**12')\n"
+ "text": [
+ "('donor concentration per m^3 is', 4.6296296296296284e+19)\n",
+ "('concentration of minority carriers per m^3', 4.861, '*10**12')\n",
+ "('acceptor concentration per m^3 is', 1.3020833333333331e+20)\n",
+ "('concentration of minority carriers per m^3 is', 1.7281, '*10**12')\n"
+ ]
}
],
"prompt_number": 33
@@ -247,7 +570,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/chapter1_2.ipynb b/Engineering_Physics/chapter1_2.ipynb
index 33cd96c8..bd2e1aac 100644
--- a/Engineering_Physics/chapter1_2.ipynb
+++ b/Engineering_Physics/chapter1_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter1"
+ "name": "",
+ "signature": "sha256:18ac31f959977ef2080ed3a1b1a6990ce93e604dcfb0f72ab45c0c28a2428e0e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,44 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Quantum Mechanics and Quantum Computing"
+ "source": [
+ "Quantum Mechanics and Quantum Computing"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.1, Page number 41"
+ "source": [
+ "Example number 1.1, Page number 41"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#to calculate the de Broglie wavelength\n\n#Variable declaration\nc=3*10**8 #velocity of light in m/s\nh=6.626*10**-34 #planks constant \nm=1.67*10**-27 #mass of proton\n\n#Calculation\nv=c/10 #velocity of proton\nlamda=h/(m*v) #de Broglie wave length\n\n#Result\nprint(\"the de Broglie wavelength in m is \",lamda);\n",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "c=3*10**8 #velocity of light in m/s\n",
+ "h=6.626*10**-34 #planks constant \n",
+ "m=1.67*10**-27 #mass of proton\n",
+ "\n",
+ "#Calculation\n",
+ "v=c/10 #velocity of proton\n",
+ "lamda=h/(m*v) #de Broglie wave length\n",
+ "\n",
+ "#Result\n",
+ "print(\"the de Broglie wavelength in m is \",lamda);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the de Broglie wavelength in m is ', 1.3225548902195607e-14)\n"
+ "text": [
+ "('the de Broglie wavelength in m is ', 1.3225548902195607e-14)\n"
+ ]
}
],
"prompt_number": 17
@@ -38,19 +58,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.2, Page number 42"
+ "source": [
+ "Example number 1.2, Page number 42"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the de Broglie wavelength of an electron\n\n#importing modules\nimport math\n\n#Variable declaration\nV=400; #potential in Volts\n\n#Calculation\nlamda=12.56/math.sqrt(V); #de Broglie wavelength\n\n#Result\nprint(\"The de Broglie wavelength in Armstrong is\",lamda);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "V=400; #potential in Volts\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=12.56/math.sqrt(V); #de Broglie wavelength\n",
+ "\n",
+ "#Result\n",
+ "print(\"The de Broglie wavelength in Armstrong is\",lamda);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The de Broglie wavelength in Armstrong is', 0.628)\n"
+ "text": [
+ "('The de Broglie wavelength in Armstrong is', 0.628)\n"
+ ]
}
],
"prompt_number": 19
@@ -59,19 +98,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.3, Page number 42\n"
+ "source": [
+ "Example number 1.3, Page number 42\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the de Broglie wavelength of neutron\n\n#importing modules\nimport math\n\n#Variable declaration\nm=1.674*10**(-27); #mass of neutron in kg\nh=6.626*10**(-34);\nE=0.025; #kinetic energy in eV\n\n#Calculation\nEj=E*1.6*10**-19; #kinetic energy in J\nlamda=h/math.sqrt(2*m*Ej); #de Broglie wavelength\nlamdaA=lamda*10**10; #converting wavelength from m to Armstrong\nlamdaA=math.ceil(lamdaA*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"The de Broglie wavelength in metres is\",lamda);\nprint(\"The de Broglie wavelength in Armstrong is\",lamdaA);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "m=1.674*10**(-27); #mass of neutron in kg\n",
+ "h=6.626*10**(-34);\n",
+ "E=0.025; #kinetic energy in eV\n",
+ "\n",
+ "#Calculation\n",
+ "Ej=E*1.6*10**-19; #kinetic energy in J\n",
+ "lamda=h/math.sqrt(2*m*Ej); #de Broglie wavelength\n",
+ "lamdaA=lamda*10**10; #converting wavelength from m to Armstrong\n",
+ "lamdaA=math.ceil(lamdaA*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"The de Broglie wavelength in metres is\",lamda);\n",
+ "print(\"The de Broglie wavelength in Armstrong is\",lamdaA);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The de Broglie wavelength in metres is', 1.81062582829353e-10)\n('The de Broglie wavelength in Armstrong is', 1.811)\n"
+ "text": [
+ "('The de Broglie wavelength in metres is', 1.81062582829353e-10)\n",
+ "('The de Broglie wavelength in Armstrong is', 1.811)\n"
+ ]
}
],
"prompt_number": 20
@@ -80,19 +143,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.4, Page number 42"
+ "source": [
+ "Example number 1.4, Page number 42"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the de Broglie wavelength of an electron\n\n#importing modules\nimport math\n\n#Variable declaration\nV=1600; #potential in Volts\n\n#Calculation\nlamda=12.56/math.sqrt(V); #de Broglie wavelength\nlamda=math.ceil(lamda*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"The de Broglie wavelength in Armstrong is\",lamda);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "V=1600; #potential in Volts\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=12.56/math.sqrt(V); #de Broglie wavelength\n",
+ "lamda=math.ceil(lamda*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"The de Broglie wavelength in Armstrong is\",lamda);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The de Broglie wavelength in Armstrong is', 0.32)\n"
+ "text": [
+ "('The de Broglie wavelength in Armstrong is', 0.32)\n"
+ ]
}
],
"prompt_number": 21
@@ -101,19 +182,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.5, Page number 42"
+ "source": [
+ "Example number 1.5, Page number 42"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the uncertainity in momentum\n\n#importing modules\nimport math\n\n#Variable declaration\ndeltax=0.2; #distance in armstrong\nh=6.626*10**(-34);\n\n#Calculation\ndelta_xm=deltax*10**-10; #distance in m\ndelta_p=h/(2*math.pi*delta_xm);\n\n#Result\nprint(\"The uncertainity in momentum of electron in kg m/sec is\",delta_p);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "deltax=0.2; #distance in armstrong\n",
+ "h=6.626*10**(-34);\n",
+ "\n",
+ "#Calculation\n",
+ "delta_xm=deltax*10**-10; #distance in m\n",
+ "delta_p=h/(2*math.pi*delta_xm);\n",
+ "\n",
+ "#Result\n",
+ "print(\"The uncertainity in momentum of electron in kg m/sec is\",delta_p);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The uncertainity in momentum of electron in kg m/sec is', 5.2728032646344916e-24)\n"
+ "text": [
+ "('The uncertainity in momentum of electron in kg m/sec is', 5.2728032646344916e-24)\n"
+ ]
}
],
"prompt_number": 22
@@ -122,19 +222,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.6, Page number 43"
+ "source": [
+ "Example number 1.6, Page number 43"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the lowest energy of electron\n\n#importing modules\nimport math\n\n#Variable declaration\nn1=1;\nn2=1;\nn3=1; #values in lowest energy\nh=6.62*10**(-34);\nM=9.1*10**-31; #mass in kg\nL=0.1; #side in nm\n\n#Calculation\nL=L*10**-9; #side in m\nn=(n1**2)+(n2**2)+(n3**2);\nE1=(n*h**2)/(8*M*L**2); #energy in j\nE1eV=E1/(1.6*10**-19); #energy in eV\nE1eV=math.ceil(E1eV*10)/10; #rounding off to 1 decimals\n\n#Result\nprint(\"lowest energy of electron in Joule is\",E1);\nprint(\"lowest energy of electron is eV\",E1eV);\n\n#answer for lowest energy in eV given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1;\n",
+ "n2=1;\n",
+ "n3=1; #values in lowest energy\n",
+ "h=6.62*10**(-34);\n",
+ "M=9.1*10**-31; #mass in kg\n",
+ "L=0.1; #side in nm\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-9; #side in m\n",
+ "n=(n1**2)+(n2**2)+(n3**2);\n",
+ "E1=(n*h**2)/(8*M*L**2); #energy in j\n",
+ "E1eV=E1/(1.6*10**-19); #energy in eV\n",
+ "E1eV=math.ceil(E1eV*10)/10; #rounding off to 1 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lowest energy of electron in Joule is\",E1);\n",
+ "print(\"lowest energy of electron is eV\",E1eV);\n",
+ "\n",
+ "#answer for lowest energy in eV given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lowest energy of electron in Joule is', 1.8059505494505486e-17)\n('lowest energy of electron is eV', 112.9)\n"
+ "text": [
+ "('lowest energy of electron in Joule is', 1.8059505494505486e-17)\n",
+ "('lowest energy of electron is eV', 112.9)\n"
+ ]
}
],
"prompt_number": 23
@@ -143,19 +273,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.7, Page number 43"
+ "source": [
+ "Example number 1.7, Page number 43"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the de Broglie wavelength of neutron\n\n#importing modules\nimport math\n\n#Variable declaration\nM=9.1*10**(-31); #mass of electron in kg\nh=6.66*10**(-34);\nE=2000; #kinetic energy in eV\n\n#Calculation\nEj=E*1.6*10**-19; #kinetic energy in J\nlamda=h/math.sqrt(2*M*Ej); #de Broglie wavelength\nlamdaA=lamda*10**9; #converting wavelength from m to nm\nlamdaA=math.ceil(lamdaA*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"The de Broglie wavelength in nm is\",lamdaA);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "M=9.1*10**(-31); #mass of electron in kg\n",
+ "h=6.66*10**(-34);\n",
+ "E=2000; #kinetic energy in eV\n",
+ "\n",
+ "#Calculation\n",
+ "Ej=E*1.6*10**-19; #kinetic energy in J\n",
+ "lamda=h/math.sqrt(2*M*Ej); #de Broglie wavelength\n",
+ "lamdaA=lamda*10**9; #converting wavelength from m to nm\n",
+ "lamdaA=math.ceil(lamdaA*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"The de Broglie wavelength in nm is\",lamdaA);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The de Broglie wavelength in nm is', 0.028)\n"
+ "text": [
+ "('The de Broglie wavelength in nm is', 0.028)\n"
+ ]
}
],
"prompt_number": 24
@@ -164,19 +316,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.8, Page number 43"
+ "source": [
+ "Example number 1.8, Page number 43"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the minimum energy of electron\n\n#importing modules\nimport math\n\n#Variable declaration\nn=1; #for minimum energy\nh=6.626*10**(-34);\nm=9.1*10**-31; #mass in kg\nL=4*10**-10; #size in m\n\n#Calculation\nE1=(n*h**2)/(8*m*L**2); #energy in j\n\n#Result\nprint(\"lowest energy of electron in Joule is\",E1);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=1; #for minimum energy\n",
+ "h=6.626*10**(-34);\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "L=4*10**-10; #size in m\n",
+ "\n",
+ "#Calculation\n",
+ "E1=(n*h**2)/(8*m*L**2); #energy in j\n",
+ "\n",
+ "#Result\n",
+ "print(\"lowest energy of electron in Joule is\",E1);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lowest energy of electron in Joule is', 3.7692201236263733e-19)\n"
+ "text": [
+ "('lowest energy of electron in Joule is', 3.7692201236263733e-19)\n"
+ ]
}
],
"prompt_number": 23
@@ -185,19 +359,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.9, Page number 44"
+ "source": [
+ "Example number 1.9, Page number 44"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the velocity and kinetic energy of electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh=6.626*10**(-34);\nm=9.1*10**-31; #mass in kg\nlamda=1.66*10**-10; #wavelength in m\n\n#Calculation\nv=h/(m*lamda); #velocity in m/sec\nv_km=v*10**-3; #velocity in km/sec\nE=(1/2)*m*v**2; #kinetic energy in joule\nEeV=E/(1.6*10**-19); #energy in eV\nEeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"velocity of electron in m/sec is\",round(v));\nprint(\"velocity of electron in km/sec is\",round(v_km));\nprint(\"kinetic energy of electron in Joule is\",E);\nprint(\"kinetic energy of electron in eV is\",EeV);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**(-34);\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "lamda=1.66*10**-10; #wavelength in m\n",
+ "\n",
+ "#Calculation\n",
+ "v=h/(m*lamda); #velocity in m/sec\n",
+ "v_km=v*10**-3; #velocity in km/sec\n",
+ "E=(1/2)*m*v**2; #kinetic energy in joule\n",
+ "EeV=E/(1.6*10**-19); #energy in eV\n",
+ "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"velocity of electron in m/sec is\",round(v));\n",
+ "print(\"velocity of electron in km/sec is\",round(v_km));\n",
+ "print(\"kinetic energy of electron in Joule is\",E);\n",
+ "print(\"kinetic energy of electron in eV is\",EeV);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('velocity of electron in m/sec is', 4386337.0)\n('velocity of electron in km/sec is', 4386.0)\n('kinetic energy of electron in Joule is', 8.754176510091736e-18)\n('kinetic energy of electron in eV is', 54.714)\n"
+ "text": [
+ "('velocity of electron in m/sec is', 4386337.0)\n",
+ "('velocity of electron in km/sec is', 4386.0)\n",
+ "('kinetic energy of electron in Joule is', 8.754176510091736e-18)\n",
+ "('kinetic energy of electron in eV is', 54.714)\n"
+ ]
}
],
"prompt_number": 26
@@ -206,19 +410,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.10, Page number 44"
+ "source": [
+ "Example number 1.10, Page number 44"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the wavelength of an electron\n\n#importing modules\nimport math\n\n#Variable decleration\nV=15; #potential in kV\n\n#Calculation\nv=V*10**3; #potential in V\nlamda=12.26/math.sqrt(v); #de Broglie wavelength\nlamda=math.ceil(lamda*10**2)/10**2 #rounding off to 2 decimals\n\n#result\nprint(\"The de Broglie wavelength in Armstrong is\",lamda);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable decleration\n",
+ "V=15; #potential in kV\n",
+ "\n",
+ "#Calculation\n",
+ "v=V*10**3; #potential in V\n",
+ "lamda=12.26/math.sqrt(v); #de Broglie wavelength\n",
+ "lamda=math.ceil(lamda*10**2)/10**2 #rounding off to 2 decimals\n",
+ "\n",
+ "#result\n",
+ "print(\"The de Broglie wavelength in Armstrong is\",lamda);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The de Broglie wavelength in Armstrong is', 0.11)\n"
+ "text": [
+ "('The de Broglie wavelength in Armstrong is', 0.11)\n"
+ ]
}
],
"prompt_number": 27
@@ -227,19 +450,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.11, Page number 44\n"
+ "source": [
+ "Example number 1.11, Page number 44\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the de Broglie wavelength of neutron\n\n#importing modules\nimport math\n\n#Calculation\nm=1.675*10**-27; #mass of neutron in kg\nh=6.626*10**-34;\nE=10; #kinetic energy in keV\n\n#Calculation\nEeV=E*10**3; #Energy in eV\nEj=EeV*1.6*10**-19; #kinetic energy in J\nv=math.sqrt(2*Ej/m); #velocity in m/s\nlamda=h/(m*v); #de broglie wavelength in m\nlamda_A=lamda*10**10; #de broglie wavelength in armstrong\nlamda_A=math.ceil(lamda_A*10**4)/10**4 #rounding off to 4 decimals\n\n#Result\nprint(\"The velocity in m/sec is\",round(v));\nprint(\"The de Broglie wavelength in metres is\",lamda);\nprint(\"The de Broglie wavelength in Armstrong is\",lamda_A);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Calculation\n",
+ "m=1.675*10**-27; #mass of neutron in kg\n",
+ "h=6.626*10**-34;\n",
+ "E=10; #kinetic energy in keV\n",
+ "\n",
+ "#Calculation\n",
+ "EeV=E*10**3; #Energy in eV\n",
+ "Ej=EeV*1.6*10**-19; #kinetic energy in J\n",
+ "v=math.sqrt(2*Ej/m); #velocity in m/s\n",
+ "lamda=h/(m*v); #de broglie wavelength in m\n",
+ "lamda_A=lamda*10**10; #de broglie wavelength in armstrong\n",
+ "lamda_A=math.ceil(lamda_A*10**4)/10**4 #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"The velocity in m/sec is\",round(v));\n",
+ "print(\"The de Broglie wavelength in metres is\",lamda);\n",
+ "print(\"The de Broglie wavelength in Armstrong is\",lamda_A);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The velocity in m/sec is', 1382189.0)\n('The de Broglie wavelength in metres is', 2.861996093951046e-13)\n('The de Broglie wavelength in Armstrong is', 0.0029)\n"
+ "text": [
+ "('The velocity in m/sec is', 1382189.0)\n",
+ "('The de Broglie wavelength in metres is', 2.861996093951046e-13)\n",
+ "('The de Broglie wavelength in Armstrong is', 0.0029)\n"
+ ]
}
],
"prompt_number": 28
@@ -248,19 +499,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.12, Page number 45"
+ "source": [
+ "Example number 1.12, Page number 45"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the de Broglie wavelength of electron\n\n#importing modules\nimport math\n\n#Variable decleration\nm=9.1*10**-31; #mass of electron in kg\nh=6.6*10**-34;\nE=2; #kinetic energy in keV\n\n#Calculation\nEeV=E*10**3; #Energy in eV\nEj=EeV*1.6*10**-19; #kinetic energy in J\np=math.sqrt(2*m*Ej); #momentum\nlamda=h/p; #de broglie wavelength in m\nlamda_A=lamda*10**10; #de broglie wavelength in armstrong\nlamda_A=math.ceil(lamda_A*10**4)/10**4 #rounding off to 4 decimals\n\n#Result\nprint(\"The de Broglie wavelength in metres is\",lamda);\nprint(\"The de Broglie wavelength in Armstrong is\",lamda_A);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable decleration\n",
+ "m=9.1*10**-31; #mass of electron in kg\n",
+ "h=6.6*10**-34;\n",
+ "E=2; #kinetic energy in keV\n",
+ "\n",
+ "#Calculation\n",
+ "EeV=E*10**3; #Energy in eV\n",
+ "Ej=EeV*1.6*10**-19; #kinetic energy in J\n",
+ "p=math.sqrt(2*m*Ej); #momentum\n",
+ "lamda=h/p; #de broglie wavelength in m\n",
+ "lamda_A=lamda*10**10; #de broglie wavelength in armstrong\n",
+ "lamda_A=math.ceil(lamda_A*10**4)/10**4 #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"The de Broglie wavelength in metres is\",lamda);\n",
+ "print(\"The de Broglie wavelength in Armstrong is\",lamda_A);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The de Broglie wavelength in metres is', 2.7348483695436575e-11)\n('The de Broglie wavelength in Armstrong is', 0.2735)\n"
+ "text": [
+ "('The de Broglie wavelength in metres is', 2.7348483695436575e-11)\n",
+ "('The de Broglie wavelength in Armstrong is', 0.2735)\n"
+ ]
}
],
"prompt_number": 29
@@ -269,19 +546,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.13, Page number 45"
+ "source": [
+ "Example number 1.13, Page number 45"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the wavelength of thermal neutron\n\n#import module\nimport math\n\n#Variable decleration\nm=1.676*10**-27; #mass of neutron in kg\nh=6.62*10**-34;\nE=0.025; #kinetic energy in eV\n\n#Calculation\nEj=E*1.6*10**-19; #kinetic energy in J\nv=math.sqrt(2*Ej/m); #velocity in m/s\nlamda=h/(m*v); #wavelength in m\nlamda_A=lamda*10**10; #de broglie wavelength in armstrong\nlamda_A=math.ceil(lamda_A*10**5)/10**5 #rounding off to 5 decimals\n\n#Result\nprint(\"The neutrons wavelength in metres is\",lamda);\nprint(\"The wavelength in Armstrong is\",lamda_A);\n",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Variable decleration\n",
+ "m=1.676*10**-27; #mass of neutron in kg\n",
+ "h=6.62*10**-34;\n",
+ "E=0.025; #kinetic energy in eV\n",
+ "\n",
+ "#Calculation\n",
+ "Ej=E*1.6*10**-19; #kinetic energy in J\n",
+ "v=math.sqrt(2*Ej/m); #velocity in m/s\n",
+ "lamda=h/(m*v); #wavelength in m\n",
+ "lamda_A=lamda*10**10; #de broglie wavelength in armstrong\n",
+ "lamda_A=math.ceil(lamda_A*10**5)/10**5 #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"The neutrons wavelength in metres is\",lamda);\n",
+ "print(\"The wavelength in Armstrong is\",lamda_A);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The neutrons wavelength in metres is', 1.8079065940980725e-10)\n('The wavelength in Armstrong is', 1.80791)\n"
+ "text": [
+ "('The neutrons wavelength in metres is', 1.8079065940980725e-10)\n",
+ "('The wavelength in Armstrong is', 1.80791)\n"
+ ]
}
],
"prompt_number": 30
@@ -290,19 +592,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.14, Page number 45"
+ "source": [
+ "Example number 1.14, Page number 45"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the wavelength of an electron\n\n#import module\nimport math\n\n#Variable decleration\nV=10; #potential in kV\n\n#Calculation\nV=V*10**3; #potential in V\nlamda=12.26/math.sqrt(V); #wavelength\n\n#Result\nprint(\"The wavelength in Armstrong is\",lamda);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Variable decleration\n",
+ "V=10; #potential in kV\n",
+ "\n",
+ "#Calculation\n",
+ "V=V*10**3; #potential in V\n",
+ "lamda=12.26/math.sqrt(V); #wavelength\n",
+ "\n",
+ "#Result\n",
+ "print(\"The wavelength in Armstrong is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The wavelength in Armstrong is', 0.1226)\n"
+ "text": [
+ "('The wavelength in Armstrong is', 0.1226)\n"
+ ]
}
],
"prompt_number": 31
@@ -311,19 +631,56 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.15, Page number 45"
+ "source": [
+ "Example number 1.15, Page number 45"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the first three permitted levels of electron\n\n#import module\nimport math\n\n#Varialble decleration\nh=6.626*10**-34;\nm=9.1*10**-31; #mass in kg\nl=1; #width in armstrong\n\n#Calculation\nL=l*10**-10; #width in m\n#permitted electron energies En=(n**2*h**2)/(8*m*L**2)\n#let X = h**2/(8*m*L**2)\nX = h**2/(8*m*L**2); #energy in J\nXeV=X/(1.6*10**-19); #energy in eV\n#in the 1st level n1=1\nn1=1;\nE1=(n1**2)*XeV; #energy in eV\n\n#in second level n2=2\nn2=2;\nE2=(n2**2)*XeV; #energy in eV\n#in third level n3=\nn3=3;\nE3=(n3**2)*XeV; #energy in eV\n\n#Result\nprint(\"minimum energy the electron can have in eV is\",round(E1));\nprint(\"other values of energy are in eV and in eV\",round(E2),round(E3));\n\n#answers given in the book are wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Varialble decleration\n",
+ "h=6.626*10**-34;\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "l=1; #width in armstrong\n",
+ "\n",
+ "#Calculation\n",
+ "L=l*10**-10; #width in m\n",
+ "#permitted electron energies En=(n**2*h**2)/(8*m*L**2)\n",
+ "#let X = h**2/(8*m*L**2)\n",
+ "X = h**2/(8*m*L**2); #energy in J\n",
+ "XeV=X/(1.6*10**-19); #energy in eV\n",
+ "#in the 1st level n1=1\n",
+ "n1=1;\n",
+ "E1=(n1**2)*XeV; #energy in eV\n",
+ "\n",
+ "#in second level n2=2\n",
+ "n2=2;\n",
+ "E2=(n2**2)*XeV; #energy in eV\n",
+ "#in third level n3=\n",
+ "n3=3;\n",
+ "E3=(n3**2)*XeV; #energy in eV\n",
+ "\n",
+ "#Result\n",
+ "print(\"minimum energy the electron can have in eV is\",round(E1));\n",
+ "print(\"other values of energy are in eV and in eV\",round(E2),round(E3));\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('minimum energy the electron can have in eV is', 38.0)\n('other values of energy are in eV and in eV', 151.0, 339.0)\n"
+ "text": [
+ "('minimum energy the electron can have in eV is', 38.0)\n",
+ "('other values of energy are in eV and in eV', 151.0, 339.0)\n"
+ ]
}
],
"prompt_number": 32
@@ -332,19 +689,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.16, Page number 46\n"
+ "source": [
+ "Example number 1.16, Page number 46\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the probability of finding the particle\n\n#import module\nimport math\n\n#Variable decleration\nn=1; #lowest state\nL=10; #width in armstrong\n\n#Calculation\nL=L*10**-10; #width in m\nx=L/2;\ndelta_x=1; #interval in armstrong\ndelta_x=delta_x*10**-10; #interval in m\npsi1=(math.sqrt(2/L))*math.sin(math.pi*x/L);\nA=psi1**2;\np=A*delta_x;\np=math.ceil(p*10)/10; #de broglie wavelength in armstrong\n\n#Result\nprint(\"probability of finding the particle is \",p);\n",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Variable decleration\n",
+ "n=1; #lowest state\n",
+ "L=10; #width in armstrong\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-10; #width in m\n",
+ "x=L/2;\n",
+ "delta_x=1; #interval in armstrong\n",
+ "delta_x=delta_x*10**-10; #interval in m\n",
+ "psi1=(math.sqrt(2/L))*math.sin(math.pi*x/L);\n",
+ "A=psi1**2;\n",
+ "p=A*delta_x;\n",
+ "p=math.ceil(p*10)/10; #de broglie wavelength in armstrong\n",
+ "\n",
+ "#Result\n",
+ "print(\"probability of finding the particle is \",p);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('probability of finding the particle is ', 0.2)\n"
+ "text": [
+ "('probability of finding the particle is ', 0.2)\n"
+ ]
}
],
"prompt_number": 33
@@ -353,19 +735,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.17, Page number 46"
+ "source": [
+ "Example number 1.17, Page number 46"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the Fermi energy of the metal\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nd=970; #density of Na in kg/m^3\nn=6.02*10**26;\nh=6.62*10**(-34);\nm=9.1*10**-31; #mass in kg\nw=23; #atomic weight\n\n#Calculation\nN=(d*n)/w; #number of atoms per m^3\nA=(h**2)/(8*m);\nB=(3*N)/math.pi;\nEf=A*B**(2/3);\nEfeV=Ef/(1.6*10**-19);\nEfeV=math.ceil(EfeV*10**2)/10**2 #rounding of to 2 decimals\n\n#Result\nprint(\"fermi energy of Na in eV is\",EfeV);\n",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "d=970; #density of Na in kg/m^3\n",
+ "n=6.02*10**26;\n",
+ "h=6.62*10**(-34);\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "w=23; #atomic weight\n",
+ "\n",
+ "#Calculation\n",
+ "N=(d*n)/w; #number of atoms per m^3\n",
+ "A=(h**2)/(8*m);\n",
+ "B=(3*N)/math.pi;\n",
+ "Ef=A*B**(2/3);\n",
+ "EfeV=Ef/(1.6*10**-19);\n",
+ "EfeV=math.ceil(EfeV*10**2)/10**2 #rounding of to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fermi energy of Na in eV is\",EfeV);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fermi energy of Na in eV is', 3.16)\n"
+ "text": [
+ "('fermi energy of Na in eV is', 3.16)\n"
+ ]
}
],
"prompt_number": 34
@@ -374,19 +783,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.18, Page number 46"
+ "source": [
+ "Example number 1.18, Page number 46"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the lowest energy of electron\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nn1=1;\nn2=1;\nn3=1; #values in lowest energy\nh=6.62*10**(-34);\nm=9.1*10**-31; #mass in kg\nL=0.1; #side in nm\n\n#Calculation\nL=L*10**-9; #side in m\nn=(n1**2)+(n2**2)+(n3**2);\nE1=(n*h**2)/(8*m*L**2); #energy in j\nE1eV=E1/(1.6*10**-19); #energy in eV\nE1eV=math.ceil(E1eV*10**1)/10**1 #rounding off to 2 decimals\n\n#Result\nprint(\"lowest energy of electron in Joule is\",E1);\nprint(\"lowest energy of electron in eV is\",E1eV);\n",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "n1=1;\n",
+ "n2=1;\n",
+ "n3=1; #values in lowest energy\n",
+ "h=6.62*10**(-34);\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "L=0.1; #side in nm\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-9; #side in m\n",
+ "n=(n1**2)+(n2**2)+(n3**2);\n",
+ "E1=(n*h**2)/(8*m*L**2); #energy in j\n",
+ "E1eV=E1/(1.6*10**-19); #energy in eV\n",
+ "E1eV=math.ceil(E1eV*10**1)/10**1 #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lowest energy of electron in Joule is\",E1);\n",
+ "print(\"lowest energy of electron in eV is\",E1eV);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lowest energy of electron in Joule is', 1.8059505494505486e-17)\n('lowest energy of electron in eV is', 112.9)\n"
+ "text": [
+ "('lowest energy of electron in Joule is', 1.8059505494505486e-17)\n",
+ "('lowest energy of electron in eV is', 112.9)\n"
+ ]
}
],
"prompt_number": 35
@@ -395,19 +833,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.19, Page number 47"
+ "source": [
+ "Example number 1.19, Page number 47"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the de broglie wavelength of neutron\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nmn=1.676*10**-27; #mass of neutron in kg\nme=9.1*10**-31; #mass of electron in kg\nh=6.62*10**-34;\nc=3*10**8; #velocity of light in m/sec\n\n#Calculation\nEn=2*me*c**2;\nlamda=h/math.sqrt(2*mn*En); #wavelength in m\nlamda_A=lamda*10**10; #converting lamda from m to A\nlamda_A=math.ceil(lamda_A*10**6)/10**6 #rounding off to 6 decimals\n\n#Result\nprint(\"The de broglie wavelength in Angstrom is\",lamda_A);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "mn=1.676*10**-27; #mass of neutron in kg\n",
+ "me=9.1*10**-31; #mass of electron in kg\n",
+ "h=6.62*10**-34;\n",
+ "c=3*10**8; #velocity of light in m/sec\n",
+ "\n",
+ "#Calculation\n",
+ "En=2*me*c**2;\n",
+ "lamda=h/math.sqrt(2*mn*En); #wavelength in m\n",
+ "lamda_A=lamda*10**10; #converting lamda from m to A\n",
+ "lamda_A=math.ceil(lamda_A*10**6)/10**6 #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"The de broglie wavelength in Angstrom is\",lamda_A);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The de broglie wavelength in Angstrom is', 0.000283)\n"
+ "text": [
+ "('The de broglie wavelength in Angstrom is', 0.000283)\n"
+ ]
}
],
"prompt_number": 36
@@ -416,19 +878,58 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.20, Page number 47 ***************************************************************************"
+ "source": [
+ "Example number 1.20, Page number 47 ***************************************************************************"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the energies of electron\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nn2=2; #second quantum state\nn4=4; #fourth quantum state\nh=6.626*10**-34;\nm=9.1*10**-31; #mass in kg\na=2; #potential box length in armstrong\n\n#Calculation\na=a*10**-10; #length in m\nA=n2**2*h**2;\nB=8*m*a**2;\nE2=A/B; #energy in j\nE2eV=E2/(1.6*10**-19); #energy in eV\nC=n4**2*h**2;\nE4=C/B; #energy in j\nE4eV=E4/(1.6*10**-19); #energy in eV\n\n#Result\nprint(\"energy corresponding to second quantum state in Joule is\",E2);\nprint(\"energy corresponding to second quantum state in eV is\",E2eV);\nprint(\"energy corresponding to fourth quantum state in Joule is\",E4);\nprint(\"energy corresponding to fourth quantum state in eV is\",E4eV);\n\n\n#answers given in the book are wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "n2=2; #second quantum state\n",
+ "n4=4; #fourth quantum state\n",
+ "h=6.626*10**-34;\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "a=2; #potential box length in armstrong\n",
+ "\n",
+ "#Calculation\n",
+ "a=a*10**-10; #length in m\n",
+ "A=n2**2*h**2;\n",
+ "B=8*m*a**2;\n",
+ "E2=A/B; #energy in j\n",
+ "E2eV=E2/(1.6*10**-19); #energy in eV\n",
+ "C=n4**2*h**2;\n",
+ "E4=C/B; #energy in j\n",
+ "E4eV=E4/(1.6*10**-19); #energy in eV\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy corresponding to second quantum state in Joule is\",E2);\n",
+ "print(\"energy corresponding to second quantum state in eV is\",E2eV);\n",
+ "print(\"energy corresponding to fourth quantum state in Joule is\",E4);\n",
+ "print(\"energy corresponding to fourth quantum state in eV is\",E4eV);\n",
+ "\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy corresponding to second quantum state in Joule is', 6.030752197802197e-18)\n('energy corresponding to second quantum state in eV is', 37.69220123626373)\n('energy corresponding to fourth quantum state in Joule is', 2.412300879120879e-17)\n('energy corresponding to fourth quantum state in eV is', 150.7688049450549)\n"
+ "text": [
+ "('energy corresponding to second quantum state in Joule is', 6.030752197802197e-18)\n",
+ "('energy corresponding to second quantum state in eV is', 37.69220123626373)\n",
+ "('energy corresponding to fourth quantum state in Joule is', 2.412300879120879e-17)\n",
+ "('energy corresponding to fourth quantum state in eV is', 150.7688049450549)\n"
+ ]
}
],
"prompt_number": 13
@@ -437,19 +938,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.21, Page number 48 ***********"
+ "source": [
+ "Example number 1.21, Page number 48 ***********"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the spacing of the crystal\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nV=344; #accelerated voltage in V\nn=1; #first reflection\ntheta=60; #glancing angle in degrees\n\n#Calculation\nlamda=12.27/math.sqrt(V);\nd=(n*lamda)/(2*math.sin(theta));\n\n#Result\nprint(\"The spacing of the crystal in Angstrom is\",lamda);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "V=344; #accelerated voltage in V\n",
+ "n=1; #first reflection\n",
+ "theta=60; #glancing angle in degrees\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=12.27/math.sqrt(V);\n",
+ "d=(n*lamda)/(2*math.sin(theta));\n",
+ "\n",
+ "#Result\n",
+ "print(\"The spacing of the crystal in Angstrom is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The spacing of the crystal in Angstrom is', 0.6615540636030947)\n"
+ "text": [
+ "('The spacing of the crystal in Angstrom is', 0.6615540636030947)\n"
+ ]
}
],
"prompt_number": 38
@@ -458,19 +980,61 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.22, Page number 49 *************"
+ "source": [
+ "Example number 1.22, Page number 49 *************"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the energies of electron\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nn2=2; #second quantum state\nn3=3; #fourth quantum state\nh=6.626*10**-34;\nm=9.1*10**-31; #mass in kg\na=1*10**-10; #width of potential well in m\n\n#Calculation\nB=8*m*a**2;\nE1=h**2/B; #ground state energy\nE1eV=E1/(1.6*10**-19); #energy in eV\nA=n2**2*h**2;\nE2=A/B; #energy in j\nE2eV=E2/(1.6*10**-19); #energy in eV\nC=n3**2*h**2;\nE3=C/B; #energy in j\nE3eV=E3/(1.6*10**-19); #energy in eV\nE1=math.ceil(E1*10**3)/10**3 #rounding off to 3 decimals\nE1eV=math.ceil(E1eV*10**3)/10**3 #rounding off to 3 decimals\nE2eV=math.ceil(E2eV*10**3)/10**3 #rounding off to 3 decimals\nE3eV=math.ceil(E3eV*10**3)/10**3 #rounding off to 3 decimals\n\n#Result\nprint(\"ground state energy in Joule is\",E1);\nprint(\"ground state energy in eV is\",E1eV);\nprint(\"first energy state in eV is\",E2eV);\nprint(\"second energy state in eV is\",E3eV);\n\n#answers given in the book are wrong by one decimal",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "n2=2; #second quantum state\n",
+ "n3=3; #fourth quantum state\n",
+ "h=6.626*10**-34;\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "a=1*10**-10; #width of potential well in m\n",
+ "\n",
+ "#Calculation\n",
+ "B=8*m*a**2;\n",
+ "E1=h**2/B; #ground state energy\n",
+ "E1eV=E1/(1.6*10**-19); #energy in eV\n",
+ "A=n2**2*h**2;\n",
+ "E2=A/B; #energy in j\n",
+ "E2eV=E2/(1.6*10**-19); #energy in eV\n",
+ "C=n3**2*h**2;\n",
+ "E3=C/B; #energy in j\n",
+ "E3eV=E3/(1.6*10**-19); #energy in eV\n",
+ "E1=math.ceil(E1*10**3)/10**3 #rounding off to 3 decimals\n",
+ "E1eV=math.ceil(E1eV*10**3)/10**3 #rounding off to 3 decimals\n",
+ "E2eV=math.ceil(E2eV*10**3)/10**3 #rounding off to 3 decimals\n",
+ "E3eV=math.ceil(E3eV*10**3)/10**3 #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"ground state energy in Joule is\",E1);\n",
+ "print(\"ground state energy in eV is\",E1eV);\n",
+ "print(\"first energy state in eV is\",E2eV);\n",
+ "print(\"second energy state in eV is\",E3eV);\n",
+ "\n",
+ "#answers given in the book are wrong by one decimal"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('ground state energy in Joule is', 0.001)\n('ground state energy in eV is', 37.693)\n('first energy state in eV is', 150.769)\n('second energy state in eV is', 339.23)\n"
+ "text": [
+ "('ground state energy in Joule is', 0.001)\n",
+ "('ground state energy in eV is', 37.693)\n",
+ "('first energy state in eV is', 150.769)\n",
+ "('second energy state in eV is', 339.23)\n"
+ ]
}
],
"prompt_number": 39
@@ -479,12 +1043,35 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.23, Page number 49"
+ "source": [
+ "Example number 1.23, Page number 49"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the energy required to jump an electron\n\n#import module\nimport math\n\n#Variable decleration\nn3=3; #fourth quantum state\nh=6.626*10**-34;\nm=9.1*10**-31; #mass in kg\n\n\n#ground state energy E1 = h**2/(8*m*a**2)\n#second excited state E3 = (9*h**2)/(8*m*a**2)\n#required energy E = E3-E1\n#E = (9*h**2)/(8*m*a**2) - h**2/(8*m*a**2)\n#E = (h**2/(8*m*a**2))*(9-1)\n#therefore E = (8*h**2)/(8*m*a**2)\n#hence E = (h**2)/(m*a**2)\n\n#Result \n# the required energy is E = (h**2)/(m*a**2)",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Variable decleration\n",
+ "n3=3; #fourth quantum state\n",
+ "h=6.626*10**-34;\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "\n",
+ "\n",
+ "#ground state energy E1 = h**2/(8*m*a**2)\n",
+ "#second excited state E3 = (9*h**2)/(8*m*a**2)\n",
+ "#required energy E = E3-E1\n",
+ "#E = (9*h**2)/(8*m*a**2) - h**2/(8*m*a**2)\n",
+ "#E = (h**2/(8*m*a**2))*(9-1)\n",
+ "#therefore E = (8*h**2)/(8*m*a**2)\n",
+ "#hence E = (h**2)/(m*a**2)\n",
+ "\n",
+ "#Result \n",
+ "# the required energy is E = (h**2)/(m*a**2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -494,19 +1081,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.24, Page number 50"
+ "source": [
+ "Example number 1.24, Page number 50"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the minimum uncertainity in velocity\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\ndelta_x=10**-8; #length of box in m\nh=6.626*10**-34;\nm=9.1*10**-31; #mass in kg\n\n#Calculation\ndelta_v=h/(m*delta_x); #uncertainity in m/sec\ndelta_vk=delta_v*10**-3; #uncertainity in km/sec\ndelta_vk=math.ceil(delta_vk*10**2)/10**2 #rounding off to 2 decimals\n\n#Result\nprint(\"minimum uncertainity in velocity in m/sec is\",round(delta_v));\nprint(\"minimum uncertainity in velocity in km/sec is\",delta_vk);\n",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "delta_x=10**-8; #length of box in m\n",
+ "h=6.626*10**-34;\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "\n",
+ "#Calculation\n",
+ "delta_v=h/(m*delta_x); #uncertainity in m/sec\n",
+ "delta_vk=delta_v*10**-3; #uncertainity in km/sec\n",
+ "delta_vk=math.ceil(delta_vk*10**2)/10**2 #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"minimum uncertainity in velocity in m/sec is\",round(delta_v));\n",
+ "print(\"minimum uncertainity in velocity in km/sec is\",delta_vk);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('minimum uncertainity in velocity in m/sec is', 72813.0)\n('minimum uncertainity in velocity in km/sec is', 72.82)\n"
+ "text": [
+ "('minimum uncertainity in velocity in m/sec is', 72813.0)\n",
+ "('minimum uncertainity in velocity in km/sec is', 72.82)\n"
+ ]
}
],
"prompt_number": 40
@@ -515,19 +1126,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.25, Page number 50"
+ "source": [
+ "Example number 1.25, Page number 50"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the de broglie wavelength of proton\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nmp=1.6*10**-27; #mass of proton in kg\nme=9.1*10**-31; #mass of electron in kg\nh=6.626*10**(-34);\nc=3*10**10; #velocity of light in m/sec\n\n#Calculation\nEp=me*c**2;\nlamda=h/math.sqrt(2*mp*Ep); #wavelength in m\nlamda_A=lamda*10**10; #converting lamda from m to A\n\n#Result\nprint(\"The de broglie wavelength in Angstrom is\",lamda_A);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "mp=1.6*10**-27; #mass of proton in kg\n",
+ "me=9.1*10**-31; #mass of electron in kg\n",
+ "h=6.626*10**(-34);\n",
+ "c=3*10**10; #velocity of light in m/sec\n",
+ "\n",
+ "#Calculation\n",
+ "Ep=me*c**2;\n",
+ "lamda=h/math.sqrt(2*mp*Ep); #wavelength in m\n",
+ "lamda_A=lamda*10**10; #converting lamda from m to A\n",
+ "\n",
+ "#Result\n",
+ "print(\"The de broglie wavelength in Angstrom is\",lamda_A);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The de broglie wavelength in Angstrom is', 4.092931643497047e-06)\n"
+ "text": [
+ "('The de broglie wavelength in Angstrom is', 4.092931643497047e-06)\n"
+ ]
}
],
"prompt_number": 41
@@ -536,19 +1170,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.26, Page number 51 *************************************************"
+ "source": [
+ "Example number 1.26, Page number 51 *************************************************"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the glancing angle\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nm=1.675*10**(-27); #mass of neutron in kg\nh=6.626*10**(-34);\nn=1; #diffractive order\nd=0.314; #spacing in nm\nE=0.04; #kinetic energy in eV\n\n#Calculation\nd=d*10**-9; #spacing in m\nEj=E*1.6*10**-19; #kinetic energy in J\nlamda=h/math.sqrt(2*m*Ej); #de Broglie wavelength\nlamdaA=lamda*10**9; #converting wavelength from m to nm\ntheta=math.asin((n*lamda)/(2*d));\nprint(\"The de Broglie wavelength in metres is\",lamda);\nprint(\"The de Broglie wavelength in nm is\",lamdaA);\nprint(\"glancing angle in degrees is\",theta);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "m=1.675*10**(-27); #mass of neutron in kg\n",
+ "h=6.626*10**(-34);\n",
+ "n=1; #diffractive order\n",
+ "d=0.314; #spacing in nm\n",
+ "E=0.04; #kinetic energy in eV\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**-9; #spacing in m\n",
+ "Ej=E*1.6*10**-19; #kinetic energy in J\n",
+ "lamda=h/math.sqrt(2*m*Ej); #de Broglie wavelength\n",
+ "lamdaA=lamda*10**9; #converting wavelength from m to nm\n",
+ "theta=math.asin((n*lamda)/(2*d));\n",
+ "print(\"The de Broglie wavelength in metres is\",lamda);\n",
+ "print(\"The de Broglie wavelength in nm is\",lamdaA);\n",
+ "print(\"glancing angle in degrees is\",theta);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The de Broglie wavelength in metres is', 1.4309980469755228e-10)\n('The de Broglie wavelength in nm is', 0.1430998046975523)\n('glancing angle in degrees is', 0.2298853909391574)\n"
+ "text": [
+ "('The de Broglie wavelength in metres is', 1.4309980469755228e-10)\n",
+ "('The de Broglie wavelength in nm is', 0.1430998046975523)\n",
+ "('glancing angle in degrees is', 0.2298853909391574)\n"
+ ]
}
],
"prompt_number": 16
@@ -556,7 +1220,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/chapter2_2.ipynb b/Engineering_Physics/chapter2_2.ipynb
index 95f30057..a118db3c 100644
--- a/Engineering_Physics/chapter2_2.ipynb
+++ b/Engineering_Physics/chapter2_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter2"
+ "name": "",
+ "signature": "sha256:04561aafd347865fa8c83acfb9b60eb84db275f85862655b442f546023cadd1e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,46 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Electron Theory of Metals"
+ "source": [
+ "Electron Theory of Metals"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.1, Page number 69"
+ "source": [
+ "Example number 2.1, Page number 69"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the Fermi function\n\n#import module\nimport math\n\n#Calculation\n# given that E-Ef = kT\n# fermi function FE = 1/(1+exp((E-Ef)/kT)\n# therefore FE = 1/(1+exp(kT/kT));\n# FE = 1/(1+exp(1))\nFE=1/(1+math.exp(1));\nFE=math.ceil(FE*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"fermi function is\",FE);",
+ "input": [
+ "\n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Calculation\n",
+ "# given that E-Ef = kT\n",
+ "# fermi function FE = 1/(1+exp((E-Ef)/kT)\n",
+ "# therefore FE = 1/(1+exp(kT/kT));\n",
+ "# FE = 1/(1+exp(1))\n",
+ "FE=1/(1+math.exp(1));\n",
+ "FE=math.ceil(FE*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fermi function is\",FE);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fermi function is', 0.27)\n"
+ "text": [
+ "('fermi function is', 0.27)\n"
+ ]
}
],
"prompt_number": 5
@@ -38,19 +60,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.2, Page number 69"
+ "source": [
+ "Example number 2.2, Page number 69"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the Fermi function\n\n#import module\nimport math\n\n#Calculation\n# given that E-Ef = kT\n# fermi function FE = 1/(1+exp((E-Ef)/kT)\n# therefore FE = 1/(1+exp(kT/kT));\n# FE = 1/(1+exp(1))\nFE=1/(1+math.exp(1));\nFE=math.ceil(FE*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"fermi function is\",FE);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Calculation\n",
+ "# given that E-Ef = kT\n",
+ "# fermi function FE = 1/(1+exp((E-Ef)/kT)\n",
+ "# therefore FE = 1/(1+exp(kT/kT));\n",
+ "# FE = 1/(1+exp(1))\n",
+ "FE=1/(1+math.exp(1));\n",
+ "FE=math.ceil(FE*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fermi function is\",FE);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fermi function is', 0.269)\n"
+ "text": [
+ "('fermi function is', 0.269)\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +100,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.3, Page number 69"
+ "source": [
+ "Example number 2.3, Page number 69"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the temperature\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nFE=10/100; #fermi function is 10%\nEf=5.5; #fermi energy of silver in eV\nk=1.38*10**-23;\n\n#Calculation\nE=Ef+(Ef/100);\n#FE=1/(1+math.exp((E-Ef)/(k*T)))\n#therefore 1/FE = 1+math.exp((E-Ef)/(k*T))\n#therefore (1/FE)-1 = math.exp((E-Ef)/(k*T))\n#therefore log((1/FE)-1) = (E-Ef)/(k*T)\n#therefore T = (E-Ef)/(k*math.log((1/FE)-1))\n#let X=E-Ef; \nX=E-Ef; #energy in eV\nX=X*1.6*10**-19; #energy in J\nT = (X/(k*math.log((1/FE)-1)));\nT=math.ceil(T*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"temperature in K is\",T);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "FE=10/100; #fermi function is 10%\n",
+ "Ef=5.5; #fermi energy of silver in eV\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "E=Ef+(Ef/100);\n",
+ "#FE=1/(1+math.exp((E-Ef)/(k*T)))\n",
+ "#therefore 1/FE = 1+math.exp((E-Ef)/(k*T))\n",
+ "#therefore (1/FE)-1 = math.exp((E-Ef)/(k*T))\n",
+ "#therefore log((1/FE)-1) = (E-Ef)/(k*T)\n",
+ "#therefore T = (E-Ef)/(k*math.log((1/FE)-1))\n",
+ "#let X=E-Ef; \n",
+ "X=E-Ef; #energy in eV\n",
+ "X=X*1.6*10**-19; #energy in J\n",
+ "T = (X/(k*math.log((1/FE)-1)));\n",
+ "T=math.ceil(T*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"temperature in K is\",T);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('temperature in K is', 290.23)\n"
+ "text": [
+ "('temperature in K is', 290.23)\n"
+ ]
}
],
"prompt_number": 8
@@ -80,19 +151,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.4, Page number 70 **************************************"
+ "source": [
+ "Example number 2.4, Page number 70 **************************************"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the temperature\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\n#let X=E-Ef\nX=0.5; #E-Ef=0.5 in eV\n\n#Calculation\nX=X*1.6*10**-19; #X in J\nFE=1/100; #fermi function is 1% \nk=1.38*10**-23;\n#FE=1/(1+exp(X/(k*T)))\n#therefore 1/FE = 1+math.exp(X/(k*T))\n#therefore (1/FE)-1 = math.exp(X/(k*T))\n#therefore log((1/FE)-1) = X/(k*T)\n#but log(x) = 2.303*math.log10(x)\n#therefore T = X/(k*math.log((1/FE)-1))\n#but log(x)=2.303*math.log10(x)\n#therefore T = X/(k*2.303*math.log10((1/FE)-1))\nT = X/(k*2.303*math.log10((1/FE)-1));\n\n#Result\nprint(\"temperature in K is\",T);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "#let X=E-Ef\n",
+ "X=0.5; #E-Ef=0.5 in eV\n",
+ "\n",
+ "#Calculation\n",
+ "X=X*1.6*10**-19; #X in J\n",
+ "FE=1/100; #fermi function is 1% \n",
+ "k=1.38*10**-23;\n",
+ "#FE=1/(1+exp(X/(k*T)))\n",
+ "#therefore 1/FE = 1+math.exp(X/(k*T))\n",
+ "#therefore (1/FE)-1 = math.exp(X/(k*T))\n",
+ "#therefore log((1/FE)-1) = X/(k*T)\n",
+ "#but log(x) = 2.303*math.log10(x)\n",
+ "#therefore T = X/(k*math.log((1/FE)-1))\n",
+ "#but log(x)=2.303*math.log10(x)\n",
+ "#therefore T = X/(k*2.303*math.log10((1/FE)-1))\n",
+ "T = X/(k*2.303*math.log10((1/FE)-1));\n",
+ "\n",
+ "#Result\n",
+ "print(\"temperature in K is\",T);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('temperature in K is', 1261.3505710887953)\n"
+ "text": [
+ "('temperature in K is', 1261.3505710887953)\n"
+ ]
}
],
"prompt_number": 14
@@ -101,19 +202,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.5, Page number 71 *******"
+ "source": [
+ "Example number 2.5, Page number 71 *******"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the density and mobility of electrons in silver\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nrho_s=10.5*10**3; #density in kg/m^3\nNA=6.02*10**26; #avagadro number per kmol\nMA=107.9; \n\n#Calculation\nn=(rho_s*NA)/MA;\nsigma=6.8*10**7;\ne=1.6*10**-19; #charge in coulomb\nmew=sigma/(n*e);\nmew=math.ceil(mew*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"density of electrons is\",n);\nprint(\"mobility of electrons in silver in m^2/Vs is\",mew);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "rho_s=10.5*10**3; #density in kg/m^3\n",
+ "NA=6.02*10**26; #avagadro number per kmol\n",
+ "MA=107.9; \n",
+ "\n",
+ "#Calculation\n",
+ "n=(rho_s*NA)/MA;\n",
+ "sigma=6.8*10**7;\n",
+ "e=1.6*10**-19; #charge in coulomb\n",
+ "mew=sigma/(n*e);\n",
+ "mew=math.ceil(mew*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"density of electrons is\",n);\n",
+ "print(\"mobility of electrons in silver in m^2/Vs is\",mew);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('density of electrons is', 5.85820203892493e+28)\n('mobility of electrons in silver in m^2/Vs is', 0.007255)\n"
+ "text": [
+ "('density of electrons is', 5.85820203892493e+28)\n",
+ "('mobility of electrons in silver in m^2/Vs is', 0.007255)\n"
+ ]
}
],
"prompt_number": 16
@@ -122,19 +249,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.6, Page number 71 ***"
+ "source": [
+ "Example number 2.6, Page number 71 ***"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the mobility and average time of collision of electrons\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nd=8.92*10**3; #density in kg/m^3\nrho=1.73*10**-8; #resistivity in ohm-m\nm=9.1*10**-31; #mass in kg\nw=63.5; #atomic weight\ne=1.6*10**-19; #charge in coulomb\nA=6.02*10**26; #avagadro number\n\n#Calculation\nn=(d*A)/w;\nmew=1/(rho*n*e);\ntow=m/(n*(e**2)*rho);\nmew=math.ceil(mew*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"mobility of electrons in Copper in m/Vs is\",mew);\nprint(\"average time of collision of electrons in copper in sec is\",tow);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "d=8.92*10**3; #density in kg/m^3\n",
+ "rho=1.73*10**-8; #resistivity in ohm-m\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "w=63.5; #atomic weight\n",
+ "e=1.6*10**-19; #charge in coulomb\n",
+ "A=6.02*10**26; #avagadro number\n",
+ "\n",
+ "#Calculation\n",
+ "n=(d*A)/w;\n",
+ "mew=1/(rho*n*e);\n",
+ "tow=m/(n*(e**2)*rho);\n",
+ "mew=math.ceil(mew*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"mobility of electrons in Copper in m/Vs is\",mew);\n",
+ "print(\"average time of collision of electrons in copper in sec is\",tow);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('mobility of electrons in Copper in m/Vs is', 0.004273)\n('average time of collision of electrons in copper in sec is', 2.4297841992299697e-14)\n"
+ "text": [
+ "('mobility of electrons in Copper in m/Vs is', 0.004273)\n",
+ "('average time of collision of electrons in copper in sec is', 2.4297841992299697e-14)\n"
+ ]
}
],
"prompt_number": 18
@@ -143,19 +298,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.7, Page number 72"
+ "source": [
+ "Example number 2.7, Page number 72"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the relaxation time of conduction electrons\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nrho=1.54*10**-8; #resistivity in ohm-m\nn=5.8*10**28; #electron/m^3\nm=9.108*10**-31; #mass in kg\ne=1.602*10**-19; #charge in coulomb\n\n#Calculation\ntow=m/(n*(e**2)*rho);\n\n#Result\nprint(\"relaxation time of conduction electrons in sec is\",tow);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "rho=1.54*10**-8; #resistivity in ohm-m\n",
+ "n=5.8*10**28; #electron/m^3\n",
+ "m=9.108*10**-31; #mass in kg\n",
+ "e=1.602*10**-19; #charge in coulomb\n",
+ "\n",
+ "#Calculation\n",
+ "tow=m/(n*(e**2)*rho);\n",
+ "\n",
+ "#Result\n",
+ "print(\"relaxation time of conduction electrons in sec is\",tow);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('relaxation time of conduction electrons in sec is', 3.973281032516849e-14)\n"
+ "text": [
+ "('relaxation time of conduction electrons in sec is', 3.973281032516849e-14)\n"
+ ]
}
],
"prompt_number": 19
@@ -164,19 +340,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.8, Page number 73"
+ "source": [
+ "Example number 2.8, Page number 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the temperature\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nFE=10/100; #fermi function is 10%\nEf=5.5; #fermi energy of silver in eV\nk=1.38*10**-23;\n\n#Calculation\nE=Ef+(Ef/100);\n#FE=1/(1+math.exp((E-Ef)/(k*T)))\n#therefore 1/FE = 1+math.exp((E-Ef)/(k*T))\n#therefore (1/FE)-1 = math.exp((E-Ef)/(k*T))\n#therefore log((1/FE)-1) = (E-Ef)/(k*T)\n#therefore T = (E-Ef)/(k*math.log((1/FE)-1))\n#let X=E-Ef; \nX=E-Ef; #energy in eV\nX=X*1.6*10**-19; #energy in J\nT = (X/(k*math.log((1/FE)-1)));\nT=math.ceil(T*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"temperature in K is\",T);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "FE=10/100; #fermi function is 10%\n",
+ "Ef=5.5; #fermi energy of silver in eV\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "E=Ef+(Ef/100);\n",
+ "#FE=1/(1+math.exp((E-Ef)/(k*T)))\n",
+ "#therefore 1/FE = 1+math.exp((E-Ef)/(k*T))\n",
+ "#therefore (1/FE)-1 = math.exp((E-Ef)/(k*T))\n",
+ "#therefore log((1/FE)-1) = (E-Ef)/(k*T)\n",
+ "#therefore T = (E-Ef)/(k*math.log((1/FE)-1))\n",
+ "#let X=E-Ef; \n",
+ "X=E-Ef; #energy in eV\n",
+ "X=X*1.6*10**-19; #energy in J\n",
+ "T = (X/(k*math.log((1/FE)-1)));\n",
+ "T=math.ceil(T*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"temperature in K is\",T);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('temperature in K is', 290.23)\n"
+ "text": [
+ "('temperature in K is', 290.23)\n"
+ ]
}
],
"prompt_number": 21
@@ -185,19 +391,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.9, Page number 73"
+ "source": [
+ "Example number 2.9, Page number 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the Fermi distribution function\n\n#import module\nimport math\n\n#Calculation\n# given that E-Ef = kT\n# fermi function FpE = 1/(1+exp((E-Ef)/kT)\n# therefore FpE = 1/(1+exp(kT/kT));\n# FpE = 1/(1+exp(1))\nFpE=1/(1+math.exp(1));\nFpE=math.ceil(FpE*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"fermi function is\",FpE);\n#the presence of electron at that energy level is not certain",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Calculation\n",
+ "# given that E-Ef = kT\n",
+ "# fermi function FpE = 1/(1+exp((E-Ef)/kT)\n",
+ "# therefore FpE = 1/(1+exp(kT/kT));\n",
+ "# FpE = 1/(1+exp(1))\n",
+ "FpE=1/(1+math.exp(1));\n",
+ "FpE=math.ceil(FpE*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fermi function is\",FpE);\n",
+ "#the presence of electron at that energy level is not certain"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fermi function is', 0.27)\n"
+ "text": [
+ "('fermi function is', 0.27)\n"
+ ]
}
],
"prompt_number": 23
@@ -206,12 +432,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.10, Page number 74 ****************************"
+ "source": [
+ "Example number 2.10, Page number 74 ****************************"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the number of states per unit volume\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nm=9.1*10**-31; #mass in kg\nh=6.626*10**-34;\nA=(8*m)**(3/2);\n\n#Calculation\nB=math.pi/(2*h**3);\nEfeV=3.10; #fermi energy in eV\nEf=EfeV*1.6*10**-19; #fermi energy in J\nEFeV=EfeV+0.02; #energy after interval in eV\nEF=EFeV*1.6*10**-19; #energy after interval in J\nfunction Q=f(E),Q=A*B*math.sqrt(E),endfunction\nI=intg(Ef,EF,f)\n\n#Result\nprint(\"number of energy states per unit volume is\",I);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "h=6.626*10**-34;\n",
+ "A=(8*m)**(3/2);\n",
+ "\n",
+ "#Calculation\n",
+ "B=math.pi/(2*h**3);\n",
+ "EfeV=3.10; #fermi energy in eV\n",
+ "Ef=EfeV*1.6*10**-19; #fermi energy in J\n",
+ "EFeV=EfeV+0.02; #energy after interval in eV\n",
+ "EF=EFeV*1.6*10**-19; #energy after interval in J\n",
+ "function Q=f(E),Q=A*B*math.sqrt(E),endfunction\n",
+ "I=intg(Ef,EF,f)\n",
+ "\n",
+ "#Result\n",
+ "print(\"number of energy states per unit volume is\",I);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -230,19 +480,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.11, Page number 74"
+ "source": [
+ "Example number 2.11, Page number 74"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the mean free path of electron\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nT=300; #temperature in K\nn=8.5*10**28; #density per m^3\nrho=1.69*10**-8; #resistivity in ohm/m^3\nme=9.11*10**-31; #mass of electron in kg\ne=1.6*10**-19; #charge in coulomb\nKB=1.38*10**-23; #boltzmann constant in J/k\n\n#Calculation\nlamda=math.sqrt(3*KB*me*T)/(n*(e**2)*rho);\n\n#Result\nprint(\"mean free path of electron in m is\",lamda);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "T=300; #temperature in K\n",
+ "n=8.5*10**28; #density per m^3\n",
+ "rho=1.69*10**-8; #resistivity in ohm/m^3\n",
+ "me=9.11*10**-31; #mass of electron in kg\n",
+ "e=1.6*10**-19; #charge in coulomb\n",
+ "KB=1.38*10**-23; #boltzmann constant in J/k\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=math.sqrt(3*KB*me*T)/(n*(e**2)*rho);\n",
+ "\n",
+ "#Result\n",
+ "print(\"mean free path of electron in m is\",lamda);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('mean free path of electron in m is', 2.892506814374228e-09)\n"
+ "text": [
+ "('mean free path of electron in m is', 2.892506814374228e-09)\n"
+ ]
}
],
"prompt_number": 27
@@ -251,19 +526,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.12, Page number 75"
+ "source": [
+ "Example number 2.12, Page number 75"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the relaxation time of conduction electrons\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nrho=1.43*10**-8; #resistivity in ohm-m\nn=6.5*10**28; #electron/m^3\nm=9.11*10**-34; #mass in kg\ne=1.6*10**-19; #charge in coulomb\n\n#Calculation\ntow=m/(n*(e**2)*rho);\n\n#Result\nprint(\"relaxation time of conduction electrons in sec is\",tow);",
+ "input": [
+ " \n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "rho=1.43*10**-8; #resistivity in ohm-m\n",
+ "n=6.5*10**28; #electron/m^3\n",
+ "m=9.11*10**-34; #mass in kg\n",
+ "e=1.6*10**-19; #charge in coulomb\n",
+ "\n",
+ "#Calculation\n",
+ "tow=m/(n*(e**2)*rho);\n",
+ "\n",
+ "#Result\n",
+ "print(\"relaxation time of conduction electrons in sec is\",tow);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('relaxation time of conduction electrons in sec is', 3.8285032275416887e-17)\n"
+ "text": [
+ "('relaxation time of conduction electrons in sec is', 3.8285032275416887e-17)\n"
+ ]
}
],
"prompt_number": 28
@@ -272,19 +567,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.13, Page number 75 ******"
+ "source": [
+ "Example number 2.13, Page number 75 ******"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the mobility and average time of collision of electrons\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nd=8.92*10**3; #density in kg/m^3\nrho=1.73*10**-8; #resistivity in ohm-m\nm=9.1*10**-31; #mass in kg\nM=63.5; #atomic weight\ne=1.6*10**-19; #charge in coulomb\nA=6.02*10**26; #avagadro number\n\n#Calculation\nn=(d*A)/M;\nmew=1/(rho*n*e);\ntow=m/(n*(e**2)*rho);\nmew=math.ceil(mew*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"mobility of electrons in Copper in m/Vs is\",mew);\nprint(\"average time of collision of electrons in copper in sec is\",tow);",
+ "input": [
+ " \n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "d=8.92*10**3; #density in kg/m^3\n",
+ "rho=1.73*10**-8; #resistivity in ohm-m\n",
+ "m=9.1*10**-31; #mass in kg\n",
+ "M=63.5; #atomic weight\n",
+ "e=1.6*10**-19; #charge in coulomb\n",
+ "A=6.02*10**26; #avagadro number\n",
+ "\n",
+ "#Calculation\n",
+ "n=(d*A)/M;\n",
+ "mew=1/(rho*n*e);\n",
+ "tow=m/(n*(e**2)*rho);\n",
+ "mew=math.ceil(mew*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"mobility of electrons in Copper in m/Vs is\",mew);\n",
+ "print(\"average time of collision of electrons in copper in sec is\",tow);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('mobility of electrons in Copper in m/Vs is', 0.004273)\n('average time of collision of electrons in copper in sec is', 2.4297841992299697e-14)\n"
+ "text": [
+ "('mobility of electrons in Copper in m/Vs is', 0.004273)\n",
+ "('average time of collision of electrons in copper in sec is', 2.4297841992299697e-14)\n"
+ ]
}
],
"prompt_number": 31
@@ -293,19 +615,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.14, Page number 76"
+ "source": [
+ "Example number 2.14, Page number 76"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the order of magnitude of velocity of molecules\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nMH=1.008*2*1.67*10**-27; #mass in kg\nT=30; #temperature in C\n\n#Calculation\nT=T+273; #temperature in K\nKB=1.38*10**-23; #boltzmann constant in J/k\nKE=(3/2)*KB*T; #kinetic energy in J\nKEeV=KE*6.24*10**18; #kinetic energy in eV\ncbar=math.sqrt((3*KB*T)/MH);\n\n#Result\nprint(\"average kinetic energy in J is\",KE);\nprint(\"average kinetic energy in eV is\",KEeV);\nprint(\"velocity of molecules in m/s is\",cbar);\n\n#answers for average kinetic energy in eV and velocity of electrons given in the book are wrong",
+ "input": [
+ " \n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "MH=1.008*2*1.67*10**-27; #mass in kg\n",
+ "T=30; #temperature in C\n",
+ "\n",
+ "#Calculation\n",
+ "T=T+273; #temperature in K\n",
+ "KB=1.38*10**-23; #boltzmann constant in J/k\n",
+ "KE=(3/2)*KB*T; #kinetic energy in J\n",
+ "KEeV=KE*6.24*10**18; #kinetic energy in eV\n",
+ "cbar=math.sqrt((3*KB*T)/MH);\n",
+ "\n",
+ "#Result\n",
+ "print(\"average kinetic energy in J is\",KE);\n",
+ "print(\"average kinetic energy in eV is\",KEeV);\n",
+ "print(\"velocity of molecules in m/s is\",cbar);\n",
+ "\n",
+ "#answers for average kinetic energy in eV and velocity of electrons given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('average kinetic energy in J is', 6.2720999999999986e-21)\n('average kinetic energy in eV is', 0.039137903999999994)\n('velocity of molecules in m/s is', 1930.269663853336)\n"
+ "text": [
+ "('average kinetic energy in J is', 6.2720999999999986e-21)\n",
+ "('average kinetic energy in eV is', 0.039137903999999994)\n",
+ "('velocity of molecules in m/s is', 1930.269663853336)\n"
+ ]
}
],
"prompt_number": 33
@@ -314,19 +664,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.15, Page number 77 ****"
+ "source": [
+ "Example number 2.15, Page number 77 ****"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the velocity of an electron and proton\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nEe=10; #electron kinetic energy in eV\nEp=10; #proton kinetic energy in eV\nme=9.1*10**-31; #mass of electron in kg\nmp=1.67*10**-27; #mass of proton in kg\n\n#Calculation\nEeeV=Ee*1.6*10**-19; #electron kinetic energy in J\nEpeV=Ep*1.6*10**-19; #proton kinetic energy in J\ncebar=math.sqrt((2*EeeV)/me);\ncpbar=math.sqrt((2*EpeV)/mp);\n\n#Result\nprint(\"velocity of electron in m/s is\",cebar);\nprint(\"velocity of proton in m/s is\",cpbar);\n\n#answers given in the book are wrong",
+ "input": [
+ " \n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "Ee=10; #electron kinetic energy in eV\n",
+ "Ep=10; #proton kinetic energy in eV\n",
+ "me=9.1*10**-31; #mass of electron in kg\n",
+ "mp=1.67*10**-27; #mass of proton in kg\n",
+ "\n",
+ "#Calculation\n",
+ "EeeV=Ee*1.6*10**-19; #electron kinetic energy in J\n",
+ "EpeV=Ep*1.6*10**-19; #proton kinetic energy in J\n",
+ "cebar=math.sqrt((2*EeeV)/me);\n",
+ "cpbar=math.sqrt((2*EpeV)/mp);\n",
+ "\n",
+ "#Result\n",
+ "print(\"velocity of electron in m/s is\",cebar);\n",
+ "print(\"velocity of proton in m/s is\",cpbar);\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('velocity of electron in m/s is', 1875228.9237539817)\n('velocity of proton in m/s is', 43774.05241316662)\n"
+ "text": [
+ "('velocity of electron in m/s is', 1875228.9237539817)\n",
+ "('velocity of proton in m/s is', 43774.05241316662)\n"
+ ]
}
],
"prompt_number": 35
@@ -335,19 +712,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.16, Page number 77"
+ "source": [
+ "Example number 2.16, Page number 77"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the drift velocity of free electrons\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nA=10; #area of cross section in mm^2\nA=A*10**-6; #area of cross section in m^2\ni=100; #current in amp\nn=8.5*10**28; #number of electrons per mm^3\ne=1.6*10**-19; #electron charge in coulumb\n\n#Calculation\nvd=1/(n*A*e);\n\n#Result\nprint(\"drift velocity in m/s is\",vd);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "A=10; #area of cross section in mm^2\n",
+ "A=A*10**-6; #area of cross section in m^2\n",
+ "i=100; #current in amp\n",
+ "n=8.5*10**28; #number of electrons per mm^3\n",
+ "e=1.6*10**-19; #electron charge in coulumb\n",
+ "\n",
+ "#Calculation\n",
+ "vd=1/(n*A*e);\n",
+ "\n",
+ "#Result\n",
+ "print(\"drift velocity in m/s is\",vd);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('drift velocity in m/s is', 7.3529411764705884e-06)\n"
+ "text": [
+ "('drift velocity in m/s is', 7.3529411764705884e-06)\n"
+ ]
}
],
"prompt_number": 36
@@ -356,19 +757,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.17, Page number 78"
+ "source": [
+ "Example number 2.17, Page number 78"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the thermal conductivity of copper\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\ntow=3*10**-14; #relaxation time in sec\nn=8*10**28; #density of electrons per m^3\nKB=1.38*10**-23; #boltzmann constant in J/k\nT=0; #temperature in C\n\n#Calculation\nT=T+273; #temperature in K\nm=9.1*10**-31; #mass of electron in kg\nsigma_T=((3*n*tow*(KB**2)*T)/(2*m));\nsigma_T=math.ceil(sigma_T*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"thermal conductivity of copper in ohm-1 is\",sigma_T);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "tow=3*10**-14; #relaxation time in sec\n",
+ "n=8*10**28; #density of electrons per m^3\n",
+ "KB=1.38*10**-23; #boltzmann constant in J/k\n",
+ "T=0; #temperature in C\n",
+ "\n",
+ "#Calculation\n",
+ "T=T+273; #temperature in K\n",
+ "m=9.1*10**-31; #mass of electron in kg\n",
+ "sigma_T=((3*n*tow*(KB**2)*T)/(2*m));\n",
+ "sigma_T=math.ceil(sigma_T*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"thermal conductivity of copper in ohm-1 is\",sigma_T);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('thermal conductivity of copper in ohm-1 is', 205.68)\n"
+ "text": [
+ "('thermal conductivity of copper in ohm-1 is', 205.68)\n"
+ ]
}
],
"prompt_number": 38
@@ -376,7 +801,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/chapter4_2.ipynb b/Engineering_Physics/chapter4_2.ipynb
index b8bc5e59..80203b2d 100644
--- a/Engineering_Physics/chapter4_2.ipynb
+++ b/Engineering_Physics/chapter4_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter4"
+ "name": "",
+ "signature": "sha256:544912fca601384def1f6da3b02bc7431b47e0d8f9efa5f2e7d2a367448daaa6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Magnetic Properties"
+ "source": [
+ "Magnetic Properties"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.1, Page number 119"
+ "source": [
+ "Example number 4.1, Page number 119"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the relative permeability of iron\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nH=6.5*10**-4; #magnetic field in T\nM=1.4; #field with iron\n\n#Calculation\nchi=M/H;\nmew_r=1+chi;\nmew_r=math.ceil(mew_r*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"relative permeability of iron is\",mew_r);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "H=6.5*10**-4; #magnetic field in T\n",
+ "M=1.4; #field with iron\n",
+ "\n",
+ "#Calculation\n",
+ "chi=M/H;\n",
+ "mew_r=1+chi;\n",
+ "mew_r=math.ceil(mew_r*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"relative permeability of iron is\",mew_r);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('relative permeability of iron is', 2154.85)\n"
+ "text": [
+ "('relative permeability of iron is', 2154.85)\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +64,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.2, Page number 119"
+ "source": [
+ "Example number 4.2, Page number 119"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the relative permeability of ferromagnetic material\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nH=220; #field in amp/m\nM=3300; #magnetisation in amp/m\n\n#Calculation\nchi=M/H;\nmew_r=1+chi;\n\n#Result\nprint(\"relative permeability is\",mew_r);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "H=220; #field in amp/m\n",
+ "M=3300; #magnetisation in amp/m\n",
+ "\n",
+ "#Calculation\n",
+ "chi=M/H;\n",
+ "mew_r=1+chi;\n",
+ "\n",
+ "#Result\n",
+ "print(\"relative permeability is\",mew_r);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('relative permeability is', 16.0)\n"
+ "text": [
+ "('relative permeability is', 16.0)\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +105,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.3, Page number 120 *****"
+ "source": [
+ "Example number 4.3, Page number 120 *****"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the change in magnetic moment\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nr=5.29*10**-11; #radius of orbit in m\nB=2; #applied field in Tesla\ne=1.602*10**-19; #charge of electron in coulomb\nm=9.108*10**-31; #mass of electron in kg\n\n#Calculation\nmew=(e**2)*(r**2)*B/(4*m);\n\n#Result\nprint(\"magnetic moment in Am^2 is\",mew);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "r=5.29*10**-11; #radius of orbit in m\n",
+ "B=2; #applied field in Tesla\n",
+ "e=1.602*10**-19; #charge of electron in coulomb\n",
+ "m=9.108*10**-31; #mass of electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "mew=(e**2)*(r**2)*B/(4*m);\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic moment in Am^2 is\",mew);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetic moment in Am^2 is', 3.94260574090909e-29)\n"
+ "text": [
+ "('magnetic moment in Am^2 is', 3.94260574090909e-29)\n"
+ ]
}
],
"prompt_number": 5
@@ -80,19 +147,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.4, Page number 120"
+ "source": [
+ "Example number 4.4, Page number 120"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the intensity of magnetisation and flux density\n\n#import module\nimport math\n\n#Variable decleration\nchi=0.5*10**-5; #susceptibility \nH=10**6; #field strength in amp/m\n\n#Calculation\nmew_0=4*math.pi*10**-7;\nI=chi*H;\nB=mew_0*(I+H);\nB=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"intensity of magnetisation in Amp/m is\",I);\nprint(\"flux density in Weber/m^2 is\",B);\n",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Variable decleration\n",
+ "chi=0.5*10**-5; #susceptibility \n",
+ "H=10**6; #field strength in amp/m\n",
+ "\n",
+ "#Calculation\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "I=chi*H;\n",
+ "B=mew_0*(I+H);\n",
+ "B=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"intensity of magnetisation in Amp/m is\",I);\n",
+ "print(\"flux density in Weber/m^2 is\",B);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('intensity of magnetisation in Amp/m is', 5.0)\n('flux density in Weber/m^2 is', 1.257)\n"
+ "text": [
+ "('intensity of magnetisation in Amp/m is', 5.0)\n",
+ "('flux density in Weber/m^2 is', 1.257)\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +191,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.5, Page number 120"
+ "source": [
+ "Example number 4.5, Page number 120"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the average number of bohr magnetons\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\ne=2.86; #edge in armstrong\ne=e*10**-10; #edge in m\nIs=1.76*10**6; #magnetisation in amp/m\nmewB=9.27*10**-24; #1 bohr magneton in amp m^2\n\n#Calculation\nN=2/(e**3); #density per m^3\nmewbar=Is/N;\nmew_bar=mewbar/mewB;\nmew_bar=math.ceil(mew_bar*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"average dipole moment in mewB is\",mew_bar);",
+ "input": [
+ " \n",
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "e=2.86; #edge in armstrong\n",
+ "e=e*10**-10; #edge in m\n",
+ "Is=1.76*10**6; #magnetisation in amp/m\n",
+ "mewB=9.27*10**-24; #1 bohr magneton in amp m^2\n",
+ "\n",
+ "#Calculation\n",
+ "N=2/(e**3); #density per m^3\n",
+ "mewbar=Is/N;\n",
+ "mew_bar=mewbar/mewB;\n",
+ "mew_bar=math.ceil(mew_bar*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"average dipole moment in mewB is\",mew_bar);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('average dipole moment in mewB is', 2.221)\n"
+ "text": [
+ "('average dipole moment in mewB is', 2.221)\n"
+ ]
}
],
"prompt_number": 10
@@ -122,19 +237,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.6, Page number 121 ***"
+ "source": [
+ "Example number 4.6, Page number 121 ***"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the magnetisation and flux density\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nH=10**6; #magnetic field in amp/m\nchi=1.5*10**-3; #susceptibility\n\n#Calculation\nmew_0=4*math.pi*10**-7;\nM=chi*H;\nB=mew_0*(M+H);\n\n#Result\nprint(\"magnetisation in Amp/m is\",M);\nprint(\"flux density in Tesla is\",B);\n\n#answer for flux density given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "H=10**6; #magnetic field in amp/m\n",
+ "chi=1.5*10**-3; #susceptibility\n",
+ "\n",
+ "#Calculation\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "M=chi*H;\n",
+ "B=mew_0*(M+H);\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetisation in Amp/m is\",M);\n",
+ "print(\"flux density in Tesla is\",B);\n",
+ "\n",
+ "#answer for flux density given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetisation in Amp/m is', 1500.0)\n('flux density in Tesla is', 1.258522017028071)\n"
+ "text": [
+ "('magnetisation in Amp/m is', 1500.0)\n",
+ "('flux density in Tesla is', 1.258522017028071)\n"
+ ]
}
],
"prompt_number": 11
@@ -143,19 +283,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.7, Page number 121"
+ "source": [
+ "Example number 4.7, Page number 121"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the magnetisation and flux density\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nchi=3.7*10**-3; #susceptibility \nH=10**4; #field strength in amp/m\n\n#Calculation\nmew_0=4*math.pi*10**-7;\nM=chi*H;\nB=mew_0*(M+H);\nB=math.ceil(B*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"magnetisation in Amp/m is\",M);\nprint(\"flux density in Weber/m^2 is\",B);\n\n#answer for flux density given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "chi=3.7*10**-3; #susceptibility \n",
+ "H=10**4; #field strength in amp/m\n",
+ "\n",
+ "#Calculation\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "M=chi*H;\n",
+ "B=mew_0*(M+H);\n",
+ "B=math.ceil(B*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetisation in Amp/m is\",M);\n",
+ "print(\"flux density in Weber/m^2 is\",B);\n",
+ "\n",
+ "#answer for flux density given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetisation in Amp/m is', 37.0)\n('flux density in Weber/m^2 is', 0.01262)\n"
+ "text": [
+ "('magnetisation in Amp/m is', 37.0)\n",
+ "('flux density in Weber/m^2 is', 0.01262)\n"
+ ]
}
],
"prompt_number": 13
@@ -164,19 +330,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.8, Page number 121"
+ "source": [
+ "Example number 4.8, Page number 121"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the change in magnetic moment\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nr=0.052*10**-9; #radius of orbit in m\nB=1; #magnetic field in Wb/m^2\ne=1.6*10**-19; #charge of electron in coulomb\nm=9.1*10**-31; #mass of electron in kg\n\n#Calculation\ndmew=(e**2)*(r**2)*B/(4*m);\n\n#Result\nprint(\"magnetic moment in Am^2 is\",dmew);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "r=0.052*10**-9; #radius of orbit in m\n",
+ "B=1; #magnetic field in Wb/m^2\n",
+ "e=1.6*10**-19; #charge of electron in coulomb\n",
+ "m=9.1*10**-31; #mass of electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "dmew=(e**2)*(r**2)*B/(4*m);\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic moment in Am^2 is\",dmew);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetic moment in Am^2 is', 1.901714285714286e-29)\n"
+ "text": [
+ "('magnetic moment in Am^2 is', 1.901714285714286e-29)\n"
+ ]
}
],
"prompt_number": 14
@@ -185,19 +374,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.9, Page number 122"
+ "source": [
+ "Example number 4.9, Page number 122"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the intensity of magnetisation and flux density\n\n#import module\nimport math\n\n#Variable decleration\nchi=-0.5*10**-5; #susceptibility \nH=9.9*10**4; #field strength in amp/m\n\n#Calculation\nmew_0=4*math.pi*10**-7;\nI=chi*H;\nB=mew_0*H*(1+chi);\nI=math.ceil(I*10**4)/10**4; #rounding off to 4 decimals\nB=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"intensity of magnetisation in Amp/m is\",I);\nprint(\"flux density in Weber/m^2 is\",B);\n\n#answer for flux density given in the book is wrong ",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Variable decleration\n",
+ "chi=-0.5*10**-5; #susceptibility \n",
+ "H=9.9*10**4; #field strength in amp/m\n",
+ "\n",
+ "#Calculation\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "I=chi*H;\n",
+ "B=mew_0*H*(1+chi);\n",
+ "I=math.ceil(I*10**4)/10**4; #rounding off to 4 decimals\n",
+ "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"intensity of magnetisation in Amp/m is\",I);\n",
+ "print(\"flux density in Weber/m^2 is\",B);\n",
+ "\n",
+ "#answer for flux density given in the book is wrong "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('intensity of magnetisation in Amp/m is', -0.495)\n('flux density in Weber/m^2 is', 0.1245)\n"
+ "text": [
+ "('intensity of magnetisation in Amp/m is', -0.495)\n",
+ "('flux density in Weber/m^2 is', 0.1245)\n"
+ ]
}
],
"prompt_number": 18
@@ -206,19 +421,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.10, Page number 122"
+ "source": [
+ "Example number 4.10, Page number 122"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the flux density at centre and dipole moment\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nr=6.1*10**-11; #radius of H atom in m\nnew=8.8*10**15; #frequency in rev/sec\ne=1.6*10**-19;\n\n#Calculation\nmew0=4*math.pi*10**-7;\ni=e*new;\nB=(mew0*i)/(2*r);\nmew=i*math.pi*(r**2);\ni=math.ceil(i*10**7)/10**7; #rounding off to 7 decimals\nB=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"current in amp is\",i);\nprint(\"magnetic induction in weber/m^2 is\",B);\nprint(\"dipole moment in amp m^2 is\",mew);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "r=6.1*10**-11; #radius of H atom in m\n",
+ "new=8.8*10**15; #frequency in rev/sec\n",
+ "e=1.6*10**-19;\n",
+ "\n",
+ "#Calculation\n",
+ "mew0=4*math.pi*10**-7;\n",
+ "i=e*new;\n",
+ "B=(mew0*i)/(2*r);\n",
+ "mew=i*math.pi*(r**2);\n",
+ "i=math.ceil(i*10**7)/10**7; #rounding off to 7 decimals\n",
+ "B=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"current in amp is\",i);\n",
+ "print(\"magnetic induction in weber/m^2 is\",B);\n",
+ "print(\"dipole moment in amp m^2 is\",mew);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('current in amp is', 0.0014081)\n('magnetic induction in weber/m^2 is', 14.503)\n('dipole moment in amp m^2 is', 1.645933169972273e-23)\n"
+ "text": [
+ "('current in amp is', 0.0014081)\n",
+ "('magnetic induction in weber/m^2 is', 14.503)\n",
+ "('dipole moment in amp m^2 is', 1.645933169972273e-23)\n"
+ ]
}
],
"prompt_number": 22
@@ -227,19 +471,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.11, Page number 123"
+ "source": [
+ "Example number 4.11, Page number 123"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the average number of Bohr magnetons\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nIs=1.96*10**6; #saturation magnetisation in amp/m\na=3; #cube edge of iron in armstrong\na=a*10**-10; #cube edge of iron in m\nmew_b=9.27*10**-24; #bohr magneton in amp/m^2\nn=2; #number of atoms per unit cell\n\n#Calculation\nN=n/(a**3);\nmewbar=Is/N;\nmew_ab=mewbar/mew_b;\nmew_ab=math.ceil(mew_ab*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"average number of Bohr magnetons in bohr magneton per atom is\",mew_ab);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "Is=1.96*10**6; #saturation magnetisation in amp/m\n",
+ "a=3; #cube edge of iron in armstrong\n",
+ "a=a*10**-10; #cube edge of iron in m\n",
+ "mew_b=9.27*10**-24; #bohr magneton in amp/m^2\n",
+ "n=2; #number of atoms per unit cell\n",
+ "\n",
+ "#Calculation\n",
+ "N=n/(a**3);\n",
+ "mewbar=Is/N;\n",
+ "mew_ab=mewbar/mew_b;\n",
+ "mew_ab=math.ceil(mew_ab*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"average number of Bohr magnetons in bohr magneton per atom is\",mew_ab);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('average number of Bohr magnetons in bohr magneton per atom is', 2.8544)\n"
+ "text": [
+ "('average number of Bohr magnetons in bohr magneton per atom is', 2.8544)\n"
+ ]
}
],
"prompt_number": 24
@@ -248,19 +517,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.12, Page number 123"
+ "source": [
+ "Example number 4.12, Page number 123"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the magnetic force and relative permeability\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nI=3000; #magnetisation in amp/m\nB=0.005; #flux density in weber/m^2\n\n#Calculation\nmew0=4*math.pi*10**-7;\nH=(B/mew0)-I;\nmew_r=(I/H)+1;\nH=math.ceil(H*10**3)/10**3; #rounding off to 3 decimals\nmew_r=math.ceil(mew_r*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"magnetic force in amp/m is\",H);\nprint(\"relative permeability is\",mew_r);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "I=3000; #magnetisation in amp/m\n",
+ "B=0.005; #flux density in weber/m^2\n",
+ "\n",
+ "#Calculation\n",
+ "mew0=4*math.pi*10**-7;\n",
+ "H=(B/mew0)-I;\n",
+ "mew_r=(I/H)+1;\n",
+ "H=math.ceil(H*10**3)/10**3; #rounding off to 3 decimals\n",
+ "mew_r=math.ceil(mew_r*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic force in amp/m is\",H);\n",
+ "print(\"relative permeability is\",mew_r);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetic force in amp/m is', 978.874)\n('relative permeability is', 4.065)\n"
+ "text": [
+ "('magnetic force in amp/m is', 978.874)\n",
+ "('relative permeability is', 4.065)\n"
+ ]
}
],
"prompt_number": 28
@@ -269,19 +565,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.13, Page number 124"
+ "source": [
+ "Example number 4.13, Page number 124"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the permeability\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nH=1800; #magnetising field in amp/m\nphi=3*10**-5; #magnetic flux in weber\nA=0.2; #cross sectional area in cm^2\n\n#Calculation\nA=A*10**-4; #cross sectional area in m^2\nB=phi/A;\nmew=B/H;\nmew=math.ceil(mew*10**8)/10**8 #rounding off to 8 decimals\n\n#Result\nprint(\"the permeability in Henry/m is\",mew);\n\n#answer given in the book is wron",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "H=1800; #magnetising field in amp/m\n",
+ "phi=3*10**-5; #magnetic flux in weber\n",
+ "A=0.2; #cross sectional area in cm^2\n",
+ "\n",
+ "#Calculation\n",
+ "A=A*10**-4; #cross sectional area in m^2\n",
+ "B=phi/A;\n",
+ "mew=B/H;\n",
+ "mew=math.ceil(mew*10**8)/10**8 #rounding off to 8 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the permeability in Henry/m is\",mew);\n",
+ "\n",
+ "#answer given in the book is wron"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the permeability in Henry/m is', 0.00083334)\n"
+ "text": [
+ "('the permeability in Henry/m is', 0.00083334)\n"
+ ]
}
],
"prompt_number": 31
@@ -290,19 +611,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.14, Page number 124 ********************"
+ "source": [
+ "Example number 4.14, Page number 124 ********************"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the magnetic dipole moment and torque\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nr=0.04; #radius of circular loop in m\ni=1000; #current in mA\ni=i*10**-3; #current in amp\nB=10**-3; #magnetic flux density in Wb/m^2\ntheta=45; #angle in degrees\n\n#Calculation\nA=math.pi*(r**2);\nmew=i*A;\ntow=i*B*math.cos(theta);\nmew=math.ceil(mew*10**6)/10**6 #rounding off to 6 decimals\n\n#Result\nprint(\"the magnetic dipole moment in amp m^2 is\",mew);\nprint(\"the torque in Nm is\",tow);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "r=0.04; #radius of circular loop in m\n",
+ "i=1000; #current in mA\n",
+ "i=i*10**-3; #current in amp\n",
+ "B=10**-3; #magnetic flux density in Wb/m^2\n",
+ "theta=45; #angle in degrees\n",
+ "\n",
+ "#Calculation\n",
+ "A=math.pi*(r**2);\n",
+ "mew=i*A;\n",
+ "tow=i*B*math.cos(theta);\n",
+ "mew=math.ceil(mew*10**6)/10**6 #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the magnetic dipole moment in amp m^2 is\",mew);\n",
+ "print(\"the torque in Nm is\",tow);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the magnetic dipole moment in amp m^2 is', 0.005027)\n('the torque in Nm is', 0.0005253219888177298)\n"
+ "text": [
+ "('the magnetic dipole moment in amp m^2 is', 0.005027)\n",
+ "('the torque in Nm is', 0.0005253219888177298)\n"
+ ]
}
],
"prompt_number": 36
@@ -311,19 +659,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.15, Page number 125"
+ "source": [
+ "Example number 4.15, Page number 125"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the hysterisis loss per cycle\n\n#import module\nimport math\n\n#Variable decleration\nA=100; #area of hysteris loop in m^2\nB=0.01; #flux density in wb/m^2\nH=40; #magnetic field in amp/m\nM=7650; #atomic weight in kg/m^3\n\n#Calculation\nhl=A*B*H;\n\n#Result\nprint(\"the hysterisis loss per cycle in J/m^3 is\",hl);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "\n",
+ "#Variable decleration\n",
+ "A=100; #area of hysteris loop in m^2\n",
+ "B=0.01; #flux density in wb/m^2\n",
+ "H=40; #magnetic field in amp/m\n",
+ "M=7650; #atomic weight in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "hl=A*B*H;\n",
+ "\n",
+ "#Result\n",
+ "print(\"the hysterisis loss per cycle in J/m^3 is\",hl);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the hysterisis loss per cycle in J/m^3 is', 40.0)\n"
+ "text": [
+ "('the hysterisis loss per cycle in J/m^3 is', 40.0)\n"
+ ]
}
],
"prompt_number": 38
@@ -332,19 +700,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.17, Page number 125"
+ "source": [
+ "Example number 4.17, Page number 125"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the hysterisis power loss and power loss\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nhl=200; #hysterisis loss per cycle in J/m^3\nM=7650; #atomic weight in kg/m^3\nm=100; #magnetisation cycles per second\n\n#Calculation\nhpl=hl*m;\npl=hpl/M;\npl=math.ceil(pl*10**4)/10**4 #rounding off to 4 decimals\n\n#Result\nprint(\"hysterisis power loss per second in watt/m^3 is\",hpl);\nprint(\"the power loss in watt/kg is\",pl); \n",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "hl=200; #hysterisis loss per cycle in J/m^3\n",
+ "M=7650; #atomic weight in kg/m^3\n",
+ "m=100; #magnetisation cycles per second\n",
+ "\n",
+ "#Calculation\n",
+ "hpl=hl*m;\n",
+ "pl=hpl/M;\n",
+ "pl=math.ceil(pl*10**4)/10**4 #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"hysterisis power loss per second in watt/m^3 is\",hpl);\n",
+ "print(\"the power loss in watt/kg is\",pl); \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('hysterisis power loss per second in watt/m^3 is', 20000)\n('the power loss in watt/kg is', 2.6144)\n"
+ "text": [
+ "('hysterisis power loss per second in watt/m^3 is', 20000)\n",
+ "('the power loss in watt/kg is', 2.6144)\n"
+ ]
}
],
"prompt_number": 40
@@ -352,7 +744,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/chapter5_2.ipynb b/Engineering_Physics/chapter5_2.ipynb
index 66e0fe37..14018aea 100644
--- a/Engineering_Physics/chapter5_2.ipynb
+++ b/Engineering_Physics/chapter5_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter5"
+ "name": "",
+ "signature": "sha256:19dabe1afe46093105a84b4746899bd5b483ca26e3b557510765740ff72179af"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,47 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Superconductivity"
+ "source": [
+ "Superconductivity"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.1, Page number 148"
+ "source": [
+ "Example number 5.1, Page number 148"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical feild at 2K\n\n#importing modules\nimport math\n\n#Variable declaration\nTc=3.7; #in kelvin\nHc_0=0.0306; \nT=2\n\n#Calculation\nHc_2k=Hc_0*(1-((T/Tc)**2));\nHc_2k=math.ceil(Hc_2k*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"the critical feild at 2K in tesla is\",Hc_2k);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc=3.7; #in kelvin\n",
+ "Hc_0=0.0306; \n",
+ "T=2\n",
+ "\n",
+ "#Calculation\n",
+ "Hc_2k=Hc_0*(1-((T/Tc)**2));\n",
+ "Hc_2k=math.ceil(Hc_2k*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical feild at 2K in tesla is\",Hc_2k);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical feild at 2K in tesla is', 0.02166)\n"
+ "text": [
+ "('the critical feild at 2K in tesla is', 0.02166)\n"
+ ]
}
],
"prompt_number": 4
@@ -38,19 +61,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.2, Page number 149\n"
+ "source": [
+ "Example number 5.2, Page number 149\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical current\n\n#importing modules\nimport math\n\n#Variable declaration\nT=4.2; #in kelvin\nTc=7.18; #in kelvin\nHc_0=6.5*10**4; #in amp per meter\nD=10**-3\n\n#Calculation\nR=D/2; #radius is equal to half of diameter\nHc_T=Hc_0*(1-((T/Tc)**2));\nHc_T=math.ceil(Hc_T*10)/10; #rounding off to 1 decimals\nIc=2*math.pi*R*Hc_T #critical current is calculated by 2*pi*r*Hc(T)\nIc=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"the critical feild in Tesla is\",round(Hc_T));\nprint(\"the critical current in Amp is\",Ic);\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T=4.2; #in kelvin\n",
+ "Tc=7.18; #in kelvin\n",
+ "Hc_0=6.5*10**4; #in amp per meter\n",
+ "D=10**-3\n",
+ "\n",
+ "#Calculation\n",
+ "R=D/2; #radius is equal to half of diameter\n",
+ "Hc_T=Hc_0*(1-((T/Tc)**2));\n",
+ "Hc_T=math.ceil(Hc_T*10)/10; #rounding off to 1 decimals\n",
+ "Ic=2*math.pi*R*Hc_T #critical current is calculated by 2*pi*r*Hc(T)\n",
+ "Ic=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical feild in Tesla is\",round(Hc_T));\n",
+ "print(\"the critical current in Amp is\",Ic);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical feild in Tesla is', 42759.0)\n('the critical current in Amp is', 134.34)\n"
+ "text": [
+ "('the critical feild in Tesla is', 42759.0)\n",
+ "('the critical current in Amp is', 134.34)\n"
+ ]
}
],
"prompt_number": 19
@@ -59,19 +108,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.3, Page number 149\n"
+ "source": [
+ "Example number 5.3, Page number 149\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the pentration depth at 0k\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda_T=75 #in nm\nT=3.5 \nHgTc=4.12 #in K\n\n#Calculation\nlamda_o=lamda_T*math.sqrt(1-((T/HgTc)**4));\nlamda_o=math.ceil(lamda_o*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"the pentration depth at 0k is\",lamda_o);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda_T=75 #in nm\n",
+ "T=3.5 \n",
+ "HgTc=4.12 #in K\n",
+ "\n",
+ "#Calculation\n",
+ "lamda_o=lamda_T*math.sqrt(1-((T/HgTc)**4));\n",
+ "lamda_o=math.ceil(lamda_o*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the pentration depth at 0k is\",lamda_o);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the pentration depth at 0k is', 51.92)\n"
+ "text": [
+ "('the pentration depth at 0k is', 51.92)\n"
+ ]
}
],
"prompt_number": 29
@@ -80,19 +149,58 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.4, Page number 150"
+ "source": [
+ "Example number 5.4, Page number 150"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical magnitude\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda_T1=396 #pentration depth in armstrong\nlamda_T2=1730 #pentration depth in armstrong\nT1=3 #temperature in K\nT2=7.1 #temperature in K\n\n#Calculation\n#lamda_T2**2=lamda_0**2*(((Tc**4-T2**4)/Tc**4)**-1)\n#lamda_T1**2=lamda_0**2*(((Tc**4-T1**4)/Tc**4)**-1)\n#dividing lamda_T2**2 by lamda_T1**2 = (Tc**4-T1**4)/(Tc**4-T2**4)\n#let A=lamda_T2**2 and B=lamda_T1**2\nA=lamda_T2**2\nB=lamda_T1**2\nC=A/B\nC=math.ceil(C*10**4)/10**4; #rounding off to 4 decimals\nX=T1**4\nY=T2**4\nY=math.ceil(Y*10**2)/10**2; #rounding off to 2 decimals\n#C*((TC**4)-Y)=(Tc**4)-X\n#C*(Tc**4)-(Tc**4)=C*Y-X\n#(Tc**4)*(C-1)=(C*Y)-X\n#let Tc**4 be D\n#D*(C-1)=(C*Y)-X\nD=((C*Y)-X)/(C-1)\nD=math.ceil(D*10)/10; #rounding off to 1 decimals\nTc=D**(1/4)\nTc=math.ceil(Tc*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"the pentration depth at 0k is\",Tc);",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda_T1=396 #pentration depth in armstrong\n",
+ "lamda_T2=1730 #pentration depth in armstrong\n",
+ "T1=3 #temperature in K\n",
+ "T2=7.1 #temperature in K\n",
+ "\n",
+ "#Calculation\n",
+ "#lamda_T2**2=lamda_0**2*(((Tc**4-T2**4)/Tc**4)**-1)\n",
+ "#lamda_T1**2=lamda_0**2*(((Tc**4-T1**4)/Tc**4)**-1)\n",
+ "#dividing lamda_T2**2 by lamda_T1**2 = (Tc**4-T1**4)/(Tc**4-T2**4)\n",
+ "#let A=lamda_T2**2 and B=lamda_T1**2\n",
+ "A=lamda_T2**2\n",
+ "B=lamda_T1**2\n",
+ "C=A/B\n",
+ "C=math.ceil(C*10**4)/10**4; #rounding off to 4 decimals\n",
+ "X=T1**4\n",
+ "Y=T2**4\n",
+ "Y=math.ceil(Y*10**2)/10**2; #rounding off to 2 decimals\n",
+ "#C*((TC**4)-Y)=(Tc**4)-X\n",
+ "#C*(Tc**4)-(Tc**4)=C*Y-X\n",
+ "#(Tc**4)*(C-1)=(C*Y)-X\n",
+ "#let Tc**4 be D\n",
+ "#D*(C-1)=(C*Y)-X\n",
+ "D=((C*Y)-X)/(C-1)\n",
+ "D=math.ceil(D*10)/10; #rounding off to 1 decimals\n",
+ "Tc=D**(1/4)\n",
+ "Tc=math.ceil(Tc*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the pentration depth at 0k is\",Tc);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the pentration depth at 0k is', 7.1932)\n"
+ "text": [
+ "('the pentration depth at 0k is', 7.1932)\n"
+ ]
}
],
"prompt_number": 44
@@ -101,19 +209,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.5, Page number 150"
+ "source": [
+ "Example number 5.5, Page number 150"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical feild at 5K\n\n#importing modules\nimport math\n\n#Variable declaration\nTc=7.2 #in K\nHo=6.5*10**3 #in amp per m\nT=5 #in K\n\n#Calculation\nHc=Ho*(1-((T/Tc)**2))\nHc=math.ceil(Hc*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"the critical magnetic feild at 5K in amp per m is\",Hc)\n\n# answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc=7.2 #in K\n",
+ "Ho=6.5*10**3 #in amp per m\n",
+ "T=5 #in K\n",
+ "\n",
+ "#Calculation\n",
+ "Hc=Ho*(1-((T/Tc)**2))\n",
+ "Hc=math.ceil(Hc*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical magnetic feild at 5K in amp per m is\",Hc)\n",
+ "\n",
+ "# answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical magnetic feild at 5K in amp per m is', 3365.36)\n"
+ "text": [
+ "('the critical magnetic feild at 5K in amp per m is', 3365.36)\n"
+ ]
}
],
"prompt_number": 33
@@ -122,19 +252,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.6, Page number 151"
+ "source": [
+ "Example number 5.6, Page number 151"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical feild at 2.5K\n\n#importing modules\nimport math\n\n#Variable declaration\nTc=3.5 #in K\nHo=3.2*10**3 #in amp per m\nT=2.5 #in K\n\n#Calculation\nHc=Ho*(1-((T/Tc)**2))\nHc=math.ceil(Hc*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"the critical magnetic feild at 5K in amp per m is\",Hc)\n\n#answer in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc=3.5 #in K\n",
+ "Ho=3.2*10**3 #in amp per m\n",
+ "T=2.5 #in K\n",
+ "\n",
+ "#Calculation\n",
+ "Hc=Ho*(1-((T/Tc)**2))\n",
+ "Hc=math.ceil(Hc*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical magnetic feild at 5K in amp per m is\",Hc)\n",
+ "\n",
+ "#answer in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical magnetic feild at 5K in amp per m is', 1567.35)\n"
+ "text": [
+ "('the critical magnetic feild at 5K in amp per m is', 1567.35)\n"
+ ]
}
],
"prompt_number": 45
@@ -143,19 +295,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.7, Page number 151"
+ "source": [
+ "Example number 5.7, Page number 151"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the transition temperature\n\n#importing modules\nimport math\n\n#Variable declaration\nHc=5*10**3 #in amp per m\nHo=2*10**4 #in amp per m\nT=6 #in K\n\n#Calculation\nTc=T/math.sqrt(1-(Hc/Ho))\nTc=math.ceil(Tc*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"the critical magnetic feild at 5K in amp per m is\",Tc)\n\n#answer in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Hc=5*10**3 #in amp per m\n",
+ "Ho=2*10**4 #in amp per m\n",
+ "T=6 #in K\n",
+ "\n",
+ "#Calculation\n",
+ "Tc=T/math.sqrt(1-(Hc/Ho))\n",
+ "Tc=math.ceil(Tc*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical magnetic feild at 5K in amp per m is\",Tc)\n",
+ "\n",
+ "#answer in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical magnetic feild at 5K in amp per m is', 6.93)\n"
+ "text": [
+ "('the critical magnetic feild at 5K in amp per m is', 6.93)\n"
+ ]
}
],
"prompt_number": 66
@@ -164,19 +338,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.8, Page number 152"
+ "source": [
+ "Example number 5.8, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical current\n\n#importing modules\nimport math\n\n#Variable declaration\nHc=2*10**3 #in amp per m\nR=0.02 #in m\n\n#Calculation\nIc=2*math.pi*R*Hc\nIc=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"the critical current is\",Ic)\n\n#answer in the book is wrong",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Hc=2*10**3 #in amp per m\n",
+ "R=0.02 #in m\n",
+ "\n",
+ "#Calculation\n",
+ "Ic=2*math.pi*R*Hc\n",
+ "Ic=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical current is\",Ic)\n",
+ "\n",
+ "#answer in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical magnetic feild at 5K in amp per m is', 251.33)\n"
+ "text": [
+ "('the critical magnetic feild at 5K in amp per m is', 251.33)\n"
+ ]
}
],
"prompt_number": 2
@@ -185,19 +380,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.9, Page number 152"
+ "source": [
+ "Example number 5.9, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the isotopic mass of M2\n\n#importing modules\nimport math\n\n#Variable declaration\nM1=199.5 #in a.m.u\nT1=5 #in K\nT2=5.1 #in K\n\n#Calculation\nM2=((T1/T2)**2)*M1\nM2=math.ceil(M2*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"the isotopic mass of M2 is\",M2)",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "M1=199.5 #in a.m.u\n",
+ "T1=5 #in K\n",
+ "T2=5.1 #in K\n",
+ "\n",
+ "#Calculation\n",
+ "M2=((T1/T2)**2)*M1\n",
+ "M2=math.ceil(M2*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the isotopic mass of M2 is\",M2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the isotopic mass of M2 is', 191.754)\n"
+ "text": [
+ "('the isotopic mass of M2 is', 191.754)\n"
+ ]
}
],
"prompt_number": 4
@@ -206,19 +421,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.10, Page number 152"
+ "source": [
+ "Example number 5.10, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical magnetic feild and critical current\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nD=3*10**-3 #in meters\nTc=8 #in K \nT=5 #in K \nHo=5*10**4\n\n#Calculation\nR=D/2\nHc=Ho*(1-((T/Tc)**2))\nIc=2*math.pi*R*Hc\nIc=math.ceil(Ic*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"critical magnetic feild in amp per m is\",round(Hc));\nprint(\"critical current in amp is\",Ic);\n\n#answer in the book is wrong",
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "D=3*10**-3 #in meters\n",
+ "Tc=8 #in K \n",
+ "T=5 #in K \n",
+ "Ho=5*10**4\n",
+ "\n",
+ "#Calculation\n",
+ "R=D/2\n",
+ "Hc=Ho*(1-((T/Tc)**2))\n",
+ "Ic=2*math.pi*R*Hc\n",
+ "Ic=math.ceil(Ic*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"critical magnetic feild in amp per m is\",round(Hc));\n",
+ "print(\"critical current in amp is\",Ic);\n",
+ "\n",
+ "#answer in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('critical magnetic feild in amp per m is', 30469.0)\n('critical current in amp is', 287.162)\n"
+ "text": [
+ "('critical magnetic feild in amp per m is', 30469.0)\n",
+ "('critical current in amp is', 287.162)\n"
+ ]
}
],
"prompt_number": 22
@@ -227,19 +468,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.11, Page number 153"
+ "source": [
+ "Example number 5.11, Page number 153"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical temperature\n\n#importing modules\nimport math\n\n#Variable declaration\nM1=199.5 \nM2=203.4 \nTc1=4.185 #in K\n\n#Calculation\nTc2=Tc1*math.sqrt(M1/M2)\nTc2=math.ceil(Tc2*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"the critical temperature is\",Tc2)",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "M1=199.5 \n",
+ "M2=203.4 \n",
+ "Tc1=4.185 #in K\n",
+ "\n",
+ "#Calculation\n",
+ "Tc2=Tc1*math.sqrt(M1/M2)\n",
+ "Tc2=math.ceil(Tc2*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical temperature is\",Tc2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical temperature is', 4.145)\n"
+ "text": [
+ "('the critical temperature is', 4.145)\n"
+ ]
}
],
"prompt_number": 3
@@ -248,19 +509,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.12, Page number 154"
+ "source": [
+ "Example number 5.12, Page number 154"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the EM wave frequency\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nV=8.5*10**-6 #in volts\ne=1.6*10**-19 #in C\nh=6.626*10**-24\n\n#Calculation\nnew=2*e*V/h\nnew=math.ceil(new*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"EM wave generated frequency in Hz is\",new)\n\n",
+ "input": [
+ " \n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "V=8.5*10**-6 #in volts\n",
+ "e=1.6*10**-19 #in C\n",
+ "h=6.626*10**-24\n",
+ "\n",
+ "#Calculation\n",
+ "new=2*e*V/h\n",
+ "new=math.ceil(new*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"EM wave generated frequency in Hz is\",new)\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('EM wave generated frequency in Hz is', 0.41051)\n"
+ "text": [
+ "('EM wave generated frequency in Hz is', 0.41051)\n"
+ ]
}
],
"prompt_number": 24
@@ -269,19 +552,35 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.13, Page number 154"
+ "source": [
+ "Example number 5.13, Page number 154"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#to calculate the critical temperature at 6mm presure of Hg\n\n#Variable declaration\np1=1 #in mm\np2=6 #in mm\nTc1=5 #in K\n\n#Calculation\nTc2=Tc1*(p2/p1);\n\n#Result\nprint(\"the critical temperature in K is\",round(Tc2))",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "p1=1 #in mm\n",
+ "p2=6 #in mm\n",
+ "Tc1=5 #in K\n",
+ "\n",
+ "#Calculation\n",
+ "Tc2=Tc1*(p2/p1);\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical temperature in K is\",round(Tc2))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical temperature in K is', 30.0)\n"
+ "text": [
+ "('the critical temperature in K is', 30.0)\n"
+ ]
}
],
"prompt_number": 14
@@ -290,19 +589,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.14, Page number 154\n"
+ "source": [
+ "Example number 5.14, Page number 154\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#to calculate maximum critical temperature\n\n#Variable declaration\nTc=8.7 #in K\nHc=6*10**5 #in A per m\nHo=3*10**6 #in A per m\n\n#Calculation\nT=Tc*(math.sqrt(1-(Hc/Ho)))\n\n#Result\nprint(\" maximum critical temperature in K is\",T)\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#Variable declaration\n",
+ "Tc=8.7 #in K\n",
+ "Hc=6*10**5 #in A per m\n",
+ "Ho=3*10**6 #in A per m\n",
+ "\n",
+ "#Calculation\n",
+ "T=Tc*(math.sqrt(1-(Hc/Ho)))\n",
+ "\n",
+ "#Result\n",
+ "print(\" maximum critical temperature in K is\",T)\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "(' maximum critical temperature in K is', 7.781516561699267)\n"
+ "text": [
+ "(' maximum critical temperature in K is', 7.781516561699267)\n"
+ ]
}
],
"prompt_number": 15
@@ -310,7 +627,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/chapter7_2.ipynb b/Engineering_Physics/chapter7_2.ipynb
index 617f6cbd..d4161b18 100644
--- a/Engineering_Physics/chapter7_2.ipynb
+++ b/Engineering_Physics/chapter7_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter7"
+ "name": "",
+ "signature": "sha256:b26f0e8151a54ecdc596868a34547e181ac6dce2c5aea4a02c15b80e1401fd4f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,59 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Semiconductors"
+ "source": [
+ "Semiconductors"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.1, Page number 251"
+ "source": [
+ "Example number 7.1, Page number 251"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the number of electron hole pairs\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nT1=300; #temp in K\nT2=310; #temp in K\nni1=2.5*10**19; #per cubic metre\nEgeV1=0.72; #value of Eg in eV\nEgeV2=1.12; #value of Eg in eV\n\n#Calculation\nEg1=EgeV1*1.6*10**-19; #Eg in J\nEg2=EgeV2*1.6*10**-19; #Eg in J\nKB=1.38*10**-23; #boltzmann constant in J/k\n#density of electron hole pair is ni = A*(T**(3/2))*exp(-Eg/(2*KB*T))\n#let (T**(3/2))*exp(-Eg/(2*KB*T)) be X\nX1=(T1**(3/2))*math.exp(-Eg1/(2*KB*T1));\nX2=(T2**(3/2))*math.exp(-Eg2/(2*KB*T2));\n#therefore ni1=A*X1 and ni2=A*X2. dividing ni2/ni1 we get X2/X1\nni2=ni1*(X2/X1);\n\n#Result\nprint(\"the number of electron hole pairs per cubic metre is\",ni2);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "T1=300; #temp in K\n",
+ "T2=310; #temp in K\n",
+ "ni1=2.5*10**19; #per cubic metre\n",
+ "EgeV1=0.72; #value of Eg in eV\n",
+ "EgeV2=1.12; #value of Eg in eV\n",
+ "\n",
+ "#Calculation\n",
+ "Eg1=EgeV1*1.6*10**-19; #Eg in J\n",
+ "Eg2=EgeV2*1.6*10**-19; #Eg in J\n",
+ "KB=1.38*10**-23; #boltzmann constant in J/k\n",
+ "#density of electron hole pair is ni = A*(T**(3/2))*exp(-Eg/(2*KB*T))\n",
+ "#let (T**(3/2))*exp(-Eg/(2*KB*T)) be X\n",
+ "X1=(T1**(3/2))*math.exp(-Eg1/(2*KB*T1));\n",
+ "X2=(T2**(3/2))*math.exp(-Eg2/(2*KB*T2));\n",
+ "#therefore ni1=A*X1 and ni2=A*X2. dividing ni2/ni1 we get X2/X1\n",
+ "ni2=ni1*(X2/X1);\n",
+ "\n",
+ "#Result\n",
+ "print(\"the number of electron hole pairs per cubic metre is\",ni2);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the number of electron hole pairs per cubic metre is', 2.3207901206362184e+16)\n"
+ "text": [
+ "('the number of electron hole pairs per cubic metre is', 2.3207901206362184e+16)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +73,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.2, Page number 251"
+ "source": [
+ "Example number 7.2, Page number 251"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the charge carrier density and electron mobility\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nRH=3.66*10**-4; #hall coefficient in m^3/coulomb\nsigma=112; #conductivity in ohm-1 m-1\ne=1.6*10**-19;\n\n#Calculation\nne=1/(RH*e);\n#sigma = e*ne*(mew_e+mew_h)\n#assuming mew_h = 0\nmew_e=sigma/(e*ne);\n\n#Result\nprint(\"the charge carrier density per m^3 is\",ne);\nprint(\"electron mobility in m^2/Vs is\",mew_e);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "RH=3.66*10**-4; #hall coefficient in m^3/coulomb\n",
+ "sigma=112; #conductivity in ohm-1 m-1\n",
+ "e=1.6*10**-19;\n",
+ "\n",
+ "#Calculation\n",
+ "ne=1/(RH*e);\n",
+ "#sigma = e*ne*(mew_e+mew_h)\n",
+ "#assuming mew_h = 0\n",
+ "mew_e=sigma/(e*ne);\n",
+ "\n",
+ "#Result\n",
+ "print(\"the charge carrier density per m^3 is\",ne);\n",
+ "print(\"electron mobility in m^2/Vs is\",mew_e);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the charge carrier density per m^3 is', 1.7076502732240434e+22)\n('electron mobility in m^2/Vs is', 0.040992)\n"
+ "text": [
+ "('the charge carrier density per m^3 is', 1.7076502732240434e+22)\n",
+ "('electron mobility in m^2/Vs is', 0.040992)\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +121,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.3, Page number 252"
+ "source": [
+ "Example number 7.3, Page number 252"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the conductivity of intrinsic silicon and resultant conductivity\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nni=1.5*10**16; #intrinsic concentration per m^3\ne=1.6*10**-19;\nmew_e=0.13; #mobility of electrons in m^2/Vs\nmew_h=0.05; #mobility of holes in m^2/Vs\nND=5*10**20; #conductivity in atoms/m^3\n\n#Calculation\nsigma1=ni*e*(mew_e+mew_h);\nnd=(ni**2)/ND;\nsigma2=ND*e*mew_e;\nNA=5*10**20;\nna=(ni**2)/NA;\nsigma3=NA*e*mew_h;\nsigma1=math.ceil(sigma1*10**7)/10**7; #rounding off to 7 decimals\nsigma2=math.ceil(sigma2*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"intrinsic conductivity of Si in ohm-1 m-1 is\",sigma1);\nprint(\"conductivity of Si during donor impurity in ohm-1 m-1 is\",sigma2);\nprint(\"conductivity of Si during acceptor impurity in ohm-1 m-1 is\",round(sigma3));",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "ni=1.5*10**16; #intrinsic concentration per m^3\n",
+ "e=1.6*10**-19;\n",
+ "mew_e=0.13; #mobility of electrons in m^2/Vs\n",
+ "mew_h=0.05; #mobility of holes in m^2/Vs\n",
+ "ND=5*10**20; #conductivity in atoms/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "sigma1=ni*e*(mew_e+mew_h);\n",
+ "nd=(ni**2)/ND;\n",
+ "sigma2=ND*e*mew_e;\n",
+ "NA=5*10**20;\n",
+ "na=(ni**2)/NA;\n",
+ "sigma3=NA*e*mew_h;\n",
+ "sigma1=math.ceil(sigma1*10**7)/10**7; #rounding off to 7 decimals\n",
+ "sigma2=math.ceil(sigma2*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"intrinsic conductivity of Si in ohm-1 m-1 is\",sigma1);\n",
+ "print(\"conductivity of Si during donor impurity in ohm-1 m-1 is\",sigma2);\n",
+ "print(\"conductivity of Si during acceptor impurity in ohm-1 m-1 is\",round(sigma3));"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('intrinsic conductivity of Si in ohm-1 m-1 is', 0.000432)\n('conductivity of Si during donor impurity in ohm-1 m-1 is', 10.41)\n('conductivity of Si during acceptor impurity in ohm-1 m-1 is', 4.0)\n"
+ "text": [
+ "('intrinsic conductivity of Si in ohm-1 m-1 is', 0.000432)\n",
+ "('conductivity of Si during donor impurity in ohm-1 m-1 is', 10.41)\n",
+ "('conductivity of Si during acceptor impurity in ohm-1 m-1 is', 4.0)\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +175,54 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.4, Page number 253"
+ "source": [
+ "Example number 7.4, Page number 253"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the conductivity\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nsigma1=2; #conductivity in ohm-1 m-1\nEgeV=0.72; #band gap in eV\nKB=1.38*10**-23; #boltzmann constant\nT1=20; #temp in C\nT2=40; #temp in C\n\n#Calculation\nEg=EgeV*1.6*10**-19; #in J\nT1=T1+273; #temp in K\nT2=T2+273; #temp in K\n#sigma2/sigma1 = exp((-Eg/(2*KB))*((1/T2)-(1/T1)))\n#by taking log on both sides we get 2.303*log10(sigma2/sigma1) = (Eg/(2*KB))*((1/T1)-(1/T2))\n#let (Eg/(2*KB))*((1/T1)-(1/T2)) be X\nX=(Eg/(2*KB))*((1/T1)-(1/T2));\n#let log10(sigma2/sigma1) be Y\nY=X/2.303;\n#log10(sigma2/sigma1) = log10(sigma2)-log10(sigma1)\n#let log10(sigma2) be A\nA=Y+math.log10(sigma1);\nsigma2=10**A;\nsigma2=math.ceil(sigma2*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"the conductivity in mho m-1 is\",sigma2);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "sigma1=2; #conductivity in ohm-1 m-1\n",
+ "EgeV=0.72; #band gap in eV\n",
+ "KB=1.38*10**-23; #boltzmann constant\n",
+ "T1=20; #temp in C\n",
+ "T2=40; #temp in C\n",
+ "\n",
+ "#Calculation\n",
+ "Eg=EgeV*1.6*10**-19; #in J\n",
+ "T1=T1+273; #temp in K\n",
+ "T2=T2+273; #temp in K\n",
+ "#sigma2/sigma1 = exp((-Eg/(2*KB))*((1/T2)-(1/T1)))\n",
+ "#by taking log on both sides we get 2.303*log10(sigma2/sigma1) = (Eg/(2*KB))*((1/T1)-(1/T2))\n",
+ "#let (Eg/(2*KB))*((1/T1)-(1/T2)) be X\n",
+ "X=(Eg/(2*KB))*((1/T1)-(1/T2));\n",
+ "#let log10(sigma2/sigma1) be Y\n",
+ "Y=X/2.303;\n",
+ "#log10(sigma2/sigma1) = log10(sigma2)-log10(sigma1)\n",
+ "#let log10(sigma2) be A\n",
+ "A=Y+math.log10(sigma1);\n",
+ "sigma2=10**A;\n",
+ "sigma2=math.ceil(sigma2*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the conductivity in mho m-1 is\",sigma2);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the conductivity in mho m-1 is', 4.97)\n"
+ "text": [
+ "('the conductivity in mho m-1 is', 4.97)\n"
+ ]
}
],
"prompt_number": 11
@@ -101,19 +231,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.5, Page number 253"
+ "source": [
+ "Example number 7.5, Page number 253"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the concentration of holes and electrons \n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nmew_n=1300*10**-4; #in m^2/Vs\nmew_p=500*10**-4; #in m^2/Vs\nsigma=3*10**4; #conductivity in ohm-1 m-1\ne=1.6*10**-19;\n\n#Calculation\nN=sigma/(e*mew_n);\nni=1.5*10**16; #per m^3\np=(ni**2)/N;\nP=sigma/(e*mew_p);\nn=(ni**2)/P;\nN=math.ceil(N*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"concentration of electrons in n-type per cubic metre are\",N);\nprint(\"concentration of holes in n-type per cubic metre are\",round(p));\nprint(\"concentration of electrons in p-type per cubic metre are\",round(n));\nprint(\"concentration of holes in p-type per cubic metre are\",P);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "mew_n=1300*10**-4; #in m^2/Vs\n",
+ "mew_p=500*10**-4; #in m^2/Vs\n",
+ "sigma=3*10**4; #conductivity in ohm-1 m-1\n",
+ "e=1.6*10**-19;\n",
+ "\n",
+ "#Calculation\n",
+ "N=sigma/(e*mew_n);\n",
+ "ni=1.5*10**16; #per m^3\n",
+ "p=(ni**2)/N;\n",
+ "P=sigma/(e*mew_p);\n",
+ "n=(ni**2)/P;\n",
+ "N=math.ceil(N*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of electrons in n-type per cubic metre are\",N);\n",
+ "print(\"concentration of holes in n-type per cubic metre are\",round(p));\n",
+ "print(\"concentration of electrons in p-type per cubic metre are\",round(n));\n",
+ "print(\"concentration of holes in p-type per cubic metre are\",P);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of electrons in n-type per cubic metre are', 1.4423076923076921e+24)\n('concentration of holes in n-type per cubic metre are', 156000000.0)\n('concentration of electrons in p-type per cubic metre are', 60000000.0)\n('concentration of holes in p-type per cubic metre are', 3.7499999999999995e+24)\n"
+ "text": [
+ "('concentration of electrons in n-type per cubic metre are', 1.4423076923076921e+24)\n",
+ "('concentration of holes in n-type per cubic metre are', 156000000.0)\n",
+ "('concentration of electrons in p-type per cubic metre are', 60000000.0)\n",
+ "('concentration of holes in p-type per cubic metre are', 3.7499999999999995e+24)\n"
+ ]
}
],
"prompt_number": 16
@@ -122,19 +284,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.6, Page number 254"
+ "source": [
+ "Example number 7.6, Page number 254"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the resistivity\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nni=2.37*10**19; #intrinsic carrier density per m^3\nmew_e=0.38; #in m**2/Vs\nmew_n=0.18; #in m**2/Vs\n\n#Calculation\ne=1.6*10**-19;\nsigmai=ni*e*(mew_e+mew_n);\nrho=1/sigmai;\nrho=math.ceil(rho*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"resistivity in ohm m is\",rho);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "ni=2.37*10**19; #intrinsic carrier density per m^3\n",
+ "mew_e=0.38; #in m**2/Vs\n",
+ "mew_n=0.18; #in m**2/Vs\n",
+ "\n",
+ "#Calculation\n",
+ "e=1.6*10**-19;\n",
+ "sigmai=ni*e*(mew_e+mew_n);\n",
+ "rho=1/sigmai;\n",
+ "rho=math.ceil(rho*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistivity in ohm m is\",rho);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('resistivity in ohm m is', 0.471)\n"
+ "text": [
+ "('resistivity in ohm m is', 0.471)\n"
+ ]
}
],
"prompt_number": 19
@@ -143,19 +328,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.7, Page number 254"
+ "source": [
+ "Example number 7.7, Page number 254"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the position of fermi level\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nEg=1.12; #band gap in eV\nK=1.38*10**-23;\nT=300; #temp in K\n\n#Calculation\n#EF = (Eg/2)+(3*K*T/4)*log(mh/me)\n#given me=0.12m0 and mh=0.28m0. therefore mh/me = 0.28/0.12 \n#let mh/me be X. therefore X=0.28/0.12 \nX=0.28/0.12;\nEF=(Eg/2)+((3*K*T/4)*math.log(X));\n\n#Result\nprint(\"the position of fermi level in eV is\",EF);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "Eg=1.12; #band gap in eV\n",
+ "K=1.38*10**-23;\n",
+ "T=300; #temp in K\n",
+ "\n",
+ "#Calculation\n",
+ "#EF = (Eg/2)+(3*K*T/4)*log(mh/me)\n",
+ "#given me=0.12m0 and mh=0.28m0. therefore mh/me = 0.28/0.12 \n",
+ "#let mh/me be X. therefore X=0.28/0.12 \n",
+ "X=0.28/0.12;\n",
+ "EF=(Eg/2)+((3*K*T/4)*math.log(X));\n",
+ "\n",
+ "#Result\n",
+ "print(\"the position of fermi level in eV is\",EF);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the position of fermi level in eV is', 0.56)\n"
+ "text": [
+ "('the position of fermi level in eV is', 0.56)\n"
+ ]
}
],
"prompt_number": 21
@@ -164,19 +375,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.8, Page number 254"
+ "source": [
+ "Example number 7.8, Page number 254"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the concentration of intrinsic charge carriers\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nKB=1.38*10**-23;\nT=300; #temp in K\nh=6.626*10**-34;\nm0=9.11*10**-31;\nmh=m0;\nme=m0;\nEgeV=0.7; #energy gap in eV\n\n#Calculation\nEg=EgeV*1.6*10**-19; #in J\nA=((2*math.pi*KB/(h**2))**(3/2))*(me*mh)**(3/4);\nB=T**(3/2);\nC=math.exp(-Eg/(2*KB*T));\nni=2*A*B*C;\n\n#Result\nprint(\"concentration of intrinsic charge carriers per cubic metre is\",ni);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "KB=1.38*10**-23;\n",
+ "T=300; #temp in K\n",
+ "h=6.626*10**-34;\n",
+ "m0=9.11*10**-31;\n",
+ "mh=m0;\n",
+ "me=m0;\n",
+ "EgeV=0.7; #energy gap in eV\n",
+ "\n",
+ "#Calculation\n",
+ "Eg=EgeV*1.6*10**-19; #in J\n",
+ "A=((2*math.pi*KB/(h**2))**(3/2))*(me*mh)**(3/4);\n",
+ "B=T**(3/2);\n",
+ "C=math.exp(-Eg/(2*KB*T));\n",
+ "ni=2*A*B*C;\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of intrinsic charge carriers per cubic metre is\",ni);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of intrinsic charge carriers per cubic metre is', 3.3481803992458756e+19)\n"
+ "text": [
+ "('concentration of intrinsic charge carriers per cubic metre is', 3.3481803992458756e+19)\n"
+ ]
}
],
"prompt_number": 22
@@ -185,19 +424,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.9, Page number 255"
+ "source": [
+ "Example number 7.9, Page number 255"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the resistivity\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nni=2.4*10**19;\nmew_e=0.39;\nmew_h=0.19;\ne=1.6*10**-19;\n\n#Result\nsigmai=ni*e*(mew_e+mew_h);\nrhoi=1/sigmai;\nrhoi=math.ceil(rhoi*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"resistivity in ohm m is\",rhoi);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "ni=2.4*10**19;\n",
+ "mew_e=0.39;\n",
+ "mew_h=0.19;\n",
+ "e=1.6*10**-19;\n",
+ "\n",
+ "#Result\n",
+ "sigmai=ni*e*(mew_e+mew_h);\n",
+ "rhoi=1/sigmai;\n",
+ "rhoi=math.ceil(rhoi*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistivity in ohm m is\",rhoi);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('resistivity in ohm m is', 0.45)\n"
+ "text": [
+ "('resistivity in ohm m is', 0.45)\n"
+ ]
}
],
"prompt_number": 24
@@ -206,19 +468,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.10, Page number 255"
+ "source": [
+ "Example number 7.10, Page number 255"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the resistance\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nl=1; #length in cm\nl=l*10**-2; #length in m\ne=1.6*10**-19;\nw=1; #width in mm\nt=1; #thickness in mm\n\n#Calculation\nw=w*10**-3; #width in m\nt=t*10**-3; #thickness in m\nA=w*t;\nni=2.5*10**19;\nmew_e=0.39;\nmew_p=0.19;\nsigma=ni*e*(mew_p+mew_e);\nR=l/(sigma*A);\n\n#Result\nprint(\"resistance of intrinsic Ge rod in ohm is\",R);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "l=1; #length in cm\n",
+ "l=l*10**-2; #length in m\n",
+ "e=1.6*10**-19;\n",
+ "w=1; #width in mm\n",
+ "t=1; #thickness in mm\n",
+ "\n",
+ "#Calculation\n",
+ "w=w*10**-3; #width in m\n",
+ "t=t*10**-3; #thickness in m\n",
+ "A=w*t;\n",
+ "ni=2.5*10**19;\n",
+ "mew_e=0.39;\n",
+ "mew_p=0.19;\n",
+ "sigma=ni*e*(mew_p+mew_e);\n",
+ "R=l/(sigma*A);\n",
+ "\n",
+ "#Result\n",
+ "print(\"resistance of intrinsic Ge rod in ohm is\",R);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('resistance of intrinsic Ge rod in ohm is', 4310.3448275862065)\n"
+ "text": [
+ "('resistance of intrinsic Ge rod in ohm is', 4310.3448275862065)\n"
+ ]
}
],
"prompt_number": 25
@@ -227,19 +518,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.11, Page number 255"
+ "source": [
+ "Example number 7.11, Page number 255"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the conductivity\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nEg=1.1; #energy gap in eV\nm=9.109*10**-31;\nk=1.38*10**-23;\nT=300;\ne=1.6*10**-19;\nh=6.626*10**-34;\nmew_e=0.48; #electron mobility\nmew_h=0.013; #hole mobility\n\n#Calculation\nC=2*(2*math.pi*m*k/(h**2))**(3/2);\nX=2*k*T/e;\nY=-Eg/X;\nA=math.exp(Y);\nni=C*(T**(3/2))*A;\nsigma=ni*e*(mew_e+mew_h);\nsigma=math.ceil(sigma*10**6)/10**6 #rounding off to 6 decimals\n\n#Result\nprint(\"conductivity in ohm-1 m-1 is\",sigma);\n\n# answer given in the book is wrong, Page number 255",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "Eg=1.1; #energy gap in eV\n",
+ "m=9.109*10**-31;\n",
+ "k=1.38*10**-23;\n",
+ "T=300;\n",
+ "e=1.6*10**-19;\n",
+ "h=6.626*10**-34;\n",
+ "mew_e=0.48; #electron mobility\n",
+ "mew_h=0.013; #hole mobility\n",
+ "\n",
+ "#Calculation\n",
+ "C=2*(2*math.pi*m*k/(h**2))**(3/2);\n",
+ "X=2*k*T/e;\n",
+ "Y=-Eg/X;\n",
+ "A=math.exp(Y);\n",
+ "ni=C*(T**(3/2))*A;\n",
+ "sigma=ni*e*(mew_e+mew_h);\n",
+ "sigma=math.ceil(sigma*10**6)/10**6 #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"conductivity in ohm-1 m-1 is\",sigma);\n",
+ "\n",
+ "# answer given in the book is wrong, Page number 255"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('conductivity in ohm-1 m-1 is', 0.001162)\n"
+ "text": [
+ "('conductivity in ohm-1 m-1 is', 0.001162)\n"
+ ]
}
],
"prompt_number": 28
@@ -248,19 +572,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.12, Page number 256"
+ "source": [
+ "Example number 7.12, Page number 256"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the intrinsic carrier density and conductivity\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nm=9.109*10**-31;\nk=1.38*10**-23;\nT=300;\ne=1.6*10**-19;\nh=6.626*10**-34;\nEg=0.7;\nmew_e=0.4; #electron mobility\nmew_h=0.2; #hole mobility\n\n#Calculation\nC=2*(2*math.pi*m*k/((h**2)))**(3/2);\nX=2*k*T/e;\nni=C*(T**(3/2))*math.exp(-Eg/X);\nsigma=ni*e*(mew_e+mew_h);\nsigma=math.ceil(sigma*10**3)/10**3 #rounding off to 3 decimals\n\n#Result\nprint(\"conductivity in ohm-1 m-1\",sigma);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "m=9.109*10**-31;\n",
+ "k=1.38*10**-23;\n",
+ "T=300;\n",
+ "e=1.6*10**-19;\n",
+ "h=6.626*10**-34;\n",
+ "Eg=0.7;\n",
+ "mew_e=0.4; #electron mobility\n",
+ "mew_h=0.2; #hole mobility\n",
+ "\n",
+ "#Calculation\n",
+ "C=2*(2*math.pi*m*k/((h**2)))**(3/2);\n",
+ "X=2*k*T/e;\n",
+ "ni=C*(T**(3/2))*math.exp(-Eg/X);\n",
+ "sigma=ni*e*(mew_e+mew_h);\n",
+ "sigma=math.ceil(sigma*10**3)/10**3 #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"conductivity in ohm-1 m-1\",sigma);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('conductivity in ohm-1 m-1', 3.214)\n"
+ "text": [
+ "('conductivity in ohm-1 m-1', 3.214)\n"
+ ]
}
],
"prompt_number": 30
@@ -269,19 +624,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.13, Page number 256"
+ "source": [
+ "Example number 7.13, Page number 256"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the energy band gap\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nk=8.616*10**-5;\nT1=20; #temp in C\nT1=T1+273; #temp in K\nT2=32; #temp in C\nrho2=4.5; #resistivity in ohm m\nrho1=2; #resistivity in ohm m\n\n#Calculation\nT2=T2+273; #temp in K\ndy=math.log10(rho2)-math.log10(rho1);\ndx=(1/T1)-(1/T2);\nEg=2*k*dy/dx;\nEg=math.ceil(Eg*10**3)/10**3 #rounding off to 3 decimals\n\n#Result\nprint(\"energy band gap in eV is\",Eg);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "k=8.616*10**-5;\n",
+ "T1=20; #temp in C\n",
+ "T1=T1+273; #temp in K\n",
+ "T2=32; #temp in C\n",
+ "rho2=4.5; #resistivity in ohm m\n",
+ "rho1=2; #resistivity in ohm m\n",
+ "\n",
+ "#Calculation\n",
+ "T2=T2+273; #temp in K\n",
+ "dy=math.log10(rho2)-math.log10(rho1);\n",
+ "dx=(1/T1)-(1/T2);\n",
+ "Eg=2*k*dy/dx;\n",
+ "Eg=math.ceil(Eg*10**3)/10**3 #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy band gap in eV is\",Eg);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy band gap in eV is', 0.452)\n"
+ "text": [
+ "('energy band gap in eV is', 0.452)\n"
+ ]
}
],
"prompt_number": 1
@@ -290,19 +672,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.13, Page number 256"
+ "source": [
+ "Example number 7.13, Page number 256"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the energy band gap\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nk=8.616*10**-5;\nT1=20; #temp in C\nT2=32; ##temp in C\nrho2=4.5; #resistivity in ohm m\nrho1=2; #resistivity in ohm m\n\n#Calculation\nT1=T1+273; #temp in K\nT2=T2+273; #temp in K\ndy=math.log10(rho2)-math.log10(rho1);\ndx=(1/T1)-(1/T2);\nEg=2*k*dy/dx;\nEg=math.ceil(Eg*10**3)/10**3 #rounding off to 3 decimals\n\n#Result\nprint(\"energy band gap in eV is\",Eg);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "k=8.616*10**-5;\n",
+ "T1=20; #temp in C\n",
+ "T2=32; ##temp in C\n",
+ "rho2=4.5; #resistivity in ohm m\n",
+ "rho1=2; #resistivity in ohm m\n",
+ "\n",
+ "#Calculation\n",
+ "T1=T1+273; #temp in K\n",
+ "T2=T2+273; #temp in K\n",
+ "dy=math.log10(rho2)-math.log10(rho1);\n",
+ "dx=(1/T1)-(1/T2);\n",
+ "Eg=2*k*dy/dx;\n",
+ "Eg=math.ceil(Eg*10**3)/10**3 #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy band gap in eV is\",Eg);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy band gap in eV is', 0.452)\n"
+ "text": [
+ "('energy band gap in eV is', 0.452)\n"
+ ]
}
],
"prompt_number": 3
@@ -311,19 +720,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.14, Page number 257"
+ "source": [
+ "Example number 7.14, Page number 257"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the temperature\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nEgeV=1; #energy in eV\nk=1.38*10**-23;\nEg=EgeV*1.602*10**-19; #in J\n#EF can be taken as (Ev+0.5)eV\n#therefore (Ev+0.5)eV = (Ec+Ev)/2--------(1)\n#let fermi level shift by 10% then (Ev+0.6)eV = ((Ec+Ev)/2)+((3*k*T/4)*log(4))-----(2)\n#subtracting (1) from (2)\n#0.1 eV = (3*k*T/4)*math.log(4)\nE=0.1; #energy in eV\nE=E*1.602*10**-19; #energy in J\nT=(4*E)/(3*k*math.log(4));\n\n#Result\nprint(\"temperature in K is\",T);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "EgeV=1; #energy in eV\n",
+ "k=1.38*10**-23;\n",
+ "Eg=EgeV*1.602*10**-19; #in J\n",
+ "#EF can be taken as (Ev+0.5)eV\n",
+ "#therefore (Ev+0.5)eV = (Ec+Ev)/2--------(1)\n",
+ "#let fermi level shift by 10% then (Ev+0.6)eV = ((Ec+Ev)/2)+((3*k*T/4)*log(4))-----(2)\n",
+ "#subtracting (1) from (2)\n",
+ "#0.1 eV = (3*k*T/4)*math.log(4)\n",
+ "E=0.1; #energy in eV\n",
+ "E=E*1.602*10**-19; #energy in J\n",
+ "T=(4*E)/(3*k*math.log(4));\n",
+ "\n",
+ "#Result\n",
+ "print(\"temperature in K is\",T);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('temperature in K is', 1116.520509905372)\n"
+ "text": [
+ "('temperature in K is', 1116.520509905372)\n"
+ ]
}
],
"prompt_number": 6
@@ -332,19 +766,62 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.15, Page number 257"
+ "source": [
+ "Example number 7.15, Page number 257"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the conductivity of intrinsic silicon\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nni=1.5*10**16;\ne=1.6*10**-19;\nmew_e=0.13;\nmew_h=0.05;\n\n#Calculation\nsigma=ni*e*(mew_e+mew_h);\nM=28.1; #atomic weight of Si\nd=2.33*10**3; #density in kg/m^3\nv=M/d;\nN=6.02*10**26;\nN1=N/v;\n#1 donor type impurity is added to 1 impurity atom\nND=N1/(10**8);\np=(ni**2)/ND;\nsigma_exd=ND*e*mew_e;\n#1 acceptor type impurity is added to 1 impurity atom\nNa=N1/(10**8);\nn=(ni**2)/Na;\nsigma_exa=Na*e*mew_h;\nsigma=math.ceil(sigma*10**7)/10**7 #rounding off to 7 decimals\nsigma_exd=math.ceil(sigma_exd*10**3)/10**3 #rounding off to 3 decimals\nsigma_exa=math.ceil(sigma_exa*10**3)/10**3 #rounding off to 3 decimals\n\n#Result\nprint(\"conductivity in ohm-1 m-1 is\",sigma);\nprint(\"number of Si atoms per m^3 is\",N1);\nprint(\"conductivity for donor type impurity in ohm-1 m-1 is\",sigma_exd);\nprint(\"conductivity for acceptor type impurity in ohm-1 m-1 is\",sigma_exa);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "ni=1.5*10**16;\n",
+ "e=1.6*10**-19;\n",
+ "mew_e=0.13;\n",
+ "mew_h=0.05;\n",
+ "\n",
+ "#Calculation\n",
+ "sigma=ni*e*(mew_e+mew_h);\n",
+ "M=28.1; #atomic weight of Si\n",
+ "d=2.33*10**3; #density in kg/m^3\n",
+ "v=M/d;\n",
+ "N=6.02*10**26;\n",
+ "N1=N/v;\n",
+ "#1 donor type impurity is added to 1 impurity atom\n",
+ "ND=N1/(10**8);\n",
+ "p=(ni**2)/ND;\n",
+ "sigma_exd=ND*e*mew_e;\n",
+ "#1 acceptor type impurity is added to 1 impurity atom\n",
+ "Na=N1/(10**8);\n",
+ "n=(ni**2)/Na;\n",
+ "sigma_exa=Na*e*mew_h;\n",
+ "sigma=math.ceil(sigma*10**7)/10**7 #rounding off to 7 decimals\n",
+ "sigma_exd=math.ceil(sigma_exd*10**3)/10**3 #rounding off to 3 decimals\n",
+ "sigma_exa=math.ceil(sigma_exa*10**3)/10**3 #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"conductivity in ohm-1 m-1 is\",sigma);\n",
+ "print(\"number of Si atoms per m^3 is\",N1);\n",
+ "print(\"conductivity for donor type impurity in ohm-1 m-1 is\",sigma_exd);\n",
+ "print(\"conductivity for acceptor type impurity in ohm-1 m-1 is\",sigma_exa);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('conductivity in ohm-1 m-1 is', 0.000432)\n('number of Si atoms per m^3 is', 4.991672597864769e+28)\n('conductivity for donor type impurity in ohm-1 m-1 is', 10.383)\n('conductivity for acceptor type impurity in ohm-1 m-1 is', 3.994)\n"
+ "text": [
+ "('conductivity in ohm-1 m-1 is', 0.000432)\n",
+ "('number of Si atoms per m^3 is', 4.991672597864769e+28)\n",
+ "('conductivity for donor type impurity in ohm-1 m-1 is', 10.383)\n",
+ "('conductivity for acceptor type impurity in ohm-1 m-1 is', 3.994)\n"
+ ]
}
],
"prompt_number": 10
@@ -353,19 +830,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.16, Page number 258"
+ "source": [
+ "Example number 7.16, Page number 258"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the diffusion coefficient of electrons\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nT=300; #temperature in K\nKB=1.38*10**-23;\ne=1.6*10**-19;\nmew_e=0.19; #mobility of electrons in m^2/Vs\n\n#Calculation\nDn=mew_e*KB*T/e;\nDn=math.ceil(Dn*10**6)/10**6 #rounding off to 6 decimals\n\n#Result\nprint(\"diffusion coefficient of electrons in m^2/s is\",Dn);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "T=300; #temperature in K\n",
+ "KB=1.38*10**-23;\n",
+ "e=1.6*10**-19;\n",
+ "mew_e=0.19; #mobility of electrons in m^2/Vs\n",
+ "\n",
+ "#Calculation\n",
+ "Dn=mew_e*KB*T/e;\n",
+ "Dn=math.ceil(Dn*10**6)/10**6 #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"diffusion coefficient of electrons in m^2/s is\",Dn);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('diffusion coefficient of electrons in m^2/s is', 0.004917)\n"
+ "text": [
+ "('diffusion coefficient of electrons in m^2/s is', 0.004917)\n"
+ ]
}
],
"prompt_number": 13
@@ -374,19 +873,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.17, Page number 259"
+ "source": [
+ "Example number 7.17, Page number 259"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the Hall voltage\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nRH=3.66*10**-4; #hall coefficient in m^3/coulomb\nI=10**-2; #current in amp\nB=0.5; #magnetic field in wb/m^2\nt=1; #thickness in mm\n\n#Calculation\nt=t*10**-3; #thickness in m\nVH=(RH*I*B)/t;\nVH=VH*10**3; #converting from Volts to mV\n\n#Result\nprint(\"Hall voltage in mV is\",VH);",
+ "input": [
+ " \n",
+ "\n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "RH=3.66*10**-4; #hall coefficient in m^3/coulomb\n",
+ "I=10**-2; #current in amp\n",
+ "B=0.5; #magnetic field in wb/m^2\n",
+ "t=1; #thickness in mm\n",
+ "\n",
+ "#Calculation\n",
+ "t=t*10**-3; #thickness in m\n",
+ "VH=(RH*I*B)/t;\n",
+ "VH=VH*10**3; #converting from Volts to mV\n",
+ "\n",
+ "#Result\n",
+ "print(\"Hall voltage in mV is\",VH);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('Hall voltage in mV is', 1.83)\n"
+ "text": [
+ "('Hall voltage in mV is', 1.83)\n"
+ ]
}
],
"prompt_number": 14
@@ -395,19 +918,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.18, Page number 259"
+ "source": [
+ "Example number 7.18, Page number 259"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the density and mobility of charge carrier\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nRH=-7.35*10**-5; #hall coefficient\ne=1.6*10**-19;\nsigma=200;\n\n#Calculation\nn=(-1/(RH*e));\nmew=sigma/(n*e);\n\n#Result\nprint(\"density of charge carriers in m^3 is\",n);\nprint(\"mobility of charge carriers in m^2/Vs is\",mew);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "RH=-7.35*10**-5; #hall coefficient\n",
+ "e=1.6*10**-19;\n",
+ "sigma=200;\n",
+ "\n",
+ "#Calculation\n",
+ "n=(-1/(RH*e));\n",
+ "mew=sigma/(n*e);\n",
+ "\n",
+ "#Result\n",
+ "print(\"density of charge carriers in m^3 is\",n);\n",
+ "print(\"mobility of charge carriers in m^2/Vs is\",mew);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('density of charge carriers in m^3 is', 8.503401360544217e+22)\n('mobility of charge carriers in m^2/Vs is', 0.0147)\n"
+ "text": [
+ "('density of charge carriers in m^3 is', 8.503401360544217e+22)\n",
+ "('mobility of charge carriers in m^2/Vs is', 0.0147)\n"
+ ]
}
],
"prompt_number": 15
@@ -416,19 +962,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.19, Page number 259"
+ "source": [
+ "Example number 7.19, Page number 259"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the magnitude of Hall voltage\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nI=50; #current in amp\nB=1.5; #magnetic field in T\nn=8.4*10**28; #free electron concentration in electron/m^3\nt=0.5; #thickness in cm\ne=1.6*10**-19;\n\n#Calculation\nt=t*10**-2; #thickness in m\nVH=(I*B)/(n*e*t);\nVH=VH*10**6; #converting VH from V to micro V\nVH=math.ceil(VH*10**4)/10**4 #rounding off to 4 decimals\n\n#Result\nprint(\"magnitude of Hall voltage in microVolt is\",VH);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "I=50; #current in amp\n",
+ "B=1.5; #magnetic field in T\n",
+ "n=8.4*10**28; #free electron concentration in electron/m^3\n",
+ "t=0.5; #thickness in cm\n",
+ "e=1.6*10**-19;\n",
+ "\n",
+ "#Calculation\n",
+ "t=t*10**-2; #thickness in m\n",
+ "VH=(I*B)/(n*e*t);\n",
+ "VH=VH*10**6; #converting VH from V to micro V\n",
+ "VH=math.ceil(VH*10**4)/10**4 #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnitude of Hall voltage in microVolt is\",VH);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnitude of Hall voltage in microVolt is', 1.1161)\n"
+ "text": [
+ "('magnitude of Hall voltage in microVolt is', 1.1161)\n"
+ ]
}
],
"prompt_number": 17
@@ -437,19 +1008,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.20, Page number 260"
+ "source": [
+ "Example number 7.20, Page number 260"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate mew and n\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nRH=3.66*10**-4;\ne=1.6*10**-19;\nrho_n=8.93*10**-3;\n\n#Calculation\nn=1/(RH*e);\nmew_e=RH/rho_n;\nmew_e=math.ceil(mew_e*10**5)/10**5 #rounding off to 5 decimals\n\n#Result\nprint(\"n per m^3 is\",n);\nprint(\"mew_e in m^2/V is\",mew_e);",
+ "input": [
+ " \n",
+ "\n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "RH=3.66*10**-4;\n",
+ "e=1.6*10**-19;\n",
+ "rho_n=8.93*10**-3;\n",
+ "\n",
+ "#Calculation\n",
+ "n=1/(RH*e);\n",
+ "mew_e=RH/rho_n;\n",
+ "mew_e=math.ceil(mew_e*10**5)/10**5 #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"n per m^3 is\",n);\n",
+ "print(\"mew_e in m^2/V is\",mew_e);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('n per m^3 is', 1.7076502732240434e+22)\n('mew_e in m^2/V is', 0.04099)\n"
+ "text": [
+ "('n per m^3 is', 1.7076502732240434e+22)\n",
+ "('mew_e in m^2/V is', 0.04099)\n"
+ ]
}
],
"prompt_number": 19
@@ -458,19 +1054,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.21, Page number 260"
+ "source": [
+ "Example number 7.21, Page number 260"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the conductivity and equilibrium hole concentration\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nmew_e=0.13; #electron mobility in m^2/Vs\nmew_h=0.048; #hole mobility in m^2/Vs\nni=1.5*10**16;\ne=1.6*10**-19;\nT=300; #temp in K\nND=10**23; #density per m^3\n\n#Calculation\nsigmai=ni*e*(mew_e+mew_h);\nsigma=ND*mew_e*e;\np=(ni**2)/ND;\nsigmai=math.ceil(sigmai*10**5)/10**5 #rounding off to 5 decimals\n\n#Result\nprint(\"conductivity of intrinsic Si in s is\",sigmai);\nprint(\"conductivity in s is\",sigma);\nprint(\"equilibrium hole concentration per m^3 is\",round(p));\n\n#answers for sigmai and sigma given in the book are wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "mew_e=0.13; #electron mobility in m^2/Vs\n",
+ "mew_h=0.048; #hole mobility in m^2/Vs\n",
+ "ni=1.5*10**16;\n",
+ "e=1.6*10**-19;\n",
+ "T=300; #temp in K\n",
+ "ND=10**23; #density per m^3\n",
+ "\n",
+ "#Calculation\n",
+ "sigmai=ni*e*(mew_e+mew_h);\n",
+ "sigma=ND*mew_e*e;\n",
+ "p=(ni**2)/ND;\n",
+ "sigmai=math.ceil(sigmai*10**5)/10**5 #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"conductivity of intrinsic Si in s is\",sigmai);\n",
+ "print(\"conductivity in s is\",sigma);\n",
+ "print(\"equilibrium hole concentration per m^3 is\",round(p));\n",
+ "\n",
+ "#answers for sigmai and sigma given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('conductivity of intrinsic Si in s is', 0.00043)\n('conductivity in s is', 2080.0)\n('equilibrium hole concentration per m^3 is', 2250000000.0)\n"
+ "text": [
+ "('conductivity of intrinsic Si in s is', 0.00043)\n",
+ "('conductivity in s is', 2080.0)\n",
+ "('equilibrium hole concentration per m^3 is', 2250000000.0)\n"
+ ]
}
],
"prompt_number": 22
@@ -479,19 +1107,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.22, Page number 261"
+ "source": [
+ "Example number 7.22, Page number 261"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the forbidden energy gap\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nT=300; #temp in K\nkB=1.38*10**-23;\nmew_e=0.36; #mobility of electrons in m^2/Vs\ne=1.6*10**-19;\nmew_h=0.7; #mobility of electrons in m^2/Vs\nsigma=2.12; #conductivity in ohm-1 m-1\nC=4.83*10**21; #proportional constant\n\n#Calculation\nni=sigma/(e*(mew_e+mew_h));\n#exp(-Eg/(2*kB*T)) = (C*(T^(3/2)))/ni\n#let X be (C*(T^(3/2)))/ni\nX=(C*(T**(3/2)))/ni;\n#exp(-Eg/(2*kB*T)) = X \n#applyinf log on both sides\n#Eg/(2*kB*T) = log(X)\nEg=2*kB*T*math.log(X);\n\n#Result\nprint(\"forbidden energy gap in eV is\",Eg);\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "T=300; #temp in K\n",
+ "kB=1.38*10**-23;\n",
+ "mew_e=0.36; #mobility of electrons in m^2/Vs\n",
+ "e=1.6*10**-19;\n",
+ "mew_h=0.7; #mobility of electrons in m^2/Vs\n",
+ "sigma=2.12; #conductivity in ohm-1 m-1\n",
+ "C=4.83*10**21; #proportional constant\n",
+ "\n",
+ "#Calculation\n",
+ "ni=sigma/(e*(mew_e+mew_h));\n",
+ "#exp(-Eg/(2*kB*T)) = (C*(T^(3/2)))/ni\n",
+ "#let X be (C*(T^(3/2)))/ni\n",
+ "X=(C*(T**(3/2)))/ni;\n",
+ "#exp(-Eg/(2*kB*T)) = X \n",
+ "#applyinf log on both sides\n",
+ "#Eg/(2*kB*T) = log(X)\n",
+ "Eg=2*kB*T*math.log(X);\n",
+ "\n",
+ "#Result\n",
+ "print(\"forbidden energy gap in eV is\",Eg);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('forbidden energy gap in eV is', 1.2016388762259164e-19)\n"
+ "text": [
+ "('forbidden energy gap in eV is', 1.2016388762259164e-19)\n"
+ ]
}
],
"prompt_number": 23
@@ -500,19 +1161,59 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.23, Page number 261"
+ "source": [
+ "Example number 7.23, Page number 261"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the probability of occupation\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nEg=0.4; #energy gap in eV\nEg=Eg*1.6*10**-19; #Eg in J\nKB=1.38*10**-23;\nT1=0; #temp 1 in C\nT2=50; #temp 2 in C\nT3=100; #temp 3 in C\n\n#Calculation\nT1k=T1+273; #temp 1 in K\nT2k=T2+273; #temp 2 in K\nT3k=T3+273; #temp 3 in K\n#F(E) = 1/(1+(exp((E-Ep)/(KB*T))))\n#but E-Ep = (1/2)*Eg\n#therefore F(E) = 1/(1+(exp(Eg/(2*KB*T))))\nFE1=1/(1+(math.exp(Eg/(2*KB*T1k))));\nFE2=1/(1+(math.exp(Eg/(2*KB*T2k))));\nFE3=1/(1+(math.exp(Eg/(2*KB*T3k))));\nFE1=math.ceil(FE1*10**6)/10**6 #rounding off to 6 decimals\nFE2=math.ceil(FE2*10**6)/10**6 #rounding off to 6 decimals\nFE3=math.ceil(FE3*10**6)/10**6 #rounding off to 6 decimals\n\n#Result\nprint(\"probability of occupation at 0 C in eV is\",FE1);\nprint(\"probability of occupation at 50 C in eV is\",FE2);\nprint(\"probability of occupation at 100 C in eV is\",FE3);\n\n#answers given in the book are wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "Eg=0.4; #energy gap in eV\n",
+ "Eg=Eg*1.6*10**-19; #Eg in J\n",
+ "KB=1.38*10**-23;\n",
+ "T1=0; #temp 1 in C\n",
+ "T2=50; #temp 2 in C\n",
+ "T3=100; #temp 3 in C\n",
+ "\n",
+ "#Calculation\n",
+ "T1k=T1+273; #temp 1 in K\n",
+ "T2k=T2+273; #temp 2 in K\n",
+ "T3k=T3+273; #temp 3 in K\n",
+ "#F(E) = 1/(1+(exp((E-Ep)/(KB*T))))\n",
+ "#but E-Ep = (1/2)*Eg\n",
+ "#therefore F(E) = 1/(1+(exp(Eg/(2*KB*T))))\n",
+ "FE1=1/(1+(math.exp(Eg/(2*KB*T1k))));\n",
+ "FE2=1/(1+(math.exp(Eg/(2*KB*T2k))));\n",
+ "FE3=1/(1+(math.exp(Eg/(2*KB*T3k))));\n",
+ "FE1=math.ceil(FE1*10**6)/10**6 #rounding off to 6 decimals\n",
+ "FE2=math.ceil(FE2*10**6)/10**6 #rounding off to 6 decimals\n",
+ "FE3=math.ceil(FE3*10**6)/10**6 #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"probability of occupation at 0 C in eV is\",FE1);\n",
+ "print(\"probability of occupation at 50 C in eV is\",FE2);\n",
+ "print(\"probability of occupation at 100 C in eV is\",FE3);\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('probability of occupation at 0 C in eV is', 0.000205)\n('probability of occupation at 50 C in eV is', 0.000762)\n('probability of occupation at 100 C in eV is', 0.001992)\n"
+ "text": [
+ "('probability of occupation at 0 C in eV is', 0.000205)\n",
+ "('probability of occupation at 50 C in eV is', 0.000762)\n",
+ "('probability of occupation at 100 C in eV is', 0.001992)\n"
+ ]
}
],
"prompt_number": 26
@@ -521,19 +1222,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.24, Page number 262"
+ "source": [
+ "Example number 7.24, Page number 262"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the ratio between conductivity\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nEg=1.2; #energy in eV\nEg=Eg*1.6*10**-19; #in J\nKB=1.38*10**-23;\nT1=600; #temp in K\nT2=300; #temp in K\n\n#Calculation\n#sigma is proportional to exp(-Eg/(2*KB*T))\n#let sigma1/sigma2 be R\nR=math.exp((Eg/(2*KB))*((1/T2)-(1/T1)));\n\n#Result\nprint(\"the ratio between conductivity is\",round(R));\n\n#answer given in the book is wrong",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "Eg=1.2; #energy in eV\n",
+ "Eg=Eg*1.6*10**-19; #in J\n",
+ "KB=1.38*10**-23;\n",
+ "T1=600; #temp in K\n",
+ "T2=300; #temp in K\n",
+ "\n",
+ "#Calculation\n",
+ "#sigma is proportional to exp(-Eg/(2*KB*T))\n",
+ "#let sigma1/sigma2 be R\n",
+ "R=math.exp((Eg/(2*KB))*((1/T2)-(1/T1)));\n",
+ "\n",
+ "#Result\n",
+ "print(\"the ratio between conductivity is\",round(R));\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the ratio between conductivity is', 108467.0)\n"
+ "text": [
+ "('the ratio between conductivity is', 108467.0)\n"
+ ]
}
],
"prompt_number": 28
@@ -542,19 +1269,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.25, Page number 263"
+ "source": [
+ "Example number 7.25, Page number 263"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the resistivity of doped Ge\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nni=2.5*10**19; #density of charge carriers in m^3\nr=1/(10**6); #ratio\ne=1.6*10**-19;\nmew_e=0.36; #mobility of electrons in m^2/Vs\nmew_h=0.18; #mobility of holes in m^2/Vs\nN=4.2*10**28; #number of Si atoms per m^3\n\n#Calculation\nNe=r*N;\nNh=(ni**2)/Ne;\nsigma=(Ne*e*mew_e)+(Nh*e*mew_h);\nrho=1/sigma;\nrho=math.ceil(rho*10**8)/10**8 #rounding off to 8 decimals\n\n#Result\nprint(\"number of impurity atoms per m^3 is\",Ne);\nprint(\"the resistivity of doped Ge in ohm m is\",rho);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "ni=2.5*10**19; #density of charge carriers in m^3\n",
+ "r=1/(10**6); #ratio\n",
+ "e=1.6*10**-19;\n",
+ "mew_e=0.36; #mobility of electrons in m^2/Vs\n",
+ "mew_h=0.18; #mobility of holes in m^2/Vs\n",
+ "N=4.2*10**28; #number of Si atoms per m^3\n",
+ "\n",
+ "#Calculation\n",
+ "Ne=r*N;\n",
+ "Nh=(ni**2)/Ne;\n",
+ "sigma=(Ne*e*mew_e)+(Nh*e*mew_h);\n",
+ "rho=1/sigma;\n",
+ "rho=math.ceil(rho*10**8)/10**8 #rounding off to 8 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"number of impurity atoms per m^3 is\",Ne);\n",
+ "print(\"the resistivity of doped Ge in ohm m is\",rho);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('number of impurity atoms per m^3 is', 4.2e+22)\n('the resistivity of doped Ge in ohm m is', 0.00041336)\n"
+ "text": [
+ "('number of impurity atoms per m^3 is', 4.2e+22)\n",
+ "('the resistivity of doped Ge in ohm m is', 0.00041336)\n"
+ ]
}
],
"prompt_number": 30
@@ -563,19 +1319,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.26, Page number 264"
+ "source": [
+ "Example number 7.26, Page number 264"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the conductivity of material\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nn=5*10**17; #concentration in m^3\nvd=350; #drift velocity in m/s\nE=1000; #electric field in V/m\ne=1.6*10**-19;\n\n#Calculation\nmew=vd/E;\nsigma=n*e*mew;\nsigma=math.ceil(sigma*10**4)/10**4 #rounding off to 4 decimals\n\n#Result\nprint(\"the conductivity of material in ohm m is\",sigma);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "n=5*10**17; #concentration in m^3\n",
+ "vd=350; #drift velocity in m/s\n",
+ "E=1000; #electric field in V/m\n",
+ "e=1.6*10**-19;\n",
+ "\n",
+ "#Calculation\n",
+ "mew=vd/E;\n",
+ "sigma=n*e*mew;\n",
+ "sigma=math.ceil(sigma*10**4)/10**4 #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the conductivity of material in ohm m is\",sigma);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the conductivity of material in ohm m is', 0.028)\n"
+ "text": [
+ "('the conductivity of material in ohm m is', 0.028)\n"
+ ]
}
],
"prompt_number": 32
@@ -584,19 +1363,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.27, Page number 264"
+ "source": [
+ "Example number 7.27, Page number 264"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the concentration\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nsigma_e=2.2*10**-4; #conductivity\nmew_e=125*10**-3; #mobility of electrons in m^2/Vs\ne=1.602*10**-19;\n\n#Calculation\nne=sigma_e/(e*mew_e);\n\n#Result\nprint(\"concentration in m^3 is\",ne);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "sigma_e=2.2*10**-4; #conductivity\n",
+ "mew_e=125*10**-3; #mobility of electrons in m^2/Vs\n",
+ "e=1.602*10**-19;\n",
+ "\n",
+ "#Calculation\n",
+ "ne=sigma_e/(e*mew_e);\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration in m^3 is\",ne);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration in m^3 is', 1.0986267166042448e+16)\n"
+ "text": [
+ "('concentration in m^3 is', 1.0986267166042448e+16)\n"
+ ]
}
],
"prompt_number": 33
@@ -605,19 +1404,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.28, Page number 265"
+ "source": [
+ "Example number 7.28, Page number 265"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the mobility and density of charge carrier\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nRH=3.66*10**-4; #hall coefficient in m^3/c\nrho_i=8.93*10**-3; #resistivity in ohm m\ne=1.6*10**-19;\n\n#Calculation\nnh=1/(RH*e);\nmew_h=1/(rho_i*nh*e);\nmew_h=math.ceil(mew_h*10**4)/10**4 #rounding off to 4 decimals\n\n#Result\nprint(\"density of charge carriers in m^3 is\",nh);\nprint(\"mobility of charge carriers is %f m^2/Vs\",mew_h);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "RH=3.66*10**-4; #hall coefficient in m^3/c\n",
+ "rho_i=8.93*10**-3; #resistivity in ohm m\n",
+ "e=1.6*10**-19;\n",
+ "\n",
+ "#Calculation\n",
+ "nh=1/(RH*e);\n",
+ "mew_h=1/(rho_i*nh*e);\n",
+ "mew_h=math.ceil(mew_h*10**4)/10**4 #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"density of charge carriers in m^3 is\",nh);\n",
+ "print(\"mobility of charge carriers is %f m^2/Vs\",mew_h);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('density of charge carriers in m^3 is', 1.7076502732240434e+22)\n('mobility of charge carriers is %f m^2/Vs', 0.041)\n"
+ "text": [
+ "('density of charge carriers in m^3 is', 1.7076502732240434e+22)\n",
+ "('mobility of charge carriers is %f m^2/Vs', 0.041)\n"
+ ]
}
],
"prompt_number": 35
@@ -626,19 +1449,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.29, Page number 265"
+ "source": [
+ "Example number 7.29, Page number 265"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the Hall voltage and charge carrier concentration\n\n#import module\nimport math\nfrom __future__ import division\n\n#Variable decleration\nI=3; #current in mA\nI=I*10**-3; #current in amp\ne=1.6*10**-19;\nRH=3.66*10**-4; #hall coefficient in m^3/C\nB=1; #flux density in w/m^2\nd=2; #dimension along Y in cm\nz=1; #dimension along z in mm\n\n#Calculation\nd=d*10**-2; #dimension along Y in m\nz=z*10**-3; #dimension along z in m\nA=d*z; #area in m^2\nEH=RH*I*B/A;\nVH=EH*d;\nVH=VH*10**3; #converting from V to mV\nn=1/(RH*e);\nVH=math.ceil(VH*10**2)/10**2 #rounding off to 2 decimals\n\n#Result\nprint(\"Hall voltage in mV is\",VH);\nprint(\"charge carrier concentration in m^3 is\",n);",
+ "input": [
+ " \n",
+ "#import module\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "I=3; #current in mA\n",
+ "I=I*10**-3; #current in amp\n",
+ "e=1.6*10**-19;\n",
+ "RH=3.66*10**-4; #hall coefficient in m^3/C\n",
+ "B=1; #flux density in w/m^2\n",
+ "d=2; #dimension along Y in cm\n",
+ "z=1; #dimension along z in mm\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**-2; #dimension along Y in m\n",
+ "z=z*10**-3; #dimension along z in m\n",
+ "A=d*z; #area in m^2\n",
+ "EH=RH*I*B/A;\n",
+ "VH=EH*d;\n",
+ "VH=VH*10**3; #converting from V to mV\n",
+ "n=1/(RH*e);\n",
+ "VH=math.ceil(VH*10**2)/10**2 #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"Hall voltage in mV is\",VH);\n",
+ "print(\"charge carrier concentration in m^3 is\",n);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('Hall voltage in mV is', 1.1)\n('charge carrier concentration in m^3 is', 1.7076502732240434e+22)\n"
+ "text": [
+ "('Hall voltage in mV is', 1.1)\n",
+ "('charge carrier concentration in m^3 is', 1.7076502732240434e+22)\n"
+ ]
}
],
"prompt_number": 37
@@ -646,7 +1502,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics/chapter8_2.ipynb b/Engineering_Physics/chapter8_2.ipynb
index c344140a..2dc13b1f 100644
--- a/Engineering_Physics/chapter8_2.ipynb
+++ b/Engineering_Physics/chapter8_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter8"
+ "name": "",
+ "signature": "sha256:064d55405a5d05f007b28f32cf39a9f99d10f303fc4084e2d14d99aaeb87858c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,49 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Physics of Nano Materials"
+ "source": [
+ "Physics of Nano Materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.1, Page number 320"
+ "source": [
+ "Example number 8.1, Page number 320"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the surface area to volume ratio\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable decleration\nr=5; #radius in m\npi=3.14;\n\n#Calculation \nSA=4*pi*r**2; #surface area of sphere in m^2\nV=(4/3)*pi*r**3; #volume of sphere in m^3\nR=SA/V; #ratio\n#surface area to volume ratio can also be given by 3/radius\n\n#Result\nprint(\"surface area to volume ratio of sphere in m-1 is\",R);",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "r=5; #radius in m\n",
+ "pi=3.14;\n",
+ "\n",
+ "#Calculation \n",
+ "SA=4*pi*r**2; #surface area of sphere in m^2\n",
+ "V=(4/3)*pi*r**3; #volume of sphere in m^3\n",
+ "R=SA/V; #ratio\n",
+ "#surface area to volume ratio can also be given by 3/radius\n",
+ "\n",
+ "#Result\n",
+ "print(\"surface area to volume ratio of sphere in m-1 is\",R);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('surface area to volume ratio of sphere in m-1 is', 0.6)\n"
+ "text": [
+ "('surface area to volume ratio of sphere in m-1 is', 0.6)\n"
+ ]
}
],
"prompt_number": 5
@@ -38,19 +63,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.2, Page number 321"
+ "source": [
+ "Example number 8.2, Page number 321"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the surface area to volume ratio\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable decleration\nd=26; #distance in m\nr=d/2; #radius in m\npi=3.14;\n\n#Calculation\nSA=4*pi*r**2; #surface area of sphere in m^2\nV=(4/3)*pi*r**3; #volume of sphere in m^3\nR=SA/V; #ratio\nR=math.ceil(R*10**3)/10**3; #rounding off to 3 decimals\n#surface area to volume ratio can also be given by 3/radius\n\n#Result\nprint(\"surface area to volume ratio of sphere in m-1 is\",R);",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "d=26; #distance in m\n",
+ "r=d/2; #radius in m\n",
+ "pi=3.14;\n",
+ "\n",
+ "#Calculation\n",
+ "SA=4*pi*r**2; #surface area of sphere in m^2\n",
+ "V=(4/3)*pi*r**3; #volume of sphere in m^3\n",
+ "R=SA/V; #ratio\n",
+ "R=math.ceil(R*10**3)/10**3; #rounding off to 3 decimals\n",
+ "#surface area to volume ratio can also be given by 3/radius\n",
+ "\n",
+ "#Result\n",
+ "print(\"surface area to volume ratio of sphere in m-1 is\",R);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('surface area to volume ratio of sphere in m-1 is', 0.231)\n"
+ "text": [
+ "('surface area to volume ratio of sphere in m-1 is', 0.231)\n"
+ ]
}
],
"prompt_number": 7
@@ -59,19 +108,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.3, Page number 321"
+ "source": [
+ "Example number 8.3, Page number 321"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the volume of cone\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable decleration\nr=1; #radius in m\nh=1; #height in m\npi=3.14\n\n#Calculation\nV=(1/3)*pi*(r**2)*h;\nV=math.ceil(V*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"volume of cone in m^3 is\",V); ",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "r=1; #radius in m\n",
+ "h=1; #height in m\n",
+ "pi=3.14\n",
+ "\n",
+ "#Calculation\n",
+ "V=(1/3)*pi*(r**2)*h;\n",
+ "V=math.ceil(V*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"volume of cone in m^3 is\",V); "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('volume of cone in m^3 is', 1.05)\n"
+ "text": [
+ "('volume of cone in m^3 is', 1.05)\n"
+ ]
}
],
"prompt_number": 11
@@ -80,19 +150,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.4, Page number 321"
+ "source": [
+ "Example number 8.4, Page number 321"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the total surface area of cone\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable decleration\nr=3; # radius in m\nh=4; # height in m\npi=3.14\n\n#Calculation\nSA=pi*r*math.sqrt((r**2)+(h**2));\nTSA=SA+(pi*r**2);\n\n#Result\nprint(\"total surface area of cone in m^2 is\",TSA);\n",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "r=3; # radius in m\n",
+ "h=4; # height in m\n",
+ "pi=3.14\n",
+ "\n",
+ "#Calculation\n",
+ "SA=pi*r*math.sqrt((r**2)+(h**2));\n",
+ "TSA=SA+(pi*r**2);\n",
+ "\n",
+ "#Result\n",
+ "print(\"total surface area of cone in m^2 is\",TSA);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('total surface area of cone in m^2 is', 75.36)\n"
+ "text": [
+ "('total surface area of cone in m^2 is', 75.36)\n"
+ ]
}
],
"prompt_number": 16
@@ -101,19 +192,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.5, Page number 322"
+ "source": [
+ "Example number 8.5, Page number 322"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# To calculate the height of cone\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable decleration\nV=100; #volume of cone in cubic inches\nr=5; #radius of cone in inches\npi=3.14;\n\n#Calculation\nr_m=r*0.0254; #radius of cone in m\n#volume V=(1/3)*pi*(r**2)*h\n#therefore h = (3*V)/(pi*r**2)\nh=(3*V)/(pi*r**2); #height in inches\nR=3/r_m;\nh=math.ceil(h*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"height of the cone in inches is\",h);\nprint(\"surface area to volume ratio in m-1 is\",R);\n\n#answer for the surface area to volume ratio given in the book is wrong",
+ "input": [
+ " \n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable decleration\n",
+ "V=100; #volume of cone in cubic inches\n",
+ "r=5; #radius of cone in inches\n",
+ "pi=3.14;\n",
+ "\n",
+ "#Calculation\n",
+ "r_m=r*0.0254; #radius of cone in m\n",
+ "#volume V=(1/3)*pi*(r**2)*h\n",
+ "#therefore h = (3*V)/(pi*r**2)\n",
+ "h=(3*V)/(pi*r**2); #height in inches\n",
+ "R=3/r_m;\n",
+ "h=math.ceil(h*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"height of the cone in inches is\",h);\n",
+ "print(\"surface area to volume ratio in m-1 is\",R);\n",
+ "\n",
+ "#answer for the surface area to volume ratio given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('height of the cone in inches is', 3.822)\n('surface area to volume ratio in m-1 is', 23.62204724409449)\n"
+ "text": [
+ "('height of the cone in inches is', 3.822)\n",
+ "('surface area to volume ratio in m-1 is', 23.62204724409449)\n"
+ ]
}
],
"prompt_number": 18
@@ -121,7 +241,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter10_1.ipynb b/Engineering_Physics_Aruldhas/Chapter10_1.ipynb
index b31ad5ec..a64ad6b4 100644
--- a/Engineering_Physics_Aruldhas/Chapter10_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter10_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter10"
+ "name": "",
+ "signature": "sha256:78b8d610d2cc37c12bbe36fc70ba217f440b3e2b1b7e7cbb3aa498d471c77bb0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,53 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "10: Statistical Mechanics"
+ "source": [
+ "10: Statistical Mechanics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.1, Page number 222"
+ "source": [
+ "Example number 10.1, Page number 222"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ratio of occupancy of the excited to the ground state\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nk = 1.38*10**-23; #Boltzmann constant(J/K)\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\ng1 = 2; #The degeneracy of ground state\ng2 = 8; #The degeneracy of excited state\ndelta_E = 10.2; #Energy of excited state above the ground state(eV)\nT = 6000; #Temperature of the state(K)\n\n#Calculation\nD_ratio = g2/g1; #Ratio of degeneracy of states\nx = k*T/e;\nN_ratio = D_ratio*math.exp(-delta_E/x); #Ratio of occupancy of the excited to the ground state\n\n#Result\nprint \"The ratio of occupancy of the excited to the ground state is\",N_ratio",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "g1 = 2; #The degeneracy of ground state\n",
+ "g2 = 8; #The degeneracy of excited state\n",
+ "delta_E = 10.2; #Energy of excited state above the ground state(eV)\n",
+ "T = 6000; #Temperature of the state(K)\n",
+ "\n",
+ "#Calculation\n",
+ "D_ratio = g2/g1; #Ratio of degeneracy of states\n",
+ "x = k*T/e;\n",
+ "N_ratio = D_ratio*math.exp(-delta_E/x); #Ratio of occupancy of the excited to the ground state\n",
+ "\n",
+ "#Result\n",
+ "print \"The ratio of occupancy of the excited to the ground state is\",N_ratio"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The ratio of occupancy of the excited to the ground state is 1.10167326887e-08\n"
+ "text": [
+ "The ratio of occupancy of the excited to the ground state is 1.10167326887e-08\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +67,30 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.2, Page number 222"
+ "source": [
+ "Example number 10.2, Page number 222"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ground state energy of 10 non-interacting bosons\n\n#Calculation\n#an energy level can accomodate any number of bosons. Hence 10 bosons will be in n=1 state\n#energy is given by E1 = (pi**2*h**2)/(2*m*a**2)\na = 10/2;\n#enegy of 10 bosons is E = (10*pi**2*h**2)/(2*m*a**2) = (5*pi**2*h**2)/(m*a**2)\n\n#Result\nprint \"enegy of 10 bosons is E = \",int(a),\"(pi**2*h**2)/(m*a**2)\"",
+ "input": [
+ "\n",
+ "a = 10/2;\n",
+ "#enegy of 10 bosons is E = (10*pi**2*h**2)/(2*m*a**2) = (5*pi**2*h**2)/(m*a**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"enegy of 10 bosons is E = \",int(a),\"(pi**2*h**2)/(m*a**2)\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "enegy of 10 bosons is E = 5 (pi**2*h**2)/(m*a**2)\n"
+ "text": [
+ "enegy of 10 bosons is E = 5 (pi**2*h**2)/(m*a**2)\n"
+ ]
}
],
"prompt_number": 5
@@ -59,19 +99,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.3, Page number 223"
+ "source": [
+ "Example number 10.3, Page number 223"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ground state energy of the system\n\n#importing modules\nimport math\n\n#Variable declaration\nn1=1; #1st level\nn2=2; #2nd level\nn3=3; #3rd level\nn4=4; #4th level\nn5=5; #5th level\n\n#Calculation\n#an energy level can accomodate only 2 fermions. hence there will be 2 fermions in each level\n#thus total ground state energy will be E = (2*E1)+(2*E2)+(2*E3)+(2*E4)+E5\n#let X = ((pi**2)*(h**2)/(2*m*a**2)). E = X*((2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2))\nA = (2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2);\n#thus E = A*X\n\n#Result\nprint \"the ground state energy of the system is\",A,\"(pi**2)*(h**2)/(2*m*a**2)\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1; #1st level\n",
+ "n2=2; #2nd level\n",
+ "n3=3; #3rd level\n",
+ "n4=4; #4th level\n",
+ "n5=5; #5th level\n",
+ "\n",
+ "#Calculation\n",
+ "#an energy level can accomodate only 2 fermions. hence there will be 2 fermions in each level\n",
+ "#thus total ground state energy will be E = (2*E1)+(2*E2)+(2*E3)+(2*E4)+E5\n",
+ "#let X = ((pi**2)*(h**2)/(2*m*a**2)). E = X*((2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2))\n",
+ "A = (2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2);\n",
+ "#thus E = A*X\n",
+ "\n",
+ "#Result\n",
+ "print \"the ground state energy of the system is\",A,\"(pi**2)*(h**2)/(2*m*a**2)\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "the ground state energy of the system is 85 (pi**2)*(h**2)/(2*m*a**2)\n"
+ "text": [
+ "the ground state energy of the system is 85 (pi**2)*(h**2)/(2*m*a**2)\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +146,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.4, Page number 223"
+ "source": [
+ "Example number 10.4, Page number 223"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number density of conduction electrons and Fermi energy of silver\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nN_A = 6.02*10**23; #Avogadro's number\nh = 6.626*10**-34; #Planck's constant(Js)\nme = 9.1*10**-31; #Mass of electron(kg)\nrho = 10.5; #Density of silver(g/cm)\nm = 108; #Molecular mass of silver(g/mol)\n\n#Calculation\nN_D = rho*N_A/m; #Number density of conduction electrons(per cm**3)\nN_D = N_D*10**6; #Number density of conduction electrons(per m**3)\nE_F = ((h**2)/(8*me))*(3/math.pi*N_D)**(2/3); #fermi energy(J)\nE_F = E_F/e; #fermi energy(eV)\nE_F = math.ceil(E_F*10**2)/10**2; #rounding off the value of E_F to 2 decimals\n\n#Result\nprint \"The number density of conduction electrons is\",N_D, \"per metre cube\"\nprint \"The Fermi energy of silver is\",E_F, \"eV\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "N_A = 6.02*10**23; #Avogadro's number\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "me = 9.1*10**-31; #Mass of electron(kg)\n",
+ "rho = 10.5; #Density of silver(g/cm)\n",
+ "m = 108; #Molecular mass of silver(g/mol)\n",
+ "\n",
+ "#Calculation\n",
+ "N_D = rho*N_A/m; #Number density of conduction electrons(per cm**3)\n",
+ "N_D = N_D*10**6; #Number density of conduction electrons(per m**3)\n",
+ "E_F = ((h**2)/(8*me))*(3/math.pi*N_D)**(2/3); #fermi energy(J)\n",
+ "E_F = E_F/e; #fermi energy(eV)\n",
+ "E_F = math.ceil(E_F*10**2)/10**2; #rounding off the value of E_F to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The number density of conduction electrons is\",N_D, \"per metre cube\"\n",
+ "print \"The Fermi energy of silver is\",E_F, \"eV\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The number density of conduction electrons is 5.85277777778e+28 per metre cube\nThe Fermi energy of silver is 5.51 eV\n"
+ "text": [
+ "The number density of conduction electrons is 5.85277777778e+28 per metre cube\n",
+ "The Fermi energy of silver is 5.51 eV\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +197,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.5, Page number 224"
+ "source": [
+ "Example number 10.5, Page number 224"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic contribution to molar specific heat of sodium\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN_A = 6.02*10**23; #Avogadro's number\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nT = 293; #Temperature of sodium(K)\nE_F = 3.24; #Fermi energy of sodium(eV)\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n\n#Calculation\nC_v = math.pi**2*N_A*k**2*T/(2*E_F*e); #Molar specific heat of sodium(per mole)\nC_v = math.ceil(C_v*10**2)/10**2; #rounding off the value of C_v to 2 decimals\n\n#Result\nprint \"The electronic contribution to molar specific heat of sodium is\",C_v, \"per mole\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N_A = 6.02*10**23; #Avogadro's number\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "T = 293; #Temperature of sodium(K)\n",
+ "E_F = 3.24; #Fermi energy of sodium(eV)\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "\n",
+ "#Calculation\n",
+ "C_v = math.pi**2*N_A*k**2*T/(2*E_F*e); #Molar specific heat of sodium(per mole)\n",
+ "C_v = math.ceil(C_v*10**2)/10**2; #rounding off the value of C_v to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic contribution to molar specific heat of sodium is\",C_v, \"per mole\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic contribution to molar specific heat of sodium is 0.32 per mole\n"
+ "text": [
+ "The electronic contribution to molar specific heat of sodium is 0.32 per mole\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +241,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.6, Page number 224"
+ "source": [
+ "Example number 10.6, Page number 224"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Fermi energy and mean energy of the electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nh = 6.626*10**-34; #Planck's constant(Js)\nm = 9.1*10**-31; #Mass of the electron(kg)\nN_D = 18.1*10**28; #Number density of conduction electrons in Al(per metre cube)\n\n#Calculation\nE_F = h**2/(8*m)*(3/math.pi*N_D)**(2/3); #N_D = N/V. Fermi energy of aluminium(J)\nE_F = E_F/e; #Fermi energy of aluminium(eV)\nE_F = math.ceil(E_F*10**3)/10**3; #rounding off the value of E_F to 3 decimals\nEm_0 = 3/5*E_F; #Mean energy of the electron at 0K(eV)\nEm_0 = math.ceil(Em_0*10**3)/10**3; #rounding off the value of Em_0 to 3 decimals\n\n#Result\nprint \"The Fermi energy of aluminium is\",E_F, \"eV\"\nprint \"The mean energy of the electron is\",Em_0, \"eV\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "m = 9.1*10**-31; #Mass of the electron(kg)\n",
+ "N_D = 18.1*10**28; #Number density of conduction electrons in Al(per metre cube)\n",
+ "\n",
+ "#Calculation\n",
+ "E_F = h**2/(8*m)*(3/math.pi*N_D)**(2/3); #N_D = N/V. Fermi energy of aluminium(J)\n",
+ "E_F = E_F/e; #Fermi energy of aluminium(eV)\n",
+ "E_F = math.ceil(E_F*10**3)/10**3; #rounding off the value of E_F to 3 decimals\n",
+ "Em_0 = 3/5*E_F; #Mean energy of the electron at 0K(eV)\n",
+ "Em_0 = math.ceil(Em_0*10**3)/10**3; #rounding off the value of Em_0 to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The Fermi energy of aluminium is\",E_F, \"eV\"\n",
+ "print \"The mean energy of the electron is\",Em_0, \"eV\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Fermi energy of aluminium is 11.696 eV\nThe mean energy of the electron is 7.018 eV\n"
+ "text": [
+ "The Fermi energy of aluminium is 11.696 eV\n",
+ "The mean energy of the electron is 7.018 eV\n"
+ ]
}
],
"prompt_number": 9
@@ -142,7 +288,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter11_1.ipynb b/Engineering_Physics_Aruldhas/Chapter11_1.ipynb
index 733fe6b7..d5495309 100644
--- a/Engineering_Physics_Aruldhas/Chapter11_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter11_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter11"
+ "name": "",
+ "signature": "sha256:ecf05dc207884a73f4d33d07fdee310eee827214d9664476e0cf941cf4d4f512"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,55 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "11: Lasers"
+ "source": [
+ "11: Lasers"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.1, Page number 249"
+ "source": [
+ "Example number 11.1, Page number 249"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ratio of spontaneous emission to stimulated emission for visible and microwave region\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 6.626*10**-34; #Planck's constant(Js)\nc = 3*10**8; #Speed of light in free space(m/s)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nT = 300; #Temperature at absolute scale(K)\nlamda1 = 5500; #Wavelength of visible light(A)\nlamda2 = 10**-2; #Wavelength of microwave(m)\n\n#Calculation\nlamda1 = lamda1*10**-10; #Wavelength of visible light(m)\nrate_ratio = math.exp(h*c/(lamda1*k*T))-1; #Ratio of spontaneous emission to stimulated emission\nrate_ratio1 = math.exp(h*c/(lamda2*k*T))-1; #Ratio of spontaneous emission to stimulated emission\nrate_ratio1 = math.ceil(rate_ratio1*10**5)/10**5; #rounding off the value of rate_ratio1 to 5 decimals\n\n#Result\nprint \"The ratio of spontaneous emission to stimulated emission for visible region is\",rate_ratio\nprint \"The ratio of spontaneous emission to stimulated emission for microwave region is\", rate_ratio1",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "c = 3*10**8; #Speed of light in free space(m/s)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "T = 300; #Temperature at absolute scale(K)\n",
+ "lamda1 = 5500; #Wavelength of visible light(A)\n",
+ "lamda2 = 10**-2; #Wavelength of microwave(m)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda1 = lamda1*10**-10; #Wavelength of visible light(m)\n",
+ "rate_ratio = math.exp(h*c/(lamda1*k*T))-1; #Ratio of spontaneous emission to stimulated emission\n",
+ "rate_ratio1 = math.exp(h*c/(lamda2*k*T))-1; #Ratio of spontaneous emission to stimulated emission\n",
+ "rate_ratio1 = math.ceil(rate_ratio1*10**5)/10**5; #rounding off the value of rate_ratio1 to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The ratio of spontaneous emission to stimulated emission for visible region is\",rate_ratio\n",
+ "print \"The ratio of spontaneous emission to stimulated emission for microwave region is\", rate_ratio1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The ratio of spontaneous emission to stimulated emission for visible region is 8.19422217477e+37\nThe ratio of spontaneous emission to stimulated emission for microwave region is 0.00482\n"
+ "text": [
+ "The ratio of spontaneous emission to stimulated emission for visible region is 8.19422217477e+37\n",
+ "The ratio of spontaneous emission to stimulated emission for microwave region is 0.00482\n"
+ ]
}
],
"prompt_number": 3
@@ -38,19 +69,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.2, Page number 250"
+ "source": [
+ "Example number 11.2, Page number 250"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy of excited state\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nh = 6.626*10**-34; #Planck's constant(Js)\nc = 3*10**8; #Speed of light in free space(m/s)\nlamda = 690; #Wavelength of laser light(nm)\nE_lower = 30.5; #Energy of lower state(eV)\n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of laser light(m)\nE = h*c/lamda; #Energy of the laser light(J)\nE = E/e; #Energy of the laser light(eV)\nE_ex = E_lower + E; #Energy of excited state of laser system(eV)\nE_ex = math.ceil(E_ex*10**2)/10**2; #rounding off the value of E_ex to 2 decimals\n\n#Result\nprint \"The energy of excited state of laser system is\",E_ex, \"eV\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "c = 3*10**8; #Speed of light in free space(m/s)\n",
+ "lamda = 690; #Wavelength of laser light(nm)\n",
+ "E_lower = 30.5; #Energy of lower state(eV)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of laser light(m)\n",
+ "E = h*c/lamda; #Energy of the laser light(J)\n",
+ "E = E/e; #Energy of the laser light(eV)\n",
+ "E_ex = E_lower + E; #Energy of excited state of laser system(eV)\n",
+ "E_ex = math.ceil(E_ex*10**2)/10**2; #rounding off the value of E_ex to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The energy of excited state of laser system is\",E_ex, \"eV\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The energy of excited state of laser system is 32.31 eV\n"
+ "text": [
+ "The energy of excited state of laser system is 32.31 eV\n"
+ ]
}
],
"prompt_number": 4
@@ -59,19 +117,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.3, Page number 250"
+ "source": [
+ "Example number 11.3, Page number 250"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To determine the condition under which stimulated emission equals spontaneous emission\n\n#importing modules\nimport math\nfrom __future__ import division\nimport numpy as np\n\n#Variable declaration\nh = 6.626*10**-34; #Planck's constant(Js)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\n\n#Calculation\n#Stimulated Emission = Spontaneous Emission <=> exp(h*f/(k*T))-1 = 1 i.e.\n#f/T = log(2)*k/h = A\nA = np.log(2)*k/h; #Frequency per unit temperature(Hz/K)\nA = A/10**10;\nA = math.ceil(A*10**3)/10**3; #rounding off the value of A to 3 decimals\n\n#Result\nprint \"The stimulated emission equals spontaneous emission iff f/T =\",A,\"*10**10 Hz/k\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "\n",
+ "#Calculation\n",
+ "#Stimulated Emission = Spontaneous Emission <=> exp(h*f/(k*T))-1 = 1 i.e.\n",
+ "#f/T = log(2)*k/h = A\n",
+ "A = np.log(2)*k/h; #Frequency per unit temperature(Hz/K)\n",
+ "A = A/10**10;\n",
+ "A = math.ceil(A*10**3)/10**3; #rounding off the value of A to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The stimulated emission equals spontaneous emission iff f/T =\",A,\"*10**10 Hz/k\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The stimulated emission equals spontaneous emission iff f/T = 1.444 *10**10 Hz/k\n"
+ "text": [
+ "The stimulated emission equals spontaneous emission iff f/T = 1.444 *10**10 Hz/k\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +162,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.4, Page number 250"
+ "source": [
+ "Example number 11.4, Page number 250"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the area of the spot and intensity at the focus \n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 500; #Wavelength of laser light(nm)\nf = 15; #Focal length of the lens(cm)\nd = 2; #Diameter of the aperture of source(cm)\nP = 5; #Power of the laser(mW)\n\n#Calculation\nP = P*10**-3; #Power of the laser(W)\nlamda = lamda*10**-9; #Wavelength of laser light(m)\nd = d*10**-2; #Diameter of the aperture of source(m)\nf = f*10**-2; #Focal length of the lens(m)\na = d/2; #Radius of the aperture of source(m)\nA = math.pi*lamda**2*f**2/a**2; #Area of the spot at the focal plane, metre square\nI = P/A; #Intensity at the focus(W/m**2)\nI = I/10**7;\nI = math.ceil(I*10**4)/10**4; #rounding off the value of I to 1 decimal\n\n#Result\nprint \"The area of the spot at the focal plane is\",A, \"m**2\"\nprint \"The intensity at the focus is\",I,\"*10**7 W/m**2\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 500; #Wavelength of laser light(nm)\n",
+ "f = 15; #Focal length of the lens(cm)\n",
+ "d = 2; #Diameter of the aperture of source(cm)\n",
+ "P = 5; #Power of the laser(mW)\n",
+ "\n",
+ "#Calculation\n",
+ "P = P*10**-3; #Power of the laser(W)\n",
+ "lamda = lamda*10**-9; #Wavelength of laser light(m)\n",
+ "d = d*10**-2; #Diameter of the aperture of source(m)\n",
+ "f = f*10**-2; #Focal length of the lens(m)\n",
+ "a = d/2; #Radius of the aperture of source(m)\n",
+ "A = math.pi*lamda**2*f**2/a**2; #Area of the spot at the focal plane, metre square\n",
+ "I = P/A; #Intensity at the focus(W/m**2)\n",
+ "I = I/10**7;\n",
+ "I = math.ceil(I*10**4)/10**4; #rounding off the value of I to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The area of the spot at the focal plane is\",A, \"m**2\"\n",
+ "print \"The intensity at the focus is\",I,\"*10**7 W/m**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The area of the spot at the focal plane is 1.76714586764e-10 m**2\nThe intensity at the focus is 2.8295 *10**7 W/m**2\n"
+ "text": [
+ "The area of the spot at the focal plane is 1.76714586764e-10 m**2\n",
+ "The intensity at the focus is 2.8295 *10**7 W/m**2\n"
+ ]
}
],
"prompt_number": 14
@@ -101,19 +215,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.5, Page number 251"
+ "source": [
+ "Example number 11.5, Page number 251"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy released per pulse and number of photons\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 6.626*10**-34; #Planck's constant(Js)\nc = 3*10**8; #Speed of light in free space(m/s)\nlamda = 1064; #Wavelength of laser light(nm)\nP = 0.8; #Average power output per laser pulse(W)\ndt = 25; #Pulse width of laser(ms)\n\n#Calculation\ndt = dt*10**-3; #Pulse width of laser(s)\nlamda = lamda*10**-9; #Wavelength of laser light(m)\nE = P*dt; #Energy released per pulse(J)\nE1 = E*10**3;\nN = E/(h*c/lamda); #Number of photons in a pulse\n\n#Result\nprint \"The energy released per pulse is\",E1,\"*10**-3 J\"\nprint \"The number of photons in a pulse is\", N\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "c = 3*10**8; #Speed of light in free space(m/s)\n",
+ "lamda = 1064; #Wavelength of laser light(nm)\n",
+ "P = 0.8; #Average power output per laser pulse(W)\n",
+ "dt = 25; #Pulse width of laser(ms)\n",
+ "\n",
+ "#Calculation\n",
+ "dt = dt*10**-3; #Pulse width of laser(s)\n",
+ "lamda = lamda*10**-9; #Wavelength of laser light(m)\n",
+ "E = P*dt; #Energy released per pulse(J)\n",
+ "E1 = E*10**3;\n",
+ "N = E/(h*c/lamda); #Number of photons in a pulse\n",
+ "\n",
+ "#Result\n",
+ "print \"The energy released per pulse is\",E1,\"*10**-3 J\"\n",
+ "print \"The number of photons in a pulse is\", N\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The energy released per pulse is 20.0 *10**-3 J\nThe number of photons in a pulse is 1.07053023443e+17\n"
+ "text": [
+ "The energy released per pulse is 20.0 *10**-3 J\n",
+ "The number of photons in a pulse is 1.07053023443e+17\n"
+ ]
}
],
"prompt_number": 17
@@ -122,19 +265,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.6, Page number 251"
+ "source": [
+ "Example number 11.6, Page number 251"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angular spread and diameter of the beam\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 693; #Wavelength of laser beam(nm)\nD = 3; #Diameter of laser beam(mm)\nd = 300; #Height of a satellite above the surface of earth(km)\n\n#Calculation\nD = D*10**-3; #Diameter of laser beam(m)\nlamda = lamda*10**-9; #Wavelength of laser beam(m)\nd = d*10**3; #Height of a satellite above the surface of earth(m)\nd_theta = 1.22*lamda/D; #Angular spread of laser beam(rad)\ndtheta = d_theta*10**4;\ndtheta = math.ceil(dtheta*10**2)/10**2; #rounding off the value of dtheta to 2 decimals\na = d_theta*d; #Diameter of the beam on the satellite(m)\na = math.ceil(a*10)/10; #rounding off the value of a to 1 decimal\n\n#Result\nprint \"The height of a satellite above the surface of earth is\",dtheta,\"*10**-4 rad\"\nprint \"The diameter of the beam on the satellite is\",a, \"m\"\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 693; #Wavelength of laser beam(nm)\n",
+ "D = 3; #Diameter of laser beam(mm)\n",
+ "d = 300; #Height of a satellite above the surface of earth(km)\n",
+ "\n",
+ "#Calculation\n",
+ "D = D*10**-3; #Diameter of laser beam(m)\n",
+ "lamda = lamda*10**-9; #Wavelength of laser beam(m)\n",
+ "d = d*10**3; #Height of a satellite above the surface of earth(m)\n",
+ "d_theta = 1.22*lamda/D; #Angular spread of laser beam(rad)\n",
+ "dtheta = d_theta*10**4;\n",
+ "dtheta = math.ceil(dtheta*10**2)/10**2; #rounding off the value of dtheta to 2 decimals\n",
+ "a = d_theta*d; #Diameter of the beam on the satellite(m)\n",
+ "a = math.ceil(a*10)/10; #rounding off the value of a to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The height of a satellite above the surface of earth is\",dtheta,\"*10**-4 rad\"\n",
+ "print \"The diameter of the beam on the satellite is\",a, \"m\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The height of a satellite above the surface of earth is 2.82 *10**-4 rad\nThe diameter of the beam on the satellite is 84.6 m\n"
+ "text": [
+ "The height of a satellite above the surface of earth is 2.82 *10**-4 rad\n",
+ "The diameter of the beam on the satellite is 84.6 m\n"
+ ]
}
],
"prompt_number": 25
@@ -142,7 +314,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter12_1.ipynb b/Engineering_Physics_Aruldhas/Chapter12_1.ipynb
index 440b2d59..7fa73024 100644
--- a/Engineering_Physics_Aruldhas/Chapter12_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter12_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter12"
+ "name": "",
+ "signature": "sha256:aab26783619c45961eca2004893b5ed3a4fe23aa4a44df9efa3d63c5d1ff3388"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,60 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "12: Holography and Fibre Optics"
+ "source": [
+ "12: Holography and Fibre Optics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.1, Page number 271"
+ "source": [
+ "Example number 12.1, Page number 271"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical angle, critical propagation angle and numerical aperture \n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nn1 = 1.43; #Refractive index of fibre core\nn2 = 1.4; #Refractive index of fibre cladding\n\n#Calculation\n#As sin (alpha_c) = n2/n1, solving for alpha_c\nalpha_c = math.asin(n2/n1); #Critical angle for optical fibre(rad)\nalpha_c = alpha_c*57.2957795; #Critical angle for optical fibre(degrees)\nalpha_c = math.ceil(alpha_c*10**3)/10**3; #rounding off the value of alpha_c to 3 decimals\n#AS cos(theta_c) = n2/n1, solving for theta_c\ntheta_c = math.acos(n2/n1); #Critical propagation angle for optical fibre(rad)\ntheta_c = theta_c*57.2957795; #Critical propagation angle for optical fibre(degrees)\ntheta_c = math.ceil(theta_c*10**2)/10**2; #rounding off the value of theta_c to 2 decimals\nNA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\nNA = math.ceil(NA*10**3)/10**3; #rounding off the value of NA to 3 decimals\n\n#Result\nprint \"The critical angle for optical fibre is\",alpha_c, \"degrees\"\nprint \"The critical propagation angle for optical fibre is\",theta_c, \"degrees\"\nprint \"Numerical aperture for optical fibre is\",NA\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1 = 1.43; #Refractive index of fibre core\n",
+ "n2 = 1.4; #Refractive index of fibre cladding\n",
+ "\n",
+ "#Calculation\n",
+ "#As sin (alpha_c) = n2/n1, solving for alpha_c\n",
+ "alpha_c = math.asin(n2/n1); #Critical angle for optical fibre(rad)\n",
+ "alpha_c = alpha_c*57.2957795; #Critical angle for optical fibre(degrees)\n",
+ "alpha_c = math.ceil(alpha_c*10**3)/10**3; #rounding off the value of alpha_c to 3 decimals\n",
+ "#AS cos(theta_c) = n2/n1, solving for theta_c\n",
+ "theta_c = math.acos(n2/n1); #Critical propagation angle for optical fibre(rad)\n",
+ "theta_c = theta_c*57.2957795; #Critical propagation angle for optical fibre(degrees)\n",
+ "theta_c = math.ceil(theta_c*10**2)/10**2; #rounding off the value of theta_c to 2 decimals\n",
+ "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n",
+ "NA = math.ceil(NA*10**3)/10**3; #rounding off the value of NA to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The critical angle for optical fibre is\",alpha_c, \"degrees\"\n",
+ "print \"The critical propagation angle for optical fibre is\",theta_c, \"degrees\"\n",
+ "print \"Numerical aperture for optical fibre is\",NA\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The critical angle for optical fibre is 78.244 degrees\nThe critical propagation angle for optical fibre is 11.76 degrees\nNumerical aperture for optical fibre is 0.292\n"
+ "text": [
+ "The critical angle for optical fibre is 78.244 degrees\n",
+ "The critical propagation angle for optical fibre is 11.76 degrees\n",
+ "Numerical aperture for optical fibre is 0.292\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +74,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.2, Page number 271"
+ "source": [
+ "Example number 12.2, Page number 271"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture, acceptance angle and relative refractive index difference\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nn1 = 1.45; #Refractive index of fibre core\nn2 = 1.4; #Refractive index of fibre cladding\n\n#Calculation\nNA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\nNA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n#As sin(theta_a) = sqrt(n1^2 - n2^2), solving for theta_a\ntheta_a = math.asin(math.sqrt(n1**2 - n2**2)); #Half of acceptance angle of optical fibre(rad)\ntheta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\ntheta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\ntheta_accp = math.ceil(theta_accp*10**2)/10**2; #rounding off the value of theta_accp to 2 decimals\nDelta = (n1 - n2)/n1; #Relative refractive index difference\nDelta = math.ceil(Delta*10**4)/10**4; #rounding off the value of Delta to 4 decimals\n\n#Result\nprint \"Numerical aperture for optical fibre is\", NA\nprint \"The acceptance angle of optical fibre is\",theta_accp, \"degrees\"\nprint \"Relative refractive index difference is\", Delta\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1 = 1.45; #Refractive index of fibre core\n",
+ "n2 = 1.4; #Refractive index of fibre cladding\n",
+ "\n",
+ "#Calculation\n",
+ "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n",
+ "NA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n",
+ "#As sin(theta_a) = sqrt(n1^2 - n2^2), solving for theta_a\n",
+ "theta_a = math.asin(math.sqrt(n1**2 - n2**2)); #Half of acceptance angle of optical fibre(rad)\n",
+ "theta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\n",
+ "theta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n",
+ "theta_accp = math.ceil(theta_accp*10**2)/10**2; #rounding off the value of theta_accp to 2 decimals\n",
+ "Delta = (n1 - n2)/n1; #Relative refractive index difference\n",
+ "Delta = math.ceil(Delta*10**4)/10**4; #rounding off the value of Delta to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"Numerical aperture for optical fibre is\", NA\n",
+ "print \"The acceptance angle of optical fibre is\",theta_accp, \"degrees\"\n",
+ "print \"Relative refractive index difference is\", Delta\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Numerical aperture for optical fibre is 0.3775\nThe acceptance angle of optical fibre is 44.36 degrees\nRelative refractive index difference is 0.0345\n"
+ "text": [
+ "Numerical aperture for optical fibre is 0.3775\n",
+ "The acceptance angle of optical fibre is 44.36 degrees\n",
+ "Relative refractive index difference is 0.0345\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +126,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.3, Page number 271"
+ "source": [
+ "Example number 12.3, Page number 271"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture and acceptance angle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nn1 = 1.55; #Refractive index of fibre core\nn2 = 1.53; #Refractive index of fibre cladding\nn0 = 1.3; #Refractive index of medium\n\n#Calculation\nNA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\nNA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n#n0*sin(theta_a) = sqrt(n1^2 - n2^2) = NA, solving for theta_a\ntheta_a = math.asin(math.sqrt(n1**2 - n2**2)/n0); #Half of acceptance angle of optical fibre(rad)\ntheta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\ntheta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n\n#Result\nprint \"Numerical aperture for step index fibre is\",NA\nprint \"The acceptance angle of step index fibre is\",int(theta_accp), \"degrees\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1 = 1.55; #Refractive index of fibre core\n",
+ "n2 = 1.53; #Refractive index of fibre cladding\n",
+ "n0 = 1.3; #Refractive index of medium\n",
+ "\n",
+ "#Calculation\n",
+ "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n",
+ "NA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n",
+ "#n0*sin(theta_a) = sqrt(n1^2 - n2^2) = NA, solving for theta_a\n",
+ "theta_a = math.asin(math.sqrt(n1**2 - n2**2)/n0); #Half of acceptance angle of optical fibre(rad)\n",
+ "theta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\n",
+ "theta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"Numerical aperture for step index fibre is\",NA\n",
+ "print \"The acceptance angle of step index fibre is\",int(theta_accp), \"degrees\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Numerical aperture for step index fibre is 0.2482\nThe acceptance angle of step index fibre is 22 degrees\n"
+ "text": [
+ "Numerical aperture for step index fibre is 0.2482\n",
+ "The acceptance angle of step index fibre is 22 degrees\n"
+ ]
}
],
"prompt_number": 5
@@ -80,25 +175,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.4, Page number 271 Theoritical proof"
+ "source": [
+ "Example number 12.4, Page number 271 Theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.5, Page number 272"
+ "source": [
+ "Example number 12.5, Page number 272"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture and acceptance angle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nalpha = 2; #Power loss through optical fibre(dB/km)\nP_in = 500; #Poer input of optical fibre(micro-watt)\nz = 10; #Length of the optical fibre(km)\n\n#Calculation\n#As alpha = 10/z*log10(P_in/P_out), solving for P_out\nP_out = P_in/10**(alpha*z/10); #Output power in fibre optic communication(micro-Watt)\n\n#Result\nprint \"The output power in fibre optic communication is\",P_out, \"micro-Watt\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "alpha = 2; #Power loss through optical fibre(dB/km)\n",
+ "P_in = 500; #Poer input of optical fibre(micro-watt)\n",
+ "z = 10; #Length of the optical fibre(km)\n",
+ "\n",
+ "#Calculation\n",
+ "#As alpha = 10/z*log10(P_in/P_out), solving for P_out\n",
+ "P_out = P_in/10**(alpha*z/10); #Output power in fibre optic communication(micro-Watt)\n",
+ "\n",
+ "#Result\n",
+ "print \"The output power in fibre optic communication is\",P_out, \"micro-Watt\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The output power in fibre optic communication is 5.0 micro-Watt\n"
+ "text": [
+ "The output power in fibre optic communication is 5.0 micro-Watt\n"
+ ]
}
],
"prompt_number": 6
@@ -106,7 +225,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter13_1.ipynb b/Engineering_Physics_Aruldhas/Chapter13_1.ipynb
index 2366432d..06b2e844 100644
--- a/Engineering_Physics_Aruldhas/Chapter13_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter13_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter13"
+ "name": "",
+ "signature": "sha256:23fe0a698ddd73a9b73b082e06aebc62f797877523bf19c5324fc5a8330a2aa8"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,47 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "13: Dielectric Properties of Materials"
+ "source": [
+ "13: Dielectric Properties of Materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.1, Page number 287"
+ "source": [
+ "Example number 13.1, Page number 287"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability \n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0 = 8.85*10**-12; #Absolute electrical permittivity of free space(F/m)\nR = 0.52; #Radius of hydrogen atom(A)\nn = 9.7*10**26; #Number density of hydrogen(per metre cube)\n\n#Calculation\nR = R*10**-10; #Radius of hydrogen atom(m)\nalpha_e = 4*math.pi*epsilon_0*R**3; #Electronic polarizability of hydrogen atom(Fm**2)\n\n#Result\nprint \"The electronic polarizability of hydrogen atom is\", alpha_e, \"Fm**2\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0 = 8.85*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "R = 0.52; #Radius of hydrogen atom(A)\n",
+ "n = 9.7*10**26; #Number density of hydrogen(per metre cube)\n",
+ "\n",
+ "#Calculation\n",
+ "R = R*10**-10; #Radius of hydrogen atom(m)\n",
+ "alpha_e = 4*math.pi*epsilon_0*R**3; #Electronic polarizability of hydrogen atom(Fm**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic polarizability of hydrogen atom is\", alpha_e, \"Fm**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic polarizability of hydrogen atom is 1.56373503182e-41 Fm**2\n"
+ "text": [
+ "The electronic polarizability of hydrogen atom is 1.56373503182e-41 Fm**2\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +61,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.2, Page number 287"
+ "source": [
+ "Example number 13.2, Page number 287"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the capacitance of capacitor and charge on the plates\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nA = 100; #Area of a plate of parallel plate capacitor(cm**2)\nd = 1; #Distance between the plates of the capacitor(cm)\nV = 100; #Potential applied to the plates of the capacitor(V)\n\n#Calculation\nA= A*10**-4; #Area of a plate of parallel plate capacitor(m**2)\nd = d*10**-2; #Distance between the plates of the capacitor(m)\nC = epsilon_0*A/d; #Capacitance of parallel plate capacitor(F)\nQ = C*V; #Charge on the plates of the capacitor(C)\n\n#Result\nprint \"The capacitance of parallel plate capacitor is\",C, \"F\"\nprint \"The charge on the plates of the capacitor is\",Q, \"C\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "A = 100; #Area of a plate of parallel plate capacitor(cm**2)\n",
+ "d = 1; #Distance between the plates of the capacitor(cm)\n",
+ "V = 100; #Potential applied to the plates of the capacitor(V)\n",
+ "\n",
+ "#Calculation\n",
+ "A= A*10**-4; #Area of a plate of parallel plate capacitor(m**2)\n",
+ "d = d*10**-2; #Distance between the plates of the capacitor(m)\n",
+ "C = epsilon_0*A/d; #Capacitance of parallel plate capacitor(F)\n",
+ "Q = C*V; #Charge on the plates of the capacitor(C)\n",
+ "\n",
+ "#Result\n",
+ "print \"The capacitance of parallel plate capacitor is\",C, \"F\"\n",
+ "print \"The charge on the plates of the capacitor is\",Q, \"C\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The capacitance of parallel plate capacitor is 8.854e-12 F\nThe charge on the plates of the capacitor is 8.854e-10 C\n"
+ "text": [
+ "The capacitance of parallel plate capacitor is 8.854e-12 F\n",
+ "The charge on the plates of the capacitor is 8.854e-10 C\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +109,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.3, Page number 288"
+ "source": [
+ "Example number 13.3, Page number 288"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the dielectric displacement\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nepsilon_r = 5.0; #Dielectric constant of the material between the plates of capacitor\nV = 15; #Potential difference applied between the plates of the capacitor(V)\nd = 1.5; #Separation between the plates of the capacitor(mm)\n\n#Calculation\nd = d*10**-3; #Separation between the plates of the capacitor(m)\n#Electric displacement, D = epsilon_0*epsilon_r*E, as E = V/d, so \nD = epsilon_0*epsilon_r*V/d; #Dielectric displacement(C/m**2)\n\n#Result\nprint \"The dielectric displacement is\",D, \"C/m**2\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "epsilon_r = 5.0; #Dielectric constant of the material between the plates of capacitor\n",
+ "V = 15; #Potential difference applied between the plates of the capacitor(V)\n",
+ "d = 1.5; #Separation between the plates of the capacitor(mm)\n",
+ "\n",
+ "#Calculation\n",
+ "d = d*10**-3; #Separation between the plates of the capacitor(m)\n",
+ "#Electric displacement, D = epsilon_0*epsilon_r*E, as E = V/d, so \n",
+ "D = epsilon_0*epsilon_r*V/d; #Dielectric displacement(C/m**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"The dielectric displacement is\",D, \"C/m**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The dielectric displacement is 4.427e-07 C/m**2\n"
+ "text": [
+ "The dielectric displacement is 4.427e-07 C/m**2\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +154,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.4, Page number 288"
+ "source": [
+ "Example number 13.4, Page number 288"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative dielectric constant\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nN = 3*10**28; #Number density of solid elemental dielectric(atoms/metre cube)\nalpha_e = 10**-40; #Electronic polarizability(Fm**2)\n\n#Calculation\nepsilon_r = 1 + (N*alpha_e/epsilon_0); #Relative dielectric constant of the material\nepsilon_r = math.ceil(epsilon_r*10**3)/10**3; #rounding off the value of epsilon_r to 3 decimals\n\n#Result\nprint \"The Relative dielectric constant of the material is\",epsilon_r\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "N = 3*10**28; #Number density of solid elemental dielectric(atoms/metre cube)\n",
+ "alpha_e = 10**-40; #Electronic polarizability(Fm**2)\n",
+ "\n",
+ "#Calculation\n",
+ "epsilon_r = 1 + (N*alpha_e/epsilon_0); #Relative dielectric constant of the material\n",
+ "epsilon_r = math.ceil(epsilon_r*10**3)/10**3; #rounding off the value of epsilon_r to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The Relative dielectric constant of the material is\",epsilon_r\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Relative dielectric constant of the material is 1.339\n"
+ "text": [
+ "The Relative dielectric constant of the material is 1.339\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +197,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.5, Page number 288"
+ "source": [
+ "Example number 13.5, Page number 288"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN_A = 6.02*10**23; #Avogadro's number(per mole)\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nepsilon_r = 3.75; #Relative dielectric constant\nd = 2050; #Density of sulphur(kg/metre cube)\ny = 1/3; #Internal field constant\nM = 32; #Atomic weight of sulphur(g/mol)\n\n#Calculation\nN = N_A*10**3*d/M; #Number density of atoms of sulphur(per metre cube)\n#Lorentz relation for local fields give E_local = E + P/(3*epsilon_0) which gives\n#(epsilon_r - 1)/(epsilon_r + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\nalpha_e = (epsilon_r - 1)/(epsilon_r + 2)*3*epsilon_0/N; #Electronic polarizability of sulphur(Fm**2)\n\n#Result\nprint \"The electronic polarizability of sulphur is\",alpha_e, \"Fm**2\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N_A = 6.02*10**23; #Avogadro's number(per mole)\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "epsilon_r = 3.75; #Relative dielectric constant\n",
+ "d = 2050; #Density of sulphur(kg/metre cube)\n",
+ "y = 1/3; #Internal field constant\n",
+ "M = 32; #Atomic weight of sulphur(g/mol)\n",
+ "\n",
+ "#Calculation\n",
+ "N = N_A*10**3*d/M; #Number density of atoms of sulphur(per metre cube)\n",
+ "#Lorentz relation for local fields give E_local = E + P/(3*epsilon_0) which gives\n",
+ "#(epsilon_r - 1)/(epsilon_r + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\n",
+ "alpha_e = (epsilon_r - 1)/(epsilon_r + 2)*3*epsilon_0/N; #Electronic polarizability of sulphur(Fm**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic polarizability of sulphur is\",alpha_e, \"Fm**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic polarizability of sulphur is 3.2940125351e-40 Fm**2\n"
+ "text": [
+ "The electronic polarizability of sulphur is 3.2940125351e-40 Fm**2\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +244,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.6, Page number 289"
+ "source": [
+ "Example number 13.6, Page number 289"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN = 3*10**28; #Number density of atoms of dielectric material(per metre cube)\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\nn = 1.6; #Refractive index of dielectric material\n\n#Calculation\n#As (n^2 - 1)/(n^2 + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\nalpha_e = (n**2 - 1)/(n**2 + 2)*3*epsilon_0/N; #Electronic polarizability of dielectric material(Fm**2)\n\n#Result\nprint \"The electronic polarizability of dielectric material is\",alpha_e, \"Fm**2\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N = 3*10**28; #Number density of atoms of dielectric material(per metre cube)\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "n = 1.6; #Refractive index of dielectric material\n",
+ "\n",
+ "#Calculation\n",
+ "#As (n^2 - 1)/(n^2 + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\n",
+ "alpha_e = (n**2 - 1)/(n**2 + 2)*3*epsilon_0/N; #Electronic polarizability of dielectric material(Fm**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic polarizability of dielectric material is\",alpha_e, \"Fm**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic polarizability of dielectric material is 3.029e-40 Fm**2\n"
+ "text": [
+ "The electronic polarizability of dielectric material is 3.029e-40 Fm**2\n"
+ ]
}
],
"prompt_number": 8
@@ -143,19 +286,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 13.7, Page number 289"
+ "source": [
+ "Example number 13.7, Page number 289"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the ratio of electronic polarizability to ionic polarizability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nepsilon_r = 4.9; #Absolute relative dielectric constant of material(F/m)\nn = 1.6; #Refractive index of dielectric material\n\n#Calculation\n#As (n^2 - 1)/(n^2 + 2)*(alpha_e + alpha_i)/alpha_e = N*(alpha_e + alpha_i)/(3*epsilon_0) = (epsilon_r - 1)/(epsilon_r + 2)\n#let alpha_ratio = alpha_i/alpha_e\nalpha_ratio = ((epsilon_r - 1)/(epsilon_r + 2)*(n**2 + 2)/(n**2 - 1) - 1)**(-1); #Ratio of electronic polarizability to ionic polarizability\nalpha_ratio = math.ceil(alpha_ratio*10**3)/10**3; #rounding off the value of alpha_ratio to 3 decimals\n\n#Result\nprint \"The ratio of electronic polarizability to ionic polarizability is\",alpha_ratio",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_r = 4.9; #Absolute relative dielectric constant of material(F/m)\n",
+ "n = 1.6; #Refractive index of dielectric material\n",
+ "\n",
+ "#Calculation\n",
+ "#As (n^2 - 1)/(n^2 + 2)*(alpha_e + alpha_i)/alpha_e = N*(alpha_e + alpha_i)/(3*epsilon_0) = (epsilon_r - 1)/(epsilon_r + 2)\n",
+ "#let alpha_ratio = alpha_i/alpha_e\n",
+ "alpha_ratio = ((epsilon_r - 1)/(epsilon_r + 2)*(n**2 + 2)/(n**2 - 1) - 1)**(-1); #Ratio of electronic polarizability to ionic polarizability\n",
+ "alpha_ratio = math.ceil(alpha_ratio*10**3)/10**3; #rounding off the value of alpha_ratio to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The ratio of electronic polarizability to ionic polarizability is\",alpha_ratio"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The ratio of electronic polarizability to ionic polarizability is 1.534\n"
+ "text": [
+ "The ratio of electronic polarizability to ionic polarizability is 1.534\n"
+ ]
}
],
"prompt_number": 9
@@ -163,7 +329,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter14_1.ipynb b/Engineering_Physics_Aruldhas/Chapter14_1.ipynb
index eb6cc153..63e03042 100644
--- a/Engineering_Physics_Aruldhas/Chapter14_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter14_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter14"
+ "name": "",
+ "signature": "sha256:396480b86092e159711151589922125e5821f00167a65ea8819e3cd4725bf191"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,54 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "14: Magnetic Properties of Materials"
+ "source": [
+ "14: Magnetic Properties of Materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.1, Page number 306"
+ "source": [
+ "Example number 14.1, Page number 306"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the spontaneous magnetisation\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN = 6.02*10**23; #Avogadro's number(per mole)\nA = 56; #Atomic weight of the substance(g/mole)\nd = 7.9; #Density of the substance(g/cm**3)\nm_B = 9.27*10**-24; #Bohr's Magneton(J/T)\n\n#Calculation\nm = 2.2*m_B; #Magnetic moment of substance(J/T)\nn = d*N/A ; #Number of atoms per unit volume of the substance(per cm**3)\nn = n*10**6; #Number of atoms per unit volume of the substance(per m**3)\nM = n*m; #Spontaneous magnetisation of the substance(A/m)\nM = M/10**6;\nM = math.ceil(M*10**3)/10**3; #rounding off the value of M to 3 decimals\n\n#Result\nprint \"The spontaneous magnetisation of the substance is\",M,\"*10**6 A/m\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N = 6.02*10**23; #Avogadro's number(per mole)\n",
+ "A = 56; #Atomic weight of the substance(g/mole)\n",
+ "d = 7.9; #Density of the substance(g/cm**3)\n",
+ "m_B = 9.27*10**-24; #Bohr's Magneton(J/T)\n",
+ "\n",
+ "#Calculation\n",
+ "m = 2.2*m_B; #Magnetic moment of substance(J/T)\n",
+ "n = d*N/A ; #Number of atoms per unit volume of the substance(per cm**3)\n",
+ "n = n*10**6; #Number of atoms per unit volume of the substance(per m**3)\n",
+ "M = n*m; #Spontaneous magnetisation of the substance(A/m)\n",
+ "M = M/10**6;\n",
+ "M = math.ceil(M*10**3)/10**3; #rounding off the value of M to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The spontaneous magnetisation of the substance is\",M,\"*10**6 A/m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The spontaneous magnetisation of the substance is 1.732 *10**6 A/m\n"
+ "text": [
+ "The spontaneous magnetisation of the substance is 1.732 *10**6 A/m\n"
+ ]
}
],
"prompt_number": 5
@@ -38,19 +68,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.2, Page number 307"
+ "source": [
+ "Example number 14.2, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative permeability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nH = 200; #Field strength to which the ferromagnetic material is subjected(A/m)\nM = 3100; #Magnetisation of the ferromagnetic material(A/m)\n\n#Calculation\nchi = M/H; #Magnetic susceptibility\nmew_r = 1 + chi; #Relative permeability of ferromagnetic material\n\n#Result\nprint \"The relative permeability of ferromagnetic material is\",mew_r",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "H = 200; #Field strength to which the ferromagnetic material is subjected(A/m)\n",
+ "M = 3100; #Magnetisation of the ferromagnetic material(A/m)\n",
+ "\n",
+ "#Calculation\n",
+ "chi = M/H; #Magnetic susceptibility\n",
+ "mew_r = 1 + chi; #Relative permeability of ferromagnetic material\n",
+ "\n",
+ "#Result\n",
+ "print \"The relative permeability of ferromagnetic material is\",mew_r"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The relative permeability of ferromagnetic material is 16.5\n"
+ "text": [
+ "The relative permeability of ferromagnetic material is 16.5\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +110,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.3, Page number 307"
+ "source": [
+ "Example number 14.3, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative permeability\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nH = 300; #Field strength to which the ferromagnetic material is subjected(A/m)\nM = 4400; #Magnetisation of the ferromagnetic material(A/m)\n\n#Calculation\nchi = M/H; #Magnetic susceptibility\nmew_r = 1 + chi; #Relative permeability of ferromagnetic material\nmew_r = math.ceil(mew_r*100)/100; #rounding off the value of mew_r to 2 decimals\n\n#Result\nprint \"The relative permeability of ferromagnetic material is\",mew_r\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "H = 300; #Field strength to which the ferromagnetic material is subjected(A/m)\n",
+ "M = 4400; #Magnetisation of the ferromagnetic material(A/m)\n",
+ "\n",
+ "#Calculation\n",
+ "chi = M/H; #Magnetic susceptibility\n",
+ "mew_r = 1 + chi; #Relative permeability of ferromagnetic material\n",
+ "mew_r = math.ceil(mew_r*100)/100; #rounding off the value of mew_r to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The relative permeability of ferromagnetic material is\",mew_r\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The relative permeability of ferromagnetic material is 15.67\n"
+ "text": [
+ "The relative permeability of ferromagnetic material is 15.67\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +153,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.4, Page number 307"
+ "source": [
+ "Example number 14.4, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetisation and flux density\n\n#importing modules\nimport math\n\n#Variable declaration\nmew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\nH = 10000; #Field strength to which the diamagnetic material is subjected(A/m)\nchi = -0.4*10**-5; #Magnetic susceptibility\n\n#Calculation\nM = chi*H; #Magnetisation of the diamagnetic material(A/m)\nB = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\nB = math.ceil(B*10**4)/10**4; #rounding off the value of B to 4 decimals\n\n#Result\nprint \"The magnetisation of diamagnetic material is\",M, \"A/m\"\nprint \"The magnetic flux density of diamagnetic material is\",B, \"T\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n",
+ "H = 10000; #Field strength to which the diamagnetic material is subjected(A/m)\n",
+ "chi = -0.4*10**-5; #Magnetic susceptibility\n",
+ "\n",
+ "#Calculation\n",
+ "M = chi*H; #Magnetisation of the diamagnetic material(A/m)\n",
+ "B = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\n",
+ "B = math.ceil(B*10**4)/10**4; #rounding off the value of B to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The magnetisation of diamagnetic material is\",M, \"A/m\"\n",
+ "print \"The magnetic flux density of diamagnetic material is\",B, \"T\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The magnetisation of diamagnetic material is -0.04 A/m\nThe magnetic flux density of diamagnetic material is 0.0126 T\n"
+ "text": [
+ "The magnetisation of diamagnetic material is -0.04 A/m\n",
+ "The magnetic flux density of diamagnetic material is 0.0126 T\n"
+ ]
}
],
"prompt_number": 8
@@ -101,19 +198,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.5, Page number 307"
+ "source": [
+ "Example number 14.5, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetisation, relative permeability and flux density\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nmew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\nH = 1.2*10**5; #Field strength to which the diamagnetic material is subjected(A/m)\nchi = -4.2*10**-6; #Magnetic susceptibility\n\n#Calculation\nM = chi*H; #Magnetisation of the diamagnetic material(A/m)\nB = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\nB = math.ceil(B*10**3)/10**3; #rounding off the value of B to 3 decimals\nmew_r = M/H + 1; #The relative permeability of diamagnetic material\nmew_r = math.ceil(mew_r*10**6)/10**6; #rounding off the value of mew_r to 6 decimals\n\n#Result\nprint \"The magnetisation of diamagnetic material is\",M, \"A/m\"\nprint \"The magnetic flux density of diamagnetic material is\",B, \"T\"\nprint \"The relative permeability of diamagnetic material is\",mew_r\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n",
+ "H = 1.2*10**5; #Field strength to which the diamagnetic material is subjected(A/m)\n",
+ "chi = -4.2*10**-6; #Magnetic susceptibility\n",
+ "\n",
+ "#Calculation\n",
+ "M = chi*H; #Magnetisation of the diamagnetic material(A/m)\n",
+ "B = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\n",
+ "B = math.ceil(B*10**3)/10**3; #rounding off the value of B to 3 decimals\n",
+ "mew_r = M/H + 1; #The relative permeability of diamagnetic material\n",
+ "mew_r = math.ceil(mew_r*10**6)/10**6; #rounding off the value of mew_r to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The magnetisation of diamagnetic material is\",M, \"A/m\"\n",
+ "print \"The magnetic flux density of diamagnetic material is\",B, \"T\"\n",
+ "print \"The relative permeability of diamagnetic material is\",mew_r\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The magnetisation of diamagnetic material is -0.504 A/m\nThe magnetic flux density of diamagnetic material is 0.151 T\nThe relative permeability of diamagnetic material is 0.999996\n"
+ "text": [
+ "The magnetisation of diamagnetic material is -0.504 A/m\n",
+ "The magnetic flux density of diamagnetic material is 0.151 T\n",
+ "The relative permeability of diamagnetic material is 0.999996\n"
+ ]
}
],
"prompt_number": 10
@@ -122,19 +248,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.6, Page number 308"
+ "source": [
+ "Example number 14.6, Page number 308"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mean radius of the atom\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nchi = 5.6*10**-6; #Magnetic susceptibility of diamagnetic material\nm = 9.1*10**-31; #Mass of an electron(kg)\nmew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\nZ = 1; #Atomic number\ne = 1.6*10**-19; #Electronic charge(C)\na = 2.53; #Lattice parameter of bcc structure(A)\n\n#Calculation\na = a*10**-10; #Lattice parameter of bcc structure(m)\nN = 2/a**3; #The number of electrons per unit volume(per metre cube)\nr = math.sqrt(chi*6*m/(mew_0*Z*e**2*N)); #Mean radius of body centered cubic structure(m)\nr = r*10**10; #Mean radius of body centered cubic structure(A)\nr = math.ceil(r*100)/100; #rounding off the value of r to 2 decimals\n\n#Result\nprint \"The mean radius of body centered cubic structure is\",r, \"A\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "chi = 5.6*10**-6; #Magnetic susceptibility of diamagnetic material\n",
+ "m = 9.1*10**-31; #Mass of an electron(kg)\n",
+ "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n",
+ "Z = 1; #Atomic number\n",
+ "e = 1.6*10**-19; #Electronic charge(C)\n",
+ "a = 2.53; #Lattice parameter of bcc structure(A)\n",
+ "\n",
+ "#Calculation\n",
+ "a = a*10**-10; #Lattice parameter of bcc structure(m)\n",
+ "N = 2/a**3; #The number of electrons per unit volume(per metre cube)\n",
+ "r = math.sqrt(chi*6*m/(mew_0*Z*e**2*N)); #Mean radius of body centered cubic structure(m)\n",
+ "r = r*10**10; #Mean radius of body centered cubic structure(A)\n",
+ "r = math.ceil(r*100)/100; #rounding off the value of r to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The mean radius of body centered cubic structure is\",r, \"A\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The mean radius of body centered cubic structure is 0.88 A\n"
+ "text": [
+ "The mean radius of body centered cubic structure is 0.88 A\n"
+ ]
}
],
"prompt_number": 11
@@ -143,19 +297,55 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 14.7, Page number 308"
+ "source": [
+ "Example number 14.7, Page number 308"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetic susceptibility and magnetisation\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nmew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\nN_A = 6.02*10**26; #Avogadro's number(per kmol)\nrho = 4370; #Density of paramegnetic salt(kg/metre cube)\nM = 168.5; #Molecular weight of paramagnetic salt(g/mol)\nT = 27; #Temperature of paramagnetic salt(C)\nH = 2*10**5; #Field strength to which the paramagnetic salt is subjected(A/m)\nmew_B = 9.27*10**-24; #Bohr's magneton(Am**2)\np = 2; #Number of Bohr magnetons per molecule\nk = 1.38*10**-23; #Boltzmann constant(J/K)\n\n#Calculation\nT = T+273; #Temperature of paramagnetic salt(K)\nN = rho*N_A/M; #Total density of atoms in the paramagnetic salt(per meter cube)\nchi_para = mew_0*N*p**2*mew_B**2/(3*k*T); #Magnetic susceptibility of paramagnetic salt\nchi_para = chi_para*10**4;\nchi_para = math.ceil(chi_para*10**2)/10**2; #rounding off the value of chi_para to 2 decimals\nM = chi*H; #Magnetisation of paramagnetic salt(A/m)\nM = math.ceil(M*10)/10; #rounding off the value of M to 1 decimal\n\n#Result\nprint \"The magnetic susceptibility of paramagnetic salt is\",chi_para,\"*10**-4\"\nprint \"The magnetisation of paramagnetic salt is\",M, \"A/m\"\n\n#answer for magnetisation is not given in the textbook",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n",
+ "N_A = 6.02*10**26; #Avogadro's number(per kmol)\n",
+ "rho = 4370; #Density of paramegnetic salt(kg/metre cube)\n",
+ "M = 168.5; #Molecular weight of paramagnetic salt(g/mol)\n",
+ "T = 27; #Temperature of paramagnetic salt(C)\n",
+ "H = 2*10**5; #Field strength to which the paramagnetic salt is subjected(A/m)\n",
+ "mew_B = 9.27*10**-24; #Bohr's magneton(Am**2)\n",
+ "p = 2; #Number of Bohr magnetons per molecule\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "\n",
+ "#Calculation\n",
+ "T = T+273; #Temperature of paramagnetic salt(K)\n",
+ "N = rho*N_A/M; #Total density of atoms in the paramagnetic salt(per meter cube)\n",
+ "chi_para = mew_0*N*p**2*mew_B**2/(3*k*T); #Magnetic susceptibility of paramagnetic salt\n",
+ "chi_para = chi_para*10**4;\n",
+ "chi_para = math.ceil(chi_para*10**2)/10**2; #rounding off the value of chi_para to 2 decimals\n",
+ "M = chi*H; #Magnetisation of paramagnetic salt(A/m)\n",
+ "M = math.ceil(M*10)/10; #rounding off the value of M to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The magnetic susceptibility of paramagnetic salt is\",chi_para,\"*10**-4\"\n",
+ "print \"The magnetisation of paramagnetic salt is\",M, \"A/m\"\n",
+ "\n",
+ "#answer for magnetisation is not given in the textbook"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The magnetic susceptibility of paramagnetic salt is 5.43 *10**-4\nThe magnetisation of paramagnetic salt is 1.2 A/m\n"
+ "text": [
+ "The magnetic susceptibility of paramagnetic salt is 5.43 *10**-4\n",
+ "The magnetisation of paramagnetic salt is 1.2 A/m\n"
+ ]
}
],
"prompt_number": 14
@@ -163,7 +353,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter15_1.ipynb b/Engineering_Physics_Aruldhas/Chapter15_1.ipynb
index cfabc2c6..7bc435f1 100644
--- a/Engineering_Physics_Aruldhas/Chapter15_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter15_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter15"
+ "name": "",
+ "signature": "sha256:2292e5def6e87e01b63e6b748e8fe3955bb5676e5121c51dac319cd9531c4833"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,49 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "15: Thermal Properties "
+ "source": [
+ "15: Thermal Properties "
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.1, Page number 323"
+ "source": [
+ "Example number 15.1, Page number 323"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Debye temperature\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\nf_D = 64*10**11; #Debye frequency for Al(Hz)\n\n#Calculation\ntheta_D = h*f_D/k; #Debye temperature(K)\ntheta_D = math.ceil(theta_D*10)/10; #rounding off the value of theta_D to 1 decimal\n\n#Result\nprint \"The Debye temperature of aluminium is\",theta_D, \"K\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "f_D = 64*10**11; #Debye frequency for Al(Hz)\n",
+ "\n",
+ "#Calculation\n",
+ "theta_D = h*f_D/k; #Debye temperature(K)\n",
+ "theta_D = math.ceil(theta_D*10)/10; #rounding off the value of theta_D to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The Debye temperature of aluminium is\",theta_D, \"K\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Debye temperature of aluminium is 307.3 K\n"
+ "text": [
+ "The Debye temperature of aluminium is 307.3 K\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +63,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.2, Page number 323"
+ "source": [
+ "Example number 15.2, Page number 323"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lattice specific heat\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nN = 6.02*10**26; #Avogadro's number(per kmol)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\nf_D = 40.5*10**12; #Debye frequency for Al(Hz)\nT = 30; #Temperature of carbon(Ks)\n\n#Calculation\ntheta_D = h*f_D/k; #Debye temperature(K)\nC_l = 12/5*math.pi**4*N*k*(T/theta_D)**3; #Lattice specific heat of carbon(J/k-mol/K)\nC_l = math.ceil(C_l*10**3)/10**3; #rounding off the value of C_l to 3 decimals\n\n#Result\nprint \"The lattice specific heat of carbon is\",C_l, \"J/k-mol/K\"\n\n#answer given in the book is wrong in the 2nd decimal",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "N = 6.02*10**26; #Avogadro's number(per kmol)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "f_D = 40.5*10**12; #Debye frequency for Al(Hz)\n",
+ "T = 30; #Temperature of carbon(Ks)\n",
+ "\n",
+ "#Calculation\n",
+ "theta_D = h*f_D/k; #Debye temperature(K)\n",
+ "C_l = 12/5*math.pi**4*N*k*(T/theta_D)**3; #Lattice specific heat of carbon(J/k-mol/K)\n",
+ "C_l = math.ceil(C_l*10**3)/10**3; #rounding off the value of C_l to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The lattice specific heat of carbon is\",C_l, \"J/k-mol/K\"\n",
+ "\n",
+ "#answer given in the book is wrong in the 2nd decimal"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The lattice specific heat of carbon is 7.132 J/k-mol/K\n"
+ "text": [
+ "The lattice specific heat of carbon is 7.132 J/k-mol/K\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +111,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.3, Page number 323"
+ "source": [
+ "Example number 15.3, Page number 323"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To show that the frequency falls in the infrared region\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\ntheta_E = 1990; #Einstein temperature of Cu(K)\n\n#Calculation\nf_E = k*theta_E/h; #Einstein frequency for Cu(K)\n\n#Result\nprint \"The Einstein frequency for Cu is\",f_E, \"Hz\"\nprint \"The frequency falls in the near infrared region\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "theta_E = 1990; #Einstein temperature of Cu(K)\n",
+ "\n",
+ "#Calculation\n",
+ "f_E = k*theta_E/h; #Einstein frequency for Cu(K)\n",
+ "\n",
+ "#Result\n",
+ "print \"The Einstein frequency for Cu is\",f_E, \"Hz\"\n",
+ "print \"The frequency falls in the near infrared region\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Einstein frequency for Cu is 4.14458194989e+13 Hz\nThe frequency falls in the near infrared region\n"
+ "text": [
+ "The Einstein frequency for Cu is 4.14458194989e+13 Hz\n",
+ "The frequency falls in the near infrared region\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +155,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.4, Page number 323"
+ "source": [
+ "Example number 15.4, Page number 323"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic and lattice heat capacities\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nN = 6.02*10**23; #Avogadro's number(per mol)\nT = 0.05; #Temperature of Cu(K)\nE_F = 7; #Fermi energy of Cu(eV)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\ntheta_D = 348; #Debye temperature of Cu(K)\n\n#Calculation\nC_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Cu(J/mol/K)\nC_V = (12/5)*math.pi**4*(N*k)*(T/theta_D)**3; #Lattice heat capacity of Cu(J/mol/K)\n\n#Result\nprint \"The electronic heat capacity of Cu is\",C_e, \"J/mol/K\"\nprint \"The lattice heat capacity of Cu is\",C_V, \"J/mol/K\"\n\n#answer for lattice heat capacity given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "N = 6.02*10**23; #Avogadro's number(per mol)\n",
+ "T = 0.05; #Temperature of Cu(K)\n",
+ "E_F = 7; #Fermi energy of Cu(eV)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "theta_D = 348; #Debye temperature of Cu(K)\n",
+ "\n",
+ "#Calculation\n",
+ "C_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Cu(J/mol/K)\n",
+ "C_V = (12/5)*math.pi**4*(N*k)*(T/theta_D)**3; #Lattice heat capacity of Cu(J/mol/K)\n",
+ "\n",
+ "#Result\n",
+ "print \"The electronic heat capacity of Cu is\",C_e, \"J/mol/K\"\n",
+ "print \"The lattice heat capacity of Cu is\",C_V, \"J/mol/K\"\n",
+ "\n",
+ "#answer for lattice heat capacity given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The electronic heat capacity of Cu is 2.52566877726e-05 J/mol/K\nThe lattice heat capacity of Cu is 5.76047891492e-09 J/mol/K\n"
+ "text": [
+ "The electronic heat capacity of Cu is 2.52566877726e-05 J/mol/K\n",
+ "The lattice heat capacity of Cu is 5.76047891492e-09 J/mol/K\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +206,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.5, Page number 324"
+ "source": [
+ "Example number 15.5, Page number 324"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the heat capacity\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nT = 1; #For simplicity assume temperature to be unity(K)\nR = 1; #For simplicity assume molar gas constant to be unity(J/mol/K)\ntheta_E = T; #Einstein temperature(K)\n\n#Calculation\nC_V = 3*R*(theta_E/T)**2*math.exp(theta_E/T)/(math.exp(theta_E/T)-1)**2; #Einstein lattice specific heat(J/mol/K)\nC_V = C_V/3;\nC_V = math.ceil(C_V*10**3)/10**3; #rounding off the value of C_V to 3 decimals\n\n#Result\nprint \"The Einstein lattice specific heat is\",C_V, \"X 3R\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "T = 1; #For simplicity assume temperature to be unity(K)\n",
+ "R = 1; #For simplicity assume molar gas constant to be unity(J/mol/K)\n",
+ "theta_E = T; #Einstein temperature(K)\n",
+ "\n",
+ "#Calculation\n",
+ "C_V = 3*R*(theta_E/T)**2*math.exp(theta_E/T)/(math.exp(theta_E/T)-1)**2; #Einstein lattice specific heat(J/mol/K)\n",
+ "C_V = C_V/3;\n",
+ "C_V = math.ceil(C_V*10**3)/10**3; #rounding off the value of C_V to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The Einstein lattice specific heat is\",C_V, \"X 3R\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Einstein lattice specific heat is 0.921 X 3R\n"
+ "text": [
+ "The Einstein lattice specific heat is 0.921 X 3R\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +250,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 15.6, Page number 324"
+ "source": [
+ "Example number 15.6, Page number 324"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the molar electronic heat capacity\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nv = 2; #Valency of Zn atom\nN = v*6.02*10**23; #Avogadro's number(per mol)\nT = 300; #Temperature of Zn(K)\nE_F = 9.38; #Fermi energy of Zn(eV)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\nh = 6.626*10**-34; #Planck's constant(Js)\n\n#Calculation\nN = v*6.02*10**23; #Avogadro's number(per mol)\nC_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Zn(J/mol/K)\nC_e = math.ceil(C_e*10**4)/10**4; #rounding off the value of C_e to 4 decimals\n\n#Result\nprint \"The molar electronic heat capacity of zinc is\",C_e, \"J/mol/K\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "v = 2; #Valency of Zn atom\n",
+ "N = v*6.02*10**23; #Avogadro's number(per mol)\n",
+ "T = 300; #Temperature of Zn(K)\n",
+ "E_F = 9.38; #Fermi energy of Zn(eV)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "\n",
+ "#Calculation\n",
+ "N = v*6.02*10**23; #Avogadro's number(per mol)\n",
+ "C_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Zn(J/mol/K)\n",
+ "C_e = math.ceil(C_e*10**4)/10**4; #rounding off the value of C_e to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The molar electronic heat capacity of zinc is\",C_e, \"J/mol/K\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The molar electronic heat capacity of zinc is 0.2262 J/mol/K\n"
+ "text": [
+ "The molar electronic heat capacity of zinc is 0.2262 J/mol/K\n"
+ ]
}
],
"prompt_number": 8
@@ -142,7 +297,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter17_1.ipynb b/Engineering_Physics_Aruldhas/Chapter17_1.ipynb
index f0df2691..891f2d43 100644
--- a/Engineering_Physics_Aruldhas/Chapter17_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter17_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter17"
+ "name": "",
+ "signature": "sha256:d4400dbe9ddae05e5ab81173c9df50e2e9dde25edf961941bd9c8dc15f5a6fe1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,51 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "17: Ultrasonics"
+ "source": [
+ "17: Ultrasonics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 17.1, Page number 352"
+ "source": [
+ "Example number 17.1, Page number 352"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the thickness of vibrating quartz\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nf = 3; #Fundamental vibrational frequency of quartz crystal(MHz)\nY = 7.9*10**10; #Young's modulus of quartz(N/m**2)\nrho = 2650; #Density of quartz(kg/m**3)\n\n#Calculation\nf = f*10**6; #Fundamental vibrational frequency of quartz crystal(Hz)\nl = 1/(2*f)*math.sqrt(Y/rho); #Thickness of vibrating quartz at resonance(m)\nl = l*10**3; #Thickness of vibrating quartz at resonance(mm)\nl = math.ceil(l*100)/100; #rounding off the value of l to 2 decimals\n\n#Result\nprint \"The thickness of vibrating quartz at resonance is\",l, \"mm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "f = 3; #Fundamental vibrational frequency of quartz crystal(MHz)\n",
+ "Y = 7.9*10**10; #Young's modulus of quartz(N/m**2)\n",
+ "rho = 2650; #Density of quartz(kg/m**3)\n",
+ "\n",
+ "#Calculation\n",
+ "f = f*10**6; #Fundamental vibrational frequency of quartz crystal(Hz)\n",
+ "l = 1/(2*f)*math.sqrt(Y/rho); #Thickness of vibrating quartz at resonance(m)\n",
+ "l = l*10**3; #Thickness of vibrating quartz at resonance(mm)\n",
+ "l = math.ceil(l*100)/100; #rounding off the value of l to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The thickness of vibrating quartz at resonance is\",l, \"mm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The thickness of vibrating quartz at resonance is 0.91 mm\n"
+ "text": [
+ "The thickness of vibrating quartz at resonance is 0.91 mm\n"
+ ]
}
],
"prompt_number": 1
@@ -37,7 +64,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter18_1.ipynb b/Engineering_Physics_Aruldhas/Chapter18_1.ipynb
index aca20375..553fe50f 100644
--- a/Engineering_Physics_Aruldhas/Chapter18_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter18_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter18"
+ "name": "",
+ "signature": "sha256:c2afbaf4a700c8f5f48d1946053d882d86bb1b0270a68b2bbedc639668ea43be"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,51 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "18: Acoustics of Buildings"
+ "source": [
+ "18: Acoustics of Buildings"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.1, Page number 361"
+ "source": [
+ "Example number 18.1, Page number 361"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the output power of the sound source\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nr = 200; #Distance of the point of reduction from the source(m)\nI_0 = 10**-12; #Final intensity of sound(W/m**2)\nI_f = 60; #Intensity gain of sound at the point of reduction(dB)\n\n#Calculation\n#As A_I = 10*log10(I/I_0), solving for I\nI = I_0*10**(I_f/10); #Initial Intensity of sound(W/m**2)\nP = 4*math.pi*r**2*I; #Output power of the sound source(W)\nP = math.ceil(P*100)/100; #rounding off the value of P to 2 decimals\n\n#Result\nprint \"The output power of the sound source is\",P, \"W\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "r = 200; #Distance of the point of reduction from the source(m)\n",
+ "I_0 = 10**-12; #Final intensity of sound(W/m**2)\n",
+ "I_f = 60; #Intensity gain of sound at the point of reduction(dB)\n",
+ "\n",
+ "#Calculation\n",
+ "#As A_I = 10*log10(I/I_0), solving for I\n",
+ "I = I_0*10**(I_f/10); #Initial Intensity of sound(W/m**2)\n",
+ "P = 4*math.pi*r**2*I; #Output power of the sound source(W)\n",
+ "P = math.ceil(P*100)/100; #rounding off the value of P to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The output power of the sound source is\",P, \"W\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The output power of the sound source is 0.51 W\n"
+ "text": [
+ "The output power of the sound source is 0.51 W\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +65,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.2, Page number 361"
+ "source": [
+ "Example number 18.2, Page number 361"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the change in sound level\n\n#importing modules\nimport math\nfrom __future__ import division\nimport numpy as np\n\n#Variable declaration\nI1 = 1; #For simplicity assume first intensity level to be unity(W/m**2)\n\n#Calculation\nI2 = 2*I1; #Intensity level after doubling(W/m**2)\ndA_I = 10*np.log10(I2/I1); #Difference in gain level(dB)\n\n#Result\nprint \"The sound intensity level is increased by\",int(dA_I), \"dB\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "I1 = 1; #For simplicity assume first intensity level to be unity(W/m**2)\n",
+ "\n",
+ "#Calculation\n",
+ "I2 = 2*I1; #Intensity level after doubling(W/m**2)\n",
+ "dA_I = 10*np.log10(I2/I1); #Difference in gain level(dB)\n",
+ "\n",
+ "#Result\n",
+ "print \"The sound intensity level is increased by\",int(dA_I), \"dB\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sound intensity level is increased by 3 dB\n"
+ "text": [
+ "The sound intensity level is increased by 3 dB\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +107,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.3, Page number 361"
+ "source": [
+ "Example number 18.3, Page number 361"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the total absorption of sound in the hall\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nV = 8000; #Volume of the hall(m**3)\nT = 1.5; #Reverbration time of the hall(s)\n\n#Calculation\nalpha_s = 0.167*V/T; #Sabine Formula giving total absorption of sound in the hall(OWU)\nalpha_s = math.ceil(alpha_s*10)/10; #rounding off the value of alpha_s to 1 decimal\n\n#Result\nprint \"The total absorption of sound in the hall is\",alpha_s, \"OWU\"\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 8000; #Volume of the hall(m**3)\n",
+ "T = 1.5; #Reverbration time of the hall(s)\n",
+ "\n",
+ "#Calculation\n",
+ "alpha_s = 0.167*V/T; #Sabine Formula giving total absorption of sound in the hall(OWU)\n",
+ "alpha_s = math.ceil(alpha_s*10)/10; #rounding off the value of alpha_s to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The total absorption of sound in the hall is\",alpha_s, \"OWU\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The total absorption of sound in the hall is 890.7 OWU\n"
+ "text": [
+ "The total absorption of sound in the hall is 890.7 OWU\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +148,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.4, Page number 362"
+ "source": [
+ "Example number 18.4, Page number 362"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the average absorption coefficient of the surfaces\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nV = 25*20*8; #Volume of the hall(m**3)\nT = 4; #Reverbration time of the hall(s)\n\n#Calculation\nS = 2*(25*20+25*8+20*8); #Total surface area of the hall(m**2)\nalpha = 0.167*V/(T*S); #Sabine Formule giving total absorption in the hall(OWU)\nalpha = math.ceil(alpha*10**4)/10**4; #rounding off the value of alpha to 4 decimals\n\n#Result\nprint \"The average absorption coefficient of the surfaces is\",alpha, \"OWU/m**2\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 25*20*8; #Volume of the hall(m**3)\n",
+ "T = 4; #Reverbration time of the hall(s)\n",
+ "\n",
+ "#Calculation\n",
+ "S = 2*(25*20+25*8+20*8); #Total surface area of the hall(m**2)\n",
+ "alpha = 0.167*V/(T*S); #Sabine Formule giving total absorption in the hall(OWU)\n",
+ "alpha = math.ceil(alpha*10**4)/10**4; #rounding off the value of alpha to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The average absorption coefficient of the surfaces is\",alpha, \"OWU/m**2\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The average absorption coefficient of the surfaces is 0.0971 OWU/m**2\n"
+ "text": [
+ "The average absorption coefficient of the surfaces is 0.0971 OWU/m**2\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +192,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.5, Page number 362"
+ "source": [
+ "Example number 18.5, Page number 362"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the reverbration time for the hall\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nV = 475; #Volume of the hall(m**3)\nA_f = 100; #Area of the floor(m**2)\nA_c = 100; #Area of the ceiling(m**2)\nA_w = 200; #Area of the wall(m**2)\nalpha_w = 0.025; #Absorption coefficients of the wall(OWU/m**2)\nalpha_c = 0.02; #Absorption coefficients of the ceiling(OWU/m**2)\nalpha_f = 0.55; #Absorption coefficients of the floor(OWU/m**2)\n\n#Calculation\nalpha_s = (A_w*alpha_w)+(A_c*alpha_c)+(A_f*alpha_f); \nT = 0.167*V/alpha_s; #Sabine Formula for reverbration time(s)\nT = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n\n#Result\nprint \"The reverbration time for the hall is\",T, \"s\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 475; #Volume of the hall(m**3)\n",
+ "A_f = 100; #Area of the floor(m**2)\n",
+ "A_c = 100; #Area of the ceiling(m**2)\n",
+ "A_w = 200; #Area of the wall(m**2)\n",
+ "alpha_w = 0.025; #Absorption coefficients of the wall(OWU/m**2)\n",
+ "alpha_c = 0.02; #Absorption coefficients of the ceiling(OWU/m**2)\n",
+ "alpha_f = 0.55; #Absorption coefficients of the floor(OWU/m**2)\n",
+ "\n",
+ "#Calculation\n",
+ "alpha_s = (A_w*alpha_w)+(A_c*alpha_c)+(A_f*alpha_f); \n",
+ "T = 0.167*V/alpha_s; #Sabine Formula for reverbration time(s)\n",
+ "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The reverbration time for the hall is\",T, \"s\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The reverbration time for the hall is 1.28 s\n"
+ "text": [
+ "The reverbration time for the hall is 1.28 s\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +240,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 18.6, Page number 362"
+ "source": [
+ "Example number 18.6, Page number 362"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the reverbration time for the hall\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nI0 = 1; #For simplicity assume initial sound intensity to be unity(W/m**2)\nA_I1 = 80; #First intensity gain of sound(dB)\nA_I2 = 70; #Second intensity gain of sound(dB)\n\n#Calculation\n#As A_I = 10*log10(I/I_0), solving for I1 and I2\nI1 = 10**(A_I1/10)*I0; #First intensity of sound(W/m**2)\nI2 = 10**(A_I2/10)*I0; #Second intensity of sound(W/m**2)\nI = I1 + I2; #Resultant intensity level of sound(W/m**2)\nA_I = 10*np.log10(I/I0); #Intensity gain of resultant sound(dB)\nA_I = math.ceil(A_I*10**3)/10**3; #rounding off the value of A_I to 3 decimals\n\n#Result\nprint \"The intensity gain of resultant sound is\",A_I, \"dB\"\n\n#answer given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "I0 = 1; #For simplicity assume initial sound intensity to be unity(W/m**2)\n",
+ "A_I1 = 80; #First intensity gain of sound(dB)\n",
+ "A_I2 = 70; #Second intensity gain of sound(dB)\n",
+ "\n",
+ "#Calculation\n",
+ "#As A_I = 10*log10(I/I_0), solving for I1 and I2\n",
+ "I1 = 10**(A_I1/10)*I0; #First intensity of sound(W/m**2)\n",
+ "I2 = 10**(A_I2/10)*I0; #Second intensity of sound(W/m**2)\n",
+ "I = I1 + I2; #Resultant intensity level of sound(W/m**2)\n",
+ "A_I = 10*np.log10(I/I0); #Intensity gain of resultant sound(dB)\n",
+ "A_I = math.ceil(A_I*10**3)/10**3; #rounding off the value of A_I to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The intensity gain of resultant sound is\",A_I, \"dB\"\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The intensity gain of resultant sound is 80.414 dB\n"
+ "text": [
+ "The intensity gain of resultant sound is 80.414 dB\n"
+ ]
}
],
"prompt_number": 7
@@ -142,7 +288,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter1_1.ipynb b/Engineering_Physics_Aruldhas/Chapter1_1.ipynb
index c487a981..7872d7ab 100644
--- a/Engineering_Physics_Aruldhas/Chapter1_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter1_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter1"
+ "name": "",
+ "signature": "sha256:381979e560591138195a6149a5aa889c9c7e2cfe41c7a482a0ea4bbe4c24f150"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,52 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "1: Oscillations and Waves"
+ "source": [
+ "1: Oscillations and Waves"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.1, Page number 23"
+ "source": [
+ "Example number 1.1, Page number 23"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the period of motion\n\n#import modules\nimport math\n\n#Variable declaration\nS=4; #SHM described by a particle(cm)\nx=0; #mean position\nv=12; #velocity at mean position(cm/s)\n\n#Calculation\nA=S/2; #amplitude of motion(cm)\nomega=v/A; #angular frequency(sec-1)\nT=(2*math.pi)/omega; #time period(sec)\nT=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint \"time period of motion is\",T, \"sec\"\nprint \"time period of motion is pi/3 sec\"",
+ "input": [
+ "\n",
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "S=4; #SHM described by a particle(cm)\n",
+ "x=0; #mean position\n",
+ "v=12; #velocity at mean position(cm/s)\n",
+ "\n",
+ "#Calculation\n",
+ "A=S/2; #amplitude of motion(cm)\n",
+ "omega=v/A; #angular frequency(sec-1)\n",
+ "T=(2*math.pi)/omega; #time period(sec)\n",
+ "T=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"time period of motion is\",T, \"sec\"\n",
+ "print \"time period of motion is pi/3 sec\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "time period of motion is 1.048 sec\ntime period of motion is pi/3 sec\n"
+ "text": [
+ "time period of motion is 1.048 sec\n",
+ "time period of motion is pi/3 sec\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +66,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.2, Page number 23"
+ "source": [
+ "Example number 1.2, Page number 23"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the acceleration and maximum velocity\n\n#import modules\nimport math\n\n#Variable declaration\nT=0.1; #time period(sec)\nA=4; #amplitude of motion(cm)\nx=0.2; #distance from mean position(cm)\n\n#Calculation\nomega=(2*math.pi)/T; #angular frequency(sec-1)\na=(omega**2)*x; #acceleration(cm/sec^2)\na=math.ceil(a*10**2)/10**2; #rounding off to 2 decimals\n#maximum velocity is when particle is in the mean position\nv_max=omega*A; #maximum velocity(cm/sec)\nv_max=math.ceil(v_max*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint \"acceleration is\",a, \"cm/sec^2\"\nprint \"maximum velocity is\",v_max, \"cm/sec\"\n\n#answers given in the book are wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T=0.1; #time period(sec)\n",
+ "A=4; #amplitude of motion(cm)\n",
+ "x=0.2; #distance from mean position(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "omega=(2*math.pi)/T; #angular frequency(sec-1)\n",
+ "a=(omega**2)*x; #acceleration(cm/sec^2)\n",
+ "a=math.ceil(a*10**2)/10**2; #rounding off to 2 decimals\n",
+ "#maximum velocity is when particle is in the mean position\n",
+ "v_max=omega*A; #maximum velocity(cm/sec)\n",
+ "v_max=math.ceil(v_max*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"acceleration is\",a, \"cm/sec^2\"\n",
+ "print \"maximum velocity is\",v_max, \"cm/sec\"\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "acceleration is 789.57 cm/sec^2\nmaximum velocity is 251.33 cm/sec\n"
+ "text": [
+ "acceleration is 789.57 cm/sec^2\n",
+ "maximum velocity is 251.33 cm/sec\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +116,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.3, Page number 24"
+ "source": [
+ "Example number 1.3, Page number 24"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the damping constant\n\n#import modules\nimport math\nimport numpy as np\n\n#Variable declaration\nA1 = 40; #First amplitude of oscillation(cm)\nAn_plus_1 = 4; #Amplitude after 100 oscillations(cm)\nn = 100; #Number of oscillations\nT = 2.5; #Time period of oscillations(s)\n\n#Calculation\nt = T/4; #Time taken to reach the first amplitude from the mean position(s)\n#Now A1 = x0*math.exp(-lambda*t) and An_plus_1 = x0*math.exp(-lambda*(t+nT))\n#A1/An_plus_1 = math.exp(n*lambda*T)\nx=A1/An_plus_1;\nlamda=np.log(x)/(n*T); #Damping constant(per sec)\nlamda=lamda*10**2;\nlamda=math.ceil(lamda*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint \"Damping constant is\",lamda,\"*10**-2 per sec\"",
+ "input": [
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "A1 = 40; #First amplitude of oscillation(cm)\n",
+ "An_plus_1 = 4; #Amplitude after 100 oscillations(cm)\n",
+ "n = 100; #Number of oscillations\n",
+ "T = 2.5; #Time period of oscillations(s)\n",
+ "\n",
+ "#Calculation\n",
+ "t = T/4; #Time taken to reach the first amplitude from the mean position(s)\n",
+ "#Now A1 = x0*math.exp(-lambda*t) and An_plus_1 = x0*math.exp(-lambda*(t+nT))\n",
+ "#A1/An_plus_1 = math.exp(n*lambda*T)\n",
+ "x=A1/An_plus_1;\n",
+ "lamda=np.log(x)/(n*T); #Damping constant(per sec)\n",
+ "lamda=lamda*10**2;\n",
+ "lamda=math.ceil(lamda*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"Damping constant is\",lamda,\"*10**-2 per sec\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Damping constant is 0.922 *10**-2 per sec\n"
+ "text": [
+ "Damping constant is 0.922 *10**-2 per sec\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +164,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.4, Page number 24"
+ "source": [
+ "Example number 1.4, Page number 24"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the amplitude and period of oscillation\n\n#import modules\nimport math\n\n#Variable declaration\nx1 = 3; #First position of the particle(cm)\nx2 = 4; #Second position of the particle(cm)\nv1 = 16; #Velocity of particle executing SHM at 1st position(cm/s)\nv2 = 12; #Velocity of particle executing SHM at 2nd position (cm/s)\n\n#Calculation\n#As v = omega*sqrt(A**2 - x**2) so\n#(v1/v2)**2=(A**2 - x1**2)/(A**2 - x2**2)\n#RHS gives (A**2-9)/(A**2-16)\n#(v2**2)*(A**2 - x1**2)=(v1**2)*(A**2 - x2**2), on solving we get\nA=math.sqrt((((v1**2)*(x2**2))-((v2**2)*(x1**2)))/((v1**2)-(v2**2))); #amplitude in cm\nomega=v1/math.sqrt(A**2-x1**2); #Angular speed of the particle(per sec)\nT=2*math.pi/omega; #Time period of oscillation(sec)\nT=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint \"The amplitude of SHM is\",A, \"cm\"\nprint \"The time period of oscillation is\",T, \"sec\"",
+ "input": [
+ "\n",
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "x1 = 3; #First position of the particle(cm)\n",
+ "x2 = 4; #Second position of the particle(cm)\n",
+ "v1 = 16; #Velocity of particle executing SHM at 1st position(cm/s)\n",
+ "v2 = 12; #Velocity of particle executing SHM at 2nd position (cm/s)\n",
+ "\n",
+ "#Calculation\n",
+ "#As v = omega*sqrt(A**2 - x**2) so\n",
+ "#(v1/v2)**2=(A**2 - x1**2)/(A**2 - x2**2)\n",
+ "#RHS gives (A**2-9)/(A**2-16)\n",
+ "#(v2**2)*(A**2 - x1**2)=(v1**2)*(A**2 - x2**2), on solving we get\n",
+ "A=math.sqrt((((v1**2)*(x2**2))-((v2**2)*(x1**2)))/((v1**2)-(v2**2))); #amplitude in cm\n",
+ "omega=v1/math.sqrt(A**2-x1**2); #Angular speed of the particle(per sec)\n",
+ "T=2*math.pi/omega; #Time period of oscillation(sec)\n",
+ "T=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The amplitude of SHM is\",A, \"cm\"\n",
+ "print \"The time period of oscillation is\",T, \"sec\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The amplitude of SHM is 5.0 cm\nThe time period of oscillation is 1.571 sec\n"
+ "text": [
+ "The amplitude of SHM is 5.0 cm\n",
+ "The time period of oscillation is 1.571 sec\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +215,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.5, Page number 25"
+ "source": [
+ "Example number 1.5, Page number 25"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the spring constant, amplitude and maximum velocity\n\n#import modules\nimport math\n\n#Variable declaration\nm = 0.3; #Mass attached to the string(kg)\ng = 9.8; #Acceleration due to gravity(m/sec**2)\nx = 0.15; #Stretchness produced in the spring(m)\ns = 0.1; #spring is stretched and released(m)\n\n#Calculation\nF = m*g; #Restoring force acting on the mass(N)\nk = F/x; #Spring constant(N/m)\nA = s; #amplitude equals to the spring stretched and released\nomega = math.sqrt(k/m); #Angular frequency of oscillation(rad per sec)\nv0 = omega*A; #Maximum velocity during the oscillations(m/s)\nv0=math.ceil(v0*100)/100; #rounding off to 2 decimals\n\n#Result\nprint \"The spring constant is\",k, \"N/m\"\nprint \"The amplitude of oscillation is\",A, \"m\"\nprint \"The maximum velocity during oscillations is\",v0, \"m/s\"",
+ "input": [
+ "\n",
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "m = 0.3; #Mass attached to the string(kg)\n",
+ "g = 9.8; #Acceleration due to gravity(m/sec**2)\n",
+ "x = 0.15; #Stretchness produced in the spring(m)\n",
+ "s = 0.1; #spring is stretched and released(m)\n",
+ "\n",
+ "#Calculation\n",
+ "F = m*g; #Restoring force acting on the mass(N)\n",
+ "k = F/x; #Spring constant(N/m)\n",
+ "A = s; #amplitude equals to the spring stretched and released\n",
+ "omega = math.sqrt(k/m); #Angular frequency of oscillation(rad per sec)\n",
+ "v0 = omega*A; #Maximum velocity during the oscillations(m/s)\n",
+ "v0=math.ceil(v0*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The spring constant is\",k, \"N/m\"\n",
+ "print \"The amplitude of oscillation is\",A, \"m\"\n",
+ "print \"The maximum velocity during oscillations is\",v0, \"m/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The spring constant is 19.6 N/m\nThe amplitude of oscillation is 0.1 m\nThe maximum velocity during oscillations is 0.81 m/s\n"
+ "text": [
+ "The spring constant is 19.6 N/m\n",
+ "The amplitude of oscillation is 0.1 m\n",
+ "The maximum velocity during oscillations is 0.81 m/s\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +266,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.6, Page number 25"
+ "source": [
+ "Example number 1.6, Page number 25"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the frequency equivalent of visible region\n\n#import modules\nimport math\n\n#Variable declaration\nlambda1 = 400; #Lower limit of wavelength of visible region(nm)\nlambda2 = 700; #Upper limit of wavelength of visible region(nm)\nc = 3*10**8; #Speed of light in vacuum(m/s)\n\n#Calculation\nlambda1 = lambda1*10**-9 #Lower limit of wavelength(m) \nlambda2 = lambda2*10**-9 #upper limit of wavelength(m) \nnew_1 = c/lambda1; #Upper limit of frequency of visible region(m)\nnew_2 = c/lambda2; #Lower limit of frequency of visible region(m)\n\n#Result\nprint \"The frequency equivalent of 400 nm is\",new_1, \"Hz\"\nprint \"The frequency equivalent of 700 nm is\",new_2, \"Hz\"\n",
+ "input": [
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lambda1 = 400; #Lower limit of wavelength of visible region(nm)\n",
+ "lambda2 = 700; #Upper limit of wavelength of visible region(nm)\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "lambda1 = lambda1*10**-9 #Lower limit of wavelength(m) \n",
+ "lambda2 = lambda2*10**-9 #upper limit of wavelength(m) \n",
+ "new_1 = c/lambda1; #Upper limit of frequency of visible region(m)\n",
+ "new_2 = c/lambda2; #Lower limit of frequency of visible region(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The frequency equivalent of 400 nm is\",new_1, \"Hz\"\n",
+ "print \"The frequency equivalent of 700 nm is\",new_2, \"Hz\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The frequency equivalent of 400 nm is 7.5e+14 Hz\nThe frequency equivalent of 700 nm is 4.28571428571e+14 Hz\n"
+ "text": [
+ "The frequency equivalent of 400 nm is 7.5e+14 Hz\n",
+ "The frequency equivalent of 700 nm is 4.28571428571e+14 Hz\n"
+ ]
}
],
"prompt_number": 9
@@ -143,19 +311,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.7, Page number 26"
+ "source": [
+ "Example number 1.7, Page number 26"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the amplitude, wavelength, frequency and velocity of the wave\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\n#Comparing the standard equation u(x,t) = A*sin(2*%pi(x/lambda-t/T)) with the given equation, we get\nA = 1.5*10**-3; #Amplitude of the sound wave(m)\nlamda = 8; #Wavelength of the sound wave(m)\nT = 1/40; #Time period of the sound wave(s)\n\n#Calculation\nA = A*10**3;\nnew = 1/T; #Frequency of the sound wave(Hz)\nv = new*lamda; #Velocity of the sound wave(m/s)\nT=math.ceil(T*100)/100; #rounding off to 2 decimals\n\n#Result\nprint \"The amplitude of the sound wave is\",A,\"*10**-3 m\"\nprint \"The wavelength of the sound wave is\",lamda, \"m\"\nprint \"The time period of the sound wave is\",T, \"s\"\nprint \"The frequency of the sound wave is\",new, \"Hz\"\nprint \"The velocity of the sound wave is\",v, \"m/s\"",
+ "input": [
+ "\n",
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "#Comparing the standard equation u(x,t) = A*sin(2*%pi(x/lambda-t/T)) with the given equation, we get\n",
+ "A = 1.5*10**-3; #Amplitude of the sound wave(m)\n",
+ "lamda = 8; #Wavelength of the sound wave(m)\n",
+ "T = 1/40; #Time period of the sound wave(s)\n",
+ "\n",
+ "#Calculation\n",
+ "A = A*10**3;\n",
+ "new = 1/T; #Frequency of the sound wave(Hz)\n",
+ "v = new*lamda; #Velocity of the sound wave(m/s)\n",
+ "T=math.ceil(T*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The amplitude of the sound wave is\",A,\"*10**-3 m\"\n",
+ "print \"The wavelength of the sound wave is\",lamda, \"m\"\n",
+ "print \"The time period of the sound wave is\",T, \"s\"\n",
+ "print \"The frequency of the sound wave is\",new, \"Hz\"\n",
+ "print \"The velocity of the sound wave is\",v, \"m/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The amplitude of the sound wave is 1.5 *10**-3 m\nThe wavelength of the sound wave is 8 m\nThe time period of the sound wave is 0.03 s\nThe frequency of the sound wave is 40.0 Hz\nThe velocity of the sound wave is 320.0 m/s\n"
+ "text": [
+ "The amplitude of the sound wave is 1.5 *10**-3 m\n",
+ "The wavelength of the sound wave is 8 m\n",
+ "The time period of the sound wave is 0.03 s\n",
+ "The frequency of the sound wave is 40.0 Hz\n",
+ "The velocity of the sound wave is 320.0 m/s\n"
+ ]
}
],
"prompt_number": 12
@@ -164,19 +365,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.8, Page number 26"
+ "source": [
+ "Example number 1.8, Page number 26"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the equation of a wave\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nA = 2; #Amplitude of the wave(cm)\nT = 0.5; #Time period of the wave(sec)\nv = 200; #Wave velocity(cm/s)\n\n#Calculation\nf = 1/T; #Frequency of the wave(Hz)\nlamda = v/f; #Wavelength of the wave(cm)\n\n#Result\nprint \"frequency of wave is\",f, \"Hz\"\nprint \"wavelength of wave is\",lamda, \"cm\"\nprint \"The Equation of the wave moving along X-axis :\"\nprint \"u = \",A,\"*sin*2*math.pi*(x/\",lamda,\"- t/\",T,\")\" #x and y are in cm and t is in sec",
+ "input": [
+ "\n",
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "A = 2; #Amplitude of the wave(cm)\n",
+ "T = 0.5; #Time period of the wave(sec)\n",
+ "v = 200; #Wave velocity(cm/s)\n",
+ "\n",
+ "#Calculation\n",
+ "f = 1/T; #Frequency of the wave(Hz)\n",
+ "lamda = v/f; #Wavelength of the wave(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"frequency of wave is\",f, \"Hz\"\n",
+ "print \"wavelength of wave is\",lamda, \"cm\"\n",
+ "print \"The Equation of the wave moving along X-axis :\"\n",
+ "print \"u = \",A,\"*sin*2*math.pi*(x/\",lamda,\"- t/\",T,\")\" #x and y are in cm and t is in sec"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "frequency of wave is 2.0 Hz\nwavelength of wave is 100.0 cm\nThe Equation of the wave moving along X-axis :\nu = 2 *sin*2*math.pi*(x/ 100.0 - t/ 0.5 )\n"
+ "text": [
+ "frequency of wave is 2.0 Hz\n",
+ "wavelength of wave is 100.0 cm\n",
+ "The Equation of the wave moving along X-axis :\n",
+ "u = 2 *sin*2*math.pi*(x/ 100.0 - t/ 0.5 )\n"
+ ]
}
],
"prompt_number": 13
@@ -185,19 +414,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.9, Page number 27"
+ "source": [
+ "Example number 1.9, Page number 27"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the velocity and frequency of the wave\n\n#import modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nT = 1000; #Tension in the wire(N)\nM=15; #mass of the wire(kg)\nl=300; #length of the wire(m)\nlamda = 0.30; #Wavelength of wave along wire(m)\n\n#Calculation\nm = M/l; #Mass per unit length of the wire(kg/m)\nv = math.sqrt(T/m); #Velocity of wave through wire(m/s)\nv=math.ceil(v*100)/100; #rounding off to 2 decimals\nnew = v/lamda; #Frequency of wave through string(Hz)\nnew=math.ceil(new*100)/100; #rounding off to 2 decimals\n\n#Result\nprint \"The velocity of the wave through wire is\",v, \"m/s\"\nprint \"The frequency of the wave through wire is\",new, \"Hz\"\n\n#answer for frequency of the wave is wrong in the textbook",
+ "input": [
+ "\n",
+ "#import modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "T = 1000; #Tension in the wire(N)\n",
+ "M=15; #mass of the wire(kg)\n",
+ "l=300; #length of the wire(m)\n",
+ "lamda = 0.30; #Wavelength of wave along wire(m)\n",
+ "\n",
+ "#Calculation\n",
+ "m = M/l; #Mass per unit length of the wire(kg/m)\n",
+ "v = math.sqrt(T/m); #Velocity of wave through wire(m/s)\n",
+ "v=math.ceil(v*100)/100; #rounding off to 2 decimals\n",
+ "new = v/lamda; #Frequency of wave through string(Hz)\n",
+ "new=math.ceil(new*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The velocity of the wave through wire is\",v, \"m/s\"\n",
+ "print \"The frequency of the wave through wire is\",new, \"Hz\"\n",
+ "\n",
+ "#answer for frequency of the wave is wrong in the textbook"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The velocity of the wave through wire is 141.43 m/s\nThe frequency of the wave through wire is 471.44 Hz\n"
+ "text": [
+ "The velocity of the wave through wire is 141.43 m/s\n",
+ "The frequency of the wave through wire is 471.44 Hz\n"
+ ]
}
],
"prompt_number": 15
@@ -205,7 +463,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter2_1.ipynb b/Engineering_Physics_Aruldhas/Chapter2_1.ipynb
index f002fd31..fdbf44b5 100644
--- a/Engineering_Physics_Aruldhas/Chapter2_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter2_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter2"
+ "name": "",
+ "signature": "sha256:de195a4faed398c9714bc27769421926f24c448f7ad7f1d4cb04dd3cfbb18334"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,61 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "2: Electromagnetic Theory"
+ "source": [
+ "2: Electromagnetic Theory"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.1, Page number 46"
+ "source": [
+ "Example number 2.1, Page number 46"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To determine the peak value of displacement current\n\n#importing modules\nfrom __future__ import division\nfrom sympy import *\nimport math\n\n#Variable declaration\nC = 10; #Capacitance of the capacitor(pF)\n#given V=0.2*sin(120*math.pi*t) in volts\n\n#Calculation\nC=C*10**-12; #Capacitance of the capacitor(F)\nx, y, z, t = symbols('x y z t')\nk, m, n = symbols('k m n', integer=True)\nf, g, h = symbols('f g h', cls=Function)\n#I = C*dV/dt\n#let dV/dt be a\na=diff(0.2*sin(120*math.pi*t),t) #dV/dt\n#value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n#for cosine function peak value occurs when 120*math.pi*t = 0\n#therefore value of dV/dt becomes d = 75.398223686155\nd = 75.398223686155; #value of dV/dt \nI=C*d; #displacement current(A)\n\n#Result\nprint \"value of dV/dt is\",a\nprint \"displacement current is\",I, \"A\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "from sympy import *\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "C = 10; #Capacitance of the capacitor(pF)\n",
+ "#given V=0.2*sin(120*math.pi*t) in volts\n",
+ "\n",
+ "#Calculation\n",
+ "C=C*10**-12; #Capacitance of the capacitor(F)\n",
+ "x, y, z, t = symbols('x y z t')\n",
+ "k, m, n = symbols('k m n', integer=True)\n",
+ "f, g, h = symbols('f g h', cls=Function)\n",
+ "#I = C*dV/dt\n",
+ "#let dV/dt be a\n",
+ "a=diff(0.2*sin(120*math.pi*t),t) #dV/dt\n",
+ "#value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n",
+ "#for cosine function peak value occurs when 120*math.pi*t = 0\n",
+ "#therefore value of dV/dt becomes d = 75.398223686155\n",
+ "d = 75.398223686155; #value of dV/dt \n",
+ "I=C*d; #displacement current(A)\n",
+ "\n",
+ "#Result\n",
+ "print \"value of dV/dt is\",a\n",
+ "print \"displacement current is\",I, \"A\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "value of dV/dt is 75.398223686155*cos(376.991118430775*t)\ndisplacement current is 7.53982236862e-10 A\n"
+ "text": [
+ "value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n",
+ "displacement current is 7.53982236862e-10 A\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +75,54 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.2, Page number 46"
+ "source": [
+ "Example number 2.2, Page number 46"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the peak value of displacement current density in a good conductor\n\n#importing modules\nfrom __future__ import division\nfrom sympy import *\nimport math\n\n#Variable declaration\nepsilon_r = 1; #Relative electrical permittivity of free space\nepsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n#given E=sin(120*math.pi*t) in volts\n\n#Calculation\nx, y, z, t = symbols('x y z t')\nk, m, n = symbols('k m n', integer=True)\nf, g, h = symbols('f g h', cls=Function)\n#J2 = epsilon*dE/dt\nepsilon=epsilon_0*epsilon_r;\n#let dE/dt be a\na=diff(sin(120*math.pi*t),t) #dE/dt\n#value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n#for cosine function peak value occurs when 120*math.pi*t = 0\n#therefore value of dE/dt becomes d = 376.991118430775\nd = 376.991118430775; #value of dE/dt\nJ2=epsilon*d; #displacement current density(A/m**2)\n\n#Result\nprint \"value of dE/dt is\",a\nprint \"The peak value of displacement current density is\",J2, \"A/m**2\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "from sympy import *\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_r = 1; #Relative electrical permittivity of free space\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n",
+ "#given E=sin(120*math.pi*t) in volts\n",
+ "\n",
+ "#Calculation\n",
+ "x, y, z, t = symbols('x y z t')\n",
+ "k, m, n = symbols('k m n', integer=True)\n",
+ "f, g, h = symbols('f g h', cls=Function)\n",
+ "#J2 = epsilon*dE/dt\n",
+ "epsilon=epsilon_0*epsilon_r;\n",
+ "#let dE/dt be a\n",
+ "a=diff(sin(120*math.pi*t),t) #dE/dt\n",
+ "#value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n",
+ "#for cosine function peak value occurs when 120*math.pi*t = 0\n",
+ "#therefore value of dE/dt becomes d = 376.991118430775\n",
+ "d = 376.991118430775; #value of dE/dt\n",
+ "J2=epsilon*d; #displacement current density(A/m**2)\n",
+ "\n",
+ "#Result\n",
+ "print \"value of dE/dt is\",a\n",
+ "print \"The peak value of displacement current density is\",J2, \"A/m**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "value of dE/dt is 376.991118430775*cos(376.991118430775*t)\nThe peak value of displacement current density is 3.33787936259e-09 A/m**2\n"
+ "text": [
+ "value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n",
+ "The peak value of displacement current density is 3.33787936259e-09 A/m**2\n"
+ ]
}
],
"prompt_number": 3
@@ -59,25 +131,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.3, Page number 47 (Theoritical proof)"
+ "source": [
+ "Example number 2.3, Page number 47 (Theoritical proof)"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.4, Page number 47"
+ "source": [
+ "Example number 2.4, Page number 47"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To determine the peak value of displacement current\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\np = 60; #Power rating of bulb(W)\nd = 0.5; #Distance from the bulb(m)\n\n#Calculation\nA=4*math.pi*d**2; #area(m**2)\nP = p/A; #Value of Poynting vector(W/m**2)\nP = math.ceil(P*100)/100; #rounding off value of P to 1 decimal\n\n#Result\nprint \"The value of Poynting vector is\",P, \"W/m**2\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "p = 60; #Power rating of bulb(W)\n",
+ "d = 0.5; #Distance from the bulb(m)\n",
+ "\n",
+ "#Calculation\n",
+ "A=4*math.pi*d**2; #area(m**2)\n",
+ "P = p/A; #Value of Poynting vector(W/m**2)\n",
+ "P = math.ceil(P*100)/100; #rounding off value of P to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The value of Poynting vector is\",P, \"W/m**2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The value of Poynting vector is 19.1 W/m**2\n"
+ "text": [
+ "The value of Poynting vector is 19.1 W/m**2\n"
+ ]
}
],
"prompt_number": 4
@@ -86,19 +182,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.5, Page number 47"
+ "source": [
+ "Example number 2.5, Page number 47"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To determine the velocity of wave, intrinsic impedence and peak value of magnetic intensity\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nE_peak = 6; #Peak value of electric field intensity(V/m)\nc = 3*10**8; #Speed of electromagnetic wave in free space(m/s)\nmew_0 = 4*math.pi*10**-7; #Absolute permeability of free space(Tm/A)\nepsilon_0 = 8.854*10**-12; #Absolute permittivity of free space(F/m)\nmew_r = 1; #Relative permeability of medium\nepsilon_r = 3; #Relative permittivity of the medium\n\n#Calculation\nv = c/math.sqrt(mew_r*epsilon_r); #Wave velocity(m/s)\nv = v/10**8;\nv = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\neta = math.sqrt((mew_0/epsilon_0)*(mew_r/epsilon_r)); #Intrinsic impedance of the medium(ohm)\neta = math.ceil(eta*10)/10; #rounding off the value of v to 1 decimal\nH_P = E_peak/eta; #Peak value of the magnetic intensity(A/m)\nH_P = H_P*10**2;\nH_P = math.ceil(H_P*10**2)/10**2; #rounding off the value of v to 2 decimals\n\n#Result\nprint \"The wave velocity is\",v,\"*10**8 m/s\"\nprint \"The intrinsic impedance of the medium is\",eta, \"ohm\"\nprint \"The peak value of the magnetic intensity is\",H_P,\"*10**-2 A/m\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "E_peak = 6; #Peak value of electric field intensity(V/m)\n",
+ "c = 3*10**8; #Speed of electromagnetic wave in free space(m/s)\n",
+ "mew_0 = 4*math.pi*10**-7; #Absolute permeability of free space(Tm/A)\n",
+ "epsilon_0 = 8.854*10**-12; #Absolute permittivity of free space(F/m)\n",
+ "mew_r = 1; #Relative permeability of medium\n",
+ "epsilon_r = 3; #Relative permittivity of the medium\n",
+ "\n",
+ "#Calculation\n",
+ "v = c/math.sqrt(mew_r*epsilon_r); #Wave velocity(m/s)\n",
+ "v = v/10**8;\n",
+ "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n",
+ "eta = math.sqrt((mew_0/epsilon_0)*(mew_r/epsilon_r)); #Intrinsic impedance of the medium(ohm)\n",
+ "eta = math.ceil(eta*10)/10; #rounding off the value of v to 1 decimal\n",
+ "H_P = E_peak/eta; #Peak value of the magnetic intensity(A/m)\n",
+ "H_P = H_P*10**2;\n",
+ "H_P = math.ceil(H_P*10**2)/10**2; #rounding off the value of v to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The wave velocity is\",v,\"*10**8 m/s\"\n",
+ "print \"The intrinsic impedance of the medium is\",eta, \"ohm\"\n",
+ "print \"The peak value of the magnetic intensity is\",H_P,\"*10**-2 A/m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wave velocity is 1.7321 *10**8 m/s\nThe intrinsic impedance of the medium is 217.6 ohm\nThe peak value of the magnetic intensity is 2.76 *10**-2 A/m\n"
+ "text": [
+ "The wave velocity is 1.7321 *10**8 m/s\n",
+ "The intrinsic impedance of the medium is 217.6 ohm\n",
+ "The peak value of the magnetic intensity is 2.76 *10**-2 A/m\n"
+ ]
}
],
"prompt_number": 11
@@ -106,7 +236,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter3_1.ipynb b/Engineering_Physics_Aruldhas/Chapter3_1.ipynb
index e20ce99f..645d7595 100644
--- a/Engineering_Physics_Aruldhas/Chapter3_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter3_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter3"
+ "name": "",
+ "signature": "sha256:bdc5e7b39dc3529751aa6372cd3db8b0870c9abab4c9b51855fb3bce7de6dc73"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,52 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "3: Interference"
+ "source": [
+ "3: Interference"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.1, Page number 71"
+ "source": [
+ "Example number 3.1, Page number 71"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the velocity of light\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nbeta = 0.51; #Fringe width(mm)\nd = 2.2; #Distance between the slits(mm)\nD = 2; #Distance between the slits and the screen(m)\n\n#Calculation\nbeta = beta*10**-1; #Fringe width(cm)\nd = d*10**-1; #Distance between the slits(cm)\nD=D*10**2; #Distance between the slits and the screen(cm)\nlamda = beta*d/D; #Wavelength of light(cm)\nlamda = lamda*10**8; #Wavelength of light(A)\n\n#Result\nprint \"The wavelength of light is\",lamda, \"angstrom\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "beta = 0.51; #Fringe width(mm)\n",
+ "d = 2.2; #Distance between the slits(mm)\n",
+ "D = 2; #Distance between the slits and the screen(m)\n",
+ "\n",
+ "#Calculation\n",
+ "beta = beta*10**-1; #Fringe width(cm)\n",
+ "d = d*10**-1; #Distance between the slits(cm)\n",
+ "D=D*10**2; #Distance between the slits and the screen(cm)\n",
+ "lamda = beta*d/D; #Wavelength of light(cm)\n",
+ "lamda = lamda*10**8; #Wavelength of light(A)\n",
+ "\n",
+ "#Result\n",
+ "print \"The wavelength of light is\",lamda, \"angstrom\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wavelength of light is 5610.0 angstrom\n"
+ "text": [
+ "The wavelength of light is 5610.0 angstrom\n"
+ ]
}
],
"prompt_number": 4
@@ -38,19 +66,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.2, Page number 71"
+ "source": [
+ "Example number 3.2, Page number 71"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the seperation between the third fringe\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nlambda1 = 4250; #First wavelength emitted by source of light(A)\nlambda2 = 5050; #Second wavelength emitted by source of light(A)\nD = 1.5; #Distance between the source and the screen(m)\nd = 0.025; #Distance between the slits(mm)\nn = 3; #Number of fringe from the centre\n\n#Calculation\nlambda1 = lambda1*10**-10; #First wavelength emitted(m)\nlambda2 = lambda2*10**-10; #Second wavelength emitted(m)\nd = d*10**-3; #Distance between the slits(m)\nx3 = n*lambda1*D/d; #Position of third bright fringe due to lambda1(m)\nx3_prime = n*lambda2*D/d; #Position of third bright fringe due to lambda2(m)\nx = x3_prime-x3; #separation between the third bright fringe(m)\nx = x*10**2; #separation between the third bright fringe(cm)\n\n#Result\nprint \"The separation between the third bright fringe due to the two wavelengths is\",x, \"cm\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lambda1 = 4250; #First wavelength emitted by source of light(A)\n",
+ "lambda2 = 5050; #Second wavelength emitted by source of light(A)\n",
+ "D = 1.5; #Distance between the source and the screen(m)\n",
+ "d = 0.025; #Distance between the slits(mm)\n",
+ "n = 3; #Number of fringe from the centre\n",
+ "\n",
+ "#Calculation\n",
+ "lambda1 = lambda1*10**-10; #First wavelength emitted(m)\n",
+ "lambda2 = lambda2*10**-10; #Second wavelength emitted(m)\n",
+ "d = d*10**-3; #Distance between the slits(m)\n",
+ "x3 = n*lambda1*D/d; #Position of third bright fringe due to lambda1(m)\n",
+ "x3_prime = n*lambda2*D/d; #Position of third bright fringe due to lambda2(m)\n",
+ "x = x3_prime-x3; #separation between the third bright fringe(m)\n",
+ "x = x*10**2; #separation between the third bright fringe(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The separation between the third bright fringe due to the two wavelengths is\",x, \"cm\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The separation between the third bright fringe due to the two wavelengths is 1.44 cm\n"
+ "text": [
+ "The separation between the third bright fringe due to the two wavelengths is 1.44 cm\n"
+ ]
}
],
"prompt_number": 5
@@ -59,19 +116,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.3, Page number 71"
+ "source": [
+ "Example number 3.3, Page number 71"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the refractive index of the sheet of glass\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda = 5.5*10**-5; #Wavelength emitted by source of light(cm)\nn = 4; #Number of fringes shifted\nt = 3.9*10**-4; #Thickness of the thin glass sheet(cm)\n\n#Calculation\nmew = (n*lamda/t)+1; #Refractive index of the sheet of glass\nmew = math.ceil(mew*10**4)/10**4; #rounding off the value of v to 4 decimals\n\n#Result\nprint \"The refractive index of the sheet of glass is\",mew",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 5.5*10**-5; #Wavelength emitted by source of light(cm)\n",
+ "n = 4; #Number of fringes shifted\n",
+ "t = 3.9*10**-4; #Thickness of the thin glass sheet(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "mew = (n*lamda/t)+1; #Refractive index of the sheet of glass\n",
+ "mew = math.ceil(mew*10**4)/10**4; #rounding off the value of v to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The refractive index of the sheet of glass is\",mew"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The refractive index of the sheet of glass is 1.5642\n"
+ "text": [
+ "The refractive index of the sheet of glass is 1.5642\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +158,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.4, Page number 72"
+ "source": [
+ "Example number 3.4, Page number 72"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the least thickness of the film that appears bright and dark\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda = 5893; #Wavelength of monochromatic lihgt used(A)\nn = 1; #Number of fringe for the least thickness of the film\ncosr = 1; #for normal incidence\nmew = 1.42; #refractive index of the soap film\n\n#Calculation\n#As for constructive interference, \n#2*mew*t*cos(r) = (2*n-1)*lambda/2, solving for t\nt = (2*n-1)*lamda/(4*mew*cosr); #Thickness of the film that appears bright(A)\n#As for destructive interference, \n#2*mu*t*cos(r) = n*lambda, solving for t\nt1 = n*lamda/(2*mew*cosr); #Thickness of the film that appears bright(A)\n\n#Result\nprint \"The thickness of the film that appears bright is\",t, \"angstrom\"\nprint \"The thickness of the film that appears dark is\",t1, \"angstrom\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 5893; #Wavelength of monochromatic lihgt used(A)\n",
+ "n = 1; #Number of fringe for the least thickness of the film\n",
+ "cosr = 1; #for normal incidence\n",
+ "mew = 1.42; #refractive index of the soap film\n",
+ "\n",
+ "#Calculation\n",
+ "#As for constructive interference, \n",
+ "#2*mew*t*cos(r) = (2*n-1)*lambda/2, solving for t\n",
+ "t = (2*n-1)*lamda/(4*mew*cosr); #Thickness of the film that appears bright(A)\n",
+ "#As for destructive interference, \n",
+ "#2*mu*t*cos(r) = n*lambda, solving for t\n",
+ "t1 = n*lamda/(2*mew*cosr); #Thickness of the film that appears bright(A)\n",
+ "\n",
+ "#Result\n",
+ "print \"The thickness of the film that appears bright is\",t, \"angstrom\"\n",
+ "print \"The thickness of the film that appears dark is\",t1, \"angstrom\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The thickness of the film that appears bright is 1037.5 angstrom\nThe thickness of the film that appears dark is 2075.0 angstrom\n"
+ "text": [
+ "The thickness of the film that appears bright is 1037.5 angstrom\n",
+ "The thickness of the film that appears dark is 2075.0 angstrom\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +207,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.5, Page number 72"
+ "source": [
+ "Example number 3.5, Page number 72"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle of the wedge\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda = 5893; #Wavelength of monochromatic lihgt used(A)\nn = 10; #Number of fringe that are found \nd = 1; #Distance of 10 fringes(cm)\n\n#Calculation\nbeta = d/n; #Fringe width(cm)\nlamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\ntheta = lamda/(2*beta); #Angle of the wedge(rad)\ntheta = theta*10**4;\ntheta = math.ceil(theta*10**4)/10**4; #rounding off the value of theta to 4 decimals\n\n#Result\nprint \"The angle of the wedge is\",theta,\"*10**-4 rad\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 5893; #Wavelength of monochromatic lihgt used(A)\n",
+ "n = 10; #Number of fringe that are found \n",
+ "d = 1; #Distance of 10 fringes(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "beta = d/n; #Fringe width(cm)\n",
+ "lamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\n",
+ "theta = lamda/(2*beta); #Angle of the wedge(rad)\n",
+ "theta = theta*10**4;\n",
+ "theta = math.ceil(theta*10**4)/10**4; #rounding off the value of theta to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The angle of the wedge is\",theta,\"*10**-4 rad\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The angle of the wedge is 2.9465 *10**-4 rad\n"
+ "text": [
+ "The angle of the wedge is 2.9465 *10**-4 rad\n"
+ ]
}
],
"prompt_number": 12
@@ -122,19 +251,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.6, Page number 72"
+ "source": [
+ "Example number 3.6, Page number 72"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the separation between consecutive bright fringes\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 5900; #Wavelength of monochromatic lihgt used(A)\nt = 0.010; #Spacer thickness(mm)\nl = 10; #Wedge length(cm)\n\n#Calculation\nt = t*10**-1; #Spacer thickness(cm)\ntheta = t/l; #Angle of the wedge(rad)\nlamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\nbeta = lamda/(2*theta); #Fringe width(cm)\n\n#Result\nprint \"The separation between consecutive bright fringes is\",beta, \"cm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 5900; #Wavelength of monochromatic lihgt used(A)\n",
+ "t = 0.010; #Spacer thickness(mm)\n",
+ "l = 10; #Wedge length(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "t = t*10**-1; #Spacer thickness(cm)\n",
+ "theta = t/l; #Angle of the wedge(rad)\n",
+ "lamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\n",
+ "beta = lamda/(2*theta); #Fringe width(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The separation between consecutive bright fringes is\",beta, \"cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The separation between consecutive bright fringes is 0.295 cm\n"
+ "text": [
+ "The separation between consecutive bright fringes is 0.295 cm\n"
+ ]
}
],
"prompt_number": 13
@@ -143,19 +296,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.7, Page number 72"
+ "source": [
+ "Example number 3.7, Page number 72"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the diameter of 20th dark ring\n\n#importing modules\nimport math\n\n#Variable declaration\nD4 = 0.4; #Diameter of 4th dark ring(cm)\nD12 = 0.7; #Diameter of 12th dark ring(cm)\n\n#Calculation\n#We have (dn_plus_k**2)-Dn**2 = 4*k*R*lamda\n#D12**2-D4**2 = 32*R*lamda and D20**2-D12**2 = 32*R*lamda for k = 8\n#since RHS are equal, by equating the LHS we get D12**2-D4**2 = D20**2-D12**2\nD20 = math.sqrt((2*D12**2)-D4**2); #Diameter of 20th dark ring(cm)\nD20 = math.ceil(D20*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n\n#Result\nprint \"The diameter of 20th dark ring is\",D20, \"cm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "D4 = 0.4; #Diameter of 4th dark ring(cm)\n",
+ "D12 = 0.7; #Diameter of 12th dark ring(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "#We have (dn_plus_k**2)-Dn**2 = 4*k*R*lamda\n",
+ "#D12**2-D4**2 = 32*R*lamda and D20**2-D12**2 = 32*R*lamda for k = 8\n",
+ "#since RHS are equal, by equating the LHS we get D12**2-D4**2 = D20**2-D12**2\n",
+ "D20 = math.sqrt((2*D12**2)-D4**2); #Diameter of 20th dark ring(cm)\n",
+ "D20 = math.ceil(D20*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The diameter of 20th dark ring is\",D20, \"cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The diameter of 20th dark ring is 0.9056 cm\n"
+ "text": [
+ "The diameter of 20th dark ring is 0.9056 cm\n"
+ ]
}
],
"prompt_number": 14
@@ -164,19 +340,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.8, Page number 73"
+ "source": [
+ "Example number 3.8, Page number 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the refractive index of the liquid\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nDn = 0.30; #Diameter of nth dark ring with air film(cm)\ndn = 0.25; #Diameter of nth dark ring with liquid film(cm)\n\n#Calculation\nmew = (Dn/dn)**2; #Refractive index of the liquid\n\n#Result\nprint \"The refractive index of the liquid is\", mew\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Dn = 0.30; #Diameter of nth dark ring with air film(cm)\n",
+ "dn = 0.25; #Diameter of nth dark ring with liquid film(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "mew = (Dn/dn)**2; #Refractive index of the liquid\n",
+ "\n",
+ "#Result\n",
+ "print \"The refractive index of the liquid is\", mew\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The refractive index of the liquid is 1.44\n"
+ "text": [
+ "The refractive index of the liquid is 1.44\n"
+ ]
}
],
"prompt_number": 15
@@ -185,19 +381,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.9, Page number 73"
+ "source": [
+ "Example number 3.9, Page number 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of light\n\n#importing modules\nimport math\n\n#Variable declaration\nx = 0.002945; #Distance through which movable mirror is shifted(cm)\nN = 100; #Number of fringes shifted\n\n#Calculation\nx = x*10**-2; #Distance through which movable mirror is shifted(m)\nlamda = 2*x/N; #Wavelength of light(m)\nlamda = lamda*10**10; #Wavelength of light(A)\n\n#Result\nprint \"The wavelength of light is\",lamda, \"angstrom\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "x = 0.002945; #Distance through which movable mirror is shifted(cm)\n",
+ "N = 100; #Number of fringes shifted\n",
+ "\n",
+ "#Calculation\n",
+ "x = x*10**-2; #Distance through which movable mirror is shifted(m)\n",
+ "lamda = 2*x/N; #Wavelength of light(m)\n",
+ "lamda = lamda*10**10; #Wavelength of light(A)\n",
+ "\n",
+ "#Result\n",
+ "print \"The wavelength of light is\",lamda, \"angstrom\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wavelength of light is 5890.0 angstrom\n"
+ "text": [
+ "The wavelength of light is 5890.0 angstrom\n"
+ ]
}
],
"prompt_number": 16
@@ -206,19 +422,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.10, Page number 73"
+ "source": [
+ "Example number 3.10, Page number 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the shift in movable mirror\n\n#importing modules\nimport math\n\n#Variable declaration\nlambda1 = 5896; #Wavelength of D1 line of sodium(A)\nlambda2 = 5890; #Wavelength of D2 line of sodium(A)\n\n#Calculation\nlamda = (lambda1+lambda2)/2;\nx = (lamda**2)/(2*(lambda1-lambda2)); #Shift in movable mirror of Michelson Interferometer(A)\nx = x*10**-7; #Shift in movable mirror of Michelson Interferometer(mm)\nx = math.ceil(x*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n\n#Result\nprint \"The shift in movable mirror is\",x, \"mm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lambda1 = 5896; #Wavelength of D1 line of sodium(A)\n",
+ "lambda2 = 5890; #Wavelength of D2 line of sodium(A)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = (lambda1+lambda2)/2;\n",
+ "x = (lamda**2)/(2*(lambda1-lambda2)); #Shift in movable mirror of Michelson Interferometer(A)\n",
+ "x = x*10**-7; #Shift in movable mirror of Michelson Interferometer(mm)\n",
+ "x = math.ceil(x*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The shift in movable mirror is\",x, \"mm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The shift in movable mirror is 0.2894 mm\n"
+ "text": [
+ "The shift in movable mirror is 0.2894 mm\n"
+ ]
}
],
"prompt_number": 17
@@ -226,7 +464,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter4_1.ipynb b/Engineering_Physics_Aruldhas/Chapter4_1.ipynb
index 4cd8a196..cc3fca78 100644
--- a/Engineering_Physics_Aruldhas/Chapter4_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter4_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter4"
+ "name": "",
+ "signature": "sha256:3ba769656e990801d788b85df0bb013daae3fbdec7e19bc6ba653a53dfdabcb2"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,62 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "4: Diffraction"
+ "source": [
+ "4: Diffraction"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.1, Page number 91"
+ "source": [
+ "Example number 4.1, Page number 91"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the velocity of light\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nD = 50; #Distance between source and the screen(cm)\nlamda = 6563; #Wavelength of light of parallel rays(A)\nd = 0.385; #Width of the slit(mm)\nn1 = 1; #Order of diffraction for first minimum\nn2 = 5; #Order of diffraction for fifth minimum\n\n#Calculation\nlamda = lamda*10**-8; #Wavelength of light of parallel rays(cm)\nd = d*10**-1; #Width of the slit(cm)\n#As sin(theta1) = n*lambda/d = x1/D, solving for x1\nx1 = n1*lamda*D/d; #Distance from the centre of the principal maximum to the first minimum(cm)\nx1 = x1*10; #Distance from the centre of the principal maximum to the first minimum(mm)\nx1 = math.ceil(x1*10**3)/10**3; #rounding off the value of x1 to 3 decimals\nx2 = n2*lamda*D/d; #Distance from the centre of the principal maximum to the fifth minimum(cm)\nx2 = x2*10; #Distance from the centre of the principal maximum to the fifth minimum(mm)\nx2 = math.ceil(x2*10**3)/10**3; #rounding off the value of x2 to 3 decimals\n\n#Result\nprint \"The Distance from the centre of the principal maximum to the first minimum is\",x1, \"mm\"\nprint \"The Distance from the centre of the principal maximum to the fifth minimum is\",x2, \"mm\"\n\n#answer for x2 given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "D = 50; #Distance between source and the screen(cm)\n",
+ "lamda = 6563; #Wavelength of light of parallel rays(A)\n",
+ "d = 0.385; #Width of the slit(mm)\n",
+ "n1 = 1; #Order of diffraction for first minimum\n",
+ "n2 = 5; #Order of diffraction for fifth minimum\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-8; #Wavelength of light of parallel rays(cm)\n",
+ "d = d*10**-1; #Width of the slit(cm)\n",
+ "#As sin(theta1) = n*lambda/d = x1/D, solving for x1\n",
+ "x1 = n1*lamda*D/d; #Distance from the centre of the principal maximum to the first minimum(cm)\n",
+ "x1 = x1*10; #Distance from the centre of the principal maximum to the first minimum(mm)\n",
+ "x1 = math.ceil(x1*10**3)/10**3; #rounding off the value of x1 to 3 decimals\n",
+ "x2 = n2*lamda*D/d; #Distance from the centre of the principal maximum to the fifth minimum(cm)\n",
+ "x2 = x2*10; #Distance from the centre of the principal maximum to the fifth minimum(mm)\n",
+ "x2 = math.ceil(x2*10**3)/10**3; #rounding off the value of x2 to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The Distance from the centre of the principal maximum to the first minimum is\",x1, \"mm\"\n",
+ "print \"The Distance from the centre of the principal maximum to the fifth minimum is\",x2, \"mm\"\n",
+ "\n",
+ "#answer for x2 given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Distance from the centre of the principal maximum to the first minimum is 0.853 mm\nThe Distance from the centre of the principal maximum to the fifth minimum is 4.262 mm\n"
+ "text": [
+ "The Distance from the centre of the principal maximum to the first minimum is 0.853 mm\n",
+ "The Distance from the centre of the principal maximum to the fifth minimum is 4.262 mm\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +76,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.2, Page number 91"
+ "source": [
+ "Example number 4.2, Page number 91"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the radii of first two dark rings\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nD = 0.04; #Diameter of circular aperture(cm)\nf = 20; #Focal length of convex lens(cm)\nlamda = 6000; #Wavelength of light used(A)\n\n#Calculation\nlamda = lamda*10**-8; #Wavelength of light used(cm)\n#We have sin(theta) = 1.22*lambda/D = theta, for small theta\n#For first dark ring\ntheta = 1.22*lamda/D; #The half angular width at central maximum(rad)\nr1 = theta*f; #The half width of central maximum for first dark ring(cm)\nr1 = r1*10**2;\n#We have sin(theta) = 5.136*lambda/(%pi*D) = theta, for small theta\n#For second dark ring\ntheta = 5.136*lamda/(math.pi*D); #The half angular width at central maximum(rad)\nr2 = theta*f; #The half width of central maximum for second dark ring(cm)\nr2 = r2*10**2;\nr2 = math.ceil(r2*100)/100; #rounding off the value of r2 to 2 decimals\n\n#Result\nprint \"The radius of first dark ring is\",r1,\"*10**-2 cm\"\nprint \"The radius of second dark ring is\",r2,\"*10**-2 cm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "D = 0.04; #Diameter of circular aperture(cm)\n",
+ "f = 20; #Focal length of convex lens(cm)\n",
+ "lamda = 6000; #Wavelength of light used(A)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-8; #Wavelength of light used(cm)\n",
+ "#We have sin(theta) = 1.22*lambda/D = theta, for small theta\n",
+ "#For first dark ring\n",
+ "theta = 1.22*lamda/D; #The half angular width at central maximum(rad)\n",
+ "r1 = theta*f; #The half width of central maximum for first dark ring(cm)\n",
+ "r1 = r1*10**2;\n",
+ "#We have sin(theta) = 5.136*lambda/(%pi*D) = theta, for small theta\n",
+ "#For second dark ring\n",
+ "theta = 5.136*lamda/(math.pi*D); #The half angular width at central maximum(rad)\n",
+ "r2 = theta*f; #The half width of central maximum for second dark ring(cm)\n",
+ "r2 = r2*10**2;\n",
+ "r2 = math.ceil(r2*100)/100; #rounding off the value of r2 to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The radius of first dark ring is\",r1,\"*10**-2 cm\"\n",
+ "print \"The radius of second dark ring is\",r2,\"*10**-2 cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The radius of first dark ring is 3.66 *10**-2 cm\nThe radius of second dark ring is 4.91 *10**-2 cm\n"
+ "text": [
+ "The radius of first dark ring is 3.66 *10**-2 cm\n",
+ "The radius of second dark ring is 4.91 *10**-2 cm\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +131,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.3, Page number 92"
+ "source": [
+ "Example number 4.3, Page number 92"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle at which the light produces a second order maximum\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nn = 2; #Order of diffraction\nlamda = 650; #Wavelength of light used(nm)\nd = 1.2*10**-3; #Distance between two consecutive slits of grating(cm)\n\n#Calculation\n#We have sin(theta) = n*N*lambda = n*lambda/d, solving for theta\nlamda = lamda*10**-9; #Wavelength of light used(m)\nd = d*10**-2; #Distance between two consecutive slits of grating(m)\na=n*lamda/d;\ntheta = math.asin(a); #Angle at which the 650 nm light produces a second order maximum(rad)\ntheta = theta*57.2957795; #angle in degrees\ntheta = math.ceil(theta*10**2)/10**2; #rounding off the value of theta to 2 decimals\n\n#Result\nprint \"The angle at which the light produces a second order maximum is\",theta, \"degrees\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n = 2; #Order of diffraction\n",
+ "lamda = 650; #Wavelength of light used(nm)\n",
+ "d = 1.2*10**-3; #Distance between two consecutive slits of grating(cm)\n",
+ "\n",
+ "#Calculation\n",
+ "#We have sin(theta) = n*N*lambda = n*lambda/d, solving for theta\n",
+ "lamda = lamda*10**-9; #Wavelength of light used(m)\n",
+ "d = d*10**-2; #Distance between two consecutive slits of grating(m)\n",
+ "a=n*lamda/d;\n",
+ "theta = math.asin(a); #Angle at which the 650 nm light produces a second order maximum(rad)\n",
+ "theta = theta*57.2957795; #angle in degrees\n",
+ "theta = math.ceil(theta*10**2)/10**2; #rounding off the value of theta to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The angle at which the light produces a second order maximum is\",theta, \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The angle at which the light produces a second order maximum is 6.22 degrees\n"
+ "text": [
+ "The angle at which the light produces a second order maximum is 6.22 degrees\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +179,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.4, Page number 92"
+ "source": [
+ "Example number 4.4, Page number 92"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the highest order of spectra\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 650; #Wavelength of light used(nm)\nN = 6000; #Number of lines per cm on grating\ntheta = 90; #Angle at which the highest spectral order is obtained(degrees)\n\n#Calculation\ntheta = theta*0.0174532925; #Angle at which the highest spectral order is obtained(rad)\n#We have sin(theta) = n*N*lambda, solving for n\nlamda = lamda*10**-9; #Wavelength of light used(m)\nN = N*10**2; #Number of lines per m on grating\nn = math.sin(theta)/(N*lamda); #The highest order of spectra with diffraction grating\nn = math.ceil(n*10**3)/10**3; #rounding off the value of theta to 3 decimals\ni,d = divmod(n, 1); #divides the value of n into integer and decimal parts where i is integer\n\n#Result\nprint \"value of n is\",n\nprint \"The highest order of spectra obtained with diffraction grating is\",i\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 650; #Wavelength of light used(nm)\n",
+ "N = 6000; #Number of lines per cm on grating\n",
+ "theta = 90; #Angle at which the highest spectral order is obtained(degrees)\n",
+ "\n",
+ "#Calculation\n",
+ "theta = theta*0.0174532925; #Angle at which the highest spectral order is obtained(rad)\n",
+ "#We have sin(theta) = n*N*lambda, solving for n\n",
+ "lamda = lamda*10**-9; #Wavelength of light used(m)\n",
+ "N = N*10**2; #Number of lines per m on grating\n",
+ "n = math.sin(theta)/(N*lamda); #The highest order of spectra with diffraction grating\n",
+ "n = math.ceil(n*10**3)/10**3; #rounding off the value of theta to 3 decimals\n",
+ "i,d = divmod(n, 1); #divides the value of n into integer and decimal parts where i is integer\n",
+ "\n",
+ "#Result\n",
+ "print \"value of n is\",n\n",
+ "print \"The highest order of spectra obtained with diffraction grating is\",i\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "value of n is 2.565\nThe highest order of spectra obtained with diffraction grating is 2.0\n"
+ "text": [
+ "value of n is 2.565\n",
+ "The highest order of spectra obtained with diffraction grating is 2.0\n"
+ ]
}
],
"prompt_number": 8
@@ -101,19 +228,56 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.5, Page number 92"
+ "source": [
+ "Example number 4.5, Page number 92"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To show that the blue line and red line overlap\n\n#importing modules\nimport math\n\n#Variable declaration\nN = 4000; #Number of lines per cm on grating\n#For Blue Line\nlamda1 = 450; #Wavelength of blue light(nm)\nn1 = 3; #Order of diffraction spectrum\n#For Red Line\nlamda2 = 700; #Wavelength of red light(nm)\nn2 = 2; #Order of diffraction spectrum\n\n#Calculation\nN = N*10**2; #Number of lines per m on grating\nlamda1 = lamda1*10**-9; #Wavelength of blue light(m)\nlamda2 = lamda2*10**-9; #Wavelength of red light(m)\n#We have sin(theta) = n*N*lambda, solving for sin(theta)\nsin_theta_3 = n1*N*lamda1; #Sine of angle at third order diffraction \nsin_theta_2 = n2*N*lamda2; #Sine of angle at second order diffraction\n\n#Result\nprint \"Sine of angle at third order diffraction is\",sin_theta_3\nprint \"Sine of angle at second order diffraction is\",sin_theta_2 \n#Check for overlapping\nif (sin_theta_2-sin_theta_3)<0.05:\n print \"The two orders overlap\"\nelse:\n print \"The two orders do not overlap\" ",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "N = 4000; #Number of lines per cm on grating\n",
+ "#For Blue Line\n",
+ "lamda1 = 450; #Wavelength of blue light(nm)\n",
+ "n1 = 3; #Order of diffraction spectrum\n",
+ "#For Red Line\n",
+ "lamda2 = 700; #Wavelength of red light(nm)\n",
+ "n2 = 2; #Order of diffraction spectrum\n",
+ "\n",
+ "#Calculation\n",
+ "N = N*10**2; #Number of lines per m on grating\n",
+ "lamda1 = lamda1*10**-9; #Wavelength of blue light(m)\n",
+ "lamda2 = lamda2*10**-9; #Wavelength of red light(m)\n",
+ "#We have sin(theta) = n*N*lambda, solving for sin(theta)\n",
+ "sin_theta_3 = n1*N*lamda1; #Sine of angle at third order diffraction \n",
+ "sin_theta_2 = n2*N*lamda2; #Sine of angle at second order diffraction\n",
+ "\n",
+ "#Result\n",
+ "print \"Sine of angle at third order diffraction is\",sin_theta_3\n",
+ "print \"Sine of angle at second order diffraction is\",sin_theta_2 \n",
+ "#Check for overlapping\n",
+ "if (sin_theta_2-sin_theta_3)<0.05:\n",
+ " print \"The two orders overlap\"\n",
+ "else:\n",
+ " print \"The two orders do not overlap\" "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Sine of angle at third order diffraction is 0.54\nSine of angle at second order diffraction is 0.56\nThe two orders overlap\n"
+ "text": [
+ "Sine of angle at third order diffraction is 0.54\n",
+ "Sine of angle at second order diffraction is 0.56\n",
+ "The two orders overlap\n"
+ ]
}
],
"prompt_number": 9
@@ -122,19 +286,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.6, Page number 93"
+ "source": [
+ "Example number 4.6, Page number 93"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the width of first order spectrum on the screen\n\n#importing modules\nimport math\n\n#Variable declaration\nn = 1; #Order of diffraction spectrum\nN = 6000; #Number of lines per cm on diffraction grating\nD = 2; #Distance of screen from the source(m)\nlamda1 = 400; #Wavelength of blue light(nm)\nlamda2 = 750; #Wavelength of blue light(nm)\n\n#Calculation\nN = N*10**2; #Number of lines per m on grating\nlamda1 = lamda1*10**-9; #Wavelength of blue light(m)\nlamda2 = lamda2*10**-9; #Wavelength of blue light(m)\n#We have sin(theta1) = n*N*lamda1, solving for theta1\ntheta1 = math.asin(n*N*lamda1); #Angle at first order diffraction for Blue light(rad)\ntheta1_d = theta1*57.2957795; #Angle at first order diffraction for Blue light(degrees)\ntheta2 = math.asin(n*N*lamda2); #Angle at first order diffraction for Red light(rad)\ntheta2_d = theta2*57.2957795; #Angle at first order diffraction for Red light(degrees)\nx1 = D*math.tan(theta1); #Half width position at central maximum for blue color(m)\nx2 = D*math.tan(theta2); #Half width position at central maximum for red color(m)\nx = x2-x1; #width of first order spectrum on the screen(m)\nx = x*10**2; #width of first order spectrum on the screen(cm)\nx = math.ceil(x*10**2)/10**2; #rounding off the value of x to 2 decimals\n\n#Result\nprint \"The width of first order spectrum on the screen is\",x, \"cm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n = 1; #Order of diffraction spectrum\n",
+ "N = 6000; #Number of lines per cm on diffraction grating\n",
+ "D = 2; #Distance of screen from the source(m)\n",
+ "lamda1 = 400; #Wavelength of blue light(nm)\n",
+ "lamda2 = 750; #Wavelength of blue light(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "N = N*10**2; #Number of lines per m on grating\n",
+ "lamda1 = lamda1*10**-9; #Wavelength of blue light(m)\n",
+ "lamda2 = lamda2*10**-9; #Wavelength of blue light(m)\n",
+ "#We have sin(theta1) = n*N*lamda1, solving for theta1\n",
+ "theta1 = math.asin(n*N*lamda1); #Angle at first order diffraction for Blue light(rad)\n",
+ "theta1_d = theta1*57.2957795; #Angle at first order diffraction for Blue light(degrees)\n",
+ "theta2 = math.asin(n*N*lamda2); #Angle at first order diffraction for Red light(rad)\n",
+ "theta2_d = theta2*57.2957795; #Angle at first order diffraction for Red light(degrees)\n",
+ "x1 = D*math.tan(theta1); #Half width position at central maximum for blue color(m)\n",
+ "x2 = D*math.tan(theta2); #Half width position at central maximum for red color(m)\n",
+ "x = x2-x1; #width of first order spectrum on the screen(m)\n",
+ "x = x*10**2; #width of first order spectrum on the screen(cm)\n",
+ "x = math.ceil(x*10**2)/10**2; #rounding off the value of x to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The width of first order spectrum on the screen is\",x, \"cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The width of first order spectrum on the screen is 51.34 cm\n"
+ "text": [
+ "The width of first order spectrum on the screen is 51.34 cm\n"
+ ]
}
],
"prompt_number": 10
@@ -143,19 +341,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.7, Page number 93"
+ "source": [
+ "Example number 4.7, Page number 93"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the least separation between wavelengths\n\n#importing modules\nimport math\n\n#Variable declaration\nw = 5; #Width of the grating(cm)\nN = 32; #Number of lines per mm on grating\nlamda = 640; #Wavelength of light(nm)\nn = 2; #Order of diffraction\n\n#Calculation\nN= N*10; #Number of lines per cm on grating\nN0 = w*N; #Total number of lines on the grating\nd_lambda = lamda/(n*N0); #Separation between wavelengths(nm)\n\n#Result\nprint \"The separation between wavelengths which the grating can just resolve is\",d_lambda, \"nm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "w = 5; #Width of the grating(cm)\n",
+ "N = 32; #Number of lines per mm on grating\n",
+ "lamda = 640; #Wavelength of light(nm)\n",
+ "n = 2; #Order of diffraction\n",
+ "\n",
+ "#Calculation\n",
+ "N= N*10; #Number of lines per cm on grating\n",
+ "N0 = w*N; #Total number of lines on the grating\n",
+ "d_lambda = lamda/(n*N0); #Separation between wavelengths(nm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The separation between wavelengths which the grating can just resolve is\",d_lambda, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The separation between wavelengths which the grating can just resolve is 0.2 nm\n"
+ "text": [
+ "The separation between wavelengths which the grating can just resolve is 0.2 nm\n"
+ ]
}
],
"prompt_number": 11
@@ -164,19 +385,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.8, Page number 93"
+ "source": [
+ "Example number 4.8, Page number 93"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the separation of the centres of the images in the focal plane\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda = 550; #Wavelength of light(nm)\nD = 3.2; #Diameter of circular lens(cm)\nf = 24; #Focal length of the lens(cm) \n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of light(m)\nD = D*10**-2; #Diameter of circular lens(m)\ntheta_min = 1.22*lamda/D; #Minimum angle of resolution provided by the lens(rad)\n#As delta_x/f = theta_min, solving for delta_x\nf = f*10**-2; #Focal length of the lens(m) \ndelta_x = theta_min*f; #Separation of the centres of the images in the focal plane of lens(m)\ndelta_x = delta_x*10**6; #Separation of the centres of the images in the focal plane of lens(micro m)\n \n#Result\nprint \"The separation of the centres of the images in the focal plane is\",round(delta_x), \"micro-metre\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 550; #Wavelength of light(nm)\n",
+ "D = 3.2; #Diameter of circular lens(cm)\n",
+ "f = 24; #Focal length of the lens(cm) \n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of light(m)\n",
+ "D = D*10**-2; #Diameter of circular lens(m)\n",
+ "theta_min = 1.22*lamda/D; #Minimum angle of resolution provided by the lens(rad)\n",
+ "#As delta_x/f = theta_min, solving for delta_x\n",
+ "f = f*10**-2; #Focal length of the lens(m) \n",
+ "delta_x = theta_min*f; #Separation of the centres of the images in the focal plane of lens(m)\n",
+ "delta_x = delta_x*10**6; #Separation of the centres of the images in the focal plane of lens(micro m)\n",
+ " \n",
+ "#Result\n",
+ "print \"The separation of the centres of the images in the focal plane is\",round(delta_x), \"micro-metre\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The separation of the centres of the images in the focal plane is 5.0 micro-metre\n"
+ "text": [
+ "The separation of the centres of the images in the focal plane is 5.0 micro-metre\n"
+ ]
}
],
"prompt_number": 12
@@ -185,19 +432,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.9, Page number 94"
+ "source": [
+ "Example number 4.9, Page number 94"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the linear separation between two points\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 550; #Wavelength of light(nm)\nD = 20; #Diameter of objective of telescope(cm)\nd = 6; #Distance of two points from the objective of telescope(km)\n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of light(m)\nD = D*10**-2; #Diameter of objective of telescope(m)\nd = d*10**3; #Distance of two points from the objective of telescope(m)\ntheta = 1.22*lamda/D; #Angular separation between two points(rad)\nx = theta*d; #Linear separation between two points(m)\nx = x*10**3; #Linear separation between two points(mm)\n\n#Result\nprint \"The linear separation between two points is\",x, \"mm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 550; #Wavelength of light(nm)\n",
+ "D = 20; #Diameter of objective of telescope(cm)\n",
+ "d = 6; #Distance of two points from the objective of telescope(km)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of light(m)\n",
+ "D = D*10**-2; #Diameter of objective of telescope(m)\n",
+ "d = d*10**3; #Distance of two points from the objective of telescope(m)\n",
+ "theta = 1.22*lamda/D; #Angular separation between two points(rad)\n",
+ "x = theta*d; #Linear separation between two points(m)\n",
+ "x = x*10**3; #Linear separation between two points(mm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The linear separation between two points is\",x, \"mm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The linear separation between two points is 20.13 mm\n"
+ "text": [
+ "The linear separation between two points is 20.13 mm\n"
+ ]
}
],
"prompt_number": 13
@@ -205,7 +478,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter5_1.ipynb b/Engineering_Physics_Aruldhas/Chapter5_1.ipynb
index 3731e0ad..8b5822ee 100644
--- a/Engineering_Physics_Aruldhas/Chapter5_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter5_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter5"
+ "name": "",
+ "signature": "sha256:d6b4557b658267af4573aff55394c33f7ae58a19c1bc5291838cb933f306de2e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,59 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "5: Polarization"
+ "source": [
+ "5: Polarization"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.1, Page number 113"
+ "source": [
+ "Example number 5.1, Page number 113"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle of incidence for complete polarization\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nmew_g = 1.72; #Refractive index of glass\nmew_w = 4/3; #Refractive index of water\n\n#Calculation\n#For polarization to occur on flint glass, tan(i) = mew_g/mew_w\n#Solving for i\ni_g = math.atan(mew_g/mew_w); #angle of incidence for complete polarization for flint glass(rad)\na = 180/math.pi; #conversion factor from radians to degrees\ni_g = i_g*a; #angle of incidence(degrees)\ni_g = math.ceil(i_g*10**2)/10**2; #rounding off the value of i_g to 2 decimals\n#For polarization to occur on water, tan(i) = mew_w/mew_g\n#Solving for i\ni_w = math.atan(mew_w/mew_g); #angle of incidence for complete polarization for water(rad)\ni_w = i_w*a; #angle of incidence(degrees)\ni_w = math.ceil(i_w*10**3)/10**3; #rounding off the value of i_w to 3 decimals\n\n#Result\nprint \"The angle of incidence for complete polarization to occur on flint glass is\",i_g, \"degrees\"\nprint \"The angle of incidence for complete polarization to occur on water is\",i_w, \"degrees\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_g = 1.72; #Refractive index of glass\n",
+ "mew_w = 4/3; #Refractive index of water\n",
+ "\n",
+ "#Calculation\n",
+ "#For polarization to occur on flint glass, tan(i) = mew_g/mew_w\n",
+ "#Solving for i\n",
+ "i_g = math.atan(mew_g/mew_w); #angle of incidence for complete polarization for flint glass(rad)\n",
+ "a = 180/math.pi; #conversion factor from radians to degrees\n",
+ "i_g = i_g*a; #angle of incidence(degrees)\n",
+ "i_g = math.ceil(i_g*10**2)/10**2; #rounding off the value of i_g to 2 decimals\n",
+ "#For polarization to occur on water, tan(i) = mew_w/mew_g\n",
+ "#Solving for i\n",
+ "i_w = math.atan(mew_w/mew_g); #angle of incidence for complete polarization for water(rad)\n",
+ "i_w = i_w*a; #angle of incidence(degrees)\n",
+ "i_w = math.ceil(i_w*10**3)/10**3; #rounding off the value of i_w to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The angle of incidence for complete polarization to occur on flint glass is\",i_g, \"degrees\"\n",
+ "print \"The angle of incidence for complete polarization to occur on water is\",i_w, \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The angle of incidence for complete polarization to occur on flint glass is 52.22 degrees\nThe angle of incidence for complete polarization to occur on water is 37.783 degrees\n"
+ "text": [
+ "The angle of incidence for complete polarization to occur on flint glass is 52.22 degrees\n",
+ "The angle of incidence for complete polarization to occur on water is 37.783 degrees\n"
+ ]
}
],
"prompt_number": 5
@@ -38,19 +73,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.2, Page number 113"
+ "source": [
+ "Example number 5.2, Page number 113"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the percentage transmission of incident light\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nI0 = 1; #For simplicity, we assume the intensity of light falling on the second Nicol prism to be unity(W/m**2)\ntheta = 30; #Angle through which the crossed Nicol is rotated(degrees)\n\n#Calculation\ntheeta = 90-theta; #angle between the planes of transmission after rotating through 30 degrees\na = math.pi/180; #conversion factor from degrees to radians\ntheeta = theeta*a; ##angle between the planes of transmission(rad)\nI = I0*math.cos(theeta)**2; #Intensity of the emerging light from second Nicol(W/m**2)\nT = (I/(2*I0))*100; #Percentage transmission of incident light\nT = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n\n#Result\nprint \"The percentage transmission of incident light after emerging through the Nicol prism is\",T, \"%\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "I0 = 1; #For simplicity, we assume the intensity of light falling on the second Nicol prism to be unity(W/m**2)\n",
+ "theta = 30; #Angle through which the crossed Nicol is rotated(degrees)\n",
+ "\n",
+ "#Calculation\n",
+ "theeta = 90-theta; #angle between the planes of transmission after rotating through 30 degrees\n",
+ "a = math.pi/180; #conversion factor from degrees to radians\n",
+ "theeta = theeta*a; ##angle between the planes of transmission(rad)\n",
+ "I = I0*math.cos(theeta)**2; #Intensity of the emerging light from second Nicol(W/m**2)\n",
+ "T = (I/(2*I0))*100; #Percentage transmission of incident light\n",
+ "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The percentage transmission of incident light after emerging through the Nicol prism is\",T, \"%\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The percentage transmission of incident light after emerging through the Nicol prism is 12.51 %\n"
+ "text": [
+ "The percentage transmission of incident light after emerging through the Nicol prism is 12.51 %\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +119,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.3, Page number 113"
+ "source": [
+ "Example number 5.3, Page number 113"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the thickness of Quarter Wave plate\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nlamda = 6000; #Wavelength of incident light(A)\nmew_e = 1.55; #Refractive index of extraordinary ray\nmew_o = 1.54; #Refractive index of ordinary ray\n\n#Calculation\nlamda = lamda*10**-8; #Wavelength of incident light(cm)\nt = lamda/(4*(mew_e-mew_o)); #Thickness of Quarter Wave plate of positive crystal(cm)\n\n#Result\nprint \"The thickness of Quarter Wave plate is\",t, \"cm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 6000; #Wavelength of incident light(A)\n",
+ "mew_e = 1.55; #Refractive index of extraordinary ray\n",
+ "mew_o = 1.54; #Refractive index of ordinary ray\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-8; #Wavelength of incident light(cm)\n",
+ "t = lamda/(4*(mew_e-mew_o)); #Thickness of Quarter Wave plate of positive crystal(cm)\n",
+ "\n",
+ "#Result\n",
+ "print \"The thickness of Quarter Wave plate is\",t, \"cm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The thickness of Quarter Wave plate is 0.0015 cm\n"
+ "text": [
+ "The thickness of Quarter Wave plate is 0.0015 cm\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +162,32 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.4, Page number 114"
+ "source": [
+ "Example number 5.4, Page number 114"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To show the behaviour of the plate\n\n#Calculation\n#the thickness of a half wave plate of calcite for wavelength lamda is\n#t = lamda/(2*(mew_e - mew_o)) = (2*lamda)/(4*(mew_e - mew_o))\n\n#Result\nprint \"The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "#the thickness of a half wave plate of calcite for wavelength lamda is\n",
+ "#t = lamda/(2*(mew_e - mew_o)) = (2*lamda)/(4*(mew_e - mew_o))\n",
+ "\n",
+ "#Result\n",
+ "print \"The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\n"
+ "text": [
+ "The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\n"
+ ]
}
],
"prompt_number": 8
@@ -101,19 +196,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.5, Page number 114"
+ "source": [
+ "Example number 5.5, Page number 114"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the phase retardation\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nlamda = 500; #Wavelength of incident light(nm)\nmew_e = 1.5508; #Refractive index of extraordinary ray\nmew_o = 1.5418; #Refractive index of ordinary ray\nt = 0.032; #Thickness of quartz plate(mm)\n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of incident light(m)\nt = t*10**-3; #Thickness of quartz plate(m)\ndx = (mew_e - mew_o)*t; #Path difference between E-ray and O-ray(m)\ndphi = (2*math.pi)/lamda*dx; #Phase retardation for quartz for given wavelength(rad)\ndphi = dphi/math.pi;\n\n#Result\nprint \"The phase retardation for quartz for given wavelength is\",dphi, \"pi rad\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 500; #Wavelength of incident light(nm)\n",
+ "mew_e = 1.5508; #Refractive index of extraordinary ray\n",
+ "mew_o = 1.5418; #Refractive index of ordinary ray\n",
+ "t = 0.032; #Thickness of quartz plate(mm)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of incident light(m)\n",
+ "t = t*10**-3; #Thickness of quartz plate(m)\n",
+ "dx = (mew_e - mew_o)*t; #Path difference between E-ray and O-ray(m)\n",
+ "dphi = (2*math.pi)/lamda*dx; #Phase retardation for quartz for given wavelength(rad)\n",
+ "dphi = dphi/math.pi;\n",
+ "\n",
+ "#Result\n",
+ "print \"The phase retardation for quartz for given wavelength is\",dphi, \"pi rad\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The phase retardation for quartz for given wavelength is 1.152 pi rad\n"
+ "text": [
+ "The phase retardation for quartz for given wavelength is 1.152 pi rad\n"
+ ]
}
],
"prompt_number": 9
@@ -122,19 +242,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 5.6, Page number 114"
+ "source": [
+ "Example number 5.6, Page number 114"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Brewster angle at the boundary\n\n#importing modules\nimport math\n\n#Variable declaration\nC = 52; #Critical angle for total internal reflection(degrees)\n\n#Calculation\na = math.pi/180; #conversion factor from degrees to radians\nC = C*a; #Critical angle for total internal reflection(rad)\n#From Brewster's law, math.tan(i_B) = 1_mew_2\n#Also math.sin(C) = 1_mew_2, so that math.tan(i_B) = math.sin(C), solving for i_B\ni_B = math.atan(math.sin(C)); #Brewster angle at the boundary(rad)\nb = 180/math.pi; #conversion factor from radians to degrees\ni_B = i_B*b; #Brewster angle at the boundary(degrees)\n\n#Result\nprint \"The Brewster angle at the boundary between two materials is\",int(i_B), \"degrees\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "C = 52; #Critical angle for total internal reflection(degrees)\n",
+ "\n",
+ "#Calculation\n",
+ "a = math.pi/180; #conversion factor from degrees to radians\n",
+ "C = C*a; #Critical angle for total internal reflection(rad)\n",
+ "#From Brewster's law, math.tan(i_B) = 1_mew_2\n",
+ "#Also math.sin(C) = 1_mew_2, so that math.tan(i_B) = math.sin(C), solving for i_B\n",
+ "i_B = math.atan(math.sin(C)); #Brewster angle at the boundary(rad)\n",
+ "b = 180/math.pi; #conversion factor from radians to degrees\n",
+ "i_B = i_B*b; #Brewster angle at the boundary(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"The Brewster angle at the boundary between two materials is\",int(i_B), \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Brewster angle at the boundary between two materials is 38 degrees\n"
+ "text": [
+ "The Brewster angle at the boundary between two materials is 38 degrees\n"
+ ]
}
],
"prompt_number": 13
@@ -142,7 +286,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": [],
diff --git a/Engineering_Physics_Aruldhas/Chapter6_1.ipynb b/Engineering_Physics_Aruldhas/Chapter6_1.ipynb
index 889b1e18..0de10069 100644
--- a/Engineering_Physics_Aruldhas/Chapter6_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter6_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter6"
+ "name": "",
+ "signature": "sha256:1812f754f8541ce5ac6b5aaa71f7eac9ff30ca728d742f618ea7c5d3873d8a96"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,51 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "6: Crystallography"
+ "source": [
+ "6: Crystallography"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.1, Page number 134"
+ "source": [
+ "Example number 6.1, Page number 134"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lattice parameter\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nM = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\nd = 2.18*10**3; #Density of rock salt(kg/m**3)\nn = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\nN = 6.02*10**26; #Avogadro's No., atoms/k-mol\n\n#Calculation\na = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\na = a*10**9; ##Lattice constant of unit cell of NaCl(nm)\na = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n\n#Result\nprint \"Lattice parameter for the NaCl crystal is\",a, \"nm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n",
+ "d = 2.18*10**3; #Density of rock salt(kg/m**3)\n",
+ "n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\n",
+ "N = 6.02*10**26; #Avogadro's No., atoms/k-mol\n",
+ "\n",
+ "#Calculation\n",
+ "a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\n",
+ "a = a*10**9; ##Lattice constant of unit cell of NaCl(nm)\n",
+ "a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"Lattice parameter for the NaCl crystal is\",a, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Lattice parameter for the NaCl crystal is 0.563 nm\n"
+ "text": [
+ "Lattice parameter for the NaCl crystal is 0.563 nm\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +65,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.2, Page number 134"
+ "source": [
+ "Example number 6.2, Page number 134"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the miller indices of the plane\n\n#importing modules\nimport math\n\n#Variable declaration\nm = 3;\nn = 2; \np = 1; #Coefficients of intercepts along three axes\n\n#Calculation\n#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/3, 1/2, 1\n#multiplying by LCM the reciprocals become 2, 3, 6\n\n#Result\nprint \"The required miller indices are : (2, 3, 6)\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "m = 3;\n",
+ "n = 2; \n",
+ "p = 1; #Coefficients of intercepts along three axes\n",
+ "\n",
+ "#Calculation\n",
+ "#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/3, 1/2, 1\n",
+ "#multiplying by LCM the reciprocals become 2, 3, 6\n",
+ "\n",
+ "#Result\n",
+ "print \"The required miller indices are : (2, 3, 6)\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required miller indices are : (2, 3, 6)\n"
+ "text": [
+ "The required miller indices are : (2, 3, 6)\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +107,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.3, Page number 135"
+ "source": [
+ "Example number 6.3, Page number 135"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the miller indices of the plane\n\n#importing modules\nimport math\n\n#Variable declaration\nm = 2; #Coefficient of intercept along x-axis\n#n = infinite Coefficient of intercept along y-axis\np = 3/2; #Coefficient of intercept along z-axis\n\n#Calculation\n#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/2, 0, 2/3\n#multiplying by LCM the reciprocals become 3, 0, 4\n\n#Result\nprint \"The required miller indices are : (3, 0, 4)\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "m = 2; #Coefficient of intercept along x-axis\n",
+ "#n = infinite Coefficient of intercept along y-axis\n",
+ "p = 3/2; #Coefficient of intercept along z-axis\n",
+ "\n",
+ "#Calculation\n",
+ "#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/2, 0, 2/3\n",
+ "#multiplying by LCM the reciprocals become 3, 0, 4\n",
+ "\n",
+ "#Result\n",
+ "print \"The required miller indices are : (3, 0, 4)\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required miller indices are : (3, 0, 4)\n"
+ "text": [
+ "The required miller indices are : (3, 0, 4)\n"
+ ]
}
],
"prompt_number": 3
@@ -80,25 +149,60 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.4, Sketching not possible"
+ "source": [
+ "Example number 6.4, Sketching not possible"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.5, Page number 136"
+ "source": [
+ "Example number 6.5, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the interplanar spacing between planes\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\n#For (110) planes\nh1 = 1;\nk1 = 1;\nl1 = 0; #Miller Indices for planes in a cubic crystal\na1 = 0.43; #Interatomic spacing(nm)\n#For (212) planes\nh2 = 2; \nk2 = 1;\nl2 = 2; #Miller Indices for planes in a cubic crystal\na2 = 0.43; #Interatomic spacing(nm)\n\n#Calculation\nd1 = a1/(h1**2+k1**2+l1**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\nd1 = math.ceil(d1*10**4)/10**4; #rounding off the value of d1 to 4 decimals\nd2 = a2/(h2**2+k2**2+l2**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\nd2 = math.ceil(d2*10**4)/10**4; #rounding off the value of d2 to 4 decimals\n\n#Result\nprint \"The interplanar spacing between consecutive (110) planes is\",d1, \"nm\";\nprint \"The interplanar spacing between consecutive (212) planes is\",d2, \"nm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "#For (110) planes\n",
+ "h1 = 1;\n",
+ "k1 = 1;\n",
+ "l1 = 0; #Miller Indices for planes in a cubic crystal\n",
+ "a1 = 0.43; #Interatomic spacing(nm)\n",
+ "#For (212) planes\n",
+ "h2 = 2; \n",
+ "k2 = 1;\n",
+ "l2 = 2; #Miller Indices for planes in a cubic crystal\n",
+ "a2 = 0.43; #Interatomic spacing(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "d1 = a1/(h1**2+k1**2+l1**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n",
+ "d1 = math.ceil(d1*10**4)/10**4; #rounding off the value of d1 to 4 decimals\n",
+ "d2 = a2/(h2**2+k2**2+l2**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n",
+ "d2 = math.ceil(d2*10**4)/10**4; #rounding off the value of d2 to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The interplanar spacing between consecutive (110) planes is\",d1, \"nm\";\n",
+ "print \"The interplanar spacing between consecutive (212) planes is\",d2, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The interplanar spacing between consecutive (110) planes is 0.3041 nm\nThe interplanar spacing between consecutive (212) planes is 0.1434 nm\n"
+ "text": [
+ "The interplanar spacing between consecutive (110) planes is 0.3041 nm\n",
+ "The interplanar spacing between consecutive (212) planes is 0.1434 nm\n"
+ ]
}
],
"prompt_number": 4
@@ -107,19 +211,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.6, Page number 136"
+ "source": [
+ "Example number 6.6, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the interplanar spacing between planes\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 2;\nk = 3;\nl = 1; #Miller Indices for planes in a cubic crystal\nr = 0.175; #Atomic radius of fcc lattice(nm)\n\n#Calculation\na = 2*math.sqrt(2)*r; #Interatomic spacing of fcc lattice(nm)\nd = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\nd = math.ceil(d*10**4)/10**4; #rounding off the value of d to 4 decimals\n\n#Result\nprint \"The interplanar spacing between consecutive (231) planes is\",d, \"nm\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 2;\n",
+ "k = 3;\n",
+ "l = 1; #Miller Indices for planes in a cubic crystal\n",
+ "r = 0.175; #Atomic radius of fcc lattice(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "a = 2*math.sqrt(2)*r; #Interatomic spacing of fcc lattice(nm)\n",
+ "d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n",
+ "d = math.ceil(d*10**4)/10**4; #rounding off the value of d to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The interplanar spacing between consecutive (231) planes is\",d, \"nm\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The interplanar spacing between consecutive (231) planes is 0.1323 nm\n"
+ "text": [
+ "The interplanar spacing between consecutive (231) planes is 0.1323 nm\n"
+ ]
}
],
"prompt_number": 5
@@ -128,19 +256,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.7, Page number 136"
+ "source": [
+ "Example number 6.7, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle of diffraction\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nlamda = 1.44; #Wavelength of X-rays(A)\nd = 2.8; #Interplanar spacing of rocksalt crystal(A)\nn1 = 1; #For 1st Order diffraction\nn2 = 2; #For 2nd Order diffraction\n\n#Calculation\ntheta1 = math.asin(n1*lamda/(2*d)); #Angle of diffraction(radians)\ntheeta1 = theta1*57.2957795; #Angle of diffraction(degrees)\ntheeta1 = math.ceil(theeta1*10**2)/10**2; #rounding off the value of theeta1 to 2 decimals\ntheta2 = math.asin(n2*lamda/(2*d)); #Angle of diffraction(radians)\ntheeta2 = theta2*57.2957795; #Angle of diffraction(degrees)\ntheeta2 = math.ceil(theeta2*10**2)/10**2; #rounding off the value of theeta2 to 2 decimals\n\n#Result\nprint \"The angle of diffraction for first order maxima is\",theeta1, \"degrees\"\nprint \"The angle of diffraction for second order maxima is\",theeta2, \"degrees\"\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda = 1.44; #Wavelength of X-rays(A)\n",
+ "d = 2.8; #Interplanar spacing of rocksalt crystal(A)\n",
+ "n1 = 1; #For 1st Order diffraction\n",
+ "n2 = 2; #For 2nd Order diffraction\n",
+ "\n",
+ "#Calculation\n",
+ "theta1 = math.asin(n1*lamda/(2*d)); #Angle of diffraction(radians)\n",
+ "theeta1 = theta1*57.2957795; #Angle of diffraction(degrees)\n",
+ "theeta1 = math.ceil(theeta1*10**2)/10**2; #rounding off the value of theeta1 to 2 decimals\n",
+ "theta2 = math.asin(n2*lamda/(2*d)); #Angle of diffraction(radians)\n",
+ "theeta2 = theta2*57.2957795; #Angle of diffraction(degrees)\n",
+ "theeta2 = math.ceil(theeta2*10**2)/10**2; #rounding off the value of theeta2 to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The angle of diffraction for first order maxima is\",theeta1, \"degrees\"\n",
+ "print \"The angle of diffraction for second order maxima is\",theeta2, \"degrees\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The angle of diffraction for first order maxima is 14.91 degrees\nThe angle of diffraction for second order maxima is 30.95 degrees\n"
+ "text": [
+ "The angle of diffraction for first order maxima is 14.91 degrees\n",
+ "The angle of diffraction for second order maxima is 30.95 degrees\n"
+ ]
}
],
"prompt_number": 6
@@ -149,19 +305,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.8, Page number 136"
+ "source": [
+ "Example number 6.8, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the percentage of actual volume occupied by the spheres\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\na = 1; #For convenience, assume interatomic spacing to be unity(m)\n\n#Calculation\nN = 8*(1/8) + 6*(1/2); #total number of spheres in a unit cell\nr = a/(2*math.sqrt(2)); #The atomic radius(m)\nV_atom = N*(4/3)*math.pi*r**3; #Volume of atoms(m**3)\nV_uc = a**3; #Volume of unit cell(m**3)\nPV = (V_atom/V_uc)*100; #percentage of actual volume\nPV = math.ceil(PV*10)/10; #rounding off the value of PV to 1 decimal\n\n#Result\nprint \"The percentage of actual volume occupied by the spheres in fcc structure is\",PV, \"percent\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "a = 1; #For convenience, assume interatomic spacing to be unity(m)\n",
+ "\n",
+ "#Calculation\n",
+ "N = 8*(1/8) + 6*(1/2); #total number of spheres in a unit cell\n",
+ "r = a/(2*math.sqrt(2)); #The atomic radius(m)\n",
+ "V_atom = N*(4/3)*math.pi*r**3; #Volume of atoms(m**3)\n",
+ "V_uc = a**3; #Volume of unit cell(m**3)\n",
+ "PV = (V_atom/V_uc)*100; #percentage of actual volume\n",
+ "PV = math.ceil(PV*10)/10; #rounding off the value of PV to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The percentage of actual volume occupied by the spheres in fcc structure is\",PV, \"percent\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The percentage of actual volume occupied by the spheres in fcc structure is 74.1 percent\n"
+ "text": [
+ "The percentage of actual volume occupied by the spheres in fcc structure is 74.1 percent\n"
+ ]
}
],
"prompt_number": 7
@@ -170,19 +349,57 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.9, Page number 137"
+ "source": [
+ "Example number 6.9, Page number 137"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the interplanar spacing, wavelength and angle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\n#For (221) planes\nh = 2; \nk = 2; \nl = 1; #Miller Indices for planes in a cubic crystal\na = 2.68; #Interatomic spacing(A)\nn1 = 1; #First Order of diffraction \nn2 = 2; #Second order of diffraction\ntheta1 = 8.5; #Glancing angle at which Bragg's reflection occurs(degrees)\n\n#Calculation\ntheta1 = theta1*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\na = a*10**-10; #Interatomic spacing(m)\nd = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystal(m)\nlamda = 2*d*math.sin(theta1)/n1; #Bragg's Law for wavelength of X-rays(m)\nlamda_A = lamda*10**10; #Bragg's Law for wavelength of X-rays(A)\nlamda_A = math.ceil(lamda_A*10**4)/10**4; #rounding off the value of lamda_A to 4 decimals\ntheta2 = math.asin(n2*lamda/(2*d)); #Angle at which second order Bragg reflection occurs(radians)\ntheta2 = theta2*57.2957795; #Angle at which second order Bragg reflection occurs(degrees)\ntheta2 = math.ceil(theta2*10)/10; #rounding off the value of theta2 to 1 decimal\n\n#Result\nprint \"The interplanar spacing between consecutive (221) planes is\",d, \"m\"\nprint \"The wavelength of X-rays is\",lamda_A, \"angstrom\"\nprint \"The angle at which second order Bragg reflection occurs is\",theta2, \"degrees\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "#For (221) planes\n",
+ "h = 2; \n",
+ "k = 2; \n",
+ "l = 1; #Miller Indices for planes in a cubic crystal\n",
+ "a = 2.68; #Interatomic spacing(A)\n",
+ "n1 = 1; #First Order of diffraction \n",
+ "n2 = 2; #Second order of diffraction\n",
+ "theta1 = 8.5; #Glancing angle at which Bragg's reflection occurs(degrees)\n",
+ "\n",
+ "#Calculation\n",
+ "theta1 = theta1*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n",
+ "a = a*10**-10; #Interatomic spacing(m)\n",
+ "d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystal(m)\n",
+ "lamda = 2*d*math.sin(theta1)/n1; #Bragg's Law for wavelength of X-rays(m)\n",
+ "lamda_A = lamda*10**10; #Bragg's Law for wavelength of X-rays(A)\n",
+ "lamda_A = math.ceil(lamda_A*10**4)/10**4; #rounding off the value of lamda_A to 4 decimals\n",
+ "theta2 = math.asin(n2*lamda/(2*d)); #Angle at which second order Bragg reflection occurs(radians)\n",
+ "theta2 = theta2*57.2957795; #Angle at which second order Bragg reflection occurs(degrees)\n",
+ "theta2 = math.ceil(theta2*10)/10; #rounding off the value of theta2 to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The interplanar spacing between consecutive (221) planes is\",d, \"m\"\n",
+ "print \"The wavelength of X-rays is\",lamda_A, \"angstrom\"\n",
+ "print \"The angle at which second order Bragg reflection occurs is\",theta2, \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The interplanar spacing between consecutive (221) planes is 8.93333333333e-11 m\nThe wavelength of X-rays is 0.2641 angstrom\nThe angle at which second order Bragg reflection occurs is 17.2 degrees\n"
+ "text": [
+ "The interplanar spacing between consecutive (221) planes is 8.93333333333e-11 m\n",
+ "The wavelength of X-rays is 0.2641 angstrom\n",
+ "The angle at which second order Bragg reflection occurs is 17.2 degrees\n"
+ ]
}
],
"prompt_number": 9
@@ -191,19 +408,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.10, Page number 137"
+ "source": [
+ "Example number 6.10, Page number 137"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lattice parameter for cubic crystal\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 1; \nk = 1;\nl = 0; #Miller Indices for planes in a cubic crystal\nn = 1; #First Order of diffraction \ntheta = 25; #Glancing angle at which Bragg's reflection occurs(degrees)\nlamda = 0.7; #Wavelength of X-rays(A)\n\n#Calculation\ntheta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\nd = n*lamda/(2*math.sin(theta)); #Interplanar spacing of cubic crystal(A)\na = d*(h**2+k**2+l**2)**(1/2); #The lattice parameter for cubic crystal(A)\na = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n\n#Result\nprint \"The lattice parameter for cubic crystal is\",a, \"angstrom\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 1; \n",
+ "k = 1;\n",
+ "l = 0; #Miller Indices for planes in a cubic crystal\n",
+ "n = 1; #First Order of diffraction \n",
+ "theta = 25; #Glancing angle at which Bragg's reflection occurs(degrees)\n",
+ "lamda = 0.7; #Wavelength of X-rays(A)\n",
+ "\n",
+ "#Calculation\n",
+ "theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n",
+ "d = n*lamda/(2*math.sin(theta)); #Interplanar spacing of cubic crystal(A)\n",
+ "a = d*(h**2+k**2+l**2)**(1/2); #The lattice parameter for cubic crystal(A)\n",
+ "a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The lattice parameter for cubic crystal is\",a, \"angstrom\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The lattice parameter for cubic crystal is 1.172 angstrom\n"
+ "text": [
+ "The lattice parameter for cubic crystal is 1.172 angstrom\n"
+ ]
}
],
"prompt_number": 10
@@ -212,19 +456,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.11, Page number 138"
+ "source": [
+ "Example number 6.11, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of X-rays and maximum possible order of diffraction\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nd = 0.31; #Interplanar spacing(nm)\nn = 1; #First Order of diffraction \ntheta = 9.25; #Glancing angle at which Bragg's reflection occurs(degrees)\ntheta_max = 90; #Maximum possible angle at which reflection can occur(degrees)\ntheta_max = theta_max*0.0174532925; #Maximum possible angle at which reflection can occur(radians)\n\n#Calculation\ntheta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\nlamda = 2*d*math.sin(theta)/n; #Wavelength of X-rays(nm) (Bragg's Law)\nlamda = math.ceil(lamda*10**5)/10**5; #rounding off the value of lamda to 5 decimals\nn = 2*d*math.sin(theta_max)/lamda; #Maximum possible order of diffraction\n\n#Result\nprint \"The wavelength of X-rays is\",lamda, \"nm\"\nprint \"The Maximum possible order of diffraction is\",round(n)",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "d = 0.31; #Interplanar spacing(nm)\n",
+ "n = 1; #First Order of diffraction \n",
+ "theta = 9.25; #Glancing angle at which Bragg's reflection occurs(degrees)\n",
+ "theta_max = 90; #Maximum possible angle at which reflection can occur(degrees)\n",
+ "theta_max = theta_max*0.0174532925; #Maximum possible angle at which reflection can occur(radians)\n",
+ "\n",
+ "#Calculation\n",
+ "theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n",
+ "lamda = 2*d*math.sin(theta)/n; #Wavelength of X-rays(nm) (Bragg's Law)\n",
+ "lamda = math.ceil(lamda*10**5)/10**5; #rounding off the value of lamda to 5 decimals\n",
+ "n = 2*d*math.sin(theta_max)/lamda; #Maximum possible order of diffraction\n",
+ "\n",
+ "#Result\n",
+ "print \"The wavelength of X-rays is\",lamda, \"nm\"\n",
+ "print \"The Maximum possible order of diffraction is\",round(n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wavelength of X-rays is 0.09967 nm\nThe Maximum possible order of diffraction is 6.0\n"
+ "text": [
+ "The wavelength of X-rays is 0.09967 nm\n",
+ "The Maximum possible order of diffraction is 6.0\n"
+ ]
}
],
"prompt_number": 11
@@ -233,19 +504,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.12, Page number 138"
+ "source": [
+ "Example number 6.12, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Bragg reflection angle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\n#For (110) planes\nh1 = 1;\nk1 = 1;\nl1 = 0; #Miller indices for (110) planes\nd_110 = 0.195; #Interplanar spacing between (110) planes(nm)\n#For (210) planes\nh2 = 2;\nk2 = 1; \nl2 = 0; #Miller indices for (110) planes\nn = 2; #Second Order of diffraction \nlamda = 0.071; #Wavelength of X-rays(nm)\n\n#Calculation\na = d_110*(h1**2 + k1**2 + l1**2)**(1/2); #Lattice parameter for bcc crystal(nm)\nd_210 = a/(h2**2 + k2**2 + l2**2)**(1/2); #Interplanar spacing between (210) planes(nm)\ntheta = math.asin(n*lamda/(2*d_210)); #Bragg reflection angle for the second order diffraction(radians)\ntheeta = theta*57.2957795; #Bragg reflection angle for the second order diffraction(degrees)\ntheeta = math.ceil(theeta*10**3)/10**3; #rounding off the value of theeta to 3 decimals\n\n#Result\nprint \"Bragg reflection angle for the second order diffraction is\",theeta, \"degrees\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "#For (110) planes\n",
+ "h1 = 1;\n",
+ "k1 = 1;\n",
+ "l1 = 0; #Miller indices for (110) planes\n",
+ "d_110 = 0.195; #Interplanar spacing between (110) planes(nm)\n",
+ "#For (210) planes\n",
+ "h2 = 2;\n",
+ "k2 = 1; \n",
+ "l2 = 0; #Miller indices for (110) planes\n",
+ "n = 2; #Second Order of diffraction \n",
+ "lamda = 0.071; #Wavelength of X-rays(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "a = d_110*(h1**2 + k1**2 + l1**2)**(1/2); #Lattice parameter for bcc crystal(nm)\n",
+ "d_210 = a/(h2**2 + k2**2 + l2**2)**(1/2); #Interplanar spacing between (210) planes(nm)\n",
+ "theta = math.asin(n*lamda/(2*d_210)); #Bragg reflection angle for the second order diffraction(radians)\n",
+ "theeta = theta*57.2957795; #Bragg reflection angle for the second order diffraction(degrees)\n",
+ "theeta = math.ceil(theeta*10**3)/10**3; #rounding off the value of theeta to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"Bragg reflection angle for the second order diffraction is\",theeta, \"degrees\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Bragg reflection angle for the second order diffraction is 35.149 degrees\n"
+ "text": [
+ "Bragg reflection angle for the second order diffraction is 35.149 degrees\n"
+ ]
}
],
"prompt_number": 12
@@ -254,19 +557,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.13, Page number 138"
+ "source": [
+ "Example number 6.13, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the distance between nearest neighbours\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nd = 2182; #Density of rock salt(kg/m**3)\nn = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\nN = 6.02*10**26; #Avogadro's number(atoms/k-mol)\n\n#Calculation\nM = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n#V = a^3 = M*n/(N*d)\na = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\nD = a/2; #distance between nearest neighbours(m)\nD = D*10**9; #distance between nearest neighbours(nm)\nD = math.ceil(D*10**4)/10**4; #rounding off the value of D to 4 decimals\n\n#Result\nprint \"The distance between nearest neighbours of NaCl structure is\",D, \"nm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "d = 2182; #Density of rock salt(kg/m**3)\n",
+ "n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\n",
+ "N = 6.02*10**26; #Avogadro's number(atoms/k-mol)\n",
+ "\n",
+ "#Calculation\n",
+ "M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n",
+ "#V = a^3 = M*n/(N*d)\n",
+ "a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\n",
+ "D = a/2; #distance between nearest neighbours(m)\n",
+ "D = D*10**9; #distance between nearest neighbours(nm)\n",
+ "D = math.ceil(D*10**4)/10**4; #rounding off the value of D to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The distance between nearest neighbours of NaCl structure is\",D, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The distance between nearest neighbours of NaCl structure is 0.2814 nm\n"
+ "text": [
+ "The distance between nearest neighbours of NaCl structure is 0.2814 nm\n"
+ ]
}
],
"prompt_number": 13
@@ -275,19 +604,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.14, Page number 139"
+ "source": [
+ "Example number 6.14, Page number 139"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the percentage change in volume\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nr1 = 1.258; #Atomic radius of bcc structure of iron(A)\nN1 = 2; #Number of atoms per unit cell in bcc structure\n#For fcc structure\nr2 = 1.292; #Atomic radius of fcc structure of iron(A)\nN2 = 4; #Number of atoms per unit cell in fcc structure\n\n#Calculation\na1 = 4*r1/math.sqrt(3); #Lattice parameter of bcc structure of iron(A)\nV1 = a1**3; #Volume of bcc unit cell(A)\nV_atom_bcc = V1/N1; #Volume occupied by one atom(A)\na2 = 2*math.sqrt(2)*r2; #Lattice parameter of fcc structure of iron(A)\nV2 = a2**3; #Volume of fcc unit cell(A)\nV_atom_fcc = V2/N2; #Volume occupied by one atom(A)\ndelta_V = (V_atom_bcc-V_atom_fcc)/V_atom_bcc*100; #Percentage change in volume due to structural change of iron\ndelta_V = math.ceil(delta_V*10**3)/10**3; #rounding off the value of delta_V to 3 decimals\n\n#Result\nprint \"The percentage change in volume of iron is\",delta_V, \"percent\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "r1 = 1.258; #Atomic radius of bcc structure of iron(A)\n",
+ "N1 = 2; #Number of atoms per unit cell in bcc structure\n",
+ "#For fcc structure\n",
+ "r2 = 1.292; #Atomic radius of fcc structure of iron(A)\n",
+ "N2 = 4; #Number of atoms per unit cell in fcc structure\n",
+ "\n",
+ "#Calculation\n",
+ "a1 = 4*r1/math.sqrt(3); #Lattice parameter of bcc structure of iron(A)\n",
+ "V1 = a1**3; #Volume of bcc unit cell(A)\n",
+ "V_atom_bcc = V1/N1; #Volume occupied by one atom(A)\n",
+ "a2 = 2*math.sqrt(2)*r2; #Lattice parameter of fcc structure of iron(A)\n",
+ "V2 = a2**3; #Volume of fcc unit cell(A)\n",
+ "V_atom_fcc = V2/N2; #Volume occupied by one atom(A)\n",
+ "delta_V = (V_atom_bcc-V_atom_fcc)/V_atom_bcc*100; #Percentage change in volume due to structural change of iron\n",
+ "delta_V = math.ceil(delta_V*10**3)/10**3; #rounding off the value of delta_V to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The percentage change in volume of iron is\",delta_V, \"percent\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The percentage change in volume of iron is 0.494 percent\n"
+ "text": [
+ "The percentage change in volume of iron is 0.494 percent\n"
+ ]
}
],
"prompt_number": 15
@@ -295,7 +654,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter7_1.ipynb b/Engineering_Physics_Aruldhas/Chapter7_1.ipynb
index 5b1859d1..750a9700 100644
--- a/Engineering_Physics_Aruldhas/Chapter7_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter7_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter7"
+ "name": "",
+ "signature": "sha256:7388a73b9b3de996a0d87179cb12d51f5ad7f3cb764b14aa844019e8d2cdb4ea"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,49 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "7: Superconductivity"
+ "source": [
+ "7: Superconductivity"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.1, Page number 152"
+ "source": [
+ "Example number 7.1, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical field\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nTc=3.722; #critical temperature(K)\nT=2; #temperature(K)\nBc_0=0.0305; #critical field(T)\n\n#Calculation\nBc_T=Bc_0*(1-(T/Tc)**2); #critical field at 2K(T)\nBc_T = math.ceil(Bc_T*10**4)/10**4; #rounding off the value of Bc_T to 4 decimals\n\n#Result\nprint \"The critical field at 2K is\",Bc_T, \"T\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc=3.722; #critical temperature(K)\n",
+ "T=2; #temperature(K)\n",
+ "Bc_0=0.0305; #critical field(T)\n",
+ "\n",
+ "#Calculation\n",
+ "Bc_T=Bc_0*(1-(T/Tc)**2); #critical field at 2K(T)\n",
+ "Bc_T = math.ceil(Bc_T*10**4)/10**4; #rounding off the value of Bc_T to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The critical field at 2K is\",Bc_T, \"T\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The critical field at 2K is 0.0217 T\n"
+ "text": [
+ "The critical field at 2K is 0.0217 T\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +63,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.2, Page number 152"
+ "source": [
+ "Example number 7.2, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the frequency of Josephson current\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nV = 1; #DC voltage applied across the Josephson junction(micro-volt)\ne = 1.6*10**-19; #Charge on an electron(C)\nh = 6.626*10**-34; #Planck's constant(Js)\n\n#Calculation\nV = V*10**-6; #DC voltage applied across the Josephson junction(V)\nf = 2*e*V/h; #Frequency of Josephson current(Hz)\nf = f*10**-6; #Frequency of Josephson current(MHz)\nf = math.ceil(f*10**2)/10**2; #rounding off the value of f to 2 decimals\n\n#Result\nprint \"The frequency of Josephson current is\",f, \"MHz\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 1; #DC voltage applied across the Josephson junction(micro-volt)\n",
+ "e = 1.6*10**-19; #Charge on an electron(C)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "\n",
+ "#Calculation\n",
+ "V = V*10**-6; #DC voltage applied across the Josephson junction(V)\n",
+ "f = 2*e*V/h; #Frequency of Josephson current(Hz)\n",
+ "f = f*10**-6; #Frequency of Josephson current(MHz)\n",
+ "f = math.ceil(f*10**2)/10**2; #rounding off the value of f to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The frequency of Josephson current is\",f, \"MHz\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The frequency of Josephson current is 482.95 MHz\n"
+ "text": [
+ "The frequency of Josephson current is 482.95 MHz\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +107,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.3, Page number 152"
+ "source": [
+ "Example number 7.3, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the superconducting energy gap\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nT_c = 0.517; #Critical temperature for cadmium(K)\nk = 1.38*10**-23; #Boltzmann constant(J/K)\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n\n#Calculation\nE_g = 3.5*k*T_c/e; #Superconducting energy gap at absolute zero(eV)\nE_g = E_g*10**4;\nE_g = math.ceil(E_g*10**3)/10**3; #rounding off the value of E_g to 3 decimals\n\n#Result\nprint \"The superconducting energy gap for Cd at absolute zero is\",E_g,\"*10**-4 eV\"",
+ "input": [
+ "`\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T_c = 0.517; #Critical temperature for cadmium(K)\n",
+ "k = 1.38*10**-23; #Boltzmann constant(J/K)\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "\n",
+ "#Calculation\n",
+ "E_g = 3.5*k*T_c/e; #Superconducting energy gap at absolute zero(eV)\n",
+ "E_g = E_g*10**4;\n",
+ "E_g = math.ceil(E_g*10**3)/10**3; #rounding off the value of E_g to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The superconducting energy gap for Cd at absolute zero is\",E_g,\"*10**-4 eV\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The superconducting energy gap for Cd at absolute zero is 1.561 *10**-4 eV\n"
+ "text": [
+ "The superconducting energy gap for Cd at absolute zero is 1.561 *10**-4 eV\n"
+ ]
}
],
"prompt_number": 8
@@ -80,19 +151,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.4, Page number 152"
+ "source": [
+ "Example number 7.4, Page number 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of photon\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nc = 3*10**8; #Speed of light in free space(m/s)\nh = 6.626*10**-34; #Planck's constant(Js)\nE_g = 1.5*10**-4; #Superconducting energy gap for a material(eV)\n\n#Calculation\n#As E_g = h*new = h*c/lamda, solving for lambda\nlamda = h*c/(E_g*e); #Wavelength of photon to break up a Cooper-pair(m)\nlamda = lamda*10**3;\nlamda = math.ceil(lamda*10**3)/10**3; #rounding off the value of lamda to 3 decimals\n\n#Result\nprint \"The wavelength of photon to break up a Cooper-pair is\",lamda,\"*10**-3 m\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "c = 3*10**8; #Speed of light in free space(m/s)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "E_g = 1.5*10**-4; #Superconducting energy gap for a material(eV)\n",
+ "\n",
+ "#Calculation\n",
+ "#As E_g = h*new = h*c/lamda, solving for lambda\n",
+ "lamda = h*c/(E_g*e); #Wavelength of photon to break up a Cooper-pair(m)\n",
+ "lamda = lamda*10**3;\n",
+ "lamda = math.ceil(lamda*10**3)/10**3; #rounding off the value of lamda to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The wavelength of photon to break up a Cooper-pair is\",lamda,\"*10**-3 m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The wavelength of photon to break up a Cooper-pair is 8.283 *10**-3 m\n"
+ "text": [
+ "The wavelength of photon to break up a Cooper-pair is 8.283 *10**-3 m\n"
+ ]
}
],
"prompt_number": 12
@@ -101,19 +197,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.5, Page number 153"
+ "source": [
+ "Example number 7.5, Page number 153"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the London penetration depth of lead\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nlambda_0 = 37; #Penetration depth of lead at 0 kelvin(nm)\nT_c = 7.193; #Critical temperature of superconducting transition for lead(kelvin)\nT = 5.2; #Temperature at which penetration depth for lead becomes lambda_T(kelvin) \n\n#Calculation\nlambda_T = lambda_0*(1-(T/T_c)**4)**(-1/2); #Penetration depth of lead at 5.2 kelvin(nm)\nlambda_T = math.ceil(lambda_T*10)/10; #rounding off the value of lamda_T to 1 decimal\n\n#Result\nprint \"The penetration depth of lead is\",lambda_T, \"nm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lambda_0 = 37; #Penetration depth of lead at 0 kelvin(nm)\n",
+ "T_c = 7.193; #Critical temperature of superconducting transition for lead(kelvin)\n",
+ "T = 5.2; #Temperature at which penetration depth for lead becomes lambda_T(kelvin) \n",
+ "\n",
+ "#Calculation\n",
+ "lambda_T = lambda_0*(1-(T/T_c)**4)**(-1/2); #Penetration depth of lead at 5.2 kelvin(nm)\n",
+ "lambda_T = math.ceil(lambda_T*10)/10; #rounding off the value of lamda_T to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The penetration depth of lead is\",lambda_T, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The penetration depth of lead is 43.4 nm\n"
+ "text": [
+ "The penetration depth of lead is 43.4 nm\n"
+ ]
}
],
"prompt_number": 13
@@ -122,19 +240,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.6, Page number 153"
+ "source": [
+ "Example number 7.6, Page number 153"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mass of isotope of mercury\n\n#importing modules\nfrom __future__ import division\nimport math\n\n#Variable declaration\nM1 = 199; #Mass of an isotope of mercury(amu)\nT_C1 = 4.185; #Transition temperature of the isoptope of Hg(K)\nT_C2 = 4.153; #Transition temperature of another isoptope of Hg(K)\nalpha = 0.5; #Isotope coefficient\n\n#Calculation\nM2 = M1*(T_C1/T_C2)**(1/alpha); #Mass of another isotope of mercury(amu)\nM2 = math.ceil(M2*100)/100; #rounding off the value of M2 to 2 decimals\n\n#Result\nprint \"The mass of another isotope of mercury is\",M2, \"amu\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "M1 = 199; #Mass of an isotope of mercury(amu)\n",
+ "T_C1 = 4.185; #Transition temperature of the isoptope of Hg(K)\n",
+ "T_C2 = 4.153; #Transition temperature of another isoptope of Hg(K)\n",
+ "alpha = 0.5; #Isotope coefficient\n",
+ "\n",
+ "#Calculation\n",
+ "M2 = M1*(T_C1/T_C2)**(1/alpha); #Mass of another isotope of mercury(amu)\n",
+ "M2 = math.ceil(M2*100)/100; #rounding off the value of M2 to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The mass of another isotope of mercury is\",M2, \"amu\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The mass of another isotope of mercury is 202.08 amu\n"
+ "text": [
+ "The mass of another isotope of mercury is 202.08 amu\n"
+ ]
}
],
"prompt_number": 16
@@ -142,7 +283,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter8_1.ipynb b/Engineering_Physics_Aruldhas/Chapter8_1.ipynb
index 8ec25fcf..af1e48b4 100644
--- a/Engineering_Physics_Aruldhas/Chapter8_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter8_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter8"
+ "name": "",
+ "signature": "sha256:1888e774039c89bc21625752ef2171fa6b8e8f5f67497ebbdba82729676e8946"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "8: Special Theory of Relativity"
+ "source": [
+ "8: Special Theory of Relativity"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.1, Page number 171"
+ "source": [
+ "Example number 8.1, Page number 171"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nL_0 = 1; #For simplicity, we assume classical length to be unity(m)\nc = 1; #For simplicity assume speed of light to be unity(m/s)\n\n#Calculation\nL = (1-1/100)*L_0; #Relativistic length(m)\n#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\nv = math.sqrt(1-(L/L_0)**2)*c; #Speed at which relativistic length is 1 percent of the classical length(m/s)\nv = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n\n#Result\nprint \"The speed at which relativistic length is 1 percent of the classical length is\",v, \"c\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "L_0 = 1; #For simplicity, we assume classical length to be unity(m)\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "L = (1-1/100)*L_0; #Relativistic length(m)\n",
+ "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n",
+ "v = math.sqrt(1-(L/L_0)**2)*c; #Speed at which relativistic length is 1 percent of the classical length(m/s)\n",
+ "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed at which relativistic length is 1 percent of the classical length is\",v, \"c\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed at which relativistic length is 1 percent of the classical length is 0.1411 c\n"
+ "text": [
+ "The speed at which relativistic length is 1 percent of the classical length is 0.1411 c\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +64,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.2, Page number 171"
+ "source": [
+ "Example number 8.2, Page number 171"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the proper lifetime of particle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\ndelta_t = 5*10**-6; #Mean lifetime of particles as observed in the lab frame(s)\n\n#Calculation\nv = 0.9*c; #Speed at which beam of particles travel(m/s)\ndelta_tau = delta_t*math.sqrt(1-(v/c)**2); #Proper lifetime of particle as per Time Dilation rule(s)\n\n#Result\nprint \"The proper lifetime of particle is\",delta_tau, \"s\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "delta_t = 5*10**-6; #Mean lifetime of particles as observed in the lab frame(s)\n",
+ "\n",
+ "#Calculation\n",
+ "v = 0.9*c; #Speed at which beam of particles travel(m/s)\n",
+ "delta_tau = delta_t*math.sqrt(1-(v/c)**2); #Proper lifetime of particle as per Time Dilation rule(s)\n",
+ "\n",
+ "#Result\n",
+ "print \"The proper lifetime of particle is\",delta_tau, \"s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The proper lifetime of particle is 2.17944947177e-06 s\n"
+ "text": [
+ "The proper lifetime of particle is 2.17944947177e-06 s\n"
+ ]
}
],
"prompt_number": 2
@@ -59,25 +106,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.3, Page number 171. theoritical proof"
+ "source": [
+ "Example number 8.3, Page number 171. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.4, Page number 172"
+ "source": [
+ "Example number 8.4, Page number 172"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed of second rocket for same and opposite direction\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\n\n#Calculation\nv = 0.6*c; #Speed with which the rocket leaves the earth(m/s)\nu_prime = 0.9*c; #Relative speed of second rocket w.r.t. the first rocket(m/s)\nu1 = (u_prime+v)/(1+(u_prime*v)/c**2); #Speed of second rocket for same direction of firing as per Velocity Addition Rule(m/s)\nu1 = math.ceil(u1*10**4)/10**4; #rounding off the value of u1 to 4 decimals\nu2 = (-u_prime+v)/(1-(u_prime*v)/c**2); #Speed of second rocket for opposite direction of firing as per Velocity Addition Rule(m/s)\nu2 = math.ceil(u2*10**4)/10**4; #rounding off the value of u2 to 4 decimals\n\n#Result\nprint \"The speed of second rocket for same direction of firing is\",u1,\"c\"\nprint \"The speed of second rocket for opposite direction of firing is\",u2,\"c\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "v = 0.6*c; #Speed with which the rocket leaves the earth(m/s)\n",
+ "u_prime = 0.9*c; #Relative speed of second rocket w.r.t. the first rocket(m/s)\n",
+ "u1 = (u_prime+v)/(1+(u_prime*v)/c**2); #Speed of second rocket for same direction of firing as per Velocity Addition Rule(m/s)\n",
+ "u1 = math.ceil(u1*10**4)/10**4; #rounding off the value of u1 to 4 decimals\n",
+ "u2 = (-u_prime+v)/(1-(u_prime*v)/c**2); #Speed of second rocket for opposite direction of firing as per Velocity Addition Rule(m/s)\n",
+ "u2 = math.ceil(u2*10**4)/10**4; #rounding off the value of u2 to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed of second rocket for same direction of firing is\",u1,\"c\"\n",
+ "print \"The speed of second rocket for opposite direction of firing is\",u2,\"c\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed of second rocket for same direction of firing is 0.9741 c\nThe speed of second rocket for opposite direction of firing is -0.6521 c\n"
+ "text": [
+ "The speed of second rocket for same direction of firing is 0.9741 c\n",
+ "The speed of second rocket for opposite direction of firing is -0.6521 c\n"
+ ]
}
],
"prompt_number": 4
@@ -86,19 +161,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.5, Page number 172"
+ "source": [
+ "Example number 8.5, Page number 172"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed and time dilation of spaceship\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\nL0 = 1; #For simplicity assume length in spaceship's frame to be unity(m)\ntau = 1; #Unit time in the spaceship's frame(s)\n\n#Calculation\nL = 1/2*L0; #Length as observed on earth(m)\n#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\nv = math.sqrt(1-(L/L0)**2)*c; #Speed at which length of spaceship is observed as half from the earth frame(m/s)\nt = tau/math.sqrt(1-(v/c)**2); #Time dilation of the spaceship's unit time(s)\nv = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n\n#Result\nprint \"The speed at which length of spaceship is observed as half from the earth frame is\",v, \"c\"\nprint \"The time dilation of the spaceship unit time is\",t,\"delta_tau\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "L0 = 1; #For simplicity assume length in spaceship's frame to be unity(m)\n",
+ "tau = 1; #Unit time in the spaceship's frame(s)\n",
+ "\n",
+ "#Calculation\n",
+ "L = 1/2*L0; #Length as observed on earth(m)\n",
+ "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n",
+ "v = math.sqrt(1-(L/L0)**2)*c; #Speed at which length of spaceship is observed as half from the earth frame(m/s)\n",
+ "t = tau/math.sqrt(1-(v/c)**2); #Time dilation of the spaceship's unit time(s)\n",
+ "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed at which length of spaceship is observed as half from the earth frame is\",v, \"c\"\n",
+ "print \"The time dilation of the spaceship unit time is\",t,\"delta_tau\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed at which length of spaceship is observed as half from the earth frame is 0.8661 c\nThe time dilation of the spaceship unit time is 2.0 delta_tau\n"
+ "text": [
+ "The speed at which length of spaceship is observed as half from the earth frame is 0.8661 c\n",
+ "The time dilation of the spaceship unit time is 2.0 delta_tau\n"
+ ]
}
],
"prompt_number": 5
@@ -107,19 +209,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.6, Page number 172"
+ "source": [
+ "Example number 8.6, Page number 172"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the time difference and distance between the events\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\nt1 = 2*10**-7; #Time for which first event occurs(s)\nt2 = 3*10**-7; #Time for which second event occurs(s)\nx1 = 10; #Position at which first event occurs(m)\nx2 = 40; #Position at which second event occurs(m)\n\n#Calculation\nv = 0.6*c; #Velocity with which S2 frame moves relative to S1 frame(m/s)\nL_factor = 1/math.sqrt(1-(v/c)**2); #Lorentz factor\ndelta_t = L_factor*(t2 - t1)+L_factor*v/c**2*(x1 - x2); #Time difference between the events(s)\ndelta_x = L_factor*(x2 - x1)-L_factor*v*(t2 - t1); #Distance between the events(m)\n\n#Result\nprint \"The time difference between the events is\",delta_t, \"s\" \nprint \"The distance between the events is\",delta_x, \"m\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "t1 = 2*10**-7; #Time for which first event occurs(s)\n",
+ "t2 = 3*10**-7; #Time for which second event occurs(s)\n",
+ "x1 = 10; #Position at which first event occurs(m)\n",
+ "x2 = 40; #Position at which second event occurs(m)\n",
+ "\n",
+ "#Calculation\n",
+ "v = 0.6*c; #Velocity with which S2 frame moves relative to S1 frame(m/s)\n",
+ "L_factor = 1/math.sqrt(1-(v/c)**2); #Lorentz factor\n",
+ "delta_t = L_factor*(t2 - t1)+L_factor*v/c**2*(x1 - x2); #Time difference between the events(s)\n",
+ "delta_x = L_factor*(x2 - x1)-L_factor*v*(t2 - t1); #Distance between the events(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The time difference between the events is\",delta_t, \"s\" \n",
+ "print \"The distance between the events is\",delta_x, \"m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The time difference between the events is 5e-08 s\nThe distance between the events is 15.0 m\n"
+ "text": [
+ "The time difference between the events is 5e-08 s\n",
+ "The distance between the events is 15.0 m\n"
+ ]
}
],
"prompt_number": 6
@@ -128,19 +258,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.7, Page number 173"
+ "source": [
+ "Example number 8.7, Page number 173"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed of the unstable particle\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\ntau = 2.6*10**-8; #Mean lifetime the particle in its own frame(s)\nd = 20; #Distance which the unstable particle travels before decaying(m)\n\n#Calculation\n#As t = d/v and also t = tau/sqrt(1-(v/c)^2), so that\n#d/v = tau/sqrt(1-(v/c)^2), solving for v\nv = math.sqrt(d**2/(tau**2+(d/c)**2)); #Speed of the unstable particle in lab frame(m/s)\nv = v/10**8;\nv = math.ceil(v*10)/10; #rounding off the value of v to 1 decimal\n\n#Result\nprint \"The speed of the unstable particle in lab frame is\",v,\"*10**8 m/s\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "tau = 2.6*10**-8; #Mean lifetime the particle in its own frame(s)\n",
+ "d = 20; #Distance which the unstable particle travels before decaying(m)\n",
+ "\n",
+ "#Calculation\n",
+ "#As t = d/v and also t = tau/sqrt(1-(v/c)^2), so that\n",
+ "#d/v = tau/sqrt(1-(v/c)^2), solving for v\n",
+ "v = math.sqrt(d**2/(tau**2+(d/c)**2)); #Speed of the unstable particle in lab frame(m/s)\n",
+ "v = v/10**8;\n",
+ "v = math.ceil(v*10)/10; #rounding off the value of v to 1 decimal\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed of the unstable particle in lab frame is\",v,\"*10**8 m/s\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed of the unstable particle in lab frame is 2.8 *10**8 m/s\n"
+ "text": [
+ "The speed of the unstable particle in lab frame is 2.8 *10**8 m/s\n"
+ ]
}
],
"prompt_number": 9
@@ -149,19 +304,55 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.8, Page number 174"
+ "source": [
+ "Example number 8.8, Page number 174"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed, effective mass and kinetic energy of mu-meson\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\nme = 1; #For simplicity assume mass of electron to be unity(kg)\ntau = 2.3*10**-6; #Average lifetime of mu-meson in rest frame(s)\nt = 6.9*10**-6; #Average lifetime of mu-meson in laboratory frame(s)\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nC = 3*10**8; #Speed of light in vacuum(m/s)\nm_e = 9.1*10**-31; #Mass of an electron(kg)\n\n#Calculation\n#Fromm Time Dilation Rule, tau = t*sqrt(1-(v/c)^2), solving for v\nv = c*math.sqrt(1-(tau/t)**2); #Speed of mu-meson in the laboratory frame(m/s)\nv = math.ceil(v*10**5)/10**5; #rounding off the value of v to 5 decimals\nm0 = 207*me; #Rest mass of mu-meson(kg)\nm = m0/math.sqrt(1-(v/c)**2); #Relativistic variation of mass with velocity(kg)\nm = math.ceil(m*10)/10; #rounding off the value of m to 1 decimal\nT = (m*m_e*C**2 - m0*m_e*C**2)/e; #Kinetic energy of mu-meson(eV)\nT = T*10**-6; #Kinetic energy of mu-meson(MeV)\nT = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n \n#Result\nprint \"The speed of mu-meson in the laboratory frame is\",v, \"c\"\nprint \"The effective mass of mu-meson is\",m, \"me\"\nprint \"The kinetic energy of mu-meson is\",T, \"MeV\"\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "me = 1; #For simplicity assume mass of electron to be unity(kg)\n",
+ "tau = 2.3*10**-6; #Average lifetime of mu-meson in rest frame(s)\n",
+ "t = 6.9*10**-6; #Average lifetime of mu-meson in laboratory frame(s)\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "C = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "m_e = 9.1*10**-31; #Mass of an electron(kg)\n",
+ "\n",
+ "#Calculation\n",
+ "#Fromm Time Dilation Rule, tau = t*sqrt(1-(v/c)^2), solving for v\n",
+ "v = c*math.sqrt(1-(tau/t)**2); #Speed of mu-meson in the laboratory frame(m/s)\n",
+ "v = math.ceil(v*10**5)/10**5; #rounding off the value of v to 5 decimals\n",
+ "m0 = 207*me; #Rest mass of mu-meson(kg)\n",
+ "m = m0/math.sqrt(1-(v/c)**2); #Relativistic variation of mass with velocity(kg)\n",
+ "m = math.ceil(m*10)/10; #rounding off the value of m to 1 decimal\n",
+ "T = (m*m_e*C**2 - m0*m_e*C**2)/e; #Kinetic energy of mu-meson(eV)\n",
+ "T = T*10**-6; #Kinetic energy of mu-meson(MeV)\n",
+ "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n",
+ " \n",
+ "#Result\n",
+ "print \"The speed of mu-meson in the laboratory frame is\",v, \"c\"\n",
+ "print \"The effective mass of mu-meson is\",m, \"me\"\n",
+ "print \"The kinetic energy of mu-meson is\",T, \"MeV\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed of mu-meson in the laboratory frame is 0.94281 c\nThe effective mass of mu-meson is 621.1 me\nThe kinetic energy of mu-meson is 211.97 MeV\n"
+ "text": [
+ "The speed of mu-meson in the laboratory frame is 0.94281 c\n",
+ "The effective mass of mu-meson is 621.1 me\n",
+ "The kinetic energy of mu-meson is 211.97 MeV\n"
+ ]
}
],
"prompt_number": 13
@@ -170,19 +361,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.9, Page number 174"
+ "source": [
+ "Example number 8.9, Page number 174"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the speed of moving body\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\nm0 = 1; #For simplicity assume rest mass to be unity(kg)\n\n#Calculation\nm = (20/100+1)*m0; #Mass in motion(kg)\n#As m = m0/sqrt(1-(u/c)^2), solving for u\nu = math.sqrt(1-(m0/m)**2)*c; #Speed of moving mass(m/s) \nu = math.ceil(u*10**3)/10**3; #rounding off the value of u to 3 decimals\n\n#Result\nprint \"The speed of moving body is\",u, \"c\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "m0 = 1; #For simplicity assume rest mass to be unity(kg)\n",
+ "\n",
+ "#Calculation\n",
+ "m = (20/100+1)*m0; #Mass in motion(kg)\n",
+ "#As m = m0/sqrt(1-(u/c)^2), solving for u\n",
+ "u = math.sqrt(1-(m0/m)**2)*c; #Speed of moving mass(m/s) \n",
+ "u = math.ceil(u*10**3)/10**3; #rounding off the value of u to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The speed of moving body is\",u, \"c\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The speed of moving body is 0.553 c\n"
+ "text": [
+ "The speed of moving body is 0.553 c\n"
+ ]
}
],
"prompt_number": 14
@@ -191,19 +405,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.10, Page number 175"
+ "source": [
+ "Example number 8.10, Page number 175"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the rate of decrease of mass\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\ndE = 4*10**26; #Energy radiated per second my the sun(J/s)\n\n#Calculation\ndm = dE/c**2; #Rate of decrease of mass of sun(kg/s)\ndm = dm/10**9;\ndm = math.ceil(dm*10**3)/10**3; #rounding off the value of dm to 3 decimals\n\n#Result\nprint \"The rate of decrease of mass of sun is\",dm,\"*10**9 kg/s\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "dE = 4*10**26; #Energy radiated per second my the sun(J/s)\n",
+ "\n",
+ "#Calculation\n",
+ "dm = dE/c**2; #Rate of decrease of mass of sun(kg/s)\n",
+ "dm = dm/10**9;\n",
+ "dm = math.ceil(dm*10**3)/10**3; #rounding off the value of dm to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The rate of decrease of mass of sun is\",dm,\"*10**9 kg/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of decrease of mass of sun is 4.445 *10**9 kg/s\n"
+ "text": [
+ "The rate of decrease of mass of sun is 4.445 *10**9 kg/s\n"
+ ]
}
],
"prompt_number": 18
@@ -212,19 +447,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.11, Page number 175"
+ "source": [
+ "Example number 8.11, Page number 175"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the momentum and velocity of the electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 1; #For simplicity assume speed of light to be unity(m/s)\nm0 = 9.1*10**-31; #Mass of the electron(kg)\nE0 = 0.512; #Rest energy of electron(MeV)\nT = 10; #Kinetic energy of electron(MeV)\n\n#Calculation\nE = T + E0; #Total energy of electron(MeV)\n# From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for p\np = math.sqrt(E**2-m0**2*c**4)/c; #Momentum of the electron(MeV)\np = math.ceil(p*100)/100; #rounding off the value of p to 2 decimals\n#As E = E0/sqrt(1-(u/c)^2), solving for u\nu = math.sqrt(1-(E0/E)**2)*c; #Velocity of the electron(m/s)\nu = math.ceil(u*10**4)/10**4; #rounding off the value of u to 4 decimals\n\n#Result\nprint \"The momentum of the electron is\",p,\"/c MeV\"\nprint \"The velocity of the electron is\",u, \"c\"\n\n#answer for velocity given in the book is wrong",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 1; #For simplicity assume speed of light to be unity(m/s)\n",
+ "m0 = 9.1*10**-31; #Mass of the electron(kg)\n",
+ "E0 = 0.512; #Rest energy of electron(MeV)\n",
+ "T = 10; #Kinetic energy of electron(MeV)\n",
+ "\n",
+ "#Calculation\n",
+ "E = T + E0; #Total energy of electron(MeV)\n",
+ "# From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for p\n",
+ "p = math.sqrt(E**2-m0**2*c**4)/c; #Momentum of the electron(MeV)\n",
+ "p = math.ceil(p*100)/100; #rounding off the value of p to 2 decimals\n",
+ "#As E = E0/sqrt(1-(u/c)^2), solving for u\n",
+ "u = math.sqrt(1-(E0/E)**2)*c; #Velocity of the electron(m/s)\n",
+ "u = math.ceil(u*10**4)/10**4; #rounding off the value of u to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The momentum of the electron is\",p,\"/c MeV\"\n",
+ "print \"The velocity of the electron is\",u, \"c\"\n",
+ "\n",
+ "#answer for velocity given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The momentum of the electron is 10.52 /c MeV\nThe velocity of the electron is 0.9989 c\n"
+ "text": [
+ "The momentum of the electron is 10.52 /c MeV\n",
+ "The velocity of the electron is 0.9989 c\n"
+ ]
}
],
"prompt_number": 19
@@ -233,25 +499,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.12, Page number 175. theoritical proof"
+ "source": [
+ "Example number 8.12, Page number 175. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.13, Page number 176"
+ "source": [
+ "Example number 8.13, Page number 176"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the rest mass of the body\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\nE = 4.5*10**17; #Total energy of object(J)\npx = 3.8*10**8; #X-component of momentum(kg-m/s)\npy = 3*10**8; #Y-component of momentum(kg-m/s)\npz = 3*10**8; #Z-component of momentum(kg-m/s)\n\n#Calculation\np = math.sqrt(px**2+py**2+pz**2); #Total momentum of the object(kg-m/s)\n#From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for m0\nm0 = math.sqrt(E**2/c**4 - p**2/c**2); #Rest mass of the body(kg)\nm0 = math.ceil(m0*100)/100; #rounding off the value of m0 to 2 decimals\n\n#Result\nprint \"The rest mass of the body is\",m0, \"kg\"",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "E = 4.5*10**17; #Total energy of object(J)\n",
+ "px = 3.8*10**8; #X-component of momentum(kg-m/s)\n",
+ "py = 3*10**8; #Y-component of momentum(kg-m/s)\n",
+ "pz = 3*10**8; #Z-component of momentum(kg-m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "p = math.sqrt(px**2+py**2+pz**2); #Total momentum of the object(kg-m/s)\n",
+ "#From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for m0\n",
+ "m0 = math.sqrt(E**2/c**4 - p**2/c**2); #Rest mass of the body(kg)\n",
+ "m0 = math.ceil(m0*100)/100; #rounding off the value of m0 to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The rest mass of the body is\",m0, \"kg\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rest mass of the body is 4.63 kg\n"
+ "text": [
+ "The rest mass of the body is 4.63 kg\n"
+ ]
}
],
"prompt_number": 20
@@ -260,19 +553,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.14, Page number 176"
+ "source": [
+ "Example number 8.14, Page number 176"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the momentum of the high speed probe\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light in vacuum(m/s)\nm = 50000; #Mass of high speed probe(kg)\n\n#Calculation\nu = 0.8*c; #Speed of the probe(m/s)\np = m*u/math.sqrt(1-(u/c)**2); #Momentum of the probe(kg-m/s)\n\n#Result\nprint \"The momentum of the high speed probe is\",p, \"kg-m/s\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "m = 50000; #Mass of high speed probe(kg)\n",
+ "\n",
+ "#Calculation\n",
+ "u = 0.8*c; #Speed of the probe(m/s)\n",
+ "p = m*u/math.sqrt(1-(u/c)**2); #Momentum of the probe(kg-m/s)\n",
+ "\n",
+ "#Result\n",
+ "print \"The momentum of the high speed probe is\",p, \"kg-m/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The momentum of the high speed probe is 2e+13 kg-m/s\n"
+ "text": [
+ "The momentum of the high speed probe is 2e+13 kg-m/s\n"
+ ]
}
],
"prompt_number": 21
@@ -281,19 +595,56 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.15, Page number 177"
+ "source": [
+ "Example number 8.15, Page number 177"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the change in mass, work done and accelerating potential\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Electronic charge, C = Energy equivalent of 1 eV(J/eV)\nm0 = 9.11*10**-31; #Rest mass of electron(kg)\nc = 3*10**8; #Speed of light in vacuum(m/s)\n\n#Calculation\nu1 = 0.98*c; #Inital speed of electron(m/s)\nu2 = 0.99*c; #Final speed of electron(m/s)\nm1 = m0/math.sqrt(1-(u1/c)**2); #Initial relativistic mass of electron(kg)\nm2 = m0/math.sqrt(1-(u2/c)**2); #Final relativistic mass of electron(kg)\ndm = m2 - m1; #Change in relativistic mass of the electron(kg)\nW = dm*c**2/e; #Work done on the electron to change its velocity(eV)\nW = W*10**-6; #Work done on the electron to change its velocity(MeV)\nW = math.ceil(W*100)/100; #rounding off the value of W to 2 decimals\n#As W = eV, V = accelerating potential, solving for V\nV = W*10**6; #Accelerating potential(volt)\nV = V/10**6;\n\n#Result\nprint \"The change in relativistic mass of the electron is\",dm, \"kg\"\nprint \"The work done on the electron to change its velocity is\",W, \"MeV\"\nprint \"The accelerating potential is\",V, \"*10**6 volt\"\n\n#answers given in the book are wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Electronic charge, C = Energy equivalent of 1 eV(J/eV)\n",
+ "m0 = 9.11*10**-31; #Rest mass of electron(kg)\n",
+ "c = 3*10**8; #Speed of light in vacuum(m/s)\n",
+ "\n",
+ "#Calculation\n",
+ "u1 = 0.98*c; #Inital speed of electron(m/s)\n",
+ "u2 = 0.99*c; #Final speed of electron(m/s)\n",
+ "m1 = m0/math.sqrt(1-(u1/c)**2); #Initial relativistic mass of electron(kg)\n",
+ "m2 = m0/math.sqrt(1-(u2/c)**2); #Final relativistic mass of electron(kg)\n",
+ "dm = m2 - m1; #Change in relativistic mass of the electron(kg)\n",
+ "W = dm*c**2/e; #Work done on the electron to change its velocity(eV)\n",
+ "W = W*10**-6; #Work done on the electron to change its velocity(MeV)\n",
+ "W = math.ceil(W*100)/100; #rounding off the value of W to 2 decimals\n",
+ "#As W = eV, V = accelerating potential, solving for V\n",
+ "V = W*10**6; #Accelerating potential(volt)\n",
+ "V = V/10**6;\n",
+ "\n",
+ "#Result\n",
+ "print \"The change in relativistic mass of the electron is\",dm, \"kg\"\n",
+ "print \"The work done on the electron to change its velocity is\",W, \"MeV\"\n",
+ "print \"The accelerating potential is\",V, \"*10**6 volt\"\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The change in relativistic mass of the electron is 1.87996052912e-30 kg\nThe work done on the electron to change its velocity is 1.06 MeV\nThe accelerating potential is 1.06 *10**6 volt\n"
+ "text": [
+ "The change in relativistic mass of the electron is 1.87996052912e-30 kg\n",
+ "The work done on the electron to change its velocity is 1.06 MeV\n",
+ "The accelerating potential is 1.06 *10**6 volt\n"
+ ]
}
],
"prompt_number": 24
@@ -301,7 +652,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Aruldhas/Chapter9_1.ipynb b/Engineering_Physics_Aruldhas/Chapter9_1.ipynb
index 50e4b6bd..af5adbcc 100644
--- a/Engineering_Physics_Aruldhas/Chapter9_1.ipynb
+++ b/Engineering_Physics_Aruldhas/Chapter9_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter9"
+ "name": "",
+ "signature": "sha256:d58e11c98e937b7ff914fc9567035f99fc6ab344053f332f140829887d0ef6cc"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,46 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "9: Quantum Mechanics"
+ "source": [
+ "9: Quantum Mechanics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.1, Page number 202"
+ "source": [
+ "Example number 9.1, Page number 202"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the De-Broglie wavelength of electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nV = 100; #Accelerating potential for electron(volt)\n\n#Calculation\nlamda = math.sqrt(150/V)*10**-10; #de-Broglie wavelength of electron(m)\n\n#Result\nprint \"The De-Broglie wavelength of electron is\",lamda, \"m\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "V = 100; #Accelerating potential for electron(volt)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = math.sqrt(150/V)*10**-10; #de-Broglie wavelength of electron(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The De-Broglie wavelength of electron is\",lamda, \"m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The De-Broglie wavelength of electron is 1.22474487139e-10 m\n"
+ "text": [
+ "The De-Broglie wavelength of electron is 1.22474487139e-10 m\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +60,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.2, Page number 203"
+ "source": [
+ "Example number 9.2, Page number 203"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the De-Broglie wavelength of electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nh = 6.626*10**-34; #Planck's constant(Js)\nm = 9.11*10**-31; #Mass of the electron(kg)\nEk = 10; #Kinetic energy of electron(eV)\n\n#Calculation\np = math.sqrt(2*m*Ek*e); #Momentum of the electron(kg-m/s)\nlamda = h/p ; #de-Broglie wavelength of electron from De-Broglie relation(m)\nlamda = lamda*10**9; #de-Broglie wavelength of electron from De-Broglie relation(nm)\nlamda = math.ceil(lamda*10**2)/10**2; #rounding off the value of lamda to 2 decimals\n\n#Result\nprint \"The de-Broglie wavelength of electron is\",lamda, \"nm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "m = 9.11*10**-31; #Mass of the electron(kg)\n",
+ "Ek = 10; #Kinetic energy of electron(eV)\n",
+ "\n",
+ "#Calculation\n",
+ "p = math.sqrt(2*m*Ek*e); #Momentum of the electron(kg-m/s)\n",
+ "lamda = h/p ; #de-Broglie wavelength of electron from De-Broglie relation(m)\n",
+ "lamda = lamda*10**9; #de-Broglie wavelength of electron from De-Broglie relation(nm)\n",
+ "lamda = math.ceil(lamda*10**2)/10**2; #rounding off the value of lamda to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print \"The de-Broglie wavelength of electron is\",lamda, \"nm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The de-Broglie wavelength of electron is 0.39 nm\n"
+ "text": [
+ "The de-Broglie wavelength of electron is 0.39 nm\n"
+ ]
}
],
"prompt_number": 2
@@ -59,25 +106,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.3, Page number 203. theoritical proof"
+ "source": [
+ "Example number 9.3, Page number 203. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.4, Page number 203"
+ "source": [
+ "Example number 9.4, Page number 203"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the uncertainty in position of electron\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nh = 6.626*10**-34; #Planck's constant(Js)\nm = 9.11*10**-31; #Mass of the electron(kg)\nv = 1.1*10**6; #Speed of the electron(m/s)\npr = 0.1; #precision in percent\n\n#Calculation\np = m*v; #Momentum of the electron(kg-m/s)\ndp = pr/100*p; #Uncertainty in momentum(kg-m/s)\nh_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\ndx = h_bar/(2*dp); #Uncertainty in position(m)\n\n#Result\nprint \"The uncertainty in position of electron is\",dx, \"m\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "m = 9.11*10**-31; #Mass of the electron(kg)\n",
+ "v = 1.1*10**6; #Speed of the electron(m/s)\n",
+ "pr = 0.1; #precision in percent\n",
+ "\n",
+ "#Calculation\n",
+ "p = m*v; #Momentum of the electron(kg-m/s)\n",
+ "dp = pr/100*p; #Uncertainty in momentum(kg-m/s)\n",
+ "h_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\n",
+ "dx = h_bar/(2*dp); #Uncertainty in position(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The uncertainty in position of electron is\",dx, \"m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The uncertainty in position of electron is 5.26175358211e-08 m\n"
+ "text": [
+ "The uncertainty in position of electron is 5.26175358211e-08 m\n"
+ ]
}
],
"prompt_number": 3
@@ -86,19 +160,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.5, Page number 203"
+ "source": [
+ "Example number 9.5, Page number 203"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the uncertainty in energy of the excited state\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\ne = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\nh = 6.626*10**-34; #Planck's constant(Js)\ndt = 10**-8; #Uncertainty in time(s)\n\n#Calculation\nh_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\ndE = h_bar/(2*dt*e); #Uncertainty in energy of the excited state(m)\n\n#Result\nprint \"The uncertainty in energy of the excited state is\",dE, \"eV\"\n\n#answer given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n",
+ "h = 6.626*10**-34; #Planck's constant(Js)\n",
+ "dt = 10**-8; #Uncertainty in time(s)\n",
+ "\n",
+ "#Calculation\n",
+ "h_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\n",
+ "dE = h_bar/(2*dt*e); #Uncertainty in energy of the excited state(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The uncertainty in energy of the excited state is\",dE, \"eV\"\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The uncertainty in energy of the excited state is 3.2955020404e-08 eV\n"
+ "text": [
+ "The uncertainty in energy of the excited state is 3.2955020404e-08 eV\n"
+ ]
}
],
"prompt_number": 4
@@ -107,19 +205,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.6, Page number 204"
+ "source": [
+ "Example number 9.6, Page number 204"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the width of spectral line\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nc = 3*10**8; #Speed of light(m/s)\ndt = 10**-8; #Average lifetime(s)\nlamda = 400; #Wavelength of spectral line(nm)\n\n#Calculation\nlamda = lamda*10**-9; #Wavelength of spectral line(m)\n#From Heisenberg uncertainty principle,\n#dE = h_bar/(2*dt) and also dE = h*c/lambda^2*d_lambda, which give\n#h_bar/(2*dt) = h*c/lambda^2*d_lambda, solving for d_lambda\nd_lamda = (lamda**2)/(4*math.pi*c*dt); #Width of spectral line(m)\n\n#Result\nprint \"The width of spectral line is\",d_lamda, \"m\"",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c = 3*10**8; #Speed of light(m/s)\n",
+ "dt = 10**-8; #Average lifetime(s)\n",
+ "lamda = 400; #Wavelength of spectral line(nm)\n",
+ "\n",
+ "#Calculation\n",
+ "lamda = lamda*10**-9; #Wavelength of spectral line(m)\n",
+ "#From Heisenberg uncertainty principle,\n",
+ "#dE = h_bar/(2*dt) and also dE = h*c/lambda^2*d_lambda, which give\n",
+ "#h_bar/(2*dt) = h*c/lambda^2*d_lambda, solving for d_lambda\n",
+ "d_lamda = (lamda**2)/(4*math.pi*c*dt); #Width of spectral line(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"The width of spectral line is\",d_lamda, \"m\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The width of spectral line is 4.24413181578e-15 m\n"
+ "text": [
+ "The width of spectral line is 4.24413181578e-15 m\n"
+ ]
}
],
"prompt_number": 5
@@ -128,61 +251,99 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.7, Page number 204. theoritical proof"
+ "source": [
+ "Example number 9.7, Page number 204. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.8, Page number 204. theoritical proof"
+ "source": [
+ "Example number 9.8, Page number 204. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.9, Page number 205. theoritical proof"
+ "source": [
+ "Example number 9.9, Page number 205. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.10, Page number 205. theoritical proof"
+ "source": [
+ "Example number 9.10, Page number 205. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.11, Page number 205. theoritical proof"
+ "source": [
+ "Example number 9.11, Page number 205. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.12, Page number 206. theoritical proof"
+ "source": [
+ "Example number 9.12, Page number 206. theoritical proof"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.13, Page number 206. theoritical proof "
+ "source": [
+ "Example number 9.13, Page number 206. theoritical proof "
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.14, Page number 207"
+ "source": [
+ "Example number 9.14, Page number 207"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the probability of finding the electron\n\n#importing modules\nimport math\nfrom __future__ import division\nfrom scipy.integrate import quad\n\n#Variable declaration\na = 2*10**-10; # Width of 1D box(m)\nx1=0; # Position of first extreme of the box(m)\nx2=1*10**-10; # Position of second extreme of the box(m)\n\n#Calculation\ndef intg(x):\n return ((2/a)*(math.sin(2*math.pi*x/a))**2)\nS=quad(intg,x1,x2)[0]\n\n#Result\nprint \"The probability of finding the electron between x = 0 and x = 10**-10 is\",S",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "from scipy.integrate import quad\n",
+ "\n",
+ "#Variable declaration\n",
+ "a = 2*10**-10; # Width of 1D box(m)\n",
+ "x1=0; # Position of first extreme of the box(m)\n",
+ "x2=1*10**-10; # Position of second extreme of the box(m)\n",
+ "\n",
+ "#Calculation\n",
+ "def intg(x):\n",
+ " return ((2/a)*(math.sin(2*math.pi*x/a))**2)\n",
+ "S=quad(intg,x1,x2)[0]\n",
+ "\n",
+ "#Result\n",
+ "print \"The probability of finding the electron between x = 0 and x = 10**-10 is\",S"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The probability of finding the electron between x = 0 and x = 10**-10 is 0.5\n"
+ "text": [
+ "The probability of finding the electron between x = 0 and x = 10**-10 is 0.5\n"
+ ]
}
],
"prompt_number": 7
@@ -190,7 +351,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_1.ipynb b/Engineering_Physics_Marikani/Chapter_1.ipynb
index 4392ba50..a6934dcd 100644
--- a/Engineering_Physics_Marikani/Chapter_1.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 1"
+ "name": "",
+ "signature": "sha256:dbcb8c7a4d852e94c64ae36b37434de99bb1000ca8d8a481769813b464811eeb"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Ultrasonics"
+ "source": [
+ "Ultrasonics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.1, Page number 28 "
+ "source": [
+ "Example number 1.1, Page number 28 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the fundamental frequency of vibration\n\n#importing modules\nimport math\n\n#Variable declaration\nt=0.15*10**-2; #thickness of the quartz crystal in m\nY=7.9*10**10; #young's modulus of quartz in N/m^2\nrho=2650; #density of quartz in kg/m^3\n\n#Calculation\nx=math.sqrt(Y/rho);\nf=x/(2*t);\nf=f*10**-6; #converting f from Hz to MHz\nf=math.ceil(f*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"fundamental frequency of vibration in MHz is\",f);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "t=0.15*10**-2; #thickness of the quartz crystal in m\n",
+ "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n",
+ "rho=2650; #density of quartz in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "x=math.sqrt(Y/rho);\n",
+ "f=x/(2*t);\n",
+ "f=f*10**-6; #converting f from Hz to MHz\n",
+ "f=math.ceil(f*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fundamental frequency of vibration in MHz is\",f);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fundamental frequency of vibration in MHz is', 1.819992)\n"
+ "text": [
+ "('fundamental frequency of vibration in MHz is', 1.819992)\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +64,57 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.2, Page number 28 "
+ "source": [
+ "Example number 1.2, Page number 28 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the fundamental frequency and the first overtone\n\n#importing modules\nimport math\n\n#Variable declaration\nt=1e-03; #thickness of the quartz crystal in m\nY=7.9*10**10; #young's modulus of quartz in N/m^2\nrho=2650; #density of quartz in kg/m^3\n\n#Calculation\nx=math.sqrt(Y/rho);\np1=1; #for fundamental frequency p=1\nf1=(p1*x)/(2*t);\nF1=f1/10**6;\nF1=math.ceil(F1*10**5)/10**5; #rounding off to 5 decimals\nf_1=f1*10**-6; #converting f1 from Hz to MHz\nf_1=math.ceil(f_1*10**5)/10**5; #rounding off to 5 decimals\np2=2; #for first overtone p=2\nf2=(p2*x)/(2*t);\nF2=f2/10**6;\nF2=math.ceil(F2*10**5)/10**5; #rounding off to 5 decimals\nf_2=f2*10**-6; #converting f2 from Hz to MHz\nf_2=math.ceil(f_2*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"fundamental frequency in Hz is\",F1,\"*10**6\");\nprint(\"fundamental frequency in MHz is\",f_1);\nprint(\"frequency of the first overtone in Hz is\",F2,\"*10**6\");\nprint(\"frequency of the first overtone in MHz is\",f_2);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "t=1e-03; #thickness of the quartz crystal in m\n",
+ "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n",
+ "rho=2650; #density of quartz in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "x=math.sqrt(Y/rho);\n",
+ "p1=1; #for fundamental frequency p=1\n",
+ "f1=(p1*x)/(2*t);\n",
+ "F1=f1/10**6;\n",
+ "F1=math.ceil(F1*10**5)/10**5; #rounding off to 5 decimals\n",
+ "f_1=f1*10**-6; #converting f1 from Hz to MHz\n",
+ "f_1=math.ceil(f_1*10**5)/10**5; #rounding off to 5 decimals\n",
+ "p2=2; #for first overtone p=2\n",
+ "f2=(p2*x)/(2*t);\n",
+ "F2=f2/10**6;\n",
+ "F2=math.ceil(F2*10**5)/10**5; #rounding off to 5 decimals\n",
+ "f_2=f2*10**-6; #converting f2 from Hz to MHz\n",
+ "f_2=math.ceil(f_2*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fundamental frequency in Hz is\",F1,\"*10**6\");\n",
+ "print(\"fundamental frequency in MHz is\",f_1);\n",
+ "print(\"frequency of the first overtone in Hz is\",F2,\"*10**6\");\n",
+ "print(\"frequency of the first overtone in MHz is\",f_2);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fundamental frequency in Hz is', 2.72999, '*10**6')\n('fundamental frequency in MHz is', 2.72999)\n('frequency of the first overtone in Hz is', 5.45998, '*10**6')\n('frequency of the first overtone in MHz is', 5.45998)\n"
+ "text": [
+ "('fundamental frequency in Hz is', 2.72999, '*10**6')\n",
+ "('fundamental frequency in MHz is', 2.72999)\n",
+ "('frequency of the first overtone in Hz is', 5.45998, '*10**6')\n",
+ "('frequency of the first overtone in MHz is', 5.45998)\n"
+ ]
}
],
"prompt_number": 1
@@ -59,19 +123,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.3, Page number 29 "
+ "source": [
+ "Example number 1.3, Page number 29 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the velocity of ultrasonic wave\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda=589.3*10**-9; #wavelength of light in m\nf=100*10**6; #frequency of ultrasonic transducer in Hz\nn=1; #order of diffraction\ntheta=2.25; #angle of diffraction in degrees\ntheta=theta*0.0174532925; #converting degrees to radians\n\n#Calculation\nd=(n*lamda)/(2*math.sin(theta));\nd1=d*10**6; #converting d from m to micro m\nlamda1=2*d;\nv=f*lamda1;\nv=math.ceil(v*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"wavelength of ultrasonic wave in m is\",lamda1);\nprint(\"velocity of ultrasonic wave in m/sec\",int(v));",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda=589.3*10**-9; #wavelength of light in m\n",
+ "f=100*10**6; #frequency of ultrasonic transducer in Hz\n",
+ "n=1; #order of diffraction\n",
+ "theta=2.25; #angle of diffraction in degrees\n",
+ "theta=theta*0.0174532925; #converting degrees to radians\n",
+ "\n",
+ "#Calculation\n",
+ "d=(n*lamda)/(2*math.sin(theta));\n",
+ "d1=d*10**6; #converting d from m to micro m\n",
+ "lamda1=2*d;\n",
+ "v=f*lamda1;\n",
+ "v=math.ceil(v*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of ultrasonic wave in m is\",lamda1);\n",
+ "print(\"velocity of ultrasonic wave in m/sec\",int(v));"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('wavelength of ultrasonic wave in m is', 1.5010258944908707e-05)\n('velocity of ultrasonic wave in m/sec', 1501)\n"
+ "text": [
+ "('wavelength of ultrasonic wave in m is', 1.5010258944908707e-05)\n",
+ "('velocity of ultrasonic wave in m/sec', 1501)\n"
+ ]
}
],
"prompt_number": 19
@@ -80,19 +171,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.4, Page number 29 "
+ "source": [
+ "Example number 1.4, Page number 29 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Doppler shifted frequency\n\n#importing modules\nimport math\n\n#Variable declaration\nf=2*10**6; #frequency of transducer in MHz\nv=3; #speed of blood in m/s\nc=800; #velocity of ultrasonic wave in m/s\ntheta=30; #angle of inclination in degrees\ntheta=theta*0.0174532925; #converting degrees to radians\n\n#Calculation\ndeltaf=(2*f*v*math.cos(theta))/c;\ndeltaf=deltaf*10**-6; #converting deltaf from Hz to MHz\ndeltaf=math.ceil(deltaf*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"doppler shifted frequency in MHz is\",deltaf);",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "f=2*10**6; #frequency of transducer in MHz\n",
+ "v=3; #speed of blood in m/s\n",
+ "c=800; #velocity of ultrasonic wave in m/s\n",
+ "theta=30; #angle of inclination in degrees\n",
+ "theta=theta*0.0174532925; #converting degrees to radians\n",
+ "\n",
+ "#Calculation\n",
+ "deltaf=(2*f*v*math.cos(theta))/c;\n",
+ "deltaf=deltaf*10**-6; #converting deltaf from Hz to MHz\n",
+ "deltaf=math.ceil(deltaf*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"doppler shifted frequency in MHz is\",deltaf);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('doppler shifted frequency in MHz is', 0.012991)\n"
+ "text": [
+ "('doppler shifted frequency in MHz is', 0.012991)\n"
+ ]
}
],
"prompt_number": 20
@@ -101,19 +215,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 1.5, Page number 30 "
+ "source": [
+ "Example number 1.5, Page number 30 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the velocity of ultrasonic wave\n\n#importing modules\nimport math\n\n#Variable declaration\nY=7.9*10**10; #young's modulus of quartz in N/m^2\nrho=2650; #density of quartz in kg/m^3\n\n#Calculation\nv=math.sqrt(Y/rho);\nv=math.ceil(v*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"velocity of ultrasonic waves in m/s is\",v);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n",
+ "rho=2650; #density of quartz in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "v=math.sqrt(Y/rho);\n",
+ "v=math.ceil(v*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"velocity of ultrasonic waves in m/s is\",v);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('velocity of ultrasonic waves in m/s is', 5459.975)\n"
+ "text": [
+ "('velocity of ultrasonic waves in m/s is', 5459.975)\n"
+ ]
}
],
"prompt_number": 21
@@ -121,7 +255,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_10.ipynb b/Engineering_Physics_Marikani/Chapter_10.ipynb
index d1968a2f..cad8c3fc 100644
--- a/Engineering_Physics_Marikani/Chapter_10.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 10"
+ "name": "",
+ "signature": "sha256:e2ed8f14e9384f32112bf8b476c63d65b4316d749e72b2c8fa7bc92794bf7f8a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,51 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Magnetic materials"
+ "source": [
+ "Magnetic materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.1, Page number 305"
+ "source": [
+ "Example number 10.1, Page number 305"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the intensity of magnetisation and flux density\n\n#importing modules\nimport math\n\n#Variable declaration\nH=10**6; #magnetic field strength in A/m\nchi=0.5*10**-5; #magnetic susceptibility\n\n#Calculation\nmew0=4*math.pi*10**-7;\nM=chi*H;\nB=mew0*(M+H);\nB=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"intensity of magnetisation in A/m is\",M);\nprint(\"flux density in Wb/m^2 is\",B);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "H=10**6; #magnetic field strength in A/m\n",
+ "chi=0.5*10**-5; #magnetic susceptibility\n",
+ "\n",
+ "#Calculation\n",
+ "mew0=4*math.pi*10**-7;\n",
+ "M=chi*H;\n",
+ "B=mew0*(M+H);\n",
+ "B=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"intensity of magnetisation in A/m is\",M);\n",
+ "print(\"flux density in Wb/m^2 is\",B);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('intensity of magnetisation in A/m is', 5.0)\n('flux density in Wb/m^2 is', 1.257)\n"
+ "text": [
+ "('intensity of magnetisation in A/m is', 5.0)\n",
+ "('flux density in Wb/m^2 is', 1.257)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +65,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.2, Page number 306"
+ "source": [
+ "Example number 10.2, Page number 306"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetic moment\n\n#importing modules\nimport math\n\n#Variable declaration\nA=6.022*10**23; #avagadro number\nmew0=4*math.pi*10**-7;\nw=58.7; #atomic weight of Ni\nB=0.65; #saturation magnetic induction in Wb/m^2\nrho=8906; #density in kg/m^3\n\n#Calculation\nrho=rho*10**3; #converting into gm/m^3\nN=(rho*A)/w;\nmew_m=B/(N*mew0);\n#mew_m/(9.27*10^-24) gives mew_m in mewB\nmew_m=mew_m/(9.27*10**-24);\nmew_m=math.ceil(mew_m*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"magnetic moment of Ni is\",mew_m,\"mew_b\");\n#that is mew_m=0.61 mew_b",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "A=6.022*10**23; #avagadro number\n",
+ "mew0=4*math.pi*10**-7;\n",
+ "w=58.7; #atomic weight of Ni\n",
+ "B=0.65; #saturation magnetic induction in Wb/m^2\n",
+ "rho=8906; #density in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "rho=rho*10**3; #converting into gm/m^3\n",
+ "N=(rho*A)/w;\n",
+ "mew_m=B/(N*mew0);\n",
+ "#mew_m/(9.27*10^-24) gives mew_m in mewB\n",
+ "mew_m=mew_m/(9.27*10**-24);\n",
+ "mew_m=math.ceil(mew_m*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic moment of Ni is\",mew_m,\"mew_b\");\n",
+ "#that is mew_m=0.61 mew_b"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetic moment of Ni is', 0.611, 'mew_b')\n"
+ "text": [
+ "('magnetic moment of Ni is', 0.611, 'mew_b')\n"
+ ]
}
],
"prompt_number": 5
@@ -59,19 +113,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.3, Page number 306"
+ "source": [
+ "Example number 10.3, Page number 306"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the permeability\n\n#importing modules\nimport math\n\n#Variable declaration\nmew_0=4*math.pi*10**-7;\nH=1800; #magnetic field in A/m\nphi=3*10**-5; #magnetic flux in Wb\nA=0.2; #area of cross section in cm^2\n\n#Calculation\nA=A*10**-4; #area in m^2\nB=phi/A;\nmew_r=B/(mew_0*H);\nmew_r=math.ceil(mew_r*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"permeability of material is\",mew_r);",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "H=1800; #magnetic field in A/m\n",
+ "phi=3*10**-5; #magnetic flux in Wb\n",
+ "A=0.2; #area of cross section in cm^2\n",
+ "\n",
+ "#Calculation\n",
+ "A=A*10**-4; #area in m^2\n",
+ "B=phi/A;\n",
+ "mew_r=B/(mew_0*H);\n",
+ "mew_r=math.ceil(mew_r*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"permeability of material is\",mew_r);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('permeability of material is', 663.146)\n"
+ "text": [
+ "('permeability of material is', 663.146)\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +157,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.4, Page number 307"
+ "source": [
+ "Example number 10.4, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the saturation magnetisation \n\n#importing modules\nimport math\n\n#Variable declaration\nmew=18.4; #magnetic moment in mew_b\na=0.835; #lattice parameter in nm\n\n#Calculation\nmew=mew*9.27*10**-24;\na=a*10**-9; #converting nm to m\nV=a**3;\nM=mew/V;\nM=M/10**5;\nM=math.ceil(M*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"saturation magnetisation in A/m is\",M,\"*10**5\");",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew=18.4; #magnetic moment in mew_b\n",
+ "a=0.835; #lattice parameter in nm\n",
+ "\n",
+ "#Calculation\n",
+ "mew=mew*9.27*10**-24;\n",
+ "a=a*10**-9; #converting nm to m\n",
+ "V=a**3;\n",
+ "M=mew/V;\n",
+ "M=M/10**5;\n",
+ "M=math.ceil(M*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"saturation magnetisation in A/m is\",M,\"*10**5\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('saturation magnetisation in A/m is', 2.9299, '*10**5')\n"
+ "text": [
+ "('saturation magnetisation in A/m is', 2.9299, '*10**5')\n"
+ ]
}
],
"prompt_number": 8
@@ -101,19 +201,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.5, Page number 307"
+ "source": [
+ "Example number 10.5, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the value of B and M\n\n#importing modules\nimport math\n\n#Variable declaration\nmew_0=4*math.pi*10**-7;\nH=2*10**5; #magnetic field strength in A/m\nmew_r=1.01; #relative permeability\n\n#Calculation\nB=mew_0*mew_r*H;\nB=math.ceil(B*10**5)/10**5; #rounding off to 3 decimals\nM=(B/mew_0)-H;\nM=math.ceil(M*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"magnetic flux density in Wb/m^2 is\",B);\nprint(\"magnetisation in A/m is\",M);\n\n#answer for magnetisation given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "H=2*10**5; #magnetic field strength in A/m\n",
+ "mew_r=1.01; #relative permeability\n",
+ "\n",
+ "#Calculation\n",
+ "B=mew_0*mew_r*H;\n",
+ "B=math.ceil(B*10**5)/10**5; #rounding off to 3 decimals\n",
+ "M=(B/mew_0)-H;\n",
+ "M=math.ceil(M*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic flux density in Wb/m^2 is\",B);\n",
+ "print(\"magnetisation in A/m is\",M);\n",
+ "\n",
+ "#answer for magnetisation given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetic flux density in Wb/m^2 is', 0.25385)\n('magnetisation in A/m is', 2007.42)\n"
+ "text": [
+ "('magnetic flux density in Wb/m^2 is', 0.25385)\n",
+ "('magnetisation in A/m is', 2007.42)\n"
+ ]
}
],
"prompt_number": 9
@@ -122,19 +249,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 10.6, Page number 307"
+ "source": [
+ "Example number 10.6, Page number 307"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the magnetic flux density\n\n#importing modules\nimport math\n\n#Variable declaration\nmew_0=4*math.pi*10**-7;\nH=500; #magnetic field strength in A/m\nchi=1.2; #susceptibility\n\n#Calculation\nM=chi*H;\nB=mew_0*(M+H);\nB=B*10**3;\nB=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"magnetic flux density in Wb/m^2 is\",B,\"*10**-3\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_0=4*math.pi*10**-7;\n",
+ "H=500; #magnetic field strength in A/m\n",
+ "chi=1.2; #susceptibility\n",
+ "\n",
+ "#Calculation\n",
+ "M=chi*H;\n",
+ "B=mew_0*(M+H);\n",
+ "B=B*10**3;\n",
+ "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"magnetic flux density in Wb/m^2 is\",B,\"*10**-3\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('magnetic flux density in Wb/m^2 is', 1.3824, '*10**-3')\n"
+ "text": [
+ "('magnetic flux density in Wb/m^2 is', 1.3824, '*10**-3')\n"
+ ]
}
],
"prompt_number": 14
@@ -142,7 +292,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_11.ipynb b/Engineering_Physics_Marikani/Chapter_11.ipynb
index 6e1a896d..781b51dc 100644
--- a/Engineering_Physics_Marikani/Chapter_11.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 11"
+ "name": "",
+ "signature": "sha256:6c9d1e462fb51d212d5e8b8f597a34ef40452b9332c91d54e15e6a4dccd85074"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Dielectric materials"
+ "source": [
+ "Dielectric materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.1, Page number 335"
+ "source": [
+ "Example number 11.1, Page number 335"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative dielectric constant\n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nA=10*10*10**-6; #area of capacitor in m^2\nd=2*10**-3; #distance of seperation in m\nC=10**-9; #capacitance in F\n\n#Calculation\nepsilon_r=(C*d)/(epsilon_0*A);\nepsilon_r=math.ceil(epsilon_r*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"dielectric constant of material is\",epsilon_r);\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "A=10*10*10**-6; #area of capacitor in m^2\n",
+ "d=2*10**-3; #distance of seperation in m\n",
+ "C=10**-9; #capacitance in F\n",
+ "\n",
+ "#Calculation\n",
+ "epsilon_r=(C*d)/(epsilon_0*A);\n",
+ "epsilon_r=math.ceil(epsilon_r*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"dielectric constant of material is\",epsilon_r);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('dielectric constant of material is', 2258.87)\n"
+ "text": [
+ "('dielectric constant of material is', 2258.87)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +62,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.2, Page number 335"
+ "source": [
+ "Example number 11.2, Page number 335"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability of atoms\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nepsilon_r=1.0000684; #dielectric constant of He gas\nN=2.7*10**25; #concentration of dipoles per m^3\n\n#Calculation\n#alpha_e=P/(N*E) and P=epsilon_0(epsilon_r-1)*E\n#therefore alpha_e=epsilon_0(epsilon_r-1)/N\nalpha_e=(epsilon_0*(epsilon_r-1))/N;\n\n#Result\nprint(\"electronic polarizability of He gas in Fm^2 is\",alpha_e);\n",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "epsilon_r=1.0000684; #dielectric constant of He gas\n",
+ "N=2.7*10**25; #concentration of dipoles per m^3\n",
+ "\n",
+ "#Calculation\n",
+ "#alpha_e=P/(N*E) and P=epsilon_0(epsilon_r-1)*E\n",
+ "#therefore alpha_e=epsilon_0(epsilon_r-1)/N\n",
+ "alpha_e=(epsilon_0*(epsilon_r-1))/N;\n",
+ "\n",
+ "#Result\n",
+ "print(\"electronic polarizability of He gas in Fm^2 is\",alpha_e);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electronic polarizability of He gas in Fm^2 is', 2.2430133333322991e-41)\n"
+ "text": [
+ "('electronic polarizability of He gas in Fm^2 is', 2.2430133333322991e-41)\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +101,35 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.3, Page number 336"
+ "source": [
+ "Example number 11.3, Page number 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the polarisation\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nepsilon_r=6; #dielectric constant\nE=100; #electric field intensity in V/m\n\n#Calculation\nP=epsilon_0*(epsilon_r-1)*E;\n\n#Result\nprint(\"polarization in C/m^2 is\",P);\n",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "epsilon_r=6; #dielectric constant\n",
+ "E=100; #electric field intensity in V/m\n",
+ "\n",
+ "#Calculation\n",
+ "P=epsilon_0*(epsilon_r-1)*E;\n",
+ "\n",
+ "#Result\n",
+ "print(\"polarization in C/m^2 is\",P);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('polarization in C/m^2 is', 4.426999999999999e-09)\n"
+ "text": [
+ "('polarization in C/m^2 is', 4.426999999999999e-09)\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +138,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.4, Page number 336"
+ "source": [
+ "Example number 11.4, Page number 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electronic polarizability of Ne\n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nR=0.158; #radius of Ne in nm\n\n#Calculation\nR=R*10**-9; #converting nm to m\nalpha_e=4*math.pi*epsilon_0*R**3;\n\n#Result\nprint(\"electronic polarizability in Fm^2 is\",alpha_e);\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "R=0.158; #radius of Ne in nm\n",
+ "\n",
+ "#Calculation\n",
+ "R=R*10**-9; #converting nm to m\n",
+ "alpha_e=4*math.pi*epsilon_0*R**3;\n",
+ "\n",
+ "#Result\n",
+ "print(\"electronic polarizability in Fm^2 is\",alpha_e);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electronic polarizability in Fm^2 is', 4.3885458748002144e-40)\n"
+ "text": [
+ "('electronic polarizability in Fm^2 is', 4.3885458748002144e-40)\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +178,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.5, Page number 336"
+ "source": [
+ "Example number 11.5, Page number 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the area of metal sheet\n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nC=0.02; #capacitance in micro farad\nepsilon_r=6; #dielectric constant\nt=0.002; #thickness of mica in cm\nd=0.002; #thickness of metal sheet in cm\n\n#Calculation\nC=C*10**-6; #converting micro farad to farad\nd=d*10**-2; #converting cm to m\nA=(C*d)/(epsilon_0*epsilon_r);\nA=A*10**3;\nA=math.ceil(A*10**4)/10**4; #rounding off to 4 decimals\nA1=A*10; #converting m**2 to cm**2\nA1=math.ceil(A1*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"area of metal sheet in m^2 is\",A,\"*10**-3\");\nprint(\"area of metal sheet in cm^2 is\",A1);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "C=0.02; #capacitance in micro farad\n",
+ "epsilon_r=6; #dielectric constant\n",
+ "t=0.002; #thickness of mica in cm\n",
+ "d=0.002; #thickness of metal sheet in cm\n",
+ "\n",
+ "#Calculation\n",
+ "C=C*10**-6; #converting micro farad to farad\n",
+ "d=d*10**-2; #converting cm to m\n",
+ "A=(C*d)/(epsilon_0*epsilon_r);\n",
+ "A=A*10**3;\n",
+ "A=math.ceil(A*10**4)/10**4; #rounding off to 4 decimals\n",
+ "A1=A*10; #converting m**2 to cm**2\n",
+ "A1=math.ceil(A1*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"area of metal sheet in m^2 is\",A,\"*10**-3\");\n",
+ "print(\"area of metal sheet in cm^2 is\",A1);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('area of metal sheet in m^2 is', 7.5296, '*10**-3')\n('area of metal sheet in cm^2 is', 75.296)\n"
+ "text": [
+ "('area of metal sheet in m^2 is', 7.5296, '*10**-3')\n",
+ "('area of metal sheet in cm^2 is', 75.296)\n"
+ ]
}
],
"prompt_number": 9
@@ -122,19 +229,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.6, Page number 336"
+ "source": [
+ "Example number 11.6, Page number 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative permitivity of the crystal\n\n#importing modules\nimport math\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nE=1000; #electric field in V/m\nP=4.3*10**-8; #polarization in C/m^2\n\n#Calculation\nepsilon_r=(P/(E*epsilon_0)+1);\nepsilon_r=math.ceil(epsilon_r*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"dielectric constant is\",epsilon_r);\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "E=1000; #electric field in V/m\n",
+ "P=4.3*10**-8; #polarization in C/m^2\n",
+ "\n",
+ "#Calculation\n",
+ "epsilon_r=(P/(E*epsilon_0)+1);\n",
+ "epsilon_r=math.ceil(epsilon_r*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"dielectric constant is\",epsilon_r);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('dielectric constant is', 5.8566)\n"
+ "text": [
+ "('dielectric constant is', 5.8566)\n"
+ ]
}
],
"prompt_number": 10
@@ -143,19 +270,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 11.7, Page number 337"
+ "source": [
+ "Example number 11.7, Page number 337"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the polarisability of the material\n\n#Variable declaration\nepsilon_0=8.854*10**-12;\nchi=4.94; #relative susceptibility\nN=10**28; #number of dipoles per m^3\n\n#Calculation\n#polarisation P=N*alpha*E and P=epsilon_0*chi*E. equate the two equations\n#epsilon_0*chi*E=N*alpha*E\nalpha=(epsilon_0*chi)/N;\n\n#Result\nprint(\"polarisability of material in F/m^2 is\",alpha);\n",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "epsilon_0=8.854*10**-12;\n",
+ "chi=4.94; #relative susceptibility\n",
+ "N=10**28; #number of dipoles per m^3\n",
+ "\n",
+ "#Calculation\n",
+ "#polarisation P=N*alpha*E and P=epsilon_0*chi*E. equate the two equations\n",
+ "#epsilon_0*chi*E=N*alpha*E\n",
+ "alpha=(epsilon_0*chi)/N;\n",
+ "\n",
+ "#Result\n",
+ "print(\"polarisability of material in F/m^2 is\",alpha);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('polarisability of material in F/m^2 is', 4.373876e-39)\n"
+ "text": [
+ "('polarisability of material in F/m^2 is', 4.373876e-39)\n"
+ ]
}
],
"prompt_number": 11
@@ -163,7 +308,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_12.ipynb b/Engineering_Physics_Marikani/Chapter_12.ipynb
index 5d0b74d0..dba2b7b8 100644
--- a/Engineering_Physics_Marikani/Chapter_12.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 12"
+ "name": "",
+ "signature": "sha256:40ea4bb009666aeba2b07d31c3573a833c155d9ac8e902b20b5967865ae89dbb"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Superconducting Materials"
+ "source": [
+ "Superconducting Materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.1, Page number 356"
+ "source": [
+ "Example number 12.1, Page number 356"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical field\n\n#importing modules\nimport math\n\n#Variable declaration\nTc=3.7; #critical temperature in K\nH0=0.0306; #magnetic field in T\nT=2; #temperature in K\n\n#Calculation\nHc=H0*(1-(T**2/Tc**2));\nHc=math.ceil(Hc*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"critical field in T is\",Hc);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc=3.7; #critical temperature in K\n",
+ "H0=0.0306; #magnetic field in T\n",
+ "T=2; #temperature in K\n",
+ "\n",
+ "#Calculation\n",
+ "Hc=H0*(1-(T**2/Tc**2));\n",
+ "Hc=math.ceil(Hc*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"critical field in T is\",Hc);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('critical field in T is', 0.02166)\n"
+ "text": [
+ "('critical field in T is', 0.02166)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +62,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.2, Page number 356"
+ "source": [
+ "Example number 12.2, Page number 356"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical field\n\n#importing modules\nimport math\n\n#Variable declaration\nTc=7.26; #critical temperature in K\nH0=6.4*10**3; #magnetic field in T\nT=5; #temperature in K\n\n#Calculation\nHc=H0*(1-(T**2/Tc**2));\nHc=math.ceil(Hc*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"critical field in T is\",Hc);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc=7.26; #critical temperature in K\n",
+ "H0=6.4*10**3; #magnetic field in T\n",
+ "T=5; #temperature in K\n",
+ "\n",
+ "#Calculation\n",
+ "Hc=H0*(1-(T**2/Tc**2));\n",
+ "Hc=math.ceil(Hc*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"critical field in T is\",Hc);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('critical field in T is', 3364.385)\n"
+ "text": [
+ "('critical field in T is', 3364.385)\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +104,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.3, Page number 357"
+ "source": [
+ "Example number 12.3, Page number 357"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the value of Tc\n\n#importing modules\nimport math\n\n#Variable declaration\nTc1=4.185; #critical temperature in K\nM1=199.5; #atomic mass\nM2=203.4; #atomic mass after changing\n\n#Calculation\n#according to maxwell equation Tc*M^0.5=constant\n#Tc1*M1^0.5=Tc2*M2^0.5\nTc2=(Tc1*M1**0.5)/M2**0.5;\nTc2=math.ceil(Tc2*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"critical temperature of Hg in K is\",Tc2);\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Tc1=4.185; #critical temperature in K\n",
+ "M1=199.5; #atomic mass\n",
+ "M2=203.4; #atomic mass after changing\n",
+ "\n",
+ "#Calculation\n",
+ "#according to maxwell equation Tc*M^0.5=constant\n",
+ "#Tc1*M1^0.5=Tc2*M2^0.5\n",
+ "Tc2=(Tc1*M1**0.5)/M2**0.5;\n",
+ "Tc2=math.ceil(Tc2*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"critical temperature of Hg in K is\",Tc2);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('critical temperature of Hg in K is', 4.144685)\n"
+ "text": [
+ "('critical temperature of Hg in K is', 4.144685)\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +147,54 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.4, Page number 357"
+ "source": [
+ "Example number 12.4, Page number 357"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical current density\n\n#importing modules\nimport math\n\n#Variable declaration\nd=1; #diameter of wire in mm\nT=4.2; #temperature in K\nTc=7.18; #critical temperature in K\nH0=6.5*10**4; #magnetic field\n\n#Calculation\nd=d*10**-3; #diameter in m\nR=d/2;\nHc=H0*(1-(T**2/Tc**2));\nHC=Hc/10**4;\nHC=math.ceil(HC*10**3)/10**3; #rounding off to 2 decimals\nIc=2*math.pi*R*Hc;\nIc=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\nA=math.pi*R**2;\nJ=Ic/A;\nJ=J/10**8;\nJ=math.ceil(J*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"critical magnetic field at 4.2K in A/m is\",HC,\"*10**4\");\nprint(\"critical current in A is\",Ic);\nprint(\"critical current density in A/m^2 is\",J,\"*10**8\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=1; #diameter of wire in mm\n",
+ "T=4.2; #temperature in K\n",
+ "Tc=7.18; #critical temperature in K\n",
+ "H0=6.5*10**4; #magnetic field\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**-3; #diameter in m\n",
+ "R=d/2;\n",
+ "Hc=H0*(1-(T**2/Tc**2));\n",
+ "HC=Hc/10**4;\n",
+ "HC=math.ceil(HC*10**3)/10**3; #rounding off to 2 decimals\n",
+ "Ic=2*math.pi*R*Hc;\n",
+ "Ic=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n",
+ "A=math.pi*R**2;\n",
+ "J=Ic/A;\n",
+ "J=J/10**8;\n",
+ "J=math.ceil(J*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"critical magnetic field at 4.2K in A/m is\",HC,\"*10**4\");\n",
+ "print(\"critical current in A is\",Ic);\n",
+ "print(\"critical current density in A/m^2 is\",J,\"*10**8\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('critical magnetic field at 4.2K in A/m is', 4.276, '*10**4')\n('critical current in A is', 134.33)\n('critical current density in A/m^2 is', 1.71035, '*10**8')\n"
+ "text": [
+ "('critical magnetic field at 4.2K in A/m is', 4.276, '*10**4')\n",
+ "('critical current in A is', 134.33)\n",
+ "('critical current density in A/m^2 is', 1.71035, '*10**8')\n"
+ ]
}
],
"prompt_number": 15
@@ -101,19 +203,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.5, Page number 358"
+ "source": [
+ "Example number 12.5, Page number 358"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the frequency of radiation\n\n#importing modules\nimport math\n\n#Variable declaration\ne=1.6*10**-19;\nh=6.626*10**-34;\nV=6; #voltage applied in micro volts\n\n#Calculation\nV=V*10**-6; #converting micro volts to volts\nnew=(2*e*V)/h;\nnew=new/10**9;\nnew=math.ceil(new*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"frequency of ac signal in Hz is\",new,\"*10**9\");",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "e=1.6*10**-19;\n",
+ "h=6.626*10**-34;\n",
+ "V=6; #voltage applied in micro volts\n",
+ "\n",
+ "#Calculation\n",
+ "V=V*10**-6; #converting micro volts to volts\n",
+ "new=(2*e*V)/h;\n",
+ "new=new/10**9;\n",
+ "new=math.ceil(new*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"frequency of ac signal in Hz is\",new,\"*10**9\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('frequency of ac signal in Hz is', 2.8977, '*10**9')\n"
+ "text": [
+ "('frequency of ac signal in Hz is', 2.8977, '*10**9')\n"
+ ]
}
],
"prompt_number": 16
@@ -122,19 +246,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 12.6, Page number 358"
+ "source": [
+ "Example number 12.6, Page number 358"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the band gap\n\n#importing modules\nimport math\n\n#Variable declaration\nKb=1.38*10**-23;\nTc=7.19; #critical temperature in K\n\n#Calculation\nEg=3.5*Kb*Tc;\nEg=Eg/(1.6*10**-19); #converting J to eV\nEg=Eg*10**3; #converting eV into milli eV\nEg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"band gap of superconducting lead in meV is\",Eg);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Kb=1.38*10**-23;\n",
+ "Tc=7.19; #critical temperature in K\n",
+ "\n",
+ "#Calculation\n",
+ "Eg=3.5*Kb*Tc;\n",
+ "Eg=Eg/(1.6*10**-19); #converting J to eV\n",
+ "Eg=Eg*10**3; #converting eV into milli eV\n",
+ "Eg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"band gap of superconducting lead in meV is\",Eg);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('band gap of superconducting lead in meV is', 2.171)\n"
+ "text": [
+ "('band gap of superconducting lead in meV is', 2.171)\n"
+ ]
}
],
"prompt_number": 17
@@ -142,7 +288,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_2.ipynb b/Engineering_Physics_Marikani/Chapter_2.ipynb
index f57dc5cb..b54dc631 100644
--- a/Engineering_Physics_Marikani/Chapter_2.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 2"
+ "name": "",
+ "signature": "sha256:86128ebcddc1aace30166722ef06d4489b2c11f53b2c59c5d439d37f83881533"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,54 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Laser"
+ "source": [
+ "Laser"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.1, Page number 59 "
+ "source": [
+ "Example number 2.1, Page number 59 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of photons emitted by laser\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34;\nc=3*10**8;\nlamda=632.8*10**-9; #wavelength in m\nP=5*10**-3; #output power in W\n\n#Calculation\nE=(h*c)/lamda; #energy of one photon\nE_eV=E/(1.6*10**-19); #converting J to eV\nE_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\nN=P/E; #number of photons emitted\n\n\n#Result\nprint(\"energy of one photon in eV is\",E_eV);\nprint(\"number of photons emitted per second is\",N);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "lamda=632.8*10**-9; #wavelength in m\n",
+ "P=5*10**-3; #output power in W\n",
+ "\n",
+ "#Calculation\n",
+ "E=(h*c)/lamda; #energy of one photon\n",
+ "E_eV=E/(1.6*10**-19); #converting J to eV\n",
+ "E_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n",
+ "N=P/E; #number of photons emitted\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy of one photon in eV is\",E_eV);\n",
+ "print(\"number of photons emitted per second is\",N);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy of one photon in eV is', 1.964)\n('number of photons emitted per second is', 1.5917094275077976e+16)\n"
+ "text": [
+ "('energy of one photon in eV is', 1.964)\n",
+ "('number of photons emitted per second is', 1.5917094275077976e+16)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +68,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.2, Page number 60"
+ "source": [
+ "Example number 2.2, Page number 60"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy of emitted photons\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34;\nc=3*10**8;\nlamda=632.8*10**-9; #wavelength in m\n\n#Calculation\nE=(h*c)/lamda; #energy of one photon\nE_eV=E/(1.6*10**-19); #converting J to eV\nE_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n\n#Result\nprint(\"energy of one photon in eV is\",E_eV);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "lamda=632.8*10**-9; #wavelength in m\n",
+ "\n",
+ "#Calculation\n",
+ "E=(h*c)/lamda; #energy of one photon\n",
+ "E_eV=E/(1.6*10**-19); #converting J to eV\n",
+ "E_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy of one photon in eV is\",E_eV);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy of one photon in eV is', 1.964)\n"
+ "text": [
+ "('energy of one photon in eV is', 1.964)\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +111,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.3, Page number 60"
+ "source": [
+ "Example number 2.3, Page number 60"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the value of E3\n\n#importing modules\nimport math\n\n#Variable declaration\nE1=0; #value of 1st energy level in eV\nE2=1.4; #value of 2nd energy level in eV\nlamda=1.15*10**-6;\nh=6.626*10**-34;\nc=3*10**8;\n\n#Calculation\nE=(h*c)/lamda; #energy of one photon\nE_eV=E/(1.6*10**-19); #converting J to eV\nE3=E2+E_eV;\nE3=math.ceil(E3*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"value of E3 in eV is\",E3);\n\n#answer given in the book for E3 is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "E1=0; #value of 1st energy level in eV\n",
+ "E2=1.4; #value of 2nd energy level in eV\n",
+ "lamda=1.15*10**-6;\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "\n",
+ "#Calculation\n",
+ "E=(h*c)/lamda; #energy of one photon\n",
+ "E_eV=E/(1.6*10**-19); #converting J to eV\n",
+ "E3=E2+E_eV;\n",
+ "E3=math.ceil(E3*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"value of E3 in eV is\",E3);\n",
+ "\n",
+ "#answer given in the book for E3 is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('value of E3 in eV is', 2.49)\n"
+ "text": [
+ "('value of E3 in eV is', 2.49)\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +159,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.4, Page number 60"
+ "source": [
+ "Example number 2.4, Page number 60"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of laser beam\n\n#Variable declaration\nh=6.626*10**-34;\nc=3*10**8;\nE2=3.2; #value of higher energy level in eV\nE1=1.6; #value of lower energy level in eV\n\n#Calculation\nE=E2-E1; #energy difference in eV\nE_J=E*1.6*10**-19; #converting E from eV to J\nlamda=(h*c)/E_J; #wavelength of photon\n\n#Result\nprint(\"energy difference in eV\",E);\nprint(\"wavelength of photon in m\",lamda);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "E2=3.2; #value of higher energy level in eV\n",
+ "E1=1.6; #value of lower energy level in eV\n",
+ "\n",
+ "#Calculation\n",
+ "E=E2-E1; #energy difference in eV\n",
+ "E_J=E*1.6*10**-19; #converting E from eV to J\n",
+ "lamda=(h*c)/E_J; #wavelength of photon\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy difference in eV\",E);\n",
+ "print(\"wavelength of photon in m\",lamda);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy difference in eV', 1.6)\n('wavelength of photon in m', 7.76484375e-07)\n"
+ "text": [
+ "('energy difference in eV', 1.6)\n",
+ "('wavelength of photon in m', 7.76484375e-07)\n"
+ ]
}
],
"prompt_number": 6
@@ -101,19 +202,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.5, Page number 60"
+ "source": [
+ "Example number 2.5, Page number 60"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength of laser beam\n\n#Variable declaration\nh=6.626*10**-34;\nc=3*10**8;\nE=1.42*1.6*10**-19; #band gap of GaAs in J\n\n#Calculation\nlamda=(h*c)/E; #wavelength of laser\n\n#Result\nprint(\"wavelength of laser emitted by GaAs in m\",lamda);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "E=1.42*1.6*10**-19; #band gap of GaAs in J\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=(h*c)/E; #wavelength of laser\n",
+ "\n",
+ "#Result\n",
+ "print(\"wavelength of laser emitted by GaAs in m\",lamda);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('wavelength of laser emitted by GaAs in m', 8.74911971830986e-07)\n"
+ "text": [
+ "('wavelength of laser emitted by GaAs in m', 8.74911971830986e-07)\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +240,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.6, Page number 61"
+ "source": [
+ "Example number 2.6, Page number 61"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the relative population of energy levels\n\n#importing modules\nimport math\n\n#Variable declaration\nT=300; #temperature in K\nlamda=500*10**-9; #wavelength in m\nh=6.626*10**-34;\nc=3*10**8;\nk=1.38*10**-23;\n\n#Calculation\n#from maxwell and boltzmann law, relative population is given by\n#N1/N2=exp(-E1/kT)/exp(-E2/kT)\n#hence N1/N2=exp(-(E1-E2)/kT)=exp((h*new)/(k*T));\n#new=c/lambda\nR=(h*c)/(lamda*k*T);\nRP=math.exp(R);\n\n#Result\nprint(\"relative population between N1 and N2 is\",RP);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T=300; #temperature in K\n",
+ "lamda=500*10**-9; #wavelength in m\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "#from maxwell and boltzmann law, relative population is given by\n",
+ "#N1/N2=exp(-E1/kT)/exp(-E2/kT)\n",
+ "#hence N1/N2=exp(-(E1-E2)/kT)=exp((h*new)/(k*T));\n",
+ "#new=c/lambda\n",
+ "R=(h*c)/(lamda*k*T);\n",
+ "RP=math.exp(R);\n",
+ "\n",
+ "#Result\n",
+ "print(\"relative population between N1 and N2 is\",RP);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('relative population between N1 and N2 is', 5.068255595981255e+41)\n"
+ "text": [
+ "('relative population between N1 and N2 is', 5.068255595981255e+41)\n"
+ ]
}
],
"prompt_number": 9
@@ -143,19 +288,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.7, Page number 61"
+ "source": [
+ "Example number 2.7, Page number 61"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To examine the possibility of stimulated emission\n\n#importing modules\nimport math\n\n#Variable declaration\nT=300; #temperature in K\nh=6.626*10**-34;\nc=3*10**8;\nk=1.38*10**-23;\nlamda=600*10**-9; #wavelength in m\n\n#Calculation\nR=(h*c)/(lamda*k*T);\nRs=1/(math.exp(R)-1);\n\n#Result\nprint(\"the ratio between stimulated emission to spontaneous emission is\",Rs);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T=300; #temperature in K\n",
+ "h=6.626*10**-34;\n",
+ "c=3*10**8;\n",
+ "k=1.38*10**-23;\n",
+ "lamda=600*10**-9; #wavelength in m\n",
+ "\n",
+ "#Calculation\n",
+ "R=(h*c)/(lamda*k*T);\n",
+ "Rs=1/(math.exp(R)-1);\n",
+ "\n",
+ "#Result\n",
+ "print(\"the ratio between stimulated emission to spontaneous emission is\",Rs);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the ratio between stimulated emission to spontaneous emission is', 1.7617782449453023e-35)\n"
+ "text": [
+ "('the ratio between stimulated emission to spontaneous emission is', 1.7617782449453023e-35)\n"
+ ]
}
],
"prompt_number": 11
@@ -164,19 +332,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.8, Page number 62"
+ "source": [
+ "Example number 2.8, Page number 62"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the efficiency of a He-Ne laser\n\n#importing modules\nimport math\n\n#Variable declaration\nP=5*10**-3; #output power in W\nI=10*10**-3; #current in A\nV=3*10**3; #voltage in V\n\n#Calculation\ne=(P*100)/(I*V);\ne=math.ceil(e*10**6)/10**6; #rounding off to 6 decimals\n\n#Result\nprint(\"efficiency of laser in % is\",e);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "P=5*10**-3; #output power in W\n",
+ "I=10*10**-3; #current in A\n",
+ "V=3*10**3; #voltage in V\n",
+ "\n",
+ "#Calculation\n",
+ "e=(P*100)/(I*V);\n",
+ "e=math.ceil(e*10**6)/10**6; #rounding off to 6 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"efficiency of laser in % is\",e);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('efficiency of laser in % is', 0.016667)\n"
+ "text": [
+ "('efficiency of laser in % is', 0.016667)\n"
+ ]
}
],
"prompt_number": 14
@@ -185,19 +374,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.9, Page number 62"
+ "source": [
+ "Example number 2.9, Page number 62"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the intensity of laser beam\n\n#importing modules\nimport math\n\n#Variable declaration\nP=1e-03; #output power in W\nd=1e-06; #diameter in m\n\n#Calculation\nr=d/2; #radius in m\nI=P/(math.pi*r**2); #intensity\nI=I/10**9;\nI=math.ceil(I*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"intensity of laser in W/m^2 is\",I,\"*10**9\");",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "P=1e-03; #output power in W\n",
+ "d=1e-06; #diameter in m\n",
+ "\n",
+ "#Calculation\n",
+ "r=d/2; #radius in m\n",
+ "I=P/(math.pi*r**2); #intensity\n",
+ "I=I/10**9;\n",
+ "I=math.ceil(I*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"intensity of laser in W/m^2 is\",I,\"*10**9\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('intensity of laser in W/m^2 is', 1.2733, '*10**9')\n"
+ "text": [
+ "('intensity of laser in W/m^2 is', 1.2733, '*10**9')\n"
+ ]
}
],
"prompt_number": 1
@@ -206,19 +416,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 2.10, Page number 62"
+ "source": [
+ "Example number 2.10, Page number 62"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angular speed and divergence of laser beam\n\n#importing modules\nimport math\n\n#Variable declaration\nlamda=632.8*10**-9; #wavelength in m\nD=5; #distance in m\nd=1*10**-3; #diameter in m\n\n#Calculation\ndeltatheta=lamda/d; #angular speed\ndelta_theta=deltatheta*10**4;\nr=D*deltatheta;\nr1=r*10**3; #converting r from m to mm\nA=math.pi*r**2; #area of the spread\n\n#Result \nprint(\"angular speed in radian is\",delta_theta,\"*10**-4\");\nprint(\"radius of the spread in mm is\",r1);\nprint(\"area of the spread in m^2 is\",A);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "lamda=632.8*10**-9; #wavelength in m\n",
+ "D=5; #distance in m\n",
+ "d=1*10**-3; #diameter in m\n",
+ "\n",
+ "#Calculation\n",
+ "deltatheta=lamda/d; #angular speed\n",
+ "delta_theta=deltatheta*10**4;\n",
+ "r=D*deltatheta;\n",
+ "r1=r*10**3; #converting r from m to mm\n",
+ "A=math.pi*r**2; #area of the spread\n",
+ "\n",
+ "#Result \n",
+ "print(\"angular speed in radian is\",delta_theta,\"*10**-4\");\n",
+ "print(\"radius of the spread in mm is\",r1);\n",
+ "print(\"area of the spread in m^2 is\",A);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('angular speed in radian is', 6.328, '*10**-4')\n('radius of the spread in mm is', 3.164)\n('area of the spread in m^2 is', 3.1450157329451454e-05)\n"
+ "text": [
+ "('angular speed in radian is', 6.328, '*10**-4')\n",
+ "('radius of the spread in mm is', 3.164)\n",
+ "('area of the spread in m^2 is', 3.1450157329451454e-05)\n"
+ ]
}
],
"prompt_number": 2
@@ -226,7 +464,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_3.ipynb b/Engineering_Physics_Marikani/Chapter_3.ipynb
index 59daaddd..7496a57a 100644
--- a/Engineering_Physics_Marikani/Chapter_3.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 3"
+ "name": "",
+ "signature": "sha256:3f2462cfb429298e26fc6bf563d665947cd211731889b95d7dd1a2db3452c286"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,47 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Fibre Optics"
+ "source": [
+ "Fibre Optics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.1, Page number 98 "
+ "source": [
+ "Example number 3.1, Page number 98 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture of an optical fibre\n\n#importing modules\nimport math\n\n#Variable declaration\nn1=1.6; #refractive index of core\nn2=1.5; #refractive index of cladding\n\n#Calculation\nNA=math.sqrt((n1**2)-(n2**2));\nNA=math.ceil(NA*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"the numerical aperture of the fibre is\",NA);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.6; #refractive index of core\n",
+ "n2=1.5; #refractive index of cladding\n",
+ "\n",
+ "#Calculation\n",
+ "NA=math.sqrt((n1**2)-(n2**2));\n",
+ "NA=math.ceil(NA*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the numerical aperture of the fibre is\",NA);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the numerical aperture of the fibre is', 0.5568)\n"
+ "text": [
+ "('the numerical aperture of the fibre is', 0.5568)\n"
+ ]
}
],
"prompt_number": 4
@@ -38,19 +61,54 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.2, Page number 98 "
+ "source": [
+ "Example number 3.2, Page number 98 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the numerical aperture and acceptance angle of a fibre\n\n#importing modules\nimport math\n\n#Variable declaration\nn1=1.54; #refractive index of core\nn2=1.5; #refractive index of cladding\nn0=1;\n\n#Calculation\nNA=math.sqrt((n1**2)-(n2**2)); #numerical aperture of fibre\nNA=math.ceil(NA*10**5)/10**5; #rounding off to 5 decimals\nalpha=math.asin(NA/n0); #acceptance angle in radians\nalpha=alpha*57.2957795; #converting radians to degrees\nalpha=math.ceil(alpha*10**5)/10**5; #rounding off to 5 decimals\ndeg=int(alpha); #converting to degrees\nt=60*(alpha-deg); \nmi=int(t); #converting to minutes\nsec=60*(t-mi); #converting to seconds\nsec=math.ceil(sec*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"the numerical aperture of the fibre is\",NA);\nprint(\"the acceptance angle of the fibre in degrees is\",alpha);\nprint(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n\n#answer for the angle given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.54; #refractive index of core\n",
+ "n2=1.5; #refractive index of cladding\n",
+ "n0=1;\n",
+ "\n",
+ "#Calculation\n",
+ "NA=math.sqrt((n1**2)-(n2**2)); #numerical aperture of fibre\n",
+ "NA=math.ceil(NA*10**5)/10**5; #rounding off to 5 decimals\n",
+ "alpha=math.asin(NA/n0); #acceptance angle in radians\n",
+ "alpha=alpha*57.2957795; #converting radians to degrees\n",
+ "alpha=math.ceil(alpha*10**5)/10**5; #rounding off to 5 decimals\n",
+ "deg=int(alpha); #converting to degrees\n",
+ "t=60*(alpha-deg); \n",
+ "mi=int(t); #converting to minutes\n",
+ "sec=60*(t-mi); #converting to seconds\n",
+ "sec=math.ceil(sec*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the numerical aperture of the fibre is\",NA);\n",
+ "print(\"the acceptance angle of the fibre in degrees is\",alpha);\n",
+ "print(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n",
+ "\n",
+ "#answer for the angle given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the numerical aperture of the fibre is', 0.34872)\n('the acceptance angle of the fibre in degrees is', 20.40905)\n('acceptance angle of the fibre is', 20, 'degrees', 24, 'minutes', 32.581, 'seconds')\n"
+ "text": [
+ "('the numerical aperture of the fibre is', 0.34872)\n",
+ "('the acceptance angle of the fibre in degrees is', 20.40905)\n",
+ "('acceptance angle of the fibre is', 20, 'degrees', 24, 'minutes', 32.581, 'seconds')\n"
+ ]
}
],
"prompt_number": 7
@@ -59,19 +117,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.3, Page number 99"
+ "source": [
+ "Example number 3.3, Page number 99"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the critical angle\n\n#importing modules\nimport math\n\n#Variable declaration\nn1=1.6; #refractive index of core\nn2=1.49; #refractive index of cladding\n\n#Calculation\nthetac=math.asin(n2/n1); #critical angle in radians\nthetac=thetac*57.2957795; #converting radians to degrees\ntheta_c=math.ceil(thetac*10**3)/10**3; #rounding off to 3 decimals\ndeg=int(thetac); #converting to degrees\nt=60*(thetac-deg); \nmi=int(t); #converting to minutes\nsec=60*(t-mi); #converting to seconds\nsec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"the critical angle of the fibre in degrees is\",theta_c);\nprint(\"critical angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.6; #refractive index of core\n",
+ "n2=1.49; #refractive index of cladding\n",
+ "\n",
+ "#Calculation\n",
+ "thetac=math.asin(n2/n1); #critical angle in radians\n",
+ "thetac=thetac*57.2957795; #converting radians to degrees\n",
+ "theta_c=math.ceil(thetac*10**3)/10**3; #rounding off to 3 decimals\n",
+ "deg=int(thetac); #converting to degrees\n",
+ "t=60*(thetac-deg); \n",
+ "mi=int(t); #converting to minutes\n",
+ "sec=60*(t-mi); #converting to seconds\n",
+ "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"the critical angle of the fibre in degrees is\",theta_c);\n",
+ "print(\"critical angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('the critical angle of the fibre in degrees is', 68.631)\n('critical angle of the fibre is', 68, 'degrees', 37, 'minutes', 49.85, 'seconds')\n"
+ "text": [
+ "('the critical angle of the fibre in degrees is', 68.631)\n",
+ "('critical angle of the fibre is', 68, 'degrees', 37, 'minutes', 49.85, 'seconds')\n"
+ ]
}
],
"prompt_number": 10
@@ -80,19 +166,54 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.4, Page number 99"
+ "source": [
+ "Example number 3.4, Page number 99"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the acceptance angle of a fibre\n\n#importing modules\nimport math\n\n#Variable declaration\nNA=0.15; #numerical aperture\nn2=1.55; #refractive index of cladding\nn0=1.33; #refractive index of water\n\n#Calculation\nn1=math.sqrt((NA**2)+(n2**2)); #refractive index\nn_1=math.ceil(n1*10**5)/10**5; #rounding off to 5 decimals\nalpha=math.asin(math.sqrt(n1**2-n2**2)/n0); #acceptance angle in radians\nalpha=alpha*57.2957795; #converting radians to degrees\nalphaa=math.ceil(alpha*10**3)/10**3; #rounding off to 3 decimals\ndeg=int(alpha); #converting to degrees\nt=60*(alpha-deg); \nmi=int(t); #converting to minutes\nsec=60*(t-mi); #converting to seconds\nsec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"refractive index of the core is\",n_1);\nprint(\"the acceptance angle of the fibre in degrees is\",alphaa);\nprint(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n\n#answer for acceptance angle given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "NA=0.15; #numerical aperture\n",
+ "n2=1.55; #refractive index of cladding\n",
+ "n0=1.33; #refractive index of water\n",
+ "\n",
+ "#Calculation\n",
+ "n1=math.sqrt((NA**2)+(n2**2)); #refractive index\n",
+ "n_1=math.ceil(n1*10**5)/10**5; #rounding off to 5 decimals\n",
+ "alpha=math.asin(math.sqrt(n1**2-n2**2)/n0); #acceptance angle in radians\n",
+ "alpha=alpha*57.2957795; #converting radians to degrees\n",
+ "alphaa=math.ceil(alpha*10**3)/10**3; #rounding off to 3 decimals\n",
+ "deg=int(alpha); #converting to degrees\n",
+ "t=60*(alpha-deg); \n",
+ "mi=int(t); #converting to minutes\n",
+ "sec=60*(t-mi); #converting to seconds\n",
+ "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"refractive index of the core is\",n_1);\n",
+ "print(\"the acceptance angle of the fibre in degrees is\",alphaa);\n",
+ "print(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n",
+ "\n",
+ "#answer for acceptance angle given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('refractive index of the core is', 1.55725)\n('the acceptance angle of the fibre in degrees is', 6.476)\n('acceptance angle of the fibre is', 6, 'degrees', 28, 'minutes', 32.55, 'seconds')\n"
+ "text": [
+ "('refractive index of the core is', 1.55725)\n",
+ "('the acceptance angle of the fibre in degrees is', 6.476)\n",
+ "('acceptance angle of the fibre is', 6, 'degrees', 28, 'minutes', 32.55, 'seconds')\n"
+ ]
}
],
"prompt_number": 13
@@ -101,19 +222,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.5, Page number 100"
+ "source": [
+ "Example number 3.5, Page number 100"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the refractive index of cladding\n\n#importing modules\nimport math\n\n#Variable declaration\nNA=0.26; #numerical aperture\nn1=1.5; #refractive index of core\nd=100; #core diameter in micro meter\n\n#Calculation\nd=100*(10**-6); #core diameter in metre\nn2=math.sqrt((n1**2)-(NA**2));\nn2=math.ceil(n2*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"refractive index of the cladding is\",n2);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "NA=0.26; #numerical aperture\n",
+ "n1=1.5; #refractive index of core\n",
+ "d=100; #core diameter in micro meter\n",
+ "\n",
+ "#Calculation\n",
+ "d=100*(10**-6); #core diameter in metre\n",
+ "n2=math.sqrt((n1**2)-(NA**2));\n",
+ "n2=math.ceil(n2*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"refractive index of the cladding is\",n2);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('refractive index of the cladding is', 1.4773)\n"
+ "text": [
+ "('refractive index of the cladding is', 1.4773)\n"
+ ]
}
],
"prompt_number": 16
@@ -122,19 +265,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 3.6, Page number 100"
+ "source": [
+ "Example number 3.6, Page number 100"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the refractive indices of core and cladding\n\n#importing modules\nimport math\n\n#Variable declaration\nNA=0.26; #numerical aperture\ndelta=0.015; #refractive index difference\n\n#Calculation\n#NA=math.sqrt(n1**2-n2**2)\n#let A=n1**2-n2**2\n#therefore A=NA**2\nA=NA**2;\n#delta=(n1**2-n2**2)/2*(n1**2)\n#let 2*(n1**2) be B\n#therefore B=A/delta\nB=A/delta;\nn1=math.sqrt(B/2);\nn1=math.ceil(n1*100)/100; #rounding off to 2 decimals\nn2=math.sqrt(n1**2-NA**2);\nn2=math.ceil(n2*10**3)/10**3; #rounding off to 4 decimals\n\n#Result\nprint(\"refractive index of the core is\",n1);\nprint(\"refractive index of the cladding is\",n2);\n\n#answer for refractive index of cladding given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "NA=0.26; #numerical aperture\n",
+ "delta=0.015; #refractive index difference\n",
+ "\n",
+ "#Calculation\n",
+ "#NA=math.sqrt(n1**2-n2**2)\n",
+ "#let A=n1**2-n2**2\n",
+ "#therefore A=NA**2\n",
+ "A=NA**2;\n",
+ "#delta=(n1**2-n2**2)/2*(n1**2)\n",
+ "#let 2*(n1**2) be B\n",
+ "#therefore B=A/delta\n",
+ "B=A/delta;\n",
+ "n1=math.sqrt(B/2);\n",
+ "n1=math.ceil(n1*100)/100; #rounding off to 2 decimals\n",
+ "n2=math.sqrt(n1**2-NA**2);\n",
+ "n2=math.ceil(n2*10**3)/10**3; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"refractive index of the core is\",n1);\n",
+ "print(\"refractive index of the cladding is\",n2);\n",
+ "\n",
+ "#answer for refractive index of cladding given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('refractive index of the core is', 1.51)\n('refractive index of the cladding is', 1.488)\n"
+ "text": [
+ "('refractive index of the core is', 1.51)\n",
+ "('refractive index of the cladding is', 1.488)\n"
+ ]
}
],
"prompt_number": 19
@@ -142,7 +319,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_4.ipynb b/Engineering_Physics_Marikani/Chapter_4.ipynb
index 02198aef..d2b8123c 100644
--- a/Engineering_Physics_Marikani/Chapter_4.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 4"
+ "name": "",
+ "signature": "sha256:e581747b76e15afc0096179446c0fbd68c3566f21f4931be3d8fc722fc1225b8"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,49 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Quantum Physics"
+ "source": [
+ "Quantum Physics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.1, Page number 133 "
+ "source": [
+ "Example number 4.1, Page number 133 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the change in wavelength\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.63*10**-34; #plancks constant in Js\nm0=9.1*10**-31; #mass of the electron in kg\nc=3*10**8; #velocity of light in m/s\nphi=135; #angle of scattering in degrees\nphi=phi*0.0174532925 #converting degrees to radians \n\n#Calculation\ndelta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n\n#Result\nprint(\"change in wavelength in metres is\",delta_lamda);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.63*10**-34; #plancks constant in Js\n",
+ "m0=9.1*10**-31; #mass of the electron in kg\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "phi=135; #angle of scattering in degrees\n",
+ "phi=phi*0.0174532925 #converting degrees to radians \n",
+ "\n",
+ "#Calculation\n",
+ "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n",
+ "\n",
+ "#Result\n",
+ "print(\"change in wavelength in metres is\",delta_lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('change in wavelength in metres is', 4.1458307496867315e-12)\n"
+ "text": [
+ "('change in wavelength in metres is', 4.1458307496867315e-12)\n"
+ ]
}
],
"prompt_number": 6
@@ -38,19 +63,65 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.2, Page number 134 "
+ "source": [
+ "Example number 4.2, Page number 134 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the compton shift, wavelength,energy and angle\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.63*10**-34; #plancks constant in Js\nm0=9.1*10**-31; #mass of the electron in kg\nc=3*10**8; #velocity of light in m/s\nlamda=2; #wavelength in angstrom\nlamdaA=lamda*10**-10; #converting lamda from Angstrom to m\nphi=90; #angle of scattering in degrees\nphi=phi*0.0174532925 #converting degrees to radians \n\n#Calculation\ndelta_lamda=(h*(1-math.cos(phi)))/(m0*c);\ndelta_lamda=delta_lamda*10**10; #converting delta_lamda from m to Angstrom\ndelta_lamda=math.ceil(delta_lamda*10**5)/10**5; #rounding off to 5 decimals\nlamda_dash=delta_lamda+lamda;\nlamdaA_dash=lamda_dash*10**-10; #converting lamda_dash from Angstrom to m\n#energy E=h*new-h*new_dash\nE=h*c*((1/lamdaA)-(1/lamdaA_dash));\nEeV=E/(1.602176565*10**-19); #converting J to eV\nEeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\nnew=c/lamda;\nnew_dash=c/lamda_dash;\ntheta=math.atan((h*new*math.sin(phi))/((h*new)-(h*new_dash*math.cos(phi))));\ntheta=theta*57.2957795; #converting radians to degrees\n\n#Result\nprint(\"change in compton shift in Angstrom is\",delta_lamda);\nprint(\"wavelength of scattered photons in Angstrom is\",lamda_dash);\nprint(\"energy of recoiling electron in J is\",E);\nprint(\"energy of recoiling electron in eV is\",EeV);\nprint(\"angle at which recoiling electron appears in degrees is\",int(theta));\n\n#answers given in the book are wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.63*10**-34; #plancks constant in Js\n",
+ "m0=9.1*10**-31; #mass of the electron in kg\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "lamda=2; #wavelength in angstrom\n",
+ "lamdaA=lamda*10**-10; #converting lamda from Angstrom to m\n",
+ "phi=90; #angle of scattering in degrees\n",
+ "phi=phi*0.0174532925 #converting degrees to radians \n",
+ "\n",
+ "#Calculation\n",
+ "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n",
+ "delta_lamda=delta_lamda*10**10; #converting delta_lamda from m to Angstrom\n",
+ "delta_lamda=math.ceil(delta_lamda*10**5)/10**5; #rounding off to 5 decimals\n",
+ "lamda_dash=delta_lamda+lamda;\n",
+ "lamdaA_dash=lamda_dash*10**-10; #converting lamda_dash from Angstrom to m\n",
+ "#energy E=h*new-h*new_dash\n",
+ "E=h*c*((1/lamdaA)-(1/lamdaA_dash));\n",
+ "EeV=E/(1.602176565*10**-19); #converting J to eV\n",
+ "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n",
+ "new=c/lamda;\n",
+ "new_dash=c/lamda_dash;\n",
+ "theta=math.atan((h*new*math.sin(phi))/((h*new)-(h*new_dash*math.cos(phi))));\n",
+ "theta=theta*57.2957795; #converting radians to degrees\n",
+ "\n",
+ "#Result\n",
+ "print(\"change in compton shift in Angstrom is\",delta_lamda);\n",
+ "print(\"wavelength of scattered photons in Angstrom is\",lamda_dash);\n",
+ "print(\"energy of recoiling electron in J is\",E);\n",
+ "print(\"energy of recoiling electron in eV is\",EeV);\n",
+ "print(\"angle at which recoiling electron appears in degrees is\",int(theta));\n",
+ "\n",
+ "#answers given in the book are wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('change in compton shift in Angstrom is', 0.02429)\n('wavelength of scattered photons in Angstrom is', 2.02429)\n('energy of recoiling electron in J is', 1.1933272900621974e-17)\n('energy of recoiling electron in eV is', 74.482)\n('angle at which recoiling electron appears in degrees is', 45)\n"
+ "text": [
+ "('change in compton shift in Angstrom is', 0.02429)\n",
+ "('wavelength of scattered photons in Angstrom is', 2.02429)\n",
+ "('energy of recoiling electron in J is', 1.1933272900621974e-17)\n",
+ "('energy of recoiling electron in eV is', 74.482)\n",
+ "('angle at which recoiling electron appears in degrees is', 45)\n"
+ ]
}
],
"prompt_number": 10
@@ -59,19 +130,55 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.3, Page number 135"
+ "source": [
+ "Example number 4.3, Page number 135"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the compton shift, wavelength of the scattered photon\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nm0=9.1*10**-31; #mass of the electron in kg\nc=3*10**8; #velocity of light in m/s\nphi=60; #angle of scattering in degrees\nphi=phi*0.0174532925; #converting degrees to radians\nE=10**6; #energy of photon in eV\nE=E*1.6*10**-19; #converting eV into J\n\n#Calculation\ndelta_lamda=(h*(1-math.cos(phi)))/(m0*c);\ndelta_lamda=delta_lamda*10**10; #converting metre to angstrom\ndelta_lamda=math.ceil(delta_lamda*10**4)/10**4; #rounding off to 4 decimals\nlamda=(h*c)/E;\nlamdaA=lamda*10**10; #converting metre to angstrom\nlamda_dash=delta_lamda+lamdaA;\nlamda_dash=math.ceil(lamda_dash*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"compton shift in angstrom is\",delta_lamda);\nprint(\"energy of incident photon in m\",lamda);\nprint(\"wavelength of scattered photons in angstrom is\",lamda_dash);\n\n#answer for wavelength of scattered photon given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m0=9.1*10**-31; #mass of the electron in kg\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "phi=60; #angle of scattering in degrees\n",
+ "phi=phi*0.0174532925; #converting degrees to radians\n",
+ "E=10**6; #energy of photon in eV\n",
+ "E=E*1.6*10**-19; #converting eV into J\n",
+ "\n",
+ "#Calculation\n",
+ "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n",
+ "delta_lamda=delta_lamda*10**10; #converting metre to angstrom\n",
+ "delta_lamda=math.ceil(delta_lamda*10**4)/10**4; #rounding off to 4 decimals\n",
+ "lamda=(h*c)/E;\n",
+ "lamdaA=lamda*10**10; #converting metre to angstrom\n",
+ "lamda_dash=delta_lamda+lamdaA;\n",
+ "lamda_dash=math.ceil(lamda_dash*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"compton shift in angstrom is\",delta_lamda);\n",
+ "print(\"energy of incident photon in m\",lamda);\n",
+ "print(\"wavelength of scattered photons in angstrom is\",lamda_dash);\n",
+ "\n",
+ "#answer for wavelength of scattered photon given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('compton shift in angstrom is', 0.0122)\n('energy of incident photon in m', 1.242375e-12)\n('wavelength of scattered photons in angstrom is', 0.025)\n"
+ "text": [
+ "('compton shift in angstrom is', 0.0122)\n",
+ "('energy of incident photon in m', 1.242375e-12)\n",
+ "('wavelength of scattered photons in angstrom is', 0.025)\n"
+ ]
}
],
"prompt_number": 13
@@ -80,19 +187,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.4, Page number 135"
+ "source": [
+ "Example number 4.4, Page number 135"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of photons emitted\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nc=3*10**8; #velocity of light in m/s\nlamda=5893; #wavelength in angstrom\nP=60; #output power in Watt\n\n#Calculation\nlamda=lamda*10**-10; #wavelength in metre\nE=(h*c)/lamda;\nEeV=E/(1.602176565*10**-19); #converting J to eV\nEeV=math.ceil(EeV*10**4)/10**4; #rounding off to 4 decimals\nN=P/E;\n\n#Result\nprint(\"energy of photon in J is\",E);\nprint(\"energy of photon in eV is\",EeV);\nprint(\"number of photons emitted per se cond is\",N);\n\n#answer for energy in eV given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "lamda=5893; #wavelength in angstrom\n",
+ "P=60; #output power in Watt\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=lamda*10**-10; #wavelength in metre\n",
+ "E=(h*c)/lamda;\n",
+ "EeV=E/(1.602176565*10**-19); #converting J to eV\n",
+ "EeV=math.ceil(EeV*10**4)/10**4; #rounding off to 4 decimals\n",
+ "N=P/E;\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy of photon in J is\",E);\n",
+ "print(\"energy of photon in eV is\",EeV);\n",
+ "print(\"number of photons emitted per se cond is\",N);\n",
+ "\n",
+ "#answer for energy in eV given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy of photon in J is', 3.373154590191753e-19)\n('energy of photon in eV is', 2.1054)\n('number of photons emitted per se cond is', 1.7787503773015396e+20)\n"
+ "text": [
+ "('energy of photon in J is', 3.373154590191753e-19)\n",
+ "('energy of photon in eV is', 2.1054)\n",
+ "('number of photons emitted per se cond is', 1.7787503773015396e+20)\n"
+ ]
}
],
"prompt_number": 15
@@ -101,19 +239,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.5, Page number 136"
+ "source": [
+ "Example number 4.5, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the momentum, energy and mass of a photon\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nc=3*10**8; #velocity of light in m/s\nlamda=10; #wavelength in angstrom\n\n#Calculation\nlamda=lamda*10**-10; #wavelength in metre\nE=(h*c)/lamda;\nEeV=E/(1.602176565*10**-19); #converting J to eV\nEeV=EeV*10**-3; #converting eV to keV\nEeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\nP=h/lamda;\nM=h/(lamda*c);\n\n#Result\nprint(\"energy of photon in J is\",E);\nprint(\"energy of photon in keV is\",EeV);\nprint(\"momentum in kg m/sec is\",P);\nprint(\"mass of photon in kg is\",M);\n\n#answer for energy of photon in keV given in the book is wrong by 1 decimal",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "lamda=10; #wavelength in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=lamda*10**-10; #wavelength in metre\n",
+ "E=(h*c)/lamda;\n",
+ "EeV=E/(1.602176565*10**-19); #converting J to eV\n",
+ "EeV=EeV*10**-3; #converting eV to keV\n",
+ "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n",
+ "P=h/lamda;\n",
+ "M=h/(lamda*c);\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy of photon in J is\",E);\n",
+ "print(\"energy of photon in keV is\",EeV);\n",
+ "print(\"momentum in kg m/sec is\",P);\n",
+ "print(\"mass of photon in kg is\",M);\n",
+ "\n",
+ "#answer for energy of photon in keV given in the book is wrong by 1 decimal"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy of photon in J is', 1.9878e-16)\n('energy of photon in keV is', 1.241)\n('momentum in kg m/sec is', 6.626e-25)\n('mass of photon in kg is', 2.2086666666666664e-33)\n"
+ "text": [
+ "('energy of photon in J is', 1.9878e-16)\n",
+ "('energy of photon in keV is', 1.241)\n",
+ "('momentum in kg m/sec is', 6.626e-25)\n",
+ "('mass of photon in kg is', 2.2086666666666664e-33)\n"
+ ]
}
],
"prompt_number": 18
@@ -122,19 +294,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.6, Page number 136"
+ "source": [
+ "Example number 4.6, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the wavelength\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\ne=1.602*10**-19;\nV=1.25; #potential difference in kV\n\n#Calculation\nV=V*10**3; #converting kV to V\nlamda=h/math.sqrt(2*m*e*V);\nlamda=lamda*10**10; #converting metre to angstrom\nlamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"de Broglie wavelength in angstrom is\",lamda);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "e=1.602*10**-19;\n",
+ "V=1.25; #potential difference in kV\n",
+ "\n",
+ "#Calculation\n",
+ "V=V*10**3; #converting kV to V\n",
+ "lamda=h/math.sqrt(2*m*e*V);\n",
+ "lamda=lamda*10**10; #converting metre to angstrom\n",
+ "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"de Broglie wavelength in angstrom is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('de Broglie wavelength in angstrom is', 0.3471)\n"
+ "text": [
+ "('de Broglie wavelength in angstrom is', 0.3471)\n"
+ ]
}
],
"prompt_number": 21
@@ -143,19 +339,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.7, Page number 136"
+ "source": [
+ "Example number 4.7, Page number 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the de Broglie wavelength\n\n#importing modules\nimport math\n\n#Variable declaration\nE=45; #energy of electron in eV\nE=E*1.6*10**-19; #energy in J\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\n\n#Calculation\nlamda=h/math.sqrt(2*m*E);\nlamda=lamda*10**10; #converting metres to angstrom\nlamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"de Broglie wavelength in angstrom is\",lamda);",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "E=45; #energy of electron in eV\n",
+ "E=E*1.6*10**-19; #energy in J\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=h/math.sqrt(2*m*E);\n",
+ "lamda=lamda*10**10; #converting metres to angstrom\n",
+ "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"de Broglie wavelength in angstrom is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('de Broglie wavelength in angstrom is', 1.8305)\n"
+ "text": [
+ "('de Broglie wavelength in angstrom is', 1.8305)\n"
+ ]
}
],
"prompt_number": 24
@@ -164,19 +381,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.8, Page number 137"
+ "source": [
+ "Example number 4.8, Page number 137"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the de Broglie wavelength\n\n#importing modules\nimport math\n\n#Variable declaration\nv=10**7; #velocity of electron in m/sec\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\n\n#Calculation\nlamda=h/(m*v);\nlamda=lamda*10**10; #converting metres to angstrom\nlamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"de Broglie wavelength in angstrom is\",lamda);",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "v=10**7; #velocity of electron in m/sec\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=h/(m*v);\n",
+ "lamda=lamda*10**10; #converting metres to angstrom\n",
+ "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"de Broglie wavelength in angstrom is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('de Broglie wavelength in angstrom is', 0.7282)\n"
+ "text": [
+ "('de Broglie wavelength in angstrom is', 0.7282)\n"
+ ]
}
],
"prompt_number": 25
@@ -185,19 +423,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.9, Page number 137"
+ "source": [
+ "Example number 4.9, Page number 137"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the de Broglie wavelength of alpha particle\n\n#importing modules\nimport math\n\n#Variable declaration\nV=1000; #potential difference in V\nh=6.626*10**-34; #plancks constant in Js\nm=1.67*10**-27; #mass of proton in kg\ne=1.6*10**-19; #charge of electron in J\n\n#Calculation\nlamda=h/math.sqrt(2*m*e*V);\n\n#Result\nprint(\"de Broglie wavelength of alpha particle in metre is\",lamda);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "V=1000; #potential difference in V\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=1.67*10**-27; #mass of proton in kg\n",
+ "e=1.6*10**-19; #charge of electron in J\n",
+ "\n",
+ "#Calculation\n",
+ "lamda=h/math.sqrt(2*m*e*V);\n",
+ "\n",
+ "#Result\n",
+ "print(\"de Broglie wavelength of alpha particle in metre is\",lamda);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('de Broglie wavelength of alpha particle in metre is', 9.063964727801313e-13)\n"
+ "text": [
+ "('de Broglie wavelength of alpha particle in metre is', 9.063964727801313e-13)\n"
+ ]
}
],
"prompt_number": 26
@@ -206,19 +465,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.10, Page number 138"
+ "source": [
+ "Example number 4.10, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the probability of finding the particle\n\n#importing modules\nimport math\n\n#Variable declaration\nL=25; #width of potential in armstrong\ndelta_x=0.05; #interval in armstrong\nn=1; #particle is in its least energy\nx=L/2; #particle is at the centre\npi=180; #angle in degrees\n\n#Calculation\npi=pi*0.0174532925; #angle in radians\nL=L*10**-10; #width in m\ndelta_x=delta_x*10**-10; #interval in m\n#probability P = integration of (A**2)*(math.sin(n*pi*x/L))**2*delta_x\n#but A=math.sqrt(2/L)\n#since the particle is in a small interval integration need not be applied\n#therefore P=2*(L**(-1))*(math.sin(n*pi*x/L))**2*delta_x\nP=2*(L**(-1))*((math.sin(n*pi*x/L))**2)*delta_x;\nP=math.ceil(P*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"probability of finding the particle is\",P);",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "L=25; #width of potential in armstrong\n",
+ "delta_x=0.05; #interval in armstrong\n",
+ "n=1; #particle is in its least energy\n",
+ "x=L/2; #particle is at the centre\n",
+ "pi=180; #angle in degrees\n",
+ "\n",
+ "#Calculation\n",
+ "pi=pi*0.0174532925; #angle in radians\n",
+ "L=L*10**-10; #width in m\n",
+ "delta_x=delta_x*10**-10; #interval in m\n",
+ "#probability P = integration of (A**2)*(math.sin(n*pi*x/L))**2*delta_x\n",
+ "#but A=math.sqrt(2/L)\n",
+ "#since the particle is in a small interval integration need not be applied\n",
+ "#therefore P=2*(L**(-1))*(math.sin(n*pi*x/L))**2*delta_x\n",
+ "P=2*(L**(-1))*((math.sin(n*pi*x/L))**2)*delta_x;\n",
+ "P=math.ceil(P*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"probability of finding the particle is\",P);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('probability of finding the particle is', 0.004)\n"
+ "text": [
+ "('probability of finding the particle is', 0.004)\n"
+ ]
}
],
"prompt_number": 27
@@ -227,19 +515,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.11, Page number 138"
+ "source": [
+ "Example number 4.11, Page number 138"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lowest energy of electron in eV\n\n#importing modules\nimport math\n\n#Variable declaration\nn=1;\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\nL=1; #width of potential well in angstrom\n\n#Calculation\nL=L*10**-10; #converting angstrom into metre\nE=((n**2)*h**2)/(8*m*L**2);\nEeV=E/(1.6*10**-19); #converting J to eV\nEeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"lowest energy of electron in J is\",E);\nprint(\"lowest energy of electron in eV is\",EeV);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=1;\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "L=1; #width of potential well in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-10; #converting angstrom into metre\n",
+ "E=((n**2)*h**2)/(8*m*L**2);\n",
+ "EeV=E/(1.6*10**-19); #converting J to eV\n",
+ "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lowest energy of electron in J is\",E);\n",
+ "print(\"lowest energy of electron in eV is\",EeV);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lowest energy of electron in J is', 6.030752197802197e-18)\n('lowest energy of electron in eV is', 37.693)\n"
+ "text": [
+ "('lowest energy of electron in J is', 6.030752197802197e-18)\n",
+ "('lowest energy of electron in eV is', 37.693)\n"
+ ]
}
],
"prompt_number": 28
@@ -248,19 +562,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.12, Page number 139"
+ "source": [
+ "Example number 4.12, Page number 139"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lowest energy of the system\n\n#importing modules\nimport math\n\n#Variable declaration\nn=1;\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\nL=1; #width of potential well in angstrom\n\n#Calculation\nL=L*10**-10; #converting angstrom into metre\nE=(2*(n**2)*h**2)/(8*m*L**2);\nE=E/(1.6*10**-19); #converting J to eV\nE=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"lowest energy of system in eV is\",E);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=1;\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "L=1; #width of potential well in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-10; #converting angstrom into metre\n",
+ "E=(2*(n**2)*h**2)/(8*m*L**2);\n",
+ "E=E/(1.6*10**-19); #converting J to eV\n",
+ "E=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lowest energy of system in eV is\",E);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lowest energy of system in eV is', 75.385)\n"
+ "text": [
+ "('lowest energy of system in eV is', 75.385)\n"
+ ]
}
],
"prompt_number": 29
@@ -269,19 +607,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.13, Page number 139"
+ "source": [
+ "Example number 4.13, Page number 139"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lowest energy of the system and quantum numbers\n\n#importing modules\nimport math\n\n#Variable declaration\nh=6.626*10**-34; #plancks constant in Js\nm=9.1*10**-31; #mass of the electron in kg\nL=1; #width of potential well in angstrom\n\n#Calculation\nL=L*10**-10; #converting angstrom into metre\n#according to pauli's exclusion principle, 1st electron occupies n1=1 and second electron occupies n2=2\nn1=1;\nn2=2;\nE=((2*(n1**2)*h**2)/(8*m*L**2))+(((n2**2)*h**2)/(8*m*L**2));\nE=E/(1.6*10**-19); #converting J to eV\nE=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"lowest energy of system in eV is\",E);\nprint(\"quantum numbers are\");\nprint(\"n=1,l=0,mL=0,mS=+1/2\");\nprint(\"n=1,l=0,mL=0,mS=-1/2\");\nprint(\"n=2,l=0,mL=0,mS=+1/2\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "L=1; #width of potential well in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-10; #converting angstrom into metre\n",
+ "#according to pauli's exclusion principle, 1st electron occupies n1=1 and second electron occupies n2=2\n",
+ "n1=1;\n",
+ "n2=2;\n",
+ "E=((2*(n1**2)*h**2)/(8*m*L**2))+(((n2**2)*h**2)/(8*m*L**2));\n",
+ "E=E/(1.6*10**-19); #converting J to eV\n",
+ "E=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lowest energy of system in eV is\",E);\n",
+ "print(\"quantum numbers are\");\n",
+ "print(\"n=1,l=0,mL=0,mS=+1/2\");\n",
+ "print(\"n=1,l=0,mL=0,mS=-1/2\");\n",
+ "print(\"n=2,l=0,mL=0,mS=+1/2\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lowest energy of system in eV is', 226.154)\nquantum numbers are\nn=1,l=0,mL=0,mS=+1/2\nn=1,l=0,mL=0,mS=-1/2\nn=2,l=0,mL=0,mS=+1/2\n"
+ "text": [
+ "('lowest energy of system in eV is', 226.154)\n",
+ "quantum numbers are\n",
+ "n=1,l=0,mL=0,mS=+1/2\n",
+ "n=1,l=0,mL=0,mS=-1/2\n",
+ "n=2,l=0,mL=0,mS=+1/2\n"
+ ]
}
],
"prompt_number": 30
@@ -290,19 +662,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.14, Page number 140"
+ "source": [
+ "Example number 4.14, Page number 140"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mass of the particle\n\n#Variable declaration\nn=1;\nh=6.626*10**-34; #plancks constant in Js\nL=100; #width of potential well in angstrom\n\n#Calculation\nL=L*10**-10; #converting angstrom into metre\nE=0.025; #lowest energy in eV\nE=E*(1.6*10**-19); #converting eV to J\nm=((n**2)*h**2)/(8*E*L**2);\n\n#Result\nprint(\"mass of the particle in kg is\",m);",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "n=1;\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "L=100; #width of potential well in angstrom\n",
+ "\n",
+ "#Calculation\n",
+ "L=L*10**-10; #converting angstrom into metre\n",
+ "E=0.025; #lowest energy in eV\n",
+ "E=E*(1.6*10**-19); #converting eV to J\n",
+ "m=((n**2)*h**2)/(8*E*L**2);\n",
+ "\n",
+ "#Result\n",
+ "print(\"mass of the particle in kg is\",m);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('mass of the particle in kg is', 1.3719961249999998e-31)\n"
+ "text": [
+ "('mass of the particle in kg is', 1.3719961249999998e-31)\n"
+ ]
}
],
"prompt_number": 31
@@ -311,19 +702,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 4.15, Page number 141"
+ "source": [
+ "Example number 4.15, Page number 141"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy density\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nT=6000; #temperature in K\nh=6.626*10**-34; #plancks constant in Js\nc=3*10**8; #velocity of light in m/s\nlamda1=450; #wavelength in nm\nlamda2=460; #wavelength in nm\n\n#Calculation\nlamda1=lamda1*10**-9; #converting nm to metre\nlamda2=lamda2*10**-9; #converting nm to metre\nnew1=c/lamda1;\nnew2=c/lamda2;\nnew=(new1+new2)/2;\nA=math.exp((h*new)/(k*T));\nrho_v=(8*math.pi*h*new**3)/(A*c**3);\n\n#Result\nprint(\"energy density of the black body in J/m^3 is\",rho_v);\n\n#answer given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k=1.38*10**-23;\n",
+ "T=6000; #temperature in K\n",
+ "h=6.626*10**-34; #plancks constant in Js\n",
+ "c=3*10**8; #velocity of light in m/s\n",
+ "lamda1=450; #wavelength in nm\n",
+ "lamda2=460; #wavelength in nm\n",
+ "\n",
+ "#Calculation\n",
+ "lamda1=lamda1*10**-9; #converting nm to metre\n",
+ "lamda2=lamda2*10**-9; #converting nm to metre\n",
+ "new1=c/lamda1;\n",
+ "new2=c/lamda2;\n",
+ "new=(new1+new2)/2;\n",
+ "A=math.exp((h*new)/(k*T));\n",
+ "rho_v=(8*math.pi*h*new**3)/(A*c**3);\n",
+ "\n",
+ "#Result\n",
+ "print(\"energy density of the black body in J/m^3 is\",rho_v);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('energy density of the black body in J/m^3 is', 9.033622836188887e-16)\n"
+ "text": [
+ "('energy density of the black body in J/m^3 is', 9.033622836188887e-16)\n"
+ ]
}
],
"prompt_number": 32
@@ -331,7 +753,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_6.ipynb b/Engineering_Physics_Marikani/Chapter_6.ipynb
index 1445b978..637c4652 100644
--- a/Engineering_Physics_Marikani/Chapter_6.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 6"
+ "name": "",
+ "signature": "sha256:97390494eb98d975fe0c29b984e91803cff6529592b1c9d0fc798d125a0d2ea9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,54 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Crystallography"
+ "source": [
+ "Crystallography"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.1, Page number 185"
+ "source": [
+ "Example number 6.1, Page number 185"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the density of diamond\n\n#importing modules\nimport math\n\n#Variable declaration\nr=0.071; #radius in nm\nN=6.022*10**26; \n\n#Calculation\nr=r*10**-9; #converting r from nm to m\n#mass of carbon atom m = 12/N\nm=12/N;\n#mass of diamond M = 8*mass of one carbon atom\nM=8*m;\n#volume of diamond V = (8*r/sqrt(3))^3\nV=(8*r/math.sqrt(3))**3;\nd=M/V; #density in kg/m^3\nd=math.ceil(d*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"density of diamond in kg/m^3 is\",d);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "r=0.071; #radius in nm\n",
+ "N=6.022*10**26; \n",
+ "\n",
+ "#Calculation\n",
+ "r=r*10**-9; #converting r from nm to m\n",
+ "#mass of carbon atom m = 12/N\n",
+ "m=12/N;\n",
+ "#mass of diamond M = 8*mass of one carbon atom\n",
+ "M=8*m;\n",
+ "#volume of diamond V = (8*r/sqrt(3))^3\n",
+ "V=(8*r/math.sqrt(3))**3;\n",
+ "d=M/V; #density in kg/m^3\n",
+ "d=math.ceil(d*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"density of diamond in kg/m^3 is\",d);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('density of diamond in kg/m^3 is', 4520.31)\n"
+ "text": [
+ "('density of diamond in kg/m^3 is', 4520.31)\n"
+ ]
}
],
"prompt_number": 3
@@ -38,19 +68,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.2, Page number 185"
+ "source": [
+ "Example number 6.2, Page number 185"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the percentage volume change\n\n#importing modules\nimport math\n\n#Variable declaration\naBCC=0.332; #lattice constant in nm\naHCP=0.296; #lattice constant in nm\nc=0.468; #c in nm\n\n#Calculation\naBCC=aBCC*10**-9; #converting nm to m\nVbcc=aBCC**3;\naHCP=aHCP*10**-9; #converting nm to m\nc=c*10**-9; #converting nm to m\nVhcp=6*(math.sqrt(3)/4)*aHCP**2*c;\nV=Vhcp-Vbcc;\nVch=(V*100)/Vbcc;\nVch=math.ceil(Vch*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"percentage change in volume is\",Vch);\n\n#answer given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "aBCC=0.332; #lattice constant in nm\n",
+ "aHCP=0.296; #lattice constant in nm\n",
+ "c=0.468; #c in nm\n",
+ "\n",
+ "#Calculation\n",
+ "aBCC=aBCC*10**-9; #converting nm to m\n",
+ "Vbcc=aBCC**3;\n",
+ "aHCP=aHCP*10**-9; #converting nm to m\n",
+ "c=c*10**-9; #converting nm to m\n",
+ "Vhcp=6*(math.sqrt(3)/4)*aHCP**2*c;\n",
+ "V=Vhcp-Vbcc;\n",
+ "Vch=(V*100)/Vbcc;\n",
+ "Vch=math.ceil(Vch*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"percentage change in volume is\",Vch);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('percentage change in volume is', 191.12)\n"
+ "text": [
+ "('percentage change in volume is', 191.12)\n"
+ ]
}
],
"prompt_number": 4
@@ -59,19 +118,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.3, Page number 186"
+ "source": [
+ "Example number 6.3, Page number 186"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the density\n\n#importing modules\nimport math\n\n#Variable declaration\nr=1.278; #atomic radius of Cu in Angstrom\nA=63.54; #atomic weight of Cu\nn=4; #for FCC n=4\nNa=6.022*10**26;\n\n#Calculation\nr=r*10**-10; #converting atomic radius from Angstrom to m\na=2*math.sqrt(2)*r; \nrho=(n*A)/(Na*a**3);\nrho=math.ceil(rho*100)/100; #rounding off to 2 decimals\n\n#Result\nprint(\"density of Cu in kg/m^3 is\",rho);\n\n#answer given in the book is wrong",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "r=1.278; #atomic radius of Cu in Angstrom\n",
+ "A=63.54; #atomic weight of Cu\n",
+ "n=4; #for FCC n=4\n",
+ "Na=6.022*10**26;\n",
+ "\n",
+ "#Calculation\n",
+ "r=r*10**-10; #converting atomic radius from Angstrom to m\n",
+ "a=2*math.sqrt(2)*r; \n",
+ "rho=(n*A)/(Na*a**3);\n",
+ "rho=math.ceil(rho*100)/100; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"density of Cu in kg/m^3 is\",rho);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('density of Cu in kg/m^3 is', 8935.92)\n"
+ "text": [
+ "('density of Cu in kg/m^3 is', 8935.92)\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +164,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.4, Page number 186"
+ "source": [
+ "Example number 6.4, Page number 186"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the distance between adjacent atoms\n\n#importing modules\nimport math\nimport numpy as np\n\n#Variable declaration\nrho=2180; #density of NaCl in kg/m^3\nwNa=23; #atomic weight of Na\nwCl=35.5; #atomic weight of Cl\nn=4; #for FCC n=4\nNa=6.022*10**26;\n\n#Calculation\nA=wNa+wCl; #molecular weight of NaCl\nx=np.reciprocal(3.);\na=((n*A)/(Na*rho))**x;\n\n#Result\nprint(\"interatomic distance in NaCl in m is\",a); \n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho=2180; #density of NaCl in kg/m^3\n",
+ "wNa=23; #atomic weight of Na\n",
+ "wCl=35.5; #atomic weight of Cl\n",
+ "n=4; #for FCC n=4\n",
+ "Na=6.022*10**26;\n",
+ "\n",
+ "#Calculation\n",
+ "A=wNa+wCl; #molecular weight of NaCl\n",
+ "x=np.reciprocal(3.);\n",
+ "a=((n*A)/(Na*rho))**x;\n",
+ "\n",
+ "#Result\n",
+ "print(\"interatomic distance in NaCl in m is\",a); \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('interatomic distance in NaCl in m is', 5.6278114346454509e-10)\n"
+ "text": [
+ "('interatomic distance in NaCl in m is', 5.6278114346454509e-10)\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +210,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.5, Page number 187"
+ "source": [
+ "Example number 6.5, Page number 187"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the interplanar spacing\n\n#importing modules\nimport math\n\n#Variable declaration\na=0.42; #lattice constant in nm\nh1=1;\nk1=0;\nl1=1; #indices of the plane (101)\nh2=2;\nk2=2;\nl2=1; #indices of the plane (221)\n\n#Calculation\na=a*10**-9; #converting from nm to m\nd1=a/math.sqrt((h1**2)+(k1**2)+(l1**2)); #interplanar spacing for plane (101)\nd1=d1*10**9; #converting from m to nm\nd1=math.ceil(d1*10**5)/10**5; #rounding off to 5 decimals\nd2=a/math.sqrt((h2**2)+(k2**2)+(l2**2)); #interplanar spacing for plane (221)\nd2=d2*10**9; #converting from m to nm\n\n#Result\nprint(\"interplanar spacing for (101) in nm is\",d1);\nprint(\"interplanar spacing for (221) in nm is\",d2);\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=0.42; #lattice constant in nm\n",
+ "h1=1;\n",
+ "k1=0;\n",
+ "l1=1; #indices of the plane (101)\n",
+ "h2=2;\n",
+ "k2=2;\n",
+ "l2=1; #indices of the plane (221)\n",
+ "\n",
+ "#Calculation\n",
+ "a=a*10**-9; #converting from nm to m\n",
+ "d1=a/math.sqrt((h1**2)+(k1**2)+(l1**2)); #interplanar spacing for plane (101)\n",
+ "d1=d1*10**9; #converting from m to nm\n",
+ "d1=math.ceil(d1*10**5)/10**5; #rounding off to 5 decimals\n",
+ "d2=a/math.sqrt((h2**2)+(k2**2)+(l2**2)); #interplanar spacing for plane (221)\n",
+ "d2=d2*10**9; #converting from m to nm\n",
+ "\n",
+ "#Result\n",
+ "print(\"interplanar spacing for (101) in nm is\",d1);\n",
+ "print(\"interplanar spacing for (221) in nm is\",d2);\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('interplanar spacing for (101) in nm is', 0.29699)\n('interplanar spacing for (221) in nm is', 0.14)\n"
+ "text": [
+ "('interplanar spacing for (101) in nm is', 0.29699)\n",
+ "('interplanar spacing for (221) in nm is', 0.14)\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +263,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.6, Page number 187"
+ "source": [
+ "Example number 6.6, Page number 187"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To identify the axial intercepts\n\n#Variable declaration\nh1=1;\nk1=0;\nl1=2; #indices for plane (102)\nh2=2;\nk2=3;\nl2=1; #indices for plane (231)\nh3=3;\nk3=-1;\nl3=2; #indices for plane (31'2)\n\n#Calculation\n#intercepts made by the plane is a/h, b/k, c/l\n#for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n#for plane (231) intercepts are a/2, b/3, c/1=c\n#for plane (31'2) intercepts are a/3=a, b/-1=-b, c/2\n\n#Result\nprint(\"for plane (102) intercepts are a/1=a, b/0=infinite, c/2\");\nprint(\"for plane (231) intercepts are a/2, b/3, c/1=c\");\nprint(\"for plane (312) intercepts are a/3=a, b/-1=-b, c/2\");\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "h1=1;\n",
+ "k1=0;\n",
+ "l1=2; #indices for plane (102)\n",
+ "h2=2;\n",
+ "k2=3;\n",
+ "l2=1; #indices for plane (231)\n",
+ "h3=3;\n",
+ "k3=-1;\n",
+ "l3=2; #indices for plane (31'2)\n",
+ "\n",
+ "#Calculation\n",
+ "#intercepts made by the plane is a/h, b/k, c/l\n",
+ "#for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n",
+ "#for plane (231) intercepts are a/2, b/3, c/1=c\n",
+ "#for plane (31'2) intercepts are a/3=a, b/-1=-b, c/2\n",
+ "\n",
+ "#Result\n",
+ "print(\"for plane (102) intercepts are a/1=a, b/0=infinite, c/2\");\n",
+ "print(\"for plane (231) intercepts are a/2, b/3, c/1=c\");\n",
+ "print(\"for plane (312) intercepts are a/3=a, b/-1=-b, c/2\");\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "for plane (102) intercepts are a/1=a, b/0=infinite, c/2\nfor plane (231) intercepts are a/2, b/3, c/1=c\nfor plane (312) intercepts are a/3=a, b/-1=-b, c/2\n"
+ "text": [
+ "for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n",
+ "for plane (231) intercepts are a/2, b/3, c/1=c\n",
+ "for plane (312) intercepts are a/3=a, b/-1=-b, c/2\n"
+ ]
}
],
"prompt_number": 10
@@ -143,19 +314,58 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.7, Page number 188"
+ "source": [
+ "Example number 6.7, Page number 188"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the angle between 2 planes\n\n#importing modules\nimport math\n\n#Variable declaration\nu1=1;\nv1=1;\nw1=1; #indices for plane (111)\nu2=2;\nv2=1;\nw2=2; #indices for plane (212)\n\n#Calculation\nA=u1*u2+v1*v2+w1*w2; \nB1=math.sqrt((u1**2)+(v1**2)+(w1**2));\nB2=math.sqrt((u2**2)+(v2**2)+(w2**2));\nB=A/(B1*B2);\nB=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\ntheta=math.acos(B); #angle in radian\ntheta=theta*57.2957795; #converting radian to degrees\ntheeta=math.ceil(theta*10**3)/10**3; #rounding off to 3 decimals\ndeg=int(theta); #converting to degrees\nt=60*(theta-deg);\nmi=int(t); #converting to minutes\nsec=60*(t-mi); #converting to seconds\nsec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"angle between the planes in degrees is\",theeta);\nprint(\"angle between the planes is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n\n#answer given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "u1=1;\n",
+ "v1=1;\n",
+ "w1=1; #indices for plane (111)\n",
+ "u2=2;\n",
+ "v2=1;\n",
+ "w2=2; #indices for plane (212)\n",
+ "\n",
+ "#Calculation\n",
+ "A=u1*u2+v1*v2+w1*w2; \n",
+ "B1=math.sqrt((u1**2)+(v1**2)+(w1**2));\n",
+ "B2=math.sqrt((u2**2)+(v2**2)+(w2**2));\n",
+ "B=A/(B1*B2);\n",
+ "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n",
+ "theta=math.acos(B); #angle in radian\n",
+ "theta=theta*57.2957795; #converting radian to degrees\n",
+ "theeta=math.ceil(theta*10**3)/10**3; #rounding off to 3 decimals\n",
+ "deg=int(theta); #converting to degrees\n",
+ "t=60*(theta-deg);\n",
+ "mi=int(t); #converting to minutes\n",
+ "sec=60*(t-mi); #converting to seconds\n",
+ "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"angle between the planes in degrees is\",theeta);\n",
+ "print(\"angle between the planes is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('angle between the planes in degrees is', 15.783)\n('angle between the planes is', 15, 'degrees', 46, 'minutes', 57.85, 'seconds')\n"
+ "text": [
+ "('angle between the planes in degrees is', 15.783)\n",
+ "('angle between the planes is', 15, 'degrees', 46, 'minutes', 57.85, 'seconds')\n"
+ ]
}
],
"prompt_number": 13
@@ -164,12 +374,14 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.8, Page number 188"
+ "source": [
+ "Example number 6.8, Page number 188"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#sketching the crystallographic planes",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": [],
@@ -179,19 +391,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.9, Page number 189"
+ "source": [
+ "Example number 6.9, Page number 189"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the lattice constant\n\n#importing modules\nimport math\n\n#Variable declaration\nd=0.2338; #interplanar distance in nm\nh=-1;\nk=1;\nl=1; #indices of the plane (1'11)\n\n#Calculation\nd=d*10**-9; #converting from nm to m\na=d*math.sqrt((h**2)+(k**2)+(l**2));\na=a*10**9; #converting lattice constant from m to nm\na=math.ceil(a*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"lattice constant in nm is\",a);\n\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=0.2338; #interplanar distance in nm\n",
+ "h=-1;\n",
+ "k=1;\n",
+ "l=1; #indices of the plane (1'11)\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**-9; #converting from nm to m\n",
+ "a=d*math.sqrt((h**2)+(k**2)+(l**2));\n",
+ "a=a*10**9; #converting lattice constant from m to nm\n",
+ "a=math.ceil(a*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"lattice constant in nm is\",a);\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lattice constant in nm is', 0.40496)\n"
+ "text": [
+ "('lattice constant in nm is', 0.40496)\n"
+ ]
}
],
"prompt_number": 15
@@ -200,19 +436,64 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.10, Page number 189"
+ "source": [
+ "Example number 6.10, Page number 189"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To show that for a simple cubic system d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n\n#importing modules\nimport math\n\n#variable declaration\nh1=1;\nk1=0;\nl1=0; #indices for plane (100)\nh2=1;\nk2=1;\nl2=0; #indices for plane (110)\nh3=1;\nk3=1;\nl3=1; #indices for plane (111)\n\n#Calculation\n#d=a/math.sqrt((h**2)+(k**2)+(l**2))\n#d100=a/math.sqrt((h1**2)+(k1**2)+(l1**2))\nx1=math.sqrt((h1**2)+(k1**2)+(l1**2));\n#d100=a/x1 = a/1 = a\n#d110=a/math.sqrt((h2**2)+(k2**2)+(l2**2))\nx2=math.sqrt((h2**2)+(k2**2)+(l2**2));\nx2=math.ceil(x2*10**4)/10**4; #rounding off to 4 decimals\n#d110=a/x2 = a/sqrt(2)\n#d111=a/math.sqrt((h3**2)+(k3**2)+(l3**2))\nx3=math.sqrt((h3**2)+(k3**2)+(l3**2));\nx3=math.ceil(x3*10**4)/10**4; #rounding off to 4 decimals\n#d111=a/x3 = a/sqrt(3)\n#hence d100:d110:d111=a:a/sqrt(2):a/sqrt(3)\n#multiplying RHS by sqrt(6) we get d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n\n#Result\nprint(\"value of x1 is\",x1);\nprint(\"value of x2 is\",x2);\nprint(\"value of x3 is\",x3);\nprint(\"d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "h1=1;\n",
+ "k1=0;\n",
+ "l1=0; #indices for plane (100)\n",
+ "h2=1;\n",
+ "k2=1;\n",
+ "l2=0; #indices for plane (110)\n",
+ "h3=1;\n",
+ "k3=1;\n",
+ "l3=1; #indices for plane (111)\n",
+ "\n",
+ "#Calculation\n",
+ "#d=a/math.sqrt((h**2)+(k**2)+(l**2))\n",
+ "#d100=a/math.sqrt((h1**2)+(k1**2)+(l1**2))\n",
+ "x1=math.sqrt((h1**2)+(k1**2)+(l1**2));\n",
+ "#d100=a/x1 = a/1 = a\n",
+ "#d110=a/math.sqrt((h2**2)+(k2**2)+(l2**2))\n",
+ "x2=math.sqrt((h2**2)+(k2**2)+(l2**2));\n",
+ "x2=math.ceil(x2*10**4)/10**4; #rounding off to 4 decimals\n",
+ "#d110=a/x2 = a/sqrt(2)\n",
+ "#d111=a/math.sqrt((h3**2)+(k3**2)+(l3**2))\n",
+ "x3=math.sqrt((h3**2)+(k3**2)+(l3**2));\n",
+ "x3=math.ceil(x3*10**4)/10**4; #rounding off to 4 decimals\n",
+ "#d111=a/x3 = a/sqrt(3)\n",
+ "#hence d100:d110:d111=a:a/sqrt(2):a/sqrt(3)\n",
+ "#multiplying RHS by sqrt(6) we get d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"value of x1 is\",x1);\n",
+ "print(\"value of x2 is\",x2);\n",
+ "print(\"value of x3 is\",x3);\n",
+ "print(\"d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('value of x1 is', 1.0)\n('value of x2 is', 1.4143)\n('value of x3 is', 1.7321)\nd100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n"
+ "text": [
+ "('value of x1 is', 1.0)\n",
+ "('value of x2 is', 1.4143)\n",
+ "('value of x3 is', 1.7321)\n",
+ "d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n"
+ ]
}
],
"prompt_number": 16
@@ -221,19 +502,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.11, Page number 190"
+ "source": [
+ "Example number 6.11, Page number 190"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the ratio of intercepts in a simple cubic crystal\n\n#variable declaration\nh=2;\nk=3;\nl=1; #indices for plane (231)\n\n#Calculation\n#intercepts made by the plane is a/h, b/k, c/l\n#for a cubic unit cell, a=b=c\n#for plane (231) intercepts are a/2, a/3, a/1 = a\n#ratio of the intercepts is 1/2:1/3:1\n#LCM is 6. multiplying by LCM, we get ratio l1:l2:l3 = 3:2:6\n\n#Result\nprint(\"l1:l2:l3 = 3:2:6\");",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "h=2;\n",
+ "k=3;\n",
+ "l=1; #indices for plane (231)\n",
+ "\n",
+ "#Calculation\n",
+ "#intercepts made by the plane is a/h, b/k, c/l\n",
+ "#for a cubic unit cell, a=b=c\n",
+ "#for plane (231) intercepts are a/2, a/3, a/1 = a\n",
+ "#ratio of the intercepts is 1/2:1/3:1\n",
+ "#LCM is 6. multiplying by LCM, we get ratio l1:l2:l3 = 3:2:6\n",
+ "\n",
+ "#Result\n",
+ "print(\"l1:l2:l3 = 3:2:6\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "l1:l2:l3 = 3:2:6\n"
+ "text": [
+ "l1:l2:l3 = 3:2:6\n"
+ ]
}
],
"prompt_number": 17
@@ -242,19 +544,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.12, Page number 190"
+ "source": [
+ "Example number 6.12, Page number 190"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the lengths of intercepts along Y and Z axes\n\n#variable declaration\nh=1;\nk=2;\nl=3; #indices for plane (123)\nl1=0.8; #l1 in armstrong\na=0.8; #a in armstrong\nb=1.2; #b in armstrong\nc=1.5; #c in armstrong\n\n#Calculation\n#intercepts made by the plane is a/h, b/k, c/l\n#for plane (123) intercepts are a/1 = a, b/2, c/3\n#ratio of the intercepts l1:l2:l3 = a:b/2:c/3\n#thus 0.8:l2:l3 = 0.8:1.2/2:1.5/3\nl2=1.2/2; #l2 in armstrong\nl3=1.5/3; #l3 in armstrong\n\n#Result\nprint(\"value of l2 in armstrong is\",l2);\nprint(\"value of l3 in armstrong is\",l3);",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "h=1;\n",
+ "k=2;\n",
+ "l=3; #indices for plane (123)\n",
+ "l1=0.8; #l1 in armstrong\n",
+ "a=0.8; #a in armstrong\n",
+ "b=1.2; #b in armstrong\n",
+ "c=1.5; #c in armstrong\n",
+ "\n",
+ "#Calculation\n",
+ "#intercepts made by the plane is a/h, b/k, c/l\n",
+ "#for plane (123) intercepts are a/1 = a, b/2, c/3\n",
+ "#ratio of the intercepts l1:l2:l3 = a:b/2:c/3\n",
+ "#thus 0.8:l2:l3 = 0.8:1.2/2:1.5/3\n",
+ "l2=1.2/2; #l2 in armstrong\n",
+ "l3=1.5/3; #l3 in armstrong\n",
+ "\n",
+ "#Result\n",
+ "print(\"value of l2 in armstrong is\",l2);\n",
+ "print(\"value of l3 in armstrong is\",l3);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('value of l2 in armstrong is', 0.6)\n('value of l3 in armstrong is', 0.5)\n"
+ "text": [
+ "('value of l2 in armstrong is', 0.6)\n",
+ "('value of l3 in armstrong is', 0.5)\n"
+ ]
}
],
"prompt_number": 18
@@ -263,19 +593,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.13, Page number 191"
+ "source": [
+ "Example number 6.13, Page number 191"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the nearest neighbour distance\n\n#Calculation\n#in simple cubic unit cell, corner atom is the nearest neighbour to another corner atom. \n#Hence nearest neighbour distance is a.\n#in BCC the body centered atom is the nearest neighbour to a corner atom.\n#the distance between body centered atom and corner atom is 2r\n#but r=sqrt(3)*a/4\n#distance = 2*sqrt(3)*a/4 = sqrt(3)*a/2\n#in FCC the face centered atom is the nearest neighbour to a corner atom.\n#the distance between face centered atom and corner atom is 2r\n#but r = a/sqrt(8)\n#distance = 2*a/sqrt(8) = a/sqrt(2)\n\n#Result\nprint(\"in simple cubic unit cell nearest neighbour distance is a\");\nprint(\"in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\");\nprint(\"in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\");",
+ "input": [
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "#in simple cubic unit cell, corner atom is the nearest neighbour to another corner atom. \n",
+ "#Hence nearest neighbour distance is a.\n",
+ "#in BCC the body centered atom is the nearest neighbour to a corner atom.\n",
+ "#the distance between body centered atom and corner atom is 2r\n",
+ "#but r=sqrt(3)*a/4\n",
+ "#distance = 2*sqrt(3)*a/4 = sqrt(3)*a/2\n",
+ "#in FCC the face centered atom is the nearest neighbour to a corner atom.\n",
+ "#the distance between face centered atom and corner atom is 2r\n",
+ "#but r = a/sqrt(8)\n",
+ "#distance = 2*a/sqrt(8) = a/sqrt(2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"in simple cubic unit cell nearest neighbour distance is a\");\n",
+ "print(\"in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\");\n",
+ "print(\"in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "in simple cubic unit cell nearest neighbour distance is a\nin body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\nin face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\n"
+ "text": [
+ "in simple cubic unit cell nearest neighbour distance is a\n",
+ "in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\n",
+ "in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\n"
+ ]
}
],
"prompt_number": 19
@@ -284,19 +639,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.14, Page number 191"
+ "source": [
+ "Example number 6.14, Page number 191"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the spacing of the lattice plane\n\n#importing modules\nimport math\n\n#variable declaration\na=2.04; #lattice parameter in armstrong\nh=2;\nk=1;\nl=2; #indices for plane (212)\n\n#Calculation\na=a*10**-10; #converting from armstrong to m\nd=a/math.sqrt((h**2)+(k**2)+(l**2));\nd=d*10**10; #converting from m to armstrong\nd=math.ceil(d*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"interplanar distance in armstrong is\",d);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "a=2.04; #lattice parameter in armstrong\n",
+ "h=2;\n",
+ "k=1;\n",
+ "l=2; #indices for plane (212)\n",
+ "\n",
+ "#Calculation\n",
+ "a=a*10**-10; #converting from armstrong to m\n",
+ "d=a/math.sqrt((h**2)+(k**2)+(l**2));\n",
+ "d=d*10**10; #converting from m to armstrong\n",
+ "d=math.ceil(d*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"interplanar distance in armstrong is\",d);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('interplanar distance in armstrong is', 0.681)\n"
+ "text": [
+ "('interplanar distance in armstrong is', 0.681)\n"
+ ]
}
],
"prompt_number": 20
@@ -305,19 +684,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.15, Page number 191"
+ "source": [
+ "Example number 6.15, Page number 191"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of atoms per unit cell\n\n#importing modules\nimport math\n\n#variable declaration\nr=1.278; #radius of Cu in armstrong\nM=63.54; #atomic weight of Cu\nrho=8980; #density in kg/m^3\nNa=6.022*10**26;\n\n#Calculation\nr=r*10**-10; #radius in m\na=math.sqrt(8)*r;\nn=(rho*Na*a**3)/M;\n\n#Result\nprint(\"interatomic distance in m is\",a);\nprint(\"number of atoms per Cu unit cell is\",int(n));",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "r=1.278; #radius of Cu in armstrong\n",
+ "M=63.54; #atomic weight of Cu\n",
+ "rho=8980; #density in kg/m^3\n",
+ "Na=6.022*10**26;\n",
+ "\n",
+ "#Calculation\n",
+ "r=r*10**-10; #radius in m\n",
+ "a=math.sqrt(8)*r;\n",
+ "n=(rho*Na*a**3)/M;\n",
+ "\n",
+ "#Result\n",
+ "print(\"interatomic distance in m is\",a);\n",
+ "print(\"number of atoms per Cu unit cell is\",int(n));"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('interatomic distance in m is', 3.6147298654256317e-10)\n('number of atoms per Cu unit cell is', 4)\n"
+ "text": [
+ "('interatomic distance in m is', 3.6147298654256317e-10)\n",
+ "('number of atoms per Cu unit cell is', 4)\n"
+ ]
}
],
"prompt_number": 21
@@ -326,19 +730,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.16, Page number 192"
+ "source": [
+ "Example number 6.16, Page number 192"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Miller indices \n\n#variable declaration\na=0.429;\nb=1;\nc=0.379; #intercepts of an orthorhombic crystal\n\n#Calculation\n#ratio of intercepts are 0.214:1:0.188 = (a/0.429)*0.214:1:(c/0.379)*0.188 = a/2:b:c/2\n#thus the coefficients are 1/2:1:1/2. inverses are 2,1,2.\n#thus miller indices for the first plane are (212)\n#ratio of intercepts are 0.858:1:0.754 = (a/0.429)*0.0.858:1:(c/0.379)*0.754 = 2a:b:2c\n#thus the coefficients are 2:1:2. inverses are 1/2,1,1/2. LCM is 2. multiplying with LCM we get 1,2,1\n#thus miller indices for the second plane are (121)\n#ratio of intercepts are 0.429:infinite:0.126 = (a/0.429)*0.429:infinite:(c/0.379)*0.126 = a:infiniteb:c/3\n#thus the coefficients are 1:infinte:1/3. inverses are 1,0,3.\n#thus miller indices for the third plane are (103)\n\n#Result\nprint(\"miller indices for the first plane are (212)\");\nprint(\"miller indices for the second plane are (121)\");\nprint(\"miller indices for the third plane are (103)\");\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "a=0.429;\n",
+ "b=1;\n",
+ "c=0.379; #intercepts of an orthorhombic crystal\n",
+ "\n",
+ "#Calculation\n",
+ "#ratio of intercepts are 0.214:1:0.188 = (a/0.429)*0.214:1:(c/0.379)*0.188 = a/2:b:c/2\n",
+ "#thus the coefficients are 1/2:1:1/2. inverses are 2,1,2.\n",
+ "#thus miller indices for the first plane are (212)\n",
+ "#ratio of intercepts are 0.858:1:0.754 = (a/0.429)*0.0.858:1:(c/0.379)*0.754 = 2a:b:2c\n",
+ "#thus the coefficients are 2:1:2. inverses are 1/2,1,1/2. LCM is 2. multiplying with LCM we get 1,2,1\n",
+ "#thus miller indices for the second plane are (121)\n",
+ "#ratio of intercepts are 0.429:infinite:0.126 = (a/0.429)*0.429:infinite:(c/0.379)*0.126 = a:infiniteb:c/3\n",
+ "#thus the coefficients are 1:infinte:1/3. inverses are 1,0,3.\n",
+ "#thus miller indices for the third plane are (103)\n",
+ "\n",
+ "#Result\n",
+ "print(\"miller indices for the first plane are (212)\");\n",
+ "print(\"miller indices for the second plane are (121)\");\n",
+ "print(\"miller indices for the third plane are (103)\");\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "miller indices for the first plane are (212)\nmiller indices for the second plane are (121)\nmiller indices for the third plane are (103)\n"
+ "text": [
+ "miller indices for the first plane are (212)\n",
+ "miller indices for the second plane are (121)\n",
+ "miller indices for the third plane are (103)\n"
+ ]
}
],
"prompt_number": 12
@@ -347,19 +780,66 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.17, Page number 193"
+ "source": [
+ "Example number 6.17, Page number 193"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of atoms per unit area\n\n#importing modules\nimport math\nimport numpy as np\n\n#variable declaration\nh1=1;\nk1=0;\nl1=0; #indices of the first plane (100)\nh2=1;\nk2=1;\nl2=0; #indices of the second plane (110)\nh3=1;\nk3=1;\nl3=1; #indices of the third plane (111)\n\n#Calculation\nn_1=np.reciprocal(4.);\nn_2=np.reciprocal(2.);\nn_3=np.reciprocal(6.);\nn1=(n_1*4)+1; #number of atoms per unit cell in (100)\n#number of atoms per m^2 is 2/a**2. but a=sqrt(8)*r.\n#hence number of atoms per m^2 is 1/(4*r**2)\nn2=(n_1*4)+(2*n_2); #number of atoms per unit cell in (110)\n#number of atoms per m^2 is 1/a*sqrt(2)*a. but a=sqrt(8)*r.\n#hence number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\nn3=(n_3*3)+(3*n_2); #number of atoms per unit cell in (111)\n#number of atoms per m^2 is 2/(sqrt(3)/4)*a**2. but a=4*r.\n#hence number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n\n#Result\nprint(\"number of atoms per unit cell in (100)\",n1);\nprint(\"number of atoms per m^2 is 1/(4*r**2)\");\nprint(\"number of atoms per unit cell in (110)\",n2);\nprint(\"number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\");\nprint(\"number of atoms per unit cell in (111)\",n3);\nprint(\"number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\");\n",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "import numpy as np\n",
+ "\n",
+ "#variable declaration\n",
+ "h1=1;\n",
+ "k1=0;\n",
+ "l1=0; #indices of the first plane (100)\n",
+ "h2=1;\n",
+ "k2=1;\n",
+ "l2=0; #indices of the second plane (110)\n",
+ "h3=1;\n",
+ "k3=1;\n",
+ "l3=1; #indices of the third plane (111)\n",
+ "\n",
+ "#Calculation\n",
+ "n_1=np.reciprocal(4.);\n",
+ "n_2=np.reciprocal(2.);\n",
+ "n_3=np.reciprocal(6.);\n",
+ "n1=(n_1*4)+1; #number of atoms per unit cell in (100)\n",
+ "#number of atoms per m^2 is 2/a**2. but a=sqrt(8)*r.\n",
+ "#hence number of atoms per m^2 is 1/(4*r**2)\n",
+ "n2=(n_1*4)+(2*n_2); #number of atoms per unit cell in (110)\n",
+ "#number of atoms per m^2 is 1/a*sqrt(2)*a. but a=sqrt(8)*r.\n",
+ "#hence number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n",
+ "n3=(n_3*3)+(3*n_2); #number of atoms per unit cell in (111)\n",
+ "#number of atoms per m^2 is 2/(sqrt(3)/4)*a**2. but a=4*r.\n",
+ "#hence number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"number of atoms per unit cell in (100)\",n1);\n",
+ "print(\"number of atoms per m^2 is 1/(4*r**2)\");\n",
+ "print(\"number of atoms per unit cell in (110)\",n2);\n",
+ "print(\"number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\");\n",
+ "print(\"number of atoms per unit cell in (111)\",n3);\n",
+ "print(\"number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\");\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('number of atoms per unit cell in (100)', 2.0)\nnumber of atoms per m^2 is 1/(4*r**2)\n('number of atoms per unit cell in (110)', 2.0)\nnumber of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n('number of atoms per unit cell in (111)', 2.0)\nnumber of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n"
+ "text": [
+ "('number of atoms per unit cell in (100)', 2.0)\n",
+ "number of atoms per m^2 is 1/(4*r**2)\n",
+ "('number of atoms per unit cell in (110)', 2.0)\n",
+ "number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n",
+ "('number of atoms per unit cell in (111)', 2.0)\n",
+ "number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n"
+ ]
}
],
"prompt_number": 22
@@ -368,19 +848,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 6.18, Page number 194"
+ "source": [
+ "Example number 6.18, Page number 194"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the atomic packing fraction and ionic packing fraction of NaCl\n\n#importing modules\nimport math\n\n#variable declaration\nr=0.97; #radius of Na+ ion in armstrong\nR=1.81; #radius of Cl- ion in armstrong\n\n#Calculation\n#atomic packing factor=packing density PD\n#PD=Volume of atoms/Volume of unit cell\n#volume of unit cell=a**3\n#volume of atoms=number of atoms*volume of 1 atom = 4*(4/3)*math.pi*r**3\n#but r=a/sqrt(8). hence PD = 4*(4/3)*math.pi*(a/(2*sqrt(2)))**3*(1/a**3) = 0.74\n#atomic packing factor = 0.74\nr=r*10**-10; #radius of Na+ ion in m\nR=R*10**-10; #radius of Cl- ion in m\nVna = (4*4*math.pi*r**3)/3; #volume of Na atoms\nVcl = (4*4*math.pi*R**3)/3; #volume of Cl atoms \nV=(2*(r+R))**3; #volume of unit cell\nIPF=(Vna+Vcl)/V; #ionic packing factor\nIPF=math.ceil(IPF*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"atomic packing factor = 0.74\");\nprint(\"ionic packing factor of NaCl crystal is\",IPF);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "r=0.97; #radius of Na+ ion in armstrong\n",
+ "R=1.81; #radius of Cl- ion in armstrong\n",
+ "\n",
+ "#Calculation\n",
+ "#atomic packing factor=packing density PD\n",
+ "#PD=Volume of atoms/Volume of unit cell\n",
+ "#volume of unit cell=a**3\n",
+ "#volume of atoms=number of atoms*volume of 1 atom = 4*(4/3)*math.pi*r**3\n",
+ "#but r=a/sqrt(8). hence PD = 4*(4/3)*math.pi*(a/(2*sqrt(2)))**3*(1/a**3) = 0.74\n",
+ "#atomic packing factor = 0.74\n",
+ "r=r*10**-10; #radius of Na+ ion in m\n",
+ "R=R*10**-10; #radius of Cl- ion in m\n",
+ "Vna = (4*4*math.pi*r**3)/3; #volume of Na atoms\n",
+ "Vcl = (4*4*math.pi*R**3)/3; #volume of Cl atoms \n",
+ "V=(2*(r+R))**3; #volume of unit cell\n",
+ "IPF=(Vna+Vcl)/V; #ionic packing factor\n",
+ "IPF=math.ceil(IPF*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"atomic packing factor = 0.74\");\n",
+ "print(\"ionic packing factor of NaCl crystal is\",IPF);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "atomic packing factor = 0.74\n('ionic packing factor of NaCl crystal is', 0.6671)\n"
+ "text": [
+ "atomic packing factor = 0.74\n",
+ "('ionic packing factor of NaCl crystal is', 0.6671)\n"
+ ]
}
],
"prompt_number": 24
@@ -388,7 +901,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_7.ipynb b/Engineering_Physics_Marikani/Chapter_7.ipynb
index c59443c9..706a4598 100644
--- a/Engineering_Physics_Marikani/Chapter_7.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 7"
+ "name": "",
+ "signature": "sha256:f1c728f94d30127360e83c10a55164d3b256772685ed9e2e28ae6d78b3f4a0ae"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,60 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Crystal Imperfections"
+ "source": [
+ "Crystal Imperfections"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.1, Page number 207 "
+ "source": [
+ "Example number 7.1, Page number 207 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of vacancies and vacancy fraction\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nEv=0.98; #energy in eV/atom\nT1=900; #temperature in C\nT2=1000;\nA=6.022*10**26; #avagadro's constant\nw=196.9; #atomic weight in g/mol\nd=18.63; #density in g/cm^3\n\n#Calculation\nEv=Ev*1.6*10**-19; #converting eV to J\nd=d*10**3; #converting g/cm^3 into kg/m^3\nN=(A*d)/w;\nn=N*math.exp(-Ev/(k*T1));\n#let valency fraction n/N be V\nV=math.exp(-Ev/(k*T2));\n\n#Result\nprint(\"concentration of atoms per m^3 is\",N);\nprint(\"number of vacancies per m^3 is\",n);\nprint(\"valency fraction is\",V);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k=1.38*10**-23;\n",
+ "Ev=0.98; #energy in eV/atom\n",
+ "T1=900; #temperature in C\n",
+ "T2=1000;\n",
+ "A=6.022*10**26; #avagadro's constant\n",
+ "w=196.9; #atomic weight in g/mol\n",
+ "d=18.63; #density in g/cm^3\n",
+ "\n",
+ "#Calculation\n",
+ "Ev=Ev*1.6*10**-19; #converting eV to J\n",
+ "d=d*10**3; #converting g/cm^3 into kg/m^3\n",
+ "N=(A*d)/w;\n",
+ "n=N*math.exp(-Ev/(k*T1));\n",
+ "#let valency fraction n/N be V\n",
+ "V=math.exp(-Ev/(k*T2));\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of atoms per m^3 is\",N);\n",
+ "print(\"number of vacancies per m^3 is\",n);\n",
+ "print(\"valency fraction is\",V);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of atoms per m^3 is', 5.69780904012189e+28)\n('number of vacancies per m^3 is', 1.8742498047705634e+23)\n('valency fraction is', 1.1625392535344139e-05)\n"
+ "text": [
+ "('concentration of atoms per m^3 is', 5.69780904012189e+28)\n",
+ "('number of vacancies per m^3 is', 1.8742498047705634e+23)\n",
+ "('valency fraction is', 1.1625392535344139e-05)\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +74,50 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.2, Page number 208 "
+ "source": [
+ "Example number 7.2, Page number 208 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the energy for vacancy formation\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nA=6.022*10**26; #avagadro's constant\nT=1073; #temperature in K\nn=3.6*10**23; #number of vacancies\nd=9.5; #density in g/cm^3\nw=107.9; #atomic weight in g/mol\n\n#Calculation\nd=d*10**3; #converting g/cm^3 into kg/m^3\nN=(A*d)/w; #concentration of atoms\nE=k*T*math.log((N/n), ); #energy in J\nEeV=E/(1.602176565*10**-19); #energy in eV\nEeV=math.ceil(EeV*10**2)/10**2; #rounding off to 2 decimals\n\n#Result\nprint(\"concentration of atoms per m^3 is\",N);\nprint(\"energy for vacancy formation in J\",E);\nprint(\"energy for vacancy formation in eV\",EeV);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k=1.38*10**-23;\n",
+ "A=6.022*10**26; #avagadro's constant\n",
+ "T=1073; #temperature in K\n",
+ "n=3.6*10**23; #number of vacancies\n",
+ "d=9.5; #density in g/cm^3\n",
+ "w=107.9; #atomic weight in g/mol\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**3; #converting g/cm^3 into kg/m^3\n",
+ "N=(A*d)/w; #concentration of atoms\n",
+ "E=k*T*math.log((N/n), ); #energy in J\n",
+ "EeV=E/(1.602176565*10**-19); #energy in eV\n",
+ "EeV=math.ceil(EeV*10**2)/10**2; #rounding off to 2 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of atoms per m^3 is\",N);\n",
+ "print(\"energy for vacancy formation in J\",E);\n",
+ "print(\"energy for vacancy formation in eV\",EeV);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of atoms per m^3 is', 5.3020389249304915e+28)\n('energy for vacancy formation in J', 1.762092900344914e-19)\n('energy for vacancy formation in eV', 1.1)\n"
+ "text": [
+ "('concentration of atoms per m^3 is', 5.3020389249304915e+28)\n",
+ "('energy for vacancy formation in J', 1.762092900344914e-19)\n",
+ "('energy for vacancy formation in eV', 1.1)\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +126,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 7.3, Page number 209 "
+ "source": [
+ "Example number 7.3, Page number 209 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of Schotky defect\n\n#importing modules\nimport math\n\n#Variable declaration\nA=6.022*10**26; #avagadro's constant\nk=1.38*10**-23;\nw1=39.1; #atomic weight of K\nw2=35.45; #atomic weight of Cl\nEs=2.6; #energy formation in eV\nT=500; #temperature in C\nd=1.955; #density in g/cm^3\n\n#Calculation\nEs=Es*1.6*10**-19; #converting eV to J\nT=T+273; #temperature in K\nd=d*10**3; #converting g/cm^3 into kg/m^3\nN=(A*d)/(w1+w2);\nn=N*math.exp(-Es/(2*k*T));\n\n#Result\nprint(\"number of Schotky defect per m^3 is\",n);\n\n#answer given in the book is wrong by 3rd decimal point",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "A=6.022*10**26; #avagadro's constant\n",
+ "k=1.38*10**-23;\n",
+ "w1=39.1; #atomic weight of K\n",
+ "w2=35.45; #atomic weight of Cl\n",
+ "Es=2.6; #energy formation in eV\n",
+ "T=500; #temperature in C\n",
+ "d=1.955; #density in g/cm^3\n",
+ "\n",
+ "#Calculation\n",
+ "Es=Es*1.6*10**-19; #converting eV to J\n",
+ "T=T+273; #temperature in K\n",
+ "d=d*10**3; #converting g/cm^3 into kg/m^3\n",
+ "N=(A*d)/(w1+w2);\n",
+ "n=N*math.exp(-Es/(2*k*T));\n",
+ "\n",
+ "#Result\n",
+ "print(\"number of Schotky defect per m^3 is\",n);\n",
+ "\n",
+ "#answer given in the book is wrong by 3rd decimal point"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('number of Schotky defect per m^3 is', 5.373777171020081e+19)\n"
+ "text": [
+ "('number of Schotky defect per m^3 is', 5.373777171020081e+19)\n"
+ ]
}
],
"prompt_number": 7
@@ -79,7 +175,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_8.ipynb b/Engineering_Physics_Marikani/Chapter_8.ipynb
index 40606862..1db414de 100644
--- a/Engineering_Physics_Marikani/Chapter_8.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 8"
+ "name": "",
+ "signature": "sha256:1a361e48153d58a5820c879429a5bbafe3e6e3df7d99a198492b082874550ac1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,45 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Conducting materials"
+ "source": [
+ "Conducting materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.1, Page number 231"
+ "source": [
+ "Example number 8.1, Page number 231"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electrical resistivity\n\n#Variable declaration\nm=9.1*10**-31; #mass of the electron in kg\nn=2.533*10**28; #concentration of electrons per m^3\ne=1.6*10**-19;\ntow_r=3.1*10**-14; #relaxation time in sec\n\n#Calculation\nrho=m/(n*(e**2*tow_r));\n\n#Result\nprint(\"electrical resistivity in ohm metre is\",rho);",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "n=2.533*10**28; #concentration of electrons per m^3\n",
+ "e=1.6*10**-19;\n",
+ "tow_r=3.1*10**-14; #relaxation time in sec\n",
+ "\n",
+ "#Calculation\n",
+ "rho=m/(n*(e**2*tow_r));\n",
+ "\n",
+ "#Result\n",
+ "print(\"electrical resistivity in ohm metre is\",rho);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electrical resistivity in ohm metre is', 4.526937967219795e-08)\n"
+ "text": [
+ "('electrical resistivity in ohm metre is', 4.526937967219795e-08)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +59,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.2, Page number 231"
+ "source": [
+ "Example number 8.2, Page number 231"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the band gap of semiconductor\n\n#importing modules\nimport math\n\n#Variable declaration\ns=3.75*10**3; #slope\nk=1.38*10**-23;\n\n#Calculation\nEg=2*k*s;\nEg=Eg/(1.6*10**-19); #converting J to eV\nEg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"band gap of semiconductor in eV is\",Eg);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "s=3.75*10**3; #slope\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "Eg=2*k*s;\n",
+ "Eg=Eg/(1.6*10**-19); #converting J to eV\n",
+ "Eg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"band gap of semiconductor in eV is\",Eg);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('band gap of semiconductor in eV is', 0.647)\n"
+ "text": [
+ "('band gap of semiconductor in eV is', 0.647)\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +101,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.3, Page number 231"
+ "source": [
+ "Example number 8.3, Page number 231"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the probability of occupation of electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nT=989; #temperature in C\nk=1.38*10**-23;\n#let E-EF be E\nE=0.5; #occupied level of electron in eV\n\n#Calculation\nT=T+273; #temperature in K\nE=E*1.6*10**-19; #converting eV to J\n#let fermi=dirac distribution function f(E) be f\nf=1/(1+math.exp(E/(k*T)));\nf=math.ceil(f*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"probability of occupation of electrons is\",f);",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "T=989; #temperature in C\n",
+ "k=1.38*10**-23;\n",
+ "#let E-EF be E\n",
+ "E=0.5; #occupied level of electron in eV\n",
+ "\n",
+ "#Calculation\n",
+ "T=T+273; #temperature in K\n",
+ "E=E*1.6*10**-19; #converting eV to J\n",
+ "#let fermi=dirac distribution function f(E) be f\n",
+ "f=1/(1+math.exp(E/(k*T)));\n",
+ "f=math.ceil(f*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"probability of occupation of electrons is\",f);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('probability of occupation of electrons is', 0.011)\n"
+ "text": [
+ "('probability of occupation of electrons is', 0.011)\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +146,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.4, Page number 232"
+ "source": [
+ "Example number 8.4, Page number 232"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the drift velocity of free electrons\n\n#Variable declaration\nmew_e=0.0035; #mobility of electrons in m^2/Vs\nE=0.5; #electric field strength in V/m\n\n#Calculation\nvd=mew_e*E;\nvd=vd*10**3;\n\n#Result\nprint(\"drift velocity of free electrons in m/sec is\",vd,\"*10**-3\");\n\n#answer given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_e=0.0035; #mobility of electrons in m^2/Vs\n",
+ "E=0.5; #electric field strength in V/m\n",
+ "\n",
+ "#Calculation\n",
+ "vd=mew_e*E;\n",
+ "vd=vd*10**3;\n",
+ "\n",
+ "#Result\n",
+ "print(\"drift velocity of free electrons in m/sec is\",vd,\"*10**-3\");\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('drift velocity of free electrons in m/sec is', 1.75, '*10**-3')\n"
+ "text": [
+ "('drift velocity of free electrons in m/sec is', 1.75, '*10**-3')\n"
+ ]
}
],
"prompt_number": 1
@@ -101,19 +186,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.5, Page number 232"
+ "source": [
+ "Example number 8.5, Page number 232"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mobility of electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nA=6.022*10**23; #avagadro number\ne=1.6*10**-19;\nrho=1.73*10**-8; #resistivity of Cu in ohm metre\nw=63.5; #atomic weight \nd=8.92*10**3; #density in kg/m^3\n\n#Calculation\nd=d*10**3;\nsigma=1/rho;\nsigmaa=sigma/10**7;\nsigmaa=math.ceil(sigmaa*10**3)/10**3; #rounding off to 3 decimals\nn=(d*A)/w;\nmew=sigma/(n*e); #mobility of electrons\nmew=mew*10**3;\nmew=math.ceil(mew*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"electrical conductivity in ohm-1 m-1\",sigmaa,\"*10**7\");\nprint(\"concentration of carriers per m^3\",n);\nprint(\"mobility of electrons in m^2/Vsec is\",mew,\"*10**-3\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "A=6.022*10**23; #avagadro number\n",
+ "e=1.6*10**-19;\n",
+ "rho=1.73*10**-8; #resistivity of Cu in ohm metre\n",
+ "w=63.5; #atomic weight \n",
+ "d=8.92*10**3; #density in kg/m^3\n",
+ "\n",
+ "#Calculation\n",
+ "d=d*10**3;\n",
+ "sigma=1/rho;\n",
+ "sigmaa=sigma/10**7;\n",
+ "sigmaa=math.ceil(sigmaa*10**3)/10**3; #rounding off to 3 decimals\n",
+ "n=(d*A)/w;\n",
+ "mew=sigma/(n*e); #mobility of electrons\n",
+ "mew=mew*10**3;\n",
+ "mew=math.ceil(mew*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"electrical conductivity in ohm-1 m-1\",sigmaa,\"*10**7\");\n",
+ "print(\"concentration of carriers per m^3\",n);\n",
+ "print(\"mobility of electrons in m^2/Vsec is\",mew,\"*10**-3\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electrical conductivity in ohm-1 m-1', 5.781, '*10**7')\n('concentration of carriers per m^3', 8.459250393700786e+28)\n('mobility of electrons in m^2/Vsec is', 4.2708, '*10**-3')\n"
+ "text": [
+ "('electrical conductivity in ohm-1 m-1', 5.781, '*10**7')\n",
+ "('concentration of carriers per m^3', 8.459250393700786e+28)\n",
+ "('mobility of electrons in m^2/Vsec is', 4.2708, '*10**-3')\n"
+ ]
}
],
"prompt_number": 16
@@ -122,19 +240,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.6, Page number 232"
+ "source": [
+ "Example number 8.6, Page number 232"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the fermi energy\n\n#importing modules\nimport math\n\n#Variable declaration\nn=18.1*10**28; #concentration of electrons per m^3\nh=6.62*10**-34; #planck constant in Js\nme=9.1*10**-31; #mass of electron in kg\n\n#Calculation\nX=h**2/(8*me);\nE_F0=X*(((3*n)/math.pi)**(2/3));\nE_F0=E_F0/(1.6*10**-19); #converting J to eV\n\n#Result\nprint(\"Fermi energy in eV is\",E_F0);\n\n#answer given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "n=18.1*10**28; #concentration of electrons per m^3\n",
+ "h=6.62*10**-34; #planck constant in Js\n",
+ "me=9.1*10**-31; #mass of electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "X=h**2/(8*me);\n",
+ "E_F0=X*(((3*n)/math.pi)**(2/3));\n",
+ "E_F0=E_F0/(1.6*10**-19); #converting J to eV\n",
+ "\n",
+ "#Result\n",
+ "print(\"Fermi energy in eV is\",E_F0);\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('Fermi energy in eV is', 3.762396978021977e-19)\n"
+ "text": [
+ "('Fermi energy in eV is', 3.762396978021977e-19)\n"
+ ]
}
],
"prompt_number": 18
@@ -143,19 +285,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.7, Page number 233"
+ "source": [
+ "Example number 8.7, Page number 233"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the concentration of free electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nE_F0=5.5; #fermi energy in eV\nh=6.63*10**-34; #planck constant in Js\nme=9.1*10**-31; #mass of electron in kg\n\n#Calculation\nE_F0=E_F0*1.6*10**-19; #converting eV to J\nn=((2*me*E_F0)**(3/2))*((8*math.pi)/(3*h**3));\n\n#Result\nprint(\"concentration of free electrons per unit volume of silver per m^3 is\",n);\n\n#answer given in the book is wrong\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "E_F0=5.5; #fermi energy in eV\n",
+ "h=6.63*10**-34; #planck constant in Js\n",
+ "me=9.1*10**-31; #mass of electron in kg\n",
+ "\n",
+ "#Calculation\n",
+ "E_F0=E_F0*1.6*10**-19; #converting eV to J\n",
+ "n=((2*me*E_F0)**(3/2))*((8*math.pi)/(3*h**3));\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of free electrons per unit volume of silver per m^3 is\",n);\n",
+ "\n",
+ "#answer given in the book is wrong\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of free electrons per unit volume of silver per m^3 is', 4.603965704817037e+52)\n"
+ "text": [
+ "('concentration of free electrons per unit volume of silver per m^3 is', 4.603965704817037e+52)\n"
+ ]
}
],
"prompt_number": 19
@@ -164,19 +327,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.8, Page number 233"
+ "source": [
+ "Example number 8.8, Page number 233"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the probability of an electron\n\n#importing modules\nimport math\n\n#Variable declaration\nEg=1.07; #energy gap of silicon in eV\nk=1.38*10**-23;\nT=298; #temperature in K\n\n#Calculation\nEg=Eg*1.6*10**-19; #converting eV to J\n#let the probability of electron f(E) be X\n#X=1/(1+exp((E-Ef)/(k*T)))\n#but E=Ec and Ec-Ef=Eg/2\nX=1/(1+math.exp(Eg/(2*k*T)))\n\n#Result\nprint(\"probability of an electron thermally excited is\",X);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Eg=1.07; #energy gap of silicon in eV\n",
+ "k=1.38*10**-23;\n",
+ "T=298; #temperature in K\n",
+ "\n",
+ "#Calculation\n",
+ "Eg=Eg*1.6*10**-19; #converting eV to J\n",
+ "#let the probability of electron f(E) be X\n",
+ "#X=1/(1+exp((E-Ef)/(k*T)))\n",
+ "#but E=Ec and Ec-Ef=Eg/2\n",
+ "X=1/(1+math.exp(Eg/(2*k*T)))\n",
+ "\n",
+ "#Result\n",
+ "print(\"probability of an electron thermally excited is\",X);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('probability of an electron thermally excited is', 9.122602463573379e-10)\n"
+ "text": [
+ "('probability of an electron thermally excited is', 9.122602463573379e-10)\n"
+ ]
}
],
"prompt_number": 21
@@ -185,19 +372,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.9, Page number 234"
+ "source": [
+ "Example number 8.9, Page number 234"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the fermi energy and temperature\n\n#importing modules\nimport math\n\n#Variable declaration\nk=1.38*10**-23;\nm=9.1*10**-31; #mass of the electron in kg\nvf=0.86*10**6; #fermi velocity in m/sec\n\n#Calculation\nEfj=(m*vf**2)/2;\nEf=Efj/(1.6*10**-19); #converting J to eV\nEf=math.ceil(Ef*10**3)/10**3; #rounding off to 3 decimals\nTf=Efj/k;\nTf=Tf/10**4;\nTf=math.ceil(Tf*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"fermi energy of metal in J is\",Efj);\nprint(\"fermi energy of metal in eV is\",Ef);\nprint(\"fermi temperature in K is\",Tf,\"*10**4\");\n",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "k=1.38*10**-23;\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "vf=0.86*10**6; #fermi velocity in m/sec\n",
+ "\n",
+ "#Calculation\n",
+ "Efj=(m*vf**2)/2;\n",
+ "Ef=Efj/(1.6*10**-19); #converting J to eV\n",
+ "Ef=math.ceil(Ef*10**3)/10**3; #rounding off to 3 decimals\n",
+ "Tf=Efj/k;\n",
+ "Tf=Tf/10**4;\n",
+ "Tf=math.ceil(Tf*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"fermi energy of metal in J is\",Efj);\n",
+ "print(\"fermi energy of metal in eV is\",Ef);\n",
+ "print(\"fermi temperature in K is\",Tf,\"*10**4\");\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('fermi energy of metal in J is', 3.3651800000000002e-19)\n('fermi energy of metal in eV is', 2.104)\n('fermi temperature in K is', 2.4386, '*10**4')\n"
+ "text": [
+ "('fermi energy of metal in J is', 3.3651800000000002e-19)\n",
+ "('fermi energy of metal in eV is', 2.104)\n",
+ "('fermi temperature in K is', 2.4386, '*10**4')\n"
+ ]
}
],
"prompt_number": 24
@@ -206,19 +422,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.10, Page number 234"
+ "source": [
+ "Example number 8.10, Page number 234"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Lorentz number\n\n#Variable declaration\nsigma=5.82*10**7; #electrical conductivity in ohm^-1m^-1\nK=387; #thermal conductivity of Cu in W/mK\nT=27; #temperature in C\n\n#Calculation\nT=T+273; #temperature in K\nL=K/(sigma*T);\n\n#Result\nprint(\"lorentz number in W ohm/K^2 is\",L);\n",
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "sigma=5.82*10**7; #electrical conductivity in ohm^-1m^-1\n",
+ "K=387; #thermal conductivity of Cu in W/mK\n",
+ "T=27; #temperature in C\n",
+ "\n",
+ "#Calculation\n",
+ "T=T+273; #temperature in K\n",
+ "L=K/(sigma*T);\n",
+ "\n",
+ "#Result\n",
+ "print(\"lorentz number in W ohm/K^2 is\",L);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('lorentz number in W ohm/K^2 is', 2.2164948453608246e-08)\n"
+ "text": [
+ "('lorentz number in W ohm/K^2 is', 2.2164948453608246e-08)\n"
+ ]
}
],
"prompt_number": 25
@@ -227,19 +460,52 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 8.11, Page number 235"
+ "source": [
+ "Example number 8.11, Page number 235"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the electrical conductivity, thermal conductivity and Lorentz number\n\n#importing modules\nimport math\n\n#Variable declaration\nm=9.1*10**-31; #mass of the electron in kg\ne=1.6*10**-19;\nk=1.38*10**-23;\nn=8.49*10**28; #concentration of electrons in Cu per m^3\ntow_r=2.44*10**-14; #relaxation time in sec\nT=20; #temperature in C\n\n#Calculation\nT=T+273; #temperature in K\nsigma=(n*(e**2)*tow_r)/m;\nsigmaa=sigma/10**7;\nsigmaa=math.ceil(sigmaa*10**4)/10**4; #rounding off to 4 decimals\nK=(n*(math.pi**2)*(k**2)*T*tow_r)/(3*m);\nK=math.ceil(K*100)/100; #rounding off to 2 decimals\nL=K/(sigma*T);\n\n#Result\nprint(\"electrical conductivity in ohm^-1 m^-1 is\",sigmaa,\"*10**7\");\nprint(\"thermal conductivity in W/mK is\",K);\nprint(\"Lorentz number in W ohm/K^2 is\",L);\n\n#answer for lorentz number given in the book is wrong\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "m=9.1*10**-31; #mass of the electron in kg\n",
+ "e=1.6*10**-19;\n",
+ "k=1.38*10**-23;\n",
+ "n=8.49*10**28; #concentration of electrons in Cu per m^3\n",
+ "tow_r=2.44*10**-14; #relaxation time in sec\n",
+ "T=20; #temperature in C\n",
+ "\n",
+ "#Calculation\n",
+ "T=T+273; #temperature in K\n",
+ "sigma=(n*(e**2)*tow_r)/m;\n",
+ "sigmaa=sigma/10**7;\n",
+ "sigmaa=math.ceil(sigmaa*10**4)/10**4; #rounding off to 4 decimals\n",
+ "K=(n*(math.pi**2)*(k**2)*T*tow_r)/(3*m);\n",
+ "K=math.ceil(K*100)/100; #rounding off to 2 decimals\n",
+ "L=K/(sigma*T);\n",
+ "\n",
+ "#Result\n",
+ "print(\"electrical conductivity in ohm^-1 m^-1 is\",sigmaa,\"*10**7\");\n",
+ "print(\"thermal conductivity in W/mK is\",K);\n",
+ "print(\"Lorentz number in W ohm/K^2 is\",L);\n",
+ "\n",
+ "#answer for lorentz number given in the book is wrong\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('electrical conductivity in ohm^-1 m^-1 is', 5.8277, '*10**7')\n('thermal conductivity in W/mK is', 417.89)\n('Lorentz number in W ohm/K^2 is', 2.4473623172034308e-08)\n"
+ "text": [
+ "('electrical conductivity in ohm^-1 m^-1 is', 5.8277, '*10**7')\n",
+ "('thermal conductivity in W/mK is', 417.89)\n",
+ "('Lorentz number in W ohm/K^2 is', 2.4473623172034308e-08)\n"
+ ]
}
],
"prompt_number": 29
@@ -247,7 +513,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Physics_Marikani/Chapter_9.ipynb b/Engineering_Physics_Marikani/Chapter_9.ipynb
index 4524cd7c..bcdb04e8 100644
--- a/Engineering_Physics_Marikani/Chapter_9.ipynb
+++ b/Engineering_Physics_Marikani/Chapter_9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 9"
+ "name": "",
+ "signature": "sha256:0873412d6a4e98969b64a50f25d022cd9e4d104c8635e0bc9bd27817ed58d4b4"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,46 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Semiconducting materials"
+ "source": [
+ "Semiconducting materials"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.1, Page number 266"
+ "source": [
+ "Example number 9.1, Page number 266"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the number of charge carriers\n\n#Variable declaration\nmew_e=0.36; #mobility of electrons in m^2/Vs\nmew_h=0.14; #mobility of holes in m^2/Vs\nsigma=2.2; #conductivity in ohm-1 m-1\nT=300; #temperature in K\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nni=sigma/(e*(mew_e+mew_h)); #carrier concentration per m^3\n\n#Result\nprint(\"carrier concentration of an intrinsic semiconductor per m^3 is\",ni);",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "mew_e=0.36; #mobility of electrons in m^2/Vs\n",
+ "mew_h=0.14; #mobility of holes in m^2/Vs\n",
+ "sigma=2.2; #conductivity in ohm-1 m-1\n",
+ "T=300; #temperature in K\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "ni=sigma/(e*(mew_e+mew_h)); #carrier concentration per m^3\n",
+ "\n",
+ "#Result\n",
+ "print(\"carrier concentration of an intrinsic semiconductor per m^3 is\",ni);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('carrier concentration of an intrinsic semiconductor per m^3 is', 2.75e+19)\n"
+ "text": [
+ "('carrier concentration of an intrinsic semiconductor per m^3 is', 2.75e+19)\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +60,65 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.2, Page number 266"
+ "source": [
+ "Example number 9.2, Page number 266"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the band gap\n\n#importing modules\nimport math\nimport numpy as np\nfrom __future__ import division\n\n#Variable declaration\nT1=20; #temperature in C\nT2=100; #temperature in C\nsigma_i20=250; #conductivity in ohm-1 m-1\nsigma_i100=1100; #conductivity in ohm-1 m-1\nk=1.38*10**-23;\n\n#Calculation\nT1K=T1+273; #temperature in K\nT2K=T2+273; #temperature in K\nT_1K=T1K**(-1);\nT_2K=T2K**(-1);\nT_1=T_2K-T_1K;\nT_2=T2K/T1K;\nTk=T_1**(-1);\nT_k=(T_2)**(3/2);\n#intrinsic carrier concentration at T1K is ni20 = 2*((2*math.pi*k*m*293)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*293))\n#intrinsic carrier concentration at T2K is ni100 = 2*((2*math.pi*k*m*373)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*373))\n#dividing ni20/ni100 = (293/373)**(3/2)*(math.exp(-Eg/(2*k*293))/math.exp(-Eg/(2*k*373)))\n#ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n#sigma_i20/sigma_i100 = (ni20*e*(mew_e+mew_h))/(ni100*e*(mew_e+mew_h)) = ni20/ni100\n#therefore sigma_i20/sigma_i100 = ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n#math.exp((-Eg/(2*k))*((1/293)-(1/373))) = (sigma_i20/sigma_i100)*(373/293)**(3/2)\n#by taking log on both sides we get (-Eg/(2*k))*((1/293)-(1/373)) = np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n#Eg=2*k*(((1/373)-(1/293))**(-1))*np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\nEg=2*k*Tk*np.log((sigma_i20/sigma_i100)*T_k); #band gap in J\nEgeV=Eg*6.241*10**18; #converting J to eV\nEgeV=math.ceil(EgeV*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"band gap of the semiconductor in J is\",Eg);\nprint(\"band gap of the semiconductor in eV is\",EgeV);\n\n#answer for band gap in eV given in the book is wrong in the 4th decimal point",
+ "input": [
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "import numpy as np\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "T1=20; #temperature in C\n",
+ "T2=100; #temperature in C\n",
+ "sigma_i20=250; #conductivity in ohm-1 m-1\n",
+ "sigma_i100=1100; #conductivity in ohm-1 m-1\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "T1K=T1+273; #temperature in K\n",
+ "T2K=T2+273; #temperature in K\n",
+ "T_1K=T1K**(-1);\n",
+ "T_2K=T2K**(-1);\n",
+ "T_1=T_2K-T_1K;\n",
+ "T_2=T2K/T1K;\n",
+ "Tk=T_1**(-1);\n",
+ "T_k=(T_2)**(3/2);\n",
+ "#intrinsic carrier concentration at T1K is ni20 = 2*((2*math.pi*k*m*293)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*293))\n",
+ "#intrinsic carrier concentration at T2K is ni100 = 2*((2*math.pi*k*m*373)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*373))\n",
+ "#dividing ni20/ni100 = (293/373)**(3/2)*(math.exp(-Eg/(2*k*293))/math.exp(-Eg/(2*k*373)))\n",
+ "#ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n",
+ "#sigma_i20/sigma_i100 = (ni20*e*(mew_e+mew_h))/(ni100*e*(mew_e+mew_h)) = ni20/ni100\n",
+ "#therefore sigma_i20/sigma_i100 = ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n",
+ "#math.exp((-Eg/(2*k))*((1/293)-(1/373))) = (sigma_i20/sigma_i100)*(373/293)**(3/2)\n",
+ "#by taking log on both sides we get (-Eg/(2*k))*((1/293)-(1/373)) = np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n",
+ "#Eg=2*k*(((1/373)-(1/293))**(-1))*np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n",
+ "Eg=2*k*Tk*np.log((sigma_i20/sigma_i100)*T_k); #band gap in J\n",
+ "EgeV=Eg*6.241*10**18; #converting J to eV\n",
+ "EgeV=math.ceil(EgeV*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"band gap of the semiconductor in J is\",Eg);\n",
+ "print(\"band gap of the semiconductor in eV is\",EgeV);\n",
+ "\n",
+ "#answer for band gap in eV given in the book is wrong in the 4th decimal point"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('band gap of the semiconductor in J is', 4.2210259829756855e-20)\n('band gap of the semiconductor in eV is', 0.2635)\n"
+ "text": [
+ "('band gap of the semiconductor in J is', 4.2210259829756855e-20)\n",
+ "('band gap of the semiconductor in eV is', 0.2635)\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +127,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.3, Page number 267"
+ "source": [
+ "Example number 9.3, Page number 267"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Hall voltage\n\n#Variable declaration\nI=10**-2; #current in Ampere\nl=100; #length in mm\nd=1; #thickness in mm\nw=10; #breadth in mm\nB=0.5; #magnetic field in Wb/m^2\nRH=3.66*10**-4; #hall coefficient in m^3/C\n\n#Calculation\nw=w*10**-3; #width in m\nVH=(B*I*RH)/w; #hall voltage\nVH=VH*10**4;\n\n#Result\nprint(\"Hall voltage in V is\",VH,\"*10**-4\");",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "I=10**-2; #current in Ampere\n",
+ "l=100; #length in mm\n",
+ "d=1; #thickness in mm\n",
+ "w=10; #breadth in mm\n",
+ "B=0.5; #magnetic field in Wb/m^2\n",
+ "RH=3.66*10**-4; #hall coefficient in m^3/C\n",
+ "\n",
+ "#Calculation\n",
+ "w=w*10**-3; #width in m\n",
+ "VH=(B*I*RH)/w; #hall voltage\n",
+ "VH=VH*10**4;\n",
+ "\n",
+ "#Result\n",
+ "print(\"Hall voltage in V is\",VH,\"*10**-4\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('Hall voltage in V is', 1.83, '*10**-4')\n"
+ "text": [
+ "('Hall voltage in V is', 1.83, '*10**-4')\n"
+ ]
}
],
"prompt_number": 1
@@ -80,19 +170,58 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.4, Page number 268"
+ "source": [
+ "Example number 9.4, Page number 268"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the concentration of holes and electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nsigma=300; #conductivity in S/cm\nT=300; #temperature in K\nni=1.5*10**10 #carrier concentration per cm^3\nmew_e=1300; #mobility of electrons in cm^2/Vs\nmew_h=500; #mobility of holes in cm^2/Vs\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nsigma=sigma*10**2; #sigma in S/m\nmew_e=mew_e*10**-4; #mobility of electrons in m^2/Vs\nND=sigma/(e*mew_e); #concentration of electron per m^3\nni=ni*10**6; #carrier concentration per m^3\np=ni**2/ND; #hole concentration per m^3\np=p/10**8;\np=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\nmew_h=mew_h*10**-4; #mobility of holes in m^2/Vs\nNA=sigma/(e*mew_h); #concentration of hole per m^3\nn=ni**2/NA; #electron concentration per m^3\nn=n/10**7;\n\n#Result\nprint(\"concentration of electron for N-type semiconductor per m^3\",ND);\nprint(\"hole concentration per m^3\",p,\"*10**8\");\nprint(\"concentration of hole for P-type semiconductor per m^3\",NA);\nprint(\"electron concentration per m^3\",int(n),\"*10**7\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "sigma=300; #conductivity in S/cm\n",
+ "T=300; #temperature in K\n",
+ "ni=1.5*10**10 #carrier concentration per cm^3\n",
+ "mew_e=1300; #mobility of electrons in cm^2/Vs\n",
+ "mew_h=500; #mobility of holes in cm^2/Vs\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "sigma=sigma*10**2; #sigma in S/m\n",
+ "mew_e=mew_e*10**-4; #mobility of electrons in m^2/Vs\n",
+ "ND=sigma/(e*mew_e); #concentration of electron per m^3\n",
+ "ni=ni*10**6; #carrier concentration per m^3\n",
+ "p=ni**2/ND; #hole concentration per m^3\n",
+ "p=p/10**8;\n",
+ "p=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n",
+ "mew_h=mew_h*10**-4; #mobility of holes in m^2/Vs\n",
+ "NA=sigma/(e*mew_h); #concentration of hole per m^3\n",
+ "n=ni**2/NA; #electron concentration per m^3\n",
+ "n=n/10**7;\n",
+ "\n",
+ "#Result\n",
+ "print(\"concentration of electron for N-type semiconductor per m^3\",ND);\n",
+ "print(\"hole concentration per m^3\",p,\"*10**8\");\n",
+ "print(\"concentration of hole for P-type semiconductor per m^3\",NA);\n",
+ "print(\"electron concentration per m^3\",int(n),\"*10**7\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('concentration of electron for N-type semiconductor per m^3', 1.4423076923076921e+24)\n('hole concentration per m^3', 1.561, '*10**8')\n('concentration of hole for P-type semiconductor per m^3', 3.7499999999999995e+24)\n('electron concentration per m^3', 6, '*10**7')\n"
+ "text": [
+ "('concentration of electron for N-type semiconductor per m^3', 1.4423076923076921e+24)\n",
+ "('hole concentration per m^3', 1.561, '*10**8')\n",
+ "('concentration of hole for P-type semiconductor per m^3', 3.7499999999999995e+24)\n",
+ "('electron concentration per m^3', 6, '*10**7')\n"
+ ]
}
],
"prompt_number": 11
@@ -101,19 +230,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.5, Page number 269"
+ "source": [
+ "Example number 9.5, Page number 269"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the type of charge carriers and the carrier concentration\n\n#importing modules\nimport math\n\n#Variable declaration\nRH=-3.68*10**-5; #hall coefficient in m^3/C\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\n#hall coefficient is negative implies charge carriers are electrons\nn=(3*math.pi)/(8*(-RH)*e); #carrier concentration\n\n#Result\nprint(\"charge carriers are electrons\");\nprint(\"carrier concentration per m^3 is\",n);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "RH=-3.68*10**-5; #hall coefficient in m^3/C\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "#hall coefficient is negative implies charge carriers are electrons\n",
+ "n=(3*math.pi)/(8*(-RH)*e); #carrier concentration\n",
+ "\n",
+ "#Result\n",
+ "print(\"charge carriers are electrons\");\n",
+ "print(\"carrier concentration per m^3 is\",n);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "charge carriers are electrons\n('carrier concentration per m^3 is', 2.000844505937792e+23)\n"
+ "text": [
+ "charge carriers are electrons\n",
+ "('carrier concentration per m^3 is', 2.000844505937792e+23)\n"
+ ]
}
],
"prompt_number": 13
@@ -122,19 +273,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.6, Page number 269"
+ "source": [
+ "Example number 9.6, Page number 269"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To compare the intrinsic carrier density\n\n#importing modules\nimport math\nfrom __future__ import division\n\n#Variable declaration\nEg1=0.36; #energy gap of 1st material in eV\nEg2=0.72; #energy gap of 2nd material in eV\nT=300; #temperature in K\nmh=9*10**-31;\nme=9*10**-31; \n#given that 2*k*T=0.052; \n#consider X=2*k*T\nX=0.052;\n\n#Calculation\n#intrinsic carrier concentration for A niA = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.36/(2*k*T))\n#intrinsic carrier concentration for B niB = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.72/(2*k*T))\n#dividing niA/niB = math.exp(-0.36/(2*k*T))*math.exp(0.72/(2*k*T))\n#let niA/niB be A\nA = math.exp(-0.36/X)*math.exp(0.72/X);\nA=A/10**3;\nA=math.ceil(A*10**5)/10**5; #rounding off to 5 decimals\n\n#Result\nprint(\"ratio of intrinsic carrier densities of A and B is\",A,\"*10**3\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "Eg1=0.36; #energy gap of 1st material in eV\n",
+ "Eg2=0.72; #energy gap of 2nd material in eV\n",
+ "T=300; #temperature in K\n",
+ "mh=9*10**-31;\n",
+ "me=9*10**-31; \n",
+ "#given that 2*k*T=0.052; \n",
+ "#consider X=2*k*T\n",
+ "X=0.052;\n",
+ "\n",
+ "#Calculation\n",
+ "#intrinsic carrier concentration for A niA = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.36/(2*k*T))\n",
+ "#intrinsic carrier concentration for B niB = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.72/(2*k*T))\n",
+ "#dividing niA/niB = math.exp(-0.36/(2*k*T))*math.exp(0.72/(2*k*T))\n",
+ "#let niA/niB be A\n",
+ "A = math.exp(-0.36/X)*math.exp(0.72/X);\n",
+ "A=A/10**3;\n",
+ "A=math.ceil(A*10**5)/10**5; #rounding off to 5 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio of intrinsic carrier densities of A and B is\",A,\"*10**3\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('ratio of intrinsic carrier densities of A and B is', 1.01544, '*10**3')\n"
+ "text": [
+ "('ratio of intrinsic carrier densities of A and B is', 1.01544, '*10**3')\n"
+ ]
}
],
"prompt_number": 16
@@ -143,19 +326,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.7, Page number 270"
+ "source": [
+ "Example number 9.7, Page number 270"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the mobility of electrons\n\n#importing modules\nimport math\n\n#Variable declaration\nND=2*10**22; #concentration of electron per m^3\nsigma=112; #conductivity in ohm-1 m-1\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nmew=sigma/(ND*e); #mobility of electrons \nmew=math.ceil(mew*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"mobility of electrons in m^2/Vs is\",mew);",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "ND=2*10**22; #concentration of electron per m^3\n",
+ "sigma=112; #conductivity in ohm-1 m-1\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "mew=sigma/(ND*e); #mobility of electrons \n",
+ "mew=math.ceil(mew*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"mobility of electrons in m^2/Vs is\",mew);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('mobility of electrons in m^2/Vs is', 0.035)\n"
+ "text": [
+ "('mobility of electrons in m^2/Vs is', 0.035)\n"
+ ]
}
],
"prompt_number": 17
@@ -164,19 +368,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.8, Page number 270"
+ "source": [
+ "Example number 9.8, Page number 270"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the Hall voltage\n\n#importing modules\nimport math\n\n#Variable declaration\nw=500; #thickness in micrometre\nA=2.5*10**-3; #area of cross section in cm^-2\nIx=1; #current in ampere\nBz=10; #magnetic field in Wb/cm^2\nn=10**16; #donor concentration in m^-3\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nBz=Bz*10**-4; #magnetic field in Wb/m^2\nw=w*10**-6; #thickness in m\nRH=(3*math.pi)/(8*n*e); #hall coefficient\nVH=(Bz*Ix*RH)/w; #hall voltage\nVH=VH/10**3;\nVH=math.ceil(VH*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"hall voltage in V is\",VH,\"*10**3\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "w=500; #thickness in micrometre\n",
+ "A=2.5*10**-3; #area of cross section in cm^-2\n",
+ "Ix=1; #current in ampere\n",
+ "Bz=10; #magnetic field in Wb/cm^2\n",
+ "n=10**16; #donor concentration in m^-3\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "Bz=Bz*10**-4; #magnetic field in Wb/m^2\n",
+ "w=w*10**-6; #thickness in m\n",
+ "RH=(3*math.pi)/(8*n*e); #hall coefficient\n",
+ "VH=(Bz*Ix*RH)/w; #hall voltage\n",
+ "VH=VH/10**3;\n",
+ "VH=math.ceil(VH*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"hall voltage in V is\",VH,\"*10**3\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('hall voltage in V is', 1.4727, '*10**3')\n"
+ "text": [
+ "('hall voltage in V is', 1.4727, '*10**3')\n"
+ ]
}
],
"prompt_number": 23
@@ -185,19 +417,55 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.9, Page number 271"
+ "source": [
+ "Example number 9.9, Page number 271"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To find the ratio between conductivity of intrinsic semiconductor\n\n#importing modules\nimport math\nfrom __future__ import division\nimport numpy as np\n\n#Variable declaration\nEg=1.2; #energy gap in eV\nT1=300; #temperature in K\nT2=600; #temperature in K\nk=1.38*10**-23;\n\n#Calculation\nT_1=T1**(-1);\nT_2=T2**(-1);\nT=T_1-T_2;\nEg=Eg*1.602*10**-19; #Eg in J\n#sigma_300=ni300*e*(mew_e+mew_h)\n#sigma_600=ni600*e*(mew_e+mew_h)\n#sigma_600/sigma_300 = ni600/ni300\n#ni600/ni300 =((T2/T1)**(3/2))*math.exp(-Eg/(2*k*T2))*math.exp(Eg/(2*k*T1));\n#ni600/ni300 =((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T;\n#let ni600/ni300 be X\nX=((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T);\n\n\n#Result\nprint(\"ratio between the conductivity of material is\",int(X));\n\n#answer given in the book is wrong",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "import numpy as np\n",
+ "\n",
+ "#Variable declaration\n",
+ "Eg=1.2; #energy gap in eV\n",
+ "T1=300; #temperature in K\n",
+ "T2=600; #temperature in K\n",
+ "k=1.38*10**-23;\n",
+ "\n",
+ "#Calculation\n",
+ "T_1=T1**(-1);\n",
+ "T_2=T2**(-1);\n",
+ "T=T_1-T_2;\n",
+ "Eg=Eg*1.602*10**-19; #Eg in J\n",
+ "#sigma_300=ni300*e*(mew_e+mew_h)\n",
+ "#sigma_600=ni600*e*(mew_e+mew_h)\n",
+ "#sigma_600/sigma_300 = ni600/ni300\n",
+ "#ni600/ni300 =((T2/T1)**(3/2))*math.exp(-Eg/(2*k*T2))*math.exp(Eg/(2*k*T1));\n",
+ "#ni600/ni300 =((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T;\n",
+ "#let ni600/ni300 be X\n",
+ "X=((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T);\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"ratio between the conductivity of material is\",int(X));\n",
+ "\n",
+ "#answer given in the book is wrong"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('ratio between the conductivity of material is', 311270)\n"
+ "text": [
+ "('ratio between the conductivity of material is', 311270)\n"
+ ]
}
],
"prompt_number": 25
@@ -206,19 +474,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.10, Page number 272"
+ "source": [
+ "Example number 9.10, Page number 272"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the intrinsic carrier concentration\n\n#importing modules\nimport math\n\n#Variable declaration\nsigma=10**-6; #electrical conductivity in ohm-1 m-1\nmew_e=0.85; #electron mobility in m^2/Vs\nmew_h=0.04; #hole mobility in m^2/Vs\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nni=sigma/(e*(mew_e+mew_h)); #intrinsic carrier concentration\nni=ni/10**12;\nni=math.ceil(ni*10**4)/10**4; #rounding off to 4 decimals\n\n#Result\nprint(\"intrinsic carrier concentration per m^3 is\",ni,\"*10**12\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "sigma=10**-6; #electrical conductivity in ohm-1 m-1\n",
+ "mew_e=0.85; #electron mobility in m^2/Vs\n",
+ "mew_h=0.04; #hole mobility in m^2/Vs\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "ni=sigma/(e*(mew_e+mew_h)); #intrinsic carrier concentration\n",
+ "ni=ni/10**12;\n",
+ "ni=math.ceil(ni*10**4)/10**4; #rounding off to 4 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"intrinsic carrier concentration per m^3 is\",ni,\"*10**12\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('intrinsic carrier concentration per m^3 is', 7.0225, '*10**12')\n"
+ "text": [
+ "('intrinsic carrier concentration per m^3 is', 7.0225, '*10**12')\n"
+ ]
}
],
"prompt_number": 27
@@ -227,19 +518,62 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example number 9.11, Page number 272"
+ "source": [
+ "Example number 9.11, Page number 272"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#To calculate the density of impurity atoms and concentration of minority carriers\n\n#importing modules\nimport math\n\n#Variable declaration\nrho_p=10; #resistivity of p-type Si in ohm cm\nrho_n=10; #resistivity of n-type Si in ohm cm\nmew_e=1350; #electron mobility in cm^2/Vs\nmew_h=480; #hole mobility in cm^2/Vs\nni=1.5*10**10; #carrier concentration in cm^-3\ne=1.6*10**-19; #electron charge in C\n\n#Calculation\nrho_p=rho_p*10**-2;#resistivity of p-type Si in ohm m\nsigma_p=1/rho_p; #electrical conductivity\nmew_h=mew_h*10**-3;\nNA=sigma_p/(e*mew_h); #acceptor concentration\nni=ni*10**6; #carrier concentration in m^-3\nn=ni**2/NA; #concentration of minority carriers in m^-3\nn=n/10**12;\nn=math.ceil(n*10**4)/10**4; #rounding off to 4 decimals\nrho_n=rho_n*10**-2; #resistivity of n-type Si in ohm m\nsigma_n=1/rho_n; #electrical conductivity\nmew_e=mew_e*10**-3;\nND=sigma_n/(e*mew_e); #donor concentration\np=(ni**2)/ND; #concentration of minority carriers in m^-3\np=p/10**12;\np=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n\n#Result\nprint(\"donor concentration per m^3 is\",ND);\nprint(\"concentration of minority carriers per m^3\",p,\"*10**12\");\nprint(\"acceptor concentration per m^3 is\",NA);\nprint(\"concentration of minority carriers per m^3 is\",n,\"*10**12\");",
+ "input": [
+ "\n",
+ "\n",
+ "#importing modules\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "rho_p=10; #resistivity of p-type Si in ohm cm\n",
+ "rho_n=10; #resistivity of n-type Si in ohm cm\n",
+ "mew_e=1350; #electron mobility in cm^2/Vs\n",
+ "mew_h=480; #hole mobility in cm^2/Vs\n",
+ "ni=1.5*10**10; #carrier concentration in cm^-3\n",
+ "e=1.6*10**-19; #electron charge in C\n",
+ "\n",
+ "#Calculation\n",
+ "rho_p=rho_p*10**-2;#resistivity of p-type Si in ohm m\n",
+ "sigma_p=1/rho_p; #electrical conductivity\n",
+ "mew_h=mew_h*10**-3;\n",
+ "NA=sigma_p/(e*mew_h); #acceptor concentration\n",
+ "ni=ni*10**6; #carrier concentration in m^-3\n",
+ "n=ni**2/NA; #concentration of minority carriers in m^-3\n",
+ "n=n/10**12;\n",
+ "n=math.ceil(n*10**4)/10**4; #rounding off to 4 decimals\n",
+ "rho_n=rho_n*10**-2; #resistivity of n-type Si in ohm m\n",
+ "sigma_n=1/rho_n; #electrical conductivity\n",
+ "mew_e=mew_e*10**-3;\n",
+ "ND=sigma_n/(e*mew_e); #donor concentration\n",
+ "p=(ni**2)/ND; #concentration of minority carriers in m^-3\n",
+ "p=p/10**12;\n",
+ "p=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n",
+ "\n",
+ "#Result\n",
+ "print(\"donor concentration per m^3 is\",ND);\n",
+ "print(\"concentration of minority carriers per m^3\",p,\"*10**12\");\n",
+ "print(\"acceptor concentration per m^3 is\",NA);\n",
+ "print(\"concentration of minority carriers per m^3 is\",n,\"*10**12\");"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('donor concentration per m^3 is', 4.6296296296296284e+19)\n('concentration of minority carriers per m^3', 4.861, '*10**12')\n('acceptor concentration per m^3 is', 1.3020833333333331e+20)\n('concentration of minority carriers per m^3 is', 1.7281, '*10**12')\n"
+ "text": [
+ "('donor concentration per m^3 is', 4.6296296296296284e+19)\n",
+ "('concentration of minority carriers per m^3', 4.861, '*10**12')\n",
+ "('acceptor concentration per m^3 is', 1.3020833333333331e+20)\n",
+ "('concentration of minority carriers per m^3 is', 1.7281, '*10**12')\n"
+ ]
}
],
"prompt_number": 33
@@ -247,7 +581,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb
index f6589ebe..6d38324f 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch1"
+ "name": "",
+ "signature": "sha256:2fa8b19d5030cf6dee0c92c2ee4889d5f3659cfd258460db8d8dc9ca2e443363"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,20 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "\"\"\"\nExample 1.1\n\"\"\"\nprint \"Hello, World!\\n\"\n",
+ "input": [
+ "\n",
+ "print \"Hello, World!\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n\n"
+ "text": [
+ "Hello, World!\n",
+ "\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +32,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 1.2\nprints 'hello world' with comments.\n'''\n\n# prints \"Hello, World!\":\nprint \"Hello, World!\\n\"",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"Hello, World!\":\n",
+ "print \"Hello, World!\\n\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n\n"
+ "text": [
+ "Hello, World!\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -40,14 +55,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 1.3\nanother version of hello world.\n'''\n\n# prints \"Hello, World!\":\nprint \"Hel\" + \"lo, Wo\" + \"rld!\" \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"Hello, World!\":\n",
+ "print \"Hel\" + \"lo, Wo\" + \"rld!\" \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n"
+ "text": [
+ "Hello, World!\n"
+ ]
}
],
"prompt_number": 3
@@ -55,14 +78,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "\"\"\"\nexample 1.4\nanother version of hello world.\n\"\"\"\n\n# prints \"Hello, World!\":\nprint \"Hello, W\" + 'o' + \"rld\" + '!' ",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"Hello, World!\":\n",
+ "print \"Hello, W\" + 'o' + \"rld\" + '!' "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n"
+ "text": [
+ "Hello, World!\n"
+ ]
}
],
"prompt_number": 4
@@ -70,14 +100,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.5 Inserting Numeric Literals into the Standard Output Stream\n'''\n\n# prints \"The Millennium ends Dec 31 2000.\":\nprint \"The Millennium ends Dec %d %d \" %(31,2000)",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"The Millennium ends Dec 31 2000.\":\n",
+ "print \"The Millennium ends Dec %d %d \" %(31,2000)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Millennium ends Dec 31 2000 \n"
+ "text": [
+ "The Millennium ends Dec 31 2000 \n"
+ ]
}
],
"prompt_number": 5
@@ -85,14 +122,24 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.6 Using Integer Variables\nIn this example, the integer 44 is assigned to the variable m, and the value of the expression m + 33\nis assigned to the variable n:\n'''\n# prints \"m = 44 and n = 77\":\n\nm = 44 # assigns the value 44 to the variable m\nprint \"m = %d \" % m,\nn = m + 33 # assigns the value 77 to the variable n\nprint \"and n = %d \" % n",
+ "input": [
+ "\n",
+ "# prints \"m = 44 and n = 77\":\n",
+ "\n",
+ "m = 44 # assigns the value 44 to the variable m\n",
+ "print \"m = %d \" % m,\n",
+ "n = m + 33 # assigns the value 77 to the variable n\n",
+ "print \"and n = %d \" % n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 44 and n = 77 \n"
+ "text": [
+ "m = 44 and n = 77 \n"
+ ]
}
],
"prompt_number": 6
@@ -100,14 +147,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.7 A Program's Tokens\n'''\n\n# prints \"n = 44:\nn=44\nprint \"n = %d\" % n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"n = 44:\n",
+ "n=44\n",
+ "print \"n = %d\" % n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n"
+ "text": [
+ "n = 44\n"
+ ]
}
],
"prompt_number": 7
@@ -115,14 +170,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.8 \n'''\n\n# Python does not have semicolons so wont give any errors.\nn=44\nprint \"n = %d\" % n ",
+ "input": [
+ "\n",
+ "\n",
+ "# Python does not have semicolons so wont give any errors.\n",
+ "n=44\n",
+ "print \"n = %d\" % n "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n"
+ "text": [
+ "n = 44\n"
+ ]
}
],
"prompt_number": 8
@@ -130,14 +193,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.9 Initializing Variables\nThis program contains one variable that is not initialized and one that is initialized.\nNote : This program would give you differ output then c gives.\n'''\n\n# prints \"m = ?? and n = 44\":\nm = 0 #In python we do not have declaration of variables, we just initialize it and use it.\nn=44\nprint \"m = %d and n = %d\" %(m,n)",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"m = ?? and n = 44\":\n",
+ "m = 0 #In python we do not have declaration of variables, we just initialize it and use it.\n",
+ "n=44\n",
+ "print \"m = %d and n = %d\" %(m,n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 0 and n = 44\n"
+ "text": [
+ "m = 0 and n = 44\n"
+ ]
}
],
"prompt_number": 9
@@ -145,7 +217,16 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.10 The const Specifier\nThis program illustrates constant definitions:\n'''\n\n# defines constants; has no output:\nBEEP = '\\b'\nMAXINT = 2147483647\nN = MAXINT/2\nKM_PER_MI = 1.60934\nPI = 3.14159265358979323846\n",
+ "input": [
+ "\n",
+ "\n",
+ "# defines constants; has no output:\n",
+ "BEEP = '\\b'\n",
+ "MAXINT = 2147483647\n",
+ "N = MAXINT/2\n",
+ "KM_PER_MI = 1.60934\n",
+ "PI = 3.14159265358979323846\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -154,83 +235,133 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.11 Using the Input Operator\n'''\n\n# tests the input of integers, floats, and characters:\nprint \"Enter two integers: \"\nm = int(raw_input())\nn = int(raw_input())\nprint \"m = %d , n = %d \" %(m,n)\n\nprint \"Enter three decimal numbers: \"\nx = float(raw_input())\ny = float(raw_input())\nz = float(raw_input())\n\nprint \"x = %f , y = %f , z = %f\" %(x,y,z)\n\nprint \"Enter four characters: \";\nc1 = raw_input()\nc2 = raw_input()\nc3 = raw_input()\nc4 = raw_input()\nprint \"c1 = \" + c1 + \", c2 = \" + c2 + \", c3 = \" + c3 + \", c4 = \" + c4 ",
+ "input": [
+ "\n",
+ "\n",
+ "# tests the input of integers, floats, and characters:\n",
+ "print \"Enter two integers: \"\n",
+ "m = int(raw_input())\n",
+ "n = int(raw_input())\n",
+ "print \"m = %d , n = %d \" %(m,n)\n",
+ "\n",
+ "print \"Enter three decimal numbers: \"\n",
+ "x = float(raw_input())\n",
+ "y = float(raw_input())\n",
+ "z = float(raw_input())\n",
+ "\n",
+ "print \"x = %f , y = %f , z = %f\" %(x,y,z)\n",
+ "\n",
+ "print \"Enter four characters: \";\n",
+ "c1 = raw_input()\n",
+ "c2 = raw_input()\n",
+ "c3 = raw_input()\n",
+ "c4 = raw_input()\n",
+ "print \"c1 = \" + c1 + \", c2 = \" + c2 + \", c3 = \" + c3 + \", c4 = \" + c4 "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "22\n"
+ "text": [
+ "22\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 22 , n = 44 \nEnter three decimal numbers: \n"
+ "text": [
+ "m = 22 , n = 44 \n",
+ "Enter three decimal numbers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2.2\n"
+ "text": [
+ "2.2\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4.4\n"
+ "text": [
+ "4.4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "6.6\n"
+ "text": [
+ "6.6\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 2.200000 , y = 4.400000 , z = 6.600000\nEnter four characters: \n"
+ "text": [
+ "x = 2.200000 , y = 4.400000 , z = 6.600000\n",
+ "Enter four characters: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "A\n"
+ "text": [
+ "A\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "B\n"
+ "text": [
+ "B\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "C\n"
+ "text": [
+ "C\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "D\n"
+ "text": [
+ "D\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "c1 = A, c2 = B, c3 = C, c4 = D\n"
+ "text": [
+ "c1 = A, c2 = B, c3 = C, c4 = D\n"
+ ]
}
],
"prompt_number": 11
@@ -238,7 +369,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch10.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch10.ipynb
index 4b6ac8a8..11bfc69a 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch10.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch10"
+ "name": "",
+ "signature": "sha256:80ec9afde7f244065f945a9a64c1b3fb1bcbaba0a8461385eab8b48cd3e4fc70"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.1 Implementing the Ratio Class\n'''\nclass Ratio:\n def __init__(self):\n self.num = 0\n self.den = 0\n def assign(self,n,d):\n self.num = n\n self.den = d\n def convert(self):\n return float(self.num)/self.den\n def invert(self):\n self.num,self.den = self.den,self.num\n def print_(self):\n print self.num , '/' , self.den ,\n \nx = Ratio()\nx.assign(22,7)\nprint \"x = \",\nx.print_()\nprint \" = \" , x.convert() \nx.invert()\nprint \"1/x = \",\nx.print_()\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self):\n",
+ " self.num = 0\n",
+ " self.den = 0\n",
+ " def assign(self,n,d):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def convert(self):\n",
+ " return float(self.num)/self.den\n",
+ " def invert(self):\n",
+ " self.num,self.den = self.den,self.num\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ " \n",
+ "x = Ratio()\n",
+ "x.assign(22,7)\n",
+ "print \"x = \",\n",
+ "x.print_()\n",
+ "print \" = \" , x.convert() \n",
+ "x.invert()\n",
+ "print \"1/x = \",\n",
+ "x.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 22 / 7 = 3.14285714286\n1/x = 7 / 22\n"
+ "text": [
+ "x = 22 / 7 = 3.14285714286\n",
+ "1/x = 7 / 22\n"
+ ]
}
],
"prompt_number": 1
@@ -25,7 +53,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.2 Class example\n'''\nclass Ratio:\n def __init__(self):\n self.num = 0\n self.den = 0\n def assign(self,n,d):\n self.num = n\n self.den = d\n def convert(self):\n return float(self.num)/self.den\n def invert(self):\n self.num,self.den = self.den,self.num\n def print_(self):\n print self.num , '/' , self.den ,\n",
+ "input": [
+ "class Ratio:\n",
+ " def __init__(self):\n",
+ " self.num = 0\n",
+ " self.den = 0\n",
+ " def assign(self,n,d):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def convert(self):\n",
+ " return float(self.num)/self.den\n",
+ " def invert(self):\n",
+ " self.num,self.den = self.den,self.num\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -34,14 +76,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.3\nA Constructor Function for the Ratio Class\n'''\nclass Ratio:\n def __init__(self,n,d):\n self.num = n\n self.den = d\n def print_(self):\n print self.num , '/' , self.den ,\n\nx = Ratio(-1,3)\ny = Ratio(22,7)\nprint \"x = \",\nx.print_()\nprint \" and y = \",\ny.print_()\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n,d):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ "x = Ratio(-1,3)\n",
+ "y = Ratio(22,7)\n",
+ "print \"x = \",\n",
+ "x.print_()\n",
+ "print \" and y = \",\n",
+ "y.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = -1 / 3 and y = 22 / 7\n"
+ "text": [
+ "x = -1 / 3 and y = 22 / 7\n"
+ ]
}
],
"prompt_number": 3
@@ -49,14 +108,43 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.4 Constructors to the Ratio Class\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n if n==None:\n self.num = 0\n self.den = 1\n elif d==None:\n self.num = n\n self.den = 1\n else:\n self.num = n\n self.den = d\n def print_(self):\n print self.num , '/' , self.den ,\n\nx = Ratio()\ny = Ratio(4)\nz = Ratio(22,7)\nprint \"x = \",\nx.print_()\nprint \"\\ny = \",\ny.print_()\nprint \"\\nz = \",\nz.print_()",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " if n==None:\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " elif d==None:\n",
+ " self.num = n\n",
+ " self.den = 1\n",
+ " else:\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ "x = Ratio()\n",
+ "y = Ratio(4)\n",
+ "z = Ratio(22,7)\n",
+ "print \"x = \",\n",
+ "x.print_()\n",
+ "print \"\\ny = \",\n",
+ "y.print_()\n",
+ "print \"\\nz = \",\n",
+ "z.print_()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 0 / 1 \ny = 4 / 1 \nz = 22 / 7\n"
+ "text": [
+ "x = 0 / 1 \n",
+ "y = 4 / 1 \n",
+ "z = 22 / 7\n"
+ ]
}
],
"prompt_number": 4
@@ -64,7 +152,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.5\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n if n==None:\n self.num = 0\n self.den = 1\n elif d==None:\n self.num = n\n self.den = 1\n else:\n self.num = n\n self.den = d\n def print_(self):\n print self.num , '/' , self.den ,\n\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " if n==None:\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " elif d==None:\n",
+ " self.num = n\n",
+ " self.den = 1\n",
+ " else:\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -73,7 +177,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.6 Using Default Parameter Values in the Ratio Class Constructor\n'''\n\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n def print_(self):\n print self.num , '/' , self.den ,\n\n\nx = Ratio()\ny = Ratio(4)\nz = Ratio(22,7)",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ "\n",
+ "x = Ratio()\n",
+ "y = Ratio(4)\n",
+ "z = Ratio(22,7)"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -82,14 +200,32 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.7 Access Functions in the Ratio Class\n'''\n\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n def numerator(self):\n return self.num\n def denominator(self):\n return self.den\n def print_(self):\n print self.num , '/' , self.den ,\n\n\nx = Ratio(22,7)\nprint x.numerator() , '/' , x.denominator() ",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def numerator(self):\n",
+ " return self.num\n",
+ " def denominator(self):\n",
+ " return self.den\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "print x.numerator() , '/' , x.denominator() "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "22 / 7\n"
+ "text": [
+ "22 / 7\n"
+ ]
}
],
"prompt_number": 7
@@ -97,14 +233,64 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.8\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def numerator(self):\n return self.num\n def denominator(self):\n return self.den\n def print_(self):\n print self.num , '/' , self.den ,\n\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(100,-360)\nx.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def numerator(self):\n",
+ " return self.num\n",
+ " def denominator(self):\n",
+ " return self.den\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(100,-360)\n",
+ "x.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "-5 / 18\n"
+ "text": [
+ "-5 / 18\n"
+ ]
}
],
"prompt_number": 8
@@ -112,14 +298,72 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.9 Adding a Copy Constructor to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\nclass Ratio:\n def __init__(self,n=0,d=None):\n if d == None:\n self.num = n.num\n self.den = n.den\n else: \n self.num = n\n self.den = d\n self.reduce()\n def numerator(self):\n return self.num\n def denominator(self):\n return self.den\n def print_(self):\n print self.num , '/' , self.den ,\n\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(100,360)\ny = Ratio(x)\nprint \"x = \",\nx.print_()\nprint \"y = \",\ny.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=None):\n",
+ " if d == None:\n",
+ " self.num = n.num\n",
+ " self.den = n.den\n",
+ " else: \n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def numerator(self):\n",
+ " return self.num\n",
+ " def denominator(self):\n",
+ " return self.den\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(100,360)\n",
+ "y = Ratio(x)\n",
+ "print \"x = \",\n",
+ "x.print_()\n",
+ "print \"y = \",\n",
+ "y.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 5 / 18 y = 5 / 18\n"
+ "text": [
+ "x = 5 / 18 y = 5 / 18\n"
+ ]
}
],
"prompt_number": 9
@@ -127,14 +371,74 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.10 Tracing Calls to the Copy Constructor\n'''\n'''\nEXAMPLE 10.9 Adding a Copy Constructor to the Ratio Class\n'''\n'''\nEXAMPLE 10.8\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\nclass Ratio:\n def __init__(self,n=0,d=None):\n if d == None:\n print \"COPY CONSTRUCTOR CALLED\"\n self.num = n.num\n self.den = n.den\n else: \n self.num = n\n self.den = d\n self.reduce()\n def numerator(self):\n return self.num\n def denominator(self):\n return self.den\n def print_(self):\n print self.num , '/' , self.den ,\n\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\ndef f(r):\n s = Ratio(r)\n\nx = Ratio(22,7)\ny = Ratio(x) #calls the copy constructor, copying x to y\nf(y)\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=None):\n",
+ " if d == None:\n",
+ " print \"COPY CONSTRUCTOR CALLED\"\n",
+ " self.num = n.num\n",
+ " self.den = n.den\n",
+ " else: \n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def numerator(self):\n",
+ " return self.num\n",
+ " def denominator(self):\n",
+ " return self.den\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "def f(r):\n",
+ " s = Ratio(r)\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(x) #calls the copy constructor, copying x to y\n",
+ "f(y)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "COPY CONSTRUCTOR CALLED\nCOPY CONSTRUCTOR CALLED\n"
+ "text": [
+ "COPY CONSTRUCTOR CALLED\n",
+ "COPY CONSTRUCTOR CALLED\n"
+ ]
}
],
"prompt_number": 12
@@ -142,14 +446,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.11 Including a Destructor in the Ratio Class\nNote : Python objects die when program gets exit.\n'''\n\nclass Ratio:\n def __init__(self):\n print \"OBJECT IS BORN.\"\n def __del__(self):\n print \"OBJECT DIES.\"\n\nx = Ratio()\nprint \"Now x is alive.\"\nprint \"Now between blocks.\"\ny = Ratio()\nprint \"Now y is alive.\"\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self):\n",
+ " print \"OBJECT IS BORN.\"\n",
+ " def __del__(self):\n",
+ " print \"OBJECT DIES.\"\n",
+ "\n",
+ "x = Ratio()\n",
+ "print \"Now x is alive.\"\n",
+ "print \"Now between blocks.\"\n",
+ "y = Ratio()\n",
+ "print \"Now y is alive.\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "OBJECT IS BORN.\nNow x is alive.\nNow between blocks.\nOBJECT IS BORN.\nNow y is alive.\n"
+ "text": [
+ "OBJECT IS BORN.\n",
+ "Now x is alive.\n",
+ "Now between blocks.\n",
+ "OBJECT IS BORN.\n",
+ "Now y is alive.\n"
+ ]
}
],
"prompt_number": 13
@@ -157,14 +480,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.12\n'''\nclass X:\n def __init(self):\n data = 0\n\np = X()\np.data = 22\nprint \"p.data = \" , p.data , \" = \" , p.data\np.data = 44\nprint \" p.data = \" , p.data , \" = \" , p.data ",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def __init(self):\n",
+ " data = 0\n",
+ "\n",
+ "p = X()\n",
+ "p.data = 22\n",
+ "print \"p.data = \" , p.data , \" = \" , p.data\n",
+ "p.data = 44\n",
+ "print \" p.data = \" , p.data , \" = \" , p.data "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "p.data = 22 = 22\n p.data = 44 = 44\n"
+ "text": [
+ "p.data = 22 = 22\n",
+ " p.data = 44 = 44\n"
+ ]
}
],
"prompt_number": 14
@@ -172,7 +509,27 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.13 A Node Class for Linked Lists\n'''\nclass Node:\n def __init__(self,d,q=None):\n self.data = d\n self.next = q\n\nn = int(raw_input())\nq = Node(n)\nwhile True:\n n = int(raw_input())\n if n<=0:\n break\n p = Node(n, q)\n q = p\nk = p\nwhile k != None:\n print k.data , '->' , \n k = k.next\nprint '*'\n",
+ "input": [
+ "\n",
+ "class Node:\n",
+ " def __init__(self,d,q=None):\n",
+ " self.data = d\n",
+ " self.next = q\n",
+ "\n",
+ "n = int(raw_input())\n",
+ "q = Node(n)\n",
+ "while True:\n",
+ " n = int(raw_input())\n",
+ " if n<=0:\n",
+ " break\n",
+ " p = Node(n, q)\n",
+ " q = p\n",
+ "k = p\n",
+ "while k != None:\n",
+ " print k.data , '->' , \n",
+ " k = k.next\n",
+ "print '*'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -180,48 +537,64 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "22\n"
+ "text": [
+ "22\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "66\n"
+ "text": [
+ "66\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "77 -> 66 -> 55 -> 44 -> 33 -> 22 -> *\n"
+ "text": [
+ "77 -> 66 -> 55 -> 44 -> 33 -> 22 -> *\n"
+ ]
}
],
"prompt_number": 15
@@ -229,14 +602,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.14 \nPython does not support static data type.\nPython automatically handles local variable so we need not to delete it.\n'''\ncount = 0\nclass Widget:\n def __init__(self):\n global count\n count += 1\n \nw = Widget()\nx = Widget()\nprint \"Now there are \" , count , 'widgets'\nif True:\n w = Widget()\n x = Widget()\n y = Widget()\n z = Widget()\n print \"Now there are\" , count , 'widgets' \nprint \"Now there are \" , count , 'widgets'\ny = Widget()\nprint \"Now there are \" , count , 'widgets'\n",
+ "input": [
+ "\n",
+ "count = 0\n",
+ "class Widget:\n",
+ " def __init__(self):\n",
+ " global count\n",
+ " count += 1\n",
+ " \n",
+ "w = Widget()\n",
+ "x = Widget()\n",
+ "print \"Now there are \" , count , 'widgets'\n",
+ "if True:\n",
+ " w = Widget()\n",
+ " x = Widget()\n",
+ " y = Widget()\n",
+ " z = Widget()\n",
+ " print \"Now there are\" , count , 'widgets' \n",
+ "print \"Now there are \" , count , 'widgets'\n",
+ "y = Widget()\n",
+ "print \"Now there are \" , count , 'widgets'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "OBJECT DIES.\nNow there are 2 widgets\nOBJECT DIES.\nNow there are 6 widgets\nNow there are 6 widgets\nNow there are 7 widgets\n"
+ "text": [
+ "OBJECT DIES.\n",
+ "Now there are 2 widgets\n",
+ "OBJECT DIES.\n",
+ "Now there are 6 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 7 widgets\n"
+ ]
}
],
"prompt_number": 16
@@ -244,14 +644,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.15 \n'''\ncount = 0\nclass Widget:\n def __init__(self):\n global count\n count += 1\n def numWidgets(self):\n global count\n return count\n \nw = Widget()\nx = Widget()\nprint \"Now there are \" , w.numWidgets() , 'widgets'\nif True:\n w = Widget()\n x = Widget()\n y = Widget()\n z = Widget()\n print \"Now there are\" , w.numWidgets() , 'widgets' \nprint \"Now there are \" , w.numWidgets() , 'widgets'\ny = Widget()\nprint \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "input": [
+ "\n",
+ "count = 0\n",
+ "class Widget:\n",
+ " def __init__(self):\n",
+ " global count\n",
+ " count += 1\n",
+ " def numWidgets(self):\n",
+ " global count\n",
+ " return count\n",
+ " \n",
+ "w = Widget()\n",
+ "x = Widget()\n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "if True:\n",
+ " w = Widget()\n",
+ " x = Widget()\n",
+ " y = Widget()\n",
+ " z = Widget()\n",
+ " print \"Now there are\" , w.numWidgets() , 'widgets' \n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "y = Widget()\n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Now there are 2 widgets\nNow there are 6 widgets\nNow there are 6 widgets\nNow there are 7 widgets\n"
+ "text": [
+ "Now there are 2 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 7 widgets\n"
+ ]
}
],
"prompt_number": 17
@@ -259,14 +687,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.16\n'''\ncount = 0\nclass Widget:\n def __init__(self):\n global count\n count += 1\n def numWidgets(self):\n global count\n return count\n \nw = Widget()\nx = Widget()\nprint \"Now there are \" , w.numWidgets() , 'widgets'\nif True:\n w = Widget()\n x = Widget()\n y = Widget()\n z = Widget()\n print \"Now there are\" , w.numWidgets() , 'widgets' \nprint \"Now there are \" , w.numWidgets() , 'widgets'\ny = Widget()\nprint \"Now there are \" , w.numWidgets() , 'widgets'",
+ "input": [
+ "\n",
+ "count = 0\n",
+ "class Widget:\n",
+ " def __init__(self):\n",
+ " global count\n",
+ " count += 1\n",
+ " def numWidgets(self):\n",
+ " global count\n",
+ " return count\n",
+ " \n",
+ "w = Widget()\n",
+ "x = Widget()\n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "if True:\n",
+ " w = Widget()\n",
+ " x = Widget()\n",
+ " y = Widget()\n",
+ " z = Widget()\n",
+ " print \"Now there are\" , w.numWidgets() , 'widgets' \n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "y = Widget()\n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Now there are 2 widgets\nNow there are 6 widgets\nNow there are 6 widgets\nNow there are 7 widgets\n"
+ "text": [
+ "Now there are 2 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 7 widgets\n"
+ ]
}
],
"prompt_number": 18
@@ -274,7 +730,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch11.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch11.ipynb
index 3ddc5480..34fb61dc 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch11.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch11"
+ "name": "",
+ "signature": "sha256:bdd5f9e441ccb7e3a87f4d8c5492d0aa1d228caba299fc1b0c667abb12780a1e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,7 +11,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.1\nAdding an Assignment Operator to the Ratio Class\nHere is a class interface for the Ratio class, showing the default constructor, the copy constructor,\nand the assignment operator:\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n if d==None:\n self.num = n.num\n self.den = n.den\n elif n==None:\n self.num = 0\n self.den = 1\n else:\n self.num = n\n self.den = d\n \n def equals(self):\n return self # retuns calling object.",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " if d==None:\n",
+ " self.num = n.num\n",
+ " self.den = n.den\n",
+ " elif n==None:\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " else:\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " \n",
+ " def equals(self):\n",
+ " return self # retuns calling object."
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -19,7 +36,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.2 The Preferred Prototype for an Overloaded Assignment Operator\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n pass\n \n def equals(self):\n pass\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " pass\n",
+ " \n",
+ " def equals(self):\n",
+ " pass\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -28,7 +53,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.3 Implementation of the Assignment Operator for the Ratio Class\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n if d==None:\n self.num = n.num\n self.den = n.den\n elif n==None:\n self.num = 0\n self.den = 1\n else:\n self.num = n\n self.den = d\n \n\nz = Ratio(22,7)\ny = z\nx = z\n\nx = Ratio(22,7)\ny = Ratio(x)\nz = x\nw = x",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " if d==None:\n",
+ " self.num = n.num\n",
+ " self.den = n.den\n",
+ " elif n==None:\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " else:\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " \n",
+ "\n",
+ "z = Ratio(22,7)\n",
+ "y = z\n",
+ "x = z\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(x)\n",
+ "z = x\n",
+ "w = x"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -37,7 +85,16 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.4\nmultiplication operator overload\n'''\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n def __mul__(self,y):\n pass\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def __mul__(self,y):\n",
+ " pass\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -46,14 +103,68 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.5 The Ratio Class with Assignment and Multiplication Operators\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\nx = Ratio(22,7)\ny = Ratio(-3,8)\nz = x\nz.print_()\nx = y*z\nx.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(-3,8)\n",
+ "z = x\n",
+ "z.print_()\n",
+ "x = y*z\n",
+ "x.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "22 / 7\n-33 / 28\n"
+ "text": [
+ "22 / 7\n",
+ "-33 / 28\n"
+ ]
}
],
"prompt_number": 5
@@ -61,7 +172,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.6 The Ratio Class with an Overloaded *= Operator\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n self.reduce()\n def __imul__(self,y):\n self.num = self.num * y.num\n self.den = self.den * y.den\n def print_(self):\n print self.num , '/', self.den",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __imul__(self,y):\n",
+ " self.num = self.num * y.num\n",
+ " self.den = self.den * y.den\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -70,7 +204,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.7 Overloading the Equality Operator == in the Ratio Class\n'''\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n self.reduce()\n def __imul__(self,y):\n self.num = self.num * y.num\n self.den = self.den * y.den\n def __eq__(self,y):\n return (x.num * y.den == y.num * x.den)\n def print_(self):\n print self.num , '/', self.den\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __imul__(self,y):\n",
+ " self.num = self.num * y.num\n",
+ " self.den = self.den * y.den\n",
+ " def __eq__(self,y):\n",
+ " return (x.num * y.den == y.num * x.den)\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -79,20 +229,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.8 \nPython does not use << operator for printing. So here we are just declaring function name as print_.\n'''\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n def __imul__(self,y):\n self.num = self.num * y.num\n self.den = self.den * y.den\n def __eq__(self,y):\n return (x.num * y.den == y.num * x.den)\n def print_(self):\n print self.num , '/', self.den\n\n\nx = Ratio(22,7)\ny = Ratio(-3,8)\nx.print_() , y.print_()\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def __imul__(self,y):\n",
+ " self.num = self.num * y.num\n",
+ " self.den = self.den * y.den\n",
+ " def __eq__(self,y):\n",
+ " return (x.num * y.den == y.num * x.den)\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ "\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(-3,8)\n",
+ "x.print_() , y.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "22 / 7\n-3 / 8\n"
+ "text": [
+ "22 / 7\n",
+ "-3 / 8\n"
+ ]
},
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
- "text": "(None, None)"
+ "text": [
+ "(None, None)"
+ ]
}
],
"prompt_number": 8
@@ -100,7 +274,62 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.9 \nPython does not have >> for input. so we will use input function.\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def input(self):\n self.num = int(raw_input('Numerator : '))\n self.den = int(raw_input('Denominator : '))\n self.reduce()\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\n\nx = Ratio()\ny = Ratio()\nx.input()\ny.input()\nx.print_()\ny.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def input(self):\n",
+ " self.num = int(raw_input('Numerator : '))\n",
+ " self.den = int(raw_input('Denominator : '))\n",
+ " self.reduce()\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "\n",
+ "x = Ratio()\n",
+ "y = Ratio()\n",
+ "x.input()\n",
+ "y.input()\n",
+ "x.print_()\n",
+ "y.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -108,30 +337,41 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Numerator : -10\n"
+ "text": [
+ "Numerator : -10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Denominator : -24\n"
+ "text": [
+ "Denominator : -24\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Numerator : 36\n"
+ "text": [
+ "Numerator : 36\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Denominator : -20\n"
+ "text": [
+ "Denominator : -20\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "5 / 12\n-9 / 5\n"
+ "text": [
+ "5 / 12\n",
+ "-9 / 5\n"
+ ]
}
],
"prompt_number": 1
@@ -139,14 +379,78 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.10\nAdding a Conversion Operator to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def input(self):\n self.num = int(raw_input('Numerator : '))\n self.den = int(raw_input('Denominator : '))\n self.reduce()\n def __float__(self):\n return float(self.num)/self.den\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 15.py\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(-5,8)\nprint \"x = \" , \nx.print_() \nprint \", float(x) = \" , float(x) \nP = Ratio(22,7)\nPI = float(P)\nprint \"P = \" ,\nP.print_() \nprint \", PI = \" , PI\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def input(self):\n",
+ " self.num = int(raw_input('Numerator : '))\n",
+ " self.den = int(raw_input('Denominator : '))\n",
+ " self.reduce()\n",
+ " def __float__(self):\n",
+ " return float(self.num)/self.den\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 15.py\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(-5,8)\n",
+ "print \"x = \" , \n",
+ "x.print_() \n",
+ "print \", float(x) = \" , float(x) \n",
+ "P = Ratio(22,7)\n",
+ "PI = float(P)\n",
+ "print \"P = \" ,\n",
+ "P.print_() \n",
+ "print \", PI = \" , PI\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = -5 / 8\n, float(x) = -0.625\nP = 22 / 7\n, PI = 3.14285714286\n"
+ "text": [
+ "x = -5 / 8\n",
+ ", float(x) = -0.625\n",
+ "P = 22 / 7\n",
+ ", PI = 3.14285714286\n"
+ ]
}
],
"prompt_number": 3
@@ -154,14 +458,71 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.11 Adding a Pre-Increment Operator to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def __iadd__(self,n):\n self.num += self.den\n return self\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(22,7)\nx += 1\ny = x\nprint \"y = \" ,\ny.print_()\nprint \", x = \",\nx.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def __iadd__(self,n):\n",
+ " self.num += self.den\n",
+ " return self\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "x += 1\n",
+ "y = x\n",
+ "print \"y = \" ,\n",
+ "y.print_()\n",
+ "print \", x = \",\n",
+ "x.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "y = 29 / 7\n, x = 29 / 7\n"
+ "text": [
+ "y = 29 / 7\n",
+ ", x = 29 / 7\n"
+ ]
}
],
"prompt_number": 5
@@ -169,14 +530,72 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.12 Adding a Post-Increment Operator to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def __iadd__(self,n):\n self.num += self.den\n return self\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(22,7)\ny = Ratio(x.num,x.den)\nx += 1\nprint \"y = \" ,\ny.print_()\nprint \", x = \",\nx.print_()\n\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def __iadd__(self,n):\n",
+ " self.num += self.den\n",
+ " return self\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(x.num,x.den)\n",
+ "x += 1\n",
+ "print \"y = \" ,\n",
+ "y.print_()\n",
+ "print \", x = \",\n",
+ "x.print_()\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "y = 22 / 7\n, x = 29 / 7\n"
+ "text": [
+ "y = 22 / 7\n",
+ ", x = 29 / 7\n"
+ ]
}
],
"prompt_number": 9
@@ -184,14 +603,70 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.13\nAdding a Subscript Operator to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def __getitem__(self,k):\n if k == 1:\n return self.num\n else:\n return self.den\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(22,7)\nprint \"x = \" ,\nx.print_()\nprint \"x[1] = \" , x[1] , \", x[2] = \" , x[2]\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def __getitem__(self,k):\n",
+ " if k == 1:\n",
+ " return self.num\n",
+ " else:\n",
+ " return self.den\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "print \"x = \" ,\n",
+ "x.print_()\n",
+ "print \"x[1] = \" , x[1] , \", x[2] = \" , x[2]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 22 / 7\nx[1] = 22 , x[2] = 7\n"
+ "text": [
+ "x = 22 / 7\n",
+ "x[1] = 22 , x[2] = 7\n"
+ ]
}
],
"prompt_number": 7
@@ -199,7 +674,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch12.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch12.ipynb
index 304a3ccb..2fc62abb 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch12.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch12"
+ "name": "",
+ "signature": "sha256:f377691760a60edd5db7fbe78ee867c7be9afd9802ecd81bd9e073874d13c99c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,35 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.1 A Person Class\nHere is a simple definition for a class to represent people.\n'''\nclass Person:\n def __init__(self,n=\"\",nat=\"U.S.A.\",s=1):\n self.name = n\n self.nationality = nat\n self.sex = s\n\n def printName(self):\n print self.name,\n \n def printNationality(self):\n print self.nationality,\n\ncreator = Person(\"Bjarne Stroustrup\", \"Denmark\")\nprint \"The creator of C++ was \" ,\ncreator.printName() \nprint \", who was born in \" ,\ncreator.printNationality() \n",
+ "input": [
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n=\"\",nat=\"U.S.A.\",s=1):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ "\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " \n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ "\n",
+ "creator = Person(\"Bjarne Stroustrup\", \"Denmark\")\n",
+ "print \"The creator of C++ was \" ,\n",
+ "creator.printName() \n",
+ "print \", who was born in \" ,\n",
+ "creator.printNationality() \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The creator of C++ was Bjarne Stroustrup , who was born in Denmark\n"
+ "text": [
+ "The creator of C++ was Bjarne Stroustrup , who was born in Denmark\n"
+ ]
}
],
"prompt_number": 1
@@ -25,37 +47,86 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.2 A Date Class\n'''\n\nclass Date:\n def __init__(self,m=0,d=0,y=0):\n self.month = m\n self.day = d\n self.year = y\n \n def setDate(self,m,d,y):\n self.month = m\n self.day = d\n self.year = y\n # Python doesn't have >> operator for input so we are just using input function\n def input(self):\n self.month = int(raw_input()) \n self.day = int(raw_input())\n self.year = int(raw_input()) \n \n # Python doesn't have << operator for output so we are just using print function\n def print_(self):\n monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n \"July\", \"August\",\"September\", \"October\", \"November\",\\\n \"December\"]\n print monthName[self.month] , self.day , \",\" , self.year\n\npeace = Date(11,11,1918)\nprint \"World War I ended on \" ,\npeace.print_()\npeace.setDate(8,14,1945)\nprint \"World War II ended on \" ,\npeace.print_()\nprint \"Enter month, day, and year: \"\ndate = Date()\ndate.input()\nprint \"The date is \" , \ndate.print_()\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Date:\n",
+ " def __init__(self,m=0,d=0,y=0):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " \n",
+ " def setDate(self,m,d,y):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " # Python doesn't have >> operator for input so we are just using input function\n",
+ " def input(self):\n",
+ " self.month = int(raw_input()) \n",
+ " self.day = int(raw_input())\n",
+ " self.year = int(raw_input()) \n",
+ " \n",
+ " # Python doesn't have << operator for output so we are just using print function\n",
+ " def print_(self):\n",
+ " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n",
+ " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n",
+ " \"December\"]\n",
+ " print monthName[self.month] , self.day , \",\" , self.year\n",
+ "\n",
+ "peace = Date(11,11,1918)\n",
+ "print \"World War I ended on \" ,\n",
+ "peace.print_()\n",
+ "peace.setDate(8,14,1945)\n",
+ "print \"World War II ended on \" ,\n",
+ "peace.print_()\n",
+ "print \"Enter month, day, and year: \"\n",
+ "date = Date()\n",
+ "date.input()\n",
+ "print \"The date is \" , \n",
+ "date.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "World War I ended on November 11 , 1918\nWorld War II ended on August 14 , 1945\nEnter month, day, and year: \n"
+ "text": [
+ "World War I ended on November 11 , 1918\n",
+ "World War II ended on August 14 , 1945\n",
+ "Enter month, day, and year: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1976\n"
+ "text": [
+ "1976\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The date is July 4 , 1976\n"
+ "text": [
+ "The date is July 4 , 1976\n"
+ ]
}
],
"prompt_number": 2
@@ -63,14 +134,73 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.3 Composing the Date Class with the Person Class\n'''\nclass Date:\n def __init__(self,m=0,d=0,y=0):\n self.month = m\n self.day = d\n self.year = y\n \n def setDate(self,m,d,y):\n self.month = m\n self.day = d\n self.year = y\n # Python doesn't have >> operator for input so we are just using input function\n def input(self):\n self.month = int(raw_input()) \n self.day = int(raw_input())\n self.year = int(raw_input()) \n \n # Python doesn't have << operator for output so we are just using print function\n def print_(self):\n monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n \"July\", \"August\",\"September\", \"October\", \"November\",\\\n \"December\"]\n print monthName[self.month] , self.day , \",\" , self.year\n\nclass Person:\n def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n self.name = n\n self.nationality = nat\n self.sex = s\n self.dob = Date()\n self.dod = Date()\n def setDOB(self,m,d,y):\n self.dob.setDate(m,d,y)\n def setDOD(self,m,d,y):\n self.dod.setDate(m,d,y)\n def printName(self):\n print self.name,\n def printNationality(self):\n print self.nationality,\n def printDOB(self):\n self.dob.print_()\n def printDOD(self):\n self.dod.print_()\n\nauthor = Person(\"Thomas Jefferson\", 1)\nauthor.setDOB(4,13,1743)\nauthor.setDOD(7,4,1826)\nprint \"The author of the Declaration of Independence was \",\nauthor.printName()\nprint \".\\nHe was born on \",\nauthor.printDOB()\nprint \" and died on \",\nauthor.printDOD()\n\n",
+ "input": [
+ "\n",
+ "class Date:\n",
+ " def __init__(self,m=0,d=0,y=0):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " \n",
+ " def setDate(self,m,d,y):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " # Python doesn't have >> operator for input so we are just using input function\n",
+ " def input(self):\n",
+ " self.month = int(raw_input()) \n",
+ " self.day = int(raw_input())\n",
+ " self.year = int(raw_input()) \n",
+ " \n",
+ " # Python doesn't have << operator for output so we are just using print function\n",
+ " def print_(self):\n",
+ " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n",
+ " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n",
+ " \"December\"]\n",
+ " print monthName[self.month] , self.day , \",\" , self.year\n",
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ " self.dob = Date()\n",
+ " self.dod = Date()\n",
+ " def setDOB(self,m,d,y):\n",
+ " self.dob.setDate(m,d,y)\n",
+ " def setDOD(self,m,d,y):\n",
+ " self.dod.setDate(m,d,y)\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ " def printDOB(self):\n",
+ " self.dob.print_()\n",
+ " def printDOD(self):\n",
+ " self.dod.print_()\n",
+ "\n",
+ "author = Person(\"Thomas Jefferson\", 1)\n",
+ "author.setDOB(4,13,1743)\n",
+ "author.setDOD(7,4,1826)\n",
+ "print \"The author of the Declaration of Independence was \",\n",
+ "author.printName()\n",
+ "print \".\\nHe was born on \",\n",
+ "author.printDOB()\n",
+ "print \" and died on \",\n",
+ "author.printDOD()\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The author of the Declaration of Independence was Thomas Jefferson .\nHe was born on April 13 , 1743\n and died on July 4 , 1826\n"
+ "text": [
+ "The author of the Declaration of Independence was Thomas Jefferson .\n",
+ "He was born on April 13 , 1743\n",
+ " and died on July 4 , 1826\n"
+ ]
}
],
"prompt_number": 3
@@ -78,14 +208,85 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.4 Deriving a Student Class from the Person Class\nStudents are people. So it is natural to use the Person class to derive a Student class\n'''\nclass Date:\n def __init__(self,m=0,d=0,y=0):\n self.month = m\n self.day = d\n self.year = y\n \n def setDate(self,m,d,y):\n self.month = m\n self.day = d\n self.year = y\n # Python doesn't have >> operator for input so we are just using input function\n def input(self):\n self.month = int(raw_input()) \n self.day = int(raw_input())\n self.year = int(raw_input()) \n \n # Python doesn't have << operator for output so we are just using print function\n def print_(self):\n monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n \"July\", \"August\",\"September\", \"October\", \"November\",\\\n \"December\"]\n print monthName[self.month] , self.day , \",\" , self.year\n\nclass Person:\n def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n self.name = n\n self.nationality = nat\n self.sex = s\n self.dob = Date()\n self.dod = Date()\n def setDOB(self,m,d,y):\n self.dob.setDate(m,d,y)\n def setDOD(self,m,d,y):\n self.dod.setDate(m,d,y)\n def printName(self):\n print self.name,\n def printNationality(self):\n print self.nationality,\n def printDOB(self):\n self.dob.print_()\n def printDOD(self):\n self.dod.print_()\n\nclass Student(Person):\n def __init__(self,n,s=0,i=\"\"):\n Person.__init__(self,n,s)\n self.id = i\n self.credits = 0\n self.gpa = 0\n self.dom = Date()\n\n def setDOM(self,m,d,y):\n self.dom.setDate(m, d, y)\n def printDOM(self):\n self.dom.print_()\n\nx = Student(\"Ann Jones\", 0, \"219360061\")\nx.setDOB(5, 13, 1977)\nx.setDOM(8, 29, 1995)\nx.printName()\nprint \"\\n\\t Born: \" ,\nx.printDOB()\nprint \"\\n\\tMatriculated: \",\nx.printDOM()\n",
+ "input": [
+ "\n",
+ "class Date:\n",
+ " def __init__(self,m=0,d=0,y=0):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " \n",
+ " def setDate(self,m,d,y):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " # Python doesn't have >> operator for input so we are just using input function\n",
+ " def input(self):\n",
+ " self.month = int(raw_input()) \n",
+ " self.day = int(raw_input())\n",
+ " self.year = int(raw_input()) \n",
+ " \n",
+ " # Python doesn't have << operator for output so we are just using print function\n",
+ " def print_(self):\n",
+ " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n",
+ " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n",
+ " \"December\"]\n",
+ " print monthName[self.month] , self.day , \",\" , self.year\n",
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ " self.dob = Date()\n",
+ " self.dod = Date()\n",
+ " def setDOB(self,m,d,y):\n",
+ " self.dob.setDate(m,d,y)\n",
+ " def setDOD(self,m,d,y):\n",
+ " self.dod.setDate(m,d,y)\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ " def printDOB(self):\n",
+ " self.dob.print_()\n",
+ " def printDOD(self):\n",
+ " self.dod.print_()\n",
+ "\n",
+ "class Student(Person):\n",
+ " def __init__(self,n,s=0,i=\"\"):\n",
+ " Person.__init__(self,n,s)\n",
+ " self.id = i\n",
+ " self.credits = 0\n",
+ " self.gpa = 0\n",
+ " self.dom = Date()\n",
+ "\n",
+ " def setDOM(self,m,d,y):\n",
+ " self.dom.setDate(m, d, y)\n",
+ " def printDOM(self):\n",
+ " self.dom.print_()\n",
+ "\n",
+ "x = Student(\"Ann Jones\", 0, \"219360061\")\n",
+ "x.setDOB(5, 13, 1977)\n",
+ "x.setDOM(8, 29, 1995)\n",
+ "x.printName()\n",
+ "print \"\\n\\t Born: \" ,\n",
+ "x.printDOB()\n",
+ "print \"\\n\\tMatriculated: \",\n",
+ "x.printDOM()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Ann Jones \n\t Born: May 13 , 1977\n\n\tMatriculated: August 29 , 1995\n"
+ "text": [
+ "Ann Jones \n",
+ "\t Born: May 13 , 1977\n",
+ "\n",
+ "\tMatriculated: August 29 , 1995\n"
+ ]
}
],
"prompt_number": 4
@@ -93,14 +294,95 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.5 The Person Class\n'''\nclass Date:\n def __init__(self,m=0,d=0,y=0):\n self.month = m\n self.day = d\n self.year = y\n \n def setDate(self,m,d,y):\n self.month = m\n self.day = d\n self.year = y\n # Python doesn't have >> operator for input so we are just using input function\n def input(self):\n self.month = int(raw_input()) \n self.day = int(raw_input())\n self.year = int(raw_input()) \n \n # Python doesn't have << operator for output so we are just using print function\n def print_(self):\n monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n \"July\", \"August\",\"September\", \"October\", \"November\",\\\n \"December\"]\n print monthName[self.month] , self.day , \",\" , self.year\n\nclass Person:\n def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n self.name = n\n self.nationality = nat\n self.sex = s\n self.dob = Date()\n self.dod = Date()\n def setDOB(self,m,d,y):\n self.dob.setDate(m,d,y)\n def setDOD(self,m,d,y):\n self.dod.setDate(m,d,y)\n def printName(self):\n print self.name,\n def printNationality(self):\n print self.nationality,\n def printDOB(self):\n self.dob.print_()\n def printDOD(self):\n self.dod.print_()\n\nclass Student(Person):\n def __init__(self,n,s=0,i=\"\"):\n Person.__init__(self,n,s)\n self.id = i\n self.credits = 0\n self.gpa = 0\n self.dom = Date()\n\n def setDOM(self,m,d,y):\n self.dom.setDate(m, d, y)\n def printDOM(self):\n self.dom.print_()\n def printSex(self):\n if self.sex == 1:\n print \"male\"\n else:\n print 'female'\n\nx = Student(\"Ann Jones\", 0, \"219360061\")\nx.setDOB(5, 13, 1977)\nx.setDOM(8, 29, 1995)\nx.setDOD(7,4,1826)\nx.printName()\nprint \"\\n\\t Born: \" , \nx.printDOB()\nprint \"\\n\\t Sex: \" ,\nx.printSex()\nprint \"\\n\\tMatriculated: \",\nx.printDOM()\n",
+ "input": [
+ "\n",
+ "class Date:\n",
+ " def __init__(self,m=0,d=0,y=0):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " \n",
+ " def setDate(self,m,d,y):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " # Python doesn't have >> operator for input so we are just using input function\n",
+ " def input(self):\n",
+ " self.month = int(raw_input()) \n",
+ " self.day = int(raw_input())\n",
+ " self.year = int(raw_input()) \n",
+ " \n",
+ " # Python doesn't have << operator for output so we are just using print function\n",
+ " def print_(self):\n",
+ " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n",
+ " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n",
+ " \"December\"]\n",
+ " print monthName[self.month] , self.day , \",\" , self.year\n",
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ " self.dob = Date()\n",
+ " self.dod = Date()\n",
+ " def setDOB(self,m,d,y):\n",
+ " self.dob.setDate(m,d,y)\n",
+ " def setDOD(self,m,d,y):\n",
+ " self.dod.setDate(m,d,y)\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ " def printDOB(self):\n",
+ " self.dob.print_()\n",
+ " def printDOD(self):\n",
+ " self.dod.print_()\n",
+ "\n",
+ "class Student(Person):\n",
+ " def __init__(self,n,s=0,i=\"\"):\n",
+ " Person.__init__(self,n,s)\n",
+ " self.id = i\n",
+ " self.credits = 0\n",
+ " self.gpa = 0\n",
+ " self.dom = Date()\n",
+ "\n",
+ " def setDOM(self,m,d,y):\n",
+ " self.dom.setDate(m, d, y)\n",
+ " def printDOM(self):\n",
+ " self.dom.print_()\n",
+ " def printSex(self):\n",
+ " if self.sex == 1:\n",
+ " print \"male\"\n",
+ " else:\n",
+ " print 'female'\n",
+ "\n",
+ "x = Student(\"Ann Jones\", 0, \"219360061\")\n",
+ "x.setDOB(5, 13, 1977)\n",
+ "x.setDOM(8, 29, 1995)\n",
+ "x.setDOD(7,4,1826)\n",
+ "x.printName()\n",
+ "print \"\\n\\t Born: \" , \n",
+ "x.printDOB()\n",
+ "print \"\\n\\t Sex: \" ,\n",
+ "x.printSex()\n",
+ "print \"\\n\\tMatriculated: \",\n",
+ "x.printDOM()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Ann Jones \n\t Born: May 13 , 1977\n\n\t Sex: female\n\n\tMatriculated: August 29 , 1995\n"
+ "text": [
+ "Ann Jones \n",
+ "\t Born: May 13 , 1977\n",
+ "\n",
+ "\t Sex: female\n",
+ "\n",
+ "\tMatriculated: August 29 , 1995\n"
+ ]
}
],
"prompt_number": 5
@@ -108,14 +390,51 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.6 Dominating a Data Member and Overriding a Member Function\nHere are two classes, X and Y, with Y inheriting from X.\n'''\nclass X:\n def __init__(self):\n self.a = 0\n def f(self):\n print \"X::f() executing\"\nclass Y(X):\n def __init__(self):\n self.a = 0\n def f(self):\n print \"Y::f() executing\"\nx = X()\nx.a = 22\nx.f()\nprint \"x.a = \" , x.a\ny = Y()\ny.a = 44\n# assigns 44 to the a defined in Y\ny._X__a = 66\n# assigns 66 to the a defined in X\ny.f()\n# invokes the f() defined in Y\nX.f(x)\n# invokes the f() defined in X\nprint \"y.a = \" , y.a \nprint \"y._X__a = \" , y._X__a \nz = y\nprint \"z.a = \" , z._X__a \n",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def __init__(self):\n",
+ " self.a = 0\n",
+ " def f(self):\n",
+ " print \"X::f() executing\"\n",
+ "class Y(X):\n",
+ " def __init__(self):\n",
+ " self.a = 0\n",
+ " def f(self):\n",
+ " print \"Y::f() executing\"\n",
+ "x = X()\n",
+ "x.a = 22\n",
+ "x.f()\n",
+ "print \"x.a = \" , x.a\n",
+ "y = Y()\n",
+ "y.a = 44\n",
+ "# assigns 44 to the a defined in Y\n",
+ "y._X__a = 66\n",
+ "# assigns 66 to the a defined in X\n",
+ "y.f()\n",
+ "# invokes the f() defined in Y\n",
+ "X.f(x)\n",
+ "# invokes the f() defined in X\n",
+ "print \"y.a = \" , y.a \n",
+ "print \"y._X__a = \" , y._X__a \n",
+ "z = y\n",
+ "print \"z.a = \" , z._X__a \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "X::f() executing\nx.a = 22\nY::f() executing\nX::f() executing\ny.a = 44\ny._X__a = 66\nz.a = 66\n"
+ "text": [
+ "X::f() executing\n",
+ "x.a = 22\n",
+ "Y::f() executing\n",
+ "X::f() executing\n",
+ "y.a = 44\n",
+ "y._X__a = 66\n",
+ "z.a = 66\n"
+ ]
}
],
"prompt_number": 6
@@ -123,14 +442,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.7 Parent Constructors and Destructors\nNote : Python destuctor is called when program goes exit. So output may be differ than c.\n'''\nclass X:\n def __init__(self):\n print \"X::X() constructor executing \"\n def __del__(self):\n print \"X::X() destructor executing \"\n\nclass Y(X):\n def __init__(self):\n X.__init__(self)\n print \"Y::Y() constructor executing \"\n def __del__(self):\n print \"Y::Y() destructor executing \"\n\nclass Z(Y):\n def __init__(self,i):\n Y.__init__(self)\n print \"Z::Z(\" , i , \") constructor executing \"\n def __del__(self):\n print \"Z::Z() destructor executing \"\n \n\nZ = Z(44)\n",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def __init__(self):\n",
+ " print \"X::X() constructor executing \"\n",
+ " def __del__(self):\n",
+ " print \"X::X() destructor executing \"\n",
+ "\n",
+ "class Y(X):\n",
+ " def __init__(self):\n",
+ " X.__init__(self)\n",
+ " print \"Y::Y() constructor executing \"\n",
+ " def __del__(self):\n",
+ " print \"Y::Y() destructor executing \"\n",
+ "\n",
+ "class Z(Y):\n",
+ " def __init__(self,i):\n",
+ " Y.__init__(self)\n",
+ " print \"Z::Z(\" , i , \") constructor executing \"\n",
+ " def __del__(self):\n",
+ " print \"Z::Z() destructor executing \"\n",
+ " \n",
+ "\n",
+ "Z = Z(44)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "X::X() constructor executing \nY::Y() constructor executing \nZ::Z( 44 ) constructor executing \n"
+ "text": [
+ "X::X() constructor executing \n",
+ "Y::Y() constructor executing \n",
+ "Z::Z( 44 ) constructor executing \n"
+ ]
}
],
"prompt_number": 7
@@ -138,7 +485,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.8 Parent Constructors and Destructors\nHere is a demo program that uses a base class Person and a derived class Student:\nNote : Python destuctor is called when program goes exit. So output may be differ than c.\n'''\nclass Person:\n def __init__(self,s):\n self.name = s\n def __del__(self):\n pass\n\nclass Student(Person):\n def __init__(self,s,m):\n Person.__init__(self,s)\n self.major = m\n def __del__(self):\n pass\nx = Person(\"Bob\")\ny = Student(\"Sarah\", \"Biology\")\n",
+ "input": [
+ "\n",
+ "class Person:\n",
+ " def __init__(self,s):\n",
+ " self.name = s\n",
+ " def __del__(self):\n",
+ " pass\n",
+ "\n",
+ "class Student(Person):\n",
+ " def __init__(self,s,m):\n",
+ " Person.__init__(self,s)\n",
+ " self.major = m\n",
+ " def __del__(self):\n",
+ " pass\n",
+ "x = Person(\"Bob\")\n",
+ "y = Student(\"Sarah\", \"Biology\")\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -147,7 +510,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.9\n'''\nclass Person:\n def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n self.name = n\n self.nationality = nat\n self.sex = s\n self.dob = Date()\n self.dod = Date()\n def setDOB(self,m,d,y):\n self.dob.setDate(m,d,y)\n def setDOD(self,m,d,y):\n self.dod.setDate(m,d,y)\n def printName(self):\n print self.name,\n def printNationality(self):\n print self.nationality,\n def printDOB(self):\n self.dob.print_()\n def printDOD(self):\n self.dod.print_()\n def setHSgraduate(self,g):\n self.hs = g\n def isHSgraduate(self):\n return hs\n",
+ "input": [
+ "class Person:\n",
+ " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ " self.dob = Date()\n",
+ " self.dod = Date()\n",
+ " def setDOB(self,m,d,y):\n",
+ " self.dob.setDate(m,d,y)\n",
+ " def setDOD(self,m,d,y):\n",
+ " self.dod.setDate(m,d,y)\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ " def printDOB(self):\n",
+ " self.dob.print_()\n",
+ " def printDOD(self):\n",
+ " self.dod.print_()\n",
+ " def setHSgraduate(self,g):\n",
+ " self.hs = g\n",
+ " def isHSgraduate(self):\n",
+ " return hs\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -156,14 +543,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.10 Using virtual Functions\nThis demo program declares p to be a pointer to objects of the base class X. First it assigns p to\npoint to an instance x of class X. Then it assigns p to point to an instance y of the derived class Y.\nNote : By default all methods in python are virtual. so output would be differ than c.\n'''\nclass X:\n def f(self):\n print \"X::f() executing\"\nclass Y(X):\n def f(self):\n print \"Y::f() executing\"\nx = X()\ny = Y()\np = x\np.f()\np = y\np.f()\n",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def f(self):\n",
+ " print \"X::f() executing\"\n",
+ "class Y(X):\n",
+ " def f(self):\n",
+ " print \"Y::f() executing\"\n",
+ "x = X()\n",
+ "y = Y()\n",
+ "p = x\n",
+ "p.f()\n",
+ "p = y\n",
+ "p.f()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "X::f() executing\nY::f() executing\n"
+ "text": [
+ "X::f() executing\n",
+ "Y::f() executing\n"
+ ]
}
],
"prompt_number": 10
@@ -171,14 +575,49 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.11 Polymorphism through virtual Functions\nHere is a Person class with a Student subclass and a Professor subclass:\n'''\nclass Person:\n def __init__(self,n):\n self.name = n\n def print_(self):\n print 'My name is' , self.name\n\nclass Student(Person):\n def __init__(self,s,g):\n Person.__init__(self,s)\n self.gpa = g\n def print_(self):\n print 'My name is ',self.name, ' and my G.P.A. is', self.gpa\n\nclass Professor(Person):\n def __init__(self,s,n):\n Person.__init__(self,s)\n self.publs = n\n def print_(self):\n print 'My name is ', self.name,' and i have ' , self.publs,' publications.'\n\nx = Person(\"Bob\")\np = x\np.print_()\ny = Student(\"Tom\", 3.47)\np = y\np.print_()\nz = Professor(\"Ann\", 7)\np = z\np.print_()",
+ "input": [
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n):\n",
+ " self.name = n\n",
+ " def print_(self):\n",
+ " print 'My name is' , self.name\n",
+ "\n",
+ "class Student(Person):\n",
+ " def __init__(self,s,g):\n",
+ " Person.__init__(self,s)\n",
+ " self.gpa = g\n",
+ " def print_(self):\n",
+ " print 'My name is ',self.name, ' and my G.P.A. is', self.gpa\n",
+ "\n",
+ "class Professor(Person):\n",
+ " def __init__(self,s,n):\n",
+ " Person.__init__(self,s)\n",
+ " self.publs = n\n",
+ " def print_(self):\n",
+ " print 'My name is ', self.name,' and i have ' , self.publs,' publications.'\n",
+ "\n",
+ "x = Person(\"Bob\")\n",
+ "p = x\n",
+ "p.print_()\n",
+ "y = Student(\"Tom\", 3.47)\n",
+ "p = y\n",
+ "p.print_()\n",
+ "z = Professor(\"Ann\", 7)\n",
+ "p = z\n",
+ "p.print_()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "My name is Bob\nMy name is Tom and my G.P.A. is 3.47\nMy name is Ann and i have 7 publications.\n"
+ "text": [
+ "My name is Bob\n",
+ "My name is Tom and my G.P.A. is 3.47\n",
+ "My name is Ann and i have 7 publications.\n"
+ ]
}
],
"prompt_number": 11
@@ -186,14 +625,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.12 Memory Leaks\nThis program is similar to Example 12.6:\n'''\nclass X:\n def __init__(self):\n self.p = [0,0]\n print 'X().',\n def __del__(self):\n print '~X().'\n\nclass Y(X):\n def __init__(self):\n X.__init__(self)\n self.q = []\n for i in range(1023):\n self.q.append(0)\n print 'Y() : Y::q = ', hex(id(self.q)) ,'.',\n def __del__(self):\n print '~Y().'\n\nfor i in range(8):\n r = Y()",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def __init__(self):\n",
+ " self.p = [0,0]\n",
+ " print 'X().',\n",
+ " def __del__(self):\n",
+ " print '~X().'\n",
+ "\n",
+ "class Y(X):\n",
+ " def __init__(self):\n",
+ " X.__init__(self)\n",
+ " self.q = []\n",
+ " for i in range(1023):\n",
+ " self.q.append(0)\n",
+ " print 'Y() : Y::q = ', hex(id(self.q)) ,'.',\n",
+ " def __del__(self):\n",
+ " print '~Y().'\n",
+ "\n",
+ "for i in range(8):\n",
+ " r = Y()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "X(). Y() : Y::q = 0x90d91cc . ~Y().\nX(). Y() : Y::q = 0x90c944c . ~Y().\nX(). Y() : Y::q = 0x90d91cc . ~Y().\nX(). Y() : Y::q = 0x90c944c . ~Y().\nX(). Y() : Y::q = 0x90d91cc . ~Y().\nX(). Y() : Y::q = 0x90c944c . ~Y().\nX(). Y() : Y::q = 0x90d91cc . ~Y().\nX(). Y() : Y::q = 0x90c944c . ~Y().\n"
+ "text": [
+ "X(). Y() : Y::q = 0x90d91cc . ~Y().\n",
+ "X(). Y() : Y::q = 0x90c944c . ~Y().\n",
+ "X(). Y() : Y::q = 0x90d91cc . ~Y().\n",
+ "X(). Y() : Y::q = 0x90c944c . ~Y().\n",
+ "X(). Y() : Y::q = 0x90d91cc . ~Y().\n",
+ "X(). Y() : Y::q = 0x90c944c . ~Y().\n",
+ "X(). Y() : Y::q = 0x90d91cc . ~Y().\n",
+ "X(). Y() : Y::q = 0x90c944c . ~Y().\n"
+ ]
}
],
"prompt_number": 13
@@ -201,14 +670,74 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.13 A Hierarchy of Media Classes\nHere is a hierarchy of classes to represent various media objects:\nMedia Audio Book Periodical CD Tape Record Magazine Newspaper Journal Newsletter\nThe primary ABC is the Media class:\n'''\nclass Media:\n def __init__(self):\n self.title = ''\n def print_(self):\n pass\n def id(self):\n pass\n\nclass Book(Media):\n def __init__(self,a='',t=\"\",p=\"\",i=\"\"):\n self.author = a\n self.publisher = p\n self.isbn = i\n self.title = t\n def print_(self):\n print self.title , \" by \" , self.author\n def id(self):\n return self.isbn\n\nclass CD(Media):\n def __init__(self,t=\"\",c=\"\",m=\"\",n=\"\"):\n self.composer = c\n self.make = m\n self.number = n\n self.title = t\n def print_(self):\n print self.title , \", \" , self.composer\n def id(self):\n s = str(self.make) + ' ' + str(self.number)\n return s\n\nclass Magazine(Media):\n def __init__(self,t=\"\",i=\"\",v=0, n=0):\n self.issn = i\n self.volume = v\n self.number = n\n self.title = t\n def print_(self):\n print self.title , \" Magazine, Vol. \", self.volume , \", No.\" , self.number\n def id(self):\n return self.issn\n\nbook = Book(\"Bjarne Stroustrup\", \"The C++ Programming Language\",\"Addison-Wesley\", \"0-201-53992-6\")\nmagazine = Magazine(\"TIME\", \"0040-781X\", 145, 23)\ncd = CD(\"BACH CANTATAS\", \"Johann Sebastian Bach\",\"ARCHIV\", \"D120541\")\nbook.print_()\nprint \"\\tid: \" , book.id() \nmagazine.print_()\nprint \"\\tid: \" , magazine.id() \ncd.print_()\nprint \"\\tid: \" , cd.id()",
+ "input": [
+ "\n",
+ "class Media:\n",
+ " def __init__(self):\n",
+ " self.title = ''\n",
+ " def print_(self):\n",
+ " pass\n",
+ " def id(self):\n",
+ " pass\n",
+ "\n",
+ "class Book(Media):\n",
+ " def __init__(self,a='',t=\"\",p=\"\",i=\"\"):\n",
+ " self.author = a\n",
+ " self.publisher = p\n",
+ " self.isbn = i\n",
+ " self.title = t\n",
+ " def print_(self):\n",
+ " print self.title , \" by \" , self.author\n",
+ " def id(self):\n",
+ " return self.isbn\n",
+ "\n",
+ "class CD(Media):\n",
+ " def __init__(self,t=\"\",c=\"\",m=\"\",n=\"\"):\n",
+ " self.composer = c\n",
+ " self.make = m\n",
+ " self.number = n\n",
+ " self.title = t\n",
+ " def print_(self):\n",
+ " print self.title , \", \" , self.composer\n",
+ " def id(self):\n",
+ " s = str(self.make) + ' ' + str(self.number)\n",
+ " return s\n",
+ "\n",
+ "class Magazine(Media):\n",
+ " def __init__(self,t=\"\",i=\"\",v=0, n=0):\n",
+ " self.issn = i\n",
+ " self.volume = v\n",
+ " self.number = n\n",
+ " self.title = t\n",
+ " def print_(self):\n",
+ " print self.title , \" Magazine, Vol. \", self.volume , \", No.\" , self.number\n",
+ " def id(self):\n",
+ " return self.issn\n",
+ "\n",
+ "book = Book(\"Bjarne Stroustrup\", \"The C++ Programming Language\",\"Addison-Wesley\", \"0-201-53992-6\")\n",
+ "magazine = Magazine(\"TIME\", \"0040-781X\", 145, 23)\n",
+ "cd = CD(\"BACH CANTATAS\", \"Johann Sebastian Bach\",\"ARCHIV\", \"D120541\")\n",
+ "book.print_()\n",
+ "print \"\\tid: \" , book.id() \n",
+ "magazine.print_()\n",
+ "print \"\\tid: \" , magazine.id() \n",
+ "cd.print_()\n",
+ "print \"\\tid: \" , cd.id()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The C++ Programming Language by Bjarne Stroustrup\n\tid: 0-201-53992-6\nTIME Magazine, Vol. 145 , No. 23\n\tid: 0040-781X\nBACH CANTATAS , Johann Sebastian Bach\n\tid: ARCHIV D120541\n"
+ "text": [
+ "The C++ Programming Language by Bjarne Stroustrup\n",
+ "\tid: 0-201-53992-6\n",
+ "TIME Magazine, Vol. 145 , No. 23\n",
+ "\tid: 0040-781X\n",
+ "BACH CANTATAS , Johann Sebastian Bach\n",
+ "\tid: ARCHIV D120541\n"
+ ]
}
],
"prompt_number": 14
@@ -216,7 +745,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch13.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch13.ipynb
index 827142fe..5261a124 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch13.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch13"
+ "name": "",
+ "signature": "sha256:ca23888d127466a3b56ff597f51112b17faee9e92f25f41708b3d49e2ac19a08"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,7 +11,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.1 The swap Function Template\n'''\ndef swap(x,y):\n x[0],y[0] = y[0],x[0]\n\nm = [22]\nn = [66]\nswap(m, n)\ns1 = [\"John Adams\"]\ns2 = [\"James Madison\"]\nswap(s1, s2)\nx = [22/7]\ny = [-3]\nswap(x, y)\n",
+ "input": [
+ "\n",
+ "def swap(x,y):\n",
+ " x[0],y[0] = y[0],x[0]\n",
+ "\n",
+ "m = [22]\n",
+ "n = [66]\n",
+ "swap(m, n)\n",
+ "s1 = [\"John Adams\"]\n",
+ "s2 = [\"James Madison\"]\n",
+ "swap(s1, s2)\n",
+ "x = [22/7]\n",
+ "y = [-3]\n",
+ "swap(x, y)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -19,14 +34,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.2 The Bubble Sort Template\n'''\n\ndef sort(v,n):\n for i in range(1,n):\n for j in range(n-i):\n if v[j] > v[j+1]:\n v[j],v[j+1] = v[j+1],v[j]\n\ndef print_( v,n):\n for i in range(n):\n print v[i],\n print \"\"\n \na = [55, 33, 88, 11, 44, 99, 77, 22, 66]\nprint_(a,9);\nsort(a,9)\nprint_(a,9)\ns = [\"Tom\", \"Hal\", \"Dan\", \"Bob\", \"Sue\", \"Ann\", \"Gus\"]\nprint_(s,7)\nsort(s,7)\nprint_(s,7)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def sort(v,n):\n",
+ " for i in range(1,n):\n",
+ " for j in range(n-i):\n",
+ " if v[j] > v[j+1]:\n",
+ " v[j],v[j+1] = v[j+1],v[j]\n",
+ "\n",
+ "def print_( v,n):\n",
+ " for i in range(n):\n",
+ " print v[i],\n",
+ " print \"\"\n",
+ " \n",
+ "a = [55, 33, 88, 11, 44, 99, 77, 22, 66]\n",
+ "print_(a,9);\n",
+ "sort(a,9)\n",
+ "print_(a,9)\n",
+ "s = [\"Tom\", \"Hal\", \"Dan\", \"Bob\", \"Sue\", \"Ann\", \"Gus\"]\n",
+ "print_(s,7)\n",
+ "sort(s,7)\n",
+ "print_(s,7)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "55 33 88 11 44 99 77 22 66 \n11 22 33 44 55 66 77 88 99 \nTom Hal Dan Bob Sue Ann Gus \nAnn Bob Dan Gus Hal Sue Tom \n"
+ "text": [
+ "55 33 88 11 44 99 77 22 66 \n",
+ "11 22 33 44 55 66 77 88 99 \n",
+ "Tom Hal Dan Bob Sue Ann Gus \n",
+ "Ann Bob Dan Gus Hal Sue Tom \n"
+ ]
}
],
"prompt_number": 2
@@ -34,14 +76,51 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.3 A Stack Class Template\n'''\nclass Stack:\n def __init__(self,s=100):\n self.size = s\n self.top = -1\n self.data = []\n def push(self,x):\n self.data.append( x)\n self.top += 1\n def pop(self):\n d = self.data[self.top]\n self.data.pop(self.top)\n self.top -= 1\n return d \n def isEmpty(self):\n return self.top == -1\n def isFull(self):\n return self.top==self.size-1\n \nintStack1 = Stack(5)\nintStack2 = Stack(10)\ncharStack = Stack(8)\nintStack1.push(77)\ncharStack.push('A')\nintStack2.push(22)\ncharStack.push('E')\ncharStack.push('K')\nintStack2.push(44)\nprint intStack2.pop() \nprint intStack2.pop() \nif (intStack2.isEmpty()):\n print \"intStack2 is empty.\"\n",
+ "input": [
+ "\n",
+ "class Stack:\n",
+ " def __init__(self,s=100):\n",
+ " self.size = s\n",
+ " self.top = -1\n",
+ " self.data = []\n",
+ " def push(self,x):\n",
+ " self.data.append( x)\n",
+ " self.top += 1\n",
+ " def pop(self):\n",
+ " d = self.data[self.top]\n",
+ " self.data.pop(self.top)\n",
+ " self.top -= 1\n",
+ " return d \n",
+ " def isEmpty(self):\n",
+ " return self.top == -1\n",
+ " def isFull(self):\n",
+ " return self.top==self.size-1\n",
+ " \n",
+ "intStack1 = Stack(5)\n",
+ "intStack2 = Stack(10)\n",
+ "charStack = Stack(8)\n",
+ "intStack1.push(77)\n",
+ "charStack.push('A')\n",
+ "intStack2.push(22)\n",
+ "charStack.push('E')\n",
+ "charStack.push('K')\n",
+ "intStack2.push(44)\n",
+ "print intStack2.pop() \n",
+ "print intStack2.pop() \n",
+ "if (intStack2.isEmpty()):\n",
+ " print \"intStack2 is empty.\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "44\n22\nintStack2 is empty.\n"
+ "text": [
+ "44\n",
+ "22\n",
+ "intStack2 is empty.\n"
+ ]
}
],
"prompt_number": 3
@@ -49,14 +128,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.4 A Vector Class Template\n= operator does work in python by defaultly.\n'''\nclass Vector:\n def __init__(self,n=None):\n if type(n) == int :\n self.size = n\n self.data = []\n else:\n self.size = 8\n self.data = []\n for i in range(self.size):\n self.data.append(0)\nv = Vector()\nv.data[5] = 127\nw = v\nx = Vector(3)\nprint w.size\n",
+ "input": [
+ "\n",
+ "class Vector:\n",
+ " def __init__(self,n=None):\n",
+ " if type(n) == int :\n",
+ " self.size = n\n",
+ " self.data = []\n",
+ " else:\n",
+ " self.size = 8\n",
+ " self.data = []\n",
+ " for i in range(self.size):\n",
+ " self.data.append(0)\n",
+ "v = Vector()\n",
+ "v.data[5] = 127\n",
+ "w = v\n",
+ "x = Vector(3)\n",
+ "print w.size\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
}
],
"prompt_number": 4
@@ -64,14 +162,56 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.5 A Subclass Template for Vectors\n'''\nclass Vector:\n def __init__(self,n=None):\n if type(n) == int :\n self.size = n\n self.data = []\n else:\n self.size = 8\n self.data = []\n for i in range(self.size):\n self.data.append(0)\n\nclass Array(Vector):\n def __init__(self,i,j):\n Vector.__init__(self,j-i+1)\n self.i0= i\n def __setitem__(self,k,v):\n self.data[k-self.i0] = v\n def __getitem__(self,i):\n return self.data[self.i0-i]\n def firstSubscript(self):\n return self.i0\n def lastSubscript(self):\n return self.i0+self.size-1\n\nx = Array(1,3)\nx.data[0] = 3.14159\nx.data[1] = 0.08516\nx.data[2] = 5041.92\nprint \"x.size() = \" , x.size \nprint \"x.firstSubscript() = \" , x.firstSubscript() \nprint \"x.lastSubscript() = \" , x.lastSubscript()\nfor i in range(0,3):\n print \"x[\" , i + 1 , \"] = \" , x.data[i]\n",
+ "input": [
+ "\n",
+ "class Vector:\n",
+ " def __init__(self,n=None):\n",
+ " if type(n) == int :\n",
+ " self.size = n\n",
+ " self.data = []\n",
+ " else:\n",
+ " self.size = 8\n",
+ " self.data = []\n",
+ " for i in range(self.size):\n",
+ " self.data.append(0)\n",
+ "\n",
+ "class Array(Vector):\n",
+ " def __init__(self,i,j):\n",
+ " Vector.__init__(self,j-i+1)\n",
+ " self.i0= i\n",
+ " def __setitem__(self,k,v):\n",
+ " self.data[k-self.i0] = v\n",
+ " def __getitem__(self,i):\n",
+ " return self.data[self.i0-i]\n",
+ " def firstSubscript(self):\n",
+ " return self.i0\n",
+ " def lastSubscript(self):\n",
+ " return self.i0+self.size-1\n",
+ "\n",
+ "x = Array(1,3)\n",
+ "x.data[0] = 3.14159\n",
+ "x.data[1] = 0.08516\n",
+ "x.data[2] = 5041.92\n",
+ "print \"x.size() = \" , x.size \n",
+ "print \"x.firstSubscript() = \" , x.firstSubscript() \n",
+ "print \"x.lastSubscript() = \" , x.lastSubscript()\n",
+ "for i in range(0,3):\n",
+ " print \"x[\" , i + 1 , \"] = \" , x.data[i]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x.size() = 3\nx.firstSubscript() = 1\nx.lastSubscript() = 3\nx[ 1 ] = 3.14159\nx[ 2 ] = 0.08516\nx[ 3 ] = 5041.92\n"
+ "text": [
+ "x.size() = 3\n",
+ "x.firstSubscript() = 1\n",
+ "x.lastSubscript() = 3\n",
+ "x[ 1 ] = 3.14159\n",
+ "x[ 2 ] = 0.08516\n",
+ "x[ 3 ] = 5041.92\n"
+ ]
}
],
"prompt_number": 5
@@ -79,14 +219,45 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.6 A Matrix Class Template\n'''\n\nclass Matrix:\n def __init__(self,r=1,c=1):\n self.rows = r\n self.columns = c\n self.vector = []\n for i in range(r):\n a = []\n for j in range(c):\n a.append(0)\n self.vector.append(a)\n\na = Matrix(2,3)\na.vector[0][0] = 0.0\na.vector[0][1] = 0.1\na.vector[0][2] = 0.2\na.vector[1][0] = 1.0\na.vector[1][1] = 1.1\na.vector[1][2] = 1.2\n\nprint \"The matrix a has \" , a.rows , \" rows and \", a.columns , \" columns:\"\nfor i in range(2):\n for j in range(3):\n print a.vector[i][j] ,\n print \"\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Matrix:\n",
+ " def __init__(self,r=1,c=1):\n",
+ " self.rows = r\n",
+ " self.columns = c\n",
+ " self.vector = []\n",
+ " for i in range(r):\n",
+ " a = []\n",
+ " for j in range(c):\n",
+ " a.append(0)\n",
+ " self.vector.append(a)\n",
+ "\n",
+ "a = Matrix(2,3)\n",
+ "a.vector[0][0] = 0.0\n",
+ "a.vector[0][1] = 0.1\n",
+ "a.vector[0][2] = 0.2\n",
+ "a.vector[1][0] = 1.0\n",
+ "a.vector[1][1] = 1.1\n",
+ "a.vector[1][2] = 1.2\n",
+ "\n",
+ "print \"The matrix a has \" , a.rows , \" rows and \", a.columns , \" columns:\"\n",
+ "for i in range(2):\n",
+ " for j in range(3):\n",
+ " print a.vector[i][j] ,\n",
+ " print \"\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The matrix a has 2 rows and 3 columns:\n0.0 0.1 0.2 \n1.0 1.1 1.2 \n"
+ "text": [
+ "The matrix a has 2 rows and 3 columns:\n",
+ "0.0 0.1 0.2 \n",
+ "1.0 1.1 1.2 \n"
+ ]
}
],
"prompt_number": 6
@@ -94,14 +265,38 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.7 A List Class Template\nA list consists of a linked sequence of nodes. Each node contains one data item and a link to the next\nnode. So we begin by defining a ListNode class template:\n'''\n\nfriends = []\n\n\nfriends.insert(0,\"Bowen, Van\")\nfriends.insert(0,\"Dixon, Tom\")\nfriends.insert(0,\"Mason, Joe\")\nfriends.insert(0,\"White, Ann\")\n\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\nfriends.remove('White, Ann')\nprint \"Removed: \" , 'White, Ann'\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "friends = []\n",
+ "\n",
+ "\n",
+ "friends.insert(0,\"Bowen, Van\")\n",
+ "friends.insert(0,\"Dixon, Tom\")\n",
+ "friends.insert(0,\"Mason, Joe\")\n",
+ "friends.insert(0,\"White, Ann\")\n",
+ "\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "friends.remove('White, Ann')\n",
+ "print \"Removed: \" , 'White, Ann'\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "White, Ann -> Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\nRemoved: White, Ann\nMason, Joe -> Dixon, Tom -> Bowen, Van -> *\n"
+ "text": [
+ "White, Ann -> Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\n",
+ "Removed: White, Ann\n",
+ "Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\n"
+ ]
}
],
"prompt_number": 7
@@ -109,14 +304,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.8\n'''\nfriends = []\nfriends.append(\"Bowen, Van\")\nfriends.append(\"Dixon, Tom\")\nfriends.append(\"Mason, Joe\")\nfriends.append(\"White, Ann\")\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\n\nfriends.remove(\"Mason, Joe\")\nfriends[1] = \"Davis, Jim\"\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\n\nfriends.insert(2,\"Morse, Sam\")\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\n\nfor i in range(len(friends)):\n print \"[\" ,friends[i] , \"]\" , '->' ,\nprint '*'\n",
+ "input": [
+ "\n",
+ "friends = []\n",
+ "friends.append(\"Bowen, Van\")\n",
+ "friends.append(\"Dixon, Tom\")\n",
+ "friends.append(\"Mason, Joe\")\n",
+ "friends.append(\"White, Ann\")\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "\n",
+ "friends.remove(\"Mason, Joe\")\n",
+ "friends[1] = \"Davis, Jim\"\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "\n",
+ "friends.insert(2,\"Morse, Sam\")\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "\n",
+ "for i in range(len(friends)):\n",
+ " print \"[\" ,friends[i] , \"]\" , '->' ,\n",
+ "print '*'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Bowen, Van -> Dixon, Tom -> Mason, Joe -> White, Ann -> *\nBowen, Van -> Davis, Jim -> White, Ann -> *\nBowen, Van -> Davis, Jim -> Morse, Sam -> White, Ann -> *\n[ Bowen, Van ] -> [ Davis, Jim ] -> [ Morse, Sam ] -> [ White, Ann ] -> *\n"
+ "text": [
+ "Bowen, Van -> Dixon, Tom -> Mason, Joe -> White, Ann -> *\n",
+ "Bowen, Van -> Davis, Jim -> White, Ann -> *\n",
+ "Bowen, Van -> Davis, Jim -> Morse, Sam -> White, Ann -> *\n",
+ "[ Bowen, Van ] -> [ Davis, Jim ] -> [ Morse, Sam ] -> [ White, Ann ] -> *\n"
+ ]
}
],
"prompt_number": 8
@@ -124,7 +349,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch14.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch14.ipynb
index 1618010d..6d15626d 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch14.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch14"
+ "name": "",
+ "signature": "sha256:81aae5e06fff42b82bf693bbb18c1546fd839925af34574cc2f25fff08c2a482"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,43 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.1 Using a vector of strings\n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nprint_(v)",
+ "input": [
+ "\n",
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +55,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.2 \n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nprint_(v)",
+ "input": [
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n"
+ ]
}
],
"prompt_number": 2
@@ -40,14 +98,43 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.3 \n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in range(len(v)):\n print v[i]\n\nv = []\nload(v)\nprint_(v)",
+ "input": [
+ "\n",
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in range(len(v)):\n",
+ " print v[i]\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n"
+ ]
}
],
"prompt_number": 3
@@ -55,14 +142,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.4 Using the Generic sort() Algorithm\n'''\n\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nv.sort()\nprint_(v)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "v.sort()\n",
+ "print_(v)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Chile\nEgypt\nItaly\nJapan\nKenya\nNepal\nSpain\nZaire\n"
+ "text": [
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Spain\n",
+ "Zaire\n"
+ ]
}
],
"prompt_number": 4
@@ -70,14 +187,53 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.5 Using the Assignment Operator to Duplicate a vector\n'''\n#This program demonstrates that one vector can be assigned to another.\n\n\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nw = v\nprint_(v)\nprint_(w)",
+ "input": [
+ "\n",
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "w = v\n",
+ "print_(v)\n",
+ "print_(w)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\nJapan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n",
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n"
+ ]
}
],
"prompt_number": 5
@@ -85,14 +241,59 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.6 \n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nv.sort()\nprint_(v)\nprint \"v.front() = \" + v[0]\nprint \"v.back() = \" + v.pop(-1) \nprint \"v.back() = \" + v.pop(-1) \nprint \"v.back() = \" + v[-1] \nprint_(v)",
+ "input": [
+ "\n",
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "v.sort()\n",
+ "print_(v)\n",
+ "print \"v.front() = \" + v[0]\n",
+ "print \"v.back() = \" + v.pop(-1) \n",
+ "print \"v.back() = \" + v.pop(-1) \n",
+ "print \"v.back() = \" + v[-1] \n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Chile\nEgypt\nItaly\nJapan\nKenya\nNepal\nSpain\nZaire\nv.front() = Chile\nv.back() = Zaire\nv.back() = Spain\nv.back() = Nepal\nChile\nEgypt\nItaly\nJapan\nKenya\nNepal\n"
+ "text": [
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Spain\n",
+ "Zaire\n",
+ "v.front() = Chile\n",
+ "v.back() = Zaire\n",
+ "v.back() = Spain\n",
+ "v.back() = Nepal\n",
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n"
+ ]
}
],
"prompt_number": 6
@@ -100,14 +301,52 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.7 Using the erase() Function\n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nv.sort()\nprint_(v)\nv.pop(2) # removes Italy\nv.pop(-2) # removes Spain\nprint_(v)",
+ "input": [
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "v.sort()\n",
+ "print_(v)\n",
+ "v.pop(2) # removes Italy\n",
+ "v.pop(-2) # removes Spain\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Chile\nEgypt\nItaly\nJapan\nKenya\nNepal\nSpain\nZaire\nChile\nEgypt\nJapan\nKenya\nNepal\nZaire\n"
+ "text": [
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Spain\n",
+ "Zaire\n",
+ "Chile\n",
+ "Egypt\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Zaire\n"
+ ]
}
],
"prompt_number": 7
@@ -115,14 +354,60 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.8 Using the insert() Function\n'''\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\nv = []\nload(v)\nv.sort()\nprint_(v)\nr = []\nfor i in range(2,len(v)-2):\n r.append(v[i]) #removes the segment Italy..Nepal\n \nfor i in r:\n v.remove(i)\nprint_(v)\nv.insert(2,\"India\")\nprint_(v)",
+ "input": [
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "v = []\n",
+ "load(v)\n",
+ "v.sort()\n",
+ "print_(v)\n",
+ "r = []\n",
+ "for i in range(2,len(v)-2):\n",
+ " r.append(v[i]) #removes the segment Italy..Nepal\n",
+ " \n",
+ "for i in r:\n",
+ " v.remove(i)\n",
+ "print_(v)\n",
+ "v.insert(2,\"India\")\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Chile\nEgypt\nItaly\nJapan\nKenya\nNepal\nSpain\nZaire\nChile\nEgypt\nSpain\nZaire\nChile\nEgypt\nIndia\nSpain\nZaire\n"
+ "text": [
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Spain\n",
+ "Zaire\n",
+ "Chile\n",
+ "Egypt\n",
+ "Spain\n",
+ "Zaire\n",
+ "Chile\n",
+ "Egypt\n",
+ "India\n",
+ "Spain\n",
+ "Zaire\n"
+ ]
}
],
"prompt_number": 8
@@ -130,14 +415,64 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.9 Using the find() Function\n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n v.append(\"India\")\n v.append(\"China\")\n v.append(\"Malta\")\n v.append(\"Syria\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nprint_(v)\negypt = v.index('Egypt')\nmalta = v.index('Malta')\nw = v[egypt:malta+1]\nw.sort()\nprint_(w)",
+ "input": [
+ "\n",
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ " v.append(\"India\")\n",
+ " v.append(\"China\")\n",
+ " v.append(\"Malta\")\n",
+ " v.append(\"Syria\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "print_(v)\n",
+ "egypt = v.index('Egypt')\n",
+ "malta = v.index('Malta')\n",
+ "w = v[egypt:malta+1]\n",
+ "w.sort()\n",
+ "print_(w)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\nIndia\nChina\nMalta\nSyria\nChile\nChina\nEgypt\nIndia\nKenya\nMalta\nNepal\nZaire\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n",
+ "India\n",
+ "China\n",
+ "Malta\n",
+ "Syria\n",
+ "Chile\n",
+ "China\n",
+ "Egypt\n",
+ "India\n",
+ "Kenya\n",
+ "Malta\n",
+ "Nepal\n",
+ "Zaire\n"
+ ]
}
],
"prompt_number": 9
@@ -145,14 +480,45 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.10\n'''\ndef copy(v,x,n):\n for i in x:\n v.append(i)\n\ndef projection(v,b):\n v_size = len(v)\n w = []\n for i in range(0,v_size):\n if b[i]:\n w.append(v[i])\n return w\n\ndef print_(v):\n for i in v:\n print i,\n print ''\n\nx = [ 22.2, 33.3, 44.4, 55.5, 66.6, 77.7, 88.8, 99.9 ]\nv = []\ncopy(v, x, 8)\ny = [ False, True, False, True, True, True, False, True ]\nb = []\ncopy(b, y, 8)\nw = projection(v, b)\nprint_(v)\nprint_(w)",
+ "input": [
+ "\n",
+ "def copy(v,x,n):\n",
+ " for i in x:\n",
+ " v.append(i)\n",
+ "\n",
+ "def projection(v,b):\n",
+ " v_size = len(v)\n",
+ " w = []\n",
+ " for i in range(0,v_size):\n",
+ " if b[i]:\n",
+ " w.append(v[i])\n",
+ " return w\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i,\n",
+ " print ''\n",
+ "\n",
+ "x = [ 22.2, 33.3, 44.4, 55.5, 66.6, 77.7, 88.8, 99.9 ]\n",
+ "v = []\n",
+ "copy(v, x, 8)\n",
+ "y = [ False, True, False, True, True, True, False, True ]\n",
+ "b = []\n",
+ "copy(b, y, 8)\n",
+ "w = projection(v, b)\n",
+ "print_(v)\n",
+ "print_(w)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "22.2 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n33.3 55.5 66.6 77.7 99.9 \n"
+ "text": [
+ "22.2 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n",
+ "33.3 55.5 66.6 77.7 99.9 \n"
+ ]
}
],
"prompt_number": 10
@@ -160,7 +526,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch15.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch15.ipynb
index 54f50fe3..869f8b29 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch15.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch15.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:63b02b86d37296507c195a23c5c84302645481c443c7f5e7bd4fa711e72942f7"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the rate of heat transfer per m 2 of surface area of the wall, which is 220 mm thick.\n",
"\n",
- "'''\n",
"\n",
"# Variables\n",
"t1 = 60.; \t\t\t#0C\n",
@@ -69,10 +67,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Determine the thickness of fire brick and insulation \n",
- "(ii) Calculate the heat loss \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"t1 = 1325.; \t\t\t#0C\n",
@@ -120,10 +115,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "What thickness of loosely packed rock wool insulation should be added to\n",
- "reduce the heat loss or (gain) \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"L_A = 0.1; \t\t\t#m\n",
@@ -164,10 +156,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find-\n",
- "(i) To how many millimetres of insulation brick is the air layer equivalent ?\n",
- "(ii) What is the temperature of the outer surface of the steel plate ?\n",
- "'''\n",
"\n",
"# Variables\n",
"L_A = 0.2; \t\t\t#m\n",
@@ -218,9 +206,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the heat flow rate\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"k_A = 150.; \t\t\t#W/m 0C\n",
@@ -276,11 +262,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate-\n",
- "(i) The rate of heat loss per m 2 of the tank surface area ;\n",
- "(ii) The temperature of the outside surface of the tank.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"L = 0.012; \t\t\t#m\n",
@@ -327,11 +309,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate\n",
- "(i) The rate at which heat must be removed from the interior \n",
- "(ii) The temperature on the outer surface of the metal sheet.\n",
- "'''\n",
+ "\n",
"# Variables\n",
"L_A = 0.003; \t\t\t#m\n",
"L_B = 0.05; \t\t\t#m\n",
@@ -379,12 +357,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The unknown thermal conductivity \u2018k\u2019 ;\n",
- "(ii) The overall heat transfer coefficient ;\n",
- "(iii) All surface temperatures.\n",
- "'''\n",
"\n",
"#Varaible Declaration\n",
"L_A = 0.25; \t\t#m\n",
@@ -456,9 +428,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the heat loss per metre of length\n",
- "'''\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -501,9 +471,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the rate of heat loss from 60 m length of pipe.\n",
- "'''\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -550,11 +518,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "How thick should the asbestos be provided in order to limit the heat losses to 2.1 kW/m 2 ?\n",
- "'''\n",
"\n",
- "# Variables\n",
"r1 = 0.06; \t\t\t#m\n",
"r2 = 0.08; \t\t\t#m\n",
"k_A = 42.; \t\t\t#W/m 0C\n",
@@ -596,9 +560,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the rate of heat leakage\n",
- "'''\n",
"\n",
"# Variables\n",
"r2 = 0.7; \t\t\t#m\n",
@@ -637,10 +598,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the critical thickness of insulation \n",
"\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -686,9 +644,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the rate of heat transfer\n",
- "'''\n",
"\n",
"# Variables\n",
"A = 1*1.5; \t\t\t#m**2\n",
@@ -727,9 +682,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find how much electric power must be supplied to the wire to maintain the wire surface at 120\u00b0C ?\n",
- "'''\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -772,9 +725,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the heat transfer co-efficient and the rate of heat transfer \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -825,9 +776,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the length of the tube required for developed flow.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -882,9 +831,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the area of the heat exchanger.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -934,12 +881,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find-\n",
- "(i) The rate of heat transfer,\n",
- "(ii) The mass flow rate of water, and\n",
- "(iii) The surface area of the heat exchanger.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"t_c1 = 25.; \t\t\t#0C\n",
@@ -992,9 +934,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the number of tubes required. \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1053,13 +993,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate-\n",
- "(i) Mass of cooling water circulated in kg/min,\n",
- "(ii) Condenser surface area,\n",
- "(iii) Number of tubes required per pass, and\n",
- "(iv) Tube length.\n",
- "'''\n",
+ "\n",
"\n",
"\n",
"# Variables\n",
@@ -1125,9 +1059,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the water exit temperature\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1182,12 +1114,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate-\n",
- "(i) The total rate of energy emission.\n",
- "(ii) The intensity of normal radiation, and\n",
- "(iii) The wavelength of maximum monochromatic emissive power.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1233,11 +1160,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate-\n",
- "(i) The surface temperature of the sun, and\n",
- "(ii) The heat flux at surface of the sun.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"wavelength = 0.49; \t\t\t#\u03bcm\n",
@@ -1276,14 +1199,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate-\n",
- "(i) Monochromatic emissive power \n",
- "(ii) Wavelength at which the emission is maximum,\n",
- "(iii) Maximum emissive power,\n",
- "(iv) Total emissive power, and\n",
- "(v) Total emissive power of the furnance \n",
- "'''\n",
"\n",
"import math\n",
"\n",
@@ -1345,10 +1260,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) When the body is assumed to be grey with \u03b5 = 0.42.\n",
- "(ii) When the body is not grey.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"T1 = 1273.; \t\t\t#K\n",
@@ -1395,9 +1307,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the time required for the heating operation.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1450,9 +1360,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the heat transfer rate \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"r1 = 0.05; \t\t\t#m\n",
@@ -1496,9 +1404,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the steady state temperature of cylinder surface \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"r1 = 0.05; \t\t\t#m\n",
@@ -1545,9 +1451,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the rate of evaporation of liquid air.\n",
- "'''\n",
"\n",
"# Variables\n",
"r1 = 0.105; \t\t\t#m\n",
@@ -1592,9 +1495,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Estimate the rate of heat flow by radiation to the oxygen in the container.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1639,9 +1540,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the percentage reduction when a polished aluminium shield\n",
- "'''\n",
"\n",
"# Variables\n",
"e1 = 0.3;\n",
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch16.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch16.ipynb
index 32a42e59..8e3b0a97 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch16.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch16.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:9c7b64e157d08f3c7a366b1cf2d1f4de4a886f7dc2475d29ec96bb2b10e8dc31"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the velocity of the gas \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -74,9 +73,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the pressure and the temperature \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 35.; \t\t\t#kN/m**2\n",
@@ -122,11 +119,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the sonic velocity of -\n",
- "(i) Crude oil \n",
- "(ii) Mercury \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -170,9 +163,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the speed of the plane\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -214,7 +205,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the velocity of a bullet fired \n",
+ " \n",
"\n",
"# Variables\n",
"a = 40*math.pi/180; \t\t\t#Mach angle in radians\n",
@@ -254,9 +245,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the velocity of the projectile. \n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -299,9 +287,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the speed of the aircraft \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -345,12 +331,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate-\n",
- "(i) Stagnation pressure,\n",
- "(ii) Stagnation temperature, and\n",
- "(iii) Stagnation density.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -401,10 +381,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Compute stagnation properties and the local Mach number. \n",
- "What would be the compressibility correction factor for a pitot-static tube \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -465,11 +442,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate stagnation pressure if -\n",
- "(i) Compressibility is neglected ;\n",
- "(ii) Compressibility is accounted for.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -524,9 +497,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the speed of the aircraft. \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -570,9 +541,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "What is the true speed of the aircraft ?\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -619,9 +588,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the reservoir pressure, temperature and the throat area.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -670,9 +636,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the maximum flow rate of air.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -717,9 +680,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the velocity of air flowing at the outlet of the nozzle.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"R = 287.; \t\t\t#J/kg K\n",
@@ -760,11 +721,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the mass rate of flow of air through the nozzle to the atmosphere when the pressure in the tank is-\n",
- "(i) 140 kN/m 2 (abs.),\n",
- "(ii) 300 kN/m 2\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -825,13 +782,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine-\n",
- "(i) Stagnation temperature and stagnation pressure,\n",
- "(ii) Sonic velocity and Mach number at this section,\n",
- "(iii) Velocity, Mach number and flow area at outlet section where pressure is 110 kN/m 2 ,\n",
- "(iv) Pressure, temperature, velocity and flow area at throat of the nozzle.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -927,9 +877,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the flow conditions before and after the shock wave.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -995,11 +943,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) Pressure, temperature and Mach number downstream of the shock, and\n",
- "(ii) Strength of shock.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch2.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch2.ipynb
index 606044d0..7167565e 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch2.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "CH2"
+ "name": "",
+ "signature": "sha256:6dd70c1f71cf7fe5898008fd909312cd4643245d1663bc204223830088a91083"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.1 Boolean Variables\n'''\n\n# prints the value of a boolean variable:\nflag=False\nprint \"flag = %r\" % flag\nflag = True\nprint \"flag = %r\" % flag",
+ "input": [
+ "\n",
+ "\n",
+ "# prints the value of a boolean variable:\n",
+ "flag=False\n",
+ "print \"flag = %r\" % flag\n",
+ "flag = True\n",
+ "print \"flag = %r\" % flag"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "flag = False\nflag = True\n"
+ "text": [
+ "flag = False\n",
+ "flag = True\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +37,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.2 Character Variables\n'''\n\n# prints the character and its internally stored\nc='A'\nprint \"c = \" + c + \", int(c) = %d\" % ord(c)\nc='t'\nprint \"c = \" + c + \", int(c) = %d\" % ord(c)\nc='\\t' # the tab character\nprint \"c = \" + c + \", int(c) = %d\" % ord(c)\nc='!'\nprint \"c = \" + c + \", int(c) = %d\" % ord(c)\n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints the character and its internally stored\n",
+ "c='A'\n",
+ "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n",
+ "c='t'\n",
+ "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n",
+ "c='\\t' # the tab character\n",
+ "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n",
+ "c='!'\n",
+ "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "c = A, int(c) = 65\nc = t, int(c) = 116\nc = \t, int(c) = 9\nc = !, int(c) = 33\n"
+ "text": [
+ "c = A, int(c) = 65\n",
+ "c = t, int(c) = 116\n",
+ "c = \t, int(c) = 9\n",
+ "c = !, int(c) = 33\n"
+ ]
}
],
"prompt_number": 2
@@ -40,14 +69,26 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.3 Integer Type Ranges\nThis program prints the numeric ranges of the Python\n'''\nimport sys\n# defines the constants SHRT_MIN, etc.\nprint 'maximum limit int : ',\nprint sys.maxint\nprint 'float info'\nprint sys.float_info",
+ "input": [
+ "\n",
+ "import sys\n",
+ "# defines the constants SHRT_MIN, etc.\n",
+ "print 'maximum limit int : ',\n",
+ "print sys.maxint\n",
+ "print 'float info'\n",
+ "print sys.float_info"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "maximum limit int : 2147483647\nfloat info\nsys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)\n"
+ "text": [
+ "maximum limit int : 2147483647\n",
+ "float info\n",
+ "sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)\n"
+ ]
}
],
"prompt_number": 3
@@ -55,14 +96,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.4 Integer Arithmetic\nThis example illustrates how the arithmetic operators work.\n'''\n\n# tests operators +, -, *, /, and %:\nm=54\nn=20\nprint \"m = %d and n = %d\" %(m,n)\nprint \"m+n = %d\" % (m+n) # 54+20 = 74\nprint \"m-n = %d\" % (m-n) # 54-20 = 34\nprint \"m*n = %d\" % (m*n)# 54*20 = 1080\nprint \"m/n = %d\" % (m/n) # 54/20 = 2\nprint \"m modulo by n = %d\" % (m%n) # 54%20 = 14",
+ "input": [
+ "\n",
+ "\n",
+ "# tests operators +, -, *, /, and %:\n",
+ "m=54\n",
+ "n=20\n",
+ "print \"m = %d and n = %d\" %(m,n)\n",
+ "print \"m+n = %d\" % (m+n) # 54+20 = 74\n",
+ "print \"m-n = %d\" % (m-n) # 54-20 = 34\n",
+ "print \"m*n = %d\" % (m*n)# 54*20 = 1080\n",
+ "print \"m/n = %d\" % (m/n) # 54/20 = 2\n",
+ "print \"m modulo by n = %d\" % (m%n) # 54%20 = 14"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 54 and n = 20\nm+n = 74\nm-n = 34\nm*n = 1080\nm/n = 2\nm modulo by n = 14\n"
+ "text": [
+ "m = 54 and n = 20\n",
+ "m+n = 74\n",
+ "m-n = 34\n",
+ "m*n = 1080\n",
+ "m/n = 2\n",
+ "m modulo by n = 14\n"
+ ]
}
],
"prompt_number": 4
@@ -70,14 +130,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.5 Applying the Pre-increment and Post-increment Operators\n'''\n\n# shows the difference between m++ and ++m:\nm = 44\nm += 1\nn = m\nprint \"m = %d , n = %d\" %(m,n)\nm = 44\nn = m # the post-increment operator is applied to m\nm += 1\nprint \"m = %d , n = %d\" %(m,n)\n",
+ "input": [
+ "\n",
+ "\n",
+ "# shows the difference between m++ and ++m:\n",
+ "m = 44\n",
+ "m += 1\n",
+ "n = m\n",
+ "print \"m = %d , n = %d\" %(m,n)\n",
+ "m = 44\n",
+ "n = m # the post-increment operator is applied to m\n",
+ "m += 1\n",
+ "print \"m = %d , n = %d\" %(m,n)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 45 , n = 45\nm = 45 , n = 44\n"
+ "text": [
+ "m = 45 , n = 45\n",
+ "m = 45 , n = 44\n"
+ ]
}
],
"prompt_number": 5
@@ -85,14 +160,37 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.6 Applying Composite Arithmetic Assignment Operators\n'''\n\n# tests arithmetic assignment operators:\nn=22\nprint \"n = %d\" % n\nn += 9 # adds 9 to n\nprint \"After n += 9, n = %d\" % n\nn -= 5 # subtracts 5 from n\nprint \"After n -= 5, n = %d\" % n\nn *= 2 # multiplies n by 3\nprint \"After n *= 2, n = %d\" % n \nn /= 3 # divides n by 9\nprint \"After n /= 3, n = %d\" % n \nn %= 7 # reduces n to the remainder from dividing by 4\nprint 'After n modulo by 7 n = %d' %n",
+ "input": [
+ "\n",
+ "\n",
+ "# tests arithmetic assignment operators:\n",
+ "n=22\n",
+ "print \"n = %d\" % n\n",
+ "n += 9 # adds 9 to n\n",
+ "print \"After n += 9, n = %d\" % n\n",
+ "n -= 5 # subtracts 5 from n\n",
+ "print \"After n -= 5, n = %d\" % n\n",
+ "n *= 2 # multiplies n by 3\n",
+ "print \"After n *= 2, n = %d\" % n \n",
+ "n /= 3 # divides n by 9\n",
+ "print \"After n /= 3, n = %d\" % n \n",
+ "n %= 7 # reduces n to the remainder from dividing by 4\n",
+ "print 'After n modulo by 7 n = %d' %n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 22\nAfter n += 9, n = 31\nAfter n -= 5, n = 26\nAfter n *= 2, n = 52\nAfter n /= 3, n = 17\nAfter n modulo by 7 n = 3\n"
+ "text": [
+ "n = 22\n",
+ "After n += 9, n = 31\n",
+ "After n -= 5, n = 26\n",
+ "After n *= 2, n = 52\n",
+ "After n /= 3, n = 17\n",
+ "After n modulo by 7 n = 3\n"
+ ]
}
],
"prompt_number": 6
@@ -100,14 +198,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.7 Floating-Point Arithmetic\nThis program is nearly the same as the one in Example 2.4. The important difference is that these\nvariables are declared to have the floating-point type double instead of the integer type int.\n'''\n\n# tests the floating-point operators +, -, *, and /:\nx=54.0\ny=20.0\nprint \"x = %f and y = %f\" %(x,y)\nprint \"x+y = %f\" %(x+y) # 54.0+20.0 = 74.0\nprint \"x-y = %f\" % (x-y) # 54.0-20.0 = 34.0\nprint \"x*y = %f\" %( x*y) # 54.0*20.0 = 1080.0\nprint \"x/y = %f\" % (x/y) # 54.0/20.0 = 2.7\n",
+ "input": [
+ "\n",
+ "\n",
+ "# tests the floating-point operators +, -, *, and /:\n",
+ "x=54.0\n",
+ "y=20.0\n",
+ "print \"x = %f and y = %f\" %(x,y)\n",
+ "print \"x+y = %f\" %(x+y) # 54.0+20.0 = 74.0\n",
+ "print \"x-y = %f\" % (x-y) # 54.0-20.0 = 34.0\n",
+ "print \"x*y = %f\" %( x*y) # 54.0*20.0 = 1080.0\n",
+ "print \"x/y = %f\" % (x/y) # 54.0/20.0 = 2.7\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 54.000000 and y = 20.000000\nx+y = 74.000000\nx-y = 34.000000\nx*y = 1080.000000\nx/y = 2.700000\n"
+ "text": [
+ "x = 54.000000 and y = 20.000000\n",
+ "x+y = 74.000000\n",
+ "x-y = 34.000000\n",
+ "x*y = 1080.000000\n",
+ "x/y = 2.700000\n"
+ ]
}
],
"prompt_number": 7
@@ -115,14 +230,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.8 Using the sizeof Operator\nThis program tells you how much space each of the undamental types uses:\nNote : Python has few number of data types so output would be differ.\n'''\nimport sys\n# prints the storage sizes of the fundamental types:\nprint \"Number of bytes used:\\n\"\n\nprint \" char: %d \" % sys.getsizeof('a')\nprint \" int : %d \" % sys.getsizeof(int(1))\nprint \" string : %d \" % sys.getsizeof(str('hellololdei'))\nprint \"float : %d\" % sys.getsizeof(float(1.1))",
+ "input": [
+ "\n",
+ "import sys\n",
+ "# prints the storage sizes of the fundamental types:\n",
+ "print \"Number of bytes used:\\n\"\n",
+ "\n",
+ "print \" char: %d \" % sys.getsizeof('a')\n",
+ "print \" int : %d \" % sys.getsizeof(int(1))\n",
+ "print \" string : %d \" % sys.getsizeof(str('hellololdei'))\n",
+ "print \"float : %d\" % sys.getsizeof(float(1.1))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Number of bytes used:\n\n char: 22 \n int : 12 \n string : 32 \nfloat : 16\n"
+ "text": [
+ "Number of bytes used:\n",
+ "\n",
+ " char: 22 \n",
+ " int : 12 \n",
+ " string : 32 \n",
+ "float : 16\n"
+ ]
}
],
"prompt_number": 8
@@ -130,14 +262,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.9 Reading from the <cfloat> Header File\nThis program tells you the precision and magnitude range that the float type has on your system:\n'''\nimport sys\n# prints the storage sizes of the fundamental types:\nfbits = 8*sys.getsizeof(float(123))\n\n# each byte contains 8 bits\nprint \"float uses : %d bits:\\n\\t\" % fbits \n",
+ "input": [
+ "\n",
+ "import sys\n",
+ "# prints the storage sizes of the fundamental types:\n",
+ "fbits = 8*sys.getsizeof(float(123))\n",
+ "\n",
+ "# each byte contains 8 bits\n",
+ "print \"float uses : %d bits:\\n\\t\" % fbits \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "float uses : 128 bits:\n\t\n"
+ "text": [
+ "float uses : 128 bits:\n",
+ "\t\n"
+ ]
}
],
"prompt_number": 9
@@ -145,14 +288,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nThis program casts a double value into int value:\n'''\n\n# casts a double value as an int:\nv = 1234.56789\nn = int(v);\nprint \"v = %f, n = %d\" %(v,n)",
+ "input": [
+ "\n",
+ "\n",
+ "# casts a double value as an int:\n",
+ "v = 1234.56789\n",
+ "n = int(v);\n",
+ "print \"v = %f, n = %d\" %(v,n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "v = 1234.567890, n = 1234\n"
+ "text": [
+ "v = 1234.567890, n = 1234\n"
+ ]
}
],
"prompt_number": 10
@@ -160,14 +312,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.11 Promotion of Types\nThis program promotes a char to a short to an int to a float to a double:\nNote : Python is type independent. So would give output differ.\n'''\n# prints promoted vales of 65 from char to double:\nc='A'\nprint \"char c = \" + c\nk=c;\nprint \"k = \" + k \nm=k;\nprint \"m = \" + m \nn=m\nprint \"n = \" + n\nx=m\nprint \"x = \" + x \ny=x\nprint \"y = \" + y",
+ "input": [
+ "\n",
+ "# prints promoted vales of 65 from char to double:\n",
+ "c='A'\n",
+ "print \"char c = \" + c\n",
+ "k=c;\n",
+ "print \"k = \" + k \n",
+ "m=k;\n",
+ "print \"m = \" + m \n",
+ "n=m\n",
+ "print \"n = \" + n\n",
+ "x=m\n",
+ "print \"x = \" + x \n",
+ "y=x\n",
+ "print \"y = \" + y"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "char c = A\nk = A\nm = A\nn = A\nx = A\ny = A\n"
+ "text": [
+ "char c = A\n",
+ "k = A\n",
+ "m = A\n",
+ "n = A\n",
+ "x = A\n",
+ "y = A\n"
+ ]
}
],
"prompt_number": 11
@@ -175,14 +349,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.12 Integer Overflow\nThis program repeatedly multiplies n by 1000 until it overflows.\n'''\n# prints n until it overflows:\nn=1000\nprint \"n = %d\" % n\nn *= 1000 # multiplies n by 1000\nprint \"n = %d\" % n\nn *= 1000 # multiplies n by 1000\nprint \"n = %d\" % n\nn *= 1000 # multiplies n by 1000\nprint \"n = %d\" % n\n",
+ "input": [
+ "\n",
+ "# prints n until it overflows:\n",
+ "n=1000\n",
+ "print \"n = %d\" % n\n",
+ "n *= 1000 # multiplies n by 1000\n",
+ "print \"n = %d\" % n\n",
+ "n *= 1000 # multiplies n by 1000\n",
+ "print \"n = %d\" % n\n",
+ "n *= 1000 # multiplies n by 1000\n",
+ "print \"n = %d\" % n\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 1000\nn = 1000000\nn = 1000000000\nn = 1000000000000\n"
+ "text": [
+ "n = 1000\n",
+ "n = 1000000\n",
+ "n = 1000000000\n",
+ "n = 1000000000000\n"
+ ]
}
],
"prompt_number": 12
@@ -190,14 +380,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.13 Floating-point Overflow\nThis program is similar to the one in Example 2.12. It repeatedly squares x until it overflows.\n'''\n\n# prints x until it overflows:\nx=1000.0\nprint \"x = %f\" % x\nx *= x # multiplies n by itself; i.e., it squares x\nprint \"x = %f\" % x\nx *= x # multiplies n by itself; i.e., it squares x\nprint \"x = %f\" % x\nx *= x # multiplies n by itself; i.e., it squares x\nprint \"x = %f\" % x\nx *= x # multiplies n by itself; i.e., it squares x\nprint \"x = %f\" % x\n",
+ "input": [
+ "\n",
+ "# prints x until it overflows:\n",
+ "x=1000.0\n",
+ "print \"x = %f\" % x\n",
+ "x *= x # multiplies n by itself; i.e., it squares x\n",
+ "print \"x = %f\" % x\n",
+ "x *= x # multiplies n by itself; i.e., it squares x\n",
+ "print \"x = %f\" % x\n",
+ "x *= x # multiplies n by itself; i.e., it squares x\n",
+ "print \"x = %f\" % x\n",
+ "x *= x # multiplies n by itself; i.e., it squares x\n",
+ "print \"x = %f\" % x\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 1000.000000\nx = 1000000.000000\nx = 1000000000000.000000\nx = 999999999999999983222784.000000\nx = 1000000000000000043845843045076197354634047651840.000000\n"
+ "text": [
+ "x = 1000.000000\n",
+ "x = 1000000.000000\n",
+ "x = 1000000000000.000000\n",
+ "x = 999999999999999983222784.000000\n",
+ "x = 1000000000000000043845843045076197354634047651840.000000\n"
+ ]
}
],
"prompt_number": 13
@@ -205,14 +414,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.14 Round-off Error\nThis program does some simple arithmetic to illustrate roundoff error:\n'''\n\n# illustrates round-off error::\nx = 1000/3.0\nprint \"x = %f\" %x # x = 1000/3\ny = x - 333.0\nprint \"y = %f\" % y # y = 1/3\nz = 3*y - 1.0\nprint \"z = %f\" %z # z = 3(1/3) - 1\nif (z == 0):\n print \"z == 0.\\n\"\nelse:\n print \"z does not equal 0.\\n\" # z != 0\n",
+ "input": [
+ "\n",
+ "\n",
+ "# illustrates round-off error::\n",
+ "x = 1000/3.0\n",
+ "print \"x = %f\" %x # x = 1000/3\n",
+ "y = x - 333.0\n",
+ "print \"y = %f\" % y # y = 1/3\n",
+ "z = 3*y - 1.0\n",
+ "print \"z = %f\" %z # z = 3(1/3) - 1\n",
+ "if (z == 0):\n",
+ " print \"z == 0.\\n\"\n",
+ "else:\n",
+ " print \"z does not equal 0.\\n\" # z != 0\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 333.333333\ny = 0.333333\nz = -0.000000\nz does not equal 0.\n\n"
+ "text": [
+ "x = 333.333333\n",
+ "y = 0.333333\n",
+ "z = -0.000000\n",
+ "z does not equal 0.\n",
+ "\n"
+ ]
}
],
"prompt_number": 14
@@ -220,7 +449,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.15 Hidden Round-off Error\nThis program implements the quadratic formula to solve quadratic equations.\n'''\nimport math\n\n# implements the quadratic formula\na = float(raw_input(\"Enter the coefficients of a quadratic equation:\\n a : \"))\nb = float(raw_input('b : '))\nc = float(raw_input('c : '))\n\nprint \"The equation is: \",\nprint a,\nprint \"*x*x + \",\nprint b,\nprint \"*x + \" ,\nprint c,\nprint \" = 0\" \n\nd = b*b - 4*a*c # discriminant\nsqrtd = math.sqrt(d)\nx1 = (-b + sqrtd)/(2*a)\nx2 = (-b - sqrtd)/(2*a)\nprint \"The solutions are:\"\nprint \"\\tx1 = %f\" % x1\nprint \"\\tx2 = %f\" % x2\nprint \"Check:\" \nprint \"\\ta*x1*x1 + b*x1 + c = %f\" %( a*x1*x1 + b*x1 + c)\nprint \"\\ta*x2*x2 + b*x2 + c = %f\" %( a*x2*x2 + b*x2 + c)\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "# implements the quadratic formula\n",
+ "a = float(raw_input(\"Enter the coefficients of a quadratic equation:\\n a : \"))\n",
+ "b = float(raw_input('b : '))\n",
+ "c = float(raw_input('c : '))\n",
+ "\n",
+ "print \"The equation is: \",\n",
+ "print a,\n",
+ "print \"*x*x + \",\n",
+ "print b,\n",
+ "print \"*x + \" ,\n",
+ "print c,\n",
+ "print \" = 0\" \n",
+ "\n",
+ "d = b*b - 4*a*c # discriminant\n",
+ "sqrtd = math.sqrt(d)\n",
+ "x1 = (-b + sqrtd)/(2*a)\n",
+ "x2 = (-b - sqrtd)/(2*a)\n",
+ "print \"The solutions are:\"\n",
+ "print \"\\tx1 = %f\" % x1\n",
+ "print \"\\tx2 = %f\" % x2\n",
+ "print \"Check:\" \n",
+ "print \"\\ta*x1*x1 + b*x1 + c = %f\" %( a*x1*x1 + b*x1 + c)\n",
+ "print \"\\ta*x2*x2 + b*x2 + c = %f\" %( a*x2*x2 + b*x2 + c)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -228,24 +484,39 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter the coefficients of a quadratic equation:\n a : 2\n"
+ "text": [
+ "Enter the coefficients of a quadratic equation:\n",
+ " a : 2\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "b : 1\n"
+ "text": [
+ "b : 1\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "c : -3\n"
+ "text": [
+ "c : -3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The equation is: 2.0 *x*x + 1.0 *x + -3.0 = 0\nThe solutions are:\n\tx1 = 1.000000\n\tx2 = -1.500000\nCheck:\n\ta*x1*x1 + b*x1 + c = 0.000000\n\ta*x2*x2 + b*x2 + c = 0.000000\n"
+ "text": [
+ "The equation is: 2.0 *x*x + 1.0 *x + -3.0 = 0\n",
+ "The solutions are:\n",
+ "\tx1 = 1.000000\n",
+ "\tx2 = -1.500000\n",
+ "Check:\n",
+ "\ta*x1*x1 + b*x1 + c = 0.000000\n",
+ "\ta*x2*x2 + b*x2 + c = 0.000000\n"
+ ]
}
],
"prompt_number": 15
@@ -253,7 +524,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.17 Scientific Format\nThis program shows how floating-point values may be input in scientific format:\n'''\n\n# prints double values in scientific e-format:\nx = float(raw_input(\"Enter float: \"))\nprint \"Its reciprocal is: \",\nprint 1/x ",
+ "input": [
+ "\n",
+ "\n",
+ "# prints double values in scientific e-format:\n",
+ "x = float(raw_input(\"Enter float: \"))\n",
+ "print \"Its reciprocal is: \",\n",
+ "print 1/x "
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -261,12 +539,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter float: 234.567e89\n"
+ "text": [
+ "Enter float: 234.567e89\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Its reciprocal is: 4.2631742743e-92\n"
+ "text": [
+ "Its reciprocal is: 4.2631742743e-92\n"
+ ]
}
],
"prompt_number": 16
@@ -274,7 +556,19 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.18 Scope of Variables\nNOte : Python does not have variable scopes. Once variable is declared then it stays live until program gets exit.\nso it wont give any errors.\n\n'''\n# illustrates the scope of variables:\nx = 11\n# ERROR: this is not in the scope of x\nif True:\n x = 22 # OK: this is in the scope of x\n y = 33 # ERROR: this is not in the scope of y\n x = 44 # OK: this is in the scope of x\n y = 55 # OK: this is in the scope of y\nx = 66 # OK: this is in the scope of x\ny = 77 # ERROR: this is not in the scope of y\n",
+ "input": [
+ "\n",
+ "# illustrates the scope of variables:\n",
+ "x = 11\n",
+ "# ERROR: this is not in the scope of x\n",
+ "if True:\n",
+ " x = 22 # OK: this is in the scope of x\n",
+ " y = 33 # ERROR: this is not in the scope of y\n",
+ " x = 44 # OK: this is in the scope of x\n",
+ " y = 55 # OK: this is in the scope of y\n",
+ "x = 66 # OK: this is in the scope of x\n",
+ "y = 77 # ERROR: this is not in the scope of y\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -283,14 +577,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.19 Nested and Parallel Scopes\nNOte : Python does not have variable scopes. Once variable is declared then it stays live until program gets exit.\nso output would be differ.\n'''\n# this x is global\nx = 11\n\nif True:\n # illustrates the nested and parallel scopes:\n x = 22\n # begin scope of internal block\n if True:\n x = 33\n print \"In block inside main(): x = %d \" % x\n # end scope of internal block\nprint \"In main(): x = %d\" %x \nprint \"In main(): x = %d \"% x",
+ "input": [
+ "\n",
+ "# this x is global\n",
+ "x = 11\n",
+ "\n",
+ "if True:\n",
+ " # illustrates the nested and parallel scopes:\n",
+ " x = 22\n",
+ " # begin scope of internal block\n",
+ " if True:\n",
+ " x = 33\n",
+ " print \"In block inside main(): x = %d \" % x\n",
+ " # end scope of internal block\n",
+ "print \"In main(): x = %d\" %x \n",
+ "print \"In main(): x = %d \"% x"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "In block inside main(): x = 33 \nIn main(): x = 33\nIn main(): x = 33 \n"
+ "text": [
+ "In block inside main(): x = 33 \n",
+ "In main(): x = 33\n",
+ "In main(): x = 33 \n"
+ ]
}
],
"prompt_number": 18
@@ -298,7 +611,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch3.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch3.ipynb
index 8a41802e..577b8d76 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch3.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch3"
+ "name": "",
+ "signature": "sha256:0e3c85fb42769559f9f8805f3e4d4314b9161e1f9e7c2177b9fdd0a81efd83fb"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,31 +11,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.1 Testing for Divisibility\nThis program tests if one positive integer is not divisible by another:\n'''\n\nprint \"Enter two positive integers: \";\nn = int(raw_input())\nd = int(raw_input())\nif (n%d):\n print \"%d is not divisible by %d\" %(n,d)",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter two positive integers: \";\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "if (n%d):\n",
+ " print \"%d is not divisible by %d\" %(n,d)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two positive integers: \n"
+ "text": [
+ "Enter two positive integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "66\n"
+ "text": [
+ "66\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "66 is not divisible by 7\n"
+ "text": [
+ "66 is not divisible by 7\n"
+ ]
}
],
"prompt_number": 1
@@ -42,31 +59,48 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.2 Testing for Divisibility Again\nThis program is the same as the program in Example 3.1 except that the if statement has been replaced\nby an if..else statement:\n'''\nprint \"Enter two positive integers: \";\nn = int(raw_input())\nd = int(raw_input())\nif (n%d):\n print \"%d is not divisible by %d\" %(n,d)\nelse:\n print \"%d is divisible by %d\" %(n,d)\n",
+ "input": [
+ "\n",
+ "print \"Enter two positive integers: \";\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "if (n%d):\n",
+ " print \"%d is not divisible by %d\" %(n,d)\n",
+ "else:\n",
+ " print \"%d is divisible by %d\" %(n,d)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two positive integers: \n"
+ "text": [
+ "Enter two positive integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "56\n"
+ "text": [
+ "56\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "56 is divisible by 7\n"
+ "text": [
+ "56 is divisible by 7\n"
+ ]
}
],
"prompt_number": 2
@@ -74,31 +108,50 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.3 The Minimum of Two Integers\nThis program prints the minimum of the two integers entered:\n'''\n\nprint \"Enter two integers: \"\nm = int(raw_input())\nn = int(raw_input())\n\nif (m < n):\n print \"%d is the minimum.\" %m\nelse:\n print \"%d is the minimum.\" %n\n\n",
+ "input": [
+ "\n",
+ "print \"Enter two integers: \"\n",
+ "m = int(raw_input())\n",
+ "n = int(raw_input())\n",
+ "\n",
+ "if (m < n):\n",
+ " print \"%d is the minimum.\" %m\n",
+ "else:\n",
+ " print \"%d is the minimum.\" %n\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "55 is the minimum.\n"
+ "text": [
+ "55 is the minimum.\n"
+ ]
}
],
"prompt_number": 3
@@ -106,7 +159,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.4 A Common Programming Error\nThis program is erroneous:\n'''\nprint \"Enter an integer: \"\nn = int(raw_input())\nif (n = 22):\n print \"%d = 22\" %n\nelse: \n print \"%d != 22\" %n",
+ "input": [
+ "\n",
+ "print \"Enter an integer: \"\n",
+ "n = int(raw_input())\n",
+ "if (n = 22):\n",
+ " print \"%d = 22\" %n\n",
+ "else: \n",
+ " print \"%d != 22\" %n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -124,37 +185,61 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.5 The Minimum of Three Integers\nThis program is similar to the one in Example 3.3 except that it applies to three integers:\n'''\nprint \"Enter three integers: \"\nn1 = int(raw_input())\nn2 = int(raw_input())\nn3 = int(raw_input())\n\nm=n1\n# now min <= n1\nif (n2 < m):\n m = n2 # now min <= n1 and min <= n2\nif (n3 < m):\n m = n3 # now min <= n1, min <= n2, and min <= n3\nprint \"Their minimum is %d\" % m",
+ "input": [
+ "\n",
+ "print \"Enter three integers: \"\n",
+ "n1 = int(raw_input())\n",
+ "n2 = int(raw_input())\n",
+ "n3 = int(raw_input())\n",
+ "\n",
+ "m=n1\n",
+ "# now min <= n1\n",
+ "if (n2 < m):\n",
+ " m = n2 # now min <= n1 and min <= n2\n",
+ "if (n3 < m):\n",
+ " m = n3 # now min <= n1, min <= n2, and min <= n3\n",
+ "print \"Their minimum is %d\" % m"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter three integers: \n"
+ "text": [
+ "Enter three integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Their minimum is 33\n"
+ "text": [
+ "Their minimum is 33\n"
+ ]
}
],
"prompt_number": 5
@@ -162,31 +247,53 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.6 A Statement Block within an if Statement\nThis program inputs two integers and then outputs them in increasing order:\n'''\n\nprint \"Enter two integers: \"\nx = int(raw_input())\ny = int(raw_input())\n\nif (x > y):\n temp=x\n x = y\n y = temp\n \n\nprint \"%d <= %d\" %(x,y)",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter two integers: \"\n",
+ "x = int(raw_input())\n",
+ "y = int(raw_input())\n",
+ "\n",
+ "if (x > y):\n",
+ " temp=x\n",
+ " x = y\n",
+ " y = temp\n",
+ " \n",
+ "\n",
+ "print \"%d <= %d\" %(x,y)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "66\n"
+ "text": [
+ "66\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "44 <= 66\n"
+ "text": [
+ "44 <= 66\n"
+ ]
}
],
"prompt_number": 6
@@ -194,25 +301,52 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.7 Using Blocks to Limit Scope\nThis program uses the same name n for three different variables:\n'''\nn=44\nprint \"n = %d\" % n \nif True:\n # scope extends over 4 lines\n print \"Enter an integer: \"\n n = int(raw_input())\n print \"n = %d\" % n \n\nif True:\n print \"n = %d\" % n \n # the n that was declared first\nif True:\n print \"n = %d\" % n \n\nprint \"n = %d\" % n ",
+ "input": [
+ "\n",
+ "n=44\n",
+ "print \"n = %d\" % n \n",
+ "if True:\n",
+ " # scope extends over 4 lines\n",
+ " print \"Enter an integer: \"\n",
+ " n = int(raw_input())\n",
+ " print \"n = %d\" % n \n",
+ "\n",
+ "if True:\n",
+ " print \"n = %d\" % n \n",
+ " # the n that was declared first\n",
+ "if True:\n",
+ " print \"n = %d\" % n \n",
+ "\n",
+ "print \"n = %d\" % n "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\nEnter an integer: \n"
+ "text": [
+ "n = 44\n",
+ "Enter an integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 77\nn = 77\nn = 77\nn = 77\n"
+ "text": [
+ "n = 77\n",
+ "n = 77\n",
+ "n = 77\n",
+ "n = 77\n"
+ ]
}
],
"prompt_number": 7
@@ -220,37 +354,60 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.8 Using Compound Conditions\nThis program has the same effect as the one in Example 3.5 on page 39. This version uses compound\nconditions to find the minimum of three integers:\n'''\nprint \"Enter three integers: \"\nn1 = int(raw_input())\nn2 = int(raw_input())\nn3 = int(raw_input())\nif (n1 <= n2 and n1 <= n3):\n print \"Their minimum is %d\" % n1\n \nif (n2 <= n1 and n2 <= n3):\n print \"Their minimum is %d \" % n2 \nif (n3 <= n1 and n3 <= n2):\n print \"Their minimum is %d\" % n3 \n",
+ "input": [
+ "\n",
+ "print \"Enter three integers: \"\n",
+ "n1 = int(raw_input())\n",
+ "n2 = int(raw_input())\n",
+ "n3 = int(raw_input())\n",
+ "if (n1 <= n2 and n1 <= n3):\n",
+ " print \"Their minimum is %d\" % n1\n",
+ " \n",
+ "if (n2 <= n1 and n2 <= n3):\n",
+ " print \"Their minimum is %d \" % n2 \n",
+ "if (n3 <= n1 and n3 <= n2):\n",
+ " print \"Their minimum is %d\" % n3 \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter three integers: \n"
+ "text": [
+ "Enter three integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Their minimum is 33 \n"
+ "text": [
+ "Their minimum is 33 \n"
+ ]
}
],
"prompt_number": 8
@@ -258,25 +415,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.9 User-Friendly Input\nThis program allows the user to input either a 'Y' or a 'y' for 'yes':\n'''\n\nprint \"Are you enrolled (y/n): \"\nans = raw_input()\nif (ans == 'Y' or ans == 'y'):\n print \"You are enrolled.\\n\"\nelse: \n print \"You are not enrolled.\\n\"\n",
+ "input": [
+ "\n",
+ "print \"Are you enrolled (y/n): \"\n",
+ "ans = raw_input()\n",
+ "if (ans == 'Y' or ans == 'y'):\n",
+ " print \"You are enrolled.\\n\"\n",
+ "else: \n",
+ " print \"You are not enrolled.\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Are you enrolled (y/n): \n"
+ "text": [
+ "Are you enrolled (y/n): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "y\n"
+ "text": [
+ "y\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "You are enrolled.\n\n"
+ "text": [
+ "You are enrolled.\n",
+ "\n"
+ ]
}
],
"prompt_number": 9
@@ -284,31 +456,50 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.10 Short-Circuiting\nThis program tests integer divisibility:\n'''\n\nprint \"Enter two positive integers: \";\nn = int(raw_input())\nd = int(raw_input())\n\nif (d != 0 and n%d == 0): \n print \"%d divides %d\" %(d,n)\nelse:\n print \"%d does not divide %d\"% (d,n)",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter two positive integers: \";\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "\n",
+ "if (d != 0 and n%d == 0): \n",
+ " print \"%d divides %d\" %(d,n)\n",
+ "else:\n",
+ " print \"%d does not divide %d\"% (d,n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two positive integers: \n"
+ "text": [
+ "Enter two positive integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "6\n"
+ "text": [
+ "6\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "6 does not divide 33\n"
+ "text": [
+ "6 does not divide 33\n"
+ ]
}
],
"prompt_number": 10
@@ -316,32 +507,49 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.11 Another Logical Error\nThis program is erroneous:\n'''\nprint \"Enter three integers: \"\nn1 = int(raw_input())\nn2 = int(raw_input())\nn3 = int(raw_input())\n\nif (n1 >= n2 >= n3):\n print \"max = x\"",
+ "input": [
+ "\n",
+ "print \"Enter three integers: \"\n",
+ "n1 = int(raw_input())\n",
+ "n2 = int(raw_input())\n",
+ "n3 = int(raw_input())\n",
+ "\n",
+ "if (n1 >= n2 >= n3):\n",
+ " print \"max = x\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter three integers: \n"
+ "text": [
+ "Enter three integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
}
],
"prompt_number": 11
@@ -349,31 +557,53 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.12 Nesting Selection Statements\nThis program has the same effect as the one in Example 3.10 on page 42:\n'''\nprint \"Enter two positive integers: \"\nn = int(raw_input())\nd = int(raw_input())\n\nif (d != 0):\n if (n%d == 0):\n print d,\n print \" divides %d\" % n \n else:\n print \"%d does not divide %d\" %(d,n)\nelse:\n print '%d does not divide %d '%(d,n)",
+ "input": [
+ "\n",
+ "print \"Enter two positive integers: \"\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "\n",
+ "if (d != 0):\n",
+ " if (n%d == 0):\n",
+ " print d,\n",
+ " print \" divides %d\" % n \n",
+ " else:\n",
+ " print \"%d does not divide %d\" %(d,n)\n",
+ "else:\n",
+ " print '%d does not divide %d '%(d,n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two positive integers: \n"
+ "text": [
+ "Enter two positive integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "44 does not divide 55\n"
+ "text": [
+ "44 does not divide 55\n"
+ ]
}
],
"prompt_number": 12
@@ -381,37 +611,63 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.13 Using Nested Selection Statements\nThis program has the same effect as those in Example 3.5 on page 39 and Example 3.8 on page 41.\nThis version uses nested if..else statements to find the minimum of three integers:\n'''\nprint \"Enter three integers: \"\nn1 = int(raw_input())\nn2 = int(raw_input())\nn3 = int(raw_input())\nif (n1 < n2):\n if (n1 < n3):\n print \"Their minimum is : %d\" % n1\n else:\n print \"Their minimum is : %d\" % n3\nelse: # n1 >= n2\n if (n2 < n3):\n print \"Their minimum is : %d\" % n2\n else:\n print \"Their minimum is %d\" % n3",
+ "input": [
+ "\n",
+ "print \"Enter three integers: \"\n",
+ "n1 = int(raw_input())\n",
+ "n2 = int(raw_input())\n",
+ "n3 = int(raw_input())\n",
+ "if (n1 < n2):\n",
+ " if (n1 < n3):\n",
+ " print \"Their minimum is : %d\" % n1\n",
+ " else:\n",
+ " print \"Their minimum is : %d\" % n3\n",
+ "else: # n1 >= n2\n",
+ " if (n2 < n3):\n",
+ " print \"Their minimum is : %d\" % n2\n",
+ " else:\n",
+ " print \"Their minimum is %d\" % n3"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter three integers: \n"
+ "text": [
+ "Enter three integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Their minimum is : 33\n"
+ "text": [
+ "Their minimum is : 33\n"
+ ]
}
],
"prompt_number": 13
@@ -419,58 +675,116 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.14 A Guessing Game\nThis program finds a number that the user selects from 1 to 8:\n'''\n\nprint \"Pick a number from 1 to 8.\" \nanswer = int(raw_input())\nprint \"Is it less than 5? (y|n): \"\nanswer = raw_input()\nif (answer == 'y'): # 1 <= n <= 4\n print \"Is it less than 3? (y|n): \"\n answer = raw_input() \n if (answer == 'y'): # 1 <= n <= 2\n print \"Is it less than 2? (y|n): \"\n answer = raw_input()\n if (answer == 'y'):\n print \"Your number is 1.\"\n else:\n print \"Your number is 2.\"\n else: # 3 <= n <= 4\n print \"Is it less than 4? (y|n): \"\n answer = raw_input()\n if (answer == 'y'):\n print \"Your number is 3.\"\n else:\n print \"Your number is 4.\"\nelse: # 5 <= n <= 8\n print \"Is it less than 7? (y|n): \"\n answer = raw_input()\n if (answer == 'y'): # 5 <= n <= 6\n print \"Is it less than 6? (y|n): \"\n answer = raw_input()\n if (answer == 'y'):\n print \"Your number is 5.\"\n else:\n print \"Your number is 6.\" \n else: # 7 <= n <= 8\n print \"Is it less than 8? (y|n): \"\n answer = raw_input()\n if (answer == 'y'):\n print \"Your number is 7.\" \n else:\n print \"Your number is 8.\"",
+ "input": [
+ "\n",
+ "print \"Pick a number from 1 to 8.\" \n",
+ "answer = int(raw_input())\n",
+ "print \"Is it less than 5? (y|n): \"\n",
+ "answer = raw_input()\n",
+ "if (answer == 'y'): # 1 <= n <= 4\n",
+ " print \"Is it less than 3? (y|n): \"\n",
+ " answer = raw_input() \n",
+ " if (answer == 'y'): # 1 <= n <= 2\n",
+ " print \"Is it less than 2? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'):\n",
+ " print \"Your number is 1.\"\n",
+ " else:\n",
+ " print \"Your number is 2.\"\n",
+ " else: # 3 <= n <= 4\n",
+ " print \"Is it less than 4? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'):\n",
+ " print \"Your number is 3.\"\n",
+ " else:\n",
+ " print \"Your number is 4.\"\n",
+ "else: # 5 <= n <= 8\n",
+ " print \"Is it less than 7? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'): # 5 <= n <= 6\n",
+ " print \"Is it less than 6? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'):\n",
+ " print \"Your number is 5.\"\n",
+ " else:\n",
+ " print \"Your number is 6.\" \n",
+ " else: # 7 <= n <= 8\n",
+ " print \"Is it less than 8? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'):\n",
+ " print \"Your number is 7.\" \n",
+ " else:\n",
+ " print \"Your number is 8.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Pick a number from 1 to 8.\n"
+ "text": [
+ "Pick a number from 1 to 8.\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "6\n"
+ "text": [
+ "6\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Is it less than 5? (y|n): \n"
+ "text": [
+ "Is it less than 5? (y|n): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "n\n"
+ "text": [
+ "n\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Is it less than 7? (y|n): \n"
+ "text": [
+ "Is it less than 7? (y|n): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "y\n"
+ "text": [
+ "y\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Is it less than 6? (y|n): \n"
+ "text": [
+ "Is it less than 6? (y|n): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "n\n"
+ "text": [
+ "n\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Your number is 6.\n"
+ "text": [
+ "Your number is 6.\n"
+ ]
}
],
"prompt_number": 14
@@ -478,7 +792,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.15 Using the else if Construct for Parallel Alternatives\nThis program requests the users language and then prints a greeting in that language:\n'''\nlanguage = raw_input(\"Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): \")\n\nif (language == 'e'): \n print \"Welcome to ProjectEuclid.\"\nelif (language == 'f'):\n print \"Bon jour, ProjectEuclid.\"\nelif (language == 'g'):\n print \"Guten tag, ProjectEuclid.\"\nelif (language == 'i'):\n print \"Bon giorno, ProjectEuclid.\"\nelif (language == 'r'):\n print \"Dobre utre, ProjectEuclid.\"\nelse:\n print \"Sorry; we don't speak your language.\"\n",
+ "input": [
+ "\n",
+ "language = raw_input(\"Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): \")\n",
+ "\n",
+ "if (language == 'e'): \n",
+ " print \"Welcome to ProjectEuclid.\"\n",
+ "elif (language == 'f'):\n",
+ " print \"Bon jour, ProjectEuclid.\"\n",
+ "elif (language == 'g'):\n",
+ " print \"Guten tag, ProjectEuclid.\"\n",
+ "elif (language == 'i'):\n",
+ " print \"Bon giorno, ProjectEuclid.\"\n",
+ "elif (language == 'r'):\n",
+ " print \"Dobre utre, ProjectEuclid.\"\n",
+ "else:\n",
+ " print \"Sorry; we don't speak your language.\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -486,12 +816,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): i\n"
+ "text": [
+ "Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): i\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Bon giorno, ProjectEuclid.\n"
+ "text": [
+ "Bon giorno, ProjectEuclid.\n"
+ ]
}
],
"prompt_number": 15
@@ -499,7 +833,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.16 Using the else if Construct to Select a Range of Scores\nThis program converts a test score into its equivalent letter grade:\n'''\nscore = int(raw_input(\"Enter your test score: \"))\na = int(score/10)\nif a == 10 or a == 9:\n print \"Your grade is an A.\"\nelif a == 8:\n print \"Your grade is a B.\" \nelif a == 7:\n print \"Your grade is a C.\" \nelif a == 6:\n print \"Your grade is a D.\"\nelif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n print \"Your grade is an F.\" \nelse:\n print \"Error: score is out of range.\\n\"\n",
+ "input": [
+ "\n",
+ "score = int(raw_input(\"Enter your test score: \"))\n",
+ "a = int(score/10)\n",
+ "if a == 10 or a == 9:\n",
+ " print \"Your grade is an A.\"\n",
+ "elif a == 8:\n",
+ " print \"Your grade is a B.\" \n",
+ "elif a == 7:\n",
+ " print \"Your grade is a C.\" \n",
+ "elif a == 6:\n",
+ " print \"Your grade is a D.\"\n",
+ "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n",
+ " print \"Your grade is an F.\" \n",
+ "else:\n",
+ " print \"Error: score is out of range.\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -507,12 +857,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your test score: 83\n"
+ "text": [
+ "Enter your test score: 83\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Your grade is a B.\n"
+ "text": [
+ "Your grade is a B.\n"
+ ]
}
],
"prompt_number": 16
@@ -520,7 +874,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.17 Using a switch Statement to Select a Range of Scores\nThis program has the same effect as the one in Example 3.16:\n'''\nscore = int(raw_input(\"Enter your test score: \"))\na = int(score/10)\nif a == 10 or a == 9:\n print \"Your grade is an A.\"\nelif a == 8:\n print \"Your grade is a B.\" \nelif a == 7:\n print \"Your grade is a C.\" \nelif a == 6:\n print \"Your grade is a D.\"\nelif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n print \"Your grade is an F.\" \nelse:\n print \"Error: score is out of range.\\n\"\n\nprint \"Goodbye.\"",
+ "input": [
+ "\n",
+ "score = int(raw_input(\"Enter your test score: \"))\n",
+ "a = int(score/10)\n",
+ "if a == 10 or a == 9:\n",
+ " print \"Your grade is an A.\"\n",
+ "elif a == 8:\n",
+ " print \"Your grade is a B.\" \n",
+ "elif a == 7:\n",
+ " print \"Your grade is a C.\" \n",
+ "elif a == 6:\n",
+ " print \"Your grade is a D.\"\n",
+ "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n",
+ " print \"Your grade is an F.\" \n",
+ "else:\n",
+ " print \"Error: score is out of range.\\n\"\n",
+ "\n",
+ "print \"Goodbye.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -528,12 +900,17 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your test score: 83\n"
+ "text": [
+ "Enter your test score: 83\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Your grade is a B.\nGoodbye.\n"
+ "text": [
+ "Your grade is a B.\n",
+ "Goodbye.\n"
+ ]
}
],
"prompt_number": 17
@@ -541,7 +918,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.18 An Erroneous Fall-through in a switch Statement\nThis program was intended to have the same effect as the one in Example 3.17. But with\nstatements, the program execution falls through all the case statements it encounters:\n'''\nscore = int(raw_input(\"Enter your test score: \"))\na = int(score/10)\nif a == 10 or a == 9:\n print \"Your grade is an A.\"\nelif a == 8:\n print \"Your grade is a B.\" \nelif a == 7:\n print \"Your grade is a C.\" \nelif a == 6:\n print \"Your grade is a D.\"\nelif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n print \"Your grade is an F.\" \nelse:\n print \"Error: score is out of range.\\n\"\n\nprint \"Goodbye.\"",
+ "input": [
+ "\n",
+ "score = int(raw_input(\"Enter your test score: \"))\n",
+ "a = int(score/10)\n",
+ "if a == 10 or a == 9:\n",
+ " print \"Your grade is an A.\"\n",
+ "elif a == 8:\n",
+ " print \"Your grade is a B.\" \n",
+ "elif a == 7:\n",
+ " print \"Your grade is a C.\" \n",
+ "elif a == 6:\n",
+ " print \"Your grade is a D.\"\n",
+ "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n",
+ " print \"Your grade is an F.\" \n",
+ "else:\n",
+ " print \"Error: score is out of range.\\n\"\n",
+ "\n",
+ "print \"Goodbye.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -549,12 +944,17 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your test score: 83\n"
+ "text": [
+ "Enter your test score: 83\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Your grade is a B.\nGoodbye.\n"
+ "text": [
+ "Your grade is a B.\n",
+ "Goodbye.\n"
+ ]
}
],
"prompt_number": 18
@@ -562,31 +962,46 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.19 Finding the Minimum Again\n'''\n\nprint \"Enter two integers: \"\nm = int(raw_input())\nn = int(raw_input())\nprint min(m,n),\nprint 'is the minimum'",
+ "input": [
+ "\n",
+ "print \"Enter two integers: \"\n",
+ "m = int(raw_input())\n",
+ "n = int(raw_input())\n",
+ "print min(m,n),\n",
+ "print 'is the minimum'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "33 is the minimum\n"
+ "text": [
+ "33 is the minimum\n"
+ ]
}
],
"prompt_number": 19
@@ -594,7 +1009,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch4.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch4.ipynb
index d137f53e..80faf7b0 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch4.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch4"
+ "name": "",
+ "signature": "sha256:151156e7bea70740a97337b774930eddac369834b8935c55926007a1955d4c91"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,25 +11,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.1 Using a while Loop to Compute a Sum of Consecutive Integers\nThis program computes the sum 1 + 2 + 3 + + n for an input integer n:\n'''\ni=1\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0\nwhile (i <= n):\n s += i\n i += 1\nprint \"The sum of the first %d integers is %d\" %(i,s)",
+ "input": [
+ "\n",
+ "i=1\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "while (i <= n):\n",
+ " s += i\n",
+ " i += 1\n",
+ "print \"The sum of the first %d integers is %d\" %(i,s)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 6 integers is 15\n"
+ "text": [
+ "The sum of the first 6 integers is 15\n"
+ ]
}
],
"prompt_number": 1
@@ -36,25 +53,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.2 Using a while Loop to Compute a Sum of Reciprocals\nThis program computes the sum of reciprocals s = 1 + 1/2 + 1/3 + 1/n where n is\ninteger for which n is greater than s\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\ns=0.0\ni=0\nwhile (s < bound):\n i += 1\n s += 1.0/i\n\nprint \"The sum of the first %d reciprocals is %f\" %(i,s)",
+ "input": [
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "s=0.0\n",
+ "i=0\n",
+ "while (s < bound):\n",
+ " i += 1\n",
+ " s += 1.0/i\n",
+ "\n",
+ "print \"The sum of the first %d reciprocals is %f\" %(i,s)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 83 reciprocals is 5.002068\n"
+ "text": [
+ "The sum of the first 83 reciprocals is 5.002068\n"
+ ]
}
],
"prompt_number": 2
@@ -62,42 +96,65 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.3 Using a while Loop to Repeat a Computation\nThis program prints the square root of each number input by the user. It uses a while loop to allow any\nnumber of computations in a single run of the program:\n'''\nimport math\nprint \"Enter a positive number: \"\nx = float(raw_input())\nwhile (x > 0):\n print \"sqrt(%d) = %f \"%(x,math.sqrt(x))\n print \"Enter another positive number (or 0 to quit): \"\n x = float(raw_input())\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "print \"Enter a positive number: \"\n",
+ "x = float(raw_input())\n",
+ "while (x > 0):\n",
+ " print \"sqrt(%d) = %f \"%(x,math.sqrt(x))\n",
+ " print \"Enter another positive number (or 0 to quit): \"\n",
+ " x = float(raw_input())\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive number: \n"
+ "text": [
+ "Enter a positive number: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "sqrt(5) = 2.236068 \nEnter another positive number (or 0 to quit): \n"
+ "text": [
+ "sqrt(5) = 2.236068 \n",
+ "Enter another positive number (or 0 to quit): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "sqrt(3) = 1.732051 \nEnter another positive number (or 0 to quit): \n"
+ "text": [
+ "sqrt(3) = 1.732051 \n",
+ "Enter another positive number (or 0 to quit): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
}
],
"prompt_number": 3
@@ -105,25 +162,43 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.4 Using a break Statement to Terminate a Loop\nThis program has the same effect as the one in Example 4.1 on page 60:\n'''\ni=1\nprint \"Enter a positive integer: \";\nn = int(raw_input())\ns=0\nwhile(True):\n if (i > n):\n break # terminates the loop immediately\n s += i\n i += 1\nprint \"The sum of the first %d integers is %d\" %(n,s)",
+ "input": [
+ "\n",
+ "i=1\n",
+ "print \"Enter a positive integer: \";\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "while(True):\n",
+ " if (i > n):\n",
+ " break # terminates the loop immediately\n",
+ " s += i\n",
+ " i += 1\n",
+ "print \"The sum of the first %d integers is %d\" %(n,s)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 5 integers is 15\n"
+ "text": [
+ "The sum of the first 5 integers is 15\n"
+ ]
}
],
"prompt_number": 5
@@ -131,25 +206,48 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.5 The Fibonacci Numbers\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\nf0=0\nf1=1\nwhile (True):\n f2 = f0 + f1\n if (f2 > bound):\n break\n print \", %d\" % f2,\n f0 = f1\n f1 = f2\n ",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n",
+ "f0=0\n",
+ "f1=1\n",
+ "while (True):\n",
+ " f2 = f0 + f1\n",
+ " if (f2 > bound):\n",
+ " break\n",
+ " print \", %d\" % f2,\n",
+ " f0 = f1\n",
+ " f1 = f2\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Fibonacci numbers < 10:\n0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ "text": [
+ "Fibonacci numbers < 10:\n",
+ "0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ ]
}
],
"prompt_number": 6
@@ -157,20 +255,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.6 Using the exit(0) Function\nThe exit() function provides another way to terminate a loop. When it executes, it terminates the\nprogram itself:\n'''\nimport sys\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\nf0=0\nf1=1\nwhile (True):\n f2 = f0 + f1\n if (f2 > bound):\n sys.exit(0)\n print \", %d\" % f2,\n f0 = f1\n f1 = f2\n ",
+ "input": [
+ "\n",
+ "import sys\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n",
+ "f0=0\n",
+ "f1=1\n",
+ "while (True):\n",
+ " f2 = f0 + f1\n",
+ " if (f2 > bound):\n",
+ " sys.exit(0)\n",
+ " print \", %d\" % f2,\n",
+ " f0 = f1\n",
+ " f1 = f2\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"ename": "SystemExit",
@@ -184,12 +302,17 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "Fibonacci numbers < 10:\n0, 1 , 1 , 2 , 3 , 5 , 8"
+ "text": [
+ "Fibonacci numbers < 10:\n",
+ "0, 1 , 1 , 2 , 3 , 5 , 8"
+ ]
},
{
"output_type": "stream",
"stream": "stderr",
- "text": "To exit: use 'exit', 'quit', or Ctrl-D.\n"
+ "text": [
+ "To exit: use 'exit', 'quit', or Ctrl-D.\n"
+ ]
}
],
"prompt_number": 7
@@ -197,25 +320,48 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.7 Aborting Infinite Loop\nWithout some termination mechanism, the loop will run forever. To abort its execution after it starts,\npress <Ctrl>+C (i.e., hold the Ctrl key down and press the C key on your keyboard):\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\nf0=0\nf1=1\n# Error : infinite loop !\nwhile (True):\n f2 = f0 + f1\n # By commenting the below if statement, it goes to infinite.\n if (f2 > bound):\n break\n print \", %d\" % f2,\n f0 = f1\n f1 = f2",
+ "input": [
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n",
+ "f0=0\n",
+ "f1=1\n",
+ "# Error : infinite loop !\n",
+ "while (True):\n",
+ " f2 = f0 + f1\n",
+ " # By commenting the below if statement, it goes to infinite.\n",
+ " if (f2 > bound):\n",
+ " break\n",
+ " print \", %d\" % f2,\n",
+ " f0 = f1\n",
+ " f1 = f2"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Fibonacci numbers < 10:\n0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ "text": [
+ "Fibonacci numbers < 10:\n",
+ "0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ ]
}
],
"prompt_number": 2
@@ -223,14 +369,35 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.7 Aborting Infinite Loop\nWithout some termination mechanism, the loop will run forever. To abort its execution after it starts,\npress <Ctrl>+C (i.e., hold the Ctrl key down and press the C key on your keyboard):\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\nf0=0\nf1=1\n# Error : infinite loop !\nwhile (True):\n f2 = f0 + f1\n # By commenting the below if statement, it goes to infinite.\n if (f2 > bound):\n break\n print \", %d\" % f2,\n f0 = f1\n f1 = f2",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n",
+ "f0=0\n",
+ "f1=1\n",
+ "# Error : infinite loop !\n",
+ "while (True):\n",
+ " f2 = f0 + f1\n",
+ " # By commenting the below if statement, it goes to infinite.\n",
+ " if (f2 > bound):\n",
+ " break\n",
+ " print \", %d\" % f2,\n",
+ " f0 = f1\n",
+ " f1 = f2"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \nFibonacci numbers < 10:\n0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ "text": [
+ "Enter a positive integer: \n",
+ "Fibonacci numbers < 10:\n",
+ "0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ ]
}
],
"prompt_number": 1
@@ -238,25 +405,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.8 Using a do..while Loop to Compute a Sum of Consecutive Integers\nThis program has the same effect as the one in Example 4.1 on page 60:\n'''\ni=0\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0\nwhile i<=n:\n s += i\n i += 1\nprint \"The sum of the first %d integers is %d\" %(n,s)\n",
+ "input": [
+ "\n",
+ "i=0\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "while i<=n:\n",
+ " s += i\n",
+ " i += 1\n",
+ "print \"The sum of the first %d integers is %d\" %(n,s)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 10 integers is 55\n"
+ "text": [
+ "The sum of the first 10 integers is 55\n"
+ ]
}
],
"prompt_number": 3
@@ -264,25 +447,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.9 The Factorial Numbers\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Factorial numbers < %d:\\n1, 1\" %bound,\nf=1\ni=1\nwhile f < bound:\n i += 1\n f *= i\n print \", %d\" %f,\n",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Factorial numbers < %d:\\n1, 1\" %bound,\n",
+ "f=1\n",
+ "i=1\n",
+ "while f < bound:\n",
+ " i += 1\n",
+ " f *= i\n",
+ " print \", %d\" %f,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Factorial numbers < 10:\n1, 1 , 2 , 6 , 24\n"
+ "text": [
+ "Factorial numbers < 10:\n",
+ "1, 1 , 2 , 6 , 24\n"
+ ]
}
],
"prompt_number": 4
@@ -290,25 +492,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.10 Using a for Loop to Compute a Sum of Consecutive Integers\nThis program has the same effect as the one in Example 4.1 on page 60:\n'''\n\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0;\nfor i in range(0,n+1):\n s += i\nprint \"The sum of the first %d integers is %d\" %(n,s)\n",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0;\n",
+ "for i in range(0,n+1):\n",
+ " s += i\n",
+ "print \"The sum of the first %d integers is %d\" %(n,s)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 10 integers is 55\n"
+ "text": [
+ "The sum of the first 10 integers is 55\n"
+ ]
}
],
"prompt_number": 5
@@ -316,25 +533,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.11 Reusing for Loop Control Variable Names\nThis program has the same effect as the one in Example 4.1 on page 60:\n'''\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0\nfor i in range(1,n/2): # the scope of this i is this loop\n s += i\n\nfor i in range(n/2,n+1): # the scope of this i is this loop\n s += i\nprint \"The sum of the first %d integers is %d\" % (n,s)\n",
+ "input": [
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "for i in range(1,n/2): # the scope of this i is this loop\n",
+ " s += i\n",
+ "\n",
+ "for i in range(n/2,n+1): # the scope of this i is this loop\n",
+ " s += i\n",
+ "print \"The sum of the first %d integers is %d\" % (n,s)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 10 integers is 55\n"
+ "text": [
+ "The sum of the first 10 integers is 55\n"
+ ]
}
],
"prompt_number": 6
@@ -342,25 +576,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.12 The Factorial Numbers Again\nThis program has the same effect as the one in Example 4.9 on page 65:\n'''\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\n\nprint \"Factorial numbers that are <= %d:\\n1, 1\" %bound,\nf=1\nfor i in range(2,bound+1):\n f *= i\n print \", %d\" % f,\n",
+ "input": [
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "\n",
+ "print \"Factorial numbers that are <= %d:\\n1, 1\" %bound,\n",
+ "f=1\n",
+ "for i in range(2,bound+1):\n",
+ " f *= i\n",
+ " print \", %d\" % f,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Factorial numbers that are <= 10:\n1, 1 , 2 , 6 , 24 , 120 , 720 , 5040 , 40320 , 362880 , 3628800\n"
+ "text": [
+ "Factorial numbers that are <= 10:\n",
+ "1, 1 , 2 , 6 , 24 , 120 , 720 , 5040 , 40320 , 362880 , 3628800\n"
+ ]
}
],
"prompt_number": 7
@@ -368,14 +619,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.13 Using a Descending for Loop\nThis program prints the first ten positive integers in reverse order:\n'''\n\nfor i in range(10,0,-1):\n print i,\n",
+ "input": [
+ "\n",
+ "\n",
+ "for i in range(10,0,-1):\n",
+ " print i,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 9 8 7 6 5 4 3 2 1\n"
+ "text": [
+ "10 9 8 7 6 5 4 3 2 1\n"
+ ]
}
],
"prompt_number": 8
@@ -383,25 +641,52 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.14 Using a for Loop with a Step Greater than One\nThis program determines whether an input number is prime:\n'''\nprime = True\nprint \"Enter a positive integer: \"\nn = int(raw_input())\nif (n < 2):\n print \"%d is not prime.\" %n\n prime = False\nelif (n < 4):\n print \"%d is prime.\" %n\n prime = False\nelif (n%2 == 0):\n print \"%d = 2* %d\" %(n,n/2)\n prime = False\nelse:\n for d in range(3,n/2+1):\n if (n%d == 0):\n print \"%d = %d * %d\" %(n,d,n/d)\n prime = False\nif prime: \n print \"%d is prime.\"%n\n",
+ "input": [
+ "\n",
+ "prime = True\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "if (n < 2):\n",
+ " print \"%d is not prime.\" %n\n",
+ " prime = False\n",
+ "elif (n < 4):\n",
+ " print \"%d is prime.\" %n\n",
+ " prime = False\n",
+ "elif (n%2 == 0):\n",
+ " print \"%d = 2* %d\" %(n,n/2)\n",
+ " prime = False\n",
+ "else:\n",
+ " for d in range(3,n/2+1):\n",
+ " if (n%d == 0):\n",
+ " print \"%d = %d * %d\" %(n,d,n/d)\n",
+ " prime = False\n",
+ "if prime: \n",
+ " print \"%d is prime.\"%n\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "11\n"
+ "text": [
+ "11\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "11 is prime.\n"
+ "text": [
+ "11 is prime.\n"
+ ]
}
],
"prompt_number": 9
@@ -409,49 +694,74 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.15 Using a Sentinel to Control a for Loop\nThis program finds the maximum of a sequence of input numbers:\n'''\nprint \"Enter positive integers (0 to quit): \";\nn = int(raw_input())\nm = n\nwhile n > 0:\n n = int(raw_input())\n if n > m :\n m = n\n\nprint \"max = %d\" % m",
+ "input": [
+ "\n",
+ "print \"Enter positive integers (0 to quit): \";\n",
+ "n = int(raw_input())\n",
+ "m = n\n",
+ "while n > 0:\n",
+ " n = int(raw_input())\n",
+ " if n > m :\n",
+ " m = n\n",
+ "\n",
+ "print \"max = %d\" % m"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter positive integers (0 to quit): \n"
+ "text": [
+ "Enter positive integers (0 to quit): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "19\n"
+ "text": [
+ "19\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "42\n"
+ "text": [
+ "42\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "max = 42\n"
+ "text": [
+ "max = 42\n"
+ ]
}
],
"prompt_number": 10
@@ -459,49 +769,76 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.16 Using a Loop Invariant to Prove that a for Loop is Correct\nThis program finds the minimum of a sequence of input numbers. It is similar to the program in\nExample 4.15:\n'''\n\nprint \"Enter positive integers (0 to quit): \";\nn = int(raw_input())\nm = n\nwhile n > 0: \n if n < m :\n m = n\n n = int(raw_input())\n\nprint \"min = %d\" % m\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter positive integers (0 to quit): \";\n",
+ "n = int(raw_input())\n",
+ "m = n\n",
+ "while n > 0: \n",
+ " if n < m :\n",
+ " m = n\n",
+ " n = int(raw_input())\n",
+ "\n",
+ "print \"min = %d\" % m\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter positive integers (0 to quit): \n"
+ "text": [
+ "Enter positive integers (0 to quit): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "19\n"
+ "text": [
+ "19\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "42\n"
+ "text": [
+ "42\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "min = 1\n"
+ "text": [
+ "min = 1\n"
+ ]
}
],
"prompt_number": 11
@@ -509,14 +846,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.17\n'''\n\nm = 95\nn = 11\nwhile m%n > 0:\n print \"%d modulo %d = %d\" %(m,n,m%n)\n m -= 3\n n += 1\n",
+ "input": [
+ "\n",
+ "m = 95\n",
+ "n = 11\n",
+ "while m%n > 0:\n",
+ " print \"%d modulo %d = %d\" %(m,n,m%n)\n",
+ " m -= 3\n",
+ " n += 1\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "95 modulo 11 = 7\n92 modulo 12 = 8\n89 modulo 13 = 11\n86 modulo 14 = 2\n83 modulo 15 = 8\n"
+ "text": [
+ "95 modulo 11 = 7\n",
+ "92 modulo 12 = 8\n",
+ "89 modulo 13 = 11\n",
+ "86 modulo 14 = 2\n",
+ "83 modulo 15 = 8\n"
+ ]
}
],
"prompt_number": 12
@@ -524,14 +875,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.18 Nesting for Loops\nThis program prints a multiplication table:\n'''\n\nfor x in range(1,13):\n for y in range(1,13):\n print \"%4d\" % (x*y),\n print \"\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "for x in range(1,13):\n",
+ " for y in range(1,13):\n",
+ " print \"%4d\" % (x*y),\n",
+ " print \"\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " 1 2 3 4 5 6 7 8 9 10 11 12 \n 2 4 6 8 10 12 14 16 18 20 22 24 \n 3 6 9 12 15 18 21 24 27 30 33 36 \n 4 8 12 16 20 24 28 32 36 40 44 48 \n 5 10 15 20 25 30 35 40 45 50 55 60 \n 6 12 18 24 30 36 42 48 54 60 66 72 \n 7 14 21 28 35 42 49 56 63 70 77 84 \n 8 16 24 32 40 48 56 64 72 80 88 96 \n 9 18 27 36 45 54 63 72 81 90 99 108 \n 10 20 30 40 50 60 70 80 90 100 110 120 \n 11 22 33 44 55 66 77 88 99 110 121 132 \n 12 24 36 48 60 72 84 96 108 120 132 144 \n"
+ "text": [
+ " 1 2 3 4 5 6 7 8 9 10 11 12 \n",
+ " 2 4 6 8 10 12 14 16 18 20 22 24 \n",
+ " 3 6 9 12 15 18 21 24 27 30 33 36 \n",
+ " 4 8 12 16 20 24 28 32 36 40 44 48 \n",
+ " 5 10 15 20 25 30 35 40 45 50 55 60 \n",
+ " 6 12 18 24 30 36 42 48 54 60 66 72 \n",
+ " 7 14 21 28 35 42 49 56 63 70 77 84 \n",
+ " 8 16 24 32 40 48 56 64 72 80 88 96 \n",
+ " 9 18 27 36 45 54 63 72 81 90 99 108 \n",
+ " 10 20 30 40 50 60 70 80 90 100 110 120 \n",
+ " 11 22 33 44 55 66 77 88 99 110 121 132 \n",
+ " 12 24 36 48 60 72 84 96 108 120 132 144 \n"
+ ]
}
],
"prompt_number": 13
@@ -539,25 +910,59 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.19 Testing a Loop Invariant\n'''\nimport math\n# defines pow() and log()\n\nprint \"Enter a positive integer: \"\nn = int(raw_input())\nd=0 # the discrete binary logarithm of n\np2d=1 # = 2^d\ni = n\nwhile i > 1:\n # INVARIANT: 2^d <= n/i < 2*2^d\n p2d=math.pow(2,d) # = 2^d\n print \"%2d <= %2d\" %(p2d,2*p2d)\n i /= 2\n d += 1\n\np2d=math.pow(2,d) # = 2^d\nprint \"%2d <= %2d < %2d\" %(p2d,n,2*p2d)\nprint \" The discrete binary logarithm of is %d\" % d \nlgn = math.log(n)/math.log(2) # base 2 logarithm\nprint \"The continuous binary logarithm of is %f\" % lgn",
+ "input": [
+ "\n",
+ "import math\n",
+ "# defines pow() and log()\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "d=0 # the discrete binary logarithm of n\n",
+ "p2d=1 # = 2^d\n",
+ "i = n\n",
+ "while i > 1:\n",
+ " # INVARIANT: 2^d <= n/i < 2*2^d\n",
+ " p2d=math.pow(2,d) # = 2^d\n",
+ " print \"%2d <= %2d\" %(p2d,2*p2d)\n",
+ " i /= 2\n",
+ " d += 1\n",
+ "\n",
+ "p2d=math.pow(2,d) # = 2^d\n",
+ "print \"%2d <= %2d < %2d\" %(p2d,n,2*p2d)\n",
+ "print \" The discrete binary logarithm of is %d\" % d \n",
+ "lgn = math.log(n)/math.log(2) # base 2 logarithm\n",
+ "print \"The continuous binary logarithm of is %f\" % lgn"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "17\n"
+ "text": [
+ "17\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 1 <= 2\n 2 <= 4\n 4 <= 8\n 8 <= 16\n16 <= 17 < 32\n The discrete binary logarithm of is 4\nThe continuous binary logarithm of is 4.087463\n"
+ "text": [
+ " 1 <= 2\n",
+ " 2 <= 4\n",
+ " 4 <= 8\n",
+ " 8 <= 16\n",
+ "16 <= 17 < 32\n",
+ " The discrete binary logarithm of is 4\n",
+ "The continuous binary logarithm of is 4.087463\n"
+ ]
}
],
"prompt_number": 14
@@ -565,25 +970,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.20 Using a break Statement to Terminate a Loop\nThis program has the same effect as the one in Example 4.1 on page 60. It uses a break statement to\ncontrol the loop:\n'''\ni=1\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0\nwhile (True):\n if (i > n):\n break\n s += i\n i += 1\n\nprint \"The sum of the first %d integers is %d\" %(i,s)\n",
+ "input": [
+ "\n",
+ "i=1\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "while (True):\n",
+ " if (i > n):\n",
+ " break\n",
+ " s += i\n",
+ " i += 1\n",
+ "\n",
+ "print \"The sum of the first %d integers is %d\" %(i,s)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 11 integers is 55\n"
+ "text": [
+ "The sum of the first 11 integers is 55\n"
+ ]
}
],
"prompt_number": 15
@@ -591,58 +1015,92 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.21 Controlling Input with a Sentinel\nThis program reads a sequence of positive integers, terminated by 0, and prints their average:\n'''\ncount=0\ns=0\nprint \"Enter positive integers (0 to quit):\" \nwhile True: # \"forever\"\n print \"\\t %d :\" %(count + 1),\n n = int(raw_input())\n if (n <= 0):\n break\n count += 1\n s += n\n\nprint \"The average of those %d positive numbers is \" %count,\nprint float(s)/count\n",
+ "input": [
+ "\n",
+ "count=0\n",
+ "s=0\n",
+ "print \"Enter positive integers (0 to quit):\" \n",
+ "while True: # \"forever\"\n",
+ " print \"\\t %d :\" %(count + 1),\n",
+ " n = int(raw_input())\n",
+ " if (n <= 0):\n",
+ " break\n",
+ " count += 1\n",
+ " s += n\n",
+ "\n",
+ "print \"The average of those %d positive numbers is \" %count,\n",
+ "print float(s)/count\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter positive integers (0 to quit):\n\t 1 :"
+ "text": [
+ "Enter positive integers (0 to quit):\n",
+ "\t 1 :"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "12\n"
+ "text": [
+ "12\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t 2 :"
+ "text": [
+ " \t 2 :"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "32\n"
+ "text": [
+ "32\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t 3 :"
+ "text": [
+ " \t 3 :"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "11\n"
+ "text": [
+ "11\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t 4 :"
+ "text": [
+ " \t 4 :"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " The average of those 3 positive numbers is 18.3333333333\n"
+ "text": [
+ " The average of those 3 positive numbers is 18.3333333333\n"
+ ]
}
],
"prompt_number": 16
@@ -650,14 +1108,37 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.22 Using a break Statement with Nested Loops\n'''\n\nfor x in range(1,13):\n for y in range(1,13):\n if y>x:\n break\n else:\n print '%4d' %(x*y),\n print ''\n",
+ "input": [
+ "\n",
+ "\n",
+ "for x in range(1,13):\n",
+ " for y in range(1,13):\n",
+ " if y>x:\n",
+ " break\n",
+ " else:\n",
+ " print '%4d' %(x*y),\n",
+ " print ''\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " 1 \n 2 4 \n 3 6 9 \n 4 8 12 16 \n 5 10 15 20 25 \n 6 12 18 24 30 36 \n 7 14 21 28 35 42 49 \n 8 16 24 32 40 48 56 64 \n 9 18 27 36 45 54 63 72 81 \n 10 20 30 40 50 60 70 80 90 100 \n 11 22 33 44 55 66 77 88 99 110 121 \n 12 24 36 48 60 72 84 96 108 120 132 144 \n"
+ "text": [
+ " 1 \n",
+ " 2 4 \n",
+ " 3 6 9 \n",
+ " 4 8 12 16 \n",
+ " 5 10 15 20 25 \n",
+ " 6 12 18 24 30 36 \n",
+ " 7 14 21 28 35 42 49 \n",
+ " 8 16 24 32 40 48 56 64 \n",
+ " 9 18 27 36 45 54 63 72 81 \n",
+ " 10 20 30 40 50 60 70 80 90 100 \n",
+ " 11 22 33 44 55 66 77 88 99 110 121 \n",
+ " 12 24 36 48 60 72 84 96 108 120 132 144 \n"
+ ]
}
],
"prompt_number": 17
@@ -665,7 +1146,17 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.23 Using continue and break Statements\nThis little program illustrates the continue and break statements:\n'''\nwhile True:\n n = int(raw_input('Enter int : '))\n if (n%2 == 0):\n continue\n if (n%3 == 0):\n break\n print \"\\tBottom of loop.\\n\"\nprint \"\\tOutside of loop.\\n\"\n",
+ "input": [
+ "\n",
+ "while True:\n",
+ " n = int(raw_input('Enter int : '))\n",
+ " if (n%2 == 0):\n",
+ " continue\n",
+ " if (n%3 == 0):\n",
+ " break\n",
+ " print \"\\tBottom of loop.\\n\"\n",
+ "print \"\\tOutside of loop.\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -673,35 +1164,49 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter int : 5\n"
+ "text": [
+ "Enter int : 5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tBottom of loop.\n\n"
+ "text": [
+ "\tBottom of loop.\n",
+ "\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter int : 4\n"
+ "text": [
+ "Enter int : 4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter int : 6\n"
+ "text": [
+ "Enter int : 6\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter int : 9\n"
+ "text": [
+ "Enter int : 9\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tOutside of loop.\n\n"
+ "text": [
+ "\tOutside of loop.\n",
+ "\n"
+ ]
}
],
"prompt_number": 18
@@ -709,14 +1214,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.24 Using a goto Statement to Break Out of a Nest of Loops\nNote : Python has no goto facility.\n'''\nN=5\ndone=False\nfor i in range(N):\n for j in range(N):\n if done:\n break\n for k in range(N):\n if done:\n break\n if (i+j+k>N):\n done = True\n else:\n print i+j+k,\n print \" \",\n print \"* \"\n print \".\" \n done = False\n",
+ "input": [
+ "\n",
+ "N=5\n",
+ "done=False\n",
+ "for i in range(N):\n",
+ " for j in range(N):\n",
+ " if done:\n",
+ " break\n",
+ " for k in range(N):\n",
+ " if done:\n",
+ " break\n",
+ " if (i+j+k>N):\n",
+ " done = True\n",
+ " else:\n",
+ " print i+j+k,\n",
+ " print \" \",\n",
+ " print \"* \"\n",
+ " print \".\" \n",
+ " done = False\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 2 3 4 * \n1 2 3 4 5 * \n2 3 4 5 * \n.\n1 2 3 4 5 * \n2 3 4 5 * \n.\n2 3 4 5 * \n.\n3 4 5 * \n.\n4 5 * \n.\n"
+ "text": [
+ "0 1 2 3 4 * \n",
+ "1 2 3 4 5 * \n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "1 2 3 4 5 * \n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "3 4 5 * \n",
+ ".\n",
+ "4 5 * \n",
+ ".\n"
+ ]
}
],
"prompt_number": 19
@@ -724,14 +1262,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.25 Using a Flag to Break Out of a Nest of Loops\nThis program has the same output as that in Example 4.24:\n'''\nN=5\ndone=False\nfor i in range(N):\n for j in range(N):\n if done:\n break\n for k in range(N):\n if done:\n break\n if (i+j+k>N):\n done = True\n else:\n print i+j+k,\n print \" \",\n print \"* \"\n print \".\" \n done = False\n",
+ "input": [
+ "\n",
+ "N=5\n",
+ "done=False\n",
+ "for i in range(N):\n",
+ " for j in range(N):\n",
+ " if done:\n",
+ " break\n",
+ " for k in range(N):\n",
+ " if done:\n",
+ " break\n",
+ " if (i+j+k>N):\n",
+ " done = True\n",
+ " else:\n",
+ " print i+j+k,\n",
+ " print \" \",\n",
+ " print \"* \"\n",
+ " print \".\" \n",
+ " done = False\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 2 3 4 * \n1 2 3 4 5 * \n2 3 4 5 * \n.\n1 2 3 4 5 * \n2 3 4 5 * \n.\n2 3 4 5 * \n.\n3 4 5 * \n.\n4 5 * \n.\n"
+ "text": [
+ "0 1 2 3 4 * \n",
+ "1 2 3 4 5 * \n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "1 2 3 4 5 * \n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "3 4 5 * \n",
+ ".\n",
+ "4 5 * \n",
+ ".\n"
+ ]
}
],
"prompt_number": 20
@@ -739,14 +1310,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.26 Generating Pseudo-Random Numbers\nThis program uses the rand() function to generate pseudo-random numbers:\n'''\nimport random\n\n# prints pseudo-random numbers:\n\nfor i in range(0,8):\n print random.random()\n\n ",
+ "input": [
+ "\n",
+ "import random\n",
+ "\n",
+ "# prints pseudo-random numbers:\n",
+ "\n",
+ "for i in range(0,8):\n",
+ " print random.random()\n",
+ "\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.702115758628\n0.969460447904\n0.409934401112\n0.700339443791\n0.093528851602\n0.132172955687\n0.0162887279366\n0.943010713478\n"
+ "text": [
+ "0.702115758628\n",
+ "0.969460447904\n",
+ "0.409934401112\n",
+ "0.700339443791\n",
+ "0.093528851602\n",
+ "0.132172955687\n",
+ "0.0162887279366\n",
+ "0.943010713478\n"
+ ]
}
],
"prompt_number": 21
@@ -754,25 +1344,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.27 Setting the Seed Interactively\nThis program is the same as the one in Example 4.26 except that it allows the pseudo-random number\ngenerator's seed to be set interactively:\n'''\nimport random\n# prints pseudo-random numbers:\nprint \"Enter seed: \"\nseed = int(raw_input())\nrandom.seed(seed);\nfor i in range(0,8):\n print random.random()\n",
+ "input": [
+ "\n",
+ "import random\n",
+ "# prints pseudo-random numbers:\n",
+ "print \"Enter seed: \"\n",
+ "seed = int(raw_input())\n",
+ "random.seed(seed);\n",
+ "for i in range(0,8):\n",
+ " print random.random()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter seed: \n"
+ "text": [
+ "Enter seed: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.62290169489\n0.741786989261\n0.795193565566\n0.942450283777\n0.73989857474\n0.922324996665\n0.0290052282836\n0.465622654378\n"
+ "text": [
+ "0.62290169489\n",
+ "0.741786989261\n",
+ "0.795193565566\n",
+ "0.942450283777\n",
+ "0.73989857474\n",
+ "0.922324996665\n",
+ "0.0290052282836\n",
+ "0.465622654378\n"
+ ]
}
],
"prompt_number": 22
@@ -780,14 +1392,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.28 Setting the Seed from the System Clock\nThis program is the same as the one in Example 4.27 except that it sets the pseudo-random number\ngenerator's seed from the system clock.\n'''\nimport random\nfor i in range(0,8):\n print random.random()\n",
+ "input": [
+ "\n",
+ "import random\n",
+ "for i in range(0,8):\n",
+ " print random.random()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.943356716998\n0.648974553137\n0.900900491751\n0.113205964653\n0.469069047782\n0.24657283262\n0.543760859236\n0.573941187928\n"
+ "text": [
+ "0.943356716998\n",
+ "0.648974553137\n",
+ "0.900900491751\n",
+ "0.113205964653\n",
+ "0.469069047782\n",
+ "0.24657283262\n",
+ "0.543760859236\n",
+ "0.573941187928\n"
+ ]
}
],
"prompt_number": 23
@@ -795,31 +1421,52 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.29 Generating Pseudo-Random Numbers in Given Range\nThis program is the same as the one in Example 4.28 except that the pseudo-random numbers that it\ngenerates are restricted to given range:\n'''\nimport random\nprint \"Enter minimum and maximum: \"\nm = int(raw_input())\nn = int(raw_input())\n# lowest and highest numbers\nr = n - m + 1\n# number of numbers in range\nfor i in range(0,20):\n j = int(random.random()*100 % r + m)\n print j,\n print \" \",\n",
+ "input": [
+ "\n",
+ "import random\n",
+ "print \"Enter minimum and maximum: \"\n",
+ "m = int(raw_input())\n",
+ "n = int(raw_input())\n",
+ "# lowest and highest numbers\n",
+ "r = n - m + 1\n",
+ "# number of numbers in range\n",
+ "for i in range(0,20):\n",
+ " j = int(random.random()*100 % r + m)\n",
+ " print j,\n",
+ " print \" \",\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter minimum and maximum: \n"
+ "text": [
+ "Enter minimum and maximum: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "15\n"
+ "text": [
+ "15\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "6 15 10 8 15 9 7 7 11 6 5 15 14 15 15 15 11 13 14 6 \n"
+ "text": [
+ "6 15 10 8 15 9 7 7 11 6 5 15 14 15 15 15 11 13 14 6 \n"
+ ]
}
],
"prompt_number": 24
@@ -827,7 +1474,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch5.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch5.ipynb
index 6ef37c88..a10c8e6e 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch5.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch5"
+ "name": "",
+ "signature": "sha256:507ed1502286b7e07eb64a51dd0502249f2763079a23aefef815ad5e65c327ad"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.1 The Square Root Function sqrt()\n'''\nimport math\n\n# tests the sqrt() function:\nfor i in range(0,6):\n print \"\\t %d \\t %f\" %(i,math.sqrt(i))",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "# tests the sqrt() function:\n",
+ "for i in range(0,6):\n",
+ " print \"\\t %d \\t %f\" %(i,math.sqrt(i))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t 0 \t 0.000000\n\t 1 \t 1.000000\n\t 2 \t 1.414214\n\t 3 \t 1.732051\n\t 4 \t 2.000000\n\t 5 \t 2.236068\n"
+ "text": [
+ "\t 0 \t 0.000000\n",
+ "\t 1 \t 1.000000\n",
+ "\t 2 \t 1.414214\n",
+ "\t 3 \t 1.732051\n",
+ "\t 4 \t 2.000000\n",
+ "\t 5 \t 2.236068\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +40,35 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.2 Testing a Trigonometry Identity\n'''\nimport math\n# tests the identity sin 2x = 2 sin x cos x:\nx = 0\nwhile x < 2:\n print \"%f \\t\\t %f \\t %f\" %(x,math.sin(2*x),2*math.sin(x)*math.cos(x))\n x += 0.2\n\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "# tests the identity sin 2x = 2 sin x cos x:\n",
+ "x = 0\n",
+ "while x < 2:\n",
+ " print \"%f \\t\\t %f \\t %f\" %(x,math.sin(2*x),2*math.sin(x)*math.cos(x))\n",
+ " x += 0.2\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.000000 \t\t 0.000000 \t 0.000000\n0.200000 \t\t 0.389418 \t 0.389418\n0.400000 \t\t 0.717356 \t 0.717356\n0.600000 \t\t 0.932039 \t 0.932039\n0.800000 \t\t 0.999574 \t 0.999574\n1.000000 \t\t 0.909297 \t 0.909297\n1.200000 \t\t 0.675463 \t 0.675463\n1.400000 \t\t 0.334988 \t 0.334988\n1.600000 \t\t -0.058374 \t -0.058374\n1.800000 \t\t -0.442520 \t -0.442520\n2.000000 \t\t -0.756802 \t -0.756802\n"
+ "text": [
+ "0.000000 \t\t 0.000000 \t 0.000000\n",
+ "0.200000 \t\t 0.389418 \t 0.389418\n",
+ "0.400000 \t\t 0.717356 \t 0.717356\n",
+ "0.600000 \t\t 0.932039 \t 0.932039\n",
+ "0.800000 \t\t 0.999574 \t 0.999574\n",
+ "1.000000 \t\t 0.909297 \t 0.909297\n",
+ "1.200000 \t\t 0.675463 \t 0.675463\n",
+ "1.400000 \t\t 0.334988 \t 0.334988\n",
+ "1.600000 \t\t -0.058374 \t -0.058374\n",
+ "1.800000 \t\t -0.442520 \t -0.442520\n",
+ "2.000000 \t\t -0.756802 \t -0.756802\n"
+ ]
}
],
"prompt_number": 2
@@ -40,7 +76,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.3 A cube() Function\nHere is a simple example of a user-defined function:\n'''\n\ndef cube(x):\n # returns cube of x:\n return x*x*x\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "def cube(x):\n",
+ " # returns cube of x:\n",
+ " return x*x*x\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -49,7 +92,19 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.4 A Test Driver for the cube() Function\nHere is a complete program that includes the definition of the cube() function from Example 5.4\ntogether with a test driver for it:\n'''\n\ndef cube(x):\n # returns cube of x:\n return x*x*x\n\n# tests the cube() function:\nn=1\nwhile (n != 0):\n n = int(raw_input())\n print \"\\tcube( %d ) = %d\" %(n,cube(n))",
+ "input": [
+ "\n",
+ "\n",
+ "def cube(x):\n",
+ " # returns cube of x:\n",
+ " return x*x*x\n",
+ "\n",
+ "# tests the cube() function:\n",
+ "n=1\n",
+ "while (n != 0):\n",
+ " n = int(raw_input())\n",
+ " print \"\\tcube( %d ) = %d\" %(n,cube(n))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -57,45 +112,61 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tcube( 4 ) = 64\n"
+ "text": [
+ "\tcube( 4 ) = 64\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tcube( 2 ) = 8\n"
+ "text": [
+ "\tcube( 2 ) = 8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tcube( 9 ) = 729\n"
+ "text": [
+ "\tcube( 9 ) = 729\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tcube( 0 ) = 0\n"
+ "text": [
+ "\tcube( 0 ) = 0\n"
+ ]
}
],
"prompt_number": 1
@@ -103,7 +174,24 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.5 A Test Driver for the max() Function\nHere is a function with two parameters. It returns the larger of the two values passed to it.\n'''\n\ndef maximum(x,y):\n # returns larger of the two given integers:\n if (x < y):\n return y\n else:\n return x\n\n# tests the max() function:\nm = 1\nn = 1\nwhile m != 0: \n m = int(raw_input())\n n = int(raw_input())\n print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n\n",
+ "input": [
+ "\n",
+ "def maximum(x,y):\n",
+ " # returns larger of the two given integers:\n",
+ " if (x < y):\n",
+ " return y\n",
+ " else:\n",
+ " return x\n",
+ "\n",
+ "# tests the max() function:\n",
+ "m = 1\n",
+ "n = 1\n",
+ "while m != 0: \n",
+ " m = int(raw_input())\n",
+ " n = int(raw_input())\n",
+ " print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -111,35 +199,47 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax( 5 , 2 ) = 5\n"
+ "text": [
+ "\tmax( 5 , 2 ) = 5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax( 0 , 3 ) = 3\n"
+ "text": [
+ "\tmax( 0 , 3 ) = 3\n"
+ ]
}
],
"prompt_number": 2
@@ -147,7 +247,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.6 The max() Function with Declaration Separate from Definition\n'''\n\ndef maximum(x,y):\n # returns larger of the two given integers:\n if (x < y):\n return y\n else:\n return x\n\n# tests the max() function:\nm = 1\nn = 1\nwhile m != 0: \n m = int(raw_input())\n n = int(raw_input())\n print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "def maximum(x,y):\n",
+ " # returns larger of the two given integers:\n",
+ " if (x < y):\n",
+ " return y\n",
+ " else:\n",
+ " return x\n",
+ "\n",
+ "# tests the max() function:\n",
+ "m = 1\n",
+ "n = 1\n",
+ "while m != 0: \n",
+ " m = int(raw_input())\n",
+ " n = int(raw_input())\n",
+ " print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -155,35 +273,47 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax( 5 , 2 ) = 5\n"
+ "text": [
+ "\tmax( 5 , 2 ) = 5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax( 0 , 3 ) = 3\n"
+ "text": [
+ "\tmax( 0 , 3 ) = 3\n"
+ ]
}
],
"prompt_number": 3
@@ -191,7 +321,18 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.8 The max() Function Compiled Separately\n'''\n\n\n# returns larger of the two given integers:\n\nm = 1\nn = 1\nwhile m!=0:\n m = int(raw_input())\n n = int(raw_input())\n print \"\\tmax(%d,%d) = %d\" %(m,n, max(m,n))\n",
+ "input": [
+ "\n",
+ "\n",
+ "# returns larger of the two given integers:\n",
+ "\n",
+ "m = 1\n",
+ "n = 1\n",
+ "while m!=0:\n",
+ " m = int(raw_input())\n",
+ " n = int(raw_input())\n",
+ " print \"\\tmax(%d,%d) = %d\" %(m,n, max(m,n))\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -199,69 +340,93 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax(5,4) = 5\n"
+ "text": [
+ "\tmax(5,4) = 5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax(4,3) = 4\n"
+ "text": [
+ "\tmax(4,3) = 4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax(8,0) = 8\n"
+ "text": [
+ "\tmax(8,0) = 8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax(0,5) = 5\n"
+ "text": [
+ "\tmax(0,5) = 5\n"
+ ]
}
],
"prompt_number": 4
@@ -269,14 +434,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.9 The Factorial Function\n'''\n\ndef fact(n):\n if (n < 0):\n return 0\n f = 1\n while (n > 1):\n f *= n\n n -= 1\n return f\n\nfor i in range(-1,6):\n print fact(i),\n",
+ "input": [
+ "\n",
+ "\n",
+ "def fact(n):\n",
+ " if (n < 0):\n",
+ " return 0\n",
+ " f = 1\n",
+ " while (n > 1):\n",
+ " f *= n\n",
+ " n -= 1\n",
+ " return f\n",
+ "\n",
+ "for i in range(-1,6):\n",
+ " print fact(i),\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 1 2 6 24 120\n"
+ "text": [
+ "0 1 1 2 6 24 120\n"
+ ]
}
],
"prompt_number": 5
@@ -284,14 +465,46 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.10 The Permutation Function\n'''\ndef fact(n):\n if (n < 0):\n return 0\n f = 1\n while (n > 1):\n f *= n\n n -= 1\n return f\n\n\ndef perm(n,k):\n # returns P(n,k), the number of permutations of k from n:\n if (n < 0 or k < 0 or k > n):\n return 0\n return fact(n)/fact(n-k)\n\nfor i in range(-1,8):\n for j in range(-1,i+2):\n print perm(i,j),\n print ''\n",
+ "input": [
+ "\n",
+ "def fact(n):\n",
+ " if (n < 0):\n",
+ " return 0\n",
+ " f = 1\n",
+ " while (n > 1):\n",
+ " f *= n\n",
+ " n -= 1\n",
+ " return f\n",
+ "\n",
+ "\n",
+ "def perm(n,k):\n",
+ " # returns P(n,k), the number of permutations of k from n:\n",
+ " if (n < 0 or k < 0 or k > n):\n",
+ " return 0\n",
+ " return fact(n)/fact(n-k)\n",
+ "\n",
+ "for i in range(-1,8):\n",
+ " for j in range(-1,i+2):\n",
+ " print perm(i,j),\n",
+ " print ''\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 0 \n0 1 0 \n0 1 1 0 \n0 1 2 2 0 \n0 1 3 6 6 0 \n0 1 4 12 24 24 0 \n0 1 5 20 60 120 120 0 \n0 1 6 30 120 360 720 720 0 \n0 1 7 42 210 840 2520 5040 5040 0 \n"
+ "text": [
+ "0 0 \n",
+ "0 1 0 \n",
+ "0 1 1 0 \n",
+ "0 1 2 2 0 \n",
+ "0 1 3 6 6 0 \n",
+ "0 1 4 12 24 24 0 \n",
+ "0 1 5 20 60 120 120 0 \n",
+ "0 1 6 30 120 360 720 720 0 \n",
+ "0 1 7 42 210 840 2520 5040 5040 0 \n"
+ ]
}
],
"prompt_number": 6
@@ -299,7 +512,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.11 A Function that Prints Dates\n'''\n\ndef printDate(m,d,y):\n # prints the given date in literal form:\n if (m < 1 or m > 12 or d < 1 or d > 31 or y < 0):\n print \"Error: parameter out of range.\\n\"\n return\n if m == 1:\n print \"January \",\n elif m ==2:\n print \"February \",\n elif m==3 :\n print \"March \",\n elif m==4:\n print \"April \",\n elif m==5:\n print \"May \",\n elif m==6:\n print \"June \",\n elif m==7:\n print \"July \",\n elif m==8:\n print \"August \",\n elif m==9:\n print \"September \",\n elif m==10:\n print \"October \",\n elif m==1:\n print \"November \",\n else:\n print \"December \",\n print d , \", \", y \n\n# tests the printDate() function:\nmonth = 1\nwhile month > 0:\n month = int(raw_input())\n day = int(raw_input())\n year = int(raw_input())\n printDate(month,day,year)\n",
+ "input": [
+ "\n",
+ "def printDate(m,d,y):\n",
+ " # prints the given date in literal form:\n",
+ " if (m < 1 or m > 12 or d < 1 or d > 31 or y < 0):\n",
+ " print \"Error: parameter out of range.\\n\"\n",
+ " return\n",
+ " if m == 1:\n",
+ " print \"January \",\n",
+ " elif m ==2:\n",
+ " print \"February \",\n",
+ " elif m==3 :\n",
+ " print \"March \",\n",
+ " elif m==4:\n",
+ " print \"April \",\n",
+ " elif m==5:\n",
+ " print \"May \",\n",
+ " elif m==6:\n",
+ " print \"June \",\n",
+ " elif m==7:\n",
+ " print \"July \",\n",
+ " elif m==8:\n",
+ " print \"August \",\n",
+ " elif m==9:\n",
+ " print \"September \",\n",
+ " elif m==10:\n",
+ " print \"October \",\n",
+ " elif m==1:\n",
+ " print \"November \",\n",
+ " else:\n",
+ " print \"December \",\n",
+ " print d , \", \", y \n",
+ "\n",
+ "# tests the printDate() function:\n",
+ "month = 1\n",
+ "while month > 0:\n",
+ " month = int(raw_input())\n",
+ " day = int(raw_input())\n",
+ " year = int(raw_input())\n",
+ " printDate(month,day,year)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -307,47 +560,64 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "12\n"
+ "text": [
+ "12\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1989\n"
+ "text": [
+ "1989\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "September 12 , 1989\n"
+ "text": [
+ "September 12 , 1989\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2001\n"
+ "text": [
+ "2001\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Error: parameter out of range.\n\n"
+ "text": [
+ "Error: parameter out of range.\n",
+ "\n"
+ ]
}
],
"prompt_number": 8
@@ -355,14 +625,305 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.12 Classifying Characters\n'''\nimport string\ndef ispunct(s):\n return all(c in string.punctuation for c in s)\ndef printCharCategory(c):\n # prints the category to which the given character belongs:\n print \"The character [\" + c + \"] is a \",\n if(c.isdigit()):\n print \"digit.\\n\"\n elif (c.islower()):\n print \"lower-case letter.\\n\"\n elif (c.isupper()): \n print \"capital letter.\\n\"\n elif (c.isspace()):\n print \"white space character.\\n\"\n elif (ord(c) >= 10 and ord(c) <= 15 or ord(c) == 0):\n print \"control character.\\n\"\n elif (ispunct(c)):\n print \"punctuation mark.\\n\"\n else:\n print \"Error.\\n\"\n\n# prints the category to which the given character belongs;\n# tests the printCharCategory() function:\nfor c in range(128):\n printCharCategory(chr(c))\n",
+ "input": [
+ "\n",
+ "import string\n",
+ "def ispunct(s):\n",
+ " return all(c in string.punctuation for c in s)\n",
+ "def printCharCategory(c):\n",
+ " # prints the category to which the given character belongs:\n",
+ " print \"The character [\" + c + \"] is a \",\n",
+ " if(c.isdigit()):\n",
+ " print \"digit.\\n\"\n",
+ " elif (c.islower()):\n",
+ " print \"lower-case letter.\\n\"\n",
+ " elif (c.isupper()): \n",
+ " print \"capital letter.\\n\"\n",
+ " elif (c.isspace()):\n",
+ " print \"white space character.\\n\"\n",
+ " elif (ord(c) >= 10 and ord(c) <= 15 or ord(c) == 0):\n",
+ " print \"control character.\\n\"\n",
+ " elif (ispunct(c)):\n",
+ " print \"punctuation mark.\\n\"\n",
+ " else:\n",
+ " print \"Error.\\n\"\n",
+ "\n",
+ "# prints the category to which the given character belongs;\n",
+ "# tests the printCharCategory() function:\n",
+ "for c in range(128):\n",
+ " printCharCategory(chr(c))\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " The character [\u0000] is a control character.\n\nThe character [\u0001] is a Error.\n\nThe character [\u0002] is a Error.\n\nThe character [\u0003] is a Error.\n\nThe character [\u0004] is a Error.\n\nThe character [\u0005] is a Error.\n\nThe character [\u0006] is a Error.\n\nThe character [\u0007] is a Error.\n\nThe character [\b] is a Error.\n\nThe character [\t] is a white space character.\n\nThe character [\n] is a white space character.\n\nThe character [\u000b] is a white space character.\n\nThe character [\f] is a white space character.\n\nThe character [\r] is a white space character.\n\nThe character [\u000e] is a control character.\n\nThe character [\u000f] is a control character.\n\nThe character [\u0010] is a Error.\n\nThe character [\u0011] is a Error.\n\nThe character [\u0012] is a Error.\n\nThe character [\u0013] is a Error.\n\nThe character [\u0014] is a Error.\n\nThe character [\u0015] is a Error.\n\nThe character [\u0016] is a Error.\n\nThe character [\u0017] is a Error.\n\nThe character [\u0018] is a Error.\n\nThe character [\u0019] is a Error.\n\nThe character [\u001a] is a Error.\n\nThe character [\u001b] is a Error.\n\nThe character [\u001c] is a Error.\n\nThe character [\u001d] is a Error.\n\nThe character [\u001e] is a Error.\n\nThe character [\u001f] is a Error.\n\nThe character [ ] is a white space character.\n\nThe character [!] is a punctuation mark.\n\nThe character [\"] is a punctuation mark.\n\nThe character [#] is a punctuation mark.\n\nThe character [$] is a punctuation mark.\n\nThe character [%] is a punctuation mark.\n\nThe character [&] is a punctuation mark.\n\nThe character ['] is a punctuation mark.\n\nThe character [(] is a punctuation mark.\n\nThe character [)] is a punctuation mark.\n\nThe character [*] is a punctuation mark.\n\nThe character [+] is a punctuation mark.\n\nThe character [,] is a punctuation mark.\n\nThe character [-] is a punctuation mark.\n\nThe character [.] is a punctuation mark.\n\nThe character [/] is a punctuation mark.\n\nThe character [0] is a digit.\n\nThe character [1] is a digit.\n\nThe character [2] is a digit.\n\nThe character [3] is a digit.\n\nThe character [4] is a digit.\n\nThe character [5] is a digit.\n\nThe character [6] is a digit.\n\nThe character [7] is a digit.\n\nThe character [8] is a digit.\n\nThe character [9] is a digit.\n\nThe character [:] is a punctuation mark.\n\nThe character [;] is a punctuation mark.\n\nThe character [<] is a punctuation mark.\n\nThe character [=] is a punctuation mark.\n\nThe character [>] is a punctuation mark.\n\nThe character [?] is a punctuation mark.\n\nThe character [@] is a punctuation mark.\n\nThe character [A] is a capital letter.\n\nThe character [B] is a capital letter.\n\nThe character [C] is a capital letter.\n\nThe character [D] is a capital letter.\n\nThe character [E] is a capital letter.\n\nThe character [F] is a capital letter.\n\nThe character [G] is a capital letter.\n\nThe character [H] is a capital letter.\n\nThe character [I] is a capital letter.\n\nThe character [J] is a capital letter.\n\nThe character [K] is a capital letter.\n\nThe character [L] is a capital letter.\n\nThe character [M] is a capital letter.\n\nThe character [N] is a capital letter.\n\nThe character [O] is a capital letter.\n\nThe character [P] is a capital letter.\n\nThe character [Q] is a capital letter.\n\nThe character [R] is a capital letter.\n\nThe character [S] is a capital letter.\n\nThe character [T] is a capital letter.\n\nThe character [U] is a capital letter.\n\nThe character [V] is a capital letter.\n\nThe character [W] is a capital letter.\n\nThe character [X] is a capital letter.\n\nThe character [Y] is a capital letter.\n\nThe character [Z] is a capital letter.\n\nThe character [[] is a punctuation mark.\n\nThe character [\\] is a punctuation mark.\n\nThe character []] is a punctuation mark.\n\nThe character [^] is a punctuation mark.\n\nThe character [_] is a punctuation mark.\n\nThe character [`] is a punctuation mark.\n\nThe character [a] is a lower-case letter.\n\nThe character [b] is a lower-case letter.\n\nThe character [c] is a lower-case letter.\n\nThe character [d] is a lower-case letter.\n\nThe character [e] is a lower-case letter.\n\nThe character [f] is a lower-case letter.\n\nThe character [g] is a lower-case letter.\n\nThe character [h] is a lower-case letter.\n\nThe character [i] is a lower-case letter.\n\nThe character [j] is a lower-case letter.\n\nThe character [k] is a lower-case letter.\n\nThe character [l] is a lower-case letter.\n\nThe character [m] is a lower-case letter.\n\nThe character [n] is a lower-case letter.\n\nThe character [o] is a lower-case letter.\n\nThe character [p] is a lower-case letter.\n\nThe character [q] is a lower-case letter.\n\nThe character [r] is a lower-case letter.\n\nThe character [s] is a lower-case letter.\n\nThe character [t] is a lower-case letter.\n\nThe character [u] is a lower-case letter.\n\nThe character [v] is a lower-case letter.\n\nThe character [w] is a lower-case letter.\n\nThe character [x] is a lower-case letter.\n\nThe character [y] is a lower-case letter.\n\nThe character [z] is a lower-case letter.\n\nThe character [{] is a punctuation mark.\n\nThe character [|] is a punctuation mark.\n\nThe character [}] is a punctuation mark.\n\nThe character [~] is a punctuation mark.\n\nThe character [\u007f] is a Error.\n\n"
+ "text": [
+ " The character [\u0000] is a control character.\n",
+ "\n",
+ "The character [\u0001] is a Error.\n",
+ "\n",
+ "The character [\u0002] is a Error.\n",
+ "\n",
+ "The character [\u0003] is a Error.\n",
+ "\n",
+ "The character [\u0004] is a Error.\n",
+ "\n",
+ "The character [\u0005] is a Error.\n",
+ "\n",
+ "The character [\u0006] is a Error.\n",
+ "\n",
+ "The character [\u0007] is a Error.\n",
+ "\n",
+ "The character [\b] is a Error.\n",
+ "\n",
+ "The character [\t] is a white space character.\n",
+ "\n",
+ "The character [\n",
+ "] is a white space character.\n",
+ "\n",
+ "The character [\u000b",
+ "] is a white space character.\n",
+ "\n",
+ "The character [\f",
+ "] is a white space character.\n",
+ "\n",
+ "The character [\r",
+ "] is a white space character.\n",
+ "\n",
+ "The character [\u000e] is a control character.\n",
+ "\n",
+ "The character [\u000f] is a control character.\n",
+ "\n",
+ "The character [\u0010] is a Error.\n",
+ "\n",
+ "The character [\u0011] is a Error.\n",
+ "\n",
+ "The character [\u0012] is a Error.\n",
+ "\n",
+ "The character [\u0013] is a Error.\n",
+ "\n",
+ "The character [\u0014] is a Error.\n",
+ "\n",
+ "The character [\u0015] is a Error.\n",
+ "\n",
+ "The character [\u0016] is a Error.\n",
+ "\n",
+ "The character [\u0017] is a Error.\n",
+ "\n",
+ "The character [\u0018] is a Error.\n",
+ "\n",
+ "The character [\u0019] is a Error.\n",
+ "\n",
+ "The character [\u001a] is a Error.\n",
+ "\n",
+ "The character [\u001b] is a Error.\n",
+ "\n",
+ "The character [\u001c",
+ "] is a Error.\n",
+ "\n",
+ "The character [\u001d",
+ "] is a Error.\n",
+ "\n",
+ "The character [\u001e",
+ "] is a Error.\n",
+ "\n",
+ "The character [\u001f] is a Error.\n",
+ "\n",
+ "The character [ ] is a white space character.\n",
+ "\n",
+ "The character [!] is a punctuation mark.\n",
+ "\n",
+ "The character [\"] is a punctuation mark.\n",
+ "\n",
+ "The character [#] is a punctuation mark.\n",
+ "\n",
+ "The character [$] is a punctuation mark.\n",
+ "\n",
+ "The character [%] is a punctuation mark.\n",
+ "\n",
+ "The character [&] is a punctuation mark.\n",
+ "\n",
+ "The character ['] is a punctuation mark.\n",
+ "\n",
+ "The character [(] is a punctuation mark.\n",
+ "\n",
+ "The character [)] is a punctuation mark.\n",
+ "\n",
+ "The character [*] is a punctuation mark.\n",
+ "\n",
+ "The character [+] is a punctuation mark.\n",
+ "\n",
+ "The character [,] is a punctuation mark.\n",
+ "\n",
+ "The character [-] is a punctuation mark.\n",
+ "\n",
+ "The character [.] is a punctuation mark.\n",
+ "\n",
+ "The character [/] is a punctuation mark.\n",
+ "\n",
+ "The character [0] is a digit.\n",
+ "\n",
+ "The character [1] is a digit.\n",
+ "\n",
+ "The character [2] is a digit.\n",
+ "\n",
+ "The character [3] is a digit.\n",
+ "\n",
+ "The character [4] is a digit.\n",
+ "\n",
+ "The character [5] is a digit.\n",
+ "\n",
+ "The character [6] is a digit.\n",
+ "\n",
+ "The character [7] is a digit.\n",
+ "\n",
+ "The character [8] is a digit.\n",
+ "\n",
+ "The character [9] is a digit.\n",
+ "\n",
+ "The character [:] is a punctuation mark.\n",
+ "\n",
+ "The character [;] is a punctuation mark.\n",
+ "\n",
+ "The character [<] is a punctuation mark.\n",
+ "\n",
+ "The character [=] is a punctuation mark.\n",
+ "\n",
+ "The character [>] is a punctuation mark.\n",
+ "\n",
+ "The character [?] is a punctuation mark.\n",
+ "\n",
+ "The character [@] is a punctuation mark.\n",
+ "\n",
+ "The character [A] is a capital letter.\n",
+ "\n",
+ "The character [B] is a capital letter.\n",
+ "\n",
+ "The character [C] is a capital letter.\n",
+ "\n",
+ "The character [D] is a capital letter.\n",
+ "\n",
+ "The character [E] is a capital letter.\n",
+ "\n",
+ "The character [F] is a capital letter.\n",
+ "\n",
+ "The character [G] is a capital letter.\n",
+ "\n",
+ "The character [H] is a capital letter.\n",
+ "\n",
+ "The character [I] is a capital letter.\n",
+ "\n",
+ "The character [J] is a capital letter.\n",
+ "\n",
+ "The character [K] is a capital letter.\n",
+ "\n",
+ "The character [L] is a capital letter.\n",
+ "\n",
+ "The character [M] is a capital letter.\n",
+ "\n",
+ "The character [N] is a capital letter.\n",
+ "\n",
+ "The character [O] is a capital letter.\n",
+ "\n",
+ "The character [P] is a capital letter.\n",
+ "\n",
+ "The character [Q] is a capital letter.\n",
+ "\n",
+ "The character [R] is a capital letter.\n",
+ "\n",
+ "The character [S] is a capital letter.\n",
+ "\n",
+ "The character [T] is a capital letter.\n",
+ "\n",
+ "The character [U] is a capital letter.\n",
+ "\n",
+ "The character [V] is a capital letter.\n",
+ "\n",
+ "The character [W] is a capital letter.\n",
+ "\n",
+ "The character [X] is a capital letter.\n",
+ "\n",
+ "The character [Y] is a capital letter.\n",
+ "\n",
+ "The character [Z] is a capital letter.\n",
+ "\n",
+ "The character [[] is a punctuation mark.\n",
+ "\n",
+ "The character [\\] is a punctuation mark.\n",
+ "\n",
+ "The character []] is a punctuation mark.\n",
+ "\n",
+ "The character [^] is a punctuation mark.\n",
+ "\n",
+ "The character [_] is a punctuation mark.\n",
+ "\n",
+ "The character [`] is a punctuation mark.\n",
+ "\n",
+ "The character [a] is a lower-case letter.\n",
+ "\n",
+ "The character [b] is a lower-case letter.\n",
+ "\n",
+ "The character [c] is a lower-case letter.\n",
+ "\n",
+ "The character [d] is a lower-case letter.\n",
+ "\n",
+ "The character [e] is a lower-case letter.\n",
+ "\n",
+ "The character [f] is a lower-case letter.\n",
+ "\n",
+ "The character [g] is a lower-case letter.\n",
+ "\n",
+ "The character [h] is a lower-case letter.\n",
+ "\n",
+ "The character [i] is a lower-case letter.\n",
+ "\n",
+ "The character [j] is a lower-case letter.\n",
+ "\n",
+ "The character [k] is a lower-case letter.\n",
+ "\n",
+ "The character [l] is a lower-case letter.\n",
+ "\n",
+ "The character [m] is a lower-case letter.\n",
+ "\n",
+ "The character [n] is a lower-case letter.\n",
+ "\n",
+ "The character [o] is a lower-case letter.\n",
+ "\n",
+ "The character [p] is a lower-case letter.\n",
+ "\n",
+ "The character [q] is a lower-case letter.\n",
+ "\n",
+ "The character [r] is a lower-case letter.\n",
+ "\n",
+ "The character [s] is a lower-case letter.\n",
+ "\n",
+ "The character [t] is a lower-case letter.\n",
+ "\n",
+ "The character [u] is a lower-case letter.\n",
+ "\n",
+ "The character [v] is a lower-case letter.\n",
+ "\n",
+ "The character [w] is a lower-case letter.\n",
+ "\n",
+ "The character [x] is a lower-case letter.\n",
+ "\n",
+ "The character [y] is a lower-case letter.\n",
+ "\n",
+ "The character [z] is a lower-case letter.\n",
+ "\n",
+ "The character [{] is a punctuation mark.\n",
+ "\n",
+ "The character [|] is a punctuation mark.\n",
+ "\n",
+ "The character [}] is a punctuation mark.\n",
+ "\n",
+ "The character [~] is a punctuation mark.\n",
+ "\n",
+ "The character [\u007f] is a Error.\n",
+ "\n"
+ ]
}
],
"prompt_number": 4
@@ -370,14 +931,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.13 A Function that Tests Primality\n'''\nimport math\ndef isPrime(n):\n # returns True if n is prime, False otherwise:\n sqrtn = math.sqrt(n)\n if (n < 2):\n return False\n # 0 and 1 are not primes\n if (n < 4):\n return True\n # 2 and 3 are the first primes\n if (n%2 == 0):\n return False\n # 2 is the only even prime\n for d in range(3,int(sqrtn+1),2):\n if (n%d == 0):\n return False\n # n has a nontrivial divisor\n return True;\n\nfor n in range(0,80):\n if (isPrime(n)):\n print n,\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "def isPrime(n):\n",
+ " # returns True if n is prime, False otherwise:\n",
+ " sqrtn = math.sqrt(n)\n",
+ " if (n < 2):\n",
+ " return False\n",
+ " # 0 and 1 are not primes\n",
+ " if (n < 4):\n",
+ " return True\n",
+ " # 2 and 3 are the first primes\n",
+ " if (n%2 == 0):\n",
+ " return False\n",
+ " # 2 is the only even prime\n",
+ " for d in range(3,int(sqrtn+1),2):\n",
+ " if (n%d == 0):\n",
+ " return False\n",
+ " # n has a nontrivial divisor\n",
+ " return True;\n",
+ "\n",
+ "for n in range(0,80):\n",
+ " if (isPrime(n)):\n",
+ " print n,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79\n"
+ "text": [
+ "2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79\n"
+ ]
}
],
"prompt_number": 10
@@ -385,7 +972,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.14 A Leap Year Function\n'''\ndef isLeapYear(y):\n # returns true iff y is a leap year:\n return (y % 4 == 0 and y % 100 != 0 or y % 400 == 0)\n\n# tests the isLeapYear() function:\nn = 2\nwhile n > 1:\n n = int(raw_input())\n if (isLeapYear(n)):\n print \"%d is a leap year.\" % n\n else:\n print \"%d is not a leap year.\" %n\n",
+ "input": [
+ "\n",
+ "def isLeapYear(y):\n",
+ " # returns true iff y is a leap year:\n",
+ " return (y % 4 == 0 and y % 100 != 0 or y % 400 == 0)\n",
+ "\n",
+ "# tests the isLeapYear() function:\n",
+ "n = 2\n",
+ "while n > 1:\n",
+ " n = int(raw_input())\n",
+ " if (isLeapYear(n)):\n",
+ " print \"%d is a leap year.\" % n\n",
+ " else:\n",
+ " print \"%d is not a leap year.\" %n\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -393,45 +994,61 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2004\n"
+ "text": [
+ "2004\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "2004 is a leap year.\n"
+ "text": [
+ "2004 is a leap year.\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2006\n"
+ "text": [
+ "2006\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "2006 is not a leap year.\n"
+ "text": [
+ "2006 is not a leap year.\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2013\n"
+ "text": [
+ "2013\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "2013 is not a leap year.\n"
+ "text": [
+ "2013 is not a leap year.\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 is a leap year.\n"
+ "text": [
+ "0 is a leap year.\n"
+ ]
}
],
"prompt_number": 11
@@ -439,47 +1056,88 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.15 A Function for Reading the User's Age\n'''\n\ndef age():\n # prompts the user to input his/her age, and returns that value:\n while (True):\n print \"How old are you: \"\n n = int(raw_input())\n if (n < 0):\n print \"\\a\\tYour age could not be negative.\"\n elif (n > 120):\n print \"\\a\\tYou could not be over 120.\"\n else:\n return n\n print \"\\n\\tTry again.\\n\"\n\na = age();\nprint \"\\nYou are %d years old.\" %a\n",
+ "input": [
+ "\n",
+ "\n",
+ "def age():\n",
+ " # prompts the user to input his/her age, and returns that value:\n",
+ " while (True):\n",
+ " print \"How old are you: \"\n",
+ " n = int(raw_input())\n",
+ " if (n < 0):\n",
+ " print \"\\a\\tYour age could not be negative.\"\n",
+ " elif (n > 120):\n",
+ " print \"\\a\\tYou could not be over 120.\"\n",
+ " else:\n",
+ " return n\n",
+ " print \"\\n\\tTry again.\\n\"\n",
+ "\n",
+ "a = age();\n",
+ "print \"\\nYou are %d years old.\" %a\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "How old are you: \n"
+ "text": [
+ "How old are you: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "-12\n"
+ "text": [
+ "-12\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\u0007\tYour age could not be negative.\n\n\tTry again.\n\nHow old are you: \n"
+ "text": [
+ "\u0007\tYour age could not be negative.\n",
+ "\n",
+ "\tTry again.\n",
+ "\n",
+ "How old are you: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "125\n"
+ "text": [
+ "125\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\u0007\tYou could not be over 120.\n\n\tTry again.\n\nHow old are you: \n"
+ "text": [
+ "\u0007\tYou could not be over 120.\n",
+ "\n",
+ "\tTry again.\n",
+ "\n",
+ "How old are you: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "24\n"
+ "text": [
+ "24\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\nYou are 24 years old.\n"
+ "text": [
+ "\n",
+ "You are 24 years old.\n"
+ ]
}
],
"prompt_number": 14
@@ -487,14 +1145,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.16 The swap() Function\n'''\n\ndef swap(x,y):\n # exchanges the values of x and y:\n x[0],y[0] = y[0],x[0]\n\na = [22.2]\nb = [44.4]\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\nswap(a,b)\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "input": [
+ "\n",
+ "\n",
+ "def swap(x,y):\n",
+ " # exchanges the values of x and y:\n",
+ " x[0],y[0] = y[0],x[0]\n",
+ "\n",
+ "a = [22.2]\n",
+ "b = [44.4]\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "swap(a,b)\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 22.20 , b = 44.40 \na = 44.40 , b = 22.20 \n"
+ "text": [
+ "a = 22.20 , b = 44.40 \n",
+ "a = 44.40 , b = 22.20 \n"
+ ]
}
],
"prompt_number": 15
@@ -502,14 +1175,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.17 \nNote : Python doesn't support pass value by reference. but can be done by passing list.\n'''\n\ndef f(x,y):\n x[0]= 88\n y[0] = 99\n\n# tests the f() function:\na = [22]\nb = [44]\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\nf(a,b)\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\nf(2*a,b)\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "input": [
+ "\n",
+ "\n",
+ "def f(x,y):\n",
+ " x[0]= 88\n",
+ " y[0] = 99\n",
+ "\n",
+ "# tests the f() function:\n",
+ "a = [22]\n",
+ "b = [44]\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "f(a,b)\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "f(2*a,b)\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 22.00 , b = 44.00 \na = 88.00 , b = 99.00 \na = 88.00 , b = 99.00 \n"
+ "text": [
+ "a = 22.00 , b = 44.00 \n",
+ "a = 88.00 , b = 99.00 \n",
+ "a = 88.00 , b = 99.00 \n"
+ ]
}
],
"prompt_number": 16
@@ -517,25 +1209,46 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.18 Returning More than One Value\n'''\n\ndef computeCircle(r):\n # returns the area and circumference of a circle with radius r:\n PI = 3.141592653589793\n area = PI*r*r\n circumference = 2*PI*r\n return area,circumference\n\n# tests the computeCircle() function:\nprint \"Enter radius: \"\nr = int(raw_input())\na,c = computeCircle(r)\nprint \"area = %.2f , circumference = %.2f\" %(a,c)",
+ "input": [
+ "\n",
+ "\n",
+ "def computeCircle(r):\n",
+ " # returns the area and circumference of a circle with radius r:\n",
+ " PI = 3.141592653589793\n",
+ " area = PI*r*r\n",
+ " circumference = 2*PI*r\n",
+ " return area,circumference\n",
+ "\n",
+ "# tests the computeCircle() function:\n",
+ "print \"Enter radius: \"\n",
+ "r = int(raw_input())\n",
+ "a,c = computeCircle(r)\n",
+ "print \"area = %.2f , circumference = %.2f\" %(a,c)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter radius: \n"
+ "text": [
+ "Enter radius: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "area = 78.54 , circumference = 31.42\n"
+ "text": [
+ "area = 78.54 , circumference = 31.42\n"
+ ]
}
],
"prompt_number": 17
@@ -543,14 +1256,38 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.19\nNote : Python passes variable by value and not by reference. So output would be differ.\n'''\n\n\ndef f(x,y,z):\n x[0] += z[0]\n y[0] += z[0]\n print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n\nx = [22]\ny = [33]\nz = [44]\n\nprint \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\nf(x,y,z)\nprint \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\nx[0] = 2*x[0] - 3\nf(x,y,z)\nprint \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n",
+ "input": [
+ "\n",
+ "\n",
+ "def f(x,y,z):\n",
+ " x[0] += z[0]\n",
+ " y[0] += z[0]\n",
+ " print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n",
+ "\n",
+ "x = [22]\n",
+ "y = [33]\n",
+ "z = [44]\n",
+ "\n",
+ "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n",
+ "f(x,y,z)\n",
+ "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n",
+ "x[0] = 2*x[0] - 3\n",
+ "f(x,y,z)\n",
+ "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 22 , y = 33 , z = 44\nx = 66 , y = 77 , z = 44\nx = 66 , y = 77 , z = 44\nx = 173 , y = 121 , z = 44\nx = 173 , y = 121 , z = 44\n"
+ "text": [
+ "x = 22 , y = 33 , z = 44\n",
+ "x = 66 , y = 77 , z = 44\n",
+ "x = 66 , y = 77 , z = 44\n",
+ "x = 173 , y = 121 , z = 44\n",
+ "x = 173 , y = 121 , z = 44\n"
+ ]
}
],
"prompt_number": 5
@@ -558,25 +1295,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.20\n'''\ndef cube(x):\n # returns cube of x:\n return x*x*x\n\n# tests the cube() function:\nprint cube(4)\nx = int(raw_input())\ny = cube(2*x-3)\nprint y\n",
+ "input": [
+ "\n",
+ "def cube(x):\n",
+ " # returns cube of x:\n",
+ " return x*x*x\n",
+ "\n",
+ "# tests the cube() function:\n",
+ "print cube(4)\n",
+ "x = int(raw_input())\n",
+ "y = cube(2*x-3)\n",
+ "print y\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "64\n"
+ "text": [
+ "64\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "343\n"
+ "text": [
+ "343\n"
+ ]
}
],
"prompt_number": 19
@@ -584,14 +1338,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.21 Nested and Parallel Scopes\nPython has it's own scope so output would be differ.\n'''\nx = 11\n\ndef f():\n x = 44\n print \"In f(): x = %d\" % x \n\ndef g():\n print \"In g(): x = %d\" % x \n\nx = 22\nx = 33\nprint \"In block inside main(): x = %d\" % x\n\n\nprint \"In main(): x = %d\" % x \nprint \"In main(): ::x = %d\" % x \nf()\ng()\n",
+ "input": [
+ "\n",
+ "x = 11\n",
+ "\n",
+ "def f():\n",
+ " x = 44\n",
+ " print \"In f(): x = %d\" % x \n",
+ "\n",
+ "def g():\n",
+ " print \"In g(): x = %d\" % x \n",
+ "\n",
+ "x = 22\n",
+ "x = 33\n",
+ "print \"In block inside main(): x = %d\" % x\n",
+ "\n",
+ "\n",
+ "print \"In main(): x = %d\" % x \n",
+ "print \"In main(): ::x = %d\" % x \n",
+ "f()\n",
+ "g()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "In block inside main(): x = 33\nIn main(): x = 33\nIn main(): ::x = 33\nIn f(): x = 44\nIn g(): x = 33\n"
+ "text": [
+ "In block inside main(): x = 33\n",
+ "In main(): x = 33\n",
+ "In main(): ::x = 33\n",
+ "In f(): x = 44\n",
+ "In g(): x = 33\n"
+ ]
}
],
"prompt_number": 20
@@ -599,14 +1379,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.22 \n'''\n\ndef max_(x, y,z=0):\n if x > y and x > y:\n return x\n elif y > x and y > z:\n return y\n else:\n return z\n \n \nprint max(99,77), \" \" , max(55,66,33)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def max_(x, y,z=0):\n",
+ " if x > y and x > y:\n",
+ " return x\n",
+ " elif y > x and y > z:\n",
+ " return y\n",
+ " else:\n",
+ " return z\n",
+ " \n",
+ " \n",
+ "print max(99,77), \" \" , max(55,66,33)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "99 66\n"
+ "text": [
+ "99 66\n"
+ ]
}
],
"prompt_number": 21
@@ -614,31 +1409,51 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.23 Using the return Statement to Terminate a Program\n'''\n\n# prints the quotient of two input integers:\nprint \"Enter two integers: \"\nn = int(raw_input())\nd = int(raw_input())\nif (d == 0):\n import sys\n sys.exit(0)\nprint n , \"/\" , d , \" = \" , n/d \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints the quotient of two input integers:\n",
+ "print \"Enter two integers: \"\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "if (d == 0):\n",
+ " import sys\n",
+ " sys.exit(0)\n",
+ "print n , \"/\" , d , \" = \" , n/d \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "8 / 2 = 4\n"
+ "text": [
+ "8 / 2 = 4\n"
+ ]
}
],
"prompt_number": 22
@@ -646,7 +1461,18 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.24 Using the exit() Function to Terminate a Program\n'''\n\ndef reciprocal(x):\n #returns the reciprocal of x:\n if (x == 0):\n import sys\n sys.exit(1); # terminate the program\n return 1.0/x\n\nx = float(raw_input())\nprint reciprocal(x)\n",
+ "input": [
+ "\n",
+ "def reciprocal(x):\n",
+ " #returns the reciprocal of x:\n",
+ " if (x == 0):\n",
+ " import sys\n",
+ " sys.exit(1); # terminate the program\n",
+ " return 1.0/x\n",
+ "\n",
+ "x = float(raw_input())\n",
+ "print reciprocal(x)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -654,12 +1480,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "25\n"
+ "text": [
+ "25\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.04\n"
+ "text": [
+ "0.04\n"
+ ]
}
],
"prompt_number": 23
@@ -667,14 +1497,32 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.25 Default Parameters\nThis function evaluates the third degree polynomial a0 + a1x + a2x2 + a3x3. \n'''\ndef p(x,a0,a1=0,a2=0,a3=0):\n # returns a0 + a1*x + a2*x^2 + a3*x^3:\n return (a0 + (a1 + (a2 + a3*x)*x)*x)\n\n\n# tests the p() function:\nx = 2.0003\nprint \"p(x,7) = %f\" % p(x,7)\nprint \"p(x,7,6) = %f\" % p(x,7,6)\nprint \"p(x,7,6,5) = %f\" % p(x,7,6,5)\nprint \"p(x,7,6,5,4) = %f\" % p(x,7,6,5,4)\n",
+ "input": [
+ "\n",
+ "def p(x,a0,a1=0,a2=0,a3=0):\n",
+ " # returns a0 + a1*x + a2*x^2 + a3*x^3:\n",
+ " return (a0 + (a1 + (a2 + a3*x)*x)*x)\n",
+ "\n",
+ "\n",
+ "# tests the p() function:\n",
+ "x = 2.0003\n",
+ "print \"p(x,7) = %f\" % p(x,7)\n",
+ "print \"p(x,7,6) = %f\" % p(x,7,6)\n",
+ "print \"p(x,7,6,5) = %f\" % p(x,7,6,5)\n",
+ "print \"p(x,7,6,5,4) = %f\" % p(x,7,6,5,4)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "p(x,7) = 7.000000\np(x,7,6) = 19.001800\np(x,7,6,5) = 39.007800\np(x,7,6,5,4) = 71.022203\n"
+ "text": [
+ "p(x,7) = 7.000000\n",
+ "p(x,7,6) = 19.001800\n",
+ "p(x,7,6,5) = 39.007800\n",
+ "p(x,7,6,5,4) = 71.022203\n"
+ ]
}
],
"prompt_number": 24
@@ -682,7 +1530,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch6.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch6.ipynb
index a355a8d2..e1a26f6e 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch6.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch6"
+ "name": "",
+ "signature": "sha256:a7aedcfda01e5e2719af0a5e76da43c6e7b01797bb61e0483e48a2e68eb0941d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.1 Using Direct Access on Arrays\n'''\n\na = [0, 0, 0]\na[2] = 55.55\na[0] = 11.11\na[1] = 33.33\nprint \"a[0] = \" , a[0] \nprint \"a[1] = \" , a[1] \nprint \"a[2] = \" , a[2] \n",
+ "input": [
+ "\n",
+ "\n",
+ "a = [0, 0, 0]\n",
+ "a[2] = 55.55\n",
+ "a[0] = 11.11\n",
+ "a[1] = 33.33\n",
+ "print \"a[0] = \" , a[0] \n",
+ "print \"a[1] = \" , a[1] \n",
+ "print \"a[2] = \" , a[2] \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a[0] = 11.11\na[1] = 33.33\na[2] = 55.55\n"
+ "text": [
+ "a[0] = 11.11\n",
+ "a[1] = 33.33\n",
+ "a[2] = 55.55\n"
+ ]
}
],
"prompt_number": 1
@@ -25,49 +40,82 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.2 Printing a Sequence in Order\n'''\n\nSIZE=5 # defines the size N for 5 elements\na = []\n# declares the array's elements as type double\nprint \"Enter \" , SIZE , \" numbers:\\t\"\nfor i in range(SIZE):\n a.append(float(raw_input()))\n \nprint \"In reverse order: \"\nfor i in range(SIZE-1,-1,-1):\n print \"\\t\" , a[i]\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "SIZE=5 # defines the size N for 5 elements\n",
+ "a = []\n",
+ "# declares the array's elements as type double\n",
+ "print \"Enter \" , SIZE , \" numbers:\\t\"\n",
+ "for i in range(SIZE):\n",
+ " a.append(float(raw_input()))\n",
+ " \n",
+ "print \"In reverse order: \"\n",
+ "for i in range(SIZE-1,-1,-1):\n",
+ " print \"\\t\" , a[i]\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 5 numbers:\t\n"
+ "text": [
+ "Enter 5 numbers:\t\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3.3\n"
+ "text": [
+ "3.3\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4.4\n"
+ "text": [
+ "4.4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5.5\n"
+ "text": [
+ "5.5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "In reverse order: \n\t5.5\n\t4.4\n\t3.3\n\t2.0\n\t1.0\n"
+ "text": [
+ "In reverse order: \n",
+ "\t5.5\n",
+ "\t4.4\n",
+ "\t3.3\n",
+ "\t2.0\n",
+ "\t1.0\n"
+ ]
}
],
"prompt_number": 2
@@ -75,14 +123,27 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.3 Initializing an Array\nThis program initializes the array a and then prints its values:\n'''\n\na = [ 22.2, 44.4, 66.6 ]\n\nsize = len(a)\nfor i in range(size):\n print \"\\ta[\" , i , \"] = \" , a[i]\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "a = [ 22.2, 44.4, 66.6 ]\n",
+ "\n",
+ "size = len(a)\n",
+ "for i in range(size):\n",
+ " print \"\\ta[\" , i , \"] = \" , a[i]\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ta[ 0 ] = 22.2\n\ta[ 1 ] = 44.4\n\ta[ 2 ] = 66.6\n"
+ "text": [
+ "\ta[ 0 ] = 22.2\n",
+ "\ta[ 1 ] = 44.4\n",
+ "\ta[ 2 ] = 66.6\n"
+ ]
}
],
"prompt_number": 3
@@ -90,14 +151,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.4 Initializing an Array with Trailing Zeros\n'''\n\na = [ 22.2, 44.4, 66.6 , 0 ,0,0,0]\nsize = len(a)\nfor i in range(size):\n print \"\\ta[\" , i , \"] = \" , a[i] \n",
+ "input": [
+ "\n",
+ "\n",
+ "a = [ 22.2, 44.4, 66.6 , 0 ,0,0,0]\n",
+ "size = len(a)\n",
+ "for i in range(size):\n",
+ " print \"\\ta[\" , i , \"] = \" , a[i] \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ta[ 0 ] = 22.2\n\ta[ 1 ] = 44.4\n\ta[ 2 ] = 66.6\n\ta[ 3 ] = 0\n\ta[ 4 ] = 0\n\ta[ 5 ] = 0\n\ta[ 6 ] = 0\n"
+ "text": [
+ "\ta[ 0 ] = 22.2\n",
+ "\ta[ 1 ] = 44.4\n",
+ "\ta[ 2 ] = 66.6\n",
+ "\ta[ 3 ] = 0\n",
+ "\ta[ 4 ] = 0\n",
+ "\ta[ 5 ] = 0\n",
+ "\ta[ 6 ] = 0\n"
+ ]
}
],
"prompt_number": 4
@@ -105,14 +181,27 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.5 An Uninitialized Array\nNOte : In PYthon , we have to initialize array. Without initializing it, it doesn't work.\nArray size is automatically incremented when we push data into it.\n'''\nimport numpy\nSIZE = 4\na = numpy.zeros(4)\n# declares the array's elements as type float\nfor i in range(SIZE):\n print \"\\ta[\" , i , \"] = \" , a[i]\n",
+ "input": [
+ "\n",
+ "import numpy\n",
+ "SIZE = 4\n",
+ "a = numpy.zeros(4)\n",
+ "# declares the array's elements as type float\n",
+ "for i in range(SIZE):\n",
+ " print \"\\ta[\" , i , \"] = \" , a[i]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ta[ 0 ] = 0.0\n\ta[ 1 ] = 0.0\n\ta[ 2 ] = 0.0\n\ta[ 3 ] = 0.0\n"
+ "text": [
+ "\ta[ 0 ] = 0.0\n",
+ "\ta[ 1 ] = 0.0\n",
+ "\ta[ 2 ] = 0.0\n",
+ "\ta[ 3 ] = 0.0\n"
+ ]
}
],
"prompt_number": 5
@@ -120,7 +209,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.6 Allowing an Array Index to Exceed its Bounds\nNOte : Python gives error when this kind of error occurs. so It wont print garbage values after bound exceeds.\n'''\nSIZE=4\na = [ 33.3, 44.4, 55.5, 66.6 ]\nfor i in range(7): # ERROR: index is out of bounds!\n print \"\\ta[\" , i , \"] = \" , a[i] \n\n",
+ "input": [
+ "\n",
+ "SIZE=4\n",
+ "a = [ 33.3, 44.4, 55.5, 66.6 ]\n",
+ "for i in range(7): # ERROR: index is out of bounds!\n",
+ " print \"\\ta[\" , i , \"] = \" , a[i] \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -137,7 +233,13 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ta[ 0 ] = 33.3\n\ta[ 1 ] = 44.4\n\ta[ 2 ] = 55.5\n\ta[ 3 ] = 66.6\n\ta[ 4 ] = "
+ "text": [
+ "\ta[ 0 ] = 33.3\n",
+ "\ta[ 1 ] = 44.4\n",
+ "\ta[ 2 ] = 55.5\n",
+ "\ta[ 3 ] = 66.6\n",
+ "\ta[ 4 ] = "
+ ]
}
],
"prompt_number": 6
@@ -145,14 +247,24 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.7 Causing Side Effects\nThis program inadvertently changes the value of a variable when it accesses a nonexistent element of\nan array:\nNote : Python automatically increase size of array/list. so it wont give error and output would be differ than c gives.\n'''\n\na = [ 22.2, 44.4, 66.6 ]\nx=11.1\nprint \"x = \" , x \na.append(88.8) # ERROR: index is out of bounds!\nprint \"x = \" , x \n",
+ "input": [
+ "\n",
+ "a = [ 22.2, 44.4, 66.6 ]\n",
+ "x=11.1\n",
+ "print \"x = \" , x \n",
+ "a.append(88.8) # ERROR: index is out of bounds!\n",
+ "print \"x = \" , x \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " x = 11.1\nx = 11.1\n"
+ "text": [
+ " x = 11.1\n",
+ "x = 11.1\n"
+ ]
}
],
"prompt_number": 7
@@ -160,7 +272,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.8 Causing Unhandled Exceptions\nThis program crashes because the array index gets too big:\n'''\na = [ 22.2, 44.4, 66.6 ]\nx=11.1\nprint \"x = \" , x \na[3333] = 88.8 # ERROR: index is out of bounds!\nprint \"x = \" , x \n",
+ "input": [
+ "\n",
+ "a = [ 22.2, 44.4, 66.6 ]\n",
+ "x=11.1\n",
+ "print \"x = \" , x \n",
+ "a[3333] = 88.8 # ERROR: index is out of bounds!\n",
+ "print \"x = \" , x \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -177,7 +296,9 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 11.1\n"
+ "text": [
+ "x = 11.1\n"
+ ]
}
],
"prompt_number": 8
@@ -185,14 +306,26 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.9 Passing an Array to a Function that Returns its Sum\n'''\n\ndef sum_(a):\n s = 0\n for i in a:\n s += i\n return s\n \na = [ 11, 33, 55, 77 ]\nprint \"sum(a) = \" , sum_(a) \n",
+ "input": [
+ "\n",
+ "def sum_(a):\n",
+ " s = 0\n",
+ " for i in a:\n",
+ " s += i\n",
+ " return s\n",
+ " \n",
+ "a = [ 11, 33, 55, 77 ]\n",
+ "print \"sum(a) = \" , sum_(a) \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "sum(a) = 176\n"
+ "text": [
+ "sum(a) = 176\n"
+ ]
}
],
"prompt_number": 10
@@ -200,49 +333,86 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.10 Input and Output Functions for an Array\nThis program uses a read() function to input values into the array a interactively. Then it uses a\nprint() function to print the array:\n'''\ndef read(a):\n print \"Enter integers. Terminate with 0:\\n\"\n n = 1\n while True:\n n = int(raw_input(\"a[\" + str(len(a)) + \"]: \"))\n if n == 0:\n break\n a.append(n)\n \n\ndef print_(a):\n for i in a:\n print i ,\n\n\na = []\nread(a)\nprint \"The array has \" , len(a) , \" elements: \"\nprint_(a)\n",
+ "input": [
+ "\n",
+ "def read(a):\n",
+ " print \"Enter integers. Terminate with 0:\\n\"\n",
+ " n = 1\n",
+ " while True:\n",
+ " n = int(raw_input(\"a[\" + str(len(a)) + \"]: \"))\n",
+ " if n == 0:\n",
+ " break\n",
+ " a.append(n)\n",
+ " \n",
+ "\n",
+ "def print_(a):\n",
+ " for i in a:\n",
+ " print i ,\n",
+ "\n",
+ "\n",
+ "a = []\n",
+ "read(a)\n",
+ "print \"The array has \" , len(a) , \" elements: \"\n",
+ "print_(a)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter integers. Terminate with 0:\n\n"
+ "text": [
+ "Enter integers. Terminate with 0:\n",
+ "\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[0]: 11\n"
+ "text": [
+ "a[0]: 11\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[1]: 22\n"
+ "text": [
+ "a[1]: 22\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[2]: 33\n"
+ "text": [
+ "a[2]: 33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[3]: 44\n"
+ "text": [
+ "a[3]: 44\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[4]: 0\n"
+ "text": [
+ "a[4]: 0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The array has 4 elements: \n11 22 33 44\n"
+ "text": [
+ "The array has 4 elements: \n",
+ "11 22 33 44\n"
+ ]
}
],
"prompt_number": 12
@@ -250,14 +420,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.11 Printing the Memory Location of an Array\nThis program prints the value of the address stored in an array name.\n'''\nimport sys\na = [ 22, 44, 66, 88 ]\nprint \"a = \" , id(a) # the address of a[0]\n\n",
+ "input": [
+ "\n",
+ "import sys\n",
+ "a = [ 22, 44, 66, 88 ]\n",
+ "print \"a = \" , id(a) # the address of a[0]\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 169156908\n"
+ "text": [
+ "a = 169156908\n"
+ ]
}
],
"prompt_number": 13
@@ -265,14 +443,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.12 The Linear Search\nThis program tests a function that implements the Linear Search algorithm:\n'''\ndef index(x,a,n):\n for i in range(len(a)):\n if (a[i] == x):\n return i\n return n # x not found\n\na = [ 22, 44, 66, 88, 44, 66, 55 ]\nprint \"index(44,a,7) = \" , index(44,a,7)\nprint \"index(50,a,7) = \" , index(50,a,7) \n\n\n",
+ "input": [
+ "\n",
+ "def index(x,a,n):\n",
+ " for i in range(len(a)):\n",
+ " if (a[i] == x):\n",
+ " return i\n",
+ " return n # x not found\n",
+ "\n",
+ "a = [ 22, 44, 66, 88, 44, 66, 55 ]\n",
+ "print \"index(44,a,7) = \" , index(44,a,7)\n",
+ "print \"index(50,a,7) = \" , index(50,a,7) \n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "index(44,a,7) = 1\nindex(50,a,7) = 7\n"
+ "text": [
+ "index(44,a,7) = 1\n",
+ "index(50,a,7) = 7\n"
+ ]
}
],
"prompt_number": 14
@@ -280,14 +474,38 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.13 The Bubble Sort\nThis program tests a function that implements the Bubble Sort algorithm.\n'''\ndef sort(a,n):\n # bubble sort:\n n = len(a)\n for i in range(n):\n # bubble up max{a[0..n-i]}:\n for j in range(n-i-1):\n if (a[j] > a[j+1]):\n a[j],a[j+1] = a[j+1],a[j]\n\ndef print_(a):\n for i in range(len(a)):\n print a[i],\n print ''\n \na = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n\nprint_(a)\nsort(a,8)\nprint_(a)\n",
+ "input": [
+ "\n",
+ "def sort(a,n):\n",
+ " # bubble sort:\n",
+ " n = len(a)\n",
+ " for i in range(n):\n",
+ " # bubble up max{a[0..n-i]}:\n",
+ " for j in range(n-i-1):\n",
+ " if (a[j] > a[j+1]):\n",
+ " a[j],a[j+1] = a[j+1],a[j]\n",
+ "\n",
+ "def print_(a):\n",
+ " for i in range(len(a)):\n",
+ " print a[i],\n",
+ " print ''\n",
+ " \n",
+ "a = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n",
+ "\n",
+ "print_(a)\n",
+ "sort(a,8)\n",
+ "print_(a)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n"
+ "text": [
+ "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n",
+ "22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n"
+ ]
}
],
"prompt_number": 15
@@ -295,14 +513,38 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.14 The Binary Search Algorithm\n'''\n\ndef index(x,a,n):\n # PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\n # binary search:\n lo=0\n hi=n-1\n while (lo <= hi):\n i = (lo + hi)/2 # the average of lo and hi\n if (a[i] == x):\n return i\n if (a[i] < x):\n lo = i+1 # continue search in a[i+1..hi]\n else:\n hi = i-1 # continue search in a[lo..i-1]\n return n # x was not found in a[0..n-1]\n\na = [ 22, 33, 44, 55, 66, 77, 88 ]\nprint \"index(44,a,7) = \" , index(44,a,7)\nprint \"index(60,a,7) = \" , index(60,a,7) \n\n",
+ "input": [
+ "\n",
+ "def index(x,a,n):\n",
+ " # PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\n",
+ " # binary search:\n",
+ " lo=0\n",
+ " hi=n-1\n",
+ " while (lo <= hi):\n",
+ " i = (lo + hi)/2 # the average of lo and hi\n",
+ " if (a[i] == x):\n",
+ " return i\n",
+ " if (a[i] < x):\n",
+ " lo = i+1 # continue search in a[i+1..hi]\n",
+ " else:\n",
+ " hi = i-1 # continue search in a[lo..i-1]\n",
+ " return n # x was not found in a[0..n-1]\n",
+ "\n",
+ "a = [ 22, 33, 44, 55, 66, 77, 88 ]\n",
+ "print \"index(44,a,7) = \" , index(44,a,7)\n",
+ "print \"index(60,a,7) = \" , index(60,a,7) \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "index(44,a,7) = 2\nindex(60,a,7) = 7\n"
+ "text": [
+ "index(44,a,7) = 2\n",
+ "index(60,a,7) = 7\n"
+ ]
}
],
"prompt_number": 16
@@ -310,14 +552,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.15 Determining whether an Array is Sorted\nThis program tests a boolean function that determines whether a given array is nondecreasing.\n'''\n\ndef isNondecreasing(a,n):\n # returns true iff a[0] <= a[1] <= ... <= a[n-1]:\n for i in range(1,n):\n if (a[i]<a[i-1]):\n return False\n return True\n\na = [ 22, 44, 66, 88, 44, 66, 55 ]\nprint \"isNondecreasing(a,4) = \" , isNondecreasing(a,4)\nprint \"isNondecreasing(a,7) = \" , isNondecreasing(a,7)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def isNondecreasing(a,n):\n",
+ " # returns true iff a[0] <= a[1] <= ... <= a[n-1]:\n",
+ " for i in range(1,n):\n",
+ " if (a[i]<a[i-1]):\n",
+ " return False\n",
+ " return True\n",
+ "\n",
+ "a = [ 22, 44, 66, 88, 44, 66, 55 ]\n",
+ "print \"isNondecreasing(a,4) = \" , isNondecreasing(a,4)\n",
+ "print \"isNondecreasing(a,7) = \" , isNondecreasing(a,7)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "isNondecreasing(a,4) = True\nisNondecreasing(a,7) = False\n"
+ "text": [
+ "isNondecreasing(a,4) = True\n",
+ "isNondecreasing(a,7) = False\n"
+ ]
}
],
"prompt_number": 17
@@ -325,7 +583,39 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.16 Using the assert() Function to Enforce a Precondition\nThis program tests an improved version of the search() function from Example 6.14. This version\nuses the isNondecreasing() function from Example 6.15 to determine whether the array is sorted. It\npasses the resulting boolean return value to the assert() function so that the search will not be carried\nout if the array is not sorted:\n'''\n\ndef isNondecreasing(a,n):\n # returns true iff a[0] <= a[1] <= ... <= a[n-1]:\n for i in range(1,n):\n if (a[i]<a[i-1]):\n return False\n return True\n\n\ndef index(x,a,n):\n # PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\n # binary search:\n assert(isNondecreasing(a,n)) \n \n lo=0\n hi=n-1\n while (lo <= hi):\n i = (lo + hi)/2\n if (a[i] == x):\n return i\n if (a[i] < x):\n lo = i+1 # continue search in a[i+1..hi]\n else:\n hi = i-1 # continue search in a[lo..i-1]\n return n # x was not found in a[0..n-1]\n\na = [ 22, 33, 44, 55, 66, 77, 88, 60 ]\nprint \"index(44,a,7) = \" , index(44,a,7) \nprint \"index(44,a,8.py) = \" , index(44,a,8) \nprint \"index(60,a,7) = \" , index(60,a,8)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def isNondecreasing(a,n):\n",
+ " # returns true iff a[0] <= a[1] <= ... <= a[n-1]:\n",
+ " for i in range(1,n):\n",
+ " if (a[i]<a[i-1]):\n",
+ " return False\n",
+ " return True\n",
+ "\n",
+ "\n",
+ "def index(x,a,n):\n",
+ " # PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\n",
+ " # binary search:\n",
+ " assert(isNondecreasing(a,n)) \n",
+ " \n",
+ " lo=0\n",
+ " hi=n-1\n",
+ " while (lo <= hi):\n",
+ " i = (lo + hi)/2\n",
+ " if (a[i] == x):\n",
+ " return i\n",
+ " if (a[i] < x):\n",
+ " lo = i+1 # continue search in a[i+1..hi]\n",
+ " else:\n",
+ " hi = i-1 # continue search in a[lo..i-1]\n",
+ " return n # x was not found in a[0..n-1]\n",
+ "\n",
+ "a = [ 22, 33, 44, 55, 66, 77, 88, 60 ]\n",
+ "print \"index(44,a,7) = \" , index(44,a,7) \n",
+ "print \"index(44,a,8.py) = \" , index(44,a,8) \n",
+ "print \"index(60,a,7) = \" , index(60,a,8)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -343,7 +633,10 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "index(44,a,7) = 2\nindex(44,a,7) = "
+ "text": [
+ "index(44,a,7) = 2\n",
+ "index(44,a,7) = "
+ ]
}
],
"prompt_number": 18
@@ -351,14 +644,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.17 Enumerating the Days of the Week\nThis program defines an array high[] of seven floats, representing the high temperatures for\nthe seven days of a week: 138\n'''\nDay = [ 0, 1, 2, 3, 4, 5, 6 ]\nhigh = [ 88.3, 95.0, 91.2, 89.9, 91.4, 92.5, 86.7]\n\nfor i in Day:\n print \"The high temperature for day \" , i , \" was \" , high[i] \n\n",
+ "input": [
+ "\n",
+ "Day = [ 0, 1, 2, 3, 4, 5, 6 ]\n",
+ "high = [ 88.3, 95.0, 91.2, 89.9, 91.4, 92.5, 86.7]\n",
+ "\n",
+ "for i in Day:\n",
+ " print \"The high temperature for day \" , i , \" was \" , high[i] \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " The high temperature for day 0 was 88.3\nThe high temperature for day 1 was 95.0\nThe high temperature for day 2 was 91.2\nThe high temperature for day 3 was 89.9\nThe high temperature for day 4 was 91.4\nThe high temperature for day 5 was 92.5\nThe high temperature for day 6 was 86.7\n"
+ "text": [
+ " The high temperature for day 0 was 88.3\n",
+ "The high temperature for day 1 was 95.0\n",
+ "The high temperature for day 2 was 91.2\n",
+ "The high temperature for day 3 was 89.9\n",
+ "The high temperature for day 4 was 91.4\n",
+ "The high temperature for day 5 was 92.5\n",
+ "The high temperature for day 6 was 86.7\n"
+ ]
}
],
"prompt_number": 19
@@ -366,14 +675,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.18 The Bubble Sort Again\n'''\n\ndef sort(a,n):\n a.sort()\n\ndef print_(a,n):\n for i in a:\n print i,\n print ''\na = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\nprint_(a,8);\nsort(a,8)\nprint_(a,8)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def sort(a,n):\n",
+ " a.sort()\n",
+ "\n",
+ "def print_(a,n):\n",
+ " for i in a:\n",
+ " print i,\n",
+ " print ''\n",
+ "a = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n",
+ "print_(a,8);\n",
+ "sort(a,8)\n",
+ "print_(a,8)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n"
+ "text": [
+ "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n",
+ "22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n"
+ ]
}
],
"prompt_number": 20
@@ -381,119 +707,181 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.19 Reading and Printing a Two-Dimensional Array\nThis program shows how a two-dimensional array can be processed:\n'''\n\ndef read(a):\n print \"Enter 15 integers, 5 per row:\\n\"\n for i in range(3):\n ar = []\n print \"Row \" , i , \": \",\n for j in range(5):\n ar.append(int(raw_input()))\n a.append(ar)\n\ndef print_(a):\n for i in range(3):\n for j in range(5):\n print a[i][j],\n print ''\na = []\nread(a)\nprint_(a)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def read(a):\n",
+ " print \"Enter 15 integers, 5 per row:\\n\"\n",
+ " for i in range(3):\n",
+ " ar = []\n",
+ " print \"Row \" , i , \": \",\n",
+ " for j in range(5):\n",
+ " ar.append(int(raw_input()))\n",
+ " a.append(ar)\n",
+ "\n",
+ "def print_(a):\n",
+ " for i in range(3):\n",
+ " for j in range(5):\n",
+ " print a[i][j],\n",
+ " print ''\n",
+ "a = []\n",
+ "read(a)\n",
+ "print_(a)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 15 integers, 5 per row:\n\nRow 0 : "
+ "text": [
+ "Enter 15 integers, 5 per row:\n",
+ "\n",
+ "Row 0 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "11\n"
+ "text": [
+ "11\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Row 1 : "
+ "text": [
+ " Row 1 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "60\n"
+ "text": [
+ "60\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "50\n"
+ "text": [
+ "50\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "30\n"
+ "text": [
+ "30\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "90\n"
+ "text": [
+ "90\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "70\n"
+ "text": [
+ "70\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Row 2 : "
+ "text": [
+ " Row 2 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "85\n"
+ "text": [
+ "85\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "25\n"
+ "text": [
+ "25\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "45\n"
+ "text": [
+ "45\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "45\n"
+ "text": [
+ "45\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 44 77 33 11 44 \n60 50 30 90 70 \n85 25 45 45 55 \n"
+ "text": [
+ " 44 77 33 11 44 \n",
+ "60 50 30 90 70 \n",
+ "85 25 45 45 55 \n"
+ ]
}
],
"prompt_number": 21
@@ -501,119 +889,204 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.20 Processing a Two-Dimensional Array of Quiz Scores\n'''\ndef read(score):\n for s in range(3):\n print \"Student \" , s , \": \",\n st = []\n for q in range(5):\n st.append(int(raw_input()))\n score.append(st)\n\ndef printQuizAverages(score):\n for s in range(3):\n sm = 0\n for q in range(5):\n sm += score[s][q]\n print \"\\tStudent \" , s , \": \" , sm/5.0\n\ndef printClassAverages(score):\n for q in range(5):\n sm = 0\n for s in range(3):\n sm += score[s][q]\n print \"\\tQuiz \" , q , \": \" , sm/3.0\n\n\n\nNUM_STUDENTS = 3\nNUM_QUIZZES = 5\n\n\nscore = []\nprint \"Enter \" , NUM_QUIZZES , \" scores for each student: \"\nread(score)\nprint \"The quiz averages are:\"\nprintQuizAverages(score)\nprint \"The class averages are: \"\nprintClassAverages(score)\n",
+ "input": [
+ "\n",
+ "def read(score):\n",
+ " for s in range(3):\n",
+ " print \"Student \" , s , \": \",\n",
+ " st = []\n",
+ " for q in range(5):\n",
+ " st.append(int(raw_input()))\n",
+ " score.append(st)\n",
+ "\n",
+ "def printQuizAverages(score):\n",
+ " for s in range(3):\n",
+ " sm = 0\n",
+ " for q in range(5):\n",
+ " sm += score[s][q]\n",
+ " print \"\\tStudent \" , s , \": \" , sm/5.0\n",
+ "\n",
+ "def printClassAverages(score):\n",
+ " for q in range(5):\n",
+ " sm = 0\n",
+ " for s in range(3):\n",
+ " sm += score[s][q]\n",
+ " print \"\\tQuiz \" , q , \": \" , sm/3.0\n",
+ "\n",
+ "\n",
+ "\n",
+ "NUM_STUDENTS = 3\n",
+ "NUM_QUIZZES = 5\n",
+ "\n",
+ "\n",
+ "score = []\n",
+ "print \"Enter \" , NUM_QUIZZES , \" scores for each student: \"\n",
+ "read(score)\n",
+ "print \"The quiz averages are:\"\n",
+ "printQuizAverages(score)\n",
+ "print \"The class averages are: \"\n",
+ "printClassAverages(score)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 5 scores for each student: \nStudent 0 : "
+ "text": [
+ "Enter 5 scores for each student: \n",
+ "Student 0 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Student 1 : "
+ "text": [
+ " Student 1 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Student 2 : "
+ "text": [
+ " Student 2 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "6\n"
+ "text": [
+ "6\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " The quiz averages are:\n\tStudent 0 : 8.2\n\tStudent 1 : 8.8\n\tStudent 2 : 7.0\nThe class averages are: \n\tQuiz 0 : 7.33333333333\n\tQuiz 1 : 7.33333333333\n\tQuiz 2 : 8.33333333333\n\tQuiz 3 : 8.33333333333\n\tQuiz 4 : 8.66666666667\n"
+ "text": [
+ " The quiz averages are:\n",
+ "\tStudent 0 : 8.2\n",
+ "\tStudent 1 : 8.8\n",
+ "\tStudent 2 : 7.0\n",
+ "The class averages are: \n",
+ "\tQuiz 0 : 7.33333333333\n",
+ "\tQuiz 1 : 7.33333333333\n",
+ "\tQuiz 2 : 8.33333333333\n",
+ "\tQuiz 3 : 8.33333333333\n",
+ "\tQuiz 4 : 8.66666666667\n"
+ ]
}
],
"prompt_number": 24
@@ -621,14 +1094,32 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.21 Processing a Three-Dimensional Array\nThis program simply counts the number of zeros in a three-dimensional array:\n'''\n\ndef numZeros(a,n1,n2,n3):\n count = 0\n for i in range(n1):\n for j in range(n2):\n for k in range(n3):\n if (a[i][j][k] == 0):\n count += 1\n return count\n\n\na = [ [ [5,0,2], [0,0,9], [4,1,0], [7,7,7] ],[ [3,0,0], [8,5,0], [0,0,0], [2,0,9] ]]\nprint \"This array has \" , numZeros(a,2,4,3) , \" zeros\"\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "def numZeros(a,n1,n2,n3):\n",
+ " count = 0\n",
+ " for i in range(n1):\n",
+ " for j in range(n2):\n",
+ " for k in range(n3):\n",
+ " if (a[i][j][k] == 0):\n",
+ " count += 1\n",
+ " return count\n",
+ "\n",
+ "\n",
+ "a = [ [ [5,0,2], [0,0,9], [4,1,0], [7,7,7] ],[ [3,0,0], [8,5,0], [0,0,0], [2,0,9] ]]\n",
+ "print \"This array has \" , numZeros(a,2,4,3) , \" zeros\"\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This array has 11 zeros\n"
+ "text": [
+ "This array has 11 zeros\n"
+ ]
}
],
"prompt_number": 25
@@ -636,7 +1127,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch7.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch7.ipynb
index f480fc86..ad8cdac0 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch7.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch7"
+ "name": "",
+ "signature": "sha256:653231542b6fdffa18c8d3af4f8fe1f2545223a4300162071901adcb77895ba7"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,24 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.1 Printing Pointer Values\n'''\n\nn=44\nprint \"n = \" , n \n# prints the value of n\nprint \"&n = \" , hex(id(n)) # prints the address of n\n",
+ "input": [
+ "\n",
+ "\n",
+ "n=44\n",
+ "print \"n = \" , n \n",
+ "# prints the value of n\n",
+ "print \"&n = \" , hex(id(n)) # prints the address of n\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n&n = 0x8fc0eec\n"
+ "text": [
+ "n = 44\n",
+ "&n = 0x8fc0eec\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +36,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.2\nNote : Python doesn't support reference/pointer variable. But can be achieved by using mutable datatypes i.e. list.\n'''\n\n\nn = [44]\nrn=n # r is a synonym for n\nprint \"n = \" , n , \", rn = \" , rn \nn[0] -= 1\nprint \"n = \" , n , \", rn = \" , rn \nrn[0] *= 2\nprint \"n = \" , n , \", rn = \" , rn \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "n = [44]\n",
+ "rn=n # r is a synonym for n\n",
+ "print \"n = \" , n , \", rn = \" , rn \n",
+ "n[0] -= 1\n",
+ "print \"n = \" , n , \", rn = \" , rn \n",
+ "rn[0] *= 2\n",
+ "print \"n = \" , n , \", rn = \" , rn \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] , rn = [44]\nn = [43] , rn = [43]\nn = [86] , rn = [86]\n"
+ "text": [
+ "n = [44] , rn = [44]\n",
+ "n = [43] , rn = [43]\n",
+ "n = [86] , rn = [86]\n"
+ ]
}
],
"prompt_number": 2
@@ -40,14 +67,27 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.3 References Are Not Separate Variables\n'''\n\n\nn = [44]\nrn=n # r is a synonym for n\nprint \"&n = \" , hex(id(n)) , \", rn = \" , hex(id(rn ))\nrn2 = n\nrn3 = rn\nprint \"&rn2 = \" , hex(id(rn2)) , \", rn = \" , hex(id(rn ))\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "n = [44]\n",
+ "rn=n # r is a synonym for n\n",
+ "print \"&n = \" , hex(id(n)) , \", rn = \" , hex(id(rn ))\n",
+ "rn2 = n\n",
+ "rn3 = rn\n",
+ "print \"&rn2 = \" , hex(id(rn2)) , \", rn = \" , hex(id(rn ))\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "&n = 0x9c6228c , rn = 0x9c6228c\n&rn2 = 0x9c6228c , rn = 0x9c6228c\n"
+ "text": [
+ "&n = 0x9c6228c , rn = 0x9c6228c\n",
+ "&rn2 = 0x9c6228c , rn = 0x9c6228c\n"
+ ]
}
],
"prompt_number": 3
@@ -55,14 +95,26 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.4 Using Pointer Variables\n\n'''\n\nn = [44]\nprint \"n = \" , n , \", &n = \" , hex(id(n))\npn = n\nprint \"pn = \" , hex(id(pn)) , \", &pn = \" , hex(id(hex(id(pn))))\n\n\n",
+ "input": [
+ " \n",
+ "\n",
+ "n = [44]\n",
+ "print \"n = \" , n , \", &n = \" , hex(id(n))\n",
+ "pn = n\n",
+ "print \"pn = \" , hex(id(pn)) , \", &pn = \" , hex(id(hex(id(pn))))\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] , &n = 0x9c624ec\npn = 0x9c624ec , &pn = 0x9c6aa60\n"
+ "text": [
+ "n = [44] , &n = 0x9c624ec\n",
+ "pn = 0x9c624ec , &pn = 0x9c6aa60\n"
+ ]
}
],
"prompt_number": 4
@@ -70,14 +122,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.5\n'''\n\nn = [44]\nprint \"n = \" , n , \", &n = \" , hex(id(n))\npn = n\nprint \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\nprint \"*pn = \" , pn\n\n",
+ "input": [
+ " \n",
+ "\n",
+ "n = [44]\n",
+ "print \"n = \" , n , \", &n = \" , hex(id(n))\n",
+ "pn = n\n",
+ "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"*pn = \" , pn\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] , &n = 0x9c58d6c\n\tpn = 0x9c58d6c ,\n &pn = 0x9c6ab20\n*pn = [44]\n"
+ "text": [
+ "n = [44] , &n = 0x9c58d6c\n",
+ "\tpn = 0x9c58d6c ,\n",
+ " &pn = 0x9c6ab20\n",
+ "*pn = [44]\n"
+ ]
}
],
"prompt_number": 5
@@ -85,14 +151,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.6 \n'''\n\nn = [44]\nprint \"n = \" , n , \", &n = \" , hex(id(n))\npn = n\nprint \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\nprint \"*pn = \" , pn\nppn = pn\n\nprint \" ppn = \" , hex(id(hex(id(ppn)))) \nprint \" &ppn = \" , hex(id(hex(id(hex(id(ppn))))))\nprint \" *ppn = \" , hex(id(ppn)) \nprint \"**ppn = \" , ppn \n",
+ "input": [
+ "\n",
+ "n = [44]\n",
+ "print \"n = \" , n , \", &n = \" , hex(id(n))\n",
+ "pn = n\n",
+ "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"*pn = \" , pn\n",
+ "ppn = pn\n",
+ "\n",
+ "print \" ppn = \" , hex(id(hex(id(ppn)))) \n",
+ "print \" &ppn = \" , hex(id(hex(id(hex(id(ppn))))))\n",
+ "print \" *ppn = \" , hex(id(ppn)) \n",
+ "print \"**ppn = \" , ppn \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] , &n = 0x9bf05ac\n\tpn = 0x9bf05ac ,\n &pn = 0x9c58160\n*pn = [44]\n ppn = 0x9c58680\n &ppn = 0x9c58160\n *ppn = 0x9bf05ac\n**ppn = [44]\n"
+ "text": [
+ "n = [44] , &n = 0x9bf05ac\n",
+ "\tpn = 0x9bf05ac ,\n",
+ " &pn = 0x9c58160\n",
+ "*pn = [44]\n",
+ " ppn = 0x9c58680\n",
+ " &ppn = 0x9c58160\n",
+ " *ppn = 0x9bf05ac\n",
+ "**ppn = [44]\n"
+ ]
}
],
"prompt_number": 6
@@ -100,14 +188,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.7\n'''\n\nn = [44]\nprint \"n = \" , n , \"\\n &n = \" , hex(id(n))\npn = n\nprint \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\nprint \"*pn = \" , pn\nnn = pn\nprint \" ppn = \" , hex(id(nn))\nprint \" &ppn = \" , hex(id(hex(id(nn))))\nrpn = pn\nprint \" ppn = \" , hex(id(rpn))\nprint \" &ppn = \" , hex(id(hex(id(rpn))))\n\n\n",
+ "input": [
+ " \n",
+ "\n",
+ "n = [44]\n",
+ "print \"n = \" , n , \"\\n &n = \" , hex(id(n))\n",
+ "pn = n\n",
+ "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"*pn = \" , pn\n",
+ "nn = pn\n",
+ "print \" ppn = \" , hex(id(nn))\n",
+ "print \" &ppn = \" , hex(id(hex(id(nn))))\n",
+ "rpn = pn\n",
+ "print \" ppn = \" , hex(id(rpn))\n",
+ "print \" &ppn = \" , hex(id(hex(id(rpn))))\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] \n &n = 0x9bf60ec\n\tpn = 0x9bf60ec ,\n &pn = 0x9bf0e40\n*pn = [44]\n ppn = 0x9bf60ec\n &ppn = 0x9bf0e40\n ppn = 0x9bf60ec\n &ppn = 0x9bf0f20\n"
+ "text": [
+ "n = [44] \n",
+ " &n = 0x9bf60ec\n",
+ "\tpn = 0x9bf60ec ,\n",
+ " &pn = 0x9bf0e40\n",
+ "*pn = [44]\n",
+ " ppn = 0x9bf60ec\n",
+ " &ppn = 0x9bf0e40\n",
+ " ppn = 0x9bf60ec\n",
+ " &ppn = 0x9bf0f20\n"
+ ]
}
],
"prompt_number": 7
@@ -115,14 +229,32 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.8\n'''\n\ndef max_(m,n):\n if m>n:\n return m\n else:\n return n\n\nm = 44\nn = 22\nprint m , \", \" , n , \", \" , max_(m,n)\nm = max_(m,n) \nm = 55\n# changes the value of m from 44 to 55\nprint m , \", \" , n , \", \" , max_(m,n) \n",
+ "input": [
+ "\n",
+ "def max_(m,n):\n",
+ " if m>n:\n",
+ " return m\n",
+ " else:\n",
+ " return n\n",
+ "\n",
+ "m = 44\n",
+ "n = 22\n",
+ "print m , \", \" , n , \", \" , max_(m,n)\n",
+ "m = max_(m,n) \n",
+ "m = 55\n",
+ "# changes the value of m from 44 to 55\n",
+ "print m , \", \" , n , \", \" , max_(m,n) \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "44 , 22 , 44\n55 , 22 , 55\n"
+ "text": [
+ "44 , 22 , 44\n",
+ "55 , 22 , 55\n"
+ ]
}
],
"prompt_number": 8
@@ -130,14 +262,27 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.9 \n'''\n\nv = []\nfor k in range(1,5):\n v.append(1.0/k)\n\nfor i in range(4):\n print \"v[\" , i , \"] = \" , v[i]\n",
+ "input": [
+ " \n",
+ "v = []\n",
+ "for k in range(1,5):\n",
+ " v.append(1.0/k)\n",
+ "\n",
+ "for i in range(4):\n",
+ " print \"v[\" , i , \"] = \" , v[i]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "v[ 0 ] = 1.0\nv[ 1 ] = 0.5\nv[ 2 ] = 0.333333333333\nv[ 3 ] = 0.25\n"
+ "text": [
+ "v[ 0 ] = 1.0\n",
+ "v[ 1 ] = 0.5\n",
+ "v[ 2 ] = 0.333333333333\n",
+ "v[ 3 ] = 0.25\n"
+ ]
}
],
"prompt_number": 9
@@ -145,14 +290,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.10 \n'''\nimport sys\na = [22, 33, 44]\n\nprint \"a = \" , hex(id(a))\nprint \"sizeof(int) = \" , sys.getsizeof(1) \ns = 0\nfor i in a:\n s += i\n print \"\\t i = \" , hex(id(i)),\n print \"\\t *i = \" , i,\n print \"\\t sum = \" , s\n\n",
+ "input": [
+ "\n",
+ "import sys\n",
+ "a = [22, 33, 44]\n",
+ "\n",
+ "print \"a = \" , hex(id(a))\n",
+ "print \"sizeof(int) = \" , sys.getsizeof(1) \n",
+ "s = 0\n",
+ "for i in a:\n",
+ " s += i\n",
+ " print \"\\t i = \" , hex(id(i)),\n",
+ " print \"\\t *i = \" , i,\n",
+ " print \"\\t sum = \" , s\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 0x9bf688c\nsizeof(int) = 12\n\t i = 0x8fc0ff4 \t *i = 22 \t sum = 22\n\t i = 0x8fc0f70 \t *i = 33 \t sum = 55\n\t i = 0x8fc0eec \t *i = 44 \t sum = 99\n"
+ "text": [
+ "a = 0x9bf688c\n",
+ "sizeof(int) = 12\n",
+ "\t i = 0x8fc0ff4 \t *i = 22 \t sum = 22\n",
+ "\t i = 0x8fc0f70 \t *i = 33 \t sum = 55\n",
+ "\t i = 0x8fc0eec \t *i = 44 \t sum = 99\n"
+ ]
}
],
"prompt_number": 10
@@ -160,14 +325,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.11 Examining the Addresses of Array Elements\n'''\n\na = [22, 33, 44, 55, 66]\nprint \"a = \" , hex(id(a)) , \", *a = \" , a[0] \nfor p in a:\n print \"p = \" , hex(id(p)) , \", *p = \" , p \n\n",
+ "input": [
+ " \n",
+ "\n",
+ "a = [22, 33, 44, 55, 66]\n",
+ "print \"a = \" , hex(id(a)) , \", *a = \" , a[0] \n",
+ "for p in a:\n",
+ " print \"p = \" , hex(id(p)) , \", *p = \" , p \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 0x9c6526c , *a = 22\np = 0x8fc0ff4 , *p = 22\np = 0x8fc0f70 , *p = 33\np = 0x8fc0eec , *p = 44\np = 0x8fc0e68 , *p = 55\np = 0x8fc0de4 , *p = 66\n"
+ "text": [
+ "a = 0x9c6526c , *a = 22\n",
+ "p = 0x8fc0ff4 , *p = 22\n",
+ "p = 0x8fc0f70 , *p = 33\n",
+ "p = 0x8fc0eec , *p = 44\n",
+ "p = 0x8fc0e68 , *p = 55\n",
+ "p = 0x8fc0de4 , *p = 66\n"
+ ]
}
],
"prompt_number": 11
@@ -175,14 +355,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.12 Pattern Matching\n'''\n\ndef loc(a1,a2,n1,n2):\n p = []\n for element in a2:\n if element in a1:\n p.append(element)\n return p\n\na1 = [11, 11, 11, 11, 11, 22, 33, 44, 55]\na2 = [11, 11, 11, 22, 33]\nprint \"Array a1 begins at location\\t\" , hex(id(a1 ))\nprint \"Array a2 begins at location\\t\" , hex(id(a2)) \np = loc(a1, a2, 9, 5)\nif (p):\n print \"Array a2 found at location\\t\" , hex(id(p))\n for i in range(len(p)):\n print \"\\t\" , hex(id(p[i])) , \": \" , p[i], \"\\t\" , hex(id(a2[i])) , \": \" , a2[i] \nelse:\n print \"Not found.\"\n",
+ "input": [
+ " \n",
+ "\n",
+ "def loc(a1,a2,n1,n2):\n",
+ " p = []\n",
+ " for element in a2:\n",
+ " if element in a1:\n",
+ " p.append(element)\n",
+ " return p\n",
+ "\n",
+ "a1 = [11, 11, 11, 11, 11, 22, 33, 44, 55]\n",
+ "a2 = [11, 11, 11, 22, 33]\n",
+ "print \"Array a1 begins at location\\t\" , hex(id(a1 ))\n",
+ "print \"Array a2 begins at location\\t\" , hex(id(a2)) \n",
+ "p = loc(a1, a2, 9, 5)\n",
+ "if (p):\n",
+ " print \"Array a2 found at location\\t\" , hex(id(p))\n",
+ " for i in range(len(p)):\n",
+ " print \"\\t\" , hex(id(p[i])) , \": \" , p[i], \"\\t\" , hex(id(a2[i])) , \": \" , a2[i] \n",
+ "else:\n",
+ " print \"Not found.\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Array a1 begins at location\t0x9bea56c\nArray a2 begins at location\t0x9bea62c\nArray a2 found at location\t0x9bea6cc\n\t0x8fc1078 : 11 \t0x8fc1078 : 11\n\t0x8fc1078 : 11 \t0x8fc1078 : 11\n\t0x8fc1078 : 11 \t0x8fc1078 : 11\n\t0x8fc0ff4 : 22 \t0x8fc0ff4 : 22\n\t0x8fc0f70 : 33 \t0x8fc0f70 : 33\n"
+ "text": [
+ "Array a1 begins at location\t0x9bea56c\n",
+ "Array a2 begins at location\t0x9bea62c\n",
+ "Array a2 found at location\t0x9bea6cc\n",
+ "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n",
+ "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n",
+ "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n",
+ "\t0x8fc0ff4 : 22 \t0x8fc0ff4 : 22\n",
+ "\t0x8fc0f70 : 33 \t0x8fc0f70 : 33\n"
+ ]
}
],
"prompt_number": 12
@@ -190,102 +400,161 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.15 Using Dynamic Arrays\n'''\n\ndef get(a):\n print \"Enter number of items: \"\n n = int(raw_input())\n print \"Enter \" , n , \" items, one per line:\"\n for i in range(n):\n print \"\\t\" , i+1 , \": \",\n a.append(float(raw_input()))\n\ndef print_(a):\n for i in range(len(a)):\n print a[i] ,\n print ''\n\na = []\nget(a)\nprint_(a)\na = []\nget(a)\nprint_(a)\n",
+ "input": [
+ " \n",
+ "\n",
+ "def get(a):\n",
+ " print \"Enter number of items: \"\n",
+ " n = int(raw_input())\n",
+ " print \"Enter \" , n , \" items, one per line:\"\n",
+ " for i in range(n):\n",
+ " print \"\\t\" , i+1 , \": \",\n",
+ " a.append(float(raw_input()))\n",
+ "\n",
+ "def print_(a):\n",
+ " for i in range(len(a)):\n",
+ " print a[i] ,\n",
+ " print ''\n",
+ "\n",
+ "a = []\n",
+ "get(a)\n",
+ "print_(a)\n",
+ "a = []\n",
+ "get(a)\n",
+ "print_(a)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of items: \n"
+ "text": [
+ "Enter number of items: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 4 items, one per line:\n\t1 : "
+ "text": [
+ "Enter 4 items, one per line:\n",
+ "\t1 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44.4\n"
+ "text": [
+ "44.4\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t2 : "
+ "text": [
+ " \t2 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77.7\n"
+ "text": [
+ "77.7\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t3 : "
+ "text": [
+ " \t3 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "22.2\n"
+ "text": [
+ "22.2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t4 : "
+ "text": [
+ " \t4 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "88.8\n"
+ "text": [
+ "88.8\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 44.4 77.7 22.2 88.8 \nEnter number of items: \n"
+ "text": [
+ " 44.4 77.7 22.2 88.8 \n",
+ "Enter number of items: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 2 items, one per line:\n\t1 : "
+ "text": [
+ "Enter 2 items, one per line:\n",
+ "\t1 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3.33\n"
+ "text": [
+ "3.33\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t2 : "
+ "text": [
+ " \t2 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9.99\n"
+ "text": [
+ "9.99\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 3.33 9.99 \n"
+ "text": [
+ " 3.33 9.99 \n"
+ ]
}
],
"prompt_number": 13
@@ -293,7 +562,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.17 Indirect Bubble Sort\n'''\n\ndef sort(p, n):\n for i in range(1,n):\n for j in range(n-i):\n if (p[j] > p[j+1]):\n p[j],p[j+1] = p[j+1],p[j]\n",
+ "input": [
+ " \n",
+ "\n",
+ "def sort(p, n):\n",
+ " for i in range(1,n):\n",
+ " for j in range(n-i):\n",
+ " if (p[j] > p[j+1]):\n",
+ " p[j],p[j+1] = p[j+1],p[j]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -302,14 +579,37 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.18 The Sum of a Function\n'''\n\ndef sum_(k,n):\n # returns the sum f(0) + f(1) + f(2) + . . . + f(n-1):\n s = 0\n for i in range(1,n+1):\n s += k(i)\n return s\n\ndef square(k):\n return k*k\n\ndef cube(k):\n return k*k*k\n\n\nprint sum_(square,4) # 1 + 4 + 9 + 16\nprint sum_(cube,4) # 1 + 8 + 27 + 64\n\n",
+ "input": [
+ " \n",
+ "\n",
+ "def sum_(k,n):\n",
+ " # returns the sum f(0) + f(1) + f(2) + . . . + f(n-1):\n",
+ " s = 0\n",
+ " for i in range(1,n+1):\n",
+ " s += k(i)\n",
+ " return s\n",
+ "\n",
+ "def square(k):\n",
+ " return k*k\n",
+ "\n",
+ "def cube(k):\n",
+ " return k*k*k\n",
+ "\n",
+ "\n",
+ "print sum_(square,4) # 1 + 4 + 9 + 16\n",
+ "print sum_(cube,4) # 1 + 8 + 27 + 64\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "30\n100\n"
+ "text": [
+ "30\n",
+ "100\n"
+ ]
}
],
"prompt_number": 15
@@ -317,7 +617,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch8.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch8.ipynb
index 033f6e3f..a4d4d774 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch8.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch8"
+ "name": "",
+ "signature": "sha256:79346296b970ba1771cf99da135ed51f1d98b24ac99e0b8758fa3cab63c95d45"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,77 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "\"\"\"\nEXAMPLE 8.1\n\"\"\"\n\nn= [44] # n holds the int 44\nprint \"int n=44; // n holds the int 44:\\n\";\nprint \"\\t\\t n = \" , n \nprint \"\\t\\t &n = \" , hex(id(n))\npn = n \nprint \"int* pn=&n; // pn holds the address of n:\\n\";\nprint \"\\t\\t n = \" , n \nprint \"\\t\\t &n = \" , hex(id(n))\nprint \"\\t\\t pn = \" , hex(id(pn)) \nprint \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\nprint \"\\t\\t *pn = \" , pn\n\npn[0] = 77 # changes the value of n to 77\nprint \"*pn = 77; // changes the value of n to 77:\\n\";\nprint \"\\t\\t n = \" , n \nprint \"\\t\\t &n = \" , hex(id(n))\nprint \"\\t\\t pn = \" , hex(id(pn)) \nprint \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\nprint \"\\t\\t *pn = \" , pn\n\nq = n \nprint \"int* q=&n; // q also holds the address of n:\\n\";\nprint \"\\t\\t n = \" , n \nprint \"\\t\\t &n = \" , hex(id(n))\nprint \"\\t\\t pn = \" , hex(id(pn)) \nprint \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\nprint \"\\t\\t *pn = \" , pn\nprint \"\\t\\t q = \" , hex(id(q))\nprint \"\\t\\t &q = \" , hex(id(hex(id(hex(id(pn))))))\nprint \"\\t\\t *q = \" , q \n\n",
+ "input": [
+ " \n",
+ "\n",
+ "n= [44] # n holds the int 44\n",
+ "print \"int n=44; // n holds the int 44:\\n\";\n",
+ "print \"\\t\\t n = \" , n \n",
+ "print \"\\t\\t &n = \" , hex(id(n))\n",
+ "pn = n \n",
+ "print \"int* pn=&n; // pn holds the address of n:\\n\";\n",
+ "print \"\\t\\t n = \" , n \n",
+ "print \"\\t\\t &n = \" , hex(id(n))\n",
+ "print \"\\t\\t pn = \" , hex(id(pn)) \n",
+ "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"\\t\\t *pn = \" , pn\n",
+ "\n",
+ "pn[0] = 77 # changes the value of n to 77\n",
+ "print \"*pn = 77; // changes the value of n to 77:\\n\";\n",
+ "print \"\\t\\t n = \" , n \n",
+ "print \"\\t\\t &n = \" , hex(id(n))\n",
+ "print \"\\t\\t pn = \" , hex(id(pn)) \n",
+ "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"\\t\\t *pn = \" , pn\n",
+ "\n",
+ "q = n \n",
+ "print \"int* q=&n; // q also holds the address of n:\\n\";\n",
+ "print \"\\t\\t n = \" , n \n",
+ "print \"\\t\\t &n = \" , hex(id(n))\n",
+ "print \"\\t\\t pn = \" , hex(id(pn)) \n",
+ "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"\\t\\t *pn = \" , pn\n",
+ "print \"\\t\\t q = \" , hex(id(q))\n",
+ "print \"\\t\\t &q = \" , hex(id(hex(id(hex(id(pn))))))\n",
+ "print \"\\t\\t *q = \" , q \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "int n=44; // n holds the int 44:\n\n\t\t n = [44]\n\t\t &n = 0x9bfb92c\nint* pn=&n; // pn holds the address of n:\n\n\t\t n = [44]\n\t\t &n = 0x9bfb92c\n\t\t pn = 0x9bfb92c\n\t\t &pn = 0x9bf5aa0\n\t\t *pn = [44]\n*pn = 77; // changes the value of n to 77:\n\n\t\t n = [77]\n\t\t &n = 0x9bfb92c\n\t\t pn = 0x9bfb92c\n\t\t &pn = 0x9c6a760\n\t\t *pn = [77]\nint* q=&n; // q also holds the address of n:\n\n\t\t n = [77]\n\t\t &n = 0x9bfb92c\n\t\t pn = 0x9bfb92c\n\t\t &pn = 0x9bf5c80\n\t\t *pn = [77]\n\t\t q = 0x9bfb92c\n\t\t &q = 0x9c6a760\n\t\t *q = [77]\n"
+ "text": [
+ "int n=44; // n holds the int 44:\n",
+ "\n",
+ "\t\t n = [44]\n",
+ "\t\t &n = 0x9bfb92c\n",
+ "int* pn=&n; // pn holds the address of n:\n",
+ "\n",
+ "\t\t n = [44]\n",
+ "\t\t &n = 0x9bfb92c\n",
+ "\t\t pn = 0x9bfb92c\n",
+ "\t\t &pn = 0x9bf5aa0\n",
+ "\t\t *pn = [44]\n",
+ "*pn = 77; // changes the value of n to 77:\n",
+ "\n",
+ "\t\t n = [77]\n",
+ "\t\t &n = 0x9bfb92c\n",
+ "\t\t pn = 0x9bfb92c\n",
+ "\t\t &pn = 0x9c6a760\n",
+ "\t\t *pn = [77]\n",
+ "int* q=&n; // q also holds the address of n:\n",
+ "\n",
+ "\t\t n = [77]\n",
+ "\t\t &n = 0x9bfb92c\n",
+ "\t\t pn = 0x9bfb92c\n",
+ "\t\t &pn = 0x9bf5c80\n",
+ "\t\t *pn = [77]\n",
+ "\t\t q = 0x9bfb92c\n",
+ "\t\t &q = 0x9c6a760\n",
+ "\t\t *q = [77]\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +89,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.2\nNote : Python does not append '\\0' at the end of string.\n'''\n\ns = \"ABCD\"\nfor i in range(4):\n print \"s[\" , i , \"] = '\" , s[i] , \"'\\n\";\n",
+ "input": [
+ " \n",
+ "\n",
+ "s = \"ABCD\"\n",
+ "for i in range(4):\n",
+ " print \"s[\" , i , \"] = '\" , s[i] , \"'\\n\";\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "s[ 0 ] = ' A '\n\ns[ 1 ] = ' B '\n\ns[ 2 ] = ' C '\n\ns[ 3 ] = ' D '\n\n"
+ "text": [
+ "s[ 0 ] = ' A '\n",
+ "\n",
+ "s[ 1 ] = ' B '\n",
+ "\n",
+ "s[ 2 ] = ' C '\n",
+ "\n",
+ "s[ 3 ] = ' D '\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -40,7 +119,16 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.3\n'''\n\nwhile True:\n word = raw_input()\n if len(word) < 2:\n break\n l = word.split(' ')\n for i in l:\n print '\\t\"' , i , '\"'\n",
+ "input": [
+ " \n",
+ "while True:\n",
+ " word = raw_input()\n",
+ " if len(word) < 2:\n",
+ " break\n",
+ " l = word.split(' ')\n",
+ " for i in l:\n",
+ " print '\\t\"' , i , '\"'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -48,29 +136,46 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Today's date is March 12, 2000.\n"
+ "text": [
+ "Today's date is March 12, 2000.\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t\" Today's \"\n\t\" date \"\n\t\" is \"\n\t\" March \"\n\t\" 12, \"\n\t\" 2000. \"\n"
+ "text": [
+ "\t\" Today's \"\n",
+ "\t\" date \"\n",
+ "\t\" is \"\n",
+ "\t\" March \"\n",
+ "\t\" 12, \"\n",
+ "\t\" 2000. \"\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Tomorrow is Monday.\n"
+ "text": [
+ "Tomorrow is Monday.\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t\" Tomorrow \"\n\t\" is \"\n\t\" Monday. \"\n"
+ "text": [
+ "\t\" Tomorrow \"\n",
+ "\t\" is \"\n",
+ "\t\" Monday. \"\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 6
@@ -78,7 +183,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.4\nThis program echoes the input, line by line:\n'''\n\nwhile True:\n line = raw_input()\n if len(line) < 2:\n break\n print \"\\t[\" , line , \"]\"\n",
+ "input": [
+ " \n",
+ "\n",
+ "while True:\n",
+ " line = raw_input()\n",
+ " if len(line) < 2:\n",
+ " break\n",
+ " print \"\\t[\" , line , \"]\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -86,29 +199,39 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ "text": [
+ "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t[ Once upon a midnight dreary, while I pondered, weak and weary, ]\n"
+ "text": [
+ "\t[ Once upon a midnight dreary, while I pondered, weak and weary, ]\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Over a many quaint and curious volume of forgotten lore,\n"
+ "text": [
+ "Over a many quaint and curious volume of forgotten lore,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t[ Over a many quaint and curious volume of forgotten lore, ]\n"
+ "text": [
+ "\t[ Over a many quaint and curious volume of forgotten lore, ]\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 7
@@ -116,7 +239,19 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.5\n'''\n\n\nwhile True:\n word = raw_input()\n if len(word) < 2:\n break\n l = word.split(',')\n for i in range(len(l)-1):\n print '\\t[' , l[i] , ']'\n\n",
+ "input": [
+ " \n",
+ "\n",
+ "\n",
+ "while True:\n",
+ " word = raw_input()\n",
+ " if len(word) < 2:\n",
+ " break\n",
+ " l = word.split(',')\n",
+ " for i in range(len(l)-1):\n",
+ " print '\\t[' , l[i] , ']'\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -124,29 +259,41 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ "text": [
+ "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t[ Once upon a midnight dreary ]\n\t[ while I pondered ]\n\t[ weak and weary ]\n"
+ "text": [
+ "\t[ Once upon a midnight dreary ]\n",
+ "\t[ while I pondered ]\n",
+ "\t[ weak and weary ]\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Over a many quaint and curious volume of forgotten lore,\n"
+ "text": [
+ "Over a many quaint and curious volume of forgotten lore,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t[ Over a many quaint and curious volume of forgotten lore ]\n"
+ "text": [
+ "\t[ Over a many quaint and curious volume of forgotten lore ]\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 8
@@ -154,7 +301,19 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.6 \nThis program counts the number of occurrences of the letter 'e' in the input stream. \n'''\n\ncount = 0\nwhile True:\n a = raw_input()\n if len(a) < 1:\n break\n for ch in a:\n if (ch == 'e'): count+=1\n \nprint count , \" e's were counted.\\n\"\n",
+ "input": [
+ " \n",
+ "\n",
+ "count = 0\n",
+ "while True:\n",
+ " a = raw_input()\n",
+ " if len(a) < 1:\n",
+ " break\n",
+ " for ch in a:\n",
+ " if (ch == 'e'): count+=1\n",
+ " \n",
+ "print count , \" e's were counted.\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -162,24 +321,33 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ "text": [
+ "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Over many a quaint and curious volume of forgotten lore,\n"
+ "text": [
+ "Over many a quaint and curious volume of forgotten lore,\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "11 e's were counted.\n\n"
+ "text": [
+ "11 e's were counted.\n",
+ "\n"
+ ]
}
],
"prompt_number": 9
@@ -187,7 +355,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.7 \nThis program echoes the input stream, capitalizing each word:\n'''\n\nwhile True:\n a = raw_input()\n if len(a) < 1:\n break\n print a.title()\n",
+ "input": [
+ " \n",
+ "while True:\n",
+ " a = raw_input()\n",
+ " if len(a) < 1:\n",
+ " break\n",
+ " print a.title()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -195,29 +370,39 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Fourscore and seven years ago our fathers\n"
+ "text": [
+ "Fourscore and seven years ago our fathers\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Fourscore And Seven Years Ago Our Fathers\n"
+ "text": [
+ "Fourscore And Seven Years Ago Our Fathers\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "brought forth upon this continent a new nation,\n"
+ "text": [
+ "brought forth upon this continent a new nation,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Brought Forth Upon This Continent A New Nation,\n"
+ "text": [
+ "Brought Forth Upon This Continent A New Nation,\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 10
@@ -225,7 +410,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.8\nThis tests a function that extracts the integers from the input stream:\n'''\n\na = raw_input()\nl = a.split(' ')\nnos = []\nfor i in l:\n try:\n i = int(i)\n nos.append(i)\n except:\n continue\nm = nos[0]\nn = nos[1] \nprint m , \" + \" , n , \" = \" , m+n",
+ "input": [
+ " \n",
+ "\n",
+ "a = raw_input()\n",
+ "l = a.split(' ')\n",
+ "nos = []\n",
+ "for i in l:\n",
+ " try:\n",
+ " i = int(i)\n",
+ " nos.append(i)\n",
+ " except:\n",
+ " continue\n",
+ "m = nos[0]\n",
+ "n = nos[1] \n",
+ "print m , \" + \" , n , \" = \" , m+n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -233,12 +433,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "what is 305 plus 9416 ?\n"
+ "text": [
+ "what is 305 plus 9416 ?\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "305 + 9416 = 9721\n"
+ "text": [
+ "305 + 9416 = 9721\n"
+ ]
}
],
"prompt_number": 11
@@ -246,43 +450,77 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.10 An Array of Strings\n'''\n\nname = []\ncount=0\n\nprint \"Enter at most 4 names with at most 19 characters:\\n\";\nwhile (True):\n n = raw_input()\n if len(n) < 1:\n break\n name.append(n)\n count += 1\n \nprint \"The names are:\\n\"\nfor i in range(count):\n print \"\\t\" , i , \". [\" , name[i] , \"]\" \n",
+ "input": [
+ " \n",
+ "\n",
+ "name = []\n",
+ "count=0\n",
+ "\n",
+ "print \"Enter at most 4 names with at most 19 characters:\\n\";\n",
+ "while (True):\n",
+ " n = raw_input()\n",
+ " if len(n) < 1:\n",
+ " break\n",
+ " name.append(n)\n",
+ " count += 1\n",
+ " \n",
+ "print \"The names are:\\n\"\n",
+ "for i in range(count):\n",
+ " print \"\\t\" , i , \". [\" , name[i] , \"]\" \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter at most 4 names with at most 19 characters:\n\n"
+ "text": [
+ "Enter at most 4 names with at most 19 characters:\n",
+ "\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "George Washington\n"
+ "text": [
+ "George Washington\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "John Adams\n"
+ "text": [
+ "John Adams\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Thomas Jefferson\n"
+ "text": [
+ "Thomas Jefferson\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The names are:\n\n\t0 . [ George Washington ]\n\t1 . [ John Adams ]\n\t2 . [ Thomas Jefferson ]\n"
+ "text": [
+ "The names are:\n",
+ "\n",
+ "\t0 . [ George Washington ]\n",
+ "\t1 . [ John Adams ]\n",
+ "\t2 . [ Thomas Jefferson ]\n"
+ ]
}
],
"prompt_number": 12
@@ -290,43 +528,77 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.11 A String Array\n'''\n\nname = []\ncount=0\n\nprint \"Enter at most 4 names with at most 19 characters:\\n\";\nwhile (True):\n n = raw_input()\n if len(n) < 1:\n break\n name.append(n)\n count += 1\n \nprint \"The names are:\\n\"\nfor i in range(count):\n print \"\\t\" , i , \". [\" , name[i] , \"]\" ",
+ "input": [
+ " \n",
+ "\n",
+ "name = []\n",
+ "count=0\n",
+ "\n",
+ "print \"Enter at most 4 names with at most 19 characters:\\n\";\n",
+ "while (True):\n",
+ " n = raw_input()\n",
+ " if len(n) < 1:\n",
+ " break\n",
+ " name.append(n)\n",
+ " count += 1\n",
+ " \n",
+ "print \"The names are:\\n\"\n",
+ "for i in range(count):\n",
+ " print \"\\t\" , i , \". [\" , name[i] , \"]\" "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter at most 4 names with at most 19 characters:\n\n"
+ "text": [
+ "Enter at most 4 names with at most 19 characters:\n",
+ "\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "George Washington\n"
+ "text": [
+ "George Washington\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "John Adams\n"
+ "text": [
+ "John Adams\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Thomas Jefferson\n"
+ "text": [
+ "Thomas Jefferson\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The names are:\n\n\t0 . [ George Washington ]\n\t1 . [ John Adams ]\n\t2 . [ Thomas Jefferson ]\n"
+ "text": [
+ "The names are:\n",
+ "\n",
+ "\t0 . [ George Washington ]\n",
+ "\t1 . [ John Adams ]\n",
+ "\t2 . [ Thomas Jefferson ]\n"
+ ]
}
],
"prompt_number": 13
@@ -334,14 +606,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.12 Initializing a String Array\nThis program is nearly equivalent to those in the previous two examples. It initializes the array/list\nname and then prints its contents:\n'''\n\nname = [ \"George Washington\", \"John Adams\", \"Thomas Jefferson\"]\nprint \"The names are:\\n\"\nfor i in range(3):\n print \"\\t\" , i , \". [\" , name[i] , \"]\"\n\n",
+ "input": [
+ " \n",
+ "\n",
+ "name = [ \"George Washington\", \"John Adams\", \"Thomas Jefferson\"]\n",
+ "print \"The names are:\\n\"\n",
+ "for i in range(3):\n",
+ " print \"\\t\" , i , \". [\" , name[i] , \"]\"\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The names are:\n\n\t0 . [ George Washington ]\n\t1 . [ John Adams ]\n\t2 . [ Thomas Jefferson ]\n"
+ "text": [
+ "The names are:\n",
+ "\n",
+ "\t0 . [ George Washington ]\n",
+ "\t1 . [ John Adams ]\n",
+ "\t2 . [ Thomas Jefferson ]\n"
+ ]
}
],
"prompt_number": 14
@@ -349,25 +635,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.13 The len() Function\n'''\n\ns = \"ABCDEFG\"\nprint \"len(\" , s , \") = \" , len(s) \nprint \"len(\\\"\\\") = \" , len(\"\")\nprint \"Enter string: \"\nb = raw_input()\nprint \"len(\" , b , \") = \" , len(b)",
+ "input": [
+ " \n",
+ "\n",
+ "s = \"ABCDEFG\"\n",
+ "print \"len(\" , s , \") = \" , len(s) \n",
+ "print \"len(\\\"\\\") = \" , len(\"\")\n",
+ "print \"Enter string: \"\n",
+ "b = raw_input()\n",
+ "print \"len(\" , b , \") = \" , len(b)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "len( ABCDEFG ) = 7\nlen(\"\") = 0\nEnter string: \n"
+ "text": [
+ "len( ABCDEFG ) = 7\n",
+ "len(\"\") = 0\n",
+ "Enter string: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "hello how are you !!!\n"
+ "text": [
+ "hello how are you !!!\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "len( hello how are you !!! ) = 21\n"
+ "text": [
+ "len( hello how are you !!! ) = 21\n"
+ ]
}
],
"prompt_number": 15
@@ -375,14 +678,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.14 \ngives index of substring.\n'''\ns = \"The Mississippi is a long river.\"\nprint 's = \"' , s , '\"'\np = s.find(' ')\nprint \"find(s, ' ') points to s[\" , p , \"].\"\np = s.find('s')\nprint \"find(s, 's') points to s[\" , p , \"].\"\np = s.rfind('s')\nprint \"reverse find(s, 's') points to s[\" , p , \"].\"\np = s.find(\"is\")\nprint \"strstr(s, \\\"is\\\") points to s[\" , p , \"].\"\np = s.find(\"isi\")\nif p== -1:\n print 's.find(\"isi\") returns NULL'\n",
+ "input": [
+ " \n",
+ "s = \"The Mississippi is a long river.\"\n",
+ "print 's = \"' , s , '\"'\n",
+ "p = s.find(' ')\n",
+ "print \"find(s, ' ') points to s[\" , p , \"].\"\n",
+ "p = s.find('s')\n",
+ "print \"find(s, 's') points to s[\" , p , \"].\"\n",
+ "p = s.rfind('s')\n",
+ "print \"reverse find(s, 's') points to s[\" , p , \"].\"\n",
+ "p = s.find(\"is\")\n",
+ "print \"strstr(s, \\\"is\\\") points to s[\" , p , \"].\"\n",
+ "p = s.find(\"isi\")\n",
+ "if p== -1:\n",
+ " print 's.find(\"isi\") returns NULL'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "s = \" The Mississippi is a long river. \"\nfind(s, ' ') points to s[ 3 ].\nfind(s, 's') points to s[ 6 ].\nreverse find(s, 's') points to s[ 17 ].\nstrstr(s, \"is\") points to s[ 5 ].\ns.find(\"isi\") returns NULL\n"
+ "text": [
+ "s = \" The Mississippi is a long river. \"\n",
+ "find(s, ' ') points to s[ 3 ].\n",
+ "find(s, 's') points to s[ 6 ].\n",
+ "reverse find(s, 's') points to s[ 17 ].\n",
+ "strstr(s, \"is\") points to s[ 5 ].\n",
+ "s.find(\"isi\") returns NULL\n"
+ ]
}
],
"prompt_number": 16
@@ -390,14 +715,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.15 string copy\n'''\ns1 = \"ABCDEFG\"\ns2 = \"XYZ\" \nprint \"Before strcpy(s1,s2):\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \ns1 = s2\nprint \"After strcpy(s1,s2):\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "input": [
+ " \n",
+ "s1 = \"ABCDEFG\"\n",
+ "s2 = \"XYZ\" \n",
+ "print \"Before strcpy(s1,s2):\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "s1 = s2\n",
+ "print \"After strcpy(s1,s2):\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before strcpy(s1,s2):\n\n\ts1 = [ ABCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\nAfter strcpy(s1,s2):\n\n\ts1 = [ XYZ ], length = 3\n\ts2 = [ XYZ ], length = 3\n"
+ "text": [
+ "Before strcpy(s1,s2):\n",
+ "\n",
+ "\ts1 = [ ABCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n",
+ "After strcpy(s1,s2):\n",
+ "\n",
+ "\ts1 = [ XYZ ], length = 3\n",
+ "\ts2 = [ XYZ ], length = 3\n"
+ ]
}
],
"prompt_number": 17
@@ -405,14 +750,37 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.16 string copy\n'''\n\ns1 = \"ABCDEFG\"\ns2 = \"XYZ\" \nprint \"Before strcpy(s1,s2,2):\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \ns1 = s2[:2] + s1[2:]\nprint \"After strcpy(s1,s2,2):\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n\n\n",
+ "input": [
+ " \n",
+ "\n",
+ "s1 = \"ABCDEFG\"\n",
+ "s2 = \"XYZ\" \n",
+ "print \"Before strcpy(s1,s2,2):\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "s1 = s2[:2] + s1[2:]\n",
+ "print \"After strcpy(s1,s2,2):\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before strcpy(s1,s2,2):\n\n\ts1 = [ ABCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\nAfter strcpy(s1,s2,2):\n\n\ts1 = [ XYCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\n"
+ "text": [
+ "Before strcpy(s1,s2,2):\n",
+ "\n",
+ "\ts1 = [ ABCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n",
+ "After strcpy(s1,s2,2):\n",
+ "\n",
+ "\ts1 = [ XYCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n"
+ ]
}
],
"prompt_number": 18
@@ -420,14 +788,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.17 The String Concatenation\n'''\n\ns1 = \"ABCDEFG\"\ns2 = \"XYZ\" \nprint \"Before string concatination :\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \ns1 += s2\nprint \"After string concatination :\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) ",
+ "input": [
+ " \n",
+ "\n",
+ "s1 = \"ABCDEFG\"\n",
+ "s2 = \"XYZ\" \n",
+ "print \"Before string concatination :\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "s1 += s2\n",
+ "print \"After string concatination :\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before string concatination :\n\n\ts1 = [ ABCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\nAfter string concatination :\n\ts1 = [ ABCDEFGXYZ ], length = 10\n\ts2 = [ XYZ ], length = 3\n"
+ "text": [
+ "Before string concatination :\n",
+ "\n",
+ "\ts1 = [ ABCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n",
+ "After string concatination :\n",
+ "\ts1 = [ ABCDEFGXYZ ], length = 10\n",
+ "\ts2 = [ XYZ ], length = 3\n"
+ ]
}
],
"prompt_number": 19
@@ -435,14 +823,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.18 The Second String Concatenation (no. of characters)\n'''\n\ns1 = \"ABCDEFG\"\ns2 = \"XYZ\" \nprint \"Before string concatination :\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \ns1 += s2[:2]\nprint \"After string concatination :\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) ",
+ "input": [
+ " \n",
+ "\n",
+ "s1 = \"ABCDEFG\"\n",
+ "s2 = \"XYZ\" \n",
+ "print \"Before string concatination :\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "s1 += s2[:2]\n",
+ "print \"After string concatination :\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before string concatination :\n\n\ts1 = [ ABCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\nAfter string concatination :\n\ts1 = [ ABCDEFGXY ], length = 9\n\ts2 = [ XYZ ], length = 3\n"
+ "text": [
+ "Before string concatination :\n",
+ "\n",
+ "\ts1 = [ ABCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n",
+ "After string concatination :\n",
+ "\ts1 = [ ABCDEFGXY ], length = 9\n",
+ "\ts2 = [ XYZ ], length = 3\n"
+ ]
}
],
"prompt_number": 20
@@ -450,14 +858,35 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.19 The String Tokenize \n'''\ns = \"Today's date is March 12, 2000.\"\n\nprint \"The string is: [\" , s , \"] \\nIts tokens are: \"\np = s.split(\" \")\n\nfor i in p:\n print \"\\t[\" , i , \"] \"\n\nprint \"Now the string is: [\" , p[0] , \"] \";\n",
+ "input": [
+ "\n",
+ "s = \"Today's date is March 12, 2000.\"\n",
+ "\n",
+ "print \"The string is: [\" , s , \"] \\nIts tokens are: \"\n",
+ "p = s.split(\" \")\n",
+ "\n",
+ "for i in p:\n",
+ " print \"\\t[\" , i , \"] \"\n",
+ "\n",
+ "print \"Now the string is: [\" , p[0] , \"] \";\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The string is: [ Today's date is March 12, 2000. ] \nIts tokens are: \n\t[ Today's ] \n\t[ date ] \n\t[ is ] \n\t[ March ] \n\t[ 12, ] \n\t[ 2000. ] \nNow the string is: [ Today's ] \n"
+ "text": [
+ "The string is: [ Today's date is March 12, 2000. ] \n",
+ "Its tokens are: \n",
+ "\t[ Today's ] \n",
+ "\t[ date ] \n",
+ "\t[ is ] \n",
+ "\t[ March ] \n",
+ "\t[ 12, ] \n",
+ "\t[ 2000. ] \n",
+ "Now the string is: [ Today's ] \n"
+ ]
}
],
"prompt_number": 21
@@ -465,14 +894,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.20 The strpbrk() Function\nC provides inbuilt strpbrk(), Here i have written mine.\n'''\n\ndef strpbrk(s,s1):\n found = []\n for i in range(len(s1)):\n if s1[i] in s:\n index = s.find(s1[i])\n found.append(index)\n if found:\n return min(found)\n return None\n \n\ns = \"The Mississippi is a long river.\"\nprint 's = \"' , s , '\"'\np = strpbrk(s, \"nopqr\")\nprint 'strpbrk(s, \"nopqr\") points to s[' , p , \"].\"\np = strpbrk(s, \"NOPQR\")\nif (p == None):\n print 'strpbrk(s, \"NOPQR\") returns NULL.\\n'",
+ "input": [
+ " \n",
+ "\n",
+ "def strpbrk(s,s1):\n",
+ " found = []\n",
+ " for i in range(len(s1)):\n",
+ " if s1[i] in s:\n",
+ " index = s.find(s1[i])\n",
+ " found.append(index)\n",
+ " if found:\n",
+ " return min(found)\n",
+ " return None\n",
+ " \n",
+ "\n",
+ "s = \"The Mississippi is a long river.\"\n",
+ "print 's = \"' , s , '\"'\n",
+ "p = strpbrk(s, \"nopqr\")\n",
+ "print 'strpbrk(s, \"nopqr\") points to s[' , p , \"].\"\n",
+ "p = strpbrk(s, \"NOPQR\")\n",
+ "if (p == None):\n",
+ " print 'strpbrk(s, \"NOPQR\") returns NULL.\\n'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "s = \" The Mississippi is a long river. \"\nstrpbrk(s, \"nopqr\") points to s[ 12 ].\nstrpbrk(s, \"NOPQR\") returns NULL.\n\n"
+ "text": [
+ "s = \" The Mississippi is a long river. \"\n",
+ "strpbrk(s, \"nopqr\") points to s[ 12 ].\n",
+ "strpbrk(s, \"NOPQR\") returns NULL.\n",
+ "\n"
+ ]
}
],
"prompt_number": 22
@@ -480,7 +935,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch9.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch9.ipynb
index fabb9a56..d38faaa6 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch9.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch9"
+ "name": "",
+ "signature": "sha256:636fa14bc9bbc0edbdee2b8486af1239be5ff3d58b955831baa9b4ccd512a82c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,7 +11,16 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.2 Using the Extraction Operation to Control a Loop\n'''\n\n\nwhile True:\n try:\n n = int(raw_input())\n print \"n = \" , n \n except:\n break",
+ "input": [
+ " \n",
+ "\n",
+ "while True:\n",
+ " try:\n",
+ " n = int(raw_input())\n",
+ " print \"n = \" , n \n",
+ " except:\n",
+ " break"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -18,62 +28,84 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "46\n"
+ "text": [
+ "46\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 46\n"
+ "text": [
+ "n = 46\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "22\n"
+ "text": [
+ "22\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 22\n"
+ "text": [
+ "n = 22\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n"
+ "text": [
+ "n = 44\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "66\n"
+ "text": [
+ "66\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 66\n"
+ "text": [
+ "n = 66\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "88\n"
+ "text": [
+ "88\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 88\n"
+ "text": [
+ "n = 88\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33,\n"
+ "text": [
+ "33,\n"
+ ]
}
],
"prompt_number": 1
@@ -81,7 +113,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.4 Inputting Strings with the raw_input() Function\nThis program shows how to read text data line-by-line into an array \n'''\n\nking = [] # defines king to be an array \nn=0\nwhile True:\n name = raw_input()\n if len(name) < 1:\n break\n king.append(name)\n n += 1\n# now n == the number of names read\nfor i in range(n):\n print '\\t' , i+1 , \". \" , king[i] ",
+ "input": [
+ " \n",
+ "\n",
+ "king = [] # defines king to be an array \n",
+ "n=0\n",
+ "while True:\n",
+ " name = raw_input()\n",
+ " if len(name) < 1:\n",
+ " break\n",
+ " king.append(name)\n",
+ " n += 1\n",
+ "# now n == the number of names read\n",
+ "for i in range(n):\n",
+ " print '\\t' , i+1 , \". \" , king[i] "
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -89,60 +135,87 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Kenneth II (971-995)\n"
+ "text": [
+ "Kenneth II (971-995)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Constantine III (995-997)\n"
+ "text": [
+ "Constantine III (995-997)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Kenneth III (997-1005)\n"
+ "text": [
+ "Kenneth III (997-1005)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Malcolm II (1005-1034)\n"
+ "text": [
+ "Malcolm II (1005-1034)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Duncan I (1034-1040)\n"
+ "text": [
+ "Duncan I (1034-1040)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Macbeth (1040-1057)\n"
+ "text": [
+ "Macbeth (1040-1057)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Lulach (1057-1058)\n"
+ "text": [
+ "Lulach (1057-1058)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Malcolm III (1058-1093)\n"
+ "text": [
+ "Malcolm III (1058-1093)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t1 . Kenneth II (971-995)\n\t2 . Constantine III (995-997)\n\t3 . Kenneth III (997-1005)\n\t4 . Malcolm II (1005-1034)\n\t5 . Duncan I (1034-1040)\n\t6 . Macbeth (1040-1057)\n\t7 . Lulach (1057-1058)\n\t8 . Malcolm III (1058-1093)\n"
+ "text": [
+ "\t1 . Kenneth II (971-995)\n",
+ "\t2 . Constantine III (995-997)\n",
+ "\t3 . Kenneth III (997-1005)\n",
+ "\t4 . Malcolm II (1005-1034)\n",
+ "\t5 . Duncan I (1034-1040)\n",
+ "\t6 . Macbeth (1040-1057)\n",
+ "\t7 . Lulach (1057-1058)\n",
+ "\t8 . Malcolm III (1058-1093)\n"
+ ]
}
],
"prompt_number": 2
@@ -150,7 +223,19 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.6 Capitalizing All the Words in a Text File\nHere is a complete program that reads words from the external file named input.txt, capitalizes\nthem, and then writes them to the external file named output.txt:\nNote : Working good , you need input.txt in same directory.\n'''\n\ninfile = open(\"input.txt\",\"r\")\noutfile = open(\"output.txt\",\"w\")\n\nfor i in infile:\n s = i.title()\n outfile.write(s)\n\ninfile.close()\noutfile.close()",
+ "input": [
+ " \n",
+ "\n",
+ "infile = open(\"input.txt\",\"r\")\n",
+ "outfile = open(\"output.txt\",\"w\")\n",
+ "\n",
+ "for i in infile:\n",
+ " s = i.title()\n",
+ " outfile.write(s)\n",
+ "\n",
+ "infile.close()\n",
+ "outfile.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -170,7 +255,38 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.7 Merging Two Sorted Data Files\n'''\n\nfin1 = open(\"north.dat\",\"r\")\nfin2 = open(\"south.dat\",\"r\")\nfout = open(\"combined.dat\",\"w\")\n\nfile1 = []\nfile2 = []\nfor i in fin1:\n try:\n s = i.split(\" \")\n for j in s:\n file1.append(int(j))\n except:\n continue\n \nfor i in fin2:\n try:\n s = i.split(\" \")\n for j in s:\n file2.append(int(j))\n except:\n continue\n\n\nfor i in sorted(file1 + file2):\n fout.write(str(i) + \" \")\n\nfin1.close()\nfin2.close()\nfout.close()",
+ "input": [
+ " \n",
+ "fin1 = open(\"north.dat\",\"r\")\n",
+ "fin2 = open(\"south.dat\",\"r\")\n",
+ "fout = open(\"combined.dat\",\"w\")\n",
+ "\n",
+ "file1 = []\n",
+ "file2 = []\n",
+ "for i in fin1:\n",
+ " try:\n",
+ " s = i.split(\" \")\n",
+ " for j in s:\n",
+ " file1.append(int(j))\n",
+ " except:\n",
+ " continue\n",
+ " \n",
+ "for i in fin2:\n",
+ " try:\n",
+ " s = i.split(\" \")\n",
+ " for j in s:\n",
+ " file2.append(int(j))\n",
+ " except:\n",
+ " continue\n",
+ "\n",
+ "\n",
+ "for i in sorted(file1 + file2):\n",
+ " fout.write(str(i) + \" \")\n",
+ "\n",
+ "fin1.close()\n",
+ "fin2.close()\n",
+ "fout.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -190,14 +306,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.8 Using an Output String Stream\nThis program creates four objects: a character string s,\nan integer n, a floating-point number x, and an output string stream oss:\n'''\n\ndef print_(oss):\n print 'oss.str() = \"' , str(oss) , '\"'\n\ns=\"ABCDEFG\"\nn=33\nx=2.718\nl = ''\nprint_(l)\nl += s\nprint_(l)\nl += ( \" \" + str(n) )\nprint_(l)\nl += ( \" \" + str(x) )\nprint_(l)",
+ "input": [
+ " \n",
+ "\n",
+ "def print_(oss):\n",
+ " print 'oss.str() = \"' , str(oss) , '\"'\n",
+ "\n",
+ "s=\"ABCDEFG\"\n",
+ "n=33\n",
+ "x=2.718\n",
+ "l = ''\n",
+ "print_(l)\n",
+ "l += s\n",
+ "print_(l)\n",
+ "l += ( \" \" + str(n) )\n",
+ "print_(l)\n",
+ "l += ( \" \" + str(x) )\n",
+ "print_(l)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "oss.str() = \" \"\noss.str() = \" ABCDEFG \"\noss.str() = \" ABCDEFG 33 \"\noss.str() = \" ABCDEFG 33 2.718 \"\n"
+ "text": [
+ "oss.str() = \" \"\n",
+ "oss.str() = \" ABCDEFG \"\n",
+ "oss.str() = \" ABCDEFG 33 \"\n",
+ "oss.str() = \" ABCDEFG 33 2.718 \"\n"
+ ]
}
],
"prompt_number": 5
@@ -205,14 +343,38 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.9 Using an Input String Stream iss ABCDEFG 44 3.14 istringstream\nThis program is similar to the one in Example 9.8 \nexcept that it reads from an input string stream iss\ninstead of writing to an output string stream.:\n'''\n'''\nEXAMPLE 9.8 Using an Output String Stream\nThis program creates four objects: a character string s,\nan integer n, a floating-point number x, and an output string stream oss:\n'''\n\ndef print_(iss,s='',n=0,x=0.0):\n print 's = \"' , s , '\", n = ' , n , \", x = \" , x, ', iss.str() = \"' \\\n , iss , '\"' \n\ns=\"\"\nn=0\nx=0.0\nl = ''\niss = \"ABCDEFG 44 3.14\"\nprint_(iss)\ns = \"ABCDEFG\"\nprint_(iss,s)\nn = 44\nprint_(iss,s,n)\nx = 3.14\nprint_(iss,s,n,x)",
+ "input": [
+ " \n",
+ "\n",
+ "def print_(iss,s='',n=0,x=0.0):\n",
+ " print 's = \"' , s , '\", n = ' , n , \", x = \" , x, ', iss.str() = \"' \\\n",
+ " , iss , '\"' \n",
+ "\n",
+ "s=\"\"\n",
+ "n=0\n",
+ "x=0.0\n",
+ "l = ''\n",
+ "iss = \"ABCDEFG 44 3.14\"\n",
+ "print_(iss)\n",
+ "s = \"ABCDEFG\"\n",
+ "print_(iss,s)\n",
+ "n = 44\n",
+ "print_(iss,s,n)\n",
+ "x = 3.14\n",
+ "print_(iss,s,n,x)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "s = \" \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\ns = \" ABCDEFG \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\ns = \" ABCDEFG \", n = 44 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\ns = \" ABCDEFG \", n = 44 , x = 3.14 , iss.str() = \" ABCDEFG 44 3.14 \"\n"
+ "text": [
+ "s = \" \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n",
+ "s = \" ABCDEFG \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n",
+ "s = \" ABCDEFG \", n = 44 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n",
+ "s = \" ABCDEFG \", n = 44 , x = 3.14 , iss.str() = \" ABCDEFG 44 3.14 \"\n"
+ ]
}
],
"prompt_number": 6
@@ -220,7 +382,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_1_1.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_1_1.ipynb
index 43fa32ce..c3d00505 100644
--- a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_1_1.ipynb
+++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_1_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 1"
+ "name": "",
+ "signature": "sha256:f74ebb3df14e61a18adced8ec1d013b274b4ed30f643d40b946b0969c2ba80e2"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,46 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter1: Fluid Statics"
+ "source": [
+ "Chapter1: Fluid Statics"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.1,Page 3"
+ "source": [
+ "Example 1.1,Page 3"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Force\n\n# Variable Decleration\nrho=924; #density\ng=9.81; #grivity\nH=2; #height\nd=2; # depth \n\n#Calculation\np=rho*g*H;\na=d*H;\nF=p*a/2;\n\n#result\nprint\" Total force exerted over the wall in(N) =\",round(F,3)",
+ "input": [
+ "\n",
+ "# Variable Decleration\n",
+ "rho=924; #density\n",
+ "g=9.81; #grivity\n",
+ "H=2; #height\n",
+ "d=2; # depth \n",
+ "\n",
+ "#Calculation\n",
+ "p=rho*g*H;\n",
+ "a=d*H;\n",
+ "F=p*a/2;\n",
+ "\n",
+ "#result\n",
+ "print\" Total force exerted over the wall in(N) =\",round(F,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Total force exerted over the wall in(N) = 36257.76\n"
+ "text": [
+ " Total force exerted over the wall in(N) = 36257.76\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +60,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.2,Page 5"
+ "source": [
+ "Example 1.2,Page 5"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Force and Pressure\nimport math\n\n#Variable declaration\np_v =50*1000; #pressure\nr =1; #m\np_atm =101.3*1000; #atmospheric pressure\nrho =1000; #density\nH =2.5; #m\ng =9.81; #m/s^2\n\n\n#Calculation\nF= p_v*math.pi*r*r;\np= p_atm + p_v + rho *g*H;\nFd =( p_v+ rho *g*H)*math.pi*r*r+rho*g*2*math.pi*r*r/3;\n\n#result\nprint \" Total vertical force tending to lift the dome (N)\", round(F,3)\nprint \" Absolute pressure at the bottom o f the vessel (Pa)\",round(p,3)\nprint \"Downward force imposed by the gas and liquid (N)\", round(Fd,3)",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "p_v =50*1000; #pressure\n",
+ "r =1; #m\n",
+ "p_atm =101.3*1000; #atmospheric pressure\n",
+ "rho =1000; #density\n",
+ "H =2.5; #m\n",
+ "g =9.81; #m/s^2\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "F= p_v*math.pi*r*r;\n",
+ "p= p_atm + p_v + rho *g*H;\n",
+ "Fd =( p_v+ rho *g*H)*math.pi*r*r+rho*g*2*math.pi*r*r/3;\n",
+ "\n",
+ "#result\n",
+ "print \" Total vertical force tending to lift the dome (N)\", round(F,3)\n",
+ "print \" Absolute pressure at the bottom o f the vessel (Pa)\",round(p,3)\n",
+ "print \"Downward force imposed by the gas and liquid (N)\", round(Fd,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Total vertical force tending to lift the dome (N) 157079.633\n Absolute pressure at the bottom o f the vessel (Pa) 175825.0\nDownward force imposed by the gas and liquid (N) 254673.208\n"
+ "text": [
+ " Total vertical force tending to lift the dome (N) 157079.633\n",
+ " Absolute pressure at the bottom o f the vessel (Pa) 175825.0\n",
+ "Downward force imposed by the gas and liquid (N) 254673.208\n"
+ ]
}
],
"prompt_number": 5
@@ -59,19 +109,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.3,Page 7"
+ "source": [
+ "Example 1.3,Page 7"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Force\n\n#Variable Decleration\na1 =0.3; #m^2\nm =1000; # kg\na2 =0.003; #m^2\nrho_oil =750; #kg /m^3\nH =2; #m\ng =9.81; #m/ s ^2\n\n# Calcualtion\nF1=m*g;\nF2=a2 *( F1/a1 - rho_oil *g*H);\n\n#result\nprint \"The force on the plunger(N)\",round(F2,3)",
+ "input": [
+ "\n",
+ "#Variable Decleration\n",
+ "a1 =0.3; #m^2\n",
+ "m =1000; # kg\n",
+ "a2 =0.003; #m^2\n",
+ "rho_oil =750; #kg /m^3\n",
+ "H =2; #m\n",
+ "g =9.81; #m/ s ^2\n",
+ "\n",
+ "# Calcualtion\n",
+ "F1=m*g;\n",
+ "F2=a2 *( F1/a1 - rho_oil *g*H);\n",
+ "\n",
+ "#result\n",
+ "print \"The force on the plunger(N)\",round(F2,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The force on the plunger(N) 53.955\n"
+ "text": [
+ "The force on the plunger(N) 53.955\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +150,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.4,Page 8"
+ "source": [
+ "Example 1.4,Page 8"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Height\n\n#variable Decleration\nrho_0 =800; # kg /m^3\nrho_aq =1100; # density of aqueous solution\n\n#calculation\nH =0.5* rho_aq /( rho_aq - rho_0 );\n# For a fixed length of chamber o f 3 m, the\n#interface between the two phases is determined\n#from the p r e s s u r e i n the chamber and d i s c h a r g e\n#p o i n t .\n#r h o 0 \u0003g\u0003H1+rho a q \u0003g\u0003H2=rho a q \u0003g \u0003(H\udbc0\udc000.5) ;\n#H=H1+H2\nrho_0 =600; #kg /m^3\nH1 =0.5* rho_aq /( rho_aq - rho_0 );\n\n#result\nprint \"H(m)\",round(H,3)\nprint \"The lowest possible position of the interface in the chamber below the overflow (m)\",round(H1,2)",
+ "input": [
+ "\n",
+ "#variable Decleration\n",
+ "rho_0 =800; # kg /m^3\n",
+ "rho_aq =1100; # density of aqueous solution\n",
+ "\n",
+ "#calculation\n",
+ "H =0.5* rho_aq /( rho_aq - rho_0 );\n",
+ "# For a fixed length of chamber o f 3 m, the\n",
+ "#interface between the two phases is determined\n",
+ "#from the p r e s s u r e i n the chamber and d i s c h a r g e\n",
+ "#p o i n t .\n",
+ "#r h o 0 \u0003g\u0003H1+rho a q \u0003g\u0003H2=rho a q \u0003g \u0003(H\udbc0\udc000.5) ;\n",
+ "#H=H1+H2\n",
+ "rho_0 =600; #kg /m^3\n",
+ "H1 =0.5* rho_aq /( rho_aq - rho_0 );\n",
+ "\n",
+ "#result\n",
+ "print \"H(m)\",round(H,3)\n",
+ "print \"The lowest possible position of the interface in the chamber below the overflow (m)\",round(H1,2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "H(m) 1.833\nThe lowest possible position of the interface in the chamber below the overflow (m) 1.1\n"
+ "text": [
+ "H(m) 1.833\n",
+ "The lowest possible position of the interface in the chamber below the overflow (m) 1.1\n"
+ ]
}
],
"prompt_number": 2
@@ -101,19 +196,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.5, Page11"
+ "source": [
+ "Example 1.5, Page11"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#position of interface between legs\n\n#variable decleration\nrho_o =900; #kg /m^3\nrho_n =1070; #kg /m^3\nH =1; #m\ng =9.81; #m/ s ^2\ndp =10*10**3; #change in pressure\n\n#H=H1+H2\n#calculation\nH1 =(dp - rho_n *g*H)/( rho_o - rho_n )/g;\n\n#result\nprint \"The position of the interface between the legs (m)\", round(H1,2)",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "rho_o =900; #kg /m^3\n",
+ "rho_n =1070; #kg /m^3\n",
+ "H =1; #m\n",
+ "g =9.81; #m/ s ^2\n",
+ "dp =10*10**3; #change in pressure\n",
+ "\n",
+ "#H=H1+H2\n",
+ "#calculation\n",
+ "H1 =(dp - rho_n *g*H)/( rho_o - rho_n )/g;\n",
+ "\n",
+ "#result\n",
+ "print \"The position of the interface between the legs (m)\", round(H1,2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The position of the interface between the legs (m) 0.3\n"
+ "text": [
+ "The position of the interface between the legs (m) 0.3\n"
+ ]
}
],
"prompt_number": 2
@@ -122,19 +237,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.6,Page 13"
+ "source": [
+ "Example 1.6,Page 13"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Density and Fraction\n\n# Variable defining\ndp =22*10**3; #N/m^2\ng =9.81;#m/ s ^2\nH =1.5;#m\nrho =1495.00;#kg /m^3\nrho_s =1270;#kg /m^3\nrho_c =2698;#kg /m^3\n\n# Calculation\np=dp/g/H;\n#rho=f 1 \u0003 r h o s+f 2 \u0003 r h o c\n#f 1+f 2=1\nf2 =( rho - rho_s )/( rho_c - rho_s );\n\n#result\nprint \" the density of the solution with crystals (kg/m^3)\",round(p,3)\nprint \"The fraction of crystals \", round(f2,3)",
+ "input": [
+ "# Variable defining\n",
+ "dp =22*10**3; #N/m^2\n",
+ "g =9.81;#m/ s ^2\n",
+ "H =1.5;#m\n",
+ "rho =1495.00;#kg /m^3\n",
+ "rho_s =1270;#kg /m^3\n",
+ "rho_c =2698;#kg /m^3\n",
+ "\n",
+ "# Calculation\n",
+ "p=dp/g/H;\n",
+ "#rho=f 1 \u0003 r h o s+f 2 \u0003 r h o c\n",
+ "#f 1+f 2=1\n",
+ "f2 =( rho - rho_s )/( rho_c - rho_s );\n",
+ "\n",
+ "#result\n",
+ "print \" the density of the solution with crystals (kg/m^3)\",round(p,3)\n",
+ "print \"The fraction of crystals \", round(f2,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " the density of the solution with crystals (kg/m^3) 1495.073\nThe fraction of crystals 0.158\n"
+ "text": [
+ " the density of the solution with crystals (kg/m^3) 1495.073\n",
+ "The fraction of crystals 0.158\n"
+ ]
}
],
"prompt_number": 12
@@ -143,19 +281,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.7, Page 15"
+ "source": [
+ "Example 1.7, Page 15"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding radius\n\n#Variable defining\np_atm =101.3*10**3; #N/m^2\nrho =1000; #kg /m^3\ng =9.81; #m/ s ^2\nH1 =3; #m\na =0.073; #N/m\nr1 =5*10**( -4) ; #m\np1= p_atm + rho *g*H1 +2* a/r1;\n\n#calculation\n# p2=p atm+rho \u0003g\u0003H2+2\u0003a / r2 ;\n# p1 \u00034/3\u0003%pi\u0003 r1 ^3=p2 \u00034/3\u0003%pi\u0003 r2 ^3\n# Solving above two equations we get\nr2 =0.053; #//mm\n\n#result\nprint\"Radius of the bubble(mm)\",round(r2,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable defining\n",
+ "p_atm =101.3*10**3; #N/m^2\n",
+ "rho =1000; #kg /m^3\n",
+ "g =9.81; #m/ s ^2\n",
+ "H1 =3; #m\n",
+ "a =0.073; #N/m\n",
+ "r1 =5*10**( -4) ; #m\n",
+ "p1= p_atm + rho *g*H1 +2* a/r1;\n",
+ "\n",
+ "#calculation\n",
+ "# p2=p atm+rho \u0003g\u0003H2+2\u0003a / r2 ;\n",
+ "# p1 \u00034/3\u0003%pi\u0003 r1 ^3=p2 \u00034/3\u0003%pi\u0003 r2 ^3\n",
+ "# Solving above two equations we get\n",
+ "r2 =0.053; #//mm\n",
+ "\n",
+ "#result\n",
+ "print\"Radius of the bubble(mm)\",round(r2,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Radius of the bubble(mm) 0.053\n"
+ "text": [
+ "Radius of the bubble(mm) 0.053\n"
+ ]
}
],
"prompt_number": 3
@@ -164,19 +326,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.8,Page 17"
+ "source": [
+ "Example 1.8,Page 17"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Pressure Difference\n\n#Variable defining\nH =0.2; #m\nrho =1000; #kg /m^3\nrho_Hg =13600; #kg /m^3\ng =9.81; #m/ s ^2\n\n#calculation\ndp =( rho_Hg -rho)*g*H;\n\n#result\nprint \" Differential pressure(Pa)\",round(dp,2)",
+ "input": [
+ "\n",
+ "#Variable defining\n",
+ "H =0.2; #m\n",
+ "rho =1000; #kg /m^3\n",
+ "rho_Hg =13600; #kg /m^3\n",
+ "g =9.81; #m/ s ^2\n",
+ "\n",
+ "#calculation\n",
+ "dp =( rho_Hg -rho)*g*H;\n",
+ "\n",
+ "#result\n",
+ "print \" Differential pressure(Pa)\",round(dp,2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Differential pressure(Pa) 24721.2\n"
+ "text": [
+ " Differential pressure(Pa) 24721.2\n"
+ ]
}
],
"prompt_number": 9
@@ -185,19 +364,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.9,Page 19"
+ "source": [
+ "Example 1.9,Page 19"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding pressure drop\n\n#variable defining\nrho =1000;\ng =9.81; # m/ s ^2\nH =0.4; #m\n\n#calculation\ndp=rho*g*H;\n\n#result\nprint\" Pressure drop in the pipe(Pa)\",round(dp)",
+ "input": [
+ "\n",
+ "\n",
+ "#variable defining\n",
+ "rho =1000;\n",
+ "g =9.81; # m/ s ^2\n",
+ "H =0.4; #m\n",
+ "\n",
+ "#calculation\n",
+ "dp=rho*g*H;\n",
+ "\n",
+ "#result\n",
+ "print\" Pressure drop in the pipe(Pa)\",round(dp)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Pressure drop in the pipe(Pa) 3924.0\n"
+ "text": [
+ " Pressure drop in the pipe(Pa) 3924.0\n"
+ ]
}
],
"prompt_number": 1
@@ -206,19 +402,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.10,Page 21"
+ "source": [
+ "Example 1.10,Page 21"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding quantity\nimport math\n\n#variable defining\ndp =20*10**3; #N/m^2\nrho_Hg =13600; # kg /m^3\nrho =700; #kg /m^3\ng =9.81; #m/ s ^2\nd =0.02; #m\n\n\n#calculation\nH=dp*(rho_Hg - rho)**-1/g;\nV= math.pi /4*d*d*H;\n\n#result\nprint\"Quantity of mercury to be removed (m^3)\",round(V,9)",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable defining\n",
+ "dp =20*10**3; #N/m^2\n",
+ "rho_Hg =13600; # kg /m^3\n",
+ "rho =700; #kg /m^3\n",
+ "g =9.81; #m/ s ^2\n",
+ "d =0.02; #m\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "H=dp*(rho_Hg - rho)**-1/g;\n",
+ "V= math.pi /4*d*d*H;\n",
+ "\n",
+ "#result\n",
+ "print\"Quantity of mercury to be removed (m^3)\",round(V,9)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Quantity of mercury to be removed (m^3) 4.965e-05\n"
+ "text": [
+ "Quantity of mercury to be removed (m^3) 4.965e-05\n"
+ ]
}
],
"prompt_number": 11
@@ -227,19 +445,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.11,Page 23"
+ "source": [
+ "Example 1.11,Page 23"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Pressure\n\n#Variable defining\nimport math\nfrom math import sin\nrho =800; #kg /m^3\ng =9.81; #m/ s ^2\nL =0.12;\n\n\n#calculations\ntheta = math.pi /180*20; #radians\ndp=rho*g*L*(sin(theta));\n\n#result\nprint \"The gauge pressure across the filter(Pa)\",round(dp,2)",
+ "input": [
+ "\n",
+ "#Variable defining\n",
+ "import math\n",
+ "from math import sin\n",
+ "rho =800; #kg /m^3\n",
+ "g =9.81; #m/ s ^2\n",
+ "L =0.12;\n",
+ "\n",
+ "\n",
+ "#calculations\n",
+ "theta = math.pi /180*20; #radians\n",
+ "dp=rho*g*L*(sin(theta));\n",
+ "\n",
+ "#result\n",
+ "print \"The gauge pressure across the filter(Pa)\",round(dp,2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The gauge pressure across the filter(Pa) 322.100890178\n"
+ "text": [
+ "The gauge pressure across the filter(Pa) 322.100890178\n"
+ ]
}
],
"prompt_number": 1
@@ -248,19 +486,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.12,Page 25"
+ "source": [
+ "Example 1.12,Page 25"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding tension\n\n#Variable defining\nmc =100; #kg\ng =9.81; #m/ s ^2\nrho =1000; #kg /m^3\nrho_c =7930; #kg /m^3\n\n#calculation\nm=mc*rho/ rho_c ;\nF=mc*g-m*g; #tension\n\n#result\nprint(\"The tension in the cable(N)\",round(F,2))\n",
+ "input": [
+ "\n",
+ "#Variable defining\n",
+ "mc =100; #kg\n",
+ "g =9.81; #m/ s ^2\n",
+ "rho =1000; #kg /m^3\n",
+ "rho_c =7930; #kg /m^3\n",
+ "\n",
+ "#calculation\n",
+ "m=mc*rho/ rho_c ;\n",
+ "F=mc*g-m*g; #tension\n",
+ "\n",
+ "#result\n",
+ "print(\"The tension in the cable(N)\",round(F,2))\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "('The tension in the cable(N)', 863.28)\n"
+ "text": [
+ "('The tension in the cable(N)', 863.28)\n"
+ ]
}
],
"prompt_number": 13
@@ -269,19 +525,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.13,Page 27"
+ "source": [
+ "Example 1.13,Page 27"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding length\n\n#Variale defining\nrho =1000.0;\nx =0.06;\nrho_0 =800.0;\nx_0 =0.04;\nrho_L =900.0;\n\n#calculation\nL=( rho*x- rho_0 *x_0)/( rho - rho_0 );\nx_L =L-rho/ rho_L *(L-x);\n\n#result\nprint \" Length of the stem above the liquid of SG 0.9 is (m)\",round(x_L,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#Variale defining\n",
+ "rho =1000.0;\n",
+ "x =0.06;\n",
+ "rho_0 =800.0;\n",
+ "x_0 =0.04;\n",
+ "rho_L =900.0;\n",
+ "\n",
+ "#calculation\n",
+ "L=( rho*x- rho_0 *x_0)/( rho - rho_0 );\n",
+ "x_L =L-rho/ rho_L *(L-x);\n",
+ "\n",
+ "#result\n",
+ "print \" Length of the stem above the liquid of SG 0.9 is (m)\",round(x_L,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Length of the stem above the liquid of SG 0.9 is (m) 0.05\n"
+ "text": [
+ " Length of the stem above the liquid of SG 0.9 is (m) 0.05\n"
+ ]
}
],
"prompt_number": 5
@@ -290,19 +566,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.14,Page 29\n"
+ "source": [
+ "Example 1.14,Page 29\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Time and Quantity\n\n#variable defining\nm_s =5*10**6; #kg\nT2 =4.5; #m\nT1 =3; #m\nrho_hc =950; #kg /m^3\nQ =125; #m^3/h\n\n#calculation\nm_hc =m_s *( T2/T1 -1);\nt= m_hc / rho_hc /Q;\n\n#result\nprint\"Quantity delivered(kg)\",round(m_hc,2)\nprint \"Time taken(hours)\",round(t,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#variable defining\n",
+ "m_s =5*10**6; #kg\n",
+ "T2 =4.5; #m\n",
+ "T1 =3; #m\n",
+ "rho_hc =950; #kg /m^3\n",
+ "Q =125; #m^3/h\n",
+ "\n",
+ "#calculation\n",
+ "m_hc =m_s *( T2/T1 -1);\n",
+ "t= m_hc / rho_hc /Q;\n",
+ "\n",
+ "#result\n",
+ "print\"Quantity delivered(kg)\",round(m_hc,2)\n",
+ "print \"Time taken(hours)\",round(t,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Quantity delivered(kg) 2500000.0\nTime taken(hours) 21.053\n"
+ "text": [
+ "Quantity delivered(kg) 2500000.0\n",
+ "Time taken(hours) 21.053\n"
+ ]
}
],
"prompt_number": 1
@@ -310,7 +608,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_2_1.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_2_1.ipynb
index a567da1d..72318a60 100644
--- a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_2_1.ipynb
+++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_2_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 2"
+ "name": "",
+ "signature": "sha256:785f37cfaf9aeabbac4169c1fd95bd67ae8666fc83631f2d394e32747e65fd3b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,63 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 2,Continuity Momentum and Energy"
+ "source": [
+ "Chapter 2,Continuity Momentum and Energy"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 2.1,Page 36"
+ "source": [
+ "Example 2.1,Page 36"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Velocity and Flow rate\nfrom math import pi\n\n\n#variable decleration\nQ1 =0.02; #m^3/ s\nd1 =0.15; #m\nd2 =0.05; #m\nd3 =0.1; #m\nv2 =3; #m/ s\n\n\n#calculation\nQ2=pi*d2 **2/4* v2;\nv3 =(4* Q1/pi -d2 **2* v2)/d3 **2;\nQ3=pi*d3 **2/4* v3;\nv1 =4*( Q2+Q3)/pi/d1 **2;\n\n\n#result\nprint\" Flow rate at pipe 3(m^3/s) =\",round(Q3,4)\nprint\" Flow rate at pipe 2(m^3/s)= \",round(Q2,4)\nprint\" Flow rate at pipe 1(m^3/s)= \",round(Q1,4)\nprint\" Velocity at pipe 1(m/s) =\",round(v1,3)\nprint\" Velocity at pipe 2(m/s) =\",round(v2,3)\nprint\" Velocity at pipe 3(m/s) =\",round(v3,3)\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "Q1 =0.02; #m^3/ s\n",
+ "d1 =0.15; #m\n",
+ "d2 =0.05; #m\n",
+ "d3 =0.1; #m\n",
+ "v2 =3; #m/ s\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "Q2=pi*d2 **2/4* v2;\n",
+ "v3 =(4* Q1/pi -d2 **2* v2)/d3 **2;\n",
+ "Q3=pi*d3 **2/4* v3;\n",
+ "v1 =4*( Q2+Q3)/pi/d1 **2;\n",
+ "\n",
+ "\n",
+ "#result\n",
+ "print\" Flow rate at pipe 3(m^3/s) =\",round(Q3,4)\n",
+ "print\" Flow rate at pipe 2(m^3/s)= \",round(Q2,4)\n",
+ "print\" Flow rate at pipe 1(m^3/s)= \",round(Q1,4)\n",
+ "print\" Velocity at pipe 1(m/s) =\",round(v1,3)\n",
+ "print\" Velocity at pipe 2(m/s) =\",round(v2,3)\n",
+ "print\" Velocity at pipe 3(m/s) =\",round(v3,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Flow rate at pipe 3(m^3/s) = 0.0141\n Flow rate at pipe 2(m^3/s)= 0.0059\n Flow rate at pipe 1(m^3/s)= 0.02\n Velocity at pipe 1(m/s) = 1.132\n Velocity at pipe 2(m/s) = 3.0\n Velocity at pipe 3(m/s) = 1.796\n"
+ "text": [
+ " Flow rate at pipe 3(m^3/s) = 0.0141\n",
+ " Flow rate at pipe 2(m^3/s)= 0.0059\n",
+ " Flow rate at pipe 1(m^3/s)= 0.02\n",
+ " Velocity at pipe 1(m/s) = 1.132\n",
+ " Velocity at pipe 2(m/s) = 3.0\n",
+ " Velocity at pipe 3(m/s) = 1.796\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +77,53 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 2.2,Page 38"
+ "source": [
+ "Example 2.2,Page 38"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Force exerted\n#variable decleration\nimport math\nfrom math import pi\nd1 =0.2; #m\nd2=d1;\np1 =1*10**5; #N/m^2\np2 =80*10**3; #N/m^2\nQ =150.0; #m^3/h\nrho =900; #kg /m^3\ntheta1 =0; # r a d i a n s\ntheta2 =pi; # r a d i a n s\n\n#calculation\na1=pi*d1 **2/4;\na2=pi*d2 **2/4;\nF1=p1*a1; # Upstream f o r c e\nF2=p2*a2; # Downstream f o r c e\nv1 =4*Q /3600/ pi/d1 **2;\nv2=v1;\nflux =rho*Q /3600* v2; #Momentum f l u x\nFx=F1* math.cos ( theta1 )-F2* math.cos ( theta2 )+ flux *( math.cos ( theta2 ) -\nmath.cos ( theta1 ));\nFy=F1* math.sin ( theta1 )-F2* math.sin ( theta2 )-flux *( math.sin ( theta2 )-\nmath.sin ( theta1 ));\nF= math.sqrt (Fx **2+ Fy **2);\n\n#result\nprint\" Force exerted by liquid (kN) =\",round(F,2)\n",
+ "input": [
+ "\n",
+ "#variable decleration\n",
+ "import math\n",
+ "from math import pi\n",
+ "d1 =0.2; #m\n",
+ "d2=d1;\n",
+ "p1 =1*10**5; #N/m^2\n",
+ "p2 =80*10**3; #N/m^2\n",
+ "Q =150.0; #m^3/h\n",
+ "rho =900; #kg /m^3\n",
+ "theta1 =0; # r a d i a n s\n",
+ "theta2 =pi; # r a d i a n s\n",
+ "\n",
+ "#calculation\n",
+ "a1=pi*d1 **2/4;\n",
+ "a2=pi*d2 **2/4;\n",
+ "F1=p1*a1; # Upstream f o r c e\n",
+ "F2=p2*a2; # Downstream f o r c e\n",
+ "v1 =4*Q /3600/ pi/d1 **2;\n",
+ "v2=v1;\n",
+ "flux =rho*Q /3600* v2; #Momentum f l u x\n",
+ "Fx=F1* math.cos ( theta1 )-F2* math.cos ( theta2 )+ flux *( math.cos ( theta2 ) -\n",
+ "math.cos ( theta1 ));\n",
+ "Fy=F1* math.sin ( theta1 )-F2* math.sin ( theta2 )-flux *( math.sin ( theta2 )-\n",
+ "math.sin ( theta1 ));\n",
+ "F= math.sqrt (Fx **2+ Fy **2);\n",
+ "\n",
+ "#result\n",
+ "print\" Force exerted by liquid (kN) =\",round(F,2)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Force exerted by liquid (kN) = 5552.47608322\n"
+ "text": [
+ " Force exerted by liquid (kN) = 5552.47608322\n"
+ ]
}
],
"prompt_number": 12
@@ -59,19 +132,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 2.3,Page 40"
+ "source": [
+ "Example 2.3,Page 40"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding pressure\nfrom math import pi\n\n#variable decleration\nrho =1000; # kg /m^3\nd =0.05; #m\nL =500; #m\nv =1.7; #m/ s\n\n#calculation\na= pi *d **2/4;\nF= rho *a*L*v;\nP=F/a /10**3;\n \n#result \nprint\"Average pressure(kN/m^2) =\",round(P)\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#variable decleration\n",
+ "rho =1000; # kg /m^3\n",
+ "d =0.05; #m\n",
+ "L =500; #m\n",
+ "v =1.7; #m/ s\n",
+ "\n",
+ "#calculation\n",
+ "a= pi *d **2/4;\n",
+ "F= rho *a*L*v;\n",
+ "P=F/a /10**3;\n",
+ " \n",
+ "#result \n",
+ "print\"Average pressure(kN/m^2) =\",round(P)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Average pressure(kN/m^2) = 850.0\n"
+ "text": [
+ "Average pressure(kN/m^2) = 850.0\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +174,56 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 2.4,Page 42"
+ "source": [
+ "Example 2.4,Page 42"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding pressure and velocity\n\n#variable decleration\nimport math\ng =9.8; #m/ s ^2\ndz =0.2; #m ; dz1=z1-z2=z1-z2\nrho =1000; # kg /m^3\ndz1 =2; #m ; dz1=z1-z A\ndz2 =0; #m ; dz2=z1-z B\ndz3 = -1.5; #m ; dz3=z1-z C\n\n#calculation\nv2= math.sqrt (2* g*dz);\nv_A =v2;\nv_B =v2;\nv_C =v2;\np_A = rho *g*( dz1 - v_A **2/2/ g);\np_B = rho *g*( dz2 - v_B **2/2/ g);\np_C = rho *g*( dz3 - v_C **2/2/ g);\n\n#result\nprint\" Velocity at pt . A(m/s) =\",round(v_A,2);\nprint\" Velocity at pt . B(m/s) =\",round(v_B,2);\nprint\" Velocity at pt . C(m/s) =\",round(v_C,2);\nprint\" Pressure at pt . A(kN/m^2) =\",round(p_A)\nprint\" Pressure at pt . B (kN/m^2)=\",round(p_B)\nprint\" Pressure at pt . C (kN/m^2)=\",round(p_C)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "import math\n",
+ "g =9.8; #m/ s ^2\n",
+ "dz =0.2; #m ; dz1=z1-z2=z1-z2\n",
+ "rho =1000; # kg /m^3\n",
+ "dz1 =2; #m ; dz1=z1-z A\n",
+ "dz2 =0; #m ; dz2=z1-z B\n",
+ "dz3 = -1.5; #m ; dz3=z1-z C\n",
+ "\n",
+ "#calculation\n",
+ "v2= math.sqrt (2* g*dz);\n",
+ "v_A =v2;\n",
+ "v_B =v2;\n",
+ "v_C =v2;\n",
+ "p_A = rho *g*( dz1 - v_A **2/2/ g);\n",
+ "p_B = rho *g*( dz2 - v_B **2/2/ g);\n",
+ "p_C = rho *g*( dz3 - v_C **2/2/ g);\n",
+ "\n",
+ "#result\n",
+ "print\" Velocity at pt . A(m/s) =\",round(v_A,2);\n",
+ "print\" Velocity at pt . B(m/s) =\",round(v_B,2);\n",
+ "print\" Velocity at pt . C(m/s) =\",round(v_C,2);\n",
+ "print\" Pressure at pt . A(kN/m^2) =\",round(p_A)\n",
+ "print\" Pressure at pt . B (kN/m^2)=\",round(p_B)\n",
+ "print\" Pressure at pt . C (kN/m^2)=\",round(p_C)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Velocity at pt . A(m/s) = 1.98\n Velocity at pt . B(m/s) = 1.98\n Velocity at pt . C(m/s) = 1.98\n Pressure at pt . A(kN/m^2) = 17640.0\n Pressure at pt . B (kN/m^2)= -1960.0\n Pressure at pt . C (kN/m^2)= -16660.0\n"
+ "text": [
+ " Velocity at pt . A(m/s) = 1.98\n",
+ " Velocity at pt . B(m/s) = 1.98\n",
+ " Velocity at pt . C(m/s) = 1.98\n",
+ " Pressure at pt . A(kN/m^2) = 17640.0\n",
+ " Pressure at pt . B (kN/m^2)= -1960.0\n",
+ " Pressure at pt . C (kN/m^2)= -16660.0\n"
+ ]
}
],
"prompt_number": 2
@@ -101,19 +232,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 2.5,Page 44"
+ "source": [
+ "Example 2.5,Page 44"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding pressure drop\nfrom math import pi\n\n#variable decleration\nQ =10.0; # m^3/ hr\nd1 =0.05; #m\nd2 =0.1; #m\nrho =1000.0; #kg /m^3\ng=9.81;\n\n\n#calculation\na1=pi*d1 **2/4;\na2=pi*d2 **2/4;\nv1=Q /3600/ a1;\nv2 =( d1/d2) **2* v1;\nPD=rho*0.057*g;\n\n#results\nprint\" Presure drop (N/m^2)=\",round(PD,3)\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#variable decleration\n",
+ "Q =10.0; # m^3/ hr\n",
+ "d1 =0.05; #m\n",
+ "d2 =0.1; #m\n",
+ "rho =1000.0; #kg /m^3\n",
+ "g=9.81;\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "a1=pi*d1 **2/4;\n",
+ "a2=pi*d2 **2/4;\n",
+ "v1=Q /3600/ a1;\n",
+ "v2 =( d1/d2) **2* v1;\n",
+ "PD=rho*0.057*g;\n",
+ "\n",
+ "#results\n",
+ "print\" Presure drop (N/m^2)=\",round(PD,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Presure drop (N/m^2)= 375.26364312\n"
+ "text": [
+ " Presure drop (N/m^2)= 375.26364312\n"
+ ]
}
],
"prompt_number": 7
@@ -122,19 +278,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 2.7,Page 48"
+ "source": [
+ "Example 2.7,Page 48"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding force required\n\n#variable decleration\nQ =100; #m^3/ hr\nd1 =0.2; #m\nd2 =0.15; #m\np1 =80*10**3; #N/m^2\nrho =1000; # kg /m^3\ng =9.8; #m/ s ^2\npi=3.14;\n\n#calculation\na1=pi*d1 **2/4;\na2=pi*d2 **2/4;\nv1=Q /3600/ a1;\nv2=Q /3600/ a2;\nH_L =0.2* v2 **2/2/ g;\np2=p1+ rho /2*( v1 **2- v2 **2) -rho*g* H_L ;\nF_u =p1*a1; # Upstream f o r c e\nF_d =p2*a2; # Downstream f o r c e\nF_x = rho *Q /3600*( v2 -v1)-F_u +F_d;\n\n#results\nprint\" Force required (N) =\",round(F_x)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "Q =100; #m^3/ hr\n",
+ "d1 =0.2; #m\n",
+ "d2 =0.15; #m\n",
+ "p1 =80*10**3; #N/m^2\n",
+ "rho =1000; # kg /m^3\n",
+ "g =9.8; #m/ s ^2\n",
+ "pi=3.14;\n",
+ "\n",
+ "#calculation\n",
+ "a1=pi*d1 **2/4;\n",
+ "a2=pi*d2 **2/4;\n",
+ "v1=Q /3600/ a1;\n",
+ "v2=Q /3600/ a2;\n",
+ "H_L =0.2* v2 **2/2/ g;\n",
+ "p2=p1+ rho /2*( v1 **2- v2 **2) -rho*g* H_L ;\n",
+ "F_u =p1*a1; # Upstream f o r c e\n",
+ "F_d =p2*a2; # Downstream f o r c e\n",
+ "F_x = rho *Q /3600*( v2 -v1)-F_u +F_d;\n",
+ "\n",
+ "#results\n",
+ "print\" Force required (N) =\",round(F_x)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Force required (N) = -1099.0\n"
+ "text": [
+ " Force required (N) = -1099.0\n"
+ ]
}
],
"prompt_number": 17
@@ -143,19 +328,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 2.9,Page 53"
+ "source": [
+ "Example 2.9,Page 53"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding depression\n\n#variable decleration\nN =60; #rpm\nr2 =0.25; #m\ng =9.8; #m/ s ^2\npi=3.14;\n\nw =2* pi*N /60;\ndz_12 =(w*r2) **2/2/ g; # dz 1 2=z2-z1\nc=w*r2 **2;\ndz_23 =c **2/2/ g/r2 **2; # dz 2 3=z3-z2\ndz_13 = dz_23 + dz_12 ;\n\n#results\nprint\" Total depression(m) =\",round(dz_13,3)\n",
+ "input": [
+ "\n",
+ "#variable decleration\n",
+ "N =60; #rpm\n",
+ "r2 =0.25; #m\n",
+ "g =9.8; #m/ s ^2\n",
+ "pi=3.14;\n",
+ "\n",
+ "w =2* pi*N /60;\n",
+ "dz_12 =(w*r2) **2/2/ g; # dz 1 2=z2-z1\n",
+ "c=w*r2 **2;\n",
+ "dz_23 =c **2/2/ g/r2 **2; # dz 2 3=z3-z2\n",
+ "dz_13 = dz_23 + dz_12 ;\n",
+ "\n",
+ "#results\n",
+ "print\" Total depression(m) =\",round(dz_13,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Total depression(m) = 0.252\n"
+ "text": [
+ " Total depression(m) = 0.252\n"
+ ]
}
],
"prompt_number": 3
@@ -163,7 +368,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_3_1.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_3_1.ipynb
index 538dce80..047caec2 100644
--- a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_3_1.ipynb
+++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_3_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 3"
+ "name": "",
+ "signature": "sha256:f2eaea1b025b2ddec764d2fab1514700e255b4e2c5860b0d8b1ba9dafae0ccc9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,42 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 3,Laminar Flow and Lubrication"
+ "source": [
+ "Chapter 3,Laminar Flow and Lubrication"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.2,Page 63"
+ "source": [
+ "Example 3.2,Page 63"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding fartherest distance\n\n#variable decleration\nRe =2000.0;\nd =0.008; #m\n\n#calculation\nL1 =0.058* Re*d;\n\n#result\nprint\"The furtherest distance the fluid can flow into the 8 mm inside diameter pipe (m)=\",round(L1,3);\n",
+ "input": [
+ "\n",
+ "#variable decleration\n",
+ "Re =2000.0;\n",
+ "d =0.008; #m\n",
+ "\n",
+ "#calculation\n",
+ "L1 =0.058* Re*d;\n",
+ "\n",
+ "#result\n",
+ "print\"The furtherest distance the fluid can flow into the 8 mm inside diameter pipe (m)=\",round(L1,3);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The furtherest distance the fluid can flow into the 8 mm inside diameter pipe (m)= 0.928\n"
+ "text": [
+ "The furtherest distance the fluid can flow into the 8 mm inside diameter pipe (m)= 0.928\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +56,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.4,Page 67"
+ "source": [
+ "Example 3.4,Page 67"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding flow rate\nfrom math import pi\n\n#variable decleration\ndel_p =90*10**3; # N/m^2\nd =0.126; # m\nR =0.126/2; # m\nu =1.2;\nL =60; # m\nRho =1260;\n\n\n#calculation\nQ= pi * del_p * R**4 / (8*u*L);\nRe =4* Rho *Q/(u*pi*d);\n\n#result\nprint \"The glycerol delivery rate is (m^3/s) \",round(Q,4);\nprint\"The Reynolds number is \",round(Re,3);\nprint\"As Re is below 2000 , so, laminar flow\"",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#variable decleration\n",
+ "del_p =90*10**3; # N/m^2\n",
+ "d =0.126; # m\n",
+ "R =0.126/2; # m\n",
+ "u =1.2;\n",
+ "L =60; # m\n",
+ "Rho =1260;\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "Q= pi * del_p * R**4 / (8*u*L);\n",
+ "Re =4* Rho *Q/(u*pi*d);\n",
+ "\n",
+ "#result\n",
+ "print \"The glycerol delivery rate is (m^3/s) \",round(Q,4);\n",
+ "print\"The Reynolds number is \",round(Re,3);\n",
+ "print\"As Re is below 2000 , so, laminar flow\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The glycerol delivery rate is (m^3/s) 0.0077\nThe Reynolds number is 82.047\nAs Re is below 2000 , so, laminar flow\n"
+ "text": [
+ "The glycerol delivery rate is (m^3/s) 0.0077\n",
+ "The Reynolds number is 82.047\n",
+ "As Re is below 2000 , so, laminar flow\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +104,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.5,Page 69"
+ "source": [
+ "Example 3.5,Page 69"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding diameter\nfrom math import pi\n\n#variable decleration\nu =0.015; #Ns/m^2\nQ =0.004/60; #m^3/ s\ndp =100;\nrho =1100.0; #kg /m^3\n\n\n#calculation\nR =(8* u*Q/( pi *dp)) **(0.25) ;\nRe =(4* rho *Q/( pi*u *(2* R)));\n\n#result\nprint\"Diameter of the pipe(m) =\",round(R,3);\nprint\"Reynolds number =\",round(Re,2)\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#variable decleration\n",
+ "u =0.015; #Ns/m^2\n",
+ "Q =0.004/60; #m^3/ s\n",
+ "dp =100;\n",
+ "rho =1100.0; #kg /m^3\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "R =(8* u*Q/( pi *dp)) **(0.25) ;\n",
+ "Re =(4* rho *Q/( pi*u *(2* R)));\n",
+ "\n",
+ "#result\n",
+ "print\"Diameter of the pipe(m) =\",round(R,3);\n",
+ "print\"Reynolds number =\",round(Re,2)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Diameter of the pipe(m) = 0.013\nReynolds number = 246.38\n"
+ "text": [
+ "Diameter of the pipe(m) = 0.013\n",
+ "Reynolds number = 246.38\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +148,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.6,Page 71"
+ "source": [
+ "Example 3.6,Page 71"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding pressure difference\nfrom math import pi\n\n#variable decleration\nmu =0.03; #Ns/m^2\nQ =10.0**( -7) ; #m^3/ s\nu=(7.0);\n\n#calculation\ndp= 8*mu*Q*u/3/pi/0.005**4;\n\n#result\nprint\" pressure difference (N/m^2)=\",round(dp,2)\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#variable decleration\n",
+ "mu =0.03; #Ns/m^2\n",
+ "Q =10.0**( -7) ; #m^3/ s\n",
+ "u=(7.0);\n",
+ "\n",
+ "#calculation\n",
+ "dp= 8*mu*Q*u/3/pi/0.005**4;\n",
+ "\n",
+ "#result\n",
+ "print\" pressure difference (N/m^2)=\",round(dp,2)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " pressure difference (N/m^2)= 28.52\n"
+ "text": [
+ " pressure difference (N/m^2)= 28.52\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +187,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.8,Page 75"
+ "source": [
+ "Example 3.8,Page 75"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding pressure difference\nfrom math import pi\n\n#variable decleration\nu =0.1; #Ns/m^2\nd =0.1; #m\nR =0.05; # m\nRho =900; #kg /m^3\nv_max =2; # m/ s\nv= v_max /2; # m/ s\n\n#calculation\nTw = 2*u* v_max /R;\ndel_p =4* u* v_max /R **2;\n\n#result\nprint \"At the pipe wa l l ( r =R) , shear stress (N/m^2)= \",Tw;\nprint\" pressure drop per metre lengthh of pipe is (N/m^2)\",del_p;\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#variable decleration\n",
+ "u =0.1; #Ns/m^2\n",
+ "d =0.1; #m\n",
+ "R =0.05; # m\n",
+ "Rho =900; #kg /m^3\n",
+ "v_max =2; # m/ s\n",
+ "v= v_max /2; # m/ s\n",
+ "\n",
+ "#calculation\n",
+ "Tw = 2*u* v_max /R;\n",
+ "del_p =4* u* v_max /R **2;\n",
+ "\n",
+ "#result\n",
+ "print \"At the pipe wa l l ( r =R) , shear stress (N/m^2)= \",Tw;\n",
+ "print\" pressure drop per metre lengthh of pipe is (N/m^2)\",del_p;\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "At the pipe wa l l ( r =R) , shear stress (N/m^2)= 8.0\n pressure drop per metre lengthh of pipe is (N/m^2) 320.0\n"
+ "text": [
+ "At the pipe wa l l ( r =R) , shear stress (N/m^2)= 8.0\n",
+ " pressure drop per metre lengthh of pipe is (N/m^2) 320.0\n"
+ ]
}
],
"prompt_number": 9
@@ -122,19 +232,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.9,Page 77"
+ "source": [
+ "Example 3.9,Page 77"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding inside diameter\n\n#variable decleration\nimport math\nu =0.032; #Ns/m^2\nRe =2000.0; #maximum v a l u e\nRho =854.0;\ndel_p =150.0; #N/m^2\n\n#calculation\nd =(32* u **2* Re /( Rho* del_p ))**(0.33) ;\n\nprint \"The maximum inside diameter is found to be (m) \",round(d,3);\n",
+ "input": [
+ "\n",
+ "#variable decleration\n",
+ "import math\n",
+ "u =0.032; #Ns/m^2\n",
+ "Re =2000.0; #maximum v a l u e\n",
+ "Rho =854.0;\n",
+ "del_p =150.0; #N/m^2\n",
+ "\n",
+ "#calculation\n",
+ "d =(32* u **2* Re /( Rho* del_p ))**(0.33) ;\n",
+ "\n",
+ "print \"The maximum inside diameter is found to be (m) \",round(d,3);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The maximum inside diameter is found to be (m) 0.082\n"
+ "text": [
+ "The maximum inside diameter is found to be (m) 0.082\n"
+ ]
}
],
"prompt_number": 7
@@ -143,19 +270,40 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.10,Page 79"
+ "source": [
+ "Example 3.10,Page 79"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding pressure drop\n\nfrom math import pi\n#variable decleration\nrho =1000; #kg /m^3\nu =0.1; #Ns/m^2\ng =9.81; #m/ s ^2\nL =10; #m\nH =2; #m\nQ =14.0/3600; #m^3/ s\nd =0.05; #m\n\n#calculation\ndp=rho*g*(L+H) - (128* Q*u*L/pi /d**4) ;\n\n#result\nprint\" Pressure drop across the valve (N/m^2)=\",round(dp,2)\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "#variable decleration\n",
+ "rho =1000; #kg /m^3\n",
+ "u =0.1; #Ns/m^2\n",
+ "g =9.81; #m/ s ^2\n",
+ "L =10; #m\n",
+ "H =2; #m\n",
+ "Q =14.0/3600; #m^3/ s\n",
+ "d =0.05; #m\n",
+ "\n",
+ "#calculation\n",
+ "dp=rho*g*(L+H) - (128* Q*u*L/pi /d**4) ;\n",
+ "\n",
+ "#result\n",
+ "print\" Pressure drop across the valve (N/m^2)=\",round(dp,2)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Pressure drop across the valve (N/m^2)= 92368.39\n"
+ "text": [
+ " Pressure drop across the valve (N/m^2)= 92368.39\n"
+ ]
}
],
"prompt_number": 4
@@ -164,19 +312,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.12,Page 83"
+ "source": [
+ "Example 3.12,Page 83"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding inclination and viscosity\n\n#variable decleration\nfrom math import pi\nimport math\nQ =3*10**( -6) ; #m^3/ s\nu =0.001; #Ns/m^2\nW =1;\nrho =1000; #kg /m^3\ng =9.81; #m/ s ^2\nd =1.016*10**( -4) ; #m\nd1 =1.25*10**( -4) ; # m\n\n\n#calculation\ntheta = math.asin (3*Q*u/W/rho/g/d **3) ;\nu1=W*rho *g* math.sin ( theta )*( d1 **3) /(3* Q);\n\n#result\nprint\"Exact angle of inclination (radians) =\",round(theta,3)\nprint\" Viscosity of the second liquid (Ns/m^2)=\",round(u1,4)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "from math import pi\n",
+ "import math\n",
+ "Q =3*10**( -6) ; #m^3/ s\n",
+ "u =0.001; #Ns/m^2\n",
+ "W =1;\n",
+ "rho =1000; #kg /m^3\n",
+ "g =9.81; #m/ s ^2\n",
+ "d =1.016*10**( -4) ; #m\n",
+ "d1 =1.25*10**( -4) ; # m\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "theta = math.asin (3*Q*u/W/rho/g/d **3) ;\n",
+ "u1=W*rho *g* math.sin ( theta )*( d1 **3) /(3* Q);\n",
+ "\n",
+ "#result\n",
+ "print\"Exact angle of inclination (radians) =\",round(theta,3)\n",
+ "print\" Viscosity of the second liquid (Ns/m^2)=\",round(u1,4)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Exact angle of inclination (radians) = 1.065\n Viscosity of the second liquid (Ns/m^2)= 0.0019\n"
+ "text": [
+ "Exact angle of inclination (radians) = 1.065\n",
+ " Viscosity of the second liquid (Ns/m^2)= 0.0019\n"
+ ]
}
],
"prompt_number": 3
@@ -185,19 +360,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.17,Page 93"
+ "source": [
+ "Example 3.17,Page 93"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding shear stress\n\n#variable decleration\nu =1.5; #Ns/m^2\nv =0.5; # m/ s\nH =0.02/2; # m\n\n#calculation\nt=-u*3*v/H;\n\n#result\nprint \"The shear stress (N/m^2)=\",t\nprint\"acting on opp. direction of flow\" \n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "u =1.5; #Ns/m^2\n",
+ "v =0.5; # m/ s\n",
+ "H =0.02/2; # m\n",
+ "\n",
+ "#calculation\n",
+ "t=-u*3*v/H;\n",
+ "\n",
+ "#result\n",
+ "print \"The shear stress (N/m^2)=\",t\n",
+ "print\"acting on opp. direction of flow\" \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The shear stress (N/m^2)= -225.0\nacting on opp. direction of flow\n"
+ "text": [
+ "The shear stress (N/m^2)= -225.0\n",
+ "acting on opp. direction of flow\n"
+ ]
}
],
"prompt_number": 34
@@ -206,19 +400,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.18,Page 95"
+ "source": [
+ "Example 3.18,Page 95"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding torque and viscosity\nfrom math import pi\nfrom scipy import integrate\n\n#variable decleration\nN =600.0/60; #r e v o l u t i o n s pe r s e c\nr =0.025; #m\nt =400; # N/m^2\nl =0.002; # m\ntime=2.0/1000; #s\n\n#calculation\nw =2* pi*N;\nu=t*l/w/r;\ndef integrand (R,w,u,time):\n return 2*pi*u*w/time*R**3\n\n#a=lambda r:2*pi*0.509*62.8/2*r**3*1000;\nT=integrate.quad(integrand, 0,0.025,args=(w,u,time));\n\n#result\nprint\" Viscosity,(Ns/m^2)=\",round(u,3)\nprint\"Torque(Nm) =\",round(T[0],4)\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "from scipy import integrate\n",
+ "\n",
+ "#variable decleration\n",
+ "N =600.0/60; #r e v o l u t i o n s pe r s e c\n",
+ "r =0.025; #m\n",
+ "t =400; # N/m^2\n",
+ "l =0.002; # m\n",
+ "time=2.0/1000; #s\n",
+ "\n",
+ "#calculation\n",
+ "w =2* pi*N;\n",
+ "u=t*l/w/r;\n",
+ "def integrand (R,w,u,time):\n",
+ " return 2*pi*u*w/time*R**3\n",
+ "\n",
+ "#a=lambda r:2*pi*0.509*62.8/2*r**3*1000;\n",
+ "T=integrate.quad(integrand, 0,0.025,args=(w,u,time));\n",
+ "\n",
+ "#result\n",
+ "print\" Viscosity,(Ns/m^2)=\",round(u,3)\n",
+ "print\"Torque(Nm) =\",round(T[0],4)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Viscosity,(Ns/m^2)= 0.509\nTorque(Nm) = 0.0098\n"
+ "text": [
+ " Viscosity,(Ns/m^2)= 0.509\n",
+ "Torque(Nm) = 0.0098\n"
+ ]
}
],
"prompt_number": 18
@@ -227,19 +450,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.19,Page 97"
+ "source": [
+ "Example 3.19,Page 97"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding torque and frictional resistance\nfrom math import pi\n\n#variable decleration\nu =0.153; #Ns/m^2\nr =0.05; # m\nN =30; # rps\nt =2.0/10**5; # s\nL =0.2; #m\n\n\n#calculation\ntau =u *(2* pi *N*r/t);\nF= tau *2* pi *r*L;\nT=F*r;\nw =2* pi*N;\nP=T*w;\n\n#result\nprint \"The torque on the bearing is found to be (Nm)= \",round(T,3);\nprint \" and the power required to overcome the resistance is (W)=\",round(P,3);\n\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#variable decleration\n",
+ "u =0.153; #Ns/m^2\n",
+ "r =0.05; # m\n",
+ "N =30; # rps\n",
+ "t =2.0/10**5; # s\n",
+ "L =0.2; #m\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "tau =u *(2* pi *N*r/t);\n",
+ "F= tau *2* pi *r*L;\n",
+ "T=F*r;\n",
+ "w =2* pi*N;\n",
+ "P=T*w;\n",
+ "\n",
+ "#result\n",
+ "print \"The torque on the bearing is found to be (Nm)= \",round(T,3);\n",
+ "print \" and the power required to overcome the resistance is (W)=\",round(P,3);\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The torque on the bearing is found to be (Nm)= 226.507\n and the power required to overcome the resistance is (W)= 42695.643\n"
+ "text": [
+ "The torque on the bearing is found to be (Nm)= 226.507\n",
+ " and the power required to overcome the resistance is (W)= 42695.643\n"
+ ]
}
],
"prompt_number": 19
@@ -248,19 +499,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 3.20,Page 99"
+ "source": [
+ "Example 3.20,Page 99"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding viscosity of oil\n\n#variable decleration\nt =0.0005;#s\nP =22; \nr =300.0/60; \nR_1 =0.1; \nR_2 =0.0625; \npi=3.14;\n\n#calculation\nw =2* pi*r;\nu =2* t*P/( pi *w **2*(( R_1 )**4 -( R_2) **4) );\n\n#result\nprint\"The viscosity of the oil is (Ns/m^2)= \",round(u,4);\n",
+ "input": [
+ "\n",
+ "#variable decleration\n",
+ "t =0.0005;#s\n",
+ "P =22; \n",
+ "r =300.0/60; \n",
+ "R_1 =0.1; \n",
+ "R_2 =0.0625; \n",
+ "pi=3.14;\n",
+ "\n",
+ "#calculation\n",
+ "w =2* pi*r;\n",
+ "u =2* t*P/( pi *w **2*(( R_1 )**4 -( R_2) **4) );\n",
+ "\n",
+ "#result\n",
+ "print\"The viscosity of the oil is (Ns/m^2)= \",round(u,4);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The viscosity of the oil is (Ns/m^2)= 0.0839\n"
+ "text": [
+ "The viscosity of the oil is (Ns/m^2)= 0.0839\n"
+ ]
}
],
"prompt_number": 20
@@ -268,7 +539,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_4_1.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_4_1.ipynb
index 9b4bb41f..7c5078a5 100644
--- a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_4_1.ipynb
+++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_4_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 4"
+ "name": "",
+ "signature": "sha256:3e9255609d7264d7167f865de1dbf27ba92b4a62cb35c2df65b3f59b0ee5b06e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 4, Dimensional Analysis"
+ "source": [
+ "Chapter 4, Dimensional Analysis"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 4.5,Page 108"
+ "source": [
+ "Example 4.5,Page 108"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding pressure drop\n\n#Variable Declaration\nRho_full =800.0; # kg /m^3\nv_full =1.8; # m/ s\nu_full =9.0/10000 ; # Nm/ s ^2\nRho_model =1000.0; # kg /m^3\nu_model =1.0/1000 ; # Ns/m^2\nd_full = 2.0;\nd_model =1.0;\ndel_p_fmodel =4000.0; # N/m^2\n\n#Calculation\nv_model = (( Rho_full * v_full / u_full )/( Rho_model /u_model ))*( d_full / d_model );\n#del_p_f = del_p_fmodel * Rho_full *( v_full )**2/ Rho_model /(v_model )**2;\n\n#result\nprint \"The velocity in the full scale pipe is expected to be(m/s)\",round(v_model,2);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable Declaration\n",
+ "Rho_full =800.0; # kg /m^3\n",
+ "v_full =1.8; # m/ s\n",
+ "u_full =9.0/10000 ; # Nm/ s ^2\n",
+ "Rho_model =1000.0; # kg /m^3\n",
+ "u_model =1.0/1000 ; # Ns/m^2\n",
+ "d_full = 2.0;\n",
+ "d_model =1.0;\n",
+ "del_p_fmodel =4000.0; # N/m^2\n",
+ "\n",
+ "#Calculation\n",
+ "v_model = (( Rho_full * v_full / u_full )/( Rho_model /u_model ))*( d_full / d_model );\n",
+ "#del_p_f = del_p_fmodel * Rho_full *( v_full )**2/ Rho_model /(v_model )**2;\n",
+ "\n",
+ "#result\n",
+ "print \"The velocity in the full scale pipe is expected to be(m/s)\",round(v_model,2);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The velocity in the full scale pipe is expected to be(m/s) 3.2\n"
+ "text": [
+ "The velocity in the full scale pipe is expected to be(m/s) 3.2\n"
+ ]
}
],
"prompt_number": 1
@@ -37,7 +63,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_5_1.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_5_1.ipynb
index ef67f9f0..19f3f7be 100644
--- a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_5_1.ipynb
+++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_5_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 5"
+ "name": "",
+ "signature": "sha256:3560754f85c552adcb8e17db6d394e5a7c27026cea8efa4cac19d77a4813e8fe"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Finding Velocity\n",
"\n",
"#Variable Iniialisation\n",
"import math\n",
@@ -68,7 +68,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Finding average rate of flow and velocity\n",
"\n",
"%pylab inline\n",
"#variable initialisation\n",
@@ -109,6 +108,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEMCAYAAAArnKpYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVeW+x/EPzh41h6OoqYVTIaJIDqWJUg5p5nTtWpZe\np6zTYK/mrE5ldSrr6umU1TXN0jLHyqFMtExQyXJOy8xSETVwCEHRFIF1/3hiKwky7L3X2sP3/Xrx\nCjZ77fVjtV2//Ty/ZwixLMtCREQEKON0ACIi4juUFERExEVJQUREXJQURETERUlBRERclBRERMTF\na0lh//79XHfddbRs2ZLIyEjeeOMNANLS0ujRowdXXHEFPXv2JD093VshiIhICYV4a55Camoqqamp\ntGnThszMTNq2bcuiRYt4//33qV27No899hivvPIKx44dY8KECd4IQURESshrLYV69erRpk0bAKpW\nrUqLFi04ePAgS5YsYfjw4QAMHz6cRYsWeSsEEREpIa+1FM6XlJRE165d+eGHH7jssss4duwYAJZl\nUatWLdfPIiLirHLePkFmZiaDBg3i9ddfp1q1avl+FxISQkhIyAXHFPSYiIgUzd3P+V4dfXT27FkG\nDRrEsGHDGDBgAAB169YlNTUVgJSUFEJDQws81rIsfVkWzz77rOMx+MqXroWuha7Fxb88wWtJwbIs\nRo8eTUREBA888IDr8X79+jFz5kwAZs6c6UoWIiLiPK91HyUmJjJr1ixat25NdHQ0AC+//DLjxo1j\n8ODBTJ8+nbCwMObPn++tEEREpIS8lhQ6d+5Mbm5ugb/76quvvHXagBMbG+t0CD5D1+IcXYtzdC08\ny5bRRyUVEhLisf4xEZFg4Yl7p5a5EBERFyUFERFxUVIQEREXJQUREXFRUhARERclBRERcVFSEBER\nFyUFERFxUVIQEREXJQUREXFRUhARERclBRERcVFSEBERF69vxykiEjBycuDgQdiz59zX7t2QnAzv\nvAORkU5H6DYlBRGR8504kf+mn3fj37PH3Pxr14YmTc599ekD8+fD2rVKCiIifqegT/vn3/hPncp/\n0w8PhxtvNN+HhUHlyhe+5pEj8OOPtv8p3qCkICKBp6BP++d39fz979C06bkbf95Nv0kTqFsXQkJK\ndr6WLeHzz73zt9hMO6+JiP9KTYVly859ys/778mT527y59/8L/Zp3x0HDkD79pCS4tnXLSFP3DuV\nFETEv+TmwldfwdSpsHIl9OplunjOv/mX5tO+OywLqleHpCSoVcu+8/6FJ+6d6j4SEf+Qmgrvvw/T\nppkb8F13wXvvwSWXOB2ZSUAREfDTT3DttU5H4xbNUxAR35WbCytWwM03Q4sWpmto3jzYvBn+8Q/f\nSAh5IiICotisloKI+B5fbhUUpmVL2LHD6SjcppaCiPgGf2oVFCQiIiCSgloKIuIsf2wVFERJQUSk\nlP46gujmm02roF07e0cNeVKjRpCeDhkZJrn5KSUFEbFPoLQK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OnUqfPn3429/+RkxMDCdPnnQdn/caY8aM\noX///rRp04ZevXq5Cs2rVq1i4sSJlC9fnmrVqvHBBx9cEEfnzp3ZuHEjbdu2vSCuv/58/vfr16+n\nS5cunrgUIqWiBfFEvGDPnj2MHTuWpUuXlui42NhY5s+fryGp4hh1H4l4QZMmTahWrVqJJ681a9ZM\nCUEcpZaCiIi4qKUgIiIuSgoiIuKipCAiIi5KCiIi4qKkICIiLkoKIiLi8v8vJedrtH6NpQAAAABJ\nRU5ErkJggg==\n"
},
@@ -135,7 +135,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Finding throat diameter and overall length\n",
"\n",
"#variable declaration\n",
"from math import pi\n",
@@ -187,7 +186,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Finding flow through orifice and venturimeter\n",
"\n",
"#Variable Decleration\n",
"Cd_o =0.65;\n",
@@ -235,7 +233,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#finding Cd\n",
"\n",
"#Variable declaration\n",
"from math import pi\n",
@@ -283,7 +280,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Finding differential pressure\n",
"\n",
"#variable declaration\n",
"from math import pi\n",
@@ -328,7 +324,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#finding rate of flow\n",
+ "\n",
"\n",
"#variable declaration\n",
"from math import pi\n",
@@ -373,7 +369,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Finding mass flow rate\n",
+ "\n",
"\n",
"#variable decleration\n",
"from math import pi\n",
@@ -422,7 +418,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Finding flow rate of water and Cd\n",
+ "\n",
"\n",
"#variable decleration\n",
"from math import pi\n",
diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_6_1.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_6_1.ipynb
index 19e4fb13..28a995b9 100644
--- a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_6_1.ipynb
+++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_6_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 6"
+ "name": "",
+ "signature": "sha256:935baa5cece6ad60c6e41bbc750e73048ac600a6bffe3888ab4bb403a9f445e6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 6:Tank drainage and variable head flow"
+ "source": [
+ "Chapter 6:Tank drainage and variable head flow"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 6.1,Page 143"
+ "source": [
+ "Example 6.1,Page 143"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding no. of orifice\n\n#variable decleration\nfrom math import pi\nimport math\nQ =5000.0/3600/24; #m^3 per second\nC_d =0.6;\nr =0.01/2; # m\ng =9.8; #m/ s ^2\nH =0.2; # m\n\n\n#calculation\na_o = pi *r**2;\nn=Q/C_d/ a_o / math.sqrt (2*g*H);\n\n#result\nprint\"The number of orifices required are \",round (n)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "from math import pi\n",
+ "import math\n",
+ "Q =5000.0/3600/24; #m^3 per second\n",
+ "C_d =0.6;\n",
+ "r =0.01/2; # m\n",
+ "g =9.8; #m/ s ^2\n",
+ "H =0.2; # m\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "a_o = pi *r**2;\n",
+ "n=Q/C_d/ a_o / math.sqrt (2*g*H);\n",
+ "\n",
+ "#result\n",
+ "print\"The number of orifices required are \",round (n)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The number of orifices required are 621.0\n"
+ "text": [
+ "The number of orifices required are 621.0\n"
+ ]
}
],
"prompt_number": 10
@@ -38,19 +64,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 6.2,Page 145"
+ "source": [
+ "Example 6.2,Page 145"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding coeff. of velocity\n\n#variable decleration\nfrom math import pi\nimport math\nx =0.86; # m\ng =9.8; # m/ s\ny =0.96; # m\nH =0.2; # m\n\n#calculation\nv_act =x* math.sqrt (g /2/ y);\nv= math.sqrt (2* g*H);\nCv= v_act /v;\n\n#result\nprint \"The coeff. of velocity for the orifices found to be \",round(Cv,3)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "from math import pi\n",
+ "import math\n",
+ "x =0.86; # m\n",
+ "g =9.8; # m/ s\n",
+ "y =0.96; # m\n",
+ "H =0.2; # m\n",
+ "\n",
+ "#calculation\n",
+ "v_act =x* math.sqrt (g /2/ y);\n",
+ "v= math.sqrt (2* g*H);\n",
+ "Cv= v_act /v;\n",
+ "\n",
+ "#result\n",
+ "print \"The coeff. of velocity for the orifices found to be \",round(Cv,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The coeff. of velocity for the orifices found to be 0.981\n"
+ "text": [
+ "The coeff. of velocity for the orifices found to be 0.981\n"
+ ]
}
],
"prompt_number": 1
@@ -59,19 +107,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 6.3,Page 147"
+ "source": [
+ "Example 6.3,Page 147"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time taken for drainage\n\n#variable declaration\nfrom math import pi\nimport math\nVt =1; # m^3\nd_t =1; # m\nC_d =0.6;\nd_o =0.02; # m\ng =9.8; # m/ s ^2\n\n\n#calculation\na_o = pi *( d_o ) **2/4;\nA= pi *( d_t ) **2/4;\nH1 =4* Vt/ pi /( d_t) **2;\nt=A/C_d/ a_o * math.sqrt (2* H1/g);\n\n#results\nprint\" Total drainage is found to take (s) \",round(t,2)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "from math import pi\n",
+ "import math\n",
+ "Vt =1; # m^3\n",
+ "d_t =1; # m\n",
+ "C_d =0.6;\n",
+ "d_o =0.02; # m\n",
+ "g =9.8; # m/ s ^2\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "a_o = pi *( d_o ) **2/4;\n",
+ "A= pi *( d_t ) **2/4;\n",
+ "H1 =4* Vt/ pi /( d_t) **2;\n",
+ "t=A/C_d/ a_o * math.sqrt (2* H1/g);\n",
+ "\n",
+ "#results\n",
+ "print\" Total drainage is found to take (s) \",round(t,2)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Total drainage is found to take (s) 2124.49586383\n"
+ "text": [
+ " Total drainage is found to take (s) 2124.49586383\n"
+ ]
}
],
"prompt_number": 14
@@ -80,19 +153,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 6.4,Page 149"
+ "source": [
+ "Example 6.4,Page 149"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time taken to drain tank\n\n#variable declaration\nfrom math import pi\nimport math\nC_d =0.6;\nd_o =0.05; #m\ng =9.81; # m/ s ^ 2 ;\nR =2; \nH1 =1.5; \n\n#calculation\na_o = pi *d_o **2/4;\nt= pi /C_d/ a_o*(1.333* R*H1 **(1.5) -0.4* H1 **(2.5))/math.sqrt(2*g);\n\n#results\nprint\"The time to drain the tank is found to be (s)\",round(t,3);",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "from math import pi\n",
+ "import math\n",
+ "C_d =0.6;\n",
+ "d_o =0.05; #m\n",
+ "g =9.81; # m/ s ^ 2 ;\n",
+ "R =2; \n",
+ "H1 =1.5; \n",
+ "\n",
+ "#calculation\n",
+ "a_o = pi *d_o **2/4;\n",
+ "t= pi /C_d/ a_o*(1.333* R*H1 **(1.5) -0.4* H1 **(2.5))/math.sqrt(2*g);\n",
+ "\n",
+ "#results\n",
+ "print\"The time to drain the tank is found to be (s)\",round(t,3);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The time to drain the tank is found to be (s) 2285.001\n"
+ "text": [
+ "The time to drain the tank is found to be (s) 2285.001\n"
+ ]
}
],
"prompt_number": 16
@@ -101,19 +196,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 6.6,Page 153"
+ "source": [
+ "Example 6.6,Page 153"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time taken to drain tank and rate of flow\n\n#variable declaration\nimport math\nCd =0.62;\na =0.01;# m^2\ng =9.81; # m/ s ^2\nH =0.3; #m\nA1 =4*2; # m^2\nH1 =0.300; # m\nH2 =0.100; # m\nA2 =2*2; # m^2\n\n#calculation\nQ=Cd*a* math.sqrt (2* g*H);\nt =2* A1 *( math.sqrt(H1) -math.sqrt(H2) )/( Cd*a* math.sqrt (2*g) *(1+ A1/A2));\n\n#results\nprint \"The rate of flow(m^3/s) =\",round(Q,3)\nprint \"The time taken to reduce the difference in levels to 10 cm is (s) \", round(t,3)\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "import math\n",
+ "Cd =0.62;\n",
+ "a =0.01;# m^2\n",
+ "g =9.81; # m/ s ^2\n",
+ "H =0.3; #m\n",
+ "A1 =4*2; # m^2\n",
+ "H1 =0.300; # m\n",
+ "H2 =0.100; # m\n",
+ "A2 =2*2; # m^2\n",
+ "\n",
+ "#calculation\n",
+ "Q=Cd*a* math.sqrt (2* g*H);\n",
+ "t =2* A1 *( math.sqrt(H1) -math.sqrt(H2) )/( Cd*a* math.sqrt (2*g) *(1+ A1/A2));\n",
+ "\n",
+ "#results\n",
+ "print \"The rate of flow(m^3/s) =\",round(Q,3)\n",
+ "print \"The time taken to reduce the difference in levels to 10 cm is (s) \", round(t,3)\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of flow(m^3/s) = 0.01504\nThe time taken to reduce the difference in levels to 10 cm is (s) 44.957\n"
+ "text": [
+ "The rate of flow(m^3/s) = 0.01504\n",
+ "The time taken to reduce the difference in levels to 10 cm is (s) 44.957\n"
+ ]
}
],
"prompt_number": 4
@@ -122,19 +244,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 6.8,Page 157"
+ "source": [
+ "Example 6.8,Page 157"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time taken to level tank \n\n#variable declaration\nimport math\nQs =0.4; #m^3/ s\nH1 =1.5; # m\nQ =0.2; #m^3/ s\nH2 =0.5; # m\nl =15; # m\nb =10; #m\ne=2.69;\n\n#calculation\nA=l*b;\nk=Qs*H1 **( -0.5) ;\nt=-2*A/k**2*(Q*math.log((Q-k*math.sqrt( H2))/(Q-k*math.sqrt(H1)),e)+k*(math.sqrt(H2)-math.sqrt(H1)));\n#result\nprint \"The time reqd. for the level in the tank to fall to 1 m is(s) \",round(t,3)\n\n",
+ "input": [
+ "\n",
+ "#variable declaration\n",
+ "import math\n",
+ "Qs =0.4; #m^3/ s\n",
+ "H1 =1.5; # m\n",
+ "Q =0.2; #m^3/ s\n",
+ "H2 =0.5; # m\n",
+ "l =15; # m\n",
+ "b =10; #m\n",
+ "e=2.69;\n",
+ "\n",
+ "#calculation\n",
+ "A=l*b;\n",
+ "k=Qs*H1 **( -0.5) ;\n",
+ "t=-2*A/k**2*(Q*math.log((Q-k*math.sqrt( H2))/(Q-k*math.sqrt(H1)),e)+k*(math.sqrt(H2)-math.sqrt(H1)));\n",
+ "#result\n",
+ "print \"The time reqd. for the level in the tank to fall to 1 m is(s) \",round(t,3)\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The time reqd. for the level in the tank to fall to 1 m is(s) 1536.35\n"
+ "text": [
+ "The time reqd. for the level in the tank to fall to 1 m is(s) 1536.35\n"
+ ]
}
],
"prompt_number": 5
@@ -143,19 +288,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 6.9,Page 159"
+ "source": [
+ "Example 6.9,Page 159"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time taken to level tank \n\n#variable declaration\nfrom math import pi\nimport numpy as np\nimport numpy \nimport math\nCd =0.62;\nd =0.05;\na_o = pi *d **2/4;\ng =9.81; #m/ s ^2\n\n#calculation\nk=Cd*a_o* math.sqrt (2*g);\n# We have g o t two s imultaneous equations\n#Q_k \u0003 0 . 6 5 ^ ( 1 / 2 ) =0.1/90\u0003A\n# Q_k \u0003 1 . 2 2 5 ^ ( 1 / 2 ) =0.05/120\u0003A\n\nM=np.array([[1,-0.1/90],[1,-0.05/120]]);\nN=np.array([[k *math.sqrt(0.65)] ,[k *math.sqrt(1.225)]]);\nX=np.linalg.solve(M,N)\nQ=X[0][0];\nA=X[1][0];\nprint \"The Area of the tank(m^2) =\",round(A,3)\nprint \" Flow rate(m^3/s) =\",round(Q,3)\n",
+ "input": [
+ "\n",
+ "#variable declaration\n",
+ "from math import pi\n",
+ "import numpy as np\n",
+ "import numpy \n",
+ "import math\n",
+ "Cd =0.62;\n",
+ "d =0.05;\n",
+ "a_o = pi *d **2/4;\n",
+ "g =9.81; #m/ s ^2\n",
+ "\n",
+ "#calculation\n",
+ "k=Cd*a_o* math.sqrt (2*g);\n",
+ "# We have g o t two s imultaneous equations\n",
+ "#Q_k \u0003 0 . 6 5 ^ ( 1 / 2 ) =0.1/90\u0003A\n",
+ "# Q_k \u0003 1 . 2 2 5 ^ ( 1 / 2 ) =0.05/120\u0003A\n",
+ "\n",
+ "M=np.array([[1,-0.1/90],[1,-0.05/120]]);\n",
+ "N=np.array([[k *math.sqrt(0.65)] ,[k *math.sqrt(1.225)]]);\n",
+ "X=np.linalg.solve(M,N)\n",
+ "Q=X[0][0];\n",
+ "A=X[1][0];\n",
+ "print \"The Area of the tank(m^2) =\",round(A,3)\n",
+ "print \" Flow rate(m^3/s) =\",round(Q,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Area of the tank(m^2) = 2.334\n Flow rate(m^3/s) = 0.007\n"
+ "text": [
+ "The Area of the tank(m^2) = 2.334\n",
+ " Flow rate(m^3/s) = 0.007\n"
+ ]
}
],
"prompt_number": 6
@@ -164,19 +339,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 6.10,Page 161"
+ "source": [
+ "Example 6.10,Page 161"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time taken to level tank \n\n#variable declaration\nfrom math import pi\nfrom numpy import matrix\nfrom numpy import linalg\nimport math\nH1 =1.5; # m\nV =0.75; # m^3\nd1 =1.2; # m\nu =0.08; # Ns/m^2\nL =3; # m\nrho =1100; # kg /m^3\ng =9.81; # m/ s ^2\nd =0.025; # m\ne=2.71;\n\n#calculation\na= pi*d **2/4;\nA= pi*d1 **2/4;\nH2=H1 -(V/A);\nround(H2,2);\nt= -32*u*L*A/(a*rho*g*d **2) *math.log(H2/H1,e);\n\n#result\nprint\"Time taken(s) =\",round(t,3);",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "from numpy import matrix\n",
+ "from numpy import linalg\n",
+ "import math\n",
+ "H1 =1.5; # m\n",
+ "V =0.75; # m^3\n",
+ "d1 =1.2; # m\n",
+ "u =0.08; # Ns/m^2\n",
+ "L =3; # m\n",
+ "rho =1100; # kg /m^3\n",
+ "g =9.81; # m/ s ^2\n",
+ "d =0.025; # m\n",
+ "e=2.71;\n",
+ "\n",
+ "#calculation\n",
+ "a= pi*d **2/4;\n",
+ "A= pi*d1 **2/4;\n",
+ "H2=H1 -(V/A);\n",
+ "round(H2,2);\n",
+ "t= -32*u*L*A/(a*rho*g*d **2) *math.log(H2/H1,e);\n",
+ "\n",
+ "#result\n",
+ "print\"Time taken(s) =\",round(t,3);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Time taken(s) = 1535.7565254\n"
+ "text": [
+ "Time taken(s) = 1535.7565254\n"
+ ]
}
],
"prompt_number": 17
@@ -184,7 +388,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_7_1.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_7_1.ipynb
index 0942f575..eff449e4 100644
--- a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_7_1.ipynb
+++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_7_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 7"
+ "name": "",
+ "signature": "sha256:9d2bc1b337823a33d27dffeb338a599749ddc3b72fed4860934dfca72c26b017"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 7,Open channels notches and Weirs"
+ "source": [
+ "Chapter 7,Open channels notches and Weirs"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 7.2,Page 171"
+ "source": [
+ "Example 7.2,Page 171"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Discharge\n\n#variable decleration\nimport math\nl =1; # m\nb =0.3; # m\nn =0.014; # s /m^ ( 1 / 3 )\ni =1.0/1000;\n\n#calculations\nA=l*b;\nP =2* b+l;\nm=A/P;\nQ=A/n*m **(0.67) * math.sqrt (i);\n\n#results\nprint\"The delivery of water through the channel is found to be (m^3/s)= \",round(Q,3)\n",
+ "input": [
+ "\n",
+ "#variable decleration\n",
+ "import math\n",
+ "l =1; # m\n",
+ "b =0.3; # m\n",
+ "n =0.014; # s /m^ ( 1 / 3 )\n",
+ "i =1.0/1000;\n",
+ "\n",
+ "#calculations\n",
+ "A=l*b;\n",
+ "P =2* b+l;\n",
+ "m=A/P;\n",
+ "Q=A/n*m **(0.67) * math.sqrt (i);\n",
+ "\n",
+ "#results\n",
+ "print\"The delivery of water through the channel is found to be (m^3/s)= \",round(Q,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The delivery of water through the channel is found to be (m^3/s)= 0.221\n"
+ "text": [
+ "The delivery of water through the channel is found to be (m^3/s)= 0.221\n"
+ ]
}
],
"prompt_number": 13
@@ -38,28 +62,81 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 7.3 Page 173"
+ "source": [
+ "Example 7.3 Page 173"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Depth and Chezy's Coeff.\n\n%pylab inline\n#variable decleration\nimport math\nimport numpy as np\nfrom pylab import *\nn =0.015; #m^(-1/3) s\ni =1;\nH =[4.0, 4.1, 4.2, 4.13];\n\n#calculation\nA =12* H[0];\nP =12+2* H[0];\nm=A/P;\nC=m **(0.167) /n;\nQ=C*A* math.sqrt (m*i);\n#An analytical soln for depth H is not possible.It is so necessary to use a graphical soution\n#The corresponding values of A, P, MHD (m) , Q are given below as taken from values of H\n\nA =[48, 49.2, 50.4, 49.56];\nP =[20, 20.2, 20.4, 20.26];\nm =[2.4, 2.44, 2.47, 2.45];\nQ =[57.36, 59.38, 61.39, 59.98];\nfigure()\nplot (H,Q,'g')\nr =[4.13, 4.13];\ns =[57, 60];\nplot (r,s, ' r ' )\nt =[4, 4.13];\nu =[60, 60];\nplot (t,u, ' y ' )\nxlabel('Depth (H)')\nylabel('Flow Rate')\ntitle('Depth vs Flow Rate')\nshow()\n# So, the depth is found to be approx. 4.13\ndepth =4.13; #m\nC1 =(2.45) **(0.167) /n;\n\n#results\nprint\"Depth(m) = \",round(depth,3)\nprint\"Chezy Coeff. =\",round(C1,3)\n",
+ "input": [
+ "\n",
+ "%pylab inline\n",
+ "#variable decleration\n",
+ "import math\n",
+ "import numpy as np\n",
+ "from pylab import *\n",
+ "n =0.015; #m^(-1/3) s\n",
+ "i =1;\n",
+ "H =[4.0, 4.1, 4.2, 4.13];\n",
+ "\n",
+ "#calculation\n",
+ "A =12* H[0];\n",
+ "P =12+2* H[0];\n",
+ "m=A/P;\n",
+ "C=m **(0.167) /n;\n",
+ "Q=C*A* math.sqrt (m*i);\n",
+ "#An analytical soln for depth H is not possible.It is so necessary to use a graphical soution\n",
+ "#The corresponding values of A, P, MHD (m) , Q are given below as taken from values of H\n",
+ "\n",
+ "A =[48, 49.2, 50.4, 49.56];\n",
+ "P =[20, 20.2, 20.4, 20.26];\n",
+ "m =[2.4, 2.44, 2.47, 2.45];\n",
+ "Q =[57.36, 59.38, 61.39, 59.98];\n",
+ "figure()\n",
+ "plot (H,Q,'g')\n",
+ "r =[4.13, 4.13];\n",
+ "s =[57, 60];\n",
+ "plot (r,s, ' r ' )\n",
+ "t =[4, 4.13];\n",
+ "u =[60, 60];\n",
+ "plot (t,u, ' y ' )\n",
+ "xlabel('Depth (H)')\n",
+ "ylabel('Flow Rate')\n",
+ "title('Depth vs Flow Rate')\n",
+ "show()\n",
+ "# So, the depth is found to be approx. 4.13\n",
+ "depth =4.13; #m\n",
+ "C1 =(2.45) **(0.167) /n;\n",
+ "\n",
+ "#results\n",
+ "print\"Depth(m) = \",round(depth,3)\n",
+ "print\"Chezy Coeff. =\",round(C1,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\nWelcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\nFor more information, type 'help(pylab)'.\n"
+ "text": [
+ "\n",
+ "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
+ "For more information, type 'help(pylab)'.\n"
+ ]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEXCAYAAABRWhj0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREF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jZs6fuuUqlYtGiRboz\nnQHMzc11j+3t7UucjxCVTUJD1Hrnzp3DxMSEZs2aAUU7qP39/R+YRqPRPPDLX1GUUi9DXa9ePd1j\nExMTbt26VeJ0Dw9HPWp4SlEUuVquqBJkeErUahkZGbz22mtMmTIFgP79+/P555+Tn58PwOnTp8nN\nzQWKbliTlJREYWEh69at0/UUzMzMdNOXV8uWLUlLSyv39JcuXaJly5aPtQwhDEFCQ9Q693Zct2/f\nHn9/fwYMGMA//vEPAAIDA/Hw8KBz5854eXkxefJkXSD4+voSEhKCh4cHrVu3JiAgAICJEyfSoUMH\n3Y7w0o6Cul/Pnj05fPjwI6e7/7lWq6VXr14V//BCVJBcsFCIctBoNHz88cf89NNPepmfoih07tyZ\nQ4cOUbdu3TKnHzt2LDNmzMDb21svyxfiSUlPQ4hyKKkHUdH5BQUF8e2335Y57eXLl8nMzJTAEFWC\n9DSEEEKUm/Q0hBBClJuEhhBCiHKT0BBCCFFuEhpCCCHKTUJDCCFEuUloCCGEKLf/B4ccDtv7g/WY\nAAAAAElFTkSuQmCC\n"
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Depth(m) = 4.13\nChezy Coeff. = 77.428\n"
+ "text": [
+ "Depth(m) = 4.13\n",
+ "Chezy Coeff. = 77.428\n"
+ ]
}
],
"prompt_number": 15
@@ -68,19 +145,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 7.4,Page 175"
+ "source": [
+ "Example 7.4,Page 175"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding flow area\n\n#variable decleration\nimport math\nQ =300.0/60; # m^3/ s\ni =1.0/1600;\n\n#calculation\nH=(Q /140* math.sqrt (2/ i)) **(0.67) ;\nA =2* H**2;\n\n#result\nprint \"The minimum flow area is found to be(m^2)= \",round(A,3)\n",
+ "input": [
+ "\n",
+ "#variable decleration\n",
+ "import math\n",
+ "Q =300.0/60; # m^3/ s\n",
+ "i =1.0/1600;\n",
+ "\n",
+ "#calculation\n",
+ "H=(Q /140* math.sqrt (2/ i)) **(0.67) ;\n",
+ "A =2* H**2;\n",
+ "\n",
+ "#result\n",
+ "print \"The minimum flow area is found to be(m^2)= \",round(A,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The minimum flow area is found to be(m^2)= 5.132\n"
+ "text": [
+ "The minimum flow area is found to be(m^2)= 5.132\n"
+ ]
}
],
"prompt_number": 16
@@ -89,28 +183,83 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 7.5,Page 177"
+ "source": [
+ "Example 7.5,Page 177"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Depth and Chezy's Coeff.\n\n%pylab inline\n#variable decleration\nfrom math import pi\nimport math\nimport numpy as np\nfrom pylab import *\nd =0.9144; # m\nC =100; # m^ ( 1 / 2 ) s ^(-1)\nR=d/2;\nH =[0.1, 0.15, 0.2, 0.25, 0.201];\n\n\n#calculations\ntheta = math.acos ((R-H[0])/R);\nA=R **2*( theta -math.sin (2* theta )/2);\nP =2* R* theta ;\nm=A/P;\n#An analytical soln for depth H is not possible.It is so necessary to use a graphical soution\n#The corresponding values of A, P, MHD (m) , Q are given below as taken from values of H\n\n\ntheta =[0.674, 0.834, 0.973, 1.101, 0.975];\nA =[0.039, 0.070, 0.106, 0.146, 0.107];\nP =[0.616, 0.763, 0.890, 1.006, 0.891];\nm =[0.063, 0.092, 0.119,0.145,0.120];\nQ =[248.7, 543.2, 932.2 ,1412.9, 940.0];\nfigure()\nplot (H,Q,)\nxlabel('Depth H')\nylabel('Flow Rate')\ntitle('Depth Vs Flow Rate');\ni =[0.201, 0.201];\nj =[0 ,940];\nplot (i,j)\nk =[0, 0.201];\nl =[940, 940];\nplot (k,l)\nshow()\n# So, the depth is found to be approx. 0.201\nDepth =0.201; # m\n\n#result\nprint\"The depth in the channel(m) =\",round(Depth,3)\n",
+ "input": [
+ "\n",
+ "\n",
+ "%pylab inline\n",
+ "#variable decleration\n",
+ "from math import pi\n",
+ "import math\n",
+ "import numpy as np\n",
+ "from pylab import *\n",
+ "d =0.9144; # m\n",
+ "C =100; # m^ ( 1 / 2 ) s ^(-1)\n",
+ "R=d/2;\n",
+ "H =[0.1, 0.15, 0.2, 0.25, 0.201];\n",
+ "\n",
+ "\n",
+ "#calculations\n",
+ "theta = math.acos ((R-H[0])/R);\n",
+ "A=R **2*( theta -math.sin (2* theta )/2);\n",
+ "P =2* R* theta ;\n",
+ "m=A/P;\n",
+ "#An analytical soln for depth H is not possible.It is so necessary to use a graphical soution\n",
+ "#The corresponding values of A, P, MHD (m) , Q are given below as taken from values of H\n",
+ "\n",
+ "\n",
+ "theta =[0.674, 0.834, 0.973, 1.101, 0.975];\n",
+ "A =[0.039, 0.070, 0.106, 0.146, 0.107];\n",
+ "P =[0.616, 0.763, 0.890, 1.006, 0.891];\n",
+ "m =[0.063, 0.092, 0.119,0.145,0.120];\n",
+ "Q =[248.7, 543.2, 932.2 ,1412.9, 940.0];\n",
+ "figure()\n",
+ "plot (H,Q,)\n",
+ "xlabel('Depth H')\n",
+ "ylabel('Flow Rate')\n",
+ "title('Depth Vs Flow Rate');\n",
+ "i =[0.201, 0.201];\n",
+ "j =[0 ,940];\n",
+ "plot (i,j)\n",
+ "k =[0, 0.201];\n",
+ "l =[940, 940];\n",
+ "plot (k,l)\n",
+ "show()\n",
+ "# So, the depth is found to be approx. 0.201\n",
+ "Depth =0.201; # m\n",
+ "\n",
+ "#result\n",
+ "print\"The depth in the channel(m) =\",round(Depth,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\nWelcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\nFor more information, type 'help(pylab)'.\n"
+ "text": [
+ "\n",
+ "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
+ "For more information, type 'help(pylab)'.\n"
+ ]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAEXCAYAAACDChKsAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtcVHX+x/HXKFhWopgKOYONCS6OopmJVlrTBStbybRY\nqZS85GN13bTLbla7P7Ub2K7VVrJdVo3cLTF/JW4Za1ZYaaKWRYr7gwyUm3hBAq8knN8fE6OoCAzD\nzADv5+Phw8OZc/nMcZw33+8533NMhmEYiIiINFAbbxcgIiLNkwJERERcogARERGXKEBERMQlChAR\nEXGJAkRERFyiAJFWw2q18sknn3i7DKfc3FzatGlDVVWVt0sRcYkCRLzCarVywQUXEBAQQGBgINdc\ncw2vvfYa7hqWdN999/HnP/+5xjyTyYTJZKpz3Y0bN3LRRRdx+PDhM14bOHAgiYmJDaql+r126NCB\nDh06EBAQwJ49exq0DVfZ7Xbat29Phw4d6NKlC7fffjv5+fn1WjctLY2QkJAmrlCaMwWIeIXJZOKD\nDz6grKyM3bt3M3v2bObPn8/kyZO9XRpDhw7FYrGwYsWKGvO3bdvGjh07iI2NbdD2qt9reXk55eXl\nlJWVERwc7M6Sz7nvhQsXUl5ezs6dOzl27BgPPfSQR/YtLZ8CRLyuQ4cOjBo1iuTkZJKSkti+fTsA\nx48f55FHHuHSSy8lODiYadOmcezYMcDx27HFYiE+Pp6uXbvSs2dP3n77bQBef/113n77bZ577jk6\ndOjA7bff7tzX1q1bGTBgAJ06dWLcuHEcP378rDXFxcXx1ltv1Zj31ltvcdtttxEYGMixY8e49957\n6dKlC4GBgURGRrJ3795GHYfCwkKio6O5+OKLCQsL4x//+AcAx44do3379pSUlADwzDPP4O/vz6FD\nhwD485//zIMPPljn9jt27Mjtt9/uPL4AS5YswWazERAQQK9evXj99dcBOHz4MLfeeiuFhYU1Wk2G\nYZCQkEBoaChdunThN7/5DQcPHmzU+5bmSwEiPmPw4MFYLBa+/PJLAGbPns0PP/zAd999xw8//EBB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5165ddO/eHag9QE5V1zJ33HEH+fn5fPbZZ7z//vvO7isAPz8/\n/ud//oft27ezYcMGPvjggzPOmTREdcvr1EDbvXs3FosFgKuuuor/+7//4/3338dut9OnTx92797N\n6tWrz9l9BSdbEv369eOpp55i9uzZGIbB8ePHGTt2LH/84x/Zu3cvBw8eZOTIkc7lz3Z8evToQWpq\nqvPfpPrf4JJLLnH5vUvzpQARr6n+oiorK+ODDz4gNjaW8ePH07dvX9q0acP999/PrFmz2LdvHwAF\nBQWsWbOmxjbmzJnDzz//zBdffMGHH37IXXfdBTj69n/88cd67b82F154IXfeeScTJ07EarVyxRVX\nOF9LS0vj+++/p7Kykg4dOuDv7+9snbgiJCSEq6++mscee4zjx4+TkZHB4sWLuffeewG44IILGDRo\nEAsXLuS6664D4Oqrr+bVV191/lwfcXFxHDlyhOXLl1NRUUFFRQVdunShTZs2fPTRRzWOb1BQEAcO\nHKgR2r/97W95/PHH2b17NwD79u1j1apVLr9vad4UIOI1o0aNIiAggB49ehAfH8/DDz/MkiVLnK/P\nnz+f0NBQhg4dSseOHYmKiiIrK8v5evW5jO7duzN+/Hhee+01evfuDcDkyZPJzMys9ZwD1G9cSFxc\nHLt372bChAk15u/Zs4e77rqLjh07YrPZsNvtjB8/vsHH4NT9v/POO+Tm5tK9e3fGjBnDk08+yQ03\n3OB8/brrruPEiRNERkY6fz506FCt5z/Otg9/f39mzpzpvELtpZdeIiYmhs6dO/POO+/UuGItPDyc\n2NhYLrvsMjp37syePXuYOXMm0dHRjBgxgoCAAK666io2bdrU4PctLYNJD5SS5igtLY3x48eTl5fn\n7VJEWi23t0AmTZpEUFAQERERNea//PLL9OnTh379+vHoo48658fHxxMWFkZ4eHiN5vPXX39NREQE\nYWFhzJw5091liohII7k9QCZOnEhqamqNeZ999hmrVq0iIyODbdu28cgjjwCQmZlJcnIymZmZpKam\nMn36dGe/9LRp01i0aBHZ2dlkZ2efsU2R+pwoF5Gm4/YAGT58+BmXFP7973/nsccew9/fH4CuXbsC\nkJKSQmxsLP7+/litVkJDQ0lPT6eoqIjy8nJnX++ECRNYuXKlu0uVZsxutztP5IqId3jkJHp2djaf\nf/45Q4cOxW63s2XLFsBx7Xv1ZYoAFouFgoKCM+abzWbn9fAiIuIb/DyxkxMnTnDw4EE2btzI5s2b\niYmJqfMSy/pSN4aIiGsaew2VR1ogFovFeSnl4MGDadOmDfv378dsNte4iiY/Px+LxYLZbK5xy+n8\n/HzMZnOt26++bUVr/zNnzhyv1+Arf3QsdCx0LM79xx08EiCjR4/m008/BSArK8s5eCk6Opply5ZR\nUVFBTk4O2dnZREZGEhwcTEBAAOnp6RiGwdKlSxk9erQnShURkXpyexdWbGws69at48CBA4SEhPDk\nk08yadIkJk2aREREBO3atXPe8sFmsxETE+O8n05iYqKzSyoxMZH77ruPo0ePMnLkSG655RZ3lyoi\nIo3Q7AcSmkwmtzXHmru0tLQ674vUWuhYnKRjcZKOxUnu+O5UgIiItELu+O7UvbBERMQlChAREXGJ\nAkRERFyiABEREZcoQERExCUKEBERcYkCREREXKIAERERlyhARETEJQoQERFxiQJERERcogARERGX\nKEBERMQlChAREXGJAkRERFyiABEREZcoQERExCUKEBERcYnbA2TSpEkEBQURERFxxmsLFiygTZs2\nlJSUOOfFx8cTFhZGeHg4a9ascc7/+uuviYiIICwsjJkzZ7q7TBERaSS3B8jEiRNJTU09Y35eXh4f\nf/wxl156qXNeZmYmycnJZGZmkpqayvTp053P6J02bRqLFi0iOzub7Ozss25TREQaJisLTCb3bMvt\nATJ8+HACAwPPmP/QQw/x3HPP1ZiXkpJCbGws/v7+WK1WQkNDSU9Pp6ioiPLyciIjIwGYMGECK1eu\ndHepIiKtSnY2/OpX7tueR86BpKSkYLFY6N+/f435hYWFWCwW588Wi4WCgoIz5pvNZgoKCjxRqohI\ni5SdDb17O6arqtyzTT/3bKZ2R44c4dlnn+Xjjz92zqvupnKXuXPnOqftdjt2u92t2xcRac4c4ZEG\npDFnDsyb557tNnmA7Ny5k9zcXAYMGABAfn4+gw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9BMxmMwUFBbVuc+7cuc5pu92O3W53e90iIu60dy8E\nBTmmjx9v+vBIS0sjLS3Nrdv0aIA888wztGvXjrvvvtut2z01QEREfN3p4dGuXdPv8/RfrufNm9fo\nbXosQN58801Wr17NJ5984pxnNpvJy8tz/pyfn4/FYsFsNju7uarnm6uHZIqINGP79nk+PJqKRy7j\nTU1N5S9/+QspKSmcf/75zvnR0dEsW7aMiooKcnJyyM7OJjIykuDgYAICAkhPT8cwDJYuXcro0aM9\nUaqISJPZtw+6dXNMHzvWvMMDmqAFEhsby7p169i/fz8hISHMmzeP+Ph4KioqiIqKAuCqq64iMTER\nm81GTEwMNpsNPz8/EhMTMZlMACQmJnLfffdx9OhRRo4cyS233OLuUkVEPGb//prhcd553q3HHUxG\n9XWzzZTJZKKZvwURaeH274euXR3TvhIe7vju1Eh0EZEmdODAyfA4etQ3wsNdFCAiIk3kwAHo0sUx\nffQonHIKuEVQgIiINIGWHh6gABERcbuSkpPhceRIywwPUICIiLhVSQlcfLFj+sgRaN/eu/U0JQWI\niIibHDzYesIDFCAiIm5x8CB07uyYPny45YcHKEBERBrt9PC44ALv1uMpChARkUZoreEBChAREZeV\nlp4Mj0OHWld4gAJERMQlpaVQ/ey8Q4fgwgu9W483KEBERBro1PAoL2+d4QEKEBGRBvnpp5rhcdFF\n3q3HmxQgIiL19NNP0KmTY7qsrHWHByhARETq5fTw6NDBu/X4AgWIiEgdysoUHmejABEROYeyMujY\n0TH9008Kj1MpQEREanF6eAQEeLceX6MAERE5i1PDo7RU4XE2bg+QSZMmERQUREREhHNeSUkJUVFR\n9O7dmxEjRlBaWup8LT4+nrCwMMLDw1mzZo1z/tdff01ERARhYWHMnDnT3WWKiNSqvLxmeFRPS01u\nD5CJEyeSmppaY15CQgJRUVFkZWVx4403kpCQAEBmZibJyclkZmaSmprK9OnTnQ95nzZtGosWLSI7\nO5vs7Owztiki0hTKy0+2Ng4eVHici9sDZPjw4QRWj7L5xapVq4iLiwMgLi6OlStXApCSkkJsb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kcrKHHfM\nveUWuP9++OILhYeIuylApMVZscIxpqO83PFY2cmToY0+6SJupy4saXGys2HZMsdTAkWk6ShApMV5\n7DFvVyDSOqhhLyIiLlGAiIiISzwWIHl5eVx//fX07duXfv368dJLLwFQUlJCVFQUvXv3ZsSIEZSW\nljrXiY+PJywsjPDwcNasWeOpUkVEpB48FiD+/v688MILbN++nY0bN7Jw4UJ27NhBQkICUVFRZGVl\nceONN5KQkABAZmYmycnJZGZmkpqayvTp06mqqvJUuSIiUgePBUhwcDCXX345ABdddBF9+vShoKCA\nVatWERcXB0BcXBwrV64EICUlhdjYWPz9/bFarYSGhrJp0yZPlSsiInXwylVYubm5bN26lSFDhlBc\nXExQUBAAQUFBFBcXA1BYWMjQoUOd61gsFgoKCs66vblz5zqn7XY7dru9yWoXEWmO0tLSSEtLc+s2\nPR4ghw4dYuzYsfztb3+jQ4cONV4zmUyYznGDotpeOzVARETkTKf/cj1v3rxGb9OjV2H9/PPPjB07\nlvHjxzN69GjA0erYs2cPAEVFRXTr1g0As9lMXl6ec938/HzMZrMnyxURkXPwWIAYhsHkyZOx2WzM\nmjXLOT86OpqkpCQAkpKSnMESHR3NsmXLqKioICcnh+zsbCIjIz1VroiI1MFjXVjr16/nn//8J/37\n92fgwIGA4zLd2bNnExMTw6JFi7BarSxfvhwAm81GTEwMNpsNPz8/EhMTz9m9JSIinmUyDMPwdhGN\nYTKZaOZvQUQ8yDTPhDFH3xnu+O7USHQREXGJAkRERFyiABEREZcoQERExCUKEBERcYkCREREXKIA\nERERlyhARETEJQoQERFxiQJERERcogARERGXKEBERMQlChAREXGJAkRERFyiABEREZcoQERExCUK\nEBERcYkCREREXOLzAZKamkp4eDhhYWHMnz/f2+X4tLS0NG+X4DN0LE7SsThJx8K9fDpAKisrmTFj\nBqmpqWRmZvLOO++wY8cOb5fls/Sf4yQdi5N0LE7SsXAvnw6QTZs2ERoaitVqxd/fn3HjxpGSkuLt\nskREBB8PkIKCAkJCQpw/WywWCgoKvFiRiIh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iIuEQtEBERcYkCREREXKIAERERlyhARETEJQoQERFxiQJERERc8v+luW+FdxpL\nDQAAAABJRU5ErkJggg==\n"
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The depth in the channel(m) = 0.201\n"
+ "text": [
+ "The depth in the channel(m) = 0.201\n"
+ ]
}
],
"prompt_number": 9
@@ -119,19 +268,38 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 7.7,Page 180"
+ "source": [
+ "Example 7.7,Page 180"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding flow area\n\n#variable decleration\nimport math\nCd =0.56;\nB =1.2; # m\ng =9.8; # m/ s ^2\nH =0.018; # m\n\n\n#calcualtion\nQ =2.0/3* Cd*B* math.sqrt (2*g)*H **(1.5) ;\n\n#results\nprint \"The rate of flow of liquid over the weir is (m^3/s)=\",round(Q,4)\n",
+ "input": [
+ "\n",
+ "#variable decleration\n",
+ "import math\n",
+ "Cd =0.56;\n",
+ "B =1.2; # m\n",
+ "g =9.8; # m/ s ^2\n",
+ "H =0.018; # m\n",
+ "\n",
+ "\n",
+ "#calcualtion\n",
+ "Q =2.0/3* Cd*B* math.sqrt (2*g)*H **(1.5) ;\n",
+ "\n",
+ "#results\n",
+ "print \"The rate of flow of liquid over the weir is (m^3/s)=\",round(Q,4)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of flow of liquid over the weir is (m^3/s)= 0.0048\n"
+ "text": [
+ "The rate of flow of liquid over the weir is (m^3/s)= 0.0048\n"
+ ]
}
],
"prompt_number": 10
@@ -140,19 +308,39 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 7.8,Page 182"
+ "source": [
+ "Example 7.8,Page 182"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding height of weir\n\n#variable decleration\nfrom math import pi\nimport math\nH2 =5.5;\nQ1 =217.0;\nQ2 =34.0;\nH1 =8.5;\n\n#calculation\nH0 =( H2 *( Q1/Q2) **(0.67) -H1)/(( Q1/Q2) **(0.67) -1);\n\n#result\nprint\"The height of the weir crest above the surface of the river is found to be(m)\",round(H0,2)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "from math import pi\n",
+ "import math\n",
+ "H2 =5.5;\n",
+ "Q1 =217.0;\n",
+ "Q2 =34.0;\n",
+ "H1 =8.5;\n",
+ "\n",
+ "#calculation\n",
+ "H0 =( H2 *( Q1/Q2) **(0.67) -H1)/(( Q1/Q2) **(0.67) -1);\n",
+ "\n",
+ "#result\n",
+ "print\"The height of the weir crest above the surface of the river is found to be(m)\",round(H0,2)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The height of the weir crest above the surface of the river is found to be(m) 4.28\n"
+ "text": [
+ "The height of the weir crest above the surface of the river is found to be(m) 4.28\n"
+ ]
}
],
"prompt_number": 5
@@ -161,19 +349,45 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 7.9,Page 184"
+ "source": [
+ "Example 7.9,Page 184"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time taken\n\n#variable decleration\nfrom math import pi\nfrom scipy import integrate\nimport math\nH =0.07; # a v e r a g e head\nrate = -0.02/600; # (dH/ dt )\nH1 =0.08; # m\nH2 =0.01; # m\n\n\n#calculation\nk=- rate /H **(1.5) ;\ndef integrand(H,k):\n return -1/k*H**(-1.5);\n\nt=integrate.quad(integrand,H1,H2,args=(k))\n\n#result\nprint \"Time taken (s) =\",round(t[0],2);\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "from math import pi\n",
+ "from scipy import integrate\n",
+ "import math\n",
+ "H =0.07; # a v e r a g e head\n",
+ "rate = -0.02/600; # (dH/ dt )\n",
+ "H1 =0.08; # m\n",
+ "H2 =0.01; # m\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "k=- rate /H **(1.5) ;\n",
+ "def integrand(H,k):\n",
+ " return -1/k*H**(-1.5);\n",
+ "\n",
+ "t=integrate.quad(integrand,H1,H2,args=(k))\n",
+ "\n",
+ "#result\n",
+ "print \"Time taken (s) =\",round(t[0],2);\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Time taken (s) = 7183415.25\n"
+ "text": [
+ "Time taken (s) = 7183415.25\n"
+ ]
}
],
"prompt_number": 18
@@ -182,19 +396,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 7.10,Page 186"
+ "source": [
+ "Example 7.10,Page 186"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding flow area\n\n#variable decleration\nimport math\nCd =0.62;\ng =9.81; # m/ s ^2\nH =0.03; # m\n\n#calculations\nQ =8.0/15* Cd* math.sqrt (2*g)*H **(2.5) ;\n\n#results\nprint\"Rate of flow (m^3/s) =\",round(Q,6)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "import math\n",
+ "Cd =0.62;\n",
+ "g =9.81; # m/ s ^2\n",
+ "H =0.03; # m\n",
+ "\n",
+ "#calculations\n",
+ "Q =8.0/15* Cd* math.sqrt (2*g)*H **(2.5) ;\n",
+ "\n",
+ "#results\n",
+ "print\"Rate of flow (m^3/s) =\",round(Q,6)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Rate of flow (m^3/s) = 0.000228\n"
+ "text": [
+ "Rate of flow (m^3/s) = 0.000228\n"
+ ]
}
],
"prompt_number": 3
@@ -203,19 +435,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 7.11,Page 188"
+ "source": [
+ "Example 7.11,Page 188"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time taken\nfrom scipy import integrate\n#variable decleration\nimport math\nl =4; # m\nb =2; # m\nH1 =0.15; # m\nH2 =0.05; # m\nA=8;\n\n#calculation\nk=3*1.5/A;\ndef integrand (H,A):\n return -A/1.5*H**(-2.5)\n \nt=integrate.quad(integrand,H1,H2,args=(A))\n\n#results\nprint \"Time taken to reduce the head in the the tank (s)=\",round(t[0])\n",
+ "input": [
+ "\n",
+ "from scipy import integrate\n",
+ "#variable decleration\n",
+ "import math\n",
+ "l =4; # m\n",
+ "b =2; # m\n",
+ "H1 =0.15; # m\n",
+ "H2 =0.05; # m\n",
+ "A=8;\n",
+ "\n",
+ "#calculation\n",
+ "k=3*1.5/A;\n",
+ "def integrand (H,A):\n",
+ " return -A/1.5*H**(-2.5)\n",
+ " \n",
+ "t=integrate.quad(integrand,H1,H2,args=(A))\n",
+ "\n",
+ "#results\n",
+ "print \"Time taken to reduce the head in the the tank (s)=\",round(t[0])\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Time taken to reduce the head in the the tank (s)= 257.0\n"
+ "text": [
+ "Time taken to reduce the head in the the tank (s)= 257.0\n"
+ ]
}
],
"prompt_number": 17
@@ -223,7 +479,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_8_1.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_8_1.ipynb
index 4c96cf24..3d67d746 100644
--- a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_8_1.ipynb
+++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_8_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 8"
+ "name": "",
+ "signature": "sha256:b23dbd5a6884d4ea13e28c9cb79f4fe4cdf3c73f39b3e9719031299037425f06"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,56 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 8,Pipe Friction and Turbulent Flow"
+ "source": [
+ "Chapter 8,Pipe Friction and Turbulent Flow"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.4,Page 199"
+ "source": [
+ "Example 8.4,Page 199"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Internal diameter and reynold's number\n\n#variable declaration\nfrom math import pi\nimport math\nrho =867.0; #kg /m^3\nQ =12.0/3600; #m^3/ s\nu =7.5*10**( -4) ; # Ns/m^2\nL =200.0; # m\nH =10.0; # m\ng =9.81; # m/ s ^2\ne=2.718;\n\n#calculation\nd=(H*2*g /(4*0.079*(4* rho *Q/pi/u)**( -0.25) *L *(4* Q/pi)**2) )**( -0.2105);\nd=round(d,4);\nRe =4* rho *Q/ pi /d/u;\n\n#result\nprint\" Internal diameter of the pipe line (m)=\",round(d,5)\nprint\"Re =\",round(Re,2)\nprint(\"The value o f Reynolds number l i e s between 4000 and 10^5 , confirming the validity of using the Blasius equationfor smooth walled pipes\")",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "from math import pi\n",
+ "import math\n",
+ "rho =867.0; #kg /m^3\n",
+ "Q =12.0/3600; #m^3/ s\n",
+ "u =7.5*10**( -4) ; # Ns/m^2\n",
+ "L =200.0; # m\n",
+ "H =10.0; # m\n",
+ "g =9.81; # m/ s ^2\n",
+ "e=2.718;\n",
+ "\n",
+ "#calculation\n",
+ "d=(H*2*g /(4*0.079*(4* rho *Q/pi/u)**( -0.25) *L *(4* Q/pi)**2) )**( -0.2105);\n",
+ "d=round(d,4);\n",
+ "Re =4* rho *Q/ pi /d/u;\n",
+ "\n",
+ "#result\n",
+ "print\" Internal diameter of the pipe line (m)=\",round(d,5)\n",
+ "print\"Re =\",round(Re,2)\n",
+ "print(\"The value o f Reynolds number l i e s between 4000 and 10^5 , confirming the validity of using the Blasius equationfor smooth walled pipes\")"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Internal diameter of the pipe line (m)= 0.0505\nRe = 97152.8\nThe value o f Reynolds number l i e s between 4000 and 10^5 , confirming the validity of using the Blasius equationfor smooth walled pipes\n"
+ "text": [
+ " Internal diameter of the pipe line (m)= 0.0505\n",
+ "Re = 97152.8\n",
+ "The value o f Reynolds number l i e s between 4000 and 10^5 , confirming the validity of using the Blasius equationfor smooth walled pipes\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +70,46 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.5,Page 202"
+ "source": [
+ "Example 8.5,Page 202"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding minimum allowable height\n\n#variable declaration\nfrom math import pi\nimport math\nm =40.0/60; # kg / s\nrho =873; #kg /m^3\nd =0.025; #m\nu =8.8*10** -4; # Ns/m^2\ndp =55.0*10**3; #N/m^2\nL =18; #m\ng =9.81; # m/ s ^2\n\n#calculation\nv2 =4*m/ rho / pi /d **2;\nRe=rho*v2*d/u;\n#using MOODY's Chart\nf =0.0055;\nH=dp/rho/g + v2 **2/2/ g + v2 **2/2/ g *(4* f*L/d +1.5) ;\n\n#result\nprint \"The minimum allowable height (m) =\",round(H,3)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "from math import pi\n",
+ "import math\n",
+ "m =40.0/60; # kg / s\n",
+ "rho =873; #kg /m^3\n",
+ "d =0.025; #m\n",
+ "u =8.8*10** -4; # Ns/m^2\n",
+ "dp =55.0*10**3; #N/m^2\n",
+ "L =18; #m\n",
+ "g =9.81; # m/ s ^2\n",
+ "\n",
+ "#calculation\n",
+ "v2 =4*m/ rho / pi /d **2;\n",
+ "Re=rho*v2*d/u;\n",
+ "#using MOODY's Chart\n",
+ "f =0.0055;\n",
+ "H=dp/rho/g + v2 **2/2/ g + v2 **2/2/ g *(4* f*L/d +1.5) ;\n",
+ "\n",
+ "#result\n",
+ "print \"The minimum allowable height (m) =\",round(H,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The minimum allowable height (m) = 8.684\n"
+ "text": [
+ "The minimum allowable height (m) = 8.684\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +118,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.6,Page 204"
+ "source": [
+ "Example 8.6,Page 204"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding minimum allowable height\n\n#variable declaration\nfrom math import pi\nimport math\nQ =15.0/3600; # m^3/ s\nd =0.05; #m\nRho =780.0;\nu =1.7*10**( -3) ; #Ns/m^2\nf =0.0065;\nL =100; #m\ng =9.8; #m^2/ s\n\n#calculation\nv =4* Q/ pi /d **2;\ndel_pf =2*f* Rho *v**2*L/d;\nH_f =4* f*L*v **2/( d*2*g);\nH_exit =v **2/2/ g;\nH_entrance =v **2/4/ g;\nH= H_f+ H_exit + H_entrance ;\n\n#result\nprint \"The pressure drop due to friction is (kN/m^2)\",round(del_pf,2)\nprint \" and the difference in levels is (m)\",round(H,3)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "from math import pi\n",
+ "import math\n",
+ "Q =15.0/3600; # m^3/ s\n",
+ "d =0.05; #m\n",
+ "Rho =780.0;\n",
+ "u =1.7*10**( -3) ; #Ns/m^2\n",
+ "f =0.0065;\n",
+ "L =100; #m\n",
+ "g =9.8; #m^2/ s\n",
+ "\n",
+ "#calculation\n",
+ "v =4* Q/ pi /d **2;\n",
+ "del_pf =2*f* Rho *v**2*L/d;\n",
+ "H_f =4* f*L*v **2/( d*2*g);\n",
+ "H_exit =v **2/2/ g;\n",
+ "H_entrance =v **2/4/ g;\n",
+ "H= H_f+ H_exit + H_entrance ;\n",
+ "\n",
+ "#result\n",
+ "print \"The pressure drop due to friction is (kN/m^2)\",round(del_pf,2)\n",
+ "print \" and the difference in levels is (m)\",round(H,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The pressure drop due to friction is (kN/m^2) 91324.16\n and the difference in levels is (m) 12.292\n"
+ "text": [
+ "The pressure drop due to friction is (kN/m^2) 91324.16\n",
+ " and the difference in levels is (m) 12.292\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +169,49 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.7,Page 206"
+ "source": [
+ "Example 8.7,Page 206"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding rate of flow\n\n#variable declaration\nimport math\nf =0.005;\nL =10; # m\nd =0.025; # m\ng =9.81; # m/ s ^2\n\n#Calculations\n# H L=4\u0003 f \u0003L/d\u0003v ^2/2/ g+0.5\u0003 v ^2/2/ g\n# H L=8.5\u0003 v ^2/2/ g\n# By Be r n o u l l i e q u a t i o n we g e t\n#H=2.62+9.5\u0003 v2 ^2/2/ g\n# Applying the Be r n o u l l i e q u a t i o n between the liquid surface and discharge point\n# H L=33.5\u0003 v2 ^2/2/ g\n#Solving above two we g e t\nH =2.62+9.5* v2 **2/2/ g;\nv2 =1.9; # m/ s\nQ= pi*d **2/4* v2;\n\n#result\nprint\"Rate of flow (m^3/s)=\",round(Q,5)\nprint\"The minimum allowable height(m) =\",round(H,3)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "import math\n",
+ "f =0.005;\n",
+ "L =10; # m\n",
+ "d =0.025; # m\n",
+ "g =9.81; # m/ s ^2\n",
+ "\n",
+ "#Calculations\n",
+ "# H L=4\u0003 f \u0003L/d\u0003v ^2/2/ g+0.5\u0003 v ^2/2/ g\n",
+ "# H L=8.5\u0003 v ^2/2/ g\n",
+ "# By Be r n o u l l i e q u a t i o n we g e t\n",
+ "#H=2.62+9.5\u0003 v2 ^2/2/ g\n",
+ "# Applying the Be r n o u l l i e q u a t i o n between the liquid surface and discharge point\n",
+ "# H L=33.5\u0003 v2 ^2/2/ g\n",
+ "#Solving above two we g e t\n",
+ "H =2.62+9.5* v2 **2/2/ g;\n",
+ "v2 =1.9; # m/ s\n",
+ "Q= pi*d **2/4* v2;\n",
+ "\n",
+ "#result\n",
+ "print\"Rate of flow (m^3/s)=\",round(Q,5)\n",
+ "print\"The minimum allowable height(m) =\",round(H,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Rate of flow (m^3/s)= 0.0009321875\nThe minimum allowable height(m) = 4.36796126402\n"
+ "text": [
+ "Rate of flow (m^3/s)= 0.0009321875\n",
+ "The minimum allowable height(m) = 4.36796126402\n"
+ ]
}
],
"prompt_number": 16
@@ -101,19 +220,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.8,Page 208"
+ "source": [
+ "Example 8.8,Page 208"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding rate of flow\n\n#variable declaration\nimport math\nd_A =0.025; # m\nv_A =1.21; # m/ s\nd_B =0.05; # m\nv_B =1.71; # m/ s\n\n#calculation\nQ_A = pi *d_A **2* v_A /4;\nQ_B = pi *d_B **2* v_B /4;\n\n#result\nprint \"The rate of flow through parallel pipes A is \",round(Q_A,5)\nprint\"The rate of flow through parallel pipes B is (m^3/s)=\",round(Q_B,5);\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "import math\n",
+ "d_A =0.025; # m\n",
+ "v_A =1.21; # m/ s\n",
+ "d_B =0.05; # m\n",
+ "v_B =1.71; # m/ s\n",
+ "\n",
+ "#calculation\n",
+ "Q_A = pi *d_A **2* v_A /4;\n",
+ "Q_B = pi *d_B **2* v_B /4;\n",
+ "\n",
+ "#result\n",
+ "print \"The rate of flow through parallel pipes A is \",round(Q_A,5)\n",
+ "print\"The rate of flow through parallel pipes B is (m^3/s)=\",round(Q_B,5);\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of flow through parallel pipes A is 0.00059\nThe rate of flow through parallel pipes B is (m^3/s)= 0.00336\n"
+ "text": [
+ "The rate of flow through parallel pipes A is 0.00059\n",
+ "The rate of flow through parallel pipes B is (m^3/s)= 0.00336\n"
+ ]
}
],
"prompt_number": 4
@@ -122,19 +264,47 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.9,Page 210"
+ "source": [
+ "Example 8.9,Page 210"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding rate of flow\n\n#variable declaration\nfrom math import pi\nimport math\nd2 =0.06; # m\nd1 =0.12; # m\nk =0.44;\nf =0.05;\nL1 =500; # m\ng =9.81; # m/ s ^2\n\n#Calcualtion\n# v1=d2 ^2/ d1 ^2\u0003 v2\n# H f=4\u0003 f \u0003L1 /16/ d\u0003 v2 ^2/2/ g\n# H c=k\u0003 v2 ^2/2/ g\n# H f=4\u0003 f \u0003L2/d\u0003 v2 ^2/2/ g\n# H_exit=v2 ^2/2/ g\nv2= math.sqrt (30*2* g /173.4);\nQ= pi*d2 **2/4* v2;\n\n#result\nprint\"The rate of flow (m^3/s) =\",round(Q,5)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "from math import pi\n",
+ "import math\n",
+ "d2 =0.06; # m\n",
+ "d1 =0.12; # m\n",
+ "k =0.44;\n",
+ "f =0.05;\n",
+ "L1 =500; # m\n",
+ "g =9.81; # m/ s ^2\n",
+ "\n",
+ "#Calcualtion\n",
+ "# v1=d2 ^2/ d1 ^2\u0003 v2\n",
+ "# H f=4\u0003 f \u0003L1 /16/ d\u0003 v2 ^2/2/ g\n",
+ "# H c=k\u0003 v2 ^2/2/ g\n",
+ "# H f=4\u0003 f \u0003L2/d\u0003 v2 ^2/2/ g\n",
+ "# H_exit=v2 ^2/2/ g\n",
+ "v2= math.sqrt (30*2* g /173.4);\n",
+ "Q= pi*d2 **2/4* v2;\n",
+ "\n",
+ "#result\n",
+ "print\"The rate of flow (m^3/s) =\",round(Q,5)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of flow (m^3/s) = 0.00521\n"
+ "text": [
+ "The rate of flow (m^3/s) = 0.00521\n"
+ ]
}
],
"prompt_number": 5
@@ -143,19 +313,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.10,Page 212"
+ "source": [
+ "Example 8.10,Page 212"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding rate of flow\n\n#variable declaration\nimport math\nm =12.0*10**3/3600; #kg / s\nRho =815; #kg /m^3\nd =0.05; #m\ne =0.02;\nd1 =50; # m\nd2 =0.038; # m\ng =9.8; #m\n\n#calculation\nv =4* m/ Rho / pi /d**2;\nf1 =1/(2* math.log (d1/e,10) +2.28) **2;\nL_eq =d1 +2* d1*d;\nH_50mm =4* f1* L_eq *v **2/( d *2* g);\nv =4* m/( Rho * pi *d2 **2) ;\nf2 =1/(2* math.log (38/ e,10) +2.28) **2;\nL_eq =d1 +2* d1*d2;\nH_38mm =4* f2* L_eq *v **2/( d2 *2* g);\nHr =0.2* v **2/(2* g);\nH_L = H_50mm + H_38mm +Hr;\ndel_p_f =Rho*g* H_L ;\n\n#result\nprint \"The total pressure drop due to friction through the pipe system is (N/m^2) =\",round(del_p_f,3)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "import math\n",
+ "m =12.0*10**3/3600; #kg / s\n",
+ "Rho =815; #kg /m^3\n",
+ "d =0.05; #m\n",
+ "e =0.02;\n",
+ "d1 =50; # m\n",
+ "d2 =0.038; # m\n",
+ "g =9.8; #m\n",
+ "\n",
+ "#calculation\n",
+ "v =4* m/ Rho / pi /d**2;\n",
+ "f1 =1/(2* math.log (d1/e,10) +2.28) **2;\n",
+ "L_eq =d1 +2* d1*d;\n",
+ "H_50mm =4* f1* L_eq *v **2/( d *2* g);\n",
+ "v =4* m/( Rho * pi *d2 **2) ;\n",
+ "f2 =1/(2* math.log (38/ e,10) +2.28) **2;\n",
+ "L_eq =d1 +2* d1*d2;\n",
+ "H_38mm =4* f2* L_eq *v **2/( d2 *2* g);\n",
+ "Hr =0.2* v **2/(2* g);\n",
+ "H_L = H_50mm + H_38mm +Hr;\n",
+ "del_p_f =Rho*g* H_L ;\n",
+ "\n",
+ "#result\n",
+ "print \"The total pressure drop due to friction through the pipe system is (N/m^2) =\",round(del_p_f,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The total pressure drop due to friction through the pipe system is (N/m^2) = 479792.576\n"
+ "text": [
+ "The total pressure drop due to friction through the pipe system is (N/m^2) = 479792.576\n"
+ ]
}
],
"prompt_number": 6
@@ -164,19 +366,36 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.11,Page 214"
+ "source": [
+ "Example 8.11,Page 214"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding rate of flow\n\n#variable declaration\nimport math\n#H L=1.2\u0003 v ^2/2/ g\n# H L=4\u0003 f \u0003 L eq /d\u0003V^2/2/ g\n# L eq=60\u0003d\n# H L=240\u0003 f \u0003v ^2/2/ g\n# Combining the two e q u a t i o n s f o r head l o s s\n# 1.2\u0003v^2/2/ g=240\u0003 f_\u0003v^2/2/ g\n\nf =1.2/240;\nprint \" Friction factor =\",round(f,3)\n",
+ "input": [
+ "\n",
+ "#variable declaration\n",
+ "import math\n",
+ "#H L=1.2\u0003 v ^2/2/ g\n",
+ "# H L=4\u0003 f \u0003 L eq /d\u0003V^2/2/ g\n",
+ "# L eq=60\u0003d\n",
+ "# H L=240\u0003 f \u0003v ^2/2/ g\n",
+ "# Combining the two e q u a t i o n s f o r head l o s s\n",
+ "# 1.2\u0003v^2/2/ g=240\u0003 f_\u0003v^2/2/ g\n",
+ "\n",
+ "f =1.2/240;\n",
+ "print \" Friction factor =\",round(f,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Friction factor = 0.005\n"
+ "text": [
+ " Friction factor = 0.005\n"
+ ]
}
],
"prompt_number": 7
@@ -185,19 +404,54 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.12,Page 216"
+ "source": [
+ "Example 8.12,Page 216"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding rate of flow\n\n#variable declaration\nimport math\n# dp AB+dp BC=dp AD+dp DC\n# dp AD=2\u0003 f \u0003 rho \u0003v ^2\u0003L/d\n# dp AD=16600\u0003(3_Q) ^2\n# Li k ewi s e\n# dp AB=16600\u0003Q^2\n# dp BC=16600\u0003(Q+0.5) ^2\n# dp DC=16600\u0003(2.1_Q) ^2\n#By s o l v i n g above 5 e qu a t i o ns , we g e t\nQ =1.175; # litres per second\n\n#Calculation\ndp_AD =16600*(3 - Q) **2;\ndp_AB =16600* Q**2;\ndp_BC =16600*( Q +0.5) **2;\ndp_DC =16600*(2.1 - Q) **2;\n\nprint\"The rate of flow from B to C (l/s)=\",round(Q+0.5,3)\nprint \"dp_AD(kN/m^2 =\",round(dp_AD/1000,3);\nprint\"dp AB (kN/m^2)=\",round(dp_AB/1000,3);\nprint\"dp BC(kN/m^2) =\",round(dp_BC/1000,3);\nprint\"dp DC (kN/m^2)=\",round(dp_DC/1000,3);\nprint\"The lowest pressure is in the pipe coneecting C and D\"",
+ "input": [
+ "\n",
+ "#variable declaration\n",
+ "import math\n",
+ "# dp AB+dp BC=dp AD+dp DC\n",
+ "# dp AD=2\u0003 f \u0003 rho \u0003v ^2\u0003L/d\n",
+ "# dp AD=16600\u0003(3_Q) ^2\n",
+ "# Li k ewi s e\n",
+ "# dp AB=16600\u0003Q^2\n",
+ "# dp BC=16600\u0003(Q+0.5) ^2\n",
+ "# dp DC=16600\u0003(2.1_Q) ^2\n",
+ "#By s o l v i n g above 5 e qu a t i o ns , we g e t\n",
+ "Q =1.175; # litres per second\n",
+ "\n",
+ "#Calculation\n",
+ "dp_AD =16600*(3 - Q) **2;\n",
+ "dp_AB =16600* Q**2;\n",
+ "dp_BC =16600*( Q +0.5) **2;\n",
+ "dp_DC =16600*(2.1 - Q) **2;\n",
+ "\n",
+ "print\"The rate of flow from B to C (l/s)=\",round(Q+0.5,3)\n",
+ "print \"dp_AD(kN/m^2 =\",round(dp_AD/1000,3);\n",
+ "print\"dp AB (kN/m^2)=\",round(dp_AB/1000,3);\n",
+ "print\"dp BC(kN/m^2) =\",round(dp_BC/1000,3);\n",
+ "print\"dp DC (kN/m^2)=\",round(dp_DC/1000,3);\n",
+ "print\"The lowest pressure is in the pipe coneecting C and D\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of flow from B to C (l/s)= 1.675\ndp_AD(kN/m^2 = 55.288\ndp AB (kN/m^2)= 22.918\ndp BC(kN/m^2) = 46.573\ndp DC (kN/m^2)= 14.203\nThe lowest pressure is in the pipe coneecting C and D\n"
+ "text": [
+ "The rate of flow from B to C (l/s)= 1.675\n",
+ "dp_AD(kN/m^2 = 55.288\n",
+ "dp AB (kN/m^2)= 22.918\n",
+ "dp BC(kN/m^2) = 46.573\n",
+ "dp DC (kN/m^2)= 14.203\n",
+ "The lowest pressure is in the pipe coneecting C and D\n"
+ ]
}
],
"prompt_number": 8
@@ -206,19 +460,51 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.13,Page 221"
+ "source": [
+ "Example 8.13,Page 221"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time taken\n\n#variable declaration\nfrom math import pi\nimport math\nfrom scipy import integrate\nH2 =0.5; #m\nH1 =2.0; #m\nA =4.0; #m^2\nf =0.005;\nL =20.0; #m\nd =0.025; #m\ng =9.81; # m/ s ^2\n\n#calculation\na= pi *d **2/4;\nc=A*math.sqrt( 4*f*L/d +2.5)/a/math.sqrt(2*g); # constant term of integration\ndef integrand(H,c):\n return -c*(H)**(-0.5)\n#integrate function '-A\u0003*sqrt ( ( 4*f \u0003L/d ) +2.5) / a /( sqrt(2\u0003*g ) )* \u0003(H) ^(-1/2)\n#f=lambda H:-4*1978.18*H**(-0.5);\n\n\nt=integrate.quad(integrand,H1,H2,args=(c))\n \n#result\nprint \"Time taken (s)=\",round(t[0],2)",
+ "input": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "from math import pi\n",
+ "import math\n",
+ "from scipy import integrate\n",
+ "H2 =0.5; #m\n",
+ "H1 =2.0; #m\n",
+ "A =4.0; #m^2\n",
+ "f =0.005;\n",
+ "L =20.0; #m\n",
+ "d =0.025; #m\n",
+ "g =9.81; # m/ s ^2\n",
+ "\n",
+ "#calculation\n",
+ "a= pi *d **2/4;\n",
+ "c=A*math.sqrt( 4*f*L/d +2.5)/a/math.sqrt(2*g); # constant term of integration\n",
+ "def integrand(H,c):\n",
+ " return -c*(H)**(-0.5)\n",
+ "#integrate function '-A\u0003*sqrt ( ( 4*f \u0003L/d ) +2.5) / a /( sqrt(2\u0003*g ) )* \u0003(H) ^(-1/2)\n",
+ "#f=lambda H:-4*1978.18*H**(-0.5);\n",
+ "\n",
+ "\n",
+ "t=integrate.quad(integrand,H1,H2,args=(c))\n",
+ " \n",
+ "#result\n",
+ "print \"Time taken (s)=\",round(t[0],2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Time taken (s)= 11190.29\n"
+ "text": [
+ "Time taken (s)= 11190.29\n"
+ ]
}
],
"prompt_number": 39
@@ -227,19 +513,43 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.14,Page 223"
+ "source": [
+ "Example 8.14,Page 223"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding pressure drop\n\n#variable decleration\nfrom math import pi\nd0 =0.15; # m\nd1 =0.1; #m\nQ =50.0/3600; # m^3/ s\nf =0.0052;\nRho =972;\n\n\n#calculation\na= pi /4*(( d0)**2 -( d1) **2) ;\nP= pi *(( d0)+( d1));\nd_eq =4*a/P;\nv=Q/a;\ndel_p_f =2*f* Rho *v**2/ d_eq ;\n\n#result\nprint\" the pressure drop due to friction per metre lenfth of tube is found to be(Nm^2/m)\",round(del_p_f,3)\n",
+ "input": [
+ "\n",
+ "#variable decleration\n",
+ "from math import pi\n",
+ "d0 =0.15; # m\n",
+ "d1 =0.1; #m\n",
+ "Q =50.0/3600; # m^3/ s\n",
+ "f =0.0052;\n",
+ "Rho =972;\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "a= pi /4*(( d0)**2 -( d1) **2) ;\n",
+ "P= pi *(( d0)+( d1));\n",
+ "d_eq =4*a/P;\n",
+ "v=Q/a;\n",
+ "del_p_f =2*f* Rho *v**2/ d_eq ;\n",
+ "\n",
+ "#result\n",
+ "print\" the pressure drop due to friction per metre lenfth of tube is found to be(Nm^2/m)\",round(del_p_f,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " the pressure drop due to friction per metre lenfth of tube is found to be(Nm^2/m) 404.636\n"
+ "text": [
+ " the pressure drop due to friction per metre lenfth of tube is found to be(Nm^2/m) 404.636\n"
+ ]
}
],
"prompt_number": 12
@@ -248,19 +558,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.15,Page 225"
+ "source": [
+ "Example 8.15,Page 225"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Head Loss\n\n#variable decleration\nfrom math import pi\nfrom scipy import integrate\nf =0.005;\nQ =0.07; #m^3/ s\ng =9.81; #m/ s ^2\nL=3;\n\n#calculation\nu=0.3-0.0666*L;\ndef integrand(l,f,Q,g,u):\n return 32*f*Q**2/pi**2/g*(0.3-0.0666*l)**-5 \n\nH_f=integrate.quad(integrand,0,3,args=(f,Q,g,u));\nH_f=round(H_f[0],1)\n\n#result\nprint\" Fractional head loss(m) =\",H_f\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable decleration\n",
+ "from math import pi\n",
+ "from scipy import integrate\n",
+ "f =0.005;\n",
+ "Q =0.07; #m^3/ s\n",
+ "g =9.81; #m/ s ^2\n",
+ "L=3;\n",
+ "\n",
+ "#calculation\n",
+ "u=0.3-0.0666*L;\n",
+ "def integrand(l,f,Q,g,u):\n",
+ " return 32*f*Q**2/pi**2/g*(0.3-0.0666*l)**-5 \n",
+ "\n",
+ "H_f=integrate.quad(integrand,0,3,args=(f,Q,g,u));\n",
+ "H_f=round(H_f[0],1)\n",
+ "\n",
+ "#result\n",
+ "print\" Fractional head loss(m) =\",H_f\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Fractional head loss(m) = 0.3\n"
+ "text": [
+ " Fractional head loss(m) = 0.3\n"
+ ]
}
],
"prompt_number": 3
@@ -269,19 +604,42 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 8.16,Page 228"
+ "source": [
+ "Example 8.16,Page 228"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#variable decleration\nfrom math import pi\nimport math\ng =9.81; # m/ s ^2\nH =4; # m\nf =0.006;\nL =50; # m\nd =0.1; # m\ne=2.718;\n\n\n#calculation\nv1= math.sqrt (2* g*H /(4* f*L/d + 13) );\nv2=0.99*v1;\nt=2/v1*math.log((v1+v2)/(v1-v2),e)\n\n#result\nprint\"Time taken (s)=\",round(t,2)\n",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "import math\n",
+ "g =9.81; # m/ s ^2\n",
+ "H =4; # m\n",
+ "f =0.006;\n",
+ "L =50; # m\n",
+ "d =0.1; # m\n",
+ "e=2.718;\n",
+ "\n",
+ "\n",
+ "#calculation\n",
+ "v1= math.sqrt (2* g*H /(4* f*L/d + 13) );\n",
+ "v2=0.99*v1;\n",
+ "t=2/v1*math.log((v1+v2)/(v1-v2),e)\n",
+ "\n",
+ "#result\n",
+ "print\"Time taken (s)=\",round(t,2)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Time taken (s)= 5.98\n"
+ "text": [
+ "Time taken (s)= 5.98\n"
+ ]
}
],
"prompt_number": 14
@@ -289,7 +647,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_9_1.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_9_1.ipynb
index 3b69a21d..3a6f5367 100644
--- a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_9_1.ipynb
+++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/Chapter_9_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 9"
+ "name": "",
+ "signature": "sha256:8db0dc01c526205f6578e94b8a174e884a60249a5154cf023d12bae195b0ba58"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,74 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 9,Pumps"
+ "source": [
+ "Chapter 9,Pumps"
+ ]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 9.2 (part1 and part2), Page 239"
+ "source": [
+ "Example 9.2 (part1 and part2), Page 239"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding head loss \nimport math\n\n#Variable Declaration\nd =0.1; # m\nv_r =2; # m/ s\nf =0.005;\ng =9.81; #m/ s ^2\npi=3.14;\nL_s =2; #m\nL_r =10; # m\nQ1 =1.1*10**( -2) ; #m^3/ s\nz_t =12; #m\nz_s=5 #m\nL1 =20; #m\n\n#Calculation\nQ= math.pi*d**2/4*v_r ;\nH =12-70*Q-4300*Q*Q ;\nk =2*g*H/ v_r/v_r-(4*f*( L_s +L_r)/d)-1;\n\n#result\nprint\"The head loss across the restriction orifice (in terms of velocity head)\",round(k,3) \n\n#Part2\n#Finding System Head and Delivered Head\n# For the case of the valve being fully open\n\n#calculation\nv_t =4*Q1/math.pi/d**2;\nv_r =((2*g*( z_t-z_s )+(4*f*L1/d+1)*v_t**2) /(4*f*L_r/d+k+1))**(0.5) ;\nH1 =4*f* L_r /d*v_r**2/2/ g + 4*f* L_s /d*( v_r**2+ v_t**2) /2/g+k* v_r**2/2/ g + v_r**2/2/ g;\nQ= math.pi*d**2/4*( v_t+ v_r );\nH2 =12 -70*Q -4300* Q**2;\n\n#result\nprint\" System head(m)=\",round(H1,3)\nprint\" Delivered head(m)=\",round(H2,3)\nprint\"The delivered head therefore closely matches the system head at the flow rate of 1.1*\u000310^( -2) m^3/ s\"\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "d =0.1; # m\n",
+ "v_r =2; # m/ s\n",
+ "f =0.005;\n",
+ "g =9.81; #m/ s ^2\n",
+ "pi=3.14;\n",
+ "L_s =2; #m\n",
+ "L_r =10; # m\n",
+ "Q1 =1.1*10**( -2) ; #m^3/ s\n",
+ "z_t =12; #m\n",
+ "z_s=5 #m\n",
+ "L1 =20; #m\n",
+ "\n",
+ "#Calculation\n",
+ "Q= math.pi*d**2/4*v_r ;\n",
+ "H =12-70*Q-4300*Q*Q ;\n",
+ "k =2*g*H/ v_r/v_r-(4*f*( L_s +L_r)/d)-1;\n",
+ "\n",
+ "#result\n",
+ "print\"The head loss across the restriction orifice (in terms of velocity head)\",round(k,3) \n",
+ "\n",
+ "#Part2\n",
+ "#Finding System Head and Delivered Head\n",
+ "# For the case of the valve being fully open\n",
+ "\n",
+ "#calculation\n",
+ "v_t =4*Q1/math.pi/d**2;\n",
+ "v_r =((2*g*( z_t-z_s )+(4*f*L1/d+1)*v_t**2) /(4*f*L_r/d+k+1))**(0.5) ;\n",
+ "H1 =4*f* L_r /d*v_r**2/2/ g + 4*f* L_s /d*( v_r**2+ v_t**2) /2/g+k* v_r**2/2/ g + v_r**2/2/ g;\n",
+ "Q= math.pi*d**2/4*( v_t+ v_r );\n",
+ "H2 =12 -70*Q -4300* Q**2;\n",
+ "\n",
+ "#result\n",
+ "print\" System head(m)=\",round(H1,3)\n",
+ "print\" Delivered head(m)=\",round(H2,3)\n",
+ "print\"The delivered head therefore closely matches the system head at the flow rate of 1.1*\u000310^( -2) m^3/ s\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The head loss across the restriction orifice (in terms of velocity head) 44.863\n System head(m)= 7.603\n Delivered head(m)= 7.628\nThe delivered head therefore closely matches the system head at the flow rate of 1.1*\u000310^( -2) m^3/ s\n"
+ "text": [
+ "The head loss across the restriction orifice (in terms of velocity head) 44.863\n",
+ " System head(m)= 7.603\n",
+ " Delivered head(m)= 7.628\n",
+ "The delivered head therefore closely matches the system head at the flow rate of 1.1*\u000310^( -2) m^3/ s\n"
+ ]
}
],
"prompt_number": 3
@@ -38,19 +88,48 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 9.6, Page 247"
+ "source": [
+ "Example 9.6, Page 247"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding time and volume of liquid\n\nfrom math import pi\n#Variable Declaration\nNPSH =5; # m\np_v =18*10**3; # N/m^2\np_l =0.94*101.3*10**3; # N/m^2\nrho =970;#kg /m^3\ng =9.81; # m/ s ^2\nz_s =3; # m\nH_L =0.5; # m\nd =3; # m\nh =2.5; # m\nQ =5; #m^3/h\n\n#calculation\nz1= NPSH +( p_v -p_l)/ rho /g + z_s + H_L ;\nV= pi /4*d**2*(h-z1);\nt=V/Q;\n\n#result\nprint\"Quantity of liquid delivered (m^3)=\",round(V,2)\nprint\"Time taken (h)=\",round(t,2) \n",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi\n",
+ "#Variable Declaration\n",
+ "NPSH =5; # m\n",
+ "p_v =18*10**3; # N/m^2\n",
+ "p_l =0.94*101.3*10**3; # N/m^2\n",
+ "rho =970;#kg /m^3\n",
+ "g =9.81; # m/ s ^2\n",
+ "z_s =3; # m\n",
+ "H_L =0.5; # m\n",
+ "d =3; # m\n",
+ "h =2.5; # m\n",
+ "Q =5; #m^3/h\n",
+ "\n",
+ "#calculation\n",
+ "z1= NPSH +( p_v -p_l)/ rho /g + z_s + H_L ;\n",
+ "V= pi /4*d**2*(h-z1);\n",
+ "t=V/Q;\n",
+ "\n",
+ "#result\n",
+ "print\"Quantity of liquid delivered (m^3)=\",round(V,2)\n",
+ "print\"Time taken (h)=\",round(t,2) \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Quantity of liquid delivered (m^3)= 14.95\nTime taken (h)= 2.99\n"
+ "text": [
+ "Quantity of liquid delivered (m^3)= 14.95\n",
+ "Time taken (h)= 2.99\n"
+ ]
}
],
"prompt_number": 4
@@ -59,19 +138,41 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 9.8,Page 251"
+ "source": [
+ "Example 9.8,Page 251"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding minimum level of alarm\n\n#variable Declaration\nN_s =0.14; #m^ ( 3 / 4 ) s ^(-3/2)\nH =30; #m\np_v =7.38*10**3; #N/m^2\np_l =50*10**3; #N/m^2\nrho =992; #kg /m^3\ng =9.81; #m/ s ^2\nH_L =0.2; #m\n\n#calculation\nNPSH =2.8* N_s **(1.33) *H;\nz1= NPSH +( p_v -p_l)/ rho /g+H_L;\n\n#result\nprint\"The minimum level of the alarm (m)=\",round(z1,3)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#variable Declaration\n",
+ "N_s =0.14; #m^ ( 3 / 4 ) s ^(-3/2)\n",
+ "H =30; #m\n",
+ "p_v =7.38*10**3; #N/m^2\n",
+ "p_l =50*10**3; #N/m^2\n",
+ "rho =992; #kg /m^3\n",
+ "g =9.81; #m/ s ^2\n",
+ "H_L =0.2; #m\n",
+ "\n",
+ "#calculation\n",
+ "NPSH =2.8* N_s **(1.33) *H;\n",
+ "z1= NPSH +( p_v -p_l)/ rho /g+H_L;\n",
+ "\n",
+ "#result\n",
+ "print\"The minimum level of the alarm (m)=\",round(z1,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The minimum level of the alarm (m)= 1.967\n"
+ "text": [
+ "The minimum level of the alarm (m)= 1.967\n"
+ ]
}
],
"prompt_number": 5
@@ -80,28 +181,96 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 9.10,Page 255"
+ "source": [
+ "Example 9.10,Page 255"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Final Speed\n\n%pylab inline\n#Vabiable Declaration\nimport numpy as np\nfrom pylab import *\ndz =10; #z2-z1\ng =9.81; #m/ s ^2\nd =0.05; #m\nf =0.005;\nL =100; #m\nN1 =1200; #rpm\n\n# H=z2-z1+16\u0003Q^2/2/ g /%pi ^2/d ^4\u0003(4\u0003 f \u0003L/d+1)\n# H=10+5.42\u000310^5\u0003Q^2\n\n#Calculation\nQ =[0.000, 0.002, 0.004, 0.006, 0.008, 0.010];\nH_p =[40.0, 39.5, 38.0, 35.0, 30.0, 20.0];\nH_s =[10.0, 12.2, 18.7, 29.5, 44.7, 64.2];\nfigure()\nplot (Q,H_p , 'b')\nplot (Q,H_s , 'r')\nxlabel('FLOW (m^3/s)')\nylabel('HEAD (m)')\ntitle('system and pump')\n#xtitle (\" \" , \"Flow\" , \"Head\")\n#legend (\"pump\" , \" system\")\na =[0.0066, 0.0066];\nb =[0, 33.8];\n\nplot (a,b)\ne =[0, 0.0066];\nf =[33.8, 33.8];\nplot (e,f)\ni =[0.0049, 0.0049];\nh =[0, 23];\n\nplot (i,h)\nl =[0, 0.00495];\nm =[23, 23];\nplot (l,m)\nshow()\n\n#From graph\nH1 =34.0; #m\nH2 =23.0; # m\nQ1 =0.0066; #m^3/ s\nQ2 =0.00495; #m^3/ s\nN2=N1 *( H2/H1)**(0.5) ;\n\n#result\nprint \"Duty point(m^3/s) =\",round(Q1,4)\nprint \"The speed of the pump to reduce the flow by 25% =\",round(N2,3)\n\n\n\n\n",
+ "input": [
+ "\n",
+ "%pylab inline\n",
+ "#Vabiable Declaration\n",
+ "import numpy as np\n",
+ "from pylab import *\n",
+ "dz =10; #z2-z1\n",
+ "g =9.81; #m/ s ^2\n",
+ "d =0.05; #m\n",
+ "f =0.005;\n",
+ "L =100; #m\n",
+ "N1 =1200; #rpm\n",
+ "\n",
+ "# H=z2-z1+16\u0003Q^2/2/ g /%pi ^2/d ^4\u0003(4\u0003 f \u0003L/d+1)\n",
+ "# H=10+5.42\u000310^5\u0003Q^2\n",
+ "\n",
+ "#Calculation\n",
+ "Q =[0.000, 0.002, 0.004, 0.006, 0.008, 0.010];\n",
+ "H_p =[40.0, 39.5, 38.0, 35.0, 30.0, 20.0];\n",
+ "H_s =[10.0, 12.2, 18.7, 29.5, 44.7, 64.2];\n",
+ "figure()\n",
+ "plot (Q,H_p , 'b')\n",
+ "plot (Q,H_s , 'r')\n",
+ "xlabel('FLOW (m^3/s)')\n",
+ "ylabel('HEAD (m)')\n",
+ "title('system and pump')\n",
+ "#xtitle (\" \" , \"Flow\" , \"Head\")\n",
+ "#legend (\"pump\" , \" system\")\n",
+ "a =[0.0066, 0.0066];\n",
+ "b =[0, 33.8];\n",
+ "\n",
+ "plot (a,b)\n",
+ "e =[0, 0.0066];\n",
+ "f =[33.8, 33.8];\n",
+ "plot (e,f)\n",
+ "i =[0.0049, 0.0049];\n",
+ "h =[0, 23];\n",
+ "\n",
+ "plot (i,h)\n",
+ "l =[0, 0.00495];\n",
+ "m =[23, 23];\n",
+ "plot (l,m)\n",
+ "show()\n",
+ "\n",
+ "#From graph\n",
+ "H1 =34.0; #m\n",
+ "H2 =23.0; # m\n",
+ "Q1 =0.0066; #m^3/ s\n",
+ "Q2 =0.00495; #m^3/ s\n",
+ "N2=N1 *( H2/H1)**(0.5) ;\n",
+ "\n",
+ "#result\n",
+ "print \"Duty point(m^3/s) =\",round(Q1,4)\n",
+ "print \"The speed of the pump to reduce the flow by 25% =\",round(N2,3)\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\nWelcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\nFor more information, type 'help(pylab)'.\n"
+ "text": [
+ "\n",
+ "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
+ "For more information, type 'help(pylab)'.\n"
+ ]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAEXCAYAAABYsbiOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVNX/P/DX4K6ggsKgoJILoZCIO4o5iWj2DSQzUz8q\nqdlifcv8/Nz6pGGWYpaW7ZkLbZb1ScU1l8TdUCE1FVcURcB0QAURBM7vj/NllGUQhrkzzNzX8/GY\nR8zMnTvvc8P75p5zz/tohBACREREZXCwdgBERFR9MUkQEZFRTBJERGQUkwQRERnFJEFEREYxSRAR\nkVFMEkQW4uXlhe3bt1s7DKJKYZIgm+Lg4IDz589bOwyTaDQaaDQaa4dBVClMEmRzOP+TyHKYJEhR\n8+fPh6enJxo2bAgfHx/s2LEDaWlpaNCgAfR6vWG7+Ph4uLm5oaCgAGfPnkXfvn3RuHFjuLq6YsSI\nEQCARx99FADg7+8PJycn/PLLLwCA9evXo1OnTnB2dkbv3r1x7Ngxw369vLzwwQcfoGPHjnBycsL4\n8eORnp6OQYMGoVGjRggJCUFmZmaZsWdmZuLJJ5+Em5sbXFxcEBoaipSUFMP7Op0Os2bNQlBQEBo2\nbIiBAwfi+vXrhve/++47tGrVCk2bNsXcuXPLPU7PPfccXnrpJQwYMAANGzaETqdDcnIyAODChQtw\ncHBAYWFhse9eunQpAGDFihXo3bs3Jk+eDGdnZ7Rt2xb79u3D8uXL0bJlS2i1Wnz77bcV+i6iUgSR\nQhITE0WLFi1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cLHXzp8/D0dHRzg6OqJ+/fpo164dli1bZrji6NmzJzZs2ICrV6/C29u7\nzP2WTDy1a9cGADg4OKBOnTqG1x0cHJCfn1/puJ999lnEx8cb4m3RogVq1qyJmjVrIi4uDkOHDsX6\n9evx+OOPF4vJFqofk21jkiC7MnLkSOzZs8dQDTcnJwevvfZasaU7e/XqhY8++giBgYEAgMDAQHz8\n8ceG5yW1atXKsJCLOZ09e9bw84YNGwxrYGzatAmDBg0CAGRnZyMzMxODBg3CwoULi90BlZqaCi8v\nL7PHRXQ/JgmyCcbWEdm+fTtatGhheBw9ehRr167Fu+++Cx8fH3Ts2BE9evTAK6+8Yvhc7969kZSU\nZEgKAQEBSElJKXM8omj7or/yy4qnZGwV/ev+008/hZ+fHwICAvDJJ59g+fLlAIDff//dcMVw69Yt\nhIaGwt/fH3369MGiRYsMn4+Li0OfPn0q9F1EpmKBP6IK6NevH3744YdSYxPmlpubiz59+iAuLq7c\n7W7evIng4GAcPHhQ0XiImCSIKmDjxo34888/i616Z02LFy+Gi4sLRo0aZe1QyM4xSRARkVEckyAi\nIqOYJIiIyCgmCSIiMopJgoiIjGKSICIio5gkiIjIqP8PGWNRyvJ14HwAAAAASUVORK5CYII=\n"
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Duty point(m^3/s) = 0.0066\nThe speed of the pump to reduce the flow by 25% = 986.974\n"
+ "text": [
+ "Duty point(m^3/s) = 0.0066\n",
+ "The speed of the pump to reduce the flow by 25% = 986.974\n"
+ ]
}
],
"prompt_number": 6
@@ -110,19 +279,70 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 9.11,Page 257"
+ "source": [
+ "Example 9.11,Page 257"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding head, rotational frequency, power\n\n#Varable Declaration\nQ =0.05; # m^3/ s\nv =2; # m/ s\nf =0.005;\nL_s =5; # m\nd =0.178; #m\ng =9.81; # m/ s ^2\nL_d =20; # m\np2 =1.5*10**5; # N/m^2\np1 =0.5*10**5; # N/m^2\nrho =1000; # kg /m^3\nz2 =15; # m\nz1 =5; # m\nN1 =1500.0/60; # rps\npi=3.14;\nQ =[0, 5, 10, 15, 20, 25];\nH =[9.25, 8.81, 7.85, 6.48, 4.81, 2.96];\nP=[- 0.96, 1.03, 1.19, 1.26, 1.45];\nn1 =[0, 45, 75, 800, 75, 50];\nH =27.96; #m\nH1 =6.48; #m\nQ1 =0.015; #m^3/ s\nQ =0.05; #m^3/ s\nD1 =0.15; #m\nn =0.80;\n\n#calculation\nd =(4* Q/ pi /v)**(0.5) ;\nH_f_s =4* f* L_s /d*v **2/2/ g;\nH_f_d =4* f* L_d /d*v **2/2/ g;\nH =1/(1 -0.25) *(( p2 -p1)/ rho /g + v **2/2/ g + z2 - z1 +H_f_s + H_f_d );\n# n=rho \u0003g\u0003Q\u0003H/P\nN=N1 *(H/H1) **(0.75) *( Q1/Q) **(0.5) ;\nD=D1 *(Q*N1/Q1/N)**(0.2) ;\nP= rho *g*Q*H/n;\n\n#result\nprint \" Differential Head (m) =\",round(H,3);\nprint \"impeller diameter (m)=\",round(D,3)\nprint \"The rotational speed at maximum efficiency (rps)=\",round(N,3)\nprint \"Power input to the pump (W)=\",round(P,3)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Varable Declaration\n",
+ "Q =0.05; # m^3/ s\n",
+ "v =2; # m/ s\n",
+ "f =0.005;\n",
+ "L_s =5; # m\n",
+ "d =0.178; #m\n",
+ "g =9.81; # m/ s ^2\n",
+ "L_d =20; # m\n",
+ "p2 =1.5*10**5; # N/m^2\n",
+ "p1 =0.5*10**5; # N/m^2\n",
+ "rho =1000; # kg /m^3\n",
+ "z2 =15; # m\n",
+ "z1 =5; # m\n",
+ "N1 =1500.0/60; # rps\n",
+ "pi=3.14;\n",
+ "Q =[0, 5, 10, 15, 20, 25];\n",
+ "H =[9.25, 8.81, 7.85, 6.48, 4.81, 2.96];\n",
+ "P=[- 0.96, 1.03, 1.19, 1.26, 1.45];\n",
+ "n1 =[0, 45, 75, 800, 75, 50];\n",
+ "H =27.96; #m\n",
+ "H1 =6.48; #m\n",
+ "Q1 =0.015; #m^3/ s\n",
+ "Q =0.05; #m^3/ s\n",
+ "D1 =0.15; #m\n",
+ "n =0.80;\n",
+ "\n",
+ "#calculation\n",
+ "d =(4* Q/ pi /v)**(0.5) ;\n",
+ "H_f_s =4* f* L_s /d*v **2/2/ g;\n",
+ "H_f_d =4* f* L_d /d*v **2/2/ g;\n",
+ "H =1/(1 -0.25) *(( p2 -p1)/ rho /g + v **2/2/ g + z2 - z1 +H_f_s + H_f_d );\n",
+ "# n=rho \u0003g\u0003Q\u0003H/P\n",
+ "N=N1 *(H/H1) **(0.75) *( Q1/Q) **(0.5) ;\n",
+ "D=D1 *(Q*N1/Q1/N)**(0.2) ;\n",
+ "P= rho *g*Q*H/n;\n",
+ "\n",
+ "#result\n",
+ "print \" Differential Head (m) =\",round(H,3);\n",
+ "print \"impeller diameter (m)=\",round(D,3)\n",
+ "print \"The rotational speed at maximum efficiency (rps)=\",round(N,3)\n",
+ "print \"Power input to the pump (W)=\",round(P,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Differential Head (m) = 27.958\nimpeller diameter (m)= 0.173\nThe rotational speed at maximum efficiency (rps)= 40.992\nPower input to the pump (W)= 17141.964\n"
+ "text": [
+ " Differential Head (m) = 27.958\n",
+ "impeller diameter (m)= 0.173\n",
+ "The rotational speed at maximum efficiency (rps)= 40.992\n",
+ "Power input to the pump (W)= 17141.964\n"
+ ]
}
],
"prompt_number": 10
@@ -131,19 +351,37 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 9.12,Page 259"
+ "source": [
+ "Example 9.12,Page 259"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding suction speed\n\n#Variable Declaration\nN =2000.0/60; #rps\nQ =50.0/3600; #m^3/ s\ng =9.81; #m/ s ^2\nH =5.0; #m\n\n#Calculation\nS_n =N*Q **(0.5) /(g)**(0.75)/(H) **(0.75) ;\n\n#result\nprint \" Suction specific speed =\",round(S_n,3)\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable Declaration\n",
+ "N =2000.0/60; #rps\n",
+ "Q =50.0/3600; #m^3/ s\n",
+ "g =9.81; #m/ s ^2\n",
+ "H =5.0; #m\n",
+ "\n",
+ "#Calculation\n",
+ "S_n =N*Q **(0.5) /(g)**(0.75)/(H) **(0.75) ;\n",
+ "\n",
+ "#result\n",
+ "print \" Suction specific speed =\",round(S_n,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Suction specific speed = 0.212\n"
+ "text": [
+ " Suction specific speed = 0.212\n"
+ ]
}
],
"prompt_number": 8
@@ -152,19 +390,44 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 9.14,Page 264"
+ "source": [
+ "Example 9.14,Page 264"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding Coeff. of Discharge and Power required\n\n# Variable Declaration\nA =0.01; #m^2\nL =0.3; # m\nN =60/60; # rps\nV_act =10.6/3600; # m^3/ s\nrho =1000; # kg /m^3\ng =9.81; # m/ s ^2\nQ =10.6/3600; # m^3/ s\nH =15; # m\n\n#calculation\nV=A*L*N;\nCd= V_act /V;\nP= rho *g*Q*H;\n\n#result\nprint \" Coeff. of Discharge =\",round(Cd,2)\nprint \"The power required (W)=\",round(P,3)\n",
+ "input": [
+ "\n",
+ "# Variable Declaration\n",
+ "A =0.01; #m^2\n",
+ "L =0.3; # m\n",
+ "N =60/60; # rps\n",
+ "V_act =10.6/3600; # m^3/ s\n",
+ "rho =1000; # kg /m^3\n",
+ "g =9.81; # m/ s ^2\n",
+ "Q =10.6/3600; # m^3/ s\n",
+ "H =15; # m\n",
+ "\n",
+ "#calculation\n",
+ "V=A*L*N;\n",
+ "Cd= V_act /V;\n",
+ "P= rho *g*Q*H;\n",
+ "\n",
+ "#result\n",
+ "print \" Coeff. of Discharge =\",round(Cd,2)\n",
+ "print \"The power required (W)=\",round(P,3)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " Coeff. of Discharge = 0.98\nThe power required (W)= 433.275\n"
+ "text": [
+ " Coeff. of Discharge = 0.98\n",
+ "The power required (W)= 433.275\n"
+ ]
}
],
"prompt_number": 9
@@ -172,7 +435,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Fluid_Mechanics_/Chapter1.ipynb b/Fluid_Mechanics_/Chapter1.ipynb
index e770487c..2869f384 100644
--- a/Fluid_Mechanics_/Chapter1.ipynb
+++ b/Fluid_Mechanics_/Chapter1.ipynb
@@ -28,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Density of air\n",
"\n",
- "#Given \n",
"\n",
"Mw = 29.0 # Molecular weight of air\n",
"\n",
@@ -40,7 +38,6 @@
"\n",
"p = 50*144*47.88 # Pressure in N/m**2\n",
"\n",
- "# Solution\n",
"\n",
"rho = p/(R*T) # from the state law\n",
"\n",
@@ -71,9 +68,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Reduction in volume\n",
"\n",
- "# Given\n",
"\n",
"dP = 10**6 # Pressure drop in N/m**2\n",
"\n",
@@ -81,7 +76,6 @@
"\n",
"bta = 2.2*10**9 # Bulk modulus of elasticity in N/m**2\n",
"\n",
- "# Solution\n",
"\n",
"dV = -dP*V/bta # Change in volume in m**3\n",
"\n",
@@ -114,9 +108,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Volume reduction\n",
"\n",
- "# Given\n",
"\n",
"bta1 = 2.28*10**9 # Bulk modulus of elasticity at 20 deg C and 103.4 N/m**2\n",
"\n",
@@ -126,7 +118,6 @@
"\n",
"p2 = 1034 # Pressure in N/m**2\n",
"\n",
- "# Solution \n",
"\n",
"bavg = (bta1+bta2)/2 # bulk modulus average in N/m**2\n",
"\n",
@@ -168,9 +159,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Volume reduction \n",
"\n",
- "# Given\n",
"\n",
"patm = 14.6 # Atmospheric pressure in psia\n",
"\n",
@@ -179,7 +168,6 @@
"p2 = 102 # gauge pressure at point 2 in psia\n",
"\n",
"V = 1 # volume in m**3\n",
- "# solution\n",
"\n",
"p = p1+patm # absolute pressure in psia\n",
"\n",
@@ -224,11 +212,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Sonic velocity of air\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"k = 1.4 # gas constant\n",
"\n",
@@ -236,7 +222,6 @@
"\n",
"T = 68+460 # temperature in *oR\n",
"\n",
- "# solution\n",
"\n",
"c = sqrt(k*R*T)\n",
"\n",
@@ -267,11 +252,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Force required to move the piston\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"d = 0.05 # diameter of cylinder 1 in m\n",
"\n",
@@ -287,7 +270,6 @@
"\n",
"A = pi*l*d # area in m**2\n",
"\n",
- "# Solution \n",
"\n",
"tau = mu*U/Y # Shear stress in N/m**2\n",
"\n",
@@ -320,27 +302,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Distance between the walls; Shear Stress; Location of maximum velocity\n",
"\n",
"from math import *\n",
"\n",
"from sympy import *\n",
"\n",
- "# Given\n",
"\n",
"mu = 1.005*10**-3 # Viscosity of water in Ns/m**2\n",
"\n",
- "# Solution \n",
"\n",
- "# Part a\n",
"\n",
- "# Velocity is given by the formula u = 10*(0.01*y-y**2)\n",
"\n",
- "# two boundary conditions must be satisfied\n",
"\n",
- "# at y=0;u=0 at the bottom of the plate\n",
"\n",
- "# at y=Y ; u = 0 at top of the plate\n",
"\n",
"Y = 0.01 # Distance between the walls\n",
"\n",
@@ -348,11 +322,8 @@
"\n",
"print \" (a) Distance between the walls = \",round(Y1,1),\"cm\"\n",
"\n",
- "# Part b\n",
"\n",
- "# tau = mu*du/dy # Newtons law of viscosity\n",
"\n",
- "# differentiate u wrt y\n",
"\n",
"y = Symbol('y')\n",
"\n",
@@ -364,8 +335,6 @@
"\n",
"U = uprime\n",
"\n",
- "#print U\n",
- "# for y =0 at the bottom plate we get \n",
"\n",
"U1 = 0.01 # from U\n",
"\n",
@@ -373,19 +342,14 @@
"\n",
"print \" (b) Shear stress = \",round(tau,9),\"N/m**2\"\n",
"\n",
- "# Part c\n",
"\n",
- "# Shaer stress at 20um from the wall\n",
"\n",
"tau1 = mu*10*(0.01-2*20*10**-6) # using the equation of U and y = 20*10**-6 calc shear stress in N/m**2\n",
"\n",
"print \" (c) Shear Stress at 20 um from the plate = \",round(tau1,9),\"N/m**2\"\n",
"\n",
- "# Part D\n",
"\n",
- "# Distance at which shaer stress is zero can be found from the location of maximum velocity \n",
"\n",
- "# equating uprime = 0\n",
"\n",
"y1 = 0.01/2 # shear stress location\n",
"\n",
@@ -423,9 +387,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Shaft torque for linear and non linear distribution of velocity \n",
"from math import *\n",
- "# Given\n",
"\n",
"d = 0.1 # diameter of shaft in m\n",
"\n",
@@ -443,9 +405,7 @@
"\n",
"mu = 0.44 # Viscosity of SAE-30 oil in Ns/m**2\n",
"\n",
- "# Solution\n",
"\n",
- "# part a\n",
"\n",
"F = 2*pi*r1*l*mu*U/t\n",
"\n",
@@ -453,7 +413,6 @@
"\n",
"print \" (a) For linear distribution of velocity , shaft torque = \",round(T,2),\"m.N\"\n",
"\n",
- "# part b\n",
"\n",
"F1 = 2*pi*l*mu*U/log(r2/r1)\n",
"\n",
@@ -488,9 +447,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Watts of energy lost to overcome friction\n",
"from math import *\n",
- "# Given\n",
"\n",
"mu = 0.44 # viscosity of the oil in Ns/m**2\n",
"\n",
@@ -533,15 +490,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Excessive pressure inside droplet\n",
"\n",
- "# Given\n",
"\n",
"d = 0.01 # diameter in m\n",
"\n",
"sigma = 0.073 # surface tension in N/m\n",
"\n",
- "# Solution \n",
"\n",
"dP = 4*sigma/d # pressure excessive\n",
"\n",
@@ -572,9 +526,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Height to which alcohol will rise\n",
"\n",
- "# Given\n",
"\n",
"sigma = 0.022 # surface tension in N/m\n",
"\n",
@@ -584,7 +536,6 @@
"\n",
"d = 0.002 # diameter in m\n",
"\n",
- "# Solution \n",
"\n",
"\n",
"h =4*sigma*1000/(gma*S*d) # capillary height in m\n",
diff --git a/Fluid_Mechanics_/Chapter10.ipynb b/Fluid_Mechanics_/Chapter10.ipynb
index fc9fd648..679a7dd2 100644
--- a/Fluid_Mechanics_/Chapter10.ipynb
+++ b/Fluid_Mechanics_/Chapter10.ipynb
@@ -29,13 +29,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Top width, area of lfow, hydraulic radius\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"b = 3 # base of the channel\n",
"\n",
@@ -43,7 +41,6 @@
"\n",
"y = 2 # depth of the channel\n",
"\n",
- "# Solution\n",
"\n",
"T = b + 2*z*y\n",
"\n",
@@ -99,13 +96,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Discharge for the trapezoidal channel\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"z = 1.0 # slide slope\n",
"\n",
@@ -117,7 +112,6 @@
"\n",
"n = 0.012 # for concrete\n",
"\n",
- "# Solution\n",
"\n",
"A = (b+z*y)*y\n",
"\n",
@@ -125,7 +119,6 @@
"\n",
"R = A/P\n",
"\n",
- "# from mannings eqquation\n",
"\n",
"Q = A*(1/n)*(R**(2/3)*S**(1/2))\n",
"\n",
@@ -156,19 +149,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine cross sectional area\n",
"\n",
"from __future__ import division\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"z = 1\n",
"\n",
"Q = 10000/60 # discharge of water in ft**#/s\n",
"\n",
- "# Solution\n",
"\n",
"y = (Q/(1.828*2.25*sqrt(0.5)))**(2/5)\n",
"\n",
@@ -204,13 +194,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate criticcal depth\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"y = 2.5 # depth\n",
"\n",
@@ -218,7 +206,6 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s**2\n",
"\n",
- "# Solution\n",
"\n",
"Yc = (20**2/g)**(1/3)\n",
"\n",
@@ -249,13 +236,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine normal depth, flow regine, critical depth\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"Q = 15 # flow rate in m**3/s\n",
"\n",
@@ -267,9 +252,7 @@
"\n",
"z = 0.5 # slope\n",
"\n",
- "# Solution\n",
"\n",
- "# We use a trial and error method here to find the value of y i.e. normal depth\n",
"\n",
"y = 2.22 # we take the value of y as 2.2 m\n",
"\n",
@@ -289,7 +272,6 @@
"\n",
"print \"b )F = \",round(F,2),\" Since the Froude number is less than 1, the flow is subcritical\"\n",
"\n",
- "# we use trail and error to find the value of yc for critical depth\n",
"\n",
"yc = 1.08\n",
"\n",
@@ -325,13 +307,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Height, type and length of jump and loss of energy\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"b = 60 # base width in ft\n",
"\n",
@@ -341,7 +321,6 @@
"\n",
"g = 32.2\n",
"\n",
- "# Solution\n",
"\n",
"V1 = Q/(b*y1)\n",
"\n",
@@ -394,13 +373,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine flow rate\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"d = 6 # depth of the channel\n",
"\n",
@@ -412,7 +389,6 @@
"\n",
"g = 32.2\n",
"\n",
- "# Solution\n",
"\n",
"y2 = y1 - h - 0.75\n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter11.ipynb b/Fluid_Mechanics_/Chapter11.ipynb
index 93e3588f..618f66c5 100644
--- a/Fluid_Mechanics_/Chapter11.ipynb
+++ b/Fluid_Mechanics_/Chapter11.ipynb
@@ -28,13 +28,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 11.1\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"T1 = 273 + 15 # temperature in K\n",
"\n",
@@ -42,7 +40,6 @@
"\n",
"Cp = 0.24 # cp for air in kcal/kgK\n",
"\n",
- "# Solution\n",
"\n",
"dh = Cp*(T2-T1) # enthalpy per kg of air\n",
"\n",
@@ -75,13 +72,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 11.2\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"T1 = 273 + 15 # temperature in K\n",
"\n",
@@ -95,7 +90,6 @@
"\n",
"k = 1.4 # gas constant\n",
"\n",
- "# solution\n",
"\n",
"dS = Cv*log((T2/T1)**k*(P2/P1)**(1-k))\n",
"\n",
@@ -128,7 +122,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 11.3\n",
"\n",
"from math import *\n",
"\n",
@@ -183,15 +176,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 11.4\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
- "# for water\n",
"\n",
"S =1 # specific gravity\n",
"\n",
@@ -199,7 +189,6 @@
"\n",
"bta = 2.2*10**9 # Bulk modulus of elasticity\n",
"\n",
- "# ethly alcohol\n",
"\n",
"S1 =0.79 # specific gravity\n",
"\n",
@@ -207,7 +196,6 @@
"\n",
"bta2 = 1.21*10**9 # Bulk modulus of elasticity\n",
"\n",
- "# for air\n",
"\n",
"k = 1.4 # gas constant for air\n",
"\n",
@@ -215,7 +203,6 @@
"\n",
"T = 273+20 # temperature in K\n",
"\n",
- "# Solution\n",
"\n",
"C1 = sqrt(bta/rho)\n",
"\n",
@@ -257,13 +244,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 11.5\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"P1 = 1.5 # pressure in psia\n",
"\n",
@@ -275,7 +260,6 @@
"\n",
"V1 = 1500 # velocity in ft/s\n",
"\n",
- "# Solution\n",
"\n",
"c1 = sqrt(k*R*T1)\n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter12.ipynb b/Fluid_Mechanics_/Chapter12.ipynb
index 06c84068..29dbb6ff 100644
--- a/Fluid_Mechanics_/Chapter12.ipynb
+++ b/Fluid_Mechanics_/Chapter12.ipynb
@@ -28,13 +28,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 12.1\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"Q = 0.25 # discharge from the pump in m**3/s\n",
"\n",
@@ -48,7 +46,6 @@
"\n",
"w = 2*pi*N/60 # angular velocity\n",
"\n",
- "# Solution\n",
"\n",
"Eff = gma*Q*H*100/(T*w) # efficiency\n",
"\n",
@@ -79,13 +76,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 12.2\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"d = 0.4 # diameter of the pump in m\n",
"\n",
@@ -99,7 +94,6 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s**2\n",
"\n",
- "# Solution\n",
"\n",
"w = 2*pi*N/60 # anggular velocity in rad/s\n",
"\n",
@@ -168,21 +162,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 12.3\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"d = 0.36 # diameter of the impeller of pump\n",
"\n",
"N = 1500 # Speed of impeller in RPM\n",
"\n",
- "# Solution\n",
"\n",
- "# For best efficiency\n",
"\n",
"Q1 = 82 # discharge in l/s\n",
"\n",
@@ -194,7 +184,6 @@
"\n",
"H2 = 20 # head in m\n",
"\n",
- "# Solving the simulataneous equation we get\n",
"\n",
"D2 = 38.45\n",
"\n",
@@ -230,13 +219,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 12.4\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"q = 500 # discharge in cgm\n",
"\n",
@@ -252,9 +239,7 @@
"\n",
"N = 1800 # speed in RPM\n",
"\n",
- "# Solution\n",
"\n",
- "# for water at 65 deg C\n",
"\n",
"nu = 1.134*10**-5 # viscosity in ft**2/s\n",
"\n",
@@ -304,13 +289,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 12.5 \n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"H = 60 # height in m\n",
"\n",
@@ -324,7 +307,6 @@
"\n",
"w = 9810 # specific weight\n",
"\n",
- "# Solution\n",
"\n",
"Npsh_m = sigma*60 # minimum NPSH\n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter2.ipynb b/Fluid_Mechanics_/Chapter2.ipynb
index 24cd4f37..ffb67770 100644
--- a/Fluid_Mechanics_/Chapter2.ipynb
+++ b/Fluid_Mechanics_/Chapter2.ipynb
@@ -28,11 +28,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Force applied on the piston\n",
"\n",
"from math import *\n",
"\n",
- "# Given \n",
"\n",
"d = 10 # diameter of hydraulic press in meters\n",
"\n",
@@ -44,7 +42,6 @@
"\n",
"Ar = math.pi*d**2/4 # Area of rram in m**2\n",
"\n",
- "# Solution \n",
"\n",
"p = W/Ar # pressure to be supplied by the oil in N/cm**2\n",
"\n",
@@ -78,15 +75,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Pressure in kN/m**2\n",
"\n",
- "# Given\n",
"\n",
"h = 1 # ocean depth below the surface in km\n",
"\n",
"gma = 10070 # Specific weight of sea water\n",
"\n",
- "# Solution\n",
"\n",
"P =gma*h # Pressure in kN/m**2\n",
"\n",
@@ -117,9 +111,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Pressure at the bottom of the tank\n",
"\n",
- "# Given\n",
"\n",
"p1 = 150*10**3 # Pressure at point 1 in kN/m**2\n",
"\n",
@@ -131,7 +123,6 @@
"\n",
"h1 = 2.0 # height of oil 3 in tank\n",
"\n",
- "# Solution \n",
"\n",
"p2 = (p1 + Sg*h*g)\n",
"\n",
@@ -164,9 +155,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Height of the mountain\n",
"\n",
- "# Given\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
@@ -185,7 +174,6 @@
"\n",
"r = p/Po\n",
"\n",
- "# Solution\n",
"\n",
"y = -(R*T/(g*0.19))*(1 - (r)**((n-1)/n))\n",
"\n",
@@ -216,9 +204,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Pressure in the pipe\n",
"\n",
- "# Given\n",
"\n",
"h1 = 500 # height in mm\n",
"\n",
@@ -230,7 +216,6 @@
"\n",
"w = 9810 # specific weight of water\n",
"\n",
- "# Solution\n",
"\n",
"ha = ((h2*S2)-(h1*S1))/1000\n",
"\n",
@@ -264,9 +249,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Force required to open the gate\n",
"\n",
- "# Given\n",
"\n",
"from __future__ import division\n",
"\n",
@@ -284,21 +267,16 @@
"\n",
"y1= 5+0.5\n",
"\n",
- "# Solution\n",
"\n",
"F = w*round(A,3)*(y1) # the answer will come out to be different as they have used the value of Area as 0.78 \n",
"\n",
- "# depth of the COP\n",
"\n",
"h1 = y1 + (Ig*math.sin(theta)*math.sin(theta)/(A*y1))\n",
"\n",
- "# moment about hinge A\n",
"\n",
"F1 = (F*(h1 - 5))/d\n",
"\n",
"print \"Magnitude of the force required to open the gate = \",round(F1,0),\"N\" \n",
- "#The area calculated in the book is 0.785 and that calculated from code is 0.78. \n",
- "#This difference of 0.005 is causing the answer to change from the original\n"
],
"language": "python",
"metadata": {},
@@ -325,11 +303,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# total force ; position of the center of pressure \n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"l =2 # length of the plate in m\n",
"\n",
@@ -341,7 +317,6 @@
"\n",
"w = 9810 # specific weight of water\n",
"\n",
- "# Solution\n",
"\n",
"A = 1*2\n",
"\n",
@@ -383,11 +358,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Hydrostatic force and point of location \n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"d = 6 # diameter of the gate in ft\n",
"\n",
@@ -401,7 +374,6 @@
"\n",
"F1 = p1*A\n",
"\n",
- "# Solution\n",
"\n",
"Tf = F+F1\n",
"\n",
@@ -415,7 +387,6 @@
"\n",
"print \"point of location on the center plate = \",round(H,2),\"ft\"\n",
"\n",
- "# method 2\n",
"\n",
"Hf = p1/62.4 # equivalent fluid height\n",
"\n",
@@ -456,11 +427,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Horizontal and Vertical components\n",
"\n",
"import math\n",
"\n",
- "# Given\n",
"\n",
"R = 4 # radius of the gate in ft\n",
"\n",
@@ -474,7 +443,6 @@
"\n",
"xv2 = 1.7 # distance in ft\n",
"\n",
- "# Solution \n",
"\n",
"Fh = R*y1*gma\n",
"\n",
@@ -523,13 +491,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Vertical and Horizontal components\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"p = 50 # pressure in psia\n",
"\n",
@@ -549,7 +515,6 @@
"\n",
"xv2 = 1.7 # center of pressure2 for x direction force\n",
"\n",
- "# Solution\n",
"\n",
"Fh = gma*A*y1 # hiorizontal force\n",
"\n",
@@ -600,13 +565,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Depth to which water would rise\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"l = 3 # length in m\n",
"\n",
@@ -628,7 +591,6 @@
"\n",
"gma = 9810 # specific density \n",
"\n",
- "# Solution\n",
"\n",
"Fb = Tw # since barge is floating\n",
"\n",
@@ -664,7 +626,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Level at which cylinder will float\n",
"\n",
"from math import *\n",
"\n",
@@ -672,11 +633,9 @@
"\n",
"import numpy as np\n",
"\n",
- "# Given\n",
"\n",
"W = 0.4 * 9.81 # weight of the solid cylinder in N\n",
"\n",
- "# Solution\n",
"\n",
"A = np.array([(1,-0.96),(1,1)])\n",
"\n",
@@ -723,11 +682,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Weight of the pan and the magnitude of righting moment\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"l =100 # length of the pan in cm\n",
"\n",
@@ -739,7 +696,6 @@
"\n",
"gma = 9810 # sepcific weight\n",
"\n",
- "# Solution\n",
"\n",
"Fb = gma*(d*w*l/(2*l**3)) # weight on the pan\n",
"\n",
@@ -753,7 +709,6 @@
"\n",
"x = ((X2-X1)*cos(theta*pi/180))\n",
"\n",
- "# momentum equation \n",
"\n",
"M = W*x\n",
"\n",
@@ -786,15 +741,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Metacentric height and rightning moment \n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Continued from example 2.15\n",
"\n",
- "# Given\n",
"\n",
"Io = 15*4**3/12 # moment of inertia in m**4\n",
"\n",
@@ -803,7 +755,6 @@
"Gb = ((3/2)-(2.71/2)) \n",
"\n",
"W = 1739.2 # weight of the barge from the previous example in kN\n",
- "# Solution\n",
"\n",
"Mg = (Io/V)-Gb # metacentric height in m\n",
"\n",
@@ -840,13 +791,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Maximum pressure in the tank\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"l=6 # length of the tank\n",
"\n",
@@ -864,7 +813,6 @@
"\n",
"po=0 # pressure at the origin\n",
"\n",
- "# Solution\n",
"\n",
"A = np.array([(1,-1),(1,1)])\n",
"\n",
@@ -876,7 +824,6 @@
"\n",
"Y2 = x[1]\n",
"\n",
- "# AMximum pressure at the bottom of the tank\n",
"\n",
"P = po - W*(2.61*X/9.81) - W*(1+(1.5/9.81))*(-Y2)\n",
"\n",
@@ -907,13 +854,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Height of the paraboloid revolution; maxm=imum pressure and location ; pressure at the point 0.2 from the center\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"d = 1 # diamter of the jar in ft\n",
"\n",
@@ -925,7 +870,6 @@
"\n",
"g = 32.2 # acceleration due to gravity in ft/s**2\n",
"\n",
- "# Solution\n",
"\n",
"w = 2*pi*N/60\n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter3.ipynb b/Fluid_Mechanics_/Chapter3.ipynb
index e702596e..845caa9a 100644
--- a/Fluid_Mechanics_/Chapter3.ipynb
+++ b/Fluid_Mechanics_/Chapter3.ipynb
@@ -28,19 +28,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Dimension of flow field ; velocity components at (1,2) ; magnitude and direction of velocity \n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
- "# V = 4*Xi-4Yj\n",
"\n",
"x=1 # x co-ordinate\n",
"\n",
"y=2 # y co-ordinate\n",
"\n",
- "# Solution\n",
"\n",
"print \"(a) u = 4*X; v = -4*Y \"\n",
"\n",
@@ -83,13 +79,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Discharge and mass flow rate\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"d = 0.3 # diameter of pipe in m\n",
"\n",
@@ -99,7 +93,6 @@
"\n",
"A = pi*d**2/4\n",
"\n",
- "# Solution\n",
"\n",
"Q=A*v\n",
"\n",
@@ -135,7 +128,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Mean Velocity\n",
"\n",
"from math import *\n",
"\n",
@@ -143,7 +135,6 @@
"\n",
"from scipy import integrate\n",
"\n",
- "# Given\n",
"\n",
"Vo = 10 # velocity in m/s\n",
"\n",
@@ -153,7 +144,6 @@
"\n",
"N = 1\n",
"\n",
- "# Solution\n",
"\n",
"R = lambda r: (10*r-1000*r**3)\n",
"\n",
@@ -192,7 +182,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Sketch the stream lines in the first quadrant\n",
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
@@ -204,22 +193,17 @@
"\n",
"from sympy import *\n",
"\n",
- "#init_printing(use_unicode=False, warp_line=False, no_global=True)\n",
"\n",
- "# Given\n",
"\n",
- "# V = 4*y(m)i+2(m)j\n",
"\n",
"x = Symbol('x')\n",
"U = integrate(2,x)\n",
"\n",
- "#print u\n",
"\n",
"y = Symbol('y')\n",
"\n",
"V = integrate(-4*y,y)\n",
"\n",
- "#print V\n",
"\n",
"Zhi = U + V\n",
"\n",
@@ -276,7 +260,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# magnitude and direction of flow field\n",
"\n",
"from math import *\n",
"\n",
@@ -284,13 +267,11 @@
"\n",
"import numpy as np\n",
"\n",
- "# Given\n",
"\n",
"x = 2 # X co-ordinate\n",
"\n",
"Y = 4 # Y co-ordiante\n",
"\n",
- "# Solution\n",
"y = Symbol('y')\n",
"\n",
"zhi = 4*x*y\n",
@@ -348,7 +329,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine velocity ; convective accleration\n",
"\n",
"from math import *\n",
"\n",
@@ -360,7 +340,6 @@
"\n",
"from scipy import integrate\n",
"\n",
- "# Given\n",
"\n",
"d1 = 0.09 # diameter in cm\n",
"\n",
@@ -370,7 +349,6 @@
"\n",
"mdot = 25 # mass flow rate in kg/s\n",
"\n",
- "# Solution\n",
"\n",
"x = Symbol('x')\n",
"\n",
@@ -392,7 +370,6 @@
"\n",
"V1 = vprime\n",
"\n",
- "# at x = 0.1 m we get dv/dx = 0..09\n",
"\n",
"VPrime = 0.09\n",
"\n",
@@ -426,15 +403,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Is the flow irrotational\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
- "# w = (16y-12x)i +(12y-9x)j\n",
"\n",
- "# Solution\n",
"\n",
"y = Symbol('y')\n",
"\n",
@@ -453,10 +426,7 @@
"\n",
"v = zhiprime1\n",
"\n",
- "#Vx = -9 # differentiate V wrt x\n",
"\n",
- "#Vx = -9 # differentiate V wrt x\n",
- "#Uy = 16 # differentiate U wrt y\n",
"\n",
"z = v-u\n",
"\n",
@@ -490,11 +460,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Velocity in larger section\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"d1 = 0.1 # diameter in m\n",
"\n",
@@ -502,7 +470,6 @@
"\n",
"V1 = 30 # velocity in m/s\n",
"\n",
- "# Solution\n",
"\n",
"V2 = (d1**2/d2**2)*V1\n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter4.ipynb b/Fluid_Mechanics_/Chapter4.ipynb
index 20d6f3d5..ea310eb2 100644
--- a/Fluid_Mechanics_/Chapter4.ipynb
+++ b/Fluid_Mechanics_/Chapter4.ipynb
@@ -28,13 +28,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Difference in pressure at top and bottom\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"d1 = 0.1 # diameter in m\n",
"\n",
@@ -52,7 +50,6 @@
"\n",
"g = 9.81\n",
"\n",
- "# Solution\n",
"\n",
"V1 = Q/A1 # velocity at section 1\n",
"\n",
@@ -87,13 +84,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Actual discharge\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"d = 2.5 # diameter in cm\n",
"\n",
@@ -105,7 +100,6 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s**2 \n",
"\n",
- "# Solution\n",
"\n",
"Q = Cd*A*sqrt(2*g*h)/100\n",
"\n",
@@ -137,7 +131,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Discharge through the orifice\n",
"\n",
"from __future__ import division\n",
"\n",
@@ -147,7 +140,6 @@
"\n",
"import numpy as np\n",
"\n",
- "# Given\n",
"\n",
"H1 = 3 # height in m\n",
"\n",
@@ -159,7 +151,6 @@
"\n",
"g = 9.81 # acceleration due to grvity in m/s**2\n",
"\n",
- "# Solution\n",
"\n",
"q = lambda h: h**(1/2)\n",
" \n",
@@ -194,7 +185,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# discharge through orifice\n",
" \n",
"from math import *\n",
"\n",
@@ -204,7 +194,6 @@
"\n",
"import numpy as np\n",
"\n",
- "# Given\n",
"\n",
"b = 1 # bredth of the tank\n",
"\n",
@@ -222,7 +211,6 @@
"\n",
"A = 1*0.3 # area of submerged section in m**2\n",
"\n",
- "# Solution\n",
"\n",
"q = lambda h: h**(1/2)\n",
" \n",
@@ -261,13 +249,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine flow rate of water\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"d1 = 2 # radius of pipe\n",
"\n",
@@ -283,7 +269,6 @@
"\n",
"Cd = 0.95\n",
"\n",
- "# Solution\n",
"\n",
"V2 = sqrt(21582/0.9375)\n",
"\n",
@@ -318,13 +303,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Velocity of stream point at the point of insertion\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"dx = 0.5 # in ft\n",
"\n",
@@ -332,7 +315,6 @@
"\n",
"g = 32.2 # acceleration due to gravity in ft/s**2\n",
"\n",
- "# solution\n",
"\n",
"V = sqrt(2*g*dx)\n",
"\n",
@@ -363,7 +345,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Discharge throught the system\n",
"\n",
"from math import *\n",
"\n",
@@ -379,7 +360,6 @@
"\n",
"d = 15 # diameter of the nozzle in cm\n",
"\n",
- "# Solution\n",
"\n",
"V2 = sqrt(2*g*z1/4.25)\n",
"\n",
@@ -414,14 +394,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Power input to the pump\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
"\n",
- "# Given\n",
"\n",
"Eff = 0.8 # pump efficiency\n",
"\n",
@@ -443,7 +421,6 @@
"\n",
"z1 = 30 # height in m\n",
"\n",
- "# Solution\n",
"\n",
"V1=(2/6)**2*V2\n",
"\n",
@@ -482,11 +459,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Pressure head at A and B\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"Q = 0.2 # discharge in m**3/s\n",
"\n",
@@ -504,13 +479,11 @@
"\n",
"g =9.81 # acceleration due to gravity in m/s**2\n",
"\n",
- "# Solution\n",
"\n",
"V=Q/A # Velocity of in m/s\n",
"\n",
"Hl1 = (0.02*100*V**2/(0.25*2*9.81))\n",
"\n",
- "# pressure head at A\n",
"\n",
"Pa =(z1-za-(V**2/(2*g))-Hl1)\n",
"\n",
@@ -518,7 +491,6 @@
"\n",
"print \"Elevation at height A =\",round(El,2),\"m\"\n",
"\n",
- "# pressure head at B\n",
"\n",
"hs = z3 - z1 + (0.02*(500/0.25)*(V**2/(2*g))) \n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter5.ipynb b/Fluid_Mechanics_/Chapter5.ipynb
index 92a56ea7..73c391ca 100644
--- a/Fluid_Mechanics_/Chapter5.ipynb
+++ b/Fluid_Mechanics_/Chapter5.ipynb
@@ -28,11 +28,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Resultant force on the elbow\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"Q = 0.3 # Water flow rate in m**3/s\n",
"\n",
@@ -60,13 +58,10 @@
"\n",
"theta = 45*pi/180 # angle in deg\n",
"\n",
- "# Soultion\n",
"\n",
- "# Applying the X momentum equation we get\n",
"\n",
"Rx = F1 - F2*cos(theta)-rho*Q*(V2*cos(theta)-V1)\n",
"\n",
- "# Applying the Y momentum equation\n",
"\n",
"Ry = F2*sin(theta)+rho*Q*(V2*sin(theta)-0)\n",
"\n",
@@ -104,11 +99,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Force exerted by the jet on the vane\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"V1 = 80 # Velocity in ft/s\n",
"\n",
@@ -120,21 +113,16 @@
"\n",
"a = pi/3 # angle of pipe bend\n",
"\n",
- "# Solution\n",
"\n",
"Q = A1*V1 # Total discharge in m**3\n",
"\n",
- "# Applying bernoullis at point 1 and 2\n",
"\n",
"V2 = sqrt((2*g*V1**2/(2*32.2))-3*2*g)\n",
"\n",
- "# Pressure at the end of the section are atmospheric and hence 0\n",
"\n",
- "# momentum equation in X direction\n",
"\n",
"Rx = -(rho*Q*(V2*cos(a)-80))\n",
"\n",
- "# momentum equation in Y direction\n",
"\n",
"Ry = (rho*Q*(V2*sin(a)-0))\n",
"\n",
@@ -172,9 +160,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Force needed to hold the Y position \n",
"\n",
- "# Given\n",
"\n",
"from __future__ import division\n",
"\n",
@@ -206,7 +192,6 @@
"\n",
"rho = 1000 # density in kg/m**3\n",
"\n",
- "# Solution\n",
"\n",
"V1 = Q1/A1\n",
"\n",
@@ -262,9 +247,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Normal force on the plate\n",
"\n",
- "# Given\n",
"from math import *\n",
"\n",
"d = 2 # diameter in inches\n",
@@ -279,7 +262,6 @@
"\n",
"g = 32.2 # acceleration due to gravity in ft/s**2\n",
"\n",
- "# Solution\n",
"\n",
"Rx = (gma*Q*V)/g # horizontal force required to keep plate in position\n",
"\n",
@@ -310,9 +292,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Force on the plate ; work doen per second; efficiency\n",
"\n",
- "# Given\n",
"\n",
"from math import *\n",
"\n",
@@ -326,7 +306,6 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s^2\n",
"\n",
- "# Solution\n",
"\n",
"Q =A*V # Discharge in m**3/s\n",
"\n",
@@ -373,9 +352,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Force exerted on the plate\n",
"\n",
- "# Given\n",
"from math import *\n",
"\n",
"d = 3 # diameter in inches\n",
@@ -386,7 +363,6 @@
"\n",
"rho = 1.94 # density in lbs/ft**3\n",
"\n",
- "# Solution\n",
"\n",
"V = Q/A # velocity in ft/s\n",
"\n",
@@ -428,9 +404,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Angle of blade tips at inlet and exit ; work done on the vane; efficiency of the vane\n",
"\n",
- "# Given\n",
"\n",
"from math import *\n",
"\n",
@@ -444,7 +418,6 @@
"\n",
"g = 9.81\n",
"\n",
- "# Solution\n",
"\n",
"V1x = V1*cos(alpha)\n",
"\n",
@@ -460,7 +433,6 @@
"\n",
"Vr2 = Vr1\n",
"\n",
- "# from trial and error we get the blade tip angle at inlet and outlet\n",
"\n",
"print \"a ) Angle of blade top at inlet and Outlet, Phi = 4 deg\"\n",
"\n",
@@ -505,9 +477,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Thrust on the plane; propeller efficiency ; theoretical horsepower ; pressure difference acros the blades\n",
"\n",
- "# Given\n",
"\n",
"from math import *\n",
"\n",
@@ -519,7 +489,6 @@
"\n",
"mf = 0.0022 # mass flow rate in slugs/ft**3\n",
"\n",
- "# Solution\n",
"\n",
"V1 = v*5280/3600 # velocity in ft/s\n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter6.ipynb b/Fluid_Mechanics_/Chapter6.ipynb
index c0425cb0..0eb8031a 100644
--- a/Fluid_Mechanics_/Chapter6.ipynb
+++ b/Fluid_Mechanics_/Chapter6.ipynb
@@ -28,13 +28,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Velocity of the flow\n",
"\n",
- "# Given\n",
"\n",
"L = 10 # length scale lp/l\n",
"\n",
- "# crue oil at 20 deg C\n",
"\n",
"rhop = 0.86*998.2 # density inn kg/m**3\n",
"\n",
@@ -42,13 +39,11 @@
"\n",
"Vp = 2.5 # Velocity in m/s\n",
"\n",
- "# water at 20 deg C\n",
"\n",
"rhom = 998.2 # density in kg/m**3\n",
"\n",
"mum = 1.005*10**-3 # viscosity in Ns/m**2\n",
"\n",
- "# Solution\n",
"\n",
"Vm = Vp*L*(rhop/rhom)*(mum/mup) # velocity in m/s\n",
"\n",
@@ -79,9 +74,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Mximum head on the crest and corresponding discharge for dynamically similar conditions\n",
"\n",
- "# Given\n",
"\n",
"from __future__ import division\n",
"\n",
@@ -95,7 +88,6 @@
"\n",
"L = (1/50) # length scale\n",
"\n",
- "# Solution\n",
"\n",
"Qm = 100000*(L)**(5/2) # model discharge in cfs\n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter7.ipynb b/Fluid_Mechanics_/Chapter7.ipynb
index e5a10ae6..baafd643 100644
--- a/Fluid_Mechanics_/Chapter7.ipynb
+++ b/Fluid_Mechanics_/Chapter7.ipynb
@@ -28,13 +28,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Is the flow laminar or turbulent\n",
"\n",
"from math import *\n",
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"nu1 = 0.804*10**-6 # viscosity in m**2/s\n",
"\n",
@@ -42,11 +40,9 @@
"\n",
"D = 0.02 # diameter in m/s\n",
"\n",
- "# for water \n",
"\n",
"rho = 995.7 # density in kg/m**3\n",
"\n",
- "# for gylcerine\n",
"\n",
"mu = 8620*10**-4 # viscosity in Ns/m**2\n",
"\n",
@@ -54,7 +50,6 @@
"\n",
"nu2 = mu/(S*rho) # viscosity of glycerine in Ns/m**2\n",
"\n",
- "# Solution\n",
"\n",
"R1 = V*D/nu1\n",
"\n",
@@ -101,7 +96,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Eddy Viscosity; mixing length ; turbulence constant\n",
"\n",
"from math import *\n",
"\n",
@@ -123,9 +117,7 @@
"\n",
"rho = 1000 # density in kg/m**3\n",
"\n",
- "#y = 0.3\n",
"\n",
- "# solution\n",
"\n",
"Up = diff(8.5+0.7*log(y),y)\n",
"\n",
@@ -174,7 +166,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# PLot boundary layer distribution and total drag on the plate\n",
"\n",
"from math import *\n",
"\n",
@@ -190,9 +181,7 @@
"\n",
"import matplotlib.pyplot as plt\n",
"\n",
- "# Given\n",
"\n",
- "# for glycerine\n",
"\n",
"S = 1.26 # specific gravity \n",
"\n",
@@ -204,9 +193,7 @@
"\n",
"V=1 # velocity in m/s\n",
"\n",
- "# Solution\n",
"\n",
- "# from blasius equation\n",
"\n",
"x = [0,0.1,0.5,1.0,2.0];\n",
"\n",
@@ -214,17 +201,12 @@
"\n",
"tauo = K2*rho*V**2/(sqrt(1462)*np.sqrt(x))\n",
"\n",
- "#plt.figure()\n",
"plt.plot(x, d, 'r')\n",
"plt.xlabel('x(m)')\n",
"plt.ylabel('delta(cm),tauo(N/m**2)')\n",
- "#plt.title('delta v/s x')\n",
- "#plt.legend('d')\n",
"\n",
"plt.plot(x, tauo, 'b')\n",
"plt.xlabel('x')\n",
- "#plt.ylabel('tauo(N/m**2)')\n",
- "#plt.title('tauo v/s x(m)')\n",
"plt.legend('d''t')\n",
"plt.show()\n"
],
@@ -245,7 +227,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Sketch the boundary layer and drag on the plate\n",
"\n",
"import numpy as np\n",
"\n",
@@ -257,7 +238,6 @@
"\n",
"from numpy import sqrt\n",
"\n",
- "# Given\n",
"\n",
"rho = 1.197 # air density in kg/m**3\n",
"\n",
@@ -275,7 +255,6 @@
"\n",
"l3 = 0.951 # length from 0 to 0.951\n",
"\n",
- "# Solution\n",
"\n",
"X = Rec/525576\n",
"\n",
@@ -332,7 +311,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine drag on the sphere\n",
"\n",
"from math import *\n",
"\n",
@@ -340,7 +318,6 @@
"\n",
"from __future__ import division\n",
"\n",
- "# Given\n",
"\n",
"d = 0.01 # doameter of sphere in m\n",
"\n",
@@ -352,11 +329,9 @@
"\n",
"rho = S*1000 # density\n",
"\n",
- "# Solution\n",
"\n",
"R = rho*v*d/mu\n",
"\n",
- "# for the above rho\n",
"\n",
"Cd = 35\n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter8.ipynb b/Fluid_Mechanics_/Chapter8.ipynb
index 51f3481e..6972a7f7 100644
--- a/Fluid_Mechanics_/Chapter8.ipynb
+++ b/Fluid_Mechanics_/Chapter8.ipynb
@@ -28,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine maximum velocity and shear stress\n",
"\n",
- "# Given\n",
"\n",
"from math import *\n",
"\n",
@@ -46,7 +44,6 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s**2\n",
"\n",
- "# properties of kerosene\n",
"\n",
"mu = 19.1*10**-4 # viscosity of kerosene at 20 deg C\n",
"\n",
@@ -54,17 +51,13 @@
"\n",
"rho = 1000 # density in kg/m**3\n",
"\n",
- "# Solution\n",
"\n",
- "# calculating direction of flow\n",
"\n",
"p1 = (P1+g*z*S)*1000 # point 1\n",
"\n",
"p2 = (P2)*1000 # point 2\n",
"\n",
- "# direction of flow is from point 1-2\n",
"\n",
- "# shear stress\n",
"\n",
"Sp = -((p1-p2)/sqrt(L**2+z**2))\n",
"\n",
@@ -74,19 +67,16 @@
"\n",
"print \"(a) Maximum shear stress =\",round(Tau_max,3),\"N/m**2\"\n",
"\n",
- "# maximum velocity\n",
"\n",
"Vmax = r**2*Sp/(4*mu)\n",
"\n",
"print \"(b) Maximum velocity =\",round(Vmax,3),\"m/s\"\n",
"\n",
- "# discharge\n",
"\n",
"Q = pi*r**4*Sp/(8*mu)\n",
"\n",
"print \"(c) Discharge = \",round(Q,7),\"m**3/s\"\n",
"\n",
- "# calculate reynolds number\n",
"\n",
"V = Vmax/2\n",
"\n",
@@ -122,9 +112,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the head loss\n",
"\n",
- "# Given\n",
"\n",
"d = 0.02 # diameter of the pipe in m\n",
"\n",
@@ -134,11 +122,9 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s**2\n",
"\n",
- "# for water at 5 deg C\n",
"\n",
"nu = 1.54*10**-6 # kinematic viscosity of water in m**2/s\n",
"\n",
- "# Solution\n",
"\n",
"R = v*d/nu\n",
"\n",
@@ -178,13 +164,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Horsepower required to pump 50 tons of oil\n",
"\n",
- "# Given\n",
"\n",
"from math import *\n",
"\n",
- "# oil properties\n",
"\n",
"S = 0.92 # specific gravity\n",
"\n",
@@ -198,7 +181,6 @@
"\n",
"g = 32.2 # acceleration due to gravity in ft/s**2\n",
"\n",
- "# Solution\n",
"\n",
"Q = W*2000/(gma*3600) # discharge in ft**3/s\n",
"\n",
@@ -244,9 +226,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Viscosity of the liquid in poise\n",
"\n",
- "# Given\n",
"\n",
"from math import *\n",
"\n",
@@ -268,9 +248,7 @@
"\n",
"a = pi*d1**2/4\n",
"\n",
- "# Solution\n",
"\n",
- "# From derivation we obtain a equation for T\n",
"\n",
"H2 = H1-(V/A)\n",
"\n",
@@ -303,13 +281,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Velocity distribution; Discharge ; shear on the upper plate\n",
"\n",
- "# Given\n",
"\n",
"from math import *\n",
"\n",
- "# properties of kerosene oil at 20 deg C\n",
"\n",
"S = 0.81 # specific gravity of oil\n",
"\n",
@@ -327,35 +302,27 @@
"\n",
"theta = pi/6 # angle of inclination\n",
"\n",
- "# Solution\n",
"\n",
- "# point 1\n",
"\n",
"P1 = p1*144 + gma*l*sin(theta)\n",
"\n",
- "# point 2\n",
"\n",
"P2 = p2*144\n",
"\n",
- "# flow is taking from poont 2-1\n",
"\n",
"Sp = (P2-P1)/4\n",
"\n",
- "# equation for u = 2154.75*y-359125*y**2\n",
"\n",
"y = h\n",
"\n",
- "# discharge per ft width\n",
"\n",
"q = (2154.75*y**2/2) - (359125*y**3/3)\n",
"\n",
"print \"Discharge q = \",round(q,3),\"per unit ft of the plate\"\n",
"\n",
- "# to find shear at the top of the plate take du/dy = 0\n",
"\n",
"dV = 2154.75 - 718250*h\n",
"\n",
- "# shear stress\n",
"\n",
"T = -mu*dV\n",
"\n",
diff --git a/Fluid_Mechanics_/Chapter9.ipynb b/Fluid_Mechanics_/Chapter9.ipynb
index 6c911620..503ee70d 100644
--- a/Fluid_Mechanics_/Chapter9.ipynb
+++ b/Fluid_Mechanics_/Chapter9.ipynb
@@ -28,23 +28,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine Head loss\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"S = 1.26 # specific gravity\n",
"\n",
"mu = 0.826 # kinematic viscosity in Ns/m**2\n",
"\n",
- "# for water\n",
"\n",
"rho = 998 # density of water in kg/m**3\n",
"\n",
"mu1 = 1.005*10**-3 # viscosity in Ns/m**2\n",
"\n",
- "# for glycerine\n",
"\n",
"rho1 = S*rho # density of glycerine in kg/m**3\n",
"\n",
@@ -58,7 +54,6 @@
"\n",
"l =100 # length of the pipe\n",
"\n",
- "# Solution\n",
"\n",
"V = Q/A\n",
"\n",
@@ -114,13 +109,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Discharge of water\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
- "# for water\n",
"\n",
"nu = 1.007*10**-6 # viscosity in m**2/s\n",
"\n",
@@ -136,7 +128,6 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s**2\n",
"\n",
- "# Solution\n",
"\n",
"A = sqrt(2*g*D*hf/L)\n",
"\n",
@@ -183,11 +174,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Size of the case iron\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"Q =0.1 # discharge in m**3/s\n",
"\n",
@@ -201,13 +190,11 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s**2\n",
"\n",
- "# Solution\n",
"\n",
"A = 8*L*Q**2/(hf*g*pi**2)\n",
"\n",
"B = 4*Q/(pi*nu)\n",
"\n",
- "# for D = 0.172 ; f=0.01\n",
"D = 0.172\n",
"\n",
"r = e/D\n",
@@ -216,7 +203,6 @@
"\n",
"f = 0.022 # for Re and r\n",
"\n",
- "# for D1=0.199 ; f=0.021\n",
"\n",
"D1 = 0.199\n",
"\n",
@@ -253,11 +239,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Head loss \n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"L = 500 # length of the pipe in ft\n",
"\n",
@@ -267,7 +251,6 @@
"\n",
"S = 0.004\n",
"\n",
- "# Solution\n",
"\n",
"Hf = S*L\n",
"\n",
@@ -298,11 +281,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Head loss of water\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"Q = 0.1 # water flow rate in m**3/s\n",
"\n",
@@ -314,7 +295,6 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s**2\n",
"\n",
- "# Solution\n",
"\n",
"r = log(d/e,10)\n",
"\n",
@@ -351,11 +331,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Head loss by conveyance method\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"Q = 0.1 # water flow rate in m**3/s\n",
"\n",
@@ -369,7 +347,6 @@
"\n",
"S = 5.43 \n",
"\n",
- "# Solution\n",
"\n",
"r = log(d/e,10)\n",
"\n",
@@ -404,24 +381,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Solve using the conveyence method\n",
"\n",
"from math import *\n",
"\n",
- "# given\n",
"\n",
"eps = 0.025*10**-2 # for cast iron epsilon = 0.0025 cm\n",
"\n",
- "# we get the value of K = 0.432 m**2/s\n",
- "# we need to do trial and error to find the value of D\n",
"\n",
- "# we use the value of D = 0.2 m\n",
"\n",
"D = 0.2 # value in m\n",
"\n",
"g = 9.81\n",
"\n",
- "# Solution\n",
"\n",
"K = (pi/4)*sqrt(2*g)*(2*log10(D/(eps))+1.14)*D**(2.5)\n",
"\n",
@@ -452,11 +423,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine head loss\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"d = 0.1 # diameter of the pipe\n",
"\n",
@@ -468,7 +437,6 @@
"\n",
"g = 9.81 # acceleration due to gravity in m/s**2\n",
"\n",
- "# for water\n",
"\n",
"nu = 1.007*10**-6 # viscosity in m**2/s\n",
"\n",
@@ -476,7 +444,6 @@
"\n",
"r = e/(10*d)\n",
"\n",
- "# Solution\n",
"\n",
"V = Q/A\n",
"\n",
@@ -523,13 +490,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# discharge through the pipe\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
- "# for water\n",
"\n",
"nu = 1.007*10**-6 # viscosity in m**2/s\n",
"\n",
@@ -547,7 +511,6 @@
"\n",
"f2 = 0.022 # foe e/d2\n",
"\n",
- "# Solution\n",
"\n",
"V3 = sqrt(2*g*100/((8.4*(f1)+268.85*(f2)+4.85)))\n",
"\n",
@@ -555,7 +518,6 @@
"\n",
"V2 = (d3/d2)**2*V3\n",
"\n",
- "# reynolds number for pipe BC\n",
"\n",
"R1 = V1*d1/nu\n",
"\n",
@@ -590,11 +552,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Replace the flow system\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"D = 0.2 # diameter of pipe 1\n",
"\n",
@@ -608,7 +568,6 @@
"\n",
"r = e/(100*D) \n",
"\n",
- "# Solution\n",
"\n",
"V = Q/(pi*(0.2)**2/4)\n",
"\n",
@@ -653,11 +612,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Discharge through each branch\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"e = 0.025 # in cm\n",
"\n",
@@ -671,7 +628,6 @@
"\n",
"g = 9.81\n",
"\n",
- "# Pipe 1\n",
"\n",
"r1 = e/D # r1 for pipe 1\n",
"\n",
@@ -683,7 +639,6 @@
"\n",
"hf1 = f*L1*V1**2/(2*g*D1)\n",
"\n",
- "# pipe 2\n",
"\n",
"hf2 = hf1\n",
"\n",
@@ -701,7 +656,6 @@
"\n",
"Q2 = V2*(pi*D2**2/4)\n",
"\n",
- "#pipe 3\n",
"\n",
"hf3=hf1\n",
"\n",
@@ -733,7 +687,6 @@
"\n",
"print \"Discharge through branch 3 =\",round(q3,3),\"m**3/s\"\n",
"\n",
- "# Actual head loss\n",
"\n",
"d = 0.5\n",
"\n",
@@ -777,11 +730,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find minimum depth below the ridge\n",
"\n",
"from math import *\n",
"\n",
- "# Given\n",
"\n",
"e = 0.00015 # from moody's chart\n",
"\n",
@@ -801,7 +752,6 @@
"\n",
"L = 1000 # length in ft\n",
"\n",
- "# Solution\n",
"\n",
"f = 0.011 # assume\n",
"\n",
diff --git a/Fluidization_Engineering/ch10.ipynb b/Fluidization_Engineering/ch10.ipynb
index 6cd12465..40d88cd4 100644
--- a/Fluidization_Engineering/ch10.ipynb
+++ b/Fluidization_Engineering/ch10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch10"
+ "name": "",
+ "signature": "sha256:89c91579d721ed0f833b399593203d4eb19421ab1695bc830f1be612e46bd826"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -48,7 +49,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Estimate Interchange Coefficients in Bubbling Beds\n",
+ "\n",
"from numpy import *\n",
"%pylab inline\n",
"#Variable declaration\n",
@@ -136,6 +137,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAD9CAYAAABdoNd6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtYk/fBPvA7AZSgFo0g2qpUDgKpVSlI7FSMioAi4qpO\naVdstRt2q1it21Xb/lbbXa9bZ7fqWN+O9p2tCrzalU0oihR0iHYVcHX6ioCKMktbD0QLcjQhz++P\npwQi4RAIPIHcn+vK1RyexBsr9/fJ9znJBEEQQEREg5pc6gBERNT3WPZERHaAZU9EZAdY9kREdoBl\nT0RkB1j2RER2oMuyz8/PR0BAAHx9fZGYmGh2ma1bt8LLywtBQUEoLS01Pl9XV4c1a9Zg8uTJUKlU\nOHXqlPWSExFRt3VZ9hs3bkRSUhJyc3Px7rvvoqqqyuT1wsJCnDhxAqdPn8aWLVuwZcsW42uvv/46\nJk6ciHPnzuHcuXMICAiw/k9ARERd6rTsq6urAQChoaHw9PREeHg4CgoKTJYpKCjAihUroFQqERsb\ni5KSEuNrubm5eOWVV+Ds7AxHR0e4urr2wY9ARERd6bTsi4qK4O/vb3xsbiqmsLAQKpXK+Njd3R1X\nrlxBZWUlGhsb8fzzz0OtVuOtt95CY2OjleMTEVF3OPb2AwRBgLkzLjQ2NuLixYvYsWMHwsLCEB8f\nj48//hhxc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\noaQZ2+Zs+X++e/du4fz588Lq1auFqVOnCk8++aRQUlIidUzhxIkTgkwmE6ZNm2b8t5iVlWXx75Hk\nV6oiIqK+Z7u7whARkdWw7ImI7ADLnojIDrDsiYjsAMueiMgOsOyJiOzA/wfai5Sp3wLX9AAAAABJ\nRU5ErkJggg==\n"
},
@@ -165,9 +167,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Compare the Relative Importance of Kbc and Kce\n",
"\n",
- "#Variable declaration\n",
"D=0.69; #Diffusion coefficient of gas in cm**2/s\n",
"umf=1.0; #Velocity at minimum fluidization condition in cm/s\n",
"ephsilonmf=0.5; #Void fraction at minimum fluidization condition\n",
@@ -231,9 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Compare Interchange Rates for Adsorbed and Nonadsorbed Gases\n",
"\n",
- "#Variable declaration\n",
"Kbe=[0.028,0.05]; #Reported range for gas interchange coefficient between bubble and emulsion\n",
"uo=0.30; #Superficial gas velocity in m/s\n",
"db=0.13; #Equilibrium bubble size in m\n",
diff --git a/Fluidization_Engineering/ch11.ipynb b/Fluidization_Engineering/ch11.ipynb
index b665def9..4c2d2fd3 100644
--- a/Fluidization_Engineering/ch11.ipynb
+++ b/Fluidization_Engineering/ch11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:69d28aca1d8ec525f15842df275d6e6c6108139c968df651029692a500222ce7"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -48,9 +49,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Fitting Reported Mass Transfer Data with the Bubbling Bed Model\n",
"\n",
- "#Variable declaration\n",
"db=0.37; #Equilibrium bubble size in cm\n",
"dp=0.028; #Particle size in cm\n",
"rhos=1.06; #Density of solids in g/cc\n",
@@ -202,9 +201,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Fitting Reported Heat Transfer Data with the Bubbling Bed Model\n",
"\n",
- "#Variable declaration\n",
"rhos=1.3; #Density of solids in g/cc\n",
"phis=0.806; #Sphericity of solids\n",
"gammab=0.001; #Ratio of volume of dispersed solids to that of bubble phase\n",
@@ -293,7 +290,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Heating a Particle in a Fluidized Bed\n",
+ "\n",
"\n",
"import math\n",
"\n",
diff --git a/Fluidization_Engineering/ch12.ipynb b/Fluidization_Engineering/ch12.ipynb
index d49e64ff..1fc80a09 100644
--- a/Fluidization_Engineering/ch12.ipynb
+++ b/Fluidization_Engineering/ch12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch12"
+ "name": "",
+ "signature": "sha256:3cabb972e9b40cc3c2621280c95233b4046eb8d671e52d74d499a7e149a3d9aa"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Fine Particle (Geldart A) Bubbling Bed Reactor\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -93,7 +94,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Commercial-Sized Phthalic Anhydride Reactor\n",
"\n",
"import math\n",
"\n",
@@ -181,7 +181,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Bubbling Bed Reactor for Intermediate Sized Reactor\n",
"\n",
"import math\n",
"\n",
@@ -260,7 +259,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Reaction in the Slow Bubble Regime\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -315,7 +314,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Conversion in the Freeboard of a Reactor\n",
+ "\n",
"\n",
"import math\n",
"\n",
diff --git a/Fluidization_Engineering/ch13.ipynb b/Fluidization_Engineering/ch13.ipynb
index 06efb739..18536015 100644
--- a/Fluidization_Engineering/ch13.ipynb
+++ b/Fluidization_Engineering/ch13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch13"
+ "name": "",
+ "signature": "sha256:a97460b196d7b42e945dcfefc11684cc1c39c5847f8b0bdc9e3f6cdcd94bfcc3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#h on a Horizontal Tube Bank\n",
"\n",
- "#Variable declaration\n",
"dp=57.0; #Particle size in micrometer\n",
"rhos=940.0; #Density of solids in kg/m**3\n",
"Cps=828.0; #Specific heat capacity of the solid in J/kg K\n",
@@ -103,9 +102,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Effect of Gas Properties on h\n",
"\n",
- "#Variable declaration\n",
"dp=80.; #Particle size in micrometer\n",
"rhos=2550.; #Density of solids in kg/m**3\n",
"Cps=756.; #Specific heat capacity of the solid in J/kg K\n",
@@ -172,9 +169,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Effect of Particle Size on h\n",
"\n",
- "#Variable declaration\n",
"rhos=2700.; #Density of solids in kg/m**3\n",
"Cps=755.; #Specific heat capacity of the solid in J/kg K\n",
"ks=1.2; #Thermal conductivity of solids in W/m k\n",
@@ -237,7 +232,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Freeboard Heat Exchange\n",
+ "\n",
"\n",
"import math\n",
"\n",
diff --git a/Fluidization_Engineering/ch14.ipynb b/Fluidization_Engineering/ch14.ipynb
index 1367f2cc..c3aead0d 100644
--- a/Fluidization_Engineering/ch14.ipynb
+++ b/Fluidization_Engineering/ch14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:a7839feeb371e4231dbf99a0d3738674ff633956f5fb373aea54d56b513c13f8"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -86,7 +87,6 @@
"collapsed": false,
"input": [
"\n",
- "#Flow with Elutriation and Change in Density of Solids\n",
"\n",
"\n",
"import math\n",
@@ -233,9 +233,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Single-Size Feed of Shrinking Particles\n",
"\n",
- "#Variable declaration\n",
"dp=1; #Particle size in mm\n",
"Fo=10; #Feed rate in kg/min\n",
"k=0.1; #Particle shrinkage rate in mm/min\n",
@@ -272,7 +270,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Wide Size Distribution of Shrinking Particle\n",
"\n",
"#Variable declaration\n",
"dpi=[1.05,0.95,0.85,0.75,0.65,0.55,0.45,0.35,0.25,0.15,0.05]; #Mean size in mm\n",
@@ -326,7 +323,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Elutriation and Attrition of Catalyst\n",
+ "\n",
"\n",
"import math\n",
"\n",
diff --git a/Fluidization_Engineering/ch15.ipynb b/Fluidization_Engineering/ch15.ipynb
index 77a4d951..09c02451 100644
--- a/Fluidization_Engineering/ch15.ipynb
+++ b/Fluidization_Engineering/ch15.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch15"
+ "name": "",
+ "signature": "sha256:b0605e72f5da8476b3859cf3dc90196dcbe80cabc58b8c8d37cf5b28482c7ee1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Circulation Rate when Deactivation Controls\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -73,7 +74,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Circulation Rate when Heat Duty Controls\n",
"\n",
"#Variable declaration\n",
"deltaHr1=1260.; #Enthalpy change during endothermic reaction in kJ/kg\n",
@@ -161,9 +161,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Aeration of Fine Particle Downcomer\n",
"\n",
- "#Variable declaration\n",
"Fs=100.; #Solid flowrate in kg/s\n",
"ephsilon1=0.55;\n",
"ephsilon2=0.5;\n",
@@ -216,7 +214,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Circulation in Side-by-Side Beds\n",
+ "\n",
"\n",
"import math\n",
"\n",
diff --git a/Fluidization_Engineering/ch16.ipynb b/Fluidization_Engineering/ch16.ipynb
index 1ad8955d..e835e890 100644
--- a/Fluidization_Engineering/ch16.ipynb
+++ b/Fluidization_Engineering/ch16.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:1a37ab741ccda7f67c7de1085d3807de9fa5a11a3111916ad9502a04f1c58721"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Single-Stage Limestone Calciner\n",
"\n",
- "#Variable Declaration\n",
"T=1000.; #Operating temperature of calciner in degree celcius\n",
"deltaHr=1795.; #Heat of reaction in kJ/kg\n",
"M1=0.1; #Molecular weight of Calcium carbonate in kg/mol\n",
@@ -192,9 +191,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Multistage Adsorber\n",
"\n",
- "#INPUT\n",
"T=20; #Temeprature in degree C\n",
"M=0.018; #Molecular weight of water in kg/mol\n",
"Q=10; #Flow rate of dry air in m**3/s\n",
@@ -324,7 +321,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Solvent Recovery from Polymer Particles\n",
+ "\n",
"\n",
"import math\n",
"\n",
diff --git a/Fluidization_Engineering/ch17.ipynb b/Fluidization_Engineering/ch17.ipynb
index a51249d4..77951e94 100644
--- a/Fluidization_Engineering/ch17.ipynb
+++ b/Fluidization_Engineering/ch17.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch17"
+ "name": "",
+ "signature": "sha256:82e0373b19da96ab8fd50304caf9cd3e08cf8bad10412b0998bf9110f7a5ae63"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Reactor Development Program\n",
"\n",
- "#Variable Declaration\n",
"dt=[0.081,0.205,3.6]; #Reactor diameter for the three reactors in m\n",
"dte=[0.04,0.12,0.70]; #Equivalent diameters for the three reactors in m\n",
"db=[0.05,0.057,0.07]; #Estimated bubble size in the three reactors in m\n",
@@ -201,9 +200,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Design of a Commercial Acrylonitrile Reactor\n",
"\n",
- "#Variable Declaration\n",
"deltaHr=5.15E8; #Heat of reaction in J/k mol\n",
"W=5E4; #Weight of acrylonitirle produced per 334-day year in tonnes\n",
"db=0.07; #Estimated bubble size in m\n",
@@ -287,9 +284,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Reactor-Regenerator with Circulating Catalyst: Catalytic Cracking\n",
"\n",
- "#Variable Declaration\n",
"db=0.08; #Estimated bubble size in m\n",
"dte=2; #Equivalent diameter in m\n",
"F1=55.6; #Feed rate of oil in kg/s\n",
diff --git a/Fluidization_Engineering/ch18.ipynb b/Fluidization_Engineering/ch18.ipynb
index 6826590f..281bc4a5 100644
--- a/Fluidization_Engineering/ch18.ipynb
+++ b/Fluidization_Engineering/ch18.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:3eba5bf9f8e98dcb46f4a3b03f9f7fa4b342f8fb2d0d8b697e9a50303c32aa8f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Kinetics of Zinc Blende Roasting\n",
"\n",
- "#Variable Declaration\n",
"xA=0.08; #Fraction of oxygen in stream\n",
"dp=[2,0.1]; #Particle diameter in mm\n",
"rhos=4130; #Density of catalyst in kg/m**3\n",
@@ -88,9 +87,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Kinetics of Carbon Burning\n",
"\n",
- "#Variable Declaration\n",
"xA=0.08; #Fraction of oxygen in stream\n",
"dp=1; #Particle diameter in mm\n",
"rhos=2200; #Density of catalyst in kg/m**3\n",
diff --git a/Fluidization_Engineering/ch3.ipynb b/Fluidization_Engineering/ch3.ipynb
index cd21b1dd..72abab33 100644
--- a/Fluidization_Engineering/ch3.ipynb
+++ b/Fluidization_Engineering/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch3"
+ "name": "",
+ "signature": "sha256:c2d23a740208e3823c43d8afcfc0ef305894f28fcd5f9e9793f1f1c6fe8b25f1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Size Measure of Nonuniform Solids\n",
"\n",
- "#INPUT\n",
"weight = [0,60,150,270,330,360.0]; # Weight in grams for the oversized particles\n",
"psize = [50,75,100,125,150,175]; #PSD in micrometers\n",
"\n",
@@ -140,9 +139,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Estimation of terminal velocity of falling particles\n",
"\n",
- "#INPUT\n",
"rhog=1.2e-3; #Density of air in g/cc\n",
"myu=1.8e-4 #Viscosity of air in g/cm s\n",
"dpbar=0.016 #Mean diameter of solids in centimeter\n",
@@ -189,9 +186,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Prediction of flow regime\n",
"\n",
- "#INPUT\n",
"rhos=1.5; #Density of Solid in g/cc\n",
"uo1=40; uo2=80; #Superficial gas velocity in cm/s\n",
"dp1=0.006; dp2=0.045; #Particle size in centimeter\n",
diff --git a/Fluidization_Engineering/ch4.ipynb b/Fluidization_Engineering/ch4.ipynb
index 3ff36672..cbd2e1e4 100644
--- a/Fluidization_Engineering/ch4.ipynb
+++ b/Fluidization_Engineering/ch4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:66650a76faf5eec3efd8e3c62ecb57addf32e1a6b2cb5d90995ca785777b9427"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "Design of a Perforated Plate Distributor\n",
+ "\n",
"\n",
"#Variable declaration\n",
"dt=4; #Vessel diameter in m\n",
@@ -137,9 +138,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Design of a Tuyere Distributor\n",
"\n",
- "#Variable declaration\n",
"lor=0.1; #Minimum allowable tuyere spacing in m\n",
"uorm=30; #Maximum allowable jet velocity from the tuyere in m/s\n",
"uo=0.4; #Superficial velocity of gas in m/s\n",
@@ -218,9 +217,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Power Requirement for a Fluidized Coal Combustor(FBC)\n",
"\n",
- "#Variable declaration\n",
"deltapd=[3,10] #Distributor pressure drop in kPa\n",
"deltapd2=10.0; #Distributor pressure drop in kPa\n",
"po=101.0; #Entering air pressure in kPa\n",
diff --git a/Fluidization_Engineering/ch5.ipynb b/Fluidization_Engineering/ch5.ipynb
index 4fb61904..791c6af2 100644
--- a/Fluidization_Engineering/ch5.ipynb
+++ b/Fluidization_Engineering/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch5"
+ "name": "",
+ "signature": "sha256:502044f71f0f4f73ada9ff3f4a68fa509018810bcbdaf16eaa17d381758e9755"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Charactersitics of a Single Bubble\n",
"\n",
- "#Variable declaration\n",
"dt=60.0; #ID of tube in cm \n",
"dp=300; #Size of particles of bed in micrometers\n",
"umf=3; #Velocity at minimum fluidization condition in cm/s\n",
@@ -82,7 +81,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Initial Bubble Size at a Distributor\n",
+ "\n",
"\n",
"import math\n",
"\n",
diff --git a/Fluidization_Engineering/ch6.ipynb b/Fluidization_Engineering/ch6.ipynb
index 39b1fc56..9c4f2311 100644
--- a/Fluidization_Engineering/ch6.ipynb
+++ b/Fluidization_Engineering/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:432c74872bfc5b3cdf6cd2ab6c97c0ab1581b40f382e3a1bf8502ef1c3f981bb"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Bubble Size and Rise Velocity in Geldart A Beds\n",
"\n",
- "#Variable declaration\n",
"z=0.5; #Height of bed in m\n",
"dt=0.5; #ID of tube in m\n",
"rhos=1.6; #Density of catalyst in g/cm**3\n",
@@ -88,7 +87,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Bubble Size and Rise Velocity in Geldart B Beds\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -214,9 +213,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Scale-down of a Commercial Chlorinator\n",
"\n",
- "#Variable declaration\n",
"dpbar=53.; #Average particle size in micrometer\n",
"s=[1,2]; #Size of Bermuda rock in cm \n",
"rhosbar=3200.; #Average solid density of the coke-zircon mixture in kg/m**3\n",
@@ -272,7 +269,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Reactor Scale-up for Geldart A Catalyst\n",
+ "\n",
"import math\n",
"\n",
"#Variable declaration\n",
@@ -442,9 +439,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Reactor Scale-up for Geldart B Catalyst\n",
"\n",
- "#Variable declaration\n",
"dtb=20; #ID of bench-scale reactor\n",
"dtp=1; #ID of pilot reactor\n",
"dpbar=200; #Average particle size in micrometer\n",
diff --git a/Fluidization_Engineering/ch7.ipynb b/Fluidization_Engineering/ch7.ipynb
index d666d2ab..aafc2f66 100644
--- a/Fluidization_Engineering/ch7.ipynb
+++ b/Fluidization_Engineering/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:8eb00dc3983a05f0d88bd9a81e8b022860563cdbf1df8dacf4157210feb1c3ce"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Entrainment from Fine Particle Beds with High Freeboard\n",
"\n",
- "#Variable declaration\n",
+ "\n",
"rhog=5.51; #Density of gas in kg/m**3\n",
"rhos=1200; #Density of solid in kg/m**3\n",
"dpbar=130; #Average size of particles in micrometer\n",
@@ -72,9 +72,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Entrainment from Large Particle Beds with High Freeboard\n",
"\n",
- "#Variable declaration\n",
"x=0.2; #Fraction of fines in the bed\n",
"Gsstar=4.033320 #Rate of entrainment in kg/m**2s(from Exa.1)\n",
"\n",
@@ -110,9 +108,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Entrainment from Beds with a Wide Size Distribution of Solids\n",
"\n",
- "#Variable declaration\n",
"rhog=5.51; #Density of gas in kg/m**3\n",
"rhos=1200; #Density of solid in kg/m**3\n",
"uo=0.61; #Superficial gas velocity in m/s\n",
@@ -176,9 +172,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#k* from Steady State Experiments\n",
"\n",
- "#Variable declaration\n",
"dp=[40,60,80,100,120]; #Diameter of particle in micrometer\n",
"uo=0.381; #Superficial gas velocity in m/s\n",
"\n",
@@ -242,7 +236,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Comparing Predictions for k*\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -349,7 +343,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Entrainment from a Short Vessel Ht<TDH\n",
+ "\n",
"import math\n",
"\n",
"#Variable declaration\n",
diff --git a/Fluidization_Engineering/ch9.ipynb b/Fluidization_Engineering/ch9.ipynb
index f17e97e9..5087d780 100644
--- a/Fluidization_Engineering/ch9.ipynb
+++ b/Fluidization_Engineering/ch9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch9"
+ "name": "",
+ "signature": "sha256:52ff353152f32e41c2e832a90f993fbd3f11b7f2a5fbb5e4f20eb7599a61f880"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Vertical Movement of Solids\n",
"\n",
- "#Variable declaration\n",
"umf=0.015; #Velocity at minimum fluidization condition in m/s\n",
"ephsilonmf=0.5; #Void fraction at minimum fluidization condition\n",
"uo=0.1; #Superficial gas velocity in m/s\n",
@@ -100,9 +99,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Horizontal Drift Of Solids\n",
"\n",
- "#Variable declaration\n",
"Lmf=0.83; #Length of bed at minimum fluidization condition in m\n",
"dp=450.0; #Average particle size in micrometer\n",
"ephsilonmf=0.42; #Void fraction at minimum fluidization condition\n",
@@ -194,7 +191,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Design of Baffle Plates\n",
+ "\n",
"\n",
"import math\n",
"\n",
diff --git a/Fundamental_of_Electronics_Devices/Ch1.ipynb b/Fundamental_of_Electronics_Devices/Ch1.ipynb
index 34ecc51b..78c644f7 100644
--- a/Fundamental_of_Electronics_Devices/Ch1.ipynb
+++ b/Fundamental_of_Electronics_Devices/Ch1.ipynb
@@ -27,17 +27,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.1\n",
- "#Find the miller indices for a plane.\n",
"\n",
- "#Given\n",
- "#Length of intercept\n",
"l1=2.0\n",
"l2=3.0\n",
"l3=2.0\n",
"\n",
- "#Calcuation\n",
- "#reciprocal of intercept\n",
"r1=1/l1\n",
"r2=1/l2\n",
"r3=1/l3\n",
@@ -45,7 +39,6 @@
"m2=6*r2\n",
"m3=6*r3\n",
"\n",
- "#Result\n",
"print\"Miller indices of the given plane are\",m1,m2,m3\n"
],
"language": "python",
@@ -73,17 +66,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.2\n",
- "#Find the miller indices for a plane.\n",
"\n",
- "#Given\n",
- "#Length of intercept\n",
"l1=1.0\n",
"l2=2.0\n",
"l3=0\n",
"\n",
- "#Calcuation\n",
- "#reciprocal of intercept\n",
"r1=1/l1\n",
"r2=1/l2\n",
"r3=0\n",
@@ -91,7 +78,6 @@
"m2=2*r2\n",
"m3=2*r3\n",
"\n",
- "#Result\n",
"print\"Miller indices of the given plane are\",m1,m2,m3\n"
],
"language": "python",
@@ -119,19 +105,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.3\n",
- "#Obtain lattice constant and radius of the atom.\n",
"\n",
- "#Given\n",
"V=3*(10**22) #kg/m**3, density of SCC lattice\n",
"p=(1/3.0)*10**-22\n",
"\n",
- "#Calculation\n",
"n=1 #no. of lattice point \n",
"a=(n*p)**(1/3.0) #lattice constant\n",
"r=(a*10**8/2)\n",
"\n",
- "#Result\n",
"print\"Lattice constant is\",round(a*10**8,2),\"A\"\n",
"print\"radius of simple lattice is\",round(r,2),\"A\""
],
@@ -161,26 +142,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exampe 1.4\n",
- "#Determine the density of crystal\n",
"\n",
- "#given data\n",
"import math\n",
"r=1.278 #in Angstrum\n",
"AtomicWeight=63.5 #constant\n",
"AvogadroNo=6.023*10**23 #constant\n",
"\n",
- "#Calculation\n",
- "#For FCC structure a=4*r/math.sqrt(2)\n",
"a=4*r*10**-10/math.sqrt(2) #in meter\n",
"V=a**3 #in meter**3\n",
- "#mass of one atom = m\n",
"m=AtomicWeight/AvogadroNo #in gm\n",
"m=m/1000 #in Kg\n",
"n=4 # no. of atoms per unit cell for FCC structure\n",
"rho=m*n/V #in Kg/m**3\n",
"\n",
- "#Result\n",
"print \"Density of crystal is\",round(rho,2),\"Kg/m**3\""
],
"language": "python",
@@ -208,15 +182,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.5\n",
- "#What is Density of silicon crystal .\n",
"\n",
- "#given data\n",
"n=4 # no. of atoms per unit cell of silicon\n",
"AtomicWeight=28 #constant\n",
"AvogadroNo=6.021*10**23 #constant\n",
"\n",
- "#calculation\n",
"m=AtomicWeight/AvogadroNo #in gm\n",
"m=m/1000 #in Kg\n",
"a=5.3 #lattice constant in Angstrum\n",
@@ -224,7 +194,6 @@
"V=a**3 #in meter**3\n",
"rho=m*n/V #in Kg/m**3\n",
"\n",
- "#result\n",
"print\"Density of silicon crystal is\",round(rho,0),\"Kg/m**3\""
],
"language": "python",
@@ -252,18 +221,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.5\n",
- "#What is Surface density in FCC .\n",
"\n",
- "#given data\n",
"a=4.75 #lattice constant in Angstrum\n",
"a=a*10**-10 #in meter\n",
"\n",
- "#Calculation\n",
"dp=2.31/a**2 #in atom/m**2\n",
"dp=dp/10**6 #in atom/mm**2\n",
"\n",
- "#Result\n",
"print \"Surface density in FCC on (111)Plane is %.e\",dp,\"atoms/mm**2\""
],
"language": "python",
@@ -291,19 +255,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.7\n",
- "#find the Interpolar distance\n",
"\n",
- "#given data\n",
"import math\n",
"l=1.539 #in Angstrum\n",
"theta=22.5 #in degree\n",
"n=1 #order unitless\n",
"\n",
- "#Calculation\n",
"d=n*l/(2*math.sin(theta*math.pi/180)) #in Angstrum\n",
"\n",
- "#result\n",
"print \"Interpolar distance in Angstrum \",round(d,2),\"A\""
],
"language": "python",
@@ -331,20 +290,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 1.8\n",
- "#Find the wavelength of X-rays \n",
"\n",
- "#given data\n",
"import math\n",
"\n",
"theta=16.8/2.0 #in degree\n",
"n=2.0 #order unitless\n",
"d=0.4 #in nm\n",
"\n",
- "#Calculation\n",
"l=(2*d*10**-9*sin(theta*math.pi/180.0))/n #in Angstrum\n",
"\n",
- "#result\n",
"print \"wavelength of X-rays in Angstrum \",round(l*10**10,3),\"A\"\n"
],
"language": "python",
diff --git a/Fundamental_of_Electronics_Devices/Ch2.ipynb b/Fundamental_of_Electronics_Devices/Ch2.ipynb
index 0b7d4443..b52ed808 100644
--- a/Fundamental_of_Electronics_Devices/Ch2.ipynb
+++ b/Fundamental_of_Electronics_Devices/Ch2.ipynb
@@ -27,21 +27,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.1\n",
- "#Find probability of an electronic state\n",
"\n",
- "#Given\n",
"dE1=0.1 #eV\n",
"dE2=-0.1 #eV\n",
"k=8.61*10**-5 #Boltzman constant\n",
"T=300 #K\n",
"\n",
- "#Calcualtion\n",
"import math\n",
"FE1=1/(1+math.exp(dE1/(k*T)))\n",
"FE2=1/(1+math.exp(dE2/(k*T)))\n",
"\n",
- "#Result\n",
"print\"Probability when the energy of the state is above 0.1 eV\",round(FE1,2)\n",
"print\"Probability when the energy of the state is below 0.1 eV\",round(FE2,2)"
],
@@ -71,20 +66,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculate the temprature at which there is 1 percent probability\n",
- "#that a state of 0.30 eV below the fermi energy level will not contain electrons.\n",
"\n",
- "#Exa 2.2\n",
"Ef=6.25 #EV fermi energy level\n",
"dE=-0.30 #eV\n",
"k=8.61*10**-5 #Boltzman constant\n",
"fE=0.99\n",
"\n",
- "#calculation\n",
- "#From the probability formula fE=1/(1+math.exp(dE/(k*T)))\n",
"T=(dE)/(k*math.log(1/fE-1))\n",
"\n",
- "#result\n",
"print\"The Temprature is\",round(T,1),\"K\" "
],
"language": "python",
@@ -112,22 +101,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.3\n",
- "#Determine the fraction of total no. of electron\n",
"\n",
- "#Given\n",
"Eg=0.72 #eV\n",
"Ef=0.5*Eg\n",
"dE=Eg-Ef #eV\n",
"k=8.61*10**-5 #Boltzman constant\n",
"T=300 #K\n",
"\n",
- "#Calcualtion\n",
"import math\n",
"N=1/(1+math.exp(dE/(k*T)))\n",
"\n",
"\n",
- "#Result\n",
"print\"the fraction of total no. of electron is \",round(N,9)"
],
"language": "python",
@@ -155,19 +139,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.4\n",
- "#Calculate the wave length\n",
"\n",
- "#Given\n",
"E=300*1.602*10**-19 #eV Energy\n",
"m=9.108*10**-31 #kg, mass of electron\n",
"h=6.626*10**-34 #Planck constant\n",
"\n",
- "#Calculation\n",
"v=math.sqrt(2*E/m)\n",
"lam=h*v/E\n",
"\n",
- "#Result\n",
"print\"The wavwlength is\",round(lam*10**10,3),\"A\"\n",
"\n",
"\n"
@@ -197,19 +176,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 2.5\n",
- "#Find the ratio of electron to hole concentration ratio\n",
"\n",
- "#given data\n",
"ni=1.4*10**18\t\t\t#in atoms/m**3\n",
"Nd=1.4*10**24\t\t\t#in atoms/m**3\n",
"n=Nd\t\t\t\t#in atoms/m**3\n",
"\n",
- "#Calculation\n",
"p=ni**2/n\t\t\t#in atoms/m**3\n",
"ratio=n/p\t\t\t#unitless\n",
"\n",
- "#Result\n",
"print\"Ratio of electron to hole concentration : \",round(ratio,2)"
],
"language": "python",
@@ -237,19 +211,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.7\n",
- "#Calculate the magnitude of current\n",
"\n",
- "#Given\n",
"n=10**24 #Electron density\n",
"e=1.6*10**-19 #Electron charge\n",
"v=0.015 #m/s drift velocity\n",
"A=10**-4 #m**2 area\n",
"\n",
- "#Calculation\n",
"I=n*e*v/A\n",
"\n",
- "#Result\n",
"print\"The magnitude of current is\",round(I/10**8,2),\"A\""
],
"language": "python",
@@ -277,24 +246,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 2.8\n",
- "#calculate (i) Relaxation time (ii)Resistivity of conductor (iii) velocity of electron \n",
"\n",
- "#given data\n",
"Ef=5.5\t\t\t#in eV\n",
"MUe=7.04*10**-3\t\t#in m**2/V-s\n",
"n=5.8*10**28\t\t#in m**-3\n",
"e=1.6*10**-19\t\t#constant\n",
"m=9.1*10**-31\t\t#in Kg\n",
"\n",
- "#calculation\n",
- "#part (i)\n",
"import math\n",
"tau=MUe*m/e\t\t#in sec\n",
"rho=1/(n*e*MUe)\t\t#in ohm-m\n",
"vF=math.sqrt(2*Ef*1.6*10**-19/m)\n",
"\n",
- "#Result\n",
"print\"Relaxation time in sec : \",tau,\"s\"\n",
"print\"Resistivity of conductor in ohm-m : \",round(rho,11),\"ohm m\"\n",
"print\"velocity of electron with fermi energy is \",round(vF,0),\"m/s\""
@@ -326,20 +289,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.9\n",
- "#Find (i)the valence electrons per unit volume (ii) mobility\n",
"\n",
- "#Given\n",
"rho=1.73*10**-8 #resistivity\n",
"Tav=2.42*10**-14 #Average Time\n",
"e=1.6*10**-19\t\t#constant\n",
"m=9.1*10**-31\t\t#in Kg\n",
"\n",
- "#Calculation\n",
"n=m/(e**2*Tav*rho)\n",
"mu=(e*Tav)/m\n",
"\n",
- "#Result\n",
"print\"NO. of free electrons are\",round(n,-26)\n",
"print\"mobility of electrons is\",round(mu,3),\"m**2/Vs\"\n",
"\n"
@@ -370,8 +328,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.10\n",
- "#calculate Relaxation time and drift velocity\n",
"\n",
"Ef=100\t\t\t#in V/m Applied electric field\n",
"n=6*10**28\t\t#in m**-3\n",
@@ -379,12 +335,10 @@
"m=9.1*10**-31\t\t#in Kg mass of electron\n",
"rho=1.5*10**-8 #Density\n",
"\n",
- "#calculation\n",
"import math\n",
"tau=m/(n*e**2*rho)\t\t#in sec\n",
"vF=e*Ef*tau/m\n",
"\n",
- "#Result\n",
"print\"Relaxation time in sec : \",round(tau,16),\"s\"\n",
"print\"velocity of electron with fermi energy is \",round(vF,1),\"m/s\"\n"
],
@@ -414,10 +368,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exampl 2.11\n",
- "#Determine charge density, current density ,Current flowing in the wire, Electron drift velocity\n",
"\n",
- "#Given\n",
"d=0.002 #m, diameter of pipe\n",
"s=5.8*10**7 #Conductivity S/m\n",
"mu=0.0032 #m**2/Vs, Electron mobility\n",
@@ -425,15 +376,12 @@
"m=9.1*10**-31\t\t#in Kg mass of electron\n",
"E=0.02 #V/m Electric field\n",
"\n",
- "#Calculation\n",
"import math\n",
- "#From eq 2.62\n",
"n=s/(e*mu)\n",
"J=s*E\n",
"I=J*(math.pi*d**2/4.0)\n",
"v=mu*E\n",
"\n",
- "#Result\n",
"print\"Charge density is\",round(n,-26),\"m**-3\"\n",
"print\"current density is\",round(J,6),\"A/m**2\"\n",
"print\"curret flowing is\",round(I,3),\"A\"\n",
@@ -467,20 +415,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 2.12\n",
- "#calculate the drift velocity and time\n",
"\n",
- "#Given\n",
"rho=0.5 #ohm-m Resistivity\n",
"J=100 #A/m**2 Current density\n",
"mue=0.4 #m**2/Vs Electron mobility\n",
"d=10*10**-6 #m distance\n",
"\n",
- "#calculation\n",
"Ve=mue*J*rho\n",
"t=d/Ve\n",
"\n",
- "#Result\n",
"print\"The drift velocity is \",Ve,\"m/s\"\n",
"print\"Time taken by the electron is\",round(t,8),\"s\""
],
@@ -510,22 +453,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.13\n",
- "#Calculate drift velocity and time\n",
"\n",
- "#Given\n",
"e=1.6*10**-19\t\t#constant electronic charge\n",
"m=9.1*10**-31\t\t#in Kg mass of electron\n",
"rho=0.039 #ohm-cm resistivity\n",
"mu=3600 #cm**2/Vs Carrier mobility\n",
"ni=2.5*10**13\n",
"\n",
- "#Calculation \n",
"Nd=(1/(rho*e*mu))\n",
"n=Nd\n",
"p=(ni**2/n)\n",
"\n",
- "#Result\n",
"print\"Concentration of electron is\",round(n,-14),\"/cm**3\"\n",
"print\"Concentration of holes is\",round(p,0),\"/cm**3\"\n"
],
@@ -555,10 +493,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.14\n",
- "#Determine concentration of holes and electrons\n",
"\n",
- "#Given\n",
"rho=5.32 #kg/m**3, density\n",
"Aw=72.6 #kg/K kmol atomic weight\n",
"ni=2.5*10**13\n",
@@ -567,14 +502,12 @@
"mue=0.38 #m**/Vs\n",
"muh=0.18 #m**/Vs\n",
"\n",
- "#CAlculation\n",
"N=6.023*10**23*rho/Aw #No 0f germanium atoms per cm**3\n",
"Nd=N/di\n",
"n=Nd\n",
"p=(ni**2/n)\n",
"s=n*e*mue*10**4\n",
"\n",
- "#Result\n",
"print\"Concentration of electrons is\",round(n,-12),\"atoms/cm**3\"\n",
"print\"Concentration of holes is\",round(p,-10),\"atoms/cm**3\"\n",
"\n",
@@ -614,23 +547,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.15\n",
- "#Calculate the density and drift velocity\n",
"\n",
- "#Given\n",
"e=1.6*10**-19 #Electronic charge\n",
"mue=0.39 #m**/Vs\n",
"muh=0.19 #m**/Vs\n",
"rhoi=0.47 #ohm-m, intrinsic resistivity\n",
"E=10**4 #Electric field\n",
"\n",
- "#Calculation\n",
"sigmai=1/rhoi\n",
"ni=sigmai/(e*(mue+muh))\n",
"Vn=mue*E\n",
"Vh=muh*E\n",
"\n",
- "#Result\n",
"print\"Density of electrons is\",round(ni,-17),\"/m**3\"\n",
"print\"Drift velocity for electrons\",round(Vn,0),\"m/s\"\n",
"print\"Drift velocity for holes\",round(Vh,0),\"m/s\""
@@ -662,10 +590,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.16\n",
- "#Calculate conductivity\n",
"\n",
- "#Given\n",
"i=10**7 #IMpurity in Ge atom\n",
"ni=2.5*10**13 #/cm**3\n",
"N=4.4*10**22 #No. of atoms of Ge\n",
@@ -674,7 +599,6 @@
"e=1.6*10**-19 #Electronic charge\n",
"E=400 #Electric field\n",
"\n",
- "#Calculation\n",
"sigmai=ni*e*(mue+muh)\n",
"Nd=N/i\n",
"n=Nd\n",
@@ -710,11 +634,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.17\n",
- "#(i)Electron drift velocity & hole drift velocity .\n",
- "#(ii)Intrinsic Conductivity of Ge,(iii)The total current .\n",
"\n",
- "#Given\n",
"V=10 #Volt\n",
"l=0.025 #m, length\n",
"w=0.004 #m width\n",
@@ -726,14 +646,12 @@
"e=1.6*10**-19 #Electronic charge\n",
"E=400 #Electric field\n",
"\n",
- "#Calculation\n",
"E=V/l\n",
"Ve=mue*E\n",
"Vh=muh*E\n",
"sigmai=ni*e*(mue+muh)\n",
"I=sigmai*E*w*t\n",
"\n",
- "#Result\n",
"print\"(i)Electron drift velocity is \",Ve,\"m/s\"\n",
"print\" hole drift velocity is \",Vh,\"m/s\"\n",
"print\"(ii)Intrinsic Conductivity of Ge is\",sigmai,\"ohm-m**-1\"\n",
@@ -767,19 +685,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.18\n",
- "#What is ratio of electrons to holes\n",
"\n",
- "#Given\n",
"Ie=3/4.0 #Current due to electron\n",
"Ih=1-Ie #Current due to holes\n",
"Vh=1 #Hole velocity\n",
"Ve=3 #Electron velocity 3 times the hole velocity\n",
"\n",
- "#ccalculation\n",
"R=(Ie*Vh/(Ih*Ve))\n",
"\n",
- "#Result\n",
"print\"The ratio of electrons to holes drift velocity is \",R"
],
"language": "python",
@@ -807,10 +720,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 2.19\n",
- "#Find the diffusion coefficients of electrons and holes\n",
"\n",
- "#given data\n",
"e=1.6*10**-19\t\t\t#in coulamb\n",
"T=300\t\t\t\t#in Kelvin\n",
"MUh=0.025\t\t\t#in m**2/V-s\n",
@@ -819,7 +729,6 @@
"De=MUe*k*T/e\t\t\t#in cm**2/s\n",
"Dh=MUh*k*T/e\t\t\t#in cm**2/s\n",
"\n",
- "#Result\n",
"print\"Diffusion constant of electron is \",round(De*10000,2),\"(in cm**2/s)\"\n",
"print\"Diffusion constant of hole is \",round(Dh*10000,2),\"(in cm**2/s)\""
],
@@ -849,10 +758,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.20\n",
- "#Find intrinsic carries cncentration and conductivity\n",
"\n",
- "#Given\n",
"N=3*10**25 #No of atoms\n",
"e=1.6*10**-19\n",
"Eg=1.1*e #eV\n",
@@ -861,11 +767,9 @@
"mue=0.14\n",
"muh=0.05\n",
"\n",
- "#Calculation\n",
"ni=N*math.exp(-Eg/(2*k*T))\n",
"sigma=ni*e*(mue+muh)\n",
"\n",
- "#Result\n",
"print\"The intrinsic carries concentration is \",round(ni,-14),\"/m**3\"\n",
"print\"The conductivity of Si is \",round(sigma,5),\"S/m\"\n"
],
@@ -895,18 +799,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.21\n",
- "#Find the effective density\n",
"\n",
- "#Given\n",
"a=1.5 #a=me/mo\n",
"T=300 #K\n",
"\n",
- "#calculation\n",
- "#from eq. 2.29\n",
"Nc=4.82*10**21*(a)**(1.5)*T**(1.5)\n",
"\n",
- "#Result\n",
"print\"The effective density is\",round(Nc,-23),\"/m**3\""
],
"language": "python",
@@ -934,22 +832,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.22\n",
- "#Calculate the intrinsic concentration\n",
"\n",
- "#Given\n",
"a=0.07 #a=me/mo\n",
"b=0.4 #b=mh/mo\n",
"T=300 #K\n",
"Eg=0.7 #eV\n",
"k=8.62*10**-5 # Boltzman constant\n",
"\n",
- "#calculation\n",
"import math\n",
- "#From eq 2.101\n",
"ni=math.sqrt(2.33*10**43*(a*b)**(1.5)*T**3*math.exp(-Eg/(k*T)))\n",
"\n",
- "#Result\n",
"print\"The intrinsic concentration of charge carrier is\",round(ni,-16),\"/m**3\"\n",
"\n",
"\n",
@@ -980,20 +872,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.23\n",
- "#Find the value of absolute temprature\n",
"\n",
- "#Given\n",
"C=5*10**28 #atom/m**3, concentration of Si atoms\n",
"DL=2*10**8 #Doping level \n",
"m=1\n",
"me=m\n",
- "#calculation\n",
"Nd=C/DL\n",
"nc=Nd\n",
"T=((nc/(4.82*10**21))*(m/me)**(1.5))**(2/3.0)\n",
"\n",
- "#Result\n",
"print\"The absolute temprature is\",round(T,2),\"K\"\n",
"\n"
],
@@ -1022,10 +909,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.24\n",
- "#Determine the effective density\n",
"\n",
- "#Given\n",
"T1=300.0 #K temprature\n",
"T2=400.0\n",
"k=1.38*10**-23 #J/k\n",
@@ -1034,7 +918,6 @@
"dE=0.3 #eV\n",
"k_=8.62*10**-5\n",
"\n",
- "#calculation\n",
"import math\n",
"nc1=2*(2*math.pi*m*k*T1/(h**2))**(1.5)\n",
"n1=nc1*math.exp(-(0.3/(k_*T1)))\n",
@@ -1042,7 +925,6 @@
"nc2=2*(2*math.pi*m*k*T2/(h**2))**(1.5)\n",
"n2=nc2*math.exp(-(0.3/(k_*T2)))\n",
"\n",
- "#result\n",
"print\"The effective density at temprature 300 K is\",round(n1,-19),\"/m**3\"\n",
"print\"The effective density at temprature 400 K is\",round(n2,-19),\"/m**3\"\n"
],
@@ -1072,10 +954,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 2.25\n",
- "#determine the position of intrinsic fermi level\n",
"\n",
- "#Given\n",
"T=300.0\n",
"k=8.62*10**-5 #J/k\n",
"m=9.107*10**-31\n",
@@ -1083,10 +962,8 @@
"mh=0.4*m\n",
"\n",
"\n",
- "#calculation\n",
"dE=-3*k*T*math.log((me/mh)**(1))/4.0 #dE=Ef-Emidgap\n",
"\n",
- "#Result\n",
"print\"The position of fermi level is\",round(dE,4),\"eV\"\n"
],
"language": "python",
@@ -1114,22 +991,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 2.26\n",
- "#determine the position of intrinsic fermi level\n",
"\n",
- "#Given\n",
"T=300.0\n",
"Eg=0.72 #eV Energy gap\n",
"k=8.62*10**-5 #J/k\n",
"me=1\n",
"mh=5.0\n",
"\n",
- "#calculation\n",
- "#from Ef=Ec-kTlog(nc/Nd)\n",
"import math\n",
"dE=(Eg/2.0)-3*k*T*math.log(me/mh)/4.0 #dE=Ef-Emidgap\n",
"\n",
- "#Result\n",
"print\"The position of fermi level is\",round(dE,4),\"eV\"\n"
],
"language": "python",
@@ -1157,20 +1028,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 2.27\n",
- "#determine the position of intrinsic fermi level\n",
"\n",
- "#Given\n",
"T1=300.0\n",
"T2=350\n",
"Eg=0.24 #eV Energy gap\n",
"\n",
- "#calculation\n",
- "#from Ef=Ev+kTlog(nc/Nd)\n",
"import math\n",
"dE=(T2/T1)*Eg\n",
"\n",
- "#Result\n",
"print\"The position of fermi level is\",round(dE,4),\"eV\"\n"
],
"language": "python",
@@ -1198,19 +1063,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.28\n",
- "#determine the position of intrinsic fermi level\n",
"\n",
- "#Given\n",
"T1=300.0\n",
"T2=400\n",
"Eg=0.27 #eV Energy gap\n",
"\n",
- "#calculation\n",
"import math\n",
"dE=(T2/T1)*Eg\n",
"\n",
- "#Result\n",
"print\"The position of fermi level is\",round(dE,4),\"eV\"\n"
],
"language": "python",
@@ -1238,20 +1098,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "##Example 2.29\n",
- "#determine the position of intrinsic fermi level\n",
"\n",
- "#Given\n",
"dE1=0.3 #eV Energy gap\n",
"kT=0.026 #eV\n",
"\n",
- "#calculation\n",
"import math\n",
"x=math.exp(-dE1/kT) #x=Nd/nc\n",
"y=5 #y=Nd2/Nd1\n",
"dE2=-math.log(y)*kT+dE1\n",
"\n",
- "#Result\n",
"print\"The position of fermi level is\",round(dE2,3),\"eV\"\n"
],
"language": "python",
@@ -1279,21 +1134,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "##Example 2.30\n",
- "#determine the position of intrinsic fermi level\n",
"\n",
- "#Given\n",
"dE1=0.39 #eV Energy gap\n",
"kT=0.026 #eV\n",
"\n",
- "#calculation\n",
"import math\n",
"x=math.exp(-dE1/kT) #x=NA1/nV\n",
"y=3 #y=NA2/NA1\n",
"dE2=((dE1/kT)-math.log(y))*kT\n",
"\n",
"\n",
- "#Result\n",
"print\"The position of fermi level is\",round(dE2,2),\"eV\"\n"
],
"language": "python",
@@ -1321,21 +1171,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 2.31\n",
- "#Determine electron density and mobility\n",
"\n",
- "#Given\n",
"rho=1 #ohm-m Resistivity\n",
"Rh=100.0 #cm**3/coulomb\n",
"e=1.6*10**-19\n",
"\n",
- "#calculation\n",
"con=1/rho #Conductivity\n",
"R=1/Rh #Charge density\n",
"ED=R*10**6/e\n",
"mu=con/(R*10**6)\n",
"\n",
- "#Result\n",
"print\"The electron density is\",ED,\"/m**3\"\n",
"print\"The mobility is %.e\"%mu,\"/m**3\""
],
@@ -1365,20 +1210,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.32\n",
- "#Calculate Hall Voltage\n",
"\n",
- "#Given\n",
"w=0.1 #m width\n",
"t=0.01 #m thickness\n",
"F=0.6 #T, field\n",
"Rh=3.8*10**-4 #Hall Coefficient\n",
"I=10 #mA\n",
"\n",
- "#calculation\n",
"Vh=(Rh*F*I/w)\n",
"\n",
- "#Result\n",
"print\"Hall Voltage is\",Vh*1000,\"micro V\"\n",
"\n",
"\n"
@@ -1408,10 +1248,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 2.33\n",
- "#What is magnitude of Hall Voltage\n",
"\n",
- "#given data\n",
"e=1.6*10**-19\t\t\t#in coulamb\n",
"ND=10**17\t\t\t#in cm**-3\n",
"Bz=0.1\t\t\t\t#in Wb/m**2\n",
@@ -1420,12 +1257,10 @@
"Ex=5\t\t\t\t#in V/cm\n",
"MUe=3800\t\t\t#in cm**2/V-s\n",
"\n",
- "#calculation\n",
"v=MUe*Ex\t\t\t#in cm/s\n",
"v=v*10**-2\t\t\t#in m/s\n",
"VH=Bz*v*d\t\t\t#in mV\n",
"\n",
- "#Result\n",
"print\"Magnitude of hall voltage is\",VH,\"mV\""
],
"language": "python",
@@ -1453,10 +1288,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 2.34\n",
- "#What is magnitude of hall voltage\n",
"\n",
- "#given data\n",
"e=1.6*10**-19\t\t\t#in coulamb\n",
"ND=10**21\t\t\t#in m**-3\n",
"Bz=0.2\t\t\t\t#in T\n",
@@ -1465,11 +1297,8 @@
"J=600\t\t\t\t#in A/m**2\n",
"n=ND\t\t\t\t#in m**-3\n",
"\n",
- "#calculation\n",
- "#formula : VH*w/(B*I)=1/(n*e)\n",
"VH=Bz*J*d/(n*e)\t\t\t#in V\n",
"\n",
- "#Result\n",
"print\"Magnitude of hall voltage is \",VH*10**3,\"mV\""
],
"language": "python",
@@ -1497,21 +1326,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 2.35\n",
- "#Calculate hall angle\n",
"\n",
- "#given data\n",
"e=1.6*10**-19\t\t\t#in coulamb\n",
"rho=0.00912\t\t\t#in ohm-m\n",
"B=0.48\t\t\t\t#in Wb/m**2\n",
"RH=3.55*10**-4\t\t\t#in m**3-coulamb**-1\n",
"SIGMA=1/rho\t\t\t#in (ohm=m)**-1\n",
"\n",
- "#calculation\n",
"import math\n",
"THETAh=math.atan(SIGMA*B*RH)\t#in Degree\n",
"\n",
- "#result\n",
"print\"Hall angle is\",round(THETAh*180/3.14,4),\"degree\""
],
"language": "python",
diff --git a/Fundamental_of_Electronics_Devices/Ch3.ipynb b/Fundamental_of_Electronics_Devices/Ch3.ipynb
index fcc2f572..d78715cf 100644
--- a/Fundamental_of_Electronics_Devices/Ch3.ipynb
+++ b/Fundamental_of_Electronics_Devices/Ch3.ipynb
@@ -27,19 +27,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.2\n",
- "#What is Minimum required energy \n",
"\n",
- "#given data\n",
"l=6000 #in Angstrum\n",
"h=6.6*10**(-34) #Planks constant\n",
"c=3*10**8 #speed of light in m/s\n",
"e=1.602*10**(-19) #Constant\n",
"\n",
- "#calculation\n",
"phi=c*h/(e*l*10**(-10))\n",
"\n",
- "#result\n",
"print\"Minimum required energy is\",round(phi,2),\"eV \"\n"
],
"language": "python",
@@ -67,18 +62,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 3.3\n",
- "#calculate Work function of the cathode material\n",
"\n",
- "#given data\n",
"Emax=2.5 #maximum energy of emitted electrons in eV \n",
"l=2537.0 #in Angstrum\n",
"\n",
- "#Calculation\n",
"EeV=12400.0/l #in eV\n",
"phi=EeV-Emax #in eV\n",
"\n",
- "#result\n",
"print \"Work function of the cathode material is \",round(phi,2),\"eV\""
],
"language": "python",
@@ -106,12 +96,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.4\n",
- "#Find (i)The fraction of each photon energy unit which is converted into heat\",f\n",
- "#(ii)Energy converted into heat in ,((2-1.43)/2)*0.009,\"J/s\"\n",
- "#(iii)Number of photons per second given off from recombination events \",0.009/(e*2)\n",
"\n",
- "#given data\n",
"t=0.46*10**-4 #in centi meters\n",
"hf1=2 #in ev\n",
"hf2=1.43\n",
@@ -122,18 +107,15 @@
"\n",
"import math\n",
"\n",
- "#Calculation\n",
"It=Io*math.exp(-alpha*t) #in mW\n",
"Iabs=Io-It\n",
"f=(hf1-hf2)/hf1\n",
"E=f*Iabs\n",
"N=Iabs/(e*hf1)\n",
"\n",
- "#result\n",
"print\"(i)Thus power absorbed is \",round(Iabs,3),\"J/s\"\n",
"print\"(ii)Energy converted into heat is\",round(E,4),\"J/s\"\n",
"print\"(iii)Number of photons per second given off from recombination events \",round(N,-14)\n",
- "#In book there is calculation mistake in Number of photons."
],
"language": "python",
"metadata": {},
@@ -162,11 +144,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.5\n",
- "#What is Photoconductor gain \n",
- "#Electron transit time.\n",
"\n",
- "#given data\n",
"L=100 #in uM\n",
"A=10&-7 #in cm**2\n",
"th=10**-6 #in sec\n",
@@ -174,12 +152,10 @@
"ue=0.13 #in m**2/V-s\n",
"uh=0.05 #in m**2/V-s\n",
"\n",
- "#Calculation\n",
"E=V/(L*10**-6) #in V/m\n",
"tn=(L*10**-6)/(ue*E)\n",
"Gain=(1+uh/ue)*(th/tn)\n",
"\n",
- "#result\n",
"print\"Electron transit time in sec is \",round(tn,10),\"s\"\n",
"print\"Photoconductor gain is \",Gain"
],
@@ -209,19 +185,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example3.6\n",
- "#Calculate Current flowing through diode .\n",
"\n",
- "#given datex\n",
"import math\n",
"Io=0.15 #in uA\n",
"V=0.12 #in mVolt\n",
"Vt=26 #in mVolt\n",
"\n",
- "#calculation\n",
"I=Io*10**-6*(math.exp(V/(Vt*10**-3))-1) #in A\n",
"\n",
- "#result\n",
"print\"Current flowing through diode is \",round(I*10**6,2),\"micra A\""
],
"language": "python",
@@ -249,20 +220,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 3.7\n",
- "#Determine the Forward voltage \n",
"\n",
- "#given data\n",
"import math\n",
"Io=2.5 #in uA\n",
"I=10 #in mA\n",
"Vt=26 #in mVolt\n",
"n=2 #for silicon\n",
"\n",
- "#Calculation\n",
"V=n*Vt*10**-3*math.log((I*10**-3)/(Io*10**-6))\n",
"\n",
- "#Result\n",
"print \"Forward voltage is \",round(V,2),\"V\""
],
"language": "python",
@@ -290,10 +256,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.8\n",
- "#What is Reverse saturation current density \n",
"\n",
- "#given data\n",
"ND=10**21 #in m**-3\n",
"NA=10**22 #in m**-3\n",
"De=3.4*10**-3 #in m**2-s**-1\n",
@@ -303,10 +266,8 @@
"ni=1.6*10**16 #in m**-3\n",
"e=1.602*10**-19 #constant\n",
"\n",
- "#calculation\n",
"IoA=e*ni**2*(Dh/(Lh*ND)+De/(Le*NA))\n",
"\n",
- "#Result\n",
"print\"Reverse saturation current density is \",round(IoA*10**6,2),\"uA \""
],
"language": "python",
diff --git a/Fundamental_of_Electronics_Devices/Ch4.ipynb b/Fundamental_of_Electronics_Devices/Ch4.ipynb
index e41f2209..aaf0f2e5 100644
--- a/Fundamental_of_Electronics_Devices/Ch4.ipynb
+++ b/Fundamental_of_Electronics_Devices/Ch4.ipynb
@@ -27,21 +27,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.1\n",
- "#find the Majority and Minority carrier hole concentration\n",
"\n",
- "#given data\n",
"import math\n",
"T=300\t\t\t #in Kelvin\n",
"ND=5*10**13\t\t #in cm**-3\n",
"NA=0\t\t\t #in cm**-3\n",
"ni=2.4*10**13\t\t#in cm**-3\n",
"\n",
- "#Calculation\n",
"no=ND/2.0+math.sqrt((ND/2.0)**2+ni**2)\t#in cm**-3\n",
"po=ni**2/no\t\t#in cm**-3\n",
"\n",
- "#Result\n",
"print\"Majority carrier electron concentration is \",round(no,-11),\"cm**-3\"\n",
"print\"Minority carrier hole concentration is \",round(po,-11),\" cm**-3\""
],
@@ -71,21 +66,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.2\n",
- "#find the Majority and Minority carrier hole concentration\n",
"\n",
- "#given data\n",
"import math\n",
"T=300\t\t\t#in Kelvin\n",
"ND=10**16\t\t#in cm**-3\n",
"NA=0\t\t\t #in cm**-3\n",
"ni=1.5*10**10\t\t#in cm**-3\n",
"\n",
- "#Calculation\n",
"no=ND/2.0+math.sqrt((ND/2.0)**2+ni**2)\t#in cm**-3\n",
"po=ni**2/no\t\t#in cm**-3\n",
"\n",
- "#result\n",
"print\"Majority carrier electron concentration is \",no,\"cm**-3\"\n",
"print\"Minority carrier hole concentration is \",round(po,0),\" cm**-3\""
],
@@ -115,21 +105,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.3\n",
- "#find the Majority and Minority carrier hole concentration\n",
"\n",
- "#given data\n",
"import math\n",
"T=300\t\t\t#in Kelvin\n",
"ND=3*10**15\t\t#in cm**-3\n",
"NA=10**16\t\t#in cm**-3\n",
"ni=1.6*10**10\t\t#in cm**-3\n",
"\n",
- "#Calculation\n",
"po=(NA-ND)/2+math.sqrt(((NA-ND)/2.0)**2+ni**2.0)\t#in cm**-3\n",
"no=ni**2/po\t\t#in cm**-3\n",
"\n",
- "#Result\n",
"print\"Majority carrier hole concentration is\",round(po,-8),\" cm**-3\"\n",
"print\"Minority carrier electron concentration is \",round(no,0),\" cm**-3\""
],
@@ -159,10 +144,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.4\n",
- "#What is maximum Temprature\n",
"\n",
- "#Given \n",
"import math\n",
"ND=3*10**15\t\t#in cm**-3\n",
"Eg=1.12 #eV\n",
@@ -170,15 +152,11 @@
"Nc=2.8*10**19\n",
"Nv=1.04*10**19\n",
"\n",
- "#Calculation\n",
"import math\n",
- "# from the equation po=(NA-ND)/2+math.sqrt(((NA-ND)/2.0)**2+ni**2.0)\t#in cm**-3\n",
"No=1.05*ND\n",
"ni=math.sqrt((No-ND/2.0)**2-0.25*ND**2)\n",
- "#From ni**2=Nc*Nv*exp(-Eg/(k*t))\n",
"T=Eg/(-math.log(ni**2/(Nc*Nv))*k)\n",
"\n",
- "#Result\n",
"print \"The maximum Temprature is \",round(T,1),\"K\""
],
"language": "python",
@@ -206,10 +184,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.5\n",
- "#determine the built in potential\n",
"\n",
- "#given data\n",
"import math\n",
"T=300\t\t#in Kelvin\n",
"ND=10**15\t#in cm**-3\n",
@@ -217,10 +192,8 @@
"ni=1.5*10**10\t#in cm**-3\n",
"VT=T/11600.0\t#in Volts\n",
"\n",
- "#Calculation\n",
"Vbi=VT*math.log(NA*ND/ni**2)\t#in Volts\n",
"\n",
- "#result\n",
"print\"Built in potential barrier is\",round(Vbi,4),\"V\""
],
"language": "python",
@@ -248,21 +221,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.6\n",
- "#What is Contact Potential.\n",
"\n",
- "#given data\n",
"T=300\t\t #in Kelvin\n",
"ND=10**21\t #in m**-3\n",
"NA=10**21\t #in m**-3\n",
"ni=1.5*10**16 #in m**-3\n",
"VT=T/11600.0\t#in Volts\n",
"\n",
- "#Calculation\n",
"import math\n",
"Vo=VT*math.log(NA*ND/ni**2)\t#in Volts\n",
"\n",
- "#result\n",
"print\"Contact potential is\",round(Vo,4),\"V\""
],
"language": "python",
@@ -290,10 +258,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.7\n",
- "#Determine the space charge.\n",
"\n",
- "#given data\n",
"import math\n",
"T=300\t\t\t#in Kelvin\n",
"ND=10**15\t\t#in cm**-3\n",
@@ -302,7 +267,6 @@
"VT=T/11600.0\t\t#in Volts\n",
"e=1.6*10**-19\t #in Coulamb\n",
"\n",
- "#calculation\n",
"epsilon=11.7*8.854*10**-14\t #constant\n",
"Vbi=VT*math.log(NA*ND/ni**2)\t\t#in Volts\n",
"SCW=math.sqrt((2*epsilon*Vbi/e)*(NA+ND)/(NA*ND))#in cm\n",
@@ -311,7 +275,6 @@
"xp=0.086\t\t#in uM\n",
"Emax=-e*ND*xn/epsilon\t#in V/cm\n",
"\n",
- "#result\n",
"print\"Space charge width is\",round(SCW,2),\"micro meter\"\n",
"print\"At metallurgical junction, i.e for x=0 the electric field is \",round(Emax/10000,0),\"V\"#Note : Ans in the book is wrong"
],
@@ -341,24 +304,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.8\n",
- "#Find the new position of fermi level\n",
"\n",
- "#given data\n",
"import math\n",
"Ecf=0.3 #in Volts\n",
"T=27.0+273.0 #in Kelvin\n",
"delT=55 #in degree centigrade\n",
"\n",
- "#calculation\n",
- "#formula : Ecf=Ec-Ef=K*T*math.log(nc/ND)\n",
- "#let K*math.log(nc/ND)=y\n",
- "#Ecf=Ec-Ef=T*y\n",
"y=Ecf/T #assumed\n",
"Tnew=273+55 #in Kelvin\n",
"EcfNEW=y*Tnew #in Volts\n",
"\n",
- "#result\n",
"print\"New position of fermi level is \",round(EcfNEW,4),\"V\""
],
"language": "python",
@@ -386,10 +341,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.9\n",
- "#Determine the Contact Potential\n",
"\n",
- "#given data\n",
"import math\n",
"T=300\t\t\t#in Kelvin\n",
"ND=8*10**14\t\t#in cm**-3\n",
@@ -397,10 +349,8 @@
"ni=2*10**13\t\t#in cm**-3\n",
"k=8.61*10**-5\t\t#in eV/K\n",
"\n",
- "#calculation\n",
"Vo=k*T*math.log(NA*ND/ni**2)\t#in Volts\n",
"\n",
- "#Result\n",
"print\"Contact potential is \",round(Vo,2),\"V\""
],
"language": "python",
@@ -428,11 +378,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.10\n",
- "#(i)Find the hole and electron concentration \n",
- "#Is this Silicon P or N type\n",
"\n",
- "#given data\n",
"ND=2*10**16 #in cm**-3\n",
"NA=5*10**15 #in cm**-3\n",
"Ao=4.83*10**21 \t#constant\n",
@@ -440,12 +386,10 @@
"EG=1.1\t \t \t #in eV\n",
"kT=0.026 \t\t#in eV\n",
"\n",
- "#Calculation\n",
"ni=Ao*T**(1.5)*math.exp(-EG/(2*kT))\t\t#in m**-3\n",
"p=(ni/10**6)**2/ND\t\t\t#in cm**-3\n",
"n=((ni/10**6)**2)/NA\t\t\t#in cm**-3\n",
"\n",
- "#Result\n",
"\n",
"print\"Hole concentration in cm**-3 : %.1e\"%round(p,0),\"/cm**3\"\n",
"print\"electron concentration in cm**-3 :%.1e\"%round(n,0),\"/cm**3\"\n",
@@ -488,18 +432,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.11\n",
- "#Determine current\n",
"\n",
- "#In given circuit \n",
"V=5\t\t #in volts\n",
"Vo=0.7\t #in Volts\n",
"R=100\t\t#in Kohm\n",
"\n",
- "#Calculation\n",
"I=(V-Vo)/R\t#in Ampere\n",
"\n",
- "#result\n",
"print\"Current flowing through the circuit is\",round(I*1000,0),\"mA\""
],
"language": "python",
@@ -527,20 +466,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.12\n",
- "#Find the Voltage VA\n",
"\n",
- "#In given circuit \n",
"V=15\t\t\t #in volts\n",
"Vo=0.7\t\t\t#in Volts\n",
"R=7\t \t \t#in Kohm\n",
"\n",
- "#Calculation\n",
"I=(V-2*Vo)/R\n",
"I=(V-2*Vo)/R\t\t#in mAmpere\n",
"VA=I*R\t \t\t#in Volts\n",
"\n",
- "#result\n",
"print\"Voltagee VA is \",VA,\"V\""
],
"language": "python",
@@ -568,17 +502,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 4.13\n",
- "#Determine the Voltage VA\n",
"\n",
- "#Given\n",
"V=15 #V, voltage\n",
"Vb=0.3 #V, Barrier Potential #When supply is switched on\n",
"\n",
- "#Calculation\n",
"VA=V-Vb\n",
"\n",
- "#Result\n",
"print\"The Voltage VA is \",VA,\"V\"\n",
"\n"
],
@@ -607,21 +536,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.14\n",
- "#find Temperature coefficient f zener diode\n",
"\n",
- "#given data\n",
"Vz=5\t\t\t#in volts\n",
"to=25\t\t\t#in degree centigrade\n",
"t=100\t\t\t#in degree centigrade\n",
"Vdrop=4.8\t\t#in Volts\n",
"\n",
- "#calculation\n",
"delVz=Vdrop-Vz\t\t#in Volts\n",
"delt=t-to\t\t#in degree centigrade\n",
"TempCoeff=delVz*100/(Vz*delt)\n",
"\n",
- "#result\n",
"print\"Temperature coefficient f zener diode is \",round(TempCoeff,3),\"percent\""
],
"language": "python",
@@ -649,27 +573,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.15\n",
- "#Find (a)output Voltage (b) Voltage across Rs (c) Current\n",
"\n",
- "#given data\n",
"Vz=8.0\t\t\t#in volts\n",
"VS=12.0\t\t\t#in volts\n",
"RL=10.0\t\t\t#in Kohm\n",
"Rs=5.0\t\t\t#in Kohm\n",
"\n",
- "#part (a)\n",
"Vout=Vz\t\t\t#in volts\n",
"\n",
- "#part (b)\n",
"Vrs=VS-Vout\t\t#in volts\n",
"IL=Vout/RL \t\t#in mAmpere\n",
"Is=(VS-Vout)/Rs\t#in mAmpere\n",
"\n",
- "#part c\n",
"Iz=Is-IL\t \t#in mAmpere\n",
"\n",
- "#result\n",
"print\"(a)Output voltage will be equal to Vout=\",Vout,\" Volts\"\n",
"print\"(b)Voltage across Rs is Rs=\",Vrs,\"V\"\n",
"print\"(c)Current through zener diode is Iz=\",round(Iz,1),\"mA\""
@@ -701,17 +618,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.16\n",
- "#Find the min and max value of zener diode current\n",
"\n",
- "#given data\n",
"Vz=50.\t\t\t#in volts\n",
"VSmax=120.0\t\t#in volts\n",
"VSmin=80.0\t\t#in volts\n",
"RL=10.0\t\t\t#in Kohm\n",
"Rs=5.0\t\t\t#in Kohm\n",
"\n",
- "#Calculation\n",
"Vout=Vz\t\t\t#in Volts\n",
"IL=Vout/RL\t\t#in mAmpere\n",
"\n",
@@ -720,7 +633,6 @@
"Ismin=(VSmin-Vout)/Rs#in mAmpere\n",
"Izmin=Ismin-IL#in mA\n",
"\n",
- "#Result\n",
"print\"Maximum zener diode current is \",Izmax,\"mA\"\n",
"print\"Minimum zener diode current is \",Izmin,\"mA\""
],
@@ -750,10 +662,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.17\n",
- "#Design a regulator\n",
"\n",
- "#given data\n",
"Vz=15\t\t#in volts\n",
"Izk=6.0\t\t#in mA\n",
"Vout=15\t\t#in Volts\n",
@@ -762,7 +671,6 @@
"ILmax=20.0\t#in mA\n",
"RS=(Vs-Vz)*1000/(ILmax+Izk)\t#in ohm\n",
"\n",
- "#result\n",
"print\"sereis Resistance is \",round(RS,1),\"ohm\"\n",
"print\"The zener current will be minimum i.e. Izk = 6mA when load current is maximum i.e. ILmax = 20mA\"\n",
"print\"when the load current will decrease and become 10 mA, the zener current will increase and become 6+10 i.e. 16 mA. \\nThus the current through series resistance Rs will remain unchanged at 6+20 i.e. 26 mA. \\nThus voltage drop in series resistance Rs will remain constant. Consequently, the output voltage will also remain constant. \""
@@ -796,21 +704,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.18\n",
- "#Determine Vl,Iz,Pz\n",
"\n",
- "#given data\n",
"Vs=16.0\t\t #in volts\n",
"RL=1.2\t\t\t#in Kohm\n",
"Rs=1.0\t\t\t#in Kohm\n",
"\n",
- "#calculation\n",
- "#If zener open circuited\n",
"VL=Vs*RL/(Rs+RL)\t#in Volts\n",
"Iz=0\t\t\t#in mA\n",
"Pz=VL*Iz\t\t#in watts\n",
"\n",
- "#result\n",
"print\"When zener open circuited Voltage across load is \",round(VL,2),\"V\"\n",
"print\"Zener current is \",Iz,\"mA\"\n",
"print\"Power is\",Pz,\"watt\""
@@ -842,18 +744,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.19\n",
- "#determine VL,IL,IZ,IR\n",
"\n",
- "#given data\n",
"Vin=20\t\t\t#in volts\n",
"Rs=220.0\t\t\t#in Kohm\n",
"Vz=10\t\t \t#in volts\n",
"RL2=50.0\t\t\t#in Kohm\n",
"RL1=200\t\t\t#in Kohm\n",
"\n",
- "#calculation\n",
- "# part (i) RL=50\t#in Kohm\n",
"VL1=Vin*RL1/(RL+Rs)\n",
"IR=Vin/(Rs+RL)\t#in mA\n",
"IL=IR\t\t \t#in mA\n",
@@ -866,20 +763,17 @@
" print \"Zener diode will conduct\"\n",
"\n",
" \n",
- "#Result\n",
"print\"When RL=200 ohm\"\n",
"print\"IL is\",round(IL*1000,2),\"mA\"\n",
"print\"IR is\",round(IR*10**3,2),\"mA\"\n",
"print\"Iz in mA: \",round(IZ,0),\"mA\"\n",
"\n",
- "# part (ii) RL=200#in Kohm\n",
"RL=200\t\t\t#in Kohm\n",
"VL2=Vin*RL2/(RL2+Rs)\n",
"IR=Vin/(Rs+RL2)\t\t#in mA\n",
"IL=IR\t\t\t#in mA\n",
"IZ=0\t\t\t#in mA\n",
"\n",
- "#result\n",
"if VL2< Vz:\n",
" \n",
" print\"Zener diode will not conduct and VL=\",round(VL2,1),\"V\" \n",
@@ -925,19 +819,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.20\n",
- "#Find the voltage drop across the resistance\n",
"\n",
- "#given data\n",
"RL=10.0\t\t\t #in Kohm\n",
"Rs=5.0 #in Kohm\n",
"Vin=100\t\t\t #in Volts\n",
"\n",
- "#Calculation\n",
"V=Vin*RL/(RL+Rs)\t#in Volt\n",
"VZ=50\t\t\t#in Volts\n",
"VL=VZ\t\t\t#in volts\n",
- "#Apply KVL\n",
"VR=100-50\t\t#in Volts\n",
"VR=50\t\t\t#in Volts\n",
"\n",
@@ -975,10 +864,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 4.21\n",
- "#Find the input resistance\n",
"\n",
- "#given data\n",
"RL=120.0\t\t\t#in ohm, load resistance\n",
"Izmin=20\t\t#in mA min. diode current\n",
"Izmax=200\t\t#in mA max. diode current\n",
@@ -989,16 +875,12 @@
"IL=VL/RL\t\t#in Ampere\n",
"IL=IL*1000\t\t#in mAmpere\n",
"\n",
- "#calculation\n",
- "#For VDCmin = 15 volts\n",
"VSmin=VDCmin-Vz\t\t#in Volts\n",
- "#For VDCmax = 19.5 volts\n",
"VSmax=VDCmax-Vz\t\t#in Volts\n",
"ISmin=Izmin+IL\t\t#in mA\n",
"Ri=VSmin/ISmin\t\t#in Kohm\n",
"Ri=Ri*10**3\t\t#in ohm\n",
"\n",
- "#result\n",
"print\"The resistance Ri is \",Ri,\"ohm\""
],
"language": "python",
@@ -1026,10 +908,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa4.22\n",
- "#Determine the range of Rl and Il\n",
"\n",
- "#given data\n",
"VRL=10\t\t\t#in Volts Diode resistance\n",
"Vi=50\t\t\t#in Volts\n",
"R=1.0\t\t\t#in Kohm Resistance\n",
@@ -1046,7 +925,6 @@
"VL=Vz\t\t\t #in Volts\n",
"RLmax=VL/ILmin\t\t#in Ohm\n",
"\n",
- "#Result\n",
"print\"Range of RL in Kohm : From \",RLmin*1000,\"ohm to \",RLmax,\"kohm\"\n",
"print\"Range of IL in mA : From \",ILmin,\"mA to \",ILmax,\"mA\""
],
diff --git a/Fundamental_of_Electronics_Devices/Ch5.ipynb b/Fundamental_of_Electronics_Devices/Ch5.ipynb
index 49984e90..bcf84c6b 100644
--- a/Fundamental_of_Electronics_Devices/Ch5.ipynb
+++ b/Fundamental_of_Electronics_Devices/Ch5.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 5.1\n",
- "#Estimate the junction width in two cases.\n",
"\n",
- "#given data\n",
"import math\n",
"ND=10**17 #in atoms/cm**3\n",
"NA=0.5*10**16 #in atoms/cm**3\n",
@@ -41,20 +38,12 @@
"epsilon=8.85*10**-11 #in F/m\n",
"e=1.6*10**-19 #coulamb\n",
"\n",
- "#Calculation\n",
- "#part (i)\n",
- "#print \"When no external voltage is applied i.e. V=0\"\n",
- "#print\"VB = 0.7 volts\"\n",
"VB=0.7 #in Volts\n",
"W1=math.sqrt(2*epsilon*VB*(1/NA+1/ND)/e) #in m\n",
"\n",
- "#part (ii)\n",
- "#print\"When external voltage of -10 volt is applied\"\n",
- "#print\"VB = Vo-V volts\"\n",
"VB=Vo-V #in Volts\n",
"W2=math.sqrt(2*epsilon*VB*(1/NA+1/ND)/e) #in m\n",
"\n",
- "#result\n",
"print \"When no external voltage is applied, Junction width is \",round(W1,8),\"m\"\n",
"print\"When external voltage of -10 Volt is applied, Junction width is \",round(W2,7),\"m\""
],
@@ -84,19 +73,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 5.3\n",
- "#Determine the junction capacitance\n",
"\n",
- "#given data\n",
"CTzero=50 #in pF\n",
"VR=8 #in Volt\n",
"VK=0.7 #in Volt\n",
"n=1/3.0 #for Si\n",
"\n",
- "#calculation\n",
"CT=CTzero/((1+VR/VK)**n) #in pF\n",
"\n",
- "#result\n",
"print\"Junction capacitance is\",round(CT,2),\"pF\""
],
"language": "python",
@@ -124,21 +108,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.4\n",
- "#Determine the tuning range of the circuit\n",
"\n",
- "#Given\n",
"L=12.5*10**-3 #mH inductance\n",
"C1=4.0 #pF Capacitance\n",
"C2=40.0 #pF Capacitance\n",
"\n",
- "#Calculation\n",
"Ctmin=(C1*C1)/(C1+C1) #Min value of total Capacitance\n",
"Ctmax=(C2*C2)/(C2+C2) #Max value of total Capacitance\n",
"Fmax=1/(2*math.pi*math.sqrt(L*Ctmin*10**-12))\n",
"Fmin=1/(2*math.pi*math.sqrt(L*Ctmax*10**-12))\n",
"\n",
- "#result\n",
"print\"The tuning range of circuit lies between\",round(Fmin/1000,2),\"khz and\",round(Fmax/1000,0),\"Mhz\"\n"
],
"language": "python",
diff --git a/Fundamental_of_Electronics_Devices/Ch6.ipynb b/Fundamental_of_Electronics_Devices/Ch6.ipynb
index e3eea147..179d14a6 100644
--- a/Fundamental_of_Electronics_Devices/Ch6.ipynb
+++ b/Fundamental_of_Electronics_Devices/Ch6.ipynb
@@ -27,17 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.1\n",
- "#find the Base current\n",
"\n",
- "#given data\n",
"Ic=9.95\t\t\t#in mA\n",
"Ie=10 \t\t#in mA\n",
"\n",
- "#Calculation\n",
"Ib=Ie-Ic\t\t#in mA\n",
"\n",
- "#result\n",
"print\"Emitter current is \",Ib,\"mA\""
],
"language": "python",
@@ -65,24 +60,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.2\n",
- "#Find (i)Emitter current (ii)Current amplification factor (iii)Current gain factor \n",
"\n",
- "#given data\n",
"IC=0.98\t\t\t#in mA\n",
"IB=20.0\t\t\t#in uA\n",
"IB=IB*10**-3\t\t#in mA\n",
"\n",
- "#Calculation\n",
- "#part (i)\n",
"IE=IB+IC\t\t#in mA\n",
"\n",
- "#part (ii)\n",
"alpha=IC/IE\t\t#unitless\n",
- "#part (iii)\n",
"Beta=IC/IB\t\t#unitless\n",
"\n",
- "#Result\n",
"print\"Emitter current is\",IE,\"mA\"\n",
"print\"Current amplification factor is \",alpha\n",
"print\"Current gain factor is \",Beta"
@@ -114,22 +101,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.3\n",
- "#Emitter current and Collector current\n",
"\n",
- "#given data\n",
"alfaDC=0.98\t\t\t#unitless\n",
"ICBO=4\t\t\t\t#in uA\n",
"ICBO=ICBO*10**-3\t\t#in mA\n",
"IB=50\t\t\t\t#in uA\n",
"IB=IB*10**-3\t\t\t#in mA\n",
"\n",
- "#calculation\n",
- "#Formula : IC=alfaDC*(IB+IC)+ICBO\n",
"IC=alfaDC*IB/(1-alfaDC)+ICBO/(1-alfaDC)\t#in mA\n",
"IE=IC+IB\t\t\t#in mA\n",
"\n",
- "#Result\n",
"print\"Emitter current is \",IE,\"mA\"\n",
"print\"Collector current is \",IC,\"mA\""
],
@@ -159,21 +140,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.4\n",
- "#Find the collector current\n",
"\n",
- "#given data\n",
"IB=10\t\t\t#in uA\n",
"IB=IB*10**-3\t\t#in mA\n",
"Beta=99\t\t\t#Unitless\n",
"ICO=1\t\t\t#in uA\n",
"ICO=ICO*10**-3\t\t#in mA\n",
"\n",
- "#calculation\n",
- "#Formula : IC=alfa*(IB+IC)+ICO\n",
"IC=Beta*IB+(1+Beta)*ICO\t#in mA\n",
"\n",
- "#Result\n",
"print\"Collector current in mA : \",IC,\"mA\""
],
"language": "python",
@@ -201,24 +176,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.5\n",
- "#Find (i) alpha , beta and Ie \n",
- "#(ii)New level of Ib\n",
"\n",
- "#Given\n",
"Ic=5*10**-3 #mA collector current\n",
"Ic_=10*10**-3 #mA collector current\n",
"Ib=50*10**-6 #mA, Base current\n",
"Icbo=1*10**-6 #micro A, Current to base open current\n",
"\n",
- "#Calculation\n",
"beta=(Ic-Icbo)/(Ib+Icbo)\n",
"alpha=(beta/(1+beta))\n",
"Ie=Ib+Ic\n",
"\n",
"Ib=(Ic_-(beta+1)*Icbo)/(beta)\n",
"\n",
- "#Result\n",
"print\"(i) Current gain factor is\",round(beta,0)\n",
"print\" Current amplification factor is\",round(alpha,2)\n",
"print\" Emitter Current is\",Ie*1000,\"mA\"\n",
@@ -252,17 +221,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.6\n",
- "#Find the dynamic input resistance\n",
"\n",
- "#given data\n",
"delVEB=200\t\t\t#in Volts\n",
"delIE=5\t\t\t\t#in mA\n",
"\n",
- "#calculation\n",
"rin=delVEB/delIE\t\t#in ohm\n",
"\n",
- "#Result\n",
"print\"Dynamic input resistance is \",rin,\"mohm\""
],
"language": "python",
@@ -290,21 +254,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.7\n",
- "#Determine Current gain and base current\n",
"\n",
"\n",
- "#given data\n",
"ICBO=12.5 \t\t\t#in uA\n",
"ICBO=ICBO*10**-3 \t\t#in mA\n",
"IE=2 \t\t\t\t#in mA\n",
"IC=1.97 \t\t\t#in mA\n",
"\n",
- "#calculation\n",
"alfa=(IC-ICBO)/IE \t\t#unitless\n",
"IB=IE-IC \t\t\t#in mA\n",
"\n",
- "#result\n",
"print\"Current gain : \",round(alfa,3)\n",
"print\"Base current is \",IB,\"mA\""
],
@@ -334,18 +293,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.8\n",
- "#given data\n",
"RL=4.0 \t\t\t#in Kohm\n",
"VL=3.0\t\t\t#in volt\n",
"alfa=0.96 \t\t#unitless\n",
"IC=VL/RL \t\t#in mA\n",
"\n",
- "#calculation\n",
"IE=IC/alfa \t\t#in mA\n",
"IB=IE-IC \t\t#in mA\n",
"\n",
- "#result\n",
"print\"Base current ia\",round(IB,2),\"mA\""
],
"language": "python",
@@ -373,23 +328,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.9\n",
- "#Determine Collector emitter voltage and base current\n",
"\n",
- "#given data\n",
"VCC=10\t\t\t #in volt\n",
"RL=800\t\t\t #in ohm\n",
"VL=0.8\t\t\t #in volt\n",
"alfa=0.96\t\t #unitless\n",
"\n",
- "#calculation\n",
- "#VR=IC*RL\n",
"VCE=VCC-VL \t\t#in Volt\n",
"IC=VL*1000/RL \t\t#in mA\n",
"Beta=alfa/(1-alfa) \t#unitless\n",
"IB=IC/Beta \t\t#in mA\n",
"\n",
- "#Result\n",
"print\"Collector-emitter Voltage is \",VCE,\"V\"\n",
"print\"Base current in uA : \",round(IB*1000,2),\"microA\""
],
@@ -419,19 +368,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.10\n",
- "#Determine Collector Current\n",
"\n",
- "#given data\n",
"alfao=0.98 \t\t#unitless\n",
"ICO=10 \t\t\t#in uA\n",
"ICO=ICO*10**-3 \t\t#in mA\n",
"IB=0.22 \t\t#in mA\n",
"\n",
- "#calculation\n",
"IC=(alfao*IB+ICO)/(1-alfao) \t#in mA\n",
"\n",
- "#result\n",
"print\"Collector current is\",IC,\"mA\""
],
"language": "python",
@@ -459,17 +403,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.11\n",
- "#determine Dynamic input resistance \n",
"\n",
- "#given data\n",
"delVEB=250 \t\t#in mVolts\n",
"delIE=1 \t\t#in mA\n",
"\n",
- "#calculation\n",
"rin=delVEB/delIE \t#in ohm\n",
"\n",
- "#result\n",
"print\"Dynamic input resistance is\",rin,\"ohm\""
],
"language": "python",
@@ -497,17 +436,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.12\n",
- "#Determine Dynamic output resistance\n",
"\n",
- "#given data\n",
"delVCE=10-5 \t\t#in Volts\n",
"delIC=5.8-5\t \t#in mA\n",
"\n",
- "#calculation\n",
"rin=delVCE/delIC \t#in Kohm\n",
"\n",
- "#result\n",
"print\"Dynamic output resistance is \",rin,\"kohm\""
],
"language": "python",
@@ -545,27 +479,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.13\n",
- "#Determine operating point\n",
"\n",
- "#given data\n",
"VCC=10 \t\t\t#in volt\n",
"RC=8 \t\t\t#in Kohm\n",
"Beta=40 \t\t#unitless\n",
"IB=15 \t\t\t#in uA\n",
"IB=IB*10**-3 \t\t#in mA\n",
"\n",
- "#calculation\n",
- "# For VCE = 0 Volts\n",
"IC=VCC/RC \t\t#in mA\n",
- "#For IC=0 VCE=VCC=10V :\n",
"IC=Beta*IB \t\t#in mA\n",
"VCE=VCC-IC*RC \t\t#in Volts\n",
"\n",
- "#result\n",
"print\"Operating point Q is (\",VCE,\"V,\",IC,\"mA)\"\n",
"\n",
- "#Plot\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -613,20 +539,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.14\n",
- "#How will the Q point change when load resistance will be change\n",
"\n",
- "#given data \n",
"Vcc=12 \t\t#in Volt collector supply voltage\n",
"Ic=1.2 #A, collector current\n",
"Rl=5 #kohm load resistance\n",
"\n",
- "#calculation\n",
"Vce=Vcc-Ic*Rl #Collector emitter voltage\n",
"Rl1=7.5\n",
"Vce1=Vcc-Ic*Rl1\n",
"\n",
- "#result\n",
"print\"Operating point at load resistance 5 kohm is (\",Vce,\"V,\",Ic,\"mA)\"\n",
"print\"Operating point at load resistance 7.5 kohm is (\",Vce1,\"V,\",Ic,\"mA)\""
],
@@ -656,20 +577,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.15\n",
- "#Given\n",
"Vcc=20 # V, collector voltage\n",
"Rc=3.3*10**3\n",
"\n",
- "#calculation\n",
- "#Appling kirchoff's Voltage Law\n",
"Ic=0 #for cut off point\n",
"Vce=Vcc\n",
"Ic=Vcc/Rc\n",
"print \"Collector to emitter voltage is (Vce)\",Vce,\"V\"\n",
"print \"Collector current at saturation point is (Ic)\",round(Ic*1000,0),\"mA\"\n",
"\n",
- "#Plot\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -719,10 +635,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 6.16\n",
- "#find collector voltage and base voltage\n",
"\n",
- "#given data \n",
"Beta=45 \t\t\t#Unitless\n",
"VBE=0.7 \t\t\t#in Volt\n",
"VCC=0 \t\t\t\t#in Volt\n",
@@ -730,15 +643,11 @@
"RC=1.2*10**3 \t\t\t#in ohm\n",
"VEE=-9 \t\t\t\t#in Volt\n",
"\n",
- "#calculation\n",
- "#Applying Kirchoffs Voltage Law in input loop we have\n",
- "#IB*RB+VBE+VEE=0\n",
"IB=-(VBE+VEE)/RB \t\t#in mA\n",
"IC=Beta*IB \t\t\t#in mA\n",
"VC=VCC-IC*RC \t\t\t#in Volts\n",
"VB=VBE+VEE \t\t\t#in Volts\n",
"\n",
- "#Result\n",
"print\"collector voltage is \",round(VC,1),\"V\"\n",
"print\"Base voltage is \",VB,\"V\""
],
diff --git a/Fundamental_of_Electronics_Devices/Ch7.ipynb b/Fundamental_of_Electronics_Devices/Ch7.ipynb
index 6700dc78..990f60e7 100644
--- a/Fundamental_of_Electronics_Devices/Ch7.ipynb
+++ b/Fundamental_of_Electronics_Devices/Ch7.ipynb
@@ -27,18 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.1\n",
- "#What is Resistance between gate and source\n",
"\n",
- "#given data \n",
"VGS=10\t\t\t#in Volt\n",
"IG=0.001\t\t#in uA\n",
"IG=IG*10**-6\t\t#in A\n",
"\n",
- "#calculation\n",
"RGS=VGS/IG\t\t#in ohm\n",
"\n",
- "#result\n",
"print\"Resistance between gate and source is \",RGS/10**6,\"ohm\""
],
"language": "python",
@@ -66,18 +61,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.2\n",
- "#What is AC drain resistance of JFET\n",
"\n",
- "#given data \n",
"delVDS=1.5\t\t\t#in Volt\n",
"delID=120\t\t\t#in uA\n",
"delID=120*10**-6\t\t#in A\n",
"\n",
- "#Calculation\n",
"rd=delVDS/delID\t\t\t#in Ohm\n",
"\n",
- "#Result\n",
"print\"AC drain resistance of JFET in Kohm \",rd*10**-3,\"kohm\""
],
"language": "python",
@@ -105,19 +95,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.3\n",
- "#Determine Transconductance\n",
"\n",
- "#given data \n",
"VP=-4.5\t\t\t#in Volt\n",
"IDSS=10.0\t\t\t#in mA\n",
"IDS=2.5\t\t\t#in mA\n",
"\n",
- "#Calculation\n",
"VGS=VP*(1-math.sqrt(IDS/IDSS))\t\t#in Volt\n",
"gm=(-2*IDSS/VP)*(1-VGS/VP)\t\t#in mA/Volt\n",
"\n",
- "#Result\n",
"print\"Transconductance is\",round(gm,2),\"mA/v\""
],
"language": "python",
@@ -145,18 +130,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.4\n",
- "#calculate Vgs off\n",
"\n",
- "#given data \n",
"gm=10\t\t\t#in mS\n",
"IDSS=10\t\t\t#in uA\n",
"IDSS=IDSS-10**-6\t#in Ampere\n",
"\n",
- "#Calculation\n",
"VGS_OFF=-2*IDSS/gm\n",
"\n",
- "#Result\n",
"print\"VGS(OFF) is =\",round(VGS_OFF),\"mV\""
],
"language": "python",
@@ -184,19 +164,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.5\n",
- "#Determine The minimum value of VDS for pinch-OFF region is equal to VP.\n",
"\n",
- "#given data \n",
"VP=-4.0\t\t\t #in Volt\n",
"IDSS=10.0\t\t\t #in mA\n",
"IDSS=IDSS*10**-3\t#in Ampere\n",
"VGS=-2.0 #in Volt\n",
"\n",
- "#Calculation\n",
"ID=IDSS*(1.0-VGS/VP)**2\t#in mA\n",
"\n",
- "#result\n",
"print \"Drain current=\",ID*1000,\"mA\"\n",
"print\"VDS(min) is : \",VP,\"V\""
],
@@ -226,21 +201,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.6\n",
- "#Find the value of Id , gmo, gm\n",
"\n",
- "#given data \n",
"VP=-3.0\t\t\t#in Volt\n",
"IDSS=8.7\t\t#in mA\n",
"IDSS=IDSS*10**-3\t#in mA\n",
"VGS=-1\t\t\t#in Volt\n",
"\n",
- "#calculation\n",
"ID=IDSS*(1-VGS/VP)**2\t#in Ampere\n",
"gmo=-2*IDSS/VP\t\t#in mS\n",
"gm=gmo*(1-VGS/VP)\t#in mS\n",
"\n",
- "#result\n",
"print\"ID is \",round(ID*1000,1),\"mA\"\n",
"print\"gmo is\",round(gmo*1000,1),\"mS\"\n",
"print\"gm is \",round(gm*1000,1),\"mS\""
@@ -272,20 +242,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.7\n",
- "#Find gm\n",
"\n",
- "#given data \n",
"VP=-3.0 \t\t#in Volt\n",
"IDSS=8.4 \t#in mA\n",
"VGS=-1.5 \t#in Volt\n",
"\n",
- "#calculation\n",
"ID=IDSS*(1-VGS/VP)**2 \t\t#in mA\n",
"gmo=-2*IDSS/VP \t\t\t#in mS\n",
"gm=gmo*(1-VGS/VP) \t\t#in mS\n",
"\n",
- "#result\n",
"print\"Drain current=\",ID,\"mA\"\n",
"print\"Transconductance is \",gm,\"mS\""
],
@@ -315,22 +280,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.8\n",
- "#What is gm \n",
"\n",
- "#given data \n",
"VP=-4.5 \t\t #in Volt\n",
"IDSS=9 \t\t\t#in mA\n",
"IDSS=IDSS*10**-3 #in Ampere\n",
"IDS=3 \t\t\t #in mA\n",
"IDS=IDS*10**-3 \t\t#in Ampere\n",
"\n",
- "#calculation\n",
"import math\n",
"VGS=VP*(1-math.sqrt(IDS/IDSS)) \t#in Volt\n",
"gm=(-2*IDSS/VP)*(1-VGS/VP) \t\t#in mS\n",
"\n",
- "#result\n",
"print\"IDS = 3 mA when gm is \",round(gm*1000,2),\"mS\""
],
"language": "python",
@@ -358,11 +318,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.9\n",
- "#given data :\n",
"Vp=-4.0 \t\t\t #in Volt\n",
"IDSS=10.0 \t\t #in mA\n",
- "#From eq 7.1\n",
"Vgs1=0\n",
"Id1=IDSS # mA, at Vgs=0\n",
"Vgs2=1\n",
@@ -376,7 +333,6 @@
"\n",
"print \"Transfer Characteristics are in mA \",Id1,Id2,Id3,Id4,Id5\n",
"\n",
- "#Plot\n",
"import matplotlib.pyplot as plt\n",
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
@@ -432,20 +388,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 7.10\n",
- "#Determine the drain current\n",
"\n",
- "#given data \n",
"ID_on=5 \t\t#in mA\n",
"VGS=6 \t\t\t#in Volt\n",
"VGS_on=8.0 \t\t#in Volt\n",
"VGST=4 \t\t\t#in Volt\n",
"\n",
- "#calculation\n",
"K=ID_on/(VGS_on-VGST)**2 \t\t#in mA/V**2\n",
"ID=K*(VGS-VGST)**2 \t\t\t#in mA\n",
"\n",
- "#result\n",
"print\"When VGS=6V the drain current is \",ID,\"mA\""
],
"language": "python",
diff --git a/Fundamental_of_Electronics_Devices/Ch8.ipynb b/Fundamental_of_Electronics_Devices/Ch8.ipynb
index f4ce4661..71bad3db 100644
--- a/Fundamental_of_Electronics_Devices/Ch8.ipynb
+++ b/Fundamental_of_Electronics_Devices/Ch8.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 8.1\n",
- "#Find Steady state photocurrent density\n",
"\n",
- "#given data \n",
"NA=10**22 #in atoms/m**3\n",
"ND=10**22 #in atoms/m**3\n",
"De=25*10**-4 \t#in m**2/s\n",
@@ -45,7 +42,6 @@
"GL=10**27\t\t\t#in m**-3 s**-1\n",
"\n",
"\n",
- "#calculation\n",
"import math\n",
"Le=math.sqrt(De*TAUeo*10**-9)\t#in um\n",
"Le=Le*10**6\t\t\t#in um\n",
@@ -58,7 +54,6 @@
"W=W*10**6\t\t\t#in um\n",
"JL=e*(W+Le+Lh)*10**-6*GL\t#in A/cm**2\n",
"\n",
- "#Result\n",
"print \"Steady state photocurrent density is \",round(JL/10**4,3),\"A/cm**2\""
],
"language": "python",
@@ -86,22 +81,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 8.2\n",
- "#Find Steady state photocurrent density\n",
"\n",
- "#given data \n",
"import math\n",
"W=25\t\t\t#in um\n",
"PhotonFlux=10**21\t#in m**2s**-1\n",
"alfa=10**5\t\t#in m**-1\n",
"e=1.6*10**-19\t\t#in Coulambs\n",
"\n",
- "#calculation\n",
"GL1=alfa*PhotonFlux\t#in m**-3s**-1\n",
"GL2=alfa*PhotonFlux*math.exp(-alfa*W*10**-6)\t#in m**-3s**-1\n",
"JL=e*PhotonFlux*(1-math.exp(-alfa*W*10**-6))\t#in mA/cm**2\n",
"\n",
- "#Result\n",
"print\"Steady state photocurrent density is \",round(JL/10,2),\"mA/cm**2\""
],
"language": "python",
@@ -129,10 +119,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 8.3\n",
- "#DEtermine Open circuit voltage .\n",
"\n",
- "#given data \n",
"NA=7.5*10**24\t\t#in atoms/m**3\n",
"ND=1.5*10**22\t\t#in atoms/m**3\n",
"De=25.0*10**-4\t\t#in m**2/s\n",
@@ -146,7 +133,6 @@
"VT=26.0\t\t\t#in mV\n",
"GL=10.0**27\t\t#in m**-3 s**-1\n",
"\n",
- "#Calculation\n",
"import math\n",
"Le=math.sqrt(De*TAUeo*10**-9)\t#in m\n",
"Le=Le*10**6\t\t\t#in um\n",
@@ -156,7 +142,6 @@
"JL=12.5\t\t\t\t#in mA/cm**2\n",
"VOC=VT*math.log(1.0+((JL*10**-3)/(JS*10**-4)))\t\t#in Volt\n",
"\n",
- "#Result\n",
"print\"Open circuit voltage is\",round(VOC/1000,3),\"V\"\n"
],
"language": "python",
@@ -184,21 +169,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exa 8.4\n",
- "#Find The total no. of cells required\n",
- "#given data \n",
"Vout=28\t\t\t#in Volts\n",
"Vcell=0.45\t\t#in Volt\n",
"n=Vout/Vcell\t\t#Unitless\n",
"Iout=1\t\t\t#in A\n",
"Icell=50\t\t#in mA\n",
"\n",
- "#Calculation\n",
"m=Iout/(Icell*10**-3)\t#unitless\n",
"\n",
- "#Result\n",
"print\"The total no. of cells required : \",round(m*n)\n",
- "#Note : Answer in the book is wrong."
],
"language": "python",
"metadata": {},
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_10_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_10_2.ipynb
index e8caa476..2dfe33d4 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_10_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_10_2.ipynb
@@ -9,59 +9,42 @@
{
"cell_type": "markdown",
"source": [
- "# Chapter 10 :- Refrigeration and Heat pump systems"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 10.1 Page no-459"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine",
- "# (a) the compressor power, in kW, ",
- "# (b) the refrigeration capacity, in tons, ",
- "# (c) the coefficient of performance, and ",
- "# (d) the coefficient of performance of a Carnot refrigeration cycle operating between warm and cold regions at 26 and 0\u0004C, respectively.",
"",
- "# Given:-",
"Tc = 273.00 # temperature of cold region in kelvin",
"Th = 299.00 # temperature of hot region in kelvin",
"mdot = 0.08 # mass flow rate in kg/s",
"",
- "# Analysis",
- "# At the inlet to the compressor, the refrigerant is a saturated vapor at 0\u0004C, so from Table A-10",
"h1 = 247.23 # in kj/kg",
"s1 = 0.9190 # in kj/kg.k",
"",
- "# The pressure at state 2s is the saturation pressure corresponding to 26\u0004C, or",
"p2 = 6.853 # in bars",
- "# The refrigerant at state 2s is a superheated vapor with",
"h2s = 264.7 # in kj/kg",
- "# State 3 is saturated liquid at 26\u0004C, so",
"h3 = 85.75 # in kj/kg",
"h4 = h3 # since The expansion through the valve is a throttling process",
"",
- "# Part(a)",
"Wcdot = mdot*(h2s-h1) # The compressor work input in KW",
"print '-> The compressor power, in kW, is: '",
"print round(Wcdot,2)",
"",
- "# Part(b)",
"Qindot = mdot*(h1-h4)*60/211 # refrigeration capacity in ton",
"print '-> The refrigeration capacity in tons is: '",
"print round(Qindot,2)",
"",
- "# Part(c)",
"beta = (h1-h4)/(h2s-h1)",
"print '-> The coefficient of performance is: '",
"print round(beta,2)",
"",
- "# Part(d)",
"betamax = Tc/(Th-Tc)",
"print '-> The coefficient of performance of a Carnot refrigeration cycle operating between warm and cold regions at 26 and 0\u0004C, respectively is: '",
"print betamax"
@@ -88,44 +71,29 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 10.2 Page no-462"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a)Determine for the modified vapor-compression refrigeration cycle (a) the compressor power, in kW",
- "# (b) the refrigeration capacity, in tons, ",
- "# (c) the coefficient of performance. Compare results with those of Example 10.1.",
"",
- "# Given:-",
"mdot = 0.08 # mass flow rate in kg/s",
- "# Analysis",
- "# At the inlet to the compressor, the refrigerant is a saturated vapor at \u000510\u0004C, so from Table A-10,",
"h1 = 241.35 # in kj/kg",
"s1 = .9253 # in kj/kg.k",
- "# Interpolating in Table A-12 gives",
"h2s = 272.39 # in kj/kg.k",
- "# State 3 is a saturated liquid at 9 bar, so",
"h3 = 99.56 # in kj/kg",
"h4 = h3 # since The expansion through the valve is a throttling process",
"",
- "# Part(a)",
"Wcdot = mdot*(h2s-h1) # The compressor power input in KW",
- "# Result",
"print '-> The compressor power in kw is: '",
"print round(Wcdot,2)",
"",
- "# Part(b)",
"Qindot = mdot*(h1-h4)*60/211 # refrigeration capacity in tons",
- "# Result",
"print '-> The refrigeration capacity in tons is: '",
"print round(Qindot,2)",
"",
- "# Part(c)",
"beta = (h1-h4)/(h2s-h1)",
- "# Result",
"print '-> The coefficient of performance is: '",
"print round(beta,2)"
],
@@ -149,37 +117,25 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 10.3 Page no-464"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine ",
- "# (a) the compressor power, in kW,",
- "# (b) the refrigeration capacity, in tons, ",
- "# (c) the coefficient of performance, ",
- "# (d) the rates of exergy destruction within the compressor and expansion valve, in kW, for T0 \u0003= 299 K (26\u0004C).",
"",
- "# Given:-",
"Tnot = 299 #in kelvin",
"etac = .8 #compressor efficiency of 80 percent",
"mdot = .08 #mass flow rate in kg/s",
- "#analysis",
- "#State 1 is the same as in Example 10.2, so",
"h1 = 241.35 #in kj/kg",
"s1 = .9253 #in kj/kg.k",
- "#from example 10.2",
"h2s = 272.39 #in kj/kg",
"h2 =(h2s-h1)/etac + h1 #in kj/kg",
- "#Interpolating in Table A-12,",
"s2 = .9497 #in kj/kg.k",
"",
"h3 = 91.49 #in kj/kg",
"s3 = .3396",
"h4 = h3 #since The expansion through the valve is a throttling process",
- "#from data table",
"hf4 = 36.97 #in kj/kg",
"hg4 = 241.36 #in kj/kg",
"sf4 = .1486 #in kj/kg.k",
@@ -187,19 +143,15 @@
"x4 = (h4-hf4)/(hg4-hf4) #quality at state 4",
"s4 = sf4 + x4*(sg4-sf4) #specific entropy at state 4 in kj/kg.k",
"",
- "#part(a)",
"Wcdot = mdot*(h2-h1) #compressor power in kw",
"print 'The compressor power in kw is: ',round(Wcdot,2),'kW'",
"",
- "#part(b)",
"Qindot = mdot*(h1-h4)*60/211 #refrigeration capacity in ton",
"print 'The refrigeration capacity in ton is: ',round(Qindot,2),'ton'",
"",
- "#part(c)",
"beta = (h1-h4)/(h2-h1) #coefficient of performance ",
"print 'The coefficient of performance is: ',round(beta,2)",
"",
- "#part(d)",
"Eddotc = mdot*Tnot*(s2-s1) #in kw",
"Eddotv = mdot*Tnot*(s4-s3) #in kw",
"print 'The rate of exergy destruction within the compressor is:',round(Eddotc,2),'kw.'",
@@ -224,52 +176,39 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 10.4 Page no-475"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the net power input, the refrigeration capacity, the coefficient of performance.",
- "# Given:-",
"p1 = 1.00 # in bar",
"T1 = 270.00 # in kelvin",
"AV = 1.4 # in m^3/s",
"r = 3.00 # compressor pressure ratio",
"T3 = 300.00 # turbine inlet temperature in kelvin",
"",
- "# Analysis",
- "# From Table A-22,",
"h1 = 270.11 # in kj/kg",
"pr1 = 0.9590",
- "# Interpolating in Table A-22,",
"h2s = 370.1 # in kj/kg",
- "# From Table A-22,",
"h3 = 300.19 # in kj/kg",
"pr3 = 1.3860",
- "# Interpolating in Table A-22, we obtain",
"h4s = 219.00 # in kj/kg",
- "# Calculations",
"pr2 = r*pr1",
"pr4 = pr3/r",
"",
- "# Part(a)",
"R = 8.314 # universal gas constant, in SI units",
"M = 28.97 # molar mass of air in grams",
"",
- "# Results",
"mdot = (AV*p1)/((R/M)*T1)*10**2 # mass flow rate in kg/s",
"Wcycledot = mdot*((h2s-h1)-(h3-h4s))",
"print '-> The net power input in kw is: '",
"print round(Wcycledot,2)",
"",
- "# Part(b)",
"Qindot = mdot*(h1-h4s) # refrigeration capacity in kw",
"print '-> The refregeration capacity in kw is: '",
"print round(Qindot,2)",
"",
- "# Part(c)",
"beta = Qindot/Wcycledot # coefficient of performance",
"print 'The coefficient of performance is: '",
"print round(beta,2)"
@@ -294,46 +233,33 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 10.5 Page no-477"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine net power input,the refrigeration capacity,the coefficient of performance, and interpret its value.",
"",
- "# Given:-",
- "# Part(a)",
"wcdots = 99.99 # work per unit mass for the isentropic compression determined with data from the solution in Example 10.4 in kj/kg",
"mdot = 1.807 # mass flow rate in kg/s from 10.4",
"etac = 0.8 # isentropic efficiency of compressor",
"Wcdot = (mdot*wcdots)/etac # The power input to the compressor in kw",
"",
- "# Using data form the solution to Example 10.4 gives",
"wtdots =81.19 # in kj/kg",
"etat = 0.8 # isentropic efficiency of turbine",
- "# Calculations",
"Wtdot = mdot*etat*wtdots # actual turbine work in kw",
"Wdotcycle = Wcdot-Wtdot # The net power input to the cycle in kw",
- "# Result",
"print '-> The net power input in kw is: '",
"print round(Wdotcycle,2)",
"",
- "# Part(b)",
"h3 = 300.19 # in kj/kg",
- "# From table A-22",
"h1 = 270.11 # in kj/kg",
- "# Calculations",
"h4 = h3 -Wtdot/mdot",
"Qindot = mdot*(h1-h4) # refrigeration capacity in kw",
- "# Result",
"print '-> The refrigeration capacity in kw is: '",
"print round(Qindot,2)",
"",
- "# Part(c)",
"beta = Qindot/Wdotcycle # coefficient of performance ",
- "# Result",
"print '-> The coefficient of performance is: '",
"print round(beta,2)"
],
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_11_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_11_2.ipynb
index cd37efd9..7d3e1d3a 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_11_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_11_2.ipynb
@@ -9,75 +9,50 @@
{
"cell_type": "markdown",
"source": [
- "#Chapter 11 :- Thermodynamic Relations"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 11.1 Page no-491"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine",
- "# (a) the generalized compressibility chart, ",
- "# (b) the ideal gas equation of state, (c) the van der Waals equation of state, ",
- "# (d) the Redlich\u2013Kwong equation of state. Compare the results obtained.",
"",
- "# Given:-",
"m = 4.00 # mass of carbon monoxide in kg",
"T = 223.00 # temperature of carbon monoxide in kelvin",
"D = 0.2 # inner diameter of cylinder in meter",
"L = 1.00 # length of the cylinder in meter",
"pi=3.14",
- "# Analysis",
"M = 28.00 # molar mass in kg/kmol",
- "# Calculations",
"V = (pi*D**2.00/4.00)*L # volume occupied by the gas in m^3",
"vbar = M*(V/m) # The molar specific volume in m^3/kmol",
"",
- "# Part(a)",
- "# From Table A-1 for CO",
"Tc = 133 # in kelvin",
"Pc = 35 # in bar",
"Tr = T/Tc # reduced temperature",
"Rbar = 8314 # universal gas constant in N.m/kmol.K",
"Z = 0.9",
- "# Calculations",
"vrdash = (vbar*Pc*10**5)/(Rbar*Tc) # pseudoreduced specific volume",
"p = (Z*Rbar*T/vbar)*10**-5 # in bar",
- "# Result",
"print '-> part(a)the pressure in bar is: '",
"print round(p,2)",
"",
- "# Part(b)",
- "# The ideal gas equation of state gives",
- "# Calculations",
"p = (Rbar*T/vbar)/10**5 # in bar",
- "# Result",
"print '-> Part(b)the pressure in bar is: '",
"print round(p,2)",
"",
- "# Part(c)",
- "# For carbon monoxide, the van der Waals constants a and b can be read directly from Table A-24",
"a = 1.474 # in (m^3/kmol)^2",
"b = 0.0395 # in m^3/kmol",
- "# Calculations",
"p = (Rbar*T/(vbar-b))/10**5 - a/vbar**2",
- "# Result",
"print '-> Part(c)the pressure in bars is: '",
"print round(p,2)",
"",
- "# Part(d)",
- "# For carbon monoxide, the Redlich\u2013Kwong constants can be read directly from Table A-24",
"a = 17.22 # in m^6*K^.5/kmol^2",
"b = 0.02737 # in m^3/kmol",
- "# Calculations",
"p = (Rbar*T/(vbar-b))/10**5 - a/(vbar*(vbar+b)*T**.5)",
- "# Result",
"print '-> Part(d)the pressure in bar is: '",
"print round(p,2)"
],
@@ -123,24 +98,16 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 11.3 Page no-501"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Evaluate the partial derivative (dels/delv)T for water vapor ",
- "# (a) Use the Redlich\u2013Kwong equation of state and an appropriate Maxwell relation. ",
- "# (b) Check the value obtained using steam table data.",
"",
- "# Given:-",
- "# Part(a)",
"v = 0.4646 # specific volume in in m^3/kg",
"M = 18.02 # molar mass of water in kg/kmol",
- "# At the specified state, the temperature is 513 K and the specific volume on a molar basis is",
"vbar = v*M # in m^3/kmol",
- "# From Table A-24",
"a = 142.59 # (m^3/kmol)^2 * K^.5",
"b = 0.0211 # in m^3/kmol",
"",
@@ -148,23 +115,17 @@
"T = 513.0 # in kelvin",
"delpbydelT = (Rbar/(vbar-b) + a/(2*vbar*(vbar+b)*T**1.5)*10**5)/10**3 # in kj/(m^3*K)",
"",
- "# By The Maxwell relation",
"delsbydelv = delpbydelT",
- "# Result",
"print '-> The value of delpbydelT in kj/(m^3*K) is: ',delpbydelT",
"",
- "# Part(b)",
"from pylab import *",
- "# A value for (dels/delv)T can be estimated using a graphical approach with steam table data, as follows: At 240\u0004C, Table A-4 provides the values for specific entropy s and specific volume v tabulated below",
"T = 240.0 # in degree celcius",
- "# At p =1, 1.5, 3, 5, 7, 10 bar respectively",
"y = [7.994, 7.805, 7.477, 7.230, 7.064, 6.882] # in kj/kg.k # in kj/kg.k",
"x = [2.359, 1.570, 0.781, 0.4646, 0.3292, 0.2275] # in m^3/kg # in m^3/kg",
"plot(x,y)",
"xlabel(\"Specific volume\")",
"ylabel(\"Specific entropy\")",
"show()",
- "# The pressure at the desired state is 5 bar.The corresponding slope is",
"delsbydelv = 1 # in kj/m^3.K",
"print '-> From the data of the table,delsbydelv = ',delsbydelv"
],
@@ -194,49 +155,32 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 11.4 Page no-506"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate (a) hg -\u0005 hf, (b) ug -\u0005 uf, (c) sg -\u0005 sf. Compare with the respective steam table value.",
"",
- "# Given:-",
- "# Analysis",
- "# For comparison, Table A-2 gives at 100\u0004C,",
"hgf =2257.00 # in kj/kg",
"ugf = 2087.6 # in kj/kg",
"sgf = 6.048 # in kj/kg.K",
- "# Values",
"print '-> From table, hg-hf = ',hgf",
"print '-> From table, ug-uf = ',ugf",
"print '-> From table, sg-sf = ',sgf",
"",
- "# Part(a)",
"T = 373.15 # in kelvin",
- "# If we plot a graph between temperature and saturation pressure using saturation pressure\u2013temperature data from the steam tables, the desired slope is:",
"delpbydelT = 3570.00 # in N/(m^2.K)",
"vg = 1.673 # in m^3/kg",
"vf = 1.0435e-3 # in m^3/kg",
- "# Calculations",
- "# From the Clapeyron equation",
"hgf = T*(vg-vf)*delpbydelT*10**-3 # in kj/kg",
- "# Result",
"print '-> Part(a)using Clapeyron equation, hg-hf = ', round(hgf,2)",
"",
- "# Part(b)",
"psat = 1.014e5 # in N/m^2",
"hgf = 2256.00 # can be obtained using IT software in kj/kg",
- "# Calculations",
"ugf = hgf - psat*(vg-vf)/10**3 # in kj/kg",
- "# Result",
"print '-> Part(b)ug-uf = ', round(ugf,2)",
- "# Part(c)",
- "# Calculation",
"sgf =hgf/T # in kj/kg.K ",
- "# Result",
"print '-> Part(c)sg-sf = ', round(sgf,2)"
],
"language": "python",
@@ -259,35 +203,25 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 11.6 Page no-517"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# estimate (a) the percent error in cv, assumed that cp =\u0003 cv, (b) the velocity of sound, in m/s.",
"",
- "# Given:-",
- "# Part(a)",
"v = 1.00/998.21 # specific volume of water in m^3/kg",
"T = 293.00 # given temperature in kelvin",
"beta = 206.6e-6 # volume expansivity in /K",
"k = 45.90e-6 # isothermal compressibility in /bar",
- "# Interpolating in Table A-19",
"cp = 4.188 # in kj/kg.k",
- "# Calculations",
"cpv = (v*T*beta**2.00/k)*10**2 # in kj/kg.k",
"cv = cp-cpv # in kj/kg.k",
"errorPercentage = 100*(cp-cv)/cv",
- "# Result",
"print '-> The percentage error is: ',round(errorPercentage,2)",
"",
- "# Part(b)",
- "# Calculations",
"K = cp/cv # specific heat ratio",
"c = ((K*v/k)*10**5)**0.5 # velocity of sound in m/s",
- "# Result",
"print '-> The velocity of sound is: ',round(c,2),'m/s'"
],
"language": "python",
@@ -306,26 +240,21 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 11.8 Page no-526"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the work developed",
"",
- "# Given:-",
"p1 = 100.00 # in bar",
"T1 = 300.00 # in kelvin",
"p2 = 40.00 # in bar",
"T2 = 245.00 # in kelvin",
"",
"",
- "# From table A-23",
"h1starbar = 8723.00 # in kj/kmol",
"h2starbar = 7121.00 # in kj/kmol",
- "# From Tables A-1",
"Tc = 126.00 # critical temperature in kelvin",
"pc = 33.9 # critical pressure in bar",
"M = 28.00 # molar mass in kg/kmol",
@@ -333,14 +262,12 @@
"Term1 = 0.5 ",
"Term2 = 0.31",
"",
- "# Calculations",
"TR1 = T1/Tc # reduced temperature at the inlet",
"PR1 = p1/pc # reduced pressure at the inlet",
"TR2 = T2/Tc # reduced temperature at the exit",
"PR2 = p2/pc # reduced pressure at the exit",
"wcvdot = (1.00/M)*(h1starbar-h2starbar-Rbar*Tc*(Term1-Term2)) # in kj/kg",
"",
- "# Result",
"print '-> The work developed, in kJ per kg of nitrogen flowing is : '",
"print round(wcvdot,2)"
],
@@ -360,18 +287,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 11.9 Page no-529"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine (a) the rate of entropy production, in and (b) the isentropic turbine efficiency.",
"",
- "# Given:-",
- "# Part(a)",
- "# With values from Table A-23",
"sT2bar = 185.775 # in kj/(kmol.K)",
"sT1bar = 191.682 # in kj/(kmol.K)",
"Rbar = 8.314 # universal gas constant",
@@ -381,16 +303,12 @@
"Term1 = 0.21",
"Term2 = 0.14",
"",
- "# Calculations",
"import math",
"S2StarBarMinusS1StarBar = sT2bar-sT1bar-Rbar*math.log(p2/p1) # The change in specific entropy in kj/(kmol.K)",
"sigmacvdot = (1.00/M)*(S2StarBarMinusS1StarBar-Rbar*(Term2-Term1))",
- "# Result",
"print '-> the rate of entropy production in kj/kg.K is: '",
"print round(sigmacvdot,2)",
"",
- "# Part(b)",
- "# From Table A-23,",
"h2starbar = 6654.00 # in kj/kmol",
"h1starbar = 8723.00 # in kj/kmol",
"Tc = 126.00 # critical temperature in kelvin",
@@ -398,11 +316,9 @@
"Term1 = 0.5",
"wcvdot = 50.1 # from example 11.8",
"",
- "# Calculations",
"wcvdots = (1.00/M)*(h1starbar-h2starbar-Rbar*Tc*(Term1-Term2)) # isentropic work in kj/kg",
"etat = wcvdot/wcvdots # turbine efficiency",
"",
- "# Result",
"print '-> The isentropic turbine efficiency is: '",
"print round(etat,2)"
],
@@ -424,39 +340,28 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 11.10 Page no-533"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the pressure, (a) the ideal gas equation of state, (b) Kay\u2019s rule together with the generalized compressibility chart, ",
- "# (c) the van der Waals equation, ",
- "# (d) the rule of additive pressures employing the generalized compressibility chart. Compare the calculated values with the known experimental value.",
"",
- "# Given:-",
- "# Analysis",
"V = 0.241 # volume of the mixture in m^3",
"T = 511.00 # temperature of the mixture in kelvin",
"n1 = 0.18 # number of moles of methane in kmol",
"n2 = 0.274 # number of moles of butane in kmol",
"Rbar = 8314 # universal gas constant in (N.m)/(kmol.K)",
"",
- "# Calculations",
"n = n1 + n2 # The total number of moles of mixture",
"y1 = n1/n # mole fraction of methane",
"y2 = n2/n # mole fraction of butane",
"vbar = V/(n) # The specific volume of the mixture on a molar basis in m^3/kmol",
"",
- "# Part(a)",
"p = (Rbar*T/vbar)*10**-5 # in bar",
- "# Result",
"print '-> The pressure in bar obtained using ideal gas equation is: '",
"print round(p,2)",
"",
- "# Part(b)",
- "# From table A-1",
"Tc1 = 191.00 # critical temperature for methane in kelvin ",
"Pc1 = 46.4 # critical pressure for methane in bar",
"Tc2 = 425.00 # critical temperature for butane in kelvin",
@@ -464,45 +369,34 @@
"Z = 0.88",
"",
"",
- "# Calculations",
"Tc = y1*Tc1 + y2*Tc2 # critical temperature in kelvin",
"Pc = y1*Pc1 + y2*Pc2 # critical pressure in bar",
"TR = T/Tc # reduced temperature of the mixture",
"vRdash= vbar*Pc/(Rbar*Tc)",
"p = ((Z*Rbar*T)/vbar)*10**-5 # mixture pressure in bar",
- "# Result",
"print '-> Pressure obtained using Kay\u2019s rule together with the generalized compressibility chart, is: '",
"print round(p,2)",
"",
- "# Part(c)",
- "# Table A-24 gives the following van der Waals constants values for methane",
"a1 = 2.293 # in (m^3/kmol)^2",
"b1 = 0.0428 # in m^3/kmol",
- "# Table A-24 gives the following van der Waals constants values for butane",
"a2 = 13.86 # in (m^3/kmol)^2",
"b2 = 0.1162 # in m^3/kmol",
"",
"a = (y1*a1**.5 + y2*a2**.5)**2 # in bar*(m^3/kmol)^2",
"b = y1*b1+y2*b2 # in m^3/kmol",
- "# From van der Waals equation",
"p = ((Rbar*T)/(vbar-b))*10**-5 - a/(vbar**2)",
"print '-> The pressure in bar from van der Waals equation is: '",
"print round(p,2)",
"",
- "# Part(d)",
- "# For methane",
"TR1 = T/Tc1",
"vR1dash = (.241/.18)*10**5*Pc1/(Rbar*Tc1)",
"Z1 = 1.00",
- "# For butane",
"TR2 = T/Tc2",
"vR2dash = (.88*10**5*Pc2)/(Rbar*Tc2)",
"Z2 = 0.8",
"Z = y1*Z1 + y2*Z2",
- "# Accordingly, the same value for pressure as determined in part (b) using Kay\u2019s rule results:",
"p = 70.4",
"",
- "# Result",
"print '-> The pressure in bar obtained using the rule of additive pressures employing the generalized compressibility chart is: '",
"print round(p,2)"
],
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_12_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_12_2.ipynb
index 1d9602e5..6cbc550b 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_12_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_12_2.ipynb
@@ -9,45 +9,36 @@
{
"cell_type": "markdown",
"source": [
- "#Chapter 12 :- Ideal Gas Mixtures: General Considerations"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 12.1 Page no-560"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) Determine the apparent molecular weight of the mixture. (b) Determine the composition in terms of mass fractions (gravimetric analysis).",
"",
- "# Given:-",
"n1 = 0.08 # mole fraction of CO2",
"n2 = 0.11 # mole fraction of H2O",
"n3 = 0.07 # mole fraction of O2",
"n4 = 0.74 # mole fraction of N2",
"",
- "# Part(a)",
"M1 = 44.0 # molar mass of CO2 in kg/kmol",
"M2 = 18.0 # molar mass of H2O in kg/kmol",
"M3 = 32.0 # molar mass of O2 in kg/kmol",
"M4 = 28.0 # molar mass of N2 in kg/kmol",
"",
- "# Calculations",
"M = M1*n1 + M2*n2 + M3*n3 + M4*n4 # in kg/kmol",
- "# Result",
"print 'The apparent molecular weight of the mixture in kg/kmol is: ',M",
"",
- "# Part(b)",
"mf1 = (M1*n1/M)*100.0 # mass fraction of CO2 in percentage ",
"mf2 = (M2*n2/M)*100.0 # mass fraction of H2O in percentage",
"mf3 = (M3*n3/M)*100.0 # mass fraction of O2 in percentage",
"mf4 = (M4*n4/M)*100.0 # mass fraction of N2 in percentage",
"",
- "# Results",
"print 'The mass fraction of CO2 in percentage is: ',mf1",
"print 'The mass fraction of H2O in percentage is: ',mf2",
"print 'The mass fraction of O2 in percentage is: ',mf3",
@@ -72,39 +63,30 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 12.2 Page no-561"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine (a) the composition in terms of mole fractions (b) the apparent molecular weight of the mixture.",
"",
- "# Given:-",
"mf1 = 0.1 # mass fractiion of H2",
"mf2 = 0.6 # mass fraction of N2",
"mf3 = 0.3 # mass fraction of CO2",
"",
- "# Part(a)",
"M1 = 2.0 # molar mass of H2 in kg/kmol",
"M2 = 28.0 # molar mass of N2 in kg/kmol",
"M3 = 44.0 # molar mass of CO2 in kg/kmol",
"",
- "# Calculations",
"n1 = (mf1/M1)/(mf1/M1 + mf2/M2 + mf3/M3) # mole fraction of H2 ",
"n2 = (mf2/M2)/(mf1/M1 + mf2/M2 + mf3/M3) # mole fraction of N2",
"n3 = (mf3/M3)/(mf1/M1 + mf2/M2 + mf3/M3) # mole fraction of CO2",
"",
- "# Results",
"print 'The mole fraction of H2 in percentage is: ',n1*100",
"print 'The mole fraction of N2 in percentage is: ',n2*100",
"print 'The mole fraction of CO2 in percentage is: ',n3*100",
"",
- "# Part(b)",
- "# Calculation",
"M = n1*M1 + n2*M2 + n3*M3 # in kg/kmol",
- "# Result",
"print 'The apparent molecular weight of the mixture in kg/kmol is: ',M"
],
"language": "python",
@@ -125,16 +107,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 12.3 Page no-569"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the final temperature, the work, heat transfer, change in entropy of the mixture.",
"",
- "# Given:-",
"m1 = 0.3 # mass of CO2 in kg",
"m2 = 0.2 # mass of N2 in kg",
"p1 = 1.0 # in bar",
@@ -142,44 +121,30 @@
"p2 = 3.0 # in bar",
"n = 1.25",
"",
- "# Part(a)",
- "# Calculation",
"T2 = T1*(p2/p1)**((n-1)/n) # in kelvin",
- "# Result",
"print 'The final temperature in Kelvin is: ',T2",
"",
- "# Part(b)",
"Rbar = 8.314 # universal gas constant in SI units",
- "# Calculations",
"M = (m1+m2)/(m1/44 + m2/28) # molar mass of mixture in kg/kmol",
"W = ((m1+m2)*(Rbar/M)*(T2-T1))/(1-n) # in kj",
- "# Result",
"print 'The work in kj is: ',W ",
"",
- "# Part(c)",
- "# From table A-23",
"uCO2T1 = 6939.0 # internal energy of CO2 on molar mass basis at temperature T1",
"uCO2T2 = 9198.0 # internal energy of CO2 on molar mass basis at temperature T2",
"uN2T1 = 6229.0 # internal energy of N2 on molar mass basis at temperature T1",
"uN2T2 = 7770.0 # internal energy of N2 on molar mass basis at temperature T2",
"deltaU = (m1/44)*(uCO2T2-uCO2T1) + (m2/28)*(uN2T2-uN2T1) # internal energy change of the mixture in KJ",
"",
- "# With assumption, The changes in kinetic and potential energy between the initial and final states can be ignored",
"Q = deltaU + W",
- "# Result",
"print 'The heat transfer in kj is: ',Q",
"",
- "# Part(d)",
- "# From table A-23",
"sbarT2CO2 = 222.475",
"sbarT1CO2 = 213.915 ",
"sbarT2N2 = 198.105",
"sbarT1N2 = 191.682",
"Rbar = 8.314 # universal gas constant",
- "# Calculation",
"import math",
"deltaS = (m1/44)*(sbarT2CO2-sbarT1CO2-Rbar*math.log(p2/p1)) + (m2/28)*(sbarT2N2-sbarT1N2-Rbar*math.log(p2/p1))",
- "# Result",
"print 'The change in entropy of the mixture in kj/k is: ',deltaS"
],
"language": "python",
@@ -200,7 +165,6 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 12.4 Page no-571"
]
},
{
@@ -208,9 +172,7 @@
"collapsed": false,
"input": [
"",
- "# Determine temperature at the nozzle exit, entropy changes of the CO2 and O2 from inlet to exit, exit velocity,",
"",
- "# Given:-",
"y1 = 0.8 # mole fraction of CO2",
"y2 = 0.2 # mole fraction of O2",
"T1 = 700.0 # in kelvin",
@@ -219,45 +181,31 @@
"p2 = 1.0 # in bars",
"",
"",
- "# Part(a)",
- "# From table A-23",
"sO2barT1 = 231.358",
"sCO2barT1 = 250.663",
- "# Calculations",
"import math",
"RHS = y2*sO2barT1 + y1*sCO2barT1 + 8.314*math.log(p2/p1)",
- "# Using table A-23",
"LHSat510K = y2*221.206 + y1*235.7",
"LHSat520K = y2*221.812 + y1*236.575",
- "# Using linear interpolation,",
"T2 = 510 +((520-510)/(LHSat520K-LHSat510K))*(RHS-LHSat510K)",
- "# Result ",
"print 'The temperature at the nozzle exit in K is: ',T2",
"",
- "# Part(b)",
- "# From table A-23",
"sbarO2T2 = 221.667 # in kj/kmol.K",
"sbarO2T1 = 231.358 # in kj/kmol.K",
"sbarCO2T2 = 236.365 # in kj/kmol.K",
"sbarCO2T1 = 250.663 # in kj/kmol.K",
- "# Calculations",
"deltasbarO2 = sbarO2T2-sbarO2T1-8.314*math.log(p2/p1) # in kj/kmol.K",
"deltasbarCO2 = sbarCO2T2-sbarCO2T1-8.314*math.log(p2/p1) # in kj/kmol.K",
- "# Results",
"print 'The entropy changes of the CO2 from inlet to exit, in KJ/Kmol.K is: ',deltasbarCO2",
"print 'The entropy change of the O2 from inlet to the exit in kj/kmol.k is: ',deltasbarO2",
"",
- "# Part(c)",
- "# From table A-23, the molar specific enthalpies of O2 and CO2 are",
"h1barO2 = 21184.0",
"h2barO2 = 15320.0",
"h1barCO2 = 27125.0",
"h2barCO2 = 18468.0",
- "# Calculations",
"M = y1*44.0 + y2*32.0 # apparent molecular weight of the mixture in kg/kmol",
"deltah = (1.0/M)*(y2*(h1barO2-h2barO2) + y1*(h1barCO2-h2barCO2))",
"V2 = math.sqrt(V1**2+ 2*deltah*10**3)",
- "# Result",
"print 'The exit velocity in m/s is: ',V2"
],
"language": "python",
@@ -278,16 +226,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 12.5 Page no-574"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine final temperature of the mixture, final pressure of the mixture, amount of entropy produced in the mixing process",
"",
- "# Given:-",
"nN2 = 0.79 # initial moles of nitrogen in kmol",
"pN2 = 2.0 # initial pressure of nitrogen in bars",
"TN2 = 250.0 # initial temperature of nitrogen in kelvin",
@@ -295,33 +240,23 @@
"pO2 = 1.0 # initial pressure of oxygen in bars",
"TO2 = 300.0 # initial temperature of oxygen in kelvin",
"",
- "# Part(a)",
"MN2 = 28.01 # molar mass of nitrogen in kg/kmol",
"MO2 = 32.0 # molar mass of oxygen in kg/kmol",
- "# Calculations",
- "# With the help of table A-20",
"cvbarN2 = MN2*0.743 # in kj/kmol.K",
"cvbarO2 = MO2*0.656 # in kj/kmol.K",
"T2 = (nN2*cvbarN2*TN2+nO2*cvbarO2*TO2)/(nN2*cvbarN2+nO2*cvbarO2)",
- "# Result",
"print 'The final temperature of the mixture in kelvin is: ',T2",
"",
- "# Part(b)",
- "# Calculation",
"p2 = ((nN2+nO2)*T2)/(nN2*TN2/pN2 + nO2*TO2/pO2)",
- "# Result",
"print 'The final pressure of the mixture in bar is: ',p2",
"",
- "# Part(c)",
"Rbar = 8.314 # universal gas constant",
- "# Calculations",
"import math",
"cpbarN2 = cvbarN2 + Rbar",
"cpbarO2 = cvbarO2 + Rbar",
"yN2 = nN2/(nN2+nO2) # mole fraction of N2",
"yO2 = nO2/(nN2+nO2) # mole fraction of O2",
"sigma = nN2*(cpbarN2*math.log(T2/TN2)-Rbar*math.log(yN2*p2/pN2)) + nO2*(cpbarO2*math.log(T2/TO2)-Rbar*math.log(yO2*p2/pO2))",
- "# Result",
"print 'The amount of entropy produced in the mixing process, in kJ/K is: ',sigma"
],
"language": "python",
@@ -341,16 +276,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 12.6 Page no-577"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine mass flow rates of the dry air and oxygen, mole fractions of the dry air and oxygen in the exiting mixture, time rate of entropy production",
"",
- "# Given:-",
"T1 = 32.0 # temperature of dry air in degree celcius",
"p1 = 1.0 # pressure of dry air in bar",
"AV1 = 100.0 # volume rate of dry air in m^3/min",
@@ -359,43 +291,33 @@
"T3 = 47.0 # temperature of mixed stream in degree celcius",
"p3 = 1.0 # pressure of mixed stream in bar",
"",
- "# Part(a)",
"Rbar = 8314.0 # universal gas constant",
"Ma = 28.97 # molar mass of air",
"Mo = 32.0 # molar mass of oxygen",
- "# From table A-22 and A-23",
"haT3 = 320.29 # in kj/kg",
"haT1 = 305.22 # in kj/kg",
"hnotT2 = 11711.0 # in kj/kmol",
"hnotT1 = 9325.0 # in kj/kmol",
"",
- "# Calculations",
"va1 = (Rbar/Ma)*(T1+273.0)/(p1*10**5) # specific volume of air in m^3/kg",
"ma1dot = AV1/va1 # mass flow rate of dry air in kg/min",
"modot = ma1dot*(haT3-haT1)/((1/Mo)*(hnotT2-hnotT1)) # in kg/min",
- "# Results",
"print 'The mass flow rate of dry air in kg/min is: ',ma1dot",
"print 'The mass flow rate of oxygen in kg/min is: ',modot",
"",
- "# Part(b)",
"nadot = ma1dot/Ma # molar flow rate of air in kmol/min",
"nodot = modot/Mo # molar flow rate of oxygen in kmol/min",
"ya = nadot/(nadot+nodot) # mole fraction of air",
"yo = nodot/(nadot+nodot) # mole fraction of oxygen",
- "# Results",
"print 'The mole fraction of dry air in the exiting mixture is: ',ya",
"print 'The mole fraction of dry oxygen in the exiting mixture is: ',yo",
"",
- "# Part(c)",
- "# With the help of tables A-22 and A-23",
"sanotT3 = 1.7669 # in kj/kg.K",
"sanotT1 = 1.71865 # in kj/kg.K",
"sbarT3 = 207.112 # in kj/kmol.K",
"sbarT2 = 213.765 # in kj/kmol.K",
- "# Calculations",
"import math",
"sigmadot = ma1dot*(sanotT3-sanotT1-(8.314/Ma)*math.log(ya))+ (modot/Mo)*(sbarT3-sbarT2-8.314*math.log(yo))",
- "# Result",
"print 'The time rate of entropy production, in kJ/K . min is: ',sigmadot"
],
"language": "python",
@@ -417,39 +339,26 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 12.7 Page no-584"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine initial humidity ratio, dew point temperature, amount of water vapor that condenses.",
"",
- "# Given:-",
"m =1.0 # mass of sample in kg",
"T1 = 21.0 # initial temperature in degree celcius",
"psi1 = 0.7 # initial relative humidity",
"T2 = 5.0 # final temperature in degree celcius",
"",
- "# Part(a)",
- "# From table A-2",
"pg = 0.02487 # in bar",
- "# Calculations ",
"pv1 = psi1*pg # partial pressure of water vapor in bar",
"omega1 = 0.622*(0.2542)/(14.7-0.2542)",
- "# Result ",
"print 'the initial humidity ratio is: ',omega1",
"",
- "# Part(b)",
- "# The dew point temperature is the saturation temperature corresponding to the partial pressure, pv1. Interpolation in Table A-2 gives",
"T = 15.3 # the dew point temperature in degree celcius",
- "# Result",
"print 'The dew point temperature in degree celcius is: ',T",
"",
- "# Part(c)",
- "# The partial pressure of the water vapor remaining in the system at the final state is the saturation pressure corresponding to 5\u0004C:",
- "# Calculations",
"mv1 = 1/((1/omega1)+1) # initial amount of water vapor in the sample in kg",
"ma = m-mv1 # mass of dry air present in kg",
"pg = 0.00872 # in bar",
@@ -457,7 +366,6 @@
"mv2 = omega2*ma # The mass of the water vapor present at the final state",
"mw = mv1-mv2",
"",
- "# Result",
"print 'The amount of water vapor that condenses, in kg. is: ',mw"
],
"language": "python",
@@ -477,52 +385,37 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 12.8 Page no-586"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine dew point temperature corresponding to the initial state, the temperature at which condensation actually begins, the amount of water condensed.",
"",
- "# Given:-",
"V = 35.0 # volume of the vessel in m^3",
"p1 = 1.5 # in bar",
"T1 = 120.0 # in degree celcius",
"psi1 = 0.1 ",
"T2 = 22.0 # in degree celcius",
"",
- "# Part(a)",
- "# The dew point temperature at the initial state is the saturation temperature corresponding to the partial pressure pv1. With the given relative humidity and the saturation pressure at 120\u0004C from Table A-2",
"pg1 = 1.985",
- "# Interpolating in Table A-2 gives the dew point temperature as",
"T = 60.0 # in degree celcius",
- "# Calculation",
"pv1 = psi1*pg1 # partial pressure in bar",
- "# Result",
"print 'The dew point temperature corresponding to the initial state, in degee celcius is: ',T",
"",
- "# Part(b)",
"Rbar = 8314.0 # universal gas constant",
"Mv = 18.0 # molar mass of vapor in kj/kmol",
- "# Interpolation in Table A-2",
"Tdash = 56.0 # in degrees",
"vv1 =((Rbar/Mv)*(T1+273))/(pv1*10**5) # the specific volume of the vapor at state 1 in m^3/kg",
- "# Result",
"print 'The temperature at which condensation actually begins in degree celcius is: ',Tdash",
"",
- "# Part(c)",
- "# From table ",
"vf2 = 1.0022e-3",
"vg2 = 51.447",
"vv2 = vv1 # specific volume at final state",
- "# Calculations",
"mv1 = V/vv1 # initial amount of water vapor present in kg",
"x2 = (vv2-vf2)/(vg2-vf2) # quality",
"mv2 = x2*mv1 # the mass of the water vapor contained in the system at the final state",
"mw2 = mv1-mv2",
- "# Result",
"print 'The amount of water condense in kg is: ',mw2"
],
"language": "python",
@@ -542,16 +435,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 12.9 Page no-587"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the heat transfer during the process",
"",
- "# Given:-",
"V = 35.0 # volume of vessel in m^3",
"p1 = 1.5 # initial pressure in bar",
"T1 = 120.0 # initial temperature in degree celcius",
@@ -563,18 +453,15 @@
"mv2 = 0.681 # in kg, from examples 12.8",
"mv1 = 3.827 # in kg, from example 12.8",
"mw2 = 3.146 # in kg, from example 12.8",
- "# evaluating internal energies of dry air and water from Tables A-22 and A-2, respectively",
"ua2 = 210.49 # in kj/kg",
"ua1 = 281.1 # in kj/kg",
"ug2 = 2405.7 # in kj/kg",
"uf2 = 92.32 # in kj/kg",
"ug1 = 2529.3 # in kj/kg",
"",
- "# Calculations",
"ma =( ((p1-pv1)*10**5)*V)/((Rbar/Ma)*(T1+273)) # mass of dry air in kg",
"Q = ma*(ua2-ua1) + mv2*ug2 + mw2*uf2 - mv1*ug1",
"",
- "# Result",
"print 'The heat transfer during the process, in kJ is: ',Q"
],
"language": "python",
@@ -592,50 +479,37 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 12.10 Page no-595"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine rate of heat transfer,the relative humidity at the exit. Changes in kinetic and potential energy can be ignored.",
"",
- "# Given :-",
"AV1 = 150.0 # entry volumetric flow rate in m^3/min",
"T1 = 10.0 # entry temperature in degree celcius",
"psi1 = 0.8 ",
"T2 = 30.0 # exit temperature in degree celcius",
"p = 1.0 # in bar",
"",
- "# Part(a)",
"Rbar = 8314.0 # universal gas constant",
"Ma = 28.97 # molar mass of air",
- "# The specific enthalpies of the dry air are obtained from Table A-22 at the inlet and exit temperatures T1 and T2, respectively:",
"ha1 = 283.1 # in kj/kg",
"ha2 = 303.2 # in kj/kg",
- "# The specific enthalpies of the water vapor are found using hv \u0004 hg and data from Table A-2 at T1 and T2, respectively:",
"hv1 = 2519.8 # in kj/kg",
"hv2 = 2556.3 # in kj/kg",
- "# From table A-2",
"pg1 = 0.01228 # in bar",
- "# Calculations",
"pv1 = psi1*pg1 # the partial pressure of the water vapor in bar",
"pa1 = p-pv1",
"va1 = (Rbar/Ma)*(T1+273)/(pa1*10**5) # specific volume of the dry air in m^3/kg",
"madot = AV1/va1 # mass flow rate of the dry air in kg/min",
"omega = 0.622*(pv1/(p-pv1)) # humidity ratio",
"Qcvdot = madot*((ha2-ha1)+omega*(hv2-hv1)) # in kj/min",
- "# Result",
"print 'Rate of heat transfer, in kJ/min is: ',Qcvdot",
"",
- "# Part(b)",
- "# From Table A-2 at 30\u0004C",
"pg2 = 0.04246 # in bar",
- "# Calculations",
"pv2 = pv1",
"psi2 = pv2/pg2 # relative humidity at the exit",
- "# Result",
"print 'The relative humidity at the exit is: ',psi2"
],
"language": "python",
@@ -654,54 +528,39 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 12.11 Page no-600"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the mass flow rate of the dry air, the rate at which water is condensed, in kg per kg of dry air flowing through the control volume, the required refrigerating capacity",
"",
- "# Given:-",
"T1 = 30.0 # in degree celcius",
"AV1 = 280.0 # in m^3/min",
"psi1 = 0.5 # relative humidity at the inlet",
"T2 = 10.0 # in degree celcius",
"p = 1.013 # pressure in bar",
"",
- "# Part(a)",
- "# From table A-2",
"pg1 = 0.04246 # in bar",
"Rbar = 8314 # universal gas constant",
"Ma = 28.97 # molar mass of air",
- "# Calculations",
"pv1 = psi1*pg1 # in bar",
"pa1 = p-pv1 # partial pressure of the dry air in bar",
"madot = AV1/((Rbar/Ma)*((T1+273)/(pa1*10**5))) # common mass flow rate of the dry air in kg/min",
- "# Result",
"print 'The mass flow rate of the dry air in kg/min is: ',madot",
"",
- "# Part(b)",
- "# From table A-2",
"pv2 = 0.01228 # in bar",
- "# Calculations",
"omega1 = 0.622*(pv1/(p-pv1))",
"omega2 = 0.622*(pv2/(p-pv2))",
"mwdotbymadot = omega1-omega2 ",
- "# Result",
"print 'The rate at which water is condensed, in kg per kg of dry air flowing through the control volume is: ',mwdotbymadot",
"",
- "# Part(c)",
- "# From table A-2 and A-22",
"ha2 = 283.1 # in kg/kj",
"ha1 = 303.2 # in kg/kj",
"hg1 = 2556.3 # in kg/kj",
"hg2 = 2519.8 # in kg/kj",
"hf2 = 42.01 # in kg/kj",
- "# Calculations",
"Qcvdot = madot*((ha2-ha1)-omega1*hg1+omega2*hg2+(omega1-omega2)*hf2) # in kj/min",
- "# Result",
"print 'The required refrigerating capacity, in tons is: ',Qcvdot/211"
],
"language": "python",
@@ -721,16 +580,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 12.12 Page no-602"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine at the exit (a) the humidity ratio and (b) the temperature",
"",
- "# Given:-",
"T1 = 22.0 # entry temperature of moist air in degree celcius",
"Twb = 9.0 # wet-bulb temperature of entering moist air in degree celcius",
"madot = 90.0 # mass flow rate of dry air in kg/min",
@@ -738,20 +594,11 @@
"mstdot = 52.0 # mass flow rate of injected saturated water vapor in kg/h",
"p = 1.0 # pressure in bar",
"",
- "# Part(a)",
- "# By inspection of the psychrometric chart",
"omega1 = 0.002",
- "# Calculation",
"omega2 = omega1 + mstdot/(madot*60)",
- "# Result",
"print 'The humidity ratio at the exit is: ',omega2",
"",
- "# Part(b)",
- "# The steady-state form of the energy rate balance can be rearranged as",
- "# (ha + omega*hg)2 = (ha + omega*hg)1 + (omega2-omega1)*hg3",
- "# On putting values in the above equation from tables and figures, temperature at the exit can then be read directly from the chart",
"T2 = 23.5 # in degree celcius",
- "# Result",
"print 'The temperature at the exit in degree celcius is: ',T2"
],
"language": "python",
@@ -770,16 +617,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 12.13 Page no-604"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the mass flow rate of the water to the soaked pad, the relative humidity of the moist air at the exit to the evaporative cooler.",
"",
- "# Given:-",
"T1 = 38.0 # temperature of entering air in degree celcius",
"psi1 = 0.1 # relative humidity of entering air ",
"AV1 = 140.0 # volumetric flow rate of entering air in m^3/min",
@@ -787,31 +631,22 @@
"T2 = 21.0 # temperature of exiting moist air in degree celcius",
"p = 1.0 # pressure in atm",
"",
- "# Part(a)",
- "# From table A-2",
"pg1 = 0.066 # in bar",
- "# The specific volume of the dry air can be evaluated from the ideal gas equation of state. The result is",
"va1 = .887 # in m^3/kg",
"cpa = 1.005",
- "# From table A-2",
"hf = 88.14",
"hg1 = 2570.7",
"hg2 = 2539.94",
- "# Calculations",
"pv1 = psi1*pg1 # the partial pressure of the moist air entering the control volume in bar",
"omega1 = 0.622*(pv1/(p*1.01325-pv1))",
"omega2 = (cpa*(T1-T2)+omega1*(hg1-hf))/(hg2-hf)",
"madot = AV1/va1 # mass flow rate of the dry air in kg/min",
"mwdot = madot*60*(omega2-omega1) # in kg/h",
- "# Result",
"print 'The mass flow rate of the water to the soaked pad in kj/h is: ',mwdot",
"",
- "# Part(b)",
"pv2 = (omega2*p*1.01325)/(omega2+0.622) # in bars",
- "# At 21\u0004C, the saturation pressure is",
"pg2 = 0.02487",
"psi2 = pv2/pg2",
- "# Result",
"print 'The relative humidity of the moist air at the exit to the evaporative cooler is: ',psi2"
],
"language": "python",
@@ -830,16 +665,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 12.14 Page no-607"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine (a) the humidity ratio and (b) the temperature of the exiting mixed stream, in \u0004C.",
"",
- "# Given:-",
"AV1 = 142.0 # in m^3/min",
"T1 = 5.0 # in degree celcius",
"omega1 = 0.002",
@@ -849,27 +681,17 @@
"p = 1.0 # in bar",
"",
"",
- "# Part(a)",
- "# From the psychrometric chart, Fig. A-9.",
"va1 = 0.79 # in m^3/kg",
"va2 = 0.855 # in m^3/kg",
"omega2 = 0.0094",
- "# Calculations",
"ma1dot = AV1/va1 # in kg/min",
"ma2dot = AV2 /va2 # in kg/min",
"omega3 = (omega1*ma1dot+omega2*ma2dot)/(ma1dot + ma2dot) ",
- "# Result",
"print 'The humidity ratio is: ',omega3",
"",
- "# Part(b)",
- "# Reduction of the energy rate balance gives",
- "# (ha + omega*hv)3 = [ma1dot*(ha + omega*hv)1 + ma2dot*(ha + omega*hv)2]/(ma1dot+ma2dot)",
- "# With (ha + omega*hv)1 = 10kj/kg and (ha + omega*hv)2 = 47.8kj/kg from figure A-9",
"LHS = (ma1dot*10+ma2dot*47.8)/(ma1dot + ma2dot)",
"",
- "# This value for the enthalpy of the moist air at the exit, together with the previously determined value for omega3, fixes the state of the exiting moist air. From inspection of Fig. A-9,",
"T3 = 19.0 # in degree celcius",
- "# Result",
"print 'The temperature of the exiting mixed stream in degree celcius is: ',T3"
],
"language": "python",
@@ -888,16 +710,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 12.15 Page no-610"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the mass flow rates of the dry air and the makeup water",
"",
- "# Given:-",
"T1 = 38.0 # in degree celcius",
"m1dot = 4.5e7 # in kg/h",
"T2 = 30.0 # in degree celcius",
@@ -908,11 +727,8 @@
"psi4 = 0.9",
"T5 = 20.0 # in degree celcius",
"",
- "# Analysis",
- "# The humidity ratios omega3 and omega4 can be determined using the partial pressure of the water vapor obtained with the respective relative humidity",
"omega3 =0.00688",
"omega4 = 0.0327",
- "# From tables A-2 and A-22",
"hf1 = 159.21",
"hf2 = 125.79",
"ha4 = 308.2",
@@ -920,10 +736,8 @@
"hg4 = 2565.3",
"hg3 = 2547.2",
"hf5 = 83.96",
- "# Calculations",
"madot = (m1dot*(hf1-hf2))/(ha4-ha3+omega4*hg4-omega3*hg3-(omega4-omega3)*hf5) # in kg/h",
"m5dot = madot*(omega4-omega3) # in kg/h",
- "# Results",
"print 'The mass flow rate of dry air in kg/h is: ',madot",
"print 'The mass flow rate of makeup water in kg/h is: ',m5dot"
],
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_13_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_13_2.ipynb
index 1be1f14a..7baea414 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_13_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_13_2.ipynb
@@ -9,60 +9,40 @@
{
"cell_type": "markdown",
"source": [
- "# Chapter 13 :- Reacting Mixtures and Combustion"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.1 Page no-624"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the air\u2013fuel ratio on both a molar and mass basis for the complete combustion of octane, C8H18, with (a) the theoretical amount of air, ",
- "# (b) 150% theoretical air (50% excess air).",
- "",
- "# Given:-",
- "# Part(a)",
- "# The combustion equation can be written in the form of ",
- "# C8H18 + a(O2 + 3.76N2) --> b CO2 + c H2O + d N2",
- "# Using conservation of mass principle",
+ "",
"b = 8.00",
"c = 18.00/2.00",
"a = (2.00*b+c)/2.00",
"d = 3.76*a",
"",
- "# The air\u2013fuel ratio on a molar basis is",
"AFbar = a*(1+3.76)/1.00",
"Ma = 28.97 # molar mass of air",
"MC8H18 = 114.22 # molar mass of C8H18",
- "# The air\u2013fuel ratio expressed on a mass basis is",
"AF = AFbar*(Ma/MC8H18)",
"",
- "# Result",
"print '-> The air\u2013fuel ratio on a molar basis is: '",
"print AFbar",
"print '-> The air\u2013fuel ratio expressed on a mass basis is: '",
"print round(AF,2)",
"",
- "# Part(b)",
- "# For 150% theoretical air, the chemical equation for complete combustion takes the form",
- "# c8H18 + 1.5*12.5*(O2 + 3.76N2) ---> b CO2 + c H2O + d N2 + e O2",
- "# Using conservation of mass",
- "# Calculations",
"b = 8.00",
"c =18.00/2.00",
"e = (1.5*12.5*2 - c -2*b)/2.00",
"d = 1.5*12.5*3.76",
- "# The air\u2013fuel ratio on a molar basis is",
"AFbar = 1.5*12.5*(1+3.76)/1",
- "# The air\u2013fuel ratio expressed on a mass basis is",
"AF = AFbar*(Ma/MC8H18)",
"",
- "# Results",
"print '-> The air\u2013fuel ratio on a molar basis is: '",
"print AFbar",
"print '-> The air\u2013fuel ratio expressed on a mass basis is: '",
@@ -90,56 +70,34 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.2 Page no-626"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine (a) the air\u2013fuel ratio on both a molar and a mass basis, (b) the percent theoretical air, (c) the dew point temperature of the products",
- "",
- "# Given:-",
- "# Part(a)",
- "# The chemical equation",
- "# a CH4 + b*(O2 + 3.76N2) ---> 9.7CO2 + .5CO + 2.95O2 + 86.85N2 + cH2O",
- "# Calculations",
- "# Applying conservation of mass ",
+ "",
"a = 9.7 + 0.5",
"c = 2.0*a",
"b = ((9.7)*(2.0)+(0.5)+((2.0)*(2.95))+c)/2.00",
"Ma = 28.97 # molar mass of air",
"MCH4 = 16.04 # molar mass of methane",
- "# On a molar basis, the air\u2013fuel ratio is",
"AFbar = (b*(1+3.76))/a",
- "# On a mass basis",
"AF = AFbar*(Ma/MCH4)",
"",
- "# Results",
"print '-> The air-fuel ratio on a molar basis is: '",
"print AFbar",
"print '-> The air-fuel ratio on a mass basis is: '",
"print round(AF,2)",
"",
- "# Part(b)",
- "# The balanced chemical equation for the complete combustion of methane with the theoretical amount of air is",
- "# CH4 + 2(O2 + 3.76N2) ---> CO2 + 2H2O + 7.52N2",
- "# The theoretical air\u2013fuel ratio on a molar basis is",
- "# Calculations",
"AFbartheo = 2.00*(1+3.76)/1.0",
- "# The percent theoretical air is",
"Ta = AFbar/AFbartheo",
- "# Result",
"print '-> The percent theoretical air is: '",
"print round(Ta*100,2)",
"",
- "# Ppart(c)",
- "# The mole fraction of the water vapor is",
"yv = 20.4/(100+20.4)",
"pv = yv*1",
- "# Interpolating in Table A-2,",
"T = 57 # in degree celcius",
- "# Result",
"print '-> The dew point temperature of the products, in \u0004C, if the mixture were cooled at 1 atm is: '",
"print T"
],
@@ -165,53 +123,31 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 13.3 Page no-628"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the air\u2013fuel ratio on a molar basis, the amount of products, the percent of theoretical air.",
- "",
- "# Given:-",
- "# Part(a)",
- "# The chemical equation",
- "# (.8062CH4 + .0541C2H6 + .0187C3H8 + .0160C4H10 + .1050N2) + a(O2 + 3.76N2) ----> b(.078CO2 + .002CO + .07O2 + .85N2) + c H2O",
- "# Calculations",
- "# Using mass conservation",
+ "",
"b = (0.8062 + 2*.0541 + 3*.0187 + 4*.0160)/(.078 + .002)",
"c = (4*.8062 + 6*.0541 + 8*.0187 + 10*.0160)/2",
"a = (b*(2*.078+.002+2*.07) + c)/2",
- "# The air\u2013fuel ratio on a molar basis is",
"AFbar = a*(1+3.76)/1",
- "# Result",
"print '-> The air-fuel ratio on a molar mass basis is: '",
"print round(AFbar,2)",
"",
- "# Part(b)",
"p = 1.0 # in bar",
"V = 100.0 # in m^3",
"Rbar = 8314.0 # in N.m/kmol.K",
"T = 300.0 # in kelvin",
- "# Calculations",
- "# The amount of fuel in kmol",
"nF = (p*10**5*V)/(Rbar*T)",
- "# The amount of product mixture that would be formed from 100 m3 of fuel mixture is",
"n = nF*(b+c)",
- "# Result",
"print '-> The amount of products in kmol that would be formed from 100 m3 of fuel mixture at 300 K and 1 bar is: '",
"print round(n,2)",
"",
- "# Part(c)",
- "# The balanced chemical equation for the complete combustion of the fuel mixture with the theoretical amount of air is",
- "# (10.8062CH4 + 0.0541C2H6 + 0.0187C3H8 + 0.0160C4H10 + 0.1050N2) + 2(O2 + 3.76N2) ----> 1.0345CO2 + 1.93H2O + 7.625N2",
- "# Calculations",
- "# The theoretical air\u2013fuel ratio on a molar basis is",
"AFbartheo = 2*(1+3.76)/1",
- "# The percent theoretical air is",
"Ta = AFbar/AFbartheo",
- "# Result",
"print '-> The percent of theoretical air is: '",
"print round(Ta*100,2)"
],
@@ -235,31 +171,22 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.4 Page no-633"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the rate of heat transfer from the engine, neglecting kinetic and potential energy effects.",
"",
- "# Given:-",
- "# The balanced chemical equation for complete combustion with the theoretical amount of air is obtained from the solution to Example 13.1 as",
- "# C8H18 +12.5O2 + 47N2 -----> 8CO2 + 9H2O + 47N2",
- "# From tabel A-25",
"hRbar = -249910 # in kj/kmol",
"mfdot = 1.8e-3 # mass flow rate of liquid octane in kg/s",
"M = 114.22 # molar mass of octane",
"Wcvdot = 37 # power output of the engine in kw",
"",
- "# Calculations",
- "# With enthalpy of formation values for CO2 and H2O(g) from Table A-25, and enthalpy values for N2, H2O, and CO2 from Table A-23",
"hpbar = 8*(-393520 + (36876 - 9364)) + 9*(-241820 + (31429 - 9904)) + 47*((26568 - 8669))",
"nFdot = mfdot/M # molar flow rate of the fuel in kmol/s",
"Qcvdot = Wcvdot + nFdot*(hpbar-hRbar) # in kw",
"",
- "# Result",
"print '-> The rate of heat transfer from the engine, in kW is: '",
"print round(Qcvdot,2)"
],
@@ -279,32 +206,22 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 13.5 Page no-635"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the rate of heat transfer from the combustion chamber ",
"",
- "# Given:-",
- "# When expressed on a per mole of fuel basis, the balanced chemical equation obtained in the solution to Example 13.2 takes the form",
- "# CH4 + 2.265O2 + 8.515N2 ------> .951CO2 + .049CO + .289O2 + 8.515N2 + 2H2O",
"cpbar = 38.00 # specific heat in KJ/kmol.K",
- "# From table A-25",
"hfnotbar = -74850.00 # enthalpy of formation for methane",
- "# From table A-23",
"deltahbarO2 = 14770-8682",
"deltahbarN2 = 14581-8669",
"",
- "# Calculations",
"hRbar = hfnotbar + cpbar*(400-298) + 2.265*deltahbarO2 + 8.515*deltahbarN2 # in kj/kmol",
- "# With enthalpy of formation values for CO2, CO, and H2O(g) from Table A-25 and enthalpy values from Table A-23",
"hpbar = .951*(-393520 + (88806 - 9364)) + .049*(-110530 + (58191 - 8669)) + .289*(60371 - 8682) + 8.515*(57651 - 8669) + 2*(-241820 + (72513 - 9904))",
"Qcvdot = hpbar - hRbar # in kj/kmol",
"",
- "# Result",
"print '-> The rate of heat transfer from the combustion chamber in kJ per kmol of fuel is: '",
"print round(Qcvdot,2)"
],
@@ -324,42 +241,30 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.6 Page no-637"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine (a) the amount of heat transfer, in kJ, and (b) the final pressure, in atm.",
"",
- "# Given:-",
"nCH4 = 1.00 # moles of methane in kmol",
"nO2 = 2.00 # moles of oxygen in kmol",
"T1 = 25.00 # in degree celcius",
"p1 = 1.00 # in atm",
"T2 = 900.00 # in kelvin",
"Rbar = 8.314 # universal gas constant",
- "# The chemical reaction equation for the complete combustion of methane with oxygen is",
- "# CH4 + 2O2 ----> CO2 + 2H2O",
"",
- "# Part(a)",
- "# with enthalpy of formation values from table A-25",
"hfbarCO2 = -393520",
"hfbarH2O = -241820",
"hfbarCH4 = -74850",
- "# Calculations",
- "# with enthalpy values from table A-23",
"deltahbarCO2 = 37405-9364",
"deltahbarH2O = 31828-9904",
"Q = ((hfbarCO2 + deltahbarCO2)+2*(hfbarH2O + deltahbarH2O) - hfbarCH4) + 3*Rbar*(T1+273-T2)",
- "# Result",
"print '-> The amount of heat transfer in kJ is: '",
"print round(Q,2)",
"",
- "# Part(b)",
"p2 = p1*(T2/(T1+273)) # in atm",
- "# Result",
"print '-> The final pressure in atm is: '",
"print round(p2,2)"
],
@@ -381,53 +286,33 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.7 Page no-639"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the enthalpy of combustion ",
- "# (a) at 25\u0004C, 1 atm with liquid water in the products ",
- "# (b) at 25\u0004C, 1 atm with water vapor in the products",
- "# (c) Repeat part (b) at 1000 K, 1 atm",
"",
- "# Given:-",
- "# The combustion equation is",
- "# CH4 + 2O2 + 7.52N2 ----> CO2 + 2H2O + 7.52N2",
"",
- "# Part(a)",
- "# With enthalpy of formation values from Table A-25",
"hfbarCO2 = -393520 # in kj/kmol",
"hfbarH2O = -285830 # in kj/kmol",
"hfbarCH4 = -74850 # in kj/kmol",
"M = 16.04 # molar mass of CH4 in kg/kmol",
- "# Calculations",
"hRPbar = hfbarCO2 + 2*hfbarH2O - hfbarCH4 # in kj/kmol",
"hRP = hRPbar/M # in kj/kg",
- "# Result",
"print '-> Part(a)the enthalpy of combustion of gaseous methane, fuel is: ',hRP,'kJ/kg.'",
"",
- "# Part(b)",
"hfbarCO2 = -393520 # in kj/kmol",
"hfbarH2O = -241820 # in kj/kmol",
"hfbarCH4 = -74850 # in kj/kmol",
- "# Calculations",
"hRPbar = hfbarCO2 + 2*hfbarH2O - hfbarCH4 # in kj/kmol",
"hRP = hRPbar/M # in kj/kg",
- "# Result",
"print '-> Part(b)the enthalpy of combustion of gaseous methane, fuel is: ',hRP,'kJ/kg'",
"",
- "# Part(c)",
- "# From table A-23",
"deltahbarO2 = 31389-8682 # in kj/kmol",
"deltahbarH2O = 35882-9904 # in kj/kmol",
"deltahbarCO2 = 42769-9364 # in kj/kmol",
"",
- "# Using table A-21",
- "# Calculations",
- "# function cpbar = f(T)",
"T=298 # in kelvin",
"from scipy import integrate",
"cpbar = lambda T: (3.826 - (3.979e-3)*T + 24.558e-6*T**2 - 22.733e-9*T**3 + 6.963e-12*T**4)*8.314",
@@ -436,7 +321,6 @@
"",
"hRPbar = hRPbar + (deltahbarCO2 + 2*deltahbarH2O - var -2*deltahbarO2)",
"hRP = hRPbar/M # in kj/kg",
- "# Result",
"print '-> Part(c)the enthalpy of combustion of gaseous methane, per kg of fuel is ',hRP,'kJ/kg'"
],
"language": "python",
@@ -456,44 +340,27 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.8 Page no-643"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the temperature (a) the theoretical amount of air, (b) 400% theoretical air.",
"",
- "# Given:-",
- "# Part(a)",
- "# For combustion of liquid octane with the theoretical amount of air, the chemical equation is",
- "# C8H18(l) + 12.5 O2 + 47N2 -------> 8 CO2 + 9 H2O(g) + 47N2",
- "# with enthalpy of formation data from Table A-25",
"hfbarC8H18 = -249910.0 # in kj/kmol",
"hfbarCO2 = -393520.0",
"hfbarH2O = -241820.0",
"",
- "# Calculations",
"RHS = hfbarC8H18 -(8*hfbarCO2 + 9*hfbarH2O) # in kj/kmol",
- "# at temperature 2400k",
"LHS1 = 5089337.0 # in kj/kmol",
- "# at temperature 2350 k",
"LHS2 = 4955163.0 # in kj/kmol",
- "# Interpolation between these temperatures gives",
"Tp = 2400.00 + ((2400.0-2350.0)/(LHS1-LHS2))*(RHS-LHS1)",
- "# Result",
"print '-> The temperature in kelvin with theoretical amount of air is: '",
"print round(Tp,2)",
"",
- "# Part(b)",
- "# For complete combustion of liquid octane with 400% theoretical air, the chemical equation is",
- "# C8H18(l) + 50O2 + 188N2 --------> 8CO2 + 9H2O + 37.5O2 + 188N2",
"",
- "# Proceeding iteratively as part(a)",
"Tp = 962 # in kelvin",
"",
- "# Result",
"print '-> The temperature in kelvin using 400 percent theoretical air is: '",
"print round(Tp,2)"
],
@@ -515,68 +382,48 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.9 Page no-649"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the rate of entropy production (a) the theoretical amount of air, (b) 400% theoretical air.",
"",
- "# Given:-",
"import math",
- "# Part(a)",
"Tp = 2395 # in kelvin, from example 13.8",
- "# For combustion of liquid octane with the theoretical amount of air, the chemical equation is",
- "# C8H18(l) + 12.5O2 + 47N2 ----> 8CO2 + 9H2O(g) + 47N2",
"",
- "# From table A-25",
"sFbar = 360.79 # absolute entropy of liquid octane in kj/kmol.K",
"",
- "# From table A-23",
- "# For reactant side",
"sbarO2atTref = 205.03 # in kj/kmol.K",
"sbarN2atTref = 191.5 # in kj/kmol.K",
"Rbar = 8.314 # universal gas constant in SI units",
"yO2 = 0.21",
"yN2 = 0.79",
- "# For product side",
"yCO2 = 8.0/64.0",
"yH2O = 9.0/64.0",
"yN2p = 47.0/64.0",
"",
- "# Calculations",
"sbarO2 = sbarO2atTref - Rbar*math.log(yO2) # in kj/kmol.K",
"sbarN2 = sbarN2atTref - Rbar*math.log(yN2) # in kj/kmol.K",
- "# With the help from table A-23",
"sbarCO2 = 320.173 - Rbar*math.log(yCO2)",
"sbarH2O = 273.986 - Rbar*math.log(yH2O)",
"sbarN2p = 258.503 - Rbar*math.log(yN2p)",
"sigmadot = (8*sbarCO2 + 9*sbarH2O + 47*sbarN2p) - sFbar - (12.5*sbarO2 + 47*sbarN2)",
"",
- "# Result",
"print '-> The rate of entropy production, in kJ/K per kmol of fuel with theoretical amount of air is: '",
"print round(sigmadot,2)",
"",
- "# Part(b)",
- "# The complete combustion of liquid octane with 400% theoretical air is described by the following chemical equation:",
- "# C8H18(l) + 50 O2 + 188N2 -----> 8 CO2 + 9H2O(g) + 37.5O2 + 188N2",
"",
- "# For product side ",
"yCO2 = 8.0/242.5",
"yH2O = 9.0/242.5",
"yO2 = 37.5/242.5",
"yN2p = 188.0/242.5",
- "# Calculations",
- "# With help from table A-23",
"sbarCO2 = 267.12 - Rbar*math.log(yCO2)",
"sbarH2O = 231.01 - Rbar*math.log(yH2O)",
"sbarO2p = 242.12 - Rbar*math.log(yO2)",
"sbarN2p = 226.795 - Rbar*math.log(yN2p)",
"sigmadot = (8.0*sbarCO2 + 9.0*sbarH2O + 37.5*sbarO2p +188.0*sbarN2p) -sFbar - (50.0*sbarO2 + 188.0*sbarN2)",
"",
- "# Result",
"print '-> The rate of entropy production, in kJ/K per kmol of fuel with 400 percent theoretical air is: '",
"print round(sigmadot,2)"
],
@@ -598,39 +445,30 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.10 Page no-653"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the change in entropy of the system of Example 13.6 in kJ/K.",
"",
- "# Given:-",
"import math",
"Rbar = 8.314 # universal gas constant in SI units",
- "# The chemical equation for the complete combustion of methane with oxygen is",
- "# CH4 + 2O2 ----> CO2 + 2H2O",
"yCH4 = 1.0/3.0",
"yO2 = 2.0/3.0",
"yCO2 = 1.0/3.0",
"yH2O = 2.0/3.0",
- "# From table A-25",
"sbarCH4atTref = 186.16 # in kj/kmol.K",
"sbarO2atTref = 205.03 # in kj/kmol.K",
"p2 = 3.02 # in atm",
"pref = 1.0 # in atm",
"",
- "# Calculations",
"sbarCH4 = sbarCH4atTref - Rbar*math.log(yCH4)",
"sbarO2 = sbarO2atTref - Rbar*math.log(yO2)",
- "# With help from table A-23",
"sbarCO2 = 263.559 - Rbar*math.log(yCO2*p2/pref) # in kj/kmol.K",
"sbarH2O = 228.321 - Rbar*math.log(yH2O*p2/pref) # in kj/kmol.K",
"deltaS = sbarCO2 + 2*sbarH2O - sbarCH4 -2*sbarO2 # in kj/K",
"",
- "# Result",
"print '-> The change in entropy of the system is: ',round(deltaS,2),'kJ/K'"
],
"language": "python",
@@ -648,34 +486,25 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.11 Page no-654"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the Gibbs function of formation of methane at the standard state",
"",
- "# Given:-",
- "# Methane is formed from carbon and hydrogen according to",
- "# C + 2H2 ------> CH4",
"",
- "# In the present case, all substances are at the same temperature and pressure, 25\u0004C and 1 atm, which correspond to the standard reference state values",
"hCbar = 0",
"hH2bar = 0",
"gRbar = 0",
- "# With enthalpy of formation and absolute entropy data from Table A-25",
"hfbarCH4 = -74850",
"sbarCH4 = 186.16",
"sbarC = 5.74",
"sbarH2 = 130.57",
"Tref = 298.15 # in kelvin",
"",
- "# Calculation",
"gfbarCH4 = hfbarCH4 -Tref*(sbarCH4-sbarC-2*sbarH2) # in kj/kmol",
"",
- "# Result",
"print '-> The gibbs function of formation of methane at the standard state is: ',gfbarCH4,'kJ/mol'"
],
"language": "python",
@@ -693,23 +522,16 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 13.12 Page no-662"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the chemical exergy of liquid octane ",
"",
- "# Given:-",
- "# Complete combustion of liquid octane with O2 is described by",
- "# C8H18(l) + 12.5O2 ------> 8CO2 + 9H2O",
"import math",
- "# Part(a)",
"Rbar = 8.314 # universal gas constant in SI units",
"Tnot = 298.15 # in kelvin",
- "# From table A-25",
"gbarC8H18 = 6610.0",
"gbarO2 = 0",
"gbarCO2 = -394380",
@@ -719,21 +541,15 @@
"yH2O = 0.0312",
"M = 114.22 # molecular weight of liquid octane",
"",
- "# Calculations",
"ech = ((gbarC8H18 + 12.5*gbarO2 -8*gbarCO2 -9*gbarH2O) + Rbar*Tnot*math.log(yO2**12.5/(yCO2**8*yH2O**9 )))/M",
- "# Result",
"print '-> Part(a) the chemical exergy obtained on a unit mass basis is: ',round(ech,2),'kJ/K'",
"",
- "# Part(b)",
- "# With data from Table A-25 and Model II of Table A-26",
"gbarH2O = -237180.0",
"ebarCO2 = 19870.0",
"ebarH2O = 900.0",
"ebarO2 = 3970.0",
"",
- "# Calculation",
"ech = ((gbarC8H18 + 12.5*gbarO2 -8*gbarCO2 - 9*gbarH2O) + 8*ebarCO2 + 9*ebarH2O - 12.5*ebarO2)/M",
- "# Result",
"print '-> Part(b) chemical exergy on a unit mass basis is:',round(ech,3),'kJ/K'"
],
"language": "python",
@@ -752,35 +568,28 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.13 Page no-665"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Evaluate the flow exergy of the steam, in kJ/kg, relative to an environment at 25\u0004C, 1 atm ",
"",
- "# Given:-",
"import math",
"Rbar = 8.314 # universal gas constant in SI units",
"Tnot = 298.0 # in kelvin",
- "# With data from the steam tables",
"h = 2939.9 # in kj/kg",
"hnot = 104.9 # in kj/kg",
"s = 7.2307 # in kj/kg",
"snot = 0.3674 # in kj/kg",
- "# With data from Table A-25",
"gbarH2Oliq = -237180.0",
"gbarH2Ogas = -228590.0",
"yeH2O = 0.0303",
"M =18.0 # molar mass of steam",
"",
- "# Calculations",
"ech = (1.0/M)*(gbarH2Oliq-gbarH2Ogas + Rbar*Tnot*math.log(1/yeH2O)) # in kj/kg",
"ef = h-hnot-Tnot*(s-snot) + ech # in kj/kg",
"",
- "# Result",
"print '-> The flow exergy of the steam, in kJ/k is: '",
"print round(ef,2)"
],
@@ -800,20 +609,14 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.14 Page no-665"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# evaluate the flow exergy of the combustion products, in kJ per kmol of fuel. ",
"",
- "# Given:-",
- "# For 140% theoretical air, the reaction equation for complete combustion of methane is",
- "# CH4 + 2.8(O2 + 3.76N2) -------> CO2 + 2H2O + 10.53N2 + .8O2",
"",
- "# For product side",
"yCO2p = 1.0/(1.0+2.0+10.53+.8)",
"yH2Op = 2.0/(1.0+2.0+10.53+.8)",
"yN2p = 10.53/(1.0+2.0+10.53+.8)",
@@ -827,17 +630,14 @@
"yeH2O = 0.0303",
"yeCO2 = 0.0003",
"",
- "# Calculations",
"import math",
"ebarch = Rbar*Tnot*(math.log(yCO2p/yeCO2) + 2*math.log(yH2Op/yeH2O) + 10.53*math.log(yN2p/yeN2) + .8*math.log(yO2p/yeO2))",
"",
- "# with data from tables A-23 at 480 and 1560 kelvin,the thermomechanical contribution to the flow exergy, per mole of fuel, is",
"contri480 = 17712.0 # kJ per kmol of fuel",
"contri1560 = 390853.0 # kJ per kmol of fuel",
"efbar480 = contri480 + ebarch # kJ per kmol of fuel",
"efbar1560 = contri1560 + ebarch # kJ per kmol of fuel",
"",
- "# Results",
"print '-> At T= 480k, the flow exergy of the combustion products, in kJ per kmol of fuel is: '",
"print round(efbar480,2)",
"print '-> At T = 1560K, the flow exergy of the combustion products, in kJ per kmol of fuel is: '",
@@ -861,25 +661,20 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 13.15 Page no-667"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Devise and evaluate an exergetic efficiency for the internal combustion engine ",
"",
- "# Given:-",
"mFdot = 1.8e-3 # fuel mass flow rate in kg/s",
"ech = 47346.0 # in kj/kg, from example 13.12(a)",
"Wcvdot = 37.0 # power developed by the engine in kw",
"",
- "# Calculations",
"Efdot = mFdot*ech # rate at which exergy enters with the fuel in kw",
"epsilon = Wcvdot/Efdot # exergetic efficiency",
"",
- "# Result",
"print '-> The exergetic efficiency is: '",
"print round(epsilon,3)"
],
@@ -899,34 +694,25 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 13.16 Page no-668"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the exergy destruction, in kJ per kmol of fuel, devise and evaluate an exergetic efficiency.",
"",
- "# Given:-",
"Tnot = 298 # in kelvin",
"",
- "# For the case of complete combustion with the theoretical amount of air",
"sigmadot = 5404.0 # rate of entropy production from example 13.9, in kj/kmol.K",
"Efdot = 5407843.0 # rate at which exergy enters with the fuel from example 13.12, in kj/kmol",
- "# Calculations:-",
"Eddot = Tnot*sigmadot # in kj/kmol",
"epsilon = 1-Eddot/Efdot",
- "# Result",
"print '-> The exergetic efficiency with theoretical amount of air is: '",
"print round(epsilon,3)",
"",
- "# For the case of combustion with 400% theoretical air",
"sigmadot = 9754.0 # rate of entropy production from example 13.9, in kj/kmol.K",
- "# Calculations",
"Eddot = Tnot*sigmadot # in kj/kmol",
"epsilon = 1-Eddot/Efdot",
- "# Result",
"print 'The exergetic efficiency with 400 percent theoretical amount of air is: '",
"print round(epsilon,3)"
],
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_14_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_14_2.ipynb
index 5d03c617..6a3dc148 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_14_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_14_2.ipynb
@@ -9,27 +9,20 @@
{
"cell_type": "markdown",
"source": [
- "# Chapter 14 :- Chemical and Phase Equilibrium"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 14.1 Page no-688"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Evaluate the equilibrium constant, expressed as log10K, for the reaction at (a) 298 K and (b) 2000 K.",
"",
- "# Given:-",
- "# The reaction is CO + .5O2 ----> CO2",
- "# Part(a)",
"T = 298.0 # in kelvin",
"Rbar = 8.314 # universal gas constant in SI units",
- "# From table A-25",
"",
"hfbarCO2 = -393520.0 # in kj/kmol",
"hfbarCO = -110530.0 # in kj/kmol",
@@ -40,22 +33,17 @@
"sbarCO2 = 213.69 # in kj/kmol.K",
"sbarCO = 197.54 # in kj/kmol.K",
"sbarO2 = 205.03 # in kj/kmol.K",
- "# From table A-27",
"logKtable = 45.066",
- "# Calculations",
"import math",
"deltaG = (hfbarCO2-hfbarCO-.5*hfbarO2) + (deltahbarCO2-deltahbarCO-.5*deltahbarO2) - T*(sbarCO2-sbarCO-.5*sbarO2)",
"lnK = -deltaG/(Rbar*T)",
"logK = (1/math.log(10))*lnK",
- "# Results",
"print '-> Part(a) the value of equilibrium constant expressed as log10K is: '",
"print logK",
"print '-> The value of equilibrium constant expressed as log10K from table A-27 is: '",
"print logKtable",
"",
- "# Part(b)",
"T = 2000.0 # in kelvin",
- "# From table A-23",
"hfbarCO2 = -393520.0 # in kj/kmol",
"hfbarCO = -110530.0 # in kj/kmol",
"hfbarO2 = 0 # in kj/kmol",
@@ -65,13 +53,10 @@
"sbarCO2 = 309.210 # in kj/kmol.K",
"sbarCO = 258.6 # in kj/kmol.K",
"sbarO2 = 268.655 # in kj/kmol.K",
- "# Calculations",
"deltaG = (hfbarCO2-hfbarCO-.5*hfbarO2) + (deltahbarCO2-deltahbarCO-.5*deltahbarO2) - T*(sbarCO2-sbarCO-.5*sbarO2)",
"lnK = -deltaG/(Rbar*T)",
"logK = (1/math.log(10))*lnK",
- "# From table A-27",
"logKtable = 2.884",
- "# Results",
"print '-> Part(b) the value of equilibrium constant expressed as log10K is: '",
"print logK",
"print '-> The value of equilibrium constant expressed as log10K from table A-27 is: '",
@@ -99,46 +84,33 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 14.2 Page no-690"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the equilibrium composition in terms of mole fractions",
"",
- "# Given:-",
- "# Applying conservation of mass, the overall balanced chemical reaction equation is",
- "# CO + .5O2 -------> zCO + (z/2)O2 + (1-z)CO2",
"",
- "# At 2500 K, Table A-27 gives",
"log10K = -1.44",
- "# Part(a)",
"p = 1.0 # in atm",
- "# Calculations",
"import math",
"K = (10.0)**(log10K) # equilibrium constant",
- "# Solving equation K = (z/(1-z))*(2/(2 + z))^.5 *(p/1)^.5 gives",
"z = 0.129",
"yCO = 2.0*z/(2.0 + z)",
"yO2 = z/(2.0 + z)",
"yCO2 = 2.0*(1.0 - z)/(2.0 + z)",
"",
- "# Results",
"print '-> Part(a) mole fraction of CO is: ',round(yCO,3)",
"print '-> Mole fraction of O2 is: ',round(yO2,3)",
"print '-> Mole fraction of CO2 is: ',round(yCO2,3)",
"",
- "# Part(b)",
"p = 10.0 # in atm",
- "# Solving equation K = (z/(1-z))*(2/(2 + z))^.5 *(p/1)^.5 gives",
"z = 0.062",
"yCO = 2.0*z/(2.0 + z)",
"yO2 = z/(2.0 + z)",
"yCO2 = 2.0*(1.0 - z)/(2.0 + z)",
"",
- "# Results",
"print '-> Part(b) mole fraction of CO is: ',round(yCO,3)",
"print '-> Mole fraction of O2 is: ',round(yO2,3)",
"print '-> Mole fraction of CO2 is: ',round(yCO2,3)"
@@ -163,28 +135,21 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 14.3 Page no-691"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the temperature T of the mixture, in K.",
"",
- "# Given:-",
"yCO = 0.298",
"p = 1 # in atm",
"pref = 1 # in atm",
- "# With this value of K, table A-27 gives",
"T = 2881",
"",
- "# Calculations",
- "# Solving yCO = 2z/(2 + z)",
"z = 2*yCO/(2 - yCO)",
"K = (z/(1-z))*(z/(2 + z))**.5*(p/pref)**.5",
"",
- "# Result",
"print '-> The temperature T of the mixture in kelvin is: ',T"
],
"language": "python",
@@ -202,34 +167,24 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 14.4 Page no-692"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the equilibrium composition in terms of mole fractions",
"",
- "# Given:-",
- "# For a complete reaction of CO with the theoretical amount of air",
- "# CO + .5 O2 + 1.88N2 -----> CO2 + 1.88N2 ",
- "# Accordingly, the reaction of CO with the theoretical amount of air to form CO2, CO, O2, and N2 is",
- "# CO + .5O2 + 1.88N2 ---> zCO + z/2 O2 + (1-z)CO2 + 1.88N2",
"",
"K = 0.0363 # equilibrium constant the solution to Example 14.2",
"p =1.0 # in atm",
"pref = 1.0 # in atm",
"",
- "# Calculations",
- "# Solving K = (z*z^.5/(1-z))*((p/pref)*2/(5.76+z))^.5 gives",
"z = 0.175",
"yCO = 2.0*z/(5.76 + z)",
"yO2 = z/(5.76 + z)",
"yCO2 = 2.0*(1.0-z)/(5.76 + z)",
"yN2 = 3.76/(5.76 + z)",
"",
- "# Results",
"print '-> The mole fraction of CO is: ',round(yCO,3)",
"print '-> The mole fraction of O2 is: ',round(yO2,3)",
"print '-> The mole fraction of CO2 is: ',round(yCO2,3)",
@@ -253,29 +208,20 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 14.5 Page no-692"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the heat transfer to the reactor, in kJ per kmol of CO2 entering. ",
"",
- "# Given:-",
- "# Applying the conservation of mass principle, the overall dissociation reaction is described by",
- "# CO2 ----> zCO2 + (1-z)CO + ((1-z)/2)O2",
"",
"p = 1.0 # in atm",
"pref = 1.0 # in atm",
- "# At 3200 K, Table A-27 gives",
"log10k = -.189",
- "# Solving k = ((1-z)/2)*((1-z)/(3-z))^.5 gives",
"z = 0.422",
"",
- "# Calculations",
"k = 10**log10k",
- "# From tables A-25 and A-23",
"hfbarCO2 = -393520.0 # in kj/kmol",
"deltahbarCO2 = 174695-9364 # in kj/kmol",
"hfbarCO = -110530.0 # in kj/kmol",
@@ -287,7 +233,6 @@
"",
"Qcvdot = 0.422*(hfbarCO2 + deltahbarCO2) + 0.578*(hfbarCO + deltahbarCO) + 0.289*(hfbarO2 + deltahbarO2)- (hfbarCO2r + deltahbarCO2r) ",
"",
- "# Result",
"print '-> The heat transfer to the reactor, in kJ per kmol of CO2 entering is: '",
"print Qcvdot"
],
@@ -307,7 +252,6 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 14.8 Page no-701"
]
},
{
@@ -334,19 +278,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the pressure, if the ionization of Cs is 95% complete, and plot percent completion of ionization versus pressure ranging from 0 to 10 atm.",
"",
- "# Given:-",
- "# The ionization of cesium to form a mixture of Cs, Cs+, and e-\u0005 is described by",
- "# Cs ----> (1-z)Cs + zCs+ + Ze-",
"",
"K = 15.63",
"z = 0.95",
"pref =1 # in atm",
- "# Calculation",
"p = pref*K*((1-z**2)/z**2)",
"",
- "# Results",
"print '-> The pressure if the ionization of CS is 95 percent complete is: ',p,'atm'",
"",
"x = []",
@@ -382,31 +320,22 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 14.9 Page no-703"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the composition of the equilibrium mixture.",
"",
- "# Given:-",
- "# The overall reaction can be written as",
- "# CO2 + .5O2 + .5N2 ----> aCO + bNO + (1-a)CO2 + .5(1+a-b)O2 + .5(1-b)N2",
"",
- "# At 3000 K, Table A-27 provides",
"log10K1 = -0.485 # equilibrium constant of the reaction CO2 <--> CO + .5O2",
"log10K2 = -0.913 # equilibrium constant of the reaction .5O2 + .5N2 <-->NO",
- "# Solving equations K1 = (a/(1-a))*((1+a-b)/(4+a))^.5 and K2 = 2b/((1+a-b)*(1-b))^.5",
"a = 0.3745",
"b = 0.0675",
"",
- "# Calculations",
"K1 = 10**log10K1",
"K2 = 10**log10K2",
"",
- "# Result",
"print '-> The composition of the equilibrium mixture, in kmol per kmol of CO2 present initially, is then 0.3745CO, 0.0675NO, 0.6255CO2, 0.6535O2, 0.4663N2.'"
],
"language": "python",
@@ -424,17 +353,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 14.10 Page no-707"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the departure, in percent, of the partial pressure of the water vapor from the saturation pressure of water at 20\u0004C.",
"",
- "# Given:-",
- "# With data from Table A-2 at 20\u0004C,",
"vf = 1.0018e-3 # in m^3/kg",
"psat = 0.0239 # in bar",
"p = 1.0 # in bar",
@@ -443,11 +368,9 @@
"M = 18.02 # molat mass of water in kg/kmol",
"e=2.715",
"",
- "# Calculations",
"pvbypsat = e**(vf*(p-psat)*10**5/((1000*Rbar/M)*T))",
"percent = (pvbypsat-1)*100",
"",
- "# Result",
"print '-> The departure, in percent, of the partial pressure of the water vapor from the saturation pressure of water at 20\u0004 is: ',round(percent,3)"
],
"language": "python",
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_1_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_1_2.ipynb
index 5215eda5..637abb12 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_1_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_1_2.ipynb
@@ -9,14 +9,12 @@
{
"cell_type": "markdown",
"source": [
- "#Chapter 1:- Introductory Concepts and Definitions "
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
- "# Theortical Chapter"
],
"language": "python",
"outputs": []
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_2_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_2_2.ipynb
index c80d5494..c1162732 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_2_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_2_2.ipynb
@@ -9,49 +9,38 @@
{
"cell_type": "markdown",
"source": [
- "#Chapter 2:- Energy and the First Law Of Thermodynamics"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading5> Example 2.1 Page no-39"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the work for the process,in kJ, if (a) n=1.5, (b) n=1.0,and (c) n=0.",
"",
- "# Given:-",
"p1 = 3*(10**5) # initial pressure of gas in pascal",
"v1 = 0.1 # initial volumme of gas in meter^3",
"v2 = 0.2 # final volume of gas in meter^3",
"",
- "# calculations",
"from scipy import integrate",
"import math",
- "# Part (a) i.e. n=1.5",
- "#constant = p1*(v1**n) # p*(v^n) = constant",
"constant1 = p1*(v1**1.5) ",
"constant2 = p1*(v1**1) ",
"constant3 = p1*(v1**0) ",
- "# function p ",
"p1 = lambda v: constant1/(v**1.5) # expressing pressure as function of volume ",
"p2 = lambda v: constant2/(v**1)",
"p3 = lambda v: constant3/(v**0)",
- "# function [work1] ",
"work1 = integrate.quad(p1,v1,v2) # integrating pdv from initial to final volume ",
"w1 = work1[0]/1000 # divided by 1000 to convert to KJ",
"print 'The work done for n=1.5 in KJ is',round(w1,2)",
"",
- "#part(b) i.e. n = 1",
"work2 = integrate.quad(p2,v1,v2)",
"w2 = work2[0]/1000",
"print 'The work done for n=1 in KJ is',round(w2,2)",
"",
- "#part(c) i.e. n=0",
"work3 = integrate.quad(p3,v1,v2)",
"w3 = work3[0]/1000",
"print 'The work done for n=0 in KJ is',round(w3,2)"
@@ -73,23 +62,19 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 2.2 Page no-50"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the net heat transfer for the process, in kJ.",
"",
- "# Given:-",
"p1 = 3*(10**5) # initial pressure in pascal",
"v1 = 0.1 # initial volume in m3",
"v2 = 0.2 # initial volume in m3",
"m = 4.0 # mass of the gas in kg",
"deltau = -4.6 # change in specific internal energy in KJ/Kg",
"",
- "# Calculations",
"from scipy import integrate",
"import math",
"constant = p1*(v1**1.5) # p*(v^n) = constant",
@@ -102,7 +87,6 @@
"deltaU = m*deltau # change in internal energy in KJ",
"Q = deltaU + w # neglecting kinetic and potential energy changes",
"",
- "# Result",
"print 'net heat transfer for the process in KJ',round(Q,2)"
],
"language": "python",
@@ -120,16 +104,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 2.3 Page no-52"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the heat transfer from the resistor to the air (a) the air alone, (b) the air and the piston.",
"",
- "# Given:-",
"patm = 10**5 # atmospheric pressure in pascal.",
"mp = 45.0 # mass of piston in Kg",
"A = 0.09 # face area of piston in m2",
@@ -139,25 +120,18 @@
"g = 9.81 # local acceleration of gravity",
"",
"",
- "# Part (a) i.e. air is system",
- "# Calculations",
"p = (mp*g)/A + patm # constant pressure of air obtained from equilibrium of piston",
"w = (p*deltaV)/1000 # work done in KJ",
"deltaU = m*deltau # internal energy change of air in KJ",
"Q = w + deltaU # applying first with air as system",
- "# Result",
"print 'The answer given in book is incorrect.They have miscalculated deltaU.The correct heat transfer from resistor to air in KJ for air alone as system is: '",
"print round(Q,2)",
"",
- "# The answer given in book is incorrect. deltaU is incorrect in book. ",
"",
- "# Part(b) i.e. (air+piston) is system",
- "# Calculations",
"wd = (patm*deltaV)/1000 # work done in KJ",
"deltaz = (deltaV)/A # change in elevation of piston",
"deltaPE = (mp*g*deltaz)/1000 # change in potential energy of piston in KJ",
"Qt = wd + deltaPE + deltaU # applying first law with air plus piston as system ",
- "# Result",
"print 'The answer given in book is incorrect.They have miscalculated deltaU.The correct heat transfer from resistor to air in KJ for air + piston as system is:'",
"print round(Qt,2)"
],
@@ -179,28 +153,23 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 2.4 Page no-54"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# evaluate the heat transfer rate and the power delivered through the output shaft, each in kW.",
"",
- "# Given:-",
"w1dot = -60.0 # input work rate in KW",
"h = 0.171 # heat transfer coefficient,unit in KW/m2 .K",
"A = 1.0 # outer surface area of gearbox, unit in m2",
"Tb = 300.0 # outer surface temperature in kelvin",
"Tf = 293.0 # temperature of the sorrounding",
"",
- "# Calculations",
"Qdot = -h*A*(Tb-Tf); # rate of energy transfer by heat",
"wdot = Qdot; # steady state energy equation",
"w2dot = wdot-w1dot;",
"",
- "# Results",
"print 'The heat transfer rate in KW is:\\n\\tQdot = ',Qdot",
"print 'The power delivered through output shaft in KW is: = ',w2dot"
],
@@ -221,26 +190,21 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 2.5 Page no-55"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the surface temperature of the chip, in degree \u0004Celcius.",
"",
- "# Given:-",
"s=5*(10**-3) # measurement on a side in meter",
"wdot = -0.225 # power input in watt",
"Tf = 293.0 # coolant temprature in kelvin",
"h = 150.0 # heat transfer coefficient in w/m2 k",
"A = s**2 # surface area",
"",
- "# Calculation",
"Tb = ((-wdot/(h*A)) + Tf - 273) # surface temperature in degree",
"",
- "# Result",
"print 'The surface temperature of the chip in degree celcius is: ',Tb"
],
"language": "python",
@@ -258,7 +222,6 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 2.6 Page no-57"
]
},
{
@@ -285,9 +248,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Plot Qdot and Wdot,the change in energy deltaE in kJ, as functions of time from t=0 to t=120s.",
"",
- "# Given:-",
"omega = 100.0 #motor rotation speed in rad/s",
"tau = 18.0 #torque applied by shaft in N.m",
"Welecdot = -2.0 #electric power input in KW",
@@ -295,14 +256,9 @@
"Wshaftdot = (tau*omega)/1000 #shaft work rate in KW",
"Wdot = Welecdot + Wshaftdot #net work rate in KW",
"",
- "#function [Qdot]=f(t)",
- "#Qdot = (-0.2)* [1-2**(-0.05*t)]",
"",
"",
- "#function [Edot]=f1(t) #function for rate of change of energy",
- "#Edot = (-0.2)*[1-2**(-0.05*t)] - Wdot ",
"",
- "#function [deltaE] =f2(t) #function for change in energy ",
"from sympy import *",
"x = symbols('x') # a = 0.2 b = 0.05",
"f = (0.2)*(1-2**(0.05*(x))) - Wdot",
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_3_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_3_2.ipynb
index a858ee00..b1ded028 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_3_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_3_2.ipynb
@@ -9,26 +9,19 @@
{
"cell_type": "markdown",
"source": [
- "# Chapter 3 :- Evaluating Properties"
]
},
{
"cell_type": "markdown",
"source": [
- "## Example 3.1 Page no-80 ##"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine (a) the temperature, in degree \u0004Celcius, at each state.(b) the mass of vapor present at each state, in kg.",
- "# (c) If heatingcontinues, determine the pressure, in bar, when the container holds onlysaturated vapor.",
"",
- "# Given:-",
- "# Those with 1 are of state 1 and 2 are with state 2",
"",
- "# State 1",
"p1 = 10**5 # initial pressure in pascal ",
"x1 = 0.5 # initial quality",
"",
@@ -37,14 +30,12 @@
"vf1 = 1.0432*(10**(-3)) # specific volume of fluid in state 1 in m3/Kg(from table A-3)",
"vg1 = 1.694 # specific volume of gas in state 1 in m3/kg(from table A-3)",
"",
- "# State 2",
"p2 = 1.5*(10**5) # pressure after heating in pascal",
"",
"T2 = 111.4 # temperature in degree celcius in state 2, from A-3",
"vf2 = 1.0582*(10**(-3)) # specific volume of fluid in state 2 in m3/Kg, from A-3",
"vg2 = 1.159 # specific volume of gas in state 2 in m3/Kg,from A-3",
"",
- "# Calculations",
"",
"v1 = vf1 + x1*(vg1-vf1) # specific volume in state 1 in m3/Kg",
"v2 = v1 # specific volume in state 2 in m3/Kg",
@@ -54,10 +45,8 @@
"x2 = (v1-vf2)/(vg2-vf2) # quality in state 2",
"mg2 = x2*m # mass of vapor in state 2 in Kg ",
"",
- "# State 3",
"p3 = 2.11 # pressure in state 3 from table A-3",
"",
- "# Results",
"print '-> The temperature in state 1 is ',round(T1,2),'degree celcius.'",
"print '-> The temperature in state 2 is ',round(T2,2),'degree celcius.'",
"print '-> The mass of vapour in state 1 is',round(mg1,2),'kg.' ",
@@ -83,29 +72,24 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 3.2 Page no-81"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Show the initial and final states on T\u2013v and p\u2013v diagrams, determine (a) the volume occupied by the ammonia at each state (b) the work",
"",
- "# Given:-",
"m = 0.05 # mass of ammonia in kg ",
"p1 = 1.5*(10**5) # initial pressure of ammonia in pascal",
"v1 = 0.7787 # specific volume in state 1 in m3/kg from table A-14",
"v2 = 0.9553 # specific volume in state 2 in m3/kg from table A-15",
"T2 = 25.0 # final temperature in degree celcius",
"",
- "# Calculations",
"",
"V1 = m*v1 # volume occupied by ammonia in state 1 in m3",
"V2 = m*v2 # volume occupied by ammonia in state 2 in m3",
"w = (p1*(V2-V1))/1000 # work in KJ",
"",
- "# Results",
"print '-> The volume occupied by ammonia in state 1 is ',round(V1,2),'m^3.'",
"print '-> The volume occupied by ammonia in state 2 is ',round(V2,2),'m^3.'",
"print '-> The work done for the process is',round(w,2),'KJ.'"
@@ -127,34 +111,27 @@
{
"cell_type": "markdown",
"source": [
- "## Example 3.3 Page no-87"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the temperature at the final state, in \u0004C, and the work during the process, in kJ.",
"",
- "# Given:-",
"V = 0.25 # volume of tank in m3",
"v = 1.673 # specific volume in m3/kg obtained using table A-2",
"",
- "# State 1",
"T1 = 100.0 # initial temperature in degree celcius",
"u1 = 2506.5 # specific internal energy in state 1 in KJ/Kg obtained from table A-2",
"",
- "# State 2",
"p2 = 1.5 # final pressure in bars",
"T2 = 273.0 # temperature in state 2 in degree celcius obtained from table A-4",
"u2 = 2767.8 # specific internal energy in state 2 in KJ/Kg obtained from table A-4",
"",
- "# Calculations",
"m = V/v # mass of the system in kg",
"DeltaU = m*(u2-u1) # change in internal energy in KJ",
"W = - DeltaU # from energy balance",
"",
- "# Results",
"print '-> The temperature at the final state in is',round(T2,2),' degree celcius.'",
"print '-> The work during the process is',W,'KJ.'"
],
@@ -174,43 +151,35 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 3.4 Page no-88"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Sketch both processes on T\u2013v and p\u2013v diagrams, determine the work, heat transfer, in kJ/kg.",
"",
- "# Given:-",
- "# State ",
"P1 = 10*(10**5) # initial pressure in pascal",
"T1 = 400.0 # initial temperature in degree celcius",
"v1 = 0.3066 # specific volume in state 1 in m3/kg obtained from table A-4",
"u1 = 2957.3 # specific internal energy in state 1 in KJ/Kg obtained from table A-4",
"",
- "# State 2",
"",
"v2 = 0.1944 # specific volume in state 2 in m3/kg obtained from table A-3",
"w2to3 = 0 # work in process 2-3",
"",
"",
- "# State 3 ",
"v3 = v2",
"vf3 = 1.0905*(10**(-3)) # specific volume of fluid in state 3 from table A-2",
"vg3 = 0.3928 # specific volume of gas in state 3 from table A-2",
"uf3 = 631.68 # specific internal energy for fluid in state 3 from table A-2",
"ug3 = 2559.5 # specific internal energy for gas in state 3 from table A-2",
"",
- "# Calculations",
"w1to2 = (P1*(v2-v1))/1000 # work in KJ/Kg in process 1-2",
"W = w1to2 + w2to3 # net work in KJ/kg",
"x3 = (v3-vf3)/(vg3-vf3)",
"u3 = uf3+x3*(ug3-uf3) # specific internal energy in state 3 in Kj/Kg",
"q = (u3-u1) + W # heat transfer in Kj/Kg",
"",
- "# Results",
"print '-> The work done in the overall process is',W,'KJ/kg.'",
"print '-> The heat transfer in the overall process is',q,'KJ/kg.'"
],
@@ -230,31 +199,24 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 3.6 Page no-98"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the specific volume , pressure in MPa at the final state.",
"",
- "# Given:-",
- "# State 1",
"p1 = 20.0 # initial pressure in MPa",
"T1 = 520.0 # initial temperature in degree celcius",
"Z1 = 0.83 # compressibility factor",
"R = 8.314 # universal gas constant in SI unit",
"n = 1000.0/18.02 # number of moles in a kg of water",
"",
- "# State 2",
"T2 = 400.0 # final temperature in degree celcius",
"",
- "# From table A-1",
"Tc = 647.3 # critical temperature in kelvin",
"pc = 22.09 # critical pressure in MPa",
"",
- "# Calculations",
"Tr = (T1+273)/Tc # reduced temperature",
"Pr = p1/pc # reduced pressure ",
"v1 = (Z1*n*R*(T1+273))/(p1*(10**6))",
@@ -263,7 +225,6 @@
"PR = 0.69 # at above vr and Tr2",
"P2 = pc*PR",
"",
- "# Results ",
"print '-> The specific volume in state1 is',v1,'m3/kg and the corresponding value obtained from table A-4 is .01551 m^3/Kg'",
"print '-> The pressure in MPa in the final state is',P2,' MPa and the corresponding value from the table is 15.16Mpa'"
],
@@ -283,7 +244,6 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 3.7 Page no:-101"
]
},
{
@@ -310,17 +270,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) sketch the cycle on p\u2013v coordinates. ",
- "# (b) determine the temperature at state 2, in \u0004K; ",
- "# (c) determine the specific volume at state 3, in m3/kg.",
"",
- "# Given:-",
"T1 = 300.00 #temperature in state 1 in kelvin",
"P1 = 1.00 #pressure in state 1 in bar",
"P2 = 2.00 #pressure in state 2 in bar",
"R = 287.00 #gas constant of air in SI units",
"",
- "# Calculations",
"v1 = (R*T1)/(P1*10**5) #specific volume in state 1",
"v = []",
"P = []",
@@ -345,8 +300,6 @@
" Pa.append(i)",
" Pa[i] = P1",
"",
- "#function[out]= f(inp)",
- "#out = (R*T2)/(inp",
"",
"",
"VV = linspace(v1,v3,50)",
@@ -365,7 +318,6 @@
"xlabel('v')",
"ylabel('p(bar)')",
"show()",
- "#The two steps are shown in one graph and the other on is shown in the other graph\"\"\"",
"",
"print 'The temperature in kelvin in state 2 is T2 = ',T2",
"print 'The specific volume in state 3 in m^3/kg is v = ',v3"
@@ -394,35 +346,27 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 3.8 Page no-108"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the work during the process, in kJ.",
"",
- "# Given:-",
- "# State 1",
"m = 0.9 # mass of air in kg",
"T1 = 300.0 # initial temperature in kelvin",
"P1 = 1.0 # initial pressure in bar",
"",
- "# State 2",
"T2 = 470.0 # final temperature in kelvin",
"P2 = 6.0 # final pressure in bar",
"Q = -20.0 # heat transfer in kj",
"",
- "# From table A-22 ",
"u1 = 214.07 # in KJ/kg",
"u2 = 337.32 # in KJ/Kg",
"",
- "# Calculations",
"deltaU = m*(u2-u1) # change in internal energy in kj",
"W = Q - deltaU # in KJ/kg",
"",
- "# Results",
"",
"print '-> The work during the process is ',W,' KJ.'"
],
@@ -441,38 +385,30 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 3.9 Page no-109"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine (a) the final equilibrium pressure, in bar (b) the heat transfer for the process, in kJ.",
"",
- "# Given:-",
- "# State 1",
"m1 = 2.0 # initial mass of gas in tank 1 in kg",
"T1 = 350.0 # initial temperature in kelvin in tank1",
"p1 = 0.7 # initial pressure in bar in tank 1",
"",
- "# State 2",
"m2 = 8.0 # initial mass of gas in tank 2 in kg",
"T2 = 300.0 # initial temperature in kelvin in tank 2",
"p2 = 1.2 # initial pressure in bar in tank 2",
"Tf = 315.0 # final equilibrium temperature in kelvin",
"",
- "# From table A-20",
"Cv = 0.745 # in KJ/Kg.k",
"",
- "# Calculations",
"pf = ((m1+m2)*Tf)/((m1*T1/p1)+(m2*T2/p2)) ",
"Ui = (m1*Cv*T1)+(m2*Cv*T2)",
"Uf = (m1+m2)*Cv*Tf",
"deltaU = Uf-Ui",
"Q = deltaU",
"",
- "# Results",
"print '-> The final equilibrium pressure is',pf,'bar.'",
"print '-> The heat transfer for the process is',Q,'KJ.'"
],
@@ -492,32 +428,26 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 3.11 Page no-113"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the work and heat transfer per unit mass, in kJ/kg, if n \u0003= 1.3.",
"",
- "# Given:-",
"p1 = 1.0 # initial pressure in bar",
"T1 = 295.0 # initial temperature in kelvin ",
"p2 = 5.0 # final pressure in bar",
"n = 1.3 # polytropic constant",
"R = 8314/28.97 # gas constant for air in SI units",
"",
- "# From table A-22",
"u2 = 306.53",
"u1 = 210.49",
"",
- "# Calculations",
"T2 = T1*(p2/p1)**((n-1)/n)",
"w = R*(T2-T1)/(1-n)",
"Q = u2-u1+w/1000",
"",
- "# Results",
"print '-> The work done per unit mass is ',w/1000,'KJ/kg.'",
"print '-> The heat transfer per unit mass is',Q,'KJ/kg.'"
],
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_4_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_4_2.ipynb
index 9cdd4291..45f5e608 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_4_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_4_2.ipynb
@@ -9,48 +9,37 @@
{
"cell_type": "markdown",
"source": [
- "# Chapter 4:- Control Volume Analysis Using Energy"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 4.1 Page no-125"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the mass flow rates at inlet 2 and at the exit, in kg/s, and the velocity at inlet 2, in m/s.",
"",
- "# Given:-",
- "# At inlet 1:-",
"p1= 7.0 # pressure in bar",
"T2= 200.0 # temperature in degree celcius",
"m1dot= 40.0 # mass flow rate in kg/s",
"",
- "# At inlet 2:-",
"p2= 7.0 # pressure in bar",
"T2= 40.0 # temperature in degree celcius",
"A2= 25.0 # area in cm^2",
"",
- "# At exit:-",
"p3= 7.0 # pressure in bar",
"AV3= 0.06 # Volumetric flow rate through wxir in m^3/s",
"",
- "# From table A-3",
"v3 = (1.108)*(10**(-3)) # specific volume at the exit in m^3/kg",
"",
- "# from table A-2",
"v2= (1.0078)*(10**(-3)) # specific volume in state 2 in m^3/kg",
"",
- "# Calculation:-",
"m3dot= AV3/v3 # mass flow rate at exit",
"m2dot = m3dot-m1dot # mass flow rate at inlet 2",
"V2= (m2dot*v2)/(A2*(10**(-4)))",
"",
- "# Results:-",
"print '-> The mass flow rate at the inlet 2 is', round(m2dot,2),' kg/s.'",
"print '-> The mass flow rate at the exit is', round(m3dot,2),' kg/s.'",
"print '-> The velocity at the inlet is ', round(V2,2),'m/s.'"
@@ -72,34 +61,27 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 4.3 Page no-135"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the exit area of the nozzle, in m2.",
"",
- "# Given:-",
"p1= 40.0 # pressure in bar",
"T1= 400.0 # temperature in degree celcius",
"V1= 10.0 # velocity m/s",
"",
- "# At exit:-",
"p2= 10.0 # pressure in bar",
"V2= 665.0 # velocity in m/s",
"mdot= 2.0 # mass flow rate in kg/s",
"",
- "# From table A-4",
"h1= 3213.6 # snpecific enthalpy in kJ/kg",
"v2 = 0.1627 # specific volume at the exit in m^3/kg",
"",
- "# Calculation:-",
"h2 = h1 + ((V1**2-V2**2)/2)/1000 # snpecific enthalpy in kJ/kg",
"A2=(mdot*v2)/V2 # Exit area",
"",
- "# Results:-",
"print '-> The exit Area of the nozzle is', round(A2,4),'m^2.'"
],
"language": "python",
@@ -117,37 +99,30 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 4.4 Page no-138"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the rate of heat transfer between the turbine and surroundings, in kW.",
"",
- "# Given:-",
"m1dot = 4600.0 # mass flow rate in kg/h",
"Wcvdot= 1000.0 # turbine power output in kv",
"p1= 60.0 # pressure in bar",
"T1=400.0 # temperature in degree celc",
"V1= 10.0 # velocity in m/s",
"",
- "# At exit:-",
"p2= 0.10 # pressure in bar",
"q2= 0.90 # quality ",
"V2= 50.0 # velocity in m/s",
"",
- "# From table A-2 and A-3:-",
"h1= 3177.2 # specific enthalpy at inlet in kJ/kg",
"hf2= 191.83",
"hg2= 2584.63",
"",
- "# Calculation:-",
"h2 = hf2+q2*(hg2-hf2) # specific enthalpy at exit in kJ/kg",
"Qcvdot = Wcvdot + m1dot*((h2-h1)+(V2**2- V1**2)/(2*1000))/3600",
" ",
- "# Results:-",
"print '-> The rate of heat transfer between the turbine and surroundings is',round(Qcvdot,2),'kW.'"
],
"language": "python",
@@ -165,22 +140,18 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 4.5 Page no-140"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate the power input to the compressor, in kW.",
"",
- "# Given:-",
"p1=1.00 # pressure in bar",
"t1= 290.00 # temperature in kelvin",
"A1= 0.1 # area in m^2",
"V1= 6.00 # velocity in m/s",
"",
- "# At exit:-",
"",
"p2=7.00 # pressure in bar",
"t2= 450.00 # temperature in kelvin",
@@ -188,18 +159,15 @@
"Qcvdot= -180.0 # heat transfer rate in kJ/min",
"R= 8.314 # universal gas constant in SI units",
"",
- "# from table A-22",
"",
"h1= 290.16 # specific enthalpy in kJ/kg",
"h2= 451.8 # specific enthalpy in kJ/kg",
"",
- "# Calculations:-",
"",
"v1 = (R*1000*t1)/(28.97*p1*10**5) # specific volume",
"mdot=(A1*V1)/v1 # mass flow rate",
"Wcvdot = Qcvdot/60 + mdot*((h1-h2)+(V1**2-V2**2)/(2*1000))",
"",
- "# Results:-",
" ",
"print '-> The power input to the compressor is ',round(Wcvdot,2),'kW.'"
],
@@ -218,41 +186,33 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 4.6 Page no-141"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the power input to the motor, in kW.",
"",
- "# Declaration of variables:-",
- "# At Entry:=",
"t1=20.0 # Temperatue in deg celcius",
"p1=1.0 # pressure in atm",
"AV1= 0.1 # volumetric flow rate in litre/s",
"D1=2.5 # Diameter of th hose in cm",
"",
- "# At Exit:=",
"t2=23.0 # temperatuer in deg celcius",
"p2=1.0 # pressure in atm",
"V2=50.0 # Velocity in m/s",
"Z2=5.0 # elevation in m",
"g= 9.8 # acceleration due to gravity in m/s^2",
"",
- "# from table A-2 and A-19:-",
"",
"v= (1.0018)*((10.0)**(-3)) # specific volume in m^3/kg",
"c= 4.18 ",
"",
- "# Calculation:-",
"mdot = (AV1/1000)/v # mass flow rate in kg/s",
"V1= (AV1/1000)/(3.14*(D1/(2*100))**2) # Entry velocity in m/s",
"deltah = c*(t2-t1)+v*(p2-p1)",
"Wcvdot= ((mdot*10)/9)*(-deltah+(V1**2-V2**2)/(2*1000)+g*(0-Z2)/1000)",
"",
- "# Results:-",
"print '-> The power input to the motor is', round(Wcvdot,2),'KW.'"
],
"language": "python",
@@ -270,18 +230,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 4.7:- Page no-144"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine (a) the ratio of the mass flow rate of the cooling water to the mass flow rate of the condensing stream. ",
- "# (b) the rate of energy transfer from the condensing steam to the cooling water.",
"",
- "# Declaration of variables:-",
- "# Entering:-",
"p1=0.1 # pressure in bar",
"x1= 0.95 # Quality",
"p2= 0.1 # pressure in bar",
@@ -289,19 +244,16 @@
"t3=20.0 # temperature of cooling entry in deg cel",
"t4=35.0 # temperature of cooling exit",
"",
- "# From table A-3",
"hf= 191.53 # Enthalpy in KJ/kg",
"hg= 2584.7 # Enthalpy in KJ/kg",
"h2=188.45 # Assumption at states 2,3 and 4, h is approx equal to hf(T), in kJ/kg",
"deltah4_3= 62.7 # Assumption 4, in kJ/kg",
"",
"",
- "# Calculations:-",
"h1= hf + x1*(hg-hf)",
"ratio= (h1-h2)/(deltah4_3)",
"QRate= (h2-h1) # Part B",
"",
- "# Results:-",
"print '-> The rate of the mass flow rate of the cooling water to the mass flow rate of the condenstaing stream is (m3dot/m1dot)',round(ratio,2)",
"print '-> The rate of energy transfer from the condensing steam to the cooling water of the steam passing through the condenser is',round(QRate,2),'kJ/kg.'"
],
@@ -321,16 +273,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 4.8:- Page no-146"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the smallest fan inlet diameter,for which the limits on the entering air velocity and exit air temperature are met.",
"",
- "# Given:-",
"T1 = 293.0 # In kelvin",
"P1= 1.01325 * (10**5) # In pascal",
"V1max= 1.3 # maximum velocity of entering air in m/s",
@@ -343,7 +292,6 @@
"Cp= 1.005*(10**3) # in j/kg*k",
"pi=3.14",
"",
- "# Calculations:-",
"",
"Wcvdot = pec +Pf # total electric power provided to electronic components and fan in watt",
"mdotmin= (-Wcvdot)/(Cp*(T2max-T1)) # minimum mass flow rate",
@@ -351,7 +299,6 @@
"A1min = (mdotmin*v1)/V1max",
"D1min = (4*A1min/(pi))**(0.5)",
"",
- "# Results:-",
"print '-> The smallest fan inlet diameter is',round(D1min*100,2),'cm.'"
],
"language": "python",
@@ -369,33 +316,26 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 4.9 Page no-148"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the quality of the steam in the supply line.",
"",
- "# Given:-",
"P1 = 20.0 # pressure in supply line in bars",
"P2 = 1.0 # exhaust pressure in bar",
"T2 = 120.0 # exhaust temperature in degree celcius",
"",
- "# from table A-3 at 20 bars",
"hf1 = 908.79 # Enthalpy in kj/kg",
"hg1 = 2799.5 # Enthalpy in kj/kg",
"",
- "# from table A-4, at 1 bar and 120 degree celcius",
"h2 = 2766.6 # in kj/kg",
"h1 = h2 # from throttling process assumption",
"",
"",
- "# Calculations:-",
"x1 = (h1-hf1)/(hg1-hf1)",
"",
- "# Results:-",
"print '-> The quality of the steam in the supply line is',round(x1,2)"
],
"language": "python",
@@ -413,16 +353,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 4.10 Page no-150"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) Determine the power developed by the turbine (b) Determine the turbine inlet temperature, in \u0004C.",
"",
- "# Given:-",
"P1 = 1.0 # pressure of industrial discharge in bar",
"T1 = 478.0 # temperature of industrial discharge in kelvin",
"m1dot = 69.78 # mass flow rate of industrial discharge in kg/s",
@@ -434,27 +371,22 @@
"P5 = 0.07 # exit pressure of the turbine in bars",
"x5 = 0.93 # quality of turbine exit",
"",
- "# Part (a)",
"m2dot = m1dot # since gas and water streams do not mix",
"m5dot = m3dot # --DO",
"",
- "# from table A-22, A-2 and A-3:-",
"h1 = 480.3 # in kj/kg",
"h2 = 400.98 # in Kj/kg",
"h3 = 162.9 # assumption: h3 = hf(T3), units in Kj/kg",
"hf5 = 161.0 # in kj/kg",
"hg5 = 2571.72 # in kj/kg",
"",
- "# Part (b)",
"P4 = P3 # from the assumption that there is no pressure drop for water flowing through the steam generator",
"T4 = 180 # in degree celcius",
"",
- "# Calculations:-",
"h5 = hf5 + x5*(hg5-hf5)",
"Wcvdot = m1dot*h1 + m3dot*h3 - m2dot*h2 - m5dot*h5",
"h4 = h3 + (m1dot/m3dot)*(h1 -h2) # from steady state energy rate balance",
" # interpolating in table A-4, with these P4 and h4",
- "# Results:-",
"print '-> The power developed by the turbine is ',round(Wcvdot,2),'kJ/s.'",
"print '-> Turbine inlet temperature is',round(T4,2),'degree celcius.'"
],
@@ -474,21 +406,17 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 4.11 Page no-153"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the amount of heat transfer, in kJ. Neglect all kinetic andpotential energy effects.",
"",
- "# Given:-",
"V = 0.85 # volume of tank in m^3",
"T1 = 260.0 # initial temperature of the tank in degree celcius",
"X1 = 0.7 # initial quality",
"",
- "# from table A-2",
"uf1 = 1128.4 # in kg/kg",
"ug1 = 2599.0 # in kg/kg",
"",
@@ -497,12 +425,10 @@
"",
"",
"",
- "# for final state, from table A-2,",
"u2 = 2599.0 # units in KJ/kg ",
"v2 = 42.21e-3 # units in m^3/Kg",
"he = 2796.6 # units in KJ/kg",
"",
- "# Calculations:-",
"u1 = uf1 + X1*(ug1-uf1) # in kj/kg",
"v1 = vf1 + X1*(vg1-vf1) # in m^3/kg",
"m1 = V/v1 # initial mass in kg",
@@ -511,7 +437,6 @@
"U1 = m1*u1 # initial internal energy in KJ",
"Qcv = (U2-U1) - he*(m2-m1) ",
"",
- "# Results:-",
"print '-> The amount of heat transfer is',round(Qcv,2),'KJ.'"
],
"language": "python",
@@ -529,36 +454,29 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 4.12 Page no-155"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the amount of work developed by the turbine,in kJ.",
"",
- "# Given:- ",
"Pv = 15.0 # pressure in the vessel in bar",
"Tv = 320.0 # temperature in the vessel in degree celcius",
"Vt = 0.6 # volume of a tank in m^3",
"Tt = 400.0 # temperature in the tank in degree celcius when the tank is full",
"",
- "# Since the tank is initially empty:-",
"m1 = 0",
"u1 = 0",
"",
- "# From table A-4, at 15bar and 400 degree celcius:-",
"v2 = 0.203 # Volume in m^3/kg",
"m2 = Vt/v2 # mass within the tank at the end of the process in kg",
"hi = 3081.9 # in kj/kg",
"u2 = 2951.3 # in kj/kg",
"",
- "# Calculations:-",
"deltaUcv = m2*u2-m1*u1",
"Wcv = hi*(m2-m1)-deltaUcv",
"",
- "# Results:-",
"print '-> The amount of work developed by the turbine is ',round(Wcv,2),'kJ.'"
],
"language": "python",
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_5_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_5_2.ipynb
index 6df0d0a2..c916acae 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_5_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_5_2.ipynb
@@ -9,32 +9,26 @@
{
"cell_type": "markdown",
"source": [
- "#Chapter 5 :- The Second Law of Thermodynamics"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 5.1 Page no- 194"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Inventor claims to have developed a power cycle . Evaluate this claim.",
"",
- "# Given :-",
"W = 410.00 # net work output in kj claimed ",
"Q = 1000.00 # energy input by heat transfer in kj",
"Tc = 300.00 # temperature of cold reservoir in kelvin",
"TH = 500.00 # temperature of hot reservoir in kelvin",
"",
- "# Calculations ",
"eta = W/Q # thermal efficiency",
"etamax = 1-(Tc/TH)",
"",
- "# Results",
"print '-> Eta = ',round(eta,4)",
"print '-> Etamax = ',round(etamax,4)",
"print '-> Since eta is more than etamax, the claim is not authentic'"
@@ -56,26 +50,21 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 5.2 Page no- 195"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the COP of the refrigerator and compare with the COP of a reversible refrigeration cycle operating between reservoirs at the same two temperatures.",
"",
- "# Given :-",
"Qcdot = 8000.00 # in kj/h",
"Wcycledot = 3200.00 # in kj/h",
"Tc = 268.00 # temperature of compartment in kelvin",
"TH = 295.00 # temperature of the surrounding air in kelvin",
"",
- "# Calculations ",
"beta = Qcdot/Wcycledot # coefficient of performance",
"betamax = Tc/(TH-Tc) # reversible coefficient of performance",
"",
- "# Results",
"print '-> Coefficient of performance is ',round(beta,3)",
"print '-> Coefficient of performance of a reversible cycle is ',round(betamax,3)"
],
@@ -95,24 +84,19 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Eample 5.3 Page no- 196"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# An electric heat pump, supply this energy, determine the minimum theoretical work input for one day.",
"",
- "# Given :-",
"Tc = 283.0 # in kelvin",
"TH = 295.0 # in kelvin",
"QH = 5*(10**5) # in kj per day",
"",
- "# Calculations",
"Wcyclemin = (1-(Tc/TH))*QH",
"",
- "# Results",
"print '-> Minimum theoretical work input for one day of operation in kJ is: ',round(Wcyclemin,2)"
],
"language": "python",
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_6_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_6_2.ipynb
index 5360471d..d31bd424 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_6_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_6_2.ipynb
@@ -9,25 +9,20 @@
{
"cell_type": "markdown",
"source": [
- "# Chapter 6 :- Using Entropy"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.1 Page no- 219"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the work and heat transfer per unit of mass, each in kJ/kg.",
"",
- "# Given:-",
"T = 373.15 # temperature in kelvin",
"",
- "# From table A-2",
"",
"p = 1.014*(10**5) # pressure in pascal",
"vg = 1.673",
@@ -35,11 +30,9 @@
"sg = 7.3549",
"sf = 1.3069",
"",
- "# Calculations",
"w = p*(vg-vf)*(10**(-3))",
"Q = T*(sg-sf)",
"",
- "# Results ",
"print '-> The work per unit mass is',round(w,3),'KJ/kg.'",
"print '-> The heat transfer per unit mass is ',round(Q,2),'KJ/kg.'"
],
@@ -59,17 +52,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.2 Page no- 224"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the net work per unit mass and the amount of entropy produced per unit mass",
"",
- "# Given:-",
- "# Assumptions:",
"\"\"\"",
"1. The water in the piston\u2013cylinder assembly is a closed system.",
"",
@@ -78,20 +67,15 @@
"3. The system is at an equilibrium state initially and finally. There is no",
"change in kinetic or potential energy between these two states.\"\"\"",
"",
- "# From table A-2 at 100 degree celcius",
"ug = 2506.5 # in kj/kg",
"uf = 418.94 # in kj/kg",
"sg = 7.3549",
"sf = 1.3069",
"",
"",
- "# Calculations:-",
- "# From energy balance",
"W = -(ug-uf)",
- "# From entropy balance",
"sigmabym = (sg-sf)",
"",
- "# Results",
"print '-> The net work per unit mass is ',round(W,2),'KJ/kg.'",
"print '-> The amount of entropy produced per unit mass is ',round(sigmabym,2),'kJ/kg.k.'"
],
@@ -111,30 +95,22 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.3 Page no-225"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the minimum theoretical work input required per unit mass of refrigerant, in kJ/kg.",
"",
- "# Given:-",
"T1 = 273.0 # initial temperature of saturated vapor in kelvin",
"P2 = 0.7*(10**6) # final pressure in pascal",
"",
- "# From table A-10,",
"u1 = 227.06 # in kj/kg",
"",
- "# minimum theoretical work corresponds to state of isentropic compression",
- "# From table A-12,",
"u2s = 244.32 # in kj/kg",
" ",
- "# Calculations ",
"Wmin = u2s-u1",
"",
- "# Results",
"print '-> The minimum theoretical work input required per unit mass of refrigerant is: ',round(Wmin,2),'kJ/kg.'"
],
"language": "python",
@@ -152,31 +128,21 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.4 Page no- 227"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Evaluate the rate of entropy production sigmadot (a) the gearbox as the system ",
- "# (b) an enlarged system consisting of the gearbox and enough of its surroundings that heat transfer occurs at the temperature of the surroundings away from the immediate vicinity of the gearbox",
"",
- "# Given :-",
"Qdot = -1.2 # in kilo watt",
"Tb = 300.0 # in kelvin",
"Tf = 293.0 # in kelvin",
- "# Calculations",
"",
- "# Part (a)",
- "# From entropy balance ",
"sigmadot = -Qdot/Tb",
"",
- "# Part(b)",
- "# From entropy balance ",
"sigmadt = -Qdot/Tf",
"",
- "# Results",
"print '-> The rate of entropy production with gearbox as system is ',round(sigmadot,5),'kw/k.'",
"print '-> The rate of entropy production with gearbox + sorrounding as system is',round(sigmadt,5),'kw/k.'"
],
@@ -196,16 +162,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.5 Page no-229"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine (a) the final equilibrium temperatureof the metal bar and the water, in \u0004K, (b) the amount of entropy produced.",
"",
- "# GIven:-",
"Tmi = 1200.0 # initial temperature of metal in kelvin",
"cm = 0.42 # specific heat of metal in KJ/kg.k",
"mm = 0.3 # mass of metal in kg",
@@ -213,17 +176,11 @@
"cw = 4.2 # specific heat of water in KJ/Kg.k",
"mw = 9.0 # mass of water in kg",
"",
- "# Calculations",
"import math",
- "# Part(a)",
- "# Solving energy balance equation yields",
"Tf = (mw*(cw/cm)*Twi+mm*Tmi)/(mw*(cw/cm)+mm)",
"",
- "# Part (b)",
- "# Solving entropy balance equation yields",
"sigma = mw*cw*math.log(Tf/Twi)+mm*cm*math.log(Tf/Tmi)",
"",
- "# Results",
"print '-> The final equilibrium temperature of the metal bar and the water is',round(Tf,2),' kelvin.'",
"print '-> The amount of entropy produced is:',round(sigma,2),'kJ/k.'"
],
@@ -243,16 +200,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.6 Page no- 234"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the rate at which entropy is produced within the turbine per kg of steam flowing",
"",
- "# Given:-",
"P1 = 30.0 # pressure of steam entering the turbine in bar",
"T1 = 400.0 # temperature of steam entering the turbine in degree celcius",
"V1 = 160.0 # velocity of steam entering the turbine in m/s",
@@ -261,24 +215,17 @@
"Wcvdot = 540.0 # work produced by turbine in kJ/kg of steam",
"Tb = 350.0 # temperature of the boundary in kelvin",
"",
- "# From table A-4 and table A-2",
"h1 = 3230.9 # specific enthalpy at entry in Kj/kg",
"h2 = 2676.1 # specific enthalpy at exit in kj/kg",
"",
- "# Calculations",
"",
- "# Reduction in mass and energy balance equations results in ",
"Qcvdot = Wcvdot + (h2 - h1)+ (V2**2-V1**2)/(2*(10**3)) # heat transfer rate",
"",
- "# From table A-2",
"s2 = 7.3549 # in kj/kg.k",
- "# From table A-4",
"s1 = 6.9212 # in kj/kg.k",
"",
- "# From entropy and mass balance equations",
"sigmadot = -(Qcvdot/Tb) + (s2-s1)",
"",
- "# Results",
"print '-> The rate at which entropy is produced within the turbine per kg of steam flowing is',round(sigmadot,2),'kJ/kg.k.'"
],
"language": "python",
@@ -296,16 +243,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.7 Page no- 235"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Evaluate the inventor\u2019s claim, employing the ideal gas model for air and ignoring changes in the kinetic and potential energies of the streams from inlet to exit.",
"",
- "# Given:-",
"T1 = 294.0 # entry temperature of air in kelvin",
"P1 = 5.1 # entry pressure of air in bars",
"T2 = 352.0 # exit temperature of hot stream in kelvin",
@@ -314,14 +258,12 @@
"P3 = 1.0 # exit pressure of cold stream in bars",
"cp = 1.0 # in kj/kg.k",
"",
- "# Calculations",
"import math",
"R = 8.314/28.97",
"se = 0.4*(cp*math.log((T2)/(T1))-R*math.log(P2/P1)) + 0.6*(cp*math.log((T3)/(T1))-R*math.log(P3/P1))",
" # specific entropy in kj/kg.k",
"",
"",
- "# Results",
"print '-> Specific entropy in kj/kg.k = ',round(se,3),' KJ/kg.'",
"print '-> Since se > 0, the claim of the writer is true'"
],
@@ -341,17 +283,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 6.8 Page no- 237"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) determine the rates of entropyproduction, in kW/K, for control volumes enclosing the condenser,compressor,and expansion valve, respectively. ",
- "# (b) Discuss the sources of irreversibilityin the components considered in part (a).",
"",
- "# Given:-",
"P1 = 3.5 # pressure of refrigerant entering the compressor in bars",
"T1 = 268.0 # temperature of refrigerant entering the compressor in kelvin",
"P2 = 14.0 # pressure of refrigerant entering the condenser in bars",
@@ -365,32 +303,25 @@
"P6 = 1.0 # pressure of return air exiting the condenser in bar",
"T6 = 323.0 # temperature of return air exiting the condenser in kelvin",
"",
- "# Part(a)",
"",
- "# From table A-9",
"s1 = 0.9572 # in kj/kg.k",
- "# Interpolating in table A-9",
"s2 = 0.98225 # in kj/kg.k",
"h2 = 294.17 # in kj/kg",
- "# From table A-7",
"s3 = 0.2936 # in kj/kg.k",
"h3 = 79.05 # in kj/kg",
"",
"h4 = h3 # since expansion through valve is throttling process",
"",
- "# From table A-8",
"hf4 = 33.09 # in kj/kg",
"hg4 = 246.00 # in kj/kg",
"sf4 = 0.1328 # in kj/kg.k",
"sg4 = 0.9431 # in kj/kg.k",
"cp = 1.005 # in kj/kg.k",
"",
- "# Calculations",
"import math",
"x4 = (h4-hf4)/(hg4-hf4) # quality at state 4",
"s4 = sf4 + x4*(sg4-sf4) # specific entropy at state 4",
"",
- "# CONDENSER!!",
"v5 = ((8314/28.97)*T5)/(P5*(10**5)) # specific volume at state 5",
"mairdot = AV5/v5 ",
"h6 = cp*T6",
@@ -399,13 +330,10 @@
"deltaS65 = cp*math.log(T6/T5)-(8.314/28.97)*math.log(P6/P5) # change in specific entropy",
"sigmacond = (mrefdot*(s3-s2)) + (mairdot*(deltaS65))",
"",
- "# COMPRESSOR!!",
"sigmacomp = mrefdot*(s2-s1)",
"",
- "# VALVE!!",
"sigmavalve = mrefdot *(s4-s3)",
"",
- "# Results",
"print '-> The rates of entropy production for control volume enclosing the condenser is ',sigmacond,'kW/K.'",
"print '-> The rates of entropy production for control volume enclosing the compressor is ',sigmacomp,'kW/K.'",
"print '-> The rates of entropy production for control volume enclosing the expansion valve is ',sigmavalve,'kW/K.'"
@@ -427,32 +355,24 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.9 Page no-243"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the final pressure p2, using (a) pr data from Table A-22 (b) Interactive Thermodynamics: IT, and (c) a constant specific heat ratio k evaluated at the mean",
- "# temperature, 475\u0004K, from Table A-20.",
"",
- "# Given:-",
"P1 = 1.00 # initial pressure in bar",
"T1 = 300.00 # initial temperature in kelvin",
"T2 = 650.00 # final temperature in kelvin",
"",
- "# Part(a)",
- "# From table A-22",
"pr2 = 21.86 ",
"pr1 = 1.3860",
"k = 1.39 # From table A-20",
"",
- "# Calculations",
"p2 = P1*(pr2/pr1)",
"p2a = P1*((T2/T1)**(k/(k-1)))",
"",
- "# Results",
"print '-> P2 = ',p2,'bar.'",
"print '-> Part(b) IT software problem'",
"print '-> P2a = ',p2a,'bar.'"
@@ -474,34 +394,27 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.10 Page no- 244"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the amount of mass remaining in the tank and its temperature.",
"",
- "# Given:-",
"m1 = 5.00 # initial mass in kg",
"P1 = 5.00 # initial pressure in bar",
"T1 = 500.00 # initial temperature in kelvin",
"P2 = 1.00 # final pressure in bar",
"",
- "# From table A-22",
"pr1 = 8.411",
"",
"",
"",
- "# Using this value of pr2 and interpolation in table A-22",
"T2 = 317.00 # in kelvin",
"",
- "# Calculations ",
"pr2 = (P2/P1)*pr1",
"m2 = (P2/P1)*(T1/T2)*m1",
"",
- "# Results",
"print '-> The amount of mass remaining in the tank is ',m2,'kg.'",
"print 'and its temperature is ',T2,'kelvin.'"
],
@@ -521,31 +434,24 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.11 Page no- 249"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the work developed per unit mass of steam flowing through the turbine, in kJ/kg.",
"",
- "# Given:-",
"P1 = 1.00 # inlet pressure in bar",
"T1 = 593.00 # inlet temperature in kelvin",
"P2 = 1.00 # exit pressure in bar",
"eta =0.75 # turbine efficiency",
"",
- "# From table A-4",
"h1 = 3105.6 # in Kj/kg",
"s1 = 7.5308 # in kj/kg.k",
- "# From table A-4 at 1 bar",
"h2s = 2743.00 # in kj/kg",
"",
- "# Calculations",
"w = eta*(h1 - h2s)",
"",
- "# Result",
"print '-> The work developed per unit mass of steam flowing through is ',w,'kJ/kg.'"
],
"language": "python",
@@ -563,34 +469,27 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.12 Page no-250"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the turbine efficiency.",
"",
- "# Given:-",
"P1 = 3.00 # pressure of air entering in bar",
"T1 = 390.00 # temperature of air entering in kelvin",
"P2 = 1.00 # pressure of exit air",
"Wcvdot = 74.00 # work developed in kj/kg",
"",
- "# From table A-22,at 390k",
"h1 = 390.88 # in kj/kg",
"pr1 = 3.481",
"",
- "# From interpolation table A-22",
"h2s = 285.27 # in kj/kg",
"",
- "# calculations",
"pr2 = (P2/P1)*pr1",
"Wcvdots = h1 - h2s",
"eta = Wcvdot/Wcvdots",
"",
- "# Result",
"print '-> The turbine efficiency is ',round(eta,4),'.'"
],
"language": "python",
@@ -608,38 +507,30 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 6.13 Page no-251"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the nozzle efficiency.",
"",
- "# Given:-",
"P1 = 1.00 # pressure of entering steam in Mpa",
"T1 = 593.00 # temperature of entering steam in kelvin",
"V1 = 30.00 # velocity of entering steam in m/s",
"P2 = 0.3 # pressure of exit steam in Mpa",
"T2 = 453.00 # temperature of exit steam in kelvin",
"",
- "# From table A-4, at T1 = 593 kelvin and P1 = 1 Mpa;",
- "# and at T2 = 453 kelvin and P2 = .3 Mpa",
"h1 = 3093.9 # in kj/kg",
"s1 = 7.1962 # in kj/kg.k",
"h2 = 2823.9 # in kj/kg",
"",
"",
- "# Interpolating in table A-4",
"h2s = 2813.3 # in kj/kg",
"",
- "# Calculations",
"V2squareby2 = h1 - h2 + (V1**2)/2000",
"V2squareby2s = h1 - h2s + (V1**2)/2000",
"eta = V2squareby2/V2squareby2s",
"",
- "# Results",
"print '-> The nozzle efficiency is ',round(eta,4),'.'"
],
"language": "python",
@@ -657,30 +548,23 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 6.14 Page no- 252"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the power, in kW, and the isentropic efficiency using (a) data from property tables,(b) Interactive Thermodynamics: IT.",
"",
- "# Given:-",
- "# From table A-9",
"h1 = 249.75 # in kj/kg",
"h2 = 294.17 # in kj/kg",
"mdot = 0.07 # in kg/s",
"",
- "# From table A-9",
"s1 = 0.9572 # in Kj/Kg.k",
"h2s = 285.58 # in kj/kg",
"",
- "# Calculations",
"wcvdot = -(mdot*(h2-h1))",
"eta = (h2s-h1)/(h2-h1) ",
"",
- "# Results",
"print '-> The power in is',wcvdot,'KW.'",
"print '-> The isentropic efficiency is ',round(eta,3),'.'"
],
@@ -700,32 +584,26 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 6.15 Page no-256"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the work and heat transfer per unit of mass passing through the device, in kJ/kg",
"",
- "# Given:-",
"P1 = 1.00 # pressure of entering air in bar",
"T1 = 293.00 # temperature of entering air in kelvin",
"P2 = 5.00 # pressure of exit air in bar",
"n = 1.3",
"R = 8.314/28.97",
"",
- "# From table A-22",
"h1 = 293.17 # in kj/kg",
"h2 = 426.35 # in kj/kg",
"",
- "# Calculations",
"T2 = T1*((P2/P1)**((n-1)/n)) # in kelvin",
"wcvdot=((n*R)/(n-1))*(T1-T2) # in kj/kg",
"Qcvdot= wcvdot + (h2-h1) # in kj/kg",
"",
- "# Results",
"print '-> The work per unit mass passing through the device is',round(wcvdot,2),'kJ/kg.'",
"print '-> The heat transfer per unit mass is ',round(Qcvdot,2),'kJ/kg.'"
],
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_7_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_7_2.ipynb
index 920ab6d8..0a0a3ee0 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_7_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_7_2.ipynb
@@ -9,39 +9,32 @@
{
"cell_type": "markdown",
"source": [
- "# Chapter 7 :- Exergy Analysis"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 7.1 Page no-279"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the specific exergy of the gas, in kJ/kg. ",
"",
- "# Given:-",
"v = 2450.00 # volume of gaseous products in cm^3",
"P = 7.00 # pressure of gaseous product in bar",
"T = 867.00 # temperature of gaseous product in degree celcius",
"T0 = 300.00 # in kelvin",
"P0 = 1.013 # in bar",
"",
- "# From table A-22",
"u = 880.35 # in kj/kg",
"u0 = 214.07 # in kj/kg",
"s0T = 3.11883 # in kj/kg.k",
"s0T0 = 1.70203 # in kj/kg.k",
"",
- "# Calculations",
"import math",
"e = (u-u0) + (P0*(8.314/28.97)*(((T+273)/P)-(T0/P0))) - T0*(s0T-s0T0-(8.314/28.97)*math.log(P/P0)) # kj/kg",
"",
- "# Results",
"print '-> The specific exergy of the gas is ',round(e,3),'kJ/kg.'"
],
"language": "python",
@@ -59,69 +52,47 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 7.2 Page no-280"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine(a) the initial exergy, final exergy, and change in exergy of the refrigerant, each in kJ. ",
- "# (b) the change in exergy of the suspended mass, in kJ.",
- "# (c) the change in exergy of an isolated system of the vessel and pulley\u2013mass assembly, in kJ. ",
- "# Discuss the results obtained, and compare with the respective energy changes. Let T0 \u0003= 293 K (20\u0004C), p0 =\u0003 1 bar.",
"",
- "# Given:-",
"mR = 1.11 # mass of the refrigerant in kg",
"T1 = -28.00 # initial temperature of the saturated vapor in degree celcius",
"P2 = 1.4 # final pressure of the refrigerant in bar",
"T0 = 293.00 # in kelvin",
"P0 = 1.00 # in bar",
"",
- "# Part (a)",
- "# From table A-10",
"u1 = 211.29 # in kj/kg",
"v1 = 0.2052 # in m^3/kg",
"s1 = 0.9411 # in kj/kg.k",
- "# From table A-12",
"u0 = 246.67 # in kj/kg",
"v0 = 0.23349 # in m^3/kg",
"s0 = 1.0829 # in kj/kg.k",
"",
- "# From table A-12",
"u2 = 300.16 # in kj/kg",
"s2 = 1.2369 # in kj/kg.k",
"v2 = v1",
"",
- "# Calculations ",
"E1 = mR*((u1-u0) + P0*(10**5)*(v1-v0)*(10**(-3))-T0*(s1-s0))",
"E2 = mR*((u2-u0) + P0*(10**5)*(v2-v0)*(10**(-3))-T0*(s2-s0))",
"",
- "# Results for Part A",
"print '-> Part(a) The initial exergy is ',round(E1,2),'kJ.'",
"print '-> The final exergy is ',round(E2,2),'kJ.'",
"print '-> The change in exergy of the refrigerant is ',round(E2-E1,2),'kJ.'",
"",
"",
- "# Part (b)",
- "# Calculations",
"deltaU = mR*(u2-u1)",
- "# From energy balance",
"deltaPE = -deltaU",
- "# With the assumption::The only significant changes of state are experienced by the refrigerant and the suspended mass. For the refrigerant, ",
- "# there is no change in kinetic or potential energy. For the suspended mass, there is no change in kinetic or internal energy. Elevation is ",
- "# the only intensive property of the suspended mass that changes",
"deltaE = deltaPE",
"",
- "# Results for part b",
"print '-> Part(b)The change in exergy of the suspended mass is ',round(deltaE,3),'kJ.'",
"",
"",
- "# Part(c)",
- "# Calculations",
"deltaEiso = (E2-E1) + deltaE",
"",
- "# Results",
"print '-> Part(c)The change in exergy of an isolated system of the vessel and pulley\u2013mass assembly is ',round(deltaEiso,2),'kJ.'"
],
"language": "python",
@@ -143,23 +114,17 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 7.3 Page no-287"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine on a unit of mass basis the change in exergy, the exergy transfer accompanying work, the exergy transfer accompanying heat, ",
- "# and the exergy destruction, ",
"",
- "# Given :-",
"T = 373.15 # initial temperature of saturated liquid in kelvin",
"T0 = 293.15 # in kelvin",
"P0 = 1.014 # in bar",
"",
- "# Part(a)",
- "# From table A-2",
"ug = 2506.5 # in kj/kg",
"uf = 418.94 # in kj/kg",
"vg = 1.673 # in m^3/kg",
@@ -168,34 +133,25 @@
"sf = 1.3069 # in kj/kg.k",
"",
"",
- "# Calculations ",
- "# Energy transfer accompanying work",
"etaw = 0 # since p = p0",
- "# Exergy transfer accompanying heat",
"Q = 2257 # in kj/kg,obtained from example 6.1",
"etah = (1-(T0/T))*Q",
"",
- "# Exergy destruction",
"ed = 0 # since the process is accomplished without any irreversibilities",
"deltae = ug-uf + P0*(10**5)*(vg-vf)/(10**3)-T0*(sg-sf)",
"",
- "# Results",
"print '-> Part(a)the change in exergy is',round(deltae,2),'kJ/kg.'",
"print '-> The exergy transfer accompanying work is',round(etaw,2),'kJ/kg.'",
"print '-> The exergy transfer accompanying heat is',round(etah,2),'kJ/kg.'",
"print '-> The exergy destruction is',round(ed,2),'kJ/kg.'",
"",
"",
- "# Part(b)",
"Deltae = deltae # since the end states are same ",
"Etah = 0 # since process is adiabatic",
- "# Exergy transfer along work",
"W = -2087.56 # in kj/kg from example 6.2",
"Etaw = W- P0*(10**5)*(vg-vf)/(10**3)",
- "# Exergy destruction",
"Ed = -(Deltae+Etaw)",
"",
- "# Results",
"print '-> Part(b)the change in exergy is ',round(Deltae,2),'kJ/kg.'",
"print '-> The exergy transfer accompanying work is',round(Etaw,2),'kJ/kg.'",
"print '-> The exergy transfer accompanying heat is',round(Etah,2),'kJ/kg.'",
@@ -223,26 +179,21 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 7.4 Page no-289"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# For the gearbox of Examples 2.4 and 6.4(a), develop a full exergy accounting of the power input. ",
"",
- "# Given:-",
"T0 = 293.00 # in kelvin",
"Qdot = -1.2 # in KW, from example 6.4a",
"Tb = 300.00 # temperature at the outer surface of the gearbox in kelvin from example 6.4a",
"sigmadot = 0.004 # rate of entropy production in KW/k from example 6.4a",
"",
- "# Calculations",
"R = -(1-T0/Tb)*Qdot # time rate of exergy transfer accompanying heat",
"Eddot = T0*sigmadot # rate of exergy destruction",
"",
- "# Results",
"print '-> Balance sheet'",
"print '* Rate of exergy in high speed shaft 60Kw' ",
"print '-> Disposition of the exergy: Rate of exergy out low-speed shaft 58.8Kw' ",
@@ -268,39 +219,31 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 7.5 Page no-295"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the specific flow exergy at the inlet and exit and the exergy destruction per unit of mass flowing",
"",
- "# Given:-",
"p1 = 3.0 # entry pressure in Mpa",
"p2 = 0.5 # exit pressure in Mpa",
"T1 = 320.0 # entry temperature in degree celcius",
"T0 = 25.0 # in degree celcius",
"p0 = 1.0 # in atm",
"",
- "# From table A-4",
"h1 = 3043.4 # in kj/kg",
"s1 = 6.6245 # in kj/kg.k",
"h2 = h1 # from reduction of the steady-state mass and energy rate balances",
"s2 = 7.4223 # Interpolating at a pressure of 0.5 MPa with h2 = h1, units in kj/kg.k",
"",
- "# From table A-2",
"h0 = 104.89 # in kj/kg",
"s0 = 0.3674 # in kj/kg.k",
"",
- "# Calculations ",
"ef1 = h1-h0-(T0+273)*(s1-s0) # flow exergy at the inlet",
"ef2 = h2-h0-(T0+273)*(s2-s0) # flow exergy at the exit",
- "# From the steady-state form of the exergy rate balance",
"Ed = ef1-ef2 # the exergy destruction per unit of mass flowing is",
"",
- "# Results ",
"print '-> The specific flow exergy at the inlet is ',round(ef1,2),'kJ/kg.'",
"print '-> The specific flow exergy at the exit is',round(ef2,2),'kJ/kg.'",
"print '-> The exergy destruction per unit of mass flowing is',round(Ed,2),'kJ/kg.'"
@@ -322,19 +265,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 7.6 Page no-296"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine for the heat exchanger",
- "# (a) the exit temperature of the combustion gas, in K.",
- "# (b) the net change in the flow exergy rate from inlet to exit of each stream, in MW. ",
- "# (c) the rate exergy is destroyed, in MW. Let T0 =\u0003 300 K, p0 =\u0003 1 bar.",
"",
- "# Given:-",
"T1 = 610.0 # temperature of the air entering heat exchanger in kelvin",
"p1 = 10.0 # pressure of the air entering heat exchanger in bar",
"T2 = 860.0 # temperature of the air exiting the heat exchanger in kelvin",
@@ -346,44 +283,32 @@
"T0 = 300.0 # in kelvin",
"p0 = 1.0 # in bar",
"",
- "# Part (a)",
- "# From table A-22",
"h1 = 617.53 # in kj/kg",
"h2 = 888.27 # in kj/kg",
"h3 = 1068.89 # in kj/kg",
"",
- "# Calculations",
"\"\"\"From reduction of mass and energy rate balances for the control volume at",
"steady state \"\"\"",
"h4 = h3+h1-h2",
"",
- "# Using interpolation in table A-22 gives",
"T4 = 778 # in kelvin",
"",
- "# Results",
"print '-> The exit temperature of the combustion gas is',T4,'kelvin.'",
"",
- "# Part(b)",
- "# From table A-22",
"s2 = 2.79783 # in kj/kg.k",
"s1 = 2.42644 # in kj/kg.k",
"s4 = 2.68769 # in kj/kg.k",
"s3 = 2.99034 # in kj/kg.k",
"",
- "# Calculations for part b",
"import math",
"deltaR = (mdot*((h2-h1)-T0*(s2-s1-(8.314/28.97)*math.log(p2/p1))))/1000",
"deltRc = mdot*((h4-h3)-T0*(s4-s3-(8.314/28.97)*math.log(p4/p3)))/1000",
"",
- "# Results for part b",
"print '-> The net change in the flow exergy rate from inlet to exit of compressed gas is',round(deltaR,3),'MW.'",
"print '-> The net change in the flow exergy rate from inlet to exit of hot combustion gas is',round(deltRc,3),'MW.'",
"",
- "# Part(c)",
- "#From an exergy rate balance",
"Eddot = -deltaR-deltRc",
"",
- "# Results ",
"print '-> The rate exergy destroyed, is',round(Eddot,3),'MW.'"
],
"language": "python",
@@ -404,16 +329,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 7.7 Page no-299"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Develop a full accounting of the net exergy carried in by the steam, per unit mass of steam flowing.",
"",
- "# Given:-",
"p1 = 30.0 # pressure of entering steam in bar",
"t1 = 400.0 # temperature of entering steam in degree celcius",
"v1 = 160.0 # velocity of entering steam in m/s",
@@ -424,23 +346,17 @@
"T0 = 25.0 # in degree celcius",
"p0 = 1.0 # in atm",
"",
- "# From table A-4",
"h1 = 3230.9 # in kj/kg",
"s1 = 6.9212 # in kj/kg.k",
- "# From table A-2 ",
"h2 = 2676.1 # in kj/kg",
"s2 = 7.3549 # in kj/kg.k",
- "# From example 6.6",
"Q = -22.6 # in kj/kg",
" ",
- "# Calculations",
"DELTAef = (h1-h2)-(T0+273)*(s1-s2)+(v1**2-v2**2)/(2*1000)",
- "# The net exergy carried in per unit mass of steam flowing in kj/kg",
"Eq = (1-(T0+273)/Tb)*(Q) # exergy transfer accompanying heat in kj/kg",
"Ed = ((1-(T0+273)/Tb)*(Q))-W+(DELTAef) # The exergy destruction determined by rearranging the steady-state form of the exergy ",
" # rate balance",
"",
- "# Results",
"print '-> Balance sheet'",
"print '-> Net rate of exergy ',DELTAef,'kJ/kg,'",
"print '-> Disposition of the exergy:'",
@@ -470,16 +386,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 7.8 Page no-300"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Develop a full accounting of the net exergy carried in by the combustion products. Discuss the design implications of the results.",
"",
- "# Given:-",
"m1dot = 69.78 # in kg/s",
"p1 = 1.0 # in bar",
"T1 = 478.0 # in kelvin",
@@ -496,35 +409,25 @@
"T0 = 298.0 # in kelvin",
"",
"",
- "# Part(a)",
- "# From table A-22",
"h1 = 480.35 # in kj/kg",
"h2 = 400.97 # in kj/kg",
"s1 = 2.173 # in kj/kg",
"s2 = 1.992 # in kj/kg",
"",
- "# From table A-2E",
"h3 = 162.82 # in kj/kg",
"s3 = 0.5598 # in kj/kg.k",
- "# Using saturation data at 0.07 bars from Table A-3",
"h5 = 2403.27 # in kj/kg",
"s5 = 7.739 # in kj/kg.k",
- "#The net rate exergy carried out by the water stream",
"",
- "# From table A-4",
"h4 = 2825.0 # in kj/kg",
"s4 = 7.2196 # in kj/kg.k",
- "# Calculations",
"import math",
"netRE = m1dot*(h1-h2-T0*(s1-s2-(8.314/28.97)*math.log(p1/p2))) # the net rate exergy carried into the control volume",
"netREout = m3dot*(h5-h3-T0*(s5-s3))",
- "# From an exergy rate balance applied to a control volume enclosing the steam generator",
"Eddot = netRE + m3dot*(h3-h4-T0*(s3-s4)) # the rate exergy is destroyed in the heat-recovery steam generator",
"",
- "# From an exergy rate balance applied to a control volume enclosing the turbine",
"EdDot = -Wcvdot + m3dot*(h4-h5-T0*(s4-s5)) # the rate exergy is destroyed in the tpurbine",
"",
- "# Results ",
"print '-> balance sheet'",
"print '- Net rate of exergy in:',netRE,'kJ/kg.'",
"print '-> Disposition of the exergy:'",
@@ -558,33 +461,26 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 7.9 Page no-302"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the daily cost of electricity to operate the compressor and the daily cost of exergy destruction in each component. Let T0 =\u0003 273",
"",
- "# Given:-",
"T0 = 273.00 # in kelvin",
"pricerate = 0.08 # exergy value at $0.08 per kw.h",
"",
- "# From example 6.8",
"sigmadotComp = 17.5e-4 # in kw/k",
"sigmadotValve = 9.94e-4 # in kw/k",
"sigmadotcond = 7.95e-4 # in kw/k",
"",
- "# Calculations",
- "# The rates of exergy destruction",
"EddotComp = T0*sigmadotComp # in kw",
"EddotValve = T0*sigmadotValve # in kw",
"Eddotcond = T0*sigmadotcond # in kw",
"",
"mCP = 3.11 # From the solution to Example 6.14, the magnitude of the compressor power in kW",
"",
- "# Results",
"print '-> Daily cost in dollars of exergy destruction due to compressor irreversibilities = ',round(EddotComp*pricerate*24,3)",
"print '-> Daily cost in dollars of exergy destruction due to irreversibilities in the throttling valve = ',round(EddotValve*pricerate*24,3)",
"print '-> Daily cost in dollars of exergy destruction due to irreversibilities in the condenser = ',round(Eddotcond*pricerate*24,3)",
@@ -608,18 +504,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 7.10 Page no-313"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) Determine the power and the rate exergy exits with the steam, each in MW. ",
- "# (b) Determine the unit costs of the steam exiting the boiler, the steam exiting the turbine, and the power, each in cents per kw.h of exergy. ",
- "# (c) Determine the cost rates of the steam exiting the turbine and the power, each in $/h.",
"",
- "# Given:-",
"EfFdot = 100.00 # exergy rate of fuel entering the boiler in MW",
"cF = 1.44 # unit cost of fuel in cents per kw.h",
"Zbdot = 1080.00 # the cost of owning and operating boiler in dollars per hour",
@@ -633,39 +524,28 @@
"T0 = 298.00 # in kelvin ",
"",
"",
- "# Part(a)",
- "# From table A-4,",
"h1 = 3353.54 # in kj/kg",
"h2 = 2865.96 # in kj/kg",
"s1 = 6.8773 # in kj/kg.k",
"s2 = 7.0806 # in kj/kg.k",
"",
- "# Calculations",
- "# From assumption,For each control volume,Qcvdot = 0 and kinetic and potential energy effects are negligible,the mass and energy rate ",
- "# balances for a control volume enclosing the turbine reduce at steady state to give",
"Wedot = m2dot *(h1-h2)/1000 # power in MW",
"Ef2dot = Ef1dot+m2dot*(h2-h1-T0*(s2-s1))/1000 # the rate exergy exits with the steam in MW",
"",
- "# Results",
"print '-> For the turbine,the power is',round(Wedot,2),'MW.'",
"print '-> For the turbine,the rate exergy exits with the steam is',round(Ef2dot,2),' MW.'",
"",
- "# Part(b)",
- "# Calculations",
"c1 = cF*(EfFdot/Ef1dot) + ((Zbdot/Ef1dot)/10**3)*100 # unit cost of exiting steam from boiler in cents/Kw.h",
"c2 = c1 # Assigning the same unit cost to the steam entering and exiting the turbine",
"ce = c1*((Ef1dot-Ef2dot)/Wedot) + ((Ztdot/Wedot)/10**3)*100 # unit cost of power in cents/kw.h",
"",
- "# Results",
"print '-> The unit costs of the steam exiting the boiler of exergy is:',round(c1,2),' cents per kw.h.'",
"print '-> The unit costs of the steam exiting the turbine of exergy is:',round(c2,2),' cents per kw.h.'",
"print '-> Unit cost of power is:',ce,'cents per kw.h.'",
"",
- "# Part(c)",
"C2dot = (c2*Ef2dot*10**3)/100 # cost rate for low-pressure steam in dollars per hour",
"Cedot = (ce*Wedot*10**3)/100 # cost rate for power in dollars per hour",
"",
- "# Results",
"print '-> The cost rate of the steam exiting the turbine is:',round(C2dot,2),' dollars per hour.'",
"print '-> The cost rate of the power is: ',round(Cedot,2),' dollars per hour.'"
],
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_8_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_8_2.ipynb
index 00d349fc..551d434d 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_8_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_8_2.ipynb
@@ -9,29 +9,22 @@
{
"cell_type": "markdown",
"source": [
- "# Chapter 8 :- Vapour Power Systems"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 8.1 Page no-331"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine thermal efficiency,back work ratio, mass flow rate of the steam,the rate of heat transfer,Qindot , into the working fluid as it passes through the boiler, rate of heat transfer,Qoutdot from the condensing",
- "# steam as it passes through the condenser, mass flow rate of the condenser cooling water.",
"",
- "# Given:-",
"p1 = 8.0 # pressure of saturated vapor entering the turbine in MPa",
"p3 = 0.008 # pressure of saturated liquid exiting the condenser in MPa",
"Wcycledot = 100.00 # the net power output of the cycle in MW",
"",
- "# Analysis",
- "# From table A-3",
"h1 = 2758.0 # in kj/kg",
"s1 = 5.7432 # in kj/kg.k",
"s2 = s1",
@@ -41,59 +34,42 @@
"hfg = 2403.1 # in kj/kg",
"v3 = 1.0084e-3 # in m^3/kg",
"",
- "# State 3 is saturated liquid at 0.008 MPa, so",
"h3 = 173.88 # in kj/kg",
"",
- "# Calculations",
"x2 = (s2-sf)/(sg-sf) # quality at state 2",
"h2 = hf + x2*hfg",
"p4 = p1",
"h4 = h3 + v3*(p4-p3)*10**6*10**-3 # in kj/kg",
"",
- "# Part(a)",
- "#Mass and energy rate balances for control volumes around the turbine and pump give, respectively",
"wtdot = h1 - h2",
"wpdot = h4-h3",
"",
- "# The rate of heat transfer to the working fluid as it passes through the boiler is determined using mass and energy rate balances as",
"qindot = h1-h4",
"",
"eta = (wtdot-wpdot)/qindot # thermal efficiency)",
"",
- "# Result for part a",
"print '-> The thermal efficiency for the cycle is ',round(eta,2)",
"",
- "# Part(b)",
"bwr = wpdot/wtdot # back work ratio",
"",
- "# Result",
"print '-> The back work ratio is ',bwr",
"",
- "# Part(c)",
"mdot = (Wcycledot*10**3*3600)/((h1-h2)-(h4-h3)) # mass flow rate in kg/h",
"",
- "# Result ",
"print '-> The mass flow rate of the steam is',round(mdot,2),'kg/h .'",
" ",
- "# Part(d)",
"Qindot = mdot*qindot/(3600*10**3) # in MW",
"",
- "# Results",
"print '-> The rate of heat transfer,Qindot , into the working fluid as it passes through the boiler, is',round(Qindot,2),'MW.'",
"",
- "# Part(e)",
"Qoutdot = mdot*(h2-h3)/(3600*10**3) # in MW",
"",
- "# Results",
"print '-> The rate of heat transfer,Qoutdot from the condensing steam as it passes through the condenser, is',round(Qoutdot,2),'MW.'",
"",
- "# Part(f)",
- "# From table A-2",
"hcwout= 146.68 # in kj/kg",
"hcwin= 62.99 # in kj/kg",
"mcwdot= (Qoutdot*10**3*3600)/(hcwout-hcwin) # in kg/h",
"",
- "# Results",
"print '-> The mass flow rate of the condenser cooling water is',round(mcwdot,2),'kg/ h.'"
],
"language": "python",
@@ -116,62 +92,42 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 8.2 Page no-338"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine for the mass flow rate of the condenser cooling water, Discuss the effects on the vapor cycle of irreversibilities within the turbine and pump.",
"",
- "# Given:-",
"etat= .85 # given that the turbine and the pump each have an isentropic efficiency of 85%",
- "# Analysis",
- "# State 1 is the same as in Example 8.1, so",
"h1 = 2758.0 # in kj/kg",
"s1 = 5.7432 # in kj/kg.k",
- "# From example 8.1 ",
"h1 = 2758.0 # in kj/kg",
"h2s = 1794.8 # in kj/kg",
- "# State 3 is the same as in Example 8.1, so",
"h3 = 173.88 # in kj/kg",
"",
- "# Calculations",
"h2 = h1 - etat*(h1-h2s) # in kj/kg",
"wpdot = 8.06/etat # where the value 8.06 is obtained from example 8.1",
"",
"h4 = h3 + wpdot",
"",
- "# Part(a)",
"eta = ((h1-h2)-(h4-h3))/(h1-h4) # thermal efficiency",
"",
- "# Result for part (a)",
"print '-> Thermal efficiency is: ',round(eta,3)",
"",
- "# Part(b)",
"Wcycledot = 100 # given,a net power output of 100 MW",
- "# Calculations",
"mdot = (Wcycledot*(10**3)*3600)/((h1-h2)-(h4-h3))",
- "# Result for part (b)",
"print '-> The mass flow rate of steam, in kg/h, for a net power output of 100 MW is ',round(mdot,3),'kg/h.'",
"",
- "# Part(c)",
"Qindot = mdot*(h1-h4)/(3600 * 10**3)",
- "# Result",
"print '-> The rate of heat transfer Qindot into the working fluid as it passes through the boiler, is ',round(Qindot,3),'MW.'",
"",
- "# Part(d)",
"Qoutdot = mdot*(h2-h3)/(3600*10**3)",
- "# Result",
"print '-> The rate of heat transfer Qoutdotfrom the condensing steam as it passes through the condenser, is ',round(Qoutdot,3),'MW.'",
"",
- "# Part(e)",
- "# From table A-2",
"hcwout = 146.68 # in kj/kg",
"hcwin = 62.99 # in kj/kg",
"mcwdot = (Qoutdot*10**3*3600)/(hcwout-hcwin)",
- "# Result",
"print '-> The mass flow rate of the condenser cooling water, is: ',round(mcwdot,3),'kg/h.'"
],
"language": "python",
@@ -193,20 +149,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 8.3 Page no-341"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine",
- "# (a) the thermal efficiency of the cycle, ",
- "# (b) the mass flow rate of steam, in kg/h, ",
- "# (c) the rate of heat transfer Qoutdot from the condensing steam as it passes through the condenser",
- "# Discuss the effects of reheat on the vapor power cycle.",
"",
- "# Given:-",
"T1 = 480.0 # temperature of steam entering the first stage turbine in degree celcius",
"p1 = 8.0 # pressure of steam entering the first stage turbine in MPa",
"p2 = 0.7 # pressure of steam exiting the first stage turbine in MPa",
@@ -214,49 +163,36 @@
"Pcond = 0.008 # condenser pressure in MPa",
"Wcycledot = 100.0 # the net power output in MW",
"",
- "# Analysis",
- "# From table A-4",
"h1 = 3348.4 # in kj/kg",
"s1 = 6.6586 # in kj/kg.k",
"s2 = s1 # isentropic expansion through the first-stage turbine",
- "# From table A-3",
"sf = 1.9922 # in kj/kg.k",
"sg = 6.708 # in kj/kg.k",
"hf = 697.22 # in kj/kg",
"hfg = 2066.3 # in kj/kg",
"",
- "# Calculations ",
"x2 = (s2-sf)/(sg-sf)",
"h2 = hf + x2*hfg",
- "# State 3 is superheated vapor with p3 =\u0003 0.7 MPa and T3= \u0003 440\u0004C, so from Table A-4",
"h3 = 3353.3 # in kj/kg",
"s3 = 7.7571 # in kj/kg.k",
"s4 = s3 # isentropic expansion through the second-stage turbine",
- "# For determing quality at state 4,from table A-3",
"sf = 0.5926 # in kj/kg.k",
"sg = 8.2287 # in kj/kg.k",
"hf = 173.88 # in kj/kg",
"hfg = 2403.1 # in kj/kg",
"",
- "# Calculations",
"x4 = (s4-sf)/(sg-sf)",
"h4 = hf + x4*hfg",
"",
- "# State 5 is saturated liquid at 0.008 MPa, so",
"h5 = 173.88",
- "# The state at the pump exit is the same as in Example 8.1, so",
"h6 = 181.94",
"",
- "# Part(a)",
"eta = ((h1-h2)+(h3-h4)-(h6-h5))/((h1-h6)+(h3-h2))",
- "# Result",
"print '-> The thermal efficiency of the cycle is:',round(eta,2)",
"",
- "# Part(b)",
"mdot = (Wcycledot*3600*10**3)/((h1-h2)+(h3-h4)-(h6-h5))",
"print '-> The mass flow rate of steam, is:',round(mdot,2),'kg/h.'",
"",
- "# Part(c)",
"Qoutdot = (mdot*(h4-h5))/(3600*10**3)",
"print '-> The rate of heat transfer Qoutdot from the condensing steam as it passes through the condenser, MW is',round(Qoutdot,2),'kg/h.'"
],
@@ -277,7 +213,6 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 8.4 Page no-344"
]
},
{
@@ -304,12 +239,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the thermal efficiency. Plot the thermal efficiency versus turbine stage efficiency ranging from 85 to 100%.",
"",
- "# Given :-",
- "# Part (a)",
"etat = 0.85 # given efficiency",
- "# From the solution to Example 8.3, the following specific enthalpy values are known, in kJ/kg",
"h1 = 3348.4",
"h2s = 2741.8",
"h3 = 3353.3",
@@ -318,15 +249,12 @@
"h6 = 181.94",
"",
"",
- "# Calculations",
"h2 = h1 - etat*(h1 - h2s) # The specific enthalpy at the exit of the first-stage turbine in kj/kg",
"h4 = h3 - etat*(h3-h4s) # The specific enthalpy at the exit of the second-stage turbine in kj/kg",
"eta = ((h1-h2)+(h3-h4)-(h6-h5))/((h1-h6)+(h3-h2)) ",
"",
- "# Result",
"print '-> The thermal efficiency is: ',eta",
"",
- "# Part (b)",
"from numpy import linspace",
"from pylab import *",
"",
@@ -366,16 +294,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 8.5 Page no-348"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine thermal efficiency, mass flow rate of steam entering the first turbine stage.",
"",
- "# Given:-",
"T1 = 480.0 # temperature of steam entering the turbine in degree celcius",
"p1 = 8.0 # pressure of steam entering the turbine in MPa",
"Pcond = 0.008 # condenser pressure in MPa",
@@ -383,22 +308,15 @@
"Wcycledot = 100.0 # net power output of the cycle",
"",
"",
- "# Analysis",
- "# With the help of steam tables",
"h1 = 3348.4 # in kj/kg",
"h2 = 2832.8 # in kj/kg",
"s2 = 6.8606 # in kj/kg.k",
"h4 = 173.88 # in kj/kg",
- "# With s3s =\u0003 s2, the quality at state 3s is x3s= \u0003 0.8208; using this, we get",
"h3s = 2146.3 # in kj/kg",
"",
- "# Calculations",
- "# The specific enthalpy at state 3 can be determined using the efficiency of the second-stage turbine",
"h3 = h2 - etat*(h2-h3s)",
"",
- "# State 6 is saturated liquid at 0.7 MPa. Thus,",
"h6 = 697.22 # in kj/kg",
- "# For determining specific enthalpies at states 5 and 7 ,we have",
"p5 = 0.7 # in MPa",
"p4 = 0.008 # in MPa",
"p7 = 8.0 # in MPa",
@@ -406,26 +324,20 @@
"v4 = 1.0084e-3 # units in m^3/kg,obtained from steam tables",
"v6 = 1.1080e-3 # units in m^3/kg,obtained from steam tables",
"",
- "# Calculations",
"h5 = h4 + v4*(p5-p4)*10**6*10**-3 # in kj/kg",
"h7 = h6 + v6*(p7-p6)*10**3 # in kj/kg",
"",
- "# Applying mass and energy rate balances to a control volume enclosing the open heater, we find the fraction y of the flow extracted at state 2 from",
"y = (h6-h5)/(h2-h5)",
"",
- "# Part(a)",
"wtdot = (h1-h2) + (1-y)*(h2-h3) # the total turbine work output, units in KJ/Kg",
"wpdot = (h7-h6) + (1-y)*(h5-h4) # The total pump work per unit of mass passing through the first-stage turbine,in KJ/kg",
"qindot = h1 - h7 # in kj/kg",
"eta = (wtdot-wpdot)/qindot",
"",
- "# Results",
"print '-> The thermal efficiency is:',round(eta,2)",
"",
- "# Part(b)",
"m1dot = (Wcycledot*3600*10**3)/(wtdot-wpdot)",
"",
- "# Results",
"print '-> The mass flow rate of steam entering the first turbine stage, is:',round(m1dot,2),'kg/h.'"
],
"language": "python",
@@ -444,56 +356,40 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 8.6 Page no-352"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine thermal efficiency, mass flow rate of the steam entering the first turbine, ",
"",
- "# Given:-",
- "# Analysis",
- "# State 1 is the same as in Example 8.3, so",
"h1 = 3348.4 # in kj/kg",
"s1 = 6.6586 # in kj/kg.k",
- "# State 2 is fixed by p2 \u0003 2.0 MPa and the specific entropy s2, which is the same as that of state 1. Interpolating in Table A-4, we get",
"h2 = 2963.5 # in kj/kg",
- "# The state at the exit of the first turbine is the same as at the exit of the first turbine of Example 8.3, so",
"h3 = 2741.8 # in kj/kg",
- "# State 4 is superheated vapor at 0.7 MPa, 440\u0004C. From Table A-4,",
"h4 = 3353.3 # in kj/kg",
"s4 = 7.7571 # in kj/kg.k",
- "# Interpolating in table A-4 at p5 = .3MPa and s5 = s4, the enthalpy at state 5 is",
"h5 = 3101.5 # in kj/kg",
- "# Using s6 \u0003= s4, the quality at state 6 is found to be",
"x6 = 0.9382",
- "# Using steam tables, for state 6",
"hf = 173.88 # in kj/kg",
"hfg = 2403.1 # in kj/kg",
"",
"h6 = hf + x6*hfg",
"",
- "# At the condenser exit, we have ",
"h7 = 173.88 # in kj/kg",
"v7 = 1.0084e-3 # in m^3/kg",
"p8 = 0.3 # in MPa",
"p7 = 0.008 # in MPa",
"",
"h8 = h7 + v7*(p8-p7)*10**6*10**-3 # The specific enthalpy at the exit of the first pump in kj/kg",
- "# The liquid leaving the open feedwater heater at state 9 is saturated liquid at 0.3 MPa. The specific enthalpy is",
"h9 = 561.47 # in kj/kg",
"",
- "# For the exit of the second pump,",
"v9 = 1.0732e-3 # in m^3/kg",
"p10 = 8.0 # in MPa",
"p9 = 0.3 # in MPa",
"h10 = h9 + v9*(p10-p9)*10**6*10**-3 # The specific enthalpy at the exit of the second pump in kj/kg",
- "# The condensate leaving the closed heater is saturated at 2 MPa. From Table A-3,",
"h12 = 908.79 # in kj/kg",
"h13 = h12 # since The fluid passing through the trap undergoes a throttling process",
- "# For the feedwater exiting the closed heater",
"hf = 875.1 # in kj/kg",
"vf = 1.1646e-3 # in m^3/kg",
"p11 = 8.0 # in MPa",
@@ -503,7 +399,6 @@
"ydash = (h11-h10)/(h2-h12) # the fraction of the total flow diverted to the closed heater",
"ydashdash = ((1-ydash)*h8+ydash*h13-h9)/(h8-h5) # the fraction of the total flow diverted to the open heater",
"",
- "# Part(a)",
"wt1dot = (h1-h2) + (1-ydash)*(h2-h3) # The work developed by the first turbine per unit of mass entering in kj/kg",
"wt2dot = (1-ydash)*(h4-h5) + (1-ydash-ydashdash)*(h5-h6) # The work developed by the second turbine per unit of mass in kj/kg",
"wp1dot = (1-ydash-ydashdash)*(h8-h7) # The work for the first pump per unit of mass in kj/kg",
@@ -512,14 +407,11 @@
" # turbine",
"eta = (wt1dot+wt2dot-wp1dot-wp2dot)/qindot # thermal efficiency",
"",
- "# Result",
"print '-> The thermal efficiency is: ',round(eta,2)",
"",
- "# Part(b)",
"Wcycledot = 100.0 # the net power output of the cycle in MW",
"m1dot = (Wcycledot*3600*10**3)/(wt1dot+wt2dot-wp1dot-wp2dot)",
"",
- "# Result",
"print '-> The mass flow rate of the steam entering the first turbine, in kg/h is: ',round(m1dot,2)"
],
"language": "python",
@@ -538,59 +430,37 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 8.7 Page no-360"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine net rate at which exergy is carried into the heat exchanger unit by the gas stream, net rate at which exergyis carried from the heat ",
- "# exchanger by the water stream, rate of exergy destruction, exergetic efficiency",
"",
- "# Given:-",
- "# Analysis",
- "# The solution to Example 8.2 gives",
"h1 = 2758 # in kj/kg",
"h4 = 183.36 # in kj/kg",
- "# From table A-22",
"hi = 1491.44 # in kj/kg",
"he = 843.98 # in kj/kg",
- "# Using the conservation of mass principle and energy rate balance, the ratio of mass flow rates of air and water is",
"madotbymdot = (h1-h4)/(hi-he)",
- "# From example 8.2",
"mdot = 4.449e5 # in kg/h",
"madot = madotbymdot*mdot # in kg/h",
"",
- "# Part(a)",
"T0 = 295 # in kelvin",
- "# From table A-22",
"si = 3.34474 # in kj/kg.k",
"se = 2.74504 # in MW",
- "# Calculation",
"Rin = madot*(hi-he-T0*(si-se))/(3600*10**3) # The net rate at which exergy is carried into the heat exchanger ",
" # unit by the gaseous stream ",
- "# Result",
"print '-> The net rate at which exergy is carried into the heat exchanger unit by the gas stream, is:',round(Rin,2),'MW '",
"",
- "# Part(b)",
- "# From table A-3",
"s1 = 5.7432 # in kj/kg.k",
- "# From interpolation in table A-5 gives",
"s4 = 0.5957 # in kj/kg.k",
- "# Calculation",
"Rout = mdot*(h1-h4-T0*(s1-s4))/(3600*10**3) # in MW",
- "# Result",
"print '-> The net rate at which exergy is carried from the heat exchanger by the water stream, is:',round(Rout,2),'MW .'",
"",
- "# Part(c)",
"Eddot = Rin-Rout # in MW",
- "# Result",
"print '-> The rate of exergy destruction, in MW is:',round(Eddot,2)",
"",
- "# Part(d)",
"epsilon = Rout/Rin",
- "# Result",
"print '-> The exergetic efficiency is: ',round(epsilon,2)"
],
"language": "python",
@@ -611,39 +481,28 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 8.8 Page no-362"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the rate at which exergy is destroyed, Express each result as a percentage of the exergy entering the plant",
"",
- "# Given:-",
"T0 = 295.00 # in kelvin",
"P0 = 1.00 # in atm",
"",
- "# Analysis",
- "# From table A-3",
"s1 = 5.7432 # in kj/kg.k",
"s3 =0.5926 # in kj/kg.k",
"",
- "# Using h2 =\u0003 1939.3 kJ/kg from the solution to Example 8.2, the value of s2 can be determined from Table A-3 as",
"s2 = 6.2021 # in kj/kg.k",
"s4 = 0.5957 # in kj/kg.k",
"mdot = 4.449e5 # in kg/h",
"",
- "# Calculations",
"Eddot = mdot*T0*(s2-s1)/(3600*10**3) # the rate of exergy destruction for the turbine in MW",
"EddotP = mdot*T0*(s4-s3)/(3600*10**3) # the exergy destruction rate for the pump",
"",
- "# Results",
"print '-> The rate of exergy destruction for the turbine is: ',round(Eddot,2),'MW.'",
- "# From the solution to Example 8.7, the net rate at which exergy is supplied by the cooling combustion gases is 231.28 MW",
"print '-> The turbine rate of exergy destruction expressed as a percentage is: ',round((Eddot/231.28)*100)",
- "# However, since only 69% of the entering fuel exergy remains after the stack loss and combustion exergy destruction are accounted for, ",
- "# it can be concluded that",
"print '-> Percentage of the exergy entering the plant with the fuel destroyed within the turbine is:',round(0.69*(Eddot/231.28)*100,2)",
"print '-> The exergy destruction rate for the pump in MW is:',round(EddotP,2)",
"print 'and expressing this as a percentage of the exergy entering the plant as calculated above, we have',round((EddotP/231.28)*69,2) ",
@@ -671,43 +530,28 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 8.9 Page no-364"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) Determine the net rate at which exergy is carried from the condenser by the cooling water, ",
- "# Express this result as a percentage of the exergy entering the plant with the fuel, ",
- "# (b) the condenser the rate of exergy destruction, Express this result as a percentage of the exergy entering the plant",
"",
- "# Given:-",
"T0 = 295 # in kelvin",
- "# Analysis",
- "# From solution to Example 8.2.",
"mcwdot = 9.39e6 # mass flow rate of the cooling water in kg/h",
"",
- "# Part(a)",
- "# With saturated liquid values for specific enthalpy and entropy from Table A-2",
"he = 146.68 # in kj/kg",
"hi = 62.99 # in kj/kg",
"se = 0.5053 # in kj/kg.k",
"si = 0.2245 # in kj/kg.k",
- "# Calculations",
"Rout = mcwdot*(he-hi-T0*(se-si))/(3600*10**3) # The net rate at which exergy is carried out of the condenser in MW",
- "# Results",
"print '-> The net rate at which exergy is carried from the condenser by the cooling water, is:',round(Rout,2),'MW.'",
"print '-> Expressing this as a percentage of the exergy entering the plant with the fuel, we get ',round((Rout/231.28)*69,2),'percent'",
"",
- "# Part(b)",
- "# From table ",
"s3 = 0.5926 # in kj/kg.k",
"s2 = 6.2021 # in kg/kg.k",
"mdot = 4.449e5 # in kg/h",
- "# Calculations",
"Eddot = T0*(mdot*(s3-s2)+mcwdot*(se-si))/(3600*10**3) # the rate of exergy destruction for the condenser in MW",
- "# Results",
"print '-> The rate of exergy destruction for the condenser is: ',round(Eddot,2),'MW.'",
"print '-> Expressing this as a percentage of the exergy entering the plant with the fuel, we get,',round((Eddot/231.28)*69,2),'percent'"
],
diff --git a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_9_2.ipynb b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_9_2.ipynb
index adc423f0..7e190ca7 100644
--- a/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_9_2.ipynb
+++ b/Fundamental_of_Thermodynamics_by_Moran_and_Shapiro/Chapter_9_2.ipynb
@@ -9,55 +9,39 @@
{
"cell_type": "markdown",
"source": [
- "# Chapter 9 :- Gas Power Systems"
]
},
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.1 Page no-378"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine temperature and pressure at the end of each process of the cycle, thermal efficiency, mean effective pressure, in atm.",
"",
- "# Given:-",
"T1 = 300.00 # The temperature at the beginning of the compression process in kelvin",
"p1 = 1.00 # the pressure at the beginning of the compression process in bar",
"r = 8.00 # compression ratio",
"V1 = 560.00 # the volume at the beginning of the compression process in cm^3",
"T3 = 2000.00 # maximum temperature during the cycle in kelvin",
"",
- "# Part(a)",
- "# At T1 = 300k,table A-22 gives",
"u1 = 214.07 # in kj/kg",
"vr1 = 621.2 ",
- "# Interpolating with vr2 in Table A-22, we get",
"T2 = 673.00 # in kelvin",
"u2 = 491.2 # in kj/kg",
- "# At T3 \u0003= 2000 K, Table A-22 gives",
"u3 = 1678.7 # in kj/kg",
"vr3 = 2.776",
- "# Interpolating in Table A-22 with vr4 gives",
"T4 = 1043 # in kelvin",
"u4 = 795.8 # in kj/kg",
"",
- "# Calculations",
- "# For the isentropic compression Process 1\u20132",
"vr2 = vr1/r",
- "# With the ideal gas equation of state",
"p2 = p1*(T2/T1)*(r) # in bars",
- "# Since Process 2\u20133 occurs at constant volume, the ideal gas equation of state gives",
"p3 = p2*(T3/T2) # in bars",
- "# For the isentropic expansion process 3\u20134",
"vr4 = vr3*(r)",
- "# The ideal gas equation of state applied at states 1 and 4 gives",
"p4 = p1*(T4/T1) # in bars",
"",
- "# Results",
"print '-> At state1, the pressure is:',p1,'bar.'",
"print '-> At state1, the temperature is ',T1,'kelvin.'",
"print '-> At state2, the pressure is:',round(p2,3),'bar.'",
@@ -67,20 +51,15 @@
"print '-> At state4, the pressure is:',round(p4,4),'bar.'",
"print '-> At state4, the temperature is',T4,'kelvin.'",
"",
- "# Part(b)",
"eta = 1-(u4-u1)/(u3-u2) # thermal efficiency",
- "# Result",
"print '-> The thermal efficiency is:',round(eta,2)",
"",
- "# Part(c)",
"R = 8.314 # universal gas constant, in SI units",
"M = 28.97 # molar mass of air in grams",
- "# Calculations",
"m = ((p1*V1)/((R/M)*T1))*10**-6*10**5*10**-3 # mass of the air in kg",
"Wcycle = m*((u3-u4)-(u2-u1)) # the net work per cycle in KJ",
"mep = (Wcycle/(V1*(1-1/r)))*10**6*10**3*10**-5 # in bars",
"",
- "# Result",
"print '-> The mean effective pressure, is:',round(mep,4),'atm..'"
],
"language": "python",
@@ -107,50 +86,35 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.2 Page no-383"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine temperature and pressure at the end , thermal efficiency, mean effective pressure",
"",
- "# Given :-",
"r = 18.00 # compression ratio",
"T1 = 300.00 # temperature at the beginning of the compression process in kelvin",
"p1 = 0.1 # pressure at the beginning of the compression process in MPa",
"rc = 2.00 # cutoff ratio",
"",
- "# Part(a)",
- "# With T1 =\u0003 300 K, Table A-22 gives",
"u1 = 214.07 # in kj/kg",
"vr1 = 621.2 ",
- "# Interpolating in Table A-22, we get",
"T2 = 898.3 # in kelvin ",
"h2 = 930.98 # in kj/kg",
- "# From Table A-22,",
"h3 = 1999.1 # in kj/kg",
"vr3 = 3.97",
"",
- "# Interpolating in Table A-22 with vr4, we get",
"u4 = 664.3 # in kj/kg",
"T4 = 887.7 # in kelvin",
"",
- "# Calculations",
- "# Since Process 2\u20133 occurs at constant pressure, the ideal gas equation of state gives",
"T3 = rc*T2 # in kelvin",
- "# With the ideal gas equation of state",
"p2 = p1*(T2/T1)*(r) # in MPa",
"p3 = p2",
- "# For the isentropic compression process 1\u20132",
"vr2 = vr1/r",
- "# For the isentropic expansion process 3\u20134",
"vr4 = (r/rc)*vr3",
- "# The ideal gas equation of state applied at states 1 and 4 gives",
"p4 = p1*(T4/T1) # in MPa",
"",
- "# Results",
"print '-> At state1, the pressure is:',round(p1,2),'bar.'",
"print '-> At state1, the temperature is',round(T1,2),'kelvin.'",
"print '-> At state2, the pressure in bar is:',round(p2,2),'bar.'",
@@ -160,20 +124,16 @@
"print '-> At state4, the pressure is:',round(p4,2),'bar.'",
"print '-> At state4, the temperature is',round(T4,2),'kelvin.'",
"",
- "# Part(b)",
"eta = 1- (u4-u1)/(h3-h2)",
"print '-> The thermal efficiency is:',round(eta,2)",
"",
- "# Part(c)",
"R = 8.314 # universal gas constant, in SI units",
"M = 28.97 # molar mass of air in grams",
"",
- "# Calculations",
"wcycle = (h3-h2)-(u4-u1) # The net work of the cycle in kj/kg",
"v1 = ((R/M)*T1/p1)/10**3 # The specific volume at state 1 in m^3/kg",
"mep = (wcycle/(v1*(1-1/r)))*10**3*10**-6 # in MPa",
"",
- "# Results",
"print '-> The mean effective pressure, is:',round(mep,2),'MPa.'"
],
"language": "python",
@@ -200,58 +160,41 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.3 Page no-386"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine (a) the thermal efficiency and (b) the mean effective pressure, in MPa.",
"",
- "# Given :-",
"T1 = 300.00 # beginning temperature in kelvin",
"p1 = 0.1 # beginning pressure in MPa",
"r = 18.00 # compression ratio",
"pr = 1.5 # The pressure ratio for the constant volume part of the heating process",
"vr = 1.2 # The volume ratio for the constant pressure part of the heating process",
"",
- "# Analysis",
- "# States 1 and 2 are the same as in Example 9.2, so ",
"u1 = 214.07 # in kj/kg",
"T2 = 898.3 # in kelvin",
"u2 = 673.2 # in kj/kg",
"",
- "# Interpolating in Table A-22, we get",
"h3 = 1452.6 # in kj/kg",
"u3 = 1065.8 # in kj/kg",
"",
- "# From Table A-22,",
"h4 = 1778.3 # in kj/kg",
"vr4 = 5.609",
"",
- "# Interpolating in Table A-22, we get",
"u5 = 475.96 # in kj/kg",
"",
- "# Calculations",
- "# Since Process 2\u20133 occurs at constant volume, the ideal gas equation of state reduces to give",
"T3 = pr*T2 # in kelvin",
- "# Since Process 3\u20134 occurs at constant pressure, the ideal gas equation of state reduces to give",
"T4 = vr*T3 # in kelvin",
- "# Process 4\u20135 is an isentropic expansion, so",
"vr5 = vr4*r/vr",
"",
- "# Part(a)",
"eta = 1-(u5-u1)/((u3-u2)+(h4-h3))",
- "# Result",
"print '-> The thermal efficiency is:',round(eta,2)",
"",
- "# Part(b)",
- "# The specific volume at state 1 is evaluated in Example 9.2 as",
"v1 = 0.861 # in m^3/kg",
"mep = (((u3-u2)+(h4-h3)-(u5-u1))/(v1*(1-1/r)))*10**3*10**-6 # in MPa",
"",
- "# Result",
"print '-> The mean effective pressure, is:',round(mep,2),'MPa.'"
],
"language": "python",
@@ -270,59 +213,43 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2>Example 9.4 Page no-392"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine (a) the thermal efficiency of the cycle, (b) the back work ratio, (c) the net power developed",
"",
- "# Given:-",
"T1 = 300.00 # in kelvin",
"AV = 5.00 # volumetric flow rate in m^3/s",
"p1 = 100.00 # in kpa",
"pr = 10.00 # compressor pressure ratio",
"T3 = 1400.00 # turbine inlet temperature in kelvin",
"",
- "# Analysis",
- "# At state 1, the temperature is 300 K. From Table A-22,",
"h1 = 300.19 # in kj/kg",
"pr1 = 1.386",
"",
"",
- "# Interpolating in Table A-22,",
"h2 = 579.9 # in kj/kg",
- "# From Table A-22",
"h3 = 1515.4 # in kj/kg",
"pr3 = 450.5",
"",
- "# Interpolating in Table A-22, we get",
"h4 = 808.5 # in kj/kg",
"",
- "# calculations",
"pr2 = pr*pr1",
"pr4 = pr3*1/pr",
"",
"",
- "# Part(a)",
"eta = ((h3-h4)-(h2-h1))/(h3-h2) # thermal efficiency",
- "# Result",
"print '-> The thermal efficiency is:',round(eta,4)",
"",
- "# Part(b)",
"bwr = (h2-h1)/(h3-h4) # back work ratio",
- "# Result",
"print '-> The back work ratio is:',round(bwr,4)",
"",
- "# Part(c)",
"R = 8.314 # universal gas constant, in SI units",
"M = 28.97 # molar mass of air in grams",
- "# Calculations",
"mdot = AV*p1/((R/M)*T1) # mass flow rate in kg/s",
"Wcycledot = mdot*((h3-h4)-(h2-h1)) # The net power developed",
- "# Result",
"print '-> The net power developed, is:',round(Wcycledot,2),'kW .'"
],
"language": "python",
@@ -342,45 +269,33 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.6 Page no-398"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine (a) the thermal efficiency of the cycle, (b) the back work ratio, (c) the net power developed",
"",
- "# Given:-",
"etat = 0.8 # turbine efficiency",
"etac = 0.8 # compressor efficiency",
- "# Part(a)",
"wtdots = 706.9 # The value of wtdots is determined in the solution to Example 9.4 as 706.9 kJ/kg",
"wcdots = 279.7 # The value of wcdots is determined in the solution to Example 9.4 as 279.7 kJ/kg",
"h1 = 300.19 # h1 is from the solution to Example 9.4, in kj/kg",
"h3 = 1515.4 # h3 is from the solution to Example 9.4, in kj/kg",
"",
- "# Calculations",
- "# The turbine work per unit of mass is",
"wtdot = etat*wtdots # in kj/kg",
- "# For the compressor, the work per unit of mass is",
"wcdot = wcdots/etac # in kj/kg",
"h2 = h1 + wcdot # in kj/kg",
"qindot = h3-h2 # The heat transfer to the working fluid per unit of mass flow in kj/kg",
"eta = (wtdot-wcdot)/qindot # thermal efficiency",
"",
- "# Results",
"print '-> The thermal efficiency is:',round(eta,2)",
"",
- "# Part(b)",
"bwr = wcdot/wtdot # back work ratio",
- "# Result",
"print '-> The back work ratio is:',round(bwr,2)",
"",
- "# Part(c)",
"mdot = 5.807 # in kg/s, from example 9.4",
"Wcycledot = mdot*(wtdot-wcdot) # The net power developed by the cycle in kw",
- "# Result",
"print '-> The net power developed, is: ',round(Wcycledot,2),'kW.'"
],
"language": "python",
@@ -400,7 +315,6 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.7 Page no-401"
]
},
{
@@ -427,25 +341,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the thermal efficiency for a regenerator effectiveness of 80%. Plot the thermal efficiency versus regenerator effectiveness ranging from 0 to 80%.",
"",
- "# Given:-",
- "# Part(a)",
"etareg = 0.8 # regenerator effectiveness of 80%.",
- "# From example 9.4",
"h1 = 300.19 # in kj/kg",
"h2 = 579.9 # in kj/kg",
"h3 = 1515.4 # in kj/kg",
"h4 = 808.5 # in kj/kg",
"",
- "# Calculations",
"hx = etareg*(h4-h2)+h2 # in kj/kg",
"eta = ((h3-h4)- (h2-h1))/(h3-hx) # thermal efficiency",
- "# Result",
"print '-> The thermal efficiency is: '",
"print round(eta,2)",
"",
- "# Part(b)",
"etareg = []",
"x = []",
"eta = []",
@@ -483,45 +390,33 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.8 Page no-406"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the thermal efficiency.",
"",
- "# Given:-",
- "# Analysis",
- "# States 1, 2, and 3 are the same as in Example 9.4:",
"h1 = 300.19 # in kj/kg",
"h2 = 579.9 # in kj/kg",
"h3 = 1515.4 # in kj/kg",
- "# The temperature at state b is the same as at state 3, so ",
"hb = h3",
"",
"pa = 300.00 # in kpa",
"p3 = 1000.00 # in kpa",
- "# From table A-22",
"pr3 = 450.5",
"",
- "# Interpolating in Table A-22, we get",
"ha = 1095.9 # in kj/kg",
"p4 = 100.00 # in kpa",
"pb = 300.00 # in kpa",
- "# Interpolating in Table A-22, we obtain",
"h4 = 1127.6 # in kj/kg",
"",
- "# Calculions",
"pra = pr3*(pa/p3)",
"prb = pra",
"pr4 = prb*(p4/pb)",
- "# Since the regenerator effectiveness is 100%,",
"hx = h4",
"eta = ((h3-ha)+(hb-h4)-(h2-h1))/((h3-hx)+(hb-ha)) # thermal efficiency",
"",
- "# Result",
"print '-> The thermal efficiency is:'",
"print round(eta,2)"
],
@@ -541,19 +436,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.9 Page no-408"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine ",
- "# (a) the temperature at the exit of the second compressor stage ",
- "# (b) the total compressor work input perunit of mass flow. ",
- "# (c) Repeat for a single stage of compression from the given inlet state to the final pressure.",
"",
- "# Given:-",
"T1 = 300.00 # in kelvin",
"p1 = 100.00 # in kpa",
"p2 = 1000.00 # in kpa",
@@ -563,40 +452,24 @@
"Td = 300.00 # in kelvin",
"",
"",
- "# Part(a)",
- "# From table A-22",
"prd = 1.386",
- "# Interpolating in Table A-22, we get",
"T2 = 422 # in kelvin",
"h2 = 423.8 # in kj/kg",
- "# Calculations",
"pr2 = prd*(p2/pd)",
- "# Result",
"print '-> The temperature at the exit of the second compressor stage is:',round(T2,2),'kelvin.'",
"",
- "# Part(b)",
- "# From Table A-22 at T1 \u0003= 300",
"h1 = 300.19 # in kj/kg",
- "# Since Td \u0003= T1,",
"hd = 300.19 # in kj/kg",
- "# with pr data from Table A-22 together",
"pr1 = 1.386",
- "# Interpolating in Table A-22, we obtain",
"hc = 411.3 # in kj/kg",
- "# Calculations",
"prc = pr1*(pc/p1)",
"wcdot = (hc-h1)+(h2-hd) # The total compressor work per unit of mass in kj/kg",
- "# Result",
"print '-> The total compressor work input per unit of mass flow is: ',round(wcdot,2),'kJ/kg'",
"",
- "# Part(c)",
- "# Interpolating in Table A-22, we get",
"T3 = 574 # in kelvin",
"h3 = 579.9 # in kj/kg",
- "# Calculations",
"pr3 = pr1*(p3/p1)",
"wcdot = h3-h1 # The work input for a single stage of compression in kj/kg",
- "# Results",
"print '-> For a single stage of compression, the temperature at the exit state is: ',round(T3,2),'kelvin'",
"print '-> For a single stage of compression, the work input is: ',round(wcdot,2),'kJ.'"
],
@@ -618,16 +491,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.11 Page no-412"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine (a) the thermal efficiency, (b) the back work ratio, (c) the net power developed, in kW.",
"",
- "# Given:-",
"T1 = 300.00 # in kelvin",
"p1 = 100.00 # in kpa",
"mdot = 5.807 # in kg/s",
@@ -643,44 +513,33 @@
"etac = 0.8 # isentropic efficiency of compressor",
"etat = 0.8 # isentropic efficiency of turbine",
"etareg = 0.8 # regenerator effectiveness",
- "# Analysis",
- "# From example 9.9",
"h1 = 300.19 # in kj/kg",
"h3 = h1 # in kj/kg",
"h2s = 411.3 # in kj/kg",
"h4s = 423.8 # in kj/kg",
- "# From example 9.8",
"h6 = 1515.4 # in kj/kg",
"h8 = h6",
"h7s = 1095.9 # in kj/kg",
"h9s = 1127.6 # in kj/kg",
"",
- "# Calculations",
"h4 = h3 + (h4s-h3)/etac # in kj/kg",
"h2 = h1 + (h2s-h1)/etac # in kj/kg",
"h9 = h8-etat*(h8-h9s) # in kj/kg",
"h7 = h6-etat*(h6-h7s) # in kj/kg",
"h5 = h4+etareg*(h9-h4) # in kj/kg",
"",
- "# Part(a)",
- "# Calculations",
"wtdot = (h6-h7)+(h8-h9) # The total turbine work per unit of mass flow in kj/kg",
"wcdot = (h2-h1)+(h4-h3) # The total compressor work input per unit of mass flow in kj/kg",
"qindot = (h6-h5)+(h8-h7) # The total heat added per unit of mass flow in kj/kg",
"eta = (wtdot-wcdot)/qindot # thermal efficiency",
- "# Result",
"print '-> The thermal efficiency is: '",
"print round(eta,2)",
"",
- "# Part(b)",
"bwr = wcdot/wtdot # back work ratio",
- "# Result",
"print '-> The back work ratio is:'",
"print round(bwr,2)",
"",
- "# Part(c)",
"Wcycledot = mdot*(wtdot-wcdot) # net power developed in kw",
- "# Result",
"print '-> The net power developed, is: ',round(Wcycledot,2),'kW.'"
],
"language": "python",
@@ -702,17 +561,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.12 Page no-416"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 9.12 Page no-416",
- "# determine the velocity at the nozzle exit and the pressure at each principal state. ",
"",
- "# Given:-",
"Ta = 240.00 # in kelvin",
"pa = 0.8 # in bar",
"Va = 278.00 # in m/s",
@@ -720,42 +575,30 @@
"T3 = 1200.00 # in kelvin",
"p5 = 0.8 # in bar",
"",
- "# From table A-22",
"ha = 240.02 # in kj/kg",
"h1 = ha + ((Va**2)/2)*10**-3 # in kj/kg",
- "# Interpolating in Table A-22 gives",
"pr1 = 1.070",
"pra = .6355",
"",
- "# Interpolating in Table A-22, we get",
"h2 = 505.5 # in kj/kg",
- "# At state 3 the temperature is given as T3 \u0003= 1200 K. From Table A-22",
"h3 = 1277.79 # in kj/kg",
"",
"",
- "# Interpolating in Table A-22 with h4, gives",
"pr4 = 116.8",
- "# pr data from table A-22 gives",
"pr4 = 116.00",
"pr3 = 238.00",
- "# From table A-22",
"h5 = 621.3 # in kj/kg",
"",
- "# The expansion through the nozzle is isentropic to",
"p5 = .8 # in bars",
"",
- "# Calculations",
"p1 = (pr1/pra)*pa # in bars",
- "# With the help of assumption, 'The turbine work output equals the work required to drive the compressor.',",
"h4 = h3+h1-h2 # in kj/kg",
"p2 = PR*p1 # in bars",
- "# Using assumption 'There is no pressure drop for flow through the combustor', ",
"p3 = p2",
"p4 = p3*(pr4/pr3) # in bars",
"pr5 = pr4*(p5/p4)",
"V5 = ((2*(h4-h5)*10**3))**(0.5) # the velocity at the nozzle exit in m/s",
"",
- "# Results",
"print '-> The velocity at the nozzle exit in m/s is:'",
"print round(V5,2)",
"print '-> pa in bars = '",
@@ -799,17 +642,13 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.13 Page no-421"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# (a) Determine the mass flow rates of the air and the steam, and the net power developed by the gas turbine and vapor power cycle, each in MW. ",
- "# (b) Develop a full accounting of the net rate of exergy increase as the air passes through the gas turbine combustor. Discuss. ",
"",
- "# Given:-",
"Wnetdot = 45.00 # in MW",
"T1 = 300.00 # in kelvin",
"p1 = 100.00 # in kpa",
@@ -830,8 +669,6 @@
"T0 = 300.00 # in kelvin",
"p0 = 100.00 # -in kpa",
"",
- "# Analysis",
- "# With procedure similar to that used in the examples of chapters 8 and 9,we can determine following property data",
"h1 = 300.19 # in kj/kg",
"h2 = 669.79 # in kj/kg",
"h3 = 1515.42 # in kj/kg",
@@ -851,44 +688,30 @@
"s8 = 6.7282 # in kj/kg.k",
"s9 = 0.5926 # in kj/kg.k",
"",
- "# Part(a)",
- "# By applying mass and energy rate balances",
- "# Calculations",
"mvdotbymgdot = (h4-h5)/(h7-h6) # ratio of mass flow rates of vapor and air",
"mgdot = (Wnetdot*10**3)/(((h3-h4)-(h2-h1)) + mvdotbymgdot*((h7-h8)-(h6-h9))) # mass flow rate of air in kg/s",
"mvdot = mvdotbymgdot*mgdot # mass flow rate of vapor in kg/s",
"Wgasdot = mgdot*((h3-h4)-(h2-h1))*10**-3 # net power developed by gas turbine in MW",
"Wvapdot = mvdot*((h7-h8)-(h6-h9))*10**-3 # net power developed by vapor cycle in MW",
"",
- "# Results",
"print '-> Mass flow rate of air is: ',round(mgdot,2),'kg/s.'",
"print '-> Mass flow rate of vapor is: ',round(mvdot,2),'kg/s.'",
"print '-> Net power developed by gas turbine is: ',round(Wgasdot,2),'MW.'",
"print '-> Net power developed by vapor cycle is: ',round(Wvapdot,2),'MW.'",
"",
"",
- "# Part(b)",
"import math",
- "# The net rate of exergy increase of the air passing through the combustor is",
"Edotf32 = mgdot*(h3-h2-T0*(s3-s2))*10**-3 # in MW",
- "# The net rate exergy is carried out by the exhaust air stream at 5 is",
"Edotf51 = mgdot*(h5-h1-T0*(s5-s1))/10**3 # in MW",
- "# The net rate exergy is carried out as the water passes through the condenser is",
"Edotf89 = mvdot*(h8-h9-T0*(s8-s9))*10**-3 # in MW",
"R = 8.314 # universal gas constant, in SI units",
"M = 28.97 # molar mass of air in grams",
- "# The rate of exergy destruction for air turbine is",
"Eddott = mgdot*T0*(s4-s3-(R/M)*math.log(p4/p3))/10**3 # in MW",
- "# The rate of exergy destruction for compressor is",
"Eddotc = mgdot*T0*(s2-s1-(R/M)*math.log(p2/p1))/10**3 # in MW",
- "# The rate of exergy destruction for steam turbine is",
"Eddotst = mvdot*T0*(s8-s7)/10**3 # in MW",
- "# The rate of exergy destruction for pump is",
"Eddotp = mvdot*T0*(s6-s9)/10**3 # in MW",
- "# For heat exchanger",
"EddotHE = T0*(mgdot*(s5-s4)+mvdot*(s7-s6))/10**3 # in MW",
"",
- "# Results",
"print '-> Balance sheet'",
"print 'Net exergy increase of the gas passing'",
"print '-> Through the combustor: ',round(Edotf32,2),'MW'",
@@ -940,28 +763,21 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.14 Page no-438"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the mass flow rate and the exit Mach number for back pressures of (a) 500 kPa and (b) 784 kPa.",
"",
- "# Given:-",
"Tnot = 360.00 # in kelvin",
"pnot = 1.00 # in MPa",
"A2 = 0.001 # in m^2",
"k = 1.4",
"",
- "# Calculations",
"pstarbypnot = (1+(k-1)/2)**(k/(1-k))",
"pstar = pstarbypnot*pnot",
"",
- "# Part(a)",
- "# Since back pressure of 500 kpa is less than critical pressure pstar(528kpa in this case) found above, the nozzle is choked",
- "# At the exit",
"M = 1.00",
"p2 = pstar # in MPa",
"T2 = Tnot/(1+((k-1)/2)*(M**2)) # exit temperature in kelvin",
@@ -970,21 +786,16 @@
"V2 = ((k*(R/Mwt)*T2*10**3)**0.5) # exit velocity in m/s",
"mdot = (p2/((R/Mwt)*T2))*A2*V2*10**3 # mass flow rate in kg/s",
"",
- "# Results",
"print '-> The exit mach number for back pressure of 500kpa is: '",
"print round(M,2)",
"print '-> The mass flow rate in kg/s for back pressure of 500kpa is:'",
"print round(mdot,2)",
"",
- "# Part(b)",
- "# Since the back pressure of 784kpa is greater than critical pressure of pstar determined above,the flow throughout the nozzle is subsonic and the exit pressure equals the back pressure,",
"p2 = 784.00 # exit pressure in kpa",
- "# Calculations",
"M2 = (((2.00)/(k-1))*(((pnot*10**3)/p2)**((k-1)/k)-1))**0.5 # exit mach number",
"T2 = Tnot/(1+((k-1)/2)*(M2**2)) # exit temperature in kelvin",
"V2 = M2*((k*(R/Mwt)*10**3*T2)**0.5) # exit velocity in m/s",
"mdot2 = (p2/((R/Mwt)*T2))*A2*V2 # mass flow rate in kg/s",
- "# Results",
"print '-> The mass flow rate at the exit for back pressure of 784kpa is: ',round(mdot2,2),'kg/s.'",
"print '-> The exit mach number for back pressure of 784 kpa is: '",
"print round(M2,2)"
@@ -1010,43 +821,29 @@
{
"cell_type": "markdown",
"source": [
- "##<heading2> Example 9.15 Page no-442"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the mass flow rate, the exit pressure, exit Mach number for ",
- "# (a) Isentropic flow with M \u0003= 0.7 at the throat. ",
- "# (b) Isentropic flow with M \u0003= 1 at the throat and the diverging portion acting as a diffuser. ",
- "# (c) Isentropic flow with M \u0003= 1 at the throat and the diverging portion acting as a nozzle. ",
- "# (d) Isentropic flow through the nozzle with a normal shock standing at the exit. ",
- "# (e) A normal shock stands in the diverging section at a location where the area is 12.5 cm2. ",
- "",
- "# Given:-",
- "# Part(a)",
+ "",
"Mt = 0.7 # mach mumber at the throat",
"At = 6.25 # throat area in cm^2",
"Ae = 15.00 # exit area in cm^2",
"",
- "# The flow throughout the nozzle, including the exit, is subsonic. Accordingly, with this value for A2byAstar, Table 9.1 gives",
"M2 = 0.24",
- "# For M2 \u0003= 0.24,",
"T2byTnot = 0.988",
"p2bypnot = 0.959",
"k = 1.4",
"T0 = 280.00 # in kelvin",
"pnot = 6.8 # in bars",
- "# Calculations",
- "# With Mt \u0003= 0.7, Table 9.1 gives",
"AtbyAstar = 1.09437",
"A2byAstar = (Ae/At)*AtbyAstar",
"T2 = T2byTnot*T0 # in kelvin",
"p2 = p2bypnot*pnot # in bars",
"V2 = M2*((k*(8.314/28.97)*T2*10**3)**0.5) # velocity at the exit in m/s",
"mdot = (p2/((8.314/28.97)*T2))*Ae*V2*10**-2 # mass flow rate in kg/s",
- "# Results",
"print '-> Part(a) the mass flow rate in kg/s is: '",
"print round(mdot,2)",
"print '-> The exit pressure in bars is: '",
@@ -1054,80 +851,52 @@
"print '-> The exit mach number is: '",
"print round(M2,2)",
"",
- "# Part(b)",
"Mt = 1.00 # mach number at the throat",
- "# From table 9.1",
"M2 = 0.26",
"T2byTnot = 0.986 ",
"p2bypnot = 0.953",
"",
"T0 = 280.00 # in kelvin",
"pnot = 6.8 # in bars",
- "# Calculations",
"T2 = T2byTnot*T0 # in kelvin",
"p2 = p2bypnot*pnot # in bars",
"k = 1.4",
"V2 = M2*((k*(8314/28.97)*T2)**0.5) # exit velocity in m/s",
"mdot = (p2/((8.314/28.97)*T2))*Ae*V2*10**-2 # mass flow rate in kg/s",
- "# Results",
"print '-> Part(b) the mass flow rate is: ',mdot,'kg/s.'",
"print '-> The exit pressure is: ',p2,'bars.'",
"print '-> The exit mach number is: ',M2",
"",
- "# Part(c)",
- "# From part (b), the exit Mach number in the present part of the example is",
"M2 = 2.4",
- "# Using this, Table 9.1 gives",
"p2bypnot = 0.0684",
"pnot = 6.8 # in bars",
- "# Calculation",
"p2 = p2bypnot*pnot # in bars",
- "# Results",
- "# Since the nozzle is choked, the mass flow rate is the same as found in part (b).",
"print '> Part(c) the mass flow rate is: ',mdot,'kg/s.'",
"print '-> The exit pressure is: ',p2,'bars.'",
"print '-> The exit mach number is: ',M2",
"",
- "# Part(d)",
- "# Since a normal shock stands at the exit and the flow upstream of the shock is isentropic, the Mach number Mx and the pressure px correspond to the values found in part (c), ",
"Mx = 2.4",
"px = 0.465 # in bars",
- "# Then, from Table 9.2",
"My = 0.52",
- "#py is the exit pressure",
"pybypx = 6.5533",
"py = px*pybypx",
"",
- "# The pressure downstream of the shock is thus 3.047 bars. This is the exit pressure",
- "# The mass flow is the same as found in part (b).",
- "# Results",
"print '-> Part(d) the mass flow rate is: ',mdot,'kg/s.'",
"print '-> The exit pressure is: ',round(py,3),'bars.'",
"print '-> The exit mach number is: ',My",
"",
- "# Part(e)",
- "# A shock stands in the diverging portion where the area is",
"Ax = 12.5 # in cm^2",
- "# Since a shock occurs, the flow is sonic at the throat, so",
"Axstar = 6.25 # in cm^2",
"At = Axstar",
- "# The Mach number Mx can then be found from Table 9.1, by using AxbyAxstar as",
"Mx = 2.2",
"",
- "# Results",
- "# With Mx =\u0003 2.2, the ratio of stagnation pressures is obtained from Table 9.2 as",
"pnotybypnotx = 0.62812",
"",
- "# Using this ratio and noting that the flow is subsonic after the shock, Table 9.1 gives",
"M2 = 0.43",
- "# For M2 = 0.43,",
"p2bypnoty = 0.88",
- "# Calculations",
"A2byAystar = (Ae/Axstar)*pnotybypnotx",
"p2 = p2bypnoty*pnotybypnotx*pnot # in bars",
"",
- "# Results",
- "# Since the flow is choked, the mass flow rate is the same as that found in part (b).",
"print '-> part(e) the mass flow rate is: ',mdot,'kg/s.'",
"print '-> the exit pressure is: ',p2,'bars.'",
"print '-> the exit mach number is: ',M2"
diff --git a/Fundamentals_of_Fluid_Mechanics/Ch_2.ipynb b/Fundamentals_of_Fluid_Mechanics/Ch_2.ipynb
index f19146e9..41a4696d 100644
--- a/Fundamentals_of_Fluid_Mechanics/Ch_2.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/Ch_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Ch 2"
+ "name": "",
+ "signature": "sha256:0be2e552cff1c39387b1a182161229da6bb9f764cb6f5a785cae5a3f7334b401"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 2.1\n",
- "#calculate pressure at interface and pressure head and at bottom.\n",
- "#given\n",
+ "\n",
"sg=0.68 #specific gravity of gasoline\n",
"htg=17 #ft (height of gasoline)\n",
"htw=3 #ft (height of water)\n",
@@ -103,9 +102,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.2\n",
- "#Calculate ratio of pressure at the top to that at the base considering air to be incompressible.\n",
- "#Given\n",
+ "\n",
"h=1250 #ft , height\n",
"T=59 #degree farenheit, Temprature\n",
"p=14.7 #psi (abs), pressure\n",
@@ -170,9 +167,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.3\n",
- "#Calculate The local barometric pressure.\n",
- "#The absolute pressure at a depth of 40 m in the lake.\n",
"\n",
"#Given \n",
"T=10 #degree C, Temprature\n",
@@ -216,9 +210,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.4\n",
- "#calculate pressure reading of gage.\n",
- "#Given\n",
+ "\n",
"sg1=0.90 #specific gravity of oil\n",
"sg2=13.6 #specific gravity of Hg\n",
"#height of column at different section\n",
@@ -261,9 +253,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.5\n",
- "#calculate The difference in pressures at A and B.\n",
- "#Given\n",
+ "\n",
"gamma1=9.8 #kN/m**3, specific wt of gage \n",
"gamma2=15.6 #kN/m**3\n",
"h1=1 #m, height\n",
@@ -300,10 +290,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.6\n",
- "#Calculate \"The resultant force acting on the gate of the reservoir.\n",
- "#The resultant force acts through a point along the diameter of the gate at a distance of?? \n",
- "#given\n",
+ "\n",
"dia=4 #m, diameter\n",
"sw=9.8 #kN/m**3 specific weight of water\n",
"hc=10 #m, height\n",
@@ -341,6 +328,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEMCAYAAADal/HVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtwVHWa//F3A+EixEAIlwiYBMiQBCWJkAQcjG3YSlJm\nw21wFWed2sHSxgtRwFnHYSzDuFOrTLkbJuNqcMXFAafYWQaJM+7E4NhpQXIBsvKTi5RAdESiAYaA\nRDAJ5/dHm5aYdCeddOd0dz6vKsq+nO/hOXWsfjjf53ueYzEMw0BERMSNAWYHICIigU2JQkREPFKi\nEBERj5QoRETEIyUKERHxSIlCREQ88muicDgcJCYmEh8fT3FxsdvtampqGDRoENu2bXN9Fhsby4wZ\nM0hNTSU9Pd2fYYqIiAeD/LnzRx55hJKSEmJiYsjJyWHp0qVERUW126a1tZXHH3+c3Nzcdp9bLBbs\ndjuRkZH+DFFERLrgtyuKxsZGADIzM4mJiSE7O5uqqqoO2xUXF7NkyRLGjBnT4TvdCygiYj6/JYqa\nmhoSEhJc75OSkqisrGy3zcmTJ9mxYwcPPPAA4LyKaGOxWMjKymLhwoWUlpb6K0wREemCX6eeuvLo\no4/yzDPPYLFYMAyj3RXE7t27iY6O5vDhw+Tn55Oens748ePbjb86sYiISPd5NWNj+Mm5c+eMlJQU\n1/uHH37Y+OMf/9hum7i4OCM2NtaIjY01RowYYYwdO9bYsWNHh32tXLnS2LBhQ4fP/Rh+QHjqqafM\nDsGvdHzBK5SPzTBC//i8/e3029RTREQE4Fz5VFdXR3l5ORkZGe22OX78OCdOnODEiRMsWbKEF154\ngfnz59PU1MSFCxcAaGhooKysrEOxW0RE+oZfp56Kioqw2Ww0NzdTUFB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Uq9Xao6copqens2/fvqBu/SDSRolCxI2XXnqJu+++2/X+q6++4q677iIpKYk1a9a4Pj906BD3\n338/ycnJZGRkcPHiRQDy8/P53e9+12G///Vf/8Wdd95JdnY2kydPZtOmTbzwwgvMmDGDpUuXKrlI\nwFGiEHHjwIEDTJs2zfXe4XCwdu1aamtrKS0t5dNPPwXgwQcfZP78+bz//vu8/fbbDB06FHC2YNm/\nf3+n+3Y4HGzevJl33nmHBx54gLNnz3LgwAGGDRvGW2+95f+DE/GCEoVIJ86fP8/AgQMZOHCg67P0\n9HSmTZvGkCFDuPnmm9m9ezf19fV88cUX/P3f/z0AI0aMcI2ZPHkyH374Yaf7/7u/+zvGjh1LTEwM\no0aNYunSpQDMmTOHPXv2+PnoRLyjRCHSCYvF0qHD5tXPnBg8eDCXL1/udLs2hmF0Wt+wWCyu58K3\n7avtfdt+RQKJEoVIJ8LDw2ltbaWlpcXjduPGjWPs2LGuDr8XLlygtbUVgOPHj/O9732vwxhPXXPU\nUUcCkRKFiBszZsxwTR1ZLBa3q59efPFFduzYwY033khOTo7riuDw4cPcdNNNHbb/7r6++7onq6xE\n/ElNAUXc2L59O3v37uWXv/xlj8bPnj2b8vJywsPDfRyZSN/SFYWIGwsWLMBut/doOqi6uppZs2Yp\nSUhI0BWFiIh4pCsKERHxSIlCREQ8UqIQERGPlChERMQjJQoREfFIiUJERDz6/3mzRdiLDrGcAAAA\nAElFTkSuQmCC\n"
}
@@ -359,9 +347,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.7\n",
- "#calculate magnitude and location of force of seawater.\n",
- "#Given\n",
+ "\n",
"sw=64 #lb/ft**3 specific weight of water\n",
"h=10 #ft, depth\n",
"a=3 #ft, distance from horizontal axis\n",
@@ -411,9 +397,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.8\n",
- "#Calculate magnitude and location of resultant force.\n",
- "#Given\n",
+ "\n",
"sg=0.9 # specific gravity of oil\n",
"a=0.6 #m, length of square\n",
"pgage=50 #kPa, gage pressure\n",
@@ -458,9 +442,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.9\n",
- "#calculate The resultant force exerted by the tank \n",
- "#on the fluid and at what distance The force acts .\n",
+ "\n",
"\n",
"#Given\n",
"dia=6.0 #ft, diameter\n",
@@ -514,10 +496,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.10\n",
- "#Calculate The tension in the cable \n",
"\n",
- "#Given\n",
"dia=1.5 #m\n",
"wt=8.5 #kN\n",
"#tension in cable T=bouyant force(Fb)-wt\n",
@@ -558,8 +537,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 2.11\n",
- "#Calculate the max acceleration that can occur before the fuel level drops below the transducer.\n",
+ "\n",
"sg=0.65 #specific gravity of fuel\n",
"l1=0.75 #ft, horizontal distance\n",
"l2=0.5 #ft verticle distance\n",
diff --git a/Fundamentals_of_Fluid_Mechanics/Ch_4.ipynb b/Fundamentals_of_Fluid_Mechanics/Ch_4.ipynb
index 3d72a5e5..0f2922c6 100644
--- a/Fundamentals_of_Fluid_Mechanics/Ch_4.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/Ch_4.ipynb
@@ -1,58 +1,57 @@
-{
- "metadata": {
- "name": "Ch 4"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 4:fluid kinematics"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 4.6 Page no.165"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 4.6\n",
- "#Determine how fast the manufacture must travell along the route.\n",
- "#given\n",
- "pratet=-8 #dollars/hr\n",
- "pratex=0.2 #dollars/mi\n",
- "\n",
- "u=(-pratet)/pratex\n",
- "\n",
- "#Result\n",
- "print \"The delivery speed=\",round(u,1),\"mi/hr\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The delivery speed= 40.0 mi/hr\n"
- ]
- }
- ],
- "prompt_number": 1
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:05d71697cf7aa87db46aad4ab8742d4e783bd3d0a3dd26958cddc18debaf818a"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4:fluid kinematics"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.6 Page no.165"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "pratet=-8 #dollars/hr\n",
+ "pratex=0.2 #dollars/mi\n",
+ "\n",
+ "u=(-pratet)/pratex\n",
+ "\n",
+ "#Result\n",
+ "print \"The delivery speed=\",round(u,1),\"mi/hr\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The delivery speed= 40.0 mi/hr\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Fundamentals_of_Fluid_Mechanics/Ch_5.ipynb b/Fundamentals_of_Fluid_Mechanics/Ch_5.ipynb
index c5bf2805..2f61f756 100644
--- a/Fundamentals_of_Fluid_Mechanics/Ch_5.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/Ch_5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Ch 5"
+ "name": "",
+ "signature": "sha256:c7c5940af2f0332e0055a73277f3e96c5338031f3b285c9ca2e11f04c995d4f4"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.1\n",
- "#find the minimum pumping capacity required.\n",
- "#given\n",
+ "\n",
"v2=20.0 #m/s, nozzle velocity\n",
"dia2= 40.0 #mm, nozzle diameter\n",
"\n",
@@ -68,9 +67,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.2\n",
- "#calculate average Velocity at section (1)\n",
- "#given\n",
+ "\n",
"v2=1000 #ft/sec, velocity\n",
"p1=100 #psia pressure inlet\n",
"p2=18.4 #psia pressure outlet\n",
@@ -112,9 +109,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.3\n",
- "#Determine the Mass flowrate of the dry air and water vapour leaving the dehumidifier\n",
- "#given\n",
+ "\n",
"m1=22 #slugs/hr\n",
"m3=0.5 #slugs/hr\n",
"#-m1+m2+m3=0\n",
@@ -170,9 +165,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.5\n",
- "#What is the time rate of change of depth of water in tub.\n",
- "#given\n",
+ "\n",
"Q=9.0 #gal/min, Q=m/d ,flow rate\n",
"l=5.0 #ft, length\n",
"b=2.0 #ft breadth\n",
@@ -233,9 +226,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Example 5.6\n",
- "#calculate the mass flow rate of intake fuel.\n",
- "#given\n",
+ "\n",
"v=971 #km/hr, aeroplane speed\n",
"v2=1050 #km/hr velocity of exhaust gases\n",
"A1=0.80 #m**2 intake area of jet engine\n",
@@ -276,9 +267,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.7\n",
- "#Find average speed of water leaving each nozzle.\n",
- "#given\n",
+ "\n",
"Q=1000 #ml/s, flow rate\n",
"A2=30 #mm**2 area\n",
"rotv=600 #rpm, revolutionary speed\n",
@@ -315,8 +304,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.8\n",
- "#Determine the speed at which the plunger should be advanced\n",
+ "\n",
"Ap=500 #mm**2\n",
"Q2=300 #cm**3/min\n",
"Qleak=0.1*Q2 #cm**3/min\n",
@@ -352,8 +340,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.9\n",
- "#Solve Example 5.5 using water accumulating in the tub.\n",
+ "\n",
"Given\n",
"Q=9 #gal/min\n",
"l=5 #ft\n",
@@ -390,9 +377,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.11\n",
- "#Determine the anchoring force.\n",
- "#given\n",
+ "\n",
"dia1=16.0 #mm\n",
"h=30.0 #mm\n",
"dia2=5.0 #mm\n",
@@ -441,9 +426,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.12\n",
- "#Find the y component of anchoring force\n",
- "#given\n",
+ "\n",
"A=0.1 #ft**2\n",
"v=50 #ft/s\n",
"p1=30 #psia\n",
@@ -483,9 +466,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.13\n",
- "#What is the frictional force exerted by pipe wall on air flow.\n",
- "#given\n",
+ "\n",
"p1=100.0 #psia\n",
"p2=18.4 #psia\n",
"T1=540.0 #degree R\n",
@@ -530,9 +511,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.15\n",
- "#What is the thrust for which the stand is to be designed\n",
- "#given\n",
+ "\n",
"v1=200.0 #m/s\n",
"v2=500.0 #m/s\n",
"A1=1.0 #m**2\n",
@@ -575,9 +554,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.17\n",
- "#Determine the magnitude and direction of force exerted by stream of water.\n",
- "#given\n",
+ "\n",
"v1=100.0 #ft/sec\n",
"v0=20.0 #ft/sec\n",
"ang=45 #degrees\n",
@@ -630,11 +607,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.18\n",
- "#find (i)Resisting torque required to hold the sprinker stationary\n",
- "#Resisting torque when sprinker is rotating at a constant speed of 500 rev/min\n",
- "#Speed of sprikler when no resisting torque is applied\n",
- "#given\n",
+ "\n",
"Q=1000.0 #ml/sec\n",
"A=30.0 #mm**2\n",
"r=200.0 #mm\n",
@@ -685,6 +658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rQ7Pm/SpEnGnUotOXToEADgww8/xOjRozFq1CiLW7mb\n09LSgkmTJg14PJE9sXkQ9RIXF4fW1lbMnDkT48ePx1133XXHKSsAmD17Ns6cOWM8Nvc5CMOHD8e0\nadOwevVq7Nu3zziu99hfP6/n+NatW2hsbBzQFRCRI3BjRCIbaG9vx9y5c40pql+bO3cutm/fPqCr\nGHPKy8tx5MgR7Ny5cyhlEtkMrzyIbGDEiBGYO3euySce2srevXuxbt06u5ybaDB45UFERFbjlQcR\nEVmNzYOIiKzG5kFERFZj8yAiIquxeRARkdXYPIiIyGr/DxFped1zxBGnAAAAAElFTkSuQmCC\n"
}
@@ -703,9 +677,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.19\n",
- "#What is the power required to run the fan.\n",
- "#given\n",
+ "\n",
"h=1.0 #in\n",
"Q=230.0 #ft**3/min\n",
"ang=30.0 #degrees\n",
@@ -755,9 +727,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.20\n",
- "#If the pumping process is adiabatic determine the power required for pump.\n",
- "#Given\n",
+ "\n",
"Q=300.0 #gal/min \n",
"d1=3.5 #in.\n",
"p1=18.0 #psi\n",
@@ -808,9 +778,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.21\n",
- "#What is the work output involved of steam through-flow.\n",
- "#given\n",
+ "\n",
"v1=30 #m/s\n",
"h1=3348 #kJ/kg\n",
"v2=60 #m/s \n",
@@ -849,9 +817,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.22\n",
- "#Find the temprature change associated with the flow.\n",
- "#given\n",
+ "\n",
"z=500 #ft\n",
"#energy equation\n",
"#T2-T1 = (u2 - u1)/c = g*(z2 - z1)/c c=specific heat of water = 1 Btu/(lbm* degree R)\n",
@@ -885,9 +851,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.23\n",
- "#Compare the volume flowrate associated with two different vent configuration.\n",
- "#given\n",
+ "\n",
"dia=120.0 #mm\n",
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RX\nu3TpElJTU/HJJ5+YPH977tw5+Pr66p/LZDKMGTMG3bp1g4+PD3r06IHk5GQAwNChQ1FRUaFv23wf\n3iFDhmDIkCHo06cPunTpgv79++P7778HoBtKbmpqQn19vcBPSUT2xrClu1qPHj3Qr18/7N+/32yb\n1jdZc3Fx0f8tl8v1z+VyORobG43atWzT/Fyr1Rpsn7/0RNS5Ocy9kYnsoUuXLvjXv/6FxMREuLu7\n4/e//73B+n79+qG6ulr/vK27m/6aO582NDTAycnJIIyJqPNh2NJdTSaTwc3NDTt27EBCQgI8PDww\nadIk/fq+ffuisbERP/30E9zc3CCTyQyOQlv/beoI1dxyACgtLUVsbOwd/ERE5Ij4QwREFixevBhh\nYWF47LHH7vi2Fy5ciJiYGDzyyCN3fNtE5DgYtkQW/PDDD3jqqaewc+fOO7rdhoYGJCQkYO/evTxn\nS9TJMWyJiIgE42xkIiIiwRi2REREgjFsiYiIBGPYEhERCcawJSIiEoxhS0REJNj/B4TQUZbmSTpU\nAAAAAElFTkSuQmCC\n"
}
@@ -955,10 +920,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.24\n",
- "#determine the work to air which provides useful effect and \n",
- "#Fluid mechanical efficiency of this fan.\n",
- "#Given\n",
+ "\n",
"p=0.4 #kW\n",
"dia=0.6 #m\n",
"v2=12 #m/s\n",
@@ -1002,8 +964,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.25\n",
- "#Find the flow rate and power loss.\n",
"\n",
"#given\n",
"p=10.0 #hp\n",
@@ -1049,6 +1009,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEMCAYAAADEXsFmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVOX+B/DPsJSCuCCCBogmeNlnBjUst3HLcMtrt66Z\n/nCNy++ay3W7WV2lXKJrpWmaLZpaVy27JV6R8hZjoiEqmK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BQCC6R8eOHREcHAwA6NKlC9LT02tsf/78ed19poDbtxC4M9ezqjmf7dq1q3WdRObCQCC6\nx6OPPqr72dbWFqWlpbW+594Df2131hQRq7r7JjUuDASiB+Dl5aW7syagHw5OTk66mxLekZ2dDS8v\nrwarj8gQDASie9z/7b22b/M9evTQGzV07/33W7dujR49eiAoKEh3UTkpKQm9e/c2ctVExsGb2xE9\noH79+uHLL7/Uu5ZQnZdeegmzZs2CWq1ugMqIDMMeAtEDmjVrFj766KNa2126dAn5+fkMA7JY7CEQ\nEREA9hCIiKgCA4GIiAAwEIiIqAIDgYiIADAQiIioAgOBiIgAAP8PdrZWDHielqsAAAAASUVORK5C\nYII=\n"
}
@@ -1067,11 +1028,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 5.26\n",
- "#find (i)Loss for uniform velocity profile\n",
- "#and for actual velocity profile.\n",
"\n",
- "#given\n",
"m=0.1 #kg/min\n",
"dia1=60.0 #mm\n",
"alpha1=2.0\n",
@@ -1118,9 +1075,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.29\n",
- "#Determine the velocity of expanded air considering incompressible and compressible flow.\n",
- "#given\n",
+ "\n",
"p1=100.0 #psia\n",
"T1=520.0 #degree R\n",
"p2=14.7 #psia\n",
diff --git a/Fundamentals_of_Fluid_Mechanics/Ch_6.ipynb b/Fundamentals_of_Fluid_Mechanics/Ch_6.ipynb
index cf86883a..9738d352 100644
--- a/Fundamentals_of_Fluid_Mechanics/Ch_6.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/Ch_6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Ch 6"
+ "name": "",
+ "signature": "sha256:805b87c0e7bc67e50775f14efd1555d6a0dbc6c17cb66c408f5df20cf65eec99"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.4\n",
- "#If the pressure at point 1 is 30 kpa \n",
- "#Find the pressure at point 2.\n",
+ "\n",
"p1=30 #kPa\n",
"d=1000 #kg/(m**3)\n",
"r1=1 #m\n",
@@ -67,9 +66,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.5\n",
- "#What is volume rate of flow into the opening of flow.\n",
- "#given\n",
+ "\n",
"ang2=math.pi/6 #radians\n",
"#vp=-2*math.log(r)\n",
"\n",
@@ -133,12 +130,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.7\n",
- "#find elevation of point above the plane.\n",
- "#The magnitude of velocity at (2) for a 40 mi/hr approaching wind.\n",
- "#The pressure difference between points (1) and (2).\n",
"\n",
- "# given\n",
"h=200 #ft\n",
"U=40 #mi/hr\n",
"d=0.00238 #slugs/ft**3\n",
@@ -191,6 +183,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEMCAYAAAA4S+qsAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X9cVFXCP/DPIBQJKuUP1JlBfBzkpyAIkaJGaktakuuP\nRzTQjJ5ce1ykH6vbPrv7YD2LklmRVKttmaIiWZug0rSxNquiwBYUJrgiy8QAQmYioiYwnO8ffh35\nzeXHZYD5vF8vXnLvnHPuuVedz9xz75mrEEIIEBERSWBl7g4QEVH/wdAgIiLJGBpERCQZQ4OIiCRj\naBARkWQMDSIikkzW0NBqtXBzc4OLiwvi4uJavH727FlMnToVtra22Lp1a4vXjUYjfH19MX/+fDm7\nSUREElnL1bDRaMTatWuRnp4OpVKJgIAAhIaGwt3d3VRm+PDh2LZtGw4ePNhqG/Hx8fDw8MDVq1fl\n6iYREXWCbGca2dnZ0Gg0cHZ2ho2NDcLCwpCSktKkzMiRI+Hv7w8bG5sW9UtLS5GWloann34anH9I\nRNQ3yBYaZWVlUKvVpmWVSoWysjLJ9Z977jls2bIFVla87EJE1FfINjylUCi6XPfw4cMYNWoUfH19\nodPpZNk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JiemRfgQHB+Prr79usT4vLw+RkZE9sg2i7mJoELVC6mzhrVu3Ys2aNbJu09vbG0VF\nRfjhhx96ZDtE3cHQIOoig8GA2tpa0/f5PPnkk3j22WcxdepUTJgwATqdDitXroSHhwdWrVplqmdv\nb4/nn38eXl5emDNnDn788UfTawcOHEBgYCBcXV1x4sQJ0/q5c+fiwIEDvbdzRG1gaBB1UUZGBvz8\n/EzLCoUCVVVVOHXqFN544w2EhoZi/fr1OHPmDE6fPo28vDwAwPXr1xEQEIDvvvsODz74oOm51UII\nGI1GZGVl4c0332zyPOv7778fx44d690dJGoFQ4MsXlvDQh0NUZWUlGDMmDFN1s2fPx8A4OXlhdGj\nR8PT0xMKhQKenp7Q6/UAACsrKyxduhQAEB4ebjqjUCgUWLhwIQDAz8/PVB4AxowZ02SZyFwYGmTx\nhg8fjsuXLzdZd+nSJYwcObLDus2/UOGuu+4CcCsY7r77btN6Kysr1NfXt1q/cTjdrjNo0KAm5ZuX\nIzIXhgZZPHt7e4wZMwZffvklAOCnn37C559/junTp7dbb9y4caZvDe2MhoYG0/WJffv2YcaMGR3W\nuXDhAsaNG9fpbRH1NIYGEYDdu3fjlVdega+vL2bPno2YmBiMHz++3TpBQUHIyclpsq7x2UBbZwZ2\ndnbIzs7GpEmToNPp8Mc//rHVco3rZ2dnY+bMmVJ3h0g2/MJCom6YNWsW9u7d2+LaRnuGDBmCq1ev\ndmo7wcHB+OijjyzuGRDU9/BMg6gbXnzxRfz5z3/uVJ3OXpvIy8uDRqNhYFCfwDMNIiKSjGcaREQk\nGUODiIgkY2gQEZFkDA0iIpKMoUFERJIxNIiISLL/B/expgtkdenNAAAAAElFTkSuQmCC\n"
}
@@ -209,10 +202,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 6.10\n",
- "#Determine (a) the pressure drop across the tube\n",
- "#(b) if a 4mm dia tube is placed inplace of 2mm tube then what is the pressure drop.\n",
- "#given\n",
+ "\n",
"d=1.18*1000 #kg/m**3\n",
"vis=0.0045 #Ns/m**2, viscosity\n",
"Q=12.0 #ml/sec\n",
@@ -282,10 +272,12 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAaQAAAEMCAYAAACLA8K2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlYlOX+P/D3sCmL4IapLAdFC1TAETAXTDAp9y2x0MsF\nFTy2mGX9WvwqqKV11AqsY2lpenJJxARNcTk5Kpts7iiaguKCuCGLIMs8vz88jZLiDOIzz/DM+3Vd\nXNfALPfbO7o/PJ9nUwiCIICIiEhiJlIHICIiAliQiIjIQLAgERGRQWBBIiIig8CCREREBoEFiYiI\nDAILEhFRA3Pv3j307dsXarUaa9aswfPPP4/nn38ea9eufezrf/75Z9jb20OpVEKpVGLVqlWPvCY7\nO1vzvFKphJ2dHaKioh553e3btzFy5Eh4eXnhxRdfxMmTJ2s8X11dDaVSiaFDh2p+9v777+PgwYNa\n/10Ksc5DWrRoEX755ReYmJjAw8MDq1evRqNGjcQYiojIqKxatQo3b97ElClT4Ovri4yMDACAt7c3\nMjIy0LRp0xqvX7NmDTIyMh5bYB5HrVbDwcEBqampcHJyqvHchx9+CFtbW8yZMwfZ2dl46623sHfv\nXs3zX331FTIyMlBcXIy4uDgAwNmzZzFr1izN97URZQspNzcXK1euRGZmJo4fP47q6mps3LhRjKGI\niIzOhg0bMHz4cOzatQuvvPIKmjZtiqZNmyIwMBDx8fGPvF4QBNRl22Pv3r1wdXV9pBgBwKlTpxAQ\nEAAAeOGFF5Cbm4vr168DAC5duoQdO3Zg6tSpNcbr2LEjcnNzUVhY+MRxRSlItra2MDc3x927d1FV\nVYW7d+/CwcFBjKGIiIxKdXU1Tpw4geeffx6XL1+Go6Oj5jlHR0dcvnz5kfcoFArExMTA09MTQUFB\nuHTp0hPH2LhxI8aOHfvY57y8vLBlyxYAQGpqKi5cuKD5vPfeew+LFy+GicmjpUWpVCI5Of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BAcPXoU48aN\nw4wZM8QPTmQEeGIsGQUzMzN4eHjg8uXLcHFxQUpKCkxMTJCbm4uhQ4fi+PHjqKioQK9evZCeng4A\naNeuHZo0aYJbt27BzMwMJ06cgI2NDezt7ZGfnw9TU1NUVlaibdu2uH79usT/QqKGj1tIZBQsLS1x\n+PBhXLhwAY0bN37svWUOHjwIPz+/Gj9TqVS4cOECevTogZUrV2p+zr/jiJ49FiQyKpaWloiKisLs\n2bMfKSrx8fGPve+SqakpvvnmGyxduhQlJSXo1auX5rph69atw0svvaSX7ERyx4JERuHh+8t07doV\nHTp0wKZNm6BQKDTP7d+/H3379n3se1q3bo1Ro0bhu+++w7Jly7B69Wp4eXlh3bp1iIyM1N8/hEjG\nuA+JCPfvwzVt2jT8/vvvUkchMlosSEREZBDYsiMiIoPAgkRERAaBBYmIiAwCCxIRERkEFiQiIjII\nLEhERGQQ/j8y2WFyYO5hqwAAAABJRU5ErkJggg==\n"
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAELCAYAAAAY3LtyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X9UVGX+B/D38Ctd0SRDFAbPqMMKJr8U/FUU7YImpZu0\n9hXZ1QPkcvhueTqZ27etU0ydfqhZm9rW5qadTqw/yu+KJY6s1RCaOCaYFNkXyZEfhoppImrA8Hz/\nGBwlZxy43HtnBt6vczoH5s6Pz32OzZvnee5zH40QQoCIiEgCH3cXQERE3oshQkREkjFEiIhIMoYI\nERFJxhAhIiLJGCJERCSZIiGSnZ2NkJAQREdHOzxeWFiI2NhYxMfHY9KkSfj000/tx4xGIyIjIxER\nEYHly5crUR4REclEo8Q6kdLSUgQGBmLhwoWorKy87nhLSwsGDRoEAKisrMTcuXNx9OhRWK1WjBs3\nDrt370ZYWBgSExOxceNGREVFyV0iERHJQJGeSFJSEoKCgpwevxIgAHDhwgXceuutAACz2Qy9Xg+d\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/PFH+Pn54euvv0ZgYCCCg4PR2NgI\nX19ftLW1ITQ0FKdPn3bzGRJJx54IkQsDBw5ERUUFjh8/jgEDBly3ZwMAlJaW4o477ujymMlkwvHj\nxzF16lSsW7fO/jj/bqO+hCFC1E0DBw7E6tWr8dRTT10XBEaj0eE+Lb6+vvjb3/6GVatW4cKFC5g+\nfTo2bdoEACgoKMCdd96pSu1ESmGIELlw7X4KcXFx0Ov12LJlS5e9FkpKSnDXXXc5fM2IESOQnp6O\nN954A2vWrMGGDRsQGxuLgoICvP766+qdCJECOCdC1Ev19fXIzc3Fjh073F0KkeoYIkREJBmHs4iI\nSDKGCBERScYQISIiyRgiREQkGUOEiIgkY4gQEZFk/w8CXDOaRlIIgQAAAABJRU5ErkJggg==\n"
}
diff --git a/Fundamentals_of_Fluid_Mechanics/Ch_7.ipynb b/Fundamentals_of_Fluid_Mechanics/Ch_7.ipynb
index d5266070..4fbbb7e2 100644
--- a/Fundamentals_of_Fluid_Mechanics/Ch_7.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/Ch_7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Ch 7"
+ "name": "",
+ "signature": "sha256:930132386650bb03420c39344d27ebf4402487f843f63909342366713e69c9e9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.5\n",
- "#Determine the model dimension and the velocity at which the test should be performed.\n",
- "#given\n",
+ "\n",
"D=0.1 #m\n",
"H=0.3 #m\n",
"v=50.0 #km/hr\n",
@@ -105,9 +104,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.6\n",
- "#What is the required flowrate in the model.\n",
- "#given\n",
+ "\n",
"D=2.0 #ft\n",
"Q=30.0 #cfs\n",
"Dm=3.0 #in\n",
@@ -149,6 +146,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAELCAYAAAA/c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rR\n2NiId999F+7u5jdft1aJiYk4fPgwKioq4OvrizVr1qCurg6A+ftNq+sxTERE0mFnMSIiFWMIEBGp\nGEOAiEjFGAJERCrGECBVsre3N9x4LTw8HH/961/NuvDs+PHj+OMf/4jDhw+jd+/eGDZsGIKCgjB+\n/HhkZmaKUDmRZSnv5hpERujRo4fhDovl5eWYPXs2bty4geTkZJO+JysrC5MnTwYAjBs3Dp9//jkA\n4MyZM0hISICzszMmTJhg0dqJLIlHAqR6/fr1w5YtW7Bp0yYAQGpqKhISEhAbGws/Pz9s2rQJGzZs\nwLBhwzBq1ChUVVUZPnvw4EFMmjSpzVGEVqvFG2+8YfhOImvFECAC4Ofnh4aGBly/fh0AcO7cOWRk\nZODEiRNYuXIlXF1dcerUKYwaNQofffQRgKbbVjg6OnZ4fxqdTocffvhBst+ByBwMAaIWmm+2FR0d\njZ49e6Jv377o06cPpk2bBgAIDQ1FYWEhACAnJwdxcXEdfhevwyRbwBAgAnDlyhXY29sbehR0797d\n8JqdnZ3hz3Z2dqivrwfQ1O0qPj6+w+/My8tT5G0cSFm4MEyqV15ejmeffRYvvPBCp+9t+a/7/Px8\naLXadt+Xn5+Pt956C1u3brVYnURiYAiQKt25cwc6nQ51dXVwcHDA/PnzsXz5cgBNU0It78H+2581\nGg2+++476HS6Vs9/9dVXGDZsGG7fvo3+/fsjJSUF0dHR0v1SRGbgDeSIzPD2228jICAATz/9tNyl\nEHUJQ4CISMW4MExEpGIMASIiFWMIEBGpGEOAiEjFGAJERCrGECAiUrH/A1w1d0MWpUCyAAAAAElF\nTkSuQmCC\n"
}
@@ -167,9 +165,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.7\n",
- "#Find (a)The required air pressure in the tunnel.\n",
- "#(b)The corrosponding drag on the prtotype for a 1 lb drag on the model.\n",
+ "\n",
"V=240.0 #mph\n",
"ratio=0.1\n",
"Vair=240.0 #mph\n",
@@ -221,9 +217,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 7.8\n",
- "#Determine (a)the flowrate and required model width. (b) the operating time.\n",
- "#given\n",
+ "\n",
"w=20.0 #m\n",
"Q=125.0 #(m**3)/s\n",
"ratio=0.066\n",
@@ -273,6 +267,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAELCAYAAADURYGZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHf5JREFUeJzt3XtYFXX+B/D3cElSFJWbpCCJqCSIKOBdMC+IipGut8fU\nFjF/umk+bpmVPV4ixZLdR/CSq66LZl5WS2lJ1k09SIBiiguGImpHkQWMBVTM5Da/P9qOoCCHy8yc\nc+b9eh6fB47DnA9fcd7MfGa+X0EURRFERKRaZkoXQEREymIQEBGpHIOAiEjlGARERCrHICAiUjkG\nARGRykkWBLm5uRgxYgR69+4NT09PREdHAwCKi4sxevRo9OjRA2PGjEFpaalUJRARkR4EqZ4jKCgo\nQEFBAfr27YuysjL0798fR44cwa5du2BnZ4dly5Zh/fr1KCkpQWRkpBQlEBGRHiQ7I+jUqRP69u0L\nALC2toaHhwfy8vIQFxeHOXPmAADmzJmDI0eOSFUCERHpQbIzgpq0Wi0CAgJw6dIluLi4oKSkBAAg\niiI6duyo+5yIiORnIfUblJWVYfLkydi4cSPatm1b6+8EQYAgCE99TV2vERFRw5ryu72kdw1VVFRg\n8uTJmDVrFkJDQwEAjo6OKCgoAADk5+fDwcGhzq8VRZF/RBErV65UvAZD+cOx4FhwLJ79p6kkCwJR\nFDF37ly89NJLWLJkie71iRMnIjY2FgAQGxurCwgiIlKGZJeGkpOT8fnnn6NPnz7w8fEBAKxbtw7L\nly/H1KlTsXPnTri6uuLgwYNSlUBERHqQLAiGDh2K6urqOv/u22+/leptTU5gYKDSJRgMjsVjHIvH\nOBbNJ8tdQ40lCEKzrncREalRU4+dnGKCiEjlGARERCrHICAiUjkGARGRyjEIiIhUjkFARKRyDAIi\nIpVjEBARqRyDgI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WJw/fx7Tp08HABQVFeHYsWOwtLQ0udvT9RmLtm3b6j4ODg7GwoULUVxcjI4dO9a9\n05ZsYjRGRUWF2K1bN/HHH38UHz161GCzODU11WSbgvqMxW9Wrlxp0s1ifcbi5s2bopubm5iamqpQ\nlfLQZyyuXbsmVldXi6IoiufPnxe7deumRKmSa8z/EVEUxddff108fPiwjBXKR5+xKCgo0P1cnD17\nVuzatesz96nYGUF9zxNs27YNADB//nyMGzcO33zzDbp37442bdpg165dSpUrKX3GoqCgAH5+frh3\n7x7MzMywceNGZGVlwdraWuHqW5Y+Y7FmzRqUlJTorgVbWloiLS1NybIloc9YHD58GLt374alpSWs\nra2xf/9+hauWhj5joRb6jMWhQ4ewdetWWFhYoHXr1g3+XAiiaKIX0oiISC9coYyISOUYBEREKscg\nICJSOQYBEZHKMQiIamjKXVj5+fkICgrCzZs34eXlJUFVRNJiEBDV0JSnvBMSEjB27FgJqiGSB4OA\nqA4ajQYBAQEIDQ2Fm5sbli9fjj179sDf3x99+vTBjRs3dNv+85//RHBwsMlOaUCmj0FAVI+MjAxs\n27YNly9fxp49e3D9+nWkpaUhPDwcMTExAICqqipkZ2ejV69eCldL1HQMAqJ6+Pn5wdHREc899xy6\nd++OoKAgAICnpye0Wi0A4OzZsxgwYICCVRI1H4OAqB6tWrXSfWxmZqb73MzMDJWVlQCAY8eOITg4\nWJH6iFoKg4CoGU6ePIlRo0YpXQZRszAIiGqoeddQfXcQCYIAQRBQVFQEKyurWquEcW0JMkacdI6o\nifbu3Yu8vDwsW7ZM6VKImoVBQESkcrw0RESkcgwCIiKVYxAQEakcg4CISOUYBEREKscgICJSuf8H\nu0KszCbRxKoAAAAASUVORK5CYII=\n"
}
diff --git a/Fundamentals_of_Fluid_Mechanics/Ch_8.ipynb b/Fundamentals_of_Fluid_Mechanics/Ch_8.ipynb
index 0c545286..81ed821d 100644
--- a/Fundamentals_of_Fluid_Mechanics/Ch_8.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/Ch_8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Ch 8"
+ "name": "",
+ "signature": "sha256:f5ae274b7edcc57a7498bbeb71a07ac716fad352b5f8f5416ad4bc0b8ec4e837"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.1\n",
- "#Determine the minimum time taken to fill the glass\n",
- "#(b) Maximum time taken to fill the glass.\n",
"\n",
"#given\n",
"T1=50.0 #degree farenheit\n",
@@ -96,10 +94,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.2\n",
- "#(a) find the pressure drop\n",
- "#(b)How steep a hill must the pipe be on if oil is to flow through pipe.\n",
- "#given\n",
+ "\n",
"vis=0.4 #Ns/(m**2)\n",
"d=900 #kg/(m**3)\n",
"D=0.02 #m\n",
@@ -176,10 +171,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.3\n",
- "#(a) plot K(t) vs T\n",
- "#(b) Determine wall shear stress and pressure drop.\n",
- "#(c)Determine the net pressure force.\n",
+ "\n",
"\n",
"from numpy import*\n",
"T=array([60,80,100,120,140,160]) #degree F\n",
@@ -231,6 +223,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEKCAYAAAAW8vJGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH0RJREFUeJzt3XtUVXXCxvHvUTDN+21QOTSoIBdRvGtWRqViVpTWlNqs\nTB0zG6daNl5bJViK5HTVt14rL5lm+c5MQxZzxsQonVIsKqexpWSYiMqISlqoCO73j51n3MpFLod9\nzuH5rOVSDpvD80vbD799+W2HYRgGIiIiv2hgdwAREfEuKgYREbFQMYiIiIWKQURELFQMIiJioWIQ\nERELjxXDxIkTCQoKokePHuVu8/DDDxMeHk5sbCxffvmlp6KIiEgVeKwYJkyYgMvlKvfzaWlpfPfd\nd2RnZ/Pqq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LiYnJwcsrOzGTBg\ngJ1Rq8XlcrF48WJSU1Np3Lix+3V/GF+PHj3Iz88nJyeHnJwcnE4nWVlZBAUF+cX47rjjDjZv3gzA\nnj17KC4upl27dn4xNoCwsDA+/vhjADZv3ky3bt2Aav7b9NRZ8+r46quvjH79+hk9e/Y0Ro0aZRQW\nFhpHjx41brrpJiM8PNwYNmyYcfz4cbtjVltKSooRHR1txMTEGPfdd59RXFzs0+MbM2aM0bFjRyMw\nMNBwOp3GihUrKhzPggULjK5duxoRERHuqye82cXjW758uREWFmZcddVVRq9evYxevXoZU6dOdW/v\nq+Nr1KiR++/vQp07d3ZflWQYvjW+ssZWXFxs/Pa3vzViYmKMPn36GB999JF7e18am2GU/f/ejh07\njAEDBhixsbHGoEGDjKysLPf2VR2f16+VJCIidctrDiWJiIh3UDGIiIiFikFERCxUDCIiYuH1z2MQ\nscvRo0cZOnQoAIcPH6Zhw4a0b98eh8PB9u3b3UsrXCguLo7Dhw/TpEkTAJ544gn3tfMivkLFIFKO\ntm3b8uWXXwKQlJRE8+bNmT59eoVf43A4eOutt+jTp09dRBTxCB1KErlMl3tlt64AF1+nGYNILTIM\ng3vvvdd9KCk9PZ02bdrYnEqkalQMIrVIh5LEH+hQkkgt06Ek8XUqBpFa5otLNotcSMUgcpm0w5f6\nQovoiYiIhWYMIiJioWIQERELFYOIiFioGERExELFICIiFioGERGx+H/cxgRIJ7DV5wAAAABJRU5E\nrkJggg==\n"
}
@@ -249,10 +242,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.4\n",
- "#Determine (a) The thickness of the viscous sublayer\n",
- "#(b)The approximate centerline velocity\n",
- "#C ratio of laminar to turbulant shear stress.\n",
+ "\n",
"\n",
"#Given\n",
"T=20.0 #degree C\n",
@@ -324,10 +314,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.5\n",
- "# find The pressure drop if the flow is laminar and turbulent.\n",
"\n",
- "#result\n",
"D=4.0 #mm\n",
"V=50.0 #m/sec\n",
"l=0.1 #m\n",
@@ -373,12 +360,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.6\n",
- "#find the pressure drop.\n",
- "#The horsepower supplied to the fluid by the fan.\n",
"\n",
- "#Given\n",
- "#Area and Velocity at location 1 to 9\n",
"A=[22,28,35,35,4,4,10,18,22]\n",
"V=[36.4,28.6,22.9,22.9,200,200,80,44.4,36.4]\n",
"g=32.2 #ft/s**2 gravitational constant \n",
@@ -416,6 +398,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEMCAYAAADal/HVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtwlPW9x/H3AqmXISpasjAJGksSQ0JItkCgcgtjgkXH\nyEWDUSEtgfFoW0VooTpHTTzKpRVroMXxUJT0ODXQdghUIUQdA4F6DMUglyAXGzB3wIAnQZxAeM4f\nT7MS2CyB7O6zu/m8ZjKGZy/5/nxgP3l+t8dmGIaBiIhIB3pYXYCIiPg3BYWIiLiloBAREbcUFCIi\n4paCQkRE3FJQiIiIW14LiqqqKsaPH098fDyDBw9m2bJlAOTk5BAREYHD4cDhcLBp0ybnaxYtWkR0\ndDSxsbEUFxd7qzQREbkCNm+to6ivr6e+vp6kpCSam5sZOnQohYWFrF27ltDQUObOndvu+RUVFTz8\n8MPs2LGDmpoaUlNTOXjwID166KJHRMRKXvsU7tevH0lJSQD07t2bQYMGUVNTA4CrbFq/fj2ZmZmE\nhIQQGRlJVFQUZWVl3ipPREQ6ySe/rh85coTy8nJGjhwJwPLly0lMTCQ7O5tTp04BUFtbS0REhPM1\nERERzmARERHr9PL2D2hubuaBBx4gLy+P3r178/jjj/P8888D8NxzzzFv3jxWrVrl8rU2m61Tx0RE\n5PKudqTBq1cUZ8+eZerUqTz66KNMmjQJgLCwMGw2GzabjVmzZjm7l8LDw6mqqnK+trq6mvDwcJfv\naxhG0H698MILlteg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aCMzM9N45ZVX2j1eXl5u3HrrrUbfvn2NpKQkY9q0acZ1111nJCUlGfPn\nzzcMwzAWLVpkXHPNNca2bducr3N1rM3x48eNqKgo587B58+fNxITEw3DMIySkhLnPH+Hw2E0NTV5\nq+kineZXNy4S8aWdO3eyZs0aPvvsM86ePcsPf/hDhg0b1u45SUlJvPjii+zcuZNly5Zx9OhR9u3b\nR3l5OQDLli0jLCyMJ598kk2bNnHmzBkqKiouOZaamkpVVRX33nsvhw8f5pVXXuHmm28GoLy83Lmz\n6dKlS1mxYgU/+tGP+Oabb7jmmmt8+z9FxAUFhXRbpaWlTJkyhWuvvZZrr72W9PR0l1tOG4bhPH7x\n408++SRgjke88MILAKSmpl5yDGDAgAHs3r2buro6xo0bx4QJE4iKiqKoqIiJEycCMGrUKJ5++mke\neeQRpkyZEjD7C0lw02C2dFs2m63dB7+rkGh73uVcGAjujoG5GeSYMWP47LPPAHj//feZMGECAAsW\nLGDVqlWcOXOGUaNGceDAgcv+bBFvU1BItzV27FgKCwv59ttvaWpq4t1333UZChcGSGhoqHMzxytR\nU1PDmTNnADh58iTbt28nISGBr7/+mnPnzjlviPTFF18QHx/P/PnzGT58uIJC/IK6nqTbcjgcTJs2\njcTERMKkjb1tAAAApklEQVTCwhg+fLjLq4oL9/G/5ZZbGDVqFAkJCdxzzz2dvn/7/v37mTdvnvO9\nnn32WWJiYvjrX/9KWlqa83l5eXl89NFH9OjRg8GDBzu7pESspOmxIv+Wm5tL79693d68xtNmz57N\n7Nmz/XoLaxFdUYhcwNd3MWu7Ba6IP9MVhYiIuKXBbBERcUtBISIibikoRETELQWFiIi4paAQERG3\nFBQiIuLW/wOZ1ZDRj1PfyAAAAABJRU5ErkJggg==\n"
}
@@ -434,10 +417,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.7\n",
- "#Find the duct size(a) for the square duct if the head loss per foot remains the same for the pipe and the duct.\n",
"\n",
- "#given\n",
"T=120.0 #degree F\n",
"D=8.0 #in\n",
"vavg=10.0 #ft/s\n",
@@ -485,11 +465,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.8\n",
- "#Determine the pressure at point 1 if (a) all losses are neglected \n",
- "#(b) major losses are included (c) all losses are included.\n",
"\n",
- "#Given\n",
"T=60 #degree F\n",
"D=0.0625 #ft\n",
"Q=0.0267 #(ft**3)/sec \n",
@@ -630,10 +606,12 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEICAYAAABI7RO5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XlcVFX/wPHPiIgLCGqKGwkuqMgyI7ihIC6Ye64Ylkku\nZaZlmabV82RZqZVr9cvSx9Ay19Jc0sdMxp3HDSRxzSA3QNwXVAS+vz8mJghQNJgZruf9evGSO3OX\n73cu3jP3nHPP0YmIoCiKoiiFVMraASiKoigliyo4FEVRlAeiCg5FURTlgaiCQ1EURXkgquBQFEVR\nHogqOBRFUZQHUtraAeSk0+msHYKiKEqJZMknK2zujkNEEBHeeecd8+9a/NFyfiq3kvuj5fy0nJul\n2VzBkS0xMdHaIRQrLeenciu5tJyflnOzNJuqqsopMzOTFi1acOfOHdLT03nyySeZMmUKly5dYsCA\nAfzxxx+4u7uzfPlyXFxc8mzv7u5OxYoVsbOzw97enj179lghC0VRFO2x2TuOoUOHEhUVRWxsLHFx\ncURFRbFjxw6mTp1KaGgox48fp0OHDkydOjXf7XU6HUajkZiYGJssNCIiIqwdQrFRuZVcWs5Py7lZ\nmk6sUUFWAJ1Ol299XVpaGm3btiUyMpK+ffuydetWXF1dSU5OJiQkhKNHj+bZxsPDg3379lGlShVL\nhK4oimI1BV07i4vN3nEYjUaysrLQ6/W4urrSrl07mjRpQkpKCq6urgC4urqSkpKS7/Y6nY6OHTsS\nEBDAvHnzLBl6oRiNRmuHUGxUbiWXlvPTcm6WZrNtHAClSpUiNjaWq1ev8sQTTxAVFZ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Zg9ezaOjo6F2q+6q1WUB2ezBYfW+1xr\nOb/iys3dHXbsgKpVISAg99Pmd+/epW/fvjzzzDP06tWr0PusVasWp0+fNi+fPn2a2rVrF7i+ls8b\naDs/LedmaWrOcaVEcXAwDZL47bfQvj3MmAFt256iefPm3L17l7Nnz1KqVClefvllLl26xIABA/jf\n//7HyJEj2bhxIy4uLrn25+rqytatW/H09MTe3p4rV66wefNmK2WnKCWDmo9DKbEOHTIN0/7VVz/y\nzDO98PPzIysri+PHjzN79mw2btxIVFQUd+7coXTp0lStWpXff/+dc+fOMXz4cNavX09ycjIrV67k\n008/5e7du1y/fp1t27bRuHFja6enKIVm6WunKjiUEu2xx+DoUdO/2Xr16sWoUaMYNWoUW7duxdXV\nleTkZEJCQjh69Og999erVy9Gjx5Nhw4dijlyRSk6aiKnP2m9PlLL+Vkzt5y9qlJSUnB1dQVMVVIp\nKSmF3rYgWj5voO38tJybpdlswaEoD+rGjRv07duX2bNnmweOzHa/OVIepkeWojyqiryq6vTp0zz7\n7LOcP3+ZRvKCAAAgAElEQVQenU7H888/n6uh8o8//sDd3Z3ly5fnaahUVVXKg8quqnJ2vkv37t3p\n0qULY8aMAaBRo0YYjUaqV69OUlIS7dq1y7eq6u7dvNsqSklS4quq7O3tmTlzJvHx8URHR/P5559z\n5MgRpk6dSmhoKMePH6dDhw5MnTq1qA+tPKIWLRL69h1K48ZeuS78PXv2ZOHChQAsXLgw3266IsLQ\noUPx8vIqVKExZMgQXF1d8fHxMb928OBBWrVqha+vLz179uT69et5trt9+zYtWrRAr9fj5eXFxIkT\nHyZVRbENxT2myZNPPik///yzNGzYUJKTk0XENLZQzkmWsuUMR8vjyohoOz9L5rZsmUjnztsFdFKq\nlJ84OemlenW9fPjhBklMvCgdOnSQBg0aSGhoqFy+fFlERM6ePStdu3YVEZHt27eLTqcTPz8/0ev1\notfrZcOGDQUeb/bs2XLgwIFc46gFBATItm3bRERkwYIF8q9//SvfbW/evCkiInfv3pUWLVrI9u3b\ni+Q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IpEI7u7ukMlkFuU8Hg+9vb1ISEiA0WgEEWHnzp0AgJUrV2L16tXYtWsXSktLsWXLFoSEhMDN\nzQ0hISHQ6/UWdka+jo6ORlNTE6RSKZycnBAbG4v8/HwcOHAAb731FvLz8zEwMIDU1FQIhUILv3Jy\ncpCeno78/HzExsaOan/oJgeRSARnZ2dzNmVbz5+RSqWIj4+HUCiEh4cHBAIBZs2aZVWPx+PhxRdf\nhEwmg06nw5dffgknJycLuzweD0KhEJGRkdBqtfjoo4/g6ekJT09PtLa2YsmSJQAGB939+/fDzc3N\n5jka6e+T6hqp0dYfBT6fj+DgYJhMJhQVFT1zG0OvRSIRHBwcIBaLkZGRYXUL/dBNNnq9Ht7e3igq\nKoJSqRxV95PYY0xNWBJXxpTBYDDA2dkZDx48wMsvv4w9e/ZALBZb1MnIyIBKpcKyZcts2tm0aRNm\nzJiB99577992+R8RGRmJgoICBAcHT7QrDMZTwWZMjClDVlYWWlpaYDQaoVarrYLS08DWURiMfw82\nY2IwGAyGXcFufmAwGAyGXcECE4PBYDDsChaYGAwGg2FXsMDEYDAYDLuCBSYGg8Fg2BUsMDEYDAbD\nrvgfIHgLBUAjJl4AAAAASUVORK5CYII=\n"
}
@@ -652,10 +630,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.9\n",
- "# Determine the horsepower required to drive the system\n",
"\n",
- "#Given\n",
"T=140.0 #degree F\n",
"sw=53.7 #lb/(ft**3)\n",
"vis=8*10**-5 #lb*sec/(ft**2)\n",
@@ -698,6 +673,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAZwAAAEKCAYAAAAmfuNnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X1UVOe9L/DvIERjVUaIgpmhB2FmfAGEUXnJ6U0LEqAm\nV9QAAkmU+tJzRWtMlk1MmpMWs2rUJOY0MWjuTTWCPacYTaO2FYQYidYc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FREYxG\no4uj6hsvv/wyKisrYTKZkJeXh1mzZiE3N9fVYfWZb7/9Fg0Nbb8Xc+3aNRQWFg6q1aK+vr7w8/PD\n2bNnAQAffvghgoKCetx/SD2H05PB/nxOeno6Pv74Y9TW1sLPzw8vvfQSFi9e7Oqw+szx48fxm9/8\nRll6CgAbNmzAD3/4QxdH1jdqamqQkZEBu90Ou92OhQsXIjY21tVhOcRgu719+fJlzJ8/H0Db7afH\nH38c8fHxLo6qb23ZsgWPP/44bDYbAgMD8e677/a475CqpUZERK7DW2pEROQUTDhEROQUTDhEROQU\nTDhEROQUTDhELjZs2DAYjUYEBwcjLCwMr7/+eq8egnzzzTcxdepUPPHEE9i/fz+++OILJ0RLdOe4\nSo3IxUaPHq08q/H111/jsccew/e+9z1kZWXdtN+UKVNw+PBh3H///fjRj36EOXPmICkpyQkRE90Z\nJhwiF7sx4QBt9anCw8Nx5cqVHvssX74c7777LiZNmoS0tDRs3rwZnp6e8PT0xPvvv4+AgABnhE50\nW5hwiFysc8IBgLFjx+Ls2bMYN25cj/0mTpyIsrIyeHl5YfHixZgzZw4effRRR4dLdMf4HQ7RIMHP\njtTfMeEQ9TPnzp3DsGHDbjq76c5gKwtDgw8TDlE/8vXXX2P58uVYtWrVbfUbPXo0rl696qCoiPoG\nv8MhcjF3d3eEhISgubkZ7u7uWLRoEZ5++ulbzlgCAgJQWloKLy8vfPLJJ/jxj3+MESNGYM+ePVw0\nQP0SEw4RETkFb6kREZFTMOEQEZFTMOEQEZFTMOEQEZFTMOEQEZFTMOEQEZFT/H+gfiZjch3qYwAA\nAABJRU5ErkJggg==\n"
}
@@ -716,9 +692,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.10\n",
- "#Find the flow rate.\n",
- "#Given\n",
+ "\n",
"D=4.0 #in\n",
"l=20 #ft\n",
"n=4.0 #number of 90 degree elbows\n",
@@ -765,11 +739,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.11\n",
- "#What is the possible flowrate.\n",
- "\n",
- "#Given\n",
- "Pa=50.0 #hp\n",
+ " \n",
"D=1.0 #ft\n",
"l=300.0 #ft\n",
"f=0.02 #moody factor\n",
@@ -822,10 +792,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.12\n",
- "#What is the diameter of the pipe \n",
"\n",
- "#Given\n",
"roughness=0.0005 #ft\n",
"Q=2.0 #(ft**3)/sec\n",
"pd=0.5*144 #lb/ft**2 where pd=pressure drop\n",
@@ -868,6 +835,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEMCAYAAADXiYGSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X9cVGW+B/DPKKy/M/WlhgxJt0EZlV/KDxVRalVWWrlK\nudG1si7LZb3rupVlbbv3BtZWbNqN4tYlM1uvrnLrvq50DWdNl0khcRRJSvyB3pABRXHzByIKDM/9\n4ywjIyBnBs7MnJnP+/XyFTPznJnndHQ+nOc5z/dohBACREREPejn6g4QEZE6MDCIiEgWBgYREcnC\nwCAiIlkYGEREJAsDg4iIZFE0MAwGA4KDgxEUFISsrKxOr2/ZsgVhYWEIDQ1FbGwsysvLra8FBgYi\nNDQUERERiI6OVrKbREQkg0apdRgWiwUTJ07E7t274e/vj6ioKGzduhV6vd7aZv/+/Zg0aRKGDx8O\ng8GAjIwMlJSUAADuu+8+lJaWYuTIkUp0j4iI7KTYGYbJZIJOp0NgYCB8fX2RkpKC/Px8mzYzZszA\n8OHDAQAxMTGoqamxeZ1rComI3IdigVFbW4uAgADrY61Wi9ra2m7bb9iwAYmJidbHGo0Gc+fORWRk\nJNavX69UN4mISCYfpd5Yo9HIbltYWIiPP/4YxcXF1ueKi4vh5+eH+vp6zJs3D8HBwYiLi3P4M4iI\n6BZHRnAUO8Pw9/eH2Wy2PjabzdBqtZ3alZeXIy0tDZ9//jlGjBhhfd7Pzw8AMHr0aCx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mTBCzZs0Sjz32mFi7dq3N62VlZeLee+8Vo0ePFuHh4eLRRx8VgwYN\nEuHh4WL16tVCCCHeeOMNMWDAAFFUVGTdrqvn2tXX1wudTif++te/CiGEaGtrE2FhYUIIIYxGo7Ws\ndkREhGhoaFBq14lkcfuFe0TOUFpairy8PBw5cgQtLS2YOnUqIiMjbdqEh4djzZo1KC0txbvvvosz\nZ87g6NGjKCsrAwC8++67GDNmDFauXImdO3eiqakJFRUVnZ6bO3cuzGYzHnroIZw6dQpr1661rh4u\nKyuzVlBdt24d3n//fcyYMQPXr1/HgAEDnPs/heg2DAwiAPv27UNycjIGDhyIgQMHIikpqcuy1kK6\nh4z1545WrlwJQJqveOWVVwAAc+fO7fQcAAQEBKC8vBznzp3DnDlzMH/+fOh0OhgMBixYsAAAEBsb\ni2effRZLly5FcnKyqmo0kWfipDcRpAqdHQOgq7Bob9eTjsFwp+cAwM/PD3FxcThy5AgA4Msvv8T8\n+fMBAC+++CI2bNiApqYmxMbG4sSJEz1+NpGSGBhEAGbPno3t27fjxo0baGhowI4dO7oMh45BMmzY\nMDQ0NNj9WbW1tWhqagIAXLp0CcXFxQgJCcGVK1fQ2tpqvSHT6dOnMXnyZKxevRpRUVEMDHI5DkkR\nAYiIiMDjs3s6AAAAuUlEQVSjjz6KsLAwjBkzBlFRUV2eZWg0GmuQjBo1CrGxsQgJCUFiYiKysrJk\nfdaxY8ewatUq63u9/PLLmDBhAj777DPMmzfP2i47OxuFhYXo168fpkyZYh2qInIVXlZL1IXMzEwM\nHToUq1atctpnpqWlIS0tDdHR0U77TCJ78AyDqBvOvnPc+vXrnfp5RPbiGQYREcnCSW8iIpKFgUFE\nRLIwMIiISBYGBhERycLAICIiWRgYREQky/8DJ45fQDgxC4EAAAAASUVORK5CYII=\n"
}
@@ -886,9 +854,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.13\n",
- "#find the diameter of pipe.\n",
- "#Given\n",
+ "\n",
"T=60.0 #degree F\n",
"kvis=1.28*(10**(-5)) #(ft**2)/sec\n",
"l=1700.0 #ft\n",
@@ -955,10 +921,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.14\n",
- "#Determine the floerate into and out of each reservoir.\n",
"\n",
- "#Given\n",
"D=1 #ft\n",
"f=0.02\n",
"z1=100 #ft\n",
@@ -1018,9 +981,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 8.15\n",
- "#Find the diameter of nozzle.\n",
- "#Given\n",
+ "\n",
"D=60.0 #mm\n",
"pdiff=4 #kPa\n",
"Q=0.003 #(m**3)/sec\n",
diff --git a/Fundamentals_of_Fluid_Mechanics/Ch_9.ipynb b/Fundamentals_of_Fluid_Mechanics/Ch_9.ipynb
index d49580cc..1920fc56 100644
--- a/Fundamentals_of_Fluid_Mechanics/Ch_9.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/Ch_9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Ch 9"
+ "name": "",
+ "signature": "sha256:06a8229032f3641da086be083528411370ee7c42af377d79bce74559722d5125"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.1\n",
- "#Determine the lift and drag on the plate.\n",
"\n",
- "#Given\n",
"U=25.0 #ft/sec\n",
"p=0 #gage\n",
"b=10.0 #ft\n",
@@ -76,12 +74,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.5\n",
- "#At what location boundary layer become turbulent\n",
- "#and how thich it is formed if the fluid is \n",
- "#(a)water (b) air (c) glycerin\n",
"\n",
- "#Given\n",
"U=10.0 #ft/sec\n",
"Twater=60.0 #degree F\n",
"Tglycerin=68.0 #degree F\n",
@@ -163,10 +156,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.7\n",
- "#Find the drag force.\n",
"\n",
- "#given\n",
"T=70.0 #degree F\n",
"U1=0.0 #ft/sec\n",
"U2=30.0 #ft/sec\n",
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D39+f6dOnc+7c\nOfz9/Zk2bRoAMTEx9OrVC4Dp06fTrl072rdvz+uvvw5AjRo1qFu3LidOnNDtnIQoYLbFS4SwNnv3\n7qVDhw4A+Pn5MXPmTGJjY5k/fz4XL17kxIkTHDlyxLj9li1bGDx4MDdu3GDdunXEx8cDcPv2beM2\ngYGB7N69m3bt2lXuyQjxJ9KzFzanpJLNg0o5v/32m3FOI9Bewy9457C4dw/37dtHt27dqFmzJq6u\nrowdO5a1a9cap6MFaNSoEQkJCeU4CyFMS5K9sDl169bl5s2bhb5248YN6tWr98B9703q97s5nD9/\nnqZNm+Lk5ISTkxMHDx5kyJAhbNy4kb59+xY6nrXPJilsgyR7YXPc3Nxo2LChcRrYlJQUvv/+e7p1\n63bf/Zo3b26cRRAKJ/4aNWoYJ7cDrYQTHh4OaJPd3bp1i/DwcP71r39x7Ngx43ZJSUl4eHiY4rSE\nqBCp2Qub9MUXXzBp0iSmTJkCaEMvW7Rocd99unbtaly/FArPEV63bl26du2Kj48P4eHhxMfHs2DB\nAgDS0tIYOHAg2dnZKKWYN2+e8RgHDx7kww8/NPXpCVFmMhGaEPfo3bs3y5cvL1S7/7OcnBy6dev2\nwPnRU1NTCQkJ4dChQ6YOU4gyk2QvxD02b97MTz/9xIwZMyp8rPnz51OnTh1GjBhhgsiEqBhJ9kII\nYQfkAa0QQtgBSfZCCGEHJNkLIYQdkGQvhBB2QJK9EELYAUn2QghhB/4/X5n9xhZ8YLYAAAAASUVO\nRK5CYII=\n"
}
@@ -245,10 +236,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.10\n",
- "#Find the velocity of the particle through still water.\n",
"\n",
- "#given\n",
"D=0.1 #mm\n",
"sg=2.3\n",
"vis=1.12*(10**(-3)) #N*s/(m**2)\n",
@@ -286,6 +274,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAZYAAAEMCAYAAADnBZCzAAAABHNCSVQICAgIfAhkiAAA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+PCIiIrB8+XJcv34dX375Jfr06YOpU6eaAtlPP/2EVatWISsrC/v27UNcXJzpc4tqa2sxcuRI\nFBcXSzp3otZixkLUBkFBQTAajTh79myzbYxGI44ePYrQ0FDT944cOYLMzEycOHEC69atw+nTp1Fc\nXIwZM2Zg+fLlpnZ6vR579+7Fe++9B7VajXnz5uHYsWMoLS3F4cOHAdz8mO5z587h6tWr0k2UqA0Y\nWIgkcu7cOXTq1KnR92JjY+Hn54eOHTtCoVAgISEBABAZGYmKigoAN4v+jRw50vT9nj17IiIiAjKZ\nDBEREaZ2wM3gcnsdJyJnwMBC1Abff/89OnTogO7du5ttd+eVZm9vb9PXHh4eptceHh6or683/axj\nx453tWmqnRBCkv0bImswsBC10tmzZ/H8889jzpw5Ztt169YNV65ckXQstbW1Ll2lm9yTp6MHQOQK\nfvnlF0RHR6Ourg6enp6YMmUK5s6da7ZPhw4dEBkZiZMnT+Lhhx+GTCZrNru482fNfX3765qaGnTt\n2hU+Pj5tnRaRJHhXGJGE1qxZg9raWsyfP9/mx/7oo49w9erVFgMckb0xsBBJyGAwYMiQIdi5c6fN\n90IGDx6MnJwcl/70T3JPDCxERGRT3LwnIiKbYmAhIiKbYmAhIiKbYmAhIiKbYmAhIiKbYmAhIiKb\n+n+kDMLwirooewAAAABJRU5ErkJggg==\n"
}
@@ -304,10 +293,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.11\n",
- "#Find the velocity of the updraft needed\n",
"\n",
- "#Given\n",
"D=1.5 #in\n",
"#assuming CD=0.5 and verifying this value using value of Re\n",
"CD=0.5\n",
@@ -343,10 +329,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.12\n",
- "#Determine the drag on a standerd golf ball, a smooth ball and a table tennis ball.\n",
"\n",
- "#Given\n",
"Dg=1.69 #in.\n",
"Wg=0.0992 #lb\n",
"Ug=200 #ft/sec\n",
@@ -416,10 +399,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.13\n",
- "#Determine the moment needed to prevent the tower from tripping\n",
"\n",
- "#Given\n",
"U=88 #fps\n",
"Ds=40.0 #ft\n",
"Dc=15.0 #ft\n",
@@ -465,12 +445,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.15\n",
- "#Determine the lift coefficient and \n",
- "#The power required by the pilot.\n",
"\n",
- "\n",
- "#Given\n",
"U=15 #ft/sec\n",
"b=96 #ft\n",
"c=7.5 #ft\n",
@@ -513,10 +488,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 9.16\n",
- "#Find the angular velocity.\n",
"\n",
- "#Given\n",
"W=2.45*(10**(-2)) #N\n",
"D=3.8*(10**(-2)) #m\n",
"U=12 #m/s\n",
diff --git a/Fundamentals_of_Fluid_Mechanics/ch_1.ipynb b/Fundamentals_of_Fluid_Mechanics/ch_1.ipynb
index 5e1ad5e6..7ceb7896 100644
--- a/Fundamentals_of_Fluid_Mechanics/ch_1.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/ch_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch 1"
+ "name": "",
+ "signature": "sha256:3309ad2ee40727e875382d56c1e718ac3ce9fa3af9889cece7627a293ed3a4ad"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -135,6 +136,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEMCAYAAAAvaXplAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlYldX6//H3VklPaWmpqeCUoIATs5VpWBmpiVN9I1Mb\nzMzyV3Y6J8/pdE7St0wqz8k0y8ohs5DMjlgqqRk5iwNaZikpJOKU8xDKtH5/PLW/IqIIbB725vO6\nLq7Lvffaz76X5b6513rWWg5jjEFEROQc1ewOQEREKh8lBxERKULJQUREilByEBGRIpQcRESkCCUH\nEREpwqXJISkpCX9/f/z8/IiLiyvyenJyMtdccw3Bw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5gc9u3bR/PmzcupJyLlS8lBqrQ2bdrw9ttvExgYyPHjxxkxYsRF299yyy1s2LCh0HO1atUiJCSE\nJ554gqlTpwIwYcIE2rdvT8eOHbniiivo0aMHULhSSUlJoWvXruXcI5HyoVtZpcrKyMigd+/efP/9\n9yV+zx+3sq5bt44rrriCbt26MX78eEJCQi7783Urq1RmqhykSrvcMX+Hw8GwYcP4+OOPy/S53333\nHb6+vkoMUmmpchARkSJUOYiISBFKDiIiUoSSg4iIFKHkICIiRSg5iIhIEUoOIiJSxP8HeWG9fzQs\n0EsAAAAASUVORK5CYII=\n"
}
@@ -298,6 +300,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAELCAYAAADOeWEXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xt0FGWe//F3J9yCsCgIuCNECIZ0IrcASYebCahcxBDk\nYhJHcQl4MMxMBp1ddUd2xPEcUdSRy/wIqBNnR3FAwVnCNQJug5msnXAzCgkgiFFEgqASIMil6/dH\nSwMSSLpJd3V3Pq9zOJBOVedbz9H6pOqp59sWwzAMRERE6ijM7AJERCS4KDhERMQjCg4REfGIgkNE\nRDyi4BAREY8oOERExCM+C46srCzat29P9+7d3a9VVVWRlpZGZGQko0eP5vjx4+7vzZ07l+joaOLi\n4igsLHS/XlZWRu/evYmKiuKpp57yVbkiIlJHPguOiRMnsnbt2ktey83NJTIykj179tChQwcWLFgA\nQGVlJfPnz2fDhg3k5uaSk5Pj3ud3v/sdTzzxBCUlJWzcuJHNmzf7qmQREakDnwXHoEGDuOGGGy55\nrbi4mEmTJtG0aVOysrJwOBwAOBwOhg8fTmRkJMnJyRiG4b4a2bVrF+np6bRp04YxY8a49xEREXP4\ndY6jpKQEq9UKgNVqpbi4GHAFR2xsrHu7mJgYHA4Hn332Ge3atXO/HhcXx0cffeTPkkVE5Gca+fOH\nedLdxGKxeLR/TduLi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nwUycOJH777+/xm0++OAD94cmAURFRXHjjTfy5JNPXnEfkUCn4BC5BpmZmXzyySeX3KY6P19x+PBh\nmjVrxnXXXXfZPrt27WLMmDGXvK55DgkWehxXxEcWLVrEgQMHePzxx80uRaReKThERMQjulUlIiIe\nUXCIiIhHFBwiIuIRBYeIiHhEwSEiIh5RcIiIiEf+P2S92/Nie9kJAAAAAElFTkSuQmCC\n"
}
@@ -363,8 +366,7 @@
"collapsed": false,
"input": [
"#Example 1.8\n",
- "#calculate minimum required tube diameter.\n",
- "#Given\n",
+ "\n",
"T=20 #degree celcius, Temprature\n",
"h=1 #mm, height\n",
"\n",
@@ -401,6 +403,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEMCAYAAADeYiHoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHIhJREFUeJzt3X9wVOW9x/FPQggKRIEENgqU2ISYXwQIAhd7lUUaGLiG\npmhRtJqCaKdcVLx2ItNbNdx6JWg7XCu19tq5TGq9IuqIQJEBRxYVQfRCiZCEIBAJmCxgEuWHkB/s\n/eM0kYQT2E1295zdfb9mMobN7p4vZ475cJ7n+T4b5fF4PAIAoINoqwsAANgTAQEAMEVAAABMERAA\nAFMEBADAFAEBADAVsICYO3euHA6HRowY0fZYXV2dcnNzlZqaqilTpqihoaHtZ0uWLNHw4cOVlpam\njRs3BqosAICXAhYQc+bM0YYNG9o9VlxcrNzcXFVWVmry5MkqLi6WJJWVlem1115TWVmZNmzYoPnz\n5+v8+fOBKg0A4IWABcRNN92k/v37t3tszZo1KigokCQVFBRo9erVkqS3335bs2fPVs+ePZWUlKSU\nlBTt2LEjUKUBALwQ1DkIt9sth8MhSXI4HHK73ZKkL7/8UkOGDGl73pAhQ3T06NFglgYA6CDGqgNH\nRUUpKirqkj/35jEAwOV1ZVeloN5BOBwO1dbWSpJqamo0aNAgSdLgwYNVXV3d9rwjR45o8ODBp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\n279/vxYsWKA9e/aoX79+evPNNy/5/K1btyonJ6ftz1FRUWpoaNC2bdu0bNkyzZgxQ4WFhdq7d68+\n++wzlZaWSpLOnDmjyZMna8+ePYqLi9MTTzyh9957T2+99ZaeeOKJtvcbN26c3n///cD8ZQEf2a6T\nGgim6667TtnZ2ZKkMWPGqKqq6pLPP3z4sK655pp2j+Xl5UmSsrKylJiYqMzMTElSZmamqqqqlJ2d\nrdjYWE2dOlWSNGLECF1xxRXq0aOHsrKy2h3zmmuuuWwNQLBwB4GI1qtXr7bve/Tooebm5su+puPm\nA7GxsZKk6Ojodu8XHR3d9n49e/Zs9/iFr7nwmB6Ph91fYRsEBOCDYcOGqba2NmDvX1NTo2HDhgXs\n/QFfEBCIaB3/tX65f73/4Ac/0M6dOzt9TWevv9RxLvx+x44duvnmmy9dNBAkbNYH+OiWW27RK6+8\nctFchD84nU6tWrVKgwYN8vt7A77iDgLw0S9/+Uu9+OKLfn/f0tJSpaSkEA6wDe4gAACmuIMAAJgi\nIAAApggIAIApAgIAYIqAAACYIiAAAKb+H6kHdza7C9VRAAAAAElFTkSuQmCC\n"
}
diff --git a/Fundamentals_of_Fluid_Mechanics/ch_10.ipynb b/Fundamentals_of_Fluid_Mechanics/ch_10.ipynb
index 8a36a3c6..8ed43887 100644
--- a/Fundamentals_of_Fluid_Mechanics/ch_10.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/ch_10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch 10"
+ "name": "",
+ "signature": "sha256:9eaab2b896a6bb6c961934db80d46f26a50e6de94b234af0dcf8aaeaefc72384"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -48,8 +49,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.2\n",
- "#Determine the surface elimanation downstrean of ramp.\n",
"\n",
"#Given\n",
"z2=0.5 #ft\n",
@@ -95,6 +94,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAA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Y86cOTh16pSMFRJ5\nH4OBqA8DCYaTJ0/innvuQXt7O3Q6HcaPHw+TyYTx48fj7rvvxtq1a2Wulsg7GAxEfQgODsaECRNc\nr1euXIkFCxb02v7tt9/G8ePH8frrr+Obb77B7NmzOWIgv6Oalc9EanTNNdfAarW63V4Q73Hiek7k\nj3jymciL1LhDLdFAMRiIvKjrKGGgJ66J1ILBQNSH9vZ2yeWqK1eu7LO9RqNxjRquu+463HnnnZgw\nYQKeeeYZX5RL5BU8+UxERBIcMRARkQSDgYiIJBgMREQkwWAgIiIJBgMREUkwGIiISOL/Ac1RMOrb\n1MD8AAAAAElFTkSuQmCC\n"
}
@@ -113,8 +113,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.3\n",
- "#Find the flowrate and Froude NO.\n",
"\n",
"#Given\n",
"y=5.0 #ft\n",
@@ -165,10 +163,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.4\n",
- "#Find the depth of flow.\n",
"\n",
- "#Given\n",
"y=5 #ft\n",
"angle=40 #degree\n",
"l=12 #ft\n",
@@ -220,8 +215,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.7\n",
- "#Find the flowrate at given value of y\n",
"\n",
"#Given\n",
"S0=0.002\n",
@@ -279,14 +272,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.8\n",
- "#Find the aspect ratio for the best hydrolic section.\n",
"\n",
- "#A=b*y\n",
- "#p=b+2*y\n",
- "#Q=K*A*(Rh**(2/3))*(S0**0.5)/n\n",
- "#dA/dy=0\n",
- "#from the above, we get\n",
"aspratio=2 #asp ratio=aspect ratio=b/y\n",
"\n",
"#result\n",
@@ -335,10 +321,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 10.9\n",
- "#Determine the depth after the jump\n",
- "#The Froude no. before and after the jump.\n",
- "#and the power dissipated within the pump.\n",
"\n",
"#Given\n",
"w=100 #ft\n",
@@ -382,6 +364,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEMCAYAAADTfFGvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X1UVXWixvHvQbBMxdQS9KCSguLxBTQlLfVihiUFY6UU\nvVGaTdnMlGu6TbeZu9JmraRp1p1xaryrZdawelmo41zhpnLNmdDyDcvURkzJQAGBxpR8LQT2/WPn\nCVTkHODsfc7h+azFGoV9js+22edx//bvt7fDMAwDERERD4XYHUBERAKLikNERLyi4hAREa+oOERE\nxCsqDhER8YqKQ0REvOKz4pg9ezYRERGMHDnS/b1jx46RnJzMkCFDmDZtGjU1Ne6fLVq0iNjYWOLi\n4li/fr37+59++ikjR44kNjaWp556yldxRUTEQz4rjkceeYT8/Pwm38vKyiI5OZkDBw4wdepUsrKy\nACgqKmL58uUUFRWRn5/PvHnzOL+85IknnmDZsmUUFxdTXFx80XuKiIi1fFYckyZNomfPnk2+l5eX\nR2ZmJgCZmZmsXr0agNzcXDIyMggLCyM6OpqYmBi2b99OZWUlJ0+eJDExEYCHHnrI/RoREbGHpdc4\nqquriYiIACAiIoLq6moAjhw5QlRUlHu7qKgoKioqLvq+0+mkoqLCysgiInKBULv+YIfDgcPhaNf3\nExER73l75ylLzzgiIiKoqqoCoLKykj59+gDmmURZWZl7u/LycqKionA6nZSXlzf5vtPpbPb9DcPw\n+68XXnjB9gzBkjMQMiqncvr7V2tYWhxpaWlkZ2cDkJ2dzYwZM9zfz8nJoba2lpKSEoqLi0lMTCQy\nMpLw8HC2b9+OYRi8/fbb7teIiIg9fDZUlZGRwcaNGzl69Cj9+/fnxRdf5LnnniM9PZ1ly5YRHR3N\nihUrAHC5XKSnp+NyuQgNDWXJkiXuoaclS5bw8MMPc/bsWVJSUrjtttt8FVlERDzgMFp7ruJnHA5H\nq0+7rFRQUEBSUpLdMVoUCDkDISMoZ3tTzvbVms9OFYeISAfWms9O3XJERES8ouIQERGvqD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3tIZh4iPdOvWjSlTpvDhhx+2uO3777/PzJkzVRoS\nEHTGISIiXtEZh4iIeEXFISIiXlFxiIiIV1QcIiLiFRWHiIh4RcUhIiJe+X/W0eKMLsKjQwAAAABJ\nRU5ErkJggg==\n"
}
diff --git a/Fundamentals_of_Fluid_Mechanics/ch_11.ipynb b/Fundamentals_of_Fluid_Mechanics/ch_11.ipynb
index 970f9f37..84863f93 100644
--- a/Fundamentals_of_Fluid_Mechanics/ch_11.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/ch_11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch 11"
+ "name": "",
+ "signature": "sha256:f42944f5597b07b987f9572f10e4c9b04463b79fa1fecfbff1f6c9ad9b576c2b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.1\n",
- "#find the change in internal energy ,enthalpy and density between point 1 and 2\n",
- "#Given\n",
+ "\n",
"D=4.0 #in\n",
"T1=540.0 #degree R\n",
"p1=100.0 #psia\n",
@@ -77,9 +76,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 11.2\n",
- "#Find change in entropy between point 1 and 2.\n",
- "#Given\n",
+ "\n",
"D=4.0 #in\n",
"T1=540.0 #degree R\n",
"p1=100.0 #psia\n",
@@ -119,10 +116,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.3\n",
- "#Find the speed of sound for air at 0 degree C\n",
"\n",
- "#Given\n",
"T=0 #degree C\n",
"R=286.9 #J/(kg*K)\n",
"k=1.401\n",
@@ -177,10 +171,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.4\n",
- "#determine the number of seconds to wait after the plane passes over-head before it is heard.\n",
"\n",
- "#given\n",
"z=1000 #m\n",
"Ma=1.5\n",
"T=20 #degree C\n",
@@ -219,6 +210,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSU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oihmKomIiJSBwUBERBYYDEREZIHBQEREFhgMRA7w8PDA/Pnzza+bm5vRv39/zJgxQ8aqiKTB\nYCBygJ+fH06dOoWGhgYAwMGDB6HRaBR5xThRVzEYiBwUHx+Pffv2AQC2bduGuXPnWlzc9Jvf/AbR\n0dGIjY3FuXPn5CyVqEsYDEQOeuyxx5CWloZr167h5MmTFjeoCw8Px7Fjx1BQUIDU1FS8+uqrMlZK\n1DWKufKZSOlGjx6N4uJibNu2DdOnT7d4r6amBgsWLMD58+ehUqnMV3ATuSKOGIg6ITExES+88ILF\nNBIA/O53v8OUKVNw8uRJ7Nmzx7wWQeSKOGIg6oSFCxeiT58+GDVqlMUtmGtrazFo0CAA4LPLyeVx\nxEDkgBvxp8WAAAAATklEQVRnH6nVaixbtsy87cb2l156CStXrkR0dDRaWlp4thK5NN5Ej4iILHDE\nQEREFhgMRERkgcFAREQWGAxERGSBwUBERBYYDEREZOH/A5kK4I52RzdaAAAAAElFTkSuQmCC\n"
}
@@ -237,11 +229,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- " #Example 11.5\n",
- "# Determine The mass flowrate through the ducf the reciever pressure\n",
- "#(a) 80kpa (b) 40 kpa\n",
- " \n",
- "#Given\n",
+ " \n",
"A=1*(10**(-4)) #m**2\n",
"p1=80.0 #kPa(abs)\n",
"p2=40.0 #kPa(abs)\n",
@@ -292,10 +280,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.6\n",
- "#Find the mass flow rate\n",
"\n",
- "#Given\n",
"A=1*(10**(-4)) #m**2\n",
"p1=80 #kPa(abs)\n",
"p2=40 #kPa(abs)\n",
@@ -351,9 +336,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.7\n",
- "#Find the flow velocity if fluid is air\n",
- "# if fluid is helium\n",
"\n",
"#Given\n",
"pratio=0.82 #ratio of static to stagnation pressure\n",
@@ -402,9 +384,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Exampl 11.11\n",
- "#The corrosponding value of temperature for Fanno for downstream pressure of 7psia\n",
- "#and entropy change .\n",
+ "\n",
"\n",
"#Given\n",
"k=1.4 \n",
@@ -476,10 +456,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.12\n",
- "#What is the maximum mass flow rate through the duct for this rate\n",
- "#determine the static temprature ,static pressure, stagnation pressure and temprature\n",
- "#and velocity at inlet and exit.\n",
+ "\n",
"\n",
"#Given\n",
"T0=288 #K\n",
@@ -610,6 +587,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEMCAYAAAAvaXplAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XlclNX+wPHPoLigaGoKCAYiCA67LC6Jgss1953CME3s\n3jT1es3Mym567aqlZZh5NTP3tcylTFMTcknDBdTExAUUEDVxAdxQOL8/yOcHAirKMAN+368Xr+SZ\n85z5zjTzfDnnPOccnVJKIYQQQuRhZuwAhBBCmB5JDkIIIQqQ5CCEEKIASQ5CCCEKkOQghBCiAEkO\nQgghCjBYcrh16xbNmjXD29sbvV7PO++8A8Dly5fp0KEDjRs35m9/+xtXr17VzpkyZQrOzs64urqy\nZcsWQ4UmhBDiIXSGnOdw48YNLCwsuHv3Lq1atWL69Ols2LCBZ599lrFjx/LRRx9x5coVpk6dSlxc\nHP3792ffvn2kpKTQvn174uPjMTOTxo0QQpQ2g155LSwsAMjKyiI7O5tatWqxYcMGBg4cCMDAgQNZ\nt24dAOvXryc0NBRzc3McHBxwcnIiOjrakOEJIYQogkGTQ05ODt7e3lhZWREcHIybmxsXLlzAysoK\nACsrKy5cuADAuXPnsLOz0861s7MjJSXFkOEJIYQoQkVDVm5mZkZsbCzXrl2jY8eOREZG5ntcp9Oh\n0+mKPL+wxx5UXgghRNGKM4pQKh36NWvWpEuXLhw4cAArKyvOnz8PQGpqKvXq1QPA1taWpKQk7Zzk\n5GRsbW0LrU8pV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+SKXS5D9j9fT0IBKJoKqqClqtFlqtFn6/\nP6dafD4/2eXyq729PSgUCgB/AqCiogIOhwMzMzM4ODgAAHR0dCTvibhcLjw/P/9Yq6CgAGtra7i5\nuYHJZEo5Xz6fn9P6CcmEwoHklWAwCJlMBrFYDIvFgtnZ2bQ5+/v7EIlEkEgksNlsmJiYAAAYDAbw\neDy8vr6Cx+Nhbm4uY62mpiaEw+HkdjweB4vFQiwWA5vNRklJCYB/e+dXV1fD4XBAr9fD6/XCZDIl\nu5JubGyAw+F8+zPav1cGLBYLdrsddrsdVqsVAODxeCCXy3N7swjJgBrvEfILGo0GOp0OMpkMk5OT\nEAgEKCsrw+PjIwwGQ8bXvr+/g8lkgslk4vT0FHq9Pu1rp0wSiQQkEgkuLi5QWFj421MhJAWFAyG/\nEAqFMD8/j6enJ8TjcWxtbWX9EN3t7S2GhoaQSCRQVFQEq9WK5ubmrGvb7XYEAgEYjcZcl0/Ijygc\nCCGEpKF7DoQQQtJQOBBCCElD4UAIISQNhQMhhJA0FA6EEELSUDgQQghJ8w92HfCDcvY+zwAAAABJ\nRU5ErkJggg==\n"
}
@@ -628,8 +606,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.13\n",
- "#Find the flowrate for the smaller tube \n",
"\n",
"#Given\n",
"T0=288 #K Temprature\n",
@@ -688,9 +664,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.14\n",
- "#find The Mach number at the exit.\n",
- "#and The back pressure required.\n",
"\n",
"#given\n",
"T0=288 #K\n",
@@ -744,11 +717,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.15\n",
- "#The corrosponding value of temperature for the downstream pressure of 13.5 psia\n",
- "#and change in entropy for the downstream pressure of 13.5 psia.\n",
"\n",
- "#given\n",
"k=1.4 \n",
"T0=518.67 #degree R\n",
"T1=514.55 #degree R\n",
@@ -794,6 +763,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAA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HPSMZ7IuHHjCA8P\nJy4ujujoaN59913PbWPGjGHFihV18joSWJREJCBdffXVp1wT6cknn2TkyJEAuN1uXC4X69atY9Cg\nQUycOLHGx53siuf09HT69+/v1WNPhsvlYsyYMbjdbubNm8dtt93muW3kyJE8+eSTdfZaEjiURKTB\n2rdvH1deeSWxsbFER0d79p85WlFREb/5zW88375XrlwJQHx8PKGhoSf9WgcOHODTTz+le/fufP/9\n9wwZMoQ1a9YQFxfHoEGDKC0tJS4ujqFDh57wecrLyxkyZAhRUVFcf/31lJaWAnZhYHZ2NnFxcccV\nxvvwww/p3r07HTp04P333wfg1VdfJSUlhb59+3LRRRfx/PPP89RTT/HrX/+aSy+9lN27d1f7+oef\nu127dgQFBbF9+3YAIiMj2bJli2dhmsjJUhKRBis9PZ2wsDCys7PZsGED/fr1O+4+b775Jv369cPt\ndrN+/XpPVdtT5Xa76dChA2DLhsyYMYNevXrhdrt56623OOuss3C73cyaNeuEz/Pll1/y5z//mZyc\nHIKDg5k2bZrn+WNiYo67vzGGb7/9ljVr1vD+++9z++23c+DAAQA2bdrEvHnzWLNmDQ8++CDBwcGs\nW7eOSy+9lNdee+2EcWRlZXHaaadx/vnne47FxcXxySefnNL7IqIkIg1W165dWbp0Kffffz8rV64k\nODj4uPt0796dV155hfHjx7N+/XqaNWvm1Wt9++23tGrVyvNvb9fotm7dmksvvRSAIUOGeFpG6enp\nDBgw4Lj7u1wuBg0aBNjWw8UXX8wXX3yBy+Wid+/e/OIXv+D888+nefPmXHXVVQBER0ezZcuW457L\nGMMzzzxDly5dSEhIOG6H0AsuuKDax4mciJKINFiRkZG43W6io6P529/+xmOPPcbq1auJi4sjLi6O\nhQsX0qtXL1asWEFYWBjDhw//2ZZCTVwul9eJ49jnOcwY4/n30qVL6du373H3OdFznHHGGZ5jTZo0\n8fy7SZMmlJeXV/u4MWPGsHHjRubNm8e4ceOqnNPR8YicLCURabCKioo488wzufHGG7nnnntYt24d\n8fHxuN1u3G43v//97/nuu+/41a9+xS233MItt9yC2+326rUuvPDCKkXrjhUUFFTtB/exvvvuOz79\n9FMAZs+eTa9evfjhhx8oLy+vdrMgYwxvv/02xhi+/vprvvnmGzp27HjChHYyt1111VW0adOGN998\n03NbUVERERERP3sOIkdTEpEGa8OGDSQkJBAXF8djjz3GQw89dNx9MjIyiI2N9UzFHT16NAD33nsv\nrVu3prS0lNatW/Poo4+e8LViYmL48ssvPf8+dg+K2267ja5du1Y7sH70/Tp06MALL7xAVFQUP/zw\nA7fffjtLly4lKSmp2ud2uVy0adOG+Ph4BgwYwPTp0zn99NOPe/1jf6+pRXH08YcffpgJEyZ4/u12\nuz1dbSInSwUYRU7S8OHDGTlyJAkJCXX6vLfeeiu33nqroyXHN2/ezD333MOCBQsci0EaJiURkZO0\nceNGpkyZwiuvvOJ0KHVuzJgxXHvttfTs2dPpUKSBURIRERGvaUxERES8piQiIiJeUxIRERGvKYmI\niIjXlERERMRrSiIiIuK1/w8VnHZxfGG+nwAAAABJRU5ErkJggg==\n"
}
@@ -812,9 +782,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.18\n",
- "#What is the Mach number for the flow\n",
- "#and The velocity of the flow.\n",
"\n",
"\n",
"#Given\n",
@@ -865,11 +832,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 11.19\n",
- "#Find The ratio of back pressure to inlet stagnation pressure that will result in a normal shock at the exit of the duct\n",
- "#The value of back pressure to inlet stagnation pressure required to position the shock at (x=0.3 m)\n",
"\n",
- "#Given\n",
"x1=0.5 #m exit of duct\n",
"x2=0.3 #m entring of duct\n",
"Acritical=0.1 #m**2 area\n",
@@ -1021,10 +984,12 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEsCAYAAADdO/TjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XtcjOn/P/DXRE4rsjqgrGGLDtM0o0iISWEpZ0LC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O+o+1bvPPOO9BoNC+VA2NdwYWC6RSpVAq1Wg2ZTIbQ\n0FBs374d2dnZUCgUUCgUOHLkCFQqFbKysmBqaooVK1bgwIEDLzWWSCTqdGI/fvw4ZsyYISy/8cYb\nOHr0KGJiYvDTTz91uI22hyRo256I+u0TT1n/wI8ZZzqltLQUo0ePxvLly2FoaIj9+/djy5YtUKvV\nQp/CwkKYmppi1apVePbsGdRqNXx9fbs9lqWlpfBkzn9KT0/Hpk2b2rQZGRkhNTUVbm5ueOutt+Dl\n5QUDAwNkZ2fD2dkZiYmJWsfraPuWnN3c3LodP2Ndxd8omE7Jzc2FUqmEQqHA9u3bsWXLlnZ9MjMz\nIZfLMXHiRCQnJ+Ozzz4DAISEhMDc3Bx1dXUwNzfHtm3btI7l6OiIW7duCcsNDQ0YOnQoKioqMGzY\nMIwYMUJY1/KJXyKRICUlBf7+/rh8+TL279+P1atXQ6FQ4OnTp53eCdXZ9kDztRIXF5duHCXGuocf\nCsjYK1ixYgUCAwOhVCoRFBQEW1tbGBgYoLi4GCEhIf+6fW1trVBQIiMjUV5ejq+//rrL4+fn5yM4\nOBgpKSkvnQNj/4YLBWOv4Pr169i1axfKy8vR0NCAX375pVs/2EtOTkZERASeP38OiUSC+Ph4jB07\ntsvbr1+/HgsWLICrq+vLhM9Yl3ChYIwxphVfo2CMMaYVFwrGGGNacaFgjDGmFRcKxhhjWnGhYIwx\nphUXCsYYY1r9F/d10F9PEo61AAAAAElFTkSuQmCC\n"
}
diff --git a/Fundamentals_of_Fluid_Mechanics/ch_12.ipynb b/Fundamentals_of_Fluid_Mechanics/ch_12.ipynb
index 9c63bf6a..a1cf658f 100644
--- a/Fundamentals_of_Fluid_Mechanics/ch_12.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/ch_12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch 12"
+ "name": "",
+ "signature": "sha256:d4c30c3f1179130d9050291ca136a3ec0046b1e377436eb27fedfb1795ff1644"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.2\n",
- "#Find The ideal head rise\n",
- "#and Tangential velocity component and The power transferred to the fluid.\n",
"\n",
- "#Given\n",
"Q=1400.0 #gpm, water rate\n",
"N=1750.0 #rpm speed\n",
"b=2.0 #in height of blade\n",
@@ -82,10 +79,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.3\n",
- "#Find the maximum height at which the pump can be located.\n",
"\n",
- "#Given\n",
"Q=0.5 #(ft**3)/sec\n",
"NPSHr=15 #ft\n",
"T=80 #degree F\n",
@@ -130,10 +124,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.5\n",
- "#For peak efficiency predict the discharge actual head rise and shaft horsepower.\n",
"\n",
- "#Given\n",
"D1=8.0 #in\n",
"N1=1200.0 #rpm\n",
"D2=12.0 #in\n",
@@ -181,11 +172,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.6\n",
- "#determine The nozzle diameter for maximum power outpu.\n",
- "#The maximum power output and The angular velocity of the rotor.\n",
"\n",
- "#Given\n",
"z0=200 #ft height of left section\n",
"l=1000 #ft length of pipe\n",
"f=0.02\n",
@@ -244,9 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.8\n",
- "#find The shaft energy per unit mass of air.\n",
- "#Given\n",
+ "\n",
"ri=0.133 #in.\n",
"ro=0.168 #in.\n",
"N=300000 #rpm\n",
@@ -285,10 +270,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 12.9\n",
- "#What type of turbine should we selected.\n",
"\n",
- "#Given\n",
"w=6.0 #rev/s angular velocity\n",
"q=10.0 #ft**3/s , flow rate\n",
"h=20.0 #ft, head\n",
diff --git a/Fundamentals_of_Fluid_Mechanics/ch_3.ipynb b/Fundamentals_of_Fluid_Mechanics/ch_3.ipynb
index c8dc65b8..8e1a758f 100644
--- a/Fundamentals_of_Fluid_Mechanics/ch_3.ipynb
+++ b/Fundamentals_of_Fluid_Mechanics/ch_3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch 3"
+ "name": "",
+ "signature": "sha256:00c918c136b4f9ed73225af6aeb1443af9f75c0c5580d833c175de43873af847"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.1\n",
- "#Find the pressure at point 1 and 2 and the pressure difference indicated by the tube.\n",
- "#given\n",
+ "\n",
"v1=100 #mi/hr\n",
"ht=10000 #ft\n",
"#from standard table for static pressure at an altitude\n",
@@ -101,8 +100,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.7\n",
- "#given\n",
+ "\n",
"dia=0.1 #m\n",
"dia1=1.0 #m\n",
"h=2.0 #m\n",
@@ -142,6 +140,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAELCAYAAAAoUKpTAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH3lJREFUeJzt3XtU1GX+B/A3XvKSZkwQ1i/SQIuLIDcZTUAsLyhL5pHK\nqWQTd5e188vU2N/q5tngbHe1zeisZfs7PzNErSjXK6RtM+CqDJQpIWQhlHYxgY1UREd4fn/MzgjK\nOAPM9zbzfp3DCeY7jp8z6bz9Ps/zeR4fIYQAERHRNfRRugAiIlI/hgURETnFsCAiIqcYFkRE5BTD\ngoiInGJYEBGRU5KERWZmJgICAhAREdHl9ZqaGkyYMAEDBw7E6tWrO10rKSlBaGgoRo8ejby8PCnK\nIyKibvKRos+itLQUQ4YMQUZGBiorK6+6fvr0aXzzzTfYunUrfH198dRTT9mvRUdHY82aNRgxYgSm\nT5+Offv2wc/Pz90lEhFRN0hyZ5GYmAhfX1+H1/39/REXF4f+/ft3ery5uRkAkJSUhBEjRmDatGko\nKyuTokQiIuoGVc1ZlJeXIyQkxP5zWFgY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v3jxx+PBhVdYphBB/+9vfRGhoqEhKShKbNm1SbZ3r\n168XBoNBkfpsnNX5888/i0WLFono6Ggxbdo0sXPnTqevqdnDj4iISD6qHYYiIiL1YFgQEZFTDAsi\nInKKYUFERE4xLIh6IScnB6tXr7b/fPDgQfzud7+DyWTCsGHDEBMTg+DgYEydOlX2vgAid2JYEPXC\nlTsG7N69GzNmzABg3Zvns88+w+HDh5GRkYGHH34Yn332mRJlEvUaw4KomzZt2oSYmBgkJCTg22+/\n7XTtn//8J6ZMmdKpAXPIkCGYN28e5syZg1WrVsldLpFbMCyIuqGhoQHPPPMMdu3ahYKCAvsGd7Zr\n/fv3x9ChQ7v8tWlpafjyyy/lLJfIbTS9kSCR3IqLi5GSkoLhw4cDgH3LbAD46KOP7OfKd6WtrY0b\nXZJm8c6CqBtsu8h2paioCCkpKQ5/7Y4dO5zvv0OkUgwLom6YPn06PvroI5w6dQonTpzAxx9/DMC6\nSeSRI0cwduzYq37N2bNnUVBQgK1bt+Kpp56Su2Qit+AwFFE33HTTTcjNzcWMGTMwePBg+7DTp59+\niujoaPvzfHx8UFpaipiYGDQ3NyMoKAgFBQWdnkOkJdxIkMgNnnvuOYwePRoPPvig0qUQSYJhQURE\nTnHOgoiInGJYEBGRUwwLIiJyimFBREROMSyIiMgphgURETn1//Mag5geBe7+AAAAAElFTkSuQmCC\n"
}
@@ -160,9 +159,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.8\n",
- "#What is Flowrate and Pressure in the hose.\n",
- "#Given\n",
+ "\n",
"dia=0.03 #m\n",
"dia1=0.01 #m\n",
"p=3 #kPa(gage)\n",
@@ -208,9 +205,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.10\n",
- "#What is the maximum height over which the water can be siphoned without cavitation occuring.\n",
- "#given\n",
+ "\n",
"T=60 #degree farenheit\n",
"z1=5 #ft\n",
"atmp=14.7 #psia\n",
@@ -256,9 +251,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.11\n",
- "#Find the pressure difference range.\n",
- "#given\n",
+ "\n",
"sg=0.85\n",
"Q1=0.005 #m**3/s\n",
"Q2=0.05 #m**3/s\n",
@@ -300,9 +293,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Example 3.12\n",
- "#What is the flowrate per unit width and \\n The flowrate per unit width .\n",
- "#given\n",
+ "\n",
"z1=5 #m\n",
"a=0.8 #m\n",
"b=6 #m\n",
@@ -347,6 +338,7 @@
]
},
{
+ "metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEMCAYAAAA70CbBAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X1czvf+B/DXlZIQp7OQKYpqEuuGyl1cbheW+LVmmbmd\nYTmYsd/j0I5s53Dc2yFl5maGxvY7Z2xRq3EJk0ohiYoyWVhyk27R5/fH5lKnq0t3366ub6/n4+Hx\nuK5v3+v7frfx6vP4fD99PwohhAAREcmCga4bICKi+sNQJyKSEYY6EZGMMNSJiGSEoU5EJCMMdSIi\nGZE01Pft24fBgwfD0dERX3zxhZSliIgIgEKqdeoPHjyAu7s7YmNjYWRkhKFDhyIqKgpt27aVohwR\nEUHCkfrPP/8MV1dXmJmZoXXr1hgyZAhOnz4tVTkiIoKEoT5o0CDExcUhMzMTOTk5OHz4MH7++Wep\nyhEREQBDqS7cqlUrbNy4EQEBAXjw4AF69eqFFi1aVDhHoVBIVZ6ISNaqmjmX9Eapt7c3Dh8+jFOn\nTqGsrAxeXl4aG9OnP8uWLdN5D3LvWd/6Zc/st6F71kbSUL9z5w4AIDo6GsnJyXB1dZWyHBFRkyfZ\n9AsAvPHGG7hz5w5MTU2xc+dOKUsREREkDvWYmBgpL68TSqVS1y3UmL71rG/9Auy5Iehbv4BuepZs\nnXq1iisUL5wfIiKiirRlJx8TQEQkIwx1IiIZYagTEckIQ52ISEYY6kREMsJQJyKSEYY6EZGMMNSJ\niGSE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PN0qJiGSEoU5EJCMMdSIi\nGWGoExHJCEOdmoylS5eic+fOMDU1rfZnMjIy4O/vX6M6Pj4+yMnJqWl7RPWCoU5Nho+PT41/HX7T\npk2YMWNGjT4zadKkRveALGo6uKSRZGfr1q3qUL1//z5sbGxw9OhR9ddNTU2r9ZTNx48fw9HREWlp\naQCAoKAg5OTkIDU1FTdv3kRISAhOnDiB//znP/D09MSWLVugUChQUlKCnj17Ij09XZpvkEgLjtRJ\ndmbNmoWkpCTEx8fDysoKH374Ya2uc/XqVVhYWFQ4dubMGYSHh2PHjh3w9fWFra0tkpOTkZ6ejsTE\nRACAsbExTExMcOvWrTp/L0Q1xVAn2Zo3bx6GDRuGMWPG1Orz6enpsLa2Vr9XKBQYO3YsTE1N0a9f\nP5SUlOCtt96CQqGAh4cHTp8+rT63W7duuHLlSl2/BaIak3Q7OyJd2bVrF27cuIEtW7bU+hoKhaLS\nk/WePbuoefPmMDY2hrGxsfp9SUmJ+jwhhF488pjkh6FOsnP27FmsW7cOJ06cqNN17OzskJWVVavP\nXrt2Dfb29nWqT1QbHEqQ7AQHB+PevXsYMmQIXFxc8N577wEAPvroI1hZWaGoqAhWVlb45JNPtF7H\nxsam0rx4+W0B/3uLwGfvS0tLUVhYiA4dOtTHt0NUI1z9QqTF/Pnz8frrr2PEiBHV/syBAweQkpJS\nYYMEoobCkTqRFn/5y1+wY8eOGn1m7969mD17tkQdEWnHkToRkYxwpE5EJCMMdSIiGWGoExHJCEOd\niEhGGOpERDLCUCcikpH/B3UDvsh3l9PbAAAAAElFTkSuQmCC\n"
}
@@ -365,11 +357,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.13\n",
- "#Estimate the flow rate when depth is increased to 3 times.\n",
- "#given\n",
- "#Q=A*V=(H**2)*tan(theta/2)*(C2*(2*g*H)**0.5)\n",
- "#Q3H0/QH0=(3H0)**2.5/(H0)**2.5=3**2.5\n",
+ "\n",
"Qrat=3**2.5\n",
"\n",
"#Result\n",
@@ -402,9 +390,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.15\n",
- "#determene the stagnation pressure on the leading edge if flow is incompressible.\n",
- "#given\n",
+ "\n",
"h=10 #Km\n",
"#air is in a standard atmosphere\n",
"p1=26.5 #kPa\n",
@@ -449,9 +435,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.17\n",
- "#What is the pressure at stagnation point.\n",
- "#given\n",
+ "\n",
"V=5 #m/s\n",
"sg=1.03\n",
"h=50 #m\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_1.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_1.ipynb
index 62ff8fe0..7c755d06 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_1.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:711f56c3e3096fd85ba076900a2d5d1fac9fbc28d9c6a8c278c36feee7744bc6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
- "# Find Wall Heat Loss - Problem of Pure Conduction Unidimensional Heat\n",
+ "\n",
"\n",
"L=.15; \t\t \t\t\t#[m] - Thickness of conducting wall\n",
"delT = 1400. - 1150.; \t\t#[K] - Temperature Difference across the Wall\n",
@@ -70,8 +70,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
- "# Find a) Emissive Power & Irradiation b)Total Heat Loss per unit length \n",
+ " \n",
"import math\n",
"d=.07; \t\t\t\t\t\t\t\t\t#[m] - Outside Diameter of Pipe\n",
"Ts = 200+273.15; \t\t\t\t\t\t\t#[K] - Surface Temperature of Steam\n",
@@ -124,7 +123,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"# Find Velocity of Coolant Fluid\n",
"import math\n",
@@ -183,7 +182,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"# Find Skin Temperature & Heat loss rate\n",
"import math\n",
@@ -259,7 +258,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"%pylab inline\n",
"# (a) Curie Temperature for h = 15 W/m^2\n",
"# (b) Value of h for cure temp = 50 deg C\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_10.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_10.ipynb
index e31dd90e..bb6c3320 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_10.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:1967d26762283e30e4854c10c803a16851680afbc2e91b1d3cee7d16421cae2c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Power Required by electruc heater to cause boiling\n",
- "# Rate of water evaporation due to boiling\n",
- "# Critical Heat flux corresponding to the burnout point\n",
"import math\n",
"#Operating Conditions\n",
"Ts = 118+273. \t\t\t\t;#[K] Surface Temperature\n",
@@ -97,9 +94,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Power Dissipation per unith length for the cylinder, qs\n",
"import math\n",
"#Operating Conditions\n",
"Ts = 255+273. \t\t\t\t\t;#[K] Surface Temperature\n",
@@ -169,9 +164,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Heat Transfer and Condensation Rates\n",
"import math\n",
"#Operating Conditions\n",
"Ts = 50+273. \t\t\t;#[K] Surface Temperature\n",
@@ -238,9 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Condensation rate per unit length of tubes\n",
"import math\n",
"#Operating Conditions\n",
"Ts = 25+273. \t\t\t\t\t;#[K] Surface Temperature\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_11.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_11.ipynb
index 97945574..b185ed9e 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_11.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ab6cb233ee6afa8e8253b650d9b15125740d73ba571b9d5b3c9431dc16631f9d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Tube Length to achieve a desired hot fluid temperature\n",
"import math\n",
"#Operating Conditions\n",
"Tho = 60+273 \t\t\t\t\t\t\t;#[K] Hot Fluid outlet Temperature\n",
@@ -110,10 +109,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Exterior Dimensions of heat Exchanger\n",
- "# Pressure drops within the plate-type Heat exchanger with N=60 gaps\n",
"import math\n",
"import numpy\n",
"from numpy import linspace\n",
@@ -236,7 +232,6 @@
"collapsed": false,
"input": [
"\n",
- "# Required gas side surface area\n",
"\n",
"#Operating Conditions\n",
"Tho = 100+273. \t\t\t\t;#[K] Hot Fluid outlet Temperature\n",
@@ -300,9 +295,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Heat Transfer Rate and Fluid Outlet Temperatures\n",
"\n",
"#Operating Conditions\n",
"Thi = 250+273. \t\t\t;#[K] Hot Fluid intlet Temperature\n",
@@ -375,10 +368,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Outlet Temperature of cooling Water\n",
- "# Tube length per pass to achieve required heat transfer\n",
"import math\n",
"#Operating Conditions\n",
"q = 2*math.pow(10,9) \t \t\t\t;#[W] Heat transfer Rate\n",
@@ -448,9 +438,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Gas-side overall heat transfer coefficient. Heat exchanger Volume\n",
"import math\n",
"#Operating Conditions\n",
"hc = 1500. \t\t\t\t\t\t\t\t;#[W/m^2.K] Coefficient of heat transfer for outer surface\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_12.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_12.ipynb
index 25268933..9072d911 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_12.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:304ae148e504c8ed241176c62ed1b8e5847971fcae322bbded93788c7a0511f7"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"# a) Intensity of emission in each of the three directions\n",
@@ -106,7 +107,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"import math\n",
"import matplotlib.pyplot as plt\n",
"%pylab inline\n",
@@ -168,7 +169,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"# Spectral Emissive Power of a small aperture on the enclosure\n",
@@ -239,7 +240,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"import scipy\n",
@@ -295,7 +296,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
"import math\n",
"# Total hemispherical emissivity\n",
@@ -376,7 +376,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"import scipy\n",
@@ -453,7 +453,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"import matplotlib\n",
@@ -533,7 +533,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"import math\n",
"# Total emissivity of cover glass to solar radiation\n",
"\n",
@@ -579,7 +579,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"# Total hemispherical emissivity of fire brick wall\n",
@@ -648,7 +648,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
"import math\n",
"# Total hemispherical absorptivity and emissivity of sphere for initial condition\n",
@@ -712,7 +711,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"# Useful heat removal rate per unit area\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_13.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_13.ipynb
index 2b72fa5a..908362f2 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_13.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:9fc173b0d74248d2dec7a4473e85a2d5663ed8938149f46e30b414437d81486f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
"\n",
"# View Factors of known surface Geometries\n",
@@ -88,7 +88,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"import numpy\n",
@@ -161,7 +161,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"# Power required to maintain prescribed temperatures\n",
@@ -213,7 +213,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"# Heat gain by the fluid passing through the inner tube\n",
@@ -268,7 +268,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
"import math\n",
"# Rate at which heat must be supplied per unit length of duct\n",
@@ -330,7 +329,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"# Rate at which heat must be supplied \n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_14.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_14.ipynb
index 3ce70f77..6d3fd60d 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_14.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:23004d8fb27d32537f04ac072677553656b3c1c397997f3010334189894b890f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"\n",
"import math\n",
"# Molar and mass fluxes of hydrogen and the relative values of the mass and thermal diffusivities for the three cases\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_2.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_2.ipynb
index a3d2e96a..0de7a462 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_2.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:9a142a6e8cf26110d3ff9748fc8583daf04a172f1232dcfc8ee5e1fe6a9f5ec3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Find Value for Thermal Diffusivity\n",
"\n",
"def alpha(p, Cp, k):\n",
" a=k/(p*Cp); #[m^2/s]\n",
@@ -107,10 +106,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Analyze a Situation of Non-Uniform Temperature Distribution\n",
- "#T(x) = a + bx +cx^2 T-degC & x-meter\n",
"\n",
"a = 900.; \t\t\t#[degC]\n",
"b = -300.; \t\t\t#[degC/m]\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_3.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_3.ipynb
index 80e4f209..4cf59010 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_3.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ca8839cd8008ad44590694ea2ad13ce425811997673bf9c8b6a013454026c154"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Find Skin Temperature & Aerogel Insulation Thickness \n",
"import math\n",
"A=1.8; \t\t\t\t\t# [m^2] Area for Heat transfer i.e. both surfaces\n",
"Ti = 35+273.; \t\t\t\t#[K] - Inside Surface Temperature of Body\n",
@@ -104,9 +103,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
- "\n",
- "# Chip Operating Temperature\n",
"import math\n",
"Tf = 25+273.; \t\t\t#[K] - Temperature of Fluid Flow\n",
"L=.008; \t\t\t\t#[m] - Thickness of Aluminium \n",
@@ -155,9 +151,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Find Thermal conductivity of Carbon Nanotube\n",
"import math\n",
"D = 14 * math.pow(10,-9); \t\t\t# [m]Dia of Nanotube\n",
"s = 5*math.pow(10,-6); \t\t\t# [m]Distance between the islands\n",
@@ -227,9 +221,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Temperature Distribution And Heat rate\n",
"import math\n",
"import numpy\n",
"from numpy import linspace\n",
@@ -287,9 +279,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
+ "\n",
"%pylab inline\n",
- "# Critical Thickness\n",
"import math\n",
"import numpy\n",
"from numpy import linspace\n",
@@ -367,9 +358,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
- "\n",
- "# Heat conduction through Spherical Container \n",
+ " \n",
"import math\n",
"k = .0017; \t\t\t\t\t\t#[W/m.K] From Table A.3, Silica Powder at Temp 300K\n",
"h = 5; \t\t\t\t\t\t#[W/m^2.K]\n",
@@ -430,9 +419,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Composite Plane wall\n",
"import math\n",
"\n",
"Tsurr = 30+273.; \t\t\t\t\t\t#[K] Temperature of surrounding Water\n",
@@ -489,7 +476,7 @@
"input": [
"#Variable Initialization\n",
"%pylab inline\n",
- "# Heat conduction through Rod\n",
+ "\n",
"import math\n",
"import numpy\n",
"from numpy import linalg\n",
@@ -595,9 +582,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Study of motorcycle finned cylinder\n",
"import math\n",
"H = .15; \t\t\t\t\t\t#[m] height\n",
"k = 186; \t\t\t\t\t#[W/m.K] alumunium at 400K\n",
@@ -659,9 +644,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Study of Fuel-cell fan system\n",
"import math\n",
"Wc =.05; \t\t\t\t#[m] width\n",
"H = .026; \t \t\t\t\t#[m] height\n",
@@ -737,9 +720,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Heat loss from body & temp at inner surface\n",
"import math\n",
"hair = 2.; \t\t\t#[W/m^2.K] Heat convection coefficient air\n",
"hwater = 200.; \t\t#[W/m^2.K] Heat convection coefficient water\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_4.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_4.ipynb
index 70b74f06..9f1825ca 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_4.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:d0883c349e6026c1b16a5b0a707e34ddc2310403ffaeb85c40a328facdc14025"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Thermal resistance of wire coating associated with peripheral variations in coating thickness\n",
"import math\n",
"d = .005; \t\t\t\t\t\t\t\t\t\t#[m] Diameter of wire\n",
"k = .35; \t\t\t\t\t\t\t\t\t\t#[W/m.K] Thermal Conductivity\n",
@@ -77,9 +76,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Temperature Distribution and Heat rate per unit length\n",
"import math\n",
"import numpy\n",
"from numpy import linalg\n",
@@ -158,9 +155,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Temperature Field and Rate of Heat Transfer\n",
"import math\n",
"import numpy\n",
"from numpy import linalg\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_5.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_5.ipynb
index a8498107..62378c37 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_5.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:eb7d44d988c21bed8e236b270188ea83d6cab7b82a702d6c6ac0888d3618efff"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Junction Diameter and Time Calculation to attain certain temp\n",
"import math\n",
"#Operating Conditions\n",
"\n",
@@ -87,10 +86,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Steady State Temperature of junction\n",
- "# Time Required for thermocouple to reach a temp that is within 1 degc of its steady-state value\n",
"import math\n",
"#Operating Conditions\n",
"\n",
@@ -160,7 +156,6 @@
"input": [
"#Variable Initialization\n",
"\n",
- "# Total Time t required for two step process\n",
"import math\n",
"#Operating Conditions\n",
"\n",
@@ -236,9 +231,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Radial System with Convection\n",
"import math\n",
"#Operating Conditions\n",
"\n",
@@ -319,9 +312,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Two step cooling process of Sphere\n",
"import math\n",
"#Operating Conditions\n",
"\n",
@@ -385,11 +376,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
- "\n",
- "# Burial Depth\n",
"\n",
- "#Operating Conditions\n",
"import math\n",
"k = .52; \t\t#[W/m.K] Thermal Conductivity \n",
"rho = 2050; \t\t#[kg/m^3] Density\n",
@@ -436,9 +423,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Spherical Tumor\n",
"import math\n",
"#Operating Conditions\n",
"\n",
@@ -514,9 +499,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Thermal Conductivity of Nanostructured material\n",
"import numpy\n",
"import math\n",
"from numpy import linalg\n",
@@ -582,9 +565,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Temperature distribution 1.5s after a change in operating power\n",
"import math\n",
"#Operating Conditions\n",
"\n",
@@ -634,11 +615,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Variable Initialization\n",
"\n",
- "# Using Explicit Finite Difference method, determine temperatures at the surface and 150 mm from the surface after an elapsed time of 2 min\n",
- "# Repeat the calculations using the Implicit Finite Difference Method\n",
- "# Determine the same temperatures analytically\n",
"import math\n",
"#Operating Conditions\n",
"a\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_6.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_6.ipynb
index a8c5a4a2..56b06d80 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_6.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:4c9f19718c00e3bd942cd652731d5120db18676ef29029938745f62980f5cff9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Napthalene Sublimation rate per unit length\n",
"import math\n",
"#Operating Conditions\n",
"\n",
@@ -72,8 +71,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Convection Mass Transfer coefficient \n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"\n",
@@ -116,8 +114,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Convection Mass Transfer coefficient \n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"v = 1; \t\t\t\t#[m/s] Velocity of water\n",
@@ -179,9 +176,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Heat Flux to blade when surface temp is reduced\n",
- "# Heat flux to a larger turbine blade\n",
+ "\n",
"\n",
"#Operating Conditions\n",
"v = 160; \t\t\t\t#[m/s] Velocity of air\n",
@@ -232,8 +227,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Water vapor conc and flux associated with the same location on larger surface of the same shape\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"v = 100; \t\t\t#[m/s] Velocity of air\n",
@@ -296,8 +290,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Steady State Temperature of Beverage\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"Tsurr = 40+273.; \t\t#[K] Surrounding Air Temperature\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_7.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_7.ipynb
index f8aa1a6f..b47e5d70 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_7.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:12137eba1f5bf47c0fd628804006f0ff8647777d41f9645050b549888507b91d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Cooling rate per Unit Width of the Plate\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"v = 10; \t\t\t\t\t\t\t#[m/s] Air velocity\n",
@@ -83,8 +83,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Maximum Heater Power Requirement\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"v = 60; \t\t\t#[m/s] Air velocity\n",
@@ -172,8 +171,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Daily Water Loss\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"v = 2; \t\t\t#[m/s] Air velocity\n",
@@ -237,9 +235,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Convection Coefficient associated with operating conditions\n",
- "# Convection Coefficient from an appropriate correlation\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"v = 10; \t\t\t#[m/s] Air velocity\n",
@@ -304,8 +300,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Convective Heat transfer to the canister and the additional heating needed\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"v = 23; \t\t\t\t#[m/s] Air velocity\n",
@@ -363,8 +358,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Time required to cool from Ti = 75 degC to 35 degC\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"v = 10; \t\t\t#[m/s] Air velocity\n",
@@ -423,9 +417,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Air side Convection coefficient and Heat rate\n",
- "# pressure Drop\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"v = 6; \t\t\t#[m/s] Air velocity\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_8.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_8.ipynb
index fac7e1bf..ec80846d 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_8.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:bcdb44fcb5c412a8fb12ecf8bc3409e5bc0d03dc35a4f7331daf1db849b5f7af"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Length of tube needed to achieve the desired outlet temperature\n",
- "#Local convection coefficient at the outlet\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"m = .1; #[kg/s] mass flow rate of water\n",
@@ -80,8 +79,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# average convection coefficient \n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"m = .25; \t#[kg/s] mass flow rate of water\n",
@@ -128,9 +126,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Length of tube for required heating\n",
- "# Surface temperature Ts at outlet section\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"m = .01; #[kg/s] mass flow rate of water\n",
@@ -194,8 +190,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Length of Blood Vessel\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"um1 = .13; #[m/s] Blood stream\n",
@@ -281,9 +276,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Heat Loss from the Duct over the Length L, q \n",
- "# Heat flux and suface temperature at x=L\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"m = .05; \t#[kg/s] mass flow rate of water\n",
@@ -349,8 +342,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Time needed to bring the reactants to within 1 degC of processing temperature\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"T1 = 125+273.; \t\t\t#[K] Chip Temperature 1\n",
@@ -483,8 +475,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Average mass trasnfer convection coefficient for the tube\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"m = .0003; \t\t#[kg/s] mass flow rate of water\n",
diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_9.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_9.ipynb
index 8bdfef75..449ae71c 100644
--- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_9.ipynb
+++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:56bd333b1440dc978cb1a204c216290125fc0bef6769e6c73f6ac7af2e17116b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Boundary Layer thickness at trailing edge.\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"Ts = 70+273.; \t\t\t\t\t#[K] Surface Temperature\n",
@@ -84,8 +84,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Heat transfer by convection between screen and room air.\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"Ts = 232+273.; \t\t\t#[K] Surface Temperature\n",
@@ -140,8 +139,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Heat Loss from duct per meter of length\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"Ts = 45+273.; \t\t\t\t#[K] Surface Temperature\n",
@@ -200,8 +198,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Heat Loss from pipe per meter of length\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"Ts = 165+273.; \t\t\t\t#[K] Surface Temperature\n",
@@ -255,9 +252,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#variable initialization\n",
- "# Heat Loss from pipe per unit of length\n",
- "# Heat Loss if air is filled with glass-fiber blanket insulation\n",
+ "\n",
"import math\n",
"#Operating Conditions\n",
"To = 35+273. \t\t\t;#[K] Shield Temperature\n",
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_03.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_03.ipynb
index 0ee01bdd..dd27a183 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_03.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_03.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 03"
+ "name": "",
+ "signature": "sha256:18e19bec17b5f55566a2079756ce3fc602f406d3355e580aba8938f8d7833673"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,65 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 3: Process Variables"
+ "source": [
+ "Chapter 3: Process Variables"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.2, Page number: 17"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.2, Page number: 17"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Convert the following:\n1. 8.03 yr to seconds (s)\n2. 150 miles/h to yards/h\n3. 100.0 m/s2 to ft/min2\n4. 0.03 g/cm3 to lb/ft3\n'''\n \n#Variable Declaration:\nQ1 = 8.03 #Years(part 1)\nD = 365 #Days in a year\nH = 24 #Hours in a day\nM = 60 #Minutes in an hour\nS = 60 #Seconds in a minute\nQ2 = 150 #Miles per hour(part 2)\nFM = 5280 #Feet in a mile\nYF = 1.0/3.0 #Yard in a feet\nQ3 = 100 #Meter per second square(part 3)\nCmm = 100 #Centimeter in a meter\nFC = 1.0/30.48 #Feet in a centimeter\nSsMs = 60**2 #Second square in a minute square\nQ4 = 0.03 #Gram per centimeter cube (part 4)\nPG = 1.0/454.0 #Pound in a gram\nCF = (30.48)**3 #Centimeter in a feet\n \n#Calculation:\nA1 = Q1*D*H*M*S #Seconds (s)\nA2 = Q2*FM*YF #Yards per hour (yd/hr)\nA3 = Q3*Cmm*FC*SsMs #Feet per min square (ft/min^2)\nA4 = Q4*PG*CF #Pound per feet cube (lb/ft^3)\n \n#Results:\nprint \"1. Seconds in\",Q1,\"year is:\",round(A1/10**8,2),\" x 10**8 s\"\nprint \"2. Yards per hour in\",Q2,\"miles per hour is:\",round(A2/10**5,1),\" x 10**5 yd/h\"\nprint \"3. Feets per minute square in\",Q3,\"meter per square is:\",round(A3/10**6,3),\" x 10**6 ft/min^2\"\nprint \"4. Pounds per feet cube in\",Q4,\"gram per centimeter cube is:\",round(A4),\"lb/ft^3\"",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable Declaration:\n",
+ "Q1 = 8.03 #Years(part 1)\n",
+ "D = 365 #Days in a year\n",
+ "H = 24 #Hours in a day\n",
+ "M = 60 #Minutes in an hour\n",
+ "S = 60 #Seconds in a minute\n",
+ "Q2 = 150 #Miles per hour(part 2)\n",
+ "FM = 5280 #Feet in a mile\n",
+ "YF = 1.0/3.0 #Yard in a feet\n",
+ "Q3 = 100 #Meter per second square(part 3)\n",
+ "Cmm = 100 #Centimeter in a meter\n",
+ "FC = 1.0/30.48 #Feet in a centimeter\n",
+ "SsMs = 60**2 #Second square in a minute square\n",
+ "Q4 = 0.03 #Gram per centimeter cube (part 4)\n",
+ "PG = 1.0/454.0 #Pound in a gram\n",
+ "CF = (30.48)**3 #Centimeter in a feet\n",
+ " \n",
+ "#Calculation:\n",
+ "A1 = Q1*D*H*M*S #Seconds (s)\n",
+ "A2 = Q2*FM*YF #Yards per hour (yd/hr)\n",
+ "A3 = Q3*Cmm*FC*SsMs #Feet per min square (ft/min^2)\n",
+ "A4 = Q4*PG*CF #Pound per feet cube (lb/ft^3)\n",
+ " \n",
+ "#Results:\n",
+ "print \"1. Seconds in\",Q1,\"year is:\",round(A1/10**8,2),\" x 10**8 s\"\n",
+ "print \"2. Yards per hour in\",Q2,\"miles per hour is:\",round(A2/10**5,1),\" x 10**5 yd/h\"\n",
+ "print \"3. Feets per minute square in\",Q3,\"meter per square is:\",round(A3/10**6,3),\" x 10**6 ft/min^2\"\n",
+ "print \"4. Pounds per feet cube in\",Q4,\"gram per centimeter cube is:\",round(A4),\"lb/ft^3\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. Seconds in 8.03 year is: 2.53 x 10**8 s\n2. Yards per hour in 150 miles per hour is: 2.6 x 10**5 yd/h\n3. Feets per minute square in 100 meter per square is: 1.181 x 10**6 ft/min^2\n4. Pounds per feet cube in 0.03 gram per centimeter cube is: 2.0 lb/ft^3\n"
+ "text": [
+ "1. Seconds in 8.03 year is: 2.53 x 10**8 s\n",
+ "2. Yards per hour in 150 miles per hour is: 2.6 x 10**5 yd/h\n",
+ "3. Feets per minute square in 100 meter per square is: 1.181 x 10**6 ft/min^2\n",
+ "4. Pounds per feet cube in 0.03 gram per centimeter cube is: 2.0 lb/ft^3\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +79,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.3, Page number: 21"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.3, Page number: 21"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Consider the following pressure calculations.\n1. A liquid weighing 100 lb held in a cylindrical column with a base area of 3 in2 exerts\nhow much pressure at the base in lbf/ft2?\n2. If a pressure reading is 35 psig (pounds per square inch gauge), what is the absolute\npressure?\n'''\n \n#Variable Declaration:\nQ1 = 32.2 #Gravitational acceleration (ft/s^2) (part 1)\nCF = 32.2 #Conversion factor (lb.ft/lbf.s^2)\nM = 100 #Mass (lb)\nSA = 3 #Surface area (in^2)\nFsIs = (1.0/12.0)**2 #Feet square in a inch square\nQ2 = 14.7 #Atmospheric pressure (psi) (part 2)\nGP = 35 #Gauge Pressure (psig)\n \n#Caculations:\nF = M*Q1/CF #Force (lbf)\nP = F/SA/FsIs #Pressure at the base (lbf/ft^2)\nPa = GP+Q2 #Absolute pressure (psia)\n \n#Results:\nprint \"1. Pressure at the base is:\",round(P),\"lbf/ft^2\"\nprint \"2. Absolute pressure is:\",round(Pa,1),\"psia\"",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable Declaration:\n",
+ "Q1 = 32.2 #Gravitational acceleration (ft/s^2) (part 1)\n",
+ "CF = 32.2 #Conversion factor (lb.ft/lbf.s^2)\n",
+ "M = 100 #Mass (lb)\n",
+ "SA = 3 #Surface area (in^2)\n",
+ "FsIs = (1.0/12.0)**2 #Feet square in a inch square\n",
+ "Q2 = 14.7 #Atmospheric pressure (psi) (part 2)\n",
+ "GP = 35 #Gauge Pressure (psig)\n",
+ " \n",
+ "#Caculations:\n",
+ "F = M*Q1/CF #Force (lbf)\n",
+ "P = F/SA/FsIs #Pressure at the base (lbf/ft^2)\n",
+ "Pa = GP+Q2 #Absolute pressure (psia)\n",
+ " \n",
+ "#Results:\n",
+ "print \"1. Pressure at the base is:\",round(P),\"lbf/ft^2\"\n",
+ "print \"2. Absolute pressure is:\",round(Pa,1),\"psia\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. Pressure at the base is: 4800.0 lbf/ft^2\n2. Absolute pressure is: 49.7 psia\n"
+ "text": [
+ "1. Pressure at the base is: 4800.0 lbf/ft^2\n",
+ "2. Absolute pressure is: 49.7 psia\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +125,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.4, Page number: 23"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.4, Page number: 23"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''If a 55-gal tank contains 20.0 lb of water,\n1. How many pound . moles of water does it contain?\n2. How many gram . moles does it contain?\n3. How many molecules does it contain?\n'''\n \n#Variable Declaration:\nQ1 = 20.0 #Mass (lb) (part 1)\nMH = 1.008 #Molecular weight of H (lb/lbmol)\nMO = 15.999 #Molecular weight of O (lb/lbmol)\nQ2 = 454 #Gram in pound (part 2)\nQ3 = 6.023*10**23 #Avogadro nuber (part 3)\n \n#Calculations:\nMol = 2*MH+MO #Molecular weight of water (lb/lbmol)\nA1 = Q1/Mol #Pound.moles of water (lbmol)\nA2 = Q1*Q2/Mol #Gram.moles of water (gmol)\nA3 = A2*Q3 #Molecules of water (molecules)\n \n#Results:\nprint \"1. Pound.moles of water is:\",round(A1,2),\"lbmol water\"\nprint \"2. Gram.moles of water is:\",round(A2),\"gmol water\"\nprint \"3. Molecules of water is:\",round(A3/10**26,3),\" x 10**26 molecules\"",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable Declaration:\n",
+ "Q1 = 20.0 #Mass (lb) (part 1)\n",
+ "MH = 1.008 #Molecular weight of H (lb/lbmol)\n",
+ "MO = 15.999 #Molecular weight of O (lb/lbmol)\n",
+ "Q2 = 454 #Gram in pound (part 2)\n",
+ "Q3 = 6.023*10**23 #Avogadro nuber (part 3)\n",
+ " \n",
+ "#Calculations:\n",
+ "Mol = 2*MH+MO #Molecular weight of water (lb/lbmol)\n",
+ "A1 = Q1/Mol #Pound.moles of water (lbmol)\n",
+ "A2 = Q1*Q2/Mol #Gram.moles of water (gmol)\n",
+ "A3 = A2*Q3 #Molecules of water (molecules)\n",
+ " \n",
+ "#Results:\n",
+ "print \"1. Pound.moles of water is:\",round(A1,2),\"lbmol water\"\n",
+ "print \"2. Gram.moles of water is:\",round(A2),\"gmol water\"\n",
+ "print \"3. Molecules of water is:\",round(A3/10**26,3),\" x 10**26 molecules\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. Pound.moles of water is: 1.11 lbmol water\n2. Gram.moles of water is: 504.0 gmol water\n3. Molecules of water is: 3.036 x 10**26 molecules\n"
+ "text": [
+ "1. Pound.moles of water is: 1.11 lbmol water\n",
+ "2. Gram.moles of water is: 504.0 gmol water\n",
+ "3. Molecules of water is: 3.036 x 10**26 molecules\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +172,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.5, Page number: 25"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.5, Page number: 25"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following information is given:\nSpecific gravity of liquid (methanol) = 0.92 (at 60\u00b0F)\nDensity of reference substance (water) = 62.4 lb/ft^3 (at 60\u00b0F)\nDetermine the density of methanol in lb/ft^3.\n'''\n \n#Variable declaration:\nSG = 0.92 #Specific gavity of liquid, methanol\nDW = 62.4 #Density of reference substance, water (lb/ft^3)\n \n#Calculation:\nDM = SG*DW #Density of methanol (lb/ft^3)\n \n#Result:\nprint \"Density of methanol is:\",round(DM,1),\"lb/ft^3\"",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable declaration:\n",
+ "SG = 0.92 #Specific gavity of liquid, methanol\n",
+ "DW = 62.4 #Density of reference substance, water (lb/ft^3)\n",
+ " \n",
+ "#Calculation:\n",
+ "DM = SG*DW #Density of methanol (lb/ft^3)\n",
+ " \n",
+ "#Result:\n",
+ "print \"Density of methanol is:\",round(DM,1),\"lb/ft^3\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Density of methanol is: 57.4 lb/ft^3\n"
+ "text": [
+ "Density of methanol is: 57.4 lb/ft^3\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +209,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.6, Page number: 27\n"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.6, Page number: 27\n"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''What is the kinematic viscosity of a gas, if the specific gravity and absolute viscosity are 0.8 and\n0.02 cP, respectively?\n'''\n \n#Variable declaration:\nSG = 0.8 #Specific Gravity\nAV = 0.02 #Absolute Viscosity (cP)\ncP = 1 #Viscosity of centipoise (cP)\nVcP = 6.72 * 10**-4 #Pound per feet.sec in a centipoise (lb/ft.s)\npR = 62.43 #Reference density (lb/ft^3)\n \n#Calculations:\nu = AV*VcP/cP #Viscosity of gas (lb/ft.s)\np = SG*pR #Density of gas (lb/ft^3)\nv = u/p #Kinematic viscosity of gas (ft^2/s)\n \n#Result:\nprint \"Kinematic viscosity of gas is:\",round(v/10**-7,3),\"x 10**-7 ft^2/s\"",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable declaration:\n",
+ "SG = 0.8 #Specific Gravity\n",
+ "AV = 0.02 #Absolute Viscosity (cP)\n",
+ "cP = 1 #Viscosity of centipoise (cP)\n",
+ "VcP = 6.72 * 10**-4 #Pound per feet.sec in a centipoise (lb/ft.s)\n",
+ "pR = 62.43 #Reference density (lb/ft^3)\n",
+ " \n",
+ "#Calculations:\n",
+ "u = AV*VcP/cP #Viscosity of gas (lb/ft.s)\n",
+ "p = SG*pR #Density of gas (lb/ft^3)\n",
+ "v = u/p #Kinematic viscosity of gas (ft^2/s)\n",
+ " \n",
+ "#Result:\n",
+ "print \"Kinematic viscosity of gas is:\",round(v/10**-7,3),\"x 10**-7 ft^2/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Kinematic viscosity of gas is: 2.691 x 10**-7 ft^2/s\n"
+ "text": [
+ "Kinematic viscosity of gas is: 2.691 x 10**-7 ft^2/s\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +251,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.7, Page number: 27"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.7, Page number: 27"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''To illustrate the use of a monogram, calculate the absolute viscosity of a 98% sulfuric acid\nsolution at 45\u00b0C.\n'''\n \n#Variable declaration:\nX = 7.0 #Coordinate X of H2SO4\nY = 24.8 #Coordinate Y of H2SO4\nS = 45 #Slope\n \n#Calculations:\n#From the figure C.1 we found the intersection of curves mu = 12cP\nmu = 12\n \n#Results:\nprint \"Absolute viscosity of a 98% sulfuric acid solution at 45\u00b0 C is :\",mu*10**-2,\" g/cm.s\"",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable declaration:\n",
+ "X = 7.0 #Coordinate X of H2SO4\n",
+ "Y = 24.8 #Coordinate Y of H2SO4\n",
+ "S = 45 #Slope\n",
+ " \n",
+ "#Calculations:\n",
+ "#From the figure C.1 we found the intersection of curves mu = 12cP\n",
+ "mu = 12\n",
+ " \n",
+ "#Results:\n",
+ "print \"Absolute viscosity of a 98% sulfuric acid solution at 45\u00b0 C is :\",mu*10**-2,\" g/cm.s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Absolute viscosity of a 98% sulfuric acid solution at 45\u00b0 C is : 0.12 g/cm.s\n"
+ "text": [
+ "Absolute viscosity of a 98% sulfuric acid solution at 45\u00b0 C is : 0.12 g/cm.s\n"
+ ]
}
],
"prompt_number": 9
@@ -143,19 +290,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.8, Page number: 28"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.8, Page number: 28"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following is given:\nHeat capacity of methanol = 0.61 cal/g.\u00b0C (at 60\u00b0F)\nConvert the heat capacities to English units.\n'''\n \n#Variable declaration:\nCpM = 0.61 #Heat capacity of methanol (cal/g.\u00b0C)\nG = 454 #Grams in a pound\nB = 1.0/252.0 #Btu in a calorie\nC = 1.0/1.8 #Degree celsius in a degree fahrenheit\n \n#Calculation:\nCp = CpM*G*B*C #Heat capacity in English units (Btu/lb.\u00b0F)\n \n#Result:\nprint \"Heat capacity in English units is: \",round(Cp,2),\" Btu/lb.\u00b0F\"",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable declaration:\n",
+ "CpM = 0.61 #Heat capacity of methanol (cal/g.\u00b0C)\n",
+ "G = 454 #Grams in a pound\n",
+ "B = 1.0/252.0 #Btu in a calorie\n",
+ "C = 1.0/1.8 #Degree celsius in a degree fahrenheit\n",
+ " \n",
+ "#Calculation:\n",
+ "Cp = CpM*G*B*C #Heat capacity in English units (Btu/lb.\u00b0F)\n",
+ " \n",
+ "#Result:\n",
+ "print \"Heat capacity in English units is: \",round(Cp,2),\" Btu/lb.\u00b0F\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Heat capacity in English units is: 0.61 Btu/lb.\u00b0F\n"
+ "text": [
+ "Heat capacity in English units is: 0.61 Btu/lb.\u00b0F\n"
+ ]
}
],
"prompt_number": 10
@@ -164,19 +329,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.9, Page number: 29"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.9, Page number: 29"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following data is given:\nThermal conductivity of methanol = 0.0512 cal/m.s.\u00b0C(at 60\u00b0F)\nConvert the thermal conductivity to English units.\n'''\n \n#Variable declaration:\nkM = 0.0512 #Thermal conductivity of methanol (cal/m.s\u00b0C)\nB = 1.0/252.0 #Btu in a calorie\nM = 0.3048 #Meters in a feet\nS = 3600 #Seconds in an hour\nC = 1.0/1.8 #Degree celsius in a degree fahrenheit\n \n#Calculation:\nk = kM*B*M*S*C #Thermal conductivity in English units (Btu/ft.h.\u00b0F)\n \n#Result:\nprint \"Thermal coductivity in English units is:\",round(k,3),\"Btu/ft.h.\u00b0F\"",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable declaration:\n",
+ "kM = 0.0512 #Thermal conductivity of methanol (cal/m.s\u00b0C)\n",
+ "B = 1.0/252.0 #Btu in a calorie\n",
+ "M = 0.3048 #Meters in a feet\n",
+ "S = 3600 #Seconds in an hour\n",
+ "C = 1.0/1.8 #Degree celsius in a degree fahrenheit\n",
+ " \n",
+ "#Calculation:\n",
+ "k = kM*B*M*S*C #Thermal conductivity in English units (Btu/ft.h.\u00b0F)\n",
+ " \n",
+ "#Result:\n",
+ "print \"Thermal coductivity in English units is:\",round(k,3),\"Btu/ft.h.\u00b0F\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Thermal coductivity in English units is: 0.124 Btu/ft.h.\u00b0F\n"
+ "text": [
+ "Thermal coductivity in English units is: 0.124 Btu/ft.h.\u00b0F\n"
+ ]
}
],
"prompt_number": 11
@@ -185,19 +369,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.11, Page number: 31"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.11, Page number: 31"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the Reynolds number for a fluid flowing through a 5-inch diameter pipe at 10 fps\n(feet per second) with a density of 50 lb/ft3 and a viscosity of 0.65 cP. Is the flow turbulent\nor laminar?\n'''\n \n#Variable declaration:\nD = 5 #Diameter of pipe (ft)\nV = 10 #Fluid velocity (ft/s)\np = 50 #Fluid density (lb/ft^3)\nu = 0.65 #Fluid viscosity (lb/ft.s)\nF = 1.0/12.0 #Feet in an inch\nVCp = 6.72*10**-4 #Viscosity of centipoise (lb/ft.s)\n \n#Calculation:\nA = D*V*p*F/u/VCp #Reynolds Number\n \n#Result:\nif(A>2100):\n print \"The Reynolds number is :\",round(A,-2),\"; therefore, the flow is turbulent.\"\nelif(A<2100):\n print \"The Reynolds number is :\",round(A,-2),\"; therefore, the flow is not turbulent.\"",
+ "input": [
+ "\n",
+ " \n",
+ "#Variable declaration:\n",
+ "D = 5 #Diameter of pipe (ft)\n",
+ "V = 10 #Fluid velocity (ft/s)\n",
+ "p = 50 #Fluid density (lb/ft^3)\n",
+ "u = 0.65 #Fluid viscosity (lb/ft.s)\n",
+ "F = 1.0/12.0 #Feet in an inch\n",
+ "VCp = 6.72*10**-4 #Viscosity of centipoise (lb/ft.s)\n",
+ " \n",
+ "#Calculation:\n",
+ "A = D*V*p*F/u/VCp #Reynolds Number\n",
+ " \n",
+ "#Result:\n",
+ "if(A>2100):\n",
+ " print \"The Reynolds number is :\",round(A,-2),\"; therefore, the flow is turbulent.\"\n",
+ "elif(A<2100):\n",
+ " print \"The Reynolds number is :\",round(A,-2),\"; therefore, the flow is not turbulent.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Reynolds number is : 477000.0 ; therefore, the flow is turbulent.\n"
+ "text": [
+ "The Reynolds number is : 477000.0 ; therefore, the flow is turbulent.\n"
+ ]
}
],
"prompt_number": 13
@@ -206,19 +413,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 3.12, Page number: 32"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 3.12, Page number: 32"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''As part of a heat transfer course, a young environmental engineering major has been requested to\ndetermine the potential energy of water before it flows over a waterfall 10 meters in height above\nground level conditions.\n'''\n#Variable declaration:\n#For the problem at hand, take as a basis 1 kilogram of water and assume the potential energy to be zero at ground level conditions.\nz1 = 0 #Intial height from ground level (m)\nz2 = 10 #Final height from ground level (m)\nPE1 = 0 #Initial potential energy at z1 (J)\nm = 1 #Mass of water (kg)\ng = 9.8 #Gravitational acceleration (m/s^2)\ngc = 1 #Conversion factor\n \n#Calculations:\nPE2 = m*(g/gc)*z2 #Final potential energy at z2 (J)\n \n#Result:\nprint \"The potential energy of water is :\",PE2,\"J \"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "#For the problem at hand, take as a basis 1 kilogram of water and assume the potential energy to be zero at ground level conditions.\n",
+ "z1 = 0 #Intial height from ground level (m)\n",
+ "z2 = 10 #Final height from ground level (m)\n",
+ "PE1 = 0 #Initial potential energy at z1 (J)\n",
+ "m = 1 #Mass of water (kg)\n",
+ "g = 9.8 #Gravitational acceleration (m/s^2)\n",
+ "gc = 1 #Conversion factor\n",
+ " \n",
+ "#Calculations:\n",
+ "PE2 = m*(g/gc)*z2 #Final potential energy at z2 (J)\n",
+ " \n",
+ "#Result:\n",
+ "print \"The potential energy of water is :\",PE2,\"J \""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The potential energy of water is : 98.0 J \n"
+ "text": [
+ "The potential energy of water is : 98.0 J \n"
+ ]
}
],
"prompt_number": 14
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_04.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_04.ipynb
index 7d7ce512..3fece5a7 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_04.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_04.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 04"
+ "name": "",
+ "signature": "sha256:da9a4303c6fc07c594d52c82662dd9ab6e23eae788f020d82b784ed3a6873663"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,60 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 4: The Conservation Law for Momentum"
+ "source": [
+ "Chapter 4: The Conservation Law for Momentum"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.1, Page number: 39"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.1, Page number: 39"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A 10-cm-diameter horizontal line carries saturated steam at 420 m/s. Water is entrained by the\nsteam at a rate of 0.15 kg/s. The line has a 90\u00b0 bend. Calculate the force components in the horizontal\nand vertical directions required to hold the bend in place due to the entrained water.\n'''\n\n#Variable declaration:\nVx_in = 420 #Entry Velocity in X direction (m/s)\nVx_out = 0 #Exit Velocity in X direction (m/s)\nVy_in = 0 #Entry Velocity in Y direction (m/s)\nVy_out = 420 #Exit Velocity in Y direction (m/s)\nm = 0.15 #Rate of water entrained by the steam (kg/s)\nlb = 1.0/4.46 #Pound force in a newton force\n\n#Calculations:\nMx_out = m*Vx_out #Rate of change of momentum at entry in x-direction (kg.m)\nMx_in = m*Vx_in #Rate of change of momentum at exit in x-direction (kg.m)\nMy_out = m*Vy_out #Rate of change of momentum at entry in y-direction (kg.m)\nMy_in = m*Vy_in #Rate of change of momentum at exit in y-direction (kg.m)\nFxgc = (Mx_out - Mx_in)*lb #Force in X direction (lbf)\nFygc = (My_out - My_in)*lb #Force in X direction (lbf)\n\n#Results:\nif Fxgc < 1:\n print \"The x-direction supporting force acting on the 90\u00b0 elbow is :\",round(-Fxgc,1),\" lbf acting toward the left. \"\nelse:\n print \"The x-direction supporting force acting on the 90\u00b0 elbow is :\",round(Fxgc,1),\" lbf acting toward the right. \"\nif Fygc < 1:\n print \"The y-direction supporting force acting on the 90\u00b0 elbow is :\",round(-Fygc,1),\" lbf acting downwards. \" \nelse:\n print \"The y-direction supporting force acting on the 90\u00b0 elbow is :\",round(Fygc,1),\" lbf acting upwards. \"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Vx_in = 420 #Entry Velocity in X direction (m/s)\n",
+ "Vx_out = 0 #Exit Velocity in X direction (m/s)\n",
+ "Vy_in = 0 #Entry Velocity in Y direction (m/s)\n",
+ "Vy_out = 420 #Exit Velocity in Y direction (m/s)\n",
+ "m = 0.15 #Rate of water entrained by the steam (kg/s)\n",
+ "lb = 1.0/4.46 #Pound force in a newton force\n",
+ "\n",
+ "#Calculations:\n",
+ "Mx_out = m*Vx_out #Rate of change of momentum at entry in x-direction (kg.m)\n",
+ "Mx_in = m*Vx_in #Rate of change of momentum at exit in x-direction (kg.m)\n",
+ "My_out = m*Vy_out #Rate of change of momentum at entry in y-direction (kg.m)\n",
+ "My_in = m*Vy_in #Rate of change of momentum at exit in y-direction (kg.m)\n",
+ "Fxgc = (Mx_out - Mx_in)*lb #Force in X direction (lbf)\n",
+ "Fygc = (My_out - My_in)*lb #Force in X direction (lbf)\n",
+ "\n",
+ "#Results:\n",
+ "if Fxgc < 1:\n",
+ " print \"The x-direction supporting force acting on the 90\u00b0 elbow is :\",round(-Fxgc,1),\" lbf acting toward the left. \"\n",
+ "else:\n",
+ " print \"The x-direction supporting force acting on the 90\u00b0 elbow is :\",round(Fxgc,1),\" lbf acting toward the right. \"\n",
+ "if Fygc < 1:\n",
+ " print \"The y-direction supporting force acting on the 90\u00b0 elbow is :\",round(-Fygc,1),\" lbf acting downwards. \" \n",
+ "else:\n",
+ " print \"The y-direction supporting force acting on the 90\u00b0 elbow is :\",round(Fygc,1),\" lbf acting upwards. \""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The x-direction supporting force acting on the 90\u00b0 elbow is : 14.1 lbf acting toward the left. \nThe y-direction supporting force acting on the 90\u00b0 elbow is : 14.1 lbf acting upwards. \n"
+ "text": [
+ "The x-direction supporting force acting on the 90\u00b0 elbow is : 14.1 lbf acting toward the left. \n",
+ "The y-direction supporting force acting on the 90\u00b0 elbow is : 14.1 lbf acting upwards. \n"
+ ]
}
],
"prompt_number": 6
@@ -38,19 +74,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.2 Page number: 40"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.2 Page number: 40"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 4.1. Calculate the magnitude and direction of the resultant force.\n'''\n\nfrom math import sqrt,degrees,atan2\n\n#Variable declaration:\nFx = -63 #Force component in X direction (N)\nFy = 63 #Force component in Y direction (N)\nlbf = 0.22481 #Pound-forrce in unit newton (lbf)\n\n#Calculations:\nFr = sqrt(Fx**2 + Fy**2)*lbf #The resultant supporting force (lbf)\nu = degrees(atan2(Fy,Fx)) #Angle between the positive x axis and the direction of the force (degrees)\n\n#Result: \nif (0<u<90):\n print \"The supporting force is :\",round(Fr,1),\" lbf acting at\",u,\"\u00b0 i.e in the \u201cnortheast\u201d direction.\"\nelif (90<u<180):\n print \"The supporting force is :\",round(Fr,1),\" lbf acting at\",u,\"\u00b0 i.e in the \u201cnorthwest\u201d direction.\"\nelif (180<u<270):\n print \"The supporting force is :\",round(Fr,1),\" lbf acting at\",u,\"\u00b0 i.e in the \u201csouthwest\u201d direction.\"\nelif (270<u<360):\n print \"The supporting force is :\",round(Fr,1),\" lbf acting at\",u,\"\u00b0 i.e in the \u201csoutheast\u201d direction.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import sqrt,degrees,atan2\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Fx = -63 #Force component in X direction (N)\n",
+ "Fy = 63 #Force component in Y direction (N)\n",
+ "lbf = 0.22481 #Pound-forrce in unit newton (lbf)\n",
+ "\n",
+ "#Calculations:\n",
+ "Fr = sqrt(Fx**2 + Fy**2)*lbf #The resultant supporting force (lbf)\n",
+ "u = degrees(atan2(Fy,Fx)) #Angle between the positive x axis and the direction of the force (degrees)\n",
+ "\n",
+ "#Result: \n",
+ "if (0<u<90):\n",
+ " print \"The supporting force is :\",round(Fr,1),\" lbf acting at\",u,\"\u00b0 i.e in the \u201cnortheast\u201d direction.\"\n",
+ "elif (90<u<180):\n",
+ " print \"The supporting force is :\",round(Fr,1),\" lbf acting at\",u,\"\u00b0 i.e in the \u201cnorthwest\u201d direction.\"\n",
+ "elif (180<u<270):\n",
+ " print \"The supporting force is :\",round(Fr,1),\" lbf acting at\",u,\"\u00b0 i.e in the \u201csouthwest\u201d direction.\"\n",
+ "elif (270<u<360):\n",
+ " print \"The supporting force is :\",round(Fr,1),\" lbf acting at\",u,\"\u00b0 i.e in the \u201csoutheast\u201d direction.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The supporting force is : 20.0 lbf acting at 135.0 \u00b0 i.e in the \u201cnorthwest\u201d direction.\n"
+ "text": [
+ "The supporting force is : 20.0 lbf acting at 135.0 \u00b0 i.e in the \u201cnorthwest\u201d direction.\n"
+ ]
}
],
"prompt_number": 4
@@ -59,19 +122,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.3, Page number: 42"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.3, Page number: 42"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Fuel is fed into a boiler at a rate of 10,000 lb/h in the presence of 20,000 lb/h of air. Due to the\nlow heating value of the fuel, 2000 lb/h of methane is added to assist in the combustion of the\nfuel. At what rate (lb/h) do the product gases exit the incinerator?\n'''\n\n#Variable declaration:\nR1_in = 10000 #Rate of fuel fed into the boiler (lb/h)\nR2_1n = 20000 #Rate of air fed into the boiler (lb/h)\nR3_in = 2000 #Rate of methane fed into the boiler (lb/h)\n\n#Calculations:\nm_in = R1_in + R2_1n + R3_in #Rate of mass in (lb/h)\nm_out = m_in #Rate of mass out (lb/h)\n\n#Result:\nprint \"The rate of the product gases exit from the incinerator is :\",round(m_in),\" lb/h\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "R1_in = 10000 #Rate of fuel fed into the boiler (lb/h)\n",
+ "R2_1n = 20000 #Rate of air fed into the boiler (lb/h)\n",
+ "R3_in = 2000 #Rate of methane fed into the boiler (lb/h)\n",
+ "\n",
+ "#Calculations:\n",
+ "m_in = R1_in + R2_1n + R3_in #Rate of mass in (lb/h)\n",
+ "m_out = m_in #Rate of mass out (lb/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The rate of the product gases exit from the incinerator is :\",round(m_in),\" lb/h\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of the product gases exit from the incinerator is : 32000.0 lb/h\n"
+ "text": [
+ "The rate of the product gases exit from the incinerator is : 32000.0 lb/h\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +161,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.4, Page number: 42"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.4, Page number: 42"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A proposed heat exchanger design requires that a packed column and a spray tower are to be used\nin series for the removal of HCl from a gas feed stream. The spray tower is operating at an efficiency\nof 65% and the packed column at an efficiency of 98%. Calculate the mass flow rate of HCl leaving the spray tower, the mass flow rate of HCl entering the packed tower, and the overall\nfractional efficiency of the removal system if 76.0 lb of HCl enters the system every hour.\n'''\n\n#Variable declaration:\nE1 = 65 #Efficiency of spray tower (%)\nE2 = 98 #Efficiency of packed column (%)\nm_in = 76 #Mass flow rate of HCl entering the system (lb/h)\n\n#Calculations:\nm1_out = (1 - E1/100.0)*m_in #Mass flow rate of HCl leaving the spray tower (lb/h)\nm2_out = (1 - E2/100.0)*m1_out #Mass flow rate of HCl entering the packed column (lb/h)\nE = (m_in - m2_out)/m_in #Overall fractional efficiency (%)\n\n#Result:\nprint \"The mass flow rate of HCl leaving the spray tower is :\",round(m1_out,2),\" lb/h HCL\"\nprint \"The mass flow rate of HCl entering the packed column is :\",round(m2_out,3),\" lb/h HCL\"\nprint \"The overall fractional efficiency is :\",round(E*100,1),\" %\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "E1 = 65 #Efficiency of spray tower (%)\n",
+ "E2 = 98 #Efficiency of packed column (%)\n",
+ "m_in = 76 #Mass flow rate of HCl entering the system (lb/h)\n",
+ "\n",
+ "#Calculations:\n",
+ "m1_out = (1 - E1/100.0)*m_in #Mass flow rate of HCl leaving the spray tower (lb/h)\n",
+ "m2_out = (1 - E2/100.0)*m1_out #Mass flow rate of HCl entering the packed column (lb/h)\n",
+ "E = (m_in - m2_out)/m_in #Overall fractional efficiency (%)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The mass flow rate of HCl leaving the spray tower is :\",round(m1_out,2),\" lb/h HCL\"\n",
+ "print \"The mass flow rate of HCl entering the packed column is :\",round(m2_out,3),\" lb/h HCL\"\n",
+ "print \"The overall fractional efficiency is :\",round(E*100,1),\" %\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The mass flow rate of HCl leaving the spray tower is : 26.6 lb/h HCL\nThe mass flow rate of HCl entering the packed column is : 0.532 lb/h HCL\nThe overall fractional efficiency is : 99.3 %\n"
+ "text": [
+ "The mass flow rate of HCl leaving the spray tower is : 26.6 lb/h HCL\n",
+ "The mass flow rate of HCl entering the packed column is : 0.532 lb/h HCL\n",
+ "The overall fractional efficiency is : 99.3 %\n"
+ ]
}
],
"prompt_number": 6
@@ -101,19 +205,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.5, Page number: 43"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.5, Page number: 43"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Consider the flow diagram in Figure 4.3 for a wastewater treatment system. The following\nflowrate data are given:\nm\u02d91 = 1000 lb/min\nm\u02d92 = 1000 lb/min\nm\u02d94 = 200 lb/min\nCalculate the amount of water lost by evaporation in the operation, m\u02d9 .\n'''\n\n#Variable declaration:\nm1 = 1000 #Flowrate data 1 (lb/min)\nm2 = 1000 #Flowrate data 2 (lb/min)\nm4 = 200 #Flowrate data 4 (lb/min)\n\n#Calculations:\nm5 = m1 + m2 - m4 #Flowrate data 5 (lb/min)\nm6 = m2 #Flowrate data 6 (lb/min)\nm = m5 - m6 #Flowrate of water lost in operation (lb/min)\n\n#Result:\nprint \"The amount of water lost by evaporation in the operation is\", round(m),\" lb/min\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "m1 = 1000 #Flowrate data 1 (lb/min)\n",
+ "m2 = 1000 #Flowrate data 2 (lb/min)\n",
+ "m4 = 200 #Flowrate data 4 (lb/min)\n",
+ "\n",
+ "#Calculations:\n",
+ "m5 = m1 + m2 - m4 #Flowrate data 5 (lb/min)\n",
+ "m6 = m2 #Flowrate data 6 (lb/min)\n",
+ "m = m5 - m6 #Flowrate of water lost in operation (lb/min)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The amount of water lost by evaporation in the operation is\", round(m),\" lb/min\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The amount of water lost by evaporation in the operation is 800.0 lb/min\n"
+ "text": [
+ "The amount of water lost by evaporation in the operation is 800.0 lb/min\n"
+ ]
}
],
"prompt_number": 8
@@ -122,19 +245,53 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.6, Page number: 44"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.6, Page number: 44"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Consider the system shown in Figure 4.4. The following volumetric flowrate and phosphate concentration\n(volume basis) data have been provided by the plant manager. Are the data correct\nand/or consistent?\nq1 = 1000 gal/day\nq2 = 1000 gal/day\nq3 = 2000 gal/day\nq4 = 200 gal/day\nq5 = 1800 gal/day\nq6 = 1000 gal/day\nC1 = 4 ppm\nC2 = 0 ppm\nC3 = 2 ppm\nC4 = 20 ppm\nC5 = 0 ppm\nC6 = 0 ppm\n'''\n\n#Variable declaration:\nq1 = 1000.0 #Volumetric flowrate from tank 1 (gal/day)\nq2 = 1000.0 #Volumetric flowrate from tank 2 (gal/day)\nq3 = 2000.0 #Volumetric flowrate from tank 3 (gal/day)\nq4 = 200.0 #Volumetric flowrate from tank 4 (gal/day)\nq5 = 1800.0 #Volumetric flowrate from tank 5 (gal/day)\nq6 = 1000.0 #Volumetric flowrate from tank 6 (gal/day)\nC1 = 4.0 #Phosphate concentration in tank 1 (ppm)\nC2 = 0.0 #Phosphate concentration in tank 2 (ppm)\nC3 = 2.0 #Phosphate concentration in tank 3 (ppm)\nC4 = 20.0 #Phosphate concentration in tank 4 (ppm)\nC5 = 0.0 #Phosphate concentration in tank 5 (ppm)\nC6 = 0.0 #Phosphate concentration in tank 6 (ppm)\nCf = 120000.0 #conversion factor for water (gal/10**6lb)\n\n#Calculations:\nC1q1 = C1*q1/Cf #Data 1 (lb/day)\nC2q2 = C2*q2/Cf #Data 2 (lb/day)\nC3q3 = C3*q3/Cf #Data 3 (lb/day)\nC4q4 = C4*q4/Cf #Data 4 (lb/day)\nC5q5 = C5*q5/Cf #Data 5 (lb/day)\nC6q6 = C6*q6/Cf #Data 6 (lb/day)\n\n#Results:\nif (((C1q1 + C2q2) == C3q3) and C3q3 == (C4q4 + C5q5) and C5q5 == C6q6 and C2q2 == C6q6):\n print \"The data appear to be consistent .\"\nelse:\n print \"The data appear to be inconsistent .\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "q1 = 1000.0 #Volumetric flowrate from tank 1 (gal/day)\n",
+ "q2 = 1000.0 #Volumetric flowrate from tank 2 (gal/day)\n",
+ "q3 = 2000.0 #Volumetric flowrate from tank 3 (gal/day)\n",
+ "q4 = 200.0 #Volumetric flowrate from tank 4 (gal/day)\n",
+ "q5 = 1800.0 #Volumetric flowrate from tank 5 (gal/day)\n",
+ "q6 = 1000.0 #Volumetric flowrate from tank 6 (gal/day)\n",
+ "C1 = 4.0 #Phosphate concentration in tank 1 (ppm)\n",
+ "C2 = 0.0 #Phosphate concentration in tank 2 (ppm)\n",
+ "C3 = 2.0 #Phosphate concentration in tank 3 (ppm)\n",
+ "C4 = 20.0 #Phosphate concentration in tank 4 (ppm)\n",
+ "C5 = 0.0 #Phosphate concentration in tank 5 (ppm)\n",
+ "C6 = 0.0 #Phosphate concentration in tank 6 (ppm)\n",
+ "Cf = 120000.0 #conversion factor for water (gal/10**6lb)\n",
+ "\n",
+ "#Calculations:\n",
+ "C1q1 = C1*q1/Cf #Data 1 (lb/day)\n",
+ "C2q2 = C2*q2/Cf #Data 2 (lb/day)\n",
+ "C3q3 = C3*q3/Cf #Data 3 (lb/day)\n",
+ "C4q4 = C4*q4/Cf #Data 4 (lb/day)\n",
+ "C5q5 = C5*q5/Cf #Data 5 (lb/day)\n",
+ "C6q6 = C6*q6/Cf #Data 6 (lb/day)\n",
+ "\n",
+ "#Results:\n",
+ "if (((C1q1 + C2q2) == C3q3) and C3q3 == (C4q4 + C5q5) and C5q5 == C6q6 and C2q2 == C6q6):\n",
+ " print \"The data appear to be consistent .\"\n",
+ "else:\n",
+ " print \"The data appear to be inconsistent .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The data appear to be consistent .\n"
+ "text": [
+ "The data appear to be consistent .\n"
+ ]
}
],
"prompt_number": 9
@@ -143,19 +300,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.7, Page number: 48"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.7, Page number: 48"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A lake is located at the top of a mountain. A power plant has been constructed at the bottom of\nthe mountain. The potential energy of the water traveling downhill can be used to spin turbines\nand generate electricity. This is the operating mode in the daytime during peak electrical\ndemand. At night, when demand is reduced, the water is pumped back up the mountain. The\noperation is shown in Figure 4.5.\nUsing the method of power \u201cproduction\u201d described above, determine how much power\n(Watts) is generated by the lake located at an elevation of 3000 ft above the power plant. The\nflowrate of water is 500,000 gpm. The turbine efficiency is 30%. Neglect friction effects.\nNote: This programmed-instructional problem is a modified and edited version (with permission)\nof an illustrative example prepared by Marie Gillman, a graduate mechanical engineering\nstudent at Manhattan College.\n'''\n\n#Variable declaration:\nDz = 3000 #Height (ft)\nV0 = 500000 #Flowrate of water (gal/min)\nn = 30 #Turbine efficiency (%)\nm = 0.3048 #Meters in a feet\nm3 = 0.00378 #Meters-cube in a gallon\ng = 9.8 #Gravitational acceleration (m/s^2)\ngc = 1 #Conversion factor\nMW = 10**(-6) #Megawatt in newton-meter-per-second\n\n#Calculations:\nV1 = (V0*m3)*1000.0/60.0 #The mass flow rate of the water in kilograms/second (kg/s)\nDPE = V1*g*Dz*m/gc*MW #The loss in potential energy (MW)\nAP = n/100.0*DPE #The actual power output (MW)\n\n#Result:\nprint \"The power generated by the lake located is :\",round(AP,1),\" MW\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Dz = 3000 #Height (ft)\n",
+ "V0 = 500000 #Flowrate of water (gal/min)\n",
+ "n = 30 #Turbine efficiency (%)\n",
+ "m = 0.3048 #Meters in a feet\n",
+ "m3 = 0.00378 #Meters-cube in a gallon\n",
+ "g = 9.8 #Gravitational acceleration (m/s^2)\n",
+ "gc = 1 #Conversion factor\n",
+ "MW = 10**(-6) #Megawatt in newton-meter-per-second\n",
+ "\n",
+ "#Calculations:\n",
+ "V1 = (V0*m3)*1000.0/60.0 #The mass flow rate of the water in kilograms/second (kg/s)\n",
+ "DPE = V1*g*Dz*m/gc*MW #The loss in potential energy (MW)\n",
+ "AP = n/100.0*DPE #The actual power output (MW)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The power generated by the lake located is :\",round(AP,1),\" MW\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The power generated by the lake located is : 84.7 MW\n"
+ "text": [
+ "The power generated by the lake located is : 84.7 MW\n"
+ ]
}
],
"prompt_number": 10
@@ -164,19 +345,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.8, Page number: 50"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.8, Page number: 50"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''If 111.4 lbmol/min of an air stream is heated from 200\u00b0F to 600\u00b0F, calculate the heat transfer\nrate required to bring about this change in temperature. Use the following enthalpy and average\nheat capacity data:\nH200\u00b0F = 1170 Btu/lbmol\nH600\u00b0F = 4010 Btu/lbmol\n'''\n\n#Variable declaration:\nn = 111.4 #Flowrate of air stream (lbmol/min)\nH1 = 1170 #Average heat capacity at 200\u00b0F (Btu/lbmol)\nH2 = 4010 #Average heat capacity at 600\u00b0F (Btu/lbmol)\n\n#Calculation:\nQ = n*(H2 - H1) #The heat transfer rate (Btu/min)\n\n#Result:\nprint \"The heat transfer rate required is:\",round(Q/10**5,2),\" x 10**5 Btu/min\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "n = 111.4 #Flowrate of air stream (lbmol/min)\n",
+ "H1 = 1170 #Average heat capacity at 200\u00b0F (Btu/lbmol)\n",
+ "H2 = 4010 #Average heat capacity at 600\u00b0F (Btu/lbmol)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = n*(H2 - H1) #The heat transfer rate (Btu/min)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate required is:\",round(Q/10**5,2),\" x 10**5 Btu/min\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate required is: 3.16 x 10**5 Btu/min\n"
+ "text": [
+ "The heat transfer rate required is: 3.16 x 10**5 Btu/min\n"
+ ]
}
],
"prompt_number": 11
@@ -185,19 +383,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.9, Page number: 50"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.9, Page number: 50"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Given the mass flow rate of a fluid and its heat capacity, determine the required heat rate to\nchange the fluid from one temperature to another. Data are provided below:\nn = 600 lbmol/min\nCp,AV = 0.271 Btu/lbmol . \u00b0F (over the 200\u2013600\u00b0F range)\nT1 = 200\u00b0F\nT2 = 600\u00b0F\n'''\n\n#Variable declaration:\nn = 600 #The mass flow rate of fluid (lbmol/min)\nCp_AV = 0.271 #Heat capacity (Btu/lbmol . \u00b0F)\nT1 = 200 #Initial temperature(\u00b0F)\nT2 = 600 #Final temperature(\u00b0F)\n\n#Calcultaion:\nQ = n*Cp_AV*(T2 - T1) #The required heat rate (Btu/min)\n\n#Result:\nprint \"The required heat rate is :\",round(Q,-2),\" Btu/min\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "n = 600 #The mass flow rate of fluid (lbmol/min)\n",
+ "Cp_AV = 0.271 #Heat capacity (Btu/lbmol . \u00b0F)\n",
+ "T1 = 200 #Initial temperature(\u00b0F)\n",
+ "T2 = 600 #Final temperature(\u00b0F)\n",
+ "\n",
+ "#Calcultaion:\n",
+ "Q = n*Cp_AV*(T2 - T1) #The required heat rate (Btu/min)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The required heat rate is :\",round(Q,-2),\" Btu/min\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required heat rate is : 65000.0 Btu/min\n"
+ "text": [
+ "The required heat rate is : 65000.0 Btu/min\n"
+ ]
}
],
"prompt_number": 12
@@ -206,19 +422,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.10, Page number: 51"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.10, Page number: 51"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Obtain the heat transfer rate in an exchanger if equal mass liquid flow rates are used. The hot\nfluid is cooled from 94 \u00b0C to 82 \u00b0C while the cold fluid is initially at 20 \u00b0C.\n'''\n\n#Variable declaration:\nT_c1 = 20 #Initial cold fluid temperature (\u00b0C)\nT_h1 = 82 #Initial hot fluid temperature (\u00b0C)\nT_h2 = 94 #Final hot fluid temperature (\u00b0C)\n\n#Calculation:\nT_c2 = (T_h2 - T_h1 + T_c1) #Final cold fluid temperature (\u00b0C)\n\n#Result:\nprint \"The heat transfer rate is:\",round(T_c2),\" \u00b0C\"\nprint \"There is a printing mistake in book regarding unit of the final result.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T_c1 = 20 #Initial cold fluid temperature (\u00b0C)\n",
+ "T_h1 = 82 #Initial hot fluid temperature (\u00b0C)\n",
+ "T_h2 = 94 #Final hot fluid temperature (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "T_c2 = (T_h2 - T_h1 + T_c1) #Final cold fluid temperature (\u00b0C)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate is:\",round(T_c2),\" \u00b0C\"\n",
+ "print \"There is a printing mistake in book regarding unit of the final result.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate is: 32.0 \u00b0C\nThere is a printing mistake in book regarding unit of the final result.\n"
+ "text": [
+ "The heat transfer rate is: 32.0 \u00b0C\n",
+ "There is a printing mistake in book regarding unit of the final result.\n"
+ ]
}
],
"prompt_number": 13
@@ -227,19 +462,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.11, Page number: 51"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.11, Page number: 51"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''As a gas flows through a cooler, 5.5MW of heat is transferred from the gas. The average heat\ncapacity of the gas is 1090 J/(kg . \u00b0C), the gas mass flow rate, m\u02d9 , is 9 kg/s and the gas inlet temperature,\nT1, is 650 \u00b0C. For this example, kinetic and potential energy effects are again neglected.\nFurthermore, there is no shaft work. Determine the gas outlet temperature.\n'''\n\n#Variable declaration:\nQ = -5.5*10**6 #The heat transferred out from the gas (W)\nCp = 1090.0 #The average heat capacity of the gas (J/(kg . \u00b0C))\nm = 9.0 #The gas mass flow rate (kg/s)\nT1 = 650 #The gas inlet temperature (\u00b0C)\n\n#Calculation:\nT2 = Q/(m*Cp)+T1 #The gas outlet temperature (\u00b0C)\n\n#Result:\nprint \"The gas outlet temperature is :\",round(T2),\" \u00b0C\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Q = -5.5*10**6 #The heat transferred out from the gas (W)\n",
+ "Cp = 1090.0 #The average heat capacity of the gas (J/(kg . \u00b0C))\n",
+ "m = 9.0 #The gas mass flow rate (kg/s)\n",
+ "T1 = 650 #The gas inlet temperature (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "T2 = Q/(m*Cp)+T1 #The gas outlet temperature (\u00b0C)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The gas outlet temperature is :\",round(T2),\" \u00b0C\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The gas outlet temperature is : 89.0 \u00b0C\n"
+ "text": [
+ "The gas outlet temperature is : 89.0 \u00b0C\n"
+ ]
}
],
"prompt_number": 14
@@ -248,19 +501,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 4.12, Page number: 52"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 4.12, Page number: 52"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A heat pump takes in 3500 gpm of water at a temperature of 38 \u00b0F and discharges it back to the\nlake at 36.2 \u00b0F. How many Btu are removed from thewater per day [Cp for H2O = 75.4 J/(gmol .\u00b0C),\np = 62.4 lb/ft^3]?\n '''\n\n#Variable declaration:\nn = 3500.0 #Inlet flowrate of water (gal/min)\nCp_W = 75.4 #Heat capacity of water (J/(gmol . \u00b0C)\np = 62.4 #Density of water (lb/ft^3)\nM = 24*60.0 #Minutes in a day (min/day)\nG = 7.48 #Gallons in a feet cube (gal/ft^3)\ngm = 454.0 #Grams in a pound (g/lb)\nJ = 1054.0 #Joules in a Btu (J/Btu)\ng = 18.0 #Grams in a gmol (g/gmol)\nF = 1.8 #Degree fahrenheit in a degree celcius (\u00b0F)\nTi = 38.0 #Initial temperature (\u00b0F)\nTf = 36.2 #Final temperature (\u00b0F)\n\n#Calculations:\nT= Ti-Tf #Temperature loss (\u00b0F)\nm = n*p*M/G #Mass flow rate of water (lb/day)\nCp = Cp_W*gm/J/g/F #Heat capacity in cosistent units (Btu/(lb.\u00b0F))\nQ = m*Cp*T #Rate of heat flow from water (Btu/day)\n\n#Result:\nprint \"The rate of Btu removed from the water per day is :\",round(Q/10**8,2),\" x 10**8 Btu/day .\"\nprint \"There is a calculation mistake in the book regarding the final result.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "n = 3500.0 #Inlet flowrate of water (gal/min)\n",
+ "Cp_W = 75.4 #Heat capacity of water (J/(gmol . \u00b0C)\n",
+ "p = 62.4 #Density of water (lb/ft^3)\n",
+ "M = 24*60.0 #Minutes in a day (min/day)\n",
+ "G = 7.48 #Gallons in a feet cube (gal/ft^3)\n",
+ "gm = 454.0 #Grams in a pound (g/lb)\n",
+ "J = 1054.0 #Joules in a Btu (J/Btu)\n",
+ "g = 18.0 #Grams in a gmol (g/gmol)\n",
+ "F = 1.8 #Degree fahrenheit in a degree celcius (\u00b0F)\n",
+ "Ti = 38.0 #Initial temperature (\u00b0F)\n",
+ "Tf = 36.2 #Final temperature (\u00b0F)\n",
+ "\n",
+ "#Calculations:\n",
+ "T= Ti-Tf #Temperature loss (\u00b0F)\n",
+ "m = n*p*M/G #Mass flow rate of water (lb/day)\n",
+ "Cp = Cp_W*gm/J/g/F #Heat capacity in cosistent units (Btu/(lb.\u00b0F))\n",
+ "Q = m*Cp*T #Rate of heat flow from water (Btu/day)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The rate of Btu removed from the water per day is :\",round(Q/10**8,2),\" x 10**8 Btu/day .\"\n",
+ "print \"There is a calculation mistake in the book regarding the final result.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of Btu removed from the water per day is : 0.76 x 10**8 Btu/day .\nThere is a calculation mistake in the book regarding the final result.\n"
+ "text": [
+ "The rate of Btu removed from the water per day is : 0.76 x 10**8 Btu/day .\n",
+ "There is a calculation mistake in the book regarding the final result.\n"
+ ]
}
],
"prompt_number": 15
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_05.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_05.ipynb
index 8cc3b0eb..d5d367e4 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_05.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_05.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 05"
+ "name": "",
+ "signature": "sha256:33ba4a11fa0be53b880079008a0280bb47a9d8531c545010b70c7a3f75197aa0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,45 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 5: Gas Laws"
+ "source": [
+ "Chapter 5: Gas Laws"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.1, Page number: 56"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.1, Page number: 56"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''What is the final ( f ) volumetric flow rate of a gas that is heated at constant pressure in a heat\nexchanger from 100 to 300\u00b0F if its initial (i) flow is 3500 actual cubic feet per minute (acfm).\n'''\n\n#Variable declaration:\nqi = 3500 #Initial volumetric flow rate of gas (acfm)\nTi = 100.0 #Initial temperature (\u00b0F)\nTf = 300.0 #Final temperature (\u00b0F)\n\n#Calculation:\nTi_R = Ti+460 #Initial temperatur in Rankine scale (\u00b0R)\nTf_R = Tf+460 #Final temperatur in Rankine scale (\u00b0R)\nqf = qi*(Tf_R/Ti_R) #Final volumetric flow rate of gas (acfm)\n\n#Result:\nprint \"The final volumetric flow rate of gas is :\",round(qf),\" acfm\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "qi = 3500 #Initial volumetric flow rate of gas (acfm)\n",
+ "Ti = 100.0 #Initial temperature (\u00b0F)\n",
+ "Tf = 300.0 #Final temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Ti_R = Ti+460 #Initial temperatur in Rankine scale (\u00b0R)\n",
+ "Tf_R = Tf+460 #Final temperatur in Rankine scale (\u00b0R)\n",
+ "qf = qi*(Tf_R/Ti_R) #Final volumetric flow rate of gas (acfm)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The final volumetric flow rate of gas is :\",round(qf),\" acfm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The final volumetric flow rate of gas is : 4750.0 acfm\n"
+ "text": [
+ "The final volumetric flow rate of gas is : 4750.0 acfm\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +59,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.2, Page number: 57"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.2, Page number: 57"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''What is the volumetric flow rate of the gas (100\u00b0F, 1 atm) in the previous example if it is compressed\nisothermally (constant temperature) to 3 atm?\n'''\n\n#Variable declaration:\nqi = 3500 #Initial volumetric flow rate of gas (acfm)\nPi = 1.0 #Iitial pressure (atm)\nPf = 3.0 #Final pressure (atm)\n\n#Calculation:\nqf = qi*(Pi/Pf) #Final volumetric flow rate of gas (acfm)\n\n#Result:\nprint \"The volumetric flow rate of the gas (100\u00b0F, 1 atm) is:\",round(qf),\" acfm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "qi = 3500 #Initial volumetric flow rate of gas (acfm)\n",
+ "Pi = 1.0 #Iitial pressure (atm)\n",
+ "Pf = 3.0 #Final pressure (atm)\n",
+ "\n",
+ "#Calculation:\n",
+ "qf = qi*(Pi/Pf) #Final volumetric flow rate of gas (acfm)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The volumetric flow rate of the gas (100\u00b0F, 1 atm) is:\",round(qf),\" acfm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The volumetric flow rate of the gas (100\u00b0F, 1 atm) is: 1167.0 acfm\n"
+ "text": [
+ "The volumetric flow rate of the gas (100\u00b0F, 1 atm) is: 1167.0 acfm\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +97,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.3, Page number: 57"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.3, Page number: 57"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''What is the volumetric flow rate of the gas in the previous example if the final temperature\nis 300\u00b0F.\n'''\n\n#Variable declaration:\nqi = 3500 #Initial volumetric flow rate of the gas (acfm)\nPi = 1.0 #Initial pressure (atm)\nPf = 3.0 #Final pressure (atm)\nTf = 300.0+460.0 #Final temperature in Rankine scale (\u00b0R)\nTi = 100.0+460.0 #Initial temperature in Rankine scale (\u00b0R)\n\n#Calculation:\nqf = qi*(Pi/Pf)*(Tf/Ti) #Final volumetric flow rate of the gas (acfm)\n\n#Result:\nprint \"The volumetric flow rate of the gas at 300\u00b0F temperature is :\",round(qf),\" acfm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "qi = 3500 #Initial volumetric flow rate of the gas (acfm)\n",
+ "Pi = 1.0 #Initial pressure (atm)\n",
+ "Pf = 3.0 #Final pressure (atm)\n",
+ "Tf = 300.0+460.0 #Final temperature in Rankine scale (\u00b0R)\n",
+ "Ti = 100.0+460.0 #Initial temperature in Rankine scale (\u00b0R)\n",
+ "\n",
+ "#Calculation:\n",
+ "qf = qi*(Pi/Pf)*(Tf/Ti) #Final volumetric flow rate of the gas (acfm)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The volumetric flow rate of the gas at 300\u00b0F temperature is :\",round(qf),\" acfm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The volumetric flow rate of the gas at 300\u00b0F temperature is : 1583.0 acfm\n"
+ "text": [
+ "The volumetric flow rate of the gas at 300\u00b0F temperature is : 1583.0 acfm\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +137,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.4, Page number: 59"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.4, Page number: 59"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''What is the density of air at 75 \u00b0F and 14.7 psia? The molecular weight of air is approximately 29.\n'''\n\n#Variable declaration:\nP = 14.7 #Absolute pressure of air (psia)\nMW = 29 #Molecular weight of air (lb/lbmol)\nT = 75+460 #Temperature in Rankine scale (\u00b0R)\nR = 10.73 #Universal gas constant (ft^3.psi/lbmol.\u00b0R)\n\n#Calculation:\np = P*MW/R/T #Density of air (lb/ft^3)\n\n#Result:\nprint \"The density of air at 75\u00b0F and 14.7 psia is :\",round(p,4),\" lb/ft^3\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "P = 14.7 #Absolute pressure of air (psia)\n",
+ "MW = 29 #Molecular weight of air (lb/lbmol)\n",
+ "T = 75+460 #Temperature in Rankine scale (\u00b0R)\n",
+ "R = 10.73 #Universal gas constant (ft^3.psi/lbmol.\u00b0R)\n",
+ "\n",
+ "#Calculation:\n",
+ "p = P*MW/R/T #Density of air (lb/ft^3)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The density of air at 75\u00b0F and 14.7 psia is :\",round(p,4),\" lb/ft^3\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The density of air at 75\u00b0F and 14.7 psia is : 0.0743 lb/ft^3\n"
+ "text": [
+ "The density of air at 75\u00b0F and 14.7 psia is : 0.0743 lb/ft^3\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +176,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.5, Page number: 59"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.5, Page number: 59"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the volume (in ft3) of 1.0 lbmol of any ideal gas at 60\u00b0F and 14.7 psia.\n'''\n\n#Variable declaration:\nn = 1 #Molar flow rate of gas (lbmol/h)\nR = 10.73 #Universal gas constant (ft^3.psi/lbmol.\u00b0R)\nT = 60+460 #Temperature in Rankine scale (\u00b0R)\nP = 14.7 #Absolute pressure of gas (psia)\n\n#Calculation:\nV = n*R*T/P #Volume of gas (ft^3)\n\n#Result:\nprint \"The volume of given ideal gas is :\",round(V,1),\" ft^3\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "n = 1 #Molar flow rate of gas (lbmol/h)\n",
+ "R = 10.73 #Universal gas constant (ft^3.psi/lbmol.\u00b0R)\n",
+ "T = 60+460 #Temperature in Rankine scale (\u00b0R)\n",
+ "P = 14.7 #Absolute pressure of gas (psia)\n",
+ "\n",
+ "#Calculation:\n",
+ "V = n*R*T/P #Volume of gas (ft^3)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The volume of given ideal gas is :\",round(V,1),\" ft^3\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The volume of given ideal gas is : 379.6 ft^3\n"
+ "text": [
+ "The volume of given ideal gas is : 379.6 ft^3\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +215,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.6, Page number: 59"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.6, Page number: 59"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the density of a gas (MW = 29) in g/cm3 at 20\u00b0C and 1.2 atm using the ideal gas law.\n'''\n\n#Variable declaration:\nP = 1.2 #Abslute pressure of gas (psia)\nMW = 29 #Molecular weight of gas (g/gmol)\nR = 82.06 #Universal gas constant (atm.cm^3/gmol.K)\nT = 20+273 #Temperature in Kelvin (K)\n\n#Calculation:\np = P*MW/R/T #Dendity of gas (g/cm^3)\n\n#Result:\nprint \"The density of given gas is :\",round(p,5),\" g/cm^3\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "P = 1.2 #Abslute pressure of gas (psia)\n",
+ "MW = 29 #Molecular weight of gas (g/gmol)\n",
+ "R = 82.06 #Universal gas constant (atm.cm^3/gmol.K)\n",
+ "T = 20+273 #Temperature in Kelvin (K)\n",
+ "\n",
+ "#Calculation:\n",
+ "p = P*MW/R/T #Dendity of gas (g/cm^3)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The density of given gas is :\",round(p,5),\" g/cm^3\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The density of given gas is : 0.00145 g/cm^3\n"
+ "text": [
+ "The density of given gas is : 0.00145 g/cm^3\n"
+ ]
}
],
"prompt_number": 7
@@ -143,19 +254,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.7, Page number: 60"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.7, Page number: 60"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A certain pure-component two-element ideal gas has a specific volume v of 10.58 ft3/lb at 70\u00b0F\nand 14.7 psia. Determine the molecular weight of the gas and state its name. (Hint: The gas is\nacidic and soluble in water.)\n'''\n\n#Variable declaration:\nR = 10.73 #Universal gas constant (psia . ft^3/lbmol .\u00b0R)\nT = 70+460 #Temperature in Rankine scale (\u00b0R)\nv = 10.58 #Specific volume (ft^3/lb)\nP = 14.7 #Absolute pressure (psia)\n\n#Calculation:\nMW = R*T/v/P #Molecular weight of gas (lb/lbmol)\n\n#Result:\nprint \"The molecular weight of the gas is :\",round(MW,2),\" lb/lbmol.\"\nprint \"It appears that the gas is HCl (i.e., hydrogen chloride).\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "R = 10.73 #Universal gas constant (psia . ft^3/lbmol .\u00b0R)\n",
+ "T = 70+460 #Temperature in Rankine scale (\u00b0R)\n",
+ "v = 10.58 #Specific volume (ft^3/lb)\n",
+ "P = 14.7 #Absolute pressure (psia)\n",
+ "\n",
+ "#Calculation:\n",
+ "MW = R*T/v/P #Molecular weight of gas (lb/lbmol)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The molecular weight of the gas is :\",round(MW,2),\" lb/lbmol.\"\n",
+ "print \"It appears that the gas is HCl (i.e., hydrogen chloride).\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The molecular weight of the gas is : 36.57 lb/lbmol.\nIt appears that the gas is HCl (i.e., hydrogen chloride).\n"
+ "text": [
+ "The molecular weight of the gas is : 36.57 lb/lbmol.\n",
+ "It appears that the gas is HCl (i.e., hydrogen chloride).\n"
+ ]
}
],
"prompt_number": 7
@@ -164,19 +295,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.8, Page number: 61"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.8, Page number: 61"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Data from a heat exchanger indicate a volumetric flow rate of 30,000 scfm (60\u00b0F, 1 atm). If the\noperating temperature and pressure of the unit are 1100\u00b0F and 1 atm, respectively, calculate the\nflow rate in actual cubic feet per minute (acfm).\n'''\n\n#Variable declaration:\nqs = 30000 #Volumetric flow rate at standard conditions (scfm)\nTa = 1100+460 #Actual absolute temperature in Rankine scale (\u00b0R)\nTs = 60+460 #Standard absolute temperature in Rankine scale (\u00b0R)\n\n#Calculation:\nqa = qs*Ta/Ts #Volumetric flow rate at actual conditions (acfm)\n\n#Result:\nprint \"The volumetric flow rate in actual cubic feet per minute is :\",round(qa),\" acfm\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "qs = 30000 #Volumetric flow rate at standard conditions (scfm)\n",
+ "Ta = 1100+460 #Actual absolute temperature in Rankine scale (\u00b0R)\n",
+ "Ts = 60+460 #Standard absolute temperature in Rankine scale (\u00b0R)\n",
+ "\n",
+ "#Calculation:\n",
+ "qa = qs*Ta/Ts #Volumetric flow rate at actual conditions (acfm)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The volumetric flow rate in actual cubic feet per minute is :\",round(qa),\" acfm\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The volumetric flow rate in actual cubic feet per minute is : 90000.0 acfm\n"
+ "text": [
+ "The volumetric flow rate in actual cubic feet per minute is : 90000.0 acfm\n"
+ ]
}
],
"prompt_number": 9
@@ -185,19 +333,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.9, Page number: 62"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.9, Page number: 62"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The exhaust gas flow rate from a condenser is 1000 scfm. All of the gas is vented through a small\nstack that has an inlet area of 2.0 ft^2. The exhaust gas temperature is 300\u00b0F. What is the velocity\nof the gas through the stack inlet in feet per second? Assume standard conditions to be 70\u00b0F and\n1.0 atm. Neglect the pressure drop across the stack.\n'''\n\n#Variable declaration:\nqs = 1000 #Volumetric flow rate at standard conditions (scfm)\nTa = 300+460 #Actual absolute temperature in Rankine scale (\u00b0R)\nTs = 70+460 #Standard absolute temperature in Rankine scale (\u00b0R)\nA = 2.0 #Inlet area of stack (ft^2)\n\n#Calculations:\nqa = qs*Ta/Ts #Volumetric flow rate at actual conditions (acfm)\nv = qa/A/60 #Velocity of gas (ft/s)\n\n#Result:\nprint \"The velocity of the gas through the stack inlet is :\",round(v),\" ft/s\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "qs = 1000 #Volumetric flow rate at standard conditions (scfm)\n",
+ "Ta = 300+460 #Actual absolute temperature in Rankine scale (\u00b0R)\n",
+ "Ts = 70+460 #Standard absolute temperature in Rankine scale (\u00b0R)\n",
+ "A = 2.0 #Inlet area of stack (ft^2)\n",
+ "\n",
+ "#Calculations:\n",
+ "qa = qs*Ta/Ts #Volumetric flow rate at actual conditions (acfm)\n",
+ "v = qa/A/60 #Velocity of gas (ft/s)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The velocity of the gas through the stack inlet is :\",round(v),\" ft/s\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The velocity of the gas through the stack inlet is : 12.0 ft/s\n"
+ "text": [
+ "The velocity of the gas through the stack inlet is : 12.0 ft/s\n"
+ ]
}
],
"prompt_number": 10
@@ -206,19 +373,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.10, Page number: 62"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.10, Page number: 62"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''C6H5Cl is fed into a thermal oxidizer at a rate of 5000 scfm (60\u00b0F, 1 atm) and is combusted in the\npresence of air fed at a rate of 3000 scfm (60\u00b0F, 1 atm). Both streams enter the oxidizer at 70\u00b0F.\nThe products are then cooled from 20008F and exit the cooler at 180\u00b0F. At what rate (lb/h) do the\nproducts exit the cooler? The molecular weight of C6H5Cl is 112.5; the molecular weight of\nair is 29.\n'''\n\n#Variable declaration:\nqs1 = 5000.0 #Volumetric flow rate of C6H5Cl at standard conditions (scfm)\nqs2 = 3000.0 #Volumetric flow rate of air at standard conditions (scfm)\nTa = 70+460.0 #Actual absolute temperature in Rankine scale (\u00b0R)\nTs = 60+460.0 #Standard absolute temperature in Rankine scale (\u00b0R)\nV = 387.0 #Volume occupied by one lbmol of any ideal gas (ft^3)\nM1 = 112.5 #Molecular weight of C6H5Cl (lb/lbmol)\nM2 = 29.0 #Molecular weight of air (lb/lbmol)\nT = 60.0 #Absolute temperature (\u00b0F)\n\n#Calculations:\nqa1 = qs1*(Ta/Ts) #Volumetric flow rate of C6H5Cl at actual conditions (acfm)\nqa2 = qs2*(Ta/Ts) #Volumetric flow rate of air at actual conditions (acfm)\nn1 = qa1/V #Molar flow rate of C6H5Cl (lbmol/min)\nn2 = qa2/V #Molar flow rate of air (lbmol/min)\nm1 = n1*M1*T #Mass flow rate of C6H5Cl (lb/h)\nm2 = n2*M2*T #Mass flow rate of air (lb/h)\nm_in = m1+m2 #Total mass flow rate of both streams entering the oxidizer (lb/h)\nm_out = m_in #Total mass flow rate of both streams exit the cooler (lb/h)\n\n#Result:\nprint \"The rate of the products exit the cooler is :\",round(m_out),\" lb/h\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "qs1 = 5000.0 #Volumetric flow rate of C6H5Cl at standard conditions (scfm)\n",
+ "qs2 = 3000.0 #Volumetric flow rate of air at standard conditions (scfm)\n",
+ "Ta = 70+460.0 #Actual absolute temperature in Rankine scale (\u00b0R)\n",
+ "Ts = 60+460.0 #Standard absolute temperature in Rankine scale (\u00b0R)\n",
+ "V = 387.0 #Volume occupied by one lbmol of any ideal gas (ft^3)\n",
+ "M1 = 112.5 #Molecular weight of C6H5Cl (lb/lbmol)\n",
+ "M2 = 29.0 #Molecular weight of air (lb/lbmol)\n",
+ "T = 60.0 #Absolute temperature (\u00b0F)\n",
+ "\n",
+ "#Calculations:\n",
+ "qa1 = qs1*(Ta/Ts) #Volumetric flow rate of C6H5Cl at actual conditions (acfm)\n",
+ "qa2 = qs2*(Ta/Ts) #Volumetric flow rate of air at actual conditions (acfm)\n",
+ "n1 = qa1/V #Molar flow rate of C6H5Cl (lbmol/min)\n",
+ "n2 = qa2/V #Molar flow rate of air (lbmol/min)\n",
+ "m1 = n1*M1*T #Mass flow rate of C6H5Cl (lb/h)\n",
+ "m2 = n2*M2*T #Mass flow rate of air (lb/h)\n",
+ "m_in = m1+m2 #Total mass flow rate of both streams entering the oxidizer (lb/h)\n",
+ "m_out = m_in #Total mass flow rate of both streams exit the cooler (lb/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The rate of the products exit the cooler is :\",round(m_out),\" lb/h\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of the products exit the cooler is : 102634.0 lb/h\n"
+ "text": [
+ "The rate of the products exit the cooler is : 102634.0 lb/h\n"
+ ]
}
],
"prompt_number": 11
@@ -227,19 +423,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 5.11, Page number: 64"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 5.11, Page number: 64"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The exhaust to the atmosphere from a thermal device has a SO3 concentration expressed as\n0.15 mm Hg partial pressure. Calculate the parts per million of SO3 in the exhaust.\n'''\n\n#Variable declaration:\np = 0.15 #Partial pressure of SO3 (mm Hg)\nP = 760.0 #Atmospheric pressure (mm Hg)\nm = 10**6 #Particles in a million\n\n#Calculation:\ny = p/P #Mole fraction of SO3\nppm = y*m #Parts per million of SO3 (ppm)\n\n#Result:\nprint \"The parts per million of SO3 in the exhaust is :\",round(ppm),\" ppm .\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "p = 0.15 #Partial pressure of SO3 (mm Hg)\n",
+ "P = 760.0 #Atmospheric pressure (mm Hg)\n",
+ "m = 10**6 #Particles in a million\n",
+ "\n",
+ "#Calculation:\n",
+ "y = p/P #Mole fraction of SO3\n",
+ "ppm = y*m #Parts per million of SO3 (ppm)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The parts per million of SO3 in the exhaust is :\",round(ppm),\" ppm .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The parts per million of SO3 in the exhaust is : 197.0 ppm .\n"
+ "text": [
+ "The parts per million of SO3 in the exhaust is : 197.0 ppm .\n"
+ ]
}
],
"prompt_number": 12
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_06.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_06.ipynb
index dfc904b2..e4393f65 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_06.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_06.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 06"
+ "name": "",
+ "signature": "sha256:54e2e4fc776d95c57fe6ec3f8739ba703b59fc814a535a0e713a806e8b2afe6d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,44 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 6: Heat Exchanger Pipes and Tubes"
+ "source": [
+ "Chapter 6: Heat Exchanger Pipes and Tubes"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 6.1, Page number: 73"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 6.1, Page number: 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Obtain the inside diameter in inches of 2 inch schedule 40 nominal steel pipe.\n'''\n\n#Variable declaration:\nNPS = 2 #Nominal pipe size (inch)\nSN = 40 #Schedule number\n\n#Calculation:\n#From Table 6.2, we obtain that the inside diameter of steel pipe is ID = 2.067 in.\nID = 2.067\n\n#Result:\nprint \"The inside diameter of steel pipe is :\",ID,\" in.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "NPS = 2 #Nominal pipe size (inch)\n",
+ "SN = 40 #Schedule number\n",
+ "\n",
+ "#Calculation:\n",
+ "#From Table 6.2, we obtain that the inside diameter of steel pipe is ID = 2.067 in.\n",
+ "ID = 2.067\n",
+ "\n",
+ "#Result:\n",
+ "print \"The inside diameter of steel pipe is :\",ID,\" in.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The inside diameter of steel pipe is : 2.067 in.\n"
+ "text": [
+ "The inside diameter of steel pipe is : 2.067 in.\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +58,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 6.2, Page number: 73"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 6.2, Page number: 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Determine the inside diameter (ID), outside diameter (OD), wall thickness, and pipe weight\n(in lb/ft) of 3 inch schedule 40 steel pipe.\n'''\n\n#Variable declaration:\nNPS = 3 #Nominal pipe size (inch)\nSN = 40 #Schedule number\n\n#Calculation:\n#From Table 6.2, we obtain that the inside diameter of steel pipe is ID = 3.068 in, outside diameter OD = 3.5 in, wal thickness WT = 0.216 in, and pipe weight PW = 7.58 lb/ft.\nID = 3.068\nOD = 3.5\nWT = 0.216\nPW = 7.58\n\n#Result:\nprint \"The inside diameter of steel pipe is :\",ID,\" in\"\nprint \"The outside diameter of steel pipe is :\",OD,\" in\"\nprint \"The wall thickness of steel pipe is :\",WT,\" in\"\nprint \"The weight of steel pipe is :\",PW,\" lb/ft.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "NPS = 3 #Nominal pipe size (inch)\n",
+ "SN = 40 #Schedule number\n",
+ "\n",
+ "#Calculation:\n",
+ "#From Table 6.2, we obtain that the inside diameter of steel pipe is ID = 3.068 in, outside diameter OD = 3.5 in, wal thickness WT = 0.216 in, and pipe weight PW = 7.58 lb/ft.\n",
+ "ID = 3.068\n",
+ "OD = 3.5\n",
+ "WT = 0.216\n",
+ "PW = 7.58\n",
+ "\n",
+ "#Result:\n",
+ "print \"The inside diameter of steel pipe is :\",ID,\" in\"\n",
+ "print \"The outside diameter of steel pipe is :\",OD,\" in\"\n",
+ "print \"The wall thickness of steel pipe is :\",WT,\" in\"\n",
+ "print \"The weight of steel pipe is :\",PW,\" lb/ft.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The inside diameter of steel pipe is : 3.068 in\nThe outside diameter of steel pipe is : 3.5 in\nThe wall thickness of steel pipe is : 0.216 in\nThe weight of steel pipe is : 7.58 lb/ft.\n"
+ "text": [
+ "The inside diameter of steel pipe is : 3.068 in\n",
+ "The outside diameter of steel pipe is : 3.5 in\n",
+ "The wall thickness of steel pipe is : 0.216 in\n",
+ "The weight of steel pipe is : 7.58 lb/ft.\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +105,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 6.3, Page number: 73"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 6.3, Page number: 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following information is provided for a steel pipe:\nID = 0.957 in\nOD = 1.315 in\nWall thickness = 0.179 in\nPipe weight = 2.17 lb/ft\nDetermine the nominal size and schedule number of the pipe.\n'''\n\n#Variable declaration:\nID = 0.957 #Inside diameter of pipe (in)\nOD = 1.315 #Outside diameter of pipe (in)\nWT = 0.179 #Wall thickness of pipe (in)\nPW = 2.17 #Weight of pipe (lb/ft)\n\n#Calculation:\n#From Table 6.2, it indicates that the steel pipe is 1 inch schedule 80.\nNSP = 1\nSN = 80\n\n#Result:\nprint \"The nominal size of the pipe is :\",NSP,\" in.\"\nprint \"The schedule number of the pipe is:\",SN,\".\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "ID = 0.957 #Inside diameter of pipe (in)\n",
+ "OD = 1.315 #Outside diameter of pipe (in)\n",
+ "WT = 0.179 #Wall thickness of pipe (in)\n",
+ "PW = 2.17 #Weight of pipe (lb/ft)\n",
+ "\n",
+ "#Calculation:\n",
+ "#From Table 6.2, it indicates that the steel pipe is 1 inch schedule 80.\n",
+ "NSP = 1\n",
+ "SN = 80\n",
+ "\n",
+ "#Result:\n",
+ "print \"The nominal size of the pipe is :\",NSP,\" in.\"\n",
+ "print \"The schedule number of the pipe is:\",SN,\".\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The nominal size of the pipe is : 1 in.\nThe schedule number of the pipe is: 80 .\n"
+ "text": [
+ "The nominal size of the pipe is : 1 in.\n",
+ "The schedule number of the pipe is: 80 .\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +148,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 6.4, Page number: 75"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 6.4, Page number: 75"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Determine the inside diameter, wall thickness, outside diameter, and external area per foot (EA)\nof a 3/4 inch 16 BWG tube.\n'''\n\n#Variable declaration:\nS = 3/4 #Tube size (in)\nBWG = 16 #Birmingham Wire Gauge number (gauge)\n\n#calculation:\n#From table 6.3, we get:\nID = 0.620 #Internal diameter of tube (in)\nWT = 0.065 #Wall thickness of tube (in)\nOD = ID+2*WT #Outside diameter of tube (in)\nEA = 0.1963 #External area per foot (ft)\n\n#Result:\nprint \"The inside diameter is :\",ID,\" in\"\nprint \"The wall thickness is :\",WT,\" in\"\nprint \"The outside diamater is :\",OD,\" in\"\nprint \"The external area per foot per foot :\",EA,\" ft.\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "S = 3/4 #Tube size (in)\n",
+ "BWG = 16 #Birmingham Wire Gauge number (gauge)\n",
+ "\n",
+ "#calculation:\n",
+ "#From table 6.3, we get:\n",
+ "ID = 0.620 #Internal diameter of tube (in)\n",
+ "WT = 0.065 #Wall thickness of tube (in)\n",
+ "OD = ID+2*WT #Outside diameter of tube (in)\n",
+ "EA = 0.1963 #External area per foot (ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The inside diameter is :\",ID,\" in\"\n",
+ "print \"The wall thickness is :\",WT,\" in\"\n",
+ "print \"The outside diamater is :\",OD,\" in\"\n",
+ "print \"The external area per foot per foot :\",EA,\" ft.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The inside diameter is : 0.62 in\nThe wall thickness is : 0.065 in\nThe outside diamater is : 0.75 in\nThe external area per foot per foot : 0.1963 ft.\n"
+ "text": [
+ "The inside diameter is : 0.62 in\n",
+ "The wall thickness is : 0.065 in\n",
+ "The outside diamater is : 0.75 in\n",
+ "The external area per foot per foot : 0.1963 ft.\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +194,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 6.11, Page number: 81"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 6.11, Page number: 81"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An air-conditioning duct has a rectangular cross-section of 1 m by 0.25 m. If the kinematic viscosity\nof the air is approximately 1 x 10**-5 m2/s, determine the maximum air velocity before\nthe flow becomes turbulent. Assume the critical Reynolds number is 2300.\n'''\n\n#Variable declaration:\na = 1 #Length of cross-section (m)\nb = 0.25 #Width of cross-section (m)\nv = 1*10**-5 #Kinematic viscosity of air (m^2/s)\nRe = 2300.0 #Reynolds Number\ncm = 100 #Cenitmeters in a meter\n\n#Calculation:\nDh = 2*a*b/(a+b) #Hydraulic diameter of duct (m)\nV = Re*v/Dh*cm #Maximum air velocity (cm/s)\n\n#Result:\nprint \"The maximum air velocity before the flow becomes turbulent is :\",round(V,1),\" cm/s.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "a = 1 #Length of cross-section (m)\n",
+ "b = 0.25 #Width of cross-section (m)\n",
+ "v = 1*10**-5 #Kinematic viscosity of air (m^2/s)\n",
+ "Re = 2300.0 #Reynolds Number\n",
+ "cm = 100 #Cenitmeters in a meter\n",
+ "\n",
+ "#Calculation:\n",
+ "Dh = 2*a*b/(a+b) #Hydraulic diameter of duct (m)\n",
+ "V = Re*v/Dh*cm #Maximum air velocity (cm/s)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The maximum air velocity before the flow becomes turbulent is :\",round(V,1),\" cm/s.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The maximum air velocity before the flow becomes turbulent is : 5.8 cm/s.\n"
+ "text": [
+ "The maximum air velocity before the flow becomes turbulent is : 5.8 cm/s.\n"
+ ]
}
],
"prompt_number": 11
@@ -122,19 +235,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 6.12, Page number: 82"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 6.12, Page number: 82"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A circular 2-inch diameter horizontal tube contains a cold liquid fluid of density and viscosity\n70 lb/ft3 and 0.1806 lb/ft . s, respectively. If, the flow rate is 0.486 ft3/s, determine if the flow\nis laminar.\n'''\n\n#Variable declaration:\nq = 0.486 #Flow rate of fluid (ft^3/s)\nD = 2.0/12.0 #Diameter of tube in feet (ft)\npi = 3.14 #Value of pi\np = 70.0 #Density of fluid (lb/ft^3)\nu = 0.1806 #Viscosity of fluid (lb/ft)\n\n#Calculation:\nV = 4*q/pi/D**2 #Flow velocity (ft/s)\nRe = D*V*p/u #Reynolds Number\n\n#Result:\nif(Re<2100):\n print \"The flow is laminar.\"\nelif(Re>2100):\n print \"The flow is turbulant.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "q = 0.486 #Flow rate of fluid (ft^3/s)\n",
+ "D = 2.0/12.0 #Diameter of tube in feet (ft)\n",
+ "pi = 3.14 #Value of pi\n",
+ "p = 70.0 #Density of fluid (lb/ft^3)\n",
+ "u = 0.1806 #Viscosity of fluid (lb/ft)\n",
+ "\n",
+ "#Calculation:\n",
+ "V = 4*q/pi/D**2 #Flow velocity (ft/s)\n",
+ "Re = D*V*p/u #Reynolds Number\n",
+ "\n",
+ "#Result:\n",
+ "if(Re<2100):\n",
+ " print \"The flow is laminar.\"\n",
+ "elif(Re>2100):\n",
+ " print \"The flow is turbulant.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The flow is laminar.\n"
+ "text": [
+ "The flow is laminar.\n"
+ ]
}
],
"prompt_number": 12
@@ -143,19 +279,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 6.13, Page number: 82"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 6.13, Page number: 82"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 6.12. How long must the pipe be to ensure a fully developed flow?'''\n\n#Variable declaration:\n#From example 6.12, we have:\nD = 2.0/12.0 #Diameter of pipe in feet (ft)\nRe = 1440.0 #Reynolds number\n\n#Calculation:\nLc = 0.05*D*Re #Length of pipe (ft)\n\n#Result:\nprint \"The pipe length to ensure a fully developed flow is:\",Lc,\" ft.\"\nprint \"This is an abnormally long calming length for a pipe (or tube) in a heat exchanger.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 6.12, we have:\n",
+ "D = 2.0/12.0 #Diameter of pipe in feet (ft)\n",
+ "Re = 1440.0 #Reynolds number\n",
+ "\n",
+ "#Calculation:\n",
+ "Lc = 0.05*D*Re #Length of pipe (ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The pipe length to ensure a fully developed flow is:\",Lc,\" ft.\"\n",
+ "print \"This is an abnormally long calming length for a pipe (or tube) in a heat exchanger.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The pipe length to ensure a fully developed flow is: 12.0 ft.\nThis is an abnormally long calming length for a pipe (or tube) in a heat exchanger.\n"
+ "text": [
+ "The pipe length to ensure a fully developed flow is: 12.0 ft.\n",
+ "This is an abnormally long calming length for a pipe (or tube) in a heat exchanger.\n"
+ ]
}
],
"prompt_number": 22
@@ -164,19 +319,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 6.14, Page number: 82"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 6.14, Page number: 82"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the average velocity of water flowing in a 2-inch schedule 40 standard pipe at 608F for\nwhich the flow is viscous (laminar).\n'''\n\n#Variable declaration:\nu = 6.72*10**-4 #Viscosity of water (lb/ft.s)\np = 62.4 #Density of water (lb/ft^3)\n#For laminar flow:\nRe = 2100.0 #Reynolds number\n#From table 6.2, we have:\nD = 2.067/12.0 #Inside diameter of pipe (ft)\n\n#Calculation:\nV = Re*u/D/p #Average velocity of water flowing (ft/s)\n\n#Result:\nprint \"The average velocity of water flowing is:\",round(V,2),\" ft/s.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "u = 6.72*10**-4 #Viscosity of water (lb/ft.s)\n",
+ "p = 62.4 #Density of water (lb/ft^3)\n",
+ "#For laminar flow:\n",
+ "Re = 2100.0 #Reynolds number\n",
+ "#From table 6.2, we have:\n",
+ "D = 2.067/12.0 #Inside diameter of pipe (ft)\n",
+ "\n",
+ "#Calculation:\n",
+ "V = Re*u/D/p #Average velocity of water flowing (ft/s)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The average velocity of water flowing is:\",round(V,2),\" ft/s.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The average velocity of water flowing is: 0.13 ft/s.\n"
+ "text": [
+ "The average velocity of water flowing is: 0.13 ft/s.\n"
+ ]
}
],
"prompt_number": 14
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_07.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_07.ipynb
index 939dc2b5..bfa882d7 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_07.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_07.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 07"
+ "name": "",
+ "signature": "sha256:057d6eaa086db820c820c1a5a80f0143b18739ecbe1b8c285287723cf460e4b6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 7: Steady-State Heat Conduction"
+ "source": [
+ "Chapter 7: Steady-State Heat Conduction"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 7.1, Page number: 93"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 7.1, Page number: 93"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A glass window is 1 cm thick and has an area of 3 m^2. The temperature at the outer surface is\n10\u00b0C. The glass has a conductivity of 1.4 W/m . K. The heat transfer rate is 3 kW. Calculate\nthe temperature at the inner surface.\n'''\n\n#Variable declaration:\nQ = 3000.0 #The rate of heat flow through the glass window (W)\nL = 0.01 #Thickness of glass window (m)\nA = 3.0 #Area of heat transfer (m^2)\nTC = 10+273 #Temperature at the outside surface (K)\nk = 1.4 #Thermal onductivity of glass (W/m.K)\n\n#Calculation:\nTH = TC+Q*L/k/A #Temperature at the inner surface (K)\n\n#Result:\nprint \"The temperature at the inner surface is :\",round(TH,1),\" K\"\nprint \"The temperature at the inner surface is :\",round(TH-273,1),\" \u00b0C\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Q = 3000.0 #The rate of heat flow through the glass window (W)\n",
+ "L = 0.01 #Thickness of glass window (m)\n",
+ "A = 3.0 #Area of heat transfer (m^2)\n",
+ "TC = 10+273 #Temperature at the outside surface (K)\n",
+ "k = 1.4 #Thermal onductivity of glass (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "TH = TC+Q*L/k/A #Temperature at the inner surface (K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The temperature at the inner surface is :\",round(TH,1),\" K\"\n",
+ "print \"The temperature at the inner surface is :\",round(TH-273,1),\" \u00b0C\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The temperature at the inner surface is : 290.1 K\nThe temperature at the inner surface is : 17.1 \u00b0C\n"
+ "text": [
+ "The temperature at the inner surface is : 290.1 K\n",
+ "The temperature at the inner surface is : 17.1 \u00b0C\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +62,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 7.2, Page number: 94"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 7.2, Page number: 94"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A new 1 ft thick insulating material was recently tested for heat resistant properties. The data\nrecorded temperatures of 70\u00b0F and 210\u00b0F on the cold and hot sides, respectively. If the thermal\nconductivity of the insulating material is 0.026 Btu/ft . h . \u00b0F, calculate the rate of the heat flux,\nQ/A, through the wall in Btu/ft^2 . h. Resolve the problem in SI units.\n'''\n\n#Variable declaration:\nk = 0.026 #Thermal conductivity of insulating material (Btu/ft.h.\u00b0F)\nL = 1.0 #Thickness of insulating material (ft)\nTC = 70.0 #Temperature on the cold side surface (\u00b0F)\nTH = 210.0 #Temperature on the hot side surface (\u00b0F)\nc = 0.252 #Kilocalorie per hour in a Btu per hour\nm = 0.093 #meter square in a feet square\n\n#Calculation:\nDT = TH-TC #Change in temperature (\u00b0F)\nQ1 = k*DT/L #Rate of heat flux throughthe wall (Btu/f^t2.h.)\nQ2 = Q1*c/m #Rate of heat flux throughthe wall in SI units (kcal/m^2.h)\n\n#Result:\nprint \"The rate of heat flux in Btu/ft^2.h is :\",round(Q1,3),\" Btu/ft^2.h .\"\nprint \"The rate of heat flux in SI units is :\",round(Q2,3),\" kcal/m^2.h .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "k = 0.026 #Thermal conductivity of insulating material (Btu/ft.h.\u00b0F)\n",
+ "L = 1.0 #Thickness of insulating material (ft)\n",
+ "TC = 70.0 #Temperature on the cold side surface (\u00b0F)\n",
+ "TH = 210.0 #Temperature on the hot side surface (\u00b0F)\n",
+ "c = 0.252 #Kilocalorie per hour in a Btu per hour\n",
+ "m = 0.093 #meter square in a feet square\n",
+ "\n",
+ "#Calculation:\n",
+ "DT = TH-TC #Change in temperature (\u00b0F)\n",
+ "Q1 = k*DT/L #Rate of heat flux throughthe wall (Btu/f^t2.h.)\n",
+ "Q2 = Q1*c/m #Rate of heat flux throughthe wall in SI units (kcal/m^2.h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The rate of heat flux in Btu/ft^2.h is :\",round(Q1,3),\" Btu/ft^2.h .\"\n",
+ "print \"The rate of heat flux in SI units is :\",round(Q2,3),\" kcal/m^2.h .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of heat flux in Btu/ft^2.h is : 3.64 Btu/ft^2.h .\nThe rate of heat flux in SI units is : 9.863 kcal/m^2.h .\n"
+ "text": [
+ "The rate of heat flux in Btu/ft^2.h is : 3.64 Btu/ft^2.h .\n",
+ "The rate of heat flux in SI units is : 9.863 kcal/m^2.h .\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +107,55 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 7.3, Page number: 94"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 7.3, Page number: 94"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following information is provided. A rectangular furnace wall is made of fire clay (height,\nH = 3 m, width, W = 1.2 m, thickness, L = 0.17 m). Temperature of inside surface (area =\nH x W), TH, is 1592 K, and of the outside surface (area = H x W), TC, is 1364 K.\nDetermine the temperature gradient, the heat transfer rate, and the heat transfer flux.\n'''\n\n#Variable declaration:\nTH = 1592.0 #Temperature of inside surface (K)\nTC = 1364.0 #Temperature of outside surface (K)\nH = 3.0 #Height of furnace wall (m)\nW = 1.2 #Width of furnace wall (m)\nL = 0.17 #Thickness furnace wall (m)\nm = 0.0929 #Meter square per second in a feet square per second\nBtu = 3.412 #Btu per hour in a Watt\nBtu2 = 0.3171 #Btu per feet square hour in a watt per meter square\n\n#Calculation:\nTav = (TH+TC)/2 #Average wall temperature (K)\n#From Table in Appendix:\np = 2645.0 #Density of material (kg/m^3)\nk = 1.8 #Thermal conductivity (W/m.K)\nCp = 960.0 #Heat capacity of material (J/kg.K)\na = k/(p*Cp)/m #Thermal diffusivity (ft^2/s)\nt = (TC-TH)/L #Temperature gradient (\u00b0C/m)\nA = H*W #Heat transfer area (m^2)\nQ1 = k*A*(TH-TC)/L*Btu #Heat transfer rate (Btu/h)\nQ2 = k*(TH-TC)/L*Btu2 #Heat transfer flux (Btu/h.ft^2)\nR = L/(k*A) #Thermal resistance (\u00b0C/W)\n\n#Result:\nprint \"The temperature gradient is :\",round(t),\" \u00b0C/m.\"\nprint \"The heat transfer rate is :\",round(Q1),\" Btu/h.\"\nprint \"The heat transfer flux is :\",round(Q2,1),\" Btu/h.ft^2.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "TH = 1592.0 #Temperature of inside surface (K)\n",
+ "TC = 1364.0 #Temperature of outside surface (K)\n",
+ "H = 3.0 #Height of furnace wall (m)\n",
+ "W = 1.2 #Width of furnace wall (m)\n",
+ "L = 0.17 #Thickness furnace wall (m)\n",
+ "m = 0.0929 #Meter square per second in a feet square per second\n",
+ "Btu = 3.412 #Btu per hour in a Watt\n",
+ "Btu2 = 0.3171 #Btu per feet square hour in a watt per meter square\n",
+ "\n",
+ "#Calculation:\n",
+ "Tav = (TH+TC)/2 #Average wall temperature (K)\n",
+ "#From Table in Appendix:\n",
+ "p = 2645.0 #Density of material (kg/m^3)\n",
+ "k = 1.8 #Thermal conductivity (W/m.K)\n",
+ "Cp = 960.0 #Heat capacity of material (J/kg.K)\n",
+ "a = k/(p*Cp)/m #Thermal diffusivity (ft^2/s)\n",
+ "t = (TC-TH)/L #Temperature gradient (\u00b0C/m)\n",
+ "A = H*W #Heat transfer area (m^2)\n",
+ "Q1 = k*A*(TH-TC)/L*Btu #Heat transfer rate (Btu/h)\n",
+ "Q2 = k*(TH-TC)/L*Btu2 #Heat transfer flux (Btu/h.ft^2)\n",
+ "R = L/(k*A) #Thermal resistance (\u00b0C/W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The temperature gradient is :\",round(t),\" \u00b0C/m.\"\n",
+ "print \"The heat transfer rate is :\",round(Q1),\" Btu/h.\"\n",
+ "print \"The heat transfer flux is :\",round(Q2,1),\" Btu/h.ft^2.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The temperature gradient is : -1341.0 \u00b0C/m.\nThe heat transfer rate is : 29653.0 Btu/h.\nThe heat transfer flux is : 765.5 Btu/h.ft^2.\n"
+ "text": [
+ "The temperature gradient is : -1341.0 \u00b0C/m.\n",
+ "The heat transfer rate is : 29653.0 Btu/h.\n",
+ "The heat transfer flux is : 765.5 Btu/h.ft^2.\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +164,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 7.4, Page number: 96"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 7.4, Page number: 96"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A concrete wall has a surface area of 30 m^2 and is 0.30 m thick. It separates warm room air from\ncold ambient air. The inner surface of the wall is known to be at a temperature of 25\u00b0C, while the\nouter surface is at -15\u00b0C. The thermal conductivity of the concrete is 1.0 W/m . K.\n1. Describe the conditions that must be satisfied in order for the temperature distribution in\nthe wall to be linear.\n2. What is the driving force for the transfer of heat?\n3. What is the heat loss through the wall?\n'''\n\n#Variable declaration:\nTH = 25.0 #Temperature at inner suface of wall (\u00b0C)\nTC = -15.0 #Temperature at outer suface of wall (\u00b0C)\nL = 0.3 #Thickness of wall (m)\nk = 1.0 #Thermal conductivity of concrete (W/m)\nA = 30.0 #Sueface area of wall (m^2)\n\n#Calculation:\nDT = TH-TC #Driving force for heat transfer (\u00b0C) (part 2)\nR = L/(k*A) #Thermal resistance (\u00b0C/W) (part 3)\nQ = DT/R/10**3 #Heat loss through the wall (kW)\n\n#Result:\nprint \"1. Theoretical part.\"\nprint \"2. The driving force for heat transfer is :\",DT,\" \u00b0C.\"\nprint \"3. The heat loss through the wall is :\",Q,\" kW.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "TH = 25.0 #Temperature at inner suface of wall (\u00b0C)\n",
+ "TC = -15.0 #Temperature at outer suface of wall (\u00b0C)\n",
+ "L = 0.3 #Thickness of wall (m)\n",
+ "k = 1.0 #Thermal conductivity of concrete (W/m)\n",
+ "A = 30.0 #Sueface area of wall (m^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT = TH-TC #Driving force for heat transfer (\u00b0C) (part 2)\n",
+ "R = L/(k*A) #Thermal resistance (\u00b0C/W) (part 3)\n",
+ "Q = DT/R/10**3 #Heat loss through the wall (kW)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. Theoretical part.\"\n",
+ "print \"2. The driving force for heat transfer is :\",DT,\" \u00b0C.\"\n",
+ "print \"3. The heat loss through the wall is :\",Q,\" kW.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. Theoretical part.\n2. The driving force for heat transfer is : 40.0 \u00b0C.\n3. The heat loss through the wall is : 4.0 kW.\n"
+ "text": [
+ "1. Theoretical part.\n",
+ "2. The driving force for heat transfer is : 40.0 \u00b0C.\n",
+ "3. The heat loss through the wall is : 4.0 kW.\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +210,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 7.5, Page number: 97"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 7.5, Page number: 97"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The inside and outside temperatures of the walls of a room are 27\u00b0C and 68.7\u00b0C, respectively.\nThe room walls consist of 6-inch concrete (C), 8-inch cork-board (B), and 1-inch wood (W) with\ncorresponding thermal conductivities of 0.762, 0.0433, and 0.151W/m . K, respectively.\nCalculate the heat transfer rate across the wall and determine the temperature at the interface\nbetween the wood and the cork-board.\n'''\n\n#Variable declaration:\nTC = 27.0 #Inside temperature of walls (\u00b0C)\nTH = 68.7 #Outside temperature of walls (\u00b0C)\nLC = 6*0.0254 #Thickness of concrete (m)\nLB = 8*0.0254 #Thickness of cork-board (m)\nLW = 1*0.0254 #Thickness of wood (m)\nkC = 0.762 #Thermal conductivity of concrete (W/m.K)\nkB = 0.0433 #Thermal conductivity of cork-board (W/m.K)\nkW = 0.151 #Thermal conductivity of wood (W/m.K)\n\n#Calculation:\nRC = LC/kC #Thermal resistance of concrete (K/W)\nRB = LB/kB #Thermal resistance of cork-board (K/W)\nRW = LW/kW #Thermal resistance of wood (K/W)\nQ = (TC-TH)/(RC+RB+RW) #Heat transfer rate across the wall (W)\nT = -(Q*RW-TC) #Interface temperature between wood and cork-board (K)\n\n#Result:\nprint \"The heat transfer rate across the wall is :\",round(Q,3),\" W.\"\nprint \"The interface temperature between wood and cork-board is :\",round(T,1),\" \u00b0C.\"\nprint \"The interface temperature between wood and cork-board is :\",round(T+273,1),\" K.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "TC = 27.0 #Inside temperature of walls (\u00b0C)\n",
+ "TH = 68.7 #Outside temperature of walls (\u00b0C)\n",
+ "LC = 6*0.0254 #Thickness of concrete (m)\n",
+ "LB = 8*0.0254 #Thickness of cork-board (m)\n",
+ "LW = 1*0.0254 #Thickness of wood (m)\n",
+ "kC = 0.762 #Thermal conductivity of concrete (W/m.K)\n",
+ "kB = 0.0433 #Thermal conductivity of cork-board (W/m.K)\n",
+ "kW = 0.151 #Thermal conductivity of wood (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "RC = LC/kC #Thermal resistance of concrete (K/W)\n",
+ "RB = LB/kB #Thermal resistance of cork-board (K/W)\n",
+ "RW = LW/kW #Thermal resistance of wood (K/W)\n",
+ "Q = (TC-TH)/(RC+RB+RW) #Heat transfer rate across the wall (W)\n",
+ "T = -(Q*RW-TC) #Interface temperature between wood and cork-board (K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate across the wall is :\",round(Q,3),\" W.\"\n",
+ "print \"The interface temperature between wood and cork-board is :\",round(T,1),\" \u00b0C.\"\n",
+ "print \"The interface temperature between wood and cork-board is :\",round(T+273,1),\" K.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate across the wall is : -8.239 W.\nThe interface temperature between wood and cork-board is : 28.4 \u00b0C.\nThe interface temperature between wood and cork-board is : 301.4 K.\n"
+ "text": [
+ "The heat transfer rate across the wall is : -8.239 W.\n",
+ "The interface temperature between wood and cork-board is : 28.4 \u00b0C.\n",
+ "The interface temperature between wood and cork-board is : 301.4 K.\n"
+ ]
}
],
"prompt_number": 5
@@ -122,19 +261,52 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 7.6, Page number: 98"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 7.6, Page number: 98"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A 3-inch outside diameter steel pipe is covered with a 1/2-inch layer of asbestos, (a), which in turn\nis covered with a 2-inch layer of glass wool, (b). Determine the steady-state heat transfer per foot\nof pipe, Z, if the pipe outer surface temperature is 500\u00b0F and the glass wool outer temperature\nis 100\u00b0F.\nAssume an asbestos\u2013glass wool interfacial temperature of 300\u00b0F and an average asbestos (a)\ntemperature of 200\u00b0F and glass wool (b) temperature of 400\u00b0F. Based on a literature review,\nasbestos and glass wool thermal conductivity values have been estimated to be:\nk(a)(200\u00b0F) = 0.120 Btu=h . ft . \u00b0F\nk(b)(400\u00b0F) = 0.0317 Btu=h . ft . \u00b0F\n'''\n\nfrom math import pi, log\nfrom sympy import symbols\n\n#Variable declaration:\nZ = symbols ('z') #Length of pipe\nD1s = 4.0 #Glass wool inside diameter (in)\nD2s = 8.0 #Glass wool outside diameter (in)\nD1a = 3.0 #Asbestos inside diameter (in)\nD2a = 4.0 #Asbestos outside diameter (in)\nTH = 500.0 #Outer surface temperature of pipe (\u00b0F)\nTC = 100.0 #Outer surface temperature of glass wool (\u00b0F)\nLa = 0.5/12.0 #Thickness of asbestos (ft)\nLb = 2.0/12.0 #Thickness of glss wool (ft)\nka = 0.120 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\nkb = 0.0317 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\n\n#Calculation:\nAa = (pi*Z*(D2a-D1a)/12.0)/log(D2a/D1a) #Area of asbestos (ft^2)\nAb = (pi*Z*(D2s-D1s)/12.0)/log(D2s/D1s) #Area of glass wool (ft^2)\nQ1 = (TH-TC)/(La/(ka*Aa)+Lb/(kb*Ab)) #Steady-state heat transfer per foot of pipe (Btu/h.)\nQ2 = Q1/Z #Factorization of Q/Z (Btu/h.ft)\n\n#Result:\nprint \"The steady-state heat transfer per foot of pipe, Z, is :\",round(Q1/Z,1),\" x z Btu/h.\"\nprint \"The steady-state heat transfer factorizating out Z is :\",round(Q2,1),\" Btu/h.ft.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi, log\n",
+ "from sympy import symbols\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Z = symbols ('z') #Length of pipe\n",
+ "D1s = 4.0 #Glass wool inside diameter (in)\n",
+ "D2s = 8.0 #Glass wool outside diameter (in)\n",
+ "D1a = 3.0 #Asbestos inside diameter (in)\n",
+ "D2a = 4.0 #Asbestos outside diameter (in)\n",
+ "TH = 500.0 #Outer surface temperature of pipe (\u00b0F)\n",
+ "TC = 100.0 #Outer surface temperature of glass wool (\u00b0F)\n",
+ "La = 0.5/12.0 #Thickness of asbestos (ft)\n",
+ "Lb = 2.0/12.0 #Thickness of glss wool (ft)\n",
+ "ka = 0.120 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\n",
+ "kb = 0.0317 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Aa = (pi*Z*(D2a-D1a)/12.0)/log(D2a/D1a) #Area of asbestos (ft^2)\n",
+ "Ab = (pi*Z*(D2s-D1s)/12.0)/log(D2s/D1s) #Area of glass wool (ft^2)\n",
+ "Q1 = (TH-TC)/(La/(ka*Aa)+Lb/(kb*Ab)) #Steady-state heat transfer per foot of pipe (Btu/h.)\n",
+ "Q2 = Q1/Z #Factorization of Q/Z (Btu/h.ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The steady-state heat transfer per foot of pipe, Z, is :\",round(Q1/Z,1),\" x z Btu/h.\"\n",
+ "print \"The steady-state heat transfer factorizating out Z is :\",round(Q2,1),\" Btu/h.ft.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The steady-state heat transfer per foot of pipe, Z, is : 103.6 x z Btu/h.\nThe steady-state heat transfer factorizating out Z is : 103.6 Btu/h.ft.\n"
+ "text": [
+ "The steady-state heat transfer per foot of pipe, Z, is : 103.6 x z Btu/h.\n",
+ "The steady-state heat transfer factorizating out Z is : 103.6 Btu/h.ft.\n"
+ ]
}
],
"prompt_number": 6
@@ -143,19 +315,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 7.7, Page number: 99"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 7.7, Page number: 99"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to the previous example. Calculate the outer asbestos temperature, Ti (i.e., the interfacial\ntemperature between the asbestos and glass wool).\n'''\n\n#Variable declaration:\n#From example 7.6:\nTH = 500 #Outer surface temperature of pipe (\u00b0F)\nLb = 2.0/12.0 #Thickness of glss wool (ft)\nkb = 0.0317 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\nAb = 1.51 #Area of glass wool (ft^2)\nQ = 103.5 #Steady-state heat transfer per foot of pipe (Btu/h.)\nLa = 0.5/12.0 #Thickness of asbestos (ft)\nka = 0.120 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\nAa = 0.91 #Area of asbestos (ft^2)\nTC = 100 #Outer surface temperature of glass wool (\u00b0F)\n\n#Calculation:\nTi_b = -((Lb*Q)/(kb*Ab)-TH) #Interfacial temperature of glass wool layer (\u00b0F)\nTi_a = (Q*La)/(ka*Aa)+TC #Interfacial temperature of asbestos layer (\u00b0F)\n\n#Result:\nprint \"The interfacial temperature of glass wool layer is :\",round(Ti_b),\" \u00b0F.\"\nprint \"The interfacial temperature of asbestos layer is :\",round(Ti_a,1),\" \u00b0F.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 7.6:\n",
+ "TH = 500 #Outer surface temperature of pipe (\u00b0F)\n",
+ "Lb = 2.0/12.0 #Thickness of glss wool (ft)\n",
+ "kb = 0.0317 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\n",
+ "Ab = 1.51 #Area of glass wool (ft^2)\n",
+ "Q = 103.5 #Steady-state heat transfer per foot of pipe (Btu/h.)\n",
+ "La = 0.5/12.0 #Thickness of asbestos (ft)\n",
+ "ka = 0.120 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\n",
+ "Aa = 0.91 #Area of asbestos (ft^2)\n",
+ "TC = 100 #Outer surface temperature of glass wool (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Ti_b = -((Lb*Q)/(kb*Ab)-TH) #Interfacial temperature of glass wool layer (\u00b0F)\n",
+ "Ti_a = (Q*La)/(ka*Aa)+TC #Interfacial temperature of asbestos layer (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The interfacial temperature of glass wool layer is :\",round(Ti_b),\" \u00b0F.\"\n",
+ "print \"The interfacial temperature of asbestos layer is :\",round(Ti_a,1),\" \u00b0F.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The interfacial temperature of glass wool layer is : 140.0 \u00b0F.\nThe interfacial temperature of asbestos layer is : 139.5 \u00b0F.\n"
+ "text": [
+ "The interfacial temperature of glass wool layer is : 140.0 \u00b0F.\n",
+ "The interfacial temperature of asbestos layer is : 139.5 \u00b0F.\n"
+ ]
}
],
"prompt_number": 7
@@ -164,19 +363,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 7.8, Page number: 100"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 7.8, Page number: 100"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The temperature of the solid slab pictured in Figure 7.4 is given by the expression\nT = 100cos(pz/2h)\nCalculate the heat flux at z = 0 and z = h in terms of the thermal conductivity and h. Comment\non the results.\n'''\n\nfrom sympy import cos,symbols,diff,pi\n\n#Variable declaration:\nz,h,k = symbols('z, h, k') #Length, height, thermal conductivity\nT = 100*cos((pi*z)/(2*h)) #Temperature of solid slab\n\n#Calculation:\nDT = diff(T,z) #Temperature at z\nQ = -k*(DT) #Heat flux in slab (Btu/s.ft^2)\nQ1 = Q.subs(z,0) #Heat flux in slab at z = 0 (Btu/s.ft^2)\nQ2 = Q.subs(z,h) #Heat flux in slab at z = h (Btu/s.ft^2)\n\n#Result:\nprint \"The heat flux in slab is :\",Q,\" Btu/s.ft^2 .\"\nprint \"The heat flux in slab at z = 0 is :\",Q1,\" Btu/s.ft^2 .\"\nprint \"The heat flux in slab at z = h is :5\",Q2,\" Btu/s.ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from sympy import cos,symbols,diff,pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "z,h,k = symbols('z, h, k') #Length, height, thermal conductivity\n",
+ "T = 100*cos((pi*z)/(2*h)) #Temperature of solid slab\n",
+ "\n",
+ "#Calculation:\n",
+ "DT = diff(T,z) #Temperature at z\n",
+ "Q = -k*(DT) #Heat flux in slab (Btu/s.ft^2)\n",
+ "Q1 = Q.subs(z,0) #Heat flux in slab at z = 0 (Btu/s.ft^2)\n",
+ "Q2 = Q.subs(z,h) #Heat flux in slab at z = h (Btu/s.ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat flux in slab is :\",Q,\" Btu/s.ft^2 .\"\n",
+ "print \"The heat flux in slab at z = 0 is :\",Q1,\" Btu/s.ft^2 .\"\n",
+ "print \"The heat flux in slab at z = h is :5\",Q2,\" Btu/s.ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat flux in slab is : 50*pi*k*sin(pi*z/(2*h))/h Btu/s.ft^2 .\nThe heat flux in slab at z = 0 is : 0 Btu/s.ft^2 .\nThe heat flux in slab at z = h is :5 50*pi*k/h Btu/s.ft^2 .\n"
+ "text": [
+ "The heat flux in slab is : 50*pi*k*sin(pi*z/(2*h))/h Btu/s.ft^2 .\n",
+ "The heat flux in slab at z = 0 is : 0 Btu/s.ft^2 .\n",
+ "The heat flux in slab at z = h is :5 50*pi*k/h Btu/s.ft^2 .\n"
+ ]
}
],
"prompt_number": 8
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_08.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_08.ipynb
index cb9b01d8..51da1dc2 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_08.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_08.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 08"
+ "name": "",
+ "signature": "sha256:f803274ef7ccff0534bae20ab018bc7691f3977ae1b9f41d5ea33a08004d0ffb"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,56 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 8: Unsteady-State Heat Conduction"
+ "source": [
+ "Chapter 8: Unsteady-State Heat Conduction"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 8.4, Page number: 122"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 8.4, Page number: 122"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 8.3. If TS represents saturated steam at 15 psig, the initial temperature\nTA is 71\u00b0F, and the rod is 20 inches in length of stainless steel with k = 9.1 Btu/h . ft . \u00b0F,\nr = 0.29 lb/in3, and cp = 0.12 Btu/lb . \u00b0F, calculate the temperature 0.875 inches from one of\nthe ends after 30 minutes. Note: This unit was designed by the author and is located in the Unit\nOperations Laboratory of Manhattan College.\n'''\n\nfrom math import pi,sin,e\n\n#Variable declaration:\nk = 9.1 #Thermal coductivity of steel rod (Btu/h.ft.\u00b0F)\np = 0.29*1728 #Density of steel rod (lb/ft^3)\nCp = 0.12 #Heat capacity of steel rod (Btu/lb.\u00b0F)\nP = 15+14.7 #Absolute pressure (psia)\nTa = 71.0 #Initial temperature (\u00b0F)\nL = 20.0/12.0 #Length of rod (ft)\nt = 30.0/60.0 #Time taken (h)\nx = 0.875/12.0 #Length from one of end (ft)\n#From assumption:\nn = 1.0 #First term\n#From tables in Appendix:\nTs = 249.7 #Saturated steam temperature (\u00b0F)\n\n#Calculation:\na = k/(p*Cp) #Thermal diffusivity (ft^2/s)\nT = Ts+(Ta-Ts)*(((n+1)*(-1)**2 + 1 )/pi)*e**((-a*((n*pi)/L)**2)*t)*sin((n*pi*x)/L) #Temperature 0.875 inches from one of the ends after 30 minutes (\u00b0F)\n\n#Result:\nprint \"The temperature 0.875 inches from one of the ends after 30 minutes is :\",round(T),\" \u00b0F.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi,sin,e\n",
+ "\n",
+ "#Variable declaration:\n",
+ "k = 9.1 #Thermal coductivity of steel rod (Btu/h.ft.\u00b0F)\n",
+ "p = 0.29*1728 #Density of steel rod (lb/ft^3)\n",
+ "Cp = 0.12 #Heat capacity of steel rod (Btu/lb.\u00b0F)\n",
+ "P = 15+14.7 #Absolute pressure (psia)\n",
+ "Ta = 71.0 #Initial temperature (\u00b0F)\n",
+ "L = 20.0/12.0 #Length of rod (ft)\n",
+ "t = 30.0/60.0 #Time taken (h)\n",
+ "x = 0.875/12.0 #Length from one of end (ft)\n",
+ "#From assumption:\n",
+ "n = 1.0 #First term\n",
+ "#From tables in Appendix:\n",
+ "Ts = 249.7 #Saturated steam temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "a = k/(p*Cp) #Thermal diffusivity (ft^2/s)\n",
+ "T = Ts+(Ta-Ts)*(((n+1)*(-1)**2 + 1 )/pi)*e**((-a*((n*pi)/L)**2)*t)*sin((n*pi*x)/L) #Temperature 0.875 inches from one of the ends after 30 minutes (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The temperature 0.875 inches from one of the ends after 30 minutes is :\",round(T),\" \u00b0F.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The temperature 0.875 inches from one of the ends after 30 minutes is : 232.0 \u00b0F.\n"
+ "text": [
+ "The temperature 0.875 inches from one of the ends after 30 minutes is : 232.0 \u00b0F.\n"
+ ]
}
],
"prompt_number": 4
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_09.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_09.ipynb
index f6fe87e6..cba4bd5f 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_09.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_09.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 09"
+ "name": "",
+ "signature": "sha256:717821d247948d7fb9af37b8a67927013610ff26888719ba58ba9ef00c80f713"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 9: Forced Convection"
+ "source": [
+ "Chapter 9: Forced Convection"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.1, Page number: 135"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.1, Page number: 135"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Consider a closed cylindrical reactor vessel of diameter D = 1 ft, and length L = 1.5 ft. The surface\ntemperature of the vessel, T1, and the surrounding temperature, T2, are 390\u00b0F and 50\u00b0F,\nrespectively. The convective heat transfer coefficient, h, between the vessel wall and surrounding\nfluid is 4.0 Btu/h . ft . \u00b0F. Calculate the thermal resistance in \u00b0F . h/Btu.\n'''\n\n#Variable declaration:\nD = 1.0 #Diamete of vessel (ft)\nL = 1.5 #Length of vessel (ft)\nT1 = 390.0 #Surface temperature of vessel (\u00b0F)\nT2 = 50.0 #Surrounding temperature of vessel (\u00b0F)\nh = 4.0 #Convective heat transfer coefficient (Btu/h.ft.\u00b0F)\n\n#Calculation:\nA = pi*D*L+2*pi*(D/2)**2 #Total heat transfer area (ft^2)\nQ = h*A*(T1-T2) #Rate of heat transfer (Btu/h)\nR = 1/(h*A) #Thermal resistance (\u00b0F.h/Btu)\n\n#Result:\nprint \"The thermal resistance of vessel wal is :\",round(R,4),\" \u00b0F.h/Btu .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "D = 1.0 #Diamete of vessel (ft)\n",
+ "L = 1.5 #Length of vessel (ft)\n",
+ "T1 = 390.0 #Surface temperature of vessel (\u00b0F)\n",
+ "T2 = 50.0 #Surrounding temperature of vessel (\u00b0F)\n",
+ "h = 4.0 #Convective heat transfer coefficient (Btu/h.ft.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = pi*D*L+2*pi*(D/2)**2 #Total heat transfer area (ft^2)\n",
+ "Q = h*A*(T1-T2) #Rate of heat transfer (Btu/h)\n",
+ "R = 1/(h*A) #Thermal resistance (\u00b0F.h/Btu)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The thermal resistance of vessel wal is :\",round(R,4),\" \u00b0F.h/Btu .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The thermal resistance of vessel wal is : 0.0398 \u00b0F.h/Btu .\n"
+ "text": [
+ "The thermal resistance of vessel wal is : 0.0398 \u00b0F.h/Btu .\n"
+ ]
}
],
"prompt_number": 9
@@ -38,19 +62,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.2, Page number: 135"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.2, Page number: 135"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Referring to the previous example, convert the resistance to K/W and \u00b0C/W.\n'''\n\n#Variable declaration:\n#From example 9.1:\nR = 0.0398 #Theral resistance (\u00b0F.h/Btu)\nBtu = 3.412 #Btu/h in a watt\nC = 1.8 #Change in degree fahrenheit for a degree change in celsius\nK = 1 #Change in degree celsius for a unit change in Kelvin\n\n#Calculation:\nRc = R*Btu/C #Thermal resistance in degree cesius per watt (\u00b0C/W)\nRk = Rc/K #Thermal resistance in Kelvin per watt (K/W)\n\n#Result:\nprint \"The thermal resistance in \u00b0C/W is :\",round(Rc,3),\" \u00b0C/W.\"\nprint \"The thermal resistance in K/W is :\",round(Rk,3),\" K/W.\"",
+ "input": [
+ "'''Referring to the previous example, convert the resistance to K/W and \u00b0C/W.\n",
+ "'''\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 9.1:\n",
+ "R = 0.0398 #Theral resistance (\u00b0F.h/Btu)\n",
+ "Btu = 3.412 #Btu/h in a watt\n",
+ "C = 1.8 #Change in degree fahrenheit for a degree change in celsius\n",
+ "K = 1 #Change in degree celsius for a unit change in Kelvin\n",
+ "\n",
+ "#Calculation:\n",
+ "Rc = R*Btu/C #Thermal resistance in degree cesius per watt (\u00b0C/W)\n",
+ "Rk = Rc/K #Thermal resistance in Kelvin per watt (K/W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The thermal resistance in \u00b0C/W is :\",round(Rc,3),\" \u00b0C/W.\"\n",
+ "print \"The thermal resistance in K/W is :\",round(Rk,3),\" K/W.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The thermal resistance in \u00b0C/W is : 0.075 \u00b0C/W.\nThe thermal resistance in K/W is : 0.075 K/W.\n"
+ "text": [
+ "The thermal resistance in \u00b0C/W is : 0.075 \u00b0C/W.\n",
+ "The thermal resistance in K/W is : 0.075 K/W.\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +106,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.3, Page number: 136"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.3, Page number: 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Hot gas at 530\u00b0F flows over a flat plate of dimensions 2 ft by 1.5 ft. The convection heat transfer\ncoefficient between the plate and the gas is 48 Btu/ft2 . h . \u00b0F. Determine the heat transfer rate in\nBtu/h and kW from the air to one side of the plate when the plate is maintained at 105\u00b0F.\n'''\n\n#Variable declaration:\nh = 48.0 #Convective heat transfer coefficient (Btu/h.ft.\u00b0F)\nA = 2*1.5 #Total heat transfer area (ft^2)\nTs = 530.0 #Surface temperature of plate (\u00b0F)\nTm = 105.0 #Maintained temperature of opposite side of plate (\u00b0F)\nkW = 3.4123*10**3 #Units kW in a Btu/h\n\n#Calculation:\nQ = h*A*(Ts-Tm) #Heat transfer rate in Btu/h (Btu/h)\nQ1 = Q/kW #Heat transfer rate in kW (kW)\n\n#Result:\nprint \"The heat transfer rate in Btu/h is :\",round(Q),\" Btu/h.\"\nprint \"The heat transfer rate in kW is :\",round(Q1,2),\" kW.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "h = 48.0 #Convective heat transfer coefficient (Btu/h.ft.\u00b0F)\n",
+ "A = 2*1.5 #Total heat transfer area (ft^2)\n",
+ "Ts = 530.0 #Surface temperature of plate (\u00b0F)\n",
+ "Tm = 105.0 #Maintained temperature of opposite side of plate (\u00b0F)\n",
+ "kW = 3.4123*10**3 #Units kW in a Btu/h\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = h*A*(Ts-Tm) #Heat transfer rate in Btu/h (Btu/h)\n",
+ "Q1 = Q/kW #Heat transfer rate in kW (kW)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate in Btu/h is :\",round(Q),\" Btu/h.\"\n",
+ "print \"The heat transfer rate in kW is :\",round(Q1,2),\" kW.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate in Btu/h is : 61200.0 Btu/h.\nThe heat transfer rate in kW is : 17.94 kW.\n"
+ "text": [
+ "The heat transfer rate in Btu/h is : 61200.0 Btu/h.\n",
+ "The heat transfer rate in kW is : 17.94 kW.\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +149,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.4, Page number: 136"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.4, Page number: 136"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The glass window shown in Figure 9.3 of area 3.0 m2 has a temperature at the outer surface of\n10\u00b0C. The glass has conductivity of 1.4W/m . K. The convection coefficient (heat transfer\ncoefficient) of the air is 100W/m2 . K. The heat transfer is 3.0 kW. Calculate the bulk temperature\nof the fluid.\n'''\n\n#Variable declaration:\nTS = 10+273 #Outer surface temperature of wall (K)\nQ = 3000.0 #Heat transfer rate (W)\nh = 100.0 #Convection coefficient of air (W/m^2)\nA = 3.0 #Area of glass window (m^2)\n\n#Calculation:\nTM = TS-Q/(h*A) #Bulk temperature of fluid (K)\n\n#Result:\nprint \"The bulk temperature of fluid is :\",round(TM),\" K.\"\nprint \"The bulk temperature of fluid is :\",round(TM-273),\" \u00b0C.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "TS = 10+273 #Outer surface temperature of wall (K)\n",
+ "Q = 3000.0 #Heat transfer rate (W)\n",
+ "h = 100.0 #Convection coefficient of air (W/m^2)\n",
+ "A = 3.0 #Area of glass window (m^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "TM = TS-Q/(h*A) #Bulk temperature of fluid (K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The bulk temperature of fluid is :\",round(TM),\" K.\"\n",
+ "print \"The bulk temperature of fluid is :\",round(TM-273),\" \u00b0C.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The bulk temperature of fluid is : 273.0 K.\nThe bulk temperature of fluid is : 0.0 \u00b0C.\n"
+ "text": [
+ "The bulk temperature of fluid is : 273.0 K.\n",
+ "The bulk temperature of fluid is : 0.0 \u00b0C.\n"
+ ]
}
],
"prompt_number": 22
@@ -101,19 +190,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.5, Page number: 137"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.5, Page number: 137"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 9.1. If the convective heat transfer coefficient, h, between the\nvessel wall and the surrounding fluid is constant at 4.0 Btu/h . ft2 . \u00b0F and the plant operates\n24 h/day, 350 days/yr, calculate the steady-state energy loss in Btu/yr.\n'''\n\n#Variable declaration:\nh = 24.0 #Plant operating hour per day (h/day)\nd = 350.0 #Plant operating day per year (day/yr)\n\n#Calculation:\nN = h*d #Operating hours per year (h/yr)\n#From example 9.1:\nQ = 8545.0 #Rate of energy loss (Btu/h)\nQy = Q*N #Steady-state energy loss yearly (Btu/yr)\n\n#Result:\nprint \"The yearly steady-state energy loss is :\",round(Qy/10**7,2),\" x 10^7 Btu/yr.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "h = 24.0 #Plant operating hour per day (h/day)\n",
+ "d = 350.0 #Plant operating day per year (day/yr)\n",
+ "\n",
+ "#Calculation:\n",
+ "N = h*d #Operating hours per year (h/yr)\n",
+ "#From example 9.1:\n",
+ "Q = 8545.0 #Rate of energy loss (Btu/h)\n",
+ "Qy = Q*N #Steady-state energy loss yearly (Btu/yr)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The yearly steady-state energy loss is :\",round(Qy/10**7,2),\" x 10^7 Btu/yr.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The yearly steady-state energy loss is : 7.18 x 10^7 Btu/yr.\n"
+ "text": [
+ "The yearly steady-state energy loss is : 7.18 x 10^7 Btu/yr.\n"
+ ]
}
],
"prompt_number": 23
@@ -122,19 +230,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.7, Page number: 148"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.7, Page number: 148"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''For a flow of air over a horizontal flat plate, the local heat transfer coefficient, hx, is given by the\nequation\nhx = 25/x**0.4, W/m^2 . K\nwhere hx is the local heat transfer coefficient at a distance x from the leading edge of the plate and\nx is the distance in meters. The critical Reynolds number, Recr, which is the Reynolds number at\nwhich the flow is no longer laminar, is 500,000.\nConsider the flow of air at T1 = 21\u00b0C (cp = 1004.8 J/kg . K, v = 1.5 x 10**(-5) m^2/s,\nk = 0.025W/m . K, Pr = 0.7), at a velocity of 3 m/s, over a flat plate. The plate has a thermal conductivity k = 33W/m . K,\nsurface temperature, TS = 58\u00b0C, width, b = 1 m, and length,L = 1.2 m. Calculate\n1. the heat flux at 0.3 m from the leading edge of the plate\n2. the local heat transfer coefficient at the end of the plate\n3. the ratio h/hx at the end of the plate\n'''\nfrom sympy import symbols, integrate\n\n#Variable declaration:\nx = 0.3 #Length from the leading age of the plate (m)\nL = 1.2 #Length of plate (m)\nTS = 58.0 #Surface temperature of plate (\u00b0C)\nTa = 21.0 #Temperature of flowing air (\u00b0C)\n\n#Calculation:\nhx = 25/x**0.4 #Local heat transfer coefficient at 0.3m (W/m^2.K) (Part 1)\ny = symbols('y') #Length\nhy = 25/y**0.4 #hx at the end of the plate (W/m^2.K)\nh = integrate(hy, (y,0,L))/L #Average heat transfer coefficient (W/m^2.K)\nQ = hx*(TS-Ta) #Heat flux at 0.3m from leading edge of plate (W/m^2)\nhL = 25/L**0.4 #Local heat transfer coefficient at plate end (W/m^2.K) (Part 2) \nr = h/hL #Ratio h/hL at the end of the plate\n\n#Result:\nprint \"1. The heat flux at 0.3 m from the leading edge of the plate is :\",round(Q),\" W/m^2.\"\nprint \"2. The local heat transfer coefficient at the end of the plate is :\",round(hL,1),\" W/m^2.K.\"\nprint \"3. The ratio h/hL at the end of plate is :\",round(r,3),\" .\"",
+ "input": [
+ "\n",
+ "from sympy import symbols, integrate\n",
+ "\n",
+ "#Variable declaration:\n",
+ "x = 0.3 #Length from the leading age of the plate (m)\n",
+ "L = 1.2 #Length of plate (m)\n",
+ "TS = 58.0 #Surface temperature of plate (\u00b0C)\n",
+ "Ta = 21.0 #Temperature of flowing air (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "hx = 25/x**0.4 #Local heat transfer coefficient at 0.3m (W/m^2.K) (Part 1)\n",
+ "y = symbols('y') #Length\n",
+ "hy = 25/y**0.4 #hx at the end of the plate (W/m^2.K)\n",
+ "h = integrate(hy, (y,0,L))/L #Average heat transfer coefficient (W/m^2.K)\n",
+ "Q = hx*(TS-Ta) #Heat flux at 0.3m from leading edge of plate (W/m^2)\n",
+ "hL = 25/L**0.4 #Local heat transfer coefficient at plate end (W/m^2.K) (Part 2) \n",
+ "r = h/hL #Ratio h/hL at the end of the plate\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The heat flux at 0.3 m from the leading edge of the plate is :\",round(Q),\" W/m^2.\"\n",
+ "print \"2. The local heat transfer coefficient at the end of the plate is :\",round(hL,1),\" W/m^2.K.\"\n",
+ "print \"3. The ratio h/hL at the end of plate is :\",round(r,3),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The heat flux at 0.3 m from the leading edge of the plate is : 1497.0 W/m^2.\n2. The local heat transfer coefficient at the end of the plate is : 23.2 W/m^2.K.\n3. The ratio h/hL at the end of plate is : 1.667 .\n"
+ "text": [
+ "1. The heat flux at 0.3 m from the leading edge of the plate is : 1497.0 W/m^2.\n",
+ "2. The local heat transfer coefficient at the end of the plate is : 23.2 W/m^2.K.\n",
+ "3. The ratio h/hL at the end of plate is : 1.667 .\n"
+ ]
}
],
"prompt_number": 25
@@ -143,19 +280,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.8, Page number: 150"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.8, Page number: 150"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to the previous example. Calculate the rate of heat transfer over the whole length of the\nplate.\n'''\n\n#Variable declaration:\n#From example 9.7:\nb = 1.0 #Width of plate (m)\nL = 1.2 #Length of plate (m)\nTS = 58.0 #Surface temperture of plate (\u00b0C)\nTa = 21.0 #Air flow temperature (\u00b0C)\nh = 38.7 #Average heat transfer coefficient (W/m^2.K)\n\n#Calculation:\nA = b*L #Area for heat transfer for the entire plate (m^2)\nQ = h*A*(TS-Ta) #Rate of heat transfer over the whole length of the plate (W)\n\n#Result:\nprint \"The rate of heat transfer over the whole length of the plate is :\",round(Q,-1),\" W.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 9.7:\n",
+ "b = 1.0 #Width of plate (m)\n",
+ "L = 1.2 #Length of plate (m)\n",
+ "TS = 58.0 #Surface temperture of plate (\u00b0C)\n",
+ "Ta = 21.0 #Air flow temperature (\u00b0C)\n",
+ "h = 38.7 #Average heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = b*L #Area for heat transfer for the entire plate (m^2)\n",
+ "Q = h*A*(TS-Ta) #Rate of heat transfer over the whole length of the plate (W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The rate of heat transfer over the whole length of the plate is :\",round(Q,-1),\" W.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of heat transfer over the whole length of the plate is : 1720.0 W.\n"
+ "text": [
+ "The rate of heat transfer over the whole length of the plate is : 1720.0 W.\n"
+ ]
}
],
"prompt_number": 26
@@ -164,19 +322,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.9, Page number: 150"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.9, Page number: 150"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Air with a mass rate of 0.075 kg/s flows through a tube of diameter D = 0.225 m. The air enters\nat 100\u00b0C and, after a distance of L = 5 m, cools to 70\u00b0C. Determine the heat transfer coefficient\nof the air. The properties of air at 85\u00b0C are approximately, cp = 1010 J/kg . K, k = 0.030\nW/m . K, mu = 20\u00b0 x 10**-7 N . s/m2, and Pr = 0.71.\n'''\nfrom math import pi\n#Variable declaration:\nm = 0.075 #Mass rate of air flow (kg/s)\nD = 0.225 #Diameter of tube (m)\nmu = 208*10**-7 #Dynamic viscosity of fluid (N)\nPr = 0.71 #Prandtl number\nk = 0.030 #Thermal conductivity of air (W/m.K)\n\n#Calculation:\nRe = 4*m/(pi*D*mu) #Reynolds number\n#From equation 9.26:\nNu = 0.023*(Re**0.8)*(Pr**0.3) #Nusselt number\nh = (k/D)*Nu #Heat transfer coefficient of air (W/m^2.K)\n\n#Result:\nprint \"The Heat transfer coefficient of air is :\",round(h,2),\" W/m^2.K.\"",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "#Variable declaration:\n",
+ "m = 0.075 #Mass rate of air flow (kg/s)\n",
+ "D = 0.225 #Diameter of tube (m)\n",
+ "mu = 208*10**-7 #Dynamic viscosity of fluid (N)\n",
+ "Pr = 0.71 #Prandtl number\n",
+ "k = 0.030 #Thermal conductivity of air (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "Re = 4*m/(pi*D*mu) #Reynolds number\n",
+ "#From equation 9.26:\n",
+ "Nu = 0.023*(Re**0.8)*(Pr**0.3) #Nusselt number\n",
+ "h = (k/D)*Nu #Heat transfer coefficient of air (W/m^2.K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The Heat transfer coefficient of air is :\",round(h,2),\" W/m^2.K.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Heat transfer coefficient of air is : 7.76 W/m^2.K.\n"
+ "text": [
+ "The Heat transfer coefficient of air is : 7.76 W/m^2.K.\n"
+ ]
}
],
"prompt_number": 27
@@ -185,19 +365,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.10, Page number: 150"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.10, Page number: 150"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the average film heat transfer coefficient (Btu/h . ft^2 . \u00b0F) on the water side of a single\npass steam condenser. The tubes are 0.902 inch inside diameter, and the cooling water enters\nat 60\u00b0F and leaves at 70\u00b0F. Employ the Dittus\u2013Boelter equation and assume the average\nwater velocity is 7 ft/s. Pertinent physical properties of water at an average temperature of\n65\u00b0F are:\np = 62.3 lb/ft^3\nmu = 2.51 lb/ft . h\nCp = 1.0 Btu/lb . \u00b0F\nk = 0.340 Btu/h . ft . \u00b0F\n'''\n\n#Variable declaration:\nD = 0.902/12.0 #Inside diameter of tube (ft)\nT_in = 60.0 #Temperature water entering the tube (\u00b0F)\nT_out = 70.0 #Temperature water leaving the tube (\u00b0F)\nV = 7.0 #Average wave velocity water (ft/s)\np = 62.3 #Density of water (lb/ft^3)\nmu = 2.51/3600.0 #Dynamic viscosity of water (lb/ft.s)\nCp = 1.0 #Viscosity of centipoise (Btu/lb.\u00b0F)\nk = 0.34 #Thermal conductivity of water (Btu/h.ft.\u00b0F)\n\n#Calculation:\nRe = D*V*p/mu #Reynolds Number\nPr = Cp*mu/k*3600 #Prandtl number\n#From equation 9.26:\nNu = 0.023*(Re**0.8)*(Pr**0.4) #Nusselt number\nh = (k/D)*Nu #Average film heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"The required average film heat transfer coefficient is :\",round(h),\" Btu/h.ft^2.\u00b0F.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "D = 0.902/12.0 #Inside diameter of tube (ft)\n",
+ "T_in = 60.0 #Temperature water entering the tube (\u00b0F)\n",
+ "T_out = 70.0 #Temperature water leaving the tube (\u00b0F)\n",
+ "V = 7.0 #Average wave velocity water (ft/s)\n",
+ "p = 62.3 #Density of water (lb/ft^3)\n",
+ "mu = 2.51/3600.0 #Dynamic viscosity of water (lb/ft.s)\n",
+ "Cp = 1.0 #Viscosity of centipoise (Btu/lb.\u00b0F)\n",
+ "k = 0.34 #Thermal conductivity of water (Btu/h.ft.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Re = D*V*p/mu #Reynolds Number\n",
+ "Pr = Cp*mu/k*3600 #Prandtl number\n",
+ "#From equation 9.26:\n",
+ "Nu = 0.023*(Re**0.8)*(Pr**0.4) #Nusselt number\n",
+ "h = (k/D)*Nu #Average film heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The required average film heat transfer coefficient is :\",round(h),\" Btu/h.ft^2.\u00b0F.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required average film heat transfer coefficient is : 1265.0 Btu/h.ft^2.\u00b0F.\n"
+ "text": [
+ "The required average film heat transfer coefficient is : 1265.0 Btu/h.ft^2.\u00b0F.\n"
+ ]
}
],
"prompt_number": 4
@@ -206,19 +412,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.11, Page number: 151"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.11, Page number: 151"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Air at 1 atm and 300\u00b0C is cooled as it flows at a velocity 5.0 m/s through a tube with a diameter\nof 2.54 cm. Calculate the heat transfer coefficient if a constant heat flux condition is maintained\nat the wall and the wall temperature is 20\u00b0C above the temperature along the entire length of\nthe tube.\n'''\n\n#Variable declaration:\nP = 1.0132 * 10**5 #Air pressure (Pa)\nT = 300.0+273.0 #Air temperature (K)\nV = 5.0 #Air flow velocity (m/s)\nD = 2.54/100.0 #Diameter of tube (m)\nR = 287.0 #Gas constant (m^2/s^2.K)\n#From Appendix:\nPr = 0.713 #Prandtl number of nitrogen\nmu = 1.784*10**(-5) #Dynamic viscosity of nitrogen (kg/m.s)\nk = 0.0262 #Thermal conductivity of nitrogen (W/m.K)\nCp = 1.041 #Heat capacity of nitrogen (kJ/kg.K)\n\n#Calculation:\np = P/(R*T) #Density of air\nRe = D*V*p/mu #Reynolds number\n#From table 9.5:\nNu = 0.023*(Re**0.8)*(Pr**0.3) #Nusselt number\nh = (k/D)*Nu #Heat transfer coefficient (W/m^2.K)\n\n#Result:\nprint \"The required Heat transfer coefficient is :\",round(h,2),\" W/m^2.K.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "P = 1.0132 * 10**5 #Air pressure (Pa)\n",
+ "T = 300.0+273.0 #Air temperature (K)\n",
+ "V = 5.0 #Air flow velocity (m/s)\n",
+ "D = 2.54/100.0 #Diameter of tube (m)\n",
+ "R = 287.0 #Gas constant (m^2/s^2.K)\n",
+ "#From Appendix:\n",
+ "Pr = 0.713 #Prandtl number of nitrogen\n",
+ "mu = 1.784*10**(-5) #Dynamic viscosity of nitrogen (kg/m.s)\n",
+ "k = 0.0262 #Thermal conductivity of nitrogen (W/m.K)\n",
+ "Cp = 1.041 #Heat capacity of nitrogen (kJ/kg.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "p = P/(R*T) #Density of air\n",
+ "Re = D*V*p/mu #Reynolds number\n",
+ "#From table 9.5:\n",
+ "Nu = 0.023*(Re**0.8)*(Pr**0.3) #Nusselt number\n",
+ "h = (k/D)*Nu #Heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The required Heat transfer coefficient is :\",round(h,2),\" W/m^2.K.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required Heat transfer coefficient is : 17.57 W/m^2.K.\n"
+ "text": [
+ "The required Heat transfer coefficient is : 17.57 W/m^2.K.\n"
+ ]
}
],
"prompt_number": 10
@@ -227,19 +461,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.12, Page number: 152"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.12, Page number: 152"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Water flows with an average velocity of 0.355 m/s through a long copper tube (inside\ndiameter = 2.2 cm) in a heat exchanger. The water is heated by steam condensing at 150\u00b0C\non the outside of the tube. Water enters at 15\u00b0C and leaves at 60\u00b0C. Determine the heat transfer\ncoefficient, h, for the water. (Adapted from Griskey.^(5))\n'''\n\n#Variable declaration:\nT1 = 15.0 #Water entering temperature (\u00b0C)\nT2 = 60.0 #Water leaving temperature (\u00b0C)\nD = 0.022 #Inside diameter of tube (m)\nV = 0.355 #Average water flow velocity (m/s)\nTC = 150.0 #Outside wall temperature (\u00b0C)\n#From Appendix:\np = 993.0 #Density of water (kg/m^3)\nmu = 0.000683 #Dynamic viscosity of water (kg/m.s)\nCp = 4.17*10**3 #Heat capacity of water (J/kg.K)\nk = 0.63 #Thermal conductivity of water (W/m.K)\n\n#Calculation:\nTav1 = (T1+T2)/2.0 #Average bulk temperature of water (\u00b0C)\nRe = D*V*p/mu #Reynolds number\nPr = Cp*mu/k #Prandtl number\nTav2 = (Tav1+TC)/2.0 #Fluid's average wall temperature (\u00b0C)\n#From Appendix:\nmu_w = 0.000306 #Dynamic viscosity of fluid at wall (kg/m.s)\n#From Table 9.5:\nh = (k/D)*0.027*Re**0.8*Pr**0.33*(mu/mu_w)**0.14 #Heat transfer coefficient for water (W/m^2.K)\n\n#Result:\nprint \"The heat transfer coefficient for water is :\",round(h,1),\" W/m^2.K.\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 15.0 #Water entering temperature (\u00b0C)\n",
+ "T2 = 60.0 #Water leaving temperature (\u00b0C)\n",
+ "D = 0.022 #Inside diameter of tube (m)\n",
+ "V = 0.355 #Average water flow velocity (m/s)\n",
+ "TC = 150.0 #Outside wall temperature (\u00b0C)\n",
+ "#From Appendix:\n",
+ "p = 993.0 #Density of water (kg/m^3)\n",
+ "mu = 0.000683 #Dynamic viscosity of water (kg/m.s)\n",
+ "Cp = 4.17*10**3 #Heat capacity of water (J/kg.K)\n",
+ "k = 0.63 #Thermal conductivity of water (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "Tav1 = (T1+T2)/2.0 #Average bulk temperature of water (\u00b0C)\n",
+ "Re = D*V*p/mu #Reynolds number\n",
+ "Pr = Cp*mu/k #Prandtl number\n",
+ "Tav2 = (Tav1+TC)/2.0 #Fluid's average wall temperature (\u00b0C)\n",
+ "#From Appendix:\n",
+ "mu_w = 0.000306 #Dynamic viscosity of fluid at wall (kg/m.s)\n",
+ "#From Table 9.5:\n",
+ "h = (k/D)*0.027*Re**0.8*Pr**0.33*(mu/mu_w)**0.14 #Heat transfer coefficient for water (W/m^2.K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer coefficient for water is :\",round(h,1),\" W/m^2.K.\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer coefficient for water is : 2497.3 W/m^2.K.\n"
+ "text": [
+ "The heat transfer coefficient for water is : 2497.3 W/m^2.K.\n"
+ ]
}
],
"prompt_number": 11
@@ -248,19 +513,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.13, Page number: 153"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.13, Page number: 153"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 9.7. Calculate the average Biot number.\n'''\n\n#Variable declaration:\n#From example 9.7:\nh = 38.7 #Average heat transfer coefficient (W/m^2.K)\nL = 1.2 #Length of plate (m)\nk = 0.025 #Thermal conductivity of air (W/m)\n\n#Calculation:\nBi = h*L/k #Average Biot number\n\n#Result:\nprint \"The average Biot number is :\",round(Bi),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 9.7:\n",
+ "h = 38.7 #Average heat transfer coefficient (W/m^2.K)\n",
+ "L = 1.2 #Length of plate (m)\n",
+ "k = 0.025 #Thermal conductivity of air (W/m)\n",
+ "\n",
+ "#Calculation:\n",
+ "Bi = h*L/k #Average Biot number\n",
+ "\n",
+ "#Result:\n",
+ "print \"The average Biot number is :\",round(Bi),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The average Biot number is : 1858.0 .\n"
+ "text": [
+ "The average Biot number is : 1858.0 .\n"
+ ]
}
],
"prompt_number": 12
@@ -269,19 +552,55 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 9.14, Page number: 154"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 9.14, Page number: 154"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The surface temperature Ts of a circular conducting rod is maintained at 250\u00b0C by the passage of\nan electric current. The rod diameter is 10 mm, the length is 2.5 m, the thermal conductivity is 60\nW/m . K, the density is 7850 kg/m3, and the heat capacity is 434 J/kg . K. The rod is in a fluid\nat temperature Tf = 25\u00b0C, and the convection heat transfer coefficient is 140 W/m2 . K. The\nthermal conductivity of the fluid is 0.6W/m . K.\n1. What is the thermal diffusivity of the bare rod?\n2. What is the Nusselt number of the fluid in contact with the bare rod?\n3. What is the Biot number of the bare rod?\n4. Calculate the heat transferred from the rod to the fluid.\n'''\nfrom math import pi\n#Variable declaration:\nk = 60.0 #Thermal conductivity of rod (W/m.K)\np = 7850.0 #Density of rod (kg/m^3)\nCp = 434.0 #Heat capacity of rod (J/kg.K)\nh = 140.0 #Convection heat transfer coefficient (W/m^2.K)\nD = 0.01 #Diameter of rod (m)\nkf = 0.6 #Thermal conductivity of fluid (W/m.K)\nL = 2.5 #Length of rod (m)\nTs = 250.0 #Surface temperature of rod (\u00b0C)\nTf = 25.0 #Fluid temperature (\u00b0C)\n\n#Calculation:\n#Case 1:\na = k/(p*Cp) #Thermal diffusivity of bare rod (m^2/s)\n#Case 2:\nNu = h*D/kf #Nusselt number\n#Case 3:\nBi = h*D/k #Biot number of bare rod\n#Case 4:\nQ = h*(pi*D*L)*(Ts-Tf) #Heat transferred from rod to fluid (W)\n\n#Result:\nprint \"1. The thermal diffusivity of the bare rod is :\",round(a/10**-5,2),\" x 10^-5 m^2/s.\"\nprint \"2. The nusselt number is :\",round(Nu,2),\" .\"\nprint \"3. The Biot number is :\",round(Bi,4),\" .\"\nprint \"4. The heat transferred from the rod to the fluid is :\",round(Q),\" W.\"",
+ "input": [
+ "\n",
+ "from math import pi\n",
+ "#Variable declaration:\n",
+ "k = 60.0 #Thermal conductivity of rod (W/m.K)\n",
+ "p = 7850.0 #Density of rod (kg/m^3)\n",
+ "Cp = 434.0 #Heat capacity of rod (J/kg.K)\n",
+ "h = 140.0 #Convection heat transfer coefficient (W/m^2.K)\n",
+ "D = 0.01 #Diameter of rod (m)\n",
+ "kf = 0.6 #Thermal conductivity of fluid (W/m.K)\n",
+ "L = 2.5 #Length of rod (m)\n",
+ "Ts = 250.0 #Surface temperature of rod (\u00b0C)\n",
+ "Tf = 25.0 #Fluid temperature (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "#Case 1:\n",
+ "a = k/(p*Cp) #Thermal diffusivity of bare rod (m^2/s)\n",
+ "#Case 2:\n",
+ "Nu = h*D/kf #Nusselt number\n",
+ "#Case 3:\n",
+ "Bi = h*D/k #Biot number of bare rod\n",
+ "#Case 4:\n",
+ "Q = h*(pi*D*L)*(Ts-Tf) #Heat transferred from rod to fluid (W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The thermal diffusivity of the bare rod is :\",round(a/10**-5,2),\" x 10^-5 m^2/s.\"\n",
+ "print \"2. The nusselt number is :\",round(Nu,2),\" .\"\n",
+ "print \"3. The Biot number is :\",round(Bi,4),\" .\"\n",
+ "print \"4. The heat transferred from the rod to the fluid is :\",round(Q),\" W.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The thermal diffusivity of the bare rod is : 1.76 x 10^-5 m^2/s.\n2. The nusselt number is : 2.33 .\n3. The Biot number is : 0.0233 .\n4. The heat transferred from the rod to the fluid is : 2474.0 W.\n"
+ "text": [
+ "1. The thermal diffusivity of the bare rod is : 1.76 x 10^-5 m^2/s.\n",
+ "2. The nusselt number is : 2.33 .\n",
+ "3. The Biot number is : 0.0233 .\n",
+ "4. The heat transferred from the rod to the fluid is : 2474.0 W.\n"
+ ]
}
],
"prompt_number": 14
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_10.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_10.ipynb
index 76eae3ba..f1c9afa8 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_10.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 10"
+ "name": "",
+ "signature": "sha256:5a160b2a8858072f2a32a8c5f96e1426d911509afe45130ab4e23facf3414ba2"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,46 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 10: Free Convection"
+ "source": [
+ "Chapter 10: Free Convection"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.1, Page number: 163"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.1, Page number: 163"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The Grashof and Reynolds numbers for a system involved in a heat transfer process are approximately\n100 and 50, respectively. Can free convection effects be neglected.\n'''\n\n#Variable declaration:\nGr = 100.0 #Grashof number\nRe = 50.0 #Reynolds number\n\n#Calculation:\nLT = Gr/Re**2 #Measure of influence of convection effect\n\n#Result:\nif (LT<1.0):\n print \"The free convection effects can be neglected.\"\nelif (LT>1.0):\n print \"The free convection effects can not be neglected.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Gr = 100.0 #Grashof number\n",
+ "Re = 50.0 #Reynolds number\n",
+ "\n",
+ "#Calculation:\n",
+ "LT = Gr/Re**2 #Measure of influence of convection effect\n",
+ "\n",
+ "#Result:\n",
+ "if (LT<1.0):\n",
+ " print \"The free convection effects can be neglected.\"\n",
+ "elif (LT>1.0):\n",
+ " print \"The free convection effects can not be neglected.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The free convection effects can be neglected.\n"
+ "text": [
+ "The free convection effects can be neglected.\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +60,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.2, Page number: 166"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.2, Page number: 166"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The heat flux rate incident on a vertical flat plate at 110\u00b0C is 800W/m2. The plate is 2 m wide\nand 3.5 m high and is well insulated on the back side. The ambient air temperature is 30\u00b0C. All\nthe incident radiation (800W/m2) on the plate is absorbed and dissipated by free convection to\nthe ambient air at 30\u00b0C. Determine the Grashof and Rayleigh numbers.\n'''\n\n#Variable declaration:\nTs = 110.0+273.0 #Surface temperature of plate (K)\nToo = 30.0+273.0 #Ambient air temperature (K)\nL = 3.5 #Height of plate (m)\ng = 9.807 #Gravitational acceleration (m^2/s)\n\n#Calculation:\nTf = (Ts+Too)/2 #Film temperature (K)\nDT = Ts - Too #Temperature difference between surface and air (K)\n#From appendix:\nv = 2.0*10**-5 #Kinematic viscosity for air (m^2/s)\nk = 0.029 #Thermal conductivity for air (W/m.K)\nPr = 0.7 #Prandtl number\nB = 1.0/Tf #Coefficient of expansion (K^-1)\nGr = g*B*DT*L**3/v**2 #Grashof number\nRa = Gr*Pr #Rayleigh number\n\n#Result:\nprint \"The Grashof number is :\",round(Gr/10**11,2),\" x 10^11 .\"\nprint \"The Rayleigh number is :\",round(Ra/10**11,2),\" x 10^11 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ts = 110.0+273.0 #Surface temperature of plate (K)\n",
+ "Too = 30.0+273.0 #Ambient air temperature (K)\n",
+ "L = 3.5 #Height of plate (m)\n",
+ "g = 9.807 #Gravitational acceleration (m^2/s)\n",
+ "\n",
+ "#Calculation:\n",
+ "Tf = (Ts+Too)/2 #Film temperature (K)\n",
+ "DT = Ts - Too #Temperature difference between surface and air (K)\n",
+ "#From appendix:\n",
+ "v = 2.0*10**-5 #Kinematic viscosity for air (m^2/s)\n",
+ "k = 0.029 #Thermal conductivity for air (W/m.K)\n",
+ "Pr = 0.7 #Prandtl number\n",
+ "B = 1.0/Tf #Coefficient of expansion (K^-1)\n",
+ "Gr = g*B*DT*L**3/v**2 #Grashof number\n",
+ "Ra = Gr*Pr #Rayleigh number\n",
+ "\n",
+ "#Result:\n",
+ "print \"The Grashof number is :\",round(Gr/10**11,2),\" x 10^11 .\"\n",
+ "print \"The Rayleigh number is :\",round(Ra/10**11,2),\" x 10^11 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Grashof number is : 2.45 x 10^11 .\nThe Rayleigh number is : 1.72 x 10^11 .\n"
+ "text": [
+ "The Grashof number is : 2.45 x 10^11 .\n",
+ "The Rayleigh number is : 1.72 x 10^11 .\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +109,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.3, Page number: 166"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.3, Page number: 166"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 10.2. Determine the type of natural convection (flow regime).\n'''\n\n#Variable declaration:\n#From example 10.2:\nRa = 1.71*10**11 #Rayleigh number\n\n#Result:\nif (Ra>10**9):\n print \"The convection flow category is turbulent.\"\nelif(Ra<10**9):\n print \"The convection flow category is laminar.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 10.2:\n",
+ "Ra = 1.71*10**11 #Rayleigh number\n",
+ "\n",
+ "#Result:\n",
+ "if (Ra>10**9):\n",
+ " print \"The convection flow category is turbulent.\"\n",
+ "elif(Ra<10**9):\n",
+ " print \"The convection flow category is laminar.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The convection flow category is turbulent.\n"
+ "text": [
+ "The convection flow category is turbulent.\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +146,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.4, Page number: 167"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.4, Page number: 167"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 10.2. Determine the average heat transfer coefficient.\n'''\n\n#Variable declaration:\n#From Table 10.1:\nc = 0.1 #Constant c\nm = 1.0/3.0 #Constant for turbulent free conection\n#From example 10.2:\nRa = 1.71*10**11 #Rayleigh number\nk = 0.029 #Thermal conductivity (W/m.K)\nL = 3.5 #Thickness of plate (m)\n\n#Calculation:\nNu = c*Ra**m #Average Nusselt number\nh = Nu*k/L #Average heat transfer coefficient (W/m^2.K)\n\n#Result:\nprint \"The average heat transfer coefficient is :\",round(h,1),\" W/m^2.K .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From Table 10.1:\n",
+ "c = 0.1 #Constant c\n",
+ "m = 1.0/3.0 #Constant for turbulent free conection\n",
+ "#From example 10.2:\n",
+ "Ra = 1.71*10**11 #Rayleigh number\n",
+ "k = 0.029 #Thermal conductivity (W/m.K)\n",
+ "L = 3.5 #Thickness of plate (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "Nu = c*Ra**m #Average Nusselt number\n",
+ "h = Nu*k/L #Average heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The average heat transfer coefficient is :\",round(h,1),\" W/m^2.K .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The average heat transfer coefficient is : 4.6 W/m^2.K .\n"
+ "text": [
+ "The average heat transfer coefficient is : 4.6 W/m^2.K .\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +189,57 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.6, Page number: 167"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.6, Page number: 167"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the air heat transfer film coefficient for a horizontal 6 inch diameter pipe whose surface\ntemperature is 200\u00b0F in a room containing air at 70\u00b0F.\n'''\n\nfrom math import log,e\n\n#Variable declaration:\nTs = 200.0+460.0 #Surface temperature of pipe (\u00b0R)\nToo = 70.0+460.0 #Air temperature (\u00b0R)\nD = 0.5 #Diameter of pipe (ft)\nR = 0.73 #Universal gas constant (ft^3.atm.R^\u22121.lb.mol^\u22121)\nP = 1.0 #Atmospheric pressure (Pa)\nMW = 29.0 #Molecular weight of fluid (mol)\n#From Appendix:\nmu = 1.28*10**-5 #Absolute viscosity (lb/ft.s)\nk = 0.016/3600.0 #Thermal conductivity (Btu/s.ft.\u00b0F)\ng = 32.174 #Gravitational acceleration (ft/s^2)\n\n#Calculation:\nTav = (Ts+Too)/2 #Average temperature (\u00b0R)\nv = R*Tav/P #kinematic viscosity (ft^3/lbmol)\np = MW/v #Air density (lb/ft^3)\nB = 1.0/Tav #Coefficient of expansion (\u00b0R^-1)\nDT = Ts-Too #Temperature difference (\u00b0R)\nGr = D**3*p**2*g*B*DT/mu**2 #Grashof number\n#From equation 10.5:\nCp = 0.25 #Air heat capacity (Btu/lb.\u00b0F)\nPr = Cp*mu/k #Prandtl number\nGrPr = 10**8.24 #Rayleigh number\n#From Holman^(3):\nNu = 10**(1.5) #Nusselt number\nh = Nu*(k/D)*3600.0 #Air heat transfer film coefficient (Btu/h.ft.\u00b0F)\n\n#Result:\nprint \"The required air heat transfer film coefficient is :\",round(h,2),\" Btu/h.ft.\u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import log,e\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ts = 200.0+460.0 #Surface temperature of pipe (\u00b0R)\n",
+ "Too = 70.0+460.0 #Air temperature (\u00b0R)\n",
+ "D = 0.5 #Diameter of pipe (ft)\n",
+ "R = 0.73 #Universal gas constant (ft^3.atm.R^\u22121.lb.mol^\u22121)\n",
+ "P = 1.0 #Atmospheric pressure (Pa)\n",
+ "MW = 29.0 #Molecular weight of fluid (mol)\n",
+ "#From Appendix:\n",
+ "mu = 1.28*10**-5 #Absolute viscosity (lb/ft.s)\n",
+ "k = 0.016/3600.0 #Thermal conductivity (Btu/s.ft.\u00b0F)\n",
+ "g = 32.174 #Gravitational acceleration (ft/s^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "Tav = (Ts+Too)/2 #Average temperature (\u00b0R)\n",
+ "v = R*Tav/P #kinematic viscosity (ft^3/lbmol)\n",
+ "p = MW/v #Air density (lb/ft^3)\n",
+ "B = 1.0/Tav #Coefficient of expansion (\u00b0R^-1)\n",
+ "DT = Ts-Too #Temperature difference (\u00b0R)\n",
+ "Gr = D**3*p**2*g*B*DT/mu**2 #Grashof number\n",
+ "#From equation 10.5:\n",
+ "Cp = 0.25 #Air heat capacity (Btu/lb.\u00b0F)\n",
+ "Pr = Cp*mu/k #Prandtl number\n",
+ "GrPr = 10**8.24 #Rayleigh number\n",
+ "#From Holman^(3):\n",
+ "Nu = 10**(1.5) #Nusselt number\n",
+ "h = Nu*(k/D)*3600.0 #Air heat transfer film coefficient (Btu/h.ft.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The required air heat transfer film coefficient is :\",round(h,2),\" Btu/h.ft.\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required air heat transfer film coefficient is : 1.01 Btu/h.ft.\u00b0F .\n"
+ "text": [
+ "The required air heat transfer film coefficient is : 1.01 Btu/h.ft.\u00b0F .\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +248,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.7, Page number: 168"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.7, Page number: 168"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the free convection heat transfer coefficient for a plate 6 ft high and 8 ft wide at 120\u00b0F\nthat is exposed to nitrogen at 60\u00b0F.\n'''\n\n#Variable declaration:\nTs = 120.0+460 #Surface temperature of plate (\u00b0R)\nToo = 60.0+460 #Ambient temperature of nitrogen (\u00b0R)\nL = 6 #Height of plate (ft)\n#From Appendix:\np = 0.0713 #Air density (lb/ft^3)\nk = 0.01514 #Thermal conductivity (Btu/h.ft.\u00b0F)\nv = 16.82*10**-5 #Kinematic viscosity (ft^2/s)\nPr = 0.713 #Prandtl number\ng = 32.2 #Gravitational acceleration (ft/s^2)\n\n#Calculation:\nTf = (Ts+Too)/2 #Mean film temperature (\u00b0R)\nB = 1.0/Tf #Coefficient of expansion (\u00b0R^-1)\nGr = g*B*(Ts-Too)*L**3/v**2 #Grashof number\nRa = Gr*Pr #Rayleigh number\n#From equation 10.13(Table 10.2) and costants from Table 10.1:\nh = 0.10*(k/L)*Ra**(1.0/3.0) #Free convection heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"The free convection heat transfer coefficient is :\",round(h,3),\" Btu/h.ft^2.\u00b0F .\"\nprint \"There is a calculation mistake in the book for calculating 'Gr', so, value of 'h' alters from that given.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ts = 120.0+460 #Surface temperature of plate (\u00b0R)\n",
+ "Too = 60.0+460 #Ambient temperature of nitrogen (\u00b0R)\n",
+ "L = 6 #Height of plate (ft)\n",
+ "#From Appendix:\n",
+ "p = 0.0713 #Air density (lb/ft^3)\n",
+ "k = 0.01514 #Thermal conductivity (Btu/h.ft.\u00b0F)\n",
+ "v = 16.82*10**-5 #Kinematic viscosity (ft^2/s)\n",
+ "Pr = 0.713 #Prandtl number\n",
+ "g = 32.2 #Gravitational acceleration (ft/s^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "Tf = (Ts+Too)/2 #Mean film temperature (\u00b0R)\n",
+ "B = 1.0/Tf #Coefficient of expansion (\u00b0R^-1)\n",
+ "Gr = g*B*(Ts-Too)*L**3/v**2 #Grashof number\n",
+ "Ra = Gr*Pr #Rayleigh number\n",
+ "#From equation 10.13(Table 10.2) and costants from Table 10.1:\n",
+ "h = 0.10*(k/L)*Ra**(1.0/3.0) #Free convection heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The free convection heat transfer coefficient is :\",round(h,3),\" Btu/h.ft^2.\u00b0F .\"\n",
+ "print \"There is a calculation mistake in the book for calculating 'Gr', so, value of 'h' alters from that given.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The free convection heat transfer coefficient is : 0.675 Btu/h.ft^2.\u00b0F .\nThere is a calculation mistake in the book for calculating 'Gr', so, value of 'h' alters from that given.\n"
+ "text": [
+ "The free convection heat transfer coefficient is : 0.675 Btu/h.ft^2.\u00b0F .\n",
+ "There is a calculation mistake in the book for calculating 'Gr', so, value of 'h' alters from that given.\n"
+ ]
}
],
"prompt_number": 7
@@ -143,19 +299,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.8, Page number: 169"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.8, Page number: 169"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the heat loss in the previous example.\n'''\n\n#Variable declaration:\n#From example:\nh = 0.675 #Free convection heat transfer coefficient (Btu/h.ft^2.\u00b0F)\nA = 6.0*8.0 #Area of plate (ft^2)\nTs = 120.0 #Surface temperature of plate (\u00b0F)\nToo = 60.0 #Ambient temperature of nitrogen (\u00b0F)\n\n#Calculation:\nQ = h*A*(Ts-Too) #Heat loss (Btu/h)\n\n#Result:\nprint \"The heat loss is :\",round(Q,-1),\" Btu/h .\"\nprint \" The 'h' obtained in the previous example differs, therefore, 'Q' obtained here also fiffers from that given in book.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example:\n",
+ "h = 0.675 #Free convection heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "A = 6.0*8.0 #Area of plate (ft^2)\n",
+ "Ts = 120.0 #Surface temperature of plate (\u00b0F)\n",
+ "Too = 60.0 #Ambient temperature of nitrogen (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = h*A*(Ts-Too) #Heat loss (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat loss is :\",round(Q,-1),\" Btu/h .\"\n",
+ "print \" The 'h' obtained in the previous example differs, therefore, 'Q' obtained here also fiffers from that given in book.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat loss is : 1940.0 Btu/h .\n The 'h' obtained in the previous example differs, therefore, 'Q' obtained here also fiffers from that given in book.\n"
+ "text": [
+ "The heat loss is : 1940.0 Btu/h .\n",
+ " The 'h' obtained in the previous example differs, therefore, 'Q' obtained here also fiffers from that given in book.\n"
+ ]
}
],
"prompt_number": 8
@@ -164,19 +341,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.9, Page number: 169"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.9, Page number: 169"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the heat transfer from a 100-W light bulb at 113\u00b0C to 31\u00b0C ambient air. Approximate\nthe bulb as a 120-mm-diameter sphere.\n'''\n\n#Variable declaration:\nTs = 113.0+273.0 #Surface temperature of bulb (K)\nToo = 31.0+273.0 #Ambient air temperature (K)\nD = 0.06 #Diameter of sphere (m)\ng = 9.8 #Gravitational acceleration (m/s^2)\n\n#Calculation:\nTf = (Ts+Too)/2 #Mean temperature (K)\n#From Appendix:\nv = (22.38*10**-5)*0.0929 #Kinematic viscosity (m^2/s)\nPr = 0.70 #Prandtl number\nk = 0.01735*1.729 #Thermal conductivity (W/m.K)\nB = 1.0/(Tf) #Coefficient of expansion (K^-1)\nGr = g*B*(Ts-Too)*D**3/v**2 #Grashof number\nRa = Gr*Pr #Rayleigh number\n\n#From equation 10.13:\nh = (k/D)*0.6*Ra**(1.0/4.0) #Heat transferred from bulb (W/m^2.K)\n\n#Result:\nprint \"The heat transferred from bulb to air is :\",round(h,2),\" W/m^2.K .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ts = 113.0+273.0 #Surface temperature of bulb (K)\n",
+ "Too = 31.0+273.0 #Ambient air temperature (K)\n",
+ "D = 0.06 #Diameter of sphere (m)\n",
+ "g = 9.8 #Gravitational acceleration (m/s^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "Tf = (Ts+Too)/2 #Mean temperature (K)\n",
+ "#From Appendix:\n",
+ "v = (22.38*10**-5)*0.0929 #Kinematic viscosity (m^2/s)\n",
+ "Pr = 0.70 #Prandtl number\n",
+ "k = 0.01735*1.729 #Thermal conductivity (W/m.K)\n",
+ "B = 1.0/(Tf) #Coefficient of expansion (K^-1)\n",
+ "Gr = g*B*(Ts-Too)*D**3/v**2 #Grashof number\n",
+ "Ra = Gr*Pr #Rayleigh number\n",
+ "\n",
+ "#From equation 10.13:\n",
+ "h = (k/D)*0.6*Ra**(1.0/4.0) #Heat transferred from bulb (W/m^2.K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transferred from bulb to air is :\",round(h,2),\" W/m^2.K .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transferred from bulb to air is : 9.01 W/m^2.K .\n"
+ "text": [
+ "The heat transferred from bulb to air is : 9.01 W/m^2.K .\n"
+ ]
}
],
"prompt_number": 9
@@ -185,19 +390,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.10, Page number: 170"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.10, Page number: 170"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 10.9. Calculate the heat transfer lost by free convection from the\nlight bulb.\n'''\n\nfrom math import pi\n\n#Variable declaration:\n#From example 10.9:\nh = 9.01 #Heat transferred from bulb (W/m^2.K)\nD = 0.06 #Diameter of sphere (m)\nTs = 113.0+273.0 #Surface temperature of bulb (K)\nToo = 31.0+273.0 #Ambient air temperature (K)\n\n#Calculation:\nA = pi*D**2 #Surface area of bulb (m^2)\nQ = h*A*(Ts-Too) #Heat transfer lost by free convection from light bulb (W)\n\n#Result:\nprint \"The heat transfer lost by free convection from light bulb is :\",round(Q,2),\" W .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 10.9:\n",
+ "h = 9.01 #Heat transferred from bulb (W/m^2.K)\n",
+ "D = 0.06 #Diameter of sphere (m)\n",
+ "Ts = 113.0+273.0 #Surface temperature of bulb (K)\n",
+ "Too = 31.0+273.0 #Ambient air temperature (K)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = pi*D**2 #Surface area of bulb (m^2)\n",
+ "Q = h*A*(Ts-Too) #Heat transfer lost by free convection from light bulb (W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer lost by free convection from light bulb is :\",round(Q,2),\" W .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer lost by free convection from light bulb is : 8.36 W .\n"
+ "text": [
+ "The heat transfer lost by free convection from light bulb is : 8.36 W .\n"
+ ]
}
],
"prompt_number": 10
@@ -206,19 +433,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.11, Page number: 170"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.11, Page number: 170"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''With reference to Illustrative Examples 10.9\u009610.10, what percentage of the energy is lost by free\nconvection.\n'''\n\n#Variable declaration:\n#From example 10.9-10.10:\nQ = 8.36 #Heat transfer lost by free convection from light bulb (W)\n\n#Calculation:\nE = Q/100.0*(100.0) #Percent energy lost by free convection (%)\n\n#Result:\nprint \"The percentage of the energy lost by free convection is :\",round(E,2),\" % .\"\nprint \"The energy lost fraction is :\",round(E/100.0,4),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 10.9-10.10:\n",
+ "Q = 8.36 #Heat transfer lost by free convection from light bulb (W)\n",
+ "\n",
+ "#Calculation:\n",
+ "E = Q/100.0*(100.0) #Percent energy lost by free convection (%)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The percentage of the energy lost by free convection is :\",round(E,2),\" % .\"\n",
+ "print \"The energy lost fraction is :\",round(E/100.0,4),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The percentage of the energy lost by free convection is : 8.36 % .\nThe energy lost fraction is : 0.0836 .\n"
+ "text": [
+ "The percentage of the energy lost by free convection is : 8.36 % .\n",
+ "The energy lost fraction is : 0.0836 .\n"
+ ]
}
],
"prompt_number": 11
@@ -227,19 +472,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 10.13, Page number: 175"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 10.13, Page number: 175"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''If a waste source emits a gas with a buoyancy flux of 50 m^4/s^3, and the wind speed averages 4\nm/s, find the plume rise at a distance of 750 m downward from a stack that is 50 m high under\nunstable atmospheric conditions. Several plume rise equations are available. Use the equation\nproposed by Briggs.\nBriggs(5) used the following equations to calculate the plume rise.\nDh = 1.6F^1/3u^-1x^2/3 ; x < xf (10.23)\n= 1.6F^1/3u^-1xf^2/3 ; if x < xf\nxc = 14F^5/8 ; when F < 55m^4/s^3\n= 34F^2/5 ; when F < 55m^4/s^3\nxf = 3.5xc\nwhere Dh = plume rise, m\nF = buoyancy flux, m^4/s^3 =3 .7 x 10^-5 Q\u02d9H\nu = wind speed, m/s\nx* = downward distance, m\nxf = distance of transition from first stage of rise to the second stage of rise, m\nQ\u02d9H = heat emission rate, kcal/s\nIf the term Q\u02d9H is not available, the term F may be estimated by\nF = (g/pi)q(TS - T)/TS (10.24)\nwhere g = gravity term 9.8 m/s^2\nq = stack gas volumetric flowrate, m^3/s (actual conditions)\nTS, T = stack gas and ambient air temperature, K, respectively\n'''\n\n#Variable declaration:\nF = 50.0 #Buoyancy flux of gas (m^4/s^3)\nu = 4.0 #wind speed (m/s)\n\n#Calculation:\nxc = 14*F**(5.0/8.0) #Downward distance (m)\nxf = 3.5*xc #distance of transition from first stage of rise to the second stage of rise (m)\nDh = 1.6*F**(1.0/3.0)*u**-1*xf**(2.0/3.0) #Plume rise (m)\n\n#Result:\nprint \"The plume rise is :\",round(Dh),\" m .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "F = 50.0 #Buoyancy flux of gas (m^4/s^3)\n",
+ "u = 4.0 #wind speed (m/s)\n",
+ "\n",
+ "#Calculation:\n",
+ "xc = 14*F**(5.0/8.0) #Downward distance (m)\n",
+ "xf = 3.5*xc #distance of transition from first stage of rise to the second stage of rise (m)\n",
+ "Dh = 1.6*F**(1.0/3.0)*u**-1*xf**(2.0/3.0) #Plume rise (m)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The plume rise is :\",round(Dh),\" m .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The plume rise is : 101.0 m .\n"
+ "text": [
+ "The plume rise is : 101.0 m .\n"
+ ]
}
],
"prompt_number": 13
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_11.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_11.ipynb
index 485669cf..70c1dfd8 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_11.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 11"
+ "name": "",
+ "signature": "sha256:063e55263471b05545d8cee123782ea0408a4dbcfbef0baacac009fc80ca4fe1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,45 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 11: Radiation"
+ "source": [
+ "Chapter 11: Radiation"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.3, Page number: 181"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.3, Page number: 181"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The intensity of radiation as a function of wavelength (l = mu*m) is specified as\nI = 40e^-l^2 ; Btu/h.ft^2.mu.m\nCalculate the total emissive power.\n'''\n\nfrom sympy import symbols, integrate,oo,exp,pi\n\n#Variable declaration:\nl = symbols('l') #Wavelength (mu.m)\nI = 40*exp(-l**2) #Intensity of radiation (Btu/h.ft^2.mu.m)\n\n#Calculation:\nE = integrate(I, (l,0,oo)).evalf() #Total emissive power (Btu/h.ft^2)\n\n#Result:\nprint \"The total emissive power is :\",round(E,1),\" Btu/h.ft^2 .\" ",
+ "input": [
+ "\n",
+ "\n",
+ "from sympy import symbols, integrate,oo,exp,pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "l = symbols('l') #Wavelength (mu.m)\n",
+ "I = 40*exp(-l**2) #Intensity of radiation (Btu/h.ft^2.mu.m)\n",
+ "\n",
+ "#Calculation:\n",
+ "E = integrate(I, (l,0,oo)).evalf() #Total emissive power (Btu/h.ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The total emissive power is :\",round(E,1),\" Btu/h.ft^2 .\" "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The total emissive power is : 35.4 Btu/h.ft^2 .\n"
+ "text": [
+ "The total emissive power is : 35.4 Btu/h.ft^2 .\n"
+ ]
}
],
"prompt_number": 3
@@ -38,19 +59,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.4, Page number: 182"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.4, Page number: 182"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Estimate the Sun\u2019s temperature. Employ equation (11.4).\n'''\n\n#Variable declaration:\nl = 0.25 #Wavelength (mu.m)\n#From equation 11.4:\nlT = 2884 #Product of wavelength and absolute temperature (mu.m.\u00b0R)\n\n#Calculation:\nT = lT/l #Sun's temperature (\u00b0R)\n\n#Result:\nprint \"The Sun's temperature is :\",round(T,-2),\" \u00b0R .\"\nprint \"The Sun's temperature in fahrenheit scale is :\",round(T-460,-3),\" \u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "l = 0.25 #Wavelength (mu.m)\n",
+ "#From equation 11.4:\n",
+ "lT = 2884 #Product of wavelength and absolute temperature (mu.m.\u00b0R)\n",
+ "\n",
+ "#Calculation:\n",
+ "T = lT/l #Sun's temperature (\u00b0R)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The Sun's temperature is :\",round(T,-2),\" \u00b0R .\"\n",
+ "print \"The Sun's temperature in fahrenheit scale is :\",round(T-460,-3),\" \u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Sun's temperature is : 11500.0 \u00b0R .\nThe Sun's temperature in fahrenheit scale is : 11000.0 \u00b0F .\n"
+ "text": [
+ "The Sun's temperature is : 11500.0 \u00b0R .\n",
+ "The Sun's temperature in fahrenheit scale is : 11000.0 \u00b0F .\n"
+ ]
}
],
"prompt_number": 4
@@ -59,19 +99,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.5, Page number: 188"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.5, Page number: 188"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Estimate the increase in heat transferred by radiation of a black body at 1500\u00b0F relative to one at\n1000\u00b0F.\n'''\n\n#Variable declaration:\nT1 = 1500.0+460.0 #Absolute temperature 1 (\u00b0R)\nT2 = 1000.0+460.0 #Absolute temperature 2 (\u00b0R)\n\n#Calculation:\nX = T1**4/T2**4 #Ratio of quantity of heat transferred\nx = 100*(T1**4-T2**4)/T2**4 #Percentage increase in heat transfer (%)\n\n#Result:\nprint \"The ratio of the quantity/rate of heat transferred is :\",round(X,2),\" .\"\nprint \"The percentage increase in heat transfer is :\",round(x),\"%\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 1500.0+460.0 #Absolute temperature 1 (\u00b0R)\n",
+ "T2 = 1000.0+460.0 #Absolute temperature 2 (\u00b0R)\n",
+ "\n",
+ "#Calculation:\n",
+ "X = T1**4/T2**4 #Ratio of quantity of heat transferred\n",
+ "x = 100*(T1**4-T2**4)/T2**4 #Percentage increase in heat transfer (%)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The ratio of the quantity/rate of heat transferred is :\",round(X,2),\" .\"\n",
+ "print \"The percentage increase in heat transfer is :\",round(x),\"%\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The ratio of the quantity/rate of heat transferred is : 3.25 .\nThe percentage increase in heat transfer is : 225.0 %\n"
+ "text": [
+ "The ratio of the quantity/rate of heat transferred is : 3.25 .\n",
+ "The percentage increase in heat transfer is : 225.0 %\n"
+ ]
}
],
"prompt_number": 5
@@ -80,19 +139,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.6, Page number: 189"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.6, Page number: 189"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Two large walls are required to be maintained at constant temperatures of 800\u00b0F and 1200\u00b0F.\nAssuming the walls are black bodies, how much heat must be removed from the colder wall\nto maintain a steady-state, constant temperature?\n'''\n\n#Variable declaration:\nT1 = 1200.0+460.0 #Absolute temperature of wall 1 (\u00b0R)\nT2 = 800.0+460.0 #Absolute temperature of wall 2 (\u00b0R)\n\n#Calculation:\n#From equation 11.23:\nX = 0.173*((T1/100.0)**4-(T2/100.0)**4) #Heat removed from colder wall (Btu/h.ft^2)\n\n#Result:\nprint \"The heat removed from the colder wall to maintain a steady-state is :\",round(X),\" Btu/h.ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 1200.0+460.0 #Absolute temperature of wall 1 (\u00b0R)\n",
+ "T2 = 800.0+460.0 #Absolute temperature of wall 2 (\u00b0R)\n",
+ "\n",
+ "#Calculation:\n",
+ "#From equation 11.23:\n",
+ "X = 0.173*((T1/100.0)**4-(T2/100.0)**4) #Heat removed from colder wall (Btu/h.ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat removed from the colder wall to maintain a steady-state is :\",round(X),\" Btu/h.ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat removed from the colder wall to maintain a steady-state is : 8776.0 Btu/h.ft^2 .\n"
+ "text": [
+ "The heat removed from the colder wall to maintain a steady-state is : 8776.0 Btu/h.ft^2 .\n"
+ ]
}
],
"prompt_number": 6
@@ -101,19 +177,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.7, Page number: 190"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.7, Page number: 190"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''If the two bodies from Illustrative Example 11.6 have emissivities of 0.5 and 0.75, respectively,\nwhat is the net energy exchange (per unit area)? Assume that the temperatures remain constant at\n1660\u00b0R and 1260\u00b0R, and the two bodies are of infinite size.\n'''\n\n#Variable declaration:\ns = 0.173 #Stefan-Boltzmann constant (Btu/h.ft^2.\u00b0R)\nEH = 0.5 #Energy transferred from hotter body (Btu/h.ft^2)\nEC = 0.75 #Energy transferred to colder body (Btu/h.ft^2)\nTH = 1660.0 #Absolute temperature of hotter body (\u00b0R)\nTC = 1260.0 #Absolute temperature of colder body (\u00b0R)\n\n#Calculation:\nE = s*((TH/100.0)**4-(TC/100.0)**4)/((1.0/EH)+(1.0/EC)-1.0) #Net energy exchange per unit area (Btu/h.ft^2)\n\n#Result:\nprint \"The net energy exchange per unit area is :\",round(E,-1),\" Btu/h.ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "s = 0.173 #Stefan-Boltzmann constant (Btu/h.ft^2.\u00b0R)\n",
+ "EH = 0.5 #Energy transferred from hotter body (Btu/h.ft^2)\n",
+ "EC = 0.75 #Energy transferred to colder body (Btu/h.ft^2)\n",
+ "TH = 1660.0 #Absolute temperature of hotter body (\u00b0R)\n",
+ "TC = 1260.0 #Absolute temperature of colder body (\u00b0R)\n",
+ "\n",
+ "#Calculation:\n",
+ "E = s*((TH/100.0)**4-(TC/100.0)**4)/((1.0/EH)+(1.0/EC)-1.0) #Net energy exchange per unit area (Btu/h.ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The net energy exchange per unit area is :\",round(E,-1),\" Btu/h.ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The net energy exchange per unit area is : 3760.0 Btu/h.ft^2 .\n"
+ "text": [
+ "The net energy exchange per unit area is : 3760.0 Btu/h.ft^2 .\n"
+ ]
}
],
"prompt_number": 7
@@ -122,19 +217,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.8, Page number: 191"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.8, Page number: 191"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Compare and discuss the results of the last two illustrative examples.\n'''\n\n#Variable declaration:\n#From example 11.6-11.7:\nE1 = 8776.0 #Energy exchange between black bodies (Btu/h.ft^2)\nE2 = 3760.0 #Energy exchange between non-black bodies (Btu/h.ft^2)\n\n#Calculation:\nD = (E1-E2)/E1*100 #Percent difference in energy (%)\n\n#Result:\nprint \"The percent difference relative to the black body is:\",round(D,1),\" % .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 11.6-11.7:\n",
+ "E1 = 8776.0 #Energy exchange between black bodies (Btu/h.ft^2)\n",
+ "E2 = 3760.0 #Energy exchange between non-black bodies (Btu/h.ft^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "D = (E1-E2)/E1*100 #Percent difference in energy (%)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The percent difference relative to the black body is:\",round(D,1),\" % .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The percent difference relative to the black body is: 57.2 % .\n"
+ "text": [
+ "The percent difference relative to the black body is: 57.2 % .\n"
+ ]
}
],
"prompt_number": 1
@@ -143,19 +255,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.9, Page number: 192"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.9, Page number: 192"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the radiation from a 2-inch IPS cast iron pipe (assume polished) carrying steam at\n300\u00b0F and passing through the center of a 1 ft x 1 ft galvanized zinc duct at 75\u00b0F and whose\noutside is insulated.\n'''\n\n#Variable declaration:\ns = 0.173*10**-8 #Stefan-Boltzmann constant (Btu/h.ft^2.\u00b0R)\nTH = 300.0+460.0 #Absolute temperature of external surface (\u00b0R)\nTC = 75.0+460.0 #Absolute temperature of duct (\u00b0R)\n#From Table 6.2:\nAH = 0.622 #External surface area of pipe (ft^2)\n#From Table 11.2:\nEH = 0.44 #Emissivity of oxidized steel\nAC = 4.0*1.0*1.0 #External surface area of duct (ft^2)\nEC = 0.23 #Emissivity of galvanized zinc\n\n#Calculation:\nFE = 1.0/(1.0/EH+((AH/AC)*(1.0/EC-1.0))) #Emissivity correction factor\nQ = FE*AH*s*(TH**4-TC**4) #Net radiation heat transfer (Btu/h.ft)\n\n#Result:\nprint \"The net radiation heat transfer is :\",round(Q,2),\" Btu/h.ft^2 .\"\nprint \"There is a calculation error in book.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "s = 0.173*10**-8 #Stefan-Boltzmann constant (Btu/h.ft^2.\u00b0R)\n",
+ "TH = 300.0+460.0 #Absolute temperature of external surface (\u00b0R)\n",
+ "TC = 75.0+460.0 #Absolute temperature of duct (\u00b0R)\n",
+ "#From Table 6.2:\n",
+ "AH = 0.622 #External surface area of pipe (ft^2)\n",
+ "#From Table 11.2:\n",
+ "EH = 0.44 #Emissivity of oxidized steel\n",
+ "AC = 4.0*1.0*1.0 #External surface area of duct (ft^2)\n",
+ "EC = 0.23 #Emissivity of galvanized zinc\n",
+ "\n",
+ "#Calculation:\n",
+ "FE = 1.0/(1.0/EH+((AH/AC)*(1.0/EC-1.0))) #Emissivity correction factor\n",
+ "Q = FE*AH*s*(TH**4-TC**4) #Net radiation heat transfer (Btu/h.ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The net radiation heat transfer is :\",round(Q,2),\" Btu/h.ft^2 .\"\n",
+ "print \"There is a calculation error in book.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The net radiation heat transfer is : 96.96 Btu/h.ft^2 .\nThere is a calculation error in book.\n"
+ "text": [
+ "The net radiation heat transfer is : 96.96 Btu/h.ft^2 .\n",
+ "There is a calculation error in book.\n"
+ ]
}
],
"prompt_number": 9
@@ -164,19 +302,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.10, Page number: 193"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.10, Page number: 193"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The outside temperature of a 10 ft2 hot insulated pipe is 140\u00b0F and the surrounding atmosphere\nis 60\u00b0F. The heat loss by free convection and radiation is 13,020 Btu/h, and the combined coefficient\nof heat transfer is estimated to be 2.10 Btu/h.ft^2.\u00b0F . How much of the heat loss is due to\nradiation? Assume the pipe emissivity is approximately 0.9.\n'''\n\n#Variable declaration:\nTH = 140.0+460.0 #Absolute outside temperature of pipe (ft^2)\nTC = 60.0+460.0 #Absolute temperature of surrounding atmosphere (ft^2)\nA = 10.0 #Area of pipe (ft^2)\nE = 0.9 #Emissivity of pipe\n\n#Calculation:\nQ = E*A*0.173*((TH/100.0)**4-(TC/100.0)**4) #Heat loss due to radiation (Btu/h)\n\n#Result:\nprint \"The heat loss due to radiation is :\",round(Q,-1),\" Btu/h .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "TH = 140.0+460.0 #Absolute outside temperature of pipe (ft^2)\n",
+ "TC = 60.0+460.0 #Absolute temperature of surrounding atmosphere (ft^2)\n",
+ "A = 10.0 #Area of pipe (ft^2)\n",
+ "E = 0.9 #Emissivity of pipe\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = E*A*0.173*((TH/100.0)**4-(TC/100.0)**4) #Heat loss due to radiation (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat loss due to radiation is :\",round(Q,-1),\" Btu/h .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat loss due to radiation is : 880.0 Btu/h .\n"
+ "text": [
+ "The heat loss due to radiation is : 880.0 Btu/h .\n"
+ ]
}
],
"prompt_number": 10
@@ -185,19 +341,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.11, Page number: 193"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.11, Page number: 193"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''With reference to Illustrative Example 11.10, calculate the radiation heat transfer coefficient, hr.\n'''\n\n#Variable declaration:\n#Froma example 11.10:\nQ = 880.0 #Heat loss due to radiation (Btu/h)\nA = 10.0 #Area of pipe (ft^2)\nTH = 140.0 #Absolute outside temperature of pipe (\u00b0F)\nTC = 60.0 #Absolute temperature of surrounding atmosphere (\u00b0F)\n\n#Calculation:\nhr = Q/(A*(TH-TC)) #Radiation heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"The radiation heat transfer coefficient is :\",round(hr,1),\" Btu/h.ft^2.\u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#Froma example 11.10:\n",
+ "Q = 880.0 #Heat loss due to radiation (Btu/h)\n",
+ "A = 10.0 #Area of pipe (ft^2)\n",
+ "TH = 140.0 #Absolute outside temperature of pipe (\u00b0F)\n",
+ "TC = 60.0 #Absolute temperature of surrounding atmosphere (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "hr = Q/(A*(TH-TC)) #Radiation heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The radiation heat transfer coefficient is :\",round(hr,1),\" Btu/h.ft^2.\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The radiation heat transfer coefficient is : 1.1 Btu/h.ft^2.\u00b0F .\n"
+ "text": [
+ "The radiation heat transfer coefficient is : 1.1 Btu/h.ft^2.\u00b0F .\n"
+ ]
}
],
"prompt_number": 11
@@ -206,19 +381,67 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.12, Page number: 194"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.12, Page number: 194"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A small oxidized horizontal metal tube is placed in a very large furnace enclosure with firebrick\nwalls. The metal tube has an outside diameter of 1 inch, a length of 2 ft, a surface emissivity of\n0.6, and its surface is maintained at 600\u00b0F. The hot air in the furnace is at 1500\u00b0F and the furnace\nbrick walls are at 1350\u00b0F. The convection heat transfer coefficient for the horizontal tube is 2.8\nBtu/h.ft2.\u00b0F . Calculate\n1. The convective, radiative, and total heat transferred to the metal tube;\n2. The percent of total heat transferred by radiation;\n3. The radiation heat transfer coefficient;\n4. Is it appropriate to use the approximate equation presented in Equation (11.30) for (3)?\n'''\n\nfrom math import pi\n\n#Variable declaration:\nD = 0.0833 #Diameter of tube (ft)\nL = 2.0 #Length of tube (ft)\nh = 2.8 #Heat transfer coefficient (Btu/h.ft^2.\u00b0F)\nTa1 = 1500.0+460.0 #Temperature of hot air in furnace (\u00b0R)\nTa2 = 1350.0+460.0 #Temperature of hot air in the furnace brick walls (\u00b0R)\nTt = 600.0+460.0 #Surface temperature of tube (\u00b0R)\nE = 0.6 #Surface emissivity of tube\ns = 0.1713*10**-8 #Stefan-Boltzmann constant\n\n\n#Calculation:\n#Case 1:\nA = pi*D*L #Area of tube (ft^2)\nQc = round(h*A*(Ta1-Tt),-1) #Convection heat transfer from air to tube (Btu/h)\nQr = round(E*s*A*(Ta2**4-Tt**4),-2) #Radiation feat transfer from wall to tube (Btu/h)\nQ = Qr+Qc #Total heat transfer (Btu/h)\n#Case 2:\nQp = Qr/Q*100 #Radiation percent \n#Case 3:\nhr = Qr/(A*(Ta2-Tt)) #Radiation heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n#Case 4:\nT = Ta2-Tt #Temperature difference (\u00b0F)\n\n#Result:\nprint \"1. The convective heat transferred to the metal tube is :\",Qc,\" Btu/h .\"\nprint \" The radiative heat transferred to the metal tube is :\",Qr,\" Btu/h .\"\nprint \" The total heat transferred to the metal tube is :\",Q,\" Btu/h .\"\nprint \"2. The percent of total heat transferred by radiation is :\",round(Qp,1),\" % .\"\nprint \"3. The radiation heat transfer coefficient is :\",round(hr,1),\" Btu/h.ft^2.\u00b0F .\"\nif (T > 200):\n print \"4. The use of the approximation Equation (11.30), hr = 4EsTav^3, is not appropriate.\"\nelif (T < 200):\n print \"4. The use of the approximation Equation (11.30), hr = 4EsTav^3, is appropriate.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "D = 0.0833 #Diameter of tube (ft)\n",
+ "L = 2.0 #Length of tube (ft)\n",
+ "h = 2.8 #Heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "Ta1 = 1500.0+460.0 #Temperature of hot air in furnace (\u00b0R)\n",
+ "Ta2 = 1350.0+460.0 #Temperature of hot air in the furnace brick walls (\u00b0R)\n",
+ "Tt = 600.0+460.0 #Surface temperature of tube (\u00b0R)\n",
+ "E = 0.6 #Surface emissivity of tube\n",
+ "s = 0.1713*10**-8 #Stefan-Boltzmann constant\n",
+ "\n",
+ "\n",
+ "#Calculation:\n",
+ "#Case 1:\n",
+ "A = pi*D*L #Area of tube (ft^2)\n",
+ "Qc = round(h*A*(Ta1-Tt),-1) #Convection heat transfer from air to tube (Btu/h)\n",
+ "Qr = round(E*s*A*(Ta2**4-Tt**4),-2) #Radiation feat transfer from wall to tube (Btu/h)\n",
+ "Q = Qr+Qc #Total heat transfer (Btu/h)\n",
+ "#Case 2:\n",
+ "Qp = Qr/Q*100 #Radiation percent \n",
+ "#Case 3:\n",
+ "hr = Qr/(A*(Ta2-Tt)) #Radiation heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "#Case 4:\n",
+ "T = Ta2-Tt #Temperature difference (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The convective heat transferred to the metal tube is :\",Qc,\" Btu/h .\"\n",
+ "print \" The radiative heat transferred to the metal tube is :\",Qr,\" Btu/h .\"\n",
+ "print \" The total heat transferred to the metal tube is :\",Q,\" Btu/h .\"\n",
+ "print \"2. The percent of total heat transferred by radiation is :\",round(Qp,1),\" % .\"\n",
+ "print \"3. The radiation heat transfer coefficient is :\",round(hr,1),\" Btu/h.ft^2.\u00b0F .\"\n",
+ "if (T > 200):\n",
+ " print \"4. The use of the approximation Equation (11.30), hr = 4EsTav^3, is not appropriate.\"\n",
+ "elif (T < 200):\n",
+ " print \"4. The use of the approximation Equation (11.30), hr = 4EsTav^3, is appropriate.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The convective heat transferred to the metal tube is : 1320.0 Btu/h .\n The radiative heat transferred to the metal tube is : 5100.0 Btu/h .\n The total heat transferred to the metal tube is : 6420.0 Btu/h .\n2. The percent of total heat transferred by radiation is : 79.4 % .\n3. The radiation heat transfer coefficient is : 13.0 Btu/h.ft^2.\u00b0F .\n4. The use of the approximation Equation (11.30), hr = 4EsTav^3, is not appropriate.\n"
+ "text": [
+ "1. The convective heat transferred to the metal tube is : 1320.0 Btu/h .\n",
+ " The radiative heat transferred to the metal tube is : 5100.0 Btu/h .\n",
+ " The total heat transferred to the metal tube is : 6420.0 Btu/h .\n",
+ "2. The percent of total heat transferred by radiation is : 79.4 % .\n",
+ "3. The radiation heat transfer coefficient is : 13.0 Btu/h.ft^2.\u00b0F .\n",
+ "4. The use of the approximation Equation (11.30), hr = 4EsTav^3, is not appropriate.\n"
+ ]
}
],
"prompt_number": 14
@@ -227,19 +450,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.13, Page number: 194"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.13, Page number: 194"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The filament of a light bulb is at a temperature of 900\u00b0C and emits 5W of heat toward the glass\nbulb. The interior of a light bulb can be considered a vacuum and the temperature of the glass\nbulb is 150\u00b0C. Ignoring heat transfer to the room and assuming the emissivity of the filament is\n1.0, calculate the surface area of the filament in cm^2.\n'''\n\n#Variable declaration:\nQ = 5.0 #Radiation heat transfer (W)\nE = 1.0 #Emissivity of filament\ns = 5.669*10**-8 #Stefan-Boltzmann constant\nT1 = 900.0+273.0 #Light bulb temperature (K)\nT2 = 150.0+273.0 #Glass bulb temperature (K)\n\n#Calculation:\nA = Q/(E*s*(T1**4-T2**4)) #Surface area of the filament (m^2)\n\n#Result:\nprint \"The surface area of the filament is :\",round(A*10**4,2), \"cm^2\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Q = 5.0 #Radiation heat transfer (W)\n",
+ "E = 1.0 #Emissivity of filament\n",
+ "s = 5.669*10**-8 #Stefan-Boltzmann constant\n",
+ "T1 = 900.0+273.0 #Light bulb temperature (K)\n",
+ "T2 = 150.0+273.0 #Glass bulb temperature (K)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = Q/(E*s*(T1**4-T2**4)) #Surface area of the filament (m^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The surface area of the filament is :\",round(A*10**4,2), \"cm^2\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The surface area of the filament is : 0.47 cm^2\n"
+ "text": [
+ "The surface area of the filament is : 0.47 cm^2\n"
+ ]
}
],
"prompt_number": 13
@@ -248,19 +490,57 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.14, Page number: 195"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.14, Page number: 195"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A system consists of an uninsulated steam pipe made of anodized aluminum with a diameter\nD = 0.06 m and a length L = 100 m. The surface temperature is T1 = 127\u00b0C and the surface\nemissivity of anodized aluminum is 1 = 0.76. The pipe is in a large room with a wall temperature\nT2 = 20\u00b0C. The air in the room is at a temperature T3 = 22\u00b0C. The pipe convective heat\ntransfer coefficient is h = 15 W/m^2 . K.\nEstimate the emissive power, the total heat transfer by convection and radiation, and the radiation\nheat transfer coefficient. Assume steady-state operation, constant properties, and a room\nsurface area much larger than the pipe surface area.\n'''\n\nfrom math import pi\n\n#Variable declaration:\nT1 = 127.0+273.0 #Surface temperature (K)\nT2 = 20.0+273.0 #Wall temperature (K)\nT3 = 22.0+273.0 #Air temperature (K)\ns = 5.669*10**-8 #Stefan-Boltzmann constant\ne = 0.76 #Surface emissivity of anodized aluminium\nD = 0.06 #Diameter of pipe (m)\nL = 100.0 #Length of pipe (m)\nh = 15.0 #Pipe convective heat transfer coefficient (W/m^2.K)\n\n#Calculation:\nEb = s*T1**4 #Emissive energy of pipe (W/m^2)\nE = e*Eb #Emissive power from surface of pipe (W/m^2)\nA = pi*D*L #Surface area of pipe (m^2)\nQc = h*A*(T1-T3) #Convection heat transfer to air (W)\nQr = e*s*A*(T1**4-T2**4) #Radiation heat transfer rate (W)\nQ = Qc+Qr #Total heat transfer rate (Btu/h)\nTav = (T1+T2)/2.0 #Average temperature (K)\nhr = 4*e*s*Tav**3 #Radiation heat transfer coefficient (W/m^2.K)\n\n#Result:\nprint \"The emissive power from surface of pipe is :\",round(E),\" W/m^2 .\"\nprint \"The convection heat transfer to air is :\",round(Qc/10**3,1),\" kW .\"\nprint \"The radiation heat transfer rate is :\",round(Qr/10**3,1),\" kW \"\nprint \"The radiation heat transfer coefficient is :\",round(hr,1),\" W/m^2.K .\"",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 127.0+273.0 #Surface temperature (K)\n",
+ "T2 = 20.0+273.0 #Wall temperature (K)\n",
+ "T3 = 22.0+273.0 #Air temperature (K)\n",
+ "s = 5.669*10**-8 #Stefan-Boltzmann constant\n",
+ "e = 0.76 #Surface emissivity of anodized aluminium\n",
+ "D = 0.06 #Diameter of pipe (m)\n",
+ "L = 100.0 #Length of pipe (m)\n",
+ "h = 15.0 #Pipe convective heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "Eb = s*T1**4 #Emissive energy of pipe (W/m^2)\n",
+ "E = e*Eb #Emissive power from surface of pipe (W/m^2)\n",
+ "A = pi*D*L #Surface area of pipe (m^2)\n",
+ "Qc = h*A*(T1-T3) #Convection heat transfer to air (W)\n",
+ "Qr = e*s*A*(T1**4-T2**4) #Radiation heat transfer rate (W)\n",
+ "Q = Qc+Qr #Total heat transfer rate (Btu/h)\n",
+ "Tav = (T1+T2)/2.0 #Average temperature (K)\n",
+ "hr = 4*e*s*Tav**3 #Radiation heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The emissive power from surface of pipe is :\",round(E),\" W/m^2 .\"\n",
+ "print \"The convection heat transfer to air is :\",round(Qc/10**3,1),\" kW .\"\n",
+ "print \"The radiation heat transfer rate is :\",round(Qr/10**3,1),\" kW \"\n",
+ "print \"The radiation heat transfer coefficient is :\",round(hr,1),\" W/m^2.K .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The emissive power from surface of pipe is : 1103.0 W/m^2 .\nThe convection heat transfer to air is : 29.7 kW .\nThe radiation heat transfer rate is : 14.8 kW \nThe radiation heat transfer coefficient is : 7.2 W/m^2.K .\n"
+ "text": [
+ "The emissive power from surface of pipe is : 1103.0 W/m^2 .\n",
+ "The convection heat transfer to air is : 29.7 kW .\n",
+ "The radiation heat transfer rate is : 14.8 kW \n",
+ "The radiation heat transfer coefficient is : 7.2 W/m^2.K .\n"
+ ]
}
],
"prompt_number": 15
@@ -269,19 +549,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.15, Page number: 196"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.15, Page number: 196"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 11.14. How much does radiation contribute to the total heat\ntransfer?\n'''\n\n#Variable declaration:\n#From example 11.14:\nQc = 15.0 #Convection heat transfer coefficient (W/m^2.K)\nhr = 7.2 #Radiation heat transfer coefficient (W/m^2.K)\n\n#Calculation:\nX = hr/(Qc+hr)*100.0 #Percent heat transfer by radiation (%)\n\n#Result:\nprint \"The percent heat transfer by radiation is :\",round(X,1),\" % .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 11.14:\n",
+ "Qc = 15.0 #Convection heat transfer coefficient (W/m^2.K)\n",
+ "hr = 7.2 #Radiation heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "X = hr/(Qc+hr)*100.0 #Percent heat transfer by radiation (%)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The percent heat transfer by radiation is :\",round(X,1),\" % .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The percent heat transfer by radiation is : 32.4 % .\n"
+ "text": [
+ "The percent heat transfer by radiation is : 32.4 % .\n"
+ ]
}
],
"prompt_number": 16
@@ -290,19 +587,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.16, Page number: 200"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.16, Page number: 200"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 11.9. Calculate the heat transfer rate if Fv = 1.0.\n'''\n\n#Variable declaration:\nFV = 1.0 #Correction factor\n#From example 11.9:\nFE = 0.358 #Emissivity correction factor\nTH = 300.0+460.0 #Absolute temperature of external surface (\u00b0R)\nTC = 75.0+460.0 #Absolute temperature of duct (\u00b0R)\nAH = 0.622 #Area of pipe (ft^2)\ns = 0.173*10**-8 #Stefan-Boltzmann constant\n\n#Calculation:\nQ = FV*FE*AH*s*(TH**4-TC**4) #Heat transfer rate (Btu/h.ft)\n\n#Result:\nprint \"The heat transfer rate is :\",round(Q,2),\" Btu/h.ft\"\nprint \"Since, 'Q' obtained in (11.9) is 96.96 Btu/h.ft, the solution does not match with book.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "FV = 1.0 #Correction factor\n",
+ "#From example 11.9:\n",
+ "FE = 0.358 #Emissivity correction factor\n",
+ "TH = 300.0+460.0 #Absolute temperature of external surface (\u00b0R)\n",
+ "TC = 75.0+460.0 #Absolute temperature of duct (\u00b0R)\n",
+ "AH = 0.622 #Area of pipe (ft^2)\n",
+ "s = 0.173*10**-8 #Stefan-Boltzmann constant\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = FV*FE*AH*s*(TH**4-TC**4) #Heat transfer rate (Btu/h.ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate is :\",round(Q,2),\" Btu/h.ft\"\n",
+ "print \"Since, 'Q' obtained in (11.9) is 96.96 Btu/h.ft, the solution does not match with book.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate is : 96.96 Btu/h.ft\nSince, 'Q' obtained in (11.9) is 96.96 Btu/h.ft, the solution does not match with book.\n"
+ "text": [
+ "The heat transfer rate is : 96.96 Btu/h.ft\n",
+ "Since, 'Q' obtained in (11.9) is 96.96 Btu/h.ft, the solution does not match with book.\n"
+ ]
}
],
"prompt_number": 17
@@ -311,19 +631,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 11.17, Page number: 200"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 11.17, Page number: 200"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Two parallel rectangular black plates 0.5 m by 2.0 m are spaced 1.0 m apart. One plate is maintained\nat 1000\u00b0C and the other at 2000\u00b0C. What is the net radiant heat exchange between the two\nplates?\n'''\n\n#Variable declaration:\n#From figure 11.2:\nL = 1.0 #Space between plates (m)\nX = 0.5 #Length of plate (m)\nY = 2.0 #Width of plate (m)\ns = 5.669*10**-8 #Stefan-Boltzmann constant\nTH = 2000.0+273.0 #Temperature of hotter plate (K)\nTC = 1000.0+273.0 #Temperature of colder plate (K)\nBtu = 0.2934*10**-3 #Btu/h in a KW\n\n#Calculation:\nA = X*Y #Area of plate (m^2)\nZ1 = Y/L #Ratio of width with space\nZ2 = X/L #Ratio of length with space\n#From figure 11.2:\nFV = 0.18 #Correction factor\nFE = 1.0 #Emissivity correction factor\nQ1 = FV*FE*s*A*(TH**4-TC**4) #Net radiant heat exchange between plates (kW)\nQ2 = Q1/Btu #Net radiant heat exchange between plates in Btu/h (Btu/h)\n\n#Result:\nprint \"The net radiant heat exchange between plates is :\",round(Q1,-2),\" kW .\"\nprint \"The net radiant heat exchange between plates in Btu/h is :\",round(Q2/10**8,2),\" x 10^8 Btu/h .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From figure 11.2:\n",
+ "L = 1.0 #Space between plates (m)\n",
+ "X = 0.5 #Length of plate (m)\n",
+ "Y = 2.0 #Width of plate (m)\n",
+ "s = 5.669*10**-8 #Stefan-Boltzmann constant\n",
+ "TH = 2000.0+273.0 #Temperature of hotter plate (K)\n",
+ "TC = 1000.0+273.0 #Temperature of colder plate (K)\n",
+ "Btu = 0.2934*10**-3 #Btu/h in a KW\n",
+ "\n",
+ "#Calculation:\n",
+ "A = X*Y #Area of plate (m^2)\n",
+ "Z1 = Y/L #Ratio of width with space\n",
+ "Z2 = X/L #Ratio of length with space\n",
+ "#From figure 11.2:\n",
+ "FV = 0.18 #Correction factor\n",
+ "FE = 1.0 #Emissivity correction factor\n",
+ "Q1 = FV*FE*s*A*(TH**4-TC**4) #Net radiant heat exchange between plates (kW)\n",
+ "Q2 = Q1/Btu #Net radiant heat exchange between plates in Btu/h (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The net radiant heat exchange between plates is :\",round(Q1,-2),\" kW .\"\n",
+ "print \"The net radiant heat exchange between plates in Btu/h is :\",round(Q2/10**8,2),\" x 10^8 Btu/h .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The net radiant heat exchange between plates is : 245600.0 kW .\nThe net radiant heat exchange between plates in Btu/h is : 8.37 x 10^8 Btu/h .\n"
+ "text": [
+ "The net radiant heat exchange between plates is : 245600.0 kW .\n",
+ "The net radiant heat exchange between plates in Btu/h is : 8.37 x 10^8 Btu/h .\n"
+ ]
}
],
"prompt_number": 18
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_12.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_12.ipynb
index fab7925c..152f64d3 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_12.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 12"
+ "name": "",
+ "signature": "sha256:0272b11c37a42cf15d1c049753dc4426e759c84397cb741ebb3033f45eac2495"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,43 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 12: Condensation and Boiling"
+ "source": [
+ "Chapter 12: Condensation and Boiling"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.2, Page number: 206"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.2, Page number: 206"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the number of degrees of freedom for a one-component, one-phase system.\n'''\n\n#Variable declaration:\nC = 1 #Number of constituents\nP = 1 #Number of phases\n\n#Calculation:\nF = C-P+2 #Number of degrees of freedom\n\n#Result:\nprint \"The number of degrees of freedom is :\",F,\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "C = 1 #Number of constituents\n",
+ "P = 1 #Number of phases\n",
+ "\n",
+ "#Calculation:\n",
+ "F = C-P+2 #Number of degrees of freedom\n",
+ "\n",
+ "#Result:\n",
+ "print \"The number of degrees of freedom is :\",F,\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The number of degrees of freedom is : 2 .\n"
+ "text": [
+ "The number of degrees of freedom is : 2 .\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +57,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.4, Page number: 209"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.4, Page number: 209"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to the previous illustrative example. How much heat is removed from the system during\nthis process?\n'''\n\n#Variable declaration:\n#From steam tables:\nU1 = 1237.1 #Internnal energy of gas (Btu/lb)\nU2_g = 1112.2 #Internal energy of gas (Btu/lb)\nU2_l = 343.15 #Internal energy of liquid (Btu/lb)\n\n#Calculation:\nQ = 0.5*(U2_g+U2_l)-1*U1 #Heat removed (Btu/lb)\n\n#Result:\nprint \"Heat removed from the system during the process is :\",round(Q,1),\" Btu/lb .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From steam tables:\n",
+ "U1 = 1237.1 #Internnal energy of gas (Btu/lb)\n",
+ "U2_g = 1112.2 #Internal energy of gas (Btu/lb)\n",
+ "U2_l = 343.15 #Internal energy of liquid (Btu/lb)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = 0.5*(U2_g+U2_l)-1*U1 #Heat removed (Btu/lb)\n",
+ "\n",
+ "#Result:\n",
+ "print \"Heat removed from the system during the process is :\",round(Q,1),\" Btu/lb .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Heat removed from the system during the process is : -509.4 Btu/lb .\n"
+ "text": [
+ "Heat removed from the system during the process is : -509.4 Btu/lb .\n"
+ ]
}
],
"prompt_number": 4
@@ -59,19 +96,65 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.5, Page number: 212"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.5, Page number: 212"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A vertical rectangular plate is 0.2 m wide and 0.4 m high. One surface of the plate is exposed to\nsaturated steam at atmospheric pressure. The plate surface is maintained at 98\u00b0C. Filmwise condensation\nmay be assumed. Calculate the type of condensation (flow type) and the condensation\nheat transfer coefficient. Assume steady-state, constant properties, an isotropic homogeneous\nsurface, and that the properties of the water condensate may be evaluated at a film temperature\nof 99\u00b0C. The thermal conductivity of water may be assumed equal to 0.68W/m . K.\n'''\nfrom __future__ import division\nfrom sympy import symbols,solve\n\n#Variable declaration:\nT1 = 99.0 #Mean film temperature (\u00b0C)\nT2 = 98.0 #Plate surface temperature (\u00b0C)\ng = 9.807 #Gravitational acceleration (m/s^2)\n#From Appendix:\nT3 = 100.0 #Saturation temperatre (\u00b0C)\nh_vap1 = 970.3 #Latent heat of steam in Btu/lb (Btu/lb)\nh_vap2 = 2.255*10**6 #Latent heat of steam in J/kg (J/kg)\np_v = 0.577 #Density of steam (kg/m^3)\np_l = 960.0 #Density of liquid water condensate (kg/m^3)\nmu_l = 2.82*10**-4 #Absolute viscosity of liquid water condensate (kg/m.s)\nk = 0.68 #Thermal conductivity of water (W/m.K)\n#From table 12.2\nZ = 0.4 #Height of rectangular plate (m)\nPw = 0.2 #Wetted perimeter of rectangular plate (m)\nh = symbols('h') #Average heat transfer coefficient (W/m^2.K)\n\n#Calculation:\nA = Z*Pw #Heat transfer area of plate (m^2)\nR = A/Pw #Ratio A/Pw (m)\nv_l = mu_l/p_l #Kinematic viscosity of liquid water condensate (m^2/s)\nCo1 = (h/k)*(v_l**2/g/(1-p_v/p_l))**(1/3) #Condensation number (in terms of the average heat transfer coefficient)\nRe = 4*h*Z*(T3-T2)/(mu_l*h_vap2) #Reynolds number in terms of the average heat transfer coefficient\n#From equation 12.14:\nCO1 = 0.0077*Re**Z #Co in terms of Reynolds number for flow type 1\nx1 = solve(Co1-CO1,h) #Solving heat transfer coefficient (W/m^2.K)\nh1 =x1[1]; #Average heat transfer coefficient for flow type 1 (W/m^2.K)\nRe1 = Re.subs(h,h1); #Reynolds number for flow type 1\nCO2 = 1.874*Re**(-1/3) #Co in terms of Reynolds number for flow tupe 2\nx2 = solve(Co1-CO2,h) #Solving average heat transfer coefficient for flow type 2 (W/m^2.K)\nh2 = x2[0]; #Average heat transfer coefficient for flow type 2 (W/m^2.K)\nRe2 = Re.subs(h,h2) #Reynolds number for flow type 2\n\n#Result:\nprint \"The type of condensation flow type 2 is laminar.\"\nprint \"And the condensation heat transfer coefficient is :\",round(h2,-1),\" W/m^2.K .\"\n",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from sympy import symbols,solve\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 99.0 #Mean film temperature (\u00b0C)\n",
+ "T2 = 98.0 #Plate surface temperature (\u00b0C)\n",
+ "g = 9.807 #Gravitational acceleration (m/s^2)\n",
+ "#From Appendix:\n",
+ "T3 = 100.0 #Saturation temperatre (\u00b0C)\n",
+ "h_vap1 = 970.3 #Latent heat of steam in Btu/lb (Btu/lb)\n",
+ "h_vap2 = 2.255*10**6 #Latent heat of steam in J/kg (J/kg)\n",
+ "p_v = 0.577 #Density of steam (kg/m^3)\n",
+ "p_l = 960.0 #Density of liquid water condensate (kg/m^3)\n",
+ "mu_l = 2.82*10**-4 #Absolute viscosity of liquid water condensate (kg/m.s)\n",
+ "k = 0.68 #Thermal conductivity of water (W/m.K)\n",
+ "#From table 12.2\n",
+ "Z = 0.4 #Height of rectangular plate (m)\n",
+ "Pw = 0.2 #Wetted perimeter of rectangular plate (m)\n",
+ "h = symbols('h') #Average heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = Z*Pw #Heat transfer area of plate (m^2)\n",
+ "R = A/Pw #Ratio A/Pw (m)\n",
+ "v_l = mu_l/p_l #Kinematic viscosity of liquid water condensate (m^2/s)\n",
+ "Co1 = (h/k)*(v_l**2/g/(1-p_v/p_l))**(1/3) #Condensation number (in terms of the average heat transfer coefficient)\n",
+ "Re = 4*h*Z*(T3-T2)/(mu_l*h_vap2) #Reynolds number in terms of the average heat transfer coefficient\n",
+ "#From equation 12.14:\n",
+ "CO1 = 0.0077*Re**Z #Co in terms of Reynolds number for flow type 1\n",
+ "x1 = solve(Co1-CO1,h) #Solving heat transfer coefficient (W/m^2.K)\n",
+ "h1 =x1[1]; #Average heat transfer coefficient for flow type 1 (W/m^2.K)\n",
+ "Re1 = Re.subs(h,h1); #Reynolds number for flow type 1\n",
+ "CO2 = 1.874*Re**(-1/3) #Co in terms of Reynolds number for flow tupe 2\n",
+ "x2 = solve(Co1-CO2,h) #Solving average heat transfer coefficient for flow type 2 (W/m^2.K)\n",
+ "h2 = x2[0]; #Average heat transfer coefficient for flow type 2 (W/m^2.K)\n",
+ "Re2 = Re.subs(h,h2) #Reynolds number for flow type 2\n",
+ "\n",
+ "#Result:\n",
+ "print \"The type of condensation flow type 2 is laminar.\"\n",
+ "print \"And the condensation heat transfer coefficient is :\",round(h2,-1),\" W/m^2.K .\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The type of condensation flow type 2 is laminar.\nAnd the condensation heat transfer coefficient is : 14700.0 W/m^2.K .\n"
+ "text": [
+ "The type of condensation flow type 2 is laminar.\n",
+ "And the condensation heat transfer coefficient is : 14700.0 W/m^2.K .\n"
+ ]
}
],
"prompt_number": 14
@@ -80,19 +163,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.6, Page number: 214"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.6, Page number: 214"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 12.5. Calculate\n1. the mass flow rate of condensate, m\u02d91\n2. the heat transfer rate Q\u02d9 .\n'''\n\n#Variable declaration:\n#From example 12.5:\nRe = 73.9 #Reynolds number\nmu_l = 2.82*10**-4 #Absolute viscosity of liquid water condensate (kg/m.s)\nPw = 0.2 #Wetted perimeter of rectangular plate (m)\nh = 14700.0 #Heat transfer coefficient (W/m^2.K)\nT_sat = 100.0 #Saturation temperature (\u00b0C)\nTs = 98.0 #Surface temperature (\u00b0C)\nA = 0.2*0.4 #Heat transfer area of plate (m^2) \n\n#Calculation:\nm1 = Re*mu_l/4.0 #Mass flow rate of condensate (kg/m.s)\nm = Pw*m1 #Mass flow rate of condensate (kg/s)\nCo = (3.038*10**-5)*h #Condensation number\nQ = h*A*(T_sat-Ts) #Heat transfer rate (W)\n\n#Result:\nprint \"1. The mass flow rate of condensate is :\",round(m1,4),\" kg/m.s . \"\nprint \"2. The heat transfer rate is :\",round(Q/10**3,2),\" kW . \"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 12.5:\n",
+ "Re = 73.9 #Reynolds number\n",
+ "mu_l = 2.82*10**-4 #Absolute viscosity of liquid water condensate (kg/m.s)\n",
+ "Pw = 0.2 #Wetted perimeter of rectangular plate (m)\n",
+ "h = 14700.0 #Heat transfer coefficient (W/m^2.K)\n",
+ "T_sat = 100.0 #Saturation temperature (\u00b0C)\n",
+ "Ts = 98.0 #Surface temperature (\u00b0C)\n",
+ "A = 0.2*0.4 #Heat transfer area of plate (m^2) \n",
+ "\n",
+ "#Calculation:\n",
+ "m1 = Re*mu_l/4.0 #Mass flow rate of condensate (kg/m.s)\n",
+ "m = Pw*m1 #Mass flow rate of condensate (kg/s)\n",
+ "Co = (3.038*10**-5)*h #Condensation number\n",
+ "Q = h*A*(T_sat-Ts) #Heat transfer rate (W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The mass flow rate of condensate is :\",round(m1,4),\" kg/m.s . \"\n",
+ "print \"2. The heat transfer rate is :\",round(Q/10**3,2),\" kW . \""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The mass flow rate of condensate is : 0.0052 kg/m.s . \n2. The heat transfer rate is : 2.35 kW . \n"
+ "text": [
+ "1. The mass flow rate of condensate is : 0.0052 kg/m.s . \n",
+ "2. The heat transfer rate is : 2.35 kW . \n"
+ ]
}
],
"prompt_number": 6
@@ -101,19 +211,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.7, Page number: 215"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.7, Page number: 215"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A horizontal 4-inch OD tube is surrounded by saturated steam at 2.0 psia. The tube is maintained\nat 64\u00b0F. What is the average heat-transfer coefficient? Assume laminar flow.\n'''\n\n#Variable declaration:\nT_sat = 126.0 #Saturation temperature (\u00b0F)\nT = 64.0 #Surface temperature of tube (\u00b0F)\ng = 32.2 #Gravitational acceleration (ft^2/s)\nD = 4.0/12.0 #Outside diameter of tube (ft)\n\n#Calculation:\nTf = (T_sat+T)/2.0 #Mean film temperature (\u00b0F)\n#From approximate values of key properties:\nh_vap = 1022.0 #Latent heat of steam (Btu/lb)\np_v = 0.00576 #Density of steam (lb/ft^3)\np_l = 62.03 #Density of liquid (lb/ft^3)\nk_l = 0.364 #Thermal conductivity of liquid (Btu/h.ft.\u00b0F)\nmu_l = 4.26*10**-4 #Absolute viscosity of liquid water condensate (lb/ft.s)\nh = 0.725*((p_l*(p_l-p_v)*g*h_vap*k_l**3)/(mu_l*D*(T_sat-T)/3600.0))**(1.0/4.0) #Average heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"The average heat transfer coefficient is :\",round(h,1),\" Btu/h.ft^2.\u00b0F .\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "T_sat = 126.0 #Saturation temperature (\u00b0F)\n",
+ "T = 64.0 #Surface temperature of tube (\u00b0F)\n",
+ "g = 32.2 #Gravitational acceleration (ft^2/s)\n",
+ "D = 4.0/12.0 #Outside diameter of tube (ft)\n",
+ "\n",
+ "#Calculation:\n",
+ "Tf = (T_sat+T)/2.0 #Mean film temperature (\u00b0F)\n",
+ "#From approximate values of key properties:\n",
+ "h_vap = 1022.0 #Latent heat of steam (Btu/lb)\n",
+ "p_v = 0.00576 #Density of steam (lb/ft^3)\n",
+ "p_l = 62.03 #Density of liquid (lb/ft^3)\n",
+ "k_l = 0.364 #Thermal conductivity of liquid (Btu/h.ft.\u00b0F)\n",
+ "mu_l = 4.26*10**-4 #Absolute viscosity of liquid water condensate (lb/ft.s)\n",
+ "h = 0.725*((p_l*(p_l-p_v)*g*h_vap*k_l**3)/(mu_l*D*(T_sat-T)/3600.0))**(1.0/4.0) #Average heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The average heat transfer coefficient is :\",round(h,1),\" Btu/h.ft^2.\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The average heat transfer coefficient is : 911.4 Btu/h.ft^2.\u00b0F .\n"
+ "text": [
+ "The average heat transfer coefficient is : 911.4 Btu/h.ft^2.\u00b0F .\n"
+ ]
}
],
"prompt_number": 7
@@ -122,19 +256,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.9, Page number: 222"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.9, Page number: 222"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Boiling water at 100\u00b0C and 1 atm is supplied with heat from a surface at 102\u00b0C. The heat flux is\n9\u00b000W/m2. If the surface temperature is raised to 103\u00b0C, determine the new heat flux.\nAt 1 atm, the saturation temperature of the water is 100\u00b0C. The liquid water properties (SI\nunits) are: density = 957.9 kg/m3, heat capacity = 4217 J/kg . K, latent heat of vaporization =\n2.26 \u0005 106 J/kg. Assume steady-state operation, constant properties, and laminar conditions.\n'''\n\n#Variable declaration:\nQs1 = 9800.0 #Heat flux (W/m^2)\nTs1 = 102.0 #Original surface temperature (\u00b0C)\nTs2 = 103.0 #New surface temperature (\u00b0C)\nTsat = 100.0 #Saturation temperature (\u00b0C)\n\n#Calculation:\nh1 = Qs1/(Ts1-Tsat) #Original heat transfer coefficient (W/m^2.K)\nDT1 = (Ts1 - Tsat) #Original excess temperature (\u00b0C)\nDT2 = (Ts2 - Tsat) #New excess temperature (\u00b0C)\nn = 0.25 #Value of n for laminar flow\nh2 = h1*(DT2/DT1)**(n) #New heat transfer coefficient (W/m^2.K)\nQs2 = h2*(Ts2-Tsat) #New heat flux (W/m^2)\n\n#Result:\nprint \"The new heat flux is :\",round(Qs2),\" W/m^2.K . \"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "Qs1 = 9800.0 #Heat flux (W/m^2)\n",
+ "Ts1 = 102.0 #Original surface temperature (\u00b0C)\n",
+ "Ts2 = 103.0 #New surface temperature (\u00b0C)\n",
+ "Tsat = 100.0 #Saturation temperature (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "h1 = Qs1/(Ts1-Tsat) #Original heat transfer coefficient (W/m^2.K)\n",
+ "DT1 = (Ts1 - Tsat) #Original excess temperature (\u00b0C)\n",
+ "DT2 = (Ts2 - Tsat) #New excess temperature (\u00b0C)\n",
+ "n = 0.25 #Value of n for laminar flow\n",
+ "h2 = h1*(DT2/DT1)**(n) #New heat transfer coefficient (W/m^2.K)\n",
+ "Qs2 = h2*(Ts2-Tsat) #New heat flux (W/m^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The new heat flux is :\",round(Qs2),\" W/m^2.K . \""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The new heat flux is : 16268.0 W/m^2.K . \n"
+ "text": [
+ "The new heat flux is : 16268.0 W/m^2.K . \n"
+ ]
}
],
"prompt_number": 9
@@ -143,19 +299,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.10, Page number: 223"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.10, Page number: 223"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''With respect to Illustrative Example 12.9, determine the mechanism of boiling heat transfer.\nIs the earlier assumed boiling mechanism still valid?\n'''\n\n#Variable declaration:\n#From example 12.9:\nTs1 = 102.0 #Original surface temperature (\u00b0C)\nTs2 = 103.0 #New surface temperature (\u00b0C)\nTsat = 100.0 #Saturation temperature (\u00b0C)\n\n#Calculation:\nDTe1 = (Ts1 - Tsat) #Original excess temperature (\u00b0C)\nDTe2 = (Ts2 - Tsat) #New excess temperature (\u00b0C)\n\n#Result:\nprint \"The original excess temperature is: DTe = \",DTe1,\" \u00b0C .\"\nprint \"The new excess temperature is: DTe = \",DTe2,\" \u00b0C .\"\nif ((DTe1 < 5) and (DTe2 < 5)):\n print \"The assumption of the free convection mechanism is valid since DTe < 5\u00b0C.\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 12.9:\n",
+ "Ts1 = 102.0 #Original surface temperature (\u00b0C)\n",
+ "Ts2 = 103.0 #New surface temperature (\u00b0C)\n",
+ "Tsat = 100.0 #Saturation temperature (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "DTe1 = (Ts1 - Tsat) #Original excess temperature (\u00b0C)\n",
+ "DTe2 = (Ts2 - Tsat) #New excess temperature (\u00b0C)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The original excess temperature is: DTe = \",DTe1,\" \u00b0C .\"\n",
+ "print \"The new excess temperature is: DTe = \",DTe2,\" \u00b0C .\"\n",
+ "if ((DTe1 < 5) and (DTe2 < 5)):\n",
+ " print \"The assumption of the free convection mechanism is valid since DTe < 5\u00b0C.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The original excess temperature is: DTe = 2.0 \u00b0C .\nThe new excess temperature is: DTe = 3.0 \u00b0C .\nThe assumption of the free convection mechanism is valid since DTe < 5\u00b0C.\n"
+ "text": [
+ "The original excess temperature is: DTe = 2.0 \u00b0C .\n",
+ "The new excess temperature is: DTe = 3.0 \u00b0C .\n",
+ "The assumption of the free convection mechanism is valid since DTe < 5\u00b0C.\n"
+ ]
}
],
"prompt_number": 10
@@ -164,19 +343,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.11, Page number: 223"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.11, Page number: 223"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 12.9 and calculate the liquid Jakob number.\n'''\n\n#Variable declaration:\n#From example 12.9:\nCp = 4127.0 #heat capacity (J/kg . K)\nDTe = 3.0 #New excess temperature (\u00b0C)\nh_vap = 2.26*10**6 #latent heat of vaporization (J/kg)\n\n#Calculation:\nJa_L = Cp*DTe/h_vap #Liquid Jakob number\n\n#Result:\nprint \"The liquid Jakob number is :\",round(Ja_L,5),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 12.9:\n",
+ "Cp = 4127.0 #heat capacity (J/kg . K)\n",
+ "DTe = 3.0 #New excess temperature (\u00b0C)\n",
+ "h_vap = 2.26*10**6 #latent heat of vaporization (J/kg)\n",
+ "\n",
+ "#Calculation:\n",
+ "Ja_L = Cp*DTe/h_vap #Liquid Jakob number\n",
+ "\n",
+ "#Result:\n",
+ "print \"The liquid Jakob number is :\",round(Ja_L,5),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The liquid Jakob number is : 0.00548 .\n"
+ "text": [
+ "The liquid Jakob number is : 0.00548 .\n"
+ ]
}
],
"prompt_number": 11
@@ -185,19 +382,55 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.12, Page number: 223"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.12, Page number: 223"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An electric heater 0.3 m in diameter at 106\u00b0C is used to heat water. The water is at 1 atm and\n100\u00b0C. Determine\n1. the boiling regime, and\n2. The heat transfer coefficient.\nAssume steady-state operation and constant properties.\n'''\n\n#Variable declaration:\nTs = 106.0 #Surface temperature (\u00b0C)\nTsat = 100.0 #Saturation temperature (\u00b0C)\n\n#Calculation:\nDTe = Ts-Tsat #Excess temperature (\u00b0C)\n#From table 12.5:\nC1 = 5.56 #Constant C1\nn1 = 3.0 #Constant n1\nC2 = 1040.0 #Constant C2\nn2 = 1.0/3.0 #Constant n2\nP = 1.0 #Absolute pressure (atm)\nPa = 1.0 #Ambient absolute pressure (atm)\n\n#Calculation:\nh1 = C1*DTe**n1*(P/Pa)**0.4 #Boiling water heat transfer coefficient (W/m^2)\nQs1 = h1*DTe #Surface flux (W/m^2)\nh2 = C2*DTe**n2*(P/Pa)**0.4 #Second Boiling water heat transfer coefficient (W/m^2)\nQs2 = h2*DTe #Second Surface flux (W/m^2) \n\n#Result:\n \nif (Qs1/10**3 > 15.8 and Qs1/10**3 < 236):\n print \"The boiling regime is :\",round(Qs1/10**3,1),\" kW/m^2 .\"\n print \"The heat transfer coefficient is :\",round(h1), \" W/m^2 .\"\nelif (Qs1/10**3 < 15.8):\n print \"The boiling regime is :\",round(Qs2/10**3,2),\" kW/m^2 .\"\n print \"The heat transfer coefficient is :\",round(h2), \" W/m^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ts = 106.0 #Surface temperature (\u00b0C)\n",
+ "Tsat = 100.0 #Saturation temperature (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "DTe = Ts-Tsat #Excess temperature (\u00b0C)\n",
+ "#From table 12.5:\n",
+ "C1 = 5.56 #Constant C1\n",
+ "n1 = 3.0 #Constant n1\n",
+ "C2 = 1040.0 #Constant C2\n",
+ "n2 = 1.0/3.0 #Constant n2\n",
+ "P = 1.0 #Absolute pressure (atm)\n",
+ "Pa = 1.0 #Ambient absolute pressure (atm)\n",
+ "\n",
+ "#Calculation:\n",
+ "h1 = C1*DTe**n1*(P/Pa)**0.4 #Boiling water heat transfer coefficient (W/m^2)\n",
+ "Qs1 = h1*DTe #Surface flux (W/m^2)\n",
+ "h2 = C2*DTe**n2*(P/Pa)**0.4 #Second Boiling water heat transfer coefficient (W/m^2)\n",
+ "Qs2 = h2*DTe #Second Surface flux (W/m^2) \n",
+ "\n",
+ "#Result:\n",
+ " \n",
+ "if (Qs1/10**3 > 15.8 and Qs1/10**3 < 236):\n",
+ " print \"The boiling regime is :\",round(Qs1/10**3,1),\" kW/m^2 .\"\n",
+ " print \"The heat transfer coefficient is :\",round(h1), \" W/m^2 .\"\n",
+ "elif (Qs1/10**3 < 15.8):\n",
+ " print \"The boiling regime is :\",round(Qs2/10**3,2),\" kW/m^2 .\"\n",
+ " print \"The heat transfer coefficient is :\",round(h2), \" W/m^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The boiling regime is : 11.34 kW/m^2 .\nThe heat transfer coefficient is : 1890.0 W/m^2 .\n"
+ "text": [
+ "The boiling regime is : 11.34 kW/m^2 .\n",
+ "The heat transfer coefficient is : 1890.0 W/m^2 .\n"
+ ]
}
],
"prompt_number": 12
@@ -206,19 +439,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 12.13, Page number: 224"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 12.13, Page number: 224"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to the previous example. Calculate the rate of heat transfer.\n'''\n\nfrom math import pi\n\n#Variable declaration:\n#From example 12.12:\nQs1 = 11340.0 #Surface flux (W/m^2)\nD = 0.3 #Diameter of electric heater (m)\n\n#Calculation:\nA = pi*(D/2.0)**2 #Surface area of heater (m^2)\nQs = Qs1*A #Heat transfer rate (W)\n\n#Result:\nprint \"The rate of heat transfer is :\",round(Qs),\" W .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 12.12:\n",
+ "Qs1 = 11340.0 #Surface flux (W/m^2)\n",
+ "D = 0.3 #Diameter of electric heater (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = pi*(D/2.0)**2 #Surface area of heater (m^2)\n",
+ "Qs = Qs1*A #Heat transfer rate (W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The rate of heat transfer is :\",round(Qs),\" W .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of heat transfer is : 802.0 W .\n"
+ "text": [
+ "The rate of heat transfer is : 802.0 W .\n"
+ ]
}
],
"prompt_number": 13
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_13.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_13.ipynb
index 3f81a28b..b4812ba2 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_13.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 13"
+ "name": "",
+ "signature": "sha256:c1f753b566ef5be1a578722a730958eae554497c733345943c47490976e91069"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,50 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 13: Refrigeration and Cryogenics"
+ "source": [
+ "Chapter 13: Refrigeration and Cryogenics"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.1, Page number: 237"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.1, Page number: 237"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The vertical flat walls of the combustion chamber of a furnace consist of 7.5 in of refractory,\nkR = 0.75; 3 in of insulation, kI = 0.08; and 0.25 in of steel, kS = 26.0. The units of k are\nBtu/h.ft.\u00b0F. The average surface temperature of the inner face of the refractory and the outer\nface of the steel are 2000\u00b0F and 220\u00b0F, respectively.\nCalculate the heat loss expressed as Btu/h.ft^2.\n'''\n\n#Variable declaration:\nLR = 7.5/12.0 #Thickness of refractory (ft)\nLI = 3.0/12.0 #Thickness of insulation (ft)\nLS = 0.25/12.0 #Thickness of steel (ft)\nkR = 0.75 #Thermal conductivity of refractory\nkI = 0.08 #Thermal conductivity of insulation\nkS = 26.0 #Thermal conductivity of steel\nTR = 2000.0 #Average surface temperature of the inner face of the refractory (\u00b0F)\nTS = 220.0 #Average surface temperature of the outer face of the steel (\u00b0F)\n\n#Calculation:\nDT = TR-TS #Temperature difference (\u00b0F)\nQ = DT/(LR/kR+LI/kI+LS/kS) #Heat loss (Btu/h.ft^2)(here representing Qdot/A)\n\n#Result:\nprint \"The heat loss is :\",round(Q),\" Btu/h.ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "LR = 7.5/12.0 #Thickness of refractory (ft)\n",
+ "LI = 3.0/12.0 #Thickness of insulation (ft)\n",
+ "LS = 0.25/12.0 #Thickness of steel (ft)\n",
+ "kR = 0.75 #Thermal conductivity of refractory\n",
+ "kI = 0.08 #Thermal conductivity of insulation\n",
+ "kS = 26.0 #Thermal conductivity of steel\n",
+ "TR = 2000.0 #Average surface temperature of the inner face of the refractory (\u00b0F)\n",
+ "TS = 220.0 #Average surface temperature of the outer face of the steel (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT = TR-TS #Temperature difference (\u00b0F)\n",
+ "Q = DT/(LR/kR+LI/kI+LS/kS) #Heat loss (Btu/h.ft^2)(here representing Qdot/A)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat loss is :\",round(Q),\" Btu/h.ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat loss is : 450.0 Btu/h.ft^2 .\n"
+ "text": [
+ "The heat loss is : 450.0 Btu/h.ft^2 .\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +64,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.2, Page number: 239"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.2, Page number: 239"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''For the combustion chamber of the furnace in the previous example, calculate the temperature of\nthe boundary where the refractory meets the insulation, TI.\n'''\n\n#Variable declaration:\nLR = 7.5/12.0 #Thickness of refractory (ft)\nkR = 0.75 #Thermal conductivity of refractory\nTR = 2000.0 #Average surface temperature of the inner face of the refractory (\u00b0F)\nQ = 450.0 #Heat loss (Btu/h.ft^2)\n\n#Calculation:\nTI = TR - Q*(LR/kR) #Temperature of the boundary where the refractory meets the insulation (\u00b0F)\n\n#Result:\nprint \"The temperature of the boundary where the refractory meets the insulation is :\",round(TI),\" \u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "LR = 7.5/12.0 #Thickness of refractory (ft)\n",
+ "kR = 0.75 #Thermal conductivity of refractory\n",
+ "TR = 2000.0 #Average surface temperature of the inner face of the refractory (\u00b0F)\n",
+ "Q = 450.0 #Heat loss (Btu/h.ft^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "TI = TR - Q*(LR/kR) #Temperature of the boundary where the refractory meets the insulation (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The temperature of the boundary where the refractory meets the insulation is :\",round(TI),\" \u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The temperature of the boundary where the refractory meets the insulation is : 1625.0 \u00b0F .\n"
+ "text": [
+ "The temperature of the boundary where the refractory meets the insulation is : 1625.0 \u00b0F .\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +103,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.3, Page number: 239"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.3, Page number: 239"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using the scenario described in Illustrative Examples 13.1 and 13.2, calculate the area available\nfor heat transfer if the total heat loss is 70,000 Btu/h.\n'''\n\n#Variable declaration:\nQbyA = 70000.0 #Total heat loss (Btu/h)\nQ = 450.0 #Heat loss (Btu/h.ft^2)\n\n#Calculation:\nA = QbyA/Q #Area available for heat transfer (ft^2)\n\n#Result:\nprint \"The area available for heat transfer is :\",round(A,1),\" ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "QbyA = 70000.0 #Total heat loss (Btu/h)\n",
+ "Q = 450.0 #Heat loss (Btu/h.ft^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = QbyA/Q #Area available for heat transfer (ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The area available for heat transfer is :\",round(A,1),\" ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The area available for heat transfer is : 155.6 ft^2 .\n"
+ "text": [
+ "The area available for heat transfer is : 155.6 ft^2 .\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +140,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.9, Page number: 245"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.9, Page number: 245"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A refrigerator\u2019s evaporator is at 0.2 MPa and has a working fluid that enters the unit as liquid\nwith an enthalpy, hin, of 230 kJ/kg. If the refrigerator\u2019s working fluid (see Table 13.3) exits\nthe evaporator as dry and saturated vapor, calculate the heat absorbed by the evaporator, QC.\nTable 13.3 Fluid Data for Illustrative Example 13.9\nP, MPa Tsat, \u00b0C hf, kJ/kg hg, kJ/kg, h at 20\u00b0C superheated, kJ/kg\n0.2 210 190 390 410\n0.6 20 230 410 430\n'''\n\n#Variable declaration:\nh_out = 390.0 #Enthalpy of the fluid that exits from the evaporator (kJ/kg)\nh_in = 230.0 #Enthalpy of the fluid that enters the unit (kJ/kg)\n\n#Calculation:\nQC = h_out - h_in #Heat absorbed by the evaporator (kJ/kg)\n\n#Result:\nprint \"The heat absorbed by the evaporator is :\",round(QC),\" kJ/kg .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "h_out = 390.0 #Enthalpy of the fluid that exits from the evaporator (kJ/kg)\n",
+ "h_in = 230.0 #Enthalpy of the fluid that enters the unit (kJ/kg)\n",
+ "\n",
+ "#Calculation:\n",
+ "QC = h_out - h_in #Heat absorbed by the evaporator (kJ/kg)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat absorbed by the evaporator is :\",round(QC),\" kJ/kg .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat absorbed by the evaporator is : 160.0 kJ/kg .\n"
+ "text": [
+ "The heat absorbed by the evaporator is : 160.0 kJ/kg .\n"
+ ]
}
],
"prompt_number": 10
@@ -101,19 +177,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.10, Page number: 246"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.10, Page number: 246"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''As a follow-up to Illustrative Example 13.9, what is the fluid\u2019s change in entropy across the\nevaporator?\n'''\n\n#Variable declaration:\n#From example 13.9:\nTS = -10.0+273.0 #Fluid\u2019s saturation temperature expressed in Kelvin (K)\nQC = 160.0 #Heat absorbed by the evaporator (kJ/kg)\n\n#Calcuation:\nDS = QC/TS #Fluid\u2019s change in entropy(kJ/kg.K)\n\n#Result:\nprint \"The fluid's change in entropy across the evaporator is :\",round(DS,2),\" kJ/kg.K .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 13.9:\n",
+ "TS = -10.0+273.0 #Fluid\u2019s saturation temperature expressed in Kelvin (K)\n",
+ "QC = 160.0 #Heat absorbed by the evaporator (kJ/kg)\n",
+ "\n",
+ "#Calcuation:\n",
+ "DS = QC/TS #Fluid\u2019s change in entropy(kJ/kg.K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The fluid's change in entropy across the evaporator is :\",round(DS,2),\" kJ/kg.K .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The fluid's change in entropy across the evaporator is : 0.61 kJ/kg.K .\n"
+ "text": [
+ "The fluid's change in entropy across the evaporator is : 0.61 kJ/kg.K .\n"
+ ]
}
],
"prompt_number": 11
@@ -122,19 +215,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.11, Page number: 247"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.11, Page number: 247"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The working fluid in a refrigerator enters a compressor at dry-saturated conditions at a pressure\nof 0.2 MPa and exits the compressor 20\u00b0C superheated at a pressure of 0.6 MPa. Given the fluid\ndata from Illustrative Example 13.9, and given that the fluid leaves the condenser wet-saturated,\nwhat is the heat absorbed by the evaporator of the refrigerator?\n'''\n\n#Variable declaration:\n#From figure 13.2:\nh1 = 390.0 #Fluid enthalpy on entering the compressor (kJ/kg)\nh2 = 430.0 #Fluid enthalpy on leaving the compressor (kJ/kg)\nh3 = 230.0 #Fluid enthalpy on leaving the condenser (kJ/kg)\n\n#Calculation:\nQH = h2 - h3 #Heat rejected from the condenser (kJ/kg)\nW_in = h2 - h1 #Change in enthalpy across the compressor (kJ/kg)\nQC = QH - W_in #Heat absorbed by the evaporator (kJ/kg)\n\n#Result:\nprint \"The heat absorbed by the evaporator of the refrigerator is :\",round(QC),\" kJ/kg .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From figure 13.2:\n",
+ "h1 = 390.0 #Fluid enthalpy on entering the compressor (kJ/kg)\n",
+ "h2 = 430.0 #Fluid enthalpy on leaving the compressor (kJ/kg)\n",
+ "h3 = 230.0 #Fluid enthalpy on leaving the condenser (kJ/kg)\n",
+ "\n",
+ "#Calculation:\n",
+ "QH = h2 - h3 #Heat rejected from the condenser (kJ/kg)\n",
+ "W_in = h2 - h1 #Change in enthalpy across the compressor (kJ/kg)\n",
+ "QC = QH - W_in #Heat absorbed by the evaporator (kJ/kg)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat absorbed by the evaporator of the refrigerator is :\",round(QC),\" kJ/kg .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat absorbed by the evaporator of the refrigerator is : 160.0 kJ/kg .\n"
+ "text": [
+ "The heat absorbed by the evaporator of the refrigerator is : 160.0 kJ/kg .\n"
+ ]
}
],
"prompt_number": 12
@@ -143,19 +256,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.12, Page number: 248"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.12, Page number: 248"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''From Illustrative Example 13.11, what is the refrigerator\u2019s C.O.P.?\n'''\n\n#Variable declaration:\n#From example 13.11:\nW_in = 40.0 #Change in enthalpy across the compressor (kJ/kg)\nQC = 160.0 #Heat absorbed by the evaporator (kJ/kg)\n\n#Calculation:\nCOP = QC/W_in #Refrigerator\u2019s C.O.P.\n\n#Result:\nprint \"the refrigerator's C.O.P. is :\",round(COP),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 13.11:\n",
+ "W_in = 40.0 #Change in enthalpy across the compressor (kJ/kg)\n",
+ "QC = 160.0 #Heat absorbed by the evaporator (kJ/kg)\n",
+ "\n",
+ "#Calculation:\n",
+ "COP = QC/W_in #Refrigerator\u2019s C.O.P.\n",
+ "\n",
+ "#Result:\n",
+ "print \"the refrigerator's C.O.P. is :\",round(COP),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "the refrigerator's C.O.P. is : 4.0 .\n"
+ "text": [
+ "the refrigerator's C.O.P. is : 4.0 .\n"
+ ]
}
],
"prompt_number": 13
@@ -164,19 +294,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.13, Page number: 250"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.13, Page number: 250"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A Rankine cycle has a T-S diagram as shown in Figure 13.4, and rejects 2043 kJ/kg of heat\nduring the constant pressure process between points 3 and 4. The data provided in Table 13.4\nis also associated with this cycle. Calculate the enthalpy change across the boiler.\nProperties associated with the condenser are as follows:\nP = 0.1235 bar\nhf = 209 kJ/kg\nhg = 2592 kJ/kg\nsf = 0.7038 kJ/kg . K\nsg = 8.0763 kJ/kg . K\n\nTable 13.4 T-S Data for Illustrative Example 13.13\nPoint x h, kJ/kg s, kJ/kg.K\n1 548\n2 3989 7.5190\n3 0.9575 2491 7.7630\n4 1.4410\n'''\n\n#Variable declaration:\nh1 = 548.0 #Steam enthalpy at the entry and exit to the boiler (kJ/kg)\nh2 = 3989.0 #Steam enthalpy at the entry and exit to the turbine (kJ/kg)\nh3 = 2491.0 #Steam enthalpy at the entry and exit to the pump (kJ/kg)\nQH = 2043.0 #Heat rejected by the condenser (kJ/kg)\n\n#Calculation:\nh4 = h3 - QH #Steam enthalpy at the entry and exit to the condenser (kJ/kg)\nQb = h2 - h1 #Enthalpy change across the boiler (kJ/kg)\n\n#Result:\nprint \"The enthalpy change across the boiler is :\",round(Qb),\" kJ/kg .\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "h1 = 548.0 #Steam enthalpy at the entry and exit to the boiler (kJ/kg)\n",
+ "h2 = 3989.0 #Steam enthalpy at the entry and exit to the turbine (kJ/kg)\n",
+ "h3 = 2491.0 #Steam enthalpy at the entry and exit to the pump (kJ/kg)\n",
+ "QH = 2043.0 #Heat rejected by the condenser (kJ/kg)\n",
+ "\n",
+ "#Calculation:\n",
+ "h4 = h3 - QH #Steam enthalpy at the entry and exit to the condenser (kJ/kg)\n",
+ "Qb = h2 - h1 #Enthalpy change across the boiler (kJ/kg)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The enthalpy change across the boiler is :\",round(Qb),\" kJ/kg .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The enthalpy change across the boiler is : 3441.0 kJ/kg .\n"
+ "text": [
+ "The enthalpy change across the boiler is : 3441.0 kJ/kg .\n"
+ ]
}
],
"prompt_number": 14
@@ -185,19 +333,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.14, Page number: 251"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.14, Page number: 251"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''What is the thermal efficiency of the cycle in Illustrative Example 13.13?\n'''\n\n#Variable declaration:\n#From example 13.4:\nh1 = 548.0 #Steam enthalpy at the entry and exit to the boiler (kJ/kg)\nh2 = 3989.0 #Steam enthalpy at the entry and exit to the turbine (kJ/kg)\nh3 = 2491.0 #Steam enthalpy at the entry and exit to the pump (kJ/kg)\nh4 = 448.0 #Steam enthalpy at the entry and exit to the condenser (kJ/kg)\nQb = 3441.0 #Enthalpy change across the boiler (kJ/kg)\n\n#Calculation:\nWt = h2 - h3 #Work produced by the turbine (kJ/kg)\nWp = h1 - h4 #Work used by the pump (kJ/kg)\nW_net = Wt - Wp #Net work by subtracting the pump work from the turbine work (kJ/kg)\nn_th = W_net/Qb #Thermal efficiency\n\n#Result:\nprint \"The thermal efficiency is :\",round(n_th*100,1),\" % .\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 13.4:\n",
+ "h1 = 548.0 #Steam enthalpy at the entry and exit to the boiler (kJ/kg)\n",
+ "h2 = 3989.0 #Steam enthalpy at the entry and exit to the turbine (kJ/kg)\n",
+ "h3 = 2491.0 #Steam enthalpy at the entry and exit to the pump (kJ/kg)\n",
+ "h4 = 448.0 #Steam enthalpy at the entry and exit to the condenser (kJ/kg)\n",
+ "Qb = 3441.0 #Enthalpy change across the boiler (kJ/kg)\n",
+ "\n",
+ "#Calculation:\n",
+ "Wt = h2 - h3 #Work produced by the turbine (kJ/kg)\n",
+ "Wp = h1 - h4 #Work used by the pump (kJ/kg)\n",
+ "W_net = Wt - Wp #Net work by subtracting the pump work from the turbine work (kJ/kg)\n",
+ "n_th = W_net/Qb #Thermal efficiency\n",
+ "\n",
+ "#Result:\n",
+ "print \"The thermal efficiency is :\",round(n_th*100,1),\" % .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The thermal efficiency is : 40.6 % .\n"
+ "text": [
+ "The thermal efficiency is : 40.6 % .\n"
+ ]
}
],
"prompt_number": 15
@@ -206,19 +376,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 13.15, Page number: 252"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 13.15, Page number: 252"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using the Rankine cycle T-s diagram, in Figure 13.4, and the data from Illustrative Example\n13.13, calculate the temperature at point 3.\n'''\n\n#Variable declaration:\n#From table 13.4:\nx3 = 0.9575 #Mass fraction vapour at point 3\nh3 = 2491.0 #Steam enthalpy at the entry and exit to the pump (kJ/kg)\ns3 = 7.7630 #Entropy at the entry and exit to the pump (kJ/kg.K)\ns4 = 1.4410 #Entropy at the entry and exit to the condenser (kJ/kg.K)\n#From example13.14:\nh4 = 448.0 #Steam enthalpy at the entry and exit to the condenser (kJ/kg)\n\n#Calculation:\nQ_out = h3 - h4 #Heat rejected (kJ/kg)\nDS = s3 - s4 #Process change in entropy (kJ/kg)\nT3 = Q_out/DS #Temperature at point 3 (K)\n\n#Result:\nprint \"The temperature at point 3 is :\",round(T3),\" K .\"\nprint \"Or, the temperature at point 3 is :\",round(T3-273),\" \u00b0C .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From table 13.4:\n",
+ "x3 = 0.9575 #Mass fraction vapour at point 3\n",
+ "h3 = 2491.0 #Steam enthalpy at the entry and exit to the pump (kJ/kg)\n",
+ "s3 = 7.7630 #Entropy at the entry and exit to the pump (kJ/kg.K)\n",
+ "s4 = 1.4410 #Entropy at the entry and exit to the condenser (kJ/kg.K)\n",
+ "#From example13.14:\n",
+ "h4 = 448.0 #Steam enthalpy at the entry and exit to the condenser (kJ/kg)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q_out = h3 - h4 #Heat rejected (kJ/kg)\n",
+ "DS = s3 - s4 #Process change in entropy (kJ/kg)\n",
+ "T3 = Q_out/DS #Temperature at point 3 (K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The temperature at point 3 is :\",round(T3),\" K .\"\n",
+ "print \"Or, the temperature at point 3 is :\",round(T3-273),\" \u00b0C .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The temperature at point 3 is : 323.0 K .\nOr, the temperature at point 3 is : 50.0 \u00b0C .\n"
+ "text": [
+ "The temperature at point 3 is : 323.0 K .\n",
+ "Or, the temperature at point 3 is : 50.0 \u00b0C .\n"
+ ]
}
],
"prompt_number": 16
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_14.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_14.ipynb
index 8d13ffd1..7bc0f737 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_14.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 14"
+ "name": "",
+ "signature": "sha256:e3c042bf60cf5ea8673efb2741d5df5f7935daa012691b520a2d1357e838bd6c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,53 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 14: Introduction to Heat Exchangers"
+ "source": [
+ "Chapter 14: Introduction to Heat Exchangers"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.1, Page number: 259"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.1, Page number: 259"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''If 20,000 scfm (32\u00b0F, 1 atm) of an air stream is heated from 200\u00b0F to 2000\u00b0F, calculate the heat\ntransfer rate required to bring about this change in temperature. Use the following enthalpy and\naverage heat capacity data:\nH_200\u00b0F = 1170 Btu/lbmol\nH_2000\u00b0F = 14,970 Btu/lbmol\nCp,av = 7.53 Btu/lbmol.\u00b0F (over the 200-2000\u00b0F range)\n'''\n\n#Variable declaration:\nscfm = 20000.0 #Volumetric flow rate of air at standard conditions (scfm)\nH1 = 1170.0 #Enthalpy at 200\u00b0F (Btu/lbmol)\nH2 = 14970.0 #Enthalpy at 2000\u00b0F (Btu/lbmol)\nCp = 7.53 #Average heat capacity (Btu/lbmol.\u00b0F)\nT1 = 200.0 #Initial temperature (\u00b0F)\nT2 = 2000.0 #Final temperature (\u00b0F)\n\n#Calculation:\nn = scfm/359.0 #Flow rate of air in a molar flow rate (lbmol/min)\nDH = H2 - H1 #Change in enthalpy (Btu/lbmol)\nDT = T2 - T1 #Change in temperature (\u00b0F)\nQ1 = n*DH #Heat transfer rate using enthalpy data (Btu/min)\nQ2 = n*Cp*DT #Heat transfer rate using the average heat capacity data (Btu/min)\n\n#Result:\nprint \"The heat transfer rate using enthalpy data is :\",round(Q1/10**5,2),\" x 10^5 Btu/min.\"\nprint \"The heat transfer rate using the average heat capacity data is :\",round(Q2/10**5,2),\" x 10^5 Btu/min.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "scfm = 20000.0 #Volumetric flow rate of air at standard conditions (scfm)\n",
+ "H1 = 1170.0 #Enthalpy at 200\u00b0F (Btu/lbmol)\n",
+ "H2 = 14970.0 #Enthalpy at 2000\u00b0F (Btu/lbmol)\n",
+ "Cp = 7.53 #Average heat capacity (Btu/lbmol.\u00b0F)\n",
+ "T1 = 200.0 #Initial temperature (\u00b0F)\n",
+ "T2 = 2000.0 #Final temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "n = scfm/359.0 #Flow rate of air in a molar flow rate (lbmol/min)\n",
+ "DH = H2 - H1 #Change in enthalpy (Btu/lbmol)\n",
+ "DT = T2 - T1 #Change in temperature (\u00b0F)\n",
+ "Q1 = n*DH #Heat transfer rate using enthalpy data (Btu/min)\n",
+ "Q2 = n*Cp*DT #Heat transfer rate using the average heat capacity data (Btu/min)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate using enthalpy data is :\",round(Q1/10**5,2),\" x 10^5 Btu/min.\"\n",
+ "print \"The heat transfer rate using the average heat capacity data is :\",round(Q2/10**5,2),\" x 10^5 Btu/min.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate using enthalpy data is : 7.69 x 10^5 Btu/min.\nThe heat transfer rate using the average heat capacity data is : 7.55 x 10^5 Btu/min.\n"
+ "text": [
+ "The heat transfer rate using enthalpy data is : 7.69 x 10^5 Btu/min.\n",
+ "The heat transfer rate using the average heat capacity data is : 7.55 x 10^5 Btu/min.\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +67,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.2, Page number: 259"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.2, Page number: 259"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Given the mass flow rate of a gas stream and its heat capacity, determine the required heat rate to\nchange the gas stream from one temperature to another. Data are provided below:\nn = 1200 lbmol/min\nCP,av = 0.26 Btu/lbmol.\u00b0F (over the 200-2000\u00b0F range)\nT1 = 200\u00b0F\nT2 = 1200\u00b0F\n'''\n\n#Variable declaration:\nn = 1200.0 #Flow rate of air in a molar flow rate (lbmol/min)\nCp = 0.26 #Average heat capacity (Btu/lbmol.\u00b0F)\nT1 = 200.0 #Initial temperature (\u00b0F)\nT2 = 1200.0 #Final temperature (\u00b0F)\n\n#Calculation:\nDT = T2 - T1 #Change in temperature (\u00b0F)\nQ = n*Cp*DT #Required heat rate (Btu/min)\n\n#Result:\nprint \"The required heat rate is :\",round(Q/10**5,2),\" x 10^5 Btu/min .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "n = 1200.0 #Flow rate of air in a molar flow rate (lbmol/min)\n",
+ "Cp = 0.26 #Average heat capacity (Btu/lbmol.\u00b0F)\n",
+ "T1 = 200.0 #Initial temperature (\u00b0F)\n",
+ "T2 = 1200.0 #Final temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT = T2 - T1 #Change in temperature (\u00b0F)\n",
+ "Q = n*Cp*DT #Required heat rate (Btu/min)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The required heat rate is :\",round(Q/10**5,2),\" x 10^5 Btu/min .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required heat rate is : 3.12 x 10^5 Btu/min .\n"
+ "text": [
+ "The required heat rate is : 3.12 x 10^5 Btu/min .\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +107,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.3, Page number: 260"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.3, Page number: 260"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Obtain the heat transfer rate in an exchanger if equal similar liquid flow rates are used. The hot\nfluid is cooled from 84\u00b0C to 72\u00b0C while the cold fluid is initially at 25\u00b0C.\n'''\n\n#Variable declaration:\nTc1 = 25.0 #Initial temperature of cold fluid (\u00b0C)\nTh1 = 72.0 #Initial temperature of hot fluid (\u00b0C)\nTh2 = 84.0 #Final temperature of hot fluid (\u00b0C)\n\n#Calculation:\n#From equation 14.2:\nTc2 = (Th2-Th1)+Tc1 #Final temperature of cold fluid (\u00b0C)\n\n#Result:\nprint \"The final temperature of the cold liquid is :\",Tc2,\" \u00b0C .\"\nprint \"There is a printing mistake in unit of final temperature in book.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Tc1 = 25.0 #Initial temperature of cold fluid (\u00b0C)\n",
+ "Th1 = 72.0 #Initial temperature of hot fluid (\u00b0C)\n",
+ "Th2 = 84.0 #Final temperature of hot fluid (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "#From equation 14.2:\n",
+ "Tc2 = (Th2-Th1)+Tc1 #Final temperature of cold fluid (\u00b0C)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The final temperature of the cold liquid is :\",Tc2,\" \u00b0C .\"\n",
+ "print \"There is a printing mistake in unit of final temperature in book.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The final temperature of the cold liquid is : 37.0 \u00b0C .\nThere is a printing mistake in unit of final temperature in book.\n"
+ "text": [
+ "The final temperature of the cold liquid is : 37.0 \u00b0C .\n",
+ "There is a printing mistake in unit of final temperature in book.\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +148,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.4, Page number: 265"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.4, Page number: 265"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Steam at 1 atm outside a pipe is heating a fluid inside a pipe whose temperature may be assumed\nuniform at 25\u00b0C. Calculate the LMTD.\n'''\n\n#Variable declaration:\nTs = 100.0 #Steam temperature at 1 atm (\u00b0C)\nTl = 25.0 #Fluid temperature (\u00b0C)\n\n#Calculation:\nDTlm = Ts - Tl #Log mean temperature difference (\u00b0C)\n\n#Result:\nprint \"The LMTD is :\",DTlm,\" \u00b0C .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ts = 100.0 #Steam temperature at 1 atm (\u00b0C)\n",
+ "Tl = 25.0 #Fluid temperature (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "DTlm = Ts - Tl #Log mean temperature difference (\u00b0C)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The LMTD is :\",DTlm,\" \u00b0C .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The LMTD is : 75.0 \u00b0C .\n"
+ "text": [
+ "The LMTD is : 75.0 \u00b0C .\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +185,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.5, Page number: 265"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.5, Page number: 265"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Repeat the calculation in the previous example if the fluid is heated from 25\u00b0C and 80\u00b0C\n'''\n\nfrom math import log\n\n#Variable declaration:\nTs = 100.0 #Steam temperature at 1 atm (\u00b0C)\nT1 = 25.0 #Initial fluid temperature (\u00b0C)\nT2 = 80.0 #Final fluid temperature (\u00b0C)\n\n#Calculation:\nDT1 = Ts - T1 #Temperature difference driving force at the fluid entrance (\u00b0C)\nDT2 = Ts - T2 #Temperature driving force at the fluid exit (\u00b0C)\nDTlm = (DT1 - DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0C)\n\n#Result:\nprint \"The LMTD is :\",round(DTlm,1),\" \u00b0C .\"\nprint \"There is a calculation mistake regarding final result in book.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ts = 100.0 #Steam temperature at 1 atm (\u00b0C)\n",
+ "T1 = 25.0 #Initial fluid temperature (\u00b0C)\n",
+ "T2 = 80.0 #Final fluid temperature (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = Ts - T1 #Temperature difference driving force at the fluid entrance (\u00b0C)\n",
+ "DT2 = Ts - T2 #Temperature driving force at the fluid exit (\u00b0C)\n",
+ "DTlm = (DT1 - DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0C)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The LMTD is :\",round(DTlm,1),\" \u00b0C .\"\n",
+ "print \"There is a calculation mistake regarding final result in book.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The LMTD is : 41.6 \u00b0C .\nThere is a calculation mistake regarding final result in book.\n"
+ "text": [
+ "The LMTD is : 41.6 \u00b0C .\n",
+ "There is a calculation mistake regarding final result in book.\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +229,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.6, Page number: 266"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.6, Page number: 266"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A liquid-to-liquid counterflow heat exchanger is used to heat a cold fluid from 120\u00b0F to 310\u00b0F.\nAssuming that the hot fluid enters at 500\u00b0F and leaves at 400\u00b0F, calculate the log mean temperature\ndifference (driving force) for the heat exchanger.\n'''\n\nfrom math import log\n\n#Variable declaration:\nT1 = 500.0 #Temperature of hot fluid entering the heat exchanger (\u00b0F)\nT2 = 400.0 #Temperature of hot fluid exiting the heat exchanger (\u00b0F)\nt1 = 120.0 #Temperature of cold fluid entering the heat exchanger (\u00b0F)\nt2 = 310.0 #Temperature of cold fluid exiting the heat exchanger (\u00b0F)\n\n#Calculation:\nDT1 = T1 - t2 #Temperature difference driving force at the heat exchanger entrance (\u00b0F)\nDT2 = T2 - t1 #Temperature difference driving force at the heat exchanger exit (\u00b0F)\nDTlm = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n\n#Result:\nprint \"The LMTD (driving force) for the heat exchanger is :\",round(DTlm),\" \u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 500.0 #Temperature of hot fluid entering the heat exchanger (\u00b0F)\n",
+ "T2 = 400.0 #Temperature of hot fluid exiting the heat exchanger (\u00b0F)\n",
+ "t1 = 120.0 #Temperature of cold fluid entering the heat exchanger (\u00b0F)\n",
+ "t2 = 310.0 #Temperature of cold fluid exiting the heat exchanger (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = T1 - t2 #Temperature difference driving force at the heat exchanger entrance (\u00b0F)\n",
+ "DT2 = T2 - t1 #Temperature difference driving force at the heat exchanger exit (\u00b0F)\n",
+ "DTlm = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The LMTD (driving force) for the heat exchanger is :\",round(DTlm),\" \u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The LMTD (driving force) for the heat exchanger is : 232.0 \u00b0F .\n"
+ "text": [
+ "The LMTD (driving force) for the heat exchanger is : 232.0 \u00b0F .\n"
+ ]
}
],
"prompt_number": 7
@@ -143,19 +272,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.7, Page number: 267"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.7, Page number: 267"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A heavy hydrocarbon oil with heat capacity, cp = 0.55 Btu/lb . \u00b0F, is being cooled from T1 =\n210\u00b0F to T2 = 170\u00b0F. The oil flows inside a tube at a rate of 8000 lb/h and the tube surface temperature\nis maintained at 60\u00b0F. Calculate the heat transfer rate and the LMTD in \u00b0F.\n'''\n\nfrom math import log\n\n#Variable declaration:\nm = 8000.0 #Rate of oil flow inside the tube (lb/h)\nCp = 0.55 #Heat capacity of oil (Btu/lb.\u00b0F)\nT1 = 210.0 #Initial temperature of oil (\u00b0F)\nT2 = 170.0 #Final temperature of oil (\u00b0F)\nt = 60.0 #Tube surface temperature (\u00b0F)\n\n#Calculation:\nDT = T2 - T1 #Change in temperature (\u00b0F)\nQ = m*Cp*DT #Heat transferred from the heavy oil (Btu/h)\nDT1 = T1 - t #Temperature difference driving force at the pipe entrance (\u00b0F)\nDT2 = T2 - t #Temperature difference driving force at the pipe exit (\u00b0F)\nDTlm = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n\n#Result:\nprint \"The heat transfer rate is :\",round(Q),\" Btu/h .\"\nprint \"The LMTD for the heat exchanger is :\",round(DTlm),\" \u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "m = 8000.0 #Rate of oil flow inside the tube (lb/h)\n",
+ "Cp = 0.55 #Heat capacity of oil (Btu/lb.\u00b0F)\n",
+ "T1 = 210.0 #Initial temperature of oil (\u00b0F)\n",
+ "T2 = 170.0 #Final temperature of oil (\u00b0F)\n",
+ "t = 60.0 #Tube surface temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT = T2 - T1 #Change in temperature (\u00b0F)\n",
+ "Q = m*Cp*DT #Heat transferred from the heavy oil (Btu/h)\n",
+ "DT1 = T1 - t #Temperature difference driving force at the pipe entrance (\u00b0F)\n",
+ "DT2 = T2 - t #Temperature difference driving force at the pipe exit (\u00b0F)\n",
+ "DTlm = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate is :\",round(Q),\" Btu/h .\"\n",
+ "print \"The LMTD for the heat exchanger is :\",round(DTlm),\" \u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate is : -176000.0 Btu/h .\nThe LMTD for the heat exchanger is : 129.0 \u00b0F .\n"
+ "text": [
+ "The heat transfer rate is : -176000.0 Btu/h .\n",
+ "The LMTD for the heat exchanger is : 129.0 \u00b0F .\n"
+ ]
}
],
"prompt_number": 8
@@ -164,19 +320,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.8, Page number: 267"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.8, Page number: 267"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An oil cooler is to operate with an inlet of 138\u00b0F and outlet of 103\u00b0F, and the coolant entering at\n88\u00b0F is to be allowed to rise to 98\u00b0F. What is the LMTD for this unit, if it is considered as\n1. counter-current flow unit, and\n2. a parallel flow unit.\n'''\n\nfrom math import log\n\n#Variable declaration:\nT1 = 138.0 #Temperature of oil entering the cooler (\u00b0F)\nT2 = 103.0 #Temperature of oil leaving the cooler (\u00b0F)\nt1 = 88.0 #Temperature of coolant entering the cooler (\u00b0F)\nt2 = 98.0 #Temperature of coolant leaving the cooler (\u00b0F)\n\n#Calculation:\n#For counter flow unit:\nDT1 = T1 - t2 #Temperature difference driving force at the cooler entrance (\u00b0F)\nDT2 = T2 - t1 #Temperature difference driving force at the cooler exit (\u00b0F)\nDTlm1 = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n#For parallel flow unit:\nDT3 = T1 - t1 #Temperature difference driving force at the cooler entrance (\u00b0F)\nDT4 = T2 - t2 #Temperature difference driving force at the cooler exit (\u00b0F)\nDTlm2 = (DT3 - DT4)/(log(DT3/DT4)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n\n#Result:\nprint \"The LMTD for counter-current flow unit is :\",round(DTlm1,1),\" \u00b0F .\"\nprint \"The LMTD for parallel flow unit is :\",round(DTlm2,1),\" \u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 138.0 #Temperature of oil entering the cooler (\u00b0F)\n",
+ "T2 = 103.0 #Temperature of oil leaving the cooler (\u00b0F)\n",
+ "t1 = 88.0 #Temperature of coolant entering the cooler (\u00b0F)\n",
+ "t2 = 98.0 #Temperature of coolant leaving the cooler (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "#For counter flow unit:\n",
+ "DT1 = T1 - t2 #Temperature difference driving force at the cooler entrance (\u00b0F)\n",
+ "DT2 = T2 - t1 #Temperature difference driving force at the cooler exit (\u00b0F)\n",
+ "DTlm1 = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n",
+ "#For parallel flow unit:\n",
+ "DT3 = T1 - t1 #Temperature difference driving force at the cooler entrance (\u00b0F)\n",
+ "DT4 = T2 - t2 #Temperature difference driving force at the cooler exit (\u00b0F)\n",
+ "DTlm2 = (DT3 - DT4)/(log(DT3/DT4)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The LMTD for counter-current flow unit is :\",round(DTlm1,1),\" \u00b0F .\"\n",
+ "print \"The LMTD for parallel flow unit is :\",round(DTlm2,1),\" \u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The LMTD for counter-current flow unit is : 25.5 \u00b0F .\nThe LMTD for parallel flow unit is : 19.5 \u00b0F .\n"
+ "text": [
+ "The LMTD for counter-current flow unit is : 25.5 \u00b0F .\n",
+ "The LMTD for parallel flow unit is : 19.5 \u00b0F .\n"
+ ]
}
],
"prompt_number": 9
@@ -185,19 +370,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.10, Page number: 272"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.10, Page number: 272"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Arectangular plane window glass panel is mounted on a house. The glass is 0.125 inch thick and\nhas a surface area of 1.0 m2; its thermal conductivity, k2, is 1.4W/m . K. The inside house temperature,\nT1, and the outside air temperature, t4, are 25\u00b0C and 214\u00b0C, respectively. The heat\ntransfer coefficient inside the room, h1, is 11.0 W/m^2 . K and the heat transfer coefficient\nfrom the window to the surrounding cold air, h3, is 9.0 W/m^2 . K. Calculate the overall heat\ntransfer coefficient in W/m^2 . K.\n'''\n\n#Variable declaration:\nA = 1.0 #Surface area of glass (m^2)\nh1 = 11.0 #Heat transfer coefficient inside room (W/m^2.K)\nL2 = 0.125*0.0254 #Thickness of glass (m)\nk2 = 1.4 #Thermal conductivity of glass (W/m.K)\nh3 = 9.0 #Heat transfer coefficient from window to surrounding cold air (W/m^2.K)\n\n#Calculation:\nR1 = 1.0/(h1*A) #Internal convection resistance (K/W)\nR2 = L2/(k2*A) #Conduction resistance through glass panel (K/W)\nR3 = 1.0/(h3*A) #Outside convection resistance (K/W)\nRt = R1+R2+R3 #Total thermal resistance (K/W)\nU = 1.0/(A*Rt) #Overall heat transfer coefficient (W/m^2.K)\n\n#Result:\nprint \"The overall heat transfer coefficient is :\",round(U,1),\" W/m^2.K .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "A = 1.0 #Surface area of glass (m^2)\n",
+ "h1 = 11.0 #Heat transfer coefficient inside room (W/m^2.K)\n",
+ "L2 = 0.125*0.0254 #Thickness of glass (m)\n",
+ "k2 = 1.4 #Thermal conductivity of glass (W/m.K)\n",
+ "h3 = 9.0 #Heat transfer coefficient from window to surrounding cold air (W/m^2.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "R1 = 1.0/(h1*A) #Internal convection resistance (K/W)\n",
+ "R2 = L2/(k2*A) #Conduction resistance through glass panel (K/W)\n",
+ "R3 = 1.0/(h3*A) #Outside convection resistance (K/W)\n",
+ "Rt = R1+R2+R3 #Total thermal resistance (K/W)\n",
+ "U = 1.0/(A*Rt) #Overall heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The overall heat transfer coefficient is :\",round(U,1),\" W/m^2.K .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The overall heat transfer coefficient is : 4.9 W/m^2.K .\n"
+ "text": [
+ "The overall heat transfer coefficient is : 4.9 W/m^2.K .\n"
+ ]
}
],
"prompt_number": 11
@@ -206,19 +414,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.11, Page number: 273"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.11, Page number: 273"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A heat exchanger wall consists of a copper plate 0.049 inch thick. If the two surface film coefficients\nare 208 and 10.8 Btu/h.ft^2.\u00b0F, respectively, calculate the overall heat transfer coefficient\nin Btu/h.ft^2.\u00b0F.\n'''\n\n#Variable declaration:\nDx = 0.049/12.0 #Thickness of copper plate (ft)\nh1 = 208.0 #Film coefficient of surface one (Btu/h.ft^2.\u00b0F)\nh2 = 10.8 #Film coefficient of surface two (Btu/h.ft^2.\u00b0F)\nk = 220.0 #Thermal conductivity for copper (W/m.K)\n\n#Calculation:\nU = 1.0/(1.0/h1+Dx/k+1.0/h2) #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"The overall heat transfer coefficient is :\",round(U,2),\" Btu/h.ft^2.\u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Dx = 0.049/12.0 #Thickness of copper plate (ft)\n",
+ "h1 = 208.0 #Film coefficient of surface one (Btu/h.ft^2.\u00b0F)\n",
+ "h2 = 10.8 #Film coefficient of surface two (Btu/h.ft^2.\u00b0F)\n",
+ "k = 220.0 #Thermal conductivity for copper (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "U = 1.0/(1.0/h1+Dx/k+1.0/h2) #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The overall heat transfer coefficient is :\",round(U,2),\" Btu/h.ft^2.\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The overall heat transfer coefficient is : 10.26 Btu/h.ft^2.\u00b0F .\n"
+ "text": [
+ "The overall heat transfer coefficient is : 10.26 Btu/h.ft^2.\u00b0F .\n"
+ ]
}
],
"prompt_number": 12
@@ -227,19 +453,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.12, Page number: 274"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.12, Page number: 274"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A coolant flows through a steel pipe (inside diameter of 0.05 m, outside diameter of 0.06 m) at a\nvelocity of 0.25 m/s. What is the overall heat transfer coefficient for the system based on the\npipe\u2019s outside surface area if the inside and outside coefficients are 2000 W/m^2 . K and 8.25\nW/m^2 . K, respectively. Assume the \u201cresistance\u201d term for the steel, that is,\nR = Do x ln(Do/Di)/2k\nis 1.33 x 10^-4 m^2.K/W .\n'''\n\n#Variable declaration:\nDo = 0.06 #Outside diameter of pipe (m)\nDi = 0.05 #Inside diameter of pipe (m)\nho = 8.25 #Outside coefficient (W/m^2.K)\nhi = 2000.0 #Inside coefficient (W/m^2.K)\nR = 1.33*10**-4 #Resistance for steel (m^2.K/W)\n\n#Calculation:\nU = 1.0/(Do/(hi*Di)+R+1.0/ho) #Overall heat transfer coefficient (W/m^2.\u00b0K)\n\n#Result:\nprint \"The overall heat transfer coefficient is :\",round(U,2),\" W/m^2.\u00b0K .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Do = 0.06 #Outside diameter of pipe (m)\n",
+ "Di = 0.05 #Inside diameter of pipe (m)\n",
+ "ho = 8.25 #Outside coefficient (W/m^2.K)\n",
+ "hi = 2000.0 #Inside coefficient (W/m^2.K)\n",
+ "R = 1.33*10**-4 #Resistance for steel (m^2.K/W)\n",
+ "\n",
+ "#Calculation:\n",
+ "U = 1.0/(Do/(hi*Di)+R+1.0/ho) #Overall heat transfer coefficient (W/m^2.\u00b0K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The overall heat transfer coefficient is :\",round(U,2),\" W/m^2.\u00b0K .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The overall heat transfer coefficient is : 8.2 W/m^2.\u00b0K .\n"
+ "text": [
+ "The overall heat transfer coefficient is : 8.2 W/m^2.\u00b0K .\n"
+ ]
}
],
"prompt_number": 13
@@ -248,19 +493,55 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.14, Page number: 274"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.14, Page number: 274"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Steam at 247\u00b0F is flowing through a pipe exposed to air but covered with 1.5 inch thick insulation.\nThe following data is provided:\n1. Pipe diameter, inside = 0.825 inch\n2. Pipe diameter, outside = 1.05 inch\n3. Surrounding air temperature = 60\u00b0F\n4. Thermal conductivity, pipe = 26 Btu/h . ft . \u00b0F\n5. Thermal conductivity, insulation = 0.037 Btu/h . ft . \u00b0F\n6. Steam film coefficient = 800 Btu/h . ft^2 . \u00b0F\n7. Air film coefficient = 2.5 Btu/h . ft^2 . \u00b0F\nCalculate the overall heat transfer coefficient based on the inside area of the pipe.\n'''\n\nfrom math import pi,log\n\n#Variable declaration:\nDi = 0.825/12.0 #Pipe inside diameter (ft)\nDo = 1.05/12.0 #Pipe outside diameter (ft)\nDl = 4.05/12.0 #Insulation thickness (ft)\nl = 1.0 #Pipe length (ft)\nkp = 26.0 #Thermal conductivity of pipe (Btu/h.ft.\u00b0F)\nkl = 0.037 #Thermal conductivity of insulation (Btu/h.ft.\u00b0F)\nhi = 800.0 #Steam film coefficient (Btu/h.ft^2.\u00b0F)\nho = 2.5 #Air film coefficient (Btu/h.ft^2.\u00b0F)\n\n#Calculation:\nri = Di/2.0 #Pipe inside radius (ft)\nro = Do/2.0 #Pipe outside radius (ft)\nrl = Dl/2.0 #Insulation radius (ft)\nAi = pi*Di*l #Inside area of pipe (ft^2)\nAo = pi*Do*l #Outside area of pipe (ft^2)\nAl = pi*Dl*l #Insulation area of pipe (ft^2)\nA_Plm = (Ao-Ai)/log(Ao/Ai) #Log mean area for steel pipe (ft^2)\nA_Ilm = (Al-Ao)/log(Al/Ao) #Log mean area for insulation (ft^2)\nRi = 1.0/(hi*Ai) #Air resistance (m^2.K/W)\nRo = 1.0/(ho*Al) #Steam resistance (m^2.K/W)\nRp = (ro-ri)/(kp*A_Plm) #Pipe resistance (m^2.K/W)\nRl = (rl-ro)/(kl*A_Ilm) #Insulation resistance (m^2.K/W)\nU = 1.0/(Ai*(Ri+Rp+Ro+Rl)) #Overall heat coefficient based on the inside area (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"The overall heat transfer coefficient based on the inside area of the pipe is :\",round(U,3),\" Btu/h.ft^2.\u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi,log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Di = 0.825/12.0 #Pipe inside diameter (ft)\n",
+ "Do = 1.05/12.0 #Pipe outside diameter (ft)\n",
+ "Dl = 4.05/12.0 #Insulation thickness (ft)\n",
+ "l = 1.0 #Pipe length (ft)\n",
+ "kp = 26.0 #Thermal conductivity of pipe (Btu/h.ft.\u00b0F)\n",
+ "kl = 0.037 #Thermal conductivity of insulation (Btu/h.ft.\u00b0F)\n",
+ "hi = 800.0 #Steam film coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "ho = 2.5 #Air film coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "ri = Di/2.0 #Pipe inside radius (ft)\n",
+ "ro = Do/2.0 #Pipe outside radius (ft)\n",
+ "rl = Dl/2.0 #Insulation radius (ft)\n",
+ "Ai = pi*Di*l #Inside area of pipe (ft^2)\n",
+ "Ao = pi*Do*l #Outside area of pipe (ft^2)\n",
+ "Al = pi*Dl*l #Insulation area of pipe (ft^2)\n",
+ "A_Plm = (Ao-Ai)/log(Ao/Ai) #Log mean area for steel pipe (ft^2)\n",
+ "A_Ilm = (Al-Ao)/log(Al/Ao) #Log mean area for insulation (ft^2)\n",
+ "Ri = 1.0/(hi*Ai) #Air resistance (m^2.K/W)\n",
+ "Ro = 1.0/(ho*Al) #Steam resistance (m^2.K/W)\n",
+ "Rp = (ro-ri)/(kp*A_Plm) #Pipe resistance (m^2.K/W)\n",
+ "Rl = (rl-ro)/(kl*A_Ilm) #Insulation resistance (m^2.K/W)\n",
+ "U = 1.0/(Ai*(Ri+Rp+Ro+Rl)) #Overall heat coefficient based on the inside area (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The overall heat transfer coefficient based on the inside area of the pipe is :\",round(U,3),\" Btu/h.ft^2.\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The overall heat transfer coefficient based on the inside area of the pipe is : 0.748 Btu/h.ft^2.\u00b0F .\n"
+ "text": [
+ "The overall heat transfer coefficient based on the inside area of the pipe is : 0.748 Btu/h.ft^2.\u00b0F .\n"
+ ]
}
],
"prompt_number": 15
@@ -269,19 +550,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.15, Page number: 275"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.15, Page number: 275"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the rate of heat transfer in the previous example.\n'''\n\nfrom math import pi\n\n#Variable declaration:\n#From example 14.14:\nDi = 0.825/12.0 #Pipe inside diameter (ft)\nL = 1.0 #Pipe length (ft)\nUi = 0.7492 #Overall heat coefficient (Btu/h.ft^2.\u00b0F)\nTs = 247.0 #Steam temperature (\u00b0F)\nta = 60.0 #Air temperature (\u00b0F)\n\n#Calculation:\nAi = pi*Di*L #Inside area of pipe (ft^2)\nQ = Ui*Ai*(Ts-ta) #Heat transfer rate (Btu/h)\n\n#Result:\nprint \"The heat transfer rate is :\",round(Q,1),\" Btu/h .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 14.14:\n",
+ "Di = 0.825/12.0 #Pipe inside diameter (ft)\n",
+ "L = 1.0 #Pipe length (ft)\n",
+ "Ui = 0.7492 #Overall heat coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "Ts = 247.0 #Steam temperature (\u00b0F)\n",
+ "ta = 60.0 #Air temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Ai = pi*Di*L #Inside area of pipe (ft^2)\n",
+ "Q = Ui*Ai*(Ts-ta) #Heat transfer rate (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate is :\",round(Q,1),\" Btu/h .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate is : 30.3 Btu/h .\n"
+ "text": [
+ "The heat transfer rate is : 30.3 Btu/h .\n"
+ ]
}
],
"prompt_number": 16
@@ -290,19 +594,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.16, Page number: 276"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.16, Page number: 276"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following information is provided for a heat exchanger:\nhw(water) = 200 Btu/h.ft^2.\u00b0F\nho(oil) = 50 Btu/h.ft^2.\u00b0F\nhf (fouling) = 1000 Btu/h.ft^2.\u00b0F\nDTlm = 90\u00b0F\nA = 15.0 ft^2\nCalculate the heat transfer rate for the exchanger if the wall resistance can be neglected.\n'''\n\n#Variable declaration:\nhw = 200.0 #Water heat coefficient (Btu/h.ft^2.\u00b0F)\nho = 50.0 #Oil heat coefficient (Btu/h.ft^2.\u00b0F)\nhf = 1000.0 #Fouling heat coefficient (Btu/h.ft^2.\u00b0F)\nDTlm = 90.0 #Log mean temperature difference (\u00b0F)\nA = 15.0 #Area of wall (ft^2)\n\n#Calculation:\nX = 1.0/hw+1.0/ho+1.0/hf #Equation 14.34 for constant A\nU = 1.0/X #Overall heat coeffocient (Btu/h.ft^2.\u00b0F)\nQ = U*A*DTlm #Heat transfer rate (Btu/h)\n\n#Result:\nprint \"The heat transfer rate is :\",round(Q,-1),\" Btu/h .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "hw = 200.0 #Water heat coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "ho = 50.0 #Oil heat coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "hf = 1000.0 #Fouling heat coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "DTlm = 90.0 #Log mean temperature difference (\u00b0F)\n",
+ "A = 15.0 #Area of wall (ft^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "X = 1.0/hw+1.0/ho+1.0/hf #Equation 14.34 for constant A\n",
+ "U = 1.0/X #Overall heat coeffocient (Btu/h.ft^2.\u00b0F)\n",
+ "Q = U*A*DTlm #Heat transfer rate (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate is :\",round(Q,-1),\" Btu/h .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate is : 51920.0 Btu/h .\n"
+ "text": [
+ "The heat transfer rate is : 51920.0 Btu/h .\n"
+ ]
}
],
"prompt_number": 17
@@ -311,19 +636,64 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 14.17, Page number: 277"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 14.17, Page number: 277"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A brine solution at 10\u00b0F in a food processing plant is heated by flowing through a heated pipe.\nThe pipe surface is maintained at 80\u00b0F. The pipe surface area for heat transfer is 2.5 ft^2. The\nbrine solution (with a density of 62.4 lb/ft^3 and a heat capacity of 0.99 Btu/lb.\u00b0F) flows at a\nrate of 20 lb/min. The overall heat transfer coefficient varies linearly with the temperature\napproach, with values of 150 Btu/h.ft^2.\u00b0F at the brine solution entrance (where the brine\ntemperature is 10\u00b0F) and 140 Btu/h.ft^2.\u00b0F at the brine solution exit. Determine the temperature\napproach at the brine inlet side, the exit temperature of the brine solution, and the rate of heat\ntransfer, Q .\n''' \n\nfrom __future__ import division\nfrom sympy import symbols,log,nsolve\n\n\n#Variable declaration:\nT = 80.0 #Pipe surface temperature (\u00b0F)\nt1 = 10.0 #Brine inlet temperature (\u00b0F)\nDT2 = symbols('DT2') #Discharge temperature of the brine solution (\u00b0F)\nm = 20*60 #Flowrate of brine solution (lb/h)\nCp = 0.99 #Heat capacity of brine solution (Btu/lb.\u00b0F)\nU1 = 150 #Overall heat transfer coefficient at brine solution entrance (Btu/h.ft^2.\u00b0F)\nU2 = 140 #Overall heat transfer coefficientat at brine solution exit (Btu/h.ft^2.\u00b0F)\nA = 2.5 #Pipe surface area for heat transfer (ft^2)\n\n#Calculation:\nDT1 = T-t1 #Temperature approach at the pipe entrance (\u00b0F)\nQ = m*Cp*(DT1-DT2) #Energy balance to the brine solution across the full length of the pipe (Btu/h)\nDT1m = (DT1-DT2)/log(DT1/DT2) #Equation for the LMTD\nQQ = A*(U2*DT1-U1*DT2)/log(U2*DT1/U1/DT2) #Equation for the heat transfer rate (Btu/h)\nE = QQ-Q #Energy balance equation\nR = nsolve([E],[DT2],[1.2]) #\nDT = R[0] #Log mean temperature difference\nt2 = T-DT #In discharge temperature of the brine solution (\u00b0F)\nt2c = 5/9*(t2-32) #In discharge temperature of the brine solution in \u00b0C (c/5 = (F-32)/9)\n_Q_ = Q.subs(DT2,DT) #Heat transfer rate (Btu/h)\n\n#Result:\nprint \"The temperature approach at the brine inlet side is :\",round(DT1,1),\" \u00b0F.\"\nprint \"Or, the temperature approach at the brine inlet side is :\",round(DT1/1.8,1),\" \u00b0C.\"\nprint \"The exit temperature of the brine solution is :\",round(t2,1),\" \u00b0F.\"\nprint \"Or, the exit temperature of the brine solution is :\",round((t2-32)/1.8,1),\" \u00b0C.\"\nprint \"The rate of heat transfer is :\",round(_Q_,-1),\" Btu/h.\"\nprint \"Or, the rate of heat transfer is :\",round(_Q_/3.412,-2),\" W.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from sympy import symbols,log,nsolve\n",
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T = 80.0 #Pipe surface temperature (\u00b0F)\n",
+ "t1 = 10.0 #Brine inlet temperature (\u00b0F)\n",
+ "DT2 = symbols('DT2') #Discharge temperature of the brine solution (\u00b0F)\n",
+ "m = 20*60 #Flowrate of brine solution (lb/h)\n",
+ "Cp = 0.99 #Heat capacity of brine solution (Btu/lb.\u00b0F)\n",
+ "U1 = 150 #Overall heat transfer coefficient at brine solution entrance (Btu/h.ft^2.\u00b0F)\n",
+ "U2 = 140 #Overall heat transfer coefficientat at brine solution exit (Btu/h.ft^2.\u00b0F)\n",
+ "A = 2.5 #Pipe surface area for heat transfer (ft^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = T-t1 #Temperature approach at the pipe entrance (\u00b0F)\n",
+ "Q = m*Cp*(DT1-DT2) #Energy balance to the brine solution across the full length of the pipe (Btu/h)\n",
+ "DT1m = (DT1-DT2)/log(DT1/DT2) #Equation for the LMTD\n",
+ "QQ = A*(U2*DT1-U1*DT2)/log(U2*DT1/U1/DT2) #Equation for the heat transfer rate (Btu/h)\n",
+ "E = QQ-Q #Energy balance equation\n",
+ "R = nsolve([E],[DT2],[1.2]) #\n",
+ "DT = R[0] #Log mean temperature difference\n",
+ "t2 = T-DT #In discharge temperature of the brine solution (\u00b0F)\n",
+ "t2c = 5/9*(t2-32) #In discharge temperature of the brine solution in \u00b0C (c/5 = (F-32)/9)\n",
+ "_Q_ = Q.subs(DT2,DT) #Heat transfer rate (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The temperature approach at the brine inlet side is :\",round(DT1,1),\" \u00b0F.\"\n",
+ "print \"Or, the temperature approach at the brine inlet side is :\",round(DT1/1.8,1),\" \u00b0C.\"\n",
+ "print \"The exit temperature of the brine solution is :\",round(t2,1),\" \u00b0F.\"\n",
+ "print \"Or, the exit temperature of the brine solution is :\",round((t2-32)/1.8,1),\" \u00b0C.\"\n",
+ "print \"The rate of heat transfer is :\",round(_Q_,-1),\" Btu/h.\"\n",
+ "print \"Or, the rate of heat transfer is :\",round(_Q_/3.412,-2),\" W.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The temperature approach at the brine inlet side is : 70.0 \u00b0F.\nOr, the temperature approach at the brine inlet side is : 38.9 \u00b0C.\nThe exit temperature of the brine solution is : 28.4 \u00b0F.\nOr, the exit temperature of the brine solution is : -2.0 \u00b0C.\nThe rate of heat transfer is : 21830.0 Btu/h.\nOr, the rate of heat transfer is : 6400.0 W.\n"
+ "text": [
+ "The temperature approach at the brine inlet side is : 70.0 \u00b0F.\n",
+ "Or, the temperature approach at the brine inlet side is : 38.9 \u00b0C.\n",
+ "The exit temperature of the brine solution is : 28.4 \u00b0F.\n",
+ "Or, the exit temperature of the brine solution is : -2.0 \u00b0C.\n",
+ "The rate of heat transfer is : 21830.0 Btu/h.\n",
+ "Or, the rate of heat transfer is : 6400.0 W.\n"
+ ]
}
],
"prompt_number": 18
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_15.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_15.ipynb
index cbfe94ac..8331e128 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_15.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_15.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 15"
+ "name": "",
+ "signature": "sha256:9c90790dace23fbdfc3e0ce273ce32b43acc5cfa1b423fc8f4e186650e91a101"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,44 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 15: Double Pipe Heat Exchangers"
+ "source": [
+ "Chapter 15: Double Pipe Heat Exchangers"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.2, Page number: 290"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.2, Page number: 290"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following data is provided for a double pipe heat exchanger\nQ = 12,000 Btu/h\nU = 48.0 Btu/ft^2.h.\u00b0F\nDTlm = 50\u00b0F\nCalculate the area of the exchanger.\n'''\n\n#Variable declaration:\nQ = 12000.0 #Heat transfer rate (Btu/h)\nU = 48.0 #Overall heat coefficient (Btu/ft^2.h.\u00b0F)\nDTlm = 50.0 #Log mean temperature difference (\u00b0F)\n\n#Calculation:\nA = Q/(U*DTlm) #Area of exchanger (ft^2)\n\n#Result:\nprint \"The area of the exchanger is :\",round(A),\" ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Q = 12000.0 #Heat transfer rate (Btu/h)\n",
+ "U = 48.0 #Overall heat coefficient (Btu/ft^2.h.\u00b0F)\n",
+ "DTlm = 50.0 #Log mean temperature difference (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = Q/(U*DTlm) #Area of exchanger (ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The area of the exchanger is :\",round(A),\" ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The area of the exchanger is : 5.0 ft^2 .\n"
+ "text": [
+ "The area of the exchanger is : 5.0 ft^2 .\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +58,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.3, Page number: 291"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.3, Page number: 291"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the inlet cold water temperature flowing at a rate of 14.6 lb/min in a double pipe heat\nexchanger given the following data. Assume co-current operation.\nt1 = tc,i = 63\u00b0F\nT1 = TH,i = 164\u00b0F\nT2 = TH,o = 99\u00b0F\nU = 35.35 Btu/ft.h.\u00b0F\nQ = 56,760 Btu/h\nA = 32.1 ft^2\n'''\n\nfrom sympy import symbols,solve,log\n\n#Variable declaration:\nQ = 56760 #Heat transfer rate (Btu/h)\nU = 35.35 #Overall heat coefficient (Btu/ft.h.\u00b0F)\nA = 32.1 #Area of exachanger (ft^2)\nt1 = 63.0 #Outlet cold water temperature (\u00b0F)\nT1 = 164 #Outlet hot water temperature (\u00b0F)\nT2 = 99 #Inlet hot water temperature (\u00b0F)\nt2 = symbols('t2') #Inlet cold water temperature (\u00b0F)\n\n#Calculation:\nDTlm = Q/(U*A) #Log mean temperature difference (\u00b0F)\ndT1 = T1-t1 #Temperature approach at pipe outlet (\u00b0F)\ndT2 = T2-t2 #Temperature approach at pipe inlet (\u00b0F)\nEq = (dT2-dT1)/log(dT2/dT1)-DTlm\nR = solve(Eq,t2) #Inlet cold water temperature (\u00b0F)\n\n#Result:\nprint \"The inlet cold water temperature is : \",round(R[0]),\" \u00b0F.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from sympy import symbols,solve,log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Q = 56760 #Heat transfer rate (Btu/h)\n",
+ "U = 35.35 #Overall heat coefficient (Btu/ft.h.\u00b0F)\n",
+ "A = 32.1 #Area of exachanger (ft^2)\n",
+ "t1 = 63.0 #Outlet cold water temperature (\u00b0F)\n",
+ "T1 = 164 #Outlet hot water temperature (\u00b0F)\n",
+ "T2 = 99 #Inlet hot water temperature (\u00b0F)\n",
+ "t2 = symbols('t2') #Inlet cold water temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DTlm = Q/(U*A) #Log mean temperature difference (\u00b0F)\n",
+ "dT1 = T1-t1 #Temperature approach at pipe outlet (\u00b0F)\n",
+ "dT2 = T2-t2 #Temperature approach at pipe inlet (\u00b0F)\n",
+ "Eq = (dT2-dT1)/log(dT2/dT1)-DTlm\n",
+ "R = solve(Eq,t2) #Inlet cold water temperature (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The inlet cold water temperature is : \",round(R[0]),\" \u00b0F.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The inlet cold water temperature is : 79.0 \u00b0F.\n"
+ "text": [
+ "The inlet cold water temperature is : 79.0 \u00b0F.\n"
+ ]
}
],
"prompt_number": 26
@@ -59,19 +106,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.4, Page number: 292"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.4, Page number: 292"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''As Shakespeare once said: \u201cSomething is rotten in the state of . . .\u201d Comment on whether the\ninformation provided in the previous example is \u201cconsistent.\u201d\n'''\n\n#Variable declaration:\nm = 14.6 #Flow rate of water inside the tube (lb/min)\nCp = 1 #Heat capacity of water (Btu/lb.\u00b0F)\nt2 = 79 #Initial temperature of water (\u00b0F)\nt1 = 63 #Final temperature of water (\u00b0F)\n#From example 15.3:\nQ1 = 56760 #Old heat transfer rate (Btu/h)\n\n#Calculation:\nQ2 = m*Cp*(t2-t1) #New heat transfer rate (Btu/min)\n\n#Result:\nprint \"The new heat transfer rate is :\",round(Q2),\" Btu/min.\" \nprint \"Or, the new heat transfer rate is :\",round(Q2*60),\" Btu/h.\"\nif (Q1==Q2) :\n print \"This result agree with the Q\u02d9 provided in the problem statement. Shakespeare is wrong, nothing is rotten there.\"\nelse :\n print \"This result does not agree with the Q\u02d9 provided in the problem statement. Shakespeare is right, something is indeed rotten.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "m = 14.6 #Flow rate of water inside the tube (lb/min)\n",
+ "Cp = 1 #Heat capacity of water (Btu/lb.\u00b0F)\n",
+ "t2 = 79 #Initial temperature of water (\u00b0F)\n",
+ "t1 = 63 #Final temperature of water (\u00b0F)\n",
+ "#From example 15.3:\n",
+ "Q1 = 56760 #Old heat transfer rate (Btu/h)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q2 = m*Cp*(t2-t1) #New heat transfer rate (Btu/min)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The new heat transfer rate is :\",round(Q2),\" Btu/min.\" \n",
+ "print \"Or, the new heat transfer rate is :\",round(Q2*60),\" Btu/h.\"\n",
+ "if (Q1==Q2) :\n",
+ " print \"This result agree with the Q\u02d9 provided in the problem statement. Shakespeare is wrong, nothing is rotten there.\"\n",
+ "else :\n",
+ " print \"This result does not agree with the Q\u02d9 provided in the problem statement. Shakespeare is right, something is indeed rotten.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The new heat transfer rate is : 234.0 Btu/min.\nOr, the new heat transfer rate is : 14016.0 Btu/h.\nThis result does not agree with the Q\u02d9 provided in the problem statement. Shakespeare is right, something is indeed rotten.\n"
+ "text": [
+ "The new heat transfer rate is : 234.0 Btu/min.\n",
+ "Or, the new heat transfer rate is : 14016.0 Btu/h.\n",
+ "This result does not agree with the Q\u02d9 provided in the problem statement. Shakespeare is right, something is indeed rotten.\n"
+ ]
}
],
"prompt_number": 8
@@ -80,19 +154,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.5, Page number: 292"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.5, Page number: 292"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A heavy hydrocarbon oil with a heat capacity, cp = 0.55 Btu/lb.\u00b0F, is being cooled in a double\npipe heat exchanger from T1 = 210\u00b0F to T2 = 170\u00b0F. The oil flows inside a tube at a rate of\n8000 lb/h and the tube surface temperature is maintained at 60\u00b0F. The overall heat transfer\ncoefficient U = 63 Btu.h.ft^2.\u00b0F. Calculate the required heat transfer area, A, in ft^2.\n'''\n\nfrom math import log\n\n#Variable declaration:\nT1 = 210.0 #Initial temperature of oil (\u00b0F)\nT2 = 170.0 #Final temperature of oil (\u00b0F)\nT3 = 60.0 #Surface temperature of oil (\u00b0F)\nm = 8000.0 #Flow rate of oil inside tube (lb/h)\ncp = 0.55 #Heat capacity of oil (Btu/lb.\u00b0F)\nU = 63.0 #Overall heat teansfer coefficient (Btu.h.ft^2.\u00b0F)\n\n#Calculation:\nDT1 = T1-T3 #Temperature difference 1 (\u00b0F)\nDT2 = T2-T3 #Temperature difference 2 (\u00b0F)\nDTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temerature difference (\u00b0F)\nQ = m*cp*(T1-T2) #Heat transferred (Btu/h)\nA = Q/(U*DTlm) #Heat transfer area (ft^2)\n\n#Result:\nprint \"The required heat transfer area is :\",round(A,2),\" ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 210.0 #Initial temperature of oil (\u00b0F)\n",
+ "T2 = 170.0 #Final temperature of oil (\u00b0F)\n",
+ "T3 = 60.0 #Surface temperature of oil (\u00b0F)\n",
+ "m = 8000.0 #Flow rate of oil inside tube (lb/h)\n",
+ "cp = 0.55 #Heat capacity of oil (Btu/lb.\u00b0F)\n",
+ "U = 63.0 #Overall heat teansfer coefficient (Btu.h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = T1-T3 #Temperature difference 1 (\u00b0F)\n",
+ "DT2 = T2-T3 #Temperature difference 2 (\u00b0F)\n",
+ "DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temerature difference (\u00b0F)\n",
+ "Q = m*cp*(T1-T2) #Heat transferred (Btu/h)\n",
+ "A = Q/(U*DTlm) #Heat transfer area (ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The required heat transfer area is :\",round(A,2),\" ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required heat transfer area is : 21.66 ft^2 .\n"
+ "text": [
+ "The required heat transfer area is : 21.66 ft^2 .\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +201,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.6, Page number: 293"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.6, Page number: 293"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Two variations of the design of a heat exchanger have been proposed. The unit is to cool a hot\nwater stream from 140\u00b0F to 110\u00b0F through indirect contact with a cold water stream that is being\nheated from 60\u00b0F to 90\u00b0F. The water flow rate is 100 lb/min and the overall heat transfer coefficient\nmay be assumed equal to 750 Btu/h.ft^2.\u00b0F. Calculate the area requirements for the following\ntwo exchanger conditions:\n1. double pipe co-current flow\n2. double pipe countercurrent flow\n'''\n\nfrom math import log\n\n#Variable declaration:\nT1 = 140.0 #Initial temperature of hot water (\u00b0F)\nT2 = 110.0 #Final temperature of hot water (\u00b0F)\nT3 = 60.0 #Initial temperature of cold water (\u00b0F)\nT4 = 90.0 #Initial temperature of cold water (\u00b0F)\nDTlm2 = 50.0 #Log mean temerature difference for countercurrent flow, a constant (\u00b0F) (part 2)\nm = 100.0*60 #Water flow rate (lb/h)\ncp = 1.0 ##Heat capacity of water (Btu/lb.\u00b0F)\nU = 750.0 #Overall heat teansfer coefficient (Btu.h.ft^2.\u00b0F)\n\n#Calculation:\nDT1 = T1-T3 #Temperature difference 1 (\u00b0F) (part 1)\nDT2 = T2-T4 #Temperature difference 2 (\u00b0F)\nDTlm1 = (DT1-DT2)/log(DT1/DT2) #Log mean temerature difference (\u00b0F)\nQ = m*cp*(T1-T2) #Heat transferred (Btu/h)\nAp = Q/(U*DTlm1) #Heat transfer area for parallel flow (ft^2)\nAc = Q/(U*DTlm2) #Heat transfer area for counter flow (ft^2)\n\n#Result:\nprint \"1. The double pipe co-current flow is :\",round(Ap,2),\" ft^2 .\"\nprint \"1. The double pipe countercurrent flow is :\",round(Ac,2),\" ft^2 .\"",
+ "input": [
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 140.0 #Initial temperature of hot water (\u00b0F)\n",
+ "T2 = 110.0 #Final temperature of hot water (\u00b0F)\n",
+ "T3 = 60.0 #Initial temperature of cold water (\u00b0F)\n",
+ "T4 = 90.0 #Initial temperature of cold water (\u00b0F)\n",
+ "DTlm2 = 50.0 #Log mean temerature difference for countercurrent flow, a constant (\u00b0F) (part 2)\n",
+ "m = 100.0*60 #Water flow rate (lb/h)\n",
+ "cp = 1.0 ##Heat capacity of water (Btu/lb.\u00b0F)\n",
+ "U = 750.0 #Overall heat teansfer coefficient (Btu.h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = T1-T3 #Temperature difference 1 (\u00b0F) (part 1)\n",
+ "DT2 = T2-T4 #Temperature difference 2 (\u00b0F)\n",
+ "DTlm1 = (DT1-DT2)/log(DT1/DT2) #Log mean temerature difference (\u00b0F)\n",
+ "Q = m*cp*(T1-T2) #Heat transferred (Btu/h)\n",
+ "Ap = Q/(U*DTlm1) #Heat transfer area for parallel flow (ft^2)\n",
+ "Ac = Q/(U*DTlm2) #Heat transfer area for counter flow (ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The double pipe co-current flow is :\",round(Ap,2),\" ft^2 .\"\n",
+ "print \"1. The double pipe countercurrent flow is :\",round(Ac,2),\" ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The double pipe co-current flow is : 5.55 ft^2 .\n1. The double pipe countercurrent flow is : 4.8 ft^2 .\n"
+ "text": [
+ "1. The double pipe co-current flow is : 5.55 ft^2 .\n",
+ "1. The double pipe countercurrent flow is : 4.8 ft^2 .\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +252,87 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.8, Page number: 294"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.8, Page number: 294"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The double pipe heat exchanger shown in Figure 15.4 is used for heating 2500 lb/h benzene\n\tfrom 60\u00b0F to 120\u00b0F. Hot water at 200\u00b0F from a boiler is available for heating purposes in\n\tamounts up to 4000 lb/h. Use schedule 40 brass pipe and an integral number of 15 foot long\n\tsections are to be employed in the design of the exchanger.\n\tThe design is to be based on achieving a Reynolds number of 13,000 (turbulent flow) in both\n\tthe inner pipe and annular region. As an additional constrain because of pressure drop consideration,\n\tthe width of the annular region must be at least equal to one fourth the outside diameter of\n\tthe inner pipe.\n\tNote that one can obtainQ\u02d9 by calculating the duty of the benzene stream, and a heat balance\n\twill yield the exit temperature of the water, Tw. However, the area or the overall heat transfer\n\tcoefficient is not known. Obtaining U becomes more complicated since information on flow\n\tvariables or a pipe diameter is not given.\n\tData is provided below for this problem, but can be estimated or obtained from Tables in the\n\tAppendix:\n\tCenzene at 90\u00b0F:\n\tmu = 0.55 cP = 3.70 x 10^-4 lb/ft.s\n\tSG = 0.879 (at 68.8\u00b0F)\n\tr = 0.879(62.4) = 54.8 lb/ft^3\n\tcp = 0.415 Ctu/lb.\u00b0F\n\tk = 0.092 Ctu/h.ft.\u00b0F (at 86\u00b0F)\n\tHater at 200\u00b0F.\n\tmu = 0.305 cP = 2.05 x 10^-4 lb/ft.s\n\tr = 60.13 lb/ft^3\n\tcp = 1.0 Btu/lb.\u00b0F\n\tk = 0.392 Btu/h.ft.\u00b0F\n'''\n\nfrom __future__ import division\nfrom math import pi,log\n\n#Variable declaration:\nuC = 3.7*10**-4 \t #Viscosity of benzene (lb/ft.s)\nuH = 2.05*10**-4 \t #Viscosity of water @200 \u00b0F (lb/ft.s)\nu2 = 2.16*10**-4 \t\t\t\t #Viscosity of water @192 \u00b0F (lb/ft.s)\npC = 54.8 #Density of benzene (lb/ft^3)\npH = 60.13 #Density of water (lb/ft^3)\ncpC = 0.415 #Specific heat capacity of benzene (Btu/lb.\u00b0F)\ncpH = 1 #Specific heat capacity of water (Btu/lb.\u00b0F)\nsgC = 0.879 \nkC = 0.092 #Thermal conductivity of benzene (Btu/h.ft.\u00b0F)\nkH = 0.392 #Thermal conductivity of water @200 \u00b0F (Btu/h.ft.\u00b0F)\nk2 = 0.390\t\t\t\t\t #Thermal conductivity of water @192 \u00b0F (Btu/h.ft.\u00b0F)\nmC = 2500\t \t\t\t #Flow rate of benzene (lb/s)\nmH = 4000 #Flow rate of water (lb/s)\nRe = 13000 #Reynolds number\ndTc = 120-60\t\t\t\t\t #Difference in temperature heating for benzene\nTw = 200\t\t\t\t #Temperatperature of hot water (\u00b0F)\n#For 2-inch schedule 40 pipe\nAi = 0.541 #Inside area of pipe (ft^2/ft)\nAo = 0.622 #Outside area of pipe (ft^2/ft)\nDi = 2.067 #Inside diameter of pipe (inch)\nDo = 2.375 #Outside diameter of pipe (inch)\nSi = 0.0233 #Inside surface area of pipe (ft^2)\ndXw = 0.128 #Width of pipe (ft)\n\n#For 4-inch schedule 40 pipe\nDio = 4.026 #Inside diameter of pipe (inch)\nDoi = Do #Outside diameter of pipe (inch)\nkw = 26 \n\n#Calculations:\ndef St(Re,Pr):\t\t\t\t #Dittus Boelter equation\n\treturn 0.023*Re**-0.2*Pr**-0.667\n#For inside tubes:\nDicalc = 4*mC/(Re*pi*uC)/3600 #Inside diameter (ft)\nmHcalc = Re*pi*uH*(Doi+Dio)/4*3600/12 #Mass flow rate of water (lb/h)\nQ = mC*cpC*dTc\t\t\t\t\t #Heat in water (Btu/h)\ndTH = Q/mH #Temperature difference of water (\u00b0F)\nTHo = Tw - dTH #Outlet temperature of water (\u00b0F)\nTHav = (Tw+THo)/2 #Average temperature of water (\u00b0F) \n#For benzene:\nPrC = cpC*uC/kC*3600 #Prandtl number\nStC = round(St(13000, PrC),5) #Stanton number\nhi = StC*cpC*mC/Si #Heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n#For water:\nReH = 4*mH/3600/(pi*u2*(Doi+Dio)/12) #Reynolds number\nPrH = round(cpH*(u2)/k2*3600 ,2) #Prandtl number\nStH = round(St(ReH, PrH),5) #Stanton number\nSann = round(pi/4*(Dio**2-Doi**2)/144,4) #Surface area of annulus (ft^2)\nho = round(StH*cpH*mH/Sann) #Heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n#For pipe:\nDlm = round((Do-Di)/log(Do/Di)*12,3) #Log mean difference in diameter (ft)\nUo = 1/(Do/Di/hi + dXw*Do/kw/Dlm + 1/ho) #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\ndTlm = (124.4-80)/log(124.4/80) #Log mean temperature difference (\u00b0F)\nL = Q/(Uo*0.622*dTlm) #Length of pipe (ft)\n\n#Result:\nprint 'The required length of pipe: ',round(L,1), 'ft'",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi,log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "uC = 3.7*10**-4 \t #Viscosity of benzene (lb/ft.s)\n",
+ "uH = 2.05*10**-4 \t #Viscosity of water @200 \u00b0F (lb/ft.s)\n",
+ "u2 = 2.16*10**-4 \t\t\t\t #Viscosity of water @192 \u00b0F (lb/ft.s)\n",
+ "pC = 54.8 #Density of benzene (lb/ft^3)\n",
+ "pH = 60.13 #Density of water (lb/ft^3)\n",
+ "cpC = 0.415 #Specific heat capacity of benzene (Btu/lb.\u00b0F)\n",
+ "cpH = 1 #Specific heat capacity of water (Btu/lb.\u00b0F)\n",
+ "sgC = 0.879 \n",
+ "kC = 0.092 #Thermal conductivity of benzene (Btu/h.ft.\u00b0F)\n",
+ "kH = 0.392 #Thermal conductivity of water @200 \u00b0F (Btu/h.ft.\u00b0F)\n",
+ "k2 = 0.390\t\t\t\t\t #Thermal conductivity of water @192 \u00b0F (Btu/h.ft.\u00b0F)\n",
+ "mC = 2500\t \t\t\t #Flow rate of benzene (lb/s)\n",
+ "mH = 4000 #Flow rate of water (lb/s)\n",
+ "Re = 13000 #Reynolds number\n",
+ "dTc = 120-60\t\t\t\t\t #Difference in temperature heating for benzene\n",
+ "Tw = 200\t\t\t\t #Temperatperature of hot water (\u00b0F)\n",
+ "#For 2-inch schedule 40 pipe\n",
+ "Ai = 0.541 #Inside area of pipe (ft^2/ft)\n",
+ "Ao = 0.622 #Outside area of pipe (ft^2/ft)\n",
+ "Di = 2.067 #Inside diameter of pipe (inch)\n",
+ "Do = 2.375 #Outside diameter of pipe (inch)\n",
+ "Si = 0.0233 #Inside surface area of pipe (ft^2)\n",
+ "dXw = 0.128 #Width of pipe (ft)\n",
+ "\n",
+ "#For 4-inch schedule 40 pipe\n",
+ "Dio = 4.026 #Inside diameter of pipe (inch)\n",
+ "Doi = Do #Outside diameter of pipe (inch)\n",
+ "kw = 26 \n",
+ "\n",
+ "#Calculations:\n",
+ "def St(Re,Pr):\t\t\t\t #Dittus Boelter equation\n",
+ "\treturn 0.023*Re**-0.2*Pr**-0.667\n",
+ "#For inside tubes:\n",
+ "Dicalc = 4*mC/(Re*pi*uC)/3600 #Inside diameter (ft)\n",
+ "mHcalc = Re*pi*uH*(Doi+Dio)/4*3600/12 #Mass flow rate of water (lb/h)\n",
+ "Q = mC*cpC*dTc\t\t\t\t\t #Heat in water (Btu/h)\n",
+ "dTH = Q/mH #Temperature difference of water (\u00b0F)\n",
+ "THo = Tw - dTH #Outlet temperature of water (\u00b0F)\n",
+ "THav = (Tw+THo)/2 #Average temperature of water (\u00b0F) \n",
+ "#For benzene:\n",
+ "PrC = cpC*uC/kC*3600 #Prandtl number\n",
+ "StC = round(St(13000, PrC),5) #Stanton number\n",
+ "hi = StC*cpC*mC/Si #Heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "#For water:\n",
+ "ReH = 4*mH/3600/(pi*u2*(Doi+Dio)/12) #Reynolds number\n",
+ "PrH = round(cpH*(u2)/k2*3600 ,2) #Prandtl number\n",
+ "StH = round(St(ReH, PrH),5) #Stanton number\n",
+ "Sann = round(pi/4*(Dio**2-Doi**2)/144,4) #Surface area of annulus (ft^2)\n",
+ "ho = round(StH*cpH*mH/Sann) #Heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "#For pipe:\n",
+ "Dlm = round((Do-Di)/log(Do/Di)*12,3) #Log mean difference in diameter (ft)\n",
+ "Uo = 1/(Do/Di/hi + dXw*Do/kw/Dlm + 1/ho) #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "dTlm = (124.4-80)/log(124.4/80) #Log mean temperature difference (\u00b0F)\n",
+ "L = Q/(Uo*0.622*dTlm) #Length of pipe (ft)\n",
+ "\n",
+ "#Result:\n",
+ "print 'The required length of pipe: ',round(L,1), 'ft'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required length of pipe: 31.4 ft\n"
+ "text": [
+ "The required length of pipe: 31.4 ft\n"
+ ]
}
],
"prompt_number": 8
@@ -143,19 +341,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.10, Page number: 300"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.10, Page number: 300"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate T2 and t2 in (consistent units)\nMC = m_HcpH = 2000\nmc = m_CcpC = 1000\nU = 2000\nA = 10\nT1 = 300\nt1 = 60\nCalculate the exit temperatures if the flow is countercurrent by employing Equation (15.32).(7)\n'''\n\nfrom __future__ import division\nfrom math import e\n\n#Variable declaration:\nMC = 2000.0 \nmc = 1000.0\nU = 2000.0\nA = 10.0\nT1 = 300.0\nt1 = 60.0\n\n#Calculation:\nB = 1.0/mc \nb = 1.0/MC\nx = B/b\ny = U*(B-b)\nT2 = ((x-y)*T1 + x*(e-y)*t1)/(2*e-1)\nt2 = t1+(T1-T2)/x\n\n#Result:\nprint \"T2 = :\",round(T2),\" \u00b0F\"\nprint \"t2 = :\",round(t2),\" \u00b0F\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import e\n",
+ "\n",
+ "#Variable declaration:\n",
+ "MC = 2000.0 \n",
+ "mc = 1000.0\n",
+ "U = 2000.0\n",
+ "A = 10.0\n",
+ "T1 = 300.0\n",
+ "t1 = 60.0\n",
+ "\n",
+ "#Calculation:\n",
+ "B = 1.0/mc \n",
+ "b = 1.0/MC\n",
+ "x = B/b\n",
+ "y = U*(B-b)\n",
+ "T2 = ((x-y)*T1 + x*(e-y)*t1)/(2*e-1)\n",
+ "t2 = t1+(T1-T2)/x\n",
+ "\n",
+ "#Result:\n",
+ "print \"T2 = :\",round(T2),\" \u00b0F\"\n",
+ "print \"t2 = :\",round(t2),\" \u00b0F\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "T2 = : 114.0 \u00b0F\nt2 = : 153.0 \u00b0F\n"
+ "text": [
+ "T2 = : 114.0 \u00b0F\n",
+ "t2 = : 153.0 \u00b0F\n"
+ ]
}
],
"prompt_number": 10
@@ -164,19 +392,62 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.11, Page number: 301"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.11, Page number: 301"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following information is provided for a co-current flow double pipe heat exchanger. The\npipe consists of 200 ft of 2-inch schedule 40 pipe, k = 25 Btu/h.ft.\u00b0F. The hot and cold\nfilm coefficients are 1200 and 1175 Btu/h.ft^2.\u00b0F, respectively, In addition,\nMC = m_HcpH = 30,000 Btu/h.\u00b0F\nmc = m_CcpC = 22,300 Btu/h.\u00b0F\nT1 = 300 \u00b0F\nt1 = 60 \u00b0F\nCalculate T2 and t2.\n'''\n\nfrom sympy import symbols,solve,log\n\n#Variable declaration:\nh1 = 1200.0 #Hot film coefficient (Btu/h.ft^2.\u00b0F)\nh2 = 1175.0 #Cold film coefficient (Btu/h.ft^2.\u00b0F)\nL = 200.0 #Length of pipe (ft)\nMC = 30000.0\nmc = 22300.0\nT1 = 300.0 #Inlet temperature of hot fluid in pipe (\u00b0F)\nt1 = 60.0 #Inlet temperature of cold fluid in pipe (\u00b0F)\nT2 = symbols('T2') #Outlet temperature of hot fluid \u00b0F\nt2 = symbols('t2') #Outlet temperature of cold fluid \u00b0F\n#From table 6.2:\nID = 2.067 #Inside diameter of pipe (in)\nOD = 2.375 #Outside diameter of pipe (in)\nDx = 0.154 #Thickness of pipe (in)\nAi = 0.541 #Inside sectional area of pipe (ft^2/ft)\nk = 25.0 #Thermal conductivity of pipe (Btu/h)\n\n#Calculation:\nUi = 1.0/((1.0/h1) +(Dx/(k*12.0))+(1.0/(h2*(OD/ID)))) #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\nAi1 = Ai*L #Inside area of pipe (ft^3/ft)\nQH = MC*(T1-T2) #Heat transfer rate of hot fluid (Btu/h)\nQC = mc*(t2-t1) #Heat transfer rate of cold fluid (Btu/h)\nt2ht = 195 #t2 by hit and trial\nx = solve(QC-QH,T2)\nT2 = x[0]\nDTlm = (T1-t1-T2+t2)/log((T1-t1)/(T2-t2)) #Log mean temperature difference (\u00b0F)\nQ = Ui*Ai1*DTlm.subs(t2,t2ht) #Total heat transfer rate (Btu/h)\n\n#Result:\nprint \"T2 :\", round(T2.subs(t2,t2ht)),\"(\u00b0F)\"\nprint \"t2 :\", t2.subs(t2,t2ht),\"(\u00b0F)\"\nprint \"Qdot :\", round(Q/10**6) ,\"x 10**6 Btu/h\"",
+ "input": [
+ "\n",
+ "\n",
+ "from sympy import symbols,solve,log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "h1 = 1200.0 #Hot film coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "h2 = 1175.0 #Cold film coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "L = 200.0 #Length of pipe (ft)\n",
+ "MC = 30000.0\n",
+ "mc = 22300.0\n",
+ "T1 = 300.0 #Inlet temperature of hot fluid in pipe (\u00b0F)\n",
+ "t1 = 60.0 #Inlet temperature of cold fluid in pipe (\u00b0F)\n",
+ "T2 = symbols('T2') #Outlet temperature of hot fluid \u00b0F\n",
+ "t2 = symbols('t2') #Outlet temperature of cold fluid \u00b0F\n",
+ "#From table 6.2:\n",
+ "ID = 2.067 #Inside diameter of pipe (in)\n",
+ "OD = 2.375 #Outside diameter of pipe (in)\n",
+ "Dx = 0.154 #Thickness of pipe (in)\n",
+ "Ai = 0.541 #Inside sectional area of pipe (ft^2/ft)\n",
+ "k = 25.0 #Thermal conductivity of pipe (Btu/h)\n",
+ "\n",
+ "#Calculation:\n",
+ "Ui = 1.0/((1.0/h1) +(Dx/(k*12.0))+(1.0/(h2*(OD/ID)))) #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "Ai1 = Ai*L #Inside area of pipe (ft^3/ft)\n",
+ "QH = MC*(T1-T2) #Heat transfer rate of hot fluid (Btu/h)\n",
+ "QC = mc*(t2-t1) #Heat transfer rate of cold fluid (Btu/h)\n",
+ "t2ht = 195 #t2 by hit and trial\n",
+ "x = solve(QC-QH,T2)\n",
+ "T2 = x[0]\n",
+ "DTlm = (T1-t1-T2+t2)/log((T1-t1)/(T2-t2)) #Log mean temperature difference (\u00b0F)\n",
+ "Q = Ui*Ai1*DTlm.subs(t2,t2ht) #Total heat transfer rate (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"T2 :\", round(T2.subs(t2,t2ht)),\"(\u00b0F)\"\n",
+ "print \"t2 :\", t2.subs(t2,t2ht),\"(\u00b0F)\"\n",
+ "print \"Qdot :\", round(Q/10**6) ,\"x 10**6 Btu/h\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "T2 : 200.0 (\u00b0F)\nt2 : 195 (\u00b0F)\nQdot : 3.0 x 10**6 Btu/h\n"
+ "text": [
+ "T2 : 200.0 (\u00b0F)\n",
+ "t2 : 195 (\u00b0F)\n",
+ "Qdot : 3.0 x 10**6 Btu/h\n"
+ ]
}
],
"prompt_number": 23
@@ -185,19 +456,51 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.12, Page number: 302"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.12, Page number: 302"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Solve the previous example employing the equations above provided by Famularo.(7) Also calculate\nthe discharge temperature, the LMTD, and Q\u02d9 for the countercurrent case.\n'''\n\nfrom __future__ import division\nfrom math import log,e\n\n#Variable declaration:\nB = 3.33*10**-5\nb = 4.48*10**-5\n#From example 15.11:\nA = 108.2 #Inside area of pipe (ft^3/ft)\nU = 482 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\nMC = 30000.0\nmc = 23000.0\nT1 = 300.0 #Inlet temperature of hot fluid in pipe (\u00b0F)\nt1 = 60.0 #Inlet temperature of cold fluid in pipe (\u00b0F)\n\n#Calculation:\n#From equation 15.28:\nT2 = ((B/b)*(e**(U*A*(B-b))-1)*t1+T1*(B/b-1))/((B/b)*e**(U*A*(B-b))-1) #Outlet temperature of hot fluid (\u00b0F)\n#From equation 15.32:\nt2 = ((b/B)*(e**(U*A*(b-B))-1)*T1+t1*(b/B-1))/((b/B)*e**(U*A*(b-B))-1) #Outlet temperature of cold fluid (\u00b0F)\nDT = ((T2-t1)-(T1-t2))/(log((T2-t1)/(T1-t2))) #Log mean difference temperature (\u00b0F)\nQ1 = U*A*DT #Heat transfer rate of hot fluid (Btu/h)\nQ2 = MC*(T1-T2) #Heat transfer rate of cold fluid (Btu/h)\n\n#Result:\nprint \"The heat load is :\",round(Q2,-3),\" Btu/h.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import log,e\n",
+ "\n",
+ "#Variable declaration:\n",
+ "B = 3.33*10**-5\n",
+ "b = 4.48*10**-5\n",
+ "#From example 15.11:\n",
+ "A = 108.2 #Inside area of pipe (ft^3/ft)\n",
+ "U = 482 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "MC = 30000.0\n",
+ "mc = 23000.0\n",
+ "T1 = 300.0 #Inlet temperature of hot fluid in pipe (\u00b0F)\n",
+ "t1 = 60.0 #Inlet temperature of cold fluid in pipe (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "#From equation 15.28:\n",
+ "T2 = ((B/b)*(e**(U*A*(B-b))-1)*t1+T1*(B/b-1))/((B/b)*e**(U*A*(B-b))-1) #Outlet temperature of hot fluid (\u00b0F)\n",
+ "#From equation 15.32:\n",
+ "t2 = ((b/B)*(e**(U*A*(b-B))-1)*T1+t1*(b/B-1))/((b/B)*e**(U*A*(b-B))-1) #Outlet temperature of cold fluid (\u00b0F)\n",
+ "DT = ((T2-t1)-(T1-t2))/(log((T2-t1)/(T1-t2))) #Log mean difference temperature (\u00b0F)\n",
+ "Q1 = U*A*DT #Heat transfer rate of hot fluid (Btu/h)\n",
+ "Q2 = MC*(T1-T2) #Heat transfer rate of cold fluid (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat load is :\",round(Q2,-3),\" Btu/h.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat load is : 4078000.0 Btu/h.\n"
+ "text": [
+ "The heat load is : 4078000.0 Btu/h.\n"
+ ]
}
],
"prompt_number": 27
@@ -206,19 +509,64 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.14, Page number: 305"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.14, Page number: 305"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A double pipe heat exchanger is employed to heat 228 kg/h of water from 25 \u00b0C to 73 \u00b0C.\nWater is on the tube side and the flow is countercurrent. The heating fluid is saturated steam\nat 1 atm, with 55 kg/h of steam condensing on the annular side. No subcooling of condensed\nwater takes place. The inner pipe of the double pipe heat exchanger has an inner radius (ri,i)\nof 1.3 cm and an outer radius (ro,i) of 1.9 cm. The inner radius of the outer tube (ri,o) is 3.2\ncm. Both tubes are 0.5 % carbon steel. The overall heat transfer coefficient for the new heat\nexchanger, Uclean, was originally determined to be 3994 W/m^2.K, based on the inside area of\nthe inner pipe. After a period of use, the fouling factor, Rf, was estimated to be 0.0002 m^2.K/W.\nDetermine:\n1. the temperature profile of the water and steam along the length of the exchanger,\n2. whether the steam has enough energy to heat the water,\n3. the minimum length of the heat exchanger, and\n4. the dirty overall heat transfer coefficient.\nWater properties at the average bulk temperature (25 \u00fe 73)/2 = 49\u00b0C are: heat capacity,\ncp = 4174 J/kg.K; density, r = 993 kg/m^3; absolute viscosity, m = 6.82 x 10^-4 kg/m.s ;\nkinematic viscosity, n = 6.87 x 10^-7 m2/s, and the Prandtl number, Pr = 4.53. The properties\nof water at the \u201caverage\u201d film temperature (100 + 49)/2 = 74.9 \u00b0C are: heat capacity, cp = 4190\nJ/kg.K; density, r = 975 kg/m^3; absolute viscosity, m = 3.8 x 10^-4 kg/m.s; kinematic viscosity,\nn = 3.89 x 10^-7 m^2/s, and the Prandtl number, Pr = 2.53.\nFor saturated steam at 100\u00b0C: latent heat of condensation = 2.26 x 10^6 J/kg, vapor\ndensity = 0.596 kg/m^3. The thermal conductivity for 0.5% carbon steel at an average temperature\nof (100 + 25)/2 = 62.5 \u00b0C is k = 54 W/m.K\nAssumptions include steady-state operation, incompressible fluids, Newtonian fluids,\nconstant properties, homogeneous isotropic materials, and there are negligible heat losses.\nNotations 1 and 2 denote the water inlet and outlet, respectively, and s the stream.\n'''\n\nfrom __future__ import division\nfrom math import log,pi\n\n#Variable declaration:\nTs = 100.0 #Saturation temperature (\u00b0C)\nt1 = 25.0 #Initial temperature of water (\u00b0C)\nt2 = 73.0 #Final temperature of water (\u00b0C)\nm = 228.0/3600.0 #Mass flow rate of water (kg/s)\ncp = 4174.0 #Heat capacity of water (J/kg.K)\nm_s = 55.0/3600.0 #Mass flow rate of steam (kg/s)\nh_vap = 2.26*10**26 #Latent heat of condensation (J/kg)\nk = 54.0 #Thermal conductivity for 0.5% carbon steel (W/m.K)\nrii = 0.013 #Inner radius of inner pipe of the double pipe heat exchanger (m)\nroi = 0.019 #Outer radius of inner pipe of the double pipe heat exchanger (m)\nRf = 0.0002 #Fouling factor (m^2.K/W)\nUc = 0.00045 #Clean overall heat transfer coefficient (W/m^2.K)\n\n#Calculation:\nDT1 = Ts-t1 #Temperature driving force at end 1 (K)\nDT2 = Ts-t2 #Temperature driving force at end 2 (K)\nDTlm = (DT1-DT2)/(log(DT1/DT2)) #Log mean difference temperature (\u00b0C)\nCw =m*cp #Capacitance rate of water (W/K)\nQ = Cw*(t2-t1) #Heat transfer rate (W)\nQmax1 = Cw*(Ts-t1) #Maximum heat term from the water stream (W)\nQmax2 = m_s*h_vap #Maximum heat term from the steam (W)\nE = Q/Qmax1 #Effectiveness\nLmin = (Q*(log(roi/rii)))/(2*pi*k*(Ts-t1)) #Minimum required length of heat exchanger (m)\nUd = 1.0/(1.0/Uc+Rf) #Dirty overall heat transfer coefficient (W/m^2.K)\n\n#Result:\nprint \"1. The temperature profile of the water and steam along the length of the exchanger is :\",round(DTlm),\" \u00b0C .\"\nprint \"2. Effectiveness of energy from steam to heat the water is :\",round(E,3),\" .\"\nprint \"3. The minimum length of the heat exchanger is :\",round(Lmin,3),\" m .\"\nprint \"4. The dirty overall heat transfer coefficient :\",round(Ud,5),\" W/m^2.K .\"\nprint \"5. U_dirty: \", round(1/Ud,-1),\" W/m^2.K\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from math import log,pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ts = 100.0 #Saturation temperature (\u00b0C)\n",
+ "t1 = 25.0 #Initial temperature of water (\u00b0C)\n",
+ "t2 = 73.0 #Final temperature of water (\u00b0C)\n",
+ "m = 228.0/3600.0 #Mass flow rate of water (kg/s)\n",
+ "cp = 4174.0 #Heat capacity of water (J/kg.K)\n",
+ "m_s = 55.0/3600.0 #Mass flow rate of steam (kg/s)\n",
+ "h_vap = 2.26*10**26 #Latent heat of condensation (J/kg)\n",
+ "k = 54.0 #Thermal conductivity for 0.5% carbon steel (W/m.K)\n",
+ "rii = 0.013 #Inner radius of inner pipe of the double pipe heat exchanger (m)\n",
+ "roi = 0.019 #Outer radius of inner pipe of the double pipe heat exchanger (m)\n",
+ "Rf = 0.0002 #Fouling factor (m^2.K/W)\n",
+ "Uc = 0.00045 #Clean overall heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = Ts-t1 #Temperature driving force at end 1 (K)\n",
+ "DT2 = Ts-t2 #Temperature driving force at end 2 (K)\n",
+ "DTlm = (DT1-DT2)/(log(DT1/DT2)) #Log mean difference temperature (\u00b0C)\n",
+ "Cw =m*cp #Capacitance rate of water (W/K)\n",
+ "Q = Cw*(t2-t1) #Heat transfer rate (W)\n",
+ "Qmax1 = Cw*(Ts-t1) #Maximum heat term from the water stream (W)\n",
+ "Qmax2 = m_s*h_vap #Maximum heat term from the steam (W)\n",
+ "E = Q/Qmax1 #Effectiveness\n",
+ "Lmin = (Q*(log(roi/rii)))/(2*pi*k*(Ts-t1)) #Minimum required length of heat exchanger (m)\n",
+ "Ud = 1.0/(1.0/Uc+Rf) #Dirty overall heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The temperature profile of the water and steam along the length of the exchanger is :\",round(DTlm),\" \u00b0C .\"\n",
+ "print \"2. Effectiveness of energy from steam to heat the water is :\",round(E,3),\" .\"\n",
+ "print \"3. The minimum length of the heat exchanger is :\",round(Lmin,3),\" m .\"\n",
+ "print \"4. The dirty overall heat transfer coefficient :\",round(Ud,5),\" W/m^2.K .\"\n",
+ "print \"5. U_dirty: \", round(1/Ud,-1),\" W/m^2.K\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The temperature profile of the water and steam along the length of the exchanger is : 47.0 \u00b0C .\n2. Effectiveness of energy from steam to heat the water is : 0.64 .\n3. The minimum length of the heat exchanger is : 0.189 m .\n4. The dirty overall heat transfer coefficient : 0.00045 W/m^2.K .\n5. U_dirty: 2220.0 W/m^2.K\n"
+ "text": [
+ "1. The temperature profile of the water and steam along the length of the exchanger is : 47.0 \u00b0C .\n",
+ "2. Effectiveness of energy from steam to heat the water is : 0.64 .\n",
+ "3. The minimum length of the heat exchanger is : 0.189 m .\n",
+ "4. The dirty overall heat transfer coefficient : 0.00045 W/m^2.K .\n",
+ "5. U_dirty: 2220.0 W/m^2.K\n"
+ ]
}
],
"prompt_number": 24
@@ -227,19 +575,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.15, Page number: 308"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.15, Page number: 308"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to the previous example. Calculate the area and the length of the heat exchanger.'''\n\nfrom math import pi\n\n#Variable declaration:\nQ = 12700.0 #Heat transfer rate (W)\nUd = 2220.0 #Dirty overall heat transfer coefficient (W/m^2.K)\nDTlm = 47.0 #Log mean difference temperature (\u00b0C)\nrii = 0.013 #Inner radius of inner pipe of the double pipe heat exchanger (m)\n#Calculation:\nA = Q/(Ud*DTlm) #Heat transfer area (m^2)\nL = A/(2*pi*rii) #Tube length (m)\n\n#Result:\nprint \"The heat transfer area is :\",round(A,4),\" m^2 .\"\nprint \"The length of the heat exchanger is :\",round(L,2),\" m .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Q = 12700.0 #Heat transfer rate (W)\n",
+ "Ud = 2220.0 #Dirty overall heat transfer coefficient (W/m^2.K)\n",
+ "DTlm = 47.0 #Log mean difference temperature (\u00b0C)\n",
+ "rii = 0.013 #Inner radius of inner pipe of the double pipe heat exchanger (m)\n",
+ "#Calculation:\n",
+ "A = Q/(Ud*DTlm) #Heat transfer area (m^2)\n",
+ "L = A/(2*pi*rii) #Tube length (m)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer area is :\",round(A,4),\" m^2 .\"\n",
+ "print \"The length of the heat exchanger is :\",round(L,2),\" m .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer area is : 0.1217 m^2 .\nThe length of the heat exchanger is : 1.49 m .\n"
+ "text": [
+ "The heat transfer area is : 0.1217 m^2 .\n",
+ "The length of the heat exchanger is : 1.49 m .\n"
+ ]
}
],
"prompt_number": 15
@@ -248,19 +618,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.16, Page number: 308"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.16, Page number: 308"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''With reference to Illustrative Example 15.14, calculate the number of transfer units (NTU) of the\nexchanger.\n'''\n\n#Variable declaration:\nUd = 2220.0 #Dirty overall heat transfer coefficient (W/m^2.K)\nA = 0.1217 #Heat transfer area (m^2)\nCw = 264.0 #Capacitance rate of water (W/K)\n\n#Calculation:\nNTU = (Ud*A)/Cw #Number of transfer units of the exchanger\n\n#Result:\nprint \"The number of transfer units (NTU) of the exchanger is :\",round(NTU,2),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ud = 2220.0 #Dirty overall heat transfer coefficient (W/m^2.K)\n",
+ "A = 0.1217 #Heat transfer area (m^2)\n",
+ "Cw = 264.0 #Capacitance rate of water (W/K)\n",
+ "\n",
+ "#Calculation:\n",
+ "NTU = (Ud*A)/Cw #Number of transfer units of the exchanger\n",
+ "\n",
+ "#Result:\n",
+ "print \"The number of transfer units (NTU) of the exchanger is :\",round(NTU,2),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The number of transfer units (NTU) of the exchanger is : 1.02 .\n"
+ "text": [
+ "The number of transfer units (NTU) of the exchanger is : 1.02 .\n"
+ ]
}
],
"prompt_number": 16
@@ -269,19 +656,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.18, Page number: 309"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.18, Page number: 309"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''In 1975, Arthur Andrews(10)\u2014achemical engineering senior at Manhattan College\u2014conducted\na double pipe heat exchanger experiment in the Unit Operations Laboratory. Some of the\nTable 15.4 Wilson Method Information: Illustrative Example 15.18\nRun l/Uo Ao, \u00b0F.h/Btu T, \u00b0F Average temperature l/V, h/ft\n1 1.2176 x 10^-3 124.5 2.29 x 10^-4\n2 0.9454 x 10^-3 125 1.65 x 10^-4\n3 0.9366 x 10^-3 129 1.29 x 10^-4\n4 0.8618 x 10^-3 121.5 1.117 x 10^-4\n5 0.7966 x 10^-3 122 0.962 x 10^-4\nco-current flow data and calculations submitted are presented in Table 15.4. Employing\nAndrew\u2019s data and Wilson\u2019s method, estimate ho for the exchanger fluid. For this lab unit\n(see Figure 15.1), Ao = 1.85 ft^2.\n'''\n\n#Variable declaration:\nAo = 1.85 #Area of heat exchanger (ft^2)\n\n#Calculation:\n#From figure 15.6:\ny = 0.560*10**-3 #Intercept 1/UoAo (\u00b0F.h/Btu)\nho = 1.0/(Ao*y) #Thermal conductivity for heat exchanger (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"Thermal conductivity for the heat exchanger is :\",round(ho),\" Btu/h.ft^2.\u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Ao = 1.85 #Area of heat exchanger (ft^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "#From figure 15.6:\n",
+ "y = 0.560*10**-3 #Intercept 1/UoAo (\u00b0F.h/Btu)\n",
+ "ho = 1.0/(Ao*y) #Thermal conductivity for heat exchanger (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"Thermal conductivity for the heat exchanger is :\",round(ho),\" Btu/h.ft^2.\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Thermal conductivity for the heat exchanger is : 965.0 Btu/h.ft^2.\u00b0F .\n"
+ "text": [
+ "Thermal conductivity for the heat exchanger is : 965.0 Btu/h.ft^2.\u00b0F .\n"
+ ]
}
],
"prompt_number": 18
@@ -290,19 +694,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.19, Page number: 310"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.19, Page number: 310"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Another experiment(11) on the double pipe heat exchanger in the Unit Operation Laboratory at\nManhattan College produced the following data and calculated results for U (overall heat transfer\ncoefficient) and m\u02d9C (inside cold water flow rate); see Table 15.5.\nTable 15.5 Wilson Experiment Data and Results\nU, Btu/h.ft^2.\u00b0F m\u02d9C, lb/h m_C^-0.8\n687.98 500.97 144.49\n740.74 1001.94 251.58\n748.10 1502.90 347.97\n757.08 2003.87 438.02\n756.31 2204.26 472.73\nUsing the Wilson method, estimate the outside fluid film coefficient. Once again, neglect the\neffects of scale and pipe wall.\n'''\n\n#Variable declaration:\n#From figure 15.7:\na = 0.00126\nb = 0.0276\n\n#Calculation:\nho = 1.0/a #The value of ho (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"Thermal conductivity is :\",round(ho),\" Btu/h.ft^2.\u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From figure 15.7:\n",
+ "a = 0.00126\n",
+ "b = 0.0276\n",
+ "\n",
+ "#Calculation:\n",
+ "ho = 1.0/a #The value of ho (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"Thermal conductivity is :\",round(ho),\" Btu/h.ft^2.\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Thermal conductivity is : 794.0 Btu/h.ft^2.\u00b0F .\n"
+ "text": [
+ "Thermal conductivity is : 794.0 Btu/h.ft^2.\u00b0F .\n"
+ ]
}
],
"prompt_number": 19
@@ -311,19 +732,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.20, Page number: 311"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.20, Page number: 311"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to the previous illustrative example. Perform the same calculation but include the resistance\nassociated with the tube (Admiralty metal) if the inside and outside diameters are 1.00 and\n0.902 in, respectively; k for the tube is 60 Btu/h.ft^2.\u00b0F.\nTable 15.6 Wilson Experiment Data and Results\nU, Btu/h.ft^2.\u00b0F 1/U, h.ft^2.\u00b0F m\u02d9C, lb/h m_C^0.8 m_C^-0.8\n687.98 0.0014535 500.97 144.49 0.00692071\n740.74 0.00135 1001.94 251.58 0.003974904\n748.10 0.0013367 1502.90 347.97 0.002873796\n757.08 0.0013209 2003.87 438.02 0.002282992\n756.31 0.0013222 2204.26 472.73 0.002115387\n'''\n\n#Variable declaration:\nDi = 0.902/12.0 #Inside diameter of tube (ft)\nDo = 1.0/12.0 #Outside diameter of tube (ft)\nk = 60.0 #Thermal conductivity of tube (Btu/h.ft^2.\u00b0F) \n\n#Calculation:\n#From example 15.19:\na = 0.00126\nDr = (Do - Di)/2.0 #Radial thickness of tube wall (ft)\nRw = Dr/k #Resistance of wall (Btu/h.\u00b0F)\nho = 1.0/(a-Rw) #The revised ho (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"The revised ho is :\",round(ho),\" Btu/h.ft^2.\u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Di = 0.902/12.0 #Inside diameter of tube (ft)\n",
+ "Do = 1.0/12.0 #Outside diameter of tube (ft)\n",
+ "k = 60.0 #Thermal conductivity of tube (Btu/h.ft^2.\u00b0F) \n",
+ "\n",
+ "#Calculation:\n",
+ "#From example 15.19:\n",
+ "a = 0.00126\n",
+ "Dr = (Do - Di)/2.0 #Radial thickness of tube wall (ft)\n",
+ "Rw = Dr/k #Resistance of wall (Btu/h.\u00b0F)\n",
+ "ho = 1.0/(a-Rw) #The revised ho (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The revised ho is :\",round(ho),\" Btu/h.ft^2.\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The revised ho is : 839.0 Btu/h.ft^2.\u00b0F .\n"
+ "text": [
+ "The revised ho is : 839.0 Btu/h.ft^2.\u00b0F .\n"
+ ]
}
],
"prompt_number": 20
@@ -332,19 +774,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 15.21, Page number: 312"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 15.21, Page number: 312"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Data from experiments based on Wilson\u2019s method produced the following results.\nClean tube:\n1/Uclean = 0.00044 + 0.0050/(m\u02d9)0.8\n\nTube with scale:\n1/Udirty = 0.00089 +0.0050/(m\u02d9)0.8\nCalculate the scale film coefficient if the wall resistance can be neglected.\n'''\n\n#Variable declaration:\na1 = 0.00044 #Term 'a' for U_clean\na2 = 0.00089 #Term 'a' for U_dirty\n\n#Calculation:\nRs = a2 - a1 #Resistance associated with the scale\nhs = 1.0/Rs #Scale film coefficient (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"The scale film coefficient neglecting the wall resistance is:\",round(hs),\" Btu/h.ft^2.\u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "a1 = 0.00044 #Term 'a' for U_clean\n",
+ "a2 = 0.00089 #Term 'a' for U_dirty\n",
+ "\n",
+ "#Calculation:\n",
+ "Rs = a2 - a1 #Resistance associated with the scale\n",
+ "hs = 1.0/Rs #Scale film coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The scale film coefficient neglecting the wall resistance is:\",round(hs),\" Btu/h.ft^2.\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The scale film coefficient neglecting the wall resistance is: 2222.0 Btu/h.ft^2.\u00b0F .\n"
+ "text": [
+ "The scale film coefficient neglecting the wall resistance is: 2222.0 Btu/h.ft^2.\u00b0F .\n"
+ ]
}
],
"prompt_number": 21
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_16.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_16.ipynb
index ed13cc7c..af0c69ba 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_16.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_16.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 16"
+ "name": "",
+ "signature": "sha256:4d89093b0aef649c7f239bf75c18374320afd98a6f8286cbe2c1fcb242b5a141"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,61 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 16: Shell and Tube Heat Exchangers"
+ "source": [
+ "Chapter 16: Shell and Tube Heat Exchangers"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.5, Page number: 334"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.5, Page number: 334"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Consider the shell and tube heat exchanger in Figure 16.13. Calculate the log mean temperature\ndriving force. Also perform the calculation for the exchanger described in Figure 16.14.\n'''\n\nfrom math import log\n\n#Variable declaration:\n#From figure 16.13, for ideal countercurrent heat exchanger:\nT1 = 150.0 #Inlet temperature of hot fluid (\u00b0F)\nT2 = 100.0 #Outet temperature of hot fluid (\u00b0F)\nt1 = 50.0 #Inlet temperature of cold fluid (\u00b0F)\nt2 = 80.0 #Outet temperature of hot fluid (\u00b0F)\n#From figure 16.14, for shell and tube exchanger:\nT_1 = 50.0 #Inlet temperature of cold fluid (\u00b0F)\nT_2 = 80.0 #Outet temperature of hot fluid (\u00b0F)\nt_1 = 150.0 #Inlet temperature of hot fluid (\u00b0F)\nt_2 = 100.0 #Outet temperature of hot fluid (\u00b0F)\n\n#Calculation:\nDT1 = T1 - t2 #Temperature driving force 1 (\u00b0F)\nDT2 = T2 - t1 #Temperature driving force 1 (\u00b0F)\nDTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0F)\nP = (t2-t1)/(T1 - t1) #Dimensionless ratio P\nR = (T1-T2)/(t2-t1) #Dimensionless ratio R\n#From figure 16.7:\nF = 0.925 #Correction Factor\nDTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0F)\n\n#Result:\nprint \"The log mean temperature difference for ideal system is :\",round(DTlm1,1),\" \u00b0F .\"\nprint \"The log mean temperature difference for real system is :\",round(DTlm2,2),\" \u00b0F .\"",
+ "input": [
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From figure 16.13, for ideal countercurrent heat exchanger:\n",
+ "T1 = 150.0 #Inlet temperature of hot fluid (\u00b0F)\n",
+ "T2 = 100.0 #Outet temperature of hot fluid (\u00b0F)\n",
+ "t1 = 50.0 #Inlet temperature of cold fluid (\u00b0F)\n",
+ "t2 = 80.0 #Outet temperature of hot fluid (\u00b0F)\n",
+ "#From figure 16.14, for shell and tube exchanger:\n",
+ "T_1 = 50.0 #Inlet temperature of cold fluid (\u00b0F)\n",
+ "T_2 = 80.0 #Outet temperature of hot fluid (\u00b0F)\n",
+ "t_1 = 150.0 #Inlet temperature of hot fluid (\u00b0F)\n",
+ "t_2 = 100.0 #Outet temperature of hot fluid (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = T1 - t2 #Temperature driving force 1 (\u00b0F)\n",
+ "DT2 = T2 - t1 #Temperature driving force 1 (\u00b0F)\n",
+ "DTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0F)\n",
+ "P = (t2-t1)/(T1 - t1) #Dimensionless ratio P\n",
+ "R = (T1-T2)/(t2-t1) #Dimensionless ratio R\n",
+ "#From figure 16.7:\n",
+ "F = 0.925 #Correction Factor\n",
+ "DTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The log mean temperature difference for ideal system is :\",round(DTlm1,1),\" \u00b0F .\"\n",
+ "print \"The log mean temperature difference for real system is :\",round(DTlm2,2),\" \u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The log mean temperature difference for ideal system is : 59.4 \u00b0F .\nThe log mean temperature difference for real system is : 54.98 \u00b0F .\n"
+ "text": [
+ "The log mean temperature difference for ideal system is : 59.4 \u00b0F .\n",
+ "The log mean temperature difference for real system is : 54.98 \u00b0F .\n"
+ ]
}
],
"prompt_number": 5
@@ -38,19 +75,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.6, Page number: 335"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.6, Page number: 335"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A shell and tube heat exchanger having two shell passes and four tube passes is being used\nfor cooling. The shell-side fluid enters at 400\u00b0F and leaves at 250\u00b0F and the tube-side fluid\nenters at 100\u00b0F and leaves at 175\u00b0F. What is the log mean temperature difference between the\nhot fluid and the cold fluid?\n'''\n\nfrom math import log\n5\n#Variable declaration:\nT1 = 400.0 #Temperature of fluid entering the shell (\u00b0F)\nT2 = 250.0 #Temperature of fluid leaving the shell (\u00b0F)\nt1 = 100.0 #Temperature of fluid entering the tube (\u00b0F)\nt2 = 175.0 #Temperature of fluid leaving the tube (\u00b0F)\n\n#Calculation:\nDT1 = T1 - T2 #Temperature driving force 1 (\u00b0F)\nDT2 = t2 - t1 #Temperature driving force 1 (\u00b0F)\nDTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0F)\nP = (t2-t1)/(T1 - t1) #Dimensionless ratio P\nR = (T1-T2)/(t2-t1) #Dimensionless ratio R\n#From figure 16.8:\nF = 0.985 #Correction factor\nDTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0F)\n\n#Result:\nprint \"The log mean temperature difference between the hot fluid and the cold fluid is :\",round(DTlm2,1),\" \u00b0F .\"",
+ "input": [
+ "\n",
+ "from math import log\n",
+ "5\n",
+ "#Variable declaration:\n",
+ "T1 = 400.0 #Temperature of fluid entering the shell (\u00b0F)\n",
+ "T2 = 250.0 #Temperature of fluid leaving the shell (\u00b0F)\n",
+ "t1 = 100.0 #Temperature of fluid entering the tube (\u00b0F)\n",
+ "t2 = 175.0 #Temperature of fluid leaving the tube (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = T1 - T2 #Temperature driving force 1 (\u00b0F)\n",
+ "DT2 = t2 - t1 #Temperature driving force 1 (\u00b0F)\n",
+ "DTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0F)\n",
+ "P = (t2-t1)/(T1 - t1) #Dimensionless ratio P\n",
+ "R = (T1-T2)/(t2-t1) #Dimensionless ratio R\n",
+ "#From figure 16.8:\n",
+ "F = 0.985 #Correction factor\n",
+ "DTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The log mean temperature difference between the hot fluid and the cold fluid is :\",round(DTlm2,1),\" \u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The log mean temperature difference between the hot fluid and the cold fluid is : 106.6 \u00b0F .\n"
+ "text": [
+ "The log mean temperature difference between the hot fluid and the cold fluid is : 106.6 \u00b0F .\n"
+ ]
}
],
"prompt_number": 6
@@ -59,19 +122,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.7, Page number: 336"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.7, Page number: 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Recalculate the results of the two previous examples using the equation upon which the graphs\nare based.\n'''\n#Variable declaration:\n#From example 16.5:\nP1 = 0.30 #Dimensionless ratio P\nR1 = 1.67 #Dimensionless ratio R\n#From example 16.6:\nP2 = 0.30 #Dimensionless ratio P\nR2 = 1.67 #Dimensionless ratio R\n\n#Calculation:\n#Applying Equation 16.27:\nF1 = 0.92 #Correction Factor\n#Applying Equation 16.33:\nF2 = 0.985 #Correction Factor\n#From example 16.6:\nLMTD1 = 59.4 #Log mean temperature driving force 1 for ideal countercurrent heat exchanger (\u00b0F)\nLMTD2 = 108.0 #Log mean temperature driving force 2 for ideal countercurrent heat exchanger (\u00b0F)\nDTlm1 = F1*LMTD1 #Log mean temperature driving force 1 for shell and tube exchanger (\u00b0F)\nDTlm2 = F2*LMTD2 #Log mean temperature driving force 2 for shell and tube exchanger (\u00b0F)\n\n#Result:\nprint \"The log mean temperature difference for real system (in example 16.5) is :\",round(DTlm1,2),\" \u00b0F .\"\nprint \"The log mean temperature difference for real system (in example 16.6) is :\",round(DTlm2,1),\" \u00b0F .\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 16.5:\n",
+ "P1 = 0.30 #Dimensionless ratio P\n",
+ "R1 = 1.67 #Dimensionless ratio R\n",
+ "#From example 16.6:\n",
+ "P2 = 0.30 #Dimensionless ratio P\n",
+ "R2 = 1.67 #Dimensionless ratio R\n",
+ "\n",
+ "#Calculation:\n",
+ "#Applying Equation 16.27:\n",
+ "F1 = 0.92 #Correction Factor\n",
+ "#Applying Equation 16.33:\n",
+ "F2 = 0.985 #Correction Factor\n",
+ "#From example 16.6:\n",
+ "LMTD1 = 59.4 #Log mean temperature driving force 1 for ideal countercurrent heat exchanger (\u00b0F)\n",
+ "LMTD2 = 108.0 #Log mean temperature driving force 2 for ideal countercurrent heat exchanger (\u00b0F)\n",
+ "DTlm1 = F1*LMTD1 #Log mean temperature driving force 1 for shell and tube exchanger (\u00b0F)\n",
+ "DTlm2 = F2*LMTD2 #Log mean temperature driving force 2 for shell and tube exchanger (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The log mean temperature difference for real system (in example 16.5) is :\",round(DTlm1,2),\" \u00b0F .\"\n",
+ "print \"The log mean temperature difference for real system (in example 16.6) is :\",round(DTlm2,1),\" \u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The log mean temperature difference for real system (in example 16.5) is : 54.65 \u00b0F .\nThe log mean temperature difference for real system (in example 16.6) is : 106.4 \u00b0F .\n"
+ "text": [
+ "The log mean temperature difference for real system (in example 16.5) is : 54.65 \u00b0F .\n",
+ "The log mean temperature difference for real system (in example 16.6) is : 106.4 \u00b0F .\n"
+ ]
}
],
"prompt_number": 7
@@ -80,19 +172,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.8, Page number: 337"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.8, Page number: 337"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A shell and tube heat exchanger has one pass on the shell side and two passes on the tube side\n(i.e., a 1\u20132 shell and tube heat exchanger). It is being used for oil cooling. The oil flows in the\ntube side. It enters at 110\u00b0C and leaves at 75\u00b0C. The shell-side fluid is water at a flowrate of 1.133\nkg/s, entering at 35\u00b0C and leaving at 75\u00b0C. The heat capacity of the water is 4180 J/kg.K. The\noverall heat-transfer coefficient for the heat exchanger is 350W/m^2.K. The geometry factor F\nhas been previously estimated to be 0.965. Calculate the heat-transfer area requirement for this\nunit in square meters.(9)\n'''\n\nfrom math import log\n\n#Variable declaration:\nt2 = 75.0 #Temperature of water leaving the shell (\u00b0C)\nt1 = 35.0 #Temperature of water enteringing the shell (\u00b0C)\nT2 = 75.0 #Temperature of oil leaving the tube (\u00b0C)\nT1 = 110.0 #Temperature of oil entering the tube (\u00b0C)\nm = 1.133 #Mass flowrate of water (kg/s)\ncp = 4180.0 #Heat capacity of water (J/kg.K)\nF = 0.965 #Correction factor\nU = 350.0 #Overall heat transfer coefficient (W/m^2.K)\n\n#Calculation:\nQ = m*cp*(t2-t1) #Heat load (W)\nDT1 = T1-t2 #Temperature driving force 1 (\u00b0C)\nDT2 = T2-t1 #Temperature driving force 2 (\u00b0C)\nDTlm1 = (DT1-DT2)/log(DT1/DT2)+273.0 #Countercurrent log-mean temperature difference (K)\nDTlm2 = F*DTlm1 #Corrected log-mean temperature difference (K)\nA = Q/(U*DTlm2) #Required heat transfer area (m^2)\n\n#Result:\nprint \"The required heat-transfer area is :\",round(A,3),\" m^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "t2 = 75.0 #Temperature of water leaving the shell (\u00b0C)\n",
+ "t1 = 35.0 #Temperature of water enteringing the shell (\u00b0C)\n",
+ "T2 = 75.0 #Temperature of oil leaving the tube (\u00b0C)\n",
+ "T1 = 110.0 #Temperature of oil entering the tube (\u00b0C)\n",
+ "m = 1.133 #Mass flowrate of water (kg/s)\n",
+ "cp = 4180.0 #Heat capacity of water (J/kg.K)\n",
+ "F = 0.965 #Correction factor\n",
+ "U = 350.0 #Overall heat transfer coefficient (W/m^2.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = m*cp*(t2-t1) #Heat load (W)\n",
+ "DT1 = T1-t2 #Temperature driving force 1 (\u00b0C)\n",
+ "DT2 = T2-t1 #Temperature driving force 2 (\u00b0C)\n",
+ "DTlm1 = (DT1-DT2)/log(DT1/DT2)+273.0 #Countercurrent log-mean temperature difference (K)\n",
+ "DTlm2 = F*DTlm1 #Corrected log-mean temperature difference (K)\n",
+ "A = Q/(U*DTlm2) #Required heat transfer area (m^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The required heat-transfer area is :\",round(A,3),\" m^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required heat-transfer area is : 1.807 m^2 .\n"
+ "text": [
+ "The required heat-transfer area is : 1.807 m^2 .\n"
+ ]
}
],
"prompt_number": 8
@@ -101,19 +222,60 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.10, Page number: 338"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.10, Page number: 338"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A shell and tube heat exchanger is to be designed for heating 10,000 kg/h of water from 16 \u00b0C to\n84 \u00b0C by a new high heat capacity hot engine oil flowing through the shell. The oil makes a single\nshell pass, entering at 160 \u00b0C and leaving at 94 \u00b0C. Thewater flows through 11 brass tubes of 22.9\nmm inside diameter and 25.4 mm outside diameter with each tube making four passes through\nthe shell. The overall heat transfer coefficient (including the fouling resistance effect) is approximately\n350 W/m^2.\u00b0C and the thermal conductivity of brass is 137 W/m.\u00b0C. Calculate\n1. the heat load, in MW,\n2. the countercurrent flow log mean temperature difference, and\n3. the F correction factor and the corrected log mean temperature difference.\n'''\n\nfrom math import log\n\n#Variable declaration:\nt2 = 84.0 #Temperature of water leaving the tube (\u00b0C)\nt1 = 16.0 #Temperature of water entering the tube (\u00b0C)\nm1 = 10000.0/3600.0 #Mass flowrate of water (kg/s)\nT2 = 94.0 #Temperature of oil leaving the shell (\u00b0C)\nT1 = 160.0 #Temperature of oil entering the shell (\u00b0C)\n\n#Calculation:\nTw = (t1+t2)/2.0 #Average bulk temperature of water (\u00b0C)\nTo = (T1+T2)/2.0 #Average bulk temperature of oil (\u00b0C)\n#From table 16.1:\np1 = 987.0 #Density of water (kg/m^3)\ncp1 = 4176.0 #Heat capacity of water (J/kg.\u00b0C)\np2 = 822.0 #Density of oil (kg/m^3)\nQ = m1*cp1*(t2-t1) #Heat load (W)\ncp2 = 4820.0 #Heat capacity of oil (J/kg.\u00b0C)\nm2 = Q/(cp2*(T1-T2)) #Mass flowrate of oil (kg/s)\nDT1 = T2-t1 #Temperature driving force 1 (\u00b0C)\nDT2 = T1-t2 #Temperature driving force 2 (\u00b0C)\nDTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0C)\nP = (t2-t1)/(T1 - t1) #Dimensionless ratio P\nR = (T1-T2)/(t2-t1) #Dimensionless ratio R\n#From figure 16.7:\nF = 0.965 #Correction factor\nDTlm2 = F*DTlm1 #Log mean temperature driving force for 1-4 shell and tube exchanger (\u00b0C)\n\n#Result:\nprint \"1. The heat load is :\",round(Q/10**6,3),\" MW .\"\nprint \"2. The countercurrent flow log mean temperature difference is :\",round(DTlm1),\" \u00b0C .\"\nprint \"3. The F correction factor and the corrected log mean temperature difference is :\",round(DTlm2,1),\" \u00b0C .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "t2 = 84.0 #Temperature of water leaving the tube (\u00b0C)\n",
+ "t1 = 16.0 #Temperature of water entering the tube (\u00b0C)\n",
+ "m1 = 10000.0/3600.0 #Mass flowrate of water (kg/s)\n",
+ "T2 = 94.0 #Temperature of oil leaving the shell (\u00b0C)\n",
+ "T1 = 160.0 #Temperature of oil entering the shell (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "Tw = (t1+t2)/2.0 #Average bulk temperature of water (\u00b0C)\n",
+ "To = (T1+T2)/2.0 #Average bulk temperature of oil (\u00b0C)\n",
+ "#From table 16.1:\n",
+ "p1 = 987.0 #Density of water (kg/m^3)\n",
+ "cp1 = 4176.0 #Heat capacity of water (J/kg.\u00b0C)\n",
+ "p2 = 822.0 #Density of oil (kg/m^3)\n",
+ "Q = m1*cp1*(t2-t1) #Heat load (W)\n",
+ "cp2 = 4820.0 #Heat capacity of oil (J/kg.\u00b0C)\n",
+ "m2 = Q/(cp2*(T1-T2)) #Mass flowrate of oil (kg/s)\n",
+ "DT1 = T2-t1 #Temperature driving force 1 (\u00b0C)\n",
+ "DT2 = T1-t2 #Temperature driving force 2 (\u00b0C)\n",
+ "DTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0C)\n",
+ "P = (t2-t1)/(T1 - t1) #Dimensionless ratio P\n",
+ "R = (T1-T2)/(t2-t1) #Dimensionless ratio R\n",
+ "#From figure 16.7:\n",
+ "F = 0.965 #Correction factor\n",
+ "DTlm2 = F*DTlm1 #Log mean temperature driving force for 1-4 shell and tube exchanger (\u00b0C)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The heat load is :\",round(Q/10**6,3),\" MW .\"\n",
+ "print \"2. The countercurrent flow log mean temperature difference is :\",round(DTlm1),\" \u00b0C .\"\n",
+ "print \"3. The F correction factor and the corrected log mean temperature difference is :\",round(DTlm2,1),\" \u00b0C .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The heat load is : 0.789 MW .\n2. The countercurrent flow log mean temperature difference is : 77.0 \u00b0C .\n3. The F correction factor and the corrected log mean temperature difference is : 74.3 \u00b0C .\n"
+ "text": [
+ "1. The heat load is : 0.789 MW .\n",
+ "2. The countercurrent flow log mean temperature difference is : 77.0 \u00b0C .\n",
+ "3. The F correction factor and the corrected log mean temperature difference is : 74.3 \u00b0C .\n"
+ ]
}
],
"prompt_number": 10
@@ -122,19 +284,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.11, Page number: 340"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.11, Page number: 340"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to the previous example. Calculate the area and the length of the tubes required for this\nheat exchanger.\n'''\n\nfrom math import pi\n\n#Variable declaration:\n#From example 16.10:\nU = 350.0 #Over all heat transfer coefficient (W/m^2.\u00b0C)\nDTlm = 74.3 #Log mean temperature driving force for 1-4 shell and tube exchanger (\u00b0C)\nQ = 788800.0 #Heat load (W)\nNt = 11.0 #Number of tubes per pass\nNp = 4.0 #Number of passes\nDi = 0.0229 #Inside diameter of tube (m)\n\n#Calculation:\nA = Q/(U*DTlm) #Heat transfer area required for heat exchanger (m^2)\nN = Nt*Np #Total number of tubes\nL = A/(pi*Di*N) #Tube length (m)\n\n#Result:\nprint \"The heat transfer area required for the heat exchanger is :\",round(A,2),\" m^2 .\"\nprint \"The length of the tubes required for the heat exchanger is :\",round(L*3.28,1),\" ft .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 16.10:\n",
+ "U = 350.0 #Over all heat transfer coefficient (W/m^2.\u00b0C)\n",
+ "DTlm = 74.3 #Log mean temperature driving force for 1-4 shell and tube exchanger (\u00b0C)\n",
+ "Q = 788800.0 #Heat load (W)\n",
+ "Nt = 11.0 #Number of tubes per pass\n",
+ "Np = 4.0 #Number of passes\n",
+ "Di = 0.0229 #Inside diameter of tube (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = Q/(U*DTlm) #Heat transfer area required for heat exchanger (m^2)\n",
+ "N = Nt*Np #Total number of tubes\n",
+ "L = A/(pi*Di*N) #Tube length (m)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer area required for the heat exchanger is :\",round(A,2),\" m^2 .\"\n",
+ "print \"The length of the tubes required for the heat exchanger is :\",round(L*3.28,1),\" ft .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer area required for the heat exchanger is : 30.33 m^2 .\nThe length of the tubes required for the heat exchanger is : 31.4 ft .\n"
+ "text": [
+ "The heat transfer area required for the heat exchanger is : 30.33 m^2 .\n",
+ "The length of the tubes required for the heat exchanger is : 31.4 ft .\n"
+ ]
}
],
"prompt_number": 11
@@ -143,19 +332,60 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.18, Page number: 349"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.18, Page number: 349"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 16.10. Determine the effectiveness and number of transfer units.'''\n\n#Variable declaration:\n#From example 16.10:\nm1 = 2.778 #Mass flowrate of water (kg/s)\ncp1 = 4176.0 #Heat capacity of water (J/kg.\u00b0C)\ncp2 = 4820.0 #Heat capacity of oil (J/kg.\u00b0C)\nm2 = 2.48 #Mass flowrate of oil (kg/s)\nt2 = 84.0 #Temperature of water leaving the tube (\u00b0C)\nt1 = 16.0 #Temperature of water entering the tube (\u00b0C)\nT2 = 94.0 #Temperature of oil leaving the shell (\u00b0C)\nT1 = 160.0 #Temperature of oil entering the shell (\u00b0C)\nU = 350.0 #Over all heat transfer coefficient (W/m^2.\u00b0C)\nA = 30.33 #Heat transfer area required for heat exchanger (m^2)\n\n#Calculation:\nC1 = m1*cp1 #Capacitance rate of water (W/\u00b0C)\nC2 = m2*cp2 #Capacitance rate of oil (W/\u00b0C)\nQ = C1*(t2-t1) #Heat load of water (W)\nQmax = C1*(T1-t1) #Maximum heat load of water (W)\nE = Q/Qmax #Effectiveness\nif (C1<C2):\n Cmin = C1 #Minimum capacitance rate (W/\u00b0C)\n Cmax = C2 #Maximum capacitance rate (W/\u00b0C)\nelse:\n Cmin = C2 #Minimum capacitance rate (W/\u00b0C)\n Cmax = C1 #Maximum capacitance rate (W/\u00b0C)\nNTU = U*A/Cmin #Number of transfer units\nC = Cmin/Cmax #Capacitance rate ratio\n\n#Result:\nprint \"The effectiveness is :\",round(E,3),\".\"\nprint \"The number of transfer units is :\",round(NTU,3),\".\"\nprint \"The capacitance rate ratio is :\",round(C,3),\".\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 16.10:\n",
+ "m1 = 2.778 #Mass flowrate of water (kg/s)\n",
+ "cp1 = 4176.0 #Heat capacity of water (J/kg.\u00b0C)\n",
+ "cp2 = 4820.0 #Heat capacity of oil (J/kg.\u00b0C)\n",
+ "m2 = 2.48 #Mass flowrate of oil (kg/s)\n",
+ "t2 = 84.0 #Temperature of water leaving the tube (\u00b0C)\n",
+ "t1 = 16.0 #Temperature of water entering the tube (\u00b0C)\n",
+ "T2 = 94.0 #Temperature of oil leaving the shell (\u00b0C)\n",
+ "T1 = 160.0 #Temperature of oil entering the shell (\u00b0C)\n",
+ "U = 350.0 #Over all heat transfer coefficient (W/m^2.\u00b0C)\n",
+ "A = 30.33 #Heat transfer area required for heat exchanger (m^2)\n",
+ "\n",
+ "#Calculation:\n",
+ "C1 = m1*cp1 #Capacitance rate of water (W/\u00b0C)\n",
+ "C2 = m2*cp2 #Capacitance rate of oil (W/\u00b0C)\n",
+ "Q = C1*(t2-t1) #Heat load of water (W)\n",
+ "Qmax = C1*(T1-t1) #Maximum heat load of water (W)\n",
+ "E = Q/Qmax #Effectiveness\n",
+ "if (C1<C2):\n",
+ " Cmin = C1 #Minimum capacitance rate (W/\u00b0C)\n",
+ " Cmax = C2 #Maximum capacitance rate (W/\u00b0C)\n",
+ "else:\n",
+ " Cmin = C2 #Minimum capacitance rate (W/\u00b0C)\n",
+ " Cmax = C1 #Maximum capacitance rate (W/\u00b0C)\n",
+ "NTU = U*A/Cmin #Number of transfer units\n",
+ "C = Cmin/Cmax #Capacitance rate ratio\n",
+ "\n",
+ "#Result:\n",
+ "print \"The effectiveness is :\",round(E,3),\".\"\n",
+ "print \"The number of transfer units is :\",round(NTU,3),\".\"\n",
+ "print \"The capacitance rate ratio is :\",round(C,3),\".\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The effectiveness is : 0.472 .\nThe number of transfer units is : 0.915 .\nThe capacitance rate ratio is : 0.97 .\n"
+ "text": [
+ "The effectiveness is : 0.472 .\n",
+ "The number of transfer units is : 0.915 .\n",
+ "The capacitance rate ratio is : 0.97 .\n"
+ ]
}
],
"prompt_number": 18
@@ -164,19 +394,56 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.19, Page number: 351"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.19, Page number: 351"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The feedwater heater for a boiler supplies 10,000 kg/h of water at 65\u00b0C. The raw feedwater\nenters the tubes with an inlet temperature of 20\u00b0C and is to be heated in a single-shell, twotube\npass heat exchanger by condensing steam at 1.30 bars. Water is on the tube side and\nsteam is on the shell side. The overall heat transfer coefficient is 2000W/m^2.K. Determine\nthe required heat transfer area for the exchanger. Use both the LMTD method and the E-NTU\napproach to obtain the results.\n'''\n\nfrom math import log\n\n#Variable declaration:\n#From table 16.4:\nCw = 11680.3 #Capacitance rate of water (W/\u00b0C)\nt2 = 65.0 #Temperature of water leaving the tube (\u00b0C)\nt1 = 20.0 #Temperature of water entering the tube (\u00b0C)\nT2 = 107.3 #Temperature of steam leaving the shell (\u00b0C)\nT1 = 107.3 #Temperature of steam entering the shell (\u00b0C)\nhv = 2.238*10**6 #Latenet heat of condensation for steam (J/kg)\nU = 2000.0 #Overall heat transfer coefficient (W/m^2.\u00b0C)\n\n#Calculation:\nQ = Cw*(t2-t1) #Heat load (W)\nm2 = Q/hv #Steam condensation rate (kg/s)\nDT1 = T2-t1 #Temperature driving force 1 (\u00b0C)\nDT2 = T1-t2 #Temperature driving force 2 (\u00b0C)\nDTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0C)\nF = 1.0 #Correction factor (since, T2 = T1)\nDTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0C)\nA1 = Q/(U*DTlm2) #Heat transfer area using LMTD method (m^2)\nE = (t2-t1)/(T1-t1) #Effectiveness\n#From figure 16.18:\nNTU = 0.7 #Number of transfer units\nA2 = (NTU*Cw)/U #Heat transfer area using E-NTU method (m^2)\n\n#Result:\nprint \"The heat transfr area for the exchanger (using LMTD method) is :\",round(A1,2),\" m^2 .\"\nprint \"The heat transfr area for the exchanger (using E-NTU method) is :\",round(A2,1),\" m^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From table 16.4:\n",
+ "Cw = 11680.3 #Capacitance rate of water (W/\u00b0C)\n",
+ "t2 = 65.0 #Temperature of water leaving the tube (\u00b0C)\n",
+ "t1 = 20.0 #Temperature of water entering the tube (\u00b0C)\n",
+ "T2 = 107.3 #Temperature of steam leaving the shell (\u00b0C)\n",
+ "T1 = 107.3 #Temperature of steam entering the shell (\u00b0C)\n",
+ "hv = 2.238*10**6 #Latenet heat of condensation for steam (J/kg)\n",
+ "U = 2000.0 #Overall heat transfer coefficient (W/m^2.\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = Cw*(t2-t1) #Heat load (W)\n",
+ "m2 = Q/hv #Steam condensation rate (kg/s)\n",
+ "DT1 = T2-t1 #Temperature driving force 1 (\u00b0C)\n",
+ "DT2 = T1-t2 #Temperature driving force 2 (\u00b0C)\n",
+ "DTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0C)\n",
+ "F = 1.0 #Correction factor (since, T2 = T1)\n",
+ "DTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0C)\n",
+ "A1 = Q/(U*DTlm2) #Heat transfer area using LMTD method (m^2)\n",
+ "E = (t2-t1)/(T1-t1) #Effectiveness\n",
+ "#From figure 16.18:\n",
+ "NTU = 0.7 #Number of transfer units\n",
+ "A2 = (NTU*Cw)/U #Heat transfer area using E-NTU method (m^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfr area for the exchanger (using LMTD method) is :\",round(A1,2),\" m^2 .\"\n",
+ "print \"The heat transfr area for the exchanger (using E-NTU method) is :\",round(A2,1),\" m^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfr area for the exchanger (using LMTD method) is : 4.23 m^2 .\nThe heat transfr area for the exchanger (using E-NTU method) is : 4.1 m^2 .\n"
+ "text": [
+ "The heat transfr area for the exchanger (using LMTD method) is : 4.23 m^2 .\n",
+ "The heat transfr area for the exchanger (using E-NTU method) is : 4.1 m^2 .\n"
+ ]
}
],
"prompt_number": 19
@@ -185,19 +452,79 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.21, Page number: 353"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.21, Page number: 353"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A shell and tube heat exchanger has one pass on the shell side and two passes on the tube side\n(i.e., 1\u20132 shell and tube heat exchanger). It is being used for oil cooling. The oil flows in the\ntube side. It enters at 110\u00b0C and leaves at 75\u00b0C. The shell-side fluid is water at a flow rate of\n1.133 kg/s, entering at 35\u00b0C and leaving at 75\u00b0C. The oil flows in the tubes at an average\nvelocity of 0.3 m/s. The tube inside diameter is 3/4 inch or 0.01905 m. The overall heat transfer\ncoefficient for a clean heat exchanger is 350W/m^2.K. The fouling factor, Rf, is 0.00027 m2 .\nK/W. The oil properties are: p_oil = 850 kg/m3 and c_oil = 1900 J/kg.K. Calculate:\n1. the mass flow rate of the oil\n2. the minimum and maximum heat capacity rate\n3. the heat load, Q\u02d9\n4. the total number of tubes\n5. the tube length.\n'''\n\nfrom math import pi,log\n\n#Variable declaration:\n#From table 16.5:\nt2 = 75.0 #Temperature of water leaving the shell (\u00b0C)\nt1 = 35.0 #Temperature of water entering the shell (\u00b0C\nT2 = 75.0 #Temperature of oil leaving the tube (\u00b0C)\nT1 = 110.0 #Temperature of oil entering the tube (\u00b0C)\nmw = 1.133 #Mass flowrtae of water (kg/s)\ncpw = 4180.0 #Heat capacity of water (J/kg.K)\ncpo = 1900.0 #Heat capacity of oil (J/kg.K)\np = 850.0 #Density of oil (kg/m^3)\nDi = 0.01905 #Inside diameter of tube (m)\nV = 0.3 #Average velocity of oil flow inside the tube (m/s)\nNp = 2.0 #Number of passes\nUc = 350.0 #Overall heat transfer coefficient for clean heat exchanger (W/m^2)\nRf = 0.00027 #Fouling factor (m^2.K/w)\n\n#Calculation:\nCw = mw*cpw #Water capacitance rate (W/K)\nQ = Cw*(t2-t1) #Heat load (W)\nCo = Q/(T1-T2) #Oil capacitance rate (W/K)\nmo = Co/cpo #Total flowrate of oil (kg/s)\nif (Cw<Co):\n Cmin = Cw #Minimum capacitance rate (W/K)\n Cmax = Co #Maximum capacitance rate (W/K)\nelse:\n Cmin = Co #Minimum capacitance rate (W/K)\n Cmax = Cw #Maximum capacitance rate (W/K)\nm_ot = p*V*(pi/4.0)*Di**2 #Oil flowrate per tube (kg/s)\nNt = mo/m_ot #Number of tubes per pass\nN = Nt*Np #Number of tubes\nDT1 = T2-t1 #Temperature driving force 1 (\u00b0C)\nDT2 = T1-t2 #Temperature driving force 2 (\u00b0C)\nDTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0C)\nP = (t2-t1)/(T1 - t1) #Dimensionless parameter P\nR = (T1-T2)/(t2-t1) #Dimensionless parameter R\n#From figure 16.7:\nF = 0.81 #Correction factor\nDTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0C)\nUd = 1.0/(1.0/Uc+Rf) #Dirty overall heat transfer coefficient (W/m^2.K)\nA = Q/(Ud*DTlm2) #Required heat transfer area (m^2)\nL = A/(N*pi*Di) #Tube length (m)\n\n#Result:\nprint \"1. The mass flow rate of the oil is :\",round(mo,2),\" kg/s .\"\nprint \"2. The minimum and maximum heat capacity rate is :\",round(Cmin),\" and \",round(Cmax,1),\" W/K .\"\nprint \"3. The heat load, Q is :\",round(Q),\" W .\"\nprint \"4. The total number of tubes is :\",round(N,-1),\".\"\nprint \"5. The tube length is :\",round(L,1),\" m .\"",
+ "input": [
+ "\n",
+ "from math import pi,log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From table 16.5:\n",
+ "t2 = 75.0 #Temperature of water leaving the shell (\u00b0C)\n",
+ "t1 = 35.0 #Temperature of water entering the shell (\u00b0C\n",
+ "T2 = 75.0 #Temperature of oil leaving the tube (\u00b0C)\n",
+ "T1 = 110.0 #Temperature of oil entering the tube (\u00b0C)\n",
+ "mw = 1.133 #Mass flowrtae of water (kg/s)\n",
+ "cpw = 4180.0 #Heat capacity of water (J/kg.K)\n",
+ "cpo = 1900.0 #Heat capacity of oil (J/kg.K)\n",
+ "p = 850.0 #Density of oil (kg/m^3)\n",
+ "Di = 0.01905 #Inside diameter of tube (m)\n",
+ "V = 0.3 #Average velocity of oil flow inside the tube (m/s)\n",
+ "Np = 2.0 #Number of passes\n",
+ "Uc = 350.0 #Overall heat transfer coefficient for clean heat exchanger (W/m^2)\n",
+ "Rf = 0.00027 #Fouling factor (m^2.K/w)\n",
+ "\n",
+ "#Calculation:\n",
+ "Cw = mw*cpw #Water capacitance rate (W/K)\n",
+ "Q = Cw*(t2-t1) #Heat load (W)\n",
+ "Co = Q/(T1-T2) #Oil capacitance rate (W/K)\n",
+ "mo = Co/cpo #Total flowrate of oil (kg/s)\n",
+ "if (Cw<Co):\n",
+ " Cmin = Cw #Minimum capacitance rate (W/K)\n",
+ " Cmax = Co #Maximum capacitance rate (W/K)\n",
+ "else:\n",
+ " Cmin = Co #Minimum capacitance rate (W/K)\n",
+ " Cmax = Cw #Maximum capacitance rate (W/K)\n",
+ "m_ot = p*V*(pi/4.0)*Di**2 #Oil flowrate per tube (kg/s)\n",
+ "Nt = mo/m_ot #Number of tubes per pass\n",
+ "N = Nt*Np #Number of tubes\n",
+ "DT1 = T2-t1 #Temperature driving force 1 (\u00b0C)\n",
+ "DT2 = T1-t2 #Temperature driving force 2 (\u00b0C)\n",
+ "DTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0C)\n",
+ "P = (t2-t1)/(T1 - t1) #Dimensionless parameter P\n",
+ "R = (T1-T2)/(t2-t1) #Dimensionless parameter R\n",
+ "#From figure 16.7:\n",
+ "F = 0.81 #Correction factor\n",
+ "DTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0C)\n",
+ "Ud = 1.0/(1.0/Uc+Rf) #Dirty overall heat transfer coefficient (W/m^2.K)\n",
+ "A = Q/(Ud*DTlm2) #Required heat transfer area (m^2)\n",
+ "L = A/(N*pi*Di) #Tube length (m)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The mass flow rate of the oil is :\",round(mo,2),\" kg/s .\"\n",
+ "print \"2. The minimum and maximum heat capacity rate is :\",round(Cmin),\" and \",round(Cmax,1),\" W/K .\"\n",
+ "print \"3. The heat load, Q is :\",round(Q),\" W .\"\n",
+ "print \"4. The total number of tubes is :\",round(N,-1),\".\"\n",
+ "print \"5. The tube length is :\",round(L,1),\" m .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The mass flow rate of the oil is : 2.85 kg/s .\n2. The minimum and maximum heat capacity rate is : 4736.0 and 5412.5 W/K .\n3. The heat load, Q is : 189438.0 W .\n4. The total number of tubes is : 80.0 .\n5. The tube length is : 4.2 m .\n"
+ "text": [
+ "1. The mass flow rate of the oil is : 2.85 kg/s .\n",
+ "2. The minimum and maximum heat capacity rate is : 4736.0 and 5412.5 W/K .\n",
+ "3. The heat load, Q is : 189438.0 W .\n",
+ "4. The total number of tubes is : 80.0 .\n",
+ "5. The tube length is : 4.2 m .\n"
+ ]
}
],
"prompt_number": 21
@@ -206,19 +533,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 16.22, Page number: 356"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 16.22, Page number: 356"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Determine the effectiveness and NTU for the previous example.'''\n\n#Variable declaration:\n#From example 16.22:\nt2 = 75.0 #Temperature of water leaving the shell (\u00b0F)\nt1 = 35.0 #Temperature of water entering the shell (\u00b0F)\nT2 = 75.0 #Temperature of oil leaving the tube (\u00b0F)\nT1 = 110.0 #Temperature of oil entering the tube (\u00b0F)\nU = 320.0 #Overall heat transfer coefficient (W/m^2.K)\nA = 19.5 #Required heat transfer area (m^2)\nCmin = 4736.0 #Minimum capacitance rate (W/K)\n\n#Calculation:\nDT1 = t2-t1 #Actual water temperature change (\u00b0F)\nDT2 = T1 - t1 #Maximum water temperature change (\u00b0F)\nE = DT1/DT2 #Effectiveness\nNTU = (U*A)/Cmin #Number of transfer units\n\n#Result:\nprint \"The effectiveness is :\",round(E,3),\".\"\nprint \"The NTU is :\",round(NTU,3),\".\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 16.22:\n",
+ "t2 = 75.0 #Temperature of water leaving the shell (\u00b0F)\n",
+ "t1 = 35.0 #Temperature of water entering the shell (\u00b0F)\n",
+ "T2 = 75.0 #Temperature of oil leaving the tube (\u00b0F)\n",
+ "T1 = 110.0 #Temperature of oil entering the tube (\u00b0F)\n",
+ "U = 320.0 #Overall heat transfer coefficient (W/m^2.K)\n",
+ "A = 19.5 #Required heat transfer area (m^2)\n",
+ "Cmin = 4736.0 #Minimum capacitance rate (W/K)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = t2-t1 #Actual water temperature change (\u00b0F)\n",
+ "DT2 = T1 - t1 #Maximum water temperature change (\u00b0F)\n",
+ "E = DT1/DT2 #Effectiveness\n",
+ "NTU = (U*A)/Cmin #Number of transfer units\n",
+ "\n",
+ "#Result:\n",
+ "print \"The effectiveness is :\",round(E,3),\".\"\n",
+ "print \"The NTU is :\",round(NTU,3),\".\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The effectiveness is : 0.533 .\nThe NTU is : 1.318 .\n"
+ "text": [
+ "The effectiveness is : 0.533 .\n",
+ "The NTU is : 1.318 .\n"
+ ]
}
],
"prompt_number": 22
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_17.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_17.ipynb
index 16924e48..4a60ab42 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_17.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_17.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 17"
+ "name": "",
+ "signature": "sha256:475ce8fa81a36fce30309ad0a5a8ca165ef95371bfe5c210d4123243261a9f37"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,51 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 17: Fins and Extended Surfaces"
+ "source": [
+ "Chapter 17: Fins and Extended Surfaces"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.1, Page number: 358"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.1, Page number: 358"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Consider the longitudinal (rectangular) fin pictured in Figure 17.1. Estimate the fin face area,\nneglecting the (top) area contribution associated with the fin thickness if w = 1 ft and L =\n1.5 in. The fin thickness is 0.1 in. Also calculate the total area of the fin.\n'''\n\n#Variable declaration:\nw1 = 1.5 #Thicknessof fin (in)\nL = 12.0 #Length of fin (in)\nw2 = 0.1 #Thickness of fin(in)\n\n#Calculation:\nAf = 2*w1*L #Face area of fin (in^2)\nAt = Af + L*w2 #Total area of fin (in^2)\n\n#Result:\nprint \"The face area of the fin is :\",round(Af),\" in^2 .\"\nprint \"The face area of the fin is :\",round(Af/12**2,2),\" ft^2 .\"\nprint \"The total area of the fin is :\",round(At,1),\" in^2 .\"\nprint \"The total area of the fin is :\",round(At/12**2,3),\" ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "w1 = 1.5 #Thicknessof fin (in)\n",
+ "L = 12.0 #Length of fin (in)\n",
+ "w2 = 0.1 #Thickness of fin(in)\n",
+ "\n",
+ "#Calculation:\n",
+ "Af = 2*w1*L #Face area of fin (in^2)\n",
+ "At = Af + L*w2 #Total area of fin (in^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The face area of the fin is :\",round(Af),\" in^2 .\"\n",
+ "print \"The face area of the fin is :\",round(Af/12**2,2),\" ft^2 .\"\n",
+ "print \"The total area of the fin is :\",round(At,1),\" in^2 .\"\n",
+ "print \"The total area of the fin is :\",round(At/12**2,3),\" ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The face area of the fin is : 36.0 in^2 .\nThe face area of the fin is : 0.25 ft^2 .\nThe total area of the fin is : 37.2 in^2 .\nThe total area of the fin is : 0.258 ft^2 .\n"
+ "text": [
+ "The face area of the fin is : 36.0 in^2 .\n",
+ "The face area of the fin is : 0.25 ft^2 .\n",
+ "The total area of the fin is : 37.2 in^2 .\n",
+ "The total area of the fin is : 0.258 ft^2 .\n"
+ ]
}
],
"prompt_number": 22
@@ -38,19 +65,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.3, Page number: 359"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.3, Page number: 359"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Figure 17.2. Estimate the fin area, neglecting the area contribution associated with the\nfin thickness if r0 = 4.0 in, rf = 6.0 in, and t = 0.1 in.\n'''\n\nfrom math import pi\n\n#Variable declaration:\nrf = 6.0/12.0 #Outside radius of fin (ft)\nro = 4.0/12.0 #Outside radius of pipe (ft)\nt = 0.1/12.0 #Thickness of fin (ft)\n\n#Calculation:\nAf = 2*pi*(rf**2-ro**2) #Face area of fin (ft^2)\nAt = Af + 2*pi*rf*t #Total area of fin (ft^2)\n\n#Result:\nprint \"The total fin area is :\",round(At,3),\" ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "rf = 6.0/12.0 #Outside radius of fin (ft)\n",
+ "ro = 4.0/12.0 #Outside radius of pipe (ft)\n",
+ "t = 0.1/12.0 #Thickness of fin (ft)\n",
+ "\n",
+ "#Calculation:\n",
+ "Af = 2*pi*(rf**2-ro**2) #Face area of fin (ft^2)\n",
+ "At = Af + 2*pi*rf*t #Total area of fin (ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The total fin area is :\",round(At,3),\" ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The total fin area is : 0.899 ft^2 .\n"
+ "text": [
+ "The total fin area is : 0.899 ft^2 .\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +106,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.4, Page number: 364"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.4, Page number: 364"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following information is provided for a straight rectangular fin: h = 15 W/m^2.K,\nk = 300 W/m.K, L = 3 in, and t = 1 in. Estimate the fin efficiency.\n'''\n\nfrom math import sqrt\n\n#Variable declaration:\nL = 3.0*0.0254 #Height of fin (m)\nt = 1.0*0.0254 #Thickness of fin (m)\nh = 15.0 #Heat transfer coefficient (W/m^2.K)\nk = 300.0 #Thermal conductivity (W/m.K)\n\n#Calculation:\nLc = L + t/2.0 #Corrected height of fin (m)\nAp = Lc*t #Profile area of fin (m^2)\nx = sqrt((Lc**3*h)/(k*Ap)) #x-coordinate of figure 17.3\n#From figure 17.3:\nnf = 98.0 #Fin efficiency\n\n#Result:\nprint \"The fin efficiency is :\",nf,\"% .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from math import sqrt\n",
+ "\n",
+ "#Variable declaration:\n",
+ "L = 3.0*0.0254 #Height of fin (m)\n",
+ "t = 1.0*0.0254 #Thickness of fin (m)\n",
+ "h = 15.0 #Heat transfer coefficient (W/m^2.K)\n",
+ "k = 300.0 #Thermal conductivity (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "Lc = L + t/2.0 #Corrected height of fin (m)\n",
+ "Ap = Lc*t #Profile area of fin (m^2)\n",
+ "x = sqrt((Lc**3*h)/(k*Ap)) #x-coordinate of figure 17.3\n",
+ "#From figure 17.3:\n",
+ "nf = 98.0 #Fin efficiency\n",
+ "\n",
+ "#Result:\n",
+ "print \"The fin efficiency is :\",nf,\"% .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The fin efficiency is : 98.0 % .\n"
+ "text": [
+ "The fin efficiency is : 98.0 % .\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +151,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.5, Page number: 365"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.5, Page number: 365"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Estimate the fin efficiency in the previous example using the equation developed by\nBarkwill et al.(3)\n'''\n\n#Variable declaration:\n#From example 17.4:\nX = 0.1246 #X-coordinate of figure 17.3\n\n#Calculation:\n#Applying equation (A) from Table 17.3:\nY = 4.5128*X**3 - 10.079*X**2 - 31.413*X + 101.47\n\n#Result:\nprint \"The fin efficiency is :\",round(Y,1),\"% .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 17.4:\n",
+ "X = 0.1246 #X-coordinate of figure 17.3\n",
+ "\n",
+ "#Calculation:\n",
+ "#Applying equation (A) from Table 17.3:\n",
+ "Y = 4.5128*X**3 - 10.079*X**2 - 31.413*X + 101.47\n",
+ "\n",
+ "#Result:\n",
+ "print \"The fin efficiency is :\",round(Y,1),\"% .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The fin efficiency is : 97.4 % .\n"
+ "text": [
+ "The fin efficiency is : 97.4 % .\n"
+ ]
}
],
"prompt_number": 5
@@ -101,19 +189,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.6, Page number: 365"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.6, Page number: 365"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A set of micro-fins is designed to cool an electronic circuit. Each micro-fin has a square\ncross-section of 0.2 cm by 0.2 cm and a length of 1 cm. The conductivity of the fin material\nis 400 W/m.K and the air heat transfer coefficient is 16 W/m^2.K. The circuit temperature\nis 100\u00b0C and the air temperature is 25\u00b0C. Calculate the heat transfer from each micro-fin in W.\n'''\n\nfrom math import sqrt,atan\n\n#Variable declaration:\nw = 0.2/100.0 #Width of fin (m)\nt = 0.2/100.0 #Thickness of fin (m)\nL = 1.0/100.0 #Length of fin (m)\nh = 16.0 #Heat transfer coefficient (W/m^2.K)\nk = 400.0 #Thermal conductivity of fin (W/m.K)\nTc = 100.0 #Circuit temperature (\u00b0C)\nTa = 25.0 #Air temperature (\u00b0C)\n\n#Calculation:\nP = 4*w #Fin cross-section parameter (m)\nAc = w*t #Cross-sectional area of fin (m^2)\nLc = L+Ac/P #Corrected height of fin (m)\nm = sqrt((h*P)/(k*Ac)) #Location of minimum temperature (m^-1)\nQ = (sqrt(h*P*k*Ac))*(Tc-Ta)*atan(h)*(m*Lc) #Heat transfer from each micro-fin (W)\n\n#Result:\nprint \"The heat transfer from each micro-fin is :\",round(Q,2),\" W .\"",
+ "input": [
+ "\n",
+ "from math import sqrt,atan\n",
+ "\n",
+ "#Variable declaration:\n",
+ "w = 0.2/100.0 #Width of fin (m)\n",
+ "t = 0.2/100.0 #Thickness of fin (m)\n",
+ "L = 1.0/100.0 #Length of fin (m)\n",
+ "h = 16.0 #Heat transfer coefficient (W/m^2.K)\n",
+ "k = 400.0 #Thermal conductivity of fin (W/m.K)\n",
+ "Tc = 100.0 #Circuit temperature (\u00b0C)\n",
+ "Ta = 25.0 #Air temperature (\u00b0C)\n",
+ "\n",
+ "#Calculation:\n",
+ "P = 4*w #Fin cross-section parameter (m)\n",
+ "Ac = w*t #Cross-sectional area of fin (m^2)\n",
+ "Lc = L+Ac/P #Corrected height of fin (m)\n",
+ "m = sqrt((h*P)/(k*Ac)) #Location of minimum temperature (m^-1)\n",
+ "Q = (sqrt(h*P*k*Ac))*(Tc-Ta)*atan(h)*(m*Lc) #Heat transfer from each micro-fin (W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer from each micro-fin is :\",round(Q,2),\" W .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer from each micro-fin is : 0.15 W .\n"
+ "text": [
+ "The heat transfer from each micro-fin is : 0.15 W .\n"
+ ]
}
],
"prompt_number": 6
@@ -122,19 +236,86 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.8, Page number: 366"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.8, Page number: 366"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Air and water are separated by a 1.5 mm plane wall made of steel (k = 38 W/m.K; density, r =\n7753 kg/m^3; heat capacity, cp = 486 J/kg.K). The air temperature, T4, is 19\u00b0C, and the water\ntemperature, T4, is 83\u00b0C. Denote the temperature at the air\u2013wall interface T1 and let T3 be the\ntemperature at the wall\u2013water interface. The air-side heat transfer coefficient, h1, is 13 W/m^2.K\nand the water side heat transfer coefficient, h3, is 260 W/m^2.K. Assume an area of the wall that\nis 1 m high and 1 m wide as a basis.\n1. Show whether the conduction resistance may be neglected.\n2. What is the rate of heat transfer from water to air?\nTo increase the rate of heat transfer, it is proposed to add steel fins to the wall. These straight\nrectangular steel fins will be 2.5 cm long, 1.3 mm thick, and will be spaced such that the fin\npitch, S, is 1.3 cm between centers.\n3. Calculate the percent increase in steady-state heat transfer rate that can be realized by\nadding fins to the air side of the plane wall.\n4. Calculate the percent increase in steady-state heat transfer rate that can be realized by\nadding fins to the water side of the plane wall.\n'''\nfrom __future__ import division\nfrom math import sqrt\n#Variable declaration:\nh1 = 13.0 #Air-side heat transfer coefficient (W/m^2.K)\nA = 1.0 #Base wall area (m^2)\nL = 2.5/100 #Length of steel fins (m)\nL2 = 1.5/10**3 #Length of steel wall (m)\nk = 13.0 #Thermal conductivity of fin (W/m.K)\nk1 = 38.0 #Thermal conductivity of steel wall (W/m.K)\nh2 = 260.0 #Water side heat transfer coefficient (W/m^2.K)\nT4 = 19.0 #Air temperature (\u00b0C)\nT1 = 83.0 #Water temperature (\u00b0C)\nt = 1.3/10**3 #Thickness of steel fins (m)\nw = 1.0 #Width of wall (m)\nS = 1.3/100 #Fin pitch(m)\n\n#Calculation:\nR1 = 1/(h1*A) #Air resistance (\u00b0C/W) (part 1)\nR2 = L2/(k1*A) #Conduction resistance (\u00b0C/W)\nR3 = 1/(h2*A) #Water resistance (\u00b0C/W)\nRt = (R1+R3) #Total resistance (\u00b0C/W) (part 2)\nQ = (T1-T4)/Rt #Total heat transfer (W)\nNf = 1/S #Number of fins (part 3)\nLbe = w - Nf*t #Unfinned exposed base surface\nAbe = w*Lbe #Exposed base surface area (m^2)\nLc = L+t/2 #Corrected length (m)\nAp = Lc*t #Profile area (m^2)\nAf = 2*w*Lc #Fin surface area (m^2)\nBi = h1*(t/2)/k1 #Biot number\na = sqrt(Lc**3*h1/(k*Ap)) #Abscissa of the fin efficiency\n#From figure 17.3:\nnf = 0.88 #Fin efficiency\nRb = 1/(h1*Abe) #Air thermal resistance of base wall (\u00b0C/W)\nRf = 1/(h1*Nf*Af*nf) #Air thermal resistance of fins (\u00b0C/W)\nRT1 = 1/(1/Rb+1/Rf) #Total outside resistance of the fin array (\u00b0C/W)\nRt3 = RT1+R3 #Total resistance on air side fins (\u00b0C/W)\nQt = (T1-T4)/round(Rt3,5) #Heat transfer rate on air side fins (W)\nI = (Qt/Q - 1)*100 #Percent increase in heat transfer rate to air side fins (W)\nA = sqrt(Lc**3*h2/(k1*Ap)) #Abscissa of the new fin efficiency (part 4)\n#From figure 17.3:\nnf2 = 38.0 #New fin efficiency\nRb2 = 1/(h2*Abe) #Thermal resistance of base wall (\u00b0C/W)\nRf2 = 1/(h2*Nf*Af*nf2) #Thermal resistance of fins (\u00b0C/W)\nRt4 = 1/(1/Rb2+1/Rf2) #Total resistance of the finned surface (\u00b0C/W)\nRt5 = R1+Rt4 #Total resistance on water side fins (\u00b0C/W)\nQT1 = (T1-T4)/Rt5 #Heat transfer rate on water side fins (W)\nI2 = (QT1/Q - 1)*100 #Percent increase in heat transfer rate to water side fins (W)\n\n#Result:\nif (R2<R1 or R2<R3):\n print \"1. The conduction resistance may be neglected.\"\nelse:\n print \"1. The conduction resistance can not be neglected.\"\nprint \"2. The rate of heat transfer from water to air is :\",round(Q,1),\" W .\"\nprint \"3. The percent increase in steady-state heat transfer rate by adding fins to the air side of the plane wall is :\",round(I,1),\" % .\"\nprint \"4. The percent increase in steady-state heat transfer rate by adding fins to the water side of the plane wall is :\",round(I2,1),\" % .\"\nprint \"____There is a calculation mistake in book in calculating Qt(83-19/0.0214 = 2999), hence slight differences in answer______\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "#Variable declaration:\n",
+ "h1 = 13.0 #Air-side heat transfer coefficient (W/m^2.K)\n",
+ "A = 1.0 #Base wall area (m^2)\n",
+ "L = 2.5/100 #Length of steel fins (m)\n",
+ "L2 = 1.5/10**3 #Length of steel wall (m)\n",
+ "k = 13.0 #Thermal conductivity of fin (W/m.K)\n",
+ "k1 = 38.0 #Thermal conductivity of steel wall (W/m.K)\n",
+ "h2 = 260.0 #Water side heat transfer coefficient (W/m^2.K)\n",
+ "T4 = 19.0 #Air temperature (\u00b0C)\n",
+ "T1 = 83.0 #Water temperature (\u00b0C)\n",
+ "t = 1.3/10**3 #Thickness of steel fins (m)\n",
+ "w = 1.0 #Width of wall (m)\n",
+ "S = 1.3/100 #Fin pitch(m)\n",
+ "\n",
+ "#Calculation:\n",
+ "R1 = 1/(h1*A) #Air resistance (\u00b0C/W) (part 1)\n",
+ "R2 = L2/(k1*A) #Conduction resistance (\u00b0C/W)\n",
+ "R3 = 1/(h2*A) #Water resistance (\u00b0C/W)\n",
+ "Rt = (R1+R3) #Total resistance (\u00b0C/W) (part 2)\n",
+ "Q = (T1-T4)/Rt #Total heat transfer (W)\n",
+ "Nf = 1/S #Number of fins (part 3)\n",
+ "Lbe = w - Nf*t #Unfinned exposed base surface\n",
+ "Abe = w*Lbe #Exposed base surface area (m^2)\n",
+ "Lc = L+t/2 #Corrected length (m)\n",
+ "Ap = Lc*t #Profile area (m^2)\n",
+ "Af = 2*w*Lc #Fin surface area (m^2)\n",
+ "Bi = h1*(t/2)/k1 #Biot number\n",
+ "a = sqrt(Lc**3*h1/(k*Ap)) #Abscissa of the fin efficiency\n",
+ "#From figure 17.3:\n",
+ "nf = 0.88 #Fin efficiency\n",
+ "Rb = 1/(h1*Abe) #Air thermal resistance of base wall (\u00b0C/W)\n",
+ "Rf = 1/(h1*Nf*Af*nf) #Air thermal resistance of fins (\u00b0C/W)\n",
+ "RT1 = 1/(1/Rb+1/Rf) #Total outside resistance of the fin array (\u00b0C/W)\n",
+ "Rt3 = RT1+R3 #Total resistance on air side fins (\u00b0C/W)\n",
+ "Qt = (T1-T4)/round(Rt3,5) #Heat transfer rate on air side fins (W)\n",
+ "I = (Qt/Q - 1)*100 #Percent increase in heat transfer rate to air side fins (W)\n",
+ "A = sqrt(Lc**3*h2/(k1*Ap)) #Abscissa of the new fin efficiency (part 4)\n",
+ "#From figure 17.3:\n",
+ "nf2 = 38.0 #New fin efficiency\n",
+ "Rb2 = 1/(h2*Abe) #Thermal resistance of base wall (\u00b0C/W)\n",
+ "Rf2 = 1/(h2*Nf*Af*nf2) #Thermal resistance of fins (\u00b0C/W)\n",
+ "Rt4 = 1/(1/Rb2+1/Rf2) #Total resistance of the finned surface (\u00b0C/W)\n",
+ "Rt5 = R1+Rt4 #Total resistance on water side fins (\u00b0C/W)\n",
+ "QT1 = (T1-T4)/Rt5 #Heat transfer rate on water side fins (W)\n",
+ "I2 = (QT1/Q - 1)*100 #Percent increase in heat transfer rate to water side fins (W)\n",
+ "\n",
+ "#Result:\n",
+ "if (R2<R1 or R2<R3):\n",
+ " print \"1. The conduction resistance may be neglected.\"\n",
+ "else:\n",
+ " print \"1. The conduction resistance can not be neglected.\"\n",
+ "print \"2. The rate of heat transfer from water to air is :\",round(Q,1),\" W .\"\n",
+ "print \"3. The percent increase in steady-state heat transfer rate by adding fins to the air side of the plane wall is :\",round(I,1),\" % .\"\n",
+ "print \"4. The percent increase in steady-state heat transfer rate by adding fins to the water side of the plane wall is :\",round(I2,1),\" % .\"\n",
+ "print \"____There is a calculation mistake in book in calculating Qt(83-19/0.0214 = 2999), hence slight differences in answer______\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The conduction resistance may be neglected.\n2. The rate of heat transfer from water to air is : 792.4 W .\n3. The percent increase in steady-state heat transfer rate by adding fins to the air side of the plane wall is : 276.7 % .\n4. The percent increase in steady-state heat transfer rate by adding fins to the water side of the plane wall is : 5.0 % .\n____There is a calculation mistake in book in calculating Qt(83-19/0.0214 = 2999), hence slight differences in answer______\n"
+ "text": [
+ "1. The conduction resistance may be neglected.\n",
+ "2. The rate of heat transfer from water to air is : 792.4 W .\n",
+ "3. The percent increase in steady-state heat transfer rate by adding fins to the air side of the plane wall is : 276.7 % .\n",
+ "4. The percent increase in steady-state heat transfer rate by adding fins to the water side of the plane wall is : 5.0 % .\n",
+ "____There is a calculation mistake in book in calculating Qt(83-19/0.0214 = 2999), hence slight differences in answer______\n"
+ ]
}
],
"prompt_number": 21
@@ -143,19 +324,75 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.10, Page number: 369"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.10, Page number: 369"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A circular tube has an outside diameter of 2.5 cm and a surface tempeature, Tb, of 170\u00b0C. An\nannular aluminum fin of rectangular profile is attached to the tube. The fin has an outside\nradius, rf, of 2.75 cm, a thickness, t, of 1 mm, and a thermal conductivity, k, of 200 W/m . K.\nThe surrounding fluid is at a temperature Too = 25\u00b0C and the associated heat transfer coefficient,\nh, is 130 W/m^2.K. Calculate the heat transfer rate without the fin,Q\u02d9w/o,f, the corrected\nlength, Lc, the outer radius, r2c, the maximum heat transfer rate from the fin,Q\u02d9f,max, the fin efficiency,\nhf, the fin heat transfer rate, qf, and the fin thermal resistance, Rt,f.\n'''\n\nfrom __future__ import division\nfrom math import pi,sqrt\n\n#Variable declaration:\nDo = 2.5/100 #Outside diameter of tube (m)\nt = 1/10**3 #Thickness of fin (m)\nT = 25 #Fluid temperature (\u00b0C)\nTb = 170 #Surface temperature (\u00b0C)\nh = 130 #Heat transfer coefficient (W/m^2.K)\nk = 200 #Thermal conductivity of fin (W/m.K)\nrf = 2.75/100 #Outside radius of fin (m)\n\n#Calculation:\nro = Do/2 #Radius of tube (m)\nAb = 2*pi*ro*t #Area of the base of the fin (m^2)\nTe = Tb-T #Excess temperature at the base of the fin (K)\nQ1 = h*Ab*Te #Total heat transfer rate without the fin (W)\nBi = h*(t/2)/k #Biot number\nL = rf-ro #Fin height (m)\nrc = rf+t/2 #Corrected radius (m)\nLc = L+t/2 #Corrected height (m)\nAp = Lc*t #Profile area (m^2)\nAf = 2*pi*(rc**2-ro**2) #Fin surface area (m^2)\nQm = h*Af*Te #Maximum fin heat transfer rate (W)\nA = sqrt(Lc**3*h/(k*Ap)) #Abscissa of fin efficiency\nC = rf/ro #Curve parameter of fin efficiency\n#From figure 17.4:\nnf = 0.86 #Fin efficiency\nQf = nf*Qm #Fin heat transfer rate (W)\nR = Te/Qf #Fin resistance (K/W)\n\n#Result:\nprint \"1. The heat transfer rate without the fin is :\",round(Q1,2),\" W .\"\nprint \"Or, the heat transfer rate without the fin is :\",round(Q1*3.412),\" Btu/h .\"\nprint \"2. The corrected length is :\",round(Lc,4),\" m .\"\nprint \"3. The outer radius is :\",round(rc,3),\" m .\"\nprint \"4. The maximum heat transfer rate from the fin is :\",round(Qm,2),\" W .\" \nprint \"5. The fin efficiency is :\",round(nf*100),\" % .\" \nprint \"6. The fin heat transfer rate is :\",round(Qf),\" W .\"\nprint \"Or, the fin heat transfer rate is :\",round(Qf*3.412),\" Btu/h .\"\nprint \"7. The fin thermal resistance is :\",round(R,2),\" K/W .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi,sqrt\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Do = 2.5/100 #Outside diameter of tube (m)\n",
+ "t = 1/10**3 #Thickness of fin (m)\n",
+ "T = 25 #Fluid temperature (\u00b0C)\n",
+ "Tb = 170 #Surface temperature (\u00b0C)\n",
+ "h = 130 #Heat transfer coefficient (W/m^2.K)\n",
+ "k = 200 #Thermal conductivity of fin (W/m.K)\n",
+ "rf = 2.75/100 #Outside radius of fin (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "ro = Do/2 #Radius of tube (m)\n",
+ "Ab = 2*pi*ro*t #Area of the base of the fin (m^2)\n",
+ "Te = Tb-T #Excess temperature at the base of the fin (K)\n",
+ "Q1 = h*Ab*Te #Total heat transfer rate without the fin (W)\n",
+ "Bi = h*(t/2)/k #Biot number\n",
+ "L = rf-ro #Fin height (m)\n",
+ "rc = rf+t/2 #Corrected radius (m)\n",
+ "Lc = L+t/2 #Corrected height (m)\n",
+ "Ap = Lc*t #Profile area (m^2)\n",
+ "Af = 2*pi*(rc**2-ro**2) #Fin surface area (m^2)\n",
+ "Qm = h*Af*Te #Maximum fin heat transfer rate (W)\n",
+ "A = sqrt(Lc**3*h/(k*Ap)) #Abscissa of fin efficiency\n",
+ "C = rf/ro #Curve parameter of fin efficiency\n",
+ "#From figure 17.4:\n",
+ "nf = 0.86 #Fin efficiency\n",
+ "Qf = nf*Qm #Fin heat transfer rate (W)\n",
+ "R = Te/Qf #Fin resistance (K/W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The heat transfer rate without the fin is :\",round(Q1,2),\" W .\"\n",
+ "print \"Or, the heat transfer rate without the fin is :\",round(Q1*3.412),\" Btu/h .\"\n",
+ "print \"2. The corrected length is :\",round(Lc,4),\" m .\"\n",
+ "print \"3. The outer radius is :\",round(rc,3),\" m .\"\n",
+ "print \"4. The maximum heat transfer rate from the fin is :\",round(Qm,2),\" W .\" \n",
+ "print \"5. The fin efficiency is :\",round(nf*100),\" % .\" \n",
+ "print \"6. The fin heat transfer rate is :\",round(Qf),\" W .\"\n",
+ "print \"Or, the fin heat transfer rate is :\",round(Qf*3.412),\" Btu/h .\"\n",
+ "print \"7. The fin thermal resistance is :\",round(R,2),\" K/W .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The heat transfer rate without the fin is : 1.48 W .\nOr, the heat transfer rate without the fin is : 5.0 Btu/h .\n2. The corrected length is : 0.0155 m .\n3. The outer radius is : 0.028 m .\n4. The maximum heat transfer rate from the fin is : 74.35 W .\n5. The fin efficiency is : 86.0 % .\n6. The fin heat transfer rate is : 64.0 W .\nOr, the fin heat transfer rate is : 218.0 Btu/h .\n7. The fin thermal resistance is : 2.27 K/W .\n"
+ "text": [
+ "1. The heat transfer rate without the fin is : 1.48 W .\n",
+ "Or, the heat transfer rate without the fin is : 5.0 Btu/h .\n",
+ "2. The corrected length is : 0.0155 m .\n",
+ "3. The outer radius is : 0.028 m .\n",
+ "4. The maximum heat transfer rate from the fin is : 74.35 W .\n",
+ "5. The fin efficiency is : 86.0 % .\n",
+ "6. The fin heat transfer rate is : 64.0 W .\n",
+ "Or, the fin heat transfer rate is : 218.0 Btu/h .\n",
+ "7. The fin thermal resistance is : 2.27 K/W .\n"
+ ]
}
],
"prompt_number": 10
@@ -164,19 +401,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.11, Page number: 370"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.11, Page number: 370"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 17.10. Calculate the fin effectiveness, 1f, and whether the use of\nthe fin is justified.\n'''\n\n#Variable declaration:\n#From example 17.10:\nQf = 64 #Fin heat transfer rate (W)\nQ1 = 1.48 #Total heat transfer rate without the fin (W)\n\n#Calculation:\nE = Qf/Q1 #Fin effectiveness\n\n#Result:\nprint \"The fin effectiveness is :\",round(E,1),\" .\"\nif E>2:\n print \"Hence, the use of the fin is justified.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 17.10:\n",
+ "Qf = 64 #Fin heat transfer rate (W)\n",
+ "Q1 = 1.48 #Total heat transfer rate without the fin (W)\n",
+ "\n",
+ "#Calculation:\n",
+ "E = Qf/Q1 #Fin effectiveness\n",
+ "\n",
+ "#Result:\n",
+ "print \"The fin effectiveness is :\",round(E,1),\" .\"\n",
+ "if E>2:\n",
+ " print \"Hence, the use of the fin is justified.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The fin effectiveness is : 43.2 .\nHence, the use of the fin is justified.\n"
+ "text": [
+ "The fin effectiveness is : 43.2 .\n",
+ "Hence, the use of the fin is justified.\n"
+ ]
}
],
"prompt_number": 11
@@ -185,19 +442,65 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.12, Page number: 370"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.12, Page number: 370"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''If the tube described in Illustrative Example 17.10 had a length of one meter and fin pitch of\n10 mm, what would be the total surface area for heat transfer, the exposed tube base total\nheat transfer rate,Q\u02d9t, the overall efficiency of the surface, and the overall surface effectiveness?\nNote: This problem is an extension of Illustrative Example 17.10. The information is\nobtained from it and its solution is used in the solution of this problem.\n'''\n\nfrom __future__ import division\nfrom math import pi\n\n#Variable declaration:\nw = 1 #Length of tube (m)\nS = 10/10**3 #Fin patch (m)\n#From example 17.10:\nt = 1/10**3 #Thickness of fin (m)\nro = 0.0125 #Radius of tube (m)\nAf = 3.94*10**-3 #Fin surface area (m^2)\nTb = 145 #Excess temperature at the base of the fin (K)\nh = 130 #Heat transfer coefficient (W/m^2.K)\nQf = 64 #Fin heat transfer rate (W)\n\n#Calculation:\nNf = w/S #Number of fins in tube length\nwb = w-Nf*t #Unfinned base length (m)\nAb = 2*pi*ro*wb #Unfinned base area (m^2)\nAt =Ab+Nf*Af #Total transfer surface area (m^2)\nQt = h*(2*pi*ro*w*Tb) #Total heat rate without fins (W)\nQb = h*Ab*Tb #Heat flow rate from the exposed tube base (W)\nQft = Nf*Qf #Heat flow rate from all the fins (W)\nQt2 = Qb+Qft #Total heat flow rate (W)\nQm = h*At*Tb #Maximum heat transfer rate (W)\nno = Qt2/Qm #Overall fin efficiency\nEo = Qt2/Qt #Overall effectiveness\nRb = 1/(h*Ab) #Thermal resistance of base (K/W)\nRf = 1/(h*Nf*Af*no) #Thermal resistance of fins (K/W)\n\n#Result:\nprint \"1. The total surface area for heat transfer is :\",round(At,3),\" m^2 .\"\nprint \"2. The exposed tube base total heat transfer rate is :\",round(Qb,1),\" W .\"\nprint \"Or, the exposed tube base total heat transfer rate is :\",round(Qb*3.412),\" Btu/h .\"\nprint \"3. The overall efficiency of the surface is :\",round(no*100,1),\" % .\"\nprint \"4. The overall surface effectiveness is :\",round(Eo,2),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "w = 1 #Length of tube (m)\n",
+ "S = 10/10**3 #Fin patch (m)\n",
+ "#From example 17.10:\n",
+ "t = 1/10**3 #Thickness of fin (m)\n",
+ "ro = 0.0125 #Radius of tube (m)\n",
+ "Af = 3.94*10**-3 #Fin surface area (m^2)\n",
+ "Tb = 145 #Excess temperature at the base of the fin (K)\n",
+ "h = 130 #Heat transfer coefficient (W/m^2.K)\n",
+ "Qf = 64 #Fin heat transfer rate (W)\n",
+ "\n",
+ "#Calculation:\n",
+ "Nf = w/S #Number of fins in tube length\n",
+ "wb = w-Nf*t #Unfinned base length (m)\n",
+ "Ab = 2*pi*ro*wb #Unfinned base area (m^2)\n",
+ "At =Ab+Nf*Af #Total transfer surface area (m^2)\n",
+ "Qt = h*(2*pi*ro*w*Tb) #Total heat rate without fins (W)\n",
+ "Qb = h*Ab*Tb #Heat flow rate from the exposed tube base (W)\n",
+ "Qft = Nf*Qf #Heat flow rate from all the fins (W)\n",
+ "Qt2 = Qb+Qft #Total heat flow rate (W)\n",
+ "Qm = h*At*Tb #Maximum heat transfer rate (W)\n",
+ "no = Qt2/Qm #Overall fin efficiency\n",
+ "Eo = Qt2/Qt #Overall effectiveness\n",
+ "Rb = 1/(h*Ab) #Thermal resistance of base (K/W)\n",
+ "Rf = 1/(h*Nf*Af*no) #Thermal resistance of fins (K/W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The total surface area for heat transfer is :\",round(At,3),\" m^2 .\"\n",
+ "print \"2. The exposed tube base total heat transfer rate is :\",round(Qb,1),\" W .\"\n",
+ "print \"Or, the exposed tube base total heat transfer rate is :\",round(Qb*3.412),\" Btu/h .\"\n",
+ "print \"3. The overall efficiency of the surface is :\",round(no*100,1),\" % .\"\n",
+ "print \"4. The overall surface effectiveness is :\",round(Eo,2),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The total surface area for heat transfer is : 0.465 m^2 .\n2. The exposed tube base total heat transfer rate is : 1332.4 W .\nOr, the exposed tube base total heat transfer rate is : 4546.0 Btu/h .\n3. The overall efficiency of the surface is : 88.3 % .\n4. The overall surface effectiveness is : 5.22 .\n"
+ "text": [
+ "1. The total surface area for heat transfer is : 0.465 m^2 .\n",
+ "2. The exposed tube base total heat transfer rate is : 1332.4 W .\n",
+ "Or, the exposed tube base total heat transfer rate is : 4546.0 Btu/h .\n",
+ "3. The overall efficiency of the surface is : 88.3 % .\n",
+ "4. The overall surface effectiveness is : 5.22 .\n"
+ ]
}
],
"prompt_number": 13
@@ -206,19 +509,64 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.13, Page number: 374"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.13, Page number: 374"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Consider the case of aluminum fins of triangular profile that are attached to a plane wall with a\nsurface temperature is 250\u00b0C. The fin base thickness is 2 mm and its length is 6 mm. The system\nis in ambient air at a temperature of 20\u00b0C and the surface convection coefficient is 40W/m2 . K.\nConsider a 1 m width of a single fin. Determine:\n1. the heat transfer rate without the fin,\n2. the maximum heat transfer rate from the fin, and\n3. the fin efficiency, thermal resistance, and effectiveness.\nProperties of the aluminum may be evaluated at the average temperature, (Tb + T1)/2 =\n(250 + 20)/2 = 135\u00b0C = 408 K, where k \u2243 240 W/m.K.\n'''\n\nfrom __future__ import division\nfrom math import sqrt\n\n#Variable declaration:\nw = 1 #Width of single of fin (m)\nt = 2/10**3 #Fin base thickness (m)\nl = 6/10**3 #Fin length thickness (m)\nT1 = 250 #Surface temperature (\u00b0C)\nT2 = 20 #Ambient air temperature (\u00b0C)\nh = 40 #Surface convection coefficient (W/m^2.K)\nk = 240 #Thermal conductivity of fin (W/m.K)\n\n#Calculation:\nAb = t*w #Base area of the fin (m^2)\nTe = T1-T2 #Excess temperature at the base of the fin (K)\nQw = h*Ab*Te #Heat transfer rate without a fin (W)\nAf = 2*w*(sqrt(l**2-(t/2)**2)) #Fin surface area (m^2)\nQm = h*Af*Te #Maximum heat transfer rate (m^2)\nBi = h*(t/2)/k #Biot number\nLc = l #Corrected length (m)\nAp = l*t/2 #Profile area (m^2)\nA = sqrt((Lc**3*h)/k*Ap) #Abscissa for the fin efficiency figure\n#From figure 17.4:\nnf = 0.99 #Fin efficiency\nQf = nf*Qm #Fin heat transfer rate (W)\nR = Te/Qf #Fin thermal resistance (K/W)\nE = Qf/Qw #Fin effectiveness\n\n#Result:\nprint \"1. The heat transfer rate without the fin is :\",round(Qw,1),\" W .\"\nprint \"2. The maximum heat transfer rate from the fin is :\",round(Qm,-1),\" W .\"\nprint \"3. The fin efficiency is :\",round(nf*100),\" % .\"\nprint \" The fin thermal resistance is :\",round(R,1),\" \u00b0C/W .\"\nprint \" The fin effectiveness is :\",round(E,1),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import sqrt\n",
+ "\n",
+ "#Variable declaration:\n",
+ "w = 1 #Width of single of fin (m)\n",
+ "t = 2/10**3 #Fin base thickness (m)\n",
+ "l = 6/10**3 #Fin length thickness (m)\n",
+ "T1 = 250 #Surface temperature (\u00b0C)\n",
+ "T2 = 20 #Ambient air temperature (\u00b0C)\n",
+ "h = 40 #Surface convection coefficient (W/m^2.K)\n",
+ "k = 240 #Thermal conductivity of fin (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "Ab = t*w #Base area of the fin (m^2)\n",
+ "Te = T1-T2 #Excess temperature at the base of the fin (K)\n",
+ "Qw = h*Ab*Te #Heat transfer rate without a fin (W)\n",
+ "Af = 2*w*(sqrt(l**2-(t/2)**2)) #Fin surface area (m^2)\n",
+ "Qm = h*Af*Te #Maximum heat transfer rate (m^2)\n",
+ "Bi = h*(t/2)/k #Biot number\n",
+ "Lc = l #Corrected length (m)\n",
+ "Ap = l*t/2 #Profile area (m^2)\n",
+ "A = sqrt((Lc**3*h)/k*Ap) #Abscissa for the fin efficiency figure\n",
+ "#From figure 17.4:\n",
+ "nf = 0.99 #Fin efficiency\n",
+ "Qf = nf*Qm #Fin heat transfer rate (W)\n",
+ "R = Te/Qf #Fin thermal resistance (K/W)\n",
+ "E = Qf/Qw #Fin effectiveness\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The heat transfer rate without the fin is :\",round(Qw,1),\" W .\"\n",
+ "print \"2. The maximum heat transfer rate from the fin is :\",round(Qm,-1),\" W .\"\n",
+ "print \"3. The fin efficiency is :\",round(nf*100),\" % .\"\n",
+ "print \" The fin thermal resistance is :\",round(R,1),\" \u00b0C/W .\"\n",
+ "print \" The fin effectiveness is :\",round(E,1),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The heat transfer rate without the fin is : 18.4 W .\n2. The maximum heat transfer rate from the fin is : 110.0 W .\n3. The fin efficiency is : 99.0 % .\n The fin thermal resistance is : 2.1 \u00b0C/W .\n The fin effectiveness is : 5.9 .\n"
+ "text": [
+ "1. The heat transfer rate without the fin is : 18.4 W .\n",
+ "2. The maximum heat transfer rate from the fin is : 110.0 W .\n",
+ "3. The fin efficiency is : 99.0 % .\n",
+ " The fin thermal resistance is : 2.1 \u00b0C/W .\n",
+ " The fin effectiveness is : 5.9 .\n"
+ ]
}
],
"prompt_number": 15
@@ -227,19 +575,39 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.14, Page number: 375"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.14, Page number: 375"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Determine whether the use of the fin is justified in the previous example.'''\n\n#Variable declaration:\n#From example 17.13:\nQf = 108.9 #Fin heat transfer rate (W)\nQw = 18.4 #Total heat transfer rate without the fin (W)\n\n#Calculation:\nE = Qf/Qw #Fin effectiveness\n\n#Result:\nprint \"The fin effectiveness is :\",round(E,2),\" .\"\nif E>2:\n print \"Hence, the use of the fin is justified.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 17.13:\n",
+ "Qf = 108.9 #Fin heat transfer rate (W)\n",
+ "Qw = 18.4 #Total heat transfer rate without the fin (W)\n",
+ "\n",
+ "#Calculation:\n",
+ "E = Qf/Qw #Fin effectiveness\n",
+ "\n",
+ "#Result:\n",
+ "print \"The fin effectiveness is :\",round(E,2),\" .\"\n",
+ "if E>2:\n",
+ " print \"Hence, the use of the fin is justified.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The fin effectiveness is : 5.92 .\nHence, the use of the fin is justified.\n"
+ "text": [
+ "The fin effectiveness is : 5.92 .\n",
+ "Hence, the use of the fin is justified.\n"
+ ]
}
],
"prompt_number": 16
@@ -248,19 +616,70 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.15, Page number: 375"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.15, Page number: 375"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Annular aluminum fins of rectangular profile are attached to a circular tube. The outside diameter\nof the tube is 50 mm and the temperature of its outer surface is 200\u00b0C. The fins are 4 mm\nthick and have a length of 15 mm. The system is in ambient air at a temperature of 20\u00b0C and the\nsurface convection coefficient is 40 W/m^2.K. The thermal conductivity of aluminum is\n240 W/m.K. What are the efficiency, thermal resistance, effectiveness, and heat transfer rate\nof a single fin? Is the use of the fin justified?\n'''\n\nfrom __future__ import division\nfrom math import pi,sqrt\n\n#Variable declaration:\nDo = 50/10**3 #Outside diameter of tube (m)\nt = 4/10**3 #Thickness of fin (m)\nT = 20 #Fluid temperature (\u00b0C)\nTb = 200 #Surface temperature (\u00b0C)\nh = 40 #Heat transfer coefficient (W/m^2.K)\nk = 240 #Thermal conductivity of fin (W/m.K)\nl = 15/10**3 #Length of fin (m)\n\n#Calculation:\nro = Do/2 #Radius of tube (m)\nrf = ro+l #Outside radius of fin (m)\nAb = 2*pi*ro*t #Area of the base of the fin (m^2)\nTe = Tb-T #Excess temperature at the base of the fin (K)\nQ1 = h*Ab*Te #Total heat transfer rate without the fin (W)\nBi = h*(t/2)/k #Biot number\nL = rf-ro #Fin height (m)\nrc = rf+t/2 #Corrected radius (m)\nLc = L+t/2 #Corrected height (m)\nAp = Lc*t #Profile area (m^2)\nAf = 2*pi*(rc**2-ro**2) #Fin surface area (m^2)\nQm = h*Af*Te #Maximum fin heat transfer rate (W)\nA = sqrt(Lc**3*h/(k*Ap)) #Abscissa of fin efficiency\nC = rf/ro #Curve parameter of fin efficiency\n#From figure 17.4:\nnf = 0.97 #Fin efficiency\nQf = nf*Qm #Fin heat transfer rate (W)\nR = Te/Qf #Fin resistance (K/W)\nE = Qf/Q1 #Fin effectiveness\n\n#Result:\nprint \"The fin efficiency is :\",round(nf*100),\" % .\"\nprint \"The fin thermal resistance is :\",round(R,1),\" \u00b0C/W .\"\nprint \"The fin effectiveness is :\",round(E,2),\" .\"\nprint \"The maximum heat transfer rate from a single fin is :\",round(Qm,2),\" W .\"\nif E>2:\n print \"Since Ef = FCP>2, the use of the fin is justified.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi,sqrt\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Do = 50/10**3 #Outside diameter of tube (m)\n",
+ "t = 4/10**3 #Thickness of fin (m)\n",
+ "T = 20 #Fluid temperature (\u00b0C)\n",
+ "Tb = 200 #Surface temperature (\u00b0C)\n",
+ "h = 40 #Heat transfer coefficient (W/m^2.K)\n",
+ "k = 240 #Thermal conductivity of fin (W/m.K)\n",
+ "l = 15/10**3 #Length of fin (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "ro = Do/2 #Radius of tube (m)\n",
+ "rf = ro+l #Outside radius of fin (m)\n",
+ "Ab = 2*pi*ro*t #Area of the base of the fin (m^2)\n",
+ "Te = Tb-T #Excess temperature at the base of the fin (K)\n",
+ "Q1 = h*Ab*Te #Total heat transfer rate without the fin (W)\n",
+ "Bi = h*(t/2)/k #Biot number\n",
+ "L = rf-ro #Fin height (m)\n",
+ "rc = rf+t/2 #Corrected radius (m)\n",
+ "Lc = L+t/2 #Corrected height (m)\n",
+ "Ap = Lc*t #Profile area (m^2)\n",
+ "Af = 2*pi*(rc**2-ro**2) #Fin surface area (m^2)\n",
+ "Qm = h*Af*Te #Maximum fin heat transfer rate (W)\n",
+ "A = sqrt(Lc**3*h/(k*Ap)) #Abscissa of fin efficiency\n",
+ "C = rf/ro #Curve parameter of fin efficiency\n",
+ "#From figure 17.4:\n",
+ "nf = 0.97 #Fin efficiency\n",
+ "Qf = nf*Qm #Fin heat transfer rate (W)\n",
+ "R = Te/Qf #Fin resistance (K/W)\n",
+ "E = Qf/Q1 #Fin effectiveness\n",
+ "\n",
+ "#Result:\n",
+ "print \"The fin efficiency is :\",round(nf*100),\" % .\"\n",
+ "print \"The fin thermal resistance is :\",round(R,1),\" \u00b0C/W .\"\n",
+ "print \"The fin effectiveness is :\",round(E,2),\" .\"\n",
+ "print \"The maximum heat transfer rate from a single fin is :\",round(Qm,2),\" W .\"\n",
+ "if E>2:\n",
+ " print \"Since Ef = FCP>2, the use of the fin is justified.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The fin efficiency is : 97.0 % .\nThe fin thermal resistance is : 3.6 \u00b0C/W .\nThe fin effectiveness is : 11.05 .\nThe maximum heat transfer rate from a single fin is : 51.53 W .\nSince Ef = FCP>2, the use of the fin is justified.\n"
+ "text": [
+ "The fin efficiency is : 97.0 % .\n",
+ "The fin thermal resistance is : 3.6 \u00b0C/W .\n",
+ "The fin effectiveness is : 11.05 .\n",
+ "The maximum heat transfer rate from a single fin is : 51.53 W .\n",
+ "Since Ef = FCP>2, the use of the fin is justified.\n"
+ ]
}
],
"prompt_number": 17
@@ -269,19 +688,63 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.16, Page number: 376"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.16, Page number: 376"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''What is the rate of heat transfer per unit length of tube in the previous illustrative example, if\nthere are 125 such fins per meter of tube length? Also calculate the total efficiency and\neffectiveness.\n'''\n\nfrom __future__ import division\nfrom math import pi,sqrt\n\n#Variable declaration:\nNf = 125 #Array of fins per meter\nw = 1 #Length of fin (m)\n#From example 17.15:\nt = 4/10**3 #Thickness of fin (m)\nDo = 50/10**3 #Outside diameter of tube (m)\nAf = 7.157*10**-3 #Fin surface area (m^2)\nh = 40 #Heat transfer coefficient (W/m^2.K)\nDTb = 180 #Excess temperature at the base of the fin (K)\nQf = 50 #Fin heat transfer rate (W)\n\n#Calculation:\nro = Do/2 #Radius of tube (m)\nwb = w-Nf*t #Unfinned exposed base length (m)\nAb = 2*pi*ro*wb #Area of the base of the fin (m^2)\nAt = Ab+Nf*Af #Total heat transfer surface area (m^2)\nQw = h*(2*pi*ro*w)*DTb #Heat rate without fin (W)\nQb = h*Ab*DTb #Heat rate from the base (W)\nQft = Nf*Qf #Heat rate from the fin (W)\nQt = Qb+Qft #Total heat rate (W)\nQm = h*At*DTb #Maximum heat transfer rate (W)\nn = Qt/Qm #Overall fin efficiency\nE = Qt/Qw #Overall fin effectiveness\nRb = 1/(h*Ab) #Thermal resistance of base (\u00b0C/W)\nRf = 1/(h*Nf*Af*n) #Thermal resistance of fin (\u00b0C/W)\n\n#Result:\nprint \"The rate of heat transfer per unit length of tube is :\",round(Qt,1),\" W .\"\nprint \"Or, the rate of heat transfer per unit length of tube is :\",round(Qt/10**3,2),\" kW .\"\nprint \"The overall fin efficiency is :\",round(n*100,1),\" % .\"\nprint \"The overall fin effectiveness is :\",round(E,2),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi,sqrt\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Nf = 125 #Array of fins per meter\n",
+ "w = 1 #Length of fin (m)\n",
+ "#From example 17.15:\n",
+ "t = 4/10**3 #Thickness of fin (m)\n",
+ "Do = 50/10**3 #Outside diameter of tube (m)\n",
+ "Af = 7.157*10**-3 #Fin surface area (m^2)\n",
+ "h = 40 #Heat transfer coefficient (W/m^2.K)\n",
+ "DTb = 180 #Excess temperature at the base of the fin (K)\n",
+ "Qf = 50 #Fin heat transfer rate (W)\n",
+ "\n",
+ "#Calculation:\n",
+ "ro = Do/2 #Radius of tube (m)\n",
+ "wb = w-Nf*t #Unfinned exposed base length (m)\n",
+ "Ab = 2*pi*ro*wb #Area of the base of the fin (m^2)\n",
+ "At = Ab+Nf*Af #Total heat transfer surface area (m^2)\n",
+ "Qw = h*(2*pi*ro*w)*DTb #Heat rate without fin (W)\n",
+ "Qb = h*Ab*DTb #Heat rate from the base (W)\n",
+ "Qft = Nf*Qf #Heat rate from the fin (W)\n",
+ "Qt = Qb+Qft #Total heat rate (W)\n",
+ "Qm = h*At*DTb #Maximum heat transfer rate (W)\n",
+ "n = Qt/Qm #Overall fin efficiency\n",
+ "E = Qt/Qw #Overall fin effectiveness\n",
+ "Rb = 1/(h*Ab) #Thermal resistance of base (\u00b0C/W)\n",
+ "Rf = 1/(h*Nf*Af*n) #Thermal resistance of fin (\u00b0C/W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The rate of heat transfer per unit length of tube is :\",round(Qt,1),\" W .\"\n",
+ "print \"Or, the rate of heat transfer per unit length of tube is :\",round(Qt/10**3,2),\" kW .\"\n",
+ "print \"The overall fin efficiency is :\",round(n*100,1),\" % .\"\n",
+ "print \"The overall fin effectiveness is :\",round(E,2),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of heat transfer per unit length of tube is : 6815.5 W .\nOr, the rate of heat transfer per unit length of tube is : 6.82 kW .\nThe overall fin efficiency is : 97.3 % .\nThe overall fin effectiveness is : 6.03 .\n"
+ "text": [
+ "The rate of heat transfer per unit length of tube is : 6815.5 W .\n",
+ "Or, the rate of heat transfer per unit length of tube is : 6.82 kW .\n",
+ "The overall fin efficiency is : 97.3 % .\n",
+ "The overall fin effectiveness is : 6.03 .\n"
+ ]
}
],
"prompt_number": 2
@@ -290,19 +753,27 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.17, Page number: 377"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.17, Page number: 377"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A metal fin 1 inch high and 1/8 inch thick has a thermal conductivity, k, of 25 Btu/h.ft.\u00b0F and a\nuniform base temperature of 250\u00b0F. It is exposed to an air stream at 60\u00b0F with a velocity past\nthe fin such that the convection coefficient of heat transfer, h, is 15 Btu/h.ft.\u00b0F. Calculate the\ntemperature at the tip of the fin and the heat transfer from the fin per foot of fin. Solve the problem\nanalytically.\n'''\n#Variable declaration:\nprint 'Analytical Solution'",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "print 'Analytical Solution'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Analytical Solution\n"
+ "text": [
+ "Analytical Solution\n"
+ ]
}
],
"prompt_number": 19
@@ -311,19 +782,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 17.18, Page number: 379"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 17.18, Page number: 379"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Estimate the fin efficiency in the previous example, if the efficiency is defined (as noted earlier)\nas the actual heat transfer divided by the heat rate of the entire fin with the same temperature as its\nbase.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\n#From example 17.18:\nT = 250 #Base temperature of fin (\u00b0F)\nh = 15 #Convection coefficient of heat transfer (Btu/h.ft.\u00b0F)\nw = 1 #Base width of fin (ft)\nt = 1 #Thickness of fin (in)\nH = 1/8 #Height of fin (in)\nl = 1 #Length of fin (in)\nQ = 357.2 #Heat transfer rate (Btu/h.ft)\n\n#Calculation:\nA = (l*w+t*w+H*w)/12 #Heat transfer area of fin (ft^2)\nQm = h*A*(T-70) #Maximum heat transfer rate (Btu/h.ft)\nn = Q/Qm*100 #Fin efficiency\n\n#Result:\nprint \"The fin efficiency is :\",round(n,1),\" % .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 17.18:\n",
+ "T = 250 #Base temperature of fin (\u00b0F)\n",
+ "h = 15 #Convection coefficient of heat transfer (Btu/h.ft.\u00b0F)\n",
+ "w = 1 #Base width of fin (ft)\n",
+ "t = 1 #Thickness of fin (in)\n",
+ "H = 1/8 #Height of fin (in)\n",
+ "l = 1 #Length of fin (in)\n",
+ "Q = 357.2 #Heat transfer rate (Btu/h.ft)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = (l*w+t*w+H*w)/12 #Heat transfer area of fin (ft^2)\n",
+ "Qm = h*A*(T-70) #Maximum heat transfer rate (Btu/h.ft)\n",
+ "n = Q/Qm*100 #Fin efficiency\n",
+ "\n",
+ "#Result:\n",
+ "print \"The fin efficiency is :\",round(n,1),\" % .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The fin efficiency is : 74.7 % .\n"
+ "text": [
+ "The fin efficiency is : 74.7 % .\n"
+ ]
}
],
"prompt_number": 20
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_18.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_18.ipynb
index d5d13bdf..61e88510 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_18.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_18.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 18"
+ "name": "",
+ "signature": "sha256:4239ad8a8aef7d8398d3c69721341c39df37be6f21def1df2b04a8d6ccbef700"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,56 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 18: Other Heat Exchange Equipment"
+ "source": [
+ "Chapter 18: Other Heat Exchange Equipment"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.2, Page number: 384"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.2, Page number: 384"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the temperature when 50 lb of pure H2SO4 at 25\u00b0C is mixed adiabatically with 200 lb\nof a 50% by weight aqueous H2SO4 solution at 25\u00b0C. Also calculate the heat effect if the final\nmixture is at 25\u00b0C.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nT1 = 25 #Temperature of H2SO4 (\u00b0C)\nm = 50+200 #Mass of H2SO4 (lb)\n#From figure 18.2:\nW1 = 50+100 #Weight of H2SO4 (lb)\nW2 = 100 #Weight of H2O (lb)\n\n#Calculation:\nm = W1/(W1+W2)*100 #Percent weight of H2SO4 (%)\nm2 = W1+W2 #Mass of mixture (lb)\n#From fgure 18.2:\nT2 = 140 #Final temperature between the 50% solution and pure H2SO4 at 25\u00b0C (\u00b0F)\nh1 = -86 #Specific heat capacity of H2O (Btu/lb)\nh2 = -121.5 #Specific heat capacity of H2SO4 (Btu/lb)\nQ = m2*(h2-h1) #Heat transferred (Btu)\n\n#Result:\nprint \"The final temperature between the 50% solution and pure H2SO4 at 25\u00b0C is :\",round(T2),\" \u00b0F .\"\nprint \"The heat transferred is :\",round(Q),\" Btu .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 25 #Temperature of H2SO4 (\u00b0C)\n",
+ "m = 50+200 #Mass of H2SO4 (lb)\n",
+ "#From figure 18.2:\n",
+ "W1 = 50+100 #Weight of H2SO4 (lb)\n",
+ "W2 = 100 #Weight of H2O (lb)\n",
+ "\n",
+ "#Calculation:\n",
+ "m = W1/(W1+W2)*100 #Percent weight of H2SO4 (%)\n",
+ "m2 = W1+W2 #Mass of mixture (lb)\n",
+ "#From fgure 18.2:\n",
+ "T2 = 140 #Final temperature between the 50% solution and pure H2SO4 at 25\u00b0C (\u00b0F)\n",
+ "h1 = -86 #Specific heat capacity of H2O (Btu/lb)\n",
+ "h2 = -121.5 #Specific heat capacity of H2SO4 (Btu/lb)\n",
+ "Q = m2*(h2-h1) #Heat transferred (Btu)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The final temperature between the 50% solution and pure H2SO4 at 25\u00b0C is :\",round(T2),\" \u00b0F .\"\n",
+ "print \"The heat transferred is :\",round(Q),\" Btu .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The final temperature between the 50% solution and pure H2SO4 at 25\u00b0C is : 140.0 \u00b0F .\nThe heat transferred is : -8875.0 Btu .\n"
+ "text": [
+ "The final temperature between the 50% solution and pure H2SO4 at 25\u00b0C is : 140.0 \u00b0F .\n",
+ "The heat transferred is : -8875.0 Btu .\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +70,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.3, Page number: 386"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.3, Page number: 386"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A single-effect evaporator is to concentrate 10,000 lb/h of a 10% NaOH solution to 75%. The\nfeed enters at 120\u00b0F and the evaporator is to operate at an absolute pressure of 14.7 psi. The 75%\nNaOH solution leaves at the evaporator equilibrium temperature. For what heat transfer rate\n(Btu/h) should the evaporator be designed? Also calculate the area requirement in the evaporator\nif the overall heat transfer coefficient is 500 Btu/h.ft^2.\u00b0F and 103 psig (340\u00b0F) saturated\nsteam is employed in the steam chest. The NaOH\u2013H2O enthalpy-concentration diagram is provided\nin Figure 18.3. The enthalpy of saturated steam at 14.7 psia is approximately 1150 Btu/lb.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nF = 10000 #Mass flow rate of NaOH (lb/h)\nC1 = 10 #Old concentration of NaOH solution (%)\nC2 = 75 #New concentration of NaOH solution (%)\nh1 = 1150 #Enthalpy of saturated steam at 14.7 psia (Btu/lb)\nU = 500 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\nT1 = 212 #Absolute temperature of evaporator (\u00b0F)\nT2 = 340 #Saturated steam temperature (\u00b0F)\n\n#Calculation:\nL = F*(C1/100)/(C2/100) #Flow rate of steam leaving the evaporator (lb/h)\nV = F-L #Overall material balance (lb/h)\n#From figure 18.3:\nhF = 81 #Enthalpy of solution entering the unit (Btu/lb)\nhL = 395 #Enthalpy of the 75% NaOH solution (Btu/lb)\nQ = round(V)*h1+round(L)*hL-F*hF #Evaporator heat required (Btu/h)\nA = Q/(U*(T2-T1)) #Area of the evaporaor (ft^2)\n\n#Result:\nprint \"The heat transfer rate required for the evaporator is :\",round(Q,-2),\" Btu/h .\"\nprint \"The area requirement in the evaporator is :\",round(A,1),\" ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "F = 10000 #Mass flow rate of NaOH (lb/h)\n",
+ "C1 = 10 #Old concentration of NaOH solution (%)\n",
+ "C2 = 75 #New concentration of NaOH solution (%)\n",
+ "h1 = 1150 #Enthalpy of saturated steam at 14.7 psia (Btu/lb)\n",
+ "U = 500 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "T1 = 212 #Absolute temperature of evaporator (\u00b0F)\n",
+ "T2 = 340 #Saturated steam temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "L = F*(C1/100)/(C2/100) #Flow rate of steam leaving the evaporator (lb/h)\n",
+ "V = F-L #Overall material balance (lb/h)\n",
+ "#From figure 18.3:\n",
+ "hF = 81 #Enthalpy of solution entering the unit (Btu/lb)\n",
+ "hL = 395 #Enthalpy of the 75% NaOH solution (Btu/lb)\n",
+ "Q = round(V)*h1+round(L)*hL-F*hF #Evaporator heat required (Btu/h)\n",
+ "A = Q/(U*(T2-T1)) #Area of the evaporaor (ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat transfer rate required for the evaporator is :\",round(Q,-2),\" Btu/h .\"\n",
+ "print \"The area requirement in the evaporator is :\",round(A,1),\" ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat transfer rate required for the evaporator is : 9683600.0 Btu/h .\nThe area requirement in the evaporator is : 151.3 ft^2 .\n"
+ "text": [
+ "The heat transfer rate required for the evaporator is : 9683600.0 Btu/h .\n",
+ "The area requirement in the evaporator is : 151.3 ft^2 .\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +122,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.4, Page number: 388"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.4, Page number: 388"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Given the triple-effect evaporator information below, calculate the temperature drop across the\nheating surface in the first effect:\nEffect U, Btu/h.ft^2.\u00b0F A, ft^3\n1 240 125\n2 200 150\n3 125 160\nThe condensing stream temperature in the first effect and the vapor leaving the third effect are\n400\u00b0F and 120\u00b0F, respectively.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nU1 = 240 #Overall heat transfer coefficient for first effect (Btu/h.ft^2.\u00b0F)\nU2 = 200 #Overall heat transfer coefficient for second effect (Btu/h.ft^2.\u00b0F)\nU3 = 125 #Overall heat transfer coefficient for third effect (Btu/h.ft^2.\u00b0F)\nA1 = 125 #Heating surface area in first effect (ft^3)\nA2 = 150 #Heating surface area in second effect (ft^3)\nA3 = 160 #Heating surface area in third effect (ft^3)\nT1 = 400 #Condensation stream temperature in the first effect (\u00b0F)\nT2 = 120 #Vapor leaving temperature in the first effect (\u00b0F)\n\n#Calculation:\nR1 = 1/(U1*A1) #Resistance across first effect\nR2 = 1/(U2*A2) #Resistance across second effect\nR3 = 1/(U3*A3) #Resistance across third effect\nR = R1+R2+R3 #Total resistance\nDT1 = (R1/R)*(T1-T2) #Temperature drop across the heating surface in the first effect (\u00b0F)\n\n#Result:\nprint \"The temperature drop across the heating surface in the first effect is :\",round(DT1),\" \u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "U1 = 240 #Overall heat transfer coefficient for first effect (Btu/h.ft^2.\u00b0F)\n",
+ "U2 = 200 #Overall heat transfer coefficient for second effect (Btu/h.ft^2.\u00b0F)\n",
+ "U3 = 125 #Overall heat transfer coefficient for third effect (Btu/h.ft^2.\u00b0F)\n",
+ "A1 = 125 #Heating surface area in first effect (ft^3)\n",
+ "A2 = 150 #Heating surface area in second effect (ft^3)\n",
+ "A3 = 160 #Heating surface area in third effect (ft^3)\n",
+ "T1 = 400 #Condensation stream temperature in the first effect (\u00b0F)\n",
+ "T2 = 120 #Vapor leaving temperature in the first effect (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "R1 = 1/(U1*A1) #Resistance across first effect\n",
+ "R2 = 1/(U2*A2) #Resistance across second effect\n",
+ "R3 = 1/(U3*A3) #Resistance across third effect\n",
+ "R = R1+R2+R3 #Total resistance\n",
+ "DT1 = (R1/R)*(T1-T2) #Temperature drop across the heating surface in the first effect (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The temperature drop across the heating surface in the first effect is :\",round(DT1),\" \u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The temperature drop across the heating surface in the first effect is : 80.0 \u00b0F .\n"
+ "text": [
+ "The temperature drop across the heating surface in the first effect is : 80.0 \u00b0F .\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +171,61 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.6, Page number: 389"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.6, Page number: 389"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An evaporator is to be fed with 5000 lb of solution containing 2% solids by weight. The feed,\nF, is at a temperature of 100\u00b0F. It is to be concentrated to a solution of 5% solute by weight in\nan evaporator operating at a pressure of 1 atm in the vapor space. In order to carry out the\nevaporation, the heating surface is supplied with steam at 5 psig (227\u00b0F) and the overall heat\ntransfer coefficient of the evaporator, U, is 280 Btu/h.ft^2.\u00b0F. What is the mass of vapor\nproduced, the total mass of steam required, and the surface area required? Neglect enthalpy\nof solution effects.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nF = 5000 #Mass of soltuion fed in the evaporator (lb)\nxF = 2/100 #Concentration of feed\nxL = 5/100 #Concentration of liquor\nU = 280 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n#From figure 18.1 & 18.3:\nTF = 100 #Feed temperature (\u00b0F)\nTS = 227 #Steam temperature (\u00b0F)\nTV = 212 #Vapour temperature (\u00b0F)\nTL = 212 #Liquor temperature (\u00b0F)\nTC = 227 #Condensate temperature (\u00b0F)\n\n#Calculation:\n#From steam tables:\nhF = 68 #Enthalpy of feed (Btu/lb)\nhL = 180 #Enthalpy of liquor (Btu/lb)\nhV = 1150 #Enthalpy of vapour (Btu/lb)\nhS = 1156 #Enthalpy of steam (Btu/lb)\nhC = 195 #Enthalpy of condensate (Btu/lb)\ns1 = F*xF #Total solids in feed (lb)\nw = F-s1 #Total water in feed (lb)\ns2 = F*xF #Total solids in liquor (lb)\nL = s2/xL #Total water in liquor (lb)\nV = F-L #Overall balance (lb)\nS = (V*hV+L*hL-F*hF)/(hS-hC) #Mass of steam (lb)\nQ = S*(hS-hC) #Total heat requirement (Btu)\nA = Q/(U*(TS-TL)) #Required surface aea (ft^2)\n\n#Result:\nprint \"The mass of vapor produced is :\",round(V),\" lb .\"\nprint \"The total mass of steam required is :\",round(S),\" lb .\"\nprint \"The surface area required is :\",round(A),\" ft^2 .\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "F = 5000 #Mass of soltuion fed in the evaporator (lb)\n",
+ "xF = 2/100 #Concentration of feed\n",
+ "xL = 5/100 #Concentration of liquor\n",
+ "U = 280 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "#From figure 18.1 & 18.3:\n",
+ "TF = 100 #Feed temperature (\u00b0F)\n",
+ "TS = 227 #Steam temperature (\u00b0F)\n",
+ "TV = 212 #Vapour temperature (\u00b0F)\n",
+ "TL = 212 #Liquor temperature (\u00b0F)\n",
+ "TC = 227 #Condensate temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "#From steam tables:\n",
+ "hF = 68 #Enthalpy of feed (Btu/lb)\n",
+ "hL = 180 #Enthalpy of liquor (Btu/lb)\n",
+ "hV = 1150 #Enthalpy of vapour (Btu/lb)\n",
+ "hS = 1156 #Enthalpy of steam (Btu/lb)\n",
+ "hC = 195 #Enthalpy of condensate (Btu/lb)\n",
+ "s1 = F*xF #Total solids in feed (lb)\n",
+ "w = F-s1 #Total water in feed (lb)\n",
+ "s2 = F*xF #Total solids in liquor (lb)\n",
+ "L = s2/xL #Total water in liquor (lb)\n",
+ "V = F-L #Overall balance (lb)\n",
+ "S = (V*hV+L*hL-F*hF)/(hS-hC) #Mass of steam (lb)\n",
+ "Q = S*(hS-hC) #Total heat requirement (Btu)\n",
+ "A = Q/(U*(TS-TL)) #Required surface aea (ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The mass of vapor produced is :\",round(V),\" lb .\"\n",
+ "print \"The total mass of steam required is :\",round(S),\" lb .\"\n",
+ "print \"The surface area required is :\",round(A),\" ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The mass of vapor produced is : 3000.0 lb .\nThe total mass of steam required is : 3611.0 lb .\nThe surface area required is : 826.0 ft^2 .\n"
+ "text": [
+ "The mass of vapor produced is : 3000.0 lb .\n",
+ "The total mass of steam required is : 3611.0 lb .\n",
+ "The surface area required is : 826.0 ft^2 .\n"
+ ]
}
],
"prompt_number": 6
@@ -101,19 +234,62 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.7, Page number: 390"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.7, Page number: 390"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An evaporator is fed with 5000 lb/h of a 20% solution of sodium hydroxide at 100\u00b0F. This is to\nbe concentrated to a 40% solution. The evaporator is supplied with saturated steam at 5 psig.\nAlthough the unit operates with the vapor space at a pressure of 4 in Hg absolute, the boiling\ntemperature of the solution in the evaporator is 198\u00b0F (due to the superheat created by the\nexposed heating element). The overall heat transfer coefficient is 400 Btu/h.ft^2.\u00b0F.\nCalculate the steam rate and the required heat transfer area.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nF = 5000 #Mass flow rate of NaOH (lb/h)\nxF = 20/100 #Old concentration of NaOH solution\nTF = 100 #Feed temperature (\u00b0F)\nxL = 40/100 #New concentration of NaOH solution\nxv = 0 #Vapour concentration at x\nyv = 0 #Vapour concentration at y\nT1 = 198 #Boiling temperature of solution in the evaporator (\u00b0F)\nT2 = 125 #Saturated steam temperature (\u00b0F)\nU = 400 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\nTs = 228 #Steam temperature (\u00b0F)\n\n#Calculation:\n#From steam tables at 228\u00b0F and 5 psig:\nhS = 1156 #Enthalpy of steam (Btu/lb)\nhC = 196 #Enthalpy of condensate (Btu/lb)\nhV = hS-hC #Enthalpy of vapour (Btu/lb)\nTw = 125.4 #Boiling point of water at 4 in Hg absolute (\u00b0F)\nhS2 = 1116 #Enthalpy of saturated steam at 125\u00b0F (Btu/lb)\nhs = 0.46 #Heat capacity of superheated steam (Btu/lb.\u00b0F)\n#From figure 18.3:\nhF = 55 #Enthalpy of feed (Btu/lb)\nhL = 177 #Enthalpy of liquor (Btu/lb)\nL = F*xF/xL #Mass of liquor (lb)\nV = L #Mass of vapour (lb)\nhV = hS2+hs*(T1-T2) #Enthalpy of vapour leaving the solution (Btu/lb)\nS = (V*hV+L*hL-F*hF)/(hS-hC) #Mass flow rate of steam (lb/h)\nQ = S*(hS-hC) #Total heat requirement (Btu)\nA = Q/(U*(Ts-T1)) #Required heat transfer area (ft^2)\n\n#Result:\nprint \"The steam flow rate is :\",round(S,-1),\" lb/h .\"\nprint \"The required heat transfer area is :\",round(A),\" ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "F = 5000 #Mass flow rate of NaOH (lb/h)\n",
+ "xF = 20/100 #Old concentration of NaOH solution\n",
+ "TF = 100 #Feed temperature (\u00b0F)\n",
+ "xL = 40/100 #New concentration of NaOH solution\n",
+ "xv = 0 #Vapour concentration at x\n",
+ "yv = 0 #Vapour concentration at y\n",
+ "T1 = 198 #Boiling temperature of solution in the evaporator (\u00b0F)\n",
+ "T2 = 125 #Saturated steam temperature (\u00b0F)\n",
+ "U = 400 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "Ts = 228 #Steam temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "#From steam tables at 228\u00b0F and 5 psig:\n",
+ "hS = 1156 #Enthalpy of steam (Btu/lb)\n",
+ "hC = 196 #Enthalpy of condensate (Btu/lb)\n",
+ "hV = hS-hC #Enthalpy of vapour (Btu/lb)\n",
+ "Tw = 125.4 #Boiling point of water at 4 in Hg absolute (\u00b0F)\n",
+ "hS2 = 1116 #Enthalpy of saturated steam at 125\u00b0F (Btu/lb)\n",
+ "hs = 0.46 #Heat capacity of superheated steam (Btu/lb.\u00b0F)\n",
+ "#From figure 18.3:\n",
+ "hF = 55 #Enthalpy of feed (Btu/lb)\n",
+ "hL = 177 #Enthalpy of liquor (Btu/lb)\n",
+ "L = F*xF/xL #Mass of liquor (lb)\n",
+ "V = L #Mass of vapour (lb)\n",
+ "hV = hS2+hs*(T1-T2) #Enthalpy of vapour leaving the solution (Btu/lb)\n",
+ "S = (V*hV+L*hL-F*hF)/(hS-hC) #Mass flow rate of steam (lb/h)\n",
+ "Q = S*(hS-hC) #Total heat requirement (Btu)\n",
+ "A = Q/(U*(Ts-T1)) #Required heat transfer area (ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The steam flow rate is :\",round(S,-1),\" lb/h .\"\n",
+ "print \"The required heat transfer area is :\",round(A),\" ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The steam flow rate is : 3170.0 lb/h .\nThe required heat transfer area is : 253.0 ft^2 .\n"
+ "text": [
+ "The steam flow rate is : 3170.0 lb/h .\n",
+ "The required heat transfer area is : 253.0 ft^2 .\n"
+ ]
}
],
"prompt_number": 7
@@ -122,19 +298,51 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.10, Page number: 398"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.10, Page number: 398"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Using Ganapathy\u2019s method, determine the required \u201clength\u201d of a waste heat boiler to be used to\ncool hot gases (average heat capacity = 0.279 Btu/lb.\u00b0F) from 2000 to 550\u00b0F and generate\n30,000 lb/h of steam at 3308F from water at 140\u00b0F. The boiler contains 800 1.5-inch ID tubes.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nT1 = 2000 #Hot gas temperature (\u00b0F)\nT2 = 550 #Cool gas temperature (\u00b0F)\nT3 = 330 #Steam temperature (\u00b0F)\nT4 = 140 #Water temperature (\u00b0F)\nm = 30000 #Mass flow rate of steam (lb/h)\ncp = 0.279 #Average heat capacity of gas (Btu/lb.\u00b0F)\nN = 800 #Number of boiler tubes\n\n#Calculation:\nDT = (T1-T3)/(T2-T3) #Temperature difference ratio\nTav = (T1+T2)/2 #Average gas temperature (\u00b0F)\n#From steam tables (Appendix):\nhs = 1187.7 #Steam enthalpy (Btu/lb)\nhw = 107.89 #Water enthalpy (Btu/lb)\nQ = m*(hs-hw) #Heat duty (Btu/h)\nmh = Q/cp*(T1-T2) #Mass flow rate of gas (lb/h)\nx = mh/N #Gas mass flow rate per tube (lb/h)\n#From figure 18.5:\nL = 15 #Length of boiler tubes (ft)\n\n#Result:\nprint \"The length of boiler tubes is :\",L,\" ft .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 2000 #Hot gas temperature (\u00b0F)\n",
+ "T2 = 550 #Cool gas temperature (\u00b0F)\n",
+ "T3 = 330 #Steam temperature (\u00b0F)\n",
+ "T4 = 140 #Water temperature (\u00b0F)\n",
+ "m = 30000 #Mass flow rate of steam (lb/h)\n",
+ "cp = 0.279 #Average heat capacity of gas (Btu/lb.\u00b0F)\n",
+ "N = 800 #Number of boiler tubes\n",
+ "\n",
+ "#Calculation:\n",
+ "DT = (T1-T3)/(T2-T3) #Temperature difference ratio\n",
+ "Tav = (T1+T2)/2 #Average gas temperature (\u00b0F)\n",
+ "#From steam tables (Appendix):\n",
+ "hs = 1187.7 #Steam enthalpy (Btu/lb)\n",
+ "hw = 107.89 #Water enthalpy (Btu/lb)\n",
+ "Q = m*(hs-hw) #Heat duty (Btu/h)\n",
+ "mh = Q/cp*(T1-T2) #Mass flow rate of gas (lb/h)\n",
+ "x = mh/N #Gas mass flow rate per tube (lb/h)\n",
+ "#From figure 18.5:\n",
+ "L = 15 #Length of boiler tubes (ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The length of boiler tubes is :\",L,\" ft .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The length of boiler tubes is : 15 ft .\n"
+ "text": [
+ "The length of boiler tubes is : 15 ft .\n"
+ ]
}
],
"prompt_number": 10
@@ -143,19 +351,58 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.12, Page number: 399"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.12, Page number: 399"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''120,000 lb/h of flue gas from an incinerator is to be cooled from 1800 to 500\u00b0F in a waste heat\nboiler. If 2-inch ID tubes and a flow rate of 150 lb/h through each tube is to be used, estimate the\nrequired heat transfer area, tube length, heat duty, and water mass flow rate. Water at 200\u00b0F is\navailable for the steam generator; saturated steam at 80 psia is needed. The average heat capacity\nof the flue gas is 0.26 Btu/lb.\u00b0F. Use Ganapathy\u2019s method to solve the problem.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nT1 = 1800 #Hot gas temperature (\u00b0F)\nT2 = 500 #Cool gas temperature (\u00b0F)\n#From steam tables:\nTw = 312 #Boiling point of water at 80 psia (\u00b0F)\nm1 = 120000 #Mass flow rate of flue gas (lb/h)\nD = 2/12 #Inside diameter of tube (ft)\ncp = 0.26 #Average heat capacity of flue gas (Btu/lb.\u00b0F)\n\n#Calculation:\nDT = (T1-Tw)/(T2-Tw) #Temperature difference ratio\nTav = (T1+T2)/2 #Average gas temperature (\u00b0F)\n#From figure 18.4:\nx = 150 #Gas mass flow rate per tube (m/N) (lb/h)\nN = m1/x #Number of tubes\nL = 21.5 #Length of tubes (ft)\nA = N*L*D #Total heat transfer area (ft^2)\nQ = m1*cp*(T1-T2) #Heat duty (Btu/h)\n#From steam tables (Appendix):\nhs = 1183.1 #Steam enthalpy at 80 psia (Btu/lb)\nhw = 168.1 #Water enthalpy at 200\u00b0F (Btu/lb)\nm2 = Q/(hs-hw) #Mass flow rate of water (lb/h)\n\n#Result:\nprint \"The required heat transfer area is :\",round(A),\" ft^2 .\"\nprint \"The tube length is :\",L,\" ft .\"\nprint \"The heat duty is :\",round(Q/10**7,2),\" x 10^7 .\"\nprint \"The water mass flow rate is :\",round(m2,-4),\" lb/h .\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T1 = 1800 #Hot gas temperature (\u00b0F)\n",
+ "T2 = 500 #Cool gas temperature (\u00b0F)\n",
+ "#From steam tables:\n",
+ "Tw = 312 #Boiling point of water at 80 psia (\u00b0F)\n",
+ "m1 = 120000 #Mass flow rate of flue gas (lb/h)\n",
+ "D = 2/12 #Inside diameter of tube (ft)\n",
+ "cp = 0.26 #Average heat capacity of flue gas (Btu/lb.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT = (T1-Tw)/(T2-Tw) #Temperature difference ratio\n",
+ "Tav = (T1+T2)/2 #Average gas temperature (\u00b0F)\n",
+ "#From figure 18.4:\n",
+ "x = 150 #Gas mass flow rate per tube (m/N) (lb/h)\n",
+ "N = m1/x #Number of tubes\n",
+ "L = 21.5 #Length of tubes (ft)\n",
+ "A = N*L*D #Total heat transfer area (ft^2)\n",
+ "Q = m1*cp*(T1-T2) #Heat duty (Btu/h)\n",
+ "#From steam tables (Appendix):\n",
+ "hs = 1183.1 #Steam enthalpy at 80 psia (Btu/lb)\n",
+ "hw = 168.1 #Water enthalpy at 200\u00b0F (Btu/lb)\n",
+ "m2 = Q/(hs-hw) #Mass flow rate of water (lb/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The required heat transfer area is :\",round(A),\" ft^2 .\"\n",
+ "print \"The tube length is :\",L,\" ft .\"\n",
+ "print \"The heat duty is :\",round(Q/10**7,2),\" x 10^7 .\"\n",
+ "print \"The water mass flow rate is :\",round(m2,-4),\" lb/h .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The required heat transfer area is : 2867.0 ft^2 .\nThe tube length is : 21.5 ft .\nThe heat duty is : 4.06 x 10^7 .\nThe water mass flow rate is : 40000.0 lb/h .\n"
+ "text": [
+ "The required heat transfer area is : 2867.0 ft^2 .\n",
+ "The tube length is : 21.5 ft .\n",
+ "The heat duty is : 4.06 x 10^7 .\n",
+ "The water mass flow rate is : 40000.0 lb/h .\n"
+ ]
}
],
"prompt_number": 12
@@ -164,19 +411,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.18, Page number: 407"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.18, Page number: 407"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''It is proposed to cool 144,206 lb/h of a hot flue combustion gas by using ambient air at 70\u00b0F.\nCalculate the quantity (mass, mole, and volume basis) of air required to cool the gases from\n2050\u00b0F to an acceptable temperature of 560\u00b0F. Assume an average flue gas heat capacity of\n0.3 Btu/lb.\u00b0F.\n'''\n\n#Variable declaration:\nm1 = 144206 #Mass flow rate of flue gas (lb/h)\ncp = 0.3 #Average flue gas heat capacity (Btu/lb.\u00b0F)\nT1 = 2050 #Initial temperature of gas (\u00b0F)\nT2 = 560 #Final temperature of gas (\u00b0F)\nT3 = 70 #Ambient air temperature (\u00b0F)\n\n#Calculation:\nQ = m1*cp*(T1-T2) #Duty rate (Btu/h)\n#From appendix:\ncpa = 0.243 #Average ambient air heat capacity 70\u00b0F (Btu/lb.\u00b0F)\nMW = 29 #Molecular weight of air at 70\u00b0F\nma = round(Q,-5)/(cpa*(T2-T3)) #Mass of air required (lb/h)\nm2 = round(ma)/MW #Moles of air required (lb mol/h)\nm3 = round(ma)*13.32 #Volume of air required (ft^3/h)\n\n#Result:\nprint \"The mass of air required is :\",round(ma,-2),\" lb/h .\"\nprint \"The moles of air required is :\",round(m2,-1),\"lb mol/h .\"\nprint \"The volume of air required is :\",round(m3,-3),\" ft^3/h .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "m1 = 144206 #Mass flow rate of flue gas (lb/h)\n",
+ "cp = 0.3 #Average flue gas heat capacity (Btu/lb.\u00b0F)\n",
+ "T1 = 2050 #Initial temperature of gas (\u00b0F)\n",
+ "T2 = 560 #Final temperature of gas (\u00b0F)\n",
+ "T3 = 70 #Ambient air temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = m1*cp*(T1-T2) #Duty rate (Btu/h)\n",
+ "#From appendix:\n",
+ "cpa = 0.243 #Average ambient air heat capacity 70\u00b0F (Btu/lb.\u00b0F)\n",
+ "MW = 29 #Molecular weight of air at 70\u00b0F\n",
+ "ma = round(Q,-5)/(cpa*(T2-T3)) #Mass of air required (lb/h)\n",
+ "m2 = round(ma)/MW #Moles of air required (lb mol/h)\n",
+ "m3 = round(ma)*13.32 #Volume of air required (ft^3/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The mass of air required is :\",round(ma,-2),\" lb/h .\"\n",
+ "print \"The moles of air required is :\",round(m2,-1),\"lb mol/h .\"\n",
+ "print \"The volume of air required is :\",round(m3,-3),\" ft^3/h .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The mass of air required is : 541700.0 lb/h .\nThe moles of air required is : 18680.0 lb mol/h .\nThe volume of air required is : 7215000.0 ft^3/h .\n"
+ "text": [
+ "The mass of air required is : 541700.0 lb/h .\n",
+ "The moles of air required is : 18680.0 lb mol/h .\n",
+ "The volume of air required is : 7215000.0 ft^3/h .\n"
+ ]
}
],
"prompt_number": 18
@@ -185,19 +461,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.19, Page number: 407"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.19, Page number: 407"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Design the air quench tank in the previous example if a 1.5-s residence time is required.'''\n\n#Variable declaration:\n#From example 18.19:\nm1 = 144200 #Mass flow rate of flue gas (lb/h)\nm2 = 541700 #Mass flow rate of air (lb/h)\nR = 0.73 #Universal gas constant (psia.ft^3/lbmol.\u00b0R)\nP = 1 #Absolute pressure (psia)\nT = 1020 #Absolute temperature (\u00b0R)\nMW = 29 #Molecular weight of air\nt = 1.5 #Residence time (s)\n\n#Calculation:\nm = m1+m2 #Total mass flow rate of the gas (lb/h)\nq = m*R*T/(P*MW) #Volumetric flow at 560\u00b0F (ft^3/h)\nV = q*t/3600 #Volume of tank (ft^3)\n\n#Result:\nprint \"The total mass flow rate of the gas is :\",round(m,-2),\" lb/h .\"\nprint \"The volumetric flow at 560\u00b0F is :\",round(q/10**7,2),\" x 10^7 ft^3/h .\"\nprint \"The volume of tank is :\",round(V),\" ft^3 .\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 18.19:\n",
+ "m1 = 144200 #Mass flow rate of flue gas (lb/h)\n",
+ "m2 = 541700 #Mass flow rate of air (lb/h)\n",
+ "R = 0.73 #Universal gas constant (psia.ft^3/lbmol.\u00b0R)\n",
+ "P = 1 #Absolute pressure (psia)\n",
+ "T = 1020 #Absolute temperature (\u00b0R)\n",
+ "MW = 29 #Molecular weight of air\n",
+ "t = 1.5 #Residence time (s)\n",
+ "\n",
+ "#Calculation:\n",
+ "m = m1+m2 #Total mass flow rate of the gas (lb/h)\n",
+ "q = m*R*T/(P*MW) #Volumetric flow at 560\u00b0F (ft^3/h)\n",
+ "V = q*t/3600 #Volume of tank (ft^3)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The total mass flow rate of the gas is :\",round(m,-2),\" lb/h .\"\n",
+ "print \"The volumetric flow at 560\u00b0F is :\",round(q/10**7,2),\" x 10^7 ft^3/h .\"\n",
+ "print \"The volume of tank is :\",round(V),\" ft^3 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The total mass flow rate of the gas is : 685900.0 lb/h .\nThe volumetric flow at 560\u00b0F is : 1.76 x 10^7 ft^3/h .\nThe volume of tank is : 7338.0 ft^3 .\n"
+ "text": [
+ "The total mass flow rate of the gas is : 685900.0 lb/h .\n",
+ "The volumetric flow at 560\u00b0F is : 1.76 x 10^7 ft^3/h .\n",
+ "The volume of tank is : 7338.0 ft^3 .\n"
+ ]
}
],
"prompt_number": 19
@@ -206,19 +509,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.20, Page number: 408"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.20, Page number: 408"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the physical dimensions of the tank in the previous example.'''\n\nfrom __future__ import division\nfrom math import pi\n\n#Variable declaration:\n#Fro example 18.20:\nV = 7335 #Volume of tank (ft^3)\n\n#Calculation:\nD = (4*V/pi)**(1/3) #Diameter of tank (ft)\nH = D #Height of tube (ft)\n\n#Result:\nprint \"The diameter of tank is :\",round(H,2),\" ft .\"\nprint \"The height of tube is :\",round(D,2),\" ft .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#Fro example 18.20:\n",
+ "V = 7335 #Volume of tank (ft^3)\n",
+ "\n",
+ "#Calculation:\n",
+ "D = (4*V/pi)**(1/3) #Diameter of tank (ft)\n",
+ "H = D #Height of tube (ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The diameter of tank is :\",round(H,2),\" ft .\"\n",
+ "print \"The height of tube is :\",round(D,2),\" ft .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The diameter of tank is : 21.06 ft .\nThe height of tube is : 21.06 ft .\n"
+ "text": [
+ "The diameter of tank is : 21.06 ft .\n",
+ "The height of tube is : 21.06 ft .\n"
+ ]
}
],
"prompt_number": 21
@@ -227,19 +552,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.21, Page number: 408"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.21, Page number: 408"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''It is proposed to reduce the temperature of 10% of the 144,206 lb/h of flue gas described\nin Illustrative Example 18.18 to 5508F using a solids contact method that operates on a 1-h\ncooling cycle. Assume the average heat capacities of the flue gas and solid to be 0.3 and\n0.88 Btu/lb.\u00b0F, respectively, over the temperature range in question. The initial temperature\nof the solids is 70\u00b0F. Assuming an approach temperature of 40\u00b0F, what mass of solid must be\nprovided in order to cool the flue gas to the required temperature during each hour of operation.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nm1 = 144206 #Mass flow rate of flue gas (lb/h)\ncp1 = 0.3 #Average heat capacities of the flue gas (Btu/lb\u00b0F)\ncp2 = 0.88 #Average heat capacities of the solid (Btu/lb\u00b0F)\n#From example 18.18:\nT1 = 550 #Initial temperature of gas (\u00b0F)\nT2 = 2050 #Final temperature of gas (\u00b0F)\nT3 = 70 #Initial temperature of solid (\u00b0F)\nT4 = 550-40 #Final temperature of solid (\u00b0F)\n\n#Calculation:\nDhf = m1*cp1*(T2-T1) #For the flue gas, the enthalpy change for one hour of operation (Btu)\nDhs = round(Dhf,-4) #For the solids, the enthalpy change for one hour of operation (Btu)\nm2 = Dhs/(cp2*(T4-T3)) #Mass of solid (lb)\n\n#Result:\nprint \"The mass of solid is :\",round(m2),\" lb .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "m1 = 144206 #Mass flow rate of flue gas (lb/h)\n",
+ "cp1 = 0.3 #Average heat capacities of the flue gas (Btu/lb\u00b0F)\n",
+ "cp2 = 0.88 #Average heat capacities of the solid (Btu/lb\u00b0F)\n",
+ "#From example 18.18:\n",
+ "T1 = 550 #Initial temperature of gas (\u00b0F)\n",
+ "T2 = 2050 #Final temperature of gas (\u00b0F)\n",
+ "T3 = 70 #Initial temperature of solid (\u00b0F)\n",
+ "T4 = 550-40 #Final temperature of solid (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Dhf = m1*cp1*(T2-T1) #For the flue gas, the enthalpy change for one hour of operation (Btu)\n",
+ "Dhs = round(Dhf,-4) #For the solids, the enthalpy change for one hour of operation (Btu)\n",
+ "m2 = Dhs/(cp2*(T4-T3)) #Mass of solid (lb)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The mass of solid is :\",round(m2),\" lb .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The mass of solid is : 167588.0 lb .\n"
+ "text": [
+ "The mass of solid is : 167588.0 lb .\n"
+ ]
}
],
"prompt_number": 22
@@ -248,19 +599,54 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 18.22, Page number: 409"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 18.22, Page number: 409"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''With reference to the previous example, design a radiative heat exchanger to cool the entire\ncombustion gases (MW = 28.27) from 2050 to 180\u00b0F. The ambient air temperature is 60\u00b0F\nand an overall heat transfer coefficient for the cooler of 1.5 Btu/h.ft^2.\u00b0F may be assumed to\napply.\n'''\n\nfrom __future__ import division\nfrom math import log,sqrt,pi\n\n#Variable declaration:\n#From example 18.21:\nm = 144206 #Mass flow rate of flue gas (lb/h)\ncp = 0.3 #Average heat capacities of the flue gas (Btu/lb\u00b0F)\nT1 = 2050 #Initial temperature of gas (\u00b0F)\nT2 = 180 #Final temperature of gas (\u00b0F)\nT3 = 60 #Ambient air temperature (\u00b0F)\nU = 1.5 #Overall heat transfer coefficient for cooler (Btu/h.ft^2.\u00b0F)\nMW = 28.27 #Molecular weight of gas\nR = 379 #Universal gas constant (psia.ft^3/lbmol.\u00b0R)\nv = 60 #Duct or pipe velcity at inlet (2050\u00b0F) (ft/s)\n\n#Calculation:\nQ = m*cp*(T1-T2) #Heat duty (Btu/h)\nDTlm = ((T1-T3)-(T2-T3))/log((T1-T3)/(T2-T3)) #Log-mean temperature difference (\u00b0F)\nA1 = round(Q,-5)/(U*round(DTlm)) #Radiative surface area (ft^2)\nq = m*R*(T1+460)/(T3+460)/MW #Volumetric flow at inlet (ft^3/h)\nA2 = q/(v*3600) #Duct area (ft^2)\nD = sqrt(A2*4/pi) #Duct diameter (ft)\nL = A1/(pi*D) #Length of required heat exchange ducting (ft)\n\n#Result:\nprint \" The radiative surface area required is :\",round(A1,-1),\" ft^2 .\"\nprint \" The length of required heat exchange ducting is :\",round(L),\" ft .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import log,sqrt,pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 18.21:\n",
+ "m = 144206 #Mass flow rate of flue gas (lb/h)\n",
+ "cp = 0.3 #Average heat capacities of the flue gas (Btu/lb\u00b0F)\n",
+ "T1 = 2050 #Initial temperature of gas (\u00b0F)\n",
+ "T2 = 180 #Final temperature of gas (\u00b0F)\n",
+ "T3 = 60 #Ambient air temperature (\u00b0F)\n",
+ "U = 1.5 #Overall heat transfer coefficient for cooler (Btu/h.ft^2.\u00b0F)\n",
+ "MW = 28.27 #Molecular weight of gas\n",
+ "R = 379 #Universal gas constant (psia.ft^3/lbmol.\u00b0R)\n",
+ "v = 60 #Duct or pipe velcity at inlet (2050\u00b0F) (ft/s)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = m*cp*(T1-T2) #Heat duty (Btu/h)\n",
+ "DTlm = ((T1-T3)-(T2-T3))/log((T1-T3)/(T2-T3)) #Log-mean temperature difference (\u00b0F)\n",
+ "A1 = round(Q,-5)/(U*round(DTlm)) #Radiative surface area (ft^2)\n",
+ "q = m*R*(T1+460)/(T3+460)/MW #Volumetric flow at inlet (ft^3/h)\n",
+ "A2 = q/(v*3600) #Duct area (ft^2)\n",
+ "D = sqrt(A2*4/pi) #Duct diameter (ft)\n",
+ "L = A1/(pi*D) #Length of required heat exchange ducting (ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \" The radiative surface area required is :\",round(A1,-1),\" ft^2 .\"\n",
+ "print \" The length of required heat exchange ducting is :\",round(L),\" ft .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " The radiative surface area required is : 80980.0 ft^2 .\n The length of required heat exchange ducting is : 3476.0 ft .\n"
+ "text": [
+ " The radiative surface area required is : 80980.0 ft^2 .\n",
+ " The length of required heat exchange ducting is : 3476.0 ft .\n"
+ ]
}
],
"prompt_number": 23
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_19.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_19.ipynb
index f5466410..3617f433 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_19.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_19.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 19"
+ "name": "",
+ "signature": "sha256:e60aa082c3bd1f8f9672b5ca74c6357f1b26803a7fb296a1d0a644ab9efb4ea1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,63 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 19: Insulation and Refractory"
+ "source": [
+ "Chapter 19: Insulation and Refractory"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.1, Page number: 413"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.1, Page number: 413"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The following data is provided: a rectangular plane room wall, 2.5 m high and 4 m wide, has an\noutside surface temperature, T1 = 24\u00b0C; the outside air temperature is T3 = -15\u00b0C. Calculate\nthe heat transfer rate. The convective heat transfer coefficient between the outside surface and\nthe air is 11W/m^2.K.\nIf loosely packed wool with k = 0.04 W/m.K and a thickness of 7.62 mm (3 in.) is used\nfor insulation on the outer wall, calculate a revised heat transfer rate.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nH = 2.5 #Height of wall (m)\nW = 4 #Width of wall (m)\nh = 11 #Convective heat transfer coefficient (W/m^2.K)\nT1 = 24 #Outside surface temperature (\u00b0C)\nT3 = -15 #Outside air temperature (\u00b0C)\nL = 7.62/10**3 #Insulation thickness (m)\nk = 0.04 #Thermal conductivity of wool (W/m.K)\n\n#Calculation:\nA = H*W #Heat transfer area (m^2)\nQ = h*A*(T1-T3) #Heat transfer rate (W)\nRi = L/(k*A) #Insuation resistance (K/W)\nRc = 1/(h*A) #Convective resitance (K/W)\nR = Ri+Rc #Total resistance (K/W)\nQt = (T1-T3)/R #Revised heat transfer rate (Btu/h)\n \n#Result:\nprint \"1. The heat transfer rate without insulation is :\",round(Q),\" W .\"\nprint \"Or, the heat transfer rate without insulation is :\",round(Q*3.412),\" Btu/h .\"\nprint \"2. The revised heat transfer rate with insulation is :\",round(Qt),\" W .\"\nprint \"Or, the revised heat transfer rate with insulation is :\",round(Qt*3.412),\" Btu/h .\"\nprint \"There is a calculation mistake in book.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "H = 2.5 #Height of wall (m)\n",
+ "W = 4 #Width of wall (m)\n",
+ "h = 11 #Convective heat transfer coefficient (W/m^2.K)\n",
+ "T1 = 24 #Outside surface temperature (\u00b0C)\n",
+ "T3 = -15 #Outside air temperature (\u00b0C)\n",
+ "L = 7.62/10**3 #Insulation thickness (m)\n",
+ "k = 0.04 #Thermal conductivity of wool (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "A = H*W #Heat transfer area (m^2)\n",
+ "Q = h*A*(T1-T3) #Heat transfer rate (W)\n",
+ "Ri = L/(k*A) #Insuation resistance (K/W)\n",
+ "Rc = 1/(h*A) #Convective resitance (K/W)\n",
+ "R = Ri+Rc #Total resistance (K/W)\n",
+ "Qt = (T1-T3)/R #Revised heat transfer rate (Btu/h)\n",
+ " \n",
+ "#Result:\n",
+ "print \"1. The heat transfer rate without insulation is :\",round(Q),\" W .\"\n",
+ "print \"Or, the heat transfer rate without insulation is :\",round(Q*3.412),\" Btu/h .\"\n",
+ "print \"2. The revised heat transfer rate with insulation is :\",round(Qt),\" W .\"\n",
+ "print \"Or, the revised heat transfer rate with insulation is :\",round(Qt*3.412),\" Btu/h .\"\n",
+ "print \"There is a calculation mistake in book.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The heat transfer rate without insulation is : 4290.0 W .\nOr, the heat transfer rate without insulation is : 14637.0 Btu/h .\n2. The revised heat transfer rate with insulation is : 1386.0 W .\nOr, the revised heat transfer rate with insulation is : 4729.0 Btu/h .\nThere is a calculation mistake in book.\n"
+ "text": [
+ "1. The heat transfer rate without insulation is : 4290.0 W .\n",
+ "Or, the heat transfer rate without insulation is : 14637.0 Btu/h .\n",
+ "2. The revised heat transfer rate with insulation is : 1386.0 W .\n",
+ "Or, the revised heat transfer rate with insulation is : 4729.0 Btu/h .\n",
+ "There is a calculation mistake in book.\n"
+ ]
}
],
"prompt_number": 4
@@ -38,19 +77,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.2, Page number: 414"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.2, Page number: 414"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 19.1. Calculate the temperature at the wall-insulation surface.\n'''\n\n#Variable declaration:\n#From example 19.1:\nT1 = 24 #Outside surface temperature (\u00b0C)\nRi = 0.0191 #Insulation resistance (K/W)\nQ = 1383 #Revised heat transfer rate (Btu/h)\n\n#Calculation:\nT2 = T1-Q*Ri #Temperature at outer surface of insulation (\u00b0C)\n\n#Result:\nprint \"The temperature at the outer surface of the insulation is :\",round(T2,1),\" \u00b0C .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 19.1:\n",
+ "T1 = 24 #Outside surface temperature (\u00b0C)\n",
+ "Ri = 0.0191 #Insulation resistance (K/W)\n",
+ "Q = 1383 #Revised heat transfer rate (Btu/h)\n",
+ "\n",
+ "#Calculation:\n",
+ "T2 = T1-Q*Ri #Temperature at outer surface of insulation (\u00b0C)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The temperature at the outer surface of the insulation is :\",round(T2,1),\" \u00b0C .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The temperature at the outer surface of the insulation is : -2.4 \u00b0C .\n"
+ "text": [
+ "The temperature at the outer surface of the insulation is : -2.4 \u00b0C .\n"
+ ]
}
],
"prompt_number": 5
@@ -59,19 +116,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.3, Page number: 415"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.3, Page number: 415"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the Biot number in the previous example and comment on the results.'''\n\n#Variable declaration:\n#From example 19.1:\nh = 11 #Convective heat transfer coefficient (W/m^2.K)\nL = 7.62/10**3 #Insulation thickness (m)\nk = 0.04 #Thermal conductivity of wool (W/m.K)\n\n#Calculation:\nBi = h*L/k #Biot number\n\n#Result:\nprint \"The Biot nmuber is :\",round(Bi,1),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 19.1:\n",
+ "h = 11 #Convective heat transfer coefficient (W/m^2.K)\n",
+ "L = 7.62/10**3 #Insulation thickness (m)\n",
+ "k = 0.04 #Thermal conductivity of wool (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "Bi = h*L/k #Biot number\n",
+ "\n",
+ "#Result:\n",
+ "print \"The Biot nmuber is :\",round(Bi,1),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Biot nmuber is : 2.1 .\n"
+ "text": [
+ "The Biot nmuber is : 2.1 .\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +155,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.4, Page number: 415"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.4, Page number: 415"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''One wall of an oven has a 3-inch insulation cover. The temperature on the inside of the wall is at\n400\u00b0F; the temperature on the outside is at 25\u00b0C. What is the heat flux (heat flow rate per unit\narea) across the wall if the insulation is made of glass wool (k = 0.022 Btu/h.ft.\u00b0F)?\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nk = 0.022 #Thermal conductivity of glass wool (Btu/h.ft.\u00b0F)\nT1 = 400 #Inside wall temperature (\u00b0F)\nT2 = 25 #Outside wall temperature (\u00b0C)\nL = 3/12 #Length of insulation cover (ft)\n\n#Calculation:\nT_2 = T2*(9/5)+32 #Outside wall temperature in fahrenheit scale (\u00b0F)\nQbyA = k*(T1-T_2)/L #Heat flux across the wall (Btu/h.ft^2)\n\n#Result:\nprint \"The heat flux across the wall is :\",round(QbyA,1),\" Btu/h.ft^2 .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "k = 0.022 #Thermal conductivity of glass wool (Btu/h.ft.\u00b0F)\n",
+ "T1 = 400 #Inside wall temperature (\u00b0F)\n",
+ "T2 = 25 #Outside wall temperature (\u00b0C)\n",
+ "L = 3/12 #Length of insulation cover (ft)\n",
+ "\n",
+ "#Calculation:\n",
+ "T_2 = T2*(9/5)+32 #Outside wall temperature in fahrenheit scale (\u00b0F)\n",
+ "QbyA = k*(T1-T_2)/L #Heat flux across the wall (Btu/h.ft^2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat flux across the wall is :\",round(QbyA,1),\" Btu/h.ft^2 .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat flux across the wall is : 28.4 Btu/h.ft^2 .\n"
+ "text": [
+ "The heat flux across the wall is : 28.4 Btu/h.ft^2 .\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +197,60 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.5, Page number: 415"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.5, Page number: 415"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A cold-storage room has a plane rectangular wall 8 m wide (w) and 3 m high (H). The temperature\nof the outside surface of the wall T1 is -18\u00b0C. The surrounding air temperature T3 is 26\u00b0C.\nThe convective heat transfer coefficient between the air and the surface is 21 W/m^2.K. A layer\nof cork board insulation (thermal conductivity, k = 0.0433 W/m.K) is to be attached to the\noutside wall to reduce the cooling load by 80%.\n1. Calculate the rate of heat flow through the rectangular wall without insulation. Express\nthe answer in tons of refrigeration (1 ton of refrigeration = 12,000 Btu/h). Which direction\nis the heat flowing?\n2. Determine the required thickness of the insulation board.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nw = 8 #Width of wall (m)\nH = 3 #Height of wall (m)\nh = 21 #Convective heat transfer coefficient between the air and the surface (W/m^2.K)\nT1 = -18 #Outside surace of wall temperature (\u00b0C)\nT3 = 26 #Surrounding air temperature (\u00b0C)\nl1 = 80/100 #Reduction in cooling load\nk = 0.0433 #Thermal conductivity of cork board insulation (W/m.K)\nT = 12000 #Units Btu/h in 1 ton of refrigeration\n\n#Calculation:\nA = w*H #Heat transfer area (m^2) (part 1)\nQ1 = h*A*(T1-T3) #Rate of heat flow in the absence of insulation (W)\nQ2 = Q1*3.4123/T #Rate of heat flow in the absence of insulation (ton of refrigeration)\nl2 = 1-l1 #Reduced cooling load (part 2)\nQ3 = l2*Q1 #Heat rate with insulation (W)\nRt = (T1-T3)/Q3 #Total thermal resistance (\u00b0C/W)\nR2 = 1/(h*A) #Convection thermal resistance (\u00b0C/W)\nR1 = Rt-R2 #Insulation conduction resistance (\u00b0C/W)\nL = R1*k*A #Required insulation thickness (m)\n\n#Result:\nprint \"1. The rate of heat flow through the rectangular wall without insulation is :\",round(Q1/10**3,2),\" kW .\"\nprint \"Or, the rate of heat flow through the rectangular wall without insulation in tons of refrigeration is :\",round(Q2,1),\" ton of refrigeration .\"\nif (Q1<0):\n print \" The negative sign indicates heat flow from the surrounding air into the cold room.\"\nelse :\n print \" The positive sign indicates heat flow from the surrounding air into the cold room.\"\nprint \"2. The required thickness of the insulation board is :\",round(L*10**3,2),\" mm .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "w = 8 #Width of wall (m)\n",
+ "H = 3 #Height of wall (m)\n",
+ "h = 21 #Convective heat transfer coefficient between the air and the surface (W/m^2.K)\n",
+ "T1 = -18 #Outside surace of wall temperature (\u00b0C)\n",
+ "T3 = 26 #Surrounding air temperature (\u00b0C)\n",
+ "l1 = 80/100 #Reduction in cooling load\n",
+ "k = 0.0433 #Thermal conductivity of cork board insulation (W/m.K)\n",
+ "T = 12000 #Units Btu/h in 1 ton of refrigeration\n",
+ "\n",
+ "#Calculation:\n",
+ "A = w*H #Heat transfer area (m^2) (part 1)\n",
+ "Q1 = h*A*(T1-T3) #Rate of heat flow in the absence of insulation (W)\n",
+ "Q2 = Q1*3.4123/T #Rate of heat flow in the absence of insulation (ton of refrigeration)\n",
+ "l2 = 1-l1 #Reduced cooling load (part 2)\n",
+ "Q3 = l2*Q1 #Heat rate with insulation (W)\n",
+ "Rt = (T1-T3)/Q3 #Total thermal resistance (\u00b0C/W)\n",
+ "R2 = 1/(h*A) #Convection thermal resistance (\u00b0C/W)\n",
+ "R1 = Rt-R2 #Insulation conduction resistance (\u00b0C/W)\n",
+ "L = R1*k*A #Required insulation thickness (m)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The rate of heat flow through the rectangular wall without insulation is :\",round(Q1/10**3,2),\" kW .\"\n",
+ "print \"Or, the rate of heat flow through the rectangular wall without insulation in tons of refrigeration is :\",round(Q2,1),\" ton of refrigeration .\"\n",
+ "if (Q1<0):\n",
+ " print \" The negative sign indicates heat flow from the surrounding air into the cold room.\"\n",
+ "else :\n",
+ " print \" The positive sign indicates heat flow from the surrounding air into the cold room.\"\n",
+ "print \"2. The required thickness of the insulation board is :\",round(L*10**3,2),\" mm .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The rate of heat flow through the rectangular wall without insulation is : -22.18 kW .\nOr, the rate of heat flow through the rectangular wall without insulation in tons of refrigeration is : -6.3 ton of refrigeration .\n The negative sign indicates heat flow from the surrounding air into the cold room.\n2. The required thickness of the insulation board is : 8.25 mm .\n"
+ "text": [
+ "1. The rate of heat flow through the rectangular wall without insulation is : -22.18 kW .\n",
+ "Or, the rate of heat flow through the rectangular wall without insulation in tons of refrigeration is : -6.3 ton of refrigeration .\n",
+ " The negative sign indicates heat flow from the surrounding air into the cold room.\n",
+ "2. The required thickness of the insulation board is : 8.25 mm .\n"
+ ]
}
],
"prompt_number": 12
@@ -122,19 +259,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.6, Page number: 417"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.6, Page number: 417"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to the previous example.\n1. Calculate the temperature at the interface between the cork board and the air.\n2. Calculate the Biot number, Bi.\n3. What can one conclude?\n'''\n\n#Variable declaration:\n#From example 19.5:\nQ = -4435.2 #Heat rate with insulation (W)\nR2 = 0.00198 #Convection thermal resistance (\u00b0C/W)\nT3 = 26 #Surrounding air temperature (\u00b0C)\nh = 21 #Convective heat transfer coefficient between the air and the surface (W/m^2.K)\nk = 0.0433 #Thermal conductivity of cork board insulation (W/m.K)\nL = 0.00825 #Required insulation thickness (m)\n\n#Calculation:\nT2 = T3+Q*R2 #Interface temperature (\u00b0C) (part 1)\nBi = h*L/k #Biot number (part 2)\n\n#Result:\nprint \"1. The interface temperature is :\",round(T2,2),\" \u00b0C .\"\nprint \"2. The Biot number is :\",round(Bi),\" .\"\nprint \"3. Theoretical part.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 19.5:\n",
+ "Q = -4435.2 #Heat rate with insulation (W)\n",
+ "R2 = 0.00198 #Convection thermal resistance (\u00b0C/W)\n",
+ "T3 = 26 #Surrounding air temperature (\u00b0C)\n",
+ "h = 21 #Convective heat transfer coefficient between the air and the surface (W/m^2.K)\n",
+ "k = 0.0433 #Thermal conductivity of cork board insulation (W/m.K)\n",
+ "L = 0.00825 #Required insulation thickness (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "T2 = T3+Q*R2 #Interface temperature (\u00b0C) (part 1)\n",
+ "Bi = h*L/k #Biot number (part 2)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The interface temperature is :\",round(T2,2),\" \u00b0C .\"\n",
+ "print \"2. The Biot number is :\",round(Bi),\" .\"\n",
+ "print \"3. Theoretical part.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The interface temperature is : 17.22 \u00b0C .\n2. The Biot number is : 4.0 .\n3. Theoretical part.\n"
+ "text": [
+ "1. The interface temperature is : 17.22 \u00b0C .\n",
+ "2. The Biot number is : 4.0 .\n",
+ "3. Theoretical part.\n"
+ ]
}
],
"prompt_number": 9
@@ -143,19 +306,58 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.7, Page number: 417"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.7, Page number: 417"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A hypodermic needle with an external diameter D1 of 0.50 mm is to be used to transfer a reactant\npreheated to 95\u00b0C in a laboratory reactor. To reduce the heat loss from the transfer line, the hypodermic\nneedle is threaded through the center of a solid rubber insulating tube (thermal conductivity,\nk2 = 0.2 W/m.K) with a diameter of D2 of 2 mm.\n1. Calculate the rate of the heat loss from the hypodermic needle with and without the\nrubber insulation.\n2. Calculate the Biot and Nusselt numbers for the uninsulated needle taking the characteristic\ndimension to be the diameter of the needle.\nThe stainless steel needle has a thermal conductivity, k1, of 16 W/m.K. The ambient air\ntemperature is 20\u00b0C. The thermal conductivity of the air, k3, is 0.0242 W/m.K. The heat transfer\ncoefficient, h3, from the outside surface of the transfer line to the surrounding air is primarily\ndue to natural convection and is approximately equal to 12 W/m^2.K; it may also be assumed\nindependent of the radius or the temperature.\n'''\n\nfrom __future__ import division\nfrom math import pi,log\n\n#Variable declaration:\nD2 = 0.5/10**3 #External diameter of needle (m)\nh3 = 12 #Heat transfer coefficient (W/m^2.K)\nL = 1 #Insulation thickness (m)\nT1 = 95 #Reactant temperature (\u00b0C)\nT3 = 20 #Ambient air temperature (\u00b0C)\nk1 = 16 #Thermal conductivity of needle (W/m.K)\nk3 = 0.0242 #Thermal conductivity of air (W/m.K)\nD3 = 2/10**3 #Diameter of rubber tube (m)\n\n#Calculation:\nr2 = D2/2 #External radius of needle (m)\nr3 = D3/2 #Radius of rubber tube (m)\nRt1 = 1/(h3*(2*pi*r2*L)) #Thermal resistance (\u00b0C/W)\nQ1 = (T1-T3)/Rt1 #Rate of heat flow in the absence of insulation (W)\nBi = h3*D2/k1 #Biot number \nNu = h3*D2/k3 #Nusselt number\nR2 = log(r3/r2) #Thermal resistance of needle (\u00b0C/W)\nR3 = 1/(h3*(2*pi*r3*L)) #Thermal resistance of rubber tube (\u00b0C/W)\nRt2 = R2+R3 #Total thermal resistance (\u00b0C/W)\nQ2 = (T1-T3)/Rt2 #Rate of heat loss (W)\n\n#Result:\nprint \"1. The rate of the heat loss from the hypodermic needle with the rubber insulation is :\",round(Q1,2),\" W .\"\nprint \" The rate of the heat loss from the hypodermic needle without the rubber insulation is :\",round(Q2,2),\" W .\"\nprint \"2. The Biot number is :\",round(Bi,6),\" .\"\nprint \" The nusselt number is :\",round(Nu,3),\" .\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi,log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "D2 = 0.5/10**3 #External diameter of needle (m)\n",
+ "h3 = 12 #Heat transfer coefficient (W/m^2.K)\n",
+ "L = 1 #Insulation thickness (m)\n",
+ "T1 = 95 #Reactant temperature (\u00b0C)\n",
+ "T3 = 20 #Ambient air temperature (\u00b0C)\n",
+ "k1 = 16 #Thermal conductivity of needle (W/m.K)\n",
+ "k3 = 0.0242 #Thermal conductivity of air (W/m.K)\n",
+ "D3 = 2/10**3 #Diameter of rubber tube (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "r2 = D2/2 #External radius of needle (m)\n",
+ "r3 = D3/2 #Radius of rubber tube (m)\n",
+ "Rt1 = 1/(h3*(2*pi*r2*L)) #Thermal resistance (\u00b0C/W)\n",
+ "Q1 = (T1-T3)/Rt1 #Rate of heat flow in the absence of insulation (W)\n",
+ "Bi = h3*D2/k1 #Biot number \n",
+ "Nu = h3*D2/k3 #Nusselt number\n",
+ "R2 = log(r3/r2) #Thermal resistance of needle (\u00b0C/W)\n",
+ "R3 = 1/(h3*(2*pi*r3*L)) #Thermal resistance of rubber tube (\u00b0C/W)\n",
+ "Rt2 = R2+R3 #Total thermal resistance (\u00b0C/W)\n",
+ "Q2 = (T1-T3)/Rt2 #Rate of heat loss (W)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The rate of the heat loss from the hypodermic needle with the rubber insulation is :\",round(Q1,2),\" W .\"\n",
+ "print \" The rate of the heat loss from the hypodermic needle without the rubber insulation is :\",round(Q2,2),\" W .\"\n",
+ "print \"2. The Biot number is :\",round(Bi,6),\" .\"\n",
+ "print \" The nusselt number is :\",round(Nu,3),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The rate of the heat loss from the hypodermic needle with the rubber insulation is : 1.41 W .\n The rate of the heat loss from the hypodermic needle without the rubber insulation is : 5.12 W .\n2. The Biot number is : 0.000375 .\n The nusselt number is : 0.248 .\n"
+ "text": [
+ "1. The rate of the heat loss from the hypodermic needle with the rubber insulation is : 1.41 W .\n",
+ " The rate of the heat loss from the hypodermic needle without the rubber insulation is : 5.12 W .\n",
+ "2. The Biot number is : 0.000375 .\n",
+ " The nusselt number is : 0.248 .\n"
+ ]
}
],
"prompt_number": 11
@@ -164,19 +366,63 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.9, Page number: 420"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.9, Page number: 420"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The surface temperature of a circular conducting rod is maintained at 200\u00b0C (T1) by the passage\nof an electric current. The rod diameter is 10 mm, the length is 2.5 m, the thermal conductivity is\n60 W/m.K, the density is 7850 kg/m^3, and the heat capacity is 434 J/kg.K. A bakelite coating\n(thermal conductivity = 1.4 W/m.K) is applied to the rod. The rod is in a fluid at 25\u00b0C (T3),\nand the convection heat transfer coefficient is 140 W/m^2.K. The thermal conductivity of the\nfluid is 0.6 W/m.K.\n1. Calcualte the rate of heat transfer for the bare rod?\n2. What is the critical radius associated with the bakelite coating? What is the heat transfer\nrate at the critical radius?\n3. If the bakelite insulation thickness is 55 mm, determine the fractional reduction in heat\ntransfer rate relative to the case of a bare rod.\n'''\n\nfrom __future__ import division\nfrom math import log, pi\n\n#Variable declaration:\nh = 140 #Convention heat transfer coefficient (W/m^2.K)\nD1 = 10/10**3 #Rod diameter (m)\nL = 2.5 #Rod length (m)\nT1 = 200 #Surface temperature of rod (\u00b0C)\nT2 = 25 #Fluid temperature (\u00b0C)\nk = 1.4 #Thermal conductivity of bakellite (W/m.K)\nl = 55/10**3 #Insulation thickness (m)\n\n#Calculation:\nQ1 = h*pi*D1*L*(T1-T2) #Rate of heat transfer for the bare rod (W) (part 1)\nBi = 2 #Critical Biot number (part 2)\nD2 = Bi*k/h #Critical diameter associated with the bakelite coating (m)\nr2 = D2/2 #Critical radius associated with the bakelite coating (m)\nr1 = D1/2 #Rod radius (m)\nR1 = log(r2/r1)/(2*pi*k*L) #Insulation conduction resistance (\u00b0C/W)\nR2 = 1/(h*(2*pi*r2*L)) #Convection thermal resistance (\u00b0C/W)\nRt1 = R1+R2 #Total thermal resistance (\u00b0C/W)\nQc = (T1-T2)/Rt1 #Heat transfer rate at the critical radius (W)\nr3 = r1+l #New radius associated with the bakelite coating after insulation (m) (part 3)\nR3 = log(r3/r1)/(2*pi*k*L) #Insulation conduction bakelite resistance (\u00b0C/W)\nR4 = 1/(h*(2*pi*r3*L)) #Convection bakelite thermal resistance (\u00b0C/W)\nRt2 = R3+R4 #Total bakelite thermal resistance (\u00b0C/W)\nQ2 = (T1-T2)/Rt2 #Heat transfer rate at the bakelite critical radius (W)\nRe = ((Q1-Q2)/Q1)*100 #Percent reduction in heat transfer rate relative to the case of a bare rod (%)\n\n#Result:\nprint \"1. The rate of heat transfer for the bare rod is :\",round(Q1),\" W .\"\nprint \"2. The critical radius associated with the bakelite coating is :\",round(r2*10**3),\" mm.\"\nprint \" & the heat transfer rate at the critical radius is :\",round(Qc),\" W .\"\nprint \"3. The fractional reduction in heat transfer rate relative to the case of a bare rod is :\",round(Re,1),\" % .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import log, pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "h = 140 #Convention heat transfer coefficient (W/m^2.K)\n",
+ "D1 = 10/10**3 #Rod diameter (m)\n",
+ "L = 2.5 #Rod length (m)\n",
+ "T1 = 200 #Surface temperature of rod (\u00b0C)\n",
+ "T2 = 25 #Fluid temperature (\u00b0C)\n",
+ "k = 1.4 #Thermal conductivity of bakellite (W/m.K)\n",
+ "l = 55/10**3 #Insulation thickness (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q1 = h*pi*D1*L*(T1-T2) #Rate of heat transfer for the bare rod (W) (part 1)\n",
+ "Bi = 2 #Critical Biot number (part 2)\n",
+ "D2 = Bi*k/h #Critical diameter associated with the bakelite coating (m)\n",
+ "r2 = D2/2 #Critical radius associated with the bakelite coating (m)\n",
+ "r1 = D1/2 #Rod radius (m)\n",
+ "R1 = log(r2/r1)/(2*pi*k*L) #Insulation conduction resistance (\u00b0C/W)\n",
+ "R2 = 1/(h*(2*pi*r2*L)) #Convection thermal resistance (\u00b0C/W)\n",
+ "Rt1 = R1+R2 #Total thermal resistance (\u00b0C/W)\n",
+ "Qc = (T1-T2)/Rt1 #Heat transfer rate at the critical radius (W)\n",
+ "r3 = r1+l #New radius associated with the bakelite coating after insulation (m) (part 3)\n",
+ "R3 = log(r3/r1)/(2*pi*k*L) #Insulation conduction bakelite resistance (\u00b0C/W)\n",
+ "R4 = 1/(h*(2*pi*r3*L)) #Convection bakelite thermal resistance (\u00b0C/W)\n",
+ "Rt2 = R3+R4 #Total bakelite thermal resistance (\u00b0C/W)\n",
+ "Q2 = (T1-T2)/Rt2 #Heat transfer rate at the bakelite critical radius (W)\n",
+ "Re = ((Q1-Q2)/Q1)*100 #Percent reduction in heat transfer rate relative to the case of a bare rod (%)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The rate of heat transfer for the bare rod is :\",round(Q1),\" W .\"\n",
+ "print \"2. The critical radius associated with the bakelite coating is :\",round(r2*10**3),\" mm.\"\n",
+ "print \" & the heat transfer rate at the critical radius is :\",round(Qc),\" W .\"\n",
+ "print \"3. The fractional reduction in heat transfer rate relative to the case of a bare rod is :\",round(Re,1),\" % .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The rate of heat transfer for the bare rod is : 1924.0 W .\n2. The critical radius associated with the bakelite coating is : 10.0 mm.\n & the heat transfer rate at the critical radius is : 2273.0 W .\n3. The fractional reduction in heat transfer rate relative to the case of a bare rod is : 24.6 % .\n"
+ "text": [
+ "1. The rate of heat transfer for the bare rod is : 1924.0 W .\n",
+ "2. The critical radius associated with the bakelite coating is : 10.0 mm.\n",
+ " & the heat transfer rate at the critical radius is : 2273.0 W .\n",
+ "3. The fractional reduction in heat transfer rate relative to the case of a bare rod is : 24.6 % .\n"
+ ]
}
],
"prompt_number": 15
@@ -185,19 +431,83 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.10, Page number: 421"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.10, Page number: 421"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A stainless steel tube carries hot ethylene glycol at 124\u00b0C (T1). The surrounding air outside the\ntube is at 2\u00b0C (T5). To reduce the heat losses from the ethylene glycol, the tube is surrounded by\nasbestos insulation. For a 1 m length of the tube, calculate:\n1. the rate of heat transfer without insulation,\n2. the rate of heat transfer with insulation, and\n3. the overall heat transfer coefficient based on the inside area of the tube,\n4. the overall heat transfer coefficient based on the outside area of the insulation,\n5. the temperature, T3, at the steel\u2013insulation interface,\n6. the inside and outside Biot numbers, and the outside Nusselt number, and\n7. the log mean radius of insulation.\nThe following data is provided.\nStainless steel pipe: inside radius, r1 = 1.1 cm; outside radius, r2 = 1.3 cm; thermal conductivity,\nk2 = 19 W/m.K; heat transfer coefficient from ethylene glycol to the stainless\nsteel pipe, h1 = 190 W/m^2.K.\nAsbestos insulation: inside radius, r2 = 1.3 cm; outside radius, r3 = 3.8 cm; thermal conductivity,\nk3 = 0.2 W/m.K.\nThe outside heat transfer coefficient from the air to the surface of the insulation (or of the\npipe, in the case of no insulation), h3 = 14 W/m^2.K. The thermal conductivity, k4, of the air\nis 0.0242 W/m.K.\n'''\n\nfrom __future__ import division\nfrom math import pi, log\n\n#Variable declaration:\nr1 = 1.1/100 #Inside radius of pipe (m)\nr2 = 1.3/100 #Outside radius of pipe (m)\nr3 = 3.8/100 #Outside radius of asbestos insulation (m)\nL = 1 #Length of tube (m)\nh1 = 190 #Heat transfer coefficient from ethylene glycol to the stainless steel pipe (W/m^2.K)\nk2 = 19 #Thermal conductivity of pipe (W/m.K)\nh2 = 14 #Outside heat transfer coefficient from the air to the surface of the insulation (W/m^2.K)\nk3 = 0.2 #Thermal conductivity of asbestos (W/m.K)\nT1 = 124 #Hot ethylene glycol temperature (\u00b0C)\nT5 = 2 #Surrounding air temperature (\u00b0C)\nk4 = 0.0242 #Thermal conductivity of air (W/m.K)\n\n#Calculation:\nA1 = 2*pi*r1*L #Inside surface area of pipe (m^2) (part1)\nA2 = 2*pi*r2*L #Outside surface area of pipe (m^2)\nA3 = 2*pi*r3*L #Outside surface area of asbestos insulation (m^2)\nR1 = 1/(h1*A1) #Inside convection resistance (\u00b0C/W)\nR2 = log(r2/r1)/(2*pi*k2*L) #Conduction resistance through the tube (\u00b0C/W)\nR3 = 1/(h2*A2) #Outside convection resistance (\u00b0C/W)\nRt1 = R1+R2+R3 #Total resistance without insulation (\u00b0C/W)\nQ1 = (T1 - T5)/Rt1 #Heat transfer rate without insulation (W)\nR4 = log(r3/r2)/(2*pi*k3*L) #Conduction resistance associated with the insulation (\u00b0C/W) (part 2)\nR5 = 1/(h2*A3) #Outside convection resistance (\u00b0C/W)\nRt2 = R1+R2+R4+R5 #Total rsistance with the insulation (\u00b0C/W)\nQ2 = (T1-T5)/Rt2 #Heat transfer rate with the insulation (W)\nU1 = 1/(Rt2*A1) #Overall heat transfer coefficient based on the inside area (W/m^2.K) (part 3)\nU3 = 1/(Rt2*A3) #Overall heat transfer coefficient based on the outside area (W/m^2.K) (part 4)\nT3 = T1-(R1+R2)*Q2 #Temperature at the steel\u2013insulation interface (\u00b0C) (part 5)\nBi1 = h2*(2*r3)/k3 #Outside Biot number (part 6)\nBi2 = h1*(2*r1)/k2 #Inside Biot number\nNu = h1*(2*r1)/k4 #Nusselt number of the air\nrlm = (r3-r2)/log(r3/r2) #Log mean radius of the insulation (m) (part 7)\n\n#Result:\nprint \"1. The rate of heat transfer without insulation is :\",round(Q1,1),\" W.\"\nprint \"2. The rate of heat transfer with insulation is :\",round(Q2,1),\" W.\"\nprint \"3. The overall heat transfer coefficient based on the inside area of the tube is :\",round(U1,2),\" W/m^2.K .\"\nprint \"4. The overall heat transfer coefficient based on the outside area of the insulation is :\",round(U3,1),\" W/m^2.K .\"\nprint \"5. The temperature, T3, at the steel\u2013insulation interface is :\",round(T3,1),\" \u00b0C.\"\nprint \"6. The inside Biot numbers is :\",round(Bi2,2),\" .\"\nprint \" The outside Biot numbers is :\",round(Bi1,2),\" .\"\nprint \" The Nusselt number is :\",round(Nu,1),\" .\"\nprint \"7. The log mean radius of insulation is :\",round(rlm*100,2),\" cm.\"\nprint \"There is a printing mistake in book for unit in part 7.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi, log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "r1 = 1.1/100 #Inside radius of pipe (m)\n",
+ "r2 = 1.3/100 #Outside radius of pipe (m)\n",
+ "r3 = 3.8/100 #Outside radius of asbestos insulation (m)\n",
+ "L = 1 #Length of tube (m)\n",
+ "h1 = 190 #Heat transfer coefficient from ethylene glycol to the stainless steel pipe (W/m^2.K)\n",
+ "k2 = 19 #Thermal conductivity of pipe (W/m.K)\n",
+ "h2 = 14 #Outside heat transfer coefficient from the air to the surface of the insulation (W/m^2.K)\n",
+ "k3 = 0.2 #Thermal conductivity of asbestos (W/m.K)\n",
+ "T1 = 124 #Hot ethylene glycol temperature (\u00b0C)\n",
+ "T5 = 2 #Surrounding air temperature (\u00b0C)\n",
+ "k4 = 0.0242 #Thermal conductivity of air (W/m.K)\n",
+ "\n",
+ "#Calculation:\n",
+ "A1 = 2*pi*r1*L #Inside surface area of pipe (m^2) (part1)\n",
+ "A2 = 2*pi*r2*L #Outside surface area of pipe (m^2)\n",
+ "A3 = 2*pi*r3*L #Outside surface area of asbestos insulation (m^2)\n",
+ "R1 = 1/(h1*A1) #Inside convection resistance (\u00b0C/W)\n",
+ "R2 = log(r2/r1)/(2*pi*k2*L) #Conduction resistance through the tube (\u00b0C/W)\n",
+ "R3 = 1/(h2*A2) #Outside convection resistance (\u00b0C/W)\n",
+ "Rt1 = R1+R2+R3 #Total resistance without insulation (\u00b0C/W)\n",
+ "Q1 = (T1 - T5)/Rt1 #Heat transfer rate without insulation (W)\n",
+ "R4 = log(r3/r2)/(2*pi*k3*L) #Conduction resistance associated with the insulation (\u00b0C/W) (part 2)\n",
+ "R5 = 1/(h2*A3) #Outside convection resistance (\u00b0C/W)\n",
+ "Rt2 = R1+R2+R4+R5 #Total rsistance with the insulation (\u00b0C/W)\n",
+ "Q2 = (T1-T5)/Rt2 #Heat transfer rate with the insulation (W)\n",
+ "U1 = 1/(Rt2*A1) #Overall heat transfer coefficient based on the inside area (W/m^2.K) (part 3)\n",
+ "U3 = 1/(Rt2*A3) #Overall heat transfer coefficient based on the outside area (W/m^2.K) (part 4)\n",
+ "T3 = T1-(R1+R2)*Q2 #Temperature at the steel\u2013insulation interface (\u00b0C) (part 5)\n",
+ "Bi1 = h2*(2*r3)/k3 #Outside Biot number (part 6)\n",
+ "Bi2 = h1*(2*r1)/k2 #Inside Biot number\n",
+ "Nu = h1*(2*r1)/k4 #Nusselt number of the air\n",
+ "rlm = (r3-r2)/log(r3/r2) #Log mean radius of the insulation (m) (part 7)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The rate of heat transfer without insulation is :\",round(Q1,1),\" W.\"\n",
+ "print \"2. The rate of heat transfer with insulation is :\",round(Q2,1),\" W.\"\n",
+ "print \"3. The overall heat transfer coefficient based on the inside area of the tube is :\",round(U1,2),\" W/m^2.K .\"\n",
+ "print \"4. The overall heat transfer coefficient based on the outside area of the insulation is :\",round(U3,1),\" W/m^2.K .\"\n",
+ "print \"5. The temperature, T3, at the steel\u2013insulation interface is :\",round(T3,1),\" \u00b0C.\"\n",
+ "print \"6. The inside Biot numbers is :\",round(Bi2,2),\" .\"\n",
+ "print \" The outside Biot numbers is :\",round(Bi1,2),\" .\"\n",
+ "print \" The Nusselt number is :\",round(Nu,1),\" .\"\n",
+ "print \"7. The log mean radius of insulation is :\",round(rlm*100,2),\" cm.\"\n",
+ "print \"There is a printing mistake in book for unit in part 7.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The rate of heat transfer without insulation is : 128.1 W.\n2. The rate of heat transfer with insulation is : 99.2 W.\n3. The overall heat transfer coefficient based on the inside area of the tube is : 11.76 W/m^2.K .\n4. The overall heat transfer coefficient based on the outside area of the insulation is : 3.4 W/m^2.K .\n5. The temperature, T3, at the steel\u2013insulation interface is : 116.3 \u00b0C.\n6. The inside Biot numbers is : 0.22 .\n The outside Biot numbers is : 5.32 .\n The Nusselt number is : 172.7 .\n7. The log mean radius of insulation is : 2.33 cm.\nThere is a printing mistake in book for unit in part 7.\n"
+ "text": [
+ "1. The rate of heat transfer without insulation is : 128.1 W.\n",
+ "2. The rate of heat transfer with insulation is : 99.2 W.\n",
+ "3. The overall heat transfer coefficient based on the inside area of the tube is : 11.76 W/m^2.K .\n",
+ "4. The overall heat transfer coefficient based on the outside area of the insulation is : 3.4 W/m^2.K .\n",
+ "5. The temperature, T3, at the steel\u2013insulation interface is : 116.3 \u00b0C.\n",
+ "6. The inside Biot numbers is : 0.22 .\n",
+ " The outside Biot numbers is : 5.32 .\n",
+ " The Nusselt number is : 172.7 .\n",
+ "7. The log mean radius of insulation is : 2.33 cm.\n",
+ "There is a printing mistake in book for unit in part 7.\n"
+ ]
}
],
"prompt_number": 16
@@ -206,19 +516,58 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.11, Page number: 424"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.11, Page number: 424"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A recently developed synthetic oil is stored in a vertical tank 10 feet in diameter and 30 feet\nhigh which is insulated with a 2-inch layer of insulation (k = 0.039 Btu/h.ft.\u00b0F). To prevent\nfreezing of the oil, it is maintained at a temperature of 115\u00b0F by a heating coil consisting of an\n18-gauge, 3/4-inch copper tube (k = 224 Btu/h.ft.\u00b0F) containing saturated steam at 10 psig.\nAssuming that the minimum outdoor temperature is 5\u00b0F and that the oil temperature is uniform,\ncalculate of copper tubing required in feet to maintain the tank at 120\u00b0F in the coldest weather.\nNeglect upper and lower tank surface heat losses. The following additional information is\nprovided:\nSteam condensing inside coil, h = 800 Btu/h.ft^2.\u00b0F\nOil outside coil, h = 40 Btu/h.ft^2\u00b0F\nOil inside tank wall, h = 40 Btu/h.ft^2\u00b0F\nOuter tank wall to ambient air, h = 2.0 Btu/h.ft^2.\u00b0F\n'''\n\nfrom __future__ import division\nfrom math import pi\n\n#Variable declaration:\nh1 = 800 #Heat transfer coefficient for steam condensing inside coil (Btu/h.ft^2.\u00b0F)\nh2 = 40 #Heat transfer coefficient for oil outside coil (Btu/h.ft^2.\u00b0F)\nh3 = 40 #Heat transfer coefficient for oil inside tank wal (Btu/h.ft^2.\u00b0F)\nh4 = 2 #Heat transfer coefficient for outer tank wall to ambient air (Btu/h.ft^2.\u00b0F)\nk1 = 0.039 #Thermal conductivity of insulation layer (Btu/h.ft.\u00b0F)\nl1 = 2/12 #Thickness of insulation layer (ft)\nD = 10 #Diameter of tank (ft)\nH = 30 #Height of tank (ft)\nk2 = 224 #Thermal conductivity of copper tube (Btu/h.ft.\u00b0F)\nl2 = (3/4)/12 #Thickness of insulation layer (ft)\nT1 = 120 #Temperature of tank (\u00b0F)\nT2 = 5 #Outdoor temperature (\u00b0F)\n\n#Calculation:\nUo1 = 1/(1/h3+(l1/k1)+1/h4) #Overall heat transfer coefficient for tank (Btu/h.ft^2.\u00b0F)\nAt = pi*(D+2*l1)*H #Surface area of tank (ft^2)\nQ = Uo1*At*(T1-T2) #Heat transfer rate lost from the tank (Btu/h)\n#From table 6.3:\nl2 = 0.049/12 #Thickness of coil (ft)\nA = 0.1963 #Area of 18 guage, 3/4-inch copper tube (ft^2/ft)\nUo2 = 1/(1/h2+(l2/k2)+1/h1) #Overall heat transfer coefficient for coil (Btu/h.ft^2.\u00b0F)\n#From steam tables:\nTst = 240 #Temperature for 10 psia (24.7 psia) steam (\u00b0F)\nAc = Q/(Uo2*(Tst-T1)) #Area of tube (ft^2)\nL = Ac/A #Lengt of tube (ft)\n\n#Result:\nprint \"The length ofcopper tubing required is :\",round(L,1),\" ft .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "h1 = 800 #Heat transfer coefficient for steam condensing inside coil (Btu/h.ft^2.\u00b0F)\n",
+ "h2 = 40 #Heat transfer coefficient for oil outside coil (Btu/h.ft^2.\u00b0F)\n",
+ "h3 = 40 #Heat transfer coefficient for oil inside tank wal (Btu/h.ft^2.\u00b0F)\n",
+ "h4 = 2 #Heat transfer coefficient for outer tank wall to ambient air (Btu/h.ft^2.\u00b0F)\n",
+ "k1 = 0.039 #Thermal conductivity of insulation layer (Btu/h.ft.\u00b0F)\n",
+ "l1 = 2/12 #Thickness of insulation layer (ft)\n",
+ "D = 10 #Diameter of tank (ft)\n",
+ "H = 30 #Height of tank (ft)\n",
+ "k2 = 224 #Thermal conductivity of copper tube (Btu/h.ft.\u00b0F)\n",
+ "l2 = (3/4)/12 #Thickness of insulation layer (ft)\n",
+ "T1 = 120 #Temperature of tank (\u00b0F)\n",
+ "T2 = 5 #Outdoor temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Uo1 = 1/(1/h3+(l1/k1)+1/h4) #Overall heat transfer coefficient for tank (Btu/h.ft^2.\u00b0F)\n",
+ "At = pi*(D+2*l1)*H #Surface area of tank (ft^2)\n",
+ "Q = Uo1*At*(T1-T2) #Heat transfer rate lost from the tank (Btu/h)\n",
+ "#From table 6.3:\n",
+ "l2 = 0.049/12 #Thickness of coil (ft)\n",
+ "A = 0.1963 #Area of 18 guage, 3/4-inch copper tube (ft^2/ft)\n",
+ "Uo2 = 1/(1/h2+(l2/k2)+1/h1) #Overall heat transfer coefficient for coil (Btu/h.ft^2.\u00b0F)\n",
+ "#From steam tables:\n",
+ "Tst = 240 #Temperature for 10 psia (24.7 psia) steam (\u00b0F)\n",
+ "Ac = Q/(Uo2*(Tst-T1)) #Area of tube (ft^2)\n",
+ "L = Ac/A #Lengt of tube (ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The length ofcopper tubing required is :\",round(L,1),\" ft .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The length ofcopper tubing required is : 26.0 ft .\n"
+ "text": [
+ "The length ofcopper tubing required is : 26.0 ft .\n"
+ ]
}
],
"prompt_number": 17
@@ -227,19 +576,67 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.12, Page number: 426"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.12, Page number: 426"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Ricci and Theodore (R&T) Consultants have been assigned the job of selecting insulation for all\nthe plant piping at the local power plant. Included in the plant piping are 8000 ft of 1-inch schedule\n40 steel (1% C) pipe carrying steam at 240\u00b0F. It is estimated that the heat transfer coefficient\nfor condensing steam on the inside of the pipe is 2000 Btu/h.ft^2.\u00b0F. The air temperature outside\nof the pipe can drop to 20\u00b0F, and with wind motion the outside heat transfer coefficient can\nbe as high as 100 Btu/h.ft.\u00b0F.\nR&T have decided to use a fiberglass insulation having a thermal conductivity of 0.01\nBtu/h . ft . \u00b0F. It is available in 6 ft lengths in the four thicknesses listed below:\n3/8-inch thick $1.51/6 ft length\n1/2-inch thick $3.54/6 ft length\n3/4-inch thick $5.54/6 ft length\n1-inch thick $8.36/6 ft length\nCalculate the energy saved per dollar of insulation investment in going from 3/8-inch to 1/2-inch\nthick insulation. Repeat this calculation in going from 1/2-inch to 3/4-inch and 3/4-inch to 1-inch.\nExpress the results in units of Btu/h per dollar.\n'''\n\nfrom __future__ import division\nfrom math import pi, log\nfrom numpy import array,log as LOG\n\n#Variable declaration:\n#For 1-inch pipe schedule 40:\nDi = 1.049/12 #Inside diameter (ft)\nDo = 1.315/12 #Outside diameter (ft)\nL = 8000 #Length of pipe (ft)\nhi = 2000 #Heat transfer coefficient inside of the pipe (Btu/h.ft^2.\u00b0F)\nho = 100 #Outside heat transfer coefficient (Btu/h.ft.\u00b0F)\nkl = 0.01 #Thermal conductivity of insulation (Btu/h.ft.\u00b0F)\nT1 = 240 #Steam temperature (\u00b0F)\nT2 = 20 #Air temperature (\u00b0F)\nk = 24.8 #Thermal conductivity for steel (Btu/h.ft.\u00b0F)\nDxl = array([3/8,1/2,3/4,1])/12 #thickness(ft)\namt = array([1.51,3.54,5.54,8.36])/6 #Cost per feet($) \n\n#Calculation:\nD_ = (Do-Di)/log(Do/Di) #Log-mean diameter of the pipe (ft)\nDl = Do+2*(Dxl) #Insulation thickness (ft)\nD_l = (Dl-Do)/LOG(Dl/Do) #Log mean diameter of pipe (ft)\nDxw = (Do-Di)/2 #Pipe thickness (ft)\nRw = Dxw/(k*pi*D_*L) #Wall resistance ((Btu/h.\u00b0F)^-1)\nRi = 1/(hi*pi*Di*L) #Inside steam convection resistance ((Btu/h.\u00b0F)^-1)\nRl = Dxl/(kl*pi*D_l*L) #Insulation resistance ((Btu/h.\u00b0F)^-1)\nRo = 1/(ho*pi*Dl*L) #Outside air convection resistance ((Btu/h.\u00b0F)^-1)\nR = Ri+Rw+Rl+Ro #Total resistance ((Btu/h.\u00b0F)^-1)\nUo = 1/(R*pi*Dl*L) #Overall outside heat transfer coefficient (Btu/h.ft^2.\u00b0F)\nUi = 1/(R*pi*Di*L) #Overall inside heat transfer coefficient (Btu/h.ft^2.\u00b0F)\ndT = T1-T2\nAi = pi*Di*L #Inside area (ft^2)\nQ = Ui*Ai*dT #Energy loss (Btu/h)\ndef energyPerDollar(Q1,Q2,amt1,amt2):\n return round((Q1-Q2)/(8000*(amt2-amt1)),1)\n\n#Results:\nprint \"Energy saved per dollar ingoing from 3/8 to 1/2 inch is :\",energyPerDollar(Q[0],Q[1],amt[0],amt[1]),' Btu/h.$'\nprint \"Energy saved per dollar ingoing from 1/2 to 3/4 inch is :\",energyPerDollar(Q[1],Q[2],amt[1],amt[2]),' Btu/h.$'\nprint \"Energy saved per dollar ingoing from 3/4 to 1 inch is :\",energyPerDollar(Q[2],Q[3],amt[2],amt[3]),' Btu/h.$'",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi, log\n",
+ "from numpy import array,log as LOG\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#For 1-inch pipe schedule 40:\n",
+ "Di = 1.049/12 #Inside diameter (ft)\n",
+ "Do = 1.315/12 #Outside diameter (ft)\n",
+ "L = 8000 #Length of pipe (ft)\n",
+ "hi = 2000 #Heat transfer coefficient inside of the pipe (Btu/h.ft^2.\u00b0F)\n",
+ "ho = 100 #Outside heat transfer coefficient (Btu/h.ft.\u00b0F)\n",
+ "kl = 0.01 #Thermal conductivity of insulation (Btu/h.ft.\u00b0F)\n",
+ "T1 = 240 #Steam temperature (\u00b0F)\n",
+ "T2 = 20 #Air temperature (\u00b0F)\n",
+ "k = 24.8 #Thermal conductivity for steel (Btu/h.ft.\u00b0F)\n",
+ "Dxl = array([3/8,1/2,3/4,1])/12 #thickness(ft)\n",
+ "amt = array([1.51,3.54,5.54,8.36])/6 #Cost per feet($) \n",
+ "\n",
+ "#Calculation:\n",
+ "D_ = (Do-Di)/log(Do/Di) #Log-mean diameter of the pipe (ft)\n",
+ "Dl = Do+2*(Dxl) #Insulation thickness (ft)\n",
+ "D_l = (Dl-Do)/LOG(Dl/Do) #Log mean diameter of pipe (ft)\n",
+ "Dxw = (Do-Di)/2 #Pipe thickness (ft)\n",
+ "Rw = Dxw/(k*pi*D_*L) #Wall resistance ((Btu/h.\u00b0F)^-1)\n",
+ "Ri = 1/(hi*pi*Di*L) #Inside steam convection resistance ((Btu/h.\u00b0F)^-1)\n",
+ "Rl = Dxl/(kl*pi*D_l*L) #Insulation resistance ((Btu/h.\u00b0F)^-1)\n",
+ "Ro = 1/(ho*pi*Dl*L) #Outside air convection resistance ((Btu/h.\u00b0F)^-1)\n",
+ "R = Ri+Rw+Rl+Ro #Total resistance ((Btu/h.\u00b0F)^-1)\n",
+ "Uo = 1/(R*pi*Dl*L) #Overall outside heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "Ui = 1/(R*pi*Di*L) #Overall inside heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "dT = T1-T2\n",
+ "Ai = pi*Di*L #Inside area (ft^2)\n",
+ "Q = Ui*Ai*dT #Energy loss (Btu/h)\n",
+ "def energyPerDollar(Q1,Q2,amt1,amt2):\n",
+ " return round((Q1-Q2)/(8000*(amt2-amt1)),1)\n",
+ "\n",
+ "#Results:\n",
+ "print \"Energy saved per dollar ingoing from 3/8 to 1/2 inch is :\",energyPerDollar(Q[0],Q[1],amt[0],amt[1]),' Btu/h.$'\n",
+ "print \"Energy saved per dollar ingoing from 1/2 to 3/4 inch is :\",energyPerDollar(Q[1],Q[2],amt[1],amt[2]),' Btu/h.$'\n",
+ "print \"Energy saved per dollar ingoing from 3/4 to 1 inch is :\",energyPerDollar(Q[2],Q[3],amt[2],amt[3]),' Btu/h.$'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Energy saved per dollar ingoing from 3/8 to 1/2 inch is : 18.2 Btu/h.$\nEnergy saved per dollar ingoing from 1/2 to 3/4 inch is : 18.8 Btu/h.$\nEnergy saved per dollar ingoing from 3/4 to 1 inch is : 6.8 Btu/h.$\n"
+ "text": [
+ "Energy saved per dollar ingoing from 3/8 to 1/2 inch is : 18.2 Btu/h.$\n",
+ "Energy saved per dollar ingoing from 1/2 to 3/4 inch is : 18.8 Btu/h.$\n",
+ "Energy saved per dollar ingoing from 3/4 to 1 inch is : 6.8 Btu/h.$\n"
+ ]
}
],
"prompt_number": 3
@@ -248,19 +645,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.16, Page number: 434"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.16, Page number: 434"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the outer critical radius of insulation on a 2.0-inch OD pipe. Assume the air flow coefficient\nto be 1.32 Btu/h.ft^2.\u00b0F and the loosely-packed insulation\u2019s thermal conductivity to be\n0.44 Btu/h.ft.\u00b0F. Comment on the effect of insulation on the heat rate lost from the pipe.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nki = 0.44 #Thermal conductivity of insulation (Btu/h.ft.\u00b0F)\nho = 1.32 #Air flow coefficient (Btu/h.ft^2.\u00b0F)\nOD = 2 #Outside diameter of pipe (in)\n\n#Calculation:\nrc = (ki/ho)*12 #Outer critical radius of insulation (in)\nro = OD/2 #Outside radius of pipe (in)\nL = rc-ro #Critical insulation thickness (in)\n\n#Result:\nprint \"The outer critical radius of insulation is :\",round(rc),\" in .\"\nif ro<rc:\n print \"Since, ro<rc, the heat loss will increase as insulation is added.\"\nelse :\n print \"Sice, ro>rc, the heat loss will decrease as insulation is added.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "ki = 0.44 #Thermal conductivity of insulation (Btu/h.ft.\u00b0F)\n",
+ "ho = 1.32 #Air flow coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "OD = 2 #Outside diameter of pipe (in)\n",
+ "\n",
+ "#Calculation:\n",
+ "rc = (ki/ho)*12 #Outer critical radius of insulation (in)\n",
+ "ro = OD/2 #Outside radius of pipe (in)\n",
+ "L = rc-ro #Critical insulation thickness (in)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The outer critical radius of insulation is :\",round(rc),\" in .\"\n",
+ "if ro<rc:\n",
+ " print \"Since, ro<rc, the heat loss will increase as insulation is added.\"\n",
+ "else :\n",
+ " print \"Sice, ro>rc, the heat loss will decrease as insulation is added.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The outer critical radius of insulation is : 4.0 in .\nSince, ro<rc, the heat loss will increase as insulation is added.\n"
+ "text": [
+ "The outer critical radius of insulation is : 4.0 in .\n",
+ "Since, ro<rc, the heat loss will increase as insulation is added.\n"
+ ]
}
],
"prompt_number": 21
@@ -269,19 +692,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.18, Page number: 439"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.18, Page number: 439"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A flat incinerator wall with a surface area of 480 ft^2 consists of 6 inches of firebrick with a thermal\nconductivity of 0.61 Btu/h.ft.\u00b0F and an 8-inch outer layer of rock wool insulation with a\nthermal conductivity of 0.023 Btu/h.ft.\u00b0F. If the temperature of the insulation of the inside\nface of the firebrick and the outside surface of the rock wool insulation are 1900 and 140\u00b0F,\nrespectively, calculate the following:\n1. The heat loss through the wall in Btu/h.\n2. The temperature of the interface between the firebrick and the rock wool.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nLf = 6/12 #Length of firebrick (ft)\nkf = 0.61 #Thermal conductivity of firebrick (Btu/h.ft.\u00b0F)\nA = 480 #Surface area of wall (ft^2)\nLw = 8/12 #Length of rock wool (ft)\nkw = 0.023 #Thermal conductivity of rock wool (Btu/h.ft.\u00b0F)\nT1 = 1900 #Temperature of insulation of firebrick (\u00b0F)\nT2 = 140 #Temperature of insulation of rock wool (\u00b0F)\n\n#Calculation:\nRf = Lf/(kf*A) #Resistance of firebrick (h.\u00b0F/Btu)\nRw = Lw/(kw*A) #Resistance of rock wool (h.\u00b0F/Btu)\nR = Rf+Rw #Total resitance (h.\u00b0F/Btu)\nQ = (T1-T2)/R #Heat loss through the wall (Btu/h)\n\n#Result:\nprint \"The heat loss through the wall is :\",round(Q),\" Btu/h .\"\n ",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Lf = 6/12 #Length of firebrick (ft)\n",
+ "kf = 0.61 #Thermal conductivity of firebrick (Btu/h.ft.\u00b0F)\n",
+ "A = 480 #Surface area of wall (ft^2)\n",
+ "Lw = 8/12 #Length of rock wool (ft)\n",
+ "kw = 0.023 #Thermal conductivity of rock wool (Btu/h.ft.\u00b0F)\n",
+ "T1 = 1900 #Temperature of insulation of firebrick (\u00b0F)\n",
+ "T2 = 140 #Temperature of insulation of rock wool (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Rf = Lf/(kf*A) #Resistance of firebrick (h.\u00b0F/Btu)\n",
+ "Rw = Lw/(kw*A) #Resistance of rock wool (h.\u00b0F/Btu)\n",
+ "R = Rf+Rw #Total resitance (h.\u00b0F/Btu)\n",
+ "Q = (T1-T2)/R #Heat loss through the wall (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The heat loss through the wall is :\",round(Q),\" Btu/h .\"\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The heat loss through the wall is : 28344.0 Btu/h .\n"
+ "text": [
+ "The heat loss through the wall is : 28344.0 Btu/h .\n"
+ ]
}
],
"prompt_number": 24
@@ -290,19 +740,65 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.19, Page number: 440"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.19, Page number: 440"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Heat is flowing from steam on one side of a 0.375-inch thick vertical steel sheet to air on the\nother side. The steam heat-transfer coefficient is 1700 Btu/h.ft^2.\u00b0F and that of the air is\n2.0 Btu/h.ft^2.\u00b0F. The total temperature difference is 120\u00b0F. How would the rate of heat transfer\nbe affected if:\n1. the wall was copper rather than steel,\n2. by increasing the steam coefficient to 2500, and\n3. by increasing the air coefficient to 12.0?\nNote that the thermal conductivities, k, for steel and copper are 26 and 218 Btu/h.ft.\u00b0F,\nrespectively.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nh1 = 1700 #Steam heat-transfer coefficient (Btu/h.ft^2.\u00b0F)\nh2 = 2 #Air heat-transfer coefficient (Btu/h.ft^2.\u00b0F)\nA = 1 #Area of base (ft^2) (assumption)\nk1 = 26 #Thermal conductivity of steel (Btu/h.ft.\u00b0F)\nk2 = 218 #Thermal conductivity of copper (Btu/h.ft.\u00b0F)\nt = 0.375 #Thickness of steel sheet (in)\nh3 = 2500 #Increased steam heat-transfer coefficient (Btu/h.ft^2.\u00b0F)\nh4 = 12 #Increased air heat-transfer coefficient (Btu/h.ft^2.\u00b0F)\n\n#Calculation:\nR1 = 1/(h1*A) #Steam resistance (h.\u00b0F/Btu)\nR2 = 1/(h2*A) #Air resistance (h.\u00b0F/Btu)\nR3 = (t/12)/(k1*A) #Steel resistance (h.\u00b0F/Btu)\nRt1 = R1+R2+R3 #Total resistance (with steel) (h.\u00b0F/Btu)\nR4 = (t/12)/(k2*A) #Copper resistance (h.\u00b0F/Btu) (part 1)\nRt2 = R1+R2+R4 #Total resistance (with copper) (h.\u00b0F/Btu)\nR5 = 1/(h1*A) #New steam resistance (h.\u00b0F/Btu)\nRt3 = R5+R2+R3 #Total resistance after increasing the steam coefficient (h.\u00b0F/Btu)\nR6 = 1/(h4*A) #Air resistance (h.\u00b0F/Btu)\nRt4 = R1+R6+R3 #Total resistance after increasing the air coefficient (h.\u00b0F/Btu)\n\n#Result:\nif (Rt1==Rt2):\n print \"1.The rate of heat transfer is essentially unaffected.\"\nelse :\n print \"1. The rate of heat transfer is essentially affected.\"\nif (Rt1==Rt3):\n print \"2. The rate is again unaffected.\"\nelse :\n print \"2. The rate is again affected.\"\nif (Rt1==Rt4):\n print \"3. The rate is unaffected for this case.\"\nelse :\n print \"3. The rate is affected for this case.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "h1 = 1700 #Steam heat-transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "h2 = 2 #Air heat-transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "A = 1 #Area of base (ft^2) (assumption)\n",
+ "k1 = 26 #Thermal conductivity of steel (Btu/h.ft.\u00b0F)\n",
+ "k2 = 218 #Thermal conductivity of copper (Btu/h.ft.\u00b0F)\n",
+ "t = 0.375 #Thickness of steel sheet (in)\n",
+ "h3 = 2500 #Increased steam heat-transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "h4 = 12 #Increased air heat-transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "R1 = 1/(h1*A) #Steam resistance (h.\u00b0F/Btu)\n",
+ "R2 = 1/(h2*A) #Air resistance (h.\u00b0F/Btu)\n",
+ "R3 = (t/12)/(k1*A) #Steel resistance (h.\u00b0F/Btu)\n",
+ "Rt1 = R1+R2+R3 #Total resistance (with steel) (h.\u00b0F/Btu)\n",
+ "R4 = (t/12)/(k2*A) #Copper resistance (h.\u00b0F/Btu) (part 1)\n",
+ "Rt2 = R1+R2+R4 #Total resistance (with copper) (h.\u00b0F/Btu)\n",
+ "R5 = 1/(h1*A) #New steam resistance (h.\u00b0F/Btu)\n",
+ "Rt3 = R5+R2+R3 #Total resistance after increasing the steam coefficient (h.\u00b0F/Btu)\n",
+ "R6 = 1/(h4*A) #Air resistance (h.\u00b0F/Btu)\n",
+ "Rt4 = R1+R6+R3 #Total resistance after increasing the air coefficient (h.\u00b0F/Btu)\n",
+ "\n",
+ "#Result:\n",
+ "if (Rt1==Rt2):\n",
+ " print \"1.The rate of heat transfer is essentially unaffected.\"\n",
+ "else :\n",
+ " print \"1. The rate of heat transfer is essentially affected.\"\n",
+ "if (Rt1==Rt3):\n",
+ " print \"2. The rate is again unaffected.\"\n",
+ "else :\n",
+ " print \"2. The rate is again affected.\"\n",
+ "if (Rt1==Rt4):\n",
+ " print \"3. The rate is unaffected for this case.\"\n",
+ "else :\n",
+ " print \"3. The rate is affected for this case.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The rate of heat transfer is essentially affected.\n2. The rate is again unaffected.\n3. The rate is affected for this case.\n"
+ "text": [
+ "1. The rate of heat transfer is essentially affected.\n",
+ "2. The rate is again unaffected.\n",
+ "3. The rate is affected for this case.\n"
+ ]
}
],
"prompt_number": 25
@@ -311,19 +807,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 19.20, Page number: 441"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 19.20, Page number: 441"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''An incinerator is 30 ft long, has a 12-ft ID and is constructed of 3/4-inch carbon steel. The inside of\nthe steel shell is protected by 10 in. of firebrick (k = 0.608 Btu/h.ft.\u00b0F) and 5 inches of Sil-o-cel\ninsulation (k = 0.035 Btu/h.ft.\u00b0F) covers the outside. The ambient air temperature is 85\u00b0F\nand the average inside temperature is 1800\u00b0F. The present heat loss through the furnace wall\nis 6% of the heat generated by combustion of a fuel. Calculate the thickness of Sil-o-cel\ninsulation that must be added to cut the losses to 3%.\n'''\n\nfrom __future__ import division\nfrom math import pi, log, exp\n\n#Variable declaration:\nrfo = 12/2 #Outside radius of firebrick (ft)\nrfi = 5.167 #Inside radius of firebrick (ft)\nrso = 6.479 #Outside radius of sil-o-cel (ft)\nrsi = 6.063 #Inside radius of fsil-o-cel (ft)\nL = 30 #Length of incinerator (ft)\nkf = 0.608 #Thermal conductivity of firebrick (Btu/h.ft.\u00b0F)\nks = 0.035 #Thermal conductivity of sil-o-cel (Btu/h.ft.\u00b0F)\n\n#Calculation:\nRf= log(rfo/rfi)/(2*pi*L*kf) #Resistance of firebrick (h.ft.\u00b0F/Btu)\nRs= log(rso/rsi)/(2*pi*L*ks) #Resistance of sil-o-cel (h.ft.\u00b0F/Btu)\nR = Rf+Rs #Total resistance (h.ft.\u00b0F/Btu)\nro = exp(R*(2*pi*L*ks))*rso #New outside radius of sil-o-cel (ft)\nr= ro-rso #Extra thickness (ft)\n\n#Result:\nprint \"The extra thickness is :\",round(r,3),\" ft.\"\nprint \"Or, the extra thickness is :\",round(r*12,2),\" in.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import pi, log, exp\n",
+ "\n",
+ "#Variable declaration:\n",
+ "rfo = 12/2 #Outside radius of firebrick (ft)\n",
+ "rfi = 5.167 #Inside radius of firebrick (ft)\n",
+ "rso = 6.479 #Outside radius of sil-o-cel (ft)\n",
+ "rsi = 6.063 #Inside radius of fsil-o-cel (ft)\n",
+ "L = 30 #Length of incinerator (ft)\n",
+ "kf = 0.608 #Thermal conductivity of firebrick (Btu/h.ft.\u00b0F)\n",
+ "ks = 0.035 #Thermal conductivity of sil-o-cel (Btu/h.ft.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Rf= log(rfo/rfi)/(2*pi*L*kf) #Resistance of firebrick (h.ft.\u00b0F/Btu)\n",
+ "Rs= log(rso/rsi)/(2*pi*L*ks) #Resistance of sil-o-cel (h.ft.\u00b0F/Btu)\n",
+ "R = Rf+Rs #Total resistance (h.ft.\u00b0F/Btu)\n",
+ "ro = exp(R*(2*pi*L*ks))*rso #New outside radius of sil-o-cel (ft)\n",
+ "r= ro-rso #Extra thickness (ft)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The extra thickness is :\",round(r,3),\" ft.\"\n",
+ "print \"Or, the extra thickness is :\",round(r*12,2),\" in.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The extra thickness is : 0.504 ft.\nOr, the extra thickness is : 6.05 in.\n"
+ "text": [
+ "The extra thickness is : 0.504 ft.\n",
+ "Or, the extra thickness is : 6.05 in.\n"
+ ]
}
],
"prompt_number": 28
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_21.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_21.ipynb
index 1566d542..5f8510ce 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_21.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_21.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 21"
+ "name": "",
+ "signature": "sha256:bd26ff767164e3be8b1fcb13ef6fd471083a3c697418421a2ed4fbad1197f805"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,58 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 21: Entropy Considerations and Analysis"
+ "source": [
+ "Chapter 21: Entropy Considerations and Analysis"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 21.1, Page number: 460"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 21.1, Page number: 460"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Case I, Figure 21.3, above. Calculate the entropy change of the two exchangers. For the\npurposes of analysis, arbitrarily assume cp = l.0 Btu/lb.\u00b0F and mH = mC = l.0 lb\n'''\n\nfrom __future__ import division\nfrom math import log\n\n#Variable declaration:\nm = 1 #Mass flowrate (lb)\ncP = 1 #Heat capacity (Btu/lb.\u00b0F)\n#From figure 21.3:\nT1 = 300 #Temperature of hot fluid leaving exchanger (\u00b0F)\nT2 = 540 #Temperature of hot fluid entering exchanger (\u00b0F)\nT3 = 60 #Temperature of cold fluid leaving exchanger (\u00b0F)\nT4 = 300 #Temperature of cold fluid entering exchanger (\u00b0F)\n\n#Calculation:\nDSh = m*cP*log((T1+460)/(T2+460)) #Entropy for hot fluid (Btu/\u00b0F)\nDSc = m*cP*log((T4+460)/(T3+460)) #Entropy for cold fluid (Btu/\u00b0F)\nDSa = DSh+DSc #Entropy for one exchanger (Btu/\u00b0F)\nDSt = DSa*2 #Total entropy change (Btu/\u00b0F)\n\n#Result:\nprint \"The entropy chage is :\",round(DSt,4),\" Btu/\u00b0F .\"\nif (DSt>0):\n print \"There is a positive entropy change.\"\nelse :\n print \"There is a negative entropy change.\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "m = 1 #Mass flowrate (lb)\n",
+ "cP = 1 #Heat capacity (Btu/lb.\u00b0F)\n",
+ "#From figure 21.3:\n",
+ "T1 = 300 #Temperature of hot fluid leaving exchanger (\u00b0F)\n",
+ "T2 = 540 #Temperature of hot fluid entering exchanger (\u00b0F)\n",
+ "T3 = 60 #Temperature of cold fluid leaving exchanger (\u00b0F)\n",
+ "T4 = 300 #Temperature of cold fluid entering exchanger (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DSh = m*cP*log((T1+460)/(T2+460)) #Entropy for hot fluid (Btu/\u00b0F)\n",
+ "DSc = m*cP*log((T4+460)/(T3+460)) #Entropy for cold fluid (Btu/\u00b0F)\n",
+ "DSa = DSh+DSc #Entropy for one exchanger (Btu/\u00b0F)\n",
+ "DSt = DSa*2 #Total entropy change (Btu/\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The entropy chage is :\",round(DSt,4),\" Btu/\u00b0F .\"\n",
+ "if (DSt>0):\n",
+ " print \"There is a positive entropy change.\"\n",
+ "else :\n",
+ " print \"There is a negative entropy change.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The entropy chage is : 0.2101 Btu/\u00b0F .\nThere is a positive entropy change.\n"
+ "text": [
+ "The entropy chage is : 0.2101 Btu/\u00b0F .\n",
+ "There is a positive entropy change.\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +72,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 21.2, Page number: 461"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 21.2, Page number: 461"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Case II, Figure 21.4. Calculate the entropy change of exchangers C and D.'''\n\nfrom __future__ import division\nfrom math import log\n\n#Variable declaration:\n#From example 21.1:\nDSh = -0.2744 #Entropy for hot fluid (Btu/\u00b0F)\nDSc = 0.3795 #Entropy for cold fluid (Btu/\u00b0F)\nm = 1 #Mass flowrate (lb)\ncP = 1 #Heat capacity (Btu/lb.\u00b0F)\n#From figure 21.4:\nDT = 0 #Temperature difference driving force (\u00b0F)\nDS_D = 0 #Entropy for D exchanger (Btu/\u00b0F)\n\n#Calculation:\nDS_C = DSh+DSc #Entropy for C exchanger (Btu/\u00b0F)\nDSt = DS_C+DS_D #Total entropy change of exchangers (Btu/\u00b0F)\n\n#Result:\nprint \"The total entropy change is :\",DSt,\" Btu/\u00b0F .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 21.1:\n",
+ "DSh = -0.2744 #Entropy for hot fluid (Btu/\u00b0F)\n",
+ "DSc = 0.3795 #Entropy for cold fluid (Btu/\u00b0F)\n",
+ "m = 1 #Mass flowrate (lb)\n",
+ "cP = 1 #Heat capacity (Btu/lb.\u00b0F)\n",
+ "#From figure 21.4:\n",
+ "DT = 0 #Temperature difference driving force (\u00b0F)\n",
+ "DS_D = 0 #Entropy for D exchanger (Btu/\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DS_C = DSh+DSc #Entropy for C exchanger (Btu/\u00b0F)\n",
+ "DSt = DS_C+DS_D #Total entropy change of exchangers (Btu/\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The total entropy change is :\",DSt,\" Btu/\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The total entropy change is : 0.1051 Btu/\u00b0F .\n"
+ "text": [
+ "The total entropy change is : 0.1051 Btu/\u00b0F .\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +119,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 21.3, Page number: 462"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 21.3, Page number: 462"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Case III, Figure 21.5. Calculate the entropy change in exchangers E and F.'''\n\nfrom __future__ import division\nfrom math import log\n\n#Variable declaration:\n#From figure 21.5:\nm = 2 #Mass flowrate (lb)\ncP = 1 #Heat capacity (Btu/lb.\u00b0F)\nDS1 = -0.2744 #Entropy for hot fluid for E exchanger (Btu/\u00b0F)\nT1 = 180 #Temperature cold fluid entering the E exchabger (\u00b0F)\nT2 = 60 #Temperature cold fluid leaving the E exchabger (\u00b0F)\n\n#Calculation:\nDS2 = m*cP*log((T1+460)/(T2+460)) #Entropy for cold fluid for E exchanger (Btu/\u00b0F)\nDS_E = DS1+DS2 #Entropy for E exchanger (Btu/\u00b0F)\nDS_F = DS_E #Entropy for F exchanger (Btu/\u00b0F)\nDSt = DS_F+DS_E #Entropy change in exchangers E and F (Btu/\u00b0F)\n\n#Result:\nprint \"The entropy change in exchangers E and F is :\",round(DSt,4),\" Btu/\u00b0F .\"",
+ "input": [
+ "\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From figure 21.5:\n",
+ "m = 2 #Mass flowrate (lb)\n",
+ "cP = 1 #Heat capacity (Btu/lb.\u00b0F)\n",
+ "DS1 = -0.2744 #Entropy for hot fluid for E exchanger (Btu/\u00b0F)\n",
+ "T1 = 180 #Temperature cold fluid entering the E exchabger (\u00b0F)\n",
+ "T2 = 60 #Temperature cold fluid leaving the E exchabger (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DS2 = m*cP*log((T1+460)/(T2+460)) #Entropy for cold fluid for E exchanger (Btu/\u00b0F)\n",
+ "DS_E = DS1+DS2 #Entropy for E exchanger (Btu/\u00b0F)\n",
+ "DS_F = DS_E #Entropy for F exchanger (Btu/\u00b0F)\n",
+ "DSt = DS_F+DS_E #Entropy change in exchangers E and F (Btu/\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The entropy change in exchangers E and F is :\",round(DSt,4),\" Btu/\u00b0F .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The entropy change in exchangers E and F is : 0.2818 Btu/\u00b0F .\n"
+ "text": [
+ "The entropy change in exchangers E and F is : 0.2818 Btu/\u00b0F .\n"
+ ]
}
],
"prompt_number": 4
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_22.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_22.ipynb
index 92991017..65afae0f 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_22.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_22.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 22"
+ "name": "",
+ "signature": "sha256:02a3e83bf8e73eb737ccd32c864c102b912719b43e71a2afa02159b5cd3f3cf2"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,53 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 22: Design Principles and Industrial Applications"
+ "source": [
+ "Chapter 22: Design Principles and Industrial Applications"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 22.6, Page number: 471"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 22.6, Page number: 471"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''It is desired to evaporate 1000 lb/h of 60\u00b0F water at 1 atm at a power plant. Utility superheated\nsteam at 40 atm and 1000\u00b0F is available, but since this steam is to be used elsewhere in the plant,\nit cannot drop below 20 atm and 600\u00b0F. What mass flowrate of the utility steam is required?\nAssume that there is no heat loss in the evaporator.\nFrom the steam tables:\nP = 40 atm, T = 1000\u00b0F, h = 1572 Btu/lb\nP = 20 atm, T = 600\u00b0F, h = 1316 Btu/lb\nFor saturated steam:\nP = 1 atm, h = 1151 Btu/lb\nFor saturated water:\nT = 60\u00b0F, h = 28.1 Btu/lb\n'''\n\nfrom __future__ import division\nfrom sympy import symbols,solve\n\n#Variable declaration:\n#From steam tables:\nh1 = 1572 #Enthalpy for super heated steam at (P = 40 atm, T = 1000\u00b0F) (Btu/lb)\nh2 = 1316 #Enthalpy for super heated steam at (P = 20 atm, T = 600\u00b0F) (Btu/lb)\nh3 = 1151 #Enthalpy for saturated steam (Btu/lb)\nh4 = 28.1 #Enthalpy for saturated water (Btu/lb)\nm1 = 1000 #Mass flowrate of steam (lb/h)\nm = symbols('m') #Mass flow rate of steam (lb/h)\n\n#Calculation:\nDh1 = m1*(h3-h4) #The change in enthalpy for the vaporization of the water stream (Btu/h)\nDh2 = m*(h1-h2) #The change in enthalpy for the cooling of the water stream (Btu/h)\nx = solve(Dh1-Dh2,m) #Mass flowrate of steam (lb/h)\nm2 = x[0]; #Mass flowrate of steam (lb/h)\n\n#Result:\nprint \"The mass flowrate of the utility steam required is :\",round(m2),\" lb/h.\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from sympy import symbols,solve\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From steam tables:\n",
+ "h1 = 1572 #Enthalpy for super heated steam at (P = 40 atm, T = 1000\u00b0F) (Btu/lb)\n",
+ "h2 = 1316 #Enthalpy for super heated steam at (P = 20 atm, T = 600\u00b0F) (Btu/lb)\n",
+ "h3 = 1151 #Enthalpy for saturated steam (Btu/lb)\n",
+ "h4 = 28.1 #Enthalpy for saturated water (Btu/lb)\n",
+ "m1 = 1000 #Mass flowrate of steam (lb/h)\n",
+ "m = symbols('m') #Mass flow rate of steam (lb/h)\n",
+ "\n",
+ "#Calculation:\n",
+ "Dh1 = m1*(h3-h4) #The change in enthalpy for the vaporization of the water stream (Btu/h)\n",
+ "Dh2 = m*(h1-h2) #The change in enthalpy for the cooling of the water stream (Btu/h)\n",
+ "x = solve(Dh1-Dh2,m) #Mass flowrate of steam (lb/h)\n",
+ "m2 = x[0]; #Mass flowrate of steam (lb/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The mass flowrate of the utility steam required is :\",round(m2),\" lb/h.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The mass flowrate of the utility steam required is : 4386.0 lb/h.\n"
+ "text": [
+ "The mass flowrate of the utility steam required is : 4386.0 lb/h.\n"
+ ]
}
],
"prompt_number": 6
@@ -38,19 +67,51 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 22.7, Page number: 473"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 22.7, Page number: 473"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Determine the total flowrate of cooling water required for the services listed below if a cooling\ntower system supplies the water at 90\u00b0F with a return temperature of 115\u00b0F. How much fresh\nwater makeup is required if 5% of the return water is sent to \u201cblowdown?\u201d Note that the cooling\nwater heat capacity is 1.00 Btu/(lb.\u00b0F), the heat of vaporization at cooling tower operating\nconditions is 1030 Btu/lb, and the density of water at cooling tower operating conditions is\n62.0 lb/ft^3. Process data is provided in Table 22.1.\nTable 22.1 Data for Illustrative Example 22.7\nProcess unit Heat duty, Btu/h Required\n temperature, \u00b0F\n1 12,000,000 250\n2 6,000,000 200\u2013276\n3 23,500,000 130\u2013175\n4 17,000,000 300\n5 31,500,000 150\u2013225\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\n#From table 22.1:\nQH1 = 12*10**6 #Heat duty for process unit 1 (Btu/h)\nQH2 = 6*10**6 #Heat duty for process unit 2 (Btu/h)\nQH3 = 23.5*10**6 #Heat duty for process unit 3 (Btu/h)\nQH4 = 17*10**6 #Heat duty for process unit 4 (Btu/h)\nQH5 = 31*10**6 #Heat duty for process unit 5 (Btu/h)\nT1 = 90 #Supply water temperature (\u00b0F)\nT2 = 115 #Return water temperature (\u00b0F)\ncP = 1 #Cooling water heat capacity (Btu/(lb.\u00b0F))\np = 62*0.1337 #Density of water (lb/gal)\nBDR = 5/100 #Blow-down rate\n\n#Calculation:\nQHL = (QH1+QH2+QH3+QH4+QH5)/60 #Heat load (Btu/min)\nDT = T2-T1 #Change in temperature (\u00b0F)\nqCW = round(QHL,-5)/(DT*cP*p) #Required cooling water flowrate (gpm)\nqBD = BDR*qCW #Blow-down flow (gpm)\n\n#Result:\nprint \"The total flowrate of cooling water required for the services is :\",round(qCW,-1),\" gpm.\"\nprint \"The required blow-down flow is :\",round(qBD),\" gpm.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From table 22.1:\n",
+ "QH1 = 12*10**6 #Heat duty for process unit 1 (Btu/h)\n",
+ "QH2 = 6*10**6 #Heat duty for process unit 2 (Btu/h)\n",
+ "QH3 = 23.5*10**6 #Heat duty for process unit 3 (Btu/h)\n",
+ "QH4 = 17*10**6 #Heat duty for process unit 4 (Btu/h)\n",
+ "QH5 = 31*10**6 #Heat duty for process unit 5 (Btu/h)\n",
+ "T1 = 90 #Supply water temperature (\u00b0F)\n",
+ "T2 = 115 #Return water temperature (\u00b0F)\n",
+ "cP = 1 #Cooling water heat capacity (Btu/(lb.\u00b0F))\n",
+ "p = 62*0.1337 #Density of water (lb/gal)\n",
+ "BDR = 5/100 #Blow-down rate\n",
+ "\n",
+ "#Calculation:\n",
+ "QHL = (QH1+QH2+QH3+QH4+QH5)/60 #Heat load (Btu/min)\n",
+ "DT = T2-T1 #Change in temperature (\u00b0F)\n",
+ "qCW = round(QHL,-5)/(DT*cP*p) #Required cooling water flowrate (gpm)\n",
+ "qBD = BDR*qCW #Blow-down flow (gpm)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The total flowrate of cooling water required for the services is :\",round(qCW,-1),\" gpm.\"\n",
+ "print \"The required blow-down flow is :\",round(qBD),\" gpm.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The total flowrate of cooling water required for the services is : 7240.0 gpm.\nThe required blow-down flow is : 362.0 gpm.\n"
+ "text": [
+ "The total flowrate of cooling water required for the services is : 7240.0 gpm.\n",
+ "The required blow-down flow is : 362.0 gpm.\n"
+ ]
}
],
"prompt_number": 7
@@ -59,19 +120,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 22.8, Page number: 474"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 22.8, Page number: 474"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Determine how many pounds per hour of steam are required for the following situation if steam\nis provided at 500 psig, and if steam is provided at both 500 and 75 psig pressures. The plant has\nthe heating requirements given in Table 22.2. Also note the properties of saturated steam in\nTable 22.3.\nTable 22.2 Process Data for Illustrative Example 22.8\nProcess unit Unit heat duty (Q\u02d9 ), Required\n Btu/h temperature, \u00b0F\n1 10,000,000 250\n2 8,000,000 450\n3 12,000,000 400\n4 20,000,000 300\nTable 22.3 Steam Data\nPressure Saturation Enthalpy of vaporization\nprovided, psig temperature, \u00b0F (hvap), Btu/lb\n75 320 894\n500 470 751\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nQ1 = 10*10**6 #Unit heat duty for process unit 1 (Btu/h)\nQ2 = 8*10**6 #Unit heat duty for process unit 2 (Btu/h)\nQ3 = 12*10**6 #Unit heat duty for process unit 3 (Btu/h)\nQ4 = 20*10**6 #Unit heat duty for process unit 4 (Btu/h)\nhv = 751 #Enthalpy of vaporization for pressure 500 psig (Btu/lb)\n\n#Calculation:\nmB1 = Q1/hv #Mass flowrate of 500 psig steam through unit 1 (lb/h)\nmB2 = Q2/hv #Mass flowrate of 500 psig steam through unit 2 (lb/h)\nmB3 = Q3/hv #Mass flowrate of 500 psig steam through unit 3 (lb/h)\nmB4 = Q4/hv #Mass flowrate of 500 psig steam through unit 4 (lb/h)\nmBT = mB1+mB2+mB3+mB4 #Total steam required (lb/h)\n\n#Result:\nprint \"The total steam required is :\", round(mBT,-1),\" lb/h.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Q1 = 10*10**6 #Unit heat duty for process unit 1 (Btu/h)\n",
+ "Q2 = 8*10**6 #Unit heat duty for process unit 2 (Btu/h)\n",
+ "Q3 = 12*10**6 #Unit heat duty for process unit 3 (Btu/h)\n",
+ "Q4 = 20*10**6 #Unit heat duty for process unit 4 (Btu/h)\n",
+ "hv = 751 #Enthalpy of vaporization for pressure 500 psig (Btu/lb)\n",
+ "\n",
+ "#Calculation:\n",
+ "mB1 = Q1/hv #Mass flowrate of 500 psig steam through unit 1 (lb/h)\n",
+ "mB2 = Q2/hv #Mass flowrate of 500 psig steam through unit 2 (lb/h)\n",
+ "mB3 = Q3/hv #Mass flowrate of 500 psig steam through unit 3 (lb/h)\n",
+ "mB4 = Q4/hv #Mass flowrate of 500 psig steam through unit 4 (lb/h)\n",
+ "mBT = mB1+mB2+mB3+mB4 #Total steam required (lb/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The total steam required is :\", round(mBT,-1),\" lb/h.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The total steam required is : 66580.0 lb/h.\n"
+ "text": [
+ "The total steam required is : 66580.0 lb/h.\n"
+ ]
}
],
"prompt_number": 8
@@ -80,19 +166,87 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 22.9, Page number: 474"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 22.9, Page number: 474"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Afeed stream to a distillation column processes of 28,830 gals/day of a light oil, and is fed to the\ncolumn through a 6-inch I.D. pipeline. The temperature of the feed is usually 27\u00b0C. You are\nasked to explore the possibility of using either a countercurrent or a parallel (co-current)\ndouble pipe heat exchanger as an auxiliary heater for the feed stream. The double-pipe exchanger\nis to heat the oil from 23.5\u00b0C to 27\u00b0C.Water at 8406 gals/day and 93\u00b0C is available for heating\nthe oil. The necessary physical properties are provided in Table 22.4. The inner diameter of\nthe pipe forming the annular region is 20.3 cm and the outer surface of that pipe is well insulated.\nFor a counter-current flow arrangement, calculate the following using the SI system:\n1. The lowest temperature the exiting heating water could reach. Is there sufficient energy\navailable from thewater to raise the oil temperature? (If there is not enough energy, there\nis no point in designing the exchanger.)\n2. The log mean temperature difference.\n3. The overall heat transfer coefficient, U, for a new clean exchanger based on the inside\narea is 35.4 W/m^2.K. Correct the U for the fouling of the heat exchanger. Use a\nfouling factor, Rf, of quenching oil, which is 0.0007 m^2.K/W.\n4. The length of the double pipe heat exchanger.\n5. The effectiveness of the exchanger and the NTU.\nTable 22.4 Property Data for Illustrative Example 22.9\nOil (27\u00b0C) Water (93\u00b0C) Pipe\np = 53 lb/ft^3 p = 964 kg/m^3 ID = 6.0 in\ncp = 0.46 Btu/lb.\u00b0F cp = 4204 J/kg.\u00b0C OD= 168 mm\nmu = 150 cP mu = 0.7 lb/h.ft k = 45 W/m.\u00b0C\nk = 0.11 Btu/h.ft.\u00b0F k = 0.678 W/m.\u00b0C\n'''\n\nfrom __future__ import division\nfrom sympy import symbols,solve\nfrom math import log,pi\n\n#Variable declaration:\npo = 53*16.0185 #Density of oil (kg/m^3)\nco = 0.46*4186.7 #Heat capacity of oil (J/kg.\u00b0C)\nmuo = 150/1000 #Dynamic viscosity of oil (kg/m.s)\nko = 0.11*1.7303 #Thermal conductivity of oil (W/m.\u00b0C)\nqo = 28830*4.381*10**-8 #Volumetric flowrate of oil (m^3/s)\npw = 964 #Density of water (kg/m^3)\ncw = 4204 #Heat capacity of water (J/kg.\u00b0C)\nmuw = 0.7/3600*1.4881 #Dynamic viscosity of water (kg/m.s)\nkw = 0.678 #Thermal conductivity of water (W/m.\u00b0C)\nqw = 8406*4.381*10**-8 #Volumetric flowrate of water (m^3/s)\nt1 = 23.5 #Initial temperature of oil (\u00b0C)\nt2 = 27 #Final temperature of oil (\u00b0C)\nT1 = 93 #Water heating temperature of water (\u00b0C)\nT2 = symbols('T2') #Minimum temperature of heating water (\u00b0C)\nA = symbols('A') #Heat transfer area (m^2)\nUc = 35.4 #Clean heat transfer coefficient (W/m^2.K)\nRf = 0.0007 #Thermal resistance (m^2.K/W)\nD = 6*0.0254 #Inside diameter of pipe (m)\n\n#Calculation:\nvo = muo/po #Kinematic viscosity of oil (m^2/s)\nmo = po*qo #Mass flowrate of oil (kg/s)\nvw = muw/pw #Kinematic viscosity of (m^2/s)\nmw = pw*qw #Masss flow rate of water (kg/s)\nQ1 = mo*co*(t2-t1) #Duty of exchanger of oil (W)\nT2m = t1 #Lowest possible temperature of the water (\u00b0C) (part 1)\nQmw = mw*cw*(T1-T2m) #Maximum duty of exchanger of water (W) (part 2)\nQ2 = mw*cw*(T1-T2) #Duty of exchanger of water in terms of T2 (W)\nx = solve(Q1-Q2,T2) #Solving value for T2 (\u00b0C)\nT3 = x[0]; #Minimum temperature of heating water (\u00b0C)\nDT1 = T3-t1 #Inlet temperature difference (\u00b0C)\nDT2 = T1-t2 #Outlet temperature difference (\u00b0C)\nDTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0C)\nUd1 = 1/Uc+Rf #Dirty heat transfer coefficient (W/m^2.K) (part 3)\nUd2 = 34.6 #Dirty heat transfer coefficient (W/m^2.\u00b0C)\nQ3 = Ud2*A*DTlm #Duty of exchanger (W) (part 4)\ny = solve(Q1-Q3,A) #Heat transfer area (m^2)\nA1 = y[0]; #Required heat transfer area (m^2)\nL = A1/(pi*D) #Required heat transfer length (m)\nQmo = mo*co*(T1-t1) #Maximum duty of exchanger of oil (W) (part 5)\nQm = Qmw #Maximum duty of exchanger (W)\nE = Q1/Qm*100 #Effectiveness (%)\nNTU = Ud2*A1/(mw*cw) #Number of transfer units\n\n#Result:\nprint \"1. The lowest possible temperature of the water is :\",T2m,\" \u00b0C .\"\nprint \"2. The log mean temperature difference is :\",round(DTlm,2),\" \u00b0C .\"\nprint \"3. The overall heat transfer coefficient for the new clean exchanger is :\",round(Ud2,1),\" (W/m^2.\u00b0C .\"\nprint \"4. The length of the double pipe heat exchanger is :\",round(L,2),\" m .\"\nprint \"5. The effectiveness of the exchanger is :\",round(E,2),\" % .\"\nprint \" The NTU of the exchanger is :\",round(NTU,4),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from sympy import symbols,solve\n",
+ "from math import log,pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "po = 53*16.0185 #Density of oil (kg/m^3)\n",
+ "co = 0.46*4186.7 #Heat capacity of oil (J/kg.\u00b0C)\n",
+ "muo = 150/1000 #Dynamic viscosity of oil (kg/m.s)\n",
+ "ko = 0.11*1.7303 #Thermal conductivity of oil (W/m.\u00b0C)\n",
+ "qo = 28830*4.381*10**-8 #Volumetric flowrate of oil (m^3/s)\n",
+ "pw = 964 #Density of water (kg/m^3)\n",
+ "cw = 4204 #Heat capacity of water (J/kg.\u00b0C)\n",
+ "muw = 0.7/3600*1.4881 #Dynamic viscosity of water (kg/m.s)\n",
+ "kw = 0.678 #Thermal conductivity of water (W/m.\u00b0C)\n",
+ "qw = 8406*4.381*10**-8 #Volumetric flowrate of water (m^3/s)\n",
+ "t1 = 23.5 #Initial temperature of oil (\u00b0C)\n",
+ "t2 = 27 #Final temperature of oil (\u00b0C)\n",
+ "T1 = 93 #Water heating temperature of water (\u00b0C)\n",
+ "T2 = symbols('T2') #Minimum temperature of heating water (\u00b0C)\n",
+ "A = symbols('A') #Heat transfer area (m^2)\n",
+ "Uc = 35.4 #Clean heat transfer coefficient (W/m^2.K)\n",
+ "Rf = 0.0007 #Thermal resistance (m^2.K/W)\n",
+ "D = 6*0.0254 #Inside diameter of pipe (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "vo = muo/po #Kinematic viscosity of oil (m^2/s)\n",
+ "mo = po*qo #Mass flowrate of oil (kg/s)\n",
+ "vw = muw/pw #Kinematic viscosity of (m^2/s)\n",
+ "mw = pw*qw #Masss flow rate of water (kg/s)\n",
+ "Q1 = mo*co*(t2-t1) #Duty of exchanger of oil (W)\n",
+ "T2m = t1 #Lowest possible temperature of the water (\u00b0C) (part 1)\n",
+ "Qmw = mw*cw*(T1-T2m) #Maximum duty of exchanger of water (W) (part 2)\n",
+ "Q2 = mw*cw*(T1-T2) #Duty of exchanger of water in terms of T2 (W)\n",
+ "x = solve(Q1-Q2,T2) #Solving value for T2 (\u00b0C)\n",
+ "T3 = x[0]; #Minimum temperature of heating water (\u00b0C)\n",
+ "DT1 = T3-t1 #Inlet temperature difference (\u00b0C)\n",
+ "DT2 = T1-t2 #Outlet temperature difference (\u00b0C)\n",
+ "DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0C)\n",
+ "Ud1 = 1/Uc+Rf #Dirty heat transfer coefficient (W/m^2.K) (part 3)\n",
+ "Ud2 = 34.6 #Dirty heat transfer coefficient (W/m^2.\u00b0C)\n",
+ "Q3 = Ud2*A*DTlm #Duty of exchanger (W) (part 4)\n",
+ "y = solve(Q1-Q3,A) #Heat transfer area (m^2)\n",
+ "A1 = y[0]; #Required heat transfer area (m^2)\n",
+ "L = A1/(pi*D) #Required heat transfer length (m)\n",
+ "Qmo = mo*co*(T1-t1) #Maximum duty of exchanger of oil (W) (part 5)\n",
+ "Qm = Qmw #Maximum duty of exchanger (W)\n",
+ "E = Q1/Qm*100 #Effectiveness (%)\n",
+ "NTU = Ud2*A1/(mw*cw) #Number of transfer units\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The lowest possible temperature of the water is :\",T2m,\" \u00b0C .\"\n",
+ "print \"2. The log mean temperature difference is :\",round(DTlm,2),\" \u00b0C .\"\n",
+ "print \"3. The overall heat transfer coefficient for the new clean exchanger is :\",round(Ud2,1),\" (W/m^2.\u00b0C .\"\n",
+ "print \"4. The length of the double pipe heat exchanger is :\",round(L,2),\" m .\"\n",
+ "print \"5. The effectiveness of the exchanger is :\",round(E,2),\" % .\"\n",
+ "print \" The NTU of the exchanger is :\",round(NTU,4),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The lowest possible temperature of the water is : 23.5 \u00b0C .\n2. The log mean temperature difference is : 65.33 \u00b0C .\n3. The overall heat transfer coefficient for the new clean exchanger is : 34.6 (W/m^2.\u00b0C .\n4. The length of the double pipe heat exchanger is : 6.68 m .\n5. The effectiveness of the exchanger is : 6.97 % .\n The NTU of the exchanger is : 0.0741 .\n"
+ "text": [
+ "1. The lowest possible temperature of the water is : 23.5 \u00b0C .\n",
+ "2. The log mean temperature difference is : 65.33 \u00b0C .\n",
+ "3. The overall heat transfer coefficient for the new clean exchanger is : 34.6 (W/m^2.\u00b0C .\n",
+ "4. The length of the double pipe heat exchanger is : 6.68 m .\n",
+ "5. The effectiveness of the exchanger is : 6.97 % .\n",
+ " The NTU of the exchanger is : 0.0741 .\n"
+ ]
}
],
"prompt_number": 9
@@ -101,19 +255,54 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 22.10, Page number: 477"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 22.10, Page number: 477"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 22.9. How would the answer to Parts 2 and 4 be affected if the flow\nwere parallel?\n'''\n\nfrom __future__ import division\nfrom math import log,pi\n\n#Variable declaration:\n#From example 22.9:\nt1 = 23.5 #Initial temperature of oil (\u00b0C)\nt2 = 27 #Final temperature of oil (\u00b0C)\nT1 = 93 #Water heating temperature of water (\u00b0C)\nT2 = 88.16 #Minimum temperature of heating water (\u00b0C)\nU = 34.6 #Overall heat transfer coefficient (W/m^2.\u00b0C)\nQ = 7227.2 #Duty of exchanger (W)\nD = 6*0.0254 #Inside diameter of pipe (m)\nl = 6.68 #Previous heat transfer length (m)\n\n#Calculation:\nDT1 = T1-t1 #Inlet temperature difference (\u00b0C)\nDT2 = T2-t2 #Outlet temperature difference (\u00b0C)\nDTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0C)\nA = Q/(U*DTlm) #Required heat transfer area (m^2)\nL = A/(pi*D) #Required heat transfer length (m)\n\n#Result:\nprint \"The length of the parallel pipe heat exchanger is :\",round(L,2),\" m .\"\nif L>l:\n print \"The tube length would increase slightly.\"\nelif L<l:\n print \"The tube length would decrease slightly.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import log,pi\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From example 22.9:\n",
+ "t1 = 23.5 #Initial temperature of oil (\u00b0C)\n",
+ "t2 = 27 #Final temperature of oil (\u00b0C)\n",
+ "T1 = 93 #Water heating temperature of water (\u00b0C)\n",
+ "T2 = 88.16 #Minimum temperature of heating water (\u00b0C)\n",
+ "U = 34.6 #Overall heat transfer coefficient (W/m^2.\u00b0C)\n",
+ "Q = 7227.2 #Duty of exchanger (W)\n",
+ "D = 6*0.0254 #Inside diameter of pipe (m)\n",
+ "l = 6.68 #Previous heat transfer length (m)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = T1-t1 #Inlet temperature difference (\u00b0C)\n",
+ "DT2 = T2-t2 #Outlet temperature difference (\u00b0C)\n",
+ "DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0C)\n",
+ "A = Q/(U*DTlm) #Required heat transfer area (m^2)\n",
+ "L = A/(pi*D) #Required heat transfer length (m)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The length of the parallel pipe heat exchanger is :\",round(L,2),\" m .\"\n",
+ "if L>l:\n",
+ " print \"The tube length would increase slightly.\"\n",
+ "elif L<l:\n",
+ " print \"The tube length would decrease slightly.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The length of the parallel pipe heat exchanger is : 6.69 m .\nThe tube length would increase slightly.\n"
+ "text": [
+ "The length of the parallel pipe heat exchanger is : 6.69 m .\n",
+ "The tube length would increase slightly.\n"
+ ]
}
],
"prompt_number": 10
@@ -122,19 +311,51 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 22.12, Page number: 478"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 22.12, Page number: 478"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A brine solution at 10\u00b0F is heated in a food processing plant by flowing through a heated\npipe. The pipe surface is maintained at 80\u00b0F. The pipe surface area for heat transfer is 2.5 ft^2.\nThe brine solution (with a density of 62.4 lb/ft^3 and a heat capacity of 0.99 Btu/lb.\u00b0F)\nflows at a rate of 20 lb/min. The overall heat transfer coefficient varies linearly with the temperature\napproach, with values of 150 Btu/h.ft^2.\u00b0F at the brine solution entrance (where the\nbrine temperature is 10\u00b0F) and 140 Btu/h.ft.\u00b0F at the brine solution exit. Determine:\n1. the temperature approach at the brine inlet side\n2. the exit temperature of the brine solution.\n'''\n\nfrom __future__ import division\nfrom scipy.optimize import fsolve\nfrom math import log\n\n#Variable declaration:\nT = 80 #Pipe surface temperature (\u00b0F)\nt1 = 10 #Inlet temperature of brine solution (\u00b0F)\nm = 1200 #mass flowrate of solution (kg/s)\nc = 0.99 #Heat capacity of brine solution (Btu/lb.\u00b0F)\nA = 2.5 #Heat transfer area (ft^2)\nU1 = 150 #Overall heat transfer coefficient at temperature approach (Btu/h.ft^2.\u00b0F)\nU2 = 140 #Overall heat transfer coefficient at inlet brine temperature (Btu/h.ft^2.\u00b0F)\n\n#Calculation:\nDT1 = T-t1 #Temperature approach at the pipe entrance (\u00b0F)\n\ndef equation(DT2):\n\tQ1 = m*c*(DT1-DT2) #Energy balance to the brine solution across the full length of the pipe (Btu/h)\n\tDTlm = (DT1-DT2)*log(DT2/DT1) #Log mean temperature difference (\u00b0F)\n\tQ2 = A*(U2*DT1-U1*DT2)/log((U2*DT1)/(U1*DT2)) #Heat transfer rate (Btu/h)\n\treturn Q2-Q1\t\nt2 = round(T-fsolve(equation,1),1)\t #The temperature of the brine solution (\u00b0F)\n\n#Results:\nprint 'The temperature of brine solution is: ',(t2-32)/1.8,'\u00b0C'",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from scipy.optimize import fsolve\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "T = 80 #Pipe surface temperature (\u00b0F)\n",
+ "t1 = 10 #Inlet temperature of brine solution (\u00b0F)\n",
+ "m = 1200 #mass flowrate of solution (kg/s)\n",
+ "c = 0.99 #Heat capacity of brine solution (Btu/lb.\u00b0F)\n",
+ "A = 2.5 #Heat transfer area (ft^2)\n",
+ "U1 = 150 #Overall heat transfer coefficient at temperature approach (Btu/h.ft^2.\u00b0F)\n",
+ "U2 = 140 #Overall heat transfer coefficient at inlet brine temperature (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "DT1 = T-t1 #Temperature approach at the pipe entrance (\u00b0F)\n",
+ "\n",
+ "def equation(DT2):\n",
+ "\tQ1 = m*c*(DT1-DT2) #Energy balance to the brine solution across the full length of the pipe (Btu/h)\n",
+ "\tDTlm = (DT1-DT2)*log(DT2/DT1) #Log mean temperature difference (\u00b0F)\n",
+ "\tQ2 = A*(U2*DT1-U1*DT2)/log((U2*DT1)/(U1*DT2)) #Heat transfer rate (Btu/h)\n",
+ "\treturn Q2-Q1\t\n",
+ "t2 = round(T-fsolve(equation,1),1)\t #The temperature of the brine solution (\u00b0F)\n",
+ "\n",
+ "#Results:\n",
+ "print 'The temperature of brine solution is: ',(t2-32)/1.8,'\u00b0C'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The temperature of brine solution is: -2.0 \u00b0C\n"
+ "text": [
+ "The temperature of brine solution is: -2.0 \u00b0C\n"
+ ]
}
],
"prompt_number": 1
@@ -143,19 +364,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 22.13, Page number: 479"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 22.13, Page number: 479"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to Illustrative Example 22.12. Calculate:\n1. the rate of heat transfer, Q\u02d9\n2. the log mean temperature difference.\n'''\n\nfrom __future__ import division\nfrom math import log\n\n#Variable declaration:\nm = 1200 #mass flowrate of solution (kg/s)\nc = 0.99 #Heat capacity of brine solution (Btu/lb.\u00b0F)\nDT1 = 70 #Temperature approach at the pipe entrance (\u00b0F)\nDT2 = 51.6 #Temperature difference at the pipe exit (\u00b0F)\n\n#Calculation:\nQ = m*c*(DT1-DT2) #Heat transfer rate (Btu/h)\nDTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0F)\n\n#Result:\nprint \"1. The rate of heat transfer is :\",round(Q,-1),\" Btu/h.\"\nprint \"Or, the rate of heat transfer is :\",round(Q/3.412),\" W.\"\nprint \"2. The log mean temperature difference is :\",round(DTlm,1),\" \u00b0F.\"\nprint \"Or, the log mean temperature difference is :\",round(DTlm/1.8,1),\" \u00b0C.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "m = 1200 #mass flowrate of solution (kg/s)\n",
+ "c = 0.99 #Heat capacity of brine solution (Btu/lb.\u00b0F)\n",
+ "DT1 = 70 #Temperature approach at the pipe entrance (\u00b0F)\n",
+ "DT2 = 51.6 #Temperature difference at the pipe exit (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = m*c*(DT1-DT2) #Heat transfer rate (Btu/h)\n",
+ "DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The rate of heat transfer is :\",round(Q,-1),\" Btu/h.\"\n",
+ "print \"Or, the rate of heat transfer is :\",round(Q/3.412),\" W.\"\n",
+ "print \"2. The log mean temperature difference is :\",round(DTlm,1),\" \u00b0F.\"\n",
+ "print \"Or, the log mean temperature difference is :\",round(DTlm/1.8,1),\" \u00b0C.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The rate of heat transfer is : 21860.0 Btu/h.\nOr, the rate of heat transfer is : 6407.0 W.\n2. The log mean temperature difference is : 60.3 \u00b0F.\nOr, the log mean temperature difference is : 33.5 \u00b0C.\n"
+ "text": [
+ "1. The rate of heat transfer is : 21860.0 Btu/h.\n",
+ "Or, the rate of heat transfer is : 6407.0 W.\n",
+ "2. The log mean temperature difference is : 60.3 \u00b0F.\n",
+ "Or, the log mean temperature difference is : 33.5 \u00b0C.\n"
+ ]
}
],
"prompt_number": 13
@@ -164,19 +413,53 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 22.23, Page number: 484"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 22.23, Page number: 484"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Heating or cooling of liquids in batch processes is used in a number of commercial applications.\nSome reasons for using a batch rather than a continuous heat transfer operation include: the\nliquid is not continuously available, the liquid cleaning and regeneration is a significant part\nof the operation, or batch operation is simpler and cheaper.\nFor example, vapor degreasers are widely used for cleaning metal parts. A degreaser consists\nof a tank partially filled with a solvent. The tank is equipped with a heating coil to heat the solvent\nclose to its boiling point. The vapor of the solvent occupies the remaining volume of the\ntank, forming the \u201csolvent vapor zone.\u201d When a metal part is placed in the solvent vapor\nzone, the solvent condenses on the metal part and then drips off, taking contaminants with it.\nFor ease of use, vapor degreasers are often open to the atmosphere. This makes it easier to introduce\nand remove the metal parts. It has been a common practice to use a halogenated hydrocarbon\nfor such cleaning since they are excellent solvents, volatile, and non-flammable;\nhowever, they can be toxic and the open tank of a degreaser can be a significant source of solvent\nemissions or volatile organic components (VOCs).\nWhen an agitated liquid batch, initially at Ti, is heated, the temperature, T, of the liquid at\nany time, t, can be assumed to be uniform if the liquid is well stirred. Three different types of\ncalculations involving the batch heating of liquids are outlined in Table 22.6.\nThe assumptions in these analyses include:\n1. constant properties for the duration of the process,\n2. constant overall heat transfer coefficient, U, for the process,\n3. a constant temperature, T1, of the heating medium,\n\nTable 22.6 Batch Heating of Liquids\nCase Description Calculate\nDesign It is desired to heat the liquid to a The surface area required.\n specified temperature within a\n given time.\n\nSimulation It is desired to heat the liquid for a The final temperature, T.\n specified time; the heat transfer\n surface area is known.\n\nTime The heat transfer surface area and the The batch time, t.\n final temperature are known.\n\n4. a vigorously stirred unit (and therefore a uniform temperature),\n5. negligible heat losses, and\n6. no phase change.\nThe describing equation for these batch systems can be developed. Consider a liquid batch\nthat has a volume, V, density, r, and heat capacity, c. The initial temperature is Ti, and the temperature\nat any time, t, is T. The energy balance on the liquid in the agitated tank simplifies to\n UA(Too - T) = pVcp(dT/dt) (1)\nAn excess temperature, u, can be defined as\n u = T00 - T; ui = T00 - Ti, Ti 2 initial temprature (2)\nSubstituting this expression into Equation (1) and integrating with respect to t yields\n u/ui = e^(-t/r) (3)\nwhere rt is the thermal time constant that is given by\n r = pVcp/(UA) (4)\n Design a degreaser employing the development provided above; i.e., calculate the heating\nsurface area requirement for a vapor degreaser using 1,1,1-trichloroethane, Cl3C-CH3 (TCA)\nas the solvent. The degreaser tank has a rectangular cross section (6 ft x 3 ft) and a height of\n5 ft. Liquid TCA at 18\u00b0C is poured into the tank to a height of 1 ft. The solvent vapor zone\nwill occupy the remaining 4 ft. At time t = 0, saturated steam is passed into the heating coil.\nThe steam temperature is 100\u00b0C. The overall heat transfer coefficient, U, from the steam to\nthe liquid TCA, based on the outside area of the coil, is 200 Btu/h.ft^2.\u00b0F. It is desired to\nheat the liquid TCA from 18\u00b0C to its boiling point (74\u00b0C) without evaporation in 180 seconds.\nThe approximate properties of TCA are: density, p = 87.4 lb/ft3, heat capacity, cp = 0.23 Btu/lb.\u00b0F,\nand viscosity = 0.56 cP. The design should include:\n1. the required surface area of the heating coil\n2. the total heat added to the liquid TCA.\n'''\n\nfrom __future__ import division\nfrom math import log\n\n#Variable declaration:\nToo = 100 #Steam temperature (\u00b0C)\nTi = 18 #Initial temperature of liquid TCA (\u00b0C)\nTf = 74 #Final temperature of liquid TCA (\u00b0C)\nt = 180 #Heating time (s)\np = 87.4 #Density of TCA (lb/ft^3)\nV = 18 #Kinematic viscosity of TCA (m^2/s)\ncp = 0.23 #Heat capacity of TCA (Btu/lb.\u00b0F)\nU = 200 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n\n#Calculation:\nui = Too-Ti #Initial excess temperature (\u00b0C)\nuf = Too-Tf #Final excess temperature (\u00b0C)\nR = log(ui/uf) #Ratio t/r\nr = t/R #Thermal time constant (s)\nA = p*V*cp/(3600*U*r) #Required heating area (ft^3)\nTi_F = Ti*9/5+32 #Initial temperature in fahrenheit scale (\u00b0F)\nTf_F = Tf*9/5+32 #Final temperature in fahrenheit scale (\u00b0F)\nQ = p*V*cp*(Tf_F-Ti_F) #Total amount of heat added (Btu)\n\n#Result:\nprint \"1. The required surface area of the heating coil is :\",(A,1),\" ft^3 .\"\nprint \"2. The total heat added to the liquid TCA is :\",round(Q),\" Btu .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Too = 100 #Steam temperature (\u00b0C)\n",
+ "Ti = 18 #Initial temperature of liquid TCA (\u00b0C)\n",
+ "Tf = 74 #Final temperature of liquid TCA (\u00b0C)\n",
+ "t = 180 #Heating time (s)\n",
+ "p = 87.4 #Density of TCA (lb/ft^3)\n",
+ "V = 18 #Kinematic viscosity of TCA (m^2/s)\n",
+ "cp = 0.23 #Heat capacity of TCA (Btu/lb.\u00b0F)\n",
+ "U = 200 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "ui = Too-Ti #Initial excess temperature (\u00b0C)\n",
+ "uf = Too-Tf #Final excess temperature (\u00b0C)\n",
+ "R = log(ui/uf) #Ratio t/r\n",
+ "r = t/R #Thermal time constant (s)\n",
+ "A = p*V*cp/(3600*U*r) #Required heating area (ft^3)\n",
+ "Ti_F = Ti*9/5+32 #Initial temperature in fahrenheit scale (\u00b0F)\n",
+ "Tf_F = Tf*9/5+32 #Final temperature in fahrenheit scale (\u00b0F)\n",
+ "Q = p*V*cp*(Tf_F-Ti_F) #Total amount of heat added (Btu)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The required surface area of the heating coil is :\",(A,1),\" ft^3 .\"\n",
+ "print \"2. The total heat added to the liquid TCA is :\",round(Q),\" Btu .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The required surface area of the heating coil is : (3.2068907918330814e-06, 1) ft^3 .\n2. The total heat added to the liquid TCA is : 36473.0 Btu .\n"
+ "text": [
+ "1. The required surface area of the heating coil is : (3.2068907918330814e-06, 1) ft^3 .\n",
+ "2. The total heat added to the liquid TCA is : 36473.0 Btu .\n"
+ ]
}
],
"prompt_number": 25
@@ -185,19 +468,71 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 22.24, Page number: 486"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 22.24, Page number: 486"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''62,000 lb/h of pure ethyl alcohol (hvap = 365 Btu/lb; specific gravity, s = 0.79) at 2.0 psig is\nto be condensed by water (r = 62.5 lb/ft^3) entering at 85\u00b0F and exiting at 120\u00b0F. A 1\u20132 horizontal\ncondenser consists of 700(Nt) one-inch outside diameter, 14 BWGtubes, 16-inch long on\na 1.25-inch triangular pitch. There are four (n) tube passes. Assume that the flow is countercurrent\nand that the alcohol is on the shell side. A fouling factor of 0.003 Btu/h.ft^2.\u00b0F is recommended.\nThe cooling water inside film coefficient has been previously determined to be\n862.4 Btu/h.ft^2.\u00b0F. Neglecting any pressure drop considerations, determine if the exchanger\nis suitable. Additional information is provided in Table 22.7.\nTable 22.7 Exchanger Information for Illustrative Example 22.24\nShell Tubes\nID = 39 inch Pitch = 1.25 inch\nBaffle spacing = 39 inch Flow area/tube = 0.546 in2\nFlow area = 2.11 ft^2 ID = 0.834 inch\nCondensation temperature, tc = 173\u00b0F Wall thickness = 0.083 inch\nFor film condensation on horizontal tubes (see also Chapter 12), the average heat transfer\ncoefficient is to be calculated from the equation (consistent units):\nh = 1.51((kf*pf^2gmuf)/(muf^24G))^1/3\nwhere kf = thermal conductivity\npf = fluid density\ng = acceleration due to gravity\nmuf = viscosity of the fluid\nG = loading, G = (m_ alcohol/LNt^(2/3))\nm_alcohol = condensate mass flow\nL = tube length\nNt = number of tubes in bundle\nV = velocity\nFor a clean (unused) tube, the overall heat transfer coefficient can be calculated from the\nfollowing equation:\nUC = Uclean =hioho/(hio + ho)\nwhere UC = Uclean = heat transfer coefficient of a clean (new/unused) tube\nhio = corrected inside heat transfer coefficient to the outside diameter, with\nhio = hi(Di/Do)\nThe dirt fouling factor may be calculated from:\nRD = Rdirty = (Uc - U)/UcU (14.32)\nwhere RD = Rdirty = dirt (fouling) factor\nU = heat transfer coefficient calculated from the actual heat transfer\n'''\n\nfrom __future__ import division\nfrom math import log\n\n#Variable declaration:\nm1 = 62000 #Mass flowrate of alcohol (lb/h)\nh1 = 365 #Enthalpy of vapour (Btu/lb)\ncp = 1 #Heat capacity of water (Btu/lb.\u00b0F)\nT1 = 85 #Entering temperature of water (\u00b0F)\nT2 = 120 #Exit temperature of water (\u00b0F)\na1 = 2.11 #Flow area for the shell side (ft^2)\nN = 700 #Total number of tubes\na2 = 0.546 #Flow area per tube (in^2/tube)\nn = 4 #Number of tube passes\np = 62.5 #Density of water (lb/ft^3)\nL = 16 #Length of condenser (ft)\nhio = 862.4 #Cooling water inside film coefficient (Btu/h.ft^2.\u00b0F)\ng = 9.8 #Gravitational accleration (m^2/s)\nRf = 0.003 #Fouling factor (Btu/h.ft^2.\u00b0F)\n\n#Calculation:\nQ1 = m1*h1 #Heat loss from alcohol (Btu/h)\nQ2 = Q1 #Heat gained by water (Btu/h)\nDT = T2-T1 #Temperature difference (\u00b0F)\nm2 = Q2/(cp*DT) #Water mass flow rate (lb/h)\nLMTD = ((T2-32)-(T1-32))/log((T2-32)/(T1-32)) #Log mean temperature difference (\u00b0F)\nat = (N*a2)/(144*n) #Total flow area for tube side (ft^2)\nG1 = m1/a1 #Mass velocity of flow in shell side (lb/h.ft^2)\nG2 = m2/at #Mass velocity of flow in tube side (lb/h.ft^2)\nV = G2/(3600*p) #Velocity of water (ft/s)\nG3 = m1/(L*N)**(2/3) #Loading G (lb/h.ft)\n#For alcohol:\nkf = 0.105 #Thermal conductivity (Btu/h.ft.\u00b0F)\nmuf = 0.55*2.42 #Dynamic viscosity (lb/ft.h)\nsf = 0.79 #\npf = sf*p #Density (lb/ft^3)\nh = 151*(((kf**3)*(pf**2)*g*muf)/((muf**2)*n*G3))**(1/3) #Heat transfer coefficient for the shell side (Btu/h.ft^2.\u00b0F)\nho = h #Outside heat transfer coefficient of the tube bundle (Btu/h.ft^2.\u00b0F)\nUc = (hio*ho)/(hio+ho) #Overall heat transfer coefficient for a new (clean) heat exchanger (Btu/h.ft^2.\u00b0F)\nA = N*L*0.2618 #Area for heat transfer (ft^2)\nUd = Q1/(A*DT) #Design (D) overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\nRd = (Uc-Ud)/(Uc*Ud) #Dirt (d) factor (Btu/h.ft^2.\u00b0F)\n\n#Result:\nprint \"The dirt (d) factor is :\",round(Rd,4),\" Btu/h.ft^2.\u00b0F .\"\nif (Rd>Rd):\n print \"Therefore, the exchanger as specified is unsuitable for these process conditions since the fouling factor is above the recommended value. Cleaning is recommended.\"\nelse:\n print \"Therefore, the exchanger as specified is suitable for these process conditions since the fouling factor is below the recommended value. Cleaning is not recommended.\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "m1 = 62000 #Mass flowrate of alcohol (lb/h)\n",
+ "h1 = 365 #Enthalpy of vapour (Btu/lb)\n",
+ "cp = 1 #Heat capacity of water (Btu/lb.\u00b0F)\n",
+ "T1 = 85 #Entering temperature of water (\u00b0F)\n",
+ "T2 = 120 #Exit temperature of water (\u00b0F)\n",
+ "a1 = 2.11 #Flow area for the shell side (ft^2)\n",
+ "N = 700 #Total number of tubes\n",
+ "a2 = 0.546 #Flow area per tube (in^2/tube)\n",
+ "n = 4 #Number of tube passes\n",
+ "p = 62.5 #Density of water (lb/ft^3)\n",
+ "L = 16 #Length of condenser (ft)\n",
+ "hio = 862.4 #Cooling water inside film coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "g = 9.8 #Gravitational accleration (m^2/s)\n",
+ "Rf = 0.003 #Fouling factor (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q1 = m1*h1 #Heat loss from alcohol (Btu/h)\n",
+ "Q2 = Q1 #Heat gained by water (Btu/h)\n",
+ "DT = T2-T1 #Temperature difference (\u00b0F)\n",
+ "m2 = Q2/(cp*DT) #Water mass flow rate (lb/h)\n",
+ "LMTD = ((T2-32)-(T1-32))/log((T2-32)/(T1-32)) #Log mean temperature difference (\u00b0F)\n",
+ "at = (N*a2)/(144*n) #Total flow area for tube side (ft^2)\n",
+ "G1 = m1/a1 #Mass velocity of flow in shell side (lb/h.ft^2)\n",
+ "G2 = m2/at #Mass velocity of flow in tube side (lb/h.ft^2)\n",
+ "V = G2/(3600*p) #Velocity of water (ft/s)\n",
+ "G3 = m1/(L*N)**(2/3) #Loading G (lb/h.ft)\n",
+ "#For alcohol:\n",
+ "kf = 0.105 #Thermal conductivity (Btu/h.ft.\u00b0F)\n",
+ "muf = 0.55*2.42 #Dynamic viscosity (lb/ft.h)\n",
+ "sf = 0.79 #\n",
+ "pf = sf*p #Density (lb/ft^3)\n",
+ "h = 151*(((kf**3)*(pf**2)*g*muf)/((muf**2)*n*G3))**(1/3) #Heat transfer coefficient for the shell side (Btu/h.ft^2.\u00b0F)\n",
+ "ho = h #Outside heat transfer coefficient of the tube bundle (Btu/h.ft^2.\u00b0F)\n",
+ "Uc = (hio*ho)/(hio+ho) #Overall heat transfer coefficient for a new (clean) heat exchanger (Btu/h.ft^2.\u00b0F)\n",
+ "A = N*L*0.2618 #Area for heat transfer (ft^2)\n",
+ "Ud = Q1/(A*DT) #Design (D) overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n",
+ "Rd = (Uc-Ud)/(Uc*Ud) #Dirt (d) factor (Btu/h.ft^2.\u00b0F)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The dirt (d) factor is :\",round(Rd,4),\" Btu/h.ft^2.\u00b0F .\"\n",
+ "if (Rd>Rd):\n",
+ " print \"Therefore, the exchanger as specified is unsuitable for these process conditions since the fouling factor is above the recommended value. Cleaning is recommended.\"\n",
+ "else:\n",
+ " print \"Therefore, the exchanger as specified is suitable for these process conditions since the fouling factor is below the recommended value. Cleaning is not recommended.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The dirt (d) factor is : -0.0157 Btu/h.ft^2.\u00b0F .\nTherefore, the exchanger as specified is suitable for these process conditions since the fouling factor is below the recommended value. Cleaning is not recommended.\n"
+ "text": [
+ "The dirt (d) factor is : -0.0157 Btu/h.ft^2.\u00b0F .\n",
+ "Therefore, the exchanger as specified is suitable for these process conditions since the fouling factor is below the recommended value. Cleaning is not recommended.\n"
+ ]
}
],
"prompt_number": 27
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_23.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_23.ipynb
index 3ff4626b..02544a8f 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_23.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_23.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 23"
+ "name": "",
+ "signature": "sha256:ea99fc2be6052cbd9b5accb00ac50cd0a25a5282b964ce8d492c2c528e36d584"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,46 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 23: Environmental Management"
+ "source": [
+ "Chapter 23: Environmental Management"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 23.6, Page number: 498"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 23.6, Page number: 498"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''In 1900, it took about 20,000 Btu fuel input to produce 1 kW. h of electricity. Estimate the\nefficiency of conversion and compare it with a typical value for today\u2019s power industry.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nQ = 20000 #Fuel input (Btu)\ne = 1 #Energy produced (kW.h)\nBtu = 3412 #Units Btu in 1 kW.h\n\n#Calulation:\nER = Q/Btu #Energy requirement in 1990 (kW.h)\nE = e/ER*100 #Efficiency of energy conversion (%)\n\n#Result:\nprint \"The efficiency of energy conversion is :\",round(E,1),\" % .\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "Q = 20000 #Fuel input (Btu)\n",
+ "e = 1 #Energy produced (kW.h)\n",
+ "Btu = 3412 #Units Btu in 1 kW.h\n",
+ "\n",
+ "#Calulation:\n",
+ "ER = Q/Btu #Energy requirement in 1990 (kW.h)\n",
+ "E = e/ER*100 #Efficiency of energy conversion (%)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The efficiency of energy conversion is :\",round(E,1),\" % .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The efficiency of energy conversion is : 17.1 % .\n"
+ "text": [
+ "The efficiency of energy conversion is : 17.1 % .\n"
+ ]
}
],
"prompt_number": 6
@@ -38,19 +60,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 23.7, Page number: 499"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 23.7, Page number: 499"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The James David University runs it own coal-fired power plant, consuming Utah bituminous\ncoal with an energy content (in the combustion literature, energy content is defined as the\nlower heating value, LHV) of 25,000 kJ/kg. The coal contains, on average, 1.0 wt% sulfur\nand 1.2 wt% ash (based on the total mass of the coal). The power plant is 35% efficient (indicating\nthat 35% of the energy in the coal is actually converted to electrical energy), and is operated\nat a 2.0-MW average daily load (ADL).\nAssume that the coal is completely burned during combustion, and also that the power plant\ncaptures 99% of the ash and 70% of the sulfur dioxide produced during combustion. After a\nU.S. Environmental Protection Agency (EPA) Green Lights energy audit, James David found\nthat it could install energy-efficient lighting and reduce its average daily electrical generating\nneeds by 25%.\nUsing the information given above, calculate the average reduction in electrical load and the\nnew average daily load for the power plant.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nADL1 = 2 #Average daily load (MW)\nR = 25/100 #Reduction in electrical load (%)\n\n#Calculation:\nL = 1-R #New load fraction\nADL2 = ADL1*L #New average daily load (MW)\nAR = ADL1-ADL2 #Average reduction in electrical load (MW)\n\n#Result:\nprint \"The new Average daily load for the plant is :\",ADL2,\" MW.\"\nprint \"The average reduction in electrical load is :\",AR,\" MW.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "ADL1 = 2 #Average daily load (MW)\n",
+ "R = 25/100 #Reduction in electrical load (%)\n",
+ "\n",
+ "#Calculation:\n",
+ "L = 1-R #New load fraction\n",
+ "ADL2 = ADL1*L #New average daily load (MW)\n",
+ "AR = ADL1-ADL2 #Average reduction in electrical load (MW)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The new Average daily load for the plant is :\",ADL2,\" MW.\"\n",
+ "print \"The average reduction in electrical load is :\",AR,\" MW.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The new Average daily load for the plant is : 1.5 MW.\nThe average reduction in electrical load is : 0.5 MW.\n"
+ "text": [
+ "The new Average daily load for the plant is : 1.5 MW.\n",
+ "The average reduction in electrical load is : 0.5 MW.\n"
+ ]
}
],
"prompt_number": 7
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_24.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_24.ipynb
index 38c2db87..fb821b6b 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_24.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_24.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 24"
+ "name": "",
+ "signature": "sha256:20841f2d078ed8f6b672e93204c42bfe5b2cecc320cf09e962fc7cfcf63372c5"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,57 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 24: Accident and Emergency Management"
+ "source": [
+ "Chapter 24: Accident and Emergency Management"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 24.4, Page number: 514"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 24.4, Page number: 514"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Calculate the upper flammability limit (UFL) and the lower flammability limit (LFL) of a gas\nmixture that consists of 30% methane (m), 50% ethane (e), and 20% pentane ( p) by volume.\nEmploy the following equation:\nFL(mixture, n components) = 1/(fi/FLi) ; fi = mole fraction i ; i = 1 to n\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nfm = 30/100 #Mole fraction of methane\nfe = 50/100 #Mole fraction of ethane\nfp = 20/100 #Mole fraction of pentane\nLFLm = 0.046 #Lower flammability limit for methane\nLFLe = 0.035 #Lower flammability limit for ethane\nLFLp = 0.014 #Lower flammability limit for propane\nUFLm = 0.142 #Upper flammability limit for methane\nUFLe = 0.151 #Upper flammability limit for ethane\nUFLp = 0.078 #Upper flammability limit for propane\n\n#Calculation:\nLFLmix = 1/((fm/LFLm)+(fe/LFLe)+(fp/LFLp)) #Lower flammability limit of gas mixture\nUFLmix = 1/((fm/UFLm)+(fe/UFLe)+(fp/UFLp)) #Upper flammability limit of gas mixture\n\n#Result:\nprint \"The upper flammability limit (UFL) of the gas mixture is :\",round(UFLmix*100,2),\" % .\"\nprint \"The lower flammability limit (LFL) of the gas mixture is :\",round(LFLmix*100,2),\" % .\"\nprint \"There is a printing mistake in book.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "fm = 30/100 #Mole fraction of methane\n",
+ "fe = 50/100 #Mole fraction of ethane\n",
+ "fp = 20/100 #Mole fraction of pentane\n",
+ "LFLm = 0.046 #Lower flammability limit for methane\n",
+ "LFLe = 0.035 #Lower flammability limit for ethane\n",
+ "LFLp = 0.014 #Lower flammability limit for propane\n",
+ "UFLm = 0.142 #Upper flammability limit for methane\n",
+ "UFLe = 0.151 #Upper flammability limit for ethane\n",
+ "UFLp = 0.078 #Upper flammability limit for propane\n",
+ "\n",
+ "#Calculation:\n",
+ "LFLmix = 1/((fm/LFLm)+(fe/LFLe)+(fp/LFLp)) #Lower flammability limit of gas mixture\n",
+ "UFLmix = 1/((fm/UFLm)+(fe/UFLe)+(fp/UFLp)) #Upper flammability limit of gas mixture\n",
+ "\n",
+ "#Result:\n",
+ "print \"The upper flammability limit (UFL) of the gas mixture is :\",round(UFLmix*100,2),\" % .\"\n",
+ "print \"The lower flammability limit (LFL) of the gas mixture is :\",round(LFLmix*100,2),\" % .\"\n",
+ "print \"There is a printing mistake in book.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The upper flammability limit (UFL) of the gas mixture is : 12.52 % .\nThe lower flammability limit (LFL) of the gas mixture is : 2.85 % .\nThere is a printing mistake in book.\n"
+ "text": [
+ "The upper flammability limit (UFL) of the gas mixture is : 12.52 % .\n",
+ "The lower flammability limit (LFL) of the gas mixture is : 2.85 % .\n",
+ "There is a printing mistake in book.\n"
+ ]
}
],
"prompt_number": 4
@@ -38,19 +71,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 24.5, Page number: 514"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 24.5, Page number: 514"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Two boiler tubes are drawn in succession from a lot of 100 tubes, of which 10 are defective.\nWhat is the probability that both tubes are defective if (a) the first is replaced before the\nsecond is drawn and (b) the first is not replaced before the second is drawn.\n'''\n\nfrom __future__ import division\nfrom sympy import nsimplify as changeToFraction\n\n#Variable declaration:\nP_A = 10/100 #Probability that the first tube is defective if the first is replaced\nP_B = 10/100 #Probability that the second tube is defective if the first is replaced\n\n#Calculation:\nP_AB = P_A*P_B #Probability that the two tubes are defective if the first is replaced\nP_B_A = 9/99 #Probability that the second tube is defective if the first tube is not replaced\nPd_AB = P_A*P_B_A #Probability that both tubes are defective if the first tube is not replaced\n\n#Result:\nprint \"The probability that both tubes are defective if :\"\nprint \"(a) the first is replaced before the second is drawn is :\",changeToFraction(P_AB),\" .\"\nprint \"(b) the first is not replaced before the second is drawn is :\",changeToFraction(Pd_AB),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from sympy import nsimplify as changeToFraction\n",
+ "\n",
+ "#Variable declaration:\n",
+ "P_A = 10/100 #Probability that the first tube is defective if the first is replaced\n",
+ "P_B = 10/100 #Probability that the second tube is defective if the first is replaced\n",
+ "\n",
+ "#Calculation:\n",
+ "P_AB = P_A*P_B #Probability that the two tubes are defective if the first is replaced\n",
+ "P_B_A = 9/99 #Probability that the second tube is defective if the first tube is not replaced\n",
+ "Pd_AB = P_A*P_B_A #Probability that both tubes are defective if the first tube is not replaced\n",
+ "\n",
+ "#Result:\n",
+ "print \"The probability that both tubes are defective if :\"\n",
+ "print \"(a) the first is replaced before the second is drawn is :\",changeToFraction(P_AB),\" .\"\n",
+ "print \"(b) the first is not replaced before the second is drawn is :\",changeToFraction(Pd_AB),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The probability that both tubes are defective if :\n(a) the first is replaced before the second is drawn is : 1/100 .\n(b) the first is not replaced before the second is drawn is : 1/110 .\n"
+ "text": [
+ "The probability that both tubes are defective if :\n",
+ "(a) the first is replaced before the second is drawn is : 1/100 .\n",
+ "(b) the first is not replaced before the second is drawn is : 1/110 .\n"
+ ]
}
],
"prompt_number": 9
@@ -59,19 +117,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 24.6, Page number: 515"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 24.6, Page number: 515"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The difference between the magnitude of a large earthquake at a nuclear power plant, on the\nRichter scale, and the threshold value of 3.25, is a random variable X having the following\nprobability distribution function (pdf):\n f(X) = 1.7 exp(-1.7X) ; X > 0\n = 0 ; elsewhere\nFind the probability that X will have a value between 2 and 6; that is, P(2 < X < 6).\n'''\n\nfrom sympy import symbols, integrate, exp\n\n#Variable declaration:\nX = symbols('X') #Range of X\nPx = 1.7*(exp(-1.7*X)) #Probability distribution function\n\n#Calculation:\nP = integrate(Px, (X,2,6)) #Probability that X will have a value between 2 and 6\n\n#Result:\nprint \"The probability that X will have a value between 2 and 6 is :\",round(P,4),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from sympy import symbols, integrate, exp\n",
+ "\n",
+ "#Variable declaration:\n",
+ "X = symbols('X') #Range of X\n",
+ "Px = 1.7*(exp(-1.7*X)) #Probability distribution function\n",
+ "\n",
+ "#Calculation:\n",
+ "P = integrate(Px, (X,2,6)) #Probability that X will have a value between 2 and 6\n",
+ "\n",
+ "#Result:\n",
+ "print \"The probability that X will have a value between 2 and 6 is :\",round(P,4),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The probability that X will have a value between 2 and 6 is : 0.0333 .\n"
+ "text": [
+ "The probability that X will have a value between 2 and 6 is : 0.0333 .\n"
+ ]
}
],
"prompt_number": 6
@@ -80,19 +156,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 24.7, Page number: 517"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 24.7, Page number: 517"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A coolant sprinkler system in a reactor has 20 independent spray components each of which\nfails with a probability of 0.1. The coolant system is considered to \u201cfail\u201d only if four or more\nof the sprays fail. What is the probability that the sprinkler systems fails?\n'''\n\nfrom __future__ import division\nfrom math import factorial\n\n#Variable Declaration:\nn = 20 #Total number of components\np = 0.1 #Probability of success\n\n#Calculations:\ndef binomial(n,p,x):\n P=0\n for x in range(0,x,1):\n P = P + p**x*(1-p)**(n-x)*factorial(n)/(factorial(x)*factorial(n-x))\n return P\n\n#Results:\nprint \"Probability that the sprinkler system fails :\",round((1-binomial(n,p,4))*100,2),\"%\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import factorial\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "n = 20 #Total number of components\n",
+ "p = 0.1 #Probability of success\n",
+ "\n",
+ "#Calculations:\n",
+ "def binomial(n,p,x):\n",
+ " P=0\n",
+ " for x in range(0,x,1):\n",
+ " P = P + p**x*(1-p)**(n-x)*factorial(n)/(factorial(x)*factorial(n-x))\n",
+ " return P\n",
+ "\n",
+ "#Results:\n",
+ "print \"Probability that the sprinkler system fails :\",round((1-binomial(n,p,4))*100,2),\"%\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Probability that the sprinkler system fails : 13.3 %\n"
+ "text": [
+ "Probability that the sprinkler system fails : 13.3 %\n"
+ ]
}
],
"prompt_number": 7
@@ -101,19 +200,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 24.8, Page number: 518"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 24.8, Page number: 518"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Assume the time to failure (in hours), t, of a tube in a heat exchanger has aWeibull distribution\nwith a = 1.3x10^-3 and b = 0.77. Find the probability that a tube in a heat exchanger will fail\nin 1000 hours.\n'''\n\nfrom sympy import symbols, integrate, exp\n\n#Variable declaration:\na = 1.3*10**-3 #Constant a\nB = 0.77 #Constant B\nt = symbols('t') #Time (h)\nFt = a*B*t**(B-1)*(exp(-a*t**B)) #Pdf for heat exchanger tube\nPt = integrate(Ft, (t,0,1000)) #Probability that a heat exchanger will fail within 100 hours\n\n#Result:\nprint \"The probability that a tube in a heat exchanger will fail in 1000 hours is :\",round(Pt,2),\" .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from sympy import symbols, integrate, exp\n",
+ "\n",
+ "#Variable declaration:\n",
+ "a = 1.3*10**-3 #Constant a\n",
+ "B = 0.77 #Constant B\n",
+ "t = symbols('t') #Time (h)\n",
+ "Ft = a*B*t**(B-1)*(exp(-a*t**B)) #Pdf for heat exchanger tube\n",
+ "Pt = integrate(Ft, (t,0,1000)) #Probability that a heat exchanger will fail within 100 hours\n",
+ "\n",
+ "#Result:\n",
+ "print \"The probability that a tube in a heat exchanger will fail in 1000 hours is :\",round(Pt,2),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The probability that a tube in a heat exchanger will fail in 1000 hours is : 0.23 .\n"
+ "text": [
+ "The probability that a tube in a heat exchanger will fail in 1000 hours is : 0.23 .\n"
+ ]
}
],
"prompt_number": 21
@@ -122,19 +239,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 24.9, Page number: 519"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 24.9, Page number: 519"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The measurement of the pitch diameter of an acceptable thread of a boiler tube is normally distributed\nwith mean of 0.4008 inch and standard deviation of 0.0004 inch. The specifications are\ngiven as 0.4000+0.0010 and 0.4000-0.0010. What is the probability of a \u201cdefect\u201d occurring?\n'''\n\nfrom __future__ import division\nfrom scipy.stats import norm as f\n\n#Variable declaration:\nm = 0.4008 #Mean(inch)\ns = 0.0004 #Standard Deviation(inch)\nUL = 0.4000+0.001 #Upper Limit\nLL = 0.4000-0.001 #Upper Limit\n\n#Calculation:\nPs = f.cdf(UL,m,s)-f.cdf(LL,m,s)#Probability of meeting specs\nPd = 1-Ps #Probability of defect\n\n#Results:\nprint 'Probability of meeting specifications:',round(Ps*100,2),'%'\nprint 'Probability of Defect:',round(Pd*100,2),'%'",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from scipy.stats import norm as f\n",
+ "\n",
+ "#Variable declaration:\n",
+ "m = 0.4008 #Mean(inch)\n",
+ "s = 0.0004 #Standard Deviation(inch)\n",
+ "UL = 0.4000+0.001 #Upper Limit\n",
+ "LL = 0.4000-0.001 #Upper Limit\n",
+ "\n",
+ "#Calculation:\n",
+ "Ps = f.cdf(UL,m,s)-f.cdf(LL,m,s)#Probability of meeting specs\n",
+ "Pd = 1-Ps #Probability of defect\n",
+ "\n",
+ "#Results:\n",
+ "print 'Probability of meeting specifications:',round(Ps*100,2),'%'\n",
+ "print 'Probability of Defect:',round(Pd*100,2),'%'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Probability of meeting specifications: 69.15 %\nProbability of Defect: 30.85 %\n"
+ "text": [
+ "Probability of meeting specifications: 69.15 %\n",
+ "Probability of Defect: 30.85 %\n"
+ ]
}
],
"prompt_number": 10
@@ -143,19 +284,55 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 24.10, Page number: 522"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 24.10, Page number: 522"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Three thermometers (A, B, C) are positioned near the outlet of a heat exchanger. Assume that\nthe individual thermometer component lifetimes are normally distributed with ms and\nstandard deviations provided in Table 24.3.\nUsing the following random numbers, simulate the lifetime (time to failure) of the temperature\nrecording system and estimate its m and standard deviation. The lifetime to failure is\ndefined as the time (in weeks) for one of the thermometers to \u201cfail\u201d.\nMonte Carlo simulation is a procedure for mimicking observations on a random variable that\npermits verification of results that would ordinarily require difficult mathematical calculations or\nextensive experimentation. The method normally uses computer programs called random\nnumber generators. A random number is a number selected from the interval (0, 1) in such a\nway that the probabilities that the number comes from any two subintervals of equal length\nare equal. For example, the probability the number is in the sub-interval (0.1, 0.3) is the\nsame as the probability that the number is in the subinterval (0.5, 0.7). Thus, random numbers\nare observations on a random variable X having a uniform distribution on the interval (0, 1). This\nms that the pdf of X is specified by:\nf(x) = 1; 0 , x , 1\n = 0; elsewhere\nThe above pdf assigns equal probability to subintervals of equal length in the interval (0, 1).\nUsing random number generators, Monte Carlo simulation can generate observed values of a\nrandom variable having any specified pdf. For example, to generate observed values of T, the\ntime to failure, when T is assumed to have a pdf specified by f (t), first use the random\nnumber generator to generate a value of X between 0 and 1. The solution is an observed\nvalue of the random variable T having pdf specified by f (t). Additional information on\nMonte Carlo methods is provided in Chapter 26.\n'''\n\nfrom __future__ import division\nfrom numpy import array,minimum\nfrom math import sqrt\n\n#variable Declaration:\nmTa = array([100]*10) #Mean weeks for thermometer failure(A)\nmTb = array([90]*10) #Mean weeks for thermometer failure(B)\nmTc = array([80]*10) #Mean weeks for thermometer failure(C)\nsTa = 30 #Standard deviation (weeks) for thermometer failure(A)\nsTb = 20 #Standard deviation (weeks) for thermometer failure(B)\nsTc = 10 #Standard deviation (weeks) for thermometer failure(C)\nRa = array([0.52,0.80,0.45,0.68,0.59,0.01,0.50,0.29,0.34,0.46]) #Random No corrosponding to A\nRb = array([0.77,0.54,0.96,0.02,0.73,0.67,0.31,0.34,0.00,0.48]) #Random No corrosponding to B\nRc = array([0.14,0.39,0.06,0.86,0.87,0.90,0.28,0.51,0.56,0.82]) #Random No corrosponding to B\nZa = array([0.05,0.84,-0.13,0.47,0.23,-2.33,0.00,-0.55,-0.41,-0.10]) #Normal variable corrosponding to random No for A\nZb = array([0.74,0.10,1.75,-2.05,0.61,0.44,-0.50,-0.41,-3.90,-0.05]) #Normal variable corrosponding to random No for B\nZc = array([-1.08,-0.28,-1.56,1.08,1.13,1.28,-0.58,0.03,0.15,0.92]) #Normal variable corrosponding to random No for C\n\n#Calculations:\nTa = mTa+sTa*Za\nTb = mTb+sTb*Zb\nTc = mTc+sTc*Zc\nTs = minimum(Ta,Tb)\nTs = minimum(Ts,Tc)\nm = array([sum(Ts)/len(Ts)]*10)\ns = sqrt(sum((Ts-m)**2)/(len(Ts)-1))\n\n#Results:\nprint 'Standard deviation :',round(s,1),\" Weeks\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from numpy import array,minimum\n",
+ "from math import sqrt\n",
+ "\n",
+ "#variable Declaration:\n",
+ "mTa = array([100]*10) #Mean weeks for thermometer failure(A)\n",
+ "mTb = array([90]*10) #Mean weeks for thermometer failure(B)\n",
+ "mTc = array([80]*10) #Mean weeks for thermometer failure(C)\n",
+ "sTa = 30 #Standard deviation (weeks) for thermometer failure(A)\n",
+ "sTb = 20 #Standard deviation (weeks) for thermometer failure(B)\n",
+ "sTc = 10 #Standard deviation (weeks) for thermometer failure(C)\n",
+ "Ra = array([0.52,0.80,0.45,0.68,0.59,0.01,0.50,0.29,0.34,0.46]) #Random No corrosponding to A\n",
+ "Rb = array([0.77,0.54,0.96,0.02,0.73,0.67,0.31,0.34,0.00,0.48]) #Random No corrosponding to B\n",
+ "Rc = array([0.14,0.39,0.06,0.86,0.87,0.90,0.28,0.51,0.56,0.82]) #Random No corrosponding to B\n",
+ "Za = array([0.05,0.84,-0.13,0.47,0.23,-2.33,0.00,-0.55,-0.41,-0.10]) #Normal variable corrosponding to random No for A\n",
+ "Zb = array([0.74,0.10,1.75,-2.05,0.61,0.44,-0.50,-0.41,-3.90,-0.05]) #Normal variable corrosponding to random No for B\n",
+ "Zc = array([-1.08,-0.28,-1.56,1.08,1.13,1.28,-0.58,0.03,0.15,0.92]) #Normal variable corrosponding to random No for C\n",
+ "\n",
+ "#Calculations:\n",
+ "Ta = mTa+sTa*Za\n",
+ "Tb = mTb+sTb*Zb\n",
+ "Tc = mTc+sTc*Zc\n",
+ "Ts = minimum(Ta,Tb)\n",
+ "Ts = minimum(Ts,Tc)\n",
+ "m = array([sum(Ts)/len(Ts)]*10)\n",
+ "s = sqrt(sum((Ts-m)**2)/(len(Ts)-1))\n",
+ "\n",
+ "#Results:\n",
+ "print 'Standard deviation :',round(s,1),\" Weeks\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Standard deviation : 25.9 Weeks\n"
+ "text": [
+ "Standard deviation : 25.9 Weeks\n"
+ ]
}
],
"prompt_number": 22
@@ -164,19 +341,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 24.15, Page number: 531"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 24.15, Page number: 531"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A heat exchanger is located in a relatively large laboratory with a volume of 1100 m^3 at 22\u00b0C and\n1 atm. The exchanger can leak as much as 0.75 gmol of hydrocarbon (HC) from the flowing\nliquid into the room if the exchanger ruptures. A hydrocarbon mole fraction in the air greater\nthan 425 parts per billion (ppb) constitutes a health and safety hazard.\nSuppose the heat exchanger fails and the maximum amount of HC is released instantaneously.\nAssume the air flow in the room is sufficient to cause the room to behave as a continuously\nstirred tank reactor (CSTR^(17 \u2013 19)); i.e., the air composition is spatially uniform.\nCalculate the ppb of hydrocarbon in the room. Is there a health risk? From a treatment pointof-\nview, what can be done to decrease the environmental hazard or to improve the safety of\nthe exchanger?\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nt = 273 #Standard temperature (K)\nv = 0.0224 #Volume of air occupied by 1 gmol of ideal gas (m^3)\nV = 1100 #Volume of heat exchanger (m^3)\nT = 22+273 #Temperature of heat exchanger (K)\nx1 = 0.75 #gmols of hydrocarbon leaking from the exchanger (gmol)\n\n#Calculation:\nn = V*(1/v)*(t/T) #Total number of gmols of air in the room (gmol)\nxHC = (x1/(n+x1))*10**6 #The mole fraction of hydrocarbon in the room (ppm)\n\n#Result:\nprint \"1. The mole fraction of hydrocarbon in the room is :\",round(xHC*1000,-1),\" ppb .\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "t = 273 #Standard temperature (K)\n",
+ "v = 0.0224 #Volume of air occupied by 1 gmol of ideal gas (m^3)\n",
+ "V = 1100 #Volume of heat exchanger (m^3)\n",
+ "T = 22+273 #Temperature of heat exchanger (K)\n",
+ "x1 = 0.75 #gmols of hydrocarbon leaking from the exchanger (gmol)\n",
+ "\n",
+ "#Calculation:\n",
+ "n = V*(1/v)*(t/T) #Total number of gmols of air in the room (gmol)\n",
+ "xHC = (x1/(n+x1))*10**6 #The mole fraction of hydrocarbon in the room (ppm)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The mole fraction of hydrocarbon in the room is :\",round(xHC*1000,-1),\" ppb .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The mole fraction of hydrocarbon in the room is : 16500.0 ppb .\n"
+ "text": [
+ "1. The mole fraction of hydrocarbon in the room is : 16500.0 ppb .\n"
+ ]
}
],
"prompt_number": 3
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_26.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_26.ipynb
index 2aff0c90..bc45d0b7 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_26.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_26.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 26"
+ "name": "",
+ "signature": "sha256:69bf1b06698ebd52373cd9d0afc4312e7a8e8c49afae73fb0be120a794b9fc92"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,49 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 26: Numerical Methods"
+ "source": [
+ "Chapter 26: Numerical Methods"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 26.8, Page number: 558"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 26.8, Page number: 558"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Species A is undergoing a reaction in a tubular flow unit. The following data (see Table 26.1)\nhave been obtained for the rate, 2rA, versus concentration, CA. Using this data, estimate the\ncoefficient kA and a in the equation below.\n-rA = kACA^a\n'''\nfrom __future__ import division\nfrom sympy import symbols,solve,log\nfrom math import exp\n\n#Variable Declaration:\nA,B,r,C = symbols('A B r C');\n\n#Calculation:\nres = solve([A + B*log(2)-log(3),A + B*log(4)-log(12)],[A,B])\nA = round(float(res[A]),4)\nB = round(float(res[B]))\nkA = round(exp(A),2)\na = B\n\n#Result:\nprint 'The equation for rate of reaction is: ',-r,'=',kA*C**a ",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from sympy import symbols,solve,log\n",
+ "from math import exp\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "A,B,r,C = symbols('A B r C');\n",
+ "\n",
+ "#Calculation:\n",
+ "res = solve([A + B*log(2)-log(3),A + B*log(4)-log(12)],[A,B])\n",
+ "A = round(float(res[A]),4)\n",
+ "B = round(float(res[B]))\n",
+ "kA = round(exp(A),2)\n",
+ "a = B\n",
+ "\n",
+ "#Result:\n",
+ "print 'The equation for rate of reaction is: ',-r,'=',kA*C**a "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The equation for rate of reaction is: -r = 0.75*C**2.0\n"
+ "text": [
+ "The equation for rate of reaction is: -r = 0.75*C**2.0\n"
+ ]
}
],
"prompt_number": 9
@@ -38,19 +63,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 26.9, Page number: 559"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 26.9, Page number: 559"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The viscosity of air as a function of temperature is provided below in Table 26.2. Assuming a\nlinear relationship, obtain the viscosity as a function of temperature.\n'''\nimport scipy.stats as f\n\n#Variable Declaration:\nT = [-40,-20,0,10,12,30,40,50,60,80,100,150,200,250,300,400,500]\nu = [1.51,1.61,1.71,1.76,1.81,1.86,1.90,1.95,2.00,2.09,2.17,2.38,2.57,2.75,2.93,3.25,3.55]\n\n#Calculations:\nB,A,r_value, p_value, std_err = f.linregress(T,u)\n\n#Results:\nprint 'The value of A in regression model is:',round(A,4)\nprint 'The value of B in regression model is:',round(B,4)",
+ "input": [
+ "\n",
+ "import scipy.stats as f\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "T = [-40,-20,0,10,12,30,40,50,60,80,100,150,200,250,300,400,500]\n",
+ "u = [1.51,1.61,1.71,1.76,1.81,1.86,1.90,1.95,2.00,2.09,2.17,2.38,2.57,2.75,2.93,3.25,3.55]\n",
+ "\n",
+ "#Calculations:\n",
+ "B,A,r_value, p_value, std_err = f.linregress(T,u)\n",
+ "\n",
+ "#Results:\n",
+ "print 'The value of A in regression model is:',round(A,4)\n",
+ "print 'The value of B in regression model is:',round(B,4)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The value of A in regression model is: 1.7484\nThe value of B in regression model is: 0.0038\n"
+ "text": [
+ "The value of A in regression model is: 1.7484\n",
+ "The value of B in regression model is: 0.0038\n"
+ ]
}
],
"prompt_number": 10
@@ -59,19 +103,62 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 26.11, Page number: 561"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 26.11, Page number: 561"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A refinery has two catcrackers that can produce various grades of hydrocarbon products.\nBecause of consumer fuel demand, the production of gasoline, home heating oil and diesel\nmust be limited. This information is provided in Table 26.3.\nThe profit on processing U.S. crude oil is $2.00/gal and on Venezuelan crude is $1.60/gal.\nFind the approximate daily processing rate of the two crudes in order to maximize profits.\n'''\nfrom __future__ import division\nfrom scipy.optimize import fmin_cobyla as optimize\n\n#Key:\n#f(x) : Objective Function\n#ci(x)'s : Constraints\n\n#Variable Declaration:\ndef f(x):\t\n return -2.0*x[0] - 1.6*x[1]\n\ndef c1(x):\n return 16820 - x[0]\n\ndef c2(x):\n return 1152 - x[1]\n\ndef c3(x):\n return 1500 - 0.08*x[0] - 0.11*x[1]\n\ndef c4(x):\n return 6000 - 0.29*x[0] - 0.54*x[1]\n\ndef c5(x):\n return 11000 - 0.63*x[0] - 0.35*x[1]\n\ndef c6(x):\n return x[0]\n\ndef c7(x):\n return x[1]\n\n#Calculation\nX = optimize(f,[16820,1152],[c1,c2,c3,c4,c5,c6], disp = 0)\n\n#Result:\nprint \"Maximum Profit is $\",round(-f(X)), \"/day or $\", -365*f(X), \"/year\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from scipy.optimize import fmin_cobyla as optimize\n",
+ "\n",
+ "#Key:\n",
+ "#f(x) : Objective Function\n",
+ "#ci(x)'s : Constraints\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "def f(x):\t\n",
+ " return -2.0*x[0] - 1.6*x[1]\n",
+ "\n",
+ "def c1(x):\n",
+ " return 16820 - x[0]\n",
+ "\n",
+ "def c2(x):\n",
+ " return 1152 - x[1]\n",
+ "\n",
+ "def c3(x):\n",
+ " return 1500 - 0.08*x[0] - 0.11*x[1]\n",
+ "\n",
+ "def c4(x):\n",
+ " return 6000 - 0.29*x[0] - 0.54*x[1]\n",
+ "\n",
+ "def c5(x):\n",
+ " return 11000 - 0.63*x[0] - 0.35*x[1]\n",
+ "\n",
+ "def c6(x):\n",
+ " return x[0]\n",
+ "\n",
+ "def c7(x):\n",
+ " return x[1]\n",
+ "\n",
+ "#Calculation\n",
+ "X = optimize(f,[16820,1152],[c1,c2,c3,c4,c5,c6], disp = 0)\n",
+ "\n",
+ "#Result:\n",
+ "print \"Maximum Profit is $\",round(-f(X)), \"/day or $\", -365*f(X), \"/year\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Maximum Profit is $ 35483.0 /day or $ 12951368.0 /year\n"
+ "text": [
+ "Maximum Profit is $ 35483.0 /day or $ 12951368.0 /year\n"
+ ]
}
],
"prompt_number": 7
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_27.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_27.ipynb
index c26d4fbd..c5e5dea1 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_27.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_27.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 27"
+ "name": "",
+ "signature": "sha256:9cb92879a3edfd07367a11876840b47bf3060ee079039238aa0305841473df9a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,49 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 27: Economics and Finance"
+ "source": [
+ "Chapter 27: Economics and Finance"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 27.5, Page number: 575"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 27.5, Page number: 575"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A heat exchanger costing $60,000 has an estimated lifetime of 9 years and a salvage value of\n$500. What uniform annual payment must be made into a fund at the end of the year to replace\nTable 27.1 Comparative Methods of Analysis\nYear Straight-line Double-declining Sum-of-the-year\u2019s digits\n0 1.000 1.000 1.000\n1 0.900 0.800 0.818\n2 0.800 0.640 0.655\n3 0.700 0.512 0.510\n4 0.600 0.410 0.383\n5 0.500 0.328 0.274\n6 0.400 0.262 0.183\n7 0.300 0.210 0.110\n8 0.200 0.168 0.056\n9 0.100 0.134 0.018\n10 0.000 0.108 0.000\nthe exchanger if the fund earns 3.375%? What would be the appraisal value of the exchanger at\nthe end of the fifth year based on straight line depreciation?\n'''\n\n#Variable declaration:\ni = 0.03375 #Rate of interest (%)\nn = 9 #Years to the end of life (yr)\nP = 60000 #Cost of exchanger ($)\nL = 500 #Salvage value ($)\nx = 5 #Time after 5 years (yr)\n\n#Calculation:\nSFDF = i/((1+i)**n-1) #Sinking fund depreciation factor\nUAP = (P-L)*SFDF #Uniform annual payment ($)\nB = P-((P-L)/n)*x #Appraisal value after 5 years ($)\n\n#Result:\nprint \"1. The uniform annual payment made into the fund at the of the year is : $\",round(UAP),\" .\"\nprint \"2. The appraisal value of the exchanger at the end of the fifth year is : $\",round(B),\" .\"",
+ "input": [
+ "\n",
+ "#Variable declaration:\n",
+ "i = 0.03375 #Rate of interest (%)\n",
+ "n = 9 #Years to the end of life (yr)\n",
+ "P = 60000 #Cost of exchanger ($)\n",
+ "L = 500 #Salvage value ($)\n",
+ "x = 5 #Time after 5 years (yr)\n",
+ "\n",
+ "#Calculation:\n",
+ "SFDF = i/((1+i)**n-1) #Sinking fund depreciation factor\n",
+ "UAP = (P-L)*SFDF #Uniform annual payment ($)\n",
+ "B = P-((P-L)/n)*x #Appraisal value after 5 years ($)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The uniform annual payment made into the fund at the of the year is : $\",round(UAP),\" .\"\n",
+ "print \"2. The appraisal value of the exchanger at the end of the fifth year is : $\",round(B),\" .\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The uniform annual payment made into the fund at the of the year is : $ 5768.0 .\n2. The appraisal value of the exchanger at the end of the fifth year is : $ 26945.0 .\n"
+ "text": [
+ "1. The uniform annual payment made into the fund at the of the year is : $ 5768.0 .\n",
+ "2. The appraisal value of the exchanger at the end of the fifth year is : $ 26945.0 .\n"
+ ]
}
],
"prompt_number": 6
@@ -38,19 +63,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 27.6, Page number: 576"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 27.6, Page number: 576"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''The annual operation costs of an outdated heat exchanger/boiler system is $75,000. Under a\nproposed new design, the installation of a new system will require an initial cost of $150,000\nand an annual operating cost of $15,000 for the first five years. Determine the annualized cost for\nthe new heating system by assuming the system has only five years (n) operational life. The interest\nrate (i) is 7%. The capital recovery factor (CRF) or annual payment of a capital investment\ncan be calculated as follows:\nCRF = (A/P)i,n = i(1 + i)^n/(1 + i)^n - 1 (27.11)\nwhere A is the annual cost and P is the present worth.\nCompare the costs for both the outdated and proposed operations.\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\nC = 150000 #Capital cost ($)\ni = 7/100 #Interest rate\nn = 5 #Time (yr)\nOC = 15000 #Operating cost ($)\nA = 75000 #Annual cost for the old process ($)\n\n#Calculation:\nCRF = (i*(1+i)**n)/((1+i)**n-1) #Capital recovery factor\nIC = CRF*C #Initial cost ($)\nAC = IC+OC #Total annualized cost ($)\n\n#Result:\nprint \"The annualized cost for the new heating system is : $\",round(AC),\" .\"\nif (AC<A):\n print \"Since this cost is lower than the annual cost of $75,000 for the old process, the proposed plan should be implemented.\"\nelse :\n print \"Since this cost is higher than the annual cost of $75,000 for the old process, the proposed plan should not be implemented.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "C = 150000 #Capital cost ($)\n",
+ "i = 7/100 #Interest rate\n",
+ "n = 5 #Time (yr)\n",
+ "OC = 15000 #Operating cost ($)\n",
+ "A = 75000 #Annual cost for the old process ($)\n",
+ "\n",
+ "#Calculation:\n",
+ "CRF = (i*(1+i)**n)/((1+i)**n-1) #Capital recovery factor\n",
+ "IC = CRF*C #Initial cost ($)\n",
+ "AC = IC+OC #Total annualized cost ($)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The annualized cost for the new heating system is : $\",round(AC),\" .\"\n",
+ "if (AC<A):\n",
+ " print \"Since this cost is lower than the annual cost of $75,000 for the old process, the proposed plan should be implemented.\"\n",
+ "else :\n",
+ " print \"Since this cost is higher than the annual cost of $75,000 for the old process, the proposed plan should not be implemented.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The annualized cost for the new heating system is : $ 51584.0 .\nSince this cost is lower than the annual cost of $75,000 for the old process, the proposed plan should be implemented.\n"
+ "text": [
+ "The annualized cost for the new heating system is : $ 51584.0 .\n",
+ "Since this cost is lower than the annual cost of $75,000 for the old process, the proposed plan should be implemented.\n"
+ ]
}
],
"prompt_number": 7
@@ -59,19 +112,54 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 27.7, Page number: 577"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 27.7, Page number: 577"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Plans are underway to construct and operate a commercial hazardous waste facility in\nDumpsville in the sate of Egabrag. The company is still undecided as to whether to install a\ndouble pipe or shell-and-tube heat exchanger at the plant site to recover energy. The double\npipe (DP) unit is less expensive to purchase and operate than a comparable shell-and-tube\n(ST) system. However, projected energy recover income from the ST unit is higher since it\nwill handle a larger quantity and different temperature steam.\nBased on economic and financial data provided in Table 27.2, select the heat exchanger or\nthat will yield the higher annual profit.\nCalculations should be based on an interest rate of 12% and a process lifetime of 12 years for\nboth exchangers.\nTable 27.2 Costs/Credits Data\nCosts/credits Double pipe (DP) Shell-and-tube (ST)\nCapital ($) 2,625,000 2,975,000\nInstallation ($) 1,575,000 1,700,000\nOperation ($/yr) 400,000 550,000\nMaintenance ($/yr) 650,000 775,000\nIncome ($/yr) 2,000,000 2,500,000\n'''\n\nfrom __future__ import division\n\n#Variable declaration:\ni = 12/100 #Intersest rate\nn = 12 #Lifetime period (yr)\nCC = 2625000 #Capital cost ($)\nIC = 1575000 #Installation cost ($)\n#From table 27.3:\nIc1 = 2000000 #Income credit for double pipe ($/yr)\nIc2 = 2500000 #Income credit for Shell-and-tube ($/yr)\nAC1 = 1728000 #Total annual cost for double pipe ($/yr)\nAC2 = 2080000 #Total annual cost for Shell-and-tube ($/yr)\n\n#Calculation:\nCRF = i/(1-(1+i)**-n) #Capital recovery factor\nDPc = (CC+IC)*CRF #Annual capital and installation costs for the DP unit ($/yr)\nSTc = (CC+IC)*CRF #Annual capital and installation costs for the ST unit ($/yr)\nDPp = Ic1-AC1 #Profit for the DP unit ($/yr)\nSTp = Ic2-AC2 #Profit for the ST unit ($/yr)\n\n#Result:\nprint \"The profit for the shell-and-tube unit is : $\",round(DPp),\"/yr .\"\nprint \"The profit for the double pipe unit is : $\",round(STp),\"/yr .\"\nif (STp>DPp):\n print \"A shell-and-tube heat exchanger should therefore be selected based on the above economic analysis.\"\nelse :\n print \"A double pipe heat exchanger should therefore be selected based on the above economic analysis.\"",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "i = 12/100 #Intersest rate\n",
+ "n = 12 #Lifetime period (yr)\n",
+ "CC = 2625000 #Capital cost ($)\n",
+ "IC = 1575000 #Installation cost ($)\n",
+ "#From table 27.3:\n",
+ "Ic1 = 2000000 #Income credit for double pipe ($/yr)\n",
+ "Ic2 = 2500000 #Income credit for Shell-and-tube ($/yr)\n",
+ "AC1 = 1728000 #Total annual cost for double pipe ($/yr)\n",
+ "AC2 = 2080000 #Total annual cost for Shell-and-tube ($/yr)\n",
+ "\n",
+ "#Calculation:\n",
+ "CRF = i/(1-(1+i)**-n) #Capital recovery factor\n",
+ "DPc = (CC+IC)*CRF #Annual capital and installation costs for the DP unit ($/yr)\n",
+ "STc = (CC+IC)*CRF #Annual capital and installation costs for the ST unit ($/yr)\n",
+ "DPp = Ic1-AC1 #Profit for the DP unit ($/yr)\n",
+ "STp = Ic2-AC2 #Profit for the ST unit ($/yr)\n",
+ "\n",
+ "#Result:\n",
+ "print \"The profit for the shell-and-tube unit is : $\",round(DPp),\"/yr .\"\n",
+ "print \"The profit for the double pipe unit is : $\",round(STp),\"/yr .\"\n",
+ "if (STp>DPp):\n",
+ " print \"A shell-and-tube heat exchanger should therefore be selected based on the above economic analysis.\"\n",
+ "else :\n",
+ " print \"A double pipe heat exchanger should therefore be selected based on the above economic analysis.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The profit for the shell-and-tube unit is : $ 272000.0 /yr .\nThe profit for the double pipe unit is : $ 420000.0 /yr .\nA shell-and-tube heat exchanger should therefore be selected based on the above economic analysis.\n"
+ "text": [
+ "The profit for the shell-and-tube unit is : $ 272000.0 /yr .\n",
+ "The profit for the double pipe unit is : $ 420000.0 /yr .\n",
+ "A shell-and-tube heat exchanger should therefore be selected based on the above economic analysis.\n"
+ ]
}
],
"prompt_number": 8
@@ -80,19 +168,80 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 27.8, Page number: 579"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 27.8, Page number: 579"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Based on an outgrowth of a 2011 energy audit study for a new process, it is necessary to heat\n50,000 lb/h of an organic liquid form 150 to 330\u00b0F. The liquid is at a pressure of 135 psia. A\nsimple steam-heated shell-and-tube foating-head carbon steel exchanger is the preferred equipment\nchoice. Steam is available at 150 psia (135 psig) and 300 psia (285 psig). The higher\npressure steam should result in a smaller heat exchanger but the steam will cost more. Which\nsteam choice would be better?\nData:\nThe heat capacity of the organic liquid is 0.6 Btu/lb.\u00b0F.\nThe plant on-stream operation factor is expected to be 90%.\nSteam properties are:\n 150 psia 300 psia\nSaturation temperature, \u00b0F 358.0 417.0\nLatent heat (enthalpy), Btu/lb 863.6 809.0\nCost, $/1000 lb 5.20 5.75\nHeat exchanger cost correlation (1998 basis):\nBase cost (BC) = 117 A^0.65\nInstallation factor (IF) = 3.29\nPressure factors (PF):\n100 to 200 psig = 1.15\n200 to 300 psig = 1.20\nCost indexes (CI):\n1998 = 230\n2011 = 360\nCapital cost (C) = (BC)(IF)(PF)(CI)\n'''\n\nfrom __future__ import division\nfrom math import log\n\n#Variable declaration:\nm = 50000 #Mass flowrate of the organic fluid (lb/h)\ncP = 0.6 #The heat capacity of the organic liquid (Btu/lb.\u00b0F)\nT1 = 150 #Initial temperature of organic fluid (\u00b0F)\nT2 = 330 #Final temperature of organic fluid (\u00b0F)\nTs1 = 358 #Saturation temperature for 150 psia (\u00b0F)\nTs2 = 417 #Saturation temperature for 300 psia (\u00b0F)\nL1 = 863.6 #Latent heat for 150 psia (Btu/lb)\nL2 = 809 #Latent heat for 300 psia (Btu/lb)\nc1 = 5.20/1000 #Cost for 150 psia ($/lb)\nc2 = 5.75/1000 #Cost for 300 psia ($/lb)\nCI1 = 230 #Cost index in 1998 \nCI2 = 360 #Cost index in 2011\nIF = 3.29 #Installation factor\nPF1 = 1.15 #Pressure factors for 100 to 200 psig\nPF2 = 1.20 #Pressure factors for 200 to 300 psig\nOP = 90/100 #Plant on-stream operation factor\nh = 365*24 #Hours in a year (h)\n\n#Calculation:\nQ = m*cP*(T2-T1) #Overall heta duty (Btu/h)\nDT1 = Ts1-T1 #Temperature driving force 1 for 150 psia (\u00b0F)\nDT2 = Ts1-T2 #Temperature driving force 2 for 150 psia (\u00b0F)\nLMTD1 = (DT1-DT2)/log(DT1/DT2) #Log-mean temperature difference for 150 psia (\u00b0F)\nDT3 = Ts2-T1 #Temperature driving force 1 for 300 psia (\u00b0F)\nDT4 = Ts2-T2 #Temperature driving force 2 for 300 psia (\u00b0F)\nLMTD2 = (DT3-DT4)/log(DT3/DT4) #Log-mean temperature difference for 1300 psia (\u00b0F)\nA1 = Q/(138*LMTD1) #Required heat transfer area for 150 psia (ft^2)\nA2 = Q/(138*LMTD2) #Required heat transfer area for 300 psia (ft^2)\nBC1 = 117*A1**0.65 #Base cost for 150 psia ($)\nBC2 = 117*A2**0.65 #Base cost for 13000 psia ($)\nC1 = BC1*(CI2/CI1)*IF*PF1 #Capital cost for 150 psia ($)\nC2 = BC2*(CI2/CI1)*IF*PF2 #Capital cost for 300 psia ($)\nS1 = Q*(h*OP)/L1 #Steam requirement for 150 psia (lb/yr)\nS2 = Q*(h*OP)/L2 #Steam requirement for 300 psia (lb/yr)\nSC1 = S1*c1 #Annual steam cost for 150 psia ($/yr)\nSC2 = S2*c2 #Annual steam cost for 300 psia ($/yr)\n\n#Result:\nprint \"1. The capital cost for 150 psia is : $\",round(C1,-3),\" .\"\nprint \" The capital cost for 300 psia is : $\",round(C2,-3),\" .\"\nprint \"2. The annual steam cost for 150 psia is : $\",round(SC1,-3),\"/yr .\"\nprint \" The annual steam cost for 300 psia is : $\",round(SC2,-3),\"/yr .\"\nif (C1<C2 and SC1>SC2):\n print \"The 300-psia exchanger costs less to purchase and install, but it costs more to operate. Choosing the more expensive, 150-psia exchanger is the obvious choice.\"\nelif (C1>C2 and SC1<SC2):\n print \"The 150-psia exchanger costs less to purchase and install, but it costs more to operate. Choosing the more expensive, 300-psia exchanger is the obvious choice.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from math import log\n",
+ "\n",
+ "#Variable declaration:\n",
+ "m = 50000 #Mass flowrate of the organic fluid (lb/h)\n",
+ "cP = 0.6 #The heat capacity of the organic liquid (Btu/lb.\u00b0F)\n",
+ "T1 = 150 #Initial temperature of organic fluid (\u00b0F)\n",
+ "T2 = 330 #Final temperature of organic fluid (\u00b0F)\n",
+ "Ts1 = 358 #Saturation temperature for 150 psia (\u00b0F)\n",
+ "Ts2 = 417 #Saturation temperature for 300 psia (\u00b0F)\n",
+ "L1 = 863.6 #Latent heat for 150 psia (Btu/lb)\n",
+ "L2 = 809 #Latent heat for 300 psia (Btu/lb)\n",
+ "c1 = 5.20/1000 #Cost for 150 psia ($/lb)\n",
+ "c2 = 5.75/1000 #Cost for 300 psia ($/lb)\n",
+ "CI1 = 230 #Cost index in 1998 \n",
+ "CI2 = 360 #Cost index in 2011\n",
+ "IF = 3.29 #Installation factor\n",
+ "PF1 = 1.15 #Pressure factors for 100 to 200 psig\n",
+ "PF2 = 1.20 #Pressure factors for 200 to 300 psig\n",
+ "OP = 90/100 #Plant on-stream operation factor\n",
+ "h = 365*24 #Hours in a year (h)\n",
+ "\n",
+ "#Calculation:\n",
+ "Q = m*cP*(T2-T1) #Overall heta duty (Btu/h)\n",
+ "DT1 = Ts1-T1 #Temperature driving force 1 for 150 psia (\u00b0F)\n",
+ "DT2 = Ts1-T2 #Temperature driving force 2 for 150 psia (\u00b0F)\n",
+ "LMTD1 = (DT1-DT2)/log(DT1/DT2) #Log-mean temperature difference for 150 psia (\u00b0F)\n",
+ "DT3 = Ts2-T1 #Temperature driving force 1 for 300 psia (\u00b0F)\n",
+ "DT4 = Ts2-T2 #Temperature driving force 2 for 300 psia (\u00b0F)\n",
+ "LMTD2 = (DT3-DT4)/log(DT3/DT4) #Log-mean temperature difference for 1300 psia (\u00b0F)\n",
+ "A1 = Q/(138*LMTD1) #Required heat transfer area for 150 psia (ft^2)\n",
+ "A2 = Q/(138*LMTD2) #Required heat transfer area for 300 psia (ft^2)\n",
+ "BC1 = 117*A1**0.65 #Base cost for 150 psia ($)\n",
+ "BC2 = 117*A2**0.65 #Base cost for 13000 psia ($)\n",
+ "C1 = BC1*(CI2/CI1)*IF*PF1 #Capital cost for 150 psia ($)\n",
+ "C2 = BC2*(CI2/CI1)*IF*PF2 #Capital cost for 300 psia ($)\n",
+ "S1 = Q*(h*OP)/L1 #Steam requirement for 150 psia (lb/yr)\n",
+ "S2 = Q*(h*OP)/L2 #Steam requirement for 300 psia (lb/yr)\n",
+ "SC1 = S1*c1 #Annual steam cost for 150 psia ($/yr)\n",
+ "SC2 = S2*c2 #Annual steam cost for 300 psia ($/yr)\n",
+ "\n",
+ "#Result:\n",
+ "print \"1. The capital cost for 150 psia is : $\",round(C1,-3),\" .\"\n",
+ "print \" The capital cost for 300 psia is : $\",round(C2,-3),\" .\"\n",
+ "print \"2. The annual steam cost for 150 psia is : $\",round(SC1,-3),\"/yr .\"\n",
+ "print \" The annual steam cost for 300 psia is : $\",round(SC2,-3),\"/yr .\"\n",
+ "if (C1<C2 and SC1>SC2):\n",
+ " print \"The 300-psia exchanger costs less to purchase and install, but it costs more to operate. Choosing the more expensive, 150-psia exchanger is the obvious choice.\"\n",
+ "elif (C1>C2 and SC1<SC2):\n",
+ " print \"The 150-psia exchanger costs less to purchase and install, but it costs more to operate. Choosing the more expensive, 300-psia exchanger is the obvious choice.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1. The capital cost for 150 psia is : $ 36000.0 .\n The capital cost for 300 psia is : $ 26000.0 .\n2. The annual steam cost for 150 psia is : $ 256000.0 /yr .\n The annual steam cost for 300 psia is : $ 303000.0 /yr .\nThe 150-psia exchanger costs less to purchase and install, but it costs more to operate. Choosing the more expensive, 300-psia exchanger is the obvious choice.\n"
+ "text": [
+ "1. The capital cost for 150 psia is : $ 36000.0 .\n",
+ " The capital cost for 300 psia is : $ 26000.0 .\n",
+ "2. The annual steam cost for 150 psia is : $ 256000.0 /yr .\n",
+ " The annual steam cost for 300 psia is : $ 303000.0 /yr .\n",
+ "The 150-psia exchanger costs less to purchase and install, but it costs more to operate. Choosing the more expensive, 300-psia exchanger is the obvious choice.\n"
+ ]
}
],
"prompt_number": 9
@@ -101,19 +250,67 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 27.9, Page number: 581"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 27.9, Page number: 581"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Two small commercial power plant designs are under consideration. The first design involves a\ntraditional boiler (TB) and the second a fluidized fed (FB). For the TB system, the total capital\ncost (TCC_TB) is $2.5 million, the annual operating costs (AOC_TB) are $1.2 million, and the annual\nrevenue generated from the facility (R_TB) is $3.6 million. For the FB system, TCC_TB, AOC_TB and R_TB are\n$3.5, 1.4 and 5.3 million, respectively. Using straight-line depreciation and the discounted cash\nflow method, which unit is more attractive? Assume a 10-yr facility lifetime and a 2 yr construction\nperiod. Note that the solution involves the calculation of the rate of return for each of the two\nproposals.(11)\n'''\n\nfrom __future__ import division\nfrom sympy import symbols,solve\nfrom scipy.optimize import fsolve\n\n#Variable declaration:\nTCC_TB = 2500000 #Total capital cost ($)\nR_TB = 3600000 #R_TBevenue generated from the facility ($)\nAOC_TB = 1200000 #Annual operating costs ($)\nTCC_FB = 3500000 #Total capital cost ($)\nR_FB = 5300000 #R_TBevenue generated from the facility ($)\nAOC_FB = 1400000 #Annual operating costs ($)\nn = 10 \t#Time of facility (yr)\n\n#Calculation:\nD = 0.1*TCC_TB #Depriciation ($)\nWC = 0.1*TCC_TB #Working capital ($)\nTI = R_TB-AOC_TB-D #Taxable income ($)\nIT = 0.5*TI #Income tax to be paid ($)\nA = R_TB-AOC_TB-IT #After-tax cash flow ($)\ndef eqTB(i):\n\tx = (((1+i)**n-1)/(i*(1+i)**n))*A + (1/(1+i)**n)*WC #Equation for computing rate of return for TB unit\n\ty = WC + 0.5*TCC_TB + 0.5*TCC_TB*(1+i)**1 #Equation for computing rate of return for TB unit\n\treturn x-y\niTB = round(fsolve(eqTB,0.8)*100,1) #Rate of return for TB unit (%)\n\nD = 0.1*TCC_FB #Depriciation ($)\nWC = 0.1*TCC_FB #Working capital ($)\nTI = R_FB-AOC_FB-D #Taxable income ($)\nIT = 0.5*TI #Income tax to be paid ($)\nA = R_FB-AOC_FB-IT #After-tax cash flow ($)\n\ndef eqFB(i):\n\tx = (((1+i)**n-1)/(i*(1+i)**n))*A + (1/(1+i)**n)*WC #Equation for computing rate of return for FB unit\n\ty = WC + 0.5*TCC_FB + 0.5*TCC_FB*(1+i)**1 #Equation for computing rate of return for FB unit\n\treturn x-y\niFB = round(fsolve(eqFB,0.8)*100,1) #Rate of return for FB unit (%)\n\n#Results:\nprint \"The rate of return for TB unit is:\",round(iTB),\" %.\"\nprint \"The rate of return for FB unit is:\",round(iFB,1),\" %.\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from sympy import symbols,solve\n",
+ "from scipy.optimize import fsolve\n",
+ "\n",
+ "#Variable declaration:\n",
+ "TCC_TB = 2500000 #Total capital cost ($)\n",
+ "R_TB = 3600000 #R_TBevenue generated from the facility ($)\n",
+ "AOC_TB = 1200000 #Annual operating costs ($)\n",
+ "TCC_FB = 3500000 #Total capital cost ($)\n",
+ "R_FB = 5300000 #R_TBevenue generated from the facility ($)\n",
+ "AOC_FB = 1400000 #Annual operating costs ($)\n",
+ "n = 10 \t#Time of facility (yr)\n",
+ "\n",
+ "#Calculation:\n",
+ "D = 0.1*TCC_TB #Depriciation ($)\n",
+ "WC = 0.1*TCC_TB #Working capital ($)\n",
+ "TI = R_TB-AOC_TB-D #Taxable income ($)\n",
+ "IT = 0.5*TI #Income tax to be paid ($)\n",
+ "A = R_TB-AOC_TB-IT #After-tax cash flow ($)\n",
+ "def eqTB(i):\n",
+ "\tx = (((1+i)**n-1)/(i*(1+i)**n))*A + (1/(1+i)**n)*WC #Equation for computing rate of return for TB unit\n",
+ "\ty = WC + 0.5*TCC_TB + 0.5*TCC_TB*(1+i)**1 #Equation for computing rate of return for TB unit\n",
+ "\treturn x-y\n",
+ "iTB = round(fsolve(eqTB,0.8)*100,1) #Rate of return for TB unit (%)\n",
+ "\n",
+ "D = 0.1*TCC_FB #Depriciation ($)\n",
+ "WC = 0.1*TCC_FB #Working capital ($)\n",
+ "TI = R_FB-AOC_FB-D #Taxable income ($)\n",
+ "IT = 0.5*TI #Income tax to be paid ($)\n",
+ "A = R_FB-AOC_FB-IT #After-tax cash flow ($)\n",
+ "\n",
+ "def eqFB(i):\n",
+ "\tx = (((1+i)**n-1)/(i*(1+i)**n))*A + (1/(1+i)**n)*WC #Equation for computing rate of return for FB unit\n",
+ "\ty = WC + 0.5*TCC_FB + 0.5*TCC_FB*(1+i)**1 #Equation for computing rate of return for FB unit\n",
+ "\treturn x-y\n",
+ "iFB = round(fsolve(eqFB,0.8)*100,1) #Rate of return for FB unit (%)\n",
+ "\n",
+ "#Results:\n",
+ "print \"The rate of return for TB unit is:\",round(iTB),\" %.\"\n",
+ "print \"The rate of return for FB unit is:\",round(iFB,1),\" %.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The rate of return for TB unit is: 40.0 %.\nThe rate of return for FB unit is: 44.8 %.\n"
+ "text": [
+ "The rate of return for TB unit is: 40.0 %.\n",
+ "The rate of return for FB unit is: 44.8 %.\n"
+ ]
}
],
"prompt_number": 1
@@ -122,19 +319,98 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 27.10, Page number: 582"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 27.10, Page number: 582"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A stream of 100,000 acfm flue gas from a utility facility is to be cooled in an air preheater. You\nhave been requested to find the best unit to install to cool the flue gas and preheat the combustion\nair feed to the boiler. A reputable vendor has provided information on the cost of three units, as\nwell as installation, operating, and maintenance costs. Table 27.4 summarizes all the data you\nhave collected. Determine what preheater you would select in order to minimize costs on an\nannualized basis.\n'''\n\n#Variable declaration:\nf = 100000 #Flow rate of flue gas (acfm)\ni = 0.1 #Interest rate\n#From table 27.4:\n#For finned preheater:\nac1 = 3.1 #Equipment cost ($/acfm)\nac2 = 0.8 #Installation cost ($/acfm)\nac3 = 0.06 #Operating cost ($/acfm-yr)\nac4 = 14000 #Maintenance cost ($/yr)\nan = 20 #Lifetime (yr)\n#For 4-pass preheater:\nbc1 = 1.9 #Equipment cost ($/acfm)\nbc2 = 1.4 #Installation cost ($/acfm)\nbc3 = 0.06 #Operating cost for ($/acfm-yr)\nbc4 = 28000 #Maintenance cost ($/yr)\nbn = 15 #Lifetime of (yr)\n#For 2-pass preheater:\ncc1 = 2.5 #Equipment cost ($/acfm)\ncc2 = 1.0 #Installation cost ($/acfm)\ncc3 = 0.095 #Operating cost for ($/acfm-yr)\ncc4 = 9500 #Maintenance cost for ($/yr)\ncn = 20 #Lifetime of (yr)\n\n#Calculation:\n#For Finned preheater:\naEC = f*ac1 #Total equipment cost ($)\naIC = f*ac2 #Total installation cost ($)\naOC = f*ac3 #Total operating cost ($)\naMC = f*ac4 #Total maintenance cost ($)\naCRF = (i*(1+i)**an)/((1+i)**an-1) #Capital recovery factor\naAEC = aEC*aCRF #Equipment annual cost ($/yr)\naAIC = aIC*aCRF #Installation annual cost($/yr)\naAOC = ac3*f #Annual operating cost ($)\naAMC = ac4 #Annual maintenance cost ($)\naTAC = aAEC+aAIC+aAOC+aAMC #Total annual cost ($)\n\n#For 4-pass preheater:\nbEC = f*bc1 #Total equipment cost ($)\nbIC = f*bc2 #Total installation cost ($)\nbOC = f*bc3 #Total operating cost ($)\nbMC = f*bc4 #Total maintenance cost ($)\nbCRF = (i*(1+i)**bn)/((1+i)**bn-1) #Capital recovery factor\nbAEC = bEC*bCRF #Equipment annual cost ($/yr)\nbAIC = bIC*bCRF #Installation annual cost($/yr)\nbAOC = bc3*f #Annual operating cost ($)\nbAMC = bc4 #Annual maintenance cost ($)\nbTAC = bAEC+bAIC+bAOC+bAMC #Total annual cost ($)\n#For 2-pass preheater:\ncEC = f*cc1 #Total equipment cost ($)\ncIC = f*cc2 #Total installation cost ($)\ncOC = f*cc3 #Total operating cost ($)\ncMC = f*cc4 #Total maintenance cost ($)\ncCRF = (i*(1+i)**cn)/((1+i)**cn-1) #Capital recovery factor\ncAEC = cEC*cCRF #Equipment annual cost ($/yr)\ncAIC = cIC*cCRF #Installation annual cost($/yr)\ncAOC = cc3*f #Annual operating cost ($)\ncAMC = cc4 #Annual maintenance cost ($)\ncTAC = cAEC+cAIC+cAOC+cAMC #Total annual cost ($)\n\n#Result:\nprint \"Total annual cost for finned preheater is : $\",round(aTAC),\" .\"\nprint \"Total annual cost for 4-pass preheater is : $\",round(bTAC),\" .\"\nprint \"Total annual cost for 2-pass preheater is : $\",round(cTAC),\" .\"\nif (cTAC<aTAC and cTAC<bTAC):\n print \"According to the analysis, the 2-pass exchanger is the most economically attractive device since the annual cost is the lowest.\"\nelif (bTAC<aTAC and bTAC<cTAC):\n print \"According to the analysis, the 4-pass exchanger is the most economically attractive device since the annual cost is the lowest.\"\nelif (aTAC<cTAC and aTAC<bTAC):\n print \"According to the analysis, the finned exchanger is the most economically attractive device since the annual cost is the lowest.\"",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "f = 100000 #Flow rate of flue gas (acfm)\n",
+ "i = 0.1 #Interest rate\n",
+ "#From table 27.4:\n",
+ "#For finned preheater:\n",
+ "ac1 = 3.1 #Equipment cost ($/acfm)\n",
+ "ac2 = 0.8 #Installation cost ($/acfm)\n",
+ "ac3 = 0.06 #Operating cost ($/acfm-yr)\n",
+ "ac4 = 14000 #Maintenance cost ($/yr)\n",
+ "an = 20 #Lifetime (yr)\n",
+ "#For 4-pass preheater:\n",
+ "bc1 = 1.9 #Equipment cost ($/acfm)\n",
+ "bc2 = 1.4 #Installation cost ($/acfm)\n",
+ "bc3 = 0.06 #Operating cost for ($/acfm-yr)\n",
+ "bc4 = 28000 #Maintenance cost ($/yr)\n",
+ "bn = 15 #Lifetime of (yr)\n",
+ "#For 2-pass preheater:\n",
+ "cc1 = 2.5 #Equipment cost ($/acfm)\n",
+ "cc2 = 1.0 #Installation cost ($/acfm)\n",
+ "cc3 = 0.095 #Operating cost for ($/acfm-yr)\n",
+ "cc4 = 9500 #Maintenance cost for ($/yr)\n",
+ "cn = 20 #Lifetime of (yr)\n",
+ "\n",
+ "#Calculation:\n",
+ "#For Finned preheater:\n",
+ "aEC = f*ac1 #Total equipment cost ($)\n",
+ "aIC = f*ac2 #Total installation cost ($)\n",
+ "aOC = f*ac3 #Total operating cost ($)\n",
+ "aMC = f*ac4 #Total maintenance cost ($)\n",
+ "aCRF = (i*(1+i)**an)/((1+i)**an-1) #Capital recovery factor\n",
+ "aAEC = aEC*aCRF #Equipment annual cost ($/yr)\n",
+ "aAIC = aIC*aCRF #Installation annual cost($/yr)\n",
+ "aAOC = ac3*f #Annual operating cost ($)\n",
+ "aAMC = ac4 #Annual maintenance cost ($)\n",
+ "aTAC = aAEC+aAIC+aAOC+aAMC #Total annual cost ($)\n",
+ "\n",
+ "#For 4-pass preheater:\n",
+ "bEC = f*bc1 #Total equipment cost ($)\n",
+ "bIC = f*bc2 #Total installation cost ($)\n",
+ "bOC = f*bc3 #Total operating cost ($)\n",
+ "bMC = f*bc4 #Total maintenance cost ($)\n",
+ "bCRF = (i*(1+i)**bn)/((1+i)**bn-1) #Capital recovery factor\n",
+ "bAEC = bEC*bCRF #Equipment annual cost ($/yr)\n",
+ "bAIC = bIC*bCRF #Installation annual cost($/yr)\n",
+ "bAOC = bc3*f #Annual operating cost ($)\n",
+ "bAMC = bc4 #Annual maintenance cost ($)\n",
+ "bTAC = bAEC+bAIC+bAOC+bAMC #Total annual cost ($)\n",
+ "#For 2-pass preheater:\n",
+ "cEC = f*cc1 #Total equipment cost ($)\n",
+ "cIC = f*cc2 #Total installation cost ($)\n",
+ "cOC = f*cc3 #Total operating cost ($)\n",
+ "cMC = f*cc4 #Total maintenance cost ($)\n",
+ "cCRF = (i*(1+i)**cn)/((1+i)**cn-1) #Capital recovery factor\n",
+ "cAEC = cEC*cCRF #Equipment annual cost ($/yr)\n",
+ "cAIC = cIC*cCRF #Installation annual cost($/yr)\n",
+ "cAOC = cc3*f #Annual operating cost ($)\n",
+ "cAMC = cc4 #Annual maintenance cost ($)\n",
+ "cTAC = cAEC+cAIC+cAOC+cAMC #Total annual cost ($)\n",
+ "\n",
+ "#Result:\n",
+ "print \"Total annual cost for finned preheater is : $\",round(aTAC),\" .\"\n",
+ "print \"Total annual cost for 4-pass preheater is : $\",round(bTAC),\" .\"\n",
+ "print \"Total annual cost for 2-pass preheater is : $\",round(cTAC),\" .\"\n",
+ "if (cTAC<aTAC and cTAC<bTAC):\n",
+ " print \"According to the analysis, the 2-pass exchanger is the most economically attractive device since the annual cost is the lowest.\"\n",
+ "elif (bTAC<aTAC and bTAC<cTAC):\n",
+ " print \"According to the analysis, the 4-pass exchanger is the most economically attractive device since the annual cost is the lowest.\"\n",
+ "elif (aTAC<cTAC and aTAC<bTAC):\n",
+ " print \"According to the analysis, the finned exchanger is the most economically attractive device since the annual cost is the lowest.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Total annual cost for finned preheater is : $ 65809.0 .\nTotal annual cost for 4-pass preheater is : $ 77386.0 .\nTotal annual cost for 2-pass preheater is : $ 60111.0 .\nAccording to the analysis, the 2-pass exchanger is the most economically attractive device since the annual cost is the lowest.\n"
+ "text": [
+ "Total annual cost for finned preheater is : $ 65809.0 .\n",
+ "Total annual cost for 4-pass preheater is : $ 77386.0 .\n",
+ "Total annual cost for 2-pass preheater is : $ 60111.0 .\n",
+ "According to the analysis, the 2-pass exchanger is the most economically attractive device since the annual cost is the lowest.\n"
+ ]
}
],
"prompt_number": 11
@@ -143,19 +419,58 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 27.12, Page number: 584"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 27.12, Page number: 584"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Shannon O\u2019Brien, a recent graduate from Manhattan College\u2019s prestigious chemical engineering\nprogramwas given an assignment to design the most cost-effective heat exchanger to recover\nenergy from a hot flue gas at 500\u00b0F. The design is to be based on pre-heating 1008F incoming air\n(to be employed in the boiler) to a temperature that will result in the maximum annual profit to\nthe utility. A line diagram of the proposed countercurrent exchanger is provided in Figure 27.2.\nHaving just completed a heat transfer course with Dr. Flynn and a thermodynamics course\nwith the infamous Dr. Theodore, Shannon realizes that their are two costs that need to be\nconsidered:\n1. the heat exchanger employed for energy recovery, and\n2. the \u201cquality\u201d (from an entropy perspective) of the recovered energy\u2014refer to Chapter\n20 for additional details.\nShe also notes that the higher the discharge temperature of the heated air, t, the smaller will be\nthe temperature difference driving force, and the higher the area requirement of the exchanger\nand the higher the equipment cost. Alternatively, with a higher t, the \u201cquality\u201d of the recovered\nenergy is higher, thus leading to an increase in recovered profits (by reducing fuel costs).\nBased on similar system designs, Ricci Consultants (RC) has provided the following annual\neconomic models:\nRecovered energy profit: A(t - tc); A = $/yr.\u00b0F\nExchange cost: B/(TH - t); B = $.\u00b0F/yr\nFor the above system, RC suggests a value for the coefficients in the cost model be set at:\nA = 10\nB = 100,000\nEmploying the above information, Shannon has been asked to calculate a t that will\n1. provide breakeven operation\n2. maximize profits\nShe is also required to perform the calculation if A = 10, B = 4000, and A = 10, B = 400,000.\nFinally, an analysis of the results is requested.\n'''\nfrom __future__ import division\nfrom numpy import roots\nfrom math import sqrt\n\n#Variable declaration:\nTH = 500 #Hot stream temperature at exchanger 1 (\u00b0F)\ntc = 100 #Cold stream temperature at exchanger 2 (\u00b0F)\nA = 10 #Constant A\nB1 = 100000 #Constant B1\nB2 = 4000 #Constant B2\nB3 = 400000 #Constant B3\n\n#Calculations:\n#It forms equation fo form t^2 - t(Th-tc) +tcTH +B/A\nt1 = roots([1, -(TH+tc),(tc*TH + B1/A) ]); #Roots\ntmax1 = TH - sqrt(B1/A) #Upon maximising profit\nt2 = roots([1, -(TH+tc),(tc*TH + B2/A) ]); #Roots\ntmax2 = TH - sqrt(B2/A) #Upon maximising profit\nt3 = roots([1, -(TH+tc),(tc*TH + B3/A) ]); #Roots\ntmax3 = TH - sqrt(B3/A) #Upon maximising profit\n\n#Results:\nprint 'tBE for case 1: ',round(t1[0]),'\u00b0F',round(t1[1]),'\u00b0F'\nprint 'tmax1:', round(tmax1),'\u00b0F'\nprint 'tBE for case 2: ',round(t2[0]),'\u00b0F',round(t2[1]),'\u00b0F'\nprint 'tmax1:', round(tmax2),'\u00b0F'\nprint 'tBE for case 1: ',round(t3[0]),'\u00b0F',round(t3[1]),'\u00b0F'\nprint 'tmax1:', round(tmax3),'\u00b0F'",
+ "input": [
+ "\n",
+ "from __future__ import division\n",
+ "from numpy import roots\n",
+ "from math import sqrt\n",
+ "\n",
+ "#Variable declaration:\n",
+ "TH = 500 #Hot stream temperature at exchanger 1 (\u00b0F)\n",
+ "tc = 100 #Cold stream temperature at exchanger 2 (\u00b0F)\n",
+ "A = 10 #Constant A\n",
+ "B1 = 100000 #Constant B1\n",
+ "B2 = 4000 #Constant B2\n",
+ "B3 = 400000 #Constant B3\n",
+ "\n",
+ "#Calculations:\n",
+ "#It forms equation fo form t^2 - t(Th-tc) +tcTH +B/A\n",
+ "t1 = roots([1, -(TH+tc),(tc*TH + B1/A) ]); #Roots\n",
+ "tmax1 = TH - sqrt(B1/A) #Upon maximising profit\n",
+ "t2 = roots([1, -(TH+tc),(tc*TH + B2/A) ]); #Roots\n",
+ "tmax2 = TH - sqrt(B2/A) #Upon maximising profit\n",
+ "t3 = roots([1, -(TH+tc),(tc*TH + B3/A) ]); #Roots\n",
+ "tmax3 = TH - sqrt(B3/A) #Upon maximising profit\n",
+ "\n",
+ "#Results:\n",
+ "print 'tBE for case 1: ',round(t1[0]),'\u00b0F',round(t1[1]),'\u00b0F'\n",
+ "print 'tmax1:', round(tmax1),'\u00b0F'\n",
+ "print 'tBE for case 2: ',round(t2[0]),'\u00b0F',round(t2[1]),'\u00b0F'\n",
+ "print 'tmax1:', round(tmax2),'\u00b0F'\n",
+ "print 'tBE for case 1: ',round(t3[0]),'\u00b0F',round(t3[1]),'\u00b0F'\n",
+ "print 'tmax1:', round(tmax3),'\u00b0F'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "tBE for case 1: 473.0 \u00b0F 127.0 \u00b0F\ntmax1: 400.0 \u00b0F\ntBE for case 2: 499.0 \u00b0F 101.0 \u00b0F\ntmax1: 480.0 \u00b0F\ntBE for case 1: 300.0 \u00b0F 300.0 \u00b0F\ntmax1: 300.0 \u00b0F\n"
+ "text": [
+ "tBE for case 1: 473.0 \u00b0F 127.0 \u00b0F\n",
+ "tmax1: 400.0 \u00b0F\n",
+ "tBE for case 2: 499.0 \u00b0F 101.0 \u00b0F\n",
+ "tmax1: 480.0 \u00b0F\n",
+ "tBE for case 1: 300.0 \u00b0F 300.0 \u00b0F\n",
+ "tmax1: 300.0 \u00b0F\n"
+ ]
}
],
"prompt_number": 14
@@ -164,19 +479,60 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 27.15, Page number: 588"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 27.15, Page number: 588"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''Refer to the two previous examples. Calculate values of qA and qB that will maximize the profit\nfrom this process. Also calculate the annual (365 day basis) profit based on this condition.\n'''\n\nfrom __future__ import division\nfrom scipy.optimize import fmin_cobyla as optimize\n\n#Key:\n#f(x) : Objective Function\n#ci(x)'s : Constraints\n\n#Variable Declaration:\ndef f(x):\t\n return -1.70*x[0] - 2*x[1]\n\ndef c1(x):\n return 8000 - x[0]\n\ndef c2(x):\n return 6000 - x[1]\n\ndef c3(x):\n return 12000 - 0.75*x[0] - 0.40*x[1]\n\ndef c4(x):\n return 6000 - 0.60*x[0] - 0.25*x[1]\n\ndef c5(x):\n return x[0]\n\ndef c6(x):\n return x[1]\n\n#Calculation\nX = optimize(f,[7000,6000],[c1,c2,c3,c4,c5,c6], disp = 0)\n\n#Result:\nprint \"Maximum Profit is $\",-f(X), \"/day or $\", -365*f(X), \"/year\"",
+ "input": [
+ "\n",
+ "\n",
+ "from __future__ import division\n",
+ "from scipy.optimize import fmin_cobyla as optimize\n",
+ "\n",
+ "#Key:\n",
+ "#f(x) : Objective Function\n",
+ "#ci(x)'s : Constraints\n",
+ "\n",
+ "#Variable Declaration:\n",
+ "def f(x):\t\n",
+ " return -1.70*x[0] - 2*x[1]\n",
+ "\n",
+ "def c1(x):\n",
+ " return 8000 - x[0]\n",
+ "\n",
+ "def c2(x):\n",
+ " return 6000 - x[1]\n",
+ "\n",
+ "def c3(x):\n",
+ " return 12000 - 0.75*x[0] - 0.40*x[1]\n",
+ "\n",
+ "def c4(x):\n",
+ " return 6000 - 0.60*x[0] - 0.25*x[1]\n",
+ "\n",
+ "def c5(x):\n",
+ " return x[0]\n",
+ "\n",
+ "def c6(x):\n",
+ " return x[1]\n",
+ "\n",
+ "#Calculation\n",
+ "X = optimize(f,[7000,6000],[c1,c2,c3,c4,c5,c6], disp = 0)\n",
+ "\n",
+ "#Result:\n",
+ "print \"Maximum Profit is $\",-f(X), \"/day or $\", -365*f(X), \"/year\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Maximum Profit is $ 24750.0 /day or $ 9033750.0 /year\n"
+ "text": [
+ "Maximum Profit is $ 24750.0 /day or $ 9033750.0 /year\n"
+ ]
}
],
"prompt_number": 4
diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_28.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_28.ipynb
index ada59276..ef8b65ac 100644
--- a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_28.ipynb
+++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/Chapter_28.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 28"
+ "name": "",
+ "signature": "sha256:b9472c6f66e6af9fe688bfa1efb446d7b7edd950704f6c5633d9a86768f75a3d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,94 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 28: Open-Ended Problems"
+ "source": [
+ "Chapter 28: Open-Ended Problems"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "ILLUSTRATIVE EXAMPLE 28.11, Page number: 600"
+ "source": [
+ "ILLUSTRATIVE EXAMPLE 28.11, Page number: 600"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "'''A plant has three streams to be heated (see Table 28.3) and three streams to be cooled (see\nTable 28.4). Cooling water (90\u00b0F supply, 155\u00b0F return) and steam (saturated at 250 psia) are\navailable. Note that the saturated steam at 250 psia has a temperature of 401\u00b0F. Calculate the\nheating and cooling duties and indicate what utility (or utilities) should be employed.\n'''\n\n#Variable declaration:\n#From table 28.3:\n#For stream 1 to be heated:\nhm1 = 50000 #Mass flowrate (lb/h)\nhcP1 = 0.65 #Heat capacity (Btu/lb.\u00b0F)\nhTi1 = 70 #Inlet temperature (\u00b0F)\nhTo1 = 300 #Outlet temperature (\u00b0F)\n#For stream 2 to be heated:\nhm2 = 60000 #Mass flowrate (lb/h)\nhcP2 = 0.58 #Heat capacity (Btu/lb.\u00b0F)\nhTi2 = 120 #Inlet temperature (\u00b0F)\nhTo2 = 310 #Outlet temperature (\u00b0F)\n#For stream 3 to be heated:\nhm3 = 80000 #Mass flowrate (lb/h)\nhcP3 = 0.78 #Heat capacity (Btu/lb.\u00b0F)\nhTi3 = 90 #Inlet temperature (\u00b0F)\nhTo3 = 250 #Outlet temperature (\u00b0F)\n#From table 28.4:\n#For stream 1 to be cooled:\ncm1 = 60000 #Mass flowrate (lb/h)\nccP1 = 0.70 #Heat capacity (Btu/lb.\u00b0F)\ncTi1 = 420 #Inlet temperature (\u00b0F)\ncTo1 = 120 #Outlet temperature (\u00b0F)\n#For stream 2 to be cooled:\ncm2 = 40000 #Mass flowrate (lb/h)\nccP2 = 0.52 #Heat capacity (Btu/lb.\u00b0F)\ncTi2 = 300 #Inlet temperature (\u00b0F)\ncTo2 = 100 #Outlet temperature (\u00b0F)\n#For stream 3 to be cooled:\ncm3 = 35000 #Mass flowrate (lb/h)\nccP3 = 0.60 #Heat capacity (Btu/lb.\u00b0F)\ncTi3 = 240 #Inlet temperature (\u00b0F)\ncTo3 = 90 #Outlet temperature (\u00b0F)\n\n#Calculation:\nH1 = hm1*hcP1*(hTo1-hTi1) #Heating duty for stream 1 (Btu/h)\nH2 = hm2*hcP2*(hTo2-hTi2) #Heating duty for stream 2 (Btu/h)\nH3 = hm3*hcP3*(hTo3-hTi3) #Heating duty for stream 1 (Btu/h)\nH = H1+H2+H3 #Total heating duty (Btu/h)\nC1 = cm1*ccP1*(cTi1-cTo1) #Cooling duty for stream 1 (Btu/h)\nC2 = cm2*ccP2*(cTi2-cTo2) #Cooling duty for stream 2 (Btu/h)\nC3 = cm3*ccP3*(cTi3-cTo3) #Cooling duty for stream 1 (Btu/h)\nC = C1+C2+C3 #Total Cooling duty (Btu/h)\n\n#Result:\nprint \"Table: Duty Requirements.\"\nprint \"Stream Duty, Btu/h\"\nprint \"1 \",round(H1)\nprint \"2 \",round(H2)\nprint \"3 \",round(H3)\nprint \"4 \",round(C1)\nprint \"5 \",round(C2)\nprint \"6 \",round(C3)",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#From table 28.3:\n",
+ "#For stream 1 to be heated:\n",
+ "hm1 = 50000 #Mass flowrate (lb/h)\n",
+ "hcP1 = 0.65 #Heat capacity (Btu/lb.\u00b0F)\n",
+ "hTi1 = 70 #Inlet temperature (\u00b0F)\n",
+ "hTo1 = 300 #Outlet temperature (\u00b0F)\n",
+ "#For stream 2 to be heated:\n",
+ "hm2 = 60000 #Mass flowrate (lb/h)\n",
+ "hcP2 = 0.58 #Heat capacity (Btu/lb.\u00b0F)\n",
+ "hTi2 = 120 #Inlet temperature (\u00b0F)\n",
+ "hTo2 = 310 #Outlet temperature (\u00b0F)\n",
+ "#For stream 3 to be heated:\n",
+ "hm3 = 80000 #Mass flowrate (lb/h)\n",
+ "hcP3 = 0.78 #Heat capacity (Btu/lb.\u00b0F)\n",
+ "hTi3 = 90 #Inlet temperature (\u00b0F)\n",
+ "hTo3 = 250 #Outlet temperature (\u00b0F)\n",
+ "#From table 28.4:\n",
+ "#For stream 1 to be cooled:\n",
+ "cm1 = 60000 #Mass flowrate (lb/h)\n",
+ "ccP1 = 0.70 #Heat capacity (Btu/lb.\u00b0F)\n",
+ "cTi1 = 420 #Inlet temperature (\u00b0F)\n",
+ "cTo1 = 120 #Outlet temperature (\u00b0F)\n",
+ "#For stream 2 to be cooled:\n",
+ "cm2 = 40000 #Mass flowrate (lb/h)\n",
+ "ccP2 = 0.52 #Heat capacity (Btu/lb.\u00b0F)\n",
+ "cTi2 = 300 #Inlet temperature (\u00b0F)\n",
+ "cTo2 = 100 #Outlet temperature (\u00b0F)\n",
+ "#For stream 3 to be cooled:\n",
+ "cm3 = 35000 #Mass flowrate (lb/h)\n",
+ "ccP3 = 0.60 #Heat capacity (Btu/lb.\u00b0F)\n",
+ "cTi3 = 240 #Inlet temperature (\u00b0F)\n",
+ "cTo3 = 90 #Outlet temperature (\u00b0F)\n",
+ "\n",
+ "#Calculation:\n",
+ "H1 = hm1*hcP1*(hTo1-hTi1) #Heating duty for stream 1 (Btu/h)\n",
+ "H2 = hm2*hcP2*(hTo2-hTi2) #Heating duty for stream 2 (Btu/h)\n",
+ "H3 = hm3*hcP3*(hTo3-hTi3) #Heating duty for stream 1 (Btu/h)\n",
+ "H = H1+H2+H3 #Total heating duty (Btu/h)\n",
+ "C1 = cm1*ccP1*(cTi1-cTo1) #Cooling duty for stream 1 (Btu/h)\n",
+ "C2 = cm2*ccP2*(cTi2-cTo2) #Cooling duty for stream 2 (Btu/h)\n",
+ "C3 = cm3*ccP3*(cTi3-cTo3) #Cooling duty for stream 1 (Btu/h)\n",
+ "C = C1+C2+C3 #Total Cooling duty (Btu/h)\n",
+ "\n",
+ "#Result:\n",
+ "print \"Table: Duty Requirements.\"\n",
+ "print \"Stream Duty, Btu/h\"\n",
+ "print \"1 \",round(H1)\n",
+ "print \"2 \",round(H2)\n",
+ "print \"3 \",round(H3)\n",
+ "print \"4 \",round(C1)\n",
+ "print \"5 \",round(C2)\n",
+ "print \"6 \",round(C3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Table: Duty Requirements.\nStream Duty, Btu/h\n1 7475000.0\n2 6612000.0\n3 9984000.0\n4 12600000.0\n5 4160000.0\n6 3150000.0\n"
+ "text": [
+ "Table: Duty Requirements.\n",
+ "Stream Duty, Btu/h\n",
+ "1 7475000.0\n",
+ "2 6612000.0\n",
+ "3 9984000.0\n",
+ "4 12600000.0\n",
+ "5 4160000.0\n",
+ "6 3150000.0\n"
+ ]
}
],
"prompt_number": 11
diff --git a/Hydraulics/Chapter_1.ipynb b/Hydraulics/Chapter_1.ipynb
index 558e6301..afe45972 100644
--- a/Hydraulics/Chapter_1.ipynb
+++ b/Hydraulics/Chapter_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:64f6f7af2b4765d579e2e197e51bf5b0d4a46d9e2613b339c736b1f3c01726e3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find pressure of water\n",
"\n",
"#initialisation of variables\n",
"h1 = 2 \t\t\t#in\n",
@@ -68,11 +68,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "pressure difference in ft of water\n",
- "reading of mercury\n",
- "'''\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"a = 6 \t\t\t#ft\n",
@@ -115,7 +111,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# FIND THE INTENSITY OF PRESSURE IN TERMS OF FT OF WATER AT POINTS A,B,C and D\n",
"\n",
"#initialisation of variables\n",
"sm = 13.6\n",
@@ -165,7 +160,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Reading of the pressure guage at the top of tank\n",
"\n",
"#initialisation of variables\n",
"lm = 2 \t\t\t#ft\n",
@@ -209,7 +203,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the pressure in lb/sq. in\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"h = 42 \t\t\t#in\n",
@@ -244,7 +238,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the pressure exerted by a vertical column\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"h = 200 \t\t\t#ft\n",
@@ -279,7 +273,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Total pressure\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"w = 62.4 \t\t\t#lbs/ft**3\n",
@@ -316,7 +310,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Total pressure\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -360,7 +354,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find total pressure\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"l = 2. \t\t\t#ft\n",
@@ -399,12 +393,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Total pressure\n",
- "Depth\n",
- "pressure in ft\n",
- "'''\n",
+ "\n",
"#initialisation of variables\n",
"l = 6. \t\t\t#ft\n",
"b = 4. \t\t\t#ft\n",
@@ -449,11 +438,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "force exerted by the oil \n",
- "position of centre of pressure\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -502,7 +487,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find level of water\n",
"\n",
"#initialisation of variables\n",
"import math \n",
@@ -546,7 +530,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Total comression in the promp CD\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -591,11 +575,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "depth of centre of pressure\n",
- "force F required to act horizontally at the top of gate\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -654,7 +634,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find magnitude and position of the resultant water pressure.\n",
+ "\n",
"import math \n",
"\n",
"#initialisation of variables\n",
@@ -710,12 +690,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "a) the resultant thrust on the base per ft length of dam\n",
- "b) distribution of normal stress on base,\n",
- "c) normal stress on the vertical plane at the base\n",
- "'''\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"import math \n",
@@ -774,7 +749,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Volume of concrete\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"W = 145. \t\t\t#lb/cu ft\n",
@@ -813,7 +788,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Depth necessary to just float the ship in river\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"W = 10000. \t\t\t#tons\n",
diff --git a/Hydraulics/Chapter_2.ipynb b/Hydraulics/Chapter_2.ipynb
index 66db0d7d..8353a544 100644
--- a/Hydraulics/Chapter_2.ipynb
+++ b/Hydraulics/Chapter_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:e77c0ecf71b6b19d4b74c1b5653eedac5bf7ec259a0d03cbae3bef3229b3cdac"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the discharge in gal per min and also average velocities at the two sections\n",
"\n",
"#initialisation of variables\n",
"\n",
@@ -76,7 +76,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the pressure\n",
"\n",
"#initialisation of variables\n",
"import math \n",
@@ -122,7 +121,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the discharge in gpm.\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"import math \n",
@@ -169,7 +168,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the water pressure\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"\n",
@@ -216,7 +215,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate the flow of water in gallons per hour.\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"\n",
@@ -264,7 +263,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find rate of flow\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"import math \n",
@@ -310,7 +309,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the speed of the submarine\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"\n",
@@ -349,7 +348,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the volume of air flowing \n",
+ "\n",
"\n",
"#initialisation of variables\n",
"\n",
diff --git a/Hydraulics/Chapter_3.ipynb b/Hydraulics/Chapter_3.ipynb
index 52d98bab..6b36939a 100644
--- a/Hydraulics/Chapter_3.ipynb
+++ b/Hydraulics/Chapter_3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:97f449fad397b42ecb1501f787392dc6e0950fafed8997a70fb14e2a9c19a198"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the hydraulic co-efficients.\n",
"\n",
"\n",
"#initialisation of variables\n",
@@ -81,7 +81,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine coefficients of velocity and contraction and discharge of the jet.\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -137,12 +137,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "a) Head lost due to shock\n",
- "b) pressure in the larger part of pipe\n",
- "c) work done in forcing the water through the enlargement.\n",
- "'''\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"\n",
@@ -192,12 +187,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "a) discharge in cusecs\n",
- "b) co-efficient of discharge\n",
- "c) absolute pressure \n",
- "'''\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"\n",
@@ -245,9 +235,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#find discharge per second\n",
"\n",
- "#initialisation of variables\n",
"\n",
"import math \n",
"H = 4. \t\t\t#ft\n",
@@ -284,7 +272,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the rate of discharge in gpm\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -333,7 +321,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find time required to lower the water level\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -380,7 +368,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the time required to empty.\n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"D = 10. \t\t\t#ft\n",
@@ -421,7 +409,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find minutes will the mouthpiece empty the boiler\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -461,7 +449,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the time of emptying the bath when co-efficient \n",
"\n",
"import math \n",
"\n",
@@ -504,7 +491,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find time required to reduce the difference of water levels\n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"H1 = 9. \t\t\t#ft\n",
@@ -544,7 +531,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determine the size of a square orifice placed below the tail water level.\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"import math \n",
@@ -584,7 +571,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find How much water will escape through the orifice d\n",
+ "\n",
"\n",
"#initialisation of variables\n",
"import math \n",
@@ -631,7 +618,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the discharge in cu\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -672,7 +659,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find appropriate discharge in cu ft/sec.\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
diff --git a/Hydraulics/Chapter_4.ipynb b/Hydraulics/Chapter_4.ipynb
index 9cf88603..60ede3c8 100644
--- a/Hydraulics/Chapter_4.ipynb
+++ b/Hydraulics/Chapter_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:7c51eb85c2f5974253c21c1966c99eb7233e433431ba178d1ba6aaccb3adc83a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the length of the weir\n",
+ "\n",
"import math\n",
"#initialisation of variables\n",
"p = 70. \t\t\t#per cent\n",
@@ -67,7 +68,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the theoretical horse power\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -111,7 +112,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the discharge per second\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -166,7 +166,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find K and n\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -208,9 +207,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the rate of discharge\n",
- "'''\n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"g = 32.2 \t\t\t#ft/sec**2\n",
@@ -260,7 +257,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the length of the waste weir required.\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -301,7 +298,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the discharge of water \n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -344,7 +340,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the percentage error in estimating the discharge\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -384,7 +380,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find time required to lower the level of a reservoir of superficial area\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -424,7 +420,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find depth of water through this notch.\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -464,7 +459,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find in each case the percentage error \n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"V = 20. \t\t\t#litres\n",
@@ -511,7 +506,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimate the discharge in the channel in gallons per minute\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -555,7 +550,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the discharge \n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -599,7 +594,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find discharge over this weir in gallons per hour\n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"L = 6 \t\t\t#ft\n",
@@ -641,7 +636,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the height of an anicut \n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"W = 100 \t\t\t#ft\n",
@@ -685,7 +680,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find length\n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"x = 6. \t\t\t#in\n",
@@ -724,7 +719,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the number of siphons required\n",
"\n",
"import math \n",
"#initialisation of variables\n",
diff --git a/Hydraulics/Chapter_5.ipynb b/Hydraulics/Chapter_5.ipynb
index 7fdc90dc..a400585d 100644
--- a/Hydraulics/Chapter_5.ipynb
+++ b/Hydraulics/Chapter_5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:fe74dcaff3035e39890b266fafcf015d3afee121cbb7baf09e89820b75888c5a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "a) a channel having bottom width\n",
- "b) channel whose section is an arc of a circle\n",
- "'''\n",
+ "\n",
"import math\n",
"import numpy \n",
"#initialisation of variables\n",
@@ -75,7 +72,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the head lost\n",
"\n",
"import math \n",
"\n",
@@ -120,7 +116,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the pressure difference between two points\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -169,7 +165,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the discharge\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -209,7 +204,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the size of the supply main \n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -253,7 +248,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the critical velocities \n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -303,7 +298,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find pressure \n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"p = 0.91 \t\t\t#units\n",
@@ -351,7 +346,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the value of n\n",
+ "\n",
"from math import log10\n",
"#initialisation of variables\n",
"h = 1.5 # H\n",
@@ -391,7 +386,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the pressure \n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -445,7 +439,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find rate of flow \n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"d = 8. \t\t\t#in\n",
@@ -492,7 +486,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find discharge when the syphone is running full\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -538,7 +531,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the necessary height of water surface\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -583,7 +576,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#find the diameter of uniform pipe \n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -623,7 +615,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the diameter of the parallel mains\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -659,7 +651,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the increase in discharge\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -704,11 +696,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the velocity of flow in each pipe\n",
- "'''\n",
- "\n",
- "import math\n",
+ " import math\n",
"\n",
"# Variables\n",
"d1 = 2 # ft\n",
@@ -771,7 +759,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the time taken to lower the level of water\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -812,7 +800,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the time required to empty the overhead\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -866,7 +853,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the time taken \n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -909,7 +896,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find diameter of the pipe and efficiency of transmission.\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -955,7 +942,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the horse-powers of the jet.\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -1000,7 +987,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find volume of flow \n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -1043,7 +1030,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find maximum power transmitted by the jet\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -1087,7 +1074,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find height\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -1128,7 +1115,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find rise of pressure in the pipe\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -1170,7 +1156,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find economical diameter of pipe line\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
diff --git a/Hydraulics/Chapter_6.ipynb b/Hydraulics/Chapter_6.ipynb
index b60e19b9..2ab32b0e 100644
--- a/Hydraulics/Chapter_6.ipynb
+++ b/Hydraulics/Chapter_6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:a578101ccbcde1509a97d02129920a3db28366bac3115a1e48214601165df384"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the value of C and K\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -69,7 +70,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find value of C \n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -115,7 +115,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the discharge\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -160,7 +160,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the discharge of a channel\n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"d = 3. \t\t\t#ft\n",
@@ -200,7 +200,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find diameter\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -245,7 +245,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find depth of water\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -297,7 +297,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find height of dam\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -342,7 +342,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find depth, bottom width and top width\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -389,7 +389,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find depth, bottom width, and top width\n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"Q = 1100. \t\t\t#cuses\n",
@@ -432,7 +432,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find depth of channel\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -473,7 +473,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find discharge\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -514,7 +514,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find specific energy\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -561,7 +561,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find slope of free water\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -606,7 +605,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find height required\n",
"\n",
"import math \n",
"#Initialization of variables\n",
@@ -654,7 +652,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find loss in energy\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -699,7 +696,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find downstream depth \n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"d1 = 4. \t\t\t#ft\n",
@@ -735,7 +732,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find approximate length\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -785,7 +782,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find discharge through the venturi flume \n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -826,7 +823,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find discharge and depth of flow at the throat\n",
+ "\n",
"\n",
"import math \n",
"#initialisation of variables\n",
@@ -870,13 +867,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "a) discharge\n",
- "b) depth of water\n",
- "c) height of standing wave\n",
- "d) depth of water in channel\n",
- "'''\n",
+ "\n",
"import math \n",
"#initialisation of variables\n",
"h1 = 8. \t\t\t#ft\n",
diff --git a/Industrial_Instrumentation/Chapter_1.ipynb b/Industrial_Instrumentation/Chapter_1.ipynb
index ee337d56..d0854801 100644
--- a/Industrial_Instrumentation/Chapter_1.ipynb
+++ b/Industrial_Instrumentation/Chapter_1.ipynb
@@ -1,412 +1,433 @@
{
"metadata": {
- "name": "Chapter_1"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:6ba3160044fd56988f5c5098ab622aa22c3eae2ec5a701c2274f1da18b060ff5"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 1: Temperature<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.1, Page Number: 53<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Temperature Conversion'''",
- "",
- "#variable declaration",
- "c=-40.0 #Temp in degree Celcius",
- "",
- "#calculations",
- "k=c+273",
- "F=((9.0/5.0)*c)+32.0",
- "R=((9.0/5.0)*c)+492.0",
- "",
- "#Result",
- "print('\\nK=%d\u00b0K' %k)",
- "print('\\nF=%d\u00b0F' %F)",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "c=-40.0 #Temp in degree Celcius\n",
+ "\n",
+ "#calculations\n",
+ "k=c+273\n",
+ "F=((9.0/5.0)*c)+32.0\n",
+ "R=((9.0/5.0)*c)+492.0\n",
+ "\n",
+ "#Result\n",
+ "print('\\nK=%d\u00b0K' %k)\n",
+ "print('\\nF=%d\u00b0F' %F)\n",
"print('\\nR=%d\u00b0R' %R)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "",
- "K=233\u00b0K",
- "",
- "F=-40\u00b0F",
- "",
+ "\n",
+ "K=233\u00b0K\n",
+ "\n",
+ "F=-40\u00b0F\n",
+ "\n",
"R=420\u00b0R"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3> Example 1.2, Page Number: 53<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''percentage Accuracy and Error'''",
- "",
- "#varable Declaration",
- "span=1000.0 #given value of span in \u00b0C",
- "accuracy=1.0/100.0 #1% accuracy",
- "",
- "#calculations",
- "err=span*accuracy",
- "max_scale=1200.0",
- "Range_instr=max_scale+span",
- "meter_reading=700.0",
- "per_of_err=(err/meter_reading)*100.0",
- "",
- "#result",
- "print('(a)\\nAs error can be either positive or negative') ",
- "print('\\n the probable error at any point on the scale =\u00b1 %d\u00b0C'%err)",
- "print('\\n(b)\\nRange of the Instrument = %d\u00b0C'%Range_instr)",
+ "\n",
+ "\n",
+ "#varable Declaration\n",
+ "span=1000.0 #given value of span in \u00b0C\n",
+ "accuracy=1.0/100.0 #1% accuracy\n",
+ "\n",
+ "#calculations\n",
+ "err=span*accuracy\n",
+ "max_scale=1200.0\n",
+ "Range_instr=max_scale+span\n",
+ "meter_reading=700.0\n",
+ "per_of_err=(err/meter_reading)*100.0\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nAs error can be either positive or negative') \n",
+ "print('\\n the probable error at any point on the scale =\u00b1 %d\u00b0C'%err)\n",
+ "print('\\n(b)\\nRange of the Instrument = %d\u00b0C'%Range_instr)\n",
"print('\\n(c)\\nPercentage of Error = \u00b1 %.2f%% '%per_of_err)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "As error can be either positive or negative",
- "",
- " the probable error at any point on the scale =\u00b1 10\u00b0C",
- "",
- "(b)",
- "Range of the Instrument = 2200\u00b0C",
- "",
- "(c)",
+ "(a)\n",
+ "As error can be either positive or negative\n",
+ "\n",
+ " the probable error at any point on the scale =\u00b1 10\u00b0C\n",
+ "\n",
+ "(b)\n",
+ "Range of the Instrument = 2200\u00b0C\n",
+ "\n",
+ "(c)\n",
"Percentage of Error = \u00b1 1.43% "
]
}
- ],
+ ],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.3, Page Number: 54<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Two wire RTD'''",
- "",
- "#variable declaration",
- "resi_per_leg=5.0 # lead wire resistance per leg in Ohm",
- "temp_coeff=0.385 # Temperature coefficient of Pt 100 RTD in ohms/\u00b0C",
- "",
- "#calculation",
- "R_due_to_leadwires=2*resi_per_leg",
- "err=R_due_to_leadwires/temp_coeff",
- "err =round(err,0)",
- "temp_obj=200.0",
- "temp_measured=temp_obj+err",
- "per_of_err=((temp_measured-temp_obj)/temp_obj)*100.0",
- "",
- "#Result",
- "print('(a)\\nThe contribution of 10 ohms lead wire resistance')",
- "print('to the measurement error = %d\u00b0C' %err)",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "resi_per_leg=5.0 # lead wire resistance per leg in Ohm\n",
+ "temp_coeff=0.385 # Temperature coefficient of Pt 100 RTD in ohms/\u00b0C\n",
+ "\n",
+ "#calculation\n",
+ "R_due_to_leadwires=2*resi_per_leg\n",
+ "err=R_due_to_leadwires/temp_coeff\n",
+ "err =round(err,0)\n",
+ "temp_obj=200.0\n",
+ "temp_measured=temp_obj+err\n",
+ "per_of_err=((temp_measured-temp_obj)/temp_obj)*100.0\n",
+ "\n",
+ "#Result\n",
+ "print('(a)\\nThe contribution of 10 ohms lead wire resistance')\n",
+ "print('to the measurement error = %d\u00b0C' %err)\n",
"print('\\n(b)\\nPercentage of Error = %d%%' %per_of_err)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "The contribution of 10 ohms lead wire resistance",
- "to the measurement error = 26\u00b0C",
- "",
- "(b)",
+ "(a)\n",
+ "The contribution of 10 ohms lead wire resistance\n",
+ "to the measurement error = 26\u00b0C\n",
+ "\n",
+ "(b)\n",
"Percentage of Error = 13%"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.4, Page Number: 54<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Thermocouple temperature measurement'''",
- "",
- "#variable declaration",
- "temp=2.022 #Millivolt corresponds to reference junction temp 50\u00b0C",
- "millivolt_cor=37.325 #Millivolt corresponds to reference junction temp 900\u00b0C",
- "",
- "#calculation",
- "op=millivolt_cor-temp",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "temp=2.022 #Millivolt corresponds to reference junction temp 50\u00b0C\n",
+ "millivolt_cor=37.325 #Millivolt corresponds to reference junction temp 900\u00b0C\n",
+ "\n",
+ "#calculation\n",
+ "op=millivolt_cor-temp\n",
+ "\n",
+ "#result\n",
"print('Millivolt output available = % .3f' %op)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Millivolt output available = 35.303"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.5, Page Number: 54<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Hot junction temperature of thermocouple'''",
- "",
- "#variable declaration",
- "millivolt_cor=2.585 #Millivolt corresponds to reference junction temp 50\u00b0C",
- "pot_reading=30.511 #reading on pot",
- "",
- "#calculation",
- "corrected_millivolt=pot_reading+millivolt_cor",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "millivolt_cor=2.585 #Millivolt corresponds to reference junction temp 50\u00b0C\n",
+ "pot_reading=30.511 #reading on pot\n",
+ "\n",
+ "#calculation\n",
+ "corrected_millivolt=pot_reading+millivolt_cor\n",
+ "\n",
+ "#result\n",
"print('Temperature correspond to %.3f mV from the table = 600\u00b0C' %corrected_millivolt)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Temperature correspond to 33.096 mV from the table = 600\u00b0C"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.6, Page Number: 54<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Caliberation of an instrument'''",
- "",
- "#variable Declarion",
- "ref_jun=100.0 #reference junction temp.",
- "mV_100=0.645 #voltage at 100\u00b0C",
- "mV_1000=9.585 #voltage at 1000\u00b0C",
- "mV_1200=11.947 #voltage at 1200\u00b0C",
- "",
- "#calculation",
- "op1=mV_1000-mV_100",
- "op2=mV_1200-mV_100",
- "",
- "#result",
- "print('Millivolt to be fed checking 1000 C = %.3f mV'%op1)",
+ "\n",
+ "\n",
+ "#variable Declarion\n",
+ "ref_jun=100.0 #reference junction temp.\n",
+ "mV_100=0.645 #voltage at 100\u00b0C\n",
+ "mV_1000=9.585 #voltage at 1000\u00b0C\n",
+ "mV_1200=11.947 #voltage at 1200\u00b0C\n",
+ "\n",
+ "#calculation\n",
+ "op1=mV_1000-mV_100\n",
+ "op2=mV_1200-mV_100\n",
+ "\n",
+ "#result\n",
+ "print('Millivolt to be fed checking 1000 C = %.3f mV'%op1)\n",
"print('\\nMillivolt to be fed checking 1200 C = %.3f mV'%op2)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Millivolt to be fed checking 1000 C = 8.940 mV",
- "",
+ "Millivolt to be fed checking 1000 C = 8.940 mV\n",
+ "\n",
"Millivolt to be fed checking 1200 C = 11.302 mV"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.7, page Number: 55<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Wall temperature measurement'''",
- "",
- "#variable declaration",
- "E_rec_pyro=0.95*0.85 #Energy received by pyrometer",
- "",
- "#calculation",
- "T=1100.0/E_rec_pyro",
- " ",
- "#result",
+ "\n",
+ "#variable declaration\n",
+ "E_rec_pyro=0.95*0.85 #Energy received by pyrometer\n",
+ "\n",
+ "#calculation\n",
+ "T=1100.0/E_rec_pyro\n",
+ " \n",
+ "#result\n",
"print('Pyrometer reading T = %.2f\u00b0C'%T)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Pyrometer reading T = 1362.23\u00b0C"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.8, Page Number: 55<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Thermocouple output'''",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "hot1_mV=41.29 # Millivolt corresponds to hot junction temp ",
- "cold1_mV=2.022 # Millivolt corresponds to cold junction temp ",
- "",
- "#calculation",
- "op1=hot1_mV-cold1_mV",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "hot2_mV=33.096 #Millivolt corresponds to hot junction temp ",
- "cold2_mV=2.585 #Millivolt corresponds to cold junction temp ",
- "#calculation",
- "op2=hot2_mV-cold2_mV",
- "",
- "#(c)",
- "",
- "#variable declaration",
- "hot3_mV=11.947 #Millivolt corresponds to hot junction temp ",
- "cold3_mV=0.299 #Millivolt corresponds to cold junction temp ",
- "#calculation",
- "op3=hot3_mV-cold3_mV",
- "",
- "#result",
- "print('(a)\\nOutput Millivolt = %.3f'%op1)",
- "print('\\n(b)\\nOutput Millivolt = %.3f'%op2)",
- "print('\\n(c)\\nAs the wrongly formed thermocouples at J1 and J2 will always oppose')",
- "print('the main millivolt output, the net output will be lower than normal value.')",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "hot1_mV=41.29 # Millivolt corresponds to hot junction temp \n",
+ "cold1_mV=2.022 # Millivolt corresponds to cold junction temp \n",
+ "\n",
+ "#calculation\n",
+ "op1=hot1_mV-cold1_mV\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "hot2_mV=33.096 #Millivolt corresponds to hot junction temp \n",
+ "cold2_mV=2.585 #Millivolt corresponds to cold junction temp \n",
+ "#calculation\n",
+ "op2=hot2_mV-cold2_mV\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#variable declaration\n",
+ "hot3_mV=11.947 #Millivolt corresponds to hot junction temp \n",
+ "cold3_mV=0.299 #Millivolt corresponds to cold junction temp \n",
+ "#calculation\n",
+ "op3=hot3_mV-cold3_mV\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nOutput Millivolt = %.3f'%op1)\n",
+ "print('\\n(b)\\nOutput Millivolt = %.3f'%op2)\n",
+ "print('\\n(c)\\nAs the wrongly formed thermocouples at J1 and J2 will always oppose')\n",
+ "print('the main millivolt output, the net output will be lower than normal value.')\n",
"print('Output mV<%.3f'%op3)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "Output Millivolt = 39.268",
- "",
- "(b)",
- "Output Millivolt = 30.511",
- "",
- "(c)",
- "As the wrongly formed thermocouples at J1 and J2 will always oppose",
- "the main millivolt output, the net output will be lower than normal value.",
+ "(a)\n",
+ "Output Millivolt = 39.268\n",
+ "\n",
+ "(b)\n",
+ "Output Millivolt = 30.511\n",
+ "\n",
+ "(c)\n",
+ "As the wrongly formed thermocouples at J1 and J2 will always oppose\n",
+ "the main millivolt output, the net output will be lower than normal value.\n",
"Output mV<11.648"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.9, Page Number: 56<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''electtronic temperature transmitter'''",
- "",
- "#variable declaration",
- "Rl_ind=250.0 #load resistor for indicator",
- "Rl_rec=250.0 #load resistor for recorder",
- "load_allowable=600.0 #allowable load with load independency",
- "",
- "#calculation",
- "load_connected= Rl_ind+Rl_rec",
- "max_load_controller=load_allowable-load_connected",
- "op_cont=600.0",
- "total=Rl_ind+Rl_rec+load_allowable",
- "extra_load=total-op_cont",
- "",
- "#result",
- "print('(a)\\nThe max load to the controller = %d ohms'%max_load_controller)",
- "print('\\n(b)\\nExtra Load = %d ohms'%extra_load)",
- "print('\\nAdditional Power Supply voltage required = 10 V')",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "Rl_ind=250.0 #load resistor for indicator\n",
+ "Rl_rec=250.0 #load resistor for recorder\n",
+ "load_allowable=600.0 #allowable load with load independency\n",
+ "\n",
+ "#calculation\n",
+ "load_connected= Rl_ind+Rl_rec\n",
+ "max_load_controller=load_allowable-load_connected\n",
+ "op_cont=600.0\n",
+ "total=Rl_ind+Rl_rec+load_allowable\n",
+ "extra_load=total-op_cont\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nThe max load to the controller = %d ohms'%max_load_controller)\n",
+ "print('\\n(b)\\nExtra Load = %d ohms'%extra_load)\n",
+ "print('\\nAdditional Power Supply voltage required = 10 V')\n",
"print('\\nMinimum Power Supply Voltage = 34 ')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "The max load to the controller = 100 ohms",
- "",
- "(b)",
- "Extra Load = 500 ohms",
- "",
- "Additional Power Supply voltage required = 10 V",
- "",
+ "(a)\n",
+ "The max load to the controller = 100 ohms\n",
+ "\n",
+ "(b)\n",
+ "Extra Load = 500 ohms\n",
+ "\n",
+ "Additional Power Supply voltage required = 10 V\n",
+ "\n",
"Minimum Power Supply Voltage = 34 "
]
}
- ],
+ ],
"prompt_number": 9
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Industrial_Instrumentation/Chapter_2.ipynb b/Industrial_Instrumentation/Chapter_2.ipynb
index f6c4dada..41a457ab 100644
--- a/Industrial_Instrumentation/Chapter_2.ipynb
+++ b/Industrial_Instrumentation/Chapter_2.ipynb
@@ -1,603 +1,630 @@
{
"metadata": {
- "name": "Chapter_2"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:e12000c40c7eba5fb38d72e0bdbc08735899d3485eb0ecea04e85215c845b6b8"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 2: Pressure<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.1, Page Number: 116<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Pressure conversion'''",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "#1kg/cm^2=10000 mmWG",
- "x=10000.0*10.0 #equivalnt to 10kg/cm^2",
- "",
- "#result",
- "print('(a)\\n 10kg/cm^2 = %.0f mmWG' %x)",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "onemm_Hg=13.546 #pressure of 1 mm Hg",
- "",
- "#calculation",
- "y=10.0**5/onemm_Hg",
- "y=y/10.0**3",
- "",
- "#result",
- "print('\\n(b)\\n10kg/cm^2 = 10^5 mmWG = %.2f * 10^3 mmHg' %y)",
- "",
- "#(c)",
- "",
- "#variable declaration",
- "onebar=1.03 # 1 Bar presssure in kg/cm^2",
- "#calculation",
- "z=10.0/onebar",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "#1kg/cm^2=10000 mmWG\n",
+ "x=10000.0*10.0 #equivalnt to 10kg/cm^2\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\n 10kg/cm^2 = %.0f mmWG' %x)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "onemm_Hg=13.546 #pressure of 1 mm Hg\n",
+ "\n",
+ "#calculation\n",
+ "y=10.0**5/onemm_Hg\n",
+ "y=y/10.0**3\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)\\n10kg/cm^2 = 10^5 mmWG = %.2f * 10^3 mmHg' %y)\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#variable declaration\n",
+ "onebar=1.03 # 1 Bar presssure in kg/cm^2\n",
+ "#calculation\n",
+ "z=10.0/onebar\n",
+ "\n",
+ "#result\n",
"print('\\n(c)\\n10kg/cm^2 = %.2f bars' %z)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- " 10kg/cm^2 = 100000 mmWG",
- "",
- "(b)",
- "10kg/cm^2 = 10^5 mmWG = 7.38 * 10^3 mmHg",
- "",
- "(c)",
+ "(a)\n",
+ " 10kg/cm^2 = 100000 mmWG\n",
+ "\n",
+ "(b)\n",
+ "10kg/cm^2 = 10^5 mmWG = 7.38 * 10^3 mmHg\n",
+ "\n",
+ "(c)\n",
"10kg/cm^2 = 9.71 bars"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.2, Page Number: 116<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Gauge and absolute pressure'''",
- "",
- "#(a)",
- "",
- "#variable Declaration",
- "gamm=1000.0 # density of water",
- "d=35.0 # depth of water ",
- "dens_Hg=13.546 # density of Hg",
- "",
- "#calculation",
- "press_in_kg_cm=gamm*d*10**-4",
- "press_in_mmHg=gamm*d/dens_Hg",
- "press_in_mmHg=press_in_mmHg/10**3",
- "",
- "#result",
- "print('(a)\\nThe pressure at depth of %d meters in a water tank=%.1f kg/cm^2 = %.2f*10^3 mmHg'%(d, press_in_kg_cm, press_in_mmHg))",
- "",
- "#(b)",
- "",
- "#varible declaration",
- "press_atm=1.03 #atmospheric pressure",
- "",
- "#calculation",
- "abspress=press_in_kg_cm+press_atm",
- "abspress_mmHg=press_in_mmHg*1000.0+760.0",
- "abspress_mmHg=abspress_mmHg/1000.0",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable Declaration\n",
+ "gamm=1000.0 # density of water\n",
+ "d=35.0 # depth of water \n",
+ "dens_Hg=13.546 # density of Hg\n",
+ "\n",
+ "#calculation\n",
+ "press_in_kg_cm=gamm*d*10**-4\n",
+ "press_in_mmHg=gamm*d/dens_Hg\n",
+ "press_in_mmHg=press_in_mmHg/10**3\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nThe pressure at depth of %d meters in a water tank=%.1f kg/cm^2 = %.2f*10^3 mmHg'%(d, press_in_kg_cm, press_in_mmHg))\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#varible declaration\n",
+ "press_atm=1.03 #atmospheric pressure\n",
+ "\n",
+ "#calculation\n",
+ "abspress=press_in_kg_cm+press_atm\n",
+ "abspress_mmHg=press_in_mmHg*1000.0+760.0\n",
+ "abspress_mmHg=abspress_mmHg/1000.0\n",
+ "\n",
+ "#result\n",
"print('\\n(b)\\nAbsolute Pressure= %.2f kg/cm^2 Abs = %.2f*10^3 mmHg Abs'%(abspress, abspress_mmHg))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "The pressure at depth of 35 meters in a water tank=3.5 kg/cm^2 = 2.58*10^3 mmHg",
- "",
- "(b)",
+ "(a)\n",
+ "The pressure at depth of 35 meters in a water tank=3.5 kg/cm^2 = 2.58*10^3 mmHg\n",
+ "\n",
+ "(b)\n",
"Absolute Pressure= 4.53 kg/cm^2 Abs = 3.34*10^3 mmHg Abs"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.3, Page Number:116<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Gauge and absolute pressure'''",
- "",
- "#varible declaration",
- "egp=260.0 # equivalent gauge pressure",
- "",
- "#calculation",
- "abspress=760.0-egp",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#varible declaration\n",
+ "egp=260.0 # equivalent gauge pressure\n",
+ "\n",
+ "#calculation\n",
+ "abspress=760.0-egp\n",
+ "\n",
+ "#result\n",
"print('Absolute Presssure = %d mmHg' %abspress)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Absolute Presssure = 500 mmHg"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.4,Page Number:117<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''pressure measurement using U tube manometer'''",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "p_diff=500.0 #pressure difference in mmHg",
- "",
- "#calculations",
- "pdiff=p_diff*13.546/10000",
- "",
- "#Result",
- "print('(a)\\np1-p2 = %.3f kg/cm^2' %pdiff)",
- "",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "p1=6770.0 # Gauge pressure in mmWG",
- "p_atm=10300.0 # atmospheric pressure ",
- "",
- "#calculation",
- "abs_p1=p1+p_atm",
- "",
- "#result",
- "print('\\n(b)If p2 is open to atmosphere:\\nAbsolute Pressure P1 = %d mmWG abs.' %abs_p1)",
- "",
- "#(c)",
- "",
- "#variable declaration",
- "P1=500.0 #mmHg absolute pressure",
- "",
- "#calculations",
- "P1_gauge=P1-760.0",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "p_diff=500.0 #pressure difference in mmHg\n",
+ "\n",
+ "#calculations\n",
+ "pdiff=p_diff*13.546/10000\n",
+ "\n",
+ "#Result\n",
+ "print('(a)\\np1-p2 = %.3f kg/cm^2' %pdiff)\n",
+ "\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "p1=6770.0 # Gauge pressure in mmWG\n",
+ "p_atm=10300.0 # atmospheric pressure \n",
+ "\n",
+ "#calculation\n",
+ "abs_p1=p1+p_atm\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)If p2 is open to atmosphere:\\nAbsolute Pressure P1 = %d mmWG abs.' %abs_p1)\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#variable declaration\n",
+ "P1=500.0 #mmHg absolute pressure\n",
+ "\n",
+ "#calculations\n",
+ "P1_gauge=P1-760.0\n",
+ "\n",
+ "#result\n",
"print('\\n(c)If p2 is evacuated and sealed:\\np1= %d mmHg gauge Pressure' %P1_gauge)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "p1-p2 = 0.677 kg/cm^2",
- "",
- "(b)If p2 is open to atmosphere:",
- "Absolute Pressure P1 = 17070 mmWG abs.",
- "",
- "(c)If p2 is evacuated and sealed:",
+ "(a)\n",
+ "p1-p2 = 0.677 kg/cm^2\n",
+ "\n",
+ "(b)If p2 is open to atmosphere:\n",
+ "Absolute Pressure P1 = 17070 mmWG abs.\n",
+ "\n",
+ "(c)If p2 is evacuated and sealed:\n",
"p1= -260 mmHg gauge Pressure"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.5, Page Number: 117<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Specific Gravity and weight density'''",
- "",
- "#variable declaration",
- "spe_grav_water=1.0 # specific gravity of water",
- "",
- "#calculation",
- "spe_grav_X=spe_grav_water*100.0/50.0",
- "wt_dens_water=1000.0",
- "wt_dens_X=wt_dens_water*2.0",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "spe_grav_water=1.0 # specific gravity of water\n",
+ "\n",
+ "#calculation\n",
+ "spe_grav_X=spe_grav_water*100.0/50.0\n",
+ "wt_dens_water=1000.0\n",
+ "wt_dens_X=wt_dens_water*2.0\n",
+ "\n",
+ "#result\n",
"print('Weight Density of X = %d kg/m^3' %wt_dens_X)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Weight Density of X = 2000 kg/m^3"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.6, Page Number: 117<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''water flow rate using mercury manometer'''",
- "",
- "#variable declaration",
- "A=1.0/20.0 # Area ratio",
- "p_diff=1500.0 # pressure difference in mmWG",
- "",
- "#result",
- "print('(a)\\nAs Delta_h=A2/A1*h << h and normally negligible for well type manometer')",
- "print('hence, p1-p2 = h = %d =111 mmHg' %p_diff)",
- "print('\\n(b)\\nh measured above the oriinal reference will be half of H, i.e. 111/2=55.5 mmHg')",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "A=1.0/20.0 # Area ratio\n",
+ "p_diff=1500.0 # pressure difference in mmWG\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nAs Delta_h=A2/A1*h << h and normally negligible for well type manometer')\n",
+ "print('hence, p1-p2 = h = %d =111 mmHg' %p_diff)\n",
+ "print('\\n(b)\\nh measured above the oriinal reference will be half of H, i.e. 111/2=55.5 mmHg')\n",
"print('(Since area of both legs are same)')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "As Delta_h=A2/A1*h << h and normally negligible for well type manometer",
- "hence, p1-p2 = h = 1500 =111 mmHg",
- "",
- "(b)",
- "h measured above the oriinal reference will be half of H, i.e. 111/2=55.5 mmHg",
+ "(a)\n",
+ "As Delta_h=A2/A1*h << h and normally negligible for well type manometer\n",
+ "hence, p1-p2 = h = 1500 =111 mmHg\n",
+ "\n",
+ "(b)\n",
+ "h measured above the oriinal reference will be half of H, i.e. 111/2=55.5 mmHg\n",
"(Since area of both legs are same)"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.7, Page Number: 119<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''readings and errors in Bourdon gauge reading'''",
- "",
- "print('1 kg/cm^2 = 10 mWG\\n')",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "press=10+2 #pressure read by the gauge",
- "",
- "#result",
- "print('\\n(a)Bourdon Gauge is mounted 20 meters below water line:')",
- "print('\\nPressure read by the Gauge = %d kg/cm^2'%press)",
- "",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "press2=10-3 #pressure read by the gauge",
- "",
- "#result",
- "print('\\n\\n(b)Bourdon Gauge is located 30 meters above the water line:')",
+ "\n",
+ "\n",
+ "print('1 kg/cm^2 = 10 mWG\\n')\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "press=10+2 #pressure read by the gauge\n",
+ "\n",
+ "#result\n",
+ "print('\\n(a)Bourdon Gauge is mounted 20 meters below water line:')\n",
+ "print('\\nPressure read by the Gauge = %d kg/cm^2'%press)\n",
+ "\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "press2=10-3 #pressure read by the gauge\n",
+ "\n",
+ "#result\n",
+ "print('\\n\\n(b)Bourdon Gauge is located 30 meters above the water line:')\n",
"print('\\nPressure read by the Gauge = %d kg/cm^2'%press2)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "1 kg/cm^2 = 10 mWG",
- "",
- "",
- "(a)Bourdon Gauge is mounted 20 meters below water line:",
- "",
- "Pressure read by the Gauge = 12 kg/cm^2",
- "",
- "",
- "(b)Bourdon Gauge is located 30 meters above the water line:",
- "",
+ "1 kg/cm^2 = 10 mWG\n",
+ "\n",
+ "\n",
+ "(a)Bourdon Gauge is mounted 20 meters below water line:\n",
+ "\n",
+ "Pressure read by the Gauge = 12 kg/cm^2\n",
+ "\n",
+ "\n",
+ "(b)Bourdon Gauge is located 30 meters above the water line:\n",
+ "\n",
"Pressure read by the Gauge = 7 kg/cm^2"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.8, Page Number: 120<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Specific Gravity and density of liquid'''",
- "",
- "#Variable declaration",
- "dens_water=1000.0 # water Density",
- "h1=125.0 # height1 mm",
- "h2=250.0 # height2 mm",
- "d2=h1*dens_water/h2",
- "",
- "#result",
- "",
- "#a",
- "print('(a)\\nDensity of Liquid = %d kg/m^3' %d2)",
- "print('\\nSpecific Density of the liquid = %.1f' %(h1/h2))",
- "",
- "#(b)",
- "print('\\n\\n(b)\\nIf Values of water and liquid interchanged:\\n')",
- "d3=h2*dens_water/h1",
- "print('\\nDensity of Liquid = %d kg/m^3' %d3)",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "dens_water=1000.0 # water Density\n",
+ "h1=125.0 # height1 mm\n",
+ "h2=250.0 # height2 mm\n",
+ "d2=h1*dens_water/h2\n",
+ "\n",
+ "#result\n",
+ "\n",
+ "#a\n",
+ "print('(a)\\nDensity of Liquid = %d kg/m^3' %d2)\n",
+ "print('\\nSpecific Density of the liquid = %.1f' %(h1/h2))\n",
+ "\n",
+ "#(b)\n",
+ "print('\\n\\n(b)\\nIf Values of water and liquid interchanged:\\n')\n",
+ "d3=h2*dens_water/h1\n",
+ "print('\\nDensity of Liquid = %d kg/m^3' %d3)\n",
"print('\\nSpecific Density of the liquid = %.1f' %(h2/h1))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "Density of Liquid = 500 kg/m^3",
- "",
- "Specific Density of the liquid = 0.5",
- "",
- "",
- "(b)",
- "If Values of water and liquid interchanged:",
- "",
- "",
- "Density of Liquid = 2000 kg/m^3",
- "",
+ "(a)\n",
+ "Density of Liquid = 500 kg/m^3\n",
+ "\n",
+ "Specific Density of the liquid = 0.5\n",
+ "\n",
+ "\n",
+ "(b)\n",
+ "If Values of water and liquid interchanged:\n",
+ "\n",
+ "\n",
+ "Density of Liquid = 2000 kg/m^3\n",
+ "\n",
"Specific Density of the liquid = 2.0"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.9, Page Number: 120<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''strain gauge wire length and cross section area'''",
- "",
- "import math",
- "#variable Declaration",
- "R=120.0 #resistance",
- "l=122.0 #length",
- "a=0.1 #area",
- "R1=140.0 #resistance in ohm",
- "",
- "#calculation",
- "rho=R*a/l",
- "l1=math.sqrt(R1*a*l/rho)",
- "l1=round(l1,0)",
- "",
- "#Result",
- "print('Length l1 = %d meters' %l1)",
- "A1=a*l/l1",
+ "\n",
+ "\n",
+ "import math\n",
+ "#variable Declaration\n",
+ "R=120.0 #resistance\n",
+ "l=122.0 #length\n",
+ "a=0.1 #area\n",
+ "R1=140.0 #resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "rho=R*a/l\n",
+ "l1=math.sqrt(R1*a*l/rho)\n",
+ "l1=round(l1,0)\n",
+ "\n",
+ "#Result\n",
+ "print('Length l1 = %d meters' %l1)\n",
+ "A1=a*l/l1\n",
"print('\\nArea A1 = %.4f mm^2' %A1)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Length l1 = 132 meters",
- "",
+ "Length l1 = 132 meters\n",
+ "\n",
"Area A1 = 0.0924 mm^2"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.10, Page Number: 121<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Capacitance calculation for variable dielectric'''",
- "",
- "c=0.57 #Constant",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "d=0.1 #distance between plates",
- "di1=100.0 #Dielectric constant",
- "di2=1000.0 #Dielectric constant",
- "",
- "#calculation",
- "c1=c*di1*10.0/d",
- "c1=round(c1,0)",
- "",
- "#result",
- "print('(a)\\nC1=%d pf' %c1)",
- "",
- "",
- "#(b)",
- "",
- "#calculation",
- "c2=c*di2*10/d",
- "",
- "#result",
- "print('\\n(b)\\nC2=%d pf' %c2)",
- "",
- "",
- "#(c)",
- "",
- "#calculation",
- "ds=0.09",
- "c11=c*di1*10/ds",
- "c12=c*di2*10/ds",
- "",
- "#result",
+ "\n",
+ "\n",
+ "c=0.57 #Constant\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "d=0.1 #distance between plates\n",
+ "di1=100.0 #Dielectric constant\n",
+ "di2=1000.0 #Dielectric constant\n",
+ "\n",
+ "#calculation\n",
+ "c1=c*di1*10.0/d\n",
+ "c1=round(c1,0)\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nC1=%d pf' %c1)\n",
+ "\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#calculation\n",
+ "c2=c*di2*10/d\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)\\nC2=%d pf' %c2)\n",
+ "\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#calculation\n",
+ "ds=0.09\n",
+ "c11=c*di1*10/ds\n",
+ "c12=c*di2*10/ds\n",
+ "\n",
+ "#result\n",
"print('\\n(c)\\nC1 = %.1f pf\\nC2 = %d pf'%(c11,c12))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "C1=5700 pf",
- "",
- "(b)",
- "C2=57000 pf",
- "",
- "(c)",
- "C1 = 6333.3 pf",
+ "(a)\n",
+ "C1=5700 pf\n",
+ "\n",
+ "(b)\n",
+ "C2=57000 pf\n",
+ "\n",
+ "(c)\n",
+ "C1 = 6333.3 pf\n",
"C2 = 63333 pf"
]
}
- ],
+ ],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.11, Page Number: 121<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''pressure gauge caliberation'''",
- "",
- "#variable Declaration",
- "A=1.0 #area",
- "p1=10.0 #pressure",
- "",
- "#calculation",
- "W1=A*p1",
- "",
- "#Result",
- "print('W1 = %d kg' %W1)",
+ "\n",
+ "\n",
+ "#variable Declaration\n",
+ "A=1.0 #area\n",
+ "p1=10.0 #pressure\n",
+ "\n",
+ "#calculation\n",
+ "W1=A*p1\n",
+ "\n",
+ "#Result\n",
+ "print('W1 = %d kg' %W1)\n",
"print('\\nWith the 4 standard weights of 10kg, 20kg, 30kg and 40kg')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "W1 = 10 kg",
- "",
+ "W1 = 10 kg\n",
+ "\n",
"With the 4 standard weights of 10kg, 20kg, 30kg and 40kg"
]
}
- ],
+ ],
"prompt_number": 11
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.12, Page Number: 122<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''pressure calculation using McLeod gauge'''",
- "",
- "#varable declaration",
- "p1=10**-2 #pressure in torr",
- "h1=20.0 #height in mm",
- "",
- "#xalculation",
- "K=p1/h1**2",
- "p2=K*30**2",
- "p2=p2*100.0",
- "",
- "#Result",
+ "\n",
+ "#varable declaration\n",
+ "p1=10**-2 #pressure in torr\n",
+ "h1=20.0 #height in mm\n",
+ "\n",
+ "#xalculation\n",
+ "K=p1/h1**2\n",
+ "p2=K*30**2\n",
+ "p2=p2*100.0\n",
+ "\n",
+ "#Result\n",
"print('The unknown pressure p2 = %.2f * 10^-2 torr' %p2)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"The unknown pressure p2 = 2.25 * 10^-2 torr"
]
}
- ],
+ ],
"prompt_number": 12
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Industrial_Instrumentation/Chapter_3.ipynb b/Industrial_Instrumentation/Chapter_3.ipynb
index 6d26bc18..b7ff3a1a 100644
--- a/Industrial_Instrumentation/Chapter_3.ipynb
+++ b/Industrial_Instrumentation/Chapter_3.ipynb
@@ -1,391 +1,413 @@
{
"metadata": {
- "name": "Chapter_3"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:40aab97a0942d997de9cd8ee539182af9fd67e045ac34df8f9ba65083df3fe50"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter_3: Force Torque and Velocity<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.1, Page Number: 163<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Force calculation'''",
- "",
- "#variable declaration",
- "m1=20 #mass of the body in Kg ",
- "a=5 #acceleration in m/s^2",
- "",
- "#calculation",
- "F=m1*a",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "m1=20 #mass of the body in Kg \n",
+ "a=5 #acceleration in m/s^2\n",
+ "\n",
+ "#calculation\n",
+ "F=m1*a\n",
+ "\n",
+ "#result\n",
"print('F = %d Newtons'%F)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"F = 100 Newtons"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.2, Page Number: 163<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Weight calculation'''",
- "",
- "#variable declaration",
- "m1=50 #mass of the body in Kg ",
- "g1=9.8 #acceleration due to gravity",
- "",
- "#calculation",
- "W2=m1*g1",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "m1=50 #mass of the body in Kg \n",
+ "g1=9.8 #acceleration due to gravity\n",
+ "\n",
+ "#calculation\n",
+ "W2=m1*g1\n",
+ "\n",
+ "#result\n",
"print('W = %d Newtons = %d kgf' %(W2,m1))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"W = 490 Newtons = 50 kgf"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.3, Page Number: 164<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of specific gravity'''",
- "",
- "#variable declaration",
- "wt_material=2500.0 #weight of 1 m^3 material",
- "wt_water=1000.0 #weight of 1 m^3 water",
- "",
- "#calculation",
- "spe_grav=wt_material/wt_water",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "wt_material=2500.0 #weight of 1 m^3 material\n",
+ "wt_water=1000.0 #weight of 1 m^3 water\n",
+ "\n",
+ "#calculation\n",
+ "spe_grav=wt_material/wt_water\n",
+ "\n",
+ "#result\n",
"print('Specific gravity of the material = %.1f' %spe_grav)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Specific gravity of the material = 2.5"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.4, Page Number: 164<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Estimation of uncertainty due to sensitivity'''",
- "",
- "import math",
- "#variable declaration",
- "L=20.0 # length in cm",
- "W=2000.0 # Weight of mass in gm ",
- "db=0.02 # length in cm ",
- "Wb=100.0 # Weight of mass in gm ",
- "dG=0.5 # length in cm",
- "",
- "#calculation",
- "S=L/(2*W*db+Wb*dG)",
- "fi=0.2",
- "DeltaW=fi*math.pi/(180*S)",
- "",
- "#result",
- "print('S = %.3f rad/g' %S)",
+ "\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "L=20.0 # length in cm\n",
+ "W=2000.0 # Weight of mass in gm \n",
+ "db=0.02 # length in cm \n",
+ "Wb=100.0 # Weight of mass in gm \n",
+ "dG=0.5 # length in cm\n",
+ "\n",
+ "#calculation\n",
+ "S=L/(2*W*db+Wb*dG)\n",
+ "fi=0.2\n",
+ "DeltaW=fi*math.pi/(180*S)\n",
+ "\n",
+ "#result\n",
+ "print('S = %.3f rad/g' %S)\n",
"print('\\nDeltaW = %.3f g' %DeltaW)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "S = 0.154 rad/g",
- "",
+ "S = 0.154 rad/g\n",
+ "\n",
"DeltaW = 0.023 g"
]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.5, Page Number: 164<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Torque Calculation'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "hp=746.0 # horse power",
- "P=5*hp # Saft power in Watts",
- "N=1500.0 # speed in rpm",
- "",
- "#calculation",
- "n=N/60.0",
- "T=P*60/(2*math.pi*n)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "hp=746.0 # horse power\n",
+ "P=5*hp # Saft power in Watts\n",
+ "N=1500.0 # speed in rpm\n",
+ "\n",
+ "#calculation\n",
+ "n=N/60.0\n",
+ "T=P*60/(2*math.pi*n)\n",
+ "\n",
+ "#result\n",
"print('T = %.0f Newton meters' %(math.ceil(T)))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"T = 1425 Newton meters"
]
}
- ],
+ ],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.6, Page Number: 165<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Force calculation'''",
- "",
- "#variable declaration",
- "ch_l=0.075 #change in length",
- "orig_l=50.0 #Original length",
- "",
- "#calculation",
- "S=ch_l/orig_l",
- "E=9.66*10**5",
- "stress=E*S",
- "area=1.5",
- "f=stress*area",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "ch_l=0.075 #change in length\n",
+ "orig_l=50.0 #Original length\n",
+ "\n",
+ "#calculation\n",
+ "S=ch_l/orig_l\n",
+ "E=9.66*10**5\n",
+ "stress=E*S\n",
+ "area=1.5\n",
+ "f=stress*area\n",
+ "\n",
+ "#result\n",
"print('Strain = %.4f cm/cm\\nStress =%d kg/cm^2\\nForce = %.1f kg'%(S,stress,f))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Strain = 0.0015 cm/cm",
- "Stress =1449 kg/cm^2",
+ "Strain = 0.0015 cm/cm\n",
+ "Stress =1449 kg/cm^2\n",
"Force = 2173.5 kg"
]
}
- ],
+ ],
"prompt_number": 11
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.7, Page Number: 165<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''resistance strain gauge'''",
- "",
- "import math",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "R1=120.0 # resistance in Ohm",
- "R2=120.0 # resistance in Ohm",
- "R3=120.0 # resistance in Ohm",
- "R4=120.0 # resistance in Ohm",
- "Rg=100.0 # resistance in Ohm",
- "",
- "#calculation",
- "C=(R1*R2*R4)+(R1*R3*R4)+(R1*R2*R3)+(R2*R3*R4)+(Rg*(R1+R4)*(R2+R3))",
- "C=C/(10**7)",
- "",
- "#result",
- "print('(a)\\nC=%.3f*10^7' %C)",
- "E=10",
- "F=(E*R3*R1*2*10**3)/(C*10**7)",
- "print('\\nF = %.1f *10^3 A/mm = %.1f mA/mm'%(F,F))",
- "",
- "#(b)",
- "",
- "#calculation",
- "Fe=2*10**-4",
- "E=10",
- "DeltaE=Fe*E/(4+4*10**-4)",
- "DeltaE=DeltaE*10**3",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "R1=120.0 # resistance in Ohm\n",
+ "R2=120.0 # resistance in Ohm\n",
+ "R3=120.0 # resistance in Ohm\n",
+ "R4=120.0 # resistance in Ohm\n",
+ "Rg=100.0 # resistance in Ohm\n",
+ "\n",
+ "#calculation\n",
+ "C=(R1*R2*R4)+(R1*R3*R4)+(R1*R2*R3)+(R2*R3*R4)+(Rg*(R1+R4)*(R2+R3))\n",
+ "C=C/(10**7)\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nC=%.3f*10^7' %C)\n",
+ "E=10\n",
+ "F=(E*R3*R1*2*10**3)/(C*10**7)\n",
+ "print('\\nF = %.1f *10^3 A/mm = %.1f mA/mm'%(F,F))\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#calculation\n",
+ "Fe=2*10**-4\n",
+ "E=10\n",
+ "DeltaE=Fe*E/(4+4*10**-4)\n",
+ "DeltaE=DeltaE*10**3\n",
+ "\n",
+ "#Result\n",
"print('\\n(b)\\nDeltaEg=%.1f mV' %DeltaE)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "C=1.267*10^7",
- "",
- "F = 22.7 *10^3 A/mm = 22.7 mA/mm",
- "",
- "(b)",
+ "(a)\n",
+ "C=1.267*10^7\n",
+ "\n",
+ "F = 22.7 *10^3 A/mm = 22.7 mA/mm\n",
+ "\n",
+ "(b)\n",
"DeltaEg=0.5 mV"
]
}
- ],
+ ],
"prompt_number": 12
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.8, PAge Number: 167<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''speed measurement using stroboscope'''",
- "",
- "#(a)",
- "import math",
- "",
- "#variable Declaration",
- "r1=2500.0 # Highest flasing rate ",
- "r2=1500.0 # next Highest flasing rate ",
- "",
- "#calculation",
- "n=(r1*r2)/(r1-r2)",
- "",
- "#result",
- "print('(a)\\nn = %d rpm'%n)",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "N=5.0 # Fift time syncronization for same speed",
- "",
- "#calculation",
- "r5=n*r1/((r1*(N-1))+n)",
- "r5=math.ceil(r5)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "import math\n",
+ "\n",
+ "#variable Declaration\n",
+ "r1=2500.0 # Highest flasing rate \n",
+ "r2=1500.0 # next Highest flasing rate \n",
+ "\n",
+ "#calculation\n",
+ "n=(r1*r2)/(r1-r2)\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nn = %d rpm'%n)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "N=5.0 # Fift time syncronization for same speed\n",
+ "\n",
+ "#calculation\n",
+ "r5=n*r1/((r1*(N-1))+n)\n",
+ "r5=math.ceil(r5)\n",
+ "\n",
+ "#result\n",
"print('\\n(b)\\nr5=%d Flashes/Minute' %r5)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "n = 3750 rpm",
- "",
- "(b)",
+ "(a)\n",
+ "n = 3750 rpm\n",
+ "\n",
+ "(b)\n",
"r5=682 Flashes/Minute"
]
}
- ],
+ ],
"prompt_number": 13
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.9, Page Number: 167<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''speed measurement using proximity'''",
- "",
- "#variable declaration",
- "rpm=1500.0 #rotation in rpm",
- "f=200.0 #frequency",
- "",
- "#calculation",
- "N=60*f/rpm",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "rpm=1500.0 #rotation in rpm\n",
+ "f=200.0 #frequency\n",
+ "\n",
+ "#calculation\n",
+ "N=60*f/rpm\n",
+ "\n",
+ "#result\n",
"print('No of teeth on the wheel\\nN=%d' %N)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "No of teeth on the wheel",
+ "No of teeth on the wheel\n",
"N=8"
]
}
- ],
+ ],
"prompt_number": 14
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Industrial_Instrumentation/Chapter_4.ipynb b/Industrial_Instrumentation/Chapter_4.ipynb
index f58d6ec6..ea3f076f 100644
--- a/Industrial_Instrumentation/Chapter_4.ipynb
+++ b/Industrial_Instrumentation/Chapter_4.ipynb
@@ -1,554 +1,578 @@
{
"metadata": {
- "name": "Chapter_4"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:81d0436ef2f36f55ad662ab91b6d5e2e47a4c3c61b8080d3706a64417c68403d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 4: Acceleration Vibration and Density<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.1, Page Number:209 <h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''''mechanical system for a seismic instrument'''",
- "",
- "import math",
- "#(a)",
- "",
- "#variable Declaration",
- "k=50.0 #Spring constant ",
- "m=0.005 # mass in kg",
- "",
- "#calculation",
- "wn=math.sqrt(k/m)",
- "",
- "#result",
- "print('(a)\\nNatural frequency(wn)= %d rad/s' %wn)",
- "",
- "",
- "#(b)",
- "",
- "#calculation",
- "Cc=2*(m*k)**(0.5)",
- "",
- "#result",
+ "\n",
+ "import math\n",
+ "#(a)\n",
+ "\n",
+ "#variable Declaration\n",
+ "k=50.0 #Spring constant \n",
+ "m=0.005 # mass in kg\n",
+ "\n",
+ "#calculation\n",
+ "wn=math.sqrt(k/m)\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nNatural frequency(wn)= %d rad/s' %wn)\n",
+ "\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#calculation\n",
+ "Cc=2*(m*k)**(0.5)\n",
+ "\n",
+ "#result\n",
"print('\\n(b)\\nCc=%d' %Cc)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "Natural frequency(wn)= 100 rad/s",
- "",
- "(b)",
+ "(a)\n",
+ "Natural frequency(wn)= 100 rad/s\n",
+ "\n",
+ "(b)\n",
"Cc=1"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.2, Page Number:209<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Frequency and phase angle of motion'''",
- "",
- "#(a)",
- "import math",
- "",
- "#variable Declaration",
- "Cc=1.0 # damping ratio ",
- "C=0.7*Cc # Critical damping ratio ",
- "m=0.005 # mass",
- "k=50.0 # spring constant",
- "",
- "#calculation",
- "w=math.sqrt((k/m)-(C/(2*m))**2)",
- "",
- "#result",
- "print('(a)\\nw=%.1f rad/s' %w)",
- "",
- "#(b)",
- "",
- "#variable Declaration",
- "w1=250.0 # angular velocity",
- "",
- "#calculation",
- "theta=C*w1/(k-m*w1**2)",
- "print('\\ntheta=%f' %theta)",
- "fi=math.atan(-theta)",
- "fi=fi*180.0/math.pi",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "import math\n",
+ "\n",
+ "#variable Declaration\n",
+ "Cc=1.0 # damping ratio \n",
+ "C=0.7*Cc # Critical damping ratio \n",
+ "m=0.005 # mass\n",
+ "k=50.0 # spring constant\n",
+ "\n",
+ "#calculation\n",
+ "w=math.sqrt((k/m)-(C/(2*m))**2)\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nw=%.1f rad/s' %w)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable Declaration\n",
+ "w1=250.0 # angular velocity\n",
+ "\n",
+ "#calculation\n",
+ "theta=C*w1/(k-m*w1**2)\n",
+ "print('\\ntheta=%f' %theta)\n",
+ "fi=math.atan(-theta)\n",
+ "fi=fi*180.0/math.pi\n",
+ "\n",
+ "#result\n",
"print('\\nfi = %d\u00b0'%fi)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "w=71.4 rad/s",
- "",
- "theta=-0.666667",
- "",
+ "(a)\n",
+ "w=71.4 rad/s\n",
+ "\n",
+ "theta=-0.666667\n",
+ "\n",
"fi = 33\u00b0"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.3, PAge Number: 210<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''time calculation for exponetial transient term'''",
- "import math",
- "",
- "#variable Declaration",
- "m=0.005 # mass ",
- "c=0.7 # damping ratio",
- "",
- "#calculation",
- "y=-math.log(0.01)",
- "t=y*2*m/c",
- "",
- "#result",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable Declaration\n",
+ "m=0.005 # mass \n",
+ "c=0.7 # damping ratio\n",
+ "\n",
+ "#calculation\n",
+ "y=-math.log(0.01)\n",
+ "t=y*2*m/c\n",
+ "\n",
+ "#result\n",
"print('t=%.4f Secs' %t)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"t=0.0658 Secs"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.4, Page Number:210<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Acceleration measurement'''",
- "",
- "#variable Declaration",
- "rg1=1200.0 #resistance in Ohm",
- "rg2=1200.0 #resistance in Ohm",
- "rg3=1200.0 #resistance in Ohm",
- "rg4=1200.0 #resistance in Ohm",
- "",
- "#calculation",
- "D1=rg1*5.0/100.0",
- "D2=rg2*5.0/100.0",
- "D3=rg3*5.0/100.0",
- "D4=rg4*5.0/100.0",
- "E=12.0",
- "v=E*(((rg1+D1)/(rg1+D1+rg2-D2))-((rg4-D4)/(rg3+D3+rg4-D4)))",
- "v=v*1000.0",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable Declaration\n",
+ "rg1=1200.0 #resistance in Ohm\n",
+ "rg2=1200.0 #resistance in Ohm\n",
+ "rg3=1200.0 #resistance in Ohm\n",
+ "rg4=1200.0 #resistance in Ohm\n",
+ "\n",
+ "#calculation\n",
+ "D1=rg1*5.0/100.0\n",
+ "D2=rg2*5.0/100.0\n",
+ "D3=rg3*5.0/100.0\n",
+ "D4=rg4*5.0/100.0\n",
+ "E=12.0\n",
+ "v=E*(((rg1+D1)/(rg1+D1+rg2-D2))-((rg4-D4)/(rg3+D3+rg4-D4)))\n",
+ "v=v*1000.0\n",
+ "\n",
+ "#result\n",
"print('V0=%d mV' %v)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V0=600 mV"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.5, Page Number:211<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''output voltage of quartz piezoelectric crystal'''",
- "",
- "#variable declaration",
- "g=0.06 # voltage sensitivity",
- "",
- "#calculation",
- "t=2.5*10**-3",
- "p=20*9.8*10**4",
- "E=g*t*p",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "g=0.06 # voltage sensitivity\n",
+ "\n",
+ "#calculation\n",
+ "t=2.5*10**-3\n",
+ "p=20*9.8*10**4\n",
+ "E=g*t*p\n",
+ "\n",
+ "#Result\n",
"print('E=%d V' %E)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"E=294 V"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.6, Page Number: 211<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Differential values of capacitor'''",
- "",
- "#resistance in Ohm",
- "c0=25.0 # capacitance in pF",
- "x0=0.5 # distance between plates",
- "x1=0.05 # steady state displacement ",
- "",
- "#calculations",
- "c1=c0*x0/(x0-x1)",
- "c2=c0*x0/(x0+x1)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#resistance in Ohm\n",
+ "c0=25.0 # capacitance in pF\n",
+ "x0=0.5 # distance between plates\n",
+ "x1=0.05 # steady state displacement \n",
+ "\n",
+ "#calculations\n",
+ "c1=c0*x0/(x0-x1)\n",
+ "c2=c0*x0/(x0+x1)\n",
+ "\n",
+ "#result\n",
"print('C1=%.2f pF\\nC2=%.2f pF'%(c1,c2))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "C1=27.78 pF",
+ "C1=27.78 pF\n",
"C2=22.73 pF"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.7, Page Number: 211<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Specific Gravity Conversion'''",
- "",
- "#(a)",
- "",
- "#Specific gravity at 60 degree F",
- "sg_at_60=1.02",
- "",
- "#calculation",
- "API=(141.5/sg_at_60)-131.5",
- "",
- "#result",
- "print('(a)\\nDegrees API = %.2f\u00b0API' %API)",
- "",
- "#(b)",
- "",
- "#calculation",
- "Be=145-145/sg_at_60",
- "",
- "#result",
- "print('\\n(b)\\nDegrees Baume(heavy) = %.1f\u00b0Be' %Be)",
- "",
- "",
- "#(c)",
- "",
- "#calculation",
- "Bk=(sg_at_60-1)*1000",
- "",
- "#result",
- "print('\\n(c)\\nDegrees Barkometer = %d\u00b0Bk' %Bk)",
- "",
- "#(d)",
- "",
- "#calculation",
- "Q=(sg_at_60-1)*1000",
- "",
- "#result",
- "print('\\n(c)\\nDegrees Quevenne = %d\u00b0Q' %Q)",
- "",
- "#(e)",
- "",
- "#calculation",
- "Tw=200*(sg_at_60-1.0)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#Specific gravity at 60 degree F\n",
+ "sg_at_60=1.02\n",
+ "\n",
+ "#calculation\n",
+ "API=(141.5/sg_at_60)-131.5\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nDegrees API = %.2f\u00b0API' %API)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#calculation\n",
+ "Be=145-145/sg_at_60\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)\\nDegrees Baume(heavy) = %.1f\u00b0Be' %Be)\n",
+ "\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#calculation\n",
+ "Bk=(sg_at_60-1)*1000\n",
+ "\n",
+ "#result\n",
+ "print('\\n(c)\\nDegrees Barkometer = %d\u00b0Bk' %Bk)\n",
+ "\n",
+ "#(d)\n",
+ "\n",
+ "#calculation\n",
+ "Q=(sg_at_60-1)*1000\n",
+ "\n",
+ "#result\n",
+ "print('\\n(c)\\nDegrees Quevenne = %d\u00b0Q' %Q)\n",
+ "\n",
+ "#(e)\n",
+ "\n",
+ "#calculation\n",
+ "Tw=200*(sg_at_60-1.0)\n",
+ "\n",
+ "#result\n",
"print('\\n(d)\\nDegrees Twaddel = %d\u00b0Tw' %Tw)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "Degrees API = 7.23\u00b0API",
- "",
- "(b)",
- "Degrees Baume(heavy) = 2.8\u00b0Be",
- "",
- "(c)",
- "Degrees Barkometer = 20\u00b0Bk",
- "",
- "(c)",
- "Degrees Quevenne = 20\u00b0Q",
- "",
- "(d)",
+ "(a)\n",
+ "Degrees API = 7.23\u00b0API\n",
+ "\n",
+ "(b)\n",
+ "Degrees Baume(heavy) = 2.8\u00b0Be\n",
+ "\n",
+ "(c)\n",
+ "Degrees Barkometer = 20\u00b0Bk\n",
+ "\n",
+ "(c)\n",
+ "Degrees Quevenne = 20\u00b0Q\n",
+ "\n",
+ "(d)\n",
"Degrees Twaddel = 4\u00b0Tw"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.8, Page NUmber: 212<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of the volume of displacer'''",
- "",
- "import math",
- "",
- "#variable Declaration",
- "T=0.5 # Torque Tube Force",
- "sg1=1.02 # Maximum spe.gravity to be measured",
- "sg2=0.98 # Minimum spe.gravity to be measured",
- "wt=1000*10**-6",
- "",
- "#calculation",
- "v=T/((sg1-sg2)*wt)",
- "v=math.ceil(v)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable Declaration\n",
+ "T=0.5 # Torque Tube Force\n",
+ "sg1=1.02 # Maximum spe.gravity to be measured\n",
+ "sg2=0.98 # Minimum spe.gravity to be measured\n",
+ "wt=1000*10**-6\n",
+ "\n",
+ "#calculation\n",
+ "v=T/((sg1-sg2)*wt)\n",
+ "v=math.ceil(v)\n",
+ "\n",
+ "#result\n",
"print('V=%d cm^3' %v)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V=12500 cm^3"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.9, Page Number: 212<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Differential pressure Sensor'''",
- "",
- "import math",
- "",
- "#variavle declaration",
- "sg1=0.85 # Maximum spe.gravity to be measured",
- "sg2=0.8 # Minimum spe.gravity to be measured",
- "span=150.0 # D/P cell span",
- "",
- "",
- "#a",
- "",
- "#calculation",
- "H=span/(sg1-sg2)",
- "",
- "#result",
- "print('(a)\\nH=%d mm = %dm' %(H,H/1000))",
- "",
- "#b",
- "",
- "#calculation",
- "span_min=1500.0",
- "span2=span_min*(sg1-sg2)",
- "span2=math.ceil(span2)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variavle declaration\n",
+ "sg1=0.85 # Maximum spe.gravity to be measured\n",
+ "sg2=0.8 # Minimum spe.gravity to be measured\n",
+ "span=150.0 # D/P cell span\n",
+ "\n",
+ "\n",
+ "#a\n",
+ "\n",
+ "#calculation\n",
+ "H=span/(sg1-sg2)\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nH=%d mm = %dm' %(H,H/1000))\n",
+ "\n",
+ "#b\n",
+ "\n",
+ "#calculation\n",
+ "span_min=1500.0\n",
+ "span2=span_min*(sg1-sg2)\n",
+ "span2=math.ceil(span2)\n",
+ "\n",
+ "#result\n",
"print('\\n(b)\\nD/P span = %d mm' %span2)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "H=3000 mm = 3m",
- "",
- "(b)",
+ "(a)\n",
+ "H=3000 mm = 3m\n",
+ "\n",
+ "(b)\n",
"D/P span = 75 mm"
]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.10, Page Number:212<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Specific Gravity of unknown liquid'''",
- "",
- "#variable declaration",
- "Ww=12-2 # Width of water",
- "dw=1000.0 # density of water",
- "",
- "#calculation",
- "v=Ww/dw",
- "dx=(10-2)/v",
- "sg=dx/dw ",
- "",
- "#result",
+ "\n",
+ "#variable declaration\n",
+ "Ww=12-2 # Width of water\n",
+ "dw=1000.0 # density of water\n",
+ "\n",
+ "#calculation\n",
+ "v=Ww/dw\n",
+ "dx=(10-2)/v\n",
+ "sg=dx/dw \n",
+ "\n",
+ "#result\n",
"print('Specific Gravity of X =%.1f' %sg)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Specific Gravity of X =0.8"
]
}
- ],
+ ],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.11, PAge Number: 213<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of specific gravity'''",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "wt=1.5 # weight of object",
- " ",
- "#calculation",
- "v_obj=2.0/1000",
- "dx=wt/v_obj",
- "sg=dx/1000",
- "",
- "#result",
- "print('(a)\\nSpecific Gravity = %.2f' %sg)",
- "",
- "#(b)",
- "",
- "sgl=0.8 # specific grav of liquid",
- "dens=800.0 # density",
- "",
- "#calculation",
- "W1=dens*v_obj-wt",
- "",
- "#result",
- "print('\\n(b)\\nW1 = %.1f kg' %W1)",
- "",
- "",
- "#(c)",
- "",
- "#variable declaration",
- "sg2=1.2 # spe. grav.",
- "dens2=1200.0 # density",
- "",
- "#calculation",
- "W2=dens2*v_obj-wt",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "wt=1.5 # weight of object\n",
+ " \n",
+ "#calculation\n",
+ "v_obj=2.0/1000\n",
+ "dx=wt/v_obj\n",
+ "sg=dx/1000\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nSpecific Gravity = %.2f' %sg)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "sgl=0.8 # specific grav of liquid\n",
+ "dens=800.0 # density\n",
+ "\n",
+ "#calculation\n",
+ "W1=dens*v_obj-wt\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)\\nW1 = %.1f kg' %W1)\n",
+ "\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#variable declaration\n",
+ "sg2=1.2 # spe. grav.\n",
+ "dens2=1200.0 # density\n",
+ "\n",
+ "#calculation\n",
+ "W2=dens2*v_obj-wt\n",
+ "\n",
+ "#result\n",
"print('\\n(c)\\nW2 = %.1f kg' %W2)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "Specific Gravity = 0.75",
- "",
- "(b)",
- "W1 = 0.1 kg",
- "",
- "(c)",
+ "(a)\n",
+ "Specific Gravity = 0.75\n",
+ "\n",
+ "(b)\n",
+ "W1 = 0.1 kg\n",
+ "\n",
+ "(c)\n",
"W2 = 0.9 kg"
]
}
- ],
+ ],
"prompt_number": 11
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Industrial_Instrumentation/Chapter_5.ipynb b/Industrial_Instrumentation/Chapter_5.ipynb
index fa1d0762..4ec568e3 100644
--- a/Industrial_Instrumentation/Chapter_5.ipynb
+++ b/Industrial_Instrumentation/Chapter_5.ipynb
@@ -1,874 +1,918 @@
{
"metadata": {
- "name": "Chapter_5"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:6f1ee33190d8c693b6015349dc3ea8fa65731657e9afb9deaa10542a8aa4bde7"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 5: Flow <h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.1, Page Number: 310<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''flow rate calulation'''",
- "",
- "import math",
- "#(i)",
- "",
- "#variable declaration",
- "d=75.0*10**-3 # diameter of pipe",
- "a=math.pi*d**2/4 # area of cross section of pipe",
- "v=760.0*10**-3 # flow velocity",
- "",
- "#calculation",
- "Q=v*a",
- "Q=Q*10**3",
- "print('(i)\\nVolume Flow Rate Q=%.3f *10^-3 m^3/sec' %Q)",
- "rho=1000.0",
- "W=rho*Q*10**-3",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "#(i)\n",
+ "\n",
+ "#variable declaration\n",
+ "d=75.0*10**-3 # diameter of pipe\n",
+ "a=math.pi*d**2/4 # area of cross section of pipe\n",
+ "v=760.0*10**-3 # flow velocity\n",
+ "\n",
+ "#calculation\n",
+ "Q=v*a\n",
+ "Q=Q*10**3\n",
+ "print('(i)\\nVolume Flow Rate Q=%.3f *10^-3 m^3/sec' %Q)\n",
+ "rho=1000.0\n",
+ "W=rho*Q*10**-3\n",
+ "\n",
+ "#result\n",
"print('\\n(ii)\\nMass Flow rate W=%.3f kg/sec' %W)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(i)",
- "Volume Flow Rate Q=3.358 *10^-3 m^3/sec",
- "",
- "(ii)",
+ "(i)\n",
+ "Volume Flow Rate Q=3.358 *10^-3 m^3/sec\n",
+ "\n",
+ "(ii)\n",
"Mass Flow rate W=3.358 kg/sec"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.2, page Number:310<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Volumetric flow rate calculation'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "D=40.0 # Diameter of pipe",
- "d=20.0 # Diameter of Orifice",
- "mr=15.0 # Manometer reading",
- "",
- "#calculation",
- "h=(13.6-1)*15.0*10.0",
- "B=d/D",
- "M=1/math.sqrt(1-(B**4))",
- "Cd=0.5999",
- "x=math.sqrt(2*9.8*h*(10**-3))",
- "Q=x*Cd*M*(math.pi*((20*(10**-3))**2))/4",
- "Q=Q*3600.0",
- "",
- "#result",
- "print('Volumetric flow rate Q= %.4f m^3/hr' %Q)",
- "#Answer slightly deviates from answer given in the book because of pi value.",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "D=40.0 # Diameter of pipe\n",
+ "d=20.0 # Diameter of Orifice\n",
+ "mr=15.0 # Manometer reading\n",
+ "\n",
+ "#calculation\n",
+ "h=(13.6-1)*15.0*10.0\n",
+ "B=d/D\n",
+ "M=1/math.sqrt(1-(B**4))\n",
+ "Cd=0.5999\n",
+ "x=math.sqrt(2*9.8*h*(10**-3))\n",
+ "Q=x*Cd*M*(math.pi*((20*(10**-3))**2))/4\n",
+ "Q=Q*3600.0\n",
+ "\n",
+ "#result\n",
+ "print('Volumetric flow rate Q= %.4f m^3/hr' %Q)\n",
+ "#Answer slightly deviates from answer given in the book because of pi value.\n",
"#if pi=3.14, then answer is same as in textbook "
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Volumetric flow rate Q= 4.2649 m^3/hr"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.3, Page Number: 310<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Nominal flow velocity'''",
- "",
- "import math",
- "#variable declaration",
- "Re=10.0**5 # Reynolds number",
- "D=40.0*10**-3 # Diameter of pipe ",
- "v=10**-6 # Kinematic viscosity in m^2/sec",
- "",
- "#calculation",
- "V1=Re*v/D",
- "A1=(math.pi*(40.0*10**-3)**2)/4",
- "A2=(math.pi*(20.0*10**-3)**2)/4",
- "V2=V1*A1/A2",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "Re=10.0**5 # Reynolds number\n",
+ "D=40.0*10**-3 # Diameter of pipe \n",
+ "v=10**-6 # Kinematic viscosity in m^2/sec\n",
+ "\n",
+ "#calculation\n",
+ "V1=Re*v/D\n",
+ "A1=(math.pi*(40.0*10**-3)**2)/4\n",
+ "A2=(math.pi*(20.0*10**-3)**2)/4\n",
+ "V2=V1*A1/A2\n",
+ "\n",
+ "#result\n",
"print('V2=%.1f m/sec' %V2)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V2=10.0 m/sec"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.4, Page Number: 311<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''pressure difference calculation'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "Cd=0.61 # discharge coefficient",
- "D=40.0*10**-3 # Diameter of pipe",
- "d=20.0*10**-3 # Diameter of Orifice ",
- "",
- "#calculation",
- "M=1/math.sqrt(1-(d/D)**4)",
- "V2=10.0",
- "rho=1000.0",
- "g=9.8",
- "X=V2*math.sqrt(rho/(2*g))/(Cd*M)",
- "p_diff=X**2",
- "p_diff=math.floor(p_diff/100)",
- "p_diff=p_diff/100.0",
- "",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "Cd=0.61 # discharge coefficient\n",
+ "D=40.0*10**-3 # Diameter of pipe\n",
+ "d=20.0*10**-3 # Diameter of Orifice \n",
+ "\n",
+ "#calculation\n",
+ "M=1/math.sqrt(1-(d/D)**4)\n",
+ "V2=10.0\n",
+ "rho=1000.0\n",
+ "g=9.8\n",
+ "X=V2*math.sqrt(rho/(2*g))/(Cd*M)\n",
+ "p_diff=X**2\n",
+ "p_diff=math.floor(p_diff/100)\n",
+ "p_diff=p_diff/100.0\n",
+ "\n",
+ "\n",
+ "#result\n",
"print('P1-P2 = %.2f kg/cm^2'%p_diff)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"P1-P2 = 1.28 kg/cm^2"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.5, Page Number: 312<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''volume flow rate for orifice and venturi Tubes'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "Cd=0.6 # discharge coefficient",
- "D=150.0*10**-3 # Diameter of pipe",
- "d=75.0*10**-3 # Diameter of Orifice ",
- "p=250.0 # pressure recorded",
- "g=9.8 # acceleration due to gravity",
- "rho=1000.0 # Water density ",
- "s=75.0*10**-3 # venturi tube size",
- "",
- "#(a)",
- "",
- "#calculation",
- "Q=Cd*math.pi*s**2*math.sqrt(2*g*p/rho)/(4*math.sqrt(1-(d/D)**4)) ",
- "",
- "#result",
- "print('(a) For orifice plate\\nQ=%f m^3/sec = %.3f litres/sec'%(Q,Q*1000))",
- "",
- "#calculation",
- "Cd1=0.99",
- "Q2=Cd1*math.pi*s**2*math.sqrt(2*g*p/rho)/(4*math.sqrt(1-(d/D)**4))",
- "",
- "#result",
- "print('\\n\\n(b)For venturi tube\\nQ=%f m^3/sec = %.2f litres/sec'%(Q2,Q2*1000))",
- "#Answer slightly deviates from answer given in the book because of pi value.",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "Cd=0.6 # discharge coefficient\n",
+ "D=150.0*10**-3 # Diameter of pipe\n",
+ "d=75.0*10**-3 # Diameter of Orifice \n",
+ "p=250.0 # pressure recorded\n",
+ "g=9.8 # acceleration due to gravity\n",
+ "rho=1000.0 # Water density \n",
+ "s=75.0*10**-3 # venturi tube size\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#calculation\n",
+ "Q=Cd*math.pi*s**2*math.sqrt(2*g*p/rho)/(4*math.sqrt(1-(d/D)**4)) \n",
+ "\n",
+ "#result\n",
+ "print('(a) For orifice plate\\nQ=%f m^3/sec = %.3f litres/sec'%(Q,Q*1000))\n",
+ "\n",
+ "#calculation\n",
+ "Cd1=0.99\n",
+ "Q2=Cd1*math.pi*s**2*math.sqrt(2*g*p/rho)/(4*math.sqrt(1-(d/D)**4))\n",
+ "\n",
+ "#result\n",
+ "print('\\n\\n(b)For venturi tube\\nQ=%f m^3/sec = %.2f litres/sec'%(Q2,Q2*1000))\n",
+ "#Answer slightly deviates from answer given in the book because of pi value.\n",
"#if pi=3.14, then answer is same as in textbook "
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a) For orifice plate",
- "Q=0.006060 m^3/sec = 6.060 litres/sec",
- "",
- "",
- "(b)For venturi tube",
+ "(a) For orifice plate\n",
+ "Q=0.006060 m^3/sec = 6.060 litres/sec\n",
+ "\n",
+ "\n",
+ "(b)For venturi tube\n",
"Q=0.009999 m^3/sec = 10.00 litres/sec"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.6, Page Number: 312<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''determination of Reynolds number'''",
- "",
- "import math",
- "",
- "#(i)",
- "",
- "#variable declaration",
- "V=0.02 # volumetric flow rate",
- "d=10*10**-2 # Diameter of pipe",
- "",
- "#calculation",
- "A=math.pi*d**2/4",
- "v=V/A",
- "rho=1000.0",
- "Re=rho*v*d/10**-3",
- "Re=Re/100000.0",
- "",
- "#result",
- "print('(i)\\nReynolds number(Re) = %.3f * 10^5'%Re)",
- "",
- "#(ii)",
- "",
- "#variable declaration",
- "Cd=0.98 # discharge coefficient ",
- "D=20*10**-2 # Diameter of pipe ",
- "d=10*10**-2 # Diameter of orifice",
- "",
- "#calculation",
- "M=1/math.sqrt(1-(d/D)**4)",
- "a2=math.pi*d**2/4",
- "Q=0.02",
- "g=9.8",
- "X=Q*math.sqrt(rho)/(M*Cd*a2*math.sqrt(2*g))",
- "p_diff=math.ceil(X**2)",
- "",
- "#result",
- "print('\\n(ii)\\nPressur_difference = %d kg/m^2 = %.4f kg/cm^2'%(p_diff,p_diff/10000))",
- "#Answer slightly deviates from answer given in the book because of pi value.",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#(i)\n",
+ "\n",
+ "#variable declaration\n",
+ "V=0.02 # volumetric flow rate\n",
+ "d=10*10**-2 # Diameter of pipe\n",
+ "\n",
+ "#calculation\n",
+ "A=math.pi*d**2/4\n",
+ "v=V/A\n",
+ "rho=1000.0\n",
+ "Re=rho*v*d/10**-3\n",
+ "Re=Re/100000.0\n",
+ "\n",
+ "#result\n",
+ "print('(i)\\nReynolds number(Re) = %.3f * 10^5'%Re)\n",
+ "\n",
+ "#(ii)\n",
+ "\n",
+ "#variable declaration\n",
+ "Cd=0.98 # discharge coefficient \n",
+ "D=20*10**-2 # Diameter of pipe \n",
+ "d=10*10**-2 # Diameter of orifice\n",
+ "\n",
+ "#calculation\n",
+ "M=1/math.sqrt(1-(d/D)**4)\n",
+ "a2=math.pi*d**2/4\n",
+ "Q=0.02\n",
+ "g=9.8\n",
+ "X=Q*math.sqrt(rho)/(M*Cd*a2*math.sqrt(2*g))\n",
+ "p_diff=math.ceil(X**2)\n",
+ "\n",
+ "#result\n",
+ "print('\\n(ii)\\nPressur_difference = %d kg/m^2 = %.4f kg/cm^2'%(p_diff,p_diff/10000))\n",
+ "#Answer slightly deviates from answer given in the book because of pi value.\n",
"#if pi=3.14, then answer is same as in textbook "
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(i)",
- "Reynolds number(Re) = 2.546 * 10^5",
- "",
- "(ii)",
+ "(i)\n",
+ "Reynolds number(Re) = 2.546 * 10^5\n",
+ "\n",
+ "(ii)\n",
"Pressur_difference = 323 kg/m^2 = 0.0323 kg/cm^2"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.7, Page Number: 313<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Fluid velocity and Volumetric flow rate'''",
- "",
- "import math",
- "",
- "#1kg/m^2=10 meters water head",
- "",
- "#variable declaration",
- "g=9.81 #acceleration due to gravity",
- "h=20.0 #height",
- "",
- "#calculation",
- "v=math.sqrt(2*g*h)",
- "d=300.0*10**-3",
- "A=(math.pi*d**2)/4",
- "A=math.floor(A*1000)",
- "A=A/1000.0",
- "Q=A*v",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#1kg/m^2=10 meters water head\n",
+ "\n",
+ "#variable declaration\n",
+ "g=9.81 #acceleration due to gravity\n",
+ "h=20.0 #height\n",
+ "\n",
+ "#calculation\n",
+ "v=math.sqrt(2*g*h)\n",
+ "d=300.0*10**-3\n",
+ "A=(math.pi*d**2)/4\n",
+ "A=math.floor(A*1000)\n",
+ "A=A/1000.0\n",
+ "Q=A*v\n",
+ "\n",
+ "#result\n",
"print('Q = %.3f m^3/sec'%Q)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Q = 1.387 m^3/sec"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.8, Page Number:313<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Fluid velocity calculation'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "Cd=0.6 # coefficient of discharge ",
- "g=9.8 #acceleration due to gravity",
- "h=400*10**-3 #height",
- "",
- "#calculation",
- "V=Cd*math.sqrt(2*g*h)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "Cd=0.6 # coefficient of discharge \n",
+ "g=9.8 #acceleration due to gravity\n",
+ "h=400*10**-3 #height\n",
+ "\n",
+ "#calculation\n",
+ "V=Cd*math.sqrt(2*g*h)\n",
+ "\n",
+ "#result\n",
"print('V = %.2f m/sec' %V)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V = 1.68 m/sec"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.9, Page Number: 314<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''velocity measurement using pilot tube'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "Cd=0.98 # coefficient of discharge",
- "g=9.8 #acceleration due to gravity",
- "h=900.0*10**-3 #height",
- "",
- "#calculation",
- "V=Cd*math.sqrt(2*g*h)",
- "V=math.floor(V*100)",
- "V=(V/100.0)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "Cd=0.98 # coefficient of discharge\n",
+ "g=9.8 #acceleration due to gravity\n",
+ "h=900.0*10**-3 #height\n",
+ "\n",
+ "#calculation\n",
+ "V=Cd*math.sqrt(2*g*h)\n",
+ "V=math.floor(V*100)\n",
+ "V=(V/100.0)\n",
+ "\n",
+ "#result\n",
"print('V = %.2f m/sec' %V)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V = 4.11 m/sec"
]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.10, Page Number:314<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Determination of flow velocity'''",
- "",
- "import math",
- "",
- "#Variable declaration",
- "del_p=20*10**3 #Pa",
- "dens_water=1000 #kg/m^3",
- "dens_air=1.29 #kg/m^3",
- "",
- "#calculations",
- "",
- "#(i)When flowing fluid is water",
- "v=math.sqrt(2*del_p/dens_water)",
- "",
- "#(ii)When flowing fluid is air",
- "v1=math.sqrt(2*del_p/dens_air)",
- "",
- "#result",
- "print('\\n(i)When flowing fluid is water\\n\\tV=%.3f m/sec'%v)",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "del_p=20*10**3 #Pa\n",
+ "dens_water=1000 #kg/m^3\n",
+ "dens_air=1.29 #kg/m^3\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#(i)When flowing fluid is water\n",
+ "v=math.sqrt(2*del_p/dens_water)\n",
+ "\n",
+ "#(ii)When flowing fluid is air\n",
+ "v1=math.sqrt(2*del_p/dens_air)\n",
+ "\n",
+ "#result\n",
+ "print('\\n(i)When flowing fluid is water\\n\\tV=%.3f m/sec'%v)\n",
"print('\\n(ii)When flowing fluid is air\\n\\tV=%.0f m/sec'%v1)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "",
- "(i)When flowing fluid is water",
- "\tV=6.325 m/sec",
- "",
- "(ii)When flowing fluid is air",
+ "\n",
+ "(i)When flowing fluid is water\n",
+ "\tV=6.325 m/sec\n",
+ "\n",
+ "(ii)When flowing fluid is air\n",
"\tV=176 m/sec"
]
}
- ],
+ ],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.11, Page Number: 314<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''detemination of flow velocity'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "dens=1026.0 # density of see water",
- "p=25.0*10**3 # pressure difference in manometer ",
- "",
- "#calculation",
- "V=math.sqrt(2*p/dens)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "dens=1026.0 # density of see water\n",
+ "p=25.0*10**3 # pressure difference in manometer \n",
+ "\n",
+ "#calculation\n",
+ "V=math.sqrt(2*p/dens)\n",
+ "\n",
+ "#result\n",
"print('V=%.2f m/sec =%.3f km/hr'%(V,V*18/5))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V=6.98 m/sec =25.131 km/hr"
]
}
- ],
+ ],
"prompt_number": 11
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.12, Page Number: 314<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of flying speed of aircraft'''",
- "import math",
- "",
- "# variable declaration",
- "dens=1.29 # air density at height ",
- "",
- "#calculation",
- "p=12.5*1000",
- "V=math.sqrt(2*p/dens)",
- "",
- "",
- "#result",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "dens=1.29 # air density at height \n",
+ "\n",
+ "#calculation\n",
+ "p=12.5*1000\n",
+ "V=math.sqrt(2*p/dens)\n",
+ "\n",
+ "\n",
+ "#result\n",
"print('V=%.2f m/sec =%.2f km/hr'%(V,V*18/5))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V=139.21 m/sec =501.16 km/hr"
]
}
- ],
+ ],
"prompt_number": 12
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.13, Page Number: 315<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Maximum fluid handling capacity of Rotameter'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "Cd=0.6 # discharge coefficient",
- "Dp=0.05 # inside diameter of metering tube ",
- "Df=0.035 # diameter of rotameter ",
- "g=9.8 # acceleration due to gravity",
- "rho_f=3.9*10**3 # density of cylindrical float",
- "rho=1000.0 # water density ",
- "Vf=3.36*10**-5 # volume of the float",
- "",
- "#calculation",
- "Q=Cd*((Dp**2-Df**2)/Df)*math.sqrt(math.pi*g*Vf*(rho_f-rho)/(2*rho))",
- "Q=Q*10000.0",
- "",
- "#result",
- "print('Volumetric flow Q=%.4f *10^-4 m^3/sec' %Q)",
- "#Answer slightly deviates from answer given in the book because of pi value.",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "Cd=0.6 # discharge coefficient\n",
+ "Dp=0.05 # inside diameter of metering tube \n",
+ "Df=0.035 # diameter of rotameter \n",
+ "g=9.8 # acceleration due to gravity\n",
+ "rho_f=3.9*10**3 # density of cylindrical float\n",
+ "rho=1000.0 # water density \n",
+ "Vf=3.36*10**-5 # volume of the float\n",
+ "\n",
+ "#calculation\n",
+ "Q=Cd*((Dp**2-Df**2)/Df)*math.sqrt(math.pi*g*Vf*(rho_f-rho)/(2*rho))\n",
+ "Q=Q*10000.0\n",
+ "\n",
+ "#result\n",
+ "print('Volumetric flow Q=%.4f *10^-4 m^3/sec' %Q)\n",
+ "#Answer slightly deviates from answer given in the book because of pi value.\n",
"#if pi=3.14, then answer is same as in textbook "
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Volumetric flow Q=8.4652 *10^-4 m^3/sec"
]
}
- ],
+ ],
"prompt_number": 13
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.14, Page number: 315<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Determination of range of flow for ratameter'''",
- "",
- "import math",
- "# variable declaration",
- "Cd=1 # discharge coefficient",
- "Dp=0.018 # inside diameter of metering tube ",
- "Df=0.015 # diameter of rotameter ",
- "g=9.81 # acceleration due to gravity",
- "rho_f=2.7 # density of cylindrical float",
- "rho=0.8 # water density ",
- "Vf=520.0*10**-9 # volume of the float",
- "",
- "#case 1",
- "",
- "#caculation",
- "Qmin=Cd*((Dp**2-Df**2)/Df)*math.sqrt(math.pi*g*Vf*(rho_f-rho)/(2*rho))",
- "Qmin=Qmin*100000.0",
- "",
- "#result",
- "print('Case 1: When float is at the bottom\\n Volumetric flow Qmin=%.3f *10^-5 m^3/sec'%Qmin)",
- "",
- "#case 2",
- "",
- "#calculation",
- "Dp2=0.0617",
- "Qmax=Cd*((Dp2**2-Df**2)/Df)*math.sqrt(math.pi*g*Vf*(rho_f-rho)/(2*rho))",
- "Qmax=Qmax*100000",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "# variable declaration\n",
+ "Cd=1 # discharge coefficient\n",
+ "Dp=0.018 # inside diameter of metering tube \n",
+ "Df=0.015 # diameter of rotameter \n",
+ "g=9.81 # acceleration due to gravity\n",
+ "rho_f=2.7 # density of cylindrical float\n",
+ "rho=0.8 # water density \n",
+ "Vf=520.0*10**-9 # volume of the float\n",
+ "\n",
+ "#case 1\n",
+ "\n",
+ "#caculation\n",
+ "Qmin=Cd*((Dp**2-Df**2)/Df)*math.sqrt(math.pi*g*Vf*(rho_f-rho)/(2*rho))\n",
+ "Qmin=Qmin*100000.0\n",
+ "\n",
+ "#result\n",
+ "print('Case 1: When float is at the bottom\\n Volumetric flow Qmin=%.3f *10^-5 m^3/sec'%Qmin)\n",
+ "\n",
+ "#case 2\n",
+ "\n",
+ "#calculation\n",
+ "Dp2=0.0617\n",
+ "Qmax=Cd*((Dp2**2-Df**2)/Df)*math.sqrt(math.pi*g*Vf*(rho_f-rho)/(2*rho))\n",
+ "Qmax=Qmax*100000\n",
+ "\n",
+ "#result\n",
"print('\\n\\nCase 2: When float is at the bottom\\n Volumetric flow Qmax=%.2f *10^-5 m^3/sec'%Qmax)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Case 1: When float is at the bottom",
- " Volumetric flow Qmin=2.879 *10^-5 m^3/sec",
- "",
- "",
- "Case 2: When float is at the bottom",
+ "Case 1: When float is at the bottom\n",
+ " Volumetric flow Qmin=2.879 *10^-5 m^3/sec\n",
+ "\n",
+ "\n",
+ "Case 2: When float is at the bottom\n",
" Volumetric flow Qmax=104.17 *10^-5 m^3/sec"
]
}
- ],
+ ],
"prompt_number": 14
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.15, Page Number:316<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of coal delivery for coal conveyor system'''",
- "",
- "# variable declaration",
- "W=165.0 # weight of material on section of length",
- "R=328.0 # Conveyor speed m/min",
- "L=16.0 # Length of weighting platform in m",
- "",
- "#calculation",
- "Q=W*R/L",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "W=165.0 # weight of material on section of length\n",
+ "R=328.0 # Conveyor speed m/min\n",
+ "L=16.0 # Length of weighting platform in m\n",
+ "\n",
+ "#calculation\n",
+ "Q=W*R/L\n",
+ "\n",
+ "#result\n",
"print('Flow Rate Q=%.2f kg/min =%.1f kg/hour'%(Q,Q/60))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Flow Rate Q=3382.50 kg/min =56.4 kg/hour"
]
}
- ],
+ ],
"prompt_number": 15
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.16, Page Number:316<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Fluid velocity calculation'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "f=100.0 # beat frequency",
- "d=300.0*10**-3 # Sound path",
- "a=45.0 #angle between transmeter and receiver in degrees",
- "",
- "#calculation",
- "a_rad=45.0*math.pi/180.0",
- "v=f*d/(2*math.cos(a_rad))",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "f=100.0 # beat frequency\n",
+ "d=300.0*10**-3 # Sound path\n",
+ "a=45.0 #angle between transmeter and receiver in degrees\n",
+ "\n",
+ "#calculation\n",
+ "a_rad=45.0*math.pi/180.0\n",
+ "v=f*d/(2*math.cos(a_rad))\n",
+ "\n",
+ "#Result\n",
"print('Fluid Velocity V=%.1f m/sec'%v)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Fluid Velocity V=21.2 m/sec"
]
}
- ],
+ ],
"prompt_number": 16
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.17, Page Number: 316<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''volume flow rate'''",
- "",
- "# variable declaration",
- "r=150.0 # speed of rotation",
- "v=120.0 # volume trapped between gears and casting",
- "",
- "#clculation",
- "Q=4.0*v*r",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "r=150.0 # speed of rotation\n",
+ "v=120.0 # volume trapped between gears and casting\n",
+ "\n",
+ "#clculation\n",
+ "Q=4.0*v*r\n",
+ "\n",
+ "#result\n",
"print('Volume flow rate Q=%d cm^3/min = %d litres/min'%(Q,Q/1000))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Volume flow rate Q=72000 cm^3/min = 72 litres/min"
]
}
- ],
+ ],
"prompt_number": 17
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.18, Page Number: 317<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''induced emf in electromagnetic flow meter'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "Q=2500.0 # Quantitty flow rate",
- "d=2.75 # inner diameter",
- "",
- "#calculation",
- "a=(math.pi*d**2)/4",
- "v=Q/(60*a)",
- "B=60.0",
- "e=B*d*10**-2*v*10**-2",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "Q=2500.0 # Quantitty flow rate\n",
+ "d=2.75 # inner diameter\n",
+ "\n",
+ "#calculation\n",
+ "a=(math.pi*d**2)/4\n",
+ "v=Q/(60*a)\n",
+ "B=60.0\n",
+ "e=B*d*10**-2*v*10**-2\n",
+ "\n",
+ "#result\n",
"print('Induced emf e =%.4f V=%.1f mV'%(e,e*1000))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Induced emf e =0.1157 V=115.7 mV"
]
}
- ],
+ ],
"prompt_number": 18
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.19, Pae Number:317<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''velocity of flow in electromagnetic flow meter'''",
- "",
- "# variable declaration",
- "e=0.2*10**-3 # voltage of electromagnetic flow meter",
- "B=0.08 # Flux density",
- "l=10.0*10**-2 # Diameter of pipe",
- "",
- "#calculation",
- "v=e/(B*l)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "e=0.2*10**-3 # voltage of electromagnetic flow meter\n",
+ "B=0.08 # Flux density\n",
+ "l=10.0*10**-2 # Diameter of pipe\n",
+ "\n",
+ "#calculation\n",
+ "v=e/(B*l)\n",
+ "\n",
+ "#result\n",
"print('V = %.3f m/sec = %.2f cm/sec'%(v,v*100))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V = 0.025 m/sec = 2.50 cm/sec"
]
}
- ],
+ ],
"prompt_number": 19
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.20, Page Number: 317<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''average velocity of flow in electromagnetic flow meter'''",
- "",
- "# variable declaration",
- "ei=0.15*10**-3 # peak value",
- "em=2*ei # p-p amplifier output ",
- "B=0.1 # flux density",
- "l=60.0*10**-3 # diameter of the pipe",
- "",
- "#calculation",
- "v=em/(B*l)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "ei=0.15*10**-3 # peak value\n",
+ "em=2*ei # p-p amplifier output \n",
+ "B=0.1 # flux density\n",
+ "l=60.0*10**-3 # diameter of the pipe\n",
+ "\n",
+ "#calculation\n",
+ "v=em/(B*l)\n",
+ "\n",
+ "#result\n",
"print('Velocity of flow V = %.2f m/sec = %.1f cm/sec'%(v,v*100))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Velocity of flow V = 0.05 m/sec = 5.0 cm/sec"
]
}
- ],
+ ],
"prompt_number": 20
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Industrial_Instrumentation/Chapter_6.ipynb b/Industrial_Instrumentation/Chapter_6.ipynb
index d3a9a093..bdc5920d 100644
--- a/Industrial_Instrumentation/Chapter_6.ipynb
+++ b/Industrial_Instrumentation/Chapter_6.ipynb
@@ -1,534 +1,558 @@
{
"metadata": {
- "name": "Chapter_6"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:6148d2be2796832e7d2e9cefcc5c361a4c9dc07b22c355b627a74bd914199046"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 6: Level<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.1,Page Number:370<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''output current of two wire pressure transmitter'''",
- "",
- "#(a)",
- "",
- "# variable declaration",
- "p=1.5 # pressure applied",
- "a=4.0 # mA corresponds to 0 kg/cm^2",
- "b=20.0 # mA corresponds to 2 kg/cm^2",
- "",
- "#calculation",
- "wh=(((b-a)/2)*p)+a",
- "",
- "#result",
- "print('(a)just at the bottom level of the tank')",
- "print('Water head applied to the transmitter =%d mA'%wh)",
- "",
- "#(b)",
- "",
- "#calculation",
- "wh2=(((b-a)/2)*p)+2*a",
- "",
- "#result",
- "print('\\n\\n(b)5m below the bottom of the tank')",
- "print('Water head applied to the transmitter =%d mA' %wh2)",
- "",
- "#(c)",
- "",
- "#calculation",
- "wh3=(((b-a)/2)*p)",
- "",
- "#result",
- "print('\\n\\n(c)5m above the bottom of the tank')",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "# variable declaration\n",
+ "p=1.5 # pressure applied\n",
+ "a=4.0 # mA corresponds to 0 kg/cm^2\n",
+ "b=20.0 # mA corresponds to 2 kg/cm^2\n",
+ "\n",
+ "#calculation\n",
+ "wh=(((b-a)/2)*p)+a\n",
+ "\n",
+ "#result\n",
+ "print('(a)just at the bottom level of the tank')\n",
+ "print('Water head applied to the transmitter =%d mA'%wh)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#calculation\n",
+ "wh2=(((b-a)/2)*p)+2*a\n",
+ "\n",
+ "#result\n",
+ "print('\\n\\n(b)5m below the bottom of the tank')\n",
+ "print('Water head applied to the transmitter =%d mA' %wh2)\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#calculation\n",
+ "wh3=(((b-a)/2)*p)\n",
+ "\n",
+ "#result\n",
+ "print('\\n\\n(c)5m above the bottom of the tank')\n",
"print('Water head applied to the transmitter =%d mA'%wh3)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)just at the bottom level of the tank",
- "Water head applied to the transmitter =16 mA",
- "",
- "",
- "(b)5m below the bottom of the tank",
- "Water head applied to the transmitter =20 mA",
- "",
- "",
- "(c)5m above the bottom of the tank",
+ "(a)just at the bottom level of the tank\n",
+ "Water head applied to the transmitter =16 mA\n",
+ "\n",
+ "\n",
+ "(b)5m below the bottom of the tank\n",
+ "Water head applied to the transmitter =20 mA\n",
+ "\n",
+ "\n",
+ "(c)5m above the bottom of the tank\n",
"Water head applied to the transmitter =12 mA"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.2, Page Number:371<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''water level and current at different positions'''",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "b=20.0 # Maximum output",
- "a=4.0 # minimum output ",
- "op=16.0 # output in mA",
- "",
- "#calculation",
- "p=(op-a)*2/(b-a)",
- "p_h=p*10.0",
- "h=p_h-2-5",
- "",
- "#result",
- "print('(a)\\nh = %dm'%h)",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "p1=1 # pressure applied",
- "",
- "#calculation",
- "t_op=((b-a)/2)*p1+4",
- "",
- "#result",
- "print('\\n(b)\\nTransmitter output =%d mA'%t_op)",
- "",
- "#(c)",
- "",
- "#variable declaration",
- "p2=0.5 # applied pressure",
- "",
- "#calculation",
- "t_op1=((b-a)/2)*p2+4",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "b=20.0 # Maximum output\n",
+ "a=4.0 # minimum output \n",
+ "op=16.0 # output in mA\n",
+ "\n",
+ "#calculation\n",
+ "p=(op-a)*2/(b-a)\n",
+ "p_h=p*10.0\n",
+ "h=p_h-2-5\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nh = %dm'%h)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "p1=1 # pressure applied\n",
+ "\n",
+ "#calculation\n",
+ "t_op=((b-a)/2)*p1+4\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)\\nTransmitter output =%d mA'%t_op)\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#variable declaration\n",
+ "p2=0.5 # applied pressure\n",
+ "\n",
+ "#calculation\n",
+ "t_op1=((b-a)/2)*p2+4\n",
+ "\n",
+ "#result\n",
"print('\\n(c)\\nTransmitter output =%d mA'%t_op1)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "h = 8m",
- "",
- "(b)",
- "Transmitter output =12 mA",
- "",
- "(c)",
+ "(a)\n",
+ "h = 8m\n",
+ "\n",
+ "(b)\n",
+ "Transmitter output =12 mA\n",
+ "\n",
+ "(c)\n",
"Transmitter output =8 mA"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.3, Page Number: 372<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Differential pressure output at different levels'''",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "b=20.0 # Maximum output",
- "a=4.0 # minimum output",
- "op=16.0 # actual output ",
- "wt_l1=25.0 # water level (i)",
- "",
- "#calculation",
- "t_op=((b-a)/100)*(100-75)+4",
- "",
- "#result",
- "print('(a)\\nWater level=+25cm\\nTransmitter output = %d mA' %t_op)",
- "",
- "#(b)",
- "",
- "#calculation",
- "wt_l2=-25.0 # water level (ii)",
- "t_op2=((b-a)/100)*(100-25)+4",
- "",
- "#result",
- "print('\\n(b)\\nWater level=-25cm\\nTransmitter output = %d mA' %t_op2)",
- "",
- "#(c)",
- "",
- "#Variable declaration",
- "t_op3=12.0 # Transmitter output ",
- "",
- "#calculation",
- "H=(100.0/(b-a))*(12-4) ",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "b=20.0 # Maximum output\n",
+ "a=4.0 # minimum output\n",
+ "op=16.0 # actual output \n",
+ "wt_l1=25.0 # water level (i)\n",
+ "\n",
+ "#calculation\n",
+ "t_op=((b-a)/100)*(100-75)+4\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nWater level=+25cm\\nTransmitter output = %d mA' %t_op)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#calculation\n",
+ "wt_l2=-25.0 # water level (ii)\n",
+ "t_op2=((b-a)/100)*(100-25)+4\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)\\nWater level=-25cm\\nTransmitter output = %d mA' %t_op2)\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#Variable declaration\n",
+ "t_op3=12.0 # Transmitter output \n",
+ "\n",
+ "#calculation\n",
+ "H=(100.0/(b-a))*(12-4) \n",
+ "\n",
+ "#result\n",
"print('\\n(c)\\nHead Applied = %d cm\\nLevel corresponding to 50 cm head =0 cm' %H)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "Water level=+25cm",
- "Transmitter output = 8 mA",
- "",
- "(b)",
- "Water level=-25cm",
- "Transmitter output = 16 mA",
- "",
- "(c)",
- "Head Applied = 50 cm",
+ "(a)\n",
+ "Water level=+25cm\n",
+ "Transmitter output = 8 mA\n",
+ "\n",
+ "(b)\n",
+ "Water level=-25cm\n",
+ "Transmitter output = 16 mA\n",
+ "\n",
+ "(c)\n",
+ "Head Applied = 50 cm\n",
"Level corresponding to 50 cm head =0 cm"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.4, Page Number: 373<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Displacer with spring balance'''",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "a=5.0*10**-4 #area",
- "l=8.0 #length",
- "dens=6.0*1000.0 #density",
- "",
- "#calculation",
- "w=a*l*dens",
- "",
- "#result",
- "print('(a)\\nWeight of the displacer if weighed in air = %d kg'%w)",
- "",
- "",
- "#(i)",
- "",
- "#variable declaration",
- "sbr1=23.0 # spring balance reading",
- "",
- "#calculation",
- "wloss1=w-sbr1",
- "L1=wloss1/(1000.0*a)",
- "",
- "#result",
- "print('\\n(i)\\tL1=%dm'%L1)",
- "",
- "",
- "#(ii)",
- "",
- "#variable declaration",
- "sbr2=22.0 # spring balance reading",
- "",
- "#calculation",
- "wloss2=w-sbr2",
- "L2=wloss2/(1000.0*a)",
- "",
- "#result",
- "print('\\n(ii)\\tL2=%dm'%L2)",
- "",
- "#(iii)",
- "",
- "#variable declaration",
- "sbr3=21.0 # spring balance reading",
- "",
- "#calculation",
- "wloss3=w-sbr3",
- "L3=wloss3/(1000.0*a)",
- "",
- "#result",
- "print('\\n(iii)\\tL3=%dm'%L3)",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "level=8.0 # level wen tank is full ",
- "",
- "#calculation",
- "wt=a*level*1000.0",
- "spring=w-wt",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "a=5.0*10**-4 #area\n",
+ "l=8.0 #length\n",
+ "dens=6.0*1000.0 #density\n",
+ "\n",
+ "#calculation\n",
+ "w=a*l*dens\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nWeight of the displacer if weighed in air = %d kg'%w)\n",
+ "\n",
+ "\n",
+ "#(i)\n",
+ "\n",
+ "#variable declaration\n",
+ "sbr1=23.0 # spring balance reading\n",
+ "\n",
+ "#calculation\n",
+ "wloss1=w-sbr1\n",
+ "L1=wloss1/(1000.0*a)\n",
+ "\n",
+ "#result\n",
+ "print('\\n(i)\\tL1=%dm'%L1)\n",
+ "\n",
+ "\n",
+ "#(ii)\n",
+ "\n",
+ "#variable declaration\n",
+ "sbr2=22.0 # spring balance reading\n",
+ "\n",
+ "#calculation\n",
+ "wloss2=w-sbr2\n",
+ "L2=wloss2/(1000.0*a)\n",
+ "\n",
+ "#result\n",
+ "print('\\n(ii)\\tL2=%dm'%L2)\n",
+ "\n",
+ "#(iii)\n",
+ "\n",
+ "#variable declaration\n",
+ "sbr3=21.0 # spring balance reading\n",
+ "\n",
+ "#calculation\n",
+ "wloss3=w-sbr3\n",
+ "L3=wloss3/(1000.0*a)\n",
+ "\n",
+ "#result\n",
+ "print('\\n(iii)\\tL3=%dm'%L3)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "level=8.0 # level wen tank is full \n",
+ "\n",
+ "#calculation\n",
+ "wt=a*level*1000.0\n",
+ "spring=w-wt\n",
+ "\n",
+ "#result\n",
"print('\\n(b):when the tank is full\\nSpring Balance reading = %d kg'%spring)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "Weight of the displacer if weighed in air = 24 kg",
- "",
- "(i)\tL1=2m",
- "",
- "(ii)\tL2=4m",
- "",
- "(iii)\tL3=6m",
- "",
- "(b):when the tank is full",
+ "(a)\n",
+ "Weight of the displacer if weighed in air = 24 kg\n",
+ "\n",
+ "(i)\tL1=2m\n",
+ "\n",
+ "(ii)\tL2=4m\n",
+ "\n",
+ "(iii)\tL3=6m\n",
+ "\n",
+ "(b):when the tank is full\n",
"Spring Balance reading = 20 kg"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.5, Page Number: 374<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Buoyancy Force calculation'''",
- "",
- "#variable declaration",
- "rho=1000.0 # density of water ",
- "v=3.0 # displaced volume of water ",
- "",
- "#calculation",
- "Bw=rho*v",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "rho=1000.0 # density of water \n",
+ "v=3.0 # displaced volume of water \n",
+ "\n",
+ "#calculation\n",
+ "Bw=rho*v\n",
+ "\n",
+ "#Result\n",
"print('Buoyance Force(Bw) = %d kg'%Bw)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Buoyance Force(Bw) = 3000 kg"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.6, Page Number: 374<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Determination of displaced volume from Buoyancy Force'''",
- "",
- "#variable declaration",
- "rho=1000.0 # density of water",
- "Bw=5000.0 # Buoyancy Force",
- "",
- "#calculation",
- "v=Bw/rho",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "rho=1000.0 # density of water\n",
+ "Bw=5000.0 # Buoyancy Force\n",
+ "\n",
+ "#calculation\n",
+ "v=Bw/rho\n",
+ "\n",
+ "#result\n",
"print('V = %d m^3' %v)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V = 5 m^3"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.7, Page Number: 374<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Determination of hydrostatic pressure in open tank'''",
- "",
- "#variable declaration",
- "rho=1000.0 # density of water",
- "h=10.0 # height of liquid",
- "",
- "#calculation",
- "P=rho*h",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "rho=1000.0 # density of water\n",
+ "h=10.0 # height of liquid\n",
+ "\n",
+ "#calculation\n",
+ "P=rho*h\n",
+ "\n",
+ "#result\n",
"print('P = %d kg/m^2 = %d kg/cm^2 '%(P,P/10000))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"P = 10000 kg/m^2 = 1 kg/cm^2 "
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.8, Page Number: 374<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Determination of hydrostatic pressure in closed tank'''",
- "",
- "#variable declaration",
- "rho=1000.0 # density of water",
- "h=15.0 # height of liquid ",
- "ex_p=1.0 # External pressure on liquid",
- "",
- "#calculation",
- "P=(rho*h/10000.0)+ex_p",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "rho=1000.0 # density of water\n",
+ "h=15.0 # height of liquid \n",
+ "ex_p=1.0 # External pressure on liquid\n",
+ "\n",
+ "#calculation\n",
+ "P=(rho*h/10000.0)+ex_p\n",
+ "\n",
+ "#result\n",
"print('P = %.1f kg/cm^2' %P)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"P = 2.5 kg/cm^2"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.9, Page Number:374<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Determination of height from hydrostatic pressure'''",
- "",
- "#variable declaration",
- "rho=1000.0 # density of water",
- "ex_p=0.5*10**4 # External pressure on liquid ",
- "P=1.6*10**4 #(rho*h/10000)+ex_p",
- "",
- "#calculation",
- "h=(P-ex_p)/1000.0",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "rho=1000.0 # density of water\n",
+ "ex_p=0.5*10**4 # External pressure on liquid \n",
+ "P=1.6*10**4 #(rho*h/10000)+ex_p\n",
+ "\n",
+ "#calculation\n",
+ "h=(P-ex_p)/1000.0\n",
+ "\n",
+ "#result\n",
"print('h = %d m' %h)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"h = 11 m"
]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.10, Page Number:375<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of level on the probe'''",
- "",
- "#variable declaration",
- "c2=100.0*10**-6 # capacitance in capacitance probe",
- "r1=10.0*10**3 # value of resistor in bride",
- "r2=100.0*10**3 # value of resistor in bride",
- "r3=50.0*10**3 # value of resistor in bride",
- "",
- "#calculation",
- "Cx=r1*c2/r3",
- "Cx=Cx*10**6",
- "",
- "#result",
- "print('Cx = %d microFarad'%Cx)",
- "c=5.0",
- "",
- "#calculation",
- "l=Cx/c",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "c2=100.0*10**-6 # capacitance in capacitance probe\n",
+ "r1=10.0*10**3 # value of resistor in bride\n",
+ "r2=100.0*10**3 # value of resistor in bride\n",
+ "r3=50.0*10**3 # value of resistor in bride\n",
+ "\n",
+ "#calculation\n",
+ "Cx=r1*c2/r3\n",
+ "Cx=Cx*10**6\n",
+ "\n",
+ "#result\n",
+ "print('Cx = %d microFarad'%Cx)\n",
+ "c=5.0\n",
+ "\n",
+ "#calculation\n",
+ "l=Cx/c\n",
+ "\n",
+ "#result\n",
"print('\\nLevel on the probe = %dm'%l)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Cx = 20 microFarad",
- "",
+ "Cx = 20 microFarad\n",
+ "\n",
"Level on the probe = 4m"
]
}
- ],
+ ],
"prompt_number": 10
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Industrial_Instrumentation/Chapter_7.ipynb b/Industrial_Instrumentation/Chapter_7.ipynb
index f42da02c..4a5cfd38 100644
--- a/Industrial_Instrumentation/Chapter_7.ipynb
+++ b/Industrial_Instrumentation/Chapter_7.ipynb
@@ -1,567 +1,594 @@
{
"metadata": {
- "name": "Chapter_7"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:7398e89d85008e2cdad3036771199a6877abb82c38f4bdc25b1a999f38a5b0fa"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 7: Velocity Humidity and Moisture<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.1, Page NUmber: 436<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of absolute viscosity'''",
- "",
- "#variable declaration",
- "f=2*9.8*10**5 # Force in Dynes",
- "A=100.0 # area in cm^2",
- "V=20.0 # velocity in m/sec",
- "l=10.0 # length in cm",
- "",
- "#calculation",
- "mu=(f/A)/(V/l)",
- "mu=mu/1000.0",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "f=2*9.8*10**5 # Force in Dynes\n",
+ "A=100.0 # area in cm^2\n",
+ "V=20.0 # velocity in m/sec\n",
+ "l=10.0 # length in cm\n",
+ "\n",
+ "#calculation\n",
+ "mu=(f/A)/(V/l)\n",
+ "mu=mu/1000.0\n",
+ "\n",
+ "#result\n",
"print('The absolute viscosity mu = %.1f*10^5 centipoises'%mu)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"The absolute viscosity mu = 9.8*10^5 centipoises"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.2, Page Number:437<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of kinematic relative and absolute viscosity'''",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "v=10.0 # absolute viscosity",
- "",
- "#calculation",
- "F=1/v",
- "",
- "#result",
- "print('(a)\\nFluidity = %.1f rhe'%F)",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "mu=10.0 # absolute viscosity",
- "rho=0.8 # density in m/cm^3",
- "",
- "#calculation",
- "ve=mu/rho",
- "",
- "#result",
- "print('\\n(b)\\nKinematic viscosity (v)= %.1f cm^2/sec'%ve)",
- "",
- "",
- "#(c)",
- "",
- "#variable declaration",
- "ab=1000.0 # absolute viscosity ",
- "abwt=1.002 # absolute viscosity of water at 20 deree celcius",
- "",
- "#calculation",
- "rv=ab/abwt",
- "",
- "#result",
- "print('\\n(c)\\nRelative viscosity = %d centipoises'%rv)",
- "",
- "#(d)",
- "",
- "#variable declaration",
- "PAS=10.0",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "v=10.0 # absolute viscosity\n",
+ "\n",
+ "#calculation\n",
+ "F=1/v\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nFluidity = %.1f rhe'%F)\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "mu=10.0 # absolute viscosity\n",
+ "rho=0.8 # density in m/cm^3\n",
+ "\n",
+ "#calculation\n",
+ "ve=mu/rho\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)\\nKinematic viscosity (v)= %.1f cm^2/sec'%ve)\n",
+ "\n",
+ "\n",
+ "#(c)\n",
+ "\n",
+ "#variable declaration\n",
+ "ab=1000.0 # absolute viscosity \n",
+ "abwt=1.002 # absolute viscosity of water at 20 deree celcius\n",
+ "\n",
+ "#calculation\n",
+ "rv=ab/abwt\n",
+ "\n",
+ "#result\n",
+ "print('\\n(c)\\nRelative viscosity = %d centipoises'%rv)\n",
+ "\n",
+ "#(d)\n",
+ "\n",
+ "#variable declaration\n",
+ "PAS=10.0\n",
+ "\n",
+ "#Result\n",
"print('\\n(c)\\nAbsolute viscosity = 1000 centipoises =10 poises = 1PAS')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "Fluidity = 0.1 rhe",
- "",
- "(b)",
- "Kinematic viscosity (v)= 12.5 cm^2/sec",
- "",
- "(c)",
- "Relative viscosity = 998 centipoises",
- "",
- "(c)",
+ "(a)\n",
+ "Fluidity = 0.1 rhe\n",
+ "\n",
+ "(b)\n",
+ "Kinematic viscosity (v)= 12.5 cm^2/sec\n",
+ "\n",
+ "(c)\n",
+ "Relative viscosity = 998 centipoises\n",
+ "\n",
+ "(c)\n",
"Absolute viscosity = 1000 centipoises =10 poises = 1PAS"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.3, Page Number: 438<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Absolute viscosity of the Newtonian fluid'''",
- "",
- "import math",
- "#b)",
- "",
- "#variable declaration",
- "R=0.5 # radius",
- "L=5 # length",
- "p_diff=800.0 # pressure difference",
- "V=10.0 # volume",
- "",
- "#calculation",
- "mu=(math.pi*R**4)*p_diff/(8*V*L)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "#b)\n",
+ "\n",
+ "#variable declaration\n",
+ "R=0.5 # radius\n",
+ "L=5 # length\n",
+ "p_diff=800.0 # pressure difference\n",
+ "V=10.0 # volume\n",
+ "\n",
+ "#calculation\n",
+ "mu=(math.pi*R**4)*p_diff/(8*V*L)\n",
+ "\n",
+ "#result\n",
"print('(b)\\nmu=%.4f poise =%.2f centipoise'%(mu,mu*100))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(b)",
+ "(b)\n",
"mu=0.3927 poise =39.27 centipoise"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.4, Page Number: 439<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''kinematic viscosity and density calculation'''",
- "",
- "import math ",
- "#(a)",
- "",
- "#variable declaration",
- "g=980.0 # acceleration due to gravity",
- "h=4 # Height",
- "R=0.5 # radius",
- "V=10.0 # volume ",
- "l=5.0 # length ",
- "t=1.0",
- "",
- "#calculation",
- "v=(math.pi*g*h*t*R**4)/(8*l*V)",
- "",
- "#result",
- "print('(a)\\n v = %.2f stokes'%v)",
- "",
- "#calculation",
- "mu=0.3925",
- "rho=mu/v",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math \n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "g=980.0 # acceleration due to gravity\n",
+ "h=4 # Height\n",
+ "R=0.5 # radius\n",
+ "V=10.0 # volume \n",
+ "l=5.0 # length \n",
+ "t=1.0\n",
+ "\n",
+ "#calculation\n",
+ "v=(math.pi*g*h*t*R**4)/(8*l*V)\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\n v = %.2f stokes'%v)\n",
+ "\n",
+ "#calculation\n",
+ "mu=0.3925\n",
+ "rho=mu/v\n",
+ "\n",
+ "#result\n",
"print('\\n(b)\\n Density of the fluid rho = %.3f gm/cm^3'%rho)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- " v = 1.92 stokes",
- "",
- "(b)",
+ "(a)\n",
+ " v = 1.92 stokes\n",
+ "\n",
+ "(b)\n",
" Density of the fluid rho = 0.204 gm/cm^3"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.5, Page Number: 440<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Kinematic Viscosity in Saybolts Universal viscometer'''",
- "",
- "#variable declaration",
- "",
- "#(a)",
- "A=0.226 # value of A as per equation",
- "B=195.0 # value of B as per equation",
- "t=60.0 # Efflux time",
- "",
- "#calcullation",
- "v=A*t-B/t",
- "A1=0.220",
- "B1=135.0",
- "t1=140.0",
- "v1=A1*t1-B1/t1",
- "",
- "#result",
- "print('(a) Fluid X\\n v = %.2f centipoises'%v)",
+ "\n",
+ "#variable declaration\n",
+ "\n",
+ "#(a)\n",
+ "A=0.226 # value of A as per equation\n",
+ "B=195.0 # value of B as per equation\n",
+ "t=60.0 # Efflux time\n",
+ "\n",
+ "#calcullation\n",
+ "v=A*t-B/t\n",
+ "A1=0.220\n",
+ "B1=135.0\n",
+ "t1=140.0\n",
+ "v1=A1*t1-B1/t1\n",
+ "\n",
+ "#result\n",
+ "print('(a) Fluid X\\n v = %.2f centipoises'%v)\n",
"print('\\n(b)Fluid Y\\n v = %.1f centipoises'%v1)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a) Fluid X",
- " v = 10.31 centipoises",
- "",
- "(b)Fluid Y",
+ "(a) Fluid X\n",
+ " v = 10.31 centipoises\n",
+ "\n",
+ "(b)Fluid Y\n",
" v = 29.8 centipoises"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.6, Page Number: 441<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of absolute viscosity'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "t=12.0 # time interval of falling ball in sec ",
- "Rsb=7.0 # Specific gravity of ball",
- "Rsf=1.12 # Specific gravity of fluid",
- "B=1.5 # Ball constant in centipoises",
- "",
- "#calculation",
- "mu=t*(Rsb-Rsf)*B",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "t=12.0 # time interval of falling ball in sec \n",
+ "Rsb=7.0 # Specific gravity of ball\n",
+ "Rsf=1.12 # Specific gravity of fluid\n",
+ "B=1.5 # Ball constant in centipoises\n",
+ "\n",
+ "#calculation\n",
+ "mu=t*(Rsb-Rsf)*B\n",
+ "\n",
+ "#result\n",
"print('mu= %.2f centipoises = %d centipoises(approx)'%(mu,math.ceil(mu)))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"mu= 105.84 centipoises = 106 centipoises(approx)"
]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.7, Page Number: 441<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of relative humidity'''",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "B=45.0 # dry bulb temperature",
- "W=25.0 # wet bulb temperature",
- "",
- "#result",
- "print('\\n(b)\\nPsychromatic differential : %d\u00b0C'%(B-W))",
- "print('\\n Relative humidity is 80%% corresponding to')",
- "print(' \\ntemperature 45\u00b0C and psychromatic differential 20\u00b0C')",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "B1=30.0 # dry bulb temperature",
- "W1=27.0 # wet bulb temperature",
- "",
- "#result",
- "print('\\n(b)\\nPsychromatic differential : %d\u00b0C'%(B1-W1))",
- "print('\\n Relative humidity is 80%% corresponding to')",
+ "\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "B=45.0 # dry bulb temperature\n",
+ "W=25.0 # wet bulb temperature\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)\\nPsychromatic differential : %d\u00b0C'%(B-W))\n",
+ "print('\\n Relative humidity is 80%% corresponding to')\n",
+ "print(' \\ntemperature 45\u00b0C and psychromatic differential 20\u00b0C')\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "B1=30.0 # dry bulb temperature\n",
+ "W1=27.0 # wet bulb temperature\n",
+ "\n",
+ "#result\n",
+ "print('\\n(b)\\nPsychromatic differential : %d\u00b0C'%(B1-W1))\n",
+ "print('\\n Relative humidity is 80%% corresponding to')\n",
"print(' \\ntemperature 30\u00b0C and psychromatic differential 3\u00b0C')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "",
- "(b)",
- "Psychromatic differential : 20\u00b0C",
- "",
- " Relative humidity is 80%% corresponding to",
- " ",
- "temperature 45\u00b0C and psychromatic differential 20\u00b0C",
- "",
- "(b)",
- "Psychromatic differential : 3\u00b0C",
- "",
- " Relative humidity is 80%% corresponding to",
- " ",
+ "\n",
+ "(b)\n",
+ "Psychromatic differential : 20\u00b0C\n",
+ "\n",
+ " Relative humidity is 80%% corresponding to\n",
+ " \n",
+ "temperature 45\u00b0C and psychromatic differential 20\u00b0C\n",
+ "\n",
+ "(b)\n",
+ "Psychromatic differential : 3\u00b0C\n",
+ "\n",
+ " Relative humidity is 80%% corresponding to\n",
+ " \n",
"temperature 30\u00b0C and psychromatic differential 3\u00b0C"
]
}
- ],
+ ],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.8, Page Number: 441<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of Relative Humidity dew point and moisture content'''",
- "",
- "#variable declaration",
- "D=80.0 # intersection point of DB temperature",
- "W=66.5 # intersection point of WB temperature",
- "",
- "#Result",
- "",
- "#(a)",
- "print('(a)\\nThe intersection point of DB temperature 80\u00b0F and WB temperature 66.5\u00b0F')",
- "print(' \\nlines on the relative humidity curve for 50%.\\n RH = 50%')",
- "",
- "#(b)",
- "print('\\n(b)\\nFrom the point of intersection of the dry and wet bulb curves, move left')",
- "print(' \\nhorizontally to the dew point temperature curve where it meets at 60\u00b0F')",
- "print('\\nDew Point = 60\u00b0F')",
- "",
- "#(c)",
- "print('\\n(c)\\nFrom the point of intersection of the dry and wet bulb curves,')",
- "print('\\nhorizontally to the right to the moisture content plot where it meets at 76.')",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "D=80.0 # intersection point of DB temperature\n",
+ "W=66.5 # intersection point of WB temperature\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "#(a)\n",
+ "print('(a)\\nThe intersection point of DB temperature 80\u00b0F and WB temperature 66.5\u00b0F')\n",
+ "print(' \\nlines on the relative humidity curve for 50%.\\n RH = 50%')\n",
+ "\n",
+ "#(b)\n",
+ "print('\\n(b)\\nFrom the point of intersection of the dry and wet bulb curves, move left')\n",
+ "print(' \\nhorizontally to the dew point temperature curve where it meets at 60\u00b0F')\n",
+ "print('\\nDew Point = 60\u00b0F')\n",
+ "\n",
+ "#(c)\n",
+ "print('\\n(c)\\nFrom the point of intersection of the dry and wet bulb curves,')\n",
+ "print('\\nhorizontally to the right to the moisture content plot where it meets at 76.')\n",
"print('\\nMoisture Content : 76 grains of water per pound of dry air.')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "The intersection point of DB temperature 80\u00b0F and WB temperature 66.5\u00b0F",
- " ",
- "lines on the relative humidity curve for 50%.",
- " RH = 50%",
- "",
- "(b)",
- "From the point of intersection of the dry and wet bulb curves, move left",
- " ",
- "horizontally to the dew point temperature curve where it meets at 60\u00b0F",
- "",
- "Dew Point = 60\u00b0F",
- "",
- "(c)",
- "From the point of intersection of the dry and wet bulb curves,",
- "",
- "horizontally to the right to the moisture content plot where it meets at 76.",
- "",
+ "(a)\n",
+ "The intersection point of DB temperature 80\u00b0F and WB temperature 66.5\u00b0F\n",
+ " \n",
+ "lines on the relative humidity curve for 50%.\n",
+ " RH = 50%\n",
+ "\n",
+ "(b)\n",
+ "From the point of intersection of the dry and wet bulb curves, move left\n",
+ " \n",
+ "horizontally to the dew point temperature curve where it meets at 60\u00b0F\n",
+ "\n",
+ "Dew Point = 60\u00b0F\n",
+ "\n",
+ "(c)\n",
+ "From the point of intersection of the dry and wet bulb curves,\n",
+ "\n",
+ "horizontally to the right to the moisture content plot where it meets at 76.\n",
+ "\n",
"Moisture Content : 76 grains of water per pound of dry air."
]
}
- ],
+ ],
"prompt_number": 11
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.9, Page Number: 442<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of relative humidity'''",
- "",
- "#variable declaration",
- "wt_vap=500.0 # Amount of water vapour present",
- "wt_vap_to_sat=1500.0 # Amount of water vapour added to saturate",
- "",
- "#calculation",
- "total=wt_vap+wt_vap_to_sat",
- "Rh=(wt_vap/total)*100",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "wt_vap=500.0 # Amount of water vapour present\n",
+ "wt_vap_to_sat=1500.0 # Amount of water vapour added to saturate\n",
+ "\n",
+ "#calculation\n",
+ "total=wt_vap+wt_vap_to_sat\n",
+ "Rh=(wt_vap/total)*100\n",
+ "\n",
+ "#result\n",
"print('RH = %d%%'%Rh)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"RH = 25%"
]
}
- ],
+ ],
"prompt_number": 12
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.10, Page Number: 442<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''percentage relative humidity'''",
- "",
- "#variable declaration",
- "pv=30.0 # partial pressure of water vapour",
- "ps=60.0 # Saturation partial pressure ",
- "",
- "#calculations",
- "Rh=(pv/ps)*100",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "pv=30.0 # partial pressure of water vapour\n",
+ "ps=60.0 # Saturation partial pressure \n",
+ "\n",
+ "#calculations\n",
+ "Rh=(pv/ps)*100\n",
+ "\n",
+ "#Result\n",
"print('%%RH = %d%%'%Rh)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"%RH = 50%"
]
}
- ],
+ ],
"prompt_number": 13
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.11, Page Number: 442<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''percentage increase in moisture content'''",
- "",
- "#variable declaration",
- "i1=250.0 # ionazation current ",
- "i2=350.0 # ionazation current ",
- "",
- "#calculation",
- "m=(i2-i1)*100/i1",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "i1=250.0 # ionazation current \n",
+ "i2=350.0 # ionazation current \n",
+ "\n",
+ "#calculation\n",
+ "m=(i2-i1)*100/i1\n",
+ "\n",
+ "#result\n",
"print('%% increase in moisture content = %d%%'%m)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"% increase in moisture content = 40%"
]
}
- ],
+ ],
"prompt_number": 14
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.12, Page Number: 443<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of moisture content'''",
- "",
- "#variable declaraton",
- "i2=150.0 # wet weight",
- "i1=125.0 # dry weight",
- "",
- "#calculation",
- "m=(i2-i1)*100/i1",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaraton\n",
+ "i2=150.0 # wet weight\n",
+ "i1=125.0 # dry weight\n",
+ "\n",
+ "#calculation\n",
+ "m=(i2-i1)*100/i1\n",
+ "\n",
+ "#result\n",
"print('Moisture percentage = %d%%'%m)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Moisture percentage = 20%"
]
}
- ],
+ ],
"prompt_number": 15
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Industrial_Instrumentation/Chapter_8.ipynb b/Industrial_Instrumentation/Chapter_8.ipynb
index 8a84dda0..45717557 100644
--- a/Industrial_Instrumentation/Chapter_8.ipynb
+++ b/Industrial_Instrumentation/Chapter_8.ipynb
@@ -1,485 +1,507 @@
{
"metadata": {
- "name": "Chapter_8"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:d75e4cfd03813a2ebb58ae96e012a8b8020f7dffa90e8d93acabe5330e357932"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 8:Fundamentals of measuring instruments <h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.1, Page Number: 507<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Flux density calculation'''",
- "",
- "#variable declaration",
- "fi=10.0*10**-6 # fi-flux",
- "inch=2.54*10**-2 # length",
- "A=inch**2 # area",
- "",
- "#calculation",
- "B =fi/A",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "fi=10.0*10**-6 # fi-flux\n",
+ "inch=2.54*10**-2 # length\n",
+ "A=inch**2 # area\n",
+ "\n",
+ "#calculation\n",
+ "B =fi/A\n",
+ "\n",
+ "#Result\n",
"print('Flux Density B= %.1f mT'%(B*1000))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Flux Density B= 15.5 mT"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.2, Page Number: 508<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Power Dissipation and accuracy of result'''",
- "",
- "#variable Declaration",
- "i=10*10**-3 # current in A",
- "R=1000.0 # resistance in ohm",
- "P=(i**2)*R # Power",
- "err_R=10.0 # Error in Resistance measurement",
- "err_I=(2.0/100)*25*100/10 # Error in current measurement",
- "",
- "#calculation",
- "err_I2=2*err_I",
- "err_p=err_I2+err_R",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "#variable Declaration\n",
+ "i=10*10**-3 # current in A\n",
+ "R=1000.0 # resistance in ohm\n",
+ "P=(i**2)*R # Power\n",
+ "err_R=10.0 # Error in Resistance measurement\n",
+ "err_I=(2.0/100)*25*100/10 # Error in current measurement\n",
+ "\n",
+ "#calculation\n",
+ "err_I2=2*err_I\n",
+ "err_p=err_I2+err_R\n",
+ "\n",
+ "#Result\n",
"print('%% error in I^2 = \u00b1 %d%%\\n%% error in Power = \u00b1 %d%%'%(err_I2,err_p))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "% error in I^2 = \u00b1 10%",
+ "% error in I^2 = \u00b1 10%\n",
"% error in Power = \u00b1 20%"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.3, Page Number: 508<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''max and min levels of input supply current'''",
- "",
- "#variable Declaration",
- "i1=37.0 # current in branch 1 ",
- "i2=42.0 # current in branch 2",
- "i3=13.0 # current in branch 3",
- "i4=6.7 # current in branch 4",
- "",
- "#Calculation",
- "Imax=(i1+i2)+(i1+i2)*(3.0/100)+(i3+i4)+(i3+i4)*(1.0/100)",
- "Imin=(i1+i2)-(i1+i2)*(3.0/100)+(i3+i4)-(i3+i4)*(1.0/100)",
- "",
- "#result",
- "print('Maximum level of total supply current = %.3f mA'%Imax)",
+ "\n",
+ "#variable Declaration\n",
+ "i1=37.0 # current in branch 1 \n",
+ "i2=42.0 # current in branch 2\n",
+ "i3=13.0 # current in branch 3\n",
+ "i4=6.7 # current in branch 4\n",
+ "\n",
+ "#Calculation\n",
+ "Imax=(i1+i2)+(i1+i2)*(3.0/100)+(i3+i4)+(i3+i4)*(1.0/100)\n",
+ "Imin=(i1+i2)-(i1+i2)*(3.0/100)+(i3+i4)-(i3+i4)*(1.0/100)\n",
+ "\n",
+ "#result\n",
+ "print('Maximum level of total supply current = %.3f mA'%Imax)\n",
"print('\\nMinimum level of total supply current = %.3f mA'%Imin)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Maximum level of total supply current = 101.267 mA",
- "",
+ "Maximum level of total supply current = 101.267 mA\n",
+ "\n",
"Minimum level of total supply current = 96.133 mA"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.4, Page Number:508<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Time constant for thermometer'''",
- "",
- "import math",
- "",
- "#(a)",
- "",
- "#variable declaration",
- "T=200.0 # intermediate temperature ",
- "T0=300.0 # final temperature ",
- "Ti=70.0 # initial temperature ",
- "t=3.0 # time in seconds ",
- "",
- "#calculation",
- "x=(T-T0)/(Ti-T0)",
- "tow=-t/math.log(x)",
- "",
- "#result",
- "print('(a)\\nTime constant tow=%.1f s'%tow)",
- "",
- "",
- "#(b)",
- "",
- "#variable declaration",
- "t1=5.0 # time in seconds ",
- "#calculation",
- "T5=T0+((Ti-T0)*math.e**(-t1/tow))",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#(a)\n",
+ "\n",
+ "#variable declaration\n",
+ "T=200.0 # intermediate temperature \n",
+ "T0=300.0 # final temperature \n",
+ "Ti=70.0 # initial temperature \n",
+ "t=3.0 # time in seconds \n",
+ "\n",
+ "#calculation\n",
+ "x=(T-T0)/(Ti-T0)\n",
+ "tow=-t/math.log(x)\n",
+ "\n",
+ "#result\n",
+ "print('(a)\\nTime constant tow=%.1f s'%tow)\n",
+ "\n",
+ "\n",
+ "#(b)\n",
+ "\n",
+ "#variable declaration\n",
+ "t1=5.0 # time in seconds \n",
+ "#calculation\n",
+ "T5=T0+((Ti-T0)*math.e**(-t1/tow))\n",
+ "\n",
+ "#result\n",
"print('\\n(b)\\nTemperature after 5 seconds T5 = %.2f\u00b0C'%T5)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(a)",
- "Time constant tow=3.6 s",
- "",
- "(b)",
+ "(a)\n",
+ "Time constant tow=3.6 s\n",
+ "\n",
+ "(b)\n",
"Temperature after 5 seconds T5 = 242.61\u00b0C"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.5, Page Number:<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Error calculation of second order instrument'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "w=9.0 # excitation frequency",
- "wn=6.0 # natural frequency",
- "dr=0.6 # damping ratio",
- "",
- "#calculations",
- "",
- "x=w/wn",
- "Ar=1/math.sqrt(((1-(x)**2)**2)+(2*dr*x)**2)",
- "err=(1-Ar)*100",
- "",
- "#Result",
- "print('A=%.3f'%Ar)",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "w=9.0 # excitation frequency\n",
+ "wn=6.0 # natural frequency\n",
+ "dr=0.6 # damping ratio\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "x=w/wn\n",
+ "Ar=1/math.sqrt(((1-(x)**2)**2)+(2*dr*x)**2)\n",
+ "err=(1-Ar)*100\n",
+ "\n",
+ "#Result\n",
+ "print('A=%.3f'%Ar)\n",
"print('\\nError = %.2f%%'%err)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "A=0.456",
- "",
+ "A=0.456\n",
+ "\n",
"Error = 54.37%"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.6, PAge Number: 510<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Output of first order instrument for unit step input'''",
- "",
- "#variable Declaration",
- "t=2.0 # output to be calculated after t seconds",
- "",
- "#calculation",
- "y=1-math.e**(-(t-1.5)/0.5)",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable Declaration\n",
+ "t=2.0 # output to be calculated after t seconds\n",
+ "\n",
+ "#calculation\n",
+ "y=1-math.e**(-(t-1.5)/0.5)\n",
+ "\n",
+ "#result\n",
"print('y(t)at t=2 will be y(t)=%.3f'%y)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"y(t)at t=2 will be y(t)=0.632"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.7, Page Number: 510<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Statistic of Temperature readings'''",
- "",
- "import math",
- "",
- "#variable declaration",
- "",
- "#Temperature Readings",
- "x1=98.5 # Reading 1",
- "x2=99.0 # Reading 2",
- "x3=99.5 # Reading 3 ",
- "x4=100.0 # Reading 4",
- "x5=100.5 # Reading 5",
- "x6=101.0 # Reading 6",
- "x7=101.5 # Reading 7",
- "# Frequency",
- "f1=4.0 # Reading 1",
- "f2=13.0 # Reading 2",
- "f3=19.0 # Reading 3",
- "f4=35.0 # Reading 4",
- "f5=17.0 # Reading 5",
- "f6=10.0 # Reading 6",
- "f7=2.0 # Reading 7",
- "",
- "#(i) Arithmatic Mean",
- "",
- "#calculation",
- "x_bar=((x1*f1)+(x2*f2)+(x3*f3)+(x4*f4)+(x5*f5)+(x6*f6)+(x7*f7))/(f1+f2+f3+f4+f5+f6+f7)",
- "",
- "#result",
- "print('(i)\\n\\tArithmatic Mean = %.2f\u00b0C'%x_bar)",
- "",
- "#(ii) Average Deviation",
- "",
- "#calculation",
- "D=(abs(x1-x_bar)*f1)+(abs(x2-x_bar)*f2)+(abs(x3-x_bar)*f3)+(abs(x4-x_bar)*f4)",
- "D=D+(abs(x5-x_bar)*f5)+(abs(x6-x_bar)*f6)+(abs(x7-x_bar)*f7)",
- "D=D/(f1+f2+f3+f4+f5+f6+f7)",
- "",
- "#result",
- "print('\\n(ii)\\n\\tAverage Deviation =%.4f\u00b0C'%D)",
- "",
- "#Standard deviation",
- "",
- "#Calculation",
- "sigma=((x1-x_bar)**2*f1)+((x2-x_bar)**2*f2)+((x3-x_bar)**2*f3)+((x4-x_bar)**2*f4)",
- "sigma=sigma+((x5-x_bar)**2*f5)+((x6-x_bar)**2*f6)+((x7-x_bar)**2*f7)",
- "sigma=math.sqrt(sigma)",
- "sigma=sigma/math.sqrt(f1+f2+f3+f4+f5+f6+f7)",
- "",
- "#result",
- "print('\\n(iii)\\n\\tStandard deviation = %.3f\u00b0C'%sigma)",
- "",
- "#variance",
- "",
- "#result",
- "print('\\n(iv)\\n\\tVariance = %.4f\u00b0C'%(sigma**2))",
- "",
- "#Probable Error",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable declaration\n",
+ "\n",
+ "#Temperature Readings\n",
+ "x1=98.5 # Reading 1\n",
+ "x2=99.0 # Reading 2\n",
+ "x3=99.5 # Reading 3 \n",
+ "x4=100.0 # Reading 4\n",
+ "x5=100.5 # Reading 5\n",
+ "x6=101.0 # Reading 6\n",
+ "x7=101.5 # Reading 7\n",
+ "# Frequency\n",
+ "f1=4.0 # Reading 1\n",
+ "f2=13.0 # Reading 2\n",
+ "f3=19.0 # Reading 3\n",
+ "f4=35.0 # Reading 4\n",
+ "f5=17.0 # Reading 5\n",
+ "f6=10.0 # Reading 6\n",
+ "f7=2.0 # Reading 7\n",
+ "\n",
+ "#(i) Arithmatic Mean\n",
+ "\n",
+ "#calculation\n",
+ "x_bar=((x1*f1)+(x2*f2)+(x3*f3)+(x4*f4)+(x5*f5)+(x6*f6)+(x7*f7))/(f1+f2+f3+f4+f5+f6+f7)\n",
+ "\n",
+ "#result\n",
+ "print('(i)\\n\\tArithmatic Mean = %.2f\u00b0C'%x_bar)\n",
+ "\n",
+ "#(ii) Average Deviation\n",
+ "\n",
+ "#calculation\n",
+ "D=(abs(x1-x_bar)*f1)+(abs(x2-x_bar)*f2)+(abs(x3-x_bar)*f3)+(abs(x4-x_bar)*f4)\n",
+ "D=D+(abs(x5-x_bar)*f5)+(abs(x6-x_bar)*f6)+(abs(x7-x_bar)*f7)\n",
+ "D=D/(f1+f2+f3+f4+f5+f6+f7)\n",
+ "\n",
+ "#result\n",
+ "print('\\n(ii)\\n\\tAverage Deviation =%.4f\u00b0C'%D)\n",
+ "\n",
+ "#Standard deviation\n",
+ "\n",
+ "#Calculation\n",
+ "sigma=((x1-x_bar)**2*f1)+((x2-x_bar)**2*f2)+((x3-x_bar)**2*f3)+((x4-x_bar)**2*f4)\n",
+ "sigma=sigma+((x5-x_bar)**2*f5)+((x6-x_bar)**2*f6)+((x7-x_bar)**2*f7)\n",
+ "sigma=math.sqrt(sigma)\n",
+ "sigma=sigma/math.sqrt(f1+f2+f3+f4+f5+f6+f7)\n",
+ "\n",
+ "#result\n",
+ "print('\\n(iii)\\n\\tStandard deviation = %.3f\u00b0C'%sigma)\n",
+ "\n",
+ "#variance\n",
+ "\n",
+ "#result\n",
+ "print('\\n(iv)\\n\\tVariance = %.4f\u00b0C'%(sigma**2))\n",
+ "\n",
+ "#Probable Error\n",
+ "\n",
+ "#result\n",
"print('\\n(v)\\n\\tProbable Error= %.4f\u00b0C'%(0.6745*sigma))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(i)",
- "\tArithmatic Mean = 99.93\u00b0C",
- "",
- "(ii)",
- "\tAverage Deviation =0.5196\u00b0C",
- "",
- "(iii)",
- "\tStandard deviation = 0.671\u00b0C",
- "",
- "(iv)",
- "\tVariance = 0.4501\u00b0C",
- "",
- "(v)",
+ "(i)\n",
+ "\tArithmatic Mean = 99.93\u00b0C\n",
+ "\n",
+ "(ii)\n",
+ "\tAverage Deviation =0.5196\u00b0C\n",
+ "\n",
+ "(iii)\n",
+ "\tStandard deviation = 0.671\u00b0C\n",
+ "\n",
+ "(iv)\n",
+ "\tVariance = 0.4501\u00b0C\n",
+ "\n",
+ "(v)\n",
"\tProbable Error= 0.4525\u00b0C"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.8, Page Number: 511<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Calculation of damping coefficient and natural frequency for 2nd order instrument'''",
- "",
- "import math",
- "",
- "#variable Declaration",
- "wn=math.sqrt(3.0) # natural frequency of osscilation",
- "",
- "#Calculation",
- "x=3.2/(2*wn)",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#variable Declaration\n",
+ "wn=math.sqrt(3.0) # natural frequency of osscilation\n",
+ "\n",
+ "#Calculation\n",
+ "x=3.2/(2*wn)\n",
+ "\n",
+ "#Result\n",
"print('Damping coefficient = %.3f\\nNatural frequency of Oscillation = %.3f'%(x,wn))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Damping coefficient = 0.924",
+ "Damping coefficient = 0.924\n",
"Natural frequency of Oscillation = 1.732"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.9, Page Number: 512<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''calculation of Amplitude inaccuracy and phase shift from transfer function'''",
- "",
- "import math",
- "#variable declaration",
- "w=100.0 # natural frequency of osscilation",
- "",
- "#calculation",
- "fi=-math.atan(0.1*w)-math.atan(0.5*w)",
- "A=1/(math.sqrt(1+(0.1*w)**2)*(math.sqrt(1+(0.5*w)**2)))",
- "A=1*1000.0/math.ceil(1000*A)",
- "err=(1-1.0/A)*100",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "w=100.0 # natural frequency of osscilation\n",
+ "\n",
+ "#calculation\n",
+ "fi=-math.atan(0.1*w)-math.atan(0.5*w)\n",
+ "A=1/(math.sqrt(1+(0.1*w)**2)*(math.sqrt(1+(0.5*w)**2)))\n",
+ "A=1*1000.0/math.ceil(1000*A)\n",
+ "err=(1-1.0/A)*100\n",
+ "\n",
+ "#Result\n",
"print('A=K/%d\\n%% error = %.1f%%\\nfi = %.2f\u00b0'%(A,err,fi*180/math.pi))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "A=K/500",
- "% error = 99.8%",
+ "A=K/500\n",
+ "% error = 99.8%\n",
"fi = -173.14\u00b0"
]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.10, Page Number: 512<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''temperature and altitude calculation from first order thermometer placed in balloon'''",
- "",
- "#calculations",
- "R=0.15*10/50 # Temperature gradient",
- "K=1.0 # constant",
- "tow=15.0 # time constant ",
- "",
- "#Calculations",
- "deg=K*R*tow",
- "",
- "#(i)",
- "a=15-deg",
- "",
- "#(ii)",
- "alt_red=deg*50.0/0.15",
- "h=5000-alt_red",
- "",
- "#result",
- "print('(i)The actual temperature when instrument reads 15\u00b0C is %.2f\u00b0C'%a)",
- "print('\\n The true temperature at 5000 metres = %.2f '%a)",
+ "\n",
+ "#calculations\n",
+ "R=0.15*10/50 # Temperature gradient\n",
+ "K=1.0 # constant\n",
+ "tow=15.0 # time constant \n",
+ "\n",
+ "#Calculations\n",
+ "deg=K*R*tow\n",
+ "\n",
+ "#(i)\n",
+ "a=15-deg\n",
+ "\n",
+ "#(ii)\n",
+ "alt_red=deg*50.0/0.15\n",
+ "h=5000-alt_red\n",
+ "\n",
+ "#result\n",
+ "print('(i)The actual temperature when instrument reads 15\u00b0C is %.2f\u00b0C'%a)\n",
+ "print('\\n The true temperature at 5000 metres = %.2f '%a)\n",
"print('\\n(ii)\\nThe true altitude at which 15\u00b0C occurs is %d metres'%h)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "(i)The actual temperature when instrument reads 15\u00b0C is 14.55\u00b0C",
- "",
- " The true temperature at 5000 metres = 14.55 ",
- "",
- "(ii)",
+ "(i)The actual temperature when instrument reads 15\u00b0C is 14.55\u00b0C\n",
+ "\n",
+ " The true temperature at 5000 metres = 14.55 \n",
+ "\n",
+ "(ii)\n",
"The true altitude at which 15\u00b0C occurs is 4850 metres"
]
}
- ],
+ ],
"prompt_number": 10
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Industrial_Instrumentation/ch2.ipynb b/Industrial_Instrumentation/ch2.ipynb
index 22755012..0f54145a 100644
--- a/Industrial_Instrumentation/ch2.ipynb
+++ b/Industrial_Instrumentation/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:3203164807ce532b672553754629f11a0a0db0c197fd3e21e75a10e9e0cb2a95"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Convert the following readings of pressure to kPa assuming that barometer reads 760 mm of Hg.\n",
"\n",
"# Variables\n",
"rho_Hg = 13596.; \t\t\t#kg/m**3\n",
@@ -89,7 +89,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the pressure on the piston.\n",
"\n",
"import math \n",
"\n",
@@ -130,7 +129,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find the gauge pressure \n",
"\n",
"# Variables\n",
"SG = 0.9;\n",
@@ -171,7 +169,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find the absolute pressure in the condenser in Pa. \n",
"\n",
"# Variables\n",
"Vacuum_recorded = 740.; \t\t\t#mm of Hg\n",
@@ -209,11 +206,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The absolute pressure of the gas in the vessel in bar.\n",
- "(ii) Specific volume and density of the gas.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -267,9 +259,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the gas pressure.\n",
- "'''\n",
"\n",
"\n",
"# Variables\n",
@@ -310,9 +299,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the absolute pressure of steam.\n",
- "'''\n",
"\n",
"# Variables\n",
"h_H2O = 34.; \t\t\t#mm of Hg\n",
@@ -354,9 +340,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the absolute pressure of the gas \n",
- "'''\n",
"\n",
"# Variables\n",
"SG = 0.8;\n",
@@ -399,9 +382,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Estimate the mass of a piston that can be supported by a gas entrapped\n",
- "under the piston '''\n",
"\n",
"import math \n",
"\n",
@@ -444,9 +424,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the kinetic energy of an artificial satellite revolves round the earth \n",
- "'''\n",
"\n",
"# Variables\n",
"v = 800.; \t\t\t#m/s\n",
@@ -486,11 +463,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find :\n",
- "(i) Heat transferred ;\n",
- "(ii) Mean specific heat of the gas.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -543,10 +516,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "what will be the temperature corresponding to the thermometric property of 3.5 on\n",
- "Celsius scale.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -592,9 +562,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "What will be the reading on the thermometer where the gas thermometer reads 70\u00b0C ?\n",
- "'''\n",
"\n",
"def func(t): \n",
"\t return 0.20*t-5*10**(-4)*t**2\n",
@@ -635,9 +602,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "What is the amount of work done upon the atmosphere by the balloon ? \n",
- "'''\n",
"\n",
"# Variables\n",
"p = 101.325; \t\t#kPa\n",
@@ -675,9 +639,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the work done by the air which enters into an evacuated vessel\n",
- "from atmosphere when the valve is opened'''\n",
"\n",
"from scipy import integrate\n",
"\n",
@@ -718,10 +679,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "A piston and cylinder machine containing a fluid system has a stirring\n",
- "device as shown in Fig. 2.36. Find the net work transfer for the system.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -766,9 +724,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the net work done during the process.\n",
- "'''\n",
"\n",
"# Variables\n",
"A = 45.*10**(-4); \t #m**2\n",
@@ -808,9 +763,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the work done when the pressure increases from 1.5 bar to 7.5 bar.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -857,9 +810,6 @@
"input": [
"import math\n",
"\n",
- "'''\n",
- "To a closed system 150 kJ of work is supplied, determine the final volume and pressure of the system.\n",
- "'''\n",
"\n",
"# Variables\n",
"W = 150; \t\t\t#kJ\n",
@@ -898,9 +848,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the work done by the fluid on the piston.\n",
- "'''\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -949,9 +896,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the net work done by the fluid, for an initial volume of 0.05 m 3 .\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
diff --git a/Industrial_Instrumentation/ch3.ipynb b/Industrial_Instrumentation/ch3.ipynb
index 8e397388..e1873694 100644
--- a/Industrial_Instrumentation/ch3.ipynb
+++ b/Industrial_Instrumentation/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ab490015435e8f1ac3990217bb57911661595e73c3c831b703cdf5b3388c40c5"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the dryness fraction (quality) of steam \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m_s = 50. \t\t\t#kg\n",
@@ -66,11 +65,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) Mass and volume of liquid ;\n",
- "(ii) Mass and volume of vapour.\n",
- "'''\n",
"\n",
"# Variables\n",
"V = 0.6; \t\t\t#m**3\n",
@@ -129,15 +123,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the following :\n",
- "(i) The pressure,\n",
- "(ii) The mass,\n",
- "(iii) The specific volume,\n",
- "(v) The specific entropy, and\n",
- "(iv) The specific enthalpy,\n",
- "(vi) The specific internal energy.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"V = 0.05; \t\t\t#m**3\n",
@@ -214,9 +200,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the amount of heat\n",
- "'''\n",
"\n",
"# Variables\n",
"m_w = 2.; \t\t\t#kg\n",
@@ -267,9 +250,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "What amount of heat would be required to produce 4.4 kg of steam \n",
- "'''\n",
"\n",
"# Variables\n",
"m = 4.4; \t\t\t#kg\n",
@@ -322,9 +302,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the mass of 0.15 m 3 of wet steam and calculate the heat of 1 m 3 of steam.\n",
- "'''\n",
+ "\n",
"# Variables\n",
"v = 0.15; \t\t\t#m**3\n",
"p = 4.; \t\t\t#bar\n",
@@ -369,11 +347,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine\n",
- "(i) The total heat supplied to feed water per hour to produce wet steam.\n",
- "(ii) The total heat absorbed per hour in the superheater.\n",
- "'''\n",
"\n",
"# Variables\n",
"m = 1000.; \t\t\t#kJ/kg.K\n",
@@ -421,11 +394,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the mean specific heat for superheated steam :\n",
- "(i) at 0.75 bar, between 100\u00b0C and 150\u00b0C ;\n",
- "(ii) at 0.5 bar, between 300\u00b0C and 400\u00b0C\n",
- "'''\n",
"\n",
"\n",
"print (\"(i) at 0.75 bar, between 100\u00b0C and 150\u00b0C\")\n",
@@ -479,9 +447,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the pressure and temperature of the steam at the new state.\n",
- "'''\n",
+ "\n",
"# Variables\n",
"m = 1.5; \t\t\t#kg\n",
"p = 5.; \t\t\t#bar\n",
@@ -543,12 +509,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine :\n",
- "(i) The mass of steam blown off ;\n",
- "(ii) The dryness fraction of steam in the vessel after cooling ;\n",
- "(iii) The heat lost by steam per kg during cooling.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"V = 0.9; \t\t\t#m**3\n",
@@ -620,11 +581,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) External work done during evaporation.\n",
- "(ii) Internal latent heat of steam.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p = 8*10**5; \t\t\t#Pa\n",
@@ -669,10 +626,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the heat supplied to raise the temperature of the steam to 300\u00b0C at constant pressure and\n",
- "percentage of this heat which appears as external work.\n",
- "'''\n",
+ "\n",
"\n",
"p1 = 10; \t\t\t#bar\n",
"import math \n",
@@ -722,9 +676,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the specific volume, enthalpy and internal energy of wet steam \n",
- "'''\n",
"\n",
"# Variables\n",
"p = 18.; \t\t\t#bar\n",
@@ -771,9 +722,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the dryness fraction, specific volume and internal energy of steam \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p = 7.; \t\t\t#bar\n",
@@ -821,9 +770,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the temperature, enthalpy and the internal energy.\n",
- "'''\n",
"\n",
"# Variables\n",
"p = 120.; \t\t\t#bar\n",
@@ -865,9 +811,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the temperature,the specific volume and the internal energy.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p = 140.; \t\t\t#bar\n",
@@ -910,9 +854,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the internal energy per kg of superheated steam \n",
- "'''\n",
+ "\n",
"\n",
"# At 10 bar: From steam table for superheated steam\n",
"\n",
@@ -965,11 +907,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the internal energy of 1 kg of steam at 20 bar when\n",
- "(i) it is superheated, its temperature being 400\u00b0C ;\n",
- "(ii) it is wet, its dryness being 0.9.\n",
- "'''\n",
"\n",
"# Variables\n",
"m = 1.; \t\t\t#kg\n",
@@ -1024,9 +961,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the quality of steam supplied by the other boiler. Take c ps = 2.25 kJ/kg.\n",
- "'''\n",
+ "\n",
"# Variables\n",
"h_g1 = 2797.2; \t\t\t#kJ/kg\n",
"c_ps = 2.25;\n",
@@ -1071,9 +1006,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the entropy of 1 kg of wet steam \n",
- "'''\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -1116,11 +1049,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find :\n",
- "(i) Drop in enthalpy ;\n",
- "(ii) Change in entropy.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 10.; \t\t\t#bar\n",
@@ -1177,10 +1106,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the entropy of 1 kg of superheated steam \n",
- "'''\n",
- "\n",
"\n",
"import math \n",
"\n",
@@ -1224,9 +1149,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the amount of work and heat transfer to or from steam\n",
- "'''\n",
+ "\n",
"# Variables\n",
"m = 3.; \t\t\t#kg\n",
"v1 = 0.75; \t\t\t#m**3/kg\n",
@@ -1281,9 +1204,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the dryness fraction of steam as it enters the tank \n",
- "'''\n",
"\n",
"# Variables\n",
"p = 5.; \t\t\t#bar\n",
@@ -1328,9 +1248,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the mass of steam condensed\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p = 1.1; \t\t\t#bar\n",
@@ -1375,9 +1293,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the dryness fraction of the steam \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 8.; \t\t\t#bar\n",
@@ -1421,9 +1337,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Estimate the quality of steam supplied.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m_w = 2.; \t\t\t#kg\n",
@@ -1472,9 +1386,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the dryness fraction of the sample steam.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 15.; \t\t\t#bar\n",
diff --git a/Industrial_Instrumentation/ch4.ipynb b/Industrial_Instrumentation/ch4.ipynb
index 35fec4af..7eb1e631 100644
--- a/Industrial_Instrumentation/ch4.ipynb
+++ b/Industrial_Instrumentation/ch4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:75cc662b83a20e10c962bb4b327ffefb7e8b88ef4b321db4fa8f1bf933a9eccf"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,8 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the change in internal energy of the working fluid stating whether it is a gain or loss.\n",
- "\n",
+ "#\n",
"# Variables\n",
"Q = -50.; \t\t\t#kJ/kg\n",
"W = -100.; \t\t\t#kJ/kg\n",
@@ -64,9 +64,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the heat flow to and from the cylinder\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"u1 = 450.; \t\t\t#kJ/kg\n",
@@ -104,9 +102,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the heat transferred from the nitrogen to the surroundings.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m = 0.3; \t\t\t#kg\n",
@@ -147,9 +143,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "How much did the internal energy of the gas change ?\n",
- "'''\n",
+ "\n",
"# Variables\n",
"p1 = 105.; \t\t\t#kPa\n",
"V1 = 0.4; \t\t\t#m**3\n",
@@ -189,11 +183,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine : (i) Work done ;\n",
- "(ii) Change in internal energy ; and\n",
- "(iii) Heat transferred\n",
- "'''\n",
+ "\n",
"import math\n",
"\n",
"# Variables\n",
@@ -248,9 +238,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the quantity of heat added to the system.\n",
- "'''\n",
+ "\n",
"\n",
"\n",
"# Variables\n",
@@ -291,11 +279,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine : \n",
- "(i) Work done ;\n",
- "(ii) Change in internal energy of the system.\n",
- "'''\n",
"\n",
"# Variables\n",
"Q2 = 9000.; \t\t\t#kJ\n",
@@ -337,13 +320,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine \u2206U, \u2206PE, \u2206KE, Q and W, when\n",
- "(i) the stone is about to enter the water,\n",
- "(ii) the stone has come to rest in the tank, and\n",
- "(iii) the heat is transferred to the surroundings in such an amount that the stone and water\n",
- "come to their initial temperature.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m = 20.; \t\t\t#kg\n",
@@ -404,14 +381,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) How much will be the heat that flows into the system along path lnm if the work done\n",
- "is 21 kJ ?\n",
- "(ii) When the system is returned from m to l along the curved path, the work done on the\n",
- "system is 42 kJ. Does the system absorb or liberate heat, and how much of the heat is absorbed\n",
- "or liberated ?\n",
- "(iii) If U l = 0 and U n = 84 kJ, find the heat absorbed in the processes ln and nm.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"Q_lqm = 168.; \t\t\t#kJ\n",
@@ -460,9 +430,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "What will be the change of internal energy of the system when its temperature changes\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -510,9 +478,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Completeing the table\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -587,9 +553,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the steam flow round the cycle in kg/s.\n",
- "'''\n",
"\n",
"# Variables\n",
"P = 1200.; \t\t\t#kW\n",
@@ -630,11 +593,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The change in internal energy ;\n",
- "(ii) The work done.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"dT = 25.; \t\t\t#0C\n",
@@ -677,12 +636,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Find the change in energy of the system.\n",
- "(ii) The system is returned to its initial volume by an adiabatic process which requires\n",
- "110 kJ of work. Find the change in energy of the system.\n",
- "(iii) For the combined processes of (i) and (ii) determine the change in energy of the system.\n",
- "'''\n",
"\n",
"# Variables\n",
"Q = 50.; \t\t\t#kJ\n",
@@ -736,11 +689,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) Change in internal energy ;\n",
- "(ii) Change in enthalpy.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -791,14 +740,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine:\n",
- "(i) If the expansion is quasi-static, find Q, \u2206U and W for the process.\n",
- "(ii) In another process, the same system expands according to the same pressure-volume\n",
- "relationship as in part (i), and from the same initial state to the same final state as in part (i), but\n",
- "the heat transfer in this case is 32 kJ. Find the work transfer for this process.\n",
- "(iii) Explain the difference in work transfer in parts (i) and (ii).\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"V1 = 0.25; \t\t\t#m**3\n",
@@ -853,13 +795,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "(i) Heat added/kg ;\n",
- "(ii) Work done/kg ;\n",
- "(iii) Change in internal energy/kg ;\n",
- "(iv) Change in enthalpy/kg.\n",
- "'''\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -928,9 +863,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the work done during the process.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m = 1.; \t\t\t#kg\n",
@@ -971,9 +904,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the direction and magnitude of the work and heat transfer.\n",
- "'''\n",
+ "\n",
"\n",
"from numpy import *\n",
"from scipy.integrate import quad \n",
@@ -1030,11 +961,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The adiabatic work ;\n",
- "(ii) The values of internal energy at all end states if initial value is 105 kJ.\n",
- "'''\n",
"\n",
"# Variables\n",
"Qv = 90.; \t\t\t#kJ\n",
@@ -1088,12 +1014,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The work done ;\n",
- "(ii) The index of expansion, if the above processes are replaced by a single reversible polytropic\n",
- "process giving the same work between the same initial and final states.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"V1 = 0.2; \t\t\t#m**3\n",
@@ -1152,11 +1073,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Evaluate :\n",
- "(i) The work ;\n",
- "(ii) Decrease in internal energy of the system.\n",
- "'''\n",
"\n",
"# Variables\n",
"d = 0.15; \t\t\t#m\n",
@@ -1203,14 +1119,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The mass of gas ;\n",
- "(ii) The value of index \u2018n\u2019 for compression ;\n",
- "(iii) The increase in internal energy of the gas ;\n",
- "(iv) The heat received or rejected by the gas during compression.\n",
- "Take \u03b3 = 1.4, R = 294.2 J/kg\u00b0C.\n",
- "'''\n",
+ "\n",
"import math\n",
"\n",
"# Variables\n",
@@ -1274,12 +1183,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The final temperature ;\n",
- "(ii) The final volume ;\n",
- "(iii) The work done.\n",
- "'''\n",
"\n",
"# Variables\n",
"p1 = 1.02*10**5; \t#Pa\n",
@@ -1336,9 +1239,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate c p and c v .\n",
- "'''\n",
+ "\n",
"\n",
"from numpy import *\n",
"import math\n",
@@ -1390,9 +1291,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the heat flow to or from the cylinder walls.\n",
- "'''\n",
"\n",
"# Variables\n",
"n = 1.3;\n",
@@ -1441,12 +1339,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) Pressure at the end of constant volume cooling.\n",
- "(ii) Change in internal energy during constant volume process.\n",
- "(iii) Net work done and heat transferred during the cycle. Assume\n",
- "'''\n",
+ "\n",
"import math\n",
"\n",
"# Variables\n",
@@ -1513,9 +1406,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the net work done and heat transferred during the cycle.\n",
- "'''\n",
"\n",
"import math\n",
"\n",
@@ -1571,11 +1461,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Sketch the cycle on p-V diagram.\n",
- "(ii) Calculate the work done in each process starting whether it is done on or by the system\n",
- "and evaluate the net cyclic work and heat transfer.\n",
- "'''\n",
+ "\n",
"\n",
"%pylab inline\n",
"\n",
@@ -1705,9 +1591,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine theamount of heat added to the system so that piston moves by 3.5 cm.\n",
- "'''\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -1770,11 +1653,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The change in enthalpy (\u2206 h) ;\n",
- "(ii) Work done during the process (W).\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"r = 10.; \t\t\t#kg/min\n",
@@ -1837,12 +1716,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The rate at which heat is rejected to the turbine, and\n",
- "(ii) The area of the inlet pipe given that the specific volume of the gases at the inlet is\n",
- "0.45 m 3 /kg.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"\n",
@@ -1894,11 +1768,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The power required to drive the compressor ;\n",
- "(ii) The inlet and output pipe cross-sectional areas.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m = 0.5; \t\t\t#kg/s\n",
@@ -1954,9 +1824,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the power developed by the turbine. Consider the boiler and turbine as single system\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"h1 = 800.; \t\t\t#kJ/kg\n",
@@ -1998,9 +1866,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the power output of the turbine.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"g = 9.8; \t\t\t#m/s**2\n",
@@ -2044,9 +1910,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the final enthalpy of steam.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 6.87; \t\t\t#bar\n",
@@ -2088,9 +1952,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the power capacity of the system in MW.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m = 220./60; \t\t\t#kg/s\n",
@@ -2135,9 +1997,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the capacity of the turbine if the gas flow is 5 kg/s.\n",
- "'''\n",
"\n",
"\n",
"# Variables\n",
@@ -2181,10 +2040,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find : (i) Motor power required to drive the compressor ;\n",
- "(ii) Ratio of inlet to outlet pipe diameter.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"C1 = 12.; \t\t\t#m/s\n",
@@ -2235,9 +2091,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Compute the amount of heat transfer to the atmosphere from the compressor per kg of air.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"W = -175.; \t\t\t #kJ/kg\n",
@@ -2277,12 +2131,6 @@
"collapsed": false,
"input": [
"\n",
- "'''\n",
- "(i) Find the velocity at exit of the nozzle.\n",
- "(ii) If the inlet area is 900 cm 2 and the specific volume at inlet is 0.187 m 3 /kg, find the mass\n",
- "flow rate.\n",
- "(iii) If the specific volume at the nozzle exit is 0.498 m 3 /kg, find the exit area of nozzle.\n",
- "'''\n",
"import math\n",
"\n",
"# Variables\n",
@@ -2339,9 +2187,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "evaluate the heat transfer from the water per kg of water flowing.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"h1 = 240.; \t\t\t#kJ/kg\n",
@@ -2380,9 +2226,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "evaluate the relative velocity of gas leaving the jet pipe. For the gas at t = 820\u00b0C, h = 800 kJ/kg and at 910\u00b0C, 915 kJ/kg.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -2424,9 +2268,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the capacity of the electric motor to run the pump.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -2474,9 +2316,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the velocity of the exhaust jet.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -2524,11 +2364,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate :\n",
- "(i) Rate of heat transfer to the air in the heat exchanger ;\n",
- "(ii) The power output from the turbine assuming no heat loss ;\n",
- "'''\n",
"\n",
"# Variables\n",
"t1 = 20.; \t\t\t#0C\n",
@@ -2584,11 +2419,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The state of steam after cooling ;\n",
- "(ii) The amount of heat rejected by the steam.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"V = 0.028; \t\t\t#m**3\n",
@@ -2644,11 +2475,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) Heat supplied ;\n",
- "(ii) Work done\n",
- "'''\n",
"\n",
"# Variables\n",
"m = 0.08; \t\t\t#kg\n",
@@ -2697,9 +2523,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the heat supplied, and show on a T-s diagram the area which represents the heat flow.\n",
- "'''\n",
+ "\n",
"from numpy import *\n",
"from matplotlib.pyplot import *\n",
"\n",
@@ -2789,12 +2613,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate per kg :\n",
- "(i) The change of internal energy ;\n",
- "(ii) The change of enthalpy ;\n",
- "(iii) The work done.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 7.*10**5; \t\t\t#Pa\n",
@@ -2858,11 +2677,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate per kg of steam :\n",
- "(i) Work done ;\n",
- "(ii) Heat flow to or from the cylinder walls.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -2923,11 +2738,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate per kg of steam :\n",
- "(i) The heat supplied ;\n",
- "(ii) The work done.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 100.; \t\t\t#bar\n",
@@ -2975,9 +2786,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the work done by the steam.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m = 1.; \t\t\t#kg\n",
@@ -3020,11 +2829,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate per kg of steam :\n",
- "(i) The work done during expansion ;\n",
- "(ii) The heat flow to or from the cylinder walls during the expansion.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 7.*10**5; \t\t\t#N/m**2\n",
@@ -3083,9 +2888,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the work done per kg of steam flow through the turbine\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 15.; \t\t\t#bar\n",
@@ -3133,9 +2936,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the quality of the steam leaving the nozzle.\n",
- "'''\n",
+ "\n",
"# Variables\n",
"p1 = 10.; \t\t\t#bar\n",
"t1 = 200.; \t\t\t#0C\n",
@@ -3178,9 +2979,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the initial dryness fraction of the steam.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"h1 = 2776.4; \t\t\t#kJ/kg\n",
@@ -3219,9 +3018,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the exit condition of steam using Mollier chart.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 10.; \t\t\t#bar\n",
@@ -3260,11 +3057,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Change in entropy ;\n",
- "(ii) Change in enthalpy ;\n",
- "(iii) Change in internal energy.\n",
- "'''\n",
+ "\n",
"\n",
"\n",
"import math \n",
@@ -3370,8 +3163,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the mass of air which has left the receiver.\n",
- "\n",
"\n",
"# Variables\n",
"V1 = 5.5; \t\t\t#m**3\n",
@@ -3418,10 +3209,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the work obtainable by utilising the kinetic energy of the discharge air to run a frictionless\n",
- "turbine\n",
- "'''\n",
+ "\n",
"# Variables\n",
"cp = 1.; \t\t\t#kJ/kg.K\n",
"cv = 0.711; \t\t\t#kJ/kg.K\n",
@@ -3471,11 +3259,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Final state condition ;\n",
- "(ii) Work done by the piston ;\n",
- "(iii) Heat transferred to oxygen.\n",
- "'''\n",
+ "\n",
"\n",
"#For oxygen\n",
"import math \n",
diff --git a/Industrial_Instrumentation/ch5.ipynb b/Industrial_Instrumentation/ch5.ipynb
index 575e68d6..66f7a8b4 100644
--- a/Industrial_Instrumentation/ch5.ipynb
+++ b/Industrial_Instrumentation/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:12efbfeaa3ed3ebbe140abe577bbac08dcae30fc36caa52e184adf21fd445870"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The thermal efficiency \n",
- "(ii) The rate of heat rejection.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"Q1 = 1500./60; \t\t#kJ/s\n",
@@ -74,9 +71,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Is it possible to reach initial state by an adiabatic process ?\n",
- "'''\n",
"\n",
"# Variables\n",
"Q_12 = 30.; \t\t#kJ\n",
@@ -117,9 +111,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the co-efficient of performance and heat transfer rate in the condenser of a refrigerator \n",
- "'''\n",
+ "\n",
"# Variables\n",
"Q2 = 12000.; \t\t\t#kJ/h\n",
"W = 0.75*60*60; \t\t#kJ/h\n",
@@ -157,10 +149,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the least power necessary to pump this heat out continuously\n",
- "'''\n",
- "# Variables\n",
+ "\n",
"T2 = 261.; \t\t\t#K\n",
"T1 = 308.; \t\t\t#K\n",
"Q2 = 2.; \t\t\t#kJ/s\n",
@@ -197,11 +186,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) Heat abstracted from outside ;\n",
- "(ii) Co-efficient of performance.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -244,10 +229,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "What is the highest possible theoretical efficiency of a heat engine operating\n",
- "with a hot reservoir of furnace gases \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"T1 = 2373; \t\t\t#K\n",
@@ -284,12 +266,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find :\n",
- "(i) Efficiency of the system ;\n",
- "(ii) The net work transfer ;\n",
- "(iii) Heat rejected to sink.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"T1 = 523.; \t\t\t#K\n",
@@ -333,10 +310,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "An inventor claims that his engine has few specifications :\n",
- "State whether his claim is valid or not.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"T1 = 1023.; \t\t#K\n",
@@ -382,9 +356,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the least rate of heat rejection per kW net output of the engine ?\n",
- "'''\n",
"\n",
"# Variables\n",
"T1 = 1273.; \t\t#K\n",
@@ -424,9 +395,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the power required\n",
- "'''\n",
"\n",
"# Variables\n",
"one_ton_of_refrigeration = 210.; \t\t\t#kJ/min\n",
@@ -467,10 +435,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Which source (1 or 2) would you choose to supply energy to an ideal reversible heat engine that is to produce large amount of\n",
- "power if the temperature of the surroundings is 35\u00b0C ?\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"E = 12000.; \t\t#kJ/min\n",
@@ -522,12 +487,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- ".'''\n",
- "(i) Determine the heat transfer to the refrigerant and the net heat transfer to the reservoir\n",
- "at 50\u00b0C ;\n",
- "(ii) Reconsider (i) given that the efficiency of the heat engine and the C.O.P. of the refrig-\n",
- "erator are each 45 per cent of their maximum possible values.\n",
- "'''\n",
+ "\n",
"\n",
"\n",
"# Variables\n",
@@ -588,10 +548,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) determine the C.O.P. of the machine and work input required.\n",
- "(ii) determine the overall C.O.P. of the system.\n",
- "'''\n",
"\n",
"# Variables\n",
"T1 = 298.; \t\t\t#K\n",
@@ -648,12 +604,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) Power developed by the engine ;\n",
- "(ii) Fuel consumed per hour.\n",
- "Take enthalpy of fusion of ice = 334.5 kJ/kg.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"T_e1 = 493.; \t\t\t#K\n",
@@ -703,9 +654,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the intermediate temperature.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"T1 = 550.; \t\t\t#K\n",
@@ -742,12 +691,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine :\n",
- "(i) The temperature T 3 such that heat supplied to engine Q 1 is equal to the heat absorbed\n",
- "by refrigerator Q 2 .\n",
- "(ii) The efficiency of Carnot engine and C.O.P. of Carnot refrigerator.\n",
- "'''\n",
"\n",
"# Variables\n",
"T1 = 600.; \t\t\t#K\n",
@@ -794,9 +737,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "estimate the energy taken from the reservoir at 1077\u00b0C.\n",
- "'''\n",
"\n",
"# Variables\n",
"T3 = 278.; \t\t\t#K\n",
@@ -835,10 +775,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Classify which of the result report a reversible cycle or irreversible cycle or impossible\n",
- "results.\n",
- "'''\n",
+ "\n",
"# Variables\n",
"Q1 = 300.; \t\t\t#kJ/s\n",
"T1 = 290.; \t\t\t#0C\n",
@@ -895,9 +832,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Verify the Clausius inequality for the cycle.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"P1 = 0.124*10**5; \t\t\t#N/m**2\n",
@@ -943,7 +878,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Verify the Clausius Inequality'''\n",
+ "\n",
"\n",
"# Variables\n",
"T1 = 437.; \t\t\t#K\n",
@@ -990,9 +925,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the entropy changes for the iron cube and the water. Is the process reversible ? If so why ?\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1044,11 +977,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The net heat flow from the air.\n",
- "(ii) The net entropy change.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1104,12 +1033,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The change of entropy,\n",
- "(ii) The heat flow, and\n",
- "(iii) The work done.\n",
- "'''\n",
"\n",
"%pylab inline\n",
"\n",
@@ -1222,9 +1145,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the change in entropy.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1265,9 +1186,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the change of entropy\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1317,9 +1236,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the change of entropy \n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -1369,10 +1285,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Show that the process is irreversible ;\n",
- "(ii) Calculate the change of entropy per kg of air.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1424,14 +1337,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine : \n",
- "(i) Change in enthalpy ;\n",
- "(ii) Change in internal energy ;\n",
- "(iii) Change in entropy ;\n",
- "(iv) Heat transfer ;\n",
- "(v) Work transfer.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1488,13 +1394,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) Change in internal energy,\n",
- "(ii) Work done,\n",
- "(iii) Heat transferred, and\n",
- "(iv) Change in entropy\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1551,9 +1451,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the net work. Also plot the processes on T-S diagram\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from matplotlib.pyplot import *\n",
@@ -1644,11 +1542,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The heat supplied.\n",
- "(ii) The entropy change.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"V1 = 0.004; \t\t\t#m**3\n",
@@ -1699,11 +1593,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) Change in entropy.\n",
- "(ii) Work done\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1756,12 +1646,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) Final specific volume and temperature.\n",
- "(ii) Change of internal energy, work done and heat interaction.\n",
- "(iii) Change in entropy.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1831,11 +1716,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(b)What would be the percentage error if the entropy change is calculated by dividing the\n",
- "quantity of heat exchanged by the mean absolute temperature during the process ?\n",
"\n",
- "'''\n",
"%pylab inline\n",
"import math\n",
"from matplotlib.pyplot import *\n",
@@ -1934,11 +1815,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate :\n",
- "(i) The net heat flow.\n",
- "(ii) The overall change in entropy.\n",
- "'''\n",
"\n",
"from matplotlib.pyplot import *\n",
"from numpy import *\n",
@@ -2032,11 +1908,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Constant volume heat addition till pressure becomes 5 bar, \n",
- "(ii) Constant pressure cooling, and \n",
- "(iii) Isothermal heating to initial state.\n",
- "'''\n",
"\n",
"import math \n",
"from matplotlib.pyplot import *\n",
@@ -2151,9 +2022,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the entropy change of 4 kg of a perfect gas \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -2197,9 +2066,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the entropy of the gas at 25 bar and 750 K temperature.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -2250,12 +2117,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) Final equilibrium temperature,\n",
- "(ii) Final pressure on each side of the diaphragm, and\n",
- "(iii) Entropy change of system.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -2323,9 +2185,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the change in entropy in each of the adiabatic processes.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -2374,11 +2234,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Determine the heat interactions with the other two sources of heat.\n",
- "(ii) Evaluate the entropy change due to each heat interaction with the engine.\n",
- "(iii) Total entropy change during the cycle.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -2448,9 +2304,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the maximum amount of work that can be recovered as the system is cooled down to the temperature of the reservoir.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -2503,9 +2357,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Establish the direction of the flow of the air in the duct.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -2562,9 +2414,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the change of entropy due to mixing process.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -2610,14 +2460,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(a)find :\n",
- "(i) Entropy change of water ;\n",
- "(ii) Entropy change of the heat reservoir ;\n",
- "(iii) Entropy change of the universe.\n",
- "(b)what will the entropy change of the universe be ?\n",
- "(c) Explain how water might be heated from 0\u00b0C to 90\u00b0C \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -2694,10 +2537,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Determine the entropy increase of the universe.\n",
- "(ii) What is the minimum amount of work necessary to convert the water back into ice at \u2013 5\u00b0C ?\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Industrial_Instrumentation/ch6.ipynb b/Industrial_Instrumentation/ch6.ipynb
index a3874b6a..2fc63442 100644
--- a/Industrial_Instrumentation/ch6.ipynb
+++ b/Industrial_Instrumentation/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:b3244020b726410d1f880fd32ec7c61d578b2f34e3bde3131de02645aee53468"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the irreversibility if the sink temperature is 293 K. \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -78,11 +77,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "(i) The entropy produced during heat transfer ;\n",
- "(ii) The decrease in available energy after heat transfer.\n",
- "'''\n",
"\n",
"# Variables\n",
"T1 = 1000.; \t\t\t#K\n",
@@ -132,13 +126,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The availability if the system goes through the ideal work producing process.\n",
- "(ii) The availability and effectiveness if the air is cooled at constant pressure to atmos-\n",
- "pheric temperature without bringing it to complete dead state. Take c v = 0.718 kJ/kg K ;\n",
- "c p = 1.005 kJ/kg K\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -204,9 +192,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Obtain the results on the basis of 1 kg of water.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -257,9 +242,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the loss in available energy due to above heat transfer.\n",
- "'''\n",
"\n",
"import math\n",
"\n",
@@ -309,9 +291,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the unavailable energy in 60 kg of water at 60\u00b0C \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -360,9 +340,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the loss in availability for the process.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -407,11 +384,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Determine the availability of the system if the surrounding pressure and temperature\n",
- "are 1 bar and 290 K respectively.\n",
- "(ii) determine the availability and effectiveness\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -472,9 +444,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine actual and minimum power required to run the compressor. \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -527,9 +497,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the loss in availability if the surrounding temperature is 290 K.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -584,9 +552,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the decrease in available energy \n",
- "'''\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -650,9 +615,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the loss in availability on the basis of one kg of oil per second.\n",
- "'''\n",
"\n",
"import math\n",
"\n",
@@ -706,9 +668,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the net increase in entropy and unavailable energy when the system reaches common temperature\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -760,10 +719,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "What is the fraction of the available energy in the heat transferred from the process vapour\n",
- "at 400\u00b0C that is lost due to the irreversible heat transfer at 200\u00b0C ?\n",
- "'''\n",
"\n",
"# Variables\n",
"T1 = 673.; \t\t\t#K\n",
@@ -802,9 +757,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the effectiveness of the heating process when the atmospheric temperature is 15\u00b0C.\n",
- "'''\n",
+ "\n",
"import math \n",
"\n",
"# Variables\n",
@@ -848,11 +801,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate :\n",
- "(i) The ratio of mass flow of air initially at 100\u00b0C to that initially at 20\u00b0C.\n",
- "(ii) The effectiveness of heating process, if the atmospheric temperature is 20\u00b0C.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -902,12 +851,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine :\n",
- "(i) The maximum work ;\n",
- "(ii) The change in availability ;\n",
- "(iii) The irreversibility.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -964,12 +908,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine per kg of air :\n",
- "(i) The decrease in availability ;\n",
- "(ii) The maximum work ;\n",
- "(iii) The irreversibility.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1027,11 +966,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine\n",
- "(i) The irreversibility ;\n",
- "(ii) The effectiveness.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1085,11 +1020,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) find the rise in the temperature of the bearings when the flywheel has come to rest.\n",
- "(ii) Calculate the greatest possible amount of the above heat which may be returned to the\n",
- "flywheel? What would be the final r.p.m. of the flywheel, if it is set in motion with this available energy ?\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -1160,11 +1091,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) Reversible work and actual work assuming the process to be adiabatic ;\n",
- "(ii) Irreversibility and effectiveness of the system on the basis of 1 kg of air flow.\n",
- "'''\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -1230,12 +1157,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The isentropic efficiency of the process ;\n",
- "(ii) The loss of availability of the system assuming an atmospheric temperature of 20\u00b0C ;\n",
- "(iii) The effectiveness of the process ;\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 20.; \t\t\t#bar\n",
diff --git a/Industrial_Instrumentation/ch7.ipynb b/Industrial_Instrumentation/ch7.ipynb
index f35bb080..50954e24 100644
--- a/Industrial_Instrumentation/ch7.ipynb
+++ b/Industrial_Instrumentation/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:83b04c725ceaf9254a1b319f62cfdfa8f3ba518f51286a3d08dbbb299f685e47"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,14 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the following :\n",
- "(i) Work done on the copper during the process,\n",
- "(ii) Change in entropy,\n",
- "(iii) The heat transfer,\n",
- "(iv) Change in internal energy, and\n",
- "(v) (c p \u2013 c v ) for this change of state.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"B = 5.*10**(-5); \t\t\t# /K\n",
@@ -89,9 +83,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Using Clausius-Claperyon\u2019s equation, find enthalpy of vapourisation.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"vg = 0.1274; \t\t\t#m**3/kg\n",
@@ -130,9 +122,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the pressure an ice skate blade must exert to allow smooth ice skate at \u2013 10\u00b0C.\n",
- "'''\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -175,9 +165,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the specific volume v g of saturation mercury vapour at 0.1 bar\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"h_fg = 294.54; \t\t\t#kJ/kg\n",
diff --git a/Industrial_Instrumentation/ch8.ipynb b/Industrial_Instrumentation/ch8.ipynb
index 5b548006..0650ff08 100644
--- a/Industrial_Instrumentation/ch8.ipynb
+++ b/Industrial_Instrumentation/ch8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:417a431bb73c0f7340e3aa0171c3fc4bd9ac17c782d95798e961af6aeee610ed"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "How many kg of air must be removed from the chamber during the process ? Express this\n",
- "mass as a volume measured at 1 bar and 25\u00b0C.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -81,11 +79,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) How many kg of nitrogen will the flask hold at the designed conditions ?\n",
- "(ii) At what temperature must the fusible plug melt in order to limit the pressure of a full\n",
- "flask to a maximum of 150 bar ?\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"V = 0.04; \t\t\t#m**3\n",
@@ -135,12 +129,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) What mass of original gas must have escaped if the dimensions of the balloon is not\n",
- "changed ?\n",
- "(ii) Find the amount of heat to be removed to cause the same drop in pressure at constant\n",
- "volume.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -195,13 +184,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(i) Calculate pressure and the specific volume of the gas.\n",
- "(ii) evaluate the values of c p and c v .\n",
- "(iii) evaluate the final pressure of gas.\n",
- "(iv) Evaluate the increase in specific internal energy, the increase in specific enthalpy, increase\n",
- "in specific entropy and magnitude and sign of heat transfer.\n",
- "'''\n",
+ "\n",
"\n",
"from numpy import *\n",
"import math \n",
@@ -292,13 +275,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(a) \n",
- "determine :\n",
- "(i) The final specific volume, temperature and increase in entropy ;\n",
- "(ii) The work done and the heat transfer.\n",
- "(b) Repeat (a) assuming the process to be irreversible and adiabatic between end states.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -383,9 +360,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine the pressure in the spheres when the system attains equilibrium.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"d = 2.5; \t\t\t#m; diameter\n",
@@ -430,9 +405,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "evaluate the heat transfer rate from the gas and the power delivered by the turbine.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m = 6.5/60; \t\t\t#kg/s\n",
@@ -500,12 +473,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Evaluate the following :\n",
- "(i) The heat received in the cycle ;\n",
- "(ii) The heat rejected in the cycle ;\n",
- "(iii) Efficiency of the cycle.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -579,11 +547,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Compute the pressure by\n",
- "(i) Van der Waals\u2019 equation\n",
- "(ii) Perfect gas equation.\n",
- "'''\n",
+ "\n",
"\n",
"\n",
"# Variables\n",
@@ -633,13 +597,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Estimate the\n",
- "pressure exerted by CO 2 by using :\n",
- "(i) Perfect gas equation\n",
- "(ii) Van der Waals\u2019 equation\n",
- "(iii) Beattie Bridgeman equation.\n",
- "'''\n",
+ "\n",
"# Variables\n",
"V = 3.; \t\t\t#m**3\n",
"m = 10.; \t\t\t#kg\n",
@@ -699,11 +657,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find :\n",
- "(i) The work done during the process\n",
- "(ii) The final pressure.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -760,9 +714,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "compute the temperature.\n",
- "'''\n",
"\n",
"# Variables\n",
"pr = 20;\n",
@@ -801,9 +752,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the density using the compressibility chart\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p = 260.*10**5; \t\t\t#Pa\n",
@@ -846,9 +795,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "What should be the temperature of 1.3 kg of CO 2 gas to behave as an ideal ?\n",
- "'''\n",
+ "\n",
"# Variables\n",
"p = 200.*10**5; \t\t\t#Pa\n",
"pc = 73.86*10**5; \t\t\t#Pa\n",
@@ -888,9 +835,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the mass of H 2 in the balloon using real gas equation.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -937,9 +881,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the value of compressibility factor \n",
- "'''\n",
+ "\n",
"# Calculations\n",
"Z_cp = 3./2-9./8;\n",
"\n",
diff --git a/Industrial_Instrumentation/ch9.ipynb b/Industrial_Instrumentation/ch9.ipynb
index db39a5a3..fb7369a6 100644
--- a/Industrial_Instrumentation/ch9.ipynb
+++ b/Industrial_Instrumentation/ch9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:48e3494ec100096b5d245db7f5c631c3ee779596f8c61001fb43d1b21ba3707b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The partial pressure of each constituent,\n",
- "(ii) The total pressure in the vessel, and\n",
- "'''\n",
"\n",
"# Variables\n",
"V = 0.35; \t\t\t#m**3\n",
@@ -91,10 +87,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate : (i) Gas constant for air ;\n",
- "(ii) Apparent molecular weight.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"R0 = 8.314;\n",
@@ -151,9 +144,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the analysis by volume and the partial pressure \n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p = 1.; \t\t\t#bar\n",
@@ -237,13 +228,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate for the mixture :\n",
- "(i) The masses of CO 2 , O 2 and N 2 , and the total mass ;\n",
- "(ii) The percentage carbon content by mass ;\n",
- "(iii) The apparent molecular weight and the gas constant for the mixture ;\n",
- "(iv) The specific volume of the mixture\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"p = 1.*10**5; \t\t\t#Pa\n",
@@ -335,11 +320,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate :\n",
- "(ii) The volume of the container.\n",
- "(i) The mass of O 2 required ;\n",
- "'''\n",
"\n",
"# Variables\n",
"p = 1.*10**5; \t\t\t#Pa\n",
@@ -394,9 +374,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate per mole of mixture the mass of mixture to be removed, and mass of CO to be added.\n",
- "'''\n",
+ "\n",
"\n",
"#Let composition of mixture by volume be denoted by c1\n",
"#Let Final composition desired be denoted by c2\n",
@@ -446,12 +424,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate per kg of gas :\n",
- "(i) The workdone ;\n",
- "(ii) The heat flow ;\n",
- "(iii) Change of entropy per kg of mixture.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -601,8 +574,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine :\n",
- "# (i) Partial pressures of the constituents ; (ii) Gas constant of mixture.\n",
"\n",
"import math \n",
"\n",
@@ -680,16 +651,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find :\n",
- "(i) The mole fraction of each constituent,\n",
- "(ii) The equivalent molecular weight of the mixture,\n",
- "(iii) The equivalent gas constant of the mixture,\n",
- "(iv) The partial pressures and partial volumes,\n",
- "(v) The volume and density of the mixture, and\n",
- "(vi) The c p and c v of the mixture.\n",
- "\n",
- "'''\n",
"\n",
"# Variables\n",
"p = 4.*10**5; \t\t \t#Pa\n",
@@ -829,12 +790,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The final temperature and pressure of the mixture ;\n",
- "(ii) The change of entropy of the system.\n",
"\n",
- "'''\n",
"\n",
"# Variables\n",
"Cv_O2 = 21.07; \t\t\t#kJ/mole K\n",
@@ -905,10 +861,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(a) Calculate : (i) The final equilibrium pressure ;\n",
- "(ii) The amount of heat transferred to the surroundings ;\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -994,9 +947,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the increase in entropy \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1042,7 +993,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the mass of O 2 added.\n",
+ "\n",
"# Variables\n",
"m_N2 = 2.5; \t\t\t#kg \n",
"M_N2 = 28.;\n",
@@ -1084,13 +1035,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The moles of nitrogen per mole of oxygen ;\n",
- "(ii) The partial pressure of oxygen and nitrogen if the total pressure is atmosphere ;\n",
- "(iii) The kg of nitrogen per kg of mixture.\n",
"\n",
- "'''\n",
"\n",
"# Variables\n",
"n_O2 = 1.;\n",
@@ -1146,7 +1091,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- " # Find the masses of O 2 , N 2 and CO 2 in the cylinder.\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1216,12 +1161,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate-\n",
- "(i) The partial pressure ;\n",
- "(ii) The total pressure ;\n",
- "(iii) The mean value of R for the mixture.\n",
- "'''\n",
+ "\n",
"# Variables\n",
"V = 6; \t\t \t#m**3\n",
"A = 0.45; \n",
@@ -1283,13 +1223,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine-\n",
- "(i) The mole fraction of each component ; (ii) The average molecular weight ;\n",
- "(iii) The specific gas constant ;\n",
- "(iv) The volume and density ;\n",
- "(v) The partial pressures and partial volumes.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"m_O2 = 4.; \t\t\t#kg\n",
@@ -1381,11 +1315,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate :\n",
- "(i) The final temperature of the mixture ; \n",
- "(ii) The change in entropy.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1450,9 +1380,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the entropy change in the mixing process.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -1506,12 +1433,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine :\n",
- "(i) The temperature of the equilibrium mixture ;\n",
- "(ii) The pressure of the mixture ;\n",
- "(iii) The change in entropy for each component and total value.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -1590,7 +1512,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate c v and c p of the mixture.\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Introduction_To_Chemical_Engineering/ch1.ipynb b/Introduction_To_Chemical_Engineering/ch1.ipynb
index a09b75a5..b28f0745 100644
--- a/Introduction_To_Chemical_Engineering/ch1.ipynb
+++ b/Introduction_To_Chemical_Engineering/ch1.ipynb
@@ -27,17 +27,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find composition of air by weight\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"y_oxygen = 0.21 #mole fraction of oxygen\n",
"y_nitrogen = 0.79 #mole fraction of nitrogen\n",
"molar_mass_oxygen = 32.\n",
"molar_mass_nitrogen = 28.\n",
"\n",
- "# Calculations and Results\n",
"molar_mass_air = y_oxygen*molar_mass_oxygen+y_nitrogen*molar_mass_nitrogen;\n",
"mass_fraction_oxygen =y_oxygen*molar_mass_oxygen/molar_mass_air;\n",
"mass_fraction_nitrogen = y_nitrogen*molar_mass_nitrogen/molar_mass_air;\n",
@@ -83,18 +80,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#find the volume occupied by propane\n",
"\n",
"import math \n",
- "# Variables\n",
"mass_propane=14.2 #in kg\n",
"molar_mass=44 #in kg\n",
"\n",
- "# Calculations\n",
"moles=(mass_propane*1000)/molar_mass;\n",
"volume=22.4*moles; #in liters\n",
"\n",
- "# Results\n",
"print \"volume = %d liters\"%(volume)\n"
],
"language": "python",
@@ -122,18 +115,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the average weight, weight composition, gas volume in absence of SO2\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"y_CO2 = 0.25;\n",
"y_CO = 0.002;\n",
"y_SO2 = 0.012;\n",
"y_N2 = 0.680;\n",
"y_O2 = 0.056;\n",
"\n",
- "# Calculations and Results\n",
"Mm = y_CO2*44+y_CO*28+y_SO2*64+y_N2*28+y_O2*32;\n",
"print \" molar mass = %d \"%(Mm)\n",
"\n",
@@ -201,15 +191,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find volume of NH3 dissolvable in water\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"p=1. #atm\n",
"H=2.7 #atm\n",
"\n",
- "# Calculations and Results\n",
"x=p/H;\n",
"\n",
"mole_ratio = (x)/(1-x);\n",
@@ -247,21 +234,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to calculate amount of CO2 released by water\n",
"\n",
"import math \n",
- "# Variables\n",
"p=746 #in mm Hg\n",
"H=1.08*10**6 #in mm Hg, Henry's constant\n",
"\n",
- "# Calculations\n",
"x= p/H; #mole fraction of CO2\n",
"X=x*(44./18); #mass ratio of CO2 in water\n",
"\n",
"initial_CO2 = 0.005; #kg CO2/kg H20\n",
"G=1000*(initial_CO2-X);\n",
"\n",
- "# Results\n",
"print \"CO2 given up by 1 cubic meter of water = %f kg CO2/cubic meter H20\"%(G)\n"
],
"language": "python",
@@ -289,17 +272,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find vapor pressre of ethyl alchohal\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"pa1 = 23.6; #VP of ethyl alchohal at 10 degree C\n",
"pa3=760. #VP of ethyl alchohal at 78.3 degree C in mm Hg\n",
"pb1 = 9.2 #VP of ethyl water at 10 degree C in mm Hg\n",
"pb3=332. #VP of ethyl water at 78.3 degree C in mm Hg\n",
"\n",
- "# Calculations\n",
"C=(math.log10(pa1/pa3)/(math.log10(pb1/pb3)));\n",
"\n",
"pb2=149. #VP of water at 60 degree C in mm Hg\n",
@@ -308,7 +288,6 @@
"pa=C*math.log10(pas);\n",
"pa2=pa3/(10**pa);\n",
"\n",
- "# Results\n",
"print \"vapor pressure of ethyl alcholoh at 60 degree C = %f mm Hg\"%(pa2)\n"
],
"language": "python",
@@ -336,20 +315,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find vapor pressure using duhring plot\n",
"\n",
"import math \n",
- "# Variables\n",
"t1 = 41. #in degree C\n",
"t2=59. #in degree C\n",
"theta_1 =83. #in degree C\n",
"theta_2=100. #in degree C\n",
"\n",
- "# Calculations\n",
"K = (t1-t2)/(theta_1-theta_2);\n",
"t=59+(K*(104.2-100));\n",
"\n",
- "# Results\n",
"print \"boiling point of SCl2 at 880 Torr = %f degree celcius\"%(t)\n"
],
"language": "python",
@@ -377,20 +352,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the amount of steam released\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"vp_C6H6 = 520. #in torr\n",
"vp_H2O = 225. #in torr\n",
"mass_water=18.\n",
"mass_benzene=78.\n",
"\n",
- "# Calculations\n",
"amount_of_steam = (vp_H2O/vp_C6H6)/(mass_benzene/mass_water);\n",
"\n",
- "# Results\n",
"print \"amount of steam = %f\"%( amount_of_steam)\n"
],
"language": "python",
@@ -418,17 +389,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find equilibrium vapor liquid composition\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"p0b = 385. #vapor pressue of benzene at 60 degree C in torr\n",
"p0t=140. #vapor pressue of toluene at 60 degree C in torr\n",
"xb=0.4;\n",
"xt=0.6;\n",
"\n",
- "# Calculations and Results\n",
"pb=p0b*xb;\n",
"pt=p0t*xt;\n",
"P=pb+pt;\n",
@@ -439,9 +407,7 @@
"yt=pt/P;\n",
"print \"vapor composition of benzene = %f vapor composition of toluene = %f\"%(yb,yt)\n",
"\n",
- "#for liquid boiling at 90 degree C and 760 torr, liquid phase composition\n",
"x=(760.-408)/(1013-408);\n",
- "#(1013*x)+(408*(1-x))==760;\n",
"print \"mole fraction of benzene in liquid mixture = %.3f mole fraction of toluene in liquid mixture= %.3f\"%(x,1-x)\n",
"print \"Thus, the liquid mixture contained %.1f mole %% benzene and %.1f mole %% toluene\"%(x*100,(1-x)*100)"
],
@@ -473,18 +439,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find relation between friction factor and reynold's number\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "#math.log f=y, math.log Re=x, math.log a=c\n",
"sigma_x=23.393;\n",
"sigma_y=-12.437;\n",
"sigma_x2=91.456\n",
"sigma_xy=-48.554;\n",
"\n",
- "# Calculations and Results\n",
"m=((6*sigma_xy)-(sigma_x*sigma_y))/(6*sigma_x2-(sigma_x)**2);\n",
"print \"m = %f \"%(m)\n",
"\n",
@@ -520,7 +482,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the average velocity\n",
"\n",
"import math\n",
"from numpy import *\n",
@@ -528,21 +489,17 @@
"\n",
"%pylab inline\n",
"\n",
- "# Variables\n",
"u = array([2,1.92,1.68,1.28,0.72,0]);\n",
"r = array([0,1,2,3,4,5]);\n",
"\n",
- "# Calculations\n",
"z = u*r;\n",
"plot(r,z)\n",
"suptitle(\"variation of ur with r\")\n",
"xlabel(\"r\")\n",
"ylabel(\"ur\")\n",
"show()\n",
- "#by graphical integration, we get\n",
"u_avg = (2./25)*12.4\n",
"\n",
- "# Results\n",
"print \"average velocity = %f cm/s\"%(u_avg)\n"
],
"language": "python",
@@ -593,16 +550,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the average velocity\n",
"\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"n = 6.;\n",
"h = (3. - 0)/n;\n",
"\n",
- "# Calculations and Results\n",
"I = (h/2.)*(0+2*0.97+2*1.78+2*2.25+2*2.22+2*1.52+0);\n",
"u_avg = (2./3**2)*I;\n",
"\n",
@@ -646,22 +600,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the settling velocity as a function of time\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"z0 = 30.84;\n",
"z1 = 29.89;\n",
"z2 = 29.10;\n",
"h = 4;\n",
"\n",
- "# Calculations\n",
"u1_t0 = (-3*z0+4*z1-z2)/(2*h);\n",
"u1_t4 = (-z0+z2)/(2*h);\n",
"u1_t8 = (z0-4*z1+3*z2)/(2*h);\n",
"\n",
- "#considering data set for t = 4,8,12 min\n",
"z0 = 29.89;\n",
"z1 = 29.10;\n",
"z2 = 28.30;\n",
@@ -669,7 +619,6 @@
"u2_t8 = (-z0+z2)/(2*h);\n",
"u2_t12 = (z0-4*z1+3*z2)/(2*h);\n",
"\n",
- "#considering data set for t = 8,12,16 min\n",
"z0 = 29.10;\n",
"z1 = 28.30;\n",
"z2 = 27.50;\n",
@@ -677,12 +626,10 @@
"u3_t12 = (-z0+z2)/(2*h);\n",
"u3_t16 = (z0-4*z1+3*z2)/(2*h);\n",
"\n",
- "#taking average\n",
"u_t4 = (u1_t4+u2_t4)/2;\n",
"u_t8 = (u1_t8+u2_t8+u3_t8)/3;\n",
"u_t12 = (u2_t12+u3_t12)/2;\n",
"\n",
- "# Results\n",
"print \"u_t0 = %f cm/min u_t4 = %f cm/min u_t8 = %f cm/min u_t12 = %f/n cm/min u_t16 =%f/n cm/min \"%(u1_t0,u_t4,u_t8,u_t12,u3_t16)\n"
],
"language": "python",
@@ -710,11 +657,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the flow rate and pressure drop\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"density_water=988. #in kg/m3\n",
"viscosity_water=55.*10**-5 #in Ns/m2\n",
"density_air=1.21 #in kg/m3\n",
@@ -722,7 +667,6 @@
"L=1 #length in m\n",
"\n",
"\n",
- "# Calculations and Results\n",
"L1=10.*L #length in m\n",
"Q=0.0133;\n",
"\n",
@@ -730,7 +674,6 @@
"\n",
"print \"flow rate = %f cubic meter/s\"%(Q1)\n",
"\n",
- "#equating euler number\n",
"\n",
"p=9.8067*10**4; #pressure in pascal\n",
"p1=(p*density_water*Q**2*L**4)/(density_air*Q1**2*L1**4);\n",
@@ -763,20 +706,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the specific gravity of plasstic\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"L=1. #length of prototype in m\n",
"L1=10*L #length of model in m\n",
"density_prototype=2.65 #gm/cc\n",
"density_water=1. #gm/cc\n",
"\n",
- "# Calculations\n",
"density_model=(L**3*(density_prototype-density_water))/(L1**3)+1;\n",
"\n",
- "# Results\n",
"print \"specific gravity of plastic = %f\"%(density_model)\n"
],
"language": "python",
@@ -804,20 +743,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find error in actual data and nomographic chat value\n",
"\n",
"import math \n",
"from numpy import linspace\n",
"from matplotlib.pyplot import *\n",
"\n",
"\n",
- "# Variables\n",
- "#for my\n",
"ly = 8 #in cm\n",
"my = ly/((1/0.25) - (1/0.5));\n",
"lz = 10.15 #in cm\n",
"\n",
- "# Calculations and Results\n",
"mz = lz/((1./2.85) - (1/6.76));\n",
"mx = (my*mz)/(my+mz);\n",
"print \"mx = %f cm\"%(mx)\n",
@@ -850,21 +785,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the economic pipe diameter from nomograph\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "#from the nomograph,we get the values of w and density\n",
"w=450. #in kg/hr\n",
"density=1000. #in kg/m3\n",
"d=16. #in mm\n",
"\n",
- "# Calculations\n",
"u=(w/density)/(3.14*d**2/4);\n",
"Re=u*density*d/0.001;\n",
"\n",
- "# Results\n",
"if Re>2100:\n",
" print \"flow is turbulent and d= %f mm\"%(d)\n",
"else:\n",
diff --git a/Introduction_To_Chemical_Engineering/ch2.ipynb b/Introduction_To_Chemical_Engineering/ch2.ipynb
index 7f49d9ae..845b485b 100644
--- a/Introduction_To_Chemical_Engineering/ch2.ipynb
+++ b/Introduction_To_Chemical_Engineering/ch2.ipynb
@@ -27,21 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the volume of oxygen that can be obtained\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"p1=15. #in bar\n",
"p2=1.013 #in bar\n",
"t1=283. #in K\n",
"t2=273. #in K\n",
"v1=10. #in l\n",
"\n",
- "# Calculations\n",
"v2=p1*v1*t2/(t1*p2);\n",
"\n",
- "# Results\n",
"print \"volume of oxygen = %f liters\"%(v2)\n"
],
"language": "python",
@@ -69,16 +65,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find volumetric composition,partial pressue of each gas and total pressure of mixture\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"nCO2 = 2./44; #moles of CO2\n",
"nO2 = 4./32; #moles of O2\n",
"nCH4 = 1.5/16; #moles of CH4\n",
"\n",
- "# Calculations and Results\n",
"total_moles = nCO2+nO2+nCH4;\n",
"yCO2 = nCO2/total_moles;\n",
"yO2 = nO2/total_moles;\n",
@@ -122,21 +115,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find equivalent mass of metal\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P=104.3 #total pressure in KPa\n",
"pH2O=2.3 #in KPa\n",
"pH2=P-pH2O; #in KPa\n",
"\n",
- "# Calculations and Results\n",
"VH2=209*pH2*273/(293*101.3)\n",
"\n",
"print \"volume of hydrogen obtained = %f ml\"%(VH2)\n",
"\n",
- "#calculating amount of metal having 11.2l of hydrogen\n",
"\n",
"m=350/196.08*11.2 #mass of metal in grams\n",
"print \"mass of metal equivalent to 11.2 litre/mol of hydrogen = %f gm\"%(m)\n"
@@ -167,15 +156,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find NaCl content in NaOH solution\n",
"\n",
"import math \n",
- "# Variables\n",
"w=2 #in gm\n",
"m=0.287 #in gm\n",
"\n",
- "# Calculations and Results\n",
- "#precipitate from 58.5gm of NaCl=143.4gm\n",
"mNaCl=58.5/143.4*m;\n",
"\n",
"print \"mass of NaCl = %f gm\"%(mNaCl )\n",
@@ -209,20 +194,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the carbon content in sample\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"w=4.73 #in gm5\n",
"VCO2=5.30 #in liters\n",
"\n",
- "# Calculations\n",
"weight_CO2=44/22.4*VCO2;\n",
"carbon_content=12./44*weight_CO2;\n",
"percentage_content=(carbon_content/w)*100;\n",
"\n",
- "# Results\n",
"print \"percentage amount of carbon in sample = %f\"%(percentage_content)\n"
],
"language": "python",
@@ -250,19 +231,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the volume of air\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"volume_H2=0.5 #in m3\n",
"volume_CH4=0.35 #in m3\n",
"volume_CO=0.08 #in m3\n",
"volume_C2H4=0.02 #in m3\n",
"volume_oxygen=0.21 #in m3 in air\n",
"\n",
- "# Calculations\n",
- "#required oxygen for various gases\n",
"H2=0.5*volume_H2;\n",
"CH4=2*volume_CH4;\n",
"CO=0.5*volume_CO;\n",
@@ -271,7 +248,6 @@
"total_O2=H2+CH4+CO+C2H4;\n",
"oxygen_required=total_O2/volume_oxygen;\n",
"\n",
- "# Results\n",
"print \"amount of oxygen required = %f cubic meter\"%(oxygen_required)\n"
],
"language": "python",
@@ -299,23 +275,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the volume of sulphuric acid and mass of water consumed\n",
"\n",
"import math \n",
"\n",
"\n",
- "# Variables\n",
"density_H2SO4 = 1.10 #in g/ml\n",
"mass_1 = 100*density_H2SO4; #mass of 100ml of 15% solution\n",
"mass_H2SO4 = 0.15*mass_1;\n",
"density_std = 1.84 #density of 96% sulphuric acid\n",
"mass_std = 0.96*density_std; #mass of H2SO4 in 1ml 96% H2SO4\n",
"\n",
- "# Calculations\n",
"volume_std = mass_H2SO4/mass_std; #volume of 96%H2SO4\n",
"mass_water = mass_1 - mass_H2SO4;\n",
"\n",
- "# Results\n",
"print \"volume of 0.96 H2SO4 required = %f ml\"%(volume_std)\n",
"print \"mass of water required = %f g\"%(mass_water)\n"
],
@@ -345,18 +317,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find molarity,molality and normality\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"w_H2SO4=0.15 #in gm/1gm solution\n",
"density=1.10 #in gm/ml\n",
"m=density*1000; #mass per liter\n",
"weight=m*w_H2SO4; #H2SO4 per liter solution\n",
"molar_mass=98;\n",
"\n",
- "# Calculations and Results\n",
"Molarity=weight/molar_mass;\n",
"print \"Molarity = %f mol/l\"%(Molarity)\n",
"\n",
@@ -394,18 +363,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find normality\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"molar_mass_BaCl2=208.3; #in gm\n",
"equivalent_H2SO4=0.144;\n",
"\n",
- "# Calculations\n",
"normality=equivalent_H2SO4*1000/28.8;\n",
"\n",
- "# Results\n",
"print \"Normality = %f N\"%(normality)\n"
],
"language": "python",
@@ -433,20 +398,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find amount of KClO3 precipitated\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"solubility_70=30.2 #in gm/100gm\n",
"w_solute=solubility_70*350/130.2; #in gm\n",
"\n",
- "# Calculations\n",
"w_water=350-w_solute;\n",
"solubility_30=10.1 #in gm/100gm\n",
"precipitate=(solubility_70-solubility_30)*w_water/100\n",
"\n",
- "# Results\n",
"print \"amount precipitated = %f gm\"%(precipitate)\n"
],
"language": "python",
@@ -474,19 +435,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the pressure for solubility of CO2\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"absorbtion_coefficient=1.71 #in liters\n",
"molar_mass=44;\n",
"\n",
- "# Calculations\n",
"solubility=absorbtion_coefficient*molar_mass/22.4; #in gm\n",
"pressure=8/solubility*101.3;\n",
"\n",
- "# Results\n",
"print \"pressure required = %f kPa\"%(pressure)\n"
],
"language": "python",
@@ -514,23 +471,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the vapor pressure of water\n",
"\n",
"import math \n",
"\n",
"\n",
- "# Variables\n",
"w_water=540. #in gm\n",
"w_glucose=36. #in gm\n",
"m_water=18.; #molar mass of water\n",
"m_glucose=180.; #molar mass of glucose\n",
"\n",
- "# Calculations\n",
"x=(w_water/m_water)/(w_water/m_water+w_glucose/m_glucose);\n",
"p=8.2*x;\n",
"depression=8.2-p;\n",
"\n",
- "# Results\n",
"print \"depression in vapor pressure = %f Pa\"%(depression*1000)\n"
],
"language": "python",
@@ -558,21 +511,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the boiling point of solution\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"w_glucose=9. #in gm\n",
"w_water=100. #in gm\n",
"E=0.52;\n",
"m=90/180.; #moles/1000gm water\n",
"\n",
- "# Calculations\n",
"delta_t=E*m;\n",
"boiling_point=100+delta_t;\n",
"\n",
- "# Results\n",
"print \"boiling_point of water = %f degreeC\"%(boiling_point)\n"
],
"language": "python",
@@ -600,16 +549,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the molar mass and osmotic pressure\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"K=1.86;\n",
"c=15 #concentration of alcohol\n",
"delta_t=10.26;\n",
"\n",
- "# Calculations and Results\n",
"m=delta_t/K; #molality\n",
"M=c/(m*85); #molar mass\n",
"print \"molar mass = %f gm\"%(M*1000)\n",
@@ -648,22 +594,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find u_in, M_v, k'\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"u_in = 0.575 #from the graph\n",
"u_s = 0.295 #in mPa-s\n",
"\n",
- "# Calculations\n",
"M_v = (u_in/(5.80*10**-5))**(1/0.72);\n",
"u_red = 0.628; #in dl/g\n",
"\n",
"c = 0.40 #in g/dl\n",
"k = (u_red-u_in)/((u_in**2)*c);\n",
"\n",
- "# Results\n",
"print \"k = %f Mv = %fu_in = %f dl/gm\"%(k,M_v,u_in)\n"
],
"language": "python",
@@ -691,11 +633,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the molecular formula\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"C=54.5 #% of carbon\n",
"H2=9.1 #% of hydrogen\n",
"O2=36.4 #% of oxygen\n",
@@ -705,13 +645,11 @@
"molar_mass=88.;\n",
"density=44.;\n",
"\n",
- "# Calculations\n",
"ratio=molar_mass/density;\n",
"x=ratio*2;\n",
"y=ratio*1;\n",
"z=ratio*4;\n",
"\n",
- "# Results\n",
"print \"x = %f y = %f z = %f\"%(x,y,z)\n",
"print \"formula of butyric acid is = C4H8O2\"\n"
],
@@ -741,11 +679,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find molecular foemula \n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"C=93.75 #% of carbon\n",
"H2=6.25 #% of hydrogen\n",
"x=C/12 #number of carbon atoms\n",
@@ -753,12 +689,10 @@
"molar_mass=64\n",
"density=4.41*29;\n",
"\n",
- "# Calculations\n",
"ratio=density/molar_mass;\n",
"x=round(ratio*5);\n",
"y=round(ratio*4);\n",
"\n",
- "# Results\n",
"print \"x = %f y = %f\"%(x,y)\n",
"print \"formula of butyric acid is = C10H8\"\n",
"\n"
@@ -789,11 +723,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find molecular formula\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"C=50.69 #% of carbon\n",
"H2=4.23 #% of hydrogen\n",
"O2=45.08 #% of oxygen\n",
@@ -802,7 +734,6 @@
"b=H2/2; #number of hydrogen molecules\n",
"molar_mass=71;\n",
"\n",
- "# Calculations and Results\n",
"def f(m):\n",
" return (2.09*1000)/(60*m);\n",
"\n",
@@ -849,18 +780,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the molecular formula\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"C=64.6 #% of carbon\n",
"H2=5.2 #% of hydrogen\n",
"O2=12.6 #% of oxygen\n",
"N2=8.8 #% of nitrogen\n",
"Fe=8.8 #% of iron\n",
"\n",
- "# Calculations\n",
"a=C/12; #number of carbon molecules\n",
"c=8.8/14; #number of nitrogen molecules\n",
"b=H2; #number of hydrogen molecules\n",
@@ -871,7 +799,6 @@
"\n",
"molar_mass=63.3/cm;\n",
" \n",
- "# Results \n",
"print \"a = %d, b = %d, c = %d, d = %d, e = %d\"%(a*6.5,b*6.5,c*6.5,d*6.5,e*6.5)\n",
"print \"formula of butyric acid is = C34H33N4O5Fe\"\n",
"\n"
@@ -902,20 +829,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find sequence of deposition\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"E1=-0.25;\n",
"E2=0.80;\n",
"E3=0.34;\n",
"\n",
- "# Calculations\n",
"a=[E1,E2,E3];\n",
"sorted(a)\n",
"\n",
- "# Results\n",
"print \"sorted potential in volts =\"\n",
"print (a)\n",
"print (\"E2>E3>E1\")\n",
@@ -951,22 +874,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the emf of cell\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"E0_Zn=-0.76;\n",
"E0_Pb=-0.13;\n",
"c_Zn=0.1;\n",
"c_Pb=0.02;\n",
"\n",
- "# Calculations\n",
"E_Zn=E0_Zn+(0.059/2)*math.log10(c_Zn);\n",
"E_Pb=E0_Pb+(0.059/2)*math.log10(c_Pb);\n",
"E=E_Pb-E_Zn;\n",
"\n",
- "# Results\n",
"print \"emf of cell = %f V\"%(E)\n",
"print \"Since potential of lead is greater than that of zinc thus reduction will occur at\\\n",
" lead electrode and oxidation will occur at zinc electrode\"\n"
@@ -997,22 +916,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the emf of cell\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"E0_Ag=0.80;\n",
"E0_AgNO3=0.80;\n",
"c_Ag=0.001;\n",
"c_AgNO3=0.1;\n",
"\n",
- "# Calculations\n",
"E_Ag=E0_Ag+(0.059)*math.log10(c_Ag);\n",
"E_AgNO3=E0_AgNO3+(0.059)*math.log10(c_AgNO3);\n",
"E=E_AgNO3-E_Ag;\n",
"\n",
- "# Results\n",
"print \"emf of cell = %f V\" %(E)\n",
"print \"since E is positive, the left hand electrode will be anode and\\\n",
" the electron will travel in the external circuit from the left hand to the right hand electrode\"\n"
@@ -1043,18 +958,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find emf of cell\n",
"\n",
"import math \n",
- "# Variables\n",
"pH=12; #pH of solution\n",
"E_H2=0;\n",
"\n",
- "# Calculations\n",
"E2=-0.059*pH;\n",
"E=E_H2-E2;\n",
"\n",
- "# Results\n",
"print \"EMF of cell = %f V\"%(E)\n"
],
"language": "python",
@@ -1082,20 +993,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find amount of silver deposited\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"I=3 #in Ampere\n",
"t=900 #in s\n",
"m_eq=107.9 #in gm/mol\n",
"F=96500;\n",
"\n",
- "# Calculations\n",
"m=(I*t*m_eq)/F;\n",
"\n",
- "# Results\n",
"print \"mass = %f gm\"%(m)\n"
],
"language": "python",
@@ -1123,24 +1030,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the time for electroplating\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"volume=10*10*0.005; #in cm3\n",
"mass=volume*8.9;\n",
"F=96500;\n",
"atomic_mass=58.7 #in amu\n",
"current=2.5 #in Ampere\n",
"\n",
- "# Calculations\n",
"charge=(8.9*F*2)/atomic_mass;\n",
"yield_=0.95;\n",
"actual_charge=charge/(yield_*3600);\n",
"t=actual_charge/current;\n",
"\n",
- "# Results\n",
"print \"time required = %f hours\"%(t)\n"
],
"language": "python",
@@ -1168,17 +1071,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find hardness of water\n",
"\n",
- "# Variables\n",
"m_MgSO4=90. #in ppm\n",
"MgSO4_parts=120.;\n",
"CaCO3_parts=100.;\n",
"\n",
- "# Calculations\n",
"hardness=(CaCO3_parts/MgSO4_parts)*m_MgSO4;\n",
"\n",
- "# Results\n",
"print \"hardness of water = %f mg/l\"%(hardness)\n"
],
"language": "python",
@@ -1214,7 +1113,6 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"m1 = 162. #mass of calcium bi carbonate in mg\n",
"m2 = 73. #mass of magnesium bi carbonate in mg\n",
"m3 = 136. # mass of calsium sulfate in mg\n",
@@ -1222,19 +1120,16 @@
"m5 = 500. #mass of sodium cloride in mg\n",
"m6 = 50. # mass of potassium cloride in mg\n",
"\n",
- "# Calculations and Results\n",
"content_1 = m1*100/m1; #content of calcium bi carbonate in mg\n",
"content_2 = m2*100/(2*m2); #content of magnesium bi carbonate in mg\n",
"content_3 = m3*100/m3; # content of calsium sufate in mg\n",
"content_4 = m4*100/m4; # content of magnesium cloride\n",
"\n",
- "#part_1\n",
"\n",
"temp_hardness = content_1 + content_2; #depends on bicarbonate only\n",
"total_hardness = content_1+content_2+content_3+content_4;\n",
"print \"total hardness = %.0f mg/l temporary hardness = %.0f mg/l\"%(temp_hardness,total_hardness)\n",
"\n",
- "#part 2\n",
"wt_lime = (74./100)*(content_1+2*content_2+content_4);\n",
"actual_lime = wt_lime/0.85;\n",
"print \"amount of lime required = %.1f mg/l\"%(actual_lime)\n",
@@ -1270,19 +1165,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find hardness of water\n",
"\n",
- "# Variables\n",
"volume_NaCl=50. #in l\n",
"c_NaCl=5000. #in mg/l\n",
"\n",
- "# Calculations\n",
"m=volume_NaCl*c_NaCl;\n",
"equivalent_NaCl=50/58.5;\n",
"\n",
"hardness=equivalent_NaCl*m;\n",
"\n",
- "# Results\n",
"print \"hardness of water = %f mg/l\"%(hardness/1000.)\n"
],
"language": "python",
@@ -1310,16 +1201,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the total vapor pressure and molar compositions\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"m_benzene = 55. #in kg\n",
"m_toluene = 28. #in kg\n",
"m_xylene = 17. # in kg\n",
"\n",
- "# Calculations and Results\n",
"mole_benzene = m_benzene/78.;\n",
"mole_toluene = m_toluene/92.;\n",
"mole_xylene = m_xylene/106.;\n",
@@ -1364,22 +1252,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the mixture composition\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"vapor_pressure=8. #in kPa\n",
"pressure=100. #in kPa\n",
"\n",
- "# Calculations and Results\n",
- "#part 1\n",
"volume=1 #in m3\n",
"volume_ethanol=volume*(vapor_pressure/pressure);\n",
"volume_air=1-volume_ethanol;\n",
"print \"volumetric composition:- air composition = %f ethanol compostion = %f\"%(volume_air*100,volume_ethanol*100)\n",
"\n",
- "#part 2\n",
"molar_mass_ethanol=46;\n",
"molar_mass_air=28.9;\n",
"mass_ethanol=0.08*molar_mass_ethanol; #in kg\n",
@@ -1388,16 +1271,13 @@
"fraction_air=(mass_air*100)/(mass_air+mass_ethanol);\n",
"print \"composition by weight:-Air = %f Ethanol vapor = %f\"%(fraction_air,fraction_ethanol)\n",
"\n",
- "#part 3\n",
"mixture_volume=22.3*(101.3/100)*(299./273); #in m3\n",
"weight_ethanol=mass_ethanol/mixture_volume;\n",
"print \"weight of ethanol/cubic meter = %f Kg\"%(weight_ethanol)\n",
"\n",
- "#part 4\n",
"w_ethanol=mass_ethanol/mass_air;\n",
"print \"weight of ethanol/kg vapor free air = %f Kg\"%(w_ethanol)\n",
"\n",
- "#part 5\n",
"moles_ethanol=0.08/0.92;\n",
"print \"kmol of ethanol per kmol of vapor free air = %f\"%(moles_ethanol)\n"
],
@@ -1430,23 +1310,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find relative saturation and dew point\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"vapor_pressure=8. #in kPa\n",
"volume_ethanol=0.05;\n",
"\n",
"\n",
- "# Calculations and Results\n",
- "#basis 1kmol of mixture\n",
"partial_pressure=volume_ethanol*100;\n",
"relative_saturation=partial_pressure/vapor_pressure;\n",
"mole_ratio=volume_ethanol/(1-volume_ethanol);\n",
"print \"mole ratio = %f \\nrelative saturation = %f %%\"%(mole_ratio,relative_saturation*100)\n",
"\n",
- "#basis 1kmol saturated gas mixture at 100kPa\n",
"volume_vapor=(8./100)*100;\n",
"ethanol_vapor=volume_vapor/100.;\n",
"air_vapor=1-ethanol_vapor;\n",
@@ -1455,7 +1330,6 @@
"\n",
"print \"percentage saturation = %f %%\"%(percentage_saturation*100)\n",
"\n",
- "#dew point\n",
"print \"corresponding to partial pressure of 5kPa we get a dew point of 17.3 degree celcius\"\n"
],
"language": "python",
@@ -1486,26 +1360,21 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the properties of humid air\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"p = 4.24 #in kPa\n",
"H_rel = 0.8;\n",
"\n",
- "# Calculations and Results\n",
"p_partial = p*H_rel;\n",
"molal_H = p_partial/(100-p_partial);\n",
"print \"initial molal humidity = %.3f\"%(molal_H)\n",
"\n",
- "#part 2\n",
"P = 200. #in kPa\n",
"p_partial = 1.70 #in kPa\n",
"final_H = p_partial/(P-p_partial);\n",
"print \"final molal humidity = %.4f\"%(final_H)\n",
"\n",
- "#part 3\n",
"p_dryair = 100 - 3.39;\n",
"v = 100*(p_dryair/101.3)*(273./303);\n",
"moles_dryair = v/22.4;\n",
@@ -1514,7 +1383,6 @@
"water_condensed = (vapor_initial-vapor_final)*18;\n",
"print \"amount of water condensed = %f kg\"%(water_condensed)\n",
"\n",
- "#part 4\n",
"total_air = moles_dryair+vapor_final;\n",
"final_v = 22.4*(101.3/200)*(288./273)*total_air;\n",
"print \"final volume of wety air = %f m**3\"%(final_v)\n"
diff --git a/Introduction_To_Chemical_Engineering/ch3.ipynb b/Introduction_To_Chemical_Engineering/ch3.ipynb
index e6461254..0b6043d2 100644
--- a/Introduction_To_Chemical_Engineering/ch3.ipynb
+++ b/Introduction_To_Chemical_Engineering/ch3.ipynb
@@ -27,15 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the coal consumption\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"w_C = 0.6; #amount of carbon in coal\n",
"N2_content = 40. #in m3 per 100m3 air\n",
"\n",
- "# Calculations\n",
"air_consumed = N2_content/0.79;\n",
"weight_air = air_consumed*(28.8/22.4);\n",
"O2_content = air_consumed*32*(0.21/22.4); #in kg\n",
@@ -50,7 +47,6 @@
"total_consumption = C_consumption1+C_consumption2;\n",
"coal_consumption = total_consumption/w_C;\n",
"\n",
- "# Results\n",
"print \"coal consumption = %f kg\"%(coal_consumption)\n"
],
"language": "python",
@@ -78,16 +74,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find amount of ammonia and air consumed\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"NH3_required = (17./63)*1000; #NH3 required for 1 ton of nitric acid\n",
"NO_consumption = 0.96;\n",
"HNO3_consumption = 0.92;\n",
"\n",
- "# Calculations and Results\n",
"NH3_consumed = NH3_required/(NO_consumption*HNO3_consumption);\n",
"volume_NH3 = NH3_consumed*(22.4/17);\n",
"print \"volume of ammonia consumed= %f cubic metre/h\"%(volume_NH3)\n",
@@ -122,17 +115,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the consumption of NaCl and H2SO4 in HCl consumption\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"HCl_production = 500. #required to be produced in kg\n",
"NaCl_required = (117./73)*HCl_production;\n",
"yield_ = 0.92;\n",
"purity_NaCl= 0.96;\n",
"\n",
- "# Calculations and Results\n",
"actual_NaCl = NaCl_required/(purity_NaCl*yield_);\n",
"print \"amount of NaCl required = %f kg\"%(actual_NaCl)\n",
"\n",
@@ -170,20 +160,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the period of service\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"C2H2_produced = (1./64)*0.86; #in kmol\n",
"volume_C2H2 = C2H2_produced*22.4*1000; #in l\n",
"\n",
- "# Calculations\n",
- "#assuming ideal behaviour,\n",
"volume = (100/101.3)*(273./(273+30));\n",
"time = (volume_C2H2/volume)*(1./60);\n",
"\n",
- "# Results\n",
"print \"time of service = %f hr\"%(time)\n",
"\n"
],
@@ -212,17 +197,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the screen effectiveness\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"xv = 0.88;\n",
"xf = 0.46;\n",
"xl = 0.32;\n",
"F= 100. #in kg\n",
"\n",
- "# Calculations and Results\n",
"L = (F*(xf-xv))/(xl-xv);\n",
"V = F-L;\n",
"print \"L = %f Kg V = %f Kg\"%(L,V)\n",
@@ -264,16 +246,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the flow rate and concentration\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"G1 = 3600. #in m3/h\n",
"P = 106.6 #in kPa\n",
"T = 40 #in degree C\n",
"\n",
- "# Calculations and Results\n",
"q = G1*(P/101.3)*(273./((273+T))); #in m3/s\n",
"m = q/22.4; #in kmol/h\n",
"y1 = 0.02;\n",
@@ -284,16 +263,12 @@
"Gs = m*(1-y1);\n",
"print \"moles of benzene free gas = %f kmol drygas/h\"%(Gs)\n",
"\n",
- "#for 95% removal\n",
"Y2 = Y1*(1-0.95);\n",
"print \"final mole ratio of benzene = %f kmol benzene/kmol dry gas\"%(Y2)\n",
"\n",
"x2 = 0.002\n",
"X2 = 0.002/(1-0.002);\n",
"\n",
- "#at equilibrium y* = 0.2406X\n",
- "#part 1\n",
- "#for oil rate to be minimum the wash oil leaving the absorber must be in equilibrium with the entering gas\n",
"\n",
"y1 = 0.02;\n",
"x1 = y1/(0.2406);\n",
@@ -301,7 +276,6 @@
"min_Ls = Gs*((Y1-Y2)/(X1-X2));\n",
"print \"minimum Ls required = %f kg/h\"%(min_Ls*260)\n",
"\n",
- "#for 1.5 times of the minimum\n",
"Ls = 1.5*min_Ls;\n",
"print \"flow rate of wash oil = %f kg/h\"%(Ls*260)\n",
"X1 = X2 + (Gs*((Y1-Y2)/Ls));\n",
@@ -337,47 +311,38 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the extraction of nicotine\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"xf = 0.01\n",
"Xf = xf/(1-xf);\n",
"Feed = 100 #feed in kg\n",
"\n",
- "# Calculations and Results\n",
"c_nicotine = Feed*Xf; #nicotine conc in feed\n",
"c_water = Feed*(1-Xf) #water conc in feed\n",
"\n",
- "#part 1\n",
"def F1(x):\n",
" return (x/150.)-0.9*((1-x)/99.);\n",
"\n",
- "#initial guess\n",
"x = 10.;\n",
"y = fsolve(F1,x)\n",
"print \"amount of nicotine removed N = %f kg\"%(y)\n",
- "#part 2\n",
"def F2(x):\n",
" return (x/50.)-0.9*((1-x)/99.);\n",
"\n",
- "#initial guess\n",
"x = 10.;\n",
"N1 = fsolve(F2,x)\n",
"print \"amount of nicotine removed in stage 1, N1 = %f kg\"%(N1)\n",
"def F3(x):\n",
" return (x/50.)-0.9*((1-x-N1)/99.);\n",
"\n",
- "#initial guess\n",
"x = 10.;\n",
"N2 = fsolve(F3,x)\n",
"print \"amount of nicotine removed in stage 2, N2 = %f kg\"%(N2)\n",
"def F4(x):\n",
" return (x/50.)-0.9*((1-x-N2-N1)/99.);\n",
"\n",
- "#initial guess\n",
"x = 10.;\n",
"N3 = fsolve(F4,x)\n",
"\n",
@@ -414,11 +379,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the amount of water in residue\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"vp_water = 31.06 #in kPa\n",
"vp_benzene = 72.92 #in kPa\n",
"\n",
@@ -426,13 +389,11 @@
"x_benzene = vp_benzene/P;\n",
"x_water = vp_water/P;\n",
"\n",
- "# Calculations\n",
"initial_water = 50./18; #in kmol of water\n",
"initial_benzene = 50./78 #in kmol of benzene\n",
"water_evaporated = initial_benzene*(x_water/x_benzene);\n",
"water_left = (initial_water - water_evaporated);\n",
"\n",
- "# Results\n",
"print \"amount of water left in residue = %f kg\"%(water_left*18)\n"
],
"language": "python",
@@ -460,15 +421,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the vapor content of dimethylanaline\n",
"\n",
"import math \n",
- "# Variables\n",
"po_D = 4.93 #in kPa\n",
"po_W = 96.3 #in kPa\n",
"n = 0.75 #vaporization efficiency\n",
"\n",
- "# Calculations and Results\n",
"P = n*po_D+po_W;\n",
"print \"P = %f kPa\"%(P)\n",
"\n",
@@ -477,7 +435,6 @@
"wt_dimethylanaline = (x_dimethylanaline*121)/(x_dimethylanaline*121+x_water*18);\n",
"print \"weight of dimethylanaline in water = %f\"%(wt_dimethylanaline*100)\n",
"\n",
- "#part 1\n",
"n = 0.8;\n",
"po_D = 32 #in kPa\n",
"actual_vp = n*po_D;\n",
@@ -485,7 +442,6 @@
"steam_required = (p_water*18)/(actual_vp*121);\n",
"print \"amount of steam required = %f kg steam/kg dimethylanaline\"%(steam_required)\n",
"\n",
- "#part 2\n",
"x_water = p_water/100.;\n",
"wt_water = x_water*18./(x_water*18+(1-x_water)*121.);\n",
"print \"weight of water vapor = %f weight of dimethylanaline =%f\"%(wt_water*100,100*(1-wt_water))\n"
@@ -518,22 +474,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the amount of water evaporated\n",
"\n",
"import math \n",
- "# Variables\n",
"xf = 0.15;\n",
"xl = (114.7)/(114.7+1000);\n",
"xc = 1;\n",
"\n",
- "# Calculations\n",
"K2Cr2O7_feed = 1000*0.15; #in kg\n",
"\n",
"n = 0.8;\n",
"C = n*K2Cr2O7_feed;\n",
"V = (K2Cr2O7_feed-120 - 880*0.103)/(-0.103);\n",
"\n",
- "# Results\n",
"print \"amount of water evaporated = %f kg\"%(V)\n"
],
"language": "python",
@@ -561,15 +513,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the yield of crystals\n",
"\n",
"import math \n",
- "# Variables\n",
"xc = round(106./286,3);\n",
"xf = 0.25;\n",
"xl = round(27.5/127.5,3);\n",
"\n",
- "# Calculations\n",
"water_present = 100*(1-xf); #in kg\n",
"V = 0.15*75; #in kg\n",
"C = (100*xf - 88.7*xl)/(xc-xl);\n",
@@ -577,7 +526,6 @@
"\n",
"yield_ = (C/Na2CO3_feed)*100;\n",
"\n",
- "# Results\n",
"print \"yield = %.1f %%\"%(yield_)\n"
],
"language": "python",
@@ -605,24 +553,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the fraction of air recirculated\n",
"\n",
"import math \n",
- "# Variables\n",
"r = 50. #weight of dry air passing through drier\n",
"w1 = 1.60 #in kg per kg dry solid\n",
"w2 = 0.1 #in kg/kg dry solid\n",
"H0 = 0.016 #in kg water vapor/kg dry air\n",
"H2 = 0.055 #in kg water vapor/kg dry air\n",
"\n",
- "# Calculations and Results\n",
"y = 1 - (w1-w2)/(r*(H2-H0));\n",
"print \"fraction of air recirculated = %f\"%(y)\n",
"\n",
"H1 = H2 - (w1-w2)/r;\n",
"print \"humidity of air entering the drier = %f kg water vapor/kg kg dry air\"%(H1)\n",
"\n",
- "#check\n",
"H11 = H2*y+H0*(1-y);\n",
"if H1 == H11:\n",
" print \"fraction of air recirculated = %f verified\"%(y)\n"
@@ -654,15 +598,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the volumetric flow rate and fraction of air passing through the cooler\n",
"\n",
"import math \n",
- "# Variables\n",
"Hf = 0.012;\n",
"Hi = 0.033;\n",
"H1 = 0.0075;\n",
"\n",
- "# Calculations and Results\n",
"water_vapor = Hf/18.; #in kmol of water vapor\n",
"dry_air = 1/28.9; #in kmol\n",
"total_mass = water_vapor+dry_air;\n",
@@ -671,12 +612,10 @@
"weight = 60/volume;\n",
"print \"weight of dry air handled per hr = %f kg\"%(weight)\n",
"\n",
- "#part 1\n",
"inlet_watervapor = 0.033/18; #in kmol of water vapor\n",
"volume_inlet = 22.4*(308./273)*(inlet_watervapor+dry_air);\n",
"print \"volumetric flow rate of inlet air = %f cubic meter\"%(volume_inlet*weight)\n",
"\n",
- "#part 2\n",
"y = (Hf - Hi)/(H1 - Hi);\n",
"print \"fraction of inlet air passing through cooler = %f\"%(y)\n"
],
@@ -707,25 +646,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the fraction of purged recycle and total yield\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "#x- moles of N2 and H2 recycled; y - moles of N2 H2 purged\n",
"Ar_freshfeed = 0.2;\n",
- "#argon in fresh feed is equal to argon in purge \n",
"\n",
- "# Calculations and Results\n",
"y = 0.2/0.0633; #argon in purge = 0.0633y\n",
"x = (0.79*100 - y)/(1-0.79);\n",
"print \"y = %f kmolx = %f kmol\"%(y,x)\n",
"\n",
- "#part 1\n",
"fraction = y/x;\n",
"print \"fration of recycle that is purged = %f\"%(fraction)\n",
"\n",
- "#part 2\n",
"yield_ = 0.105*(100+x);\n",
"print \"overall yield of ammonia = %f kmol\"%(yield_)\n"
],
@@ -756,18 +688,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find change in enthalpy\n",
"\n",
"import math \n",
- "# Variables\n",
"H0_CH4 = -74.9 #in kJ\n",
"H0_CO2 = -393.5 #in kJ\n",
"H0_H2O = -241.8 #in kJ\n",
"\n",
- "# Calculations\n",
"delta_H0 = H0_CO2+2*H0_H2O-H0_CH4;\n",
"\n",
- "# Results\n",
"print \"change in enthalpy = %f kJ\"%(delta_H0)\n"
],
"language": "python",
@@ -795,21 +723,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to compare the enthalpy change in two reactions\n",
"\n",
"import math \n",
- "# Variables\n",
"H0_glucose = -1273 #in kJ\n",
"H0_ethanol = -277.6 #in kJ\n",
"H0_CO2 = -393.5 #in kJ\n",
"H0_H2O = -285.8 #in kJ\n",
"\n",
- "# Calculations and Results\n",
- "#for reaction 1\n",
"delta_H1 = 2*H0_ethanol+2*H0_CO2-H0_glucose;\n",
"print \"enthalpy change in reaction 1 = %f KJ\"%(delta_H1)\n",
"\n",
- "#for reaction 2\n",
"delta_H2 = 6*H0_H2O+6*H0_CO2-H0_glucose;\n",
"print \"enthalpy change in reaction 2 = %f kJ\"%(delta_H2)\n",
"\n",
@@ -845,19 +768,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find enthalpy of formation of CuSO4.5H2O\n",
"\n",
"import math \n",
- "# Variables\n",
"delta_H2 = 11.7 #in kJ/mol\n",
"m_CuSO4 = 16 #in gm\n",
"m_H2O = 384 #in gm\n",
"\n",
- "# Calculations\n",
"delta_H3 = -((m_CuSO4+m_H2O)*4.18*3.95*159.6)/(16*10**3)\n",
"delta_H1 = delta_H3 - delta_H2;\n",
"\n",
- "# Results\n",
"print \"enthalpy of formation = %f kJ/mol\"%(delta_H1)\n"
],
"language": "python",
@@ -885,20 +804,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the temperature of combustion\n",
"\n",
"import math \n",
- "# Variables\n",
"H_combustion = 1560000 #in kJ/kmol \n",
"H0_CO2 = 54.56 #in kJ/kmol\n",
"H0_O2 = 35.2 #in kJ/kmol\n",
"H0_steam = 43.38 #in kJ/kmol\n",
"H0_N2 = 33.32 #in kJ/kmol\n",
"\n",
- "# Calculations\n",
"t = H_combustion/(2*H0_CO2+3*H0_steam+0.875*H0_O2+16.46*H0_N2);\n",
"\n",
- "# Results\n",
"print \"theoritical temperature of combustion = %f degree C\"%(t)\n"
],
"language": "python",
@@ -926,16 +841,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the heat of reaction and consumption of coke\n",
"\n",
"import math \n",
- "# Variables\n",
"H_NaCl = 410.9 #in MJ/kmol\n",
"H_H2SO4 = 811.3 #in MJ/kmol\n",
"H_Na2SO4 = 1384 #in MJ/kmol\n",
"H_HCl = 92.3 #in MJ/kmol\n",
"\n",
- "# Calculations and Results\n",
"Q = H_Na2SO4 + 2*H_HCl -2*H_NaCl-H_H2SO4;\n",
"print \"heat of reaction = %f MJ\"%(Q)\n",
"\n",
@@ -969,21 +881,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the rate of heat flow\n",
"\n",
"import math \n",
- "# Variables\n",
"cp_water = 146.5 #in kj/kg\n",
"cp_steam = 3040 #in kJ/kg\n",
"d = 0.102 #in m\n",
"u = 1.5 #in m/s\n",
"density = 1000 #in kg/m3\n",
"\n",
- "# Calculations\n",
"m = (3.14/4)*d**2*u*density;\n",
"Q = m*(cp_steam-cp_water);\n",
"\n",
- "# Results\n",
"print \"rate of heat flow = %f kW\"%(Q)\n"
],
"language": "python",
@@ -1011,10 +919,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the amount of air required for combustion and composition of flue gas\n",
"\n",
"import math \n",
- "# Variables\n",
"wt_C = 0.75 #in kg\n",
"wt_H2 = 0.05 #in kg\n",
"wt_O2 = 0.12 #in kg\n",
@@ -1022,7 +928,6 @@
"wt_S = 0.01 #in kg\n",
"wt_ash = 0.04 #in kg\n",
"\n",
- "# Calculations and Results\n",
"O2_C = wt_C*(32./12); #in kg\n",
"O2_H2 = wt_H2*(16./2); #in kg\n",
"O2_S = wt_S*(32./32); #in kg\n",
@@ -1060,7 +965,6 @@
"print \"N2 = %f %%\"%(x_N2*100)\n",
"print \"O2 = %f %%\"%(x_O2*100)\n",
"\n",
- "# Note : answers are slightly different because of rounding error."
],
"language": "python",
"metadata": {},
@@ -1092,17 +996,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the composition of flue gas\n",
"\n",
"import math \n",
- "# Variables\n",
"C = 0.8 #in kg\n",
"H2 = 0.05 #in kg\n",
"S = 0.005 #in kg\n",
"ash = 0.145 #in kg\n",
"\n",
- "# Calculations and Results\n",
- "#required oxygen in kg\n",
"C_O2 = C*(32./12); \n",
"H2_O2 = H2*(16./2);\n",
"S_O2 = S*(32./32);\n",
@@ -1113,7 +1013,6 @@
"wt_airsupplied = 1.25*wt_air;\n",
"print \"amount of air supplied = %f kg\"%(wt_airsupplied)\n",
"\n",
- "#flue gas composition\n",
"m_N2 = wt_airsupplied*0.77; #in kg\n",
"mole_N2 = m_N2/28.;\n",
"\n",
@@ -1131,7 +1030,6 @@
"\n",
"m = m_N2+m_O2+m_CO2+m_H2O+m_SO2\n",
"\n",
- "#percent by weight\n",
"w_N2 = m_N2/m;\n",
"print \"percentage of N2 by weight = %f\"%(w_N2*100)\n",
"\n",
@@ -1149,7 +1047,6 @@
"\n",
"m1 = mole_N2+mole_O2+mole_CO2+mole_H2O+mole_SO2\n",
"\n",
- "#percent by mole \n",
"x_N2 = mole_N2/m1;\n",
"print \"percentage of N2 by mole = %f\"%(x_N2*100)\n",
"\n",
@@ -1201,16 +1098,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find volumetric composition of flue glass\n",
"\n",
"import math \n",
- "# Variables\n",
"wt_H2 = 0.15;\n",
"wt_C = 0.85;\n",
"O2_H2 = wt_H2*(16./2);\n",
"O2_C = wt_C*(32./12);\n",
"\n",
- "# Calculations and Results\n",
"total_O2 = O2_H2+O2_C;\n",
"wt_air = total_O2/0.23;\n",
"air_supplied = 1.15*(wt_air);\n",
@@ -1258,20 +1152,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the excess air supplied\n",
"\n",
"import math \n",
- "# Variables\n",
"N2 = 80.5 #in m3\n",
"air_supplied = N2/0.79 #in m3\n",
"volume_O2 = air_supplied*0.21; #in m3\n",
"O2_fluegas = 6.1 #in m3\n",
"\n",
- "# Calculations\n",
"O2_used = volume_O2 - O2_fluegas;\n",
"excess_air_supplied = (O2_fluegas/O2_used)*100;\n",
"\n",
- "# Results\n",
"print \"percentage of excess air supplied = %f\"%(excess_air_supplied)\n"
],
"language": "python",
@@ -1299,15 +1189,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the outlet temperature of water\n",
"\n",
"import math \n",
- "# Variables\n",
"q_NTP = 10*(200/101.3)*(273./313);\n",
"m_CO2 = 44*(q_NTP/22.4);\n",
"s_CO2 = 0.85 #in kJ/kg K\n",
"\n",
- "# Calculations\n",
"Q = m_CO2*s_CO2*(40-20) #Q = ms*delta_T\n",
"\n",
"d0 = 0.023 #in mm\n",
@@ -1322,7 +1209,6 @@
"s_water = 4.19 #in kJ/kg K\n",
"t = 15+(Q/(m_water*s_water));\n",
"\n",
- "# Results\n",
"print \"exit water temperature = %f degree C\"%(t)\n"
],
"language": "python",
@@ -1350,14 +1236,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the area of heating surface\n",
"\n",
"import math \n",
- "# Variables\n",
"F = 1000 #in kg\n",
"xF = 0.01 \n",
"\n",
- "# Calculations and Results\n",
"solid_feed = F*xF;\n",
"water_feed = F - solid_feed;\n",
"\n",
@@ -1379,7 +1262,6 @@
"tc = 108.4 #in degree C\n",
"hc = 454 #in kJ/kg\n",
"\n",
- "#applying heat balance\n",
"S = (F*hF-V*Hv-L*hL)/(hc-Hs);\n",
"print \"weight of steam required = %f kg/hr\"%(S)\n",
"\n",
@@ -1415,10 +1297,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the top and bottom product,condenser duty,heat input to rebpoiler\n",
"\n",
"import math \n",
- "# Variables\n",
"hF = 171 #in kJ/kg\n",
"hD = 67 #in kJ/kg\n",
"hL = hD;\n",
@@ -1432,7 +1312,6 @@
"xW = 0.02;\n",
"xD = 0.97;\n",
"\n",
- "# Calculations and Results\n",
"D = F*(xF-xW)/(xD-xW);\n",
"W = F-D;\n",
"\n",
@@ -1480,23 +1359,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the rate of crystal formation, cooling water rate, required area\n",
"\n",
"import math \n",
- "# Variables\n",
"F = 1000.; #in kg\n",
"V = 0.05*F; #in kg\n",
"xF = 0.48;\n",
"xL = 75./(100+75);\n",
"xC = 1.;\n",
"\n",
- "# Calculations and Results\n",
"C = (F*xF-950*xL)/(1-0.429);\n",
"print \"rate of crystal formation = %f kg\"%(C)\n",
"\n",
"L = F-C-V;\n",
"\n",
- "#cooling water\n",
"W = (F*2.97*(85-35)+126.9*75.2-V*2414)/(4.19*11);\n",
"print \"rate of cooling water = %f kg\"%(W)\n",
"\n",
@@ -1535,16 +1410,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the heat of combustion\n",
"\n",
"import math \n",
- "# Variables\n",
"delta_n = 10-12.; #mole per mole napthanlene\n",
"\n",
- "#basis 1g\n",
"moles_napthalene = (1./128);\n",
"\n",
- "# Calculations and Results\n",
"print ('part 1')\n",
"Qv = 40.28 #in kJ\n",
"Qp = Qv-(delta_n*moles_napthalene*8.3144*298./1000);\n",
diff --git a/Introduction_To_Chemical_Engineering/ch4.ipynb b/Introduction_To_Chemical_Engineering/ch4.ipynb
index 4c312cd2..3a5046ad 100644
--- a/Introduction_To_Chemical_Engineering/ch4.ipynb
+++ b/Introduction_To_Chemical_Engineering/ch4.ipynb
@@ -27,18 +27,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find water compressibility\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"delta_p=70.; #in bar\n",
"Et=20680. #in bar\n",
"\n",
- "# Calculations\n",
"compressibility = delta_p/Et;\n",
"\n",
- "# Results\n",
"print \"compressibilty of water = %f\"%(compressibility)\n"
],
"language": "python",
@@ -66,14 +62,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the viscosity of oil\n",
"\n",
"import math \n",
- "# Variables\n",
"F=0.5*9.8; #in N\n",
"A=3.14*0.05*0.15; #in m2\n",
"\n",
- "# Calculations and Results\n",
"shear_stress=F/A; #in Pa\n",
"print \"shear_stress = %f Pa\"%(shear_stress)\n",
"\n",
@@ -107,17 +100,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find variation of losses with velocity\n",
"\n",
"import math \n",
- "# Variables\n",
"loss_ratio=3.6; #delta_P2/delta_P1=3.6\n",
"velocity_ratio=2.; #u2/u1=2\n",
"\n",
- "# Calculations\n",
"n=math.log(loss_ratio,2); #delta_P2/delta_P1=(u2/u1)**n\n",
"\n",
- "# Results\n",
"print \"power constant = %f flow is turbulent\"%(n)\n"
],
"language": "python",
@@ -145,16 +134,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the boundary layer properties\n",
"\n",
"import math \n",
"print ('part 1')\n",
"\n",
- "# Variables\n",
"x=0.05 #in m\n",
"density=1000. #in kg/m3\n",
"\n",
- "# Calculations and Results\n",
"viscosity=1.*10**-3 #in Pa-s\n",
"u=1. #in m/s\n",
"Re=(density*u*x)/viscosity;\n",
@@ -210,10 +196,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the flow properties\n",
"\n",
"import math \n",
- "# Variables\n",
"d1=0.05 #in m\n",
"A1=(3.14*d1**2)/4.;\n",
"density_1=2.1 #in kg/m3\n",
@@ -221,7 +205,6 @@
"P1=1.8; #in bar\n",
"P2=1.3; #in bar\n",
"\n",
- "# Calculations and Results\n",
"w=density_1*A1*u1;\n",
"density_2=density_1*(P2/P1);\n",
"print \"density at section 2 = %f kg/cubic meter\"%(density_2)\n",
@@ -255,19 +238,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the temperature increase\n",
"\n",
"import math \n",
- "# Variables\n",
"Q=0.001*10**5 #in J/s\n",
"w=0.001*1000 #in kg/s\n",
"density=1000. #in kg/m3\n",
"cp=4.19*10**3 #in J/kg K\n",
"\n",
- "# Calculations\n",
"delta_T=Q/(w*cp);\n",
"\n",
- "# Results\n",
"print \"Temperature increase = %f degree celcius\"%(delta_T)\n"
],
"language": "python",
@@ -295,17 +274,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the pressure\n",
"\n",
"import math \n",
- "# Variables\n",
"u1=0; #in m/s\n",
"ws=0;\n",
"P1=0.7*10**5 #in Pa\n",
"P3=0\n",
"density=1000 #in kg/m3\n",
"\n",
- "# Calculations and Results\n",
"u3=((2*(P1-P3))/density)**0.5;\n",
"print \"u3 = %f m/s\"%(u3)\n",
"\n",
@@ -313,7 +289,6 @@
"u2=u3/ratio_area;\n",
"print \"u2 = %f m/s\"%(u2)\n",
"\n",
- "#applying bernoulli's equation\n",
"P2=1.7*10**5-((density*u2**2)/2)\n",
"print \"P2 = %f Pa\"%(P2)\n",
"print \"this flow is physically unreal\"\n"
@@ -346,15 +321,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the power requirements\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"Q=3800./(24*3600) #in m3/s\n",
"d=0.202 #in m\n",
"\n",
- "# Calculations\n",
"u=Q/((3.14/4)*d**2); #in m/s\n",
"delta_P=5.3*10**6 #in Pa\n",
"density=897. #in kg/m3\n",
@@ -363,7 +335,6 @@
"mass_flow_rate= Q*density;\n",
"power=(ws*mass_flow_rate)/0.6;\n",
"\n",
- "# Results\n",
"print \"power required = %f kW\"%(power/1000)\n",
"\n"
],
@@ -392,15 +363,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the tube length\n",
"\n",
"import math \n",
- "# Variables\n",
"density=1000 #in kg/m3\n",
"viscosity=1*10**-3 #in Pa s\n",
"P=100*1000 #in Pa\n",
"\n",
- "# Calculations and Results\n",
"vdP=P/density;\n",
"\n",
"Q=2.5*10**-3/(24*3600)\n",
@@ -411,7 +379,6 @@
"Re=density*u*0.0005/viscosity;\n",
"print \"Re = %f\"%(Re)\n",
"\n",
- "#F=18.86*L\n",
"L=(-u**2+vdP)/18.86;\n",
"print \"L = %f m\"%(L)\n"
],
@@ -442,16 +409,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the discharge pressure\n",
"\n",
"import math \n",
- "# Variables\n",
"d=0.025 #in m\n",
"u=3. #in m/s\n",
"density=894. #in kg/m3\n",
"viscosity=6.2*10**4 #in Pa-s\n",
"\n",
- "# Calculations and Results\n",
"Re=(u*d*density)/viscosity;\n",
"f=0.0045;\n",
"L=50.;\n",
@@ -489,15 +453,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the level difference\n",
"\n",
"import math \n",
- "# Variables\n",
"Q=0.8*10**-3; #in m3/s\n",
"d=0.026 #in m\n",
"A=(3.14*(d**2))/4 #in m2\n",
"\n",
- "# Calculations\n",
"u=Q/A; #in m/s\n",
"density=800 #in kg/m3\n",
"viscosity=0.0005 #in Pa-s\n",
@@ -507,7 +468,6 @@
"L=60\n",
"h_f=2*f*((u**2)/9.8)*(L/d);\n",
"\n",
- "# Results\n",
"print \"level difference = %f m\"%(h_f)\n"
],
"language": "python",
@@ -535,16 +495,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the engery cost\n",
"\n",
"import math \n",
- "# Variables\n",
"delta_z=50; #in m\n",
"L=290.36 #in m\n",
"d=0.18 #in m\n",
"Q=0.05 #in m3/s\n",
"\n",
- "# Calculations\n",
"A=(3.14*d**2)/4; #in m2\n",
"u=Q/A; #in m/s\n",
"density=1180; #in kg/m3\n",
@@ -558,7 +515,6 @@
"power=mass_flow_rate*ws/1000; #in KW\n",
"energy_cost=power*24*0.8;\n",
"\n",
- "# Results\n",
"print \"Energy cost = Rs %f\"%(energy_cost)\n"
],
"language": "python",
@@ -586,16 +542,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the pressure loss\n",
"\n",
"import math \n",
- "# Variables\n",
"density=998 #in kg/m3\n",
"viscosity=0.0008 #in Pa-s\n",
"d=0.03 #in m\n",
"u=1.2 #in m/s\n",
"\n",
- "# Calculations\n",
"Re=density*d*u/viscosity;\n",
"\n",
"f=0.0088;\n",
@@ -605,7 +558,6 @@
"delta_P=(2*f*u**2*L)/d; #in Pa\n",
"delta_P_coil=delta_P*(1+(3.54*(d/D)));\n",
"\n",
- "# Results\n",
"print \"frictional pressure drop = %f kPa\"%(delta_P_coil)\n"
],
"language": "python",
@@ -633,11 +585,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find pressure drop per unit length\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"b=0.050 #in m\n",
"a=0.025 #in m\n",
"d_eq=b-a #in m\n",
@@ -645,14 +595,12 @@
"u=3 #in m/s\n",
"viscosity = 0.001\n",
"\n",
- "# Calculations\n",
"Re=d_eq*u*density/viscosity;\n",
"\n",
"e=40*10**6 #in m\n",
"f=0.0062;\n",
"P_perunit_length=2*f*density*u**2/d_eq; #in Pa/m\n",
"\n",
- "# Results\n",
"print \"pressure per unit length = %f Pa/m\"%(P_perunit_length)\n"
],
"language": "python",
@@ -680,17 +628,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the flow rate\n",
"\n",
"import math \n",
- "# Variables\n",
"d = 0.3 #in m\n",
"u = 17.63 #avg velocity in m/s\n",
"\n",
- "# Calculations\n",
"q = (3.14/4)*d**2*u;\n",
"\n",
- "# Results\n",
"print \"volumetric flow rate = %f cubic meter per second\"%(q)\n"
],
"language": "python",
@@ -718,18 +662,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the size of pipe required\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"d = 0.15 #in m\n",
"\n",
- "# Calculations\n",
"u = (0.0191/0.15**2); #in m/s\n",
"q = (3.14/4)*d**2*u;\n",
"\n",
- "# Results\n",
"print \"volumetric flow rate = %f cubic meter/s\"%(q)\n"
],
"language": "python",
@@ -757,15 +697,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the pressure gradient\n",
"\n",
"import math \n",
- "# Variables\n",
"Q=0.0003 #in m3/s\n",
"d=0.05 #in m\n",
"A=(3.14*d**2)/4;\n",
"\n",
- "# Calculations\n",
"u=Q/A;\n",
"\n",
"density=1000; #in kg/m3\n",
@@ -778,11 +715,9 @@
"L=0.5 #in m\n",
"delta_Pf=fm*((density*L*u**2)/dp)*((1-e)/e**3); #in Pa\n",
"\n",
- "#applying bernoulli's equation, we get\n",
"delta_P=delta_Pf-(density*9.8*L);\n",
"pressure_gradient=delta_P/(L*1000); #in kPa/m\n",
"\n",
- "# Results\n",
"print \"required pressure gradient = %f kPa/m of packed height\"%(pressure_gradient)\n"
],
"language": "python",
@@ -810,18 +745,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find minimum fluidization velocity\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"d=120*10**-6 #in m\n",
"density=2500 #particle density in kg/m3\n",
"e_min=0.45;\n",
"density_water=1000 #in kg/m3\n",
"\n",
- "# Calculations and Results\n",
"viscosity=0.9*10**-3; #in Pa-s\n",
"umf=(d**2*(density-density_water)*9.8*e_min**3)/(150*viscosity*(1-e_min));\n",
"print \"minimum fludization velocity = %f m/s\"%(umf)\n",
@@ -829,11 +761,9 @@
"Re_mf=(d*umf*density_water)/(viscosity*(1-e_min));\n",
"\n",
"\n",
- "#given that uo/umf=10\n",
"def F(e):\n",
" return e**3+1.657*e-1.675;\n",
"\n",
- "#initial guess\n",
"x = 10.;\n",
"e = fsolve(F,x)\n",
"\n",
@@ -868,21 +798,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the power requirements\n",
"\n",
"import math \n",
- "# Variables\n",
"P=9807. #in Pa\n",
"density=1000. #in kg/m3\n",
"Q=250./(60.*density)\n",
"head=25. #in m\n",
"\n",
- "# Calculations\n",
"w= head*Q*P; #in kW\n",
"power_delivered=w/0.65;\n",
"power_taken=power_delivered/0.9;\n",
"\n",
- "# Results\n",
"print \"power_delivered = %f kW\"%(power_delivered/1000)\n",
"print \"power taken by motor = %f kW\"%(power_taken/1000)\n",
"\n"
diff --git a/Introduction_To_Chemical_Engineering/ch5.ipynb b/Introduction_To_Chemical_Engineering/ch5.ipynb
index b8695b88..6af51e50 100644
--- a/Introduction_To_Chemical_Engineering/ch5.ipynb
+++ b/Introduction_To_Chemical_Engineering/ch5.ipynb
@@ -27,22 +27,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the rate of heat loss\n",
"\n",
"import math \n",
- "# Variables\n",
"A=5.*4 #in m2\n",
"T1=100.; #in K\n",
"T2=30.; #in K\n",
"\n",
- "# Calculations\n",
"delta_T=T1-T2;\n",
"\n",
"x=0.25 #in m\n",
"k=0.70 #in W/mK\n",
"Q=k*A*(delta_T/x);\n",
"\n",
- "# Results\n",
"print \"rate of heat loss = %f W\"%(Q)\n"
],
"language": "python",
@@ -70,15 +66,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the heat loss\n",
"\n",
"import math \n",
- "# Variables\n",
"d1=0.15 #in m\n",
"d2=0.16 #in m\n",
"l=1. #in m\n",
"\n",
- "# Calculations\n",
"A1=3.14*d1*l;\n",
"A2=3.14*d2*l\n",
"Am=(A1-A2)/math.log (A1/A2);\n",
@@ -91,7 +84,6 @@
"k=50. #in W/mK\n",
"Q=k*Am*(delta_T/x);\n",
"\n",
- "# Results\n",
"print \"rate of heat loss per unit length = %f W/m\"%(Q)\n"
],
"language": "python",
@@ -119,16 +111,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the rate of heat loss\n",
"\n",
"import math \n",
- "# Variables\n",
"ri=0.5 #in m\n",
"ro=0.6; #in m\n",
"A1=4*3.14*ri**2;\n",
"A2=4*3.14*ro**2;\n",
"\n",
- "# Calculations\n",
"Am=(A1*A2)**0.5;\n",
"\n",
"Ti=140.; #in K\n",
@@ -139,7 +128,6 @@
"\n",
"Q=k*Am*(delta_T/x);\n",
"\n",
- "# Results\n",
"print \"Heat loss through sphere = %f W\"%(Q)\n"
],
"language": "python",
@@ -167,17 +155,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the heat loss from composite wall\n",
"\n",
"import math \n",
- "# Variables\n",
"x1=0.250; #in m\n",
"k1=0.7; #in W/mK\n",
"A1=1.; #in m2\n",
"R1=x1/(k1*A1); #in K/W\n",
"\n",
- "# Calculations and Results\n",
- "#for the felt layer\n",
"x2=0.020; #in m\n",
"k2=0.046; #in W/mK\n",
"A2=1.; #in m2\n",
@@ -217,10 +201,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the rate of heat loss through pipeline\n",
"\n",
"import math \n",
- "# Variables\n",
"d1=0.15 #in m\n",
"d2=0.16 #in m\n",
"l=1. #in m\n",
@@ -231,8 +213,6 @@
"k1=50. #in W/mK\n",
"R1=x1/(k1*Am1);\n",
"\n",
- "# Calculations and Results\n",
- "#resistance by insulation\n",
"d2=0.16 #in m\n",
"d3=0.26 #in m\n",
"l=1. #in m\n",
@@ -279,10 +259,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the increase in heat transfer rate\n",
"\n",
"import math \n",
- "# Variables\n",
"x1=0.1; #in m\n",
"x2= 0.25; #in m\n",
"k_rb=0.93; #in W/mK\n",
@@ -290,8 +268,6 @@
"k_al=203.6 #in W/mK\n",
"A=0.1 #in m2\n",
"\n",
- "# Calculations and Results\n",
- "#to find resistance without rivets\n",
"R=(1/A)*((x1/k_rb)+(x2/k_ib));\n",
"T1=225 #in K\n",
"T2=37 #in K\n",
@@ -299,7 +275,6 @@
"Q=delta_T/R;\n",
"print \"heat transfer rate = %f W\"%(Q)\n",
"\n",
- "#to find resistance with rivet\n",
"d=0.03 #in m\n",
"rivet_area= (3.14/4)*d**2;\n",
"R_r=(x1+x2)/(k_al*rivet_area);\n",
@@ -347,14 +322,12 @@
"\n",
"import math\n",
"\n",
- "# variables\n",
"Cp = 4.178 # kJ/kg K for water\n",
"q = 1838. # rate at which heat is transfered\n",
"A = .1005 # heat transfer area\n",
"dt1 = 80. - 24 # temperature diffference at hot end\n",
"dt2 = 36.-24 # temperature difference at cold end\n",
"\n",
- "# Calculations and Results\n",
"dtm = (56 + 12)/2.0\n",
"h = q/(A*dtm)\n",
"print \"Heat transfer coefficient, h = %.0f W/m**2 K\"%h\n",
@@ -390,11 +363,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the heat transfer coefficient\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"density=984.1 #in kg/cubic meter\n",
"v=3. #in m/s\n",
"viscosity=485*10**-6; #in Pa-s\n",
@@ -402,15 +373,12 @@
"cp=4178. #in J/kg K\n",
"d=0.016 #in m\n",
"\n",
- "# Calculations and Results\n",
"Re=(density*v*d)/viscosity;\n",
"Pr=(cp*viscosity)/k;\n",
"\n",
- "#dittus boelter equation\n",
"h=0.023*Re**0.8*Pr**0.3*(k/d);\n",
"print \"heat transfer coefficient = %f W/sq meter K\"%(h)\n",
"\n",
- "#Sieder Tate equation\n",
"viscosity_w=920*10**-6.\n",
"h1=0.023*Re**0.8*Pr**(1./3)*(k/d)*(viscosity/viscosity_w)**0.14;\n",
"print \"heat transfer coefficient = %f W/sq meter K\"%(h1)\n"
@@ -441,18 +409,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the surface temperature of earth\n",
"\n",
"import math \n",
- "# Variables\n",
"T_sun = 5973 #in degree C\n",
"d = 1.5*10**13 #in cm\n",
"R = 7.1*10**10; #in cm\n",
"\n",
- "# Calculations\n",
"T_earth = ((R/(2*d))**0.5)*T_sun;\n",
"\n",
- "# Results\n",
"print \"Temperature of earth = %f C\"%(T_earth-273) \n"
],
"language": "python",
@@ -480,18 +444,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find temperature of earth\n",
"\n",
"import math \n",
- "# Variables\n",
"R=7*10**10; #in cm\n",
"Ts=6000; #in K\n",
"\n",
- "# Calculations\n",
"l=1.5*10**13; #in m\n",
"To=((R**2/(4*l**2))**0.25)*Ts;\n",
"\n",
- "# Results\n",
"print \"temperature of earth = %f K\"%(To)\n"
],
"language": "python",
@@ -519,18 +479,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the equilibrium temperature\n",
"\n",
"import math \n",
- "# Variables\n",
"R=6.92*10**5 #in km\n",
"l=14.97*10**7 #in km\n",
"Ts=6200; #in K\n",
"\n",
- "# Calculations\n",
"To=(R**2/l**2)**0.25*Ts;\n",
"\n",
- "# Results\n",
"print \"Equilibrium temperature = %f K\"%(To)\n"
],
"language": "python",
@@ -558,19 +514,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the equilibrium temperature\n",
"\n",
"import math \n",
- "# Variables\n",
"view_factor=0.5;\n",
"R=6.92*10**5 #in km\n",
"l=14.97*10**7 #in km\n",
"Ts=6200; #in K\n",
"\n",
- "# Calculations\n",
"To=(view_factor*(R**2/l**2))**0.25*Ts;\n",
"\n",
- "# Results\n",
"print \"Equilibrium temperature = %f K\"%(To)\n",
"\n",
"\n"
@@ -600,10 +552,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the surface temperature\n",
"\n",
"import math \n",
- "# Variables\n",
"view_factor=0.25;\n",
"R=7.1*10**10 #in cm\n",
"l=1.5*10**13 #in cm\n",
@@ -611,12 +561,10 @@
"alpha=0.2;\n",
"epsilon=0.1;\n",
"\n",
- "# Calculations\n",
"ratio=alpha/epsilon;\n",
"To=(ratio*view_factor*(R**2/l**2))**0.25*Ts;\n",
"\n",
"\n",
- "# Results\n",
"print \"Equilibrium temperature = %f K\"%(To)\n"
],
"language": "python",
@@ -644,19 +592,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the solar constant\n",
"\n",
"import math \n",
- "# Variables\n",
"R=7*10**10; #in cm\n",
"l=1.5*10**13; #in cm\n",
"sigma=5.3*10**-5; #in erd/s(cm2)(K)4\n",
"T=6000; #in K\n",
"\n",
- "# Calculations\n",
"S=(R/l)**2*(sigma)*(T**4)*60;\n",
"\n",
- "# Results\n",
"print \"solar constant = %f J/sq cm min\"%(S/10**7)\n"
],
"language": "python",
@@ -684,15 +628,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the amount of vapor and liquid and amount of heat transfer\n",
"\n",
"import math \n",
- "# Variables\n",
"F = 5000. #in kg/hr\n",
"xF = 0.01\n",
"xL = 0.02;\n",
"\n",
- "# Calculations and Results\n",
"L = F*xF/xL;\n",
"V = F-L;\n",
"print \"L = %f Kg/hr V = %f kg/hr\"%(L,V)\n",
@@ -741,19 +682,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the amount of liquid and vapor leaving and outlet concentration\n",
"\n",
"import math \n",
"from numpy import *\n",
- "# Variables\n",
"b1 = 6000*125.79+3187.56*2691.5-3187.56*461.30; #data from previous problem\n",
"b2 = 6000;\n",
"A = array([[419.04, 2676.1],[1, 1]])\n",
"\n",
- "# Calculations and Results\n",
"b = array([[b1],[b2]]);\n",
"x = linalg.solve(A,b)\n",
- "#x = x*b\n",
"L = x[0];\n",
"V = x[1];\n",
"\n",
@@ -790,14 +727,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the change in heat trnasfer area\n",
"\n",
"import math \n",
- "# Variables\n",
"Hv=2635.3 #kJ/kg\n",
"hL=313.93 #in kJ/kg\n",
"\n",
- "# Calculations and Results\n",
"S=(2500*313.93+2500*2635.3-5000*125.79)/(2691.5-461.30);\n",
"print \"steam flow rate = %f kg steam/hr\"%(S)\n",
"\n",
@@ -810,7 +744,6 @@
"print \"Area = %f sq meter\"%(A)\n",
"print \"in this case a condensor and vaccum pump should be used\"\n",
"\n",
- "# Note : there is mistake in calculation in Book. Please calculate manually."
],
"language": "python",
"metadata": {},
diff --git a/Introduction_To_Chemical_Engineering/ch6.ipynb b/Introduction_To_Chemical_Engineering/ch6.ipynb
index dc10eb48..1a7b64a4 100644
--- a/Introduction_To_Chemical_Engineering/ch6.ipynb
+++ b/Introduction_To_Chemical_Engineering/ch6.ipynb
@@ -27,10 +27,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the flux and pressure difference\n",
"\n",
"import math \n",
- "# Variables\n",
"D_AB=6.75*10**-5 #in m2/s\n",
"Z=0.03 #in m\n",
"R=8314\n",
@@ -38,11 +36,9 @@
"p_A2=1.5*10**4 #in Pa\n",
"T=298 #in K\n",
"\n",
- "# Calculations and Results\n",
"N_A=D_AB*(p_A1-p_A2)/(R*T*Z);\n",
"print \"flux = %f kmol/sq m s\"%(N_A)\n",
"\n",
- "#for partial pressure\n",
"Z=0.02; #in m\n",
"p_A2=p_A1-((N_A*R*T*Z)/D_AB);\n",
"print \"pressure = %f Pa\"%(p_A2)\n",
@@ -74,17 +70,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the flux of NH3 and equimolar counter diffusion flux\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"Z=0.15 #in m\n",
"P=1.013*10**5 #in Pa\n",
"p_A1=1.5*10**4 #in Pa\n",
"p_A2=5*10**3 #in Pa\n",
"\n",
- "# Calculations and Results\n",
"p_B1=P-p_A1;\n",
"p_B2=P-p_A2;\n",
"\n",
@@ -92,13 +85,11 @@
"R=8314.\n",
"T=298. #in K\n",
"\n",
- "#for non diffusing N2\n",
"p_BM=(p_B2-p_B1)/math.log (p_B2/p_B1);\n",
"print p_B1, p_B2\n",
"N_A=D_AB*(p_A1-p_A2)*P/(R*T*Z*p_BM);\n",
"print \"flux = %.4e kmol/sq m s\"%(N_A)\n",
"\n",
- "#for diffusing N2\n",
"N_A=D_AB*(p_A1-p_A2)/(R*T*Z);\n",
"print \"flux = %.4e kmol/sq m s\"%(N_A)\n"
],
@@ -130,13 +121,11 @@
"collapsed": false,
"input": [
"import math \n",
- "# Variables\n",
"M_A=36.5 #molar mass of HCl\n",
"M_B=18. #molar masss of water\n",
"w_A1=12.; #weight % of HCL\n",
"w_A2=4. #weight % of HCL\n",
"\n",
- "# Calculations and Results\n",
"x_A1=(w_A1/M_A)/((w_A1/M_A)+((100-w_A1)/M_B));\n",
"print 'x_A1 =%f'%(x_A1)\n",
"\n",
@@ -144,7 +133,6 @@
"M1=100./((w_A1/M_A)+((100-w_A1)/M_B));\n",
"print \"molar mass at point 1 = %f kg/kmol\"%(M1)\n",
"\n",
- "#at point 2\n",
"x_A2=(w_A2/M_A)/((w_A2/M_A)+((100-w_A2)/M_B));\n",
"x_B2=1-x_A2;\n",
"M2=100/((w_A2/M_A)+((100-w_A2)/M_B)); #avg molecular weight at point 2\n",
@@ -190,10 +178,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the mean driving force and mass transfer area\n",
"\n",
"import math \n",
- "# Variables\n",
"Gs=700/22.4 #in kmol of dry air/hr\n",
"Ls=1500./18 #in kmol of dry air/hr\n",
"y1=0.05\n",
@@ -203,14 +189,11 @@
"X1=(Gs/Ls)*(Y1-Y2);\n",
"m=Gs*(Y1-Y2);\n",
"\n",
- "# Calculations and Results\n",
- "#driving force\n",
"delta_Y1=Y1-1.68*X1;\n",
"delta_Y2=Y2-1.68*X2;\n",
"delta_Y=(delta_Y1-delta_Y2)/(math.log (delta_Y1/delta_Y2));\n",
"print \"driving force = %f kmol acetone/kmol dry air\"%(delta_Y)\n",
"\n",
- "#mass transfer area\n",
"K_G=0.4 #in kmol acetone/kmol dry air\n",
"A=m/(K_G*delta_Y);\n",
"print \"area = %f sq m\"%(A)\n"
@@ -241,17 +224,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to calculate minimum oil circulation rate\n",
"\n",
"import math \n",
- "# Variables\n",
"G1=(855/22.4)*(106.6/101.3)*(273/299.7);\n",
"y1=0.02;\n",
"Y1=y1/(1-y1);\n",
"Gs=G1*(1-y1);\n",
"\n",
- "# Calculations\n",
- "#for 95% removal\n",
"Y2=0.05*Y1;\n",
"x2=0.005;\n",
"X2=x2/(1-x2);\n",
@@ -261,7 +240,6 @@
"Ls_molar=(Gs*(Y1-Y2))/(X1-X2);\n",
"Ls=Ls_molar*260;\n",
"\n",
- "# Results\n",
"print \"minimum oil circulation rate = %f kg/hr\"%(Ls)\n"
],
"language": "python",
@@ -289,15 +267,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# to find the equilibrium composition\n",
"\n",
"import math \n",
- "# Variables\n",
"P_M = 53.32 #kPa\n",
"P_W = 12.33 #in kpA\n",
"P = 40 #IN K pA\n",
"\n",
- "# Calculations and Results\n",
"x = (P - P_W)/(P_M-P_W);\n",
"\n",
"print \"liquid phase composition = %f\"%(x)\n",
@@ -331,7 +306,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the top and bottom composition\n",
"\n",
"import math \n",
"from matplotlib.pyplot import *\n",
@@ -339,13 +313,9 @@
"\n",
"%pylab inline\n",
"\n",
- "# Variables\n",
"x = [1,0.69,0.40,0.192,0.045,0];\n",
"y = [1,0.932,0.78,0.538,0.1775,0];\n",
"plot(x,y)\n",
- "#xlabel(\"x\")\n",
- "#ylabel(\"y\")\n",
- "#title(\"distillation curve\")\n",
"x = linspace(0,1,10)\n",
"y = linspace(0,1,10)\n",
"plot(x,y)\n",
@@ -362,7 +332,6 @@
"\n",
"show()\n",
"\n",
- "# Results\n",
"print \"composition of top product = %f mole percent of hexane\"%(y_D*100)\n",
"print \"composition of bottom product = %f mole percent of hexane\"%(x_W*100)\n"
],
@@ -415,19 +384,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the composite distillate and residue\n",
"\n",
"%pylab inline\n",
"import math \n",
"from numpy import *\n",
"from matplotlib.pyplot import *\n",
- "# Variables\n",
"F = 100. #moles\n",
"xf = 0.4;\n",
"D = 60. #moles\n",
"W = 40. #moles\n",
"\n",
- "# Calculations\n",
"x = linspace(0.2,0.45,6)\n",
"y = zeros(6)\n",
"z = zeros(6)\n",
@@ -443,7 +409,6 @@
"yd = (F*xf-W*xw)/D;\n",
"show()\n",
"\n",
- "# Results\n",
"print \"composition of distillate = %f\"%(yd)\n",
"print \"composition of residue = %f\"%(xw)\n"
],
@@ -488,22 +453,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the top and bottom product composition\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "#part 1\n",
"x=0.4;\n",
"y=0.8;\n",
"x_D=y;\n",
"x_W=0.135; #bottom concentration\n",
"\n",
- "# Calculations and Results\n",
"D=(100*x-100*x_W)/(y-x_W); #distillate amount\n",
"print \"amount of distillate =%f moles/h\"%(D)\n",
"\n",
- "#part 2\n",
"alpha=6; #relative volatility\n",
"x_R=y/(y+(alpha*(1-y))); #liquid leaving partial condensor\n",
"print \"liquid leaving partial condenser = %f\"%(x_R)\n",
@@ -543,15 +503,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the percentage extraction of nicotine\n",
"\n",
"import math \n",
- "# Variables\n",
"x=0.01; #% of nicotine\n",
"X0 = x/(1-x);\n",
"w=150. #weight of nicotine water solution\n",
"\n",
- "# Calculations and Results\n",
"A0=w*(1-X0);\n",
"B0=250.; #kg keroscene\n",
"X1 = A0*X0/(A0+B0*0.798);\n",
@@ -590,15 +547,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the number of stages\n",
"\n",
"import math \n",
- "# Variables\n",
"x=0.01 #mole fraction of nicotine\n",
"yN = 0.0006; #mole fraction in solvent\n",
"xN = 0.001; #final mole fraction in water\n",
"\n",
- "# Calculations and Results\n",
"X0=x/(1.-x); #in kg nicotine/kg water\n",
"YN =yN/(1.-yN); #in kg nicotine/kg keroscene\n",
"XN = xN/(1.-xN);\n",
@@ -608,7 +562,6 @@
"Y1=((A0*(X0-XN))/B0)+YN; #in kg nicotine/kg kerosene\n",
"print \"Y1 = %f kg nicotine/kg kerosene\"%(Y1)\n",
"\n",
- "#for graph refer to the book\n",
"number_of_stages = 8.4;\n",
"print \"numnber of stages = %f\"%(number_of_stages)\n"
],
@@ -638,16 +591,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to calculate the humidity\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 101.3 #in kPa\n",
"pA = 3.74 #in kPa\n",
"p_AS = 7.415 #in kPa\n",
"\n",
- "# Calculations and Results\n",
"H = (18.02/28.97)*(pA/(P-pA));\n",
"print \"humidity = %f kg H2O/kg air\"%(H)\n",
"\n",
@@ -688,12 +638,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the air flow rate and outlet humidity\n",
"\n",
"import math \n",
"from numpy import *\n",
"\n",
- "# Variables\n",
"S=425.6 #in kg/h\n",
"X1 = 0.035 #in kgwater/kg dry solid\n",
"t_s1=25. #in degree C\n",
@@ -705,7 +653,6 @@
"C_pS = 1.465 #in kJ/kg dry solid\n",
"C_pA = 4.187 #in kg/ kg H2O K\n",
"\n",
- "# Calculations and Results\n",
"H_G2=(1.005+1.88*H2)*(t_G2-0)+H2*2501;\n",
"H_S1 = C_pS*(t_s1-0)+X1*C_pA*(t_s1-0); #in kJ/kg\n",
"H_S2 = C_pS*(t_s2-0)+X2*C_pA*(t_s2-0); #in kJ/kg\n",
@@ -715,8 +662,6 @@
"print \"Enthalpy of entering solid HS1 = %f kJ/kg dryair\"%(H_S1)\n",
"print \"Enthalpy of exit solid HS2 = %f kJ/kg dryair\"%(H_S2)\n",
"\n",
- "#applying GHg2 + SHs1 = GHg1 +SHs2 +Q, we get two linear equations\n",
- "#0.0175G+14.17248 = GH1 and 98.194G-29745.398 = 2562.664GH1\n",
"A = array([[0.0175, -1],[98.194, -2562.664]]);\n",
"b = array([[-14.17248],[29745.398]]);\n",
"x = linalg.solve(A,b)\n",
@@ -754,22 +699,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the crystal yield\n",
"\n",
"import math \n",
"from numpy import *\n",
- "# Variables\n",
"M_Na2CO3 = 106\n",
"M_10H2O = 180.2\n",
"M_Na2CO3_10H2O = 286.2;\n",
"w_Na2CO3 = 5000. #in kg\n",
"water = 0.05 #% of water evaporated\n",
"\n",
- "# Calculations\n",
"W = water*w_Na2CO3;\n",
- "#solving material balance, we have two equations\n",
- "#equation 1 -> 0.8230L +0.6296C = 3500\n",
- "#equation 2 -> 0.1769L + 0.3703C = 1250\n",
"\n",
"A = array([[0.8230, 0.6296],[0.1769, 0.3703]])\n",
"b = array([[3500],[1250]])\n",
@@ -777,7 +716,6 @@
"L = x[0]\n",
"C = x[1];\n",
"\n",
- "# Results\n",
"print \"L = %f kg solution\"%(L)\n",
"print \"C = %f kg of Na2CO3.10H2O crystals\"%(C)\n"
],
@@ -807,15 +745,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the crystal yield\n",
"\n",
"import math \n",
"from numpy import *\n",
- "# Variables\n",
"A = array([[0.7380, 0.5117],[0.2619, 0.4882]])\n",
"b = array([[1400],[600]])\n",
"\n",
- "# Calculations and Results\n",
"x = linalg.solve(A,b)\n",
"L = x[0]\n",
"C = x[1];\n",
diff --git a/Introduction_To_Chemical_Engineering/ch7.ipynb b/Introduction_To_Chemical_Engineering/ch7.ipynb
index abdbbfb1..cf9ad80b 100644
--- a/Introduction_To_Chemical_Engineering/ch7.ipynb
+++ b/Introduction_To_Chemical_Engineering/ch7.ipynb
@@ -27,18 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the change on rate of reaction\n",
"\n",
"import math \n",
"\n",
- "#part 1\n",
- "#rate equation r = kC_NO**2*C_O2\n",
- "#if pressure increases 3 times\n",
- "# Calculations and Results\n",
"r = 3**2*3; #according to the rate reaction\n",
"print \"reaction reate will be increased by with 3 times increase in pressure = %f times\"%(r)\n",
"\n",
- "#part 2\n",
"r = 3**2*3; #according to the rate reaction\n",
"print \"reaction reate will be increased by with 3 times decrease in volume = %f times\"%(r)\n",
"\n",
@@ -72,25 +66,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the % transformation\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
- "# Variables\n",
"moles_A = 3.;\n",
"moles_B = 5.;\n",
"K = 1.;\n",
"\n",
- "# Calculations\n",
"def F(x):\n",
" return 15.-8*x;\n",
"\n",
"\n",
- "#initial guess\n",
"x = 10.;\n",
"y = fsolve(F,x)\n",
"\n",
- "# Results\n",
"print \"amount of A transformed = %f percent\"%(y*100/3)\n",
"\n"
],
@@ -119,11 +108,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the initial conc of A and B\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
- "# Variables\n",
"Cp = 0.02;\n",
"Cq = 0.02;\n",
"K = 4*10**-2;\n",
@@ -131,15 +118,12 @@
"Cb_i = Cb+Cp;\n",
"a = (Cp*Cq)/(K*Cb);\n",
"\n",
- "# Calculations\n",
"def F(x):\n",
" return x-0.02-a;\n",
"\n",
- "#initial guess\n",
"x = 10.;\n",
"y = fsolve(F,x)\n",
"\n",
- "# Results\n",
"print \"conc of A= %f mol/l\"%(y)\n",
"print \"conc of B= %f mol/l\"%(Cb_i)\n"
],
@@ -169,21 +153,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the initial concentration and shift in equilibrium\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"Ce_N2 = 3.; #equilibrium conc of N2\n",
"Ce_H2 = 9.; #equilibrium conc of H2\n",
"Ce_NH3 = 4.; #equilibrium conc oh NH3\n",
"\n",
- "# Calculations and Results\n",
"C_N2 = Ce_N2 + 0.5*Ce_NH3;\n",
"C_H2 = Ce_H2 + 1.5*Ce_NH3;\n",
"\n",
"print \"concentration of N2 = %f mol/l \\nconcentration of H2 = %f mol/l\"%(C_N2,C_H2)\n",
- "# Note :second part is theoritical, book shall be referred for solution\n",
"\n",
"n_H2 = 3.; #stotiometric coefficient\n",
"n_N2 = 1.; #stotiometric coefficient\n",
@@ -220,31 +200,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the % transformation\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
- "# Variables\n",
"moles_A = 0.02;\n",
"K = 1.;\n",
"\n",
- "# Calculations and Results\n",
- "#part 1\n",
"moles_B = 0.02;\n",
"def F(x):\n",
" return moles_A*moles_B-(moles_A+moles_B)*x;\n",
"\n",
- "#initial guess\n",
"x = 10.;\n",
"y = fsolve(F,x)\n",
"print \"amount of A transformed = %f percent\"%(y*100/0.02)\n",
"\n",
- "#part 2\n",
"moles_B = 0.1;\n",
"y = fsolve(F,x)\n",
"print \"amount of A transformed = %f percent\"%(y*100/0.02)\n",
"\n",
- "#part 1\n",
"moles_B = 0.2;\n",
"y = fsolve(F,x)\n",
"print \"amount of A transformed = %.0f percent\"%(y*100/0.02)\n",
@@ -277,22 +250,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the rate equation\n",
"\n",
"import math \n",
"from numpy import *\n",
"from matplotlib.pyplot import *\n",
"\n",
"%pylab inline\n",
- "# Variables\n",
"t = array([0,5,10,15,20,25])\n",
"C_A = array([25,18.2,13.2,9.6,7,5.1])\n",
"\n",
- "#integral method of rate determination\n",
"s = 0;\n",
"k = zeros(6)\n",
"\n",
- "# Calculations and Results\n",
"for i in range(1,6):\n",
" k[i] = (1./t[i])*math.log(25./C_A[i])\n",
" #print (k[i],\"k values for various conc.\")\n",
@@ -308,7 +277,6 @@
"ylabel(\"concentration\")\n",
"suptitle(\"integral method\")\n",
"\n",
- "#differential method of rate determination\n",
"ra = array([1.16,0.83,0.60,0.43])\n",
"C_A = array([18.2,13.2,9.6,7])\n",
"\n",
@@ -373,20 +341,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the rate of reaction\n",
"\n",
"import math \n",
- "# Variables\n",
"E = 75200. #in J/mol\n",
"E1 = 50100. #in J/mol\n",
"R = 8.314 #in J/mol K\n",
"T = 298. #in K\n",
"\n",
- "# Calculations\n",
"ratio = math.exp((E1-E)/(R*T));\n",
"rate_increase = ratio**-1\n",
"\n",
- "# Results\n",
"print \"increase in rate of reaction =\",rate_increase,\"times\"\n"
],
"language": "python",
diff --git a/Introduction_To_Chemical_Engineering/ch8.ipynb b/Introduction_To_Chemical_Engineering/ch8.ipynb
index a18b8152..d67175c5 100644
--- a/Introduction_To_Chemical_Engineering/ch8.ipynb
+++ b/Introduction_To_Chemical_Engineering/ch8.ipynb
@@ -30,13 +30,11 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"pressure_difference = 3.4 #in mm water\n",
"pressure = 1.0133*10**5 #in pa\n",
"temperatue = 293. #in K\n",
"mass_of_air = 29. #in Kg\n",
"\n",
- "# Calculations and Results\n",
"density_air = pressure/(temperatue*8314)*mass_of_air #in kg/m3\n",
"print \"Density of air = %f kg/cu m\"%(density_air)\n",
"\n",
@@ -76,21 +74,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find viscosity of oil \n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"diameter=0.6; #in m\n",
"disk_distance=1.25*10**-3; #in m\n",
"speed=5.; #revolutions/min\n",
"torque=11.5; #in Joules\n",
"\n",
- "# Calculations\n",
- "#we know that torque= pi*omega*viscosity*radius**4/2*disc_distance\n",
"viscosity=(2*disk_distance*torque)/(3.14*(10*3.14)*(diameter/2)**4);\n",
"\n",
- "# Results\n",
"print \"viscosity = %f Pa-s\"%(viscosity)\n"
],
"language": "python",
@@ -118,22 +111,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the viscosity of solution using given parameters\n",
"\n",
"import math \n",
- "# Variables\n",
"diameter =10.; #in mm\n",
"density_of_solution = 1750.; #in kg/m3\n",
"density_of_air = 1.2; #in kg/m3\n",
"velocity = 0.9; #in mm/s\n",
"\n",
- "# Calculations and Results\n",
"viscosity = (density_of_solution-density_of_air)*9.8*(diameter*10**-3)**2/(18*velocity*10**-3); #expression for finding viscosity\n",
"\n",
"print \"viscosity of solution = %f Pa-s\"%(viscosity)\n",
"\n",
"\n",
- "#checking stoke's region validity\n",
"v=(0.2*viscosity)/(density_of_solution*diameter*10**-3);\n",
"if v>0.9 :\n",
" print \"system follows stokes law\"\n"
@@ -164,11 +153,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the flow rate in an orifice\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"density_of_water = 1000.; #in kg/m3\n",
"viscosity = 1*10.**-3; #in Pa-s\n",
"pipe_diameter = 250.; #in mm\n",
@@ -176,14 +163,11 @@
"density_of_mercury = 13600.; # in mm\n",
"manometer_height = 242.; #in mm\n",
"\n",
- "# Calculations and Results\n",
"height_water_equivalent = (density_of_mercury-density_of_water)*(manometer_height*10**-3)/(density_of_water) #in m\n",
"\n",
- "#assuming Re>30000\n",
"Co = 0.61;\n",
"velocity = Co*(2*9.8*height_water_equivalent/(1-(orifice_diameter/pipe_diameter)**4))**0.5; #in m/s\n",
"\n",
- "#checking Reynold's number\n",
"Re = (orifice_diameter*10**-3*velocity*density_of_water)/viscosity;\n",
"print \"reynolds number = %f which is greater than 30000\"%(Re)\n",
"\n",
@@ -220,10 +204,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the coefficient of discharge for converging cone\n",
"\n",
"import math \n",
- "# Variables\n",
"pipe_diameter=0.15; #in m\n",
"venturi_diameter=0.05; #in m\n",
"pressure_drop=0.12; #m of water\n",
@@ -231,15 +213,12 @@
"density = 1000.; #in kg/m3\n",
"viscosity = 0.001 #in Pa-s\n",
"\n",
- "# Calculations and Results\n",
"velocity = ((4./3.14)*flow_rate)/(venturi_diameter**2*density);\n",
"print \"velociy = %f m/s\"%(velocity)\n",
"\n",
- "#calculating coefficient of discharge\n",
"Cv=velocity*((1-(venturi_diameter/pipe_diameter)**4)/(2*9.8*pressure_drop))**0.5;\n",
"print \"coefficient of discharge = %f\"%(Cv)\n",
"\n",
- "#calculating reynold's number\n",
"Re = velocity*(venturi_diameter/pipe_diameter)**2*pipe_diameter*density/viscosity;\n",
"print \"reynolds No = %f\"%(Re)\n"
],
@@ -270,10 +249,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find pA and pB\n",
"\n",
"import math \n",
- "# Variables\n",
"h1=0.66; #in m\n",
"h2=0.203; #in m\n",
"h3=0.305 #in m\n",
@@ -282,7 +259,6 @@
"s1=0.83;\n",
"s2=13.6;\n",
"\n",
- "# Calculations and Results\n",
"print (\"part 1\")\n",
"pA=pB+(h2*s2-(h1-h3)*s1)*density*9.81; #in Pa\n",
"print \"pressure at A = %f Pa\"%(pA)\n",
@@ -322,17 +298,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the rate of oil flow in l/s\n",
"\n",
"import math \n",
- "# Variables\n",
"density_oil=900.; #in kg/m3\n",
"viscosity_oil=38.8*10**-3; #in Pa-s\n",
"density_water = 1000.; #in kg/m3\n",
"diameter=0.102 #in m\n",
"manometer_reading=0.9; #m of water\n",
"\n",
- "# Calculations and Results\n",
"delta_H=manometer_reading*(density_water-density_oil)/density_oil;\n",
"print \"manometer reading as m of oil = %f m\"%(delta_H)\n",
"\n",
@@ -378,20 +351,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the maximum capacity of keroscene\n",
"\n",
"import math \n",
- "# Variables\n",
"flow_rate_steel=1.2; #l/s\n",
"density_steel=7.92;\n",
"density_kerosene=0.82;\n",
"density_water=1;\n",
"\n",
- "# Calculations\n",
"flow_rate_kerosene =(((density_steel-density_kerosene)/density_kerosene)/((density_steel-density_water)/density_water))**0.5*flow_rate_steel\n",
"\n",
"\n",
- "# Results\n",
"print \"maximum_flow rate of kerosene = %f litre/s\"%(flow_rate_kerosene)\n"
],
"language": "python",
@@ -419,28 +388,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the rate of flow of flue gas\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
- "# Variables\n",
"initial_CO2 = 0.02; #weight fraction\n",
"flow_rate_CO2 = 22.5; #gm/s\n",
"final_CO2=0.031; #weight fraction\n",
"\n",
- "#flow rate of flue gas =x\n",
- "#amount of CO2 entering = 0.02*x\n",
- "#amount of CO2 leaving = 0.02x+0.0225\n",
- "#amount of gas leaving = x+0.0225\n",
- "#amount of CO2 leaving = 0.031*(x+0.0225)\n",
"\n",
- "# Calculations\n",
"def f(x): \n",
"\t return initial_CO2*x+0.0225 - 0.031*(x+0.0225)\n",
"\n",
"flow_rate_flue_gas=fsolve(f,0)\n",
"\n",
- "# Results\n",
"print \"flow rate of flue gas = %f kg/s\"%(flow_rate_flue_gas)\n",
"\n"
],
diff --git a/Introduction_To_Chemical_Engineering/ch9.ipynb b/Introduction_To_Chemical_Engineering/ch9.ipynb
index ebdb2cdc..ff828207 100644
--- a/Introduction_To_Chemical_Engineering/ch9.ipynb
+++ b/Introduction_To_Chemical_Engineering/ch9.ipynb
@@ -27,10 +27,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the pressure drop in the coil\n",
"\n",
"import math \n",
- "# Variables\n",
"D = 38.*10**-3; #in m\n",
"U = 1. #in m/s\n",
"density = 998. #in kg/cubic m\n",
@@ -39,7 +37,6 @@
"N = 10.\n",
"e = 4.*10**-6; #in m\n",
"\n",
- "# Calculations and Results\n",
"Re = (density*U*D)/viscosity;\n",
"print \"Reynolds number = %f\"%(Re)\n",
"\n",
@@ -87,10 +84,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#to find the shell side pressure drop in heat exchanger\n",
"\n",
"import math \n",
- "# Variables\n",
"U = 0.5 #in m/s\n",
"N = 19.;\n",
"DT = 0.026 #in m\n",
@@ -102,7 +97,6 @@
"Pr = 6.5;\n",
"Prw = 7.6;\n",
"\n",
- "# Calculations and Results\n",
"HYDIA = (DS**2-N*DT**2)/(DS+N*DT);\n",
"Re = HYDIA*U*density/viscosity;\n",
"print \"Reynolds number = %f\"%(Re)\n",
@@ -151,7 +145,6 @@
"collapsed": false,
"input": [
"import math \n",
- "# Variables\n",
"MH = 10. #in kg/s\n",
"MC = 12.5 #in kg/s\n",
"CPH = 4.2 #in kJ/kg\n",
@@ -161,14 +154,12 @@
"TCI = 300. #in K\n",
"U = 1.8 #in kW/sq m K\n",
"\n",
- "# Calculations and Results\n",
"Q = MH*CPH*(THI-THO);\n",
"print \"heat load = %f J\"%(Q)\n",
"\n",
"TCO = Q/(MC*CPC)+TCI;\n",
"print \"cold fluid outlet temperature = %f K\"%(TCO)\n",
"\n",
- "#for co current flow\n",
"\n",
"DT1 = THI-TCO;\n",
"DT2 = THO-TCO;\n",
@@ -178,7 +169,6 @@
"A = Q/(U*LMTD);\n",
"print \"for co current flow area = %f sq m\"%(A);\n",
"\n",
- "#for counter current flow\n",
"\n",
"DT1 = THI-TCO;\n",
"DT2 = THO-TCI;\n",
diff --git a/Let_us_C/chapter-1.ipynb b/Let_us_C/chapter-1.ipynb
index 19d3a98f..5c48f867 100644
--- a/Let_us_C/chapter-1.ipynb
+++ b/Let_us_C/chapter-1.ipynb
@@ -26,8 +26,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''calculate simple interest for a set of values representing principle,\n",
- "number of years and rate of interest.'''\n",
"\n",
"#Variable declaration\n",
"p = 1000 #principle\n",
@@ -64,8 +62,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''calculate simple interest by inputing principle,\n",
- "number of years and rate of interest from the user.'''\n",
"\n",
"#Input from the user\n",
"#p,n,r = raw_input(\"Enter values of p, n, r : \").split()\n",
@@ -103,7 +99,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Just for fun. Author: Bozo'''\n",
"\n",
"#Input from the user\n",
"#num = raw_input(\"Enter a number : \")\n",
@@ -138,8 +133,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine the hierarchy of operations and evaluate the following expression:\n",
- "i = 2 * 3 / 4 + 4 / 4 + 8 - 2 + 5 / 8'''\n",
"\n",
"#Calculation\n",
"i1 = 2 * 3 # operation *\n",
@@ -179,8 +172,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine the hierarchy of operations and evaluate the following expression:\n",
- "kk = 3 / 2 * 4 + 3 / 8 + 3'''\n",
"\n",
"#Calculation\n",
"kk1 = 3 / 2# operation /\n",
diff --git a/Let_us_C/chapter-10.ipynb b/Let_us_C/chapter-10.ipynb
index db8bf067..93132187 100644
--- a/Let_us_C/chapter-10.ipynb
+++ b/Let_us_C/chapter-10.ipynb
@@ -25,8 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to store data about 3 books that is their name\n",
- "(a string), price (a float) and number of pages (an int).'''\n",
"\n",
"#Variable declaration\n",
"name = []\n",
@@ -82,8 +80,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to store data about 3 books that is their name\n",
- "(a string), price (a float) and number of pages (an int).'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -143,8 +139,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate that elements of a structure,\n",
- "are always stored in contiguous memory locations'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -184,7 +178,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to show how to use an array of structures.'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -240,9 +233,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate that values of a structure variable can be\n",
"assigned to another structure variable of the same type\n",
- "using the assignment operator.'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -294,7 +285,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate nested structures at work.'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintions\n",
@@ -334,8 +324,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the method of passing individual structure elements to\n",
- "functions'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintions\n",
@@ -375,8 +363,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the method of passing \n",
- "the entire structure variable to a function'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintions\n",
@@ -416,7 +402,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that demonstrates the usage of a structure pointer.'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintions\n",
@@ -455,7 +440,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that demonstrates passing address of a structure variable'''\n",
"\n",
"#function definition\n",
"def display (b):\n",
diff --git a/Let_us_C/chapter-11.ipynb b/Let_us_C/chapter-11.ipynb
index 4f966f44..6e6a2bf4 100644
--- a/Let_us_C/chapter-11.ipynb
+++ b/Let_us_C/chapter-11.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing a formatted string using printf function'''\n",
"\n",
"#Variable declaration\n",
"avg = 346 \n",
@@ -59,7 +58,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing using format specifiers in printf function'''\n",
"\n",
"#Variable declaration\n",
"weight = 63\n",
@@ -99,7 +97,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing using format specifiers in printf function'''\n",
"\n",
"#Variable declaration\n",
"firstname1 = \"Sandy\" \n",
@@ -136,8 +133,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrateshows usage of \\n and a\n",
- "new escape sequence \\t, called \u2018tab\u2019'''\n",
"\n",
"#Result\n",
"print \"You\\tmust\\tbe\\tcrazy\\nto\\thate\\tthis\\tbook\" \n"
@@ -167,7 +162,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to perform the specified conversion using printf function'''\n",
"\n",
"#Variable declaration\n",
"ch = 'z' \n",
@@ -209,7 +203,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of sprintf function'''\n",
"\n",
"#Variable declaration\n",
"i = 10 \n",
@@ -248,7 +241,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of unformatted input functions'''\n",
"\n",
"import msvcrt\n",
"\n",
@@ -298,7 +290,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of unformatted output functions'''\n",
"\n",
"#Variable declaration\n",
"ch = 'A'\n",
@@ -340,7 +331,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of gets and puts functions'''\n",
"\n",
"#Input from user\n",
"#footballer = input(\"Enter name\" ) # puts(\"Enter name \") ; gets(footballer)\n",
diff --git a/Let_us_C/chapter-12.ipynb b/Let_us_C/chapter-12.ipynb
index f0567d09..a3331f4d 100644
--- a/Let_us_C/chapter-12.ipynb
+++ b/Let_us_C/chapter-12.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to display contents of a file on screen.'''\n",
"\n",
"fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n",
"while ( 1 ):\n",
@@ -1582,8 +1581,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to check whether a file has been opened successfully before\n",
- "trying to read or write to the file'''\n",
"\n",
"try :\n",
" fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" )#open file in read mode and check if file is opened successfully\n",
@@ -1617,7 +1614,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to count chars, spaces, tabs and newlines in a file.'''\n",
"\n",
"#Variable declaration\n",
"nol = 0\n",
@@ -1673,8 +1669,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to take the contents of a file and\n",
- "copy them into another file, character by character.'''\n",
"\n",
"fs = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n",
"if(not fs):\n",
@@ -1714,7 +1708,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to receive strings from keyboard and write them to file'''\n",
"\n",
"fp = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) #open file in write mode\n",
"if(not fp):\n",
@@ -1759,7 +1752,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to reads strings from the file and displays them on screen.'''\n",
"\n",
"fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n",
"if ( not fp ):\n",
@@ -1839,7 +1831,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to write records to a file using structure'''\n",
"\n",
"from collections import namedtuple\n",
"\n",
@@ -1899,7 +1890,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to read records from a file using structure'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -1947,7 +1937,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to copy text as well as binary files'''\n",
"\n",
"fs = open (\"C:/Users/Akshatha M/Desktop/Project1.exe\", \"rb\" ) #open file in read binary mode\n",
"if(not fs):\n",
@@ -1987,7 +1976,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to receive records from keyboard and write them to a file in binary mode'''\n",
"\n",
"from collections import namedtuple\n",
"\n",
@@ -2050,7 +2038,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to read records from binary file and displays them on VDU'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -2098,7 +2085,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''A menu-driven program for elementary database management'''\n",
"\n",
"import os\n",
"from collections import namedtuple\n",
@@ -2202,7 +2188,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''File-copy program which copies text, .com and .exe files'''\n",
"\n",
"#source=input( \"Enter source file name \" ) \n",
"print \"Enter source file name \" \n",
@@ -2267,7 +2252,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''A program that illustrates the usage of ferror( )'''\n",
"\n",
"\n",
"fp = open ( \"C:/Users/Akshatha/Documents/extrastuff/skills.txt\", \"w\" ) \n",
@@ -2305,7 +2289,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''A program to write a file to a printer'''\n",
"\n",
"import io\n",
"\n",
diff --git a/Let_us_C/chapter-13.ipynb b/Let_us_C/chapter-13.ipynb
index d3b93ca6..bd79a9c1 100644
--- a/Let_us_C/chapter-13.ipynb
+++ b/Let_us_C/chapter-13.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''File-copy program usinng command line arguments'''\n",
"\n",
"import sys\n",
"\n",
diff --git a/Let_us_C/chapter-14.ipynb b/Let_us_C/chapter-14.ipynb
index becf792e..8181a680 100644
--- a/Let_us_C/chapter-14.ipynb
+++ b/Let_us_C/chapter-14.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to print binary equivalent of integers using showbits( ) function'''\n",
"\n",
"#Function definition\n",
"def showbits ( n ):\n",
@@ -170,7 +169,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to shows one\u2019s complement operator in action.'''\n",
"\n",
"#Function definition\n",
"def showbits ( n ):\n",
@@ -351,7 +349,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate file encryption utility'''\n",
"\n",
"#Function definition\n",
"def encrypt( ):\n",
@@ -389,7 +386,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the effect of right shift operator.'''\n",
"\n",
"#Function definition\n",
"def showbits ( n ):\n",
@@ -556,7 +552,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the effect of left shift operator.'''\n",
"\n",
"#Function definition\n",
"def showbits ( n ):\n",
@@ -723,7 +718,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to decode the date field in directory entry using bitwise operators'''\n",
"\n",
"#Variable declaration\n",
"d = 9\n",
@@ -767,7 +761,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to test whether a bit in a number is ON or OFF'''\n",
"\n",
"#Variable declaration\n",
"i = 65\n",
@@ -812,8 +805,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate that a number XORed with another number\n",
- "twice gives the original number.'''\n",
"\n",
"#Variable declaration\n",
"b = 50\n",
diff --git a/Let_us_C/chapter-15.ipynb b/Let_us_C/chapter-15.ipynb
index bf1ab52b..993f6a9b 100644
--- a/Let_us_C/chapter-15.ipynb
+++ b/Let_us_C/chapter-15.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to print a payroll using enum'''\n",
"\n",
"def enum(**enums):\n",
" return type('Enum', (), enums)\n",
@@ -82,7 +81,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to achieve the task of enums using macros'''\n",
"\n",
"#macro definition\n",
"ASSEMBLY = 0\n",
@@ -114,7 +112,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate no typecasting'''\n",
"\n",
"#Variable declaration\n",
"x=6\n",
@@ -150,7 +147,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate explicit typecasting'''\n",
"\n",
"#Variable declaration\n",
"x=6\n",
@@ -186,7 +182,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate typecasting'''\n",
"\n",
"#Variable declaration\n",
"a=6.35\n",
@@ -220,7 +215,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate bit fields in structures'''\n",
"\n",
"from ctypes import *\n",
"import ctypes\n",
@@ -276,7 +270,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate pointers to functions'''\n",
"\n",
"#Function definition\n",
"def display():\n",
@@ -311,7 +304,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to invoke a function using a pointer to a function'''\n",
"\n",
"#Function definition\n",
"def display():\n",
@@ -346,7 +338,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate functions returning pointers'''\n",
"\n",
"#Function definition\n",
"def fun():\n",
@@ -372,8 +363,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program which copies one string into another and\n",
- "returns the pointer to the target string'''\n",
"\n",
"#Function definition\n",
"def copy(t,s):\n",
@@ -415,9 +404,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a findmax() function\n",
"to find out max value from a set of values\n",
- "irrespective of number of values passed to it'''\n",
"\n",
"#function declaration\n",
"def findmax(*arg):\n",
@@ -459,8 +446,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a display() function\n",
- "to print any number of arguments of any type'''\n",
"\n",
"#function declaration\n",
"def display(*arg):\n",
@@ -514,7 +499,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a union at work'''\n",
"\n",
"from ctypes import *\n",
"\n",
@@ -544,8 +528,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate that we cant assign different values to\n",
- "different union element at the same time'''\n",
"\n",
"from ctypes import *\n",
"\n",
@@ -580,7 +562,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate structures nested in a union'''\n",
"\n",
"from ctypes import *\n",
"\n",
diff --git a/Let_us_C/chapter-16.ipynb b/Let_us_C/chapter-16.ipynb
index 8c3c03f2..195741f0 100644
--- a/Let_us_C/chapter-16.ipynb
+++ b/Let_us_C/chapter-16.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to display a \u201cHello\u201d message in a message box'''\n",
"\n",
"import ctypes\n",
"MessageBox = ctypes.windll.user32.MessageBoxW\n",
diff --git a/Let_us_C/chapter-17.ipynb b/Let_us_C/chapter-17.ipynb
index 1b6a9007..ea406a32 100644
--- a/Let_us_C/chapter-17.ipynb
+++ b/Let_us_C/chapter-17.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to create a window on the screen.'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -55,7 +54,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to create several windows on the screen'''\n",
"\n",
"from tkinter import *\n",
"root = []\n",
@@ -85,7 +83,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to create a window using window class and interact with it'''\n",
"\n",
"from tkinter import *\n",
"\n",
diff --git a/Let_us_C/chapter-18.ipynb b/Let_us_C/chapter-18.ipynb
index 7a30b0b6..3aa35505 100644
--- a/Let_us_C/chapter-18.ipynb
+++ b/Let_us_C/chapter-18.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to display a message \u201cHello Windows\u201d in different fonts'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -65,7 +64,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that displays different shapes in a window'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -105,8 +103,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to create pens of different style, color and\n",
- "thickness to draw'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -205,7 +201,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to display a image in a window.'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -233,7 +228,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a animation of a ball bouncing off a window '''\n",
"from visual import *\n",
"\n",
"floor = box(length=4, height=0.5, width=4, color=color.blue)\n",
diff --git a/Let_us_C/chapter-2.ipynb b/Let_us_C/chapter-2.ipynb
index fc025445..e2379edc 100644
--- a/Let_us_C/chapter-2.ipynb
+++ b/Let_us_C/chapter-2.ipynb
@@ -25,8 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Demonstration of if statement\n",
- "Here is a simple program, which demonstrates the use of if and the relational operators'''\n",
"\n",
"#taking in input from the user\n",
"#num = raw_input(\"Enter a number less than 10: \")\n",
@@ -64,8 +62,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000.\n",
- "If quantity and price per item are input through the keyboard, write a program to calculate the total expenses.'''\n",
"\n",
"#Variable declaration\n",
"dis = 0 #Initial Discount (%0)\n",
@@ -113,9 +109,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''The current year and the year in which the employee joined the organization are entered through the keyboard.\n",
"If the number of years for which the employee has served the organization is greater than 3 then a bonus of Rs. 2500/- is given to the employee.\n",
- "If the years of service are not greater than 3, then the program should do nothing'''\n",
"\n",
"#input from user\n",
"#cy,yoj = raw_input(\"Enter current year and year of joining: \").split() \n",
@@ -157,10 +151,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''In a company an employee is paid as under:\n",
"If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and\n",
"DA = 90% of basic salary. If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary.\n",
- "If the employee's salary is input through the keyboard ,write a program to find his gross salary.'''\n",
"\n",
"#input from user\n",
"#bs = raw_input(\"Enter basic salary: \")\n",
@@ -207,7 +199,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''A quick demo of nested if-else'''\n",
"\n",
"#input from user\n",
"#i = raw_input(\"Enter either 1 or 2: \")\n",
@@ -250,13 +241,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules:\n",
"Percentage above or equal to 60 - First division\n",
"Percentage between 50 and 59 - Second division\n",
"Percentage between 40 and 49 - Third division\n",
"Percentage less than 40 - Fail\n",
"Write a program to calculate the division obtained by the student.\n",
- "Method 1'''\n",
"\n",
"#input from user\n",
"#m1,m2,m3,m4,m5 = raw_input(\"Enter marks in five subjects: \").split() \n",
@@ -309,7 +298,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Method 2'''\n",
"\n",
"#input from user\n",
"#m1,m2,m3,m4,m5 = raw_input(\"Enter marks in five subjects: \").split() \n",
@@ -363,7 +351,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Method 3 - else if ladder demo'''\n",
"\n",
"#input from user\n",
"#m1,m2,m3,m4,m5 = raw_input(\"Enter marks in five subjects: \").split() \n",
@@ -414,12 +401,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''A company insures its drivers in the following cases:\n",
"\u2212 If the driver is married.\n",
"\u2212 If the driver is unmarried, male & above 30 years of age.\n",
"\u2212 If the driver is unmarried, female & above 25 years of age.\n",
"In all other cases the driver is not insured.\n",
- "If the marital status, sex and age of the driver are the inputs, write a program to determine whether the driver is to be insured or not.'''\n",
"\n",
"#input from user\n",
"#age,sex,ms = raw_input(\"Enter age, sex, marital status: \").split() # Age , sex and marital status of the driver\n",
@@ -470,7 +455,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Using logical operators'''\n",
"\n",
"#input from user\n",
"#age,sex,ms = raw_input(\"Enter age, sex, marital status: \").split() # Age , sex and marital status of the driver\n",
@@ -512,7 +496,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Write a program to calculate the salary as per the given table'''\n",
"\n",
"#Input gender( m/f), years of service and qualification from the user\n",
"#g,yos,qual = raw_input(\"Enter Gender, Years of Service and Qualifications ( 0 = G, 1 = PG ):\").split()\n",
diff --git a/Let_us_C/chapter-20.ipynb b/Let_us_C/chapter-20.ipynb
index 52b3cd37..16c8fdc8 100644
--- a/Let_us_C/chapter-20.ipynb
+++ b/Let_us_C/chapter-20.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate how to create a child process'''\n",
"\n",
"import os\n",
"\n",
@@ -50,7 +49,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate how to create a child process'''\n",
"\n",
"import os\n",
"\n",
@@ -76,7 +74,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to get the pids of parent and child processes'''\n",
"\n",
"import os\n",
"from multiprocessing import Process\n",
@@ -115,7 +112,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that uses execl( ) to run a new program in the child process.'''\n",
"\n",
"import os\n",
"\n",
@@ -143,8 +139,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that gets the exit code\n",
- "of the terminated process and thereby ensures a proper cleanup.'''\n",
"\n",
"import os\n",
"\n",
diff --git a/Let_us_C/chapter-21.ipynb b/Let_us_C/chapter-21.ipynb
index 7cf37612..9883bc71 100644
--- a/Let_us_C/chapter-21.ipynb
+++ b/Let_us_C/chapter-21.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to prevent the termination of a program even after hitting Ctrl + C'''\n",
"\n",
"import signal, os\n",
"\n",
@@ -52,7 +51,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to handle multiple signals.'''\n",
"\n",
"import signal, os\n",
"\n",
@@ -88,8 +86,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a common signal handler to handle all signals\n",
- "instead of registering a separate handler for each signal'''\n",
"\n",
"import signal, os\n",
"\n",
@@ -123,7 +119,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to understand signal blocking '''\n",
"\n",
"import signal, os\n",
"\n",
@@ -164,7 +159,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that uses GTK toolkit to create a window on the screen.'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -198,7 +192,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to draw a few shapes in a window'''\n",
"\n",
"from tkinter import *\n",
"\n",
diff --git a/Let_us_C/chapter-3.ipynb b/Let_us_C/chapter-3.ipynb
index eae87c95..5b3de0d9 100644
--- a/Let_us_C/chapter-3.ipynb
+++ b/Let_us_C/chapter-3.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculation of simple interest for 3 sets of p, n and r (while loop)'''\n",
"\n",
"#Variable declaration\n",
"count = 1\n",
@@ -77,7 +76,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculation of simple interest for 3 sets of p, n and r (for loop)'''\n",
"\n",
"pr = [1000,2000,3500]\n",
"yr = [5,5,5]\n",
@@ -123,7 +121,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Demonstration of nested loops'''\n",
"\n",
"#nested for loops\n",
"for r in range(1,4): #outer loop\n",
@@ -161,7 +158,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Execution of a loop an unknown number of times'''\n",
"\n",
"#do while loop\n",
"while True:\n",
@@ -203,7 +199,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''odd loop using a for loop'''\n",
"\n",
"#Variable declaration\n",
"another = 'y'\n",
@@ -250,7 +245,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''odd loop using a while loop'''\n",
"\n",
"#Variable declaration\n",
"another = 'y'\n",
@@ -292,8 +286,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Write a program to determine whether a number is prime or not.\n",
- "A prime number is one, which is divisible only by 1 or itself.'''\n",
"\n",
"#Input from user\n",
"#num = raw_input(\"Enter a number: \")\n",
@@ -337,8 +329,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''The following program illustrates the fact that the keyword break,\n",
- "breaks the control only from the loop in which it is placed.'''\n",
"\n",
"#Variable declaration\n",
"i = 1\n",
@@ -577,7 +567,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''The following program illustrates the use of the 'continue' statement'''\n",
"\n",
"#for loops\n",
"for i in range(1,3):\n",
diff --git a/Let_us_C/chapter-4.ipynb b/Let_us_C/chapter-4.ipynb
index d6b348c1..75a56ab9 100644
--- a/Let_us_C/chapter-4.ipynb
+++ b/Let_us_C/chapter-4.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate switch-case control structure(without break)'''\n",
"\n",
"#Variable declaration\n",
"i = 2\n",
@@ -65,7 +64,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate switch-case control structure'''\n",
"\n",
"#Variable declaration\n",
"i = 2\n",
@@ -104,7 +102,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''An example of scrambled case order'''\n",
"\n",
"#Variable declaration\n",
"i = 22\n",
@@ -143,7 +140,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''An example which shows the use of 'char' values in case and switch'''\n",
"\n",
"#Variable declaration\n",
"c = 'x'\n",
@@ -182,8 +178,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''An example which shows how to execute a common set of statements for\n",
- "multiple cases.'''\n",
"\n",
"#Input from user\n",
"#ch = raw_input(\"Enter any of the alphabet a, b, or c : \")\n",
@@ -223,9 +217,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''An example that shows every statement in a switch must belong to some \n",
"case or the other. If it doesn\u2019t,the compiler won\u2019t report an error.\n",
- "However, the statement would never get executed.'''\n",
"\n",
"#Input from user\n",
"#i = raw_input(\"Enter value of i \")\n",
@@ -255,8 +247,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program shows how to use goto statement'''\n",
- "'''Python doesnt support statements like 'goto' '''\n",
"#Input from user\n",
"#goals = raw_input(\"Enter the number of goals scored against India: \")\n",
"goals = 3\n",
@@ -292,9 +282,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''The following program illustrates the usage of 'goto'\n",
"when we want to take the control out of the loop that is contained in\n",
- "several other loops.'''\n",
"\n",
"\n",
"#nested for loops\n",
diff --git a/Let_us_C/chapter-5.ipynb b/Let_us_C/chapter-5.ipynb
index 62f0970a..76227dd0 100644
--- a/Let_us_C/chapter-5.ipynb
+++ b/Let_us_C/chapter-5.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a simple function'''\n",
"\n",
"# function definition\n",
"def message():\n",
@@ -59,7 +58,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a call to more than one function'''\n",
"\n",
"# function definitions\n",
"def italy():\n",
@@ -105,7 +103,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a call to more than one function'''\n",
"\n",
"# function definitions\n",
"def argentina():\n",
@@ -154,7 +151,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate sending and receiving values between functions'''\n",
"\n",
"# function definition\n",
"def calsum ( x, y, z ):\n",
@@ -201,10 +197,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate that there is no restriction on the number of return\n",
"statements that may be present in a function.\n",
"Also, the return statement need not always be present at the end of the called\n",
- "function.'''\n",
"\n",
"# function definition\n",
"def fun():\n",
@@ -240,9 +234,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate that If the value of a formal argument is\n",
"changed in the called function, the corresponding\n",
- "change does not take place in the calling function.'''\n",
"\n",
"# function definition\n",
"def fun(b):\n",
@@ -278,7 +270,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate Scope Rule of Functions'''\n",
"\n",
"# function definition\n",
"def display(j):\n",
@@ -314,7 +305,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to find out square of a number using a function.'''\n",
"\n",
"# function definition\n",
"def square(x):\n",
@@ -358,8 +348,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a called function without returning any value using\n",
- "the keyword void.'''\n",
"\n",
"# function definition\n",
"def gospel(): # void function\n",
@@ -397,7 +385,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to print the address of a variable'''\n",
"\n",
"#Variable declaration\n",
"i = 3\n",
@@ -431,8 +418,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that demonstrates the relationships between pointers , variables\n",
- "and addresses'''\n",
"\n",
"#Variable declaration\n",
"i = 3 \n",
@@ -477,8 +462,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that demonstrates a pointer that\n",
- "points to another pointer'''\n",
"\n",
"#Variable declaration\n",
"i = 3\n",
@@ -534,7 +517,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the \u2018Call by Value\u2019 method of passing arguments'''\n",
"\n",
"# function definition\n",
"def swapv (x,y):\n",
@@ -575,7 +557,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the \u2018Call by Reference\u2019 method of passing arguments'''\n",
"\n",
"# function definition\n",
"def swapv (a,b):\n",
@@ -615,8 +596,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate how to use a call by reference to make a function\n",
- "return more than one value at a time, which is not possible ordinarily.'''\n",
"\n",
"#Input from user\n",
"#radius = raw_input(\"Enter radius of a circle: \" )\n",
@@ -664,8 +643,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a non-recursive function for calculating\n",
- "the factorial value of an integer'''\n",
"\n",
"# function definition\n",
"def factorial(x):\n",
@@ -711,8 +688,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a the recursive version of\n",
- "the function to calculate the factorial value.'''\n",
"\n",
"# function definition\n",
"def rec(x):\n",
@@ -759,8 +734,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the use of a stack for\n",
- "implementing function calls'''\n",
"\n",
"#Variable declaration\n",
"a = 5\n",
diff --git a/Let_us_C/chapter-6.ipynb b/Let_us_C/chapter-6.ipynb
index 7cf66240..8234fda0 100644
--- a/Let_us_C/chapter-6.ipynb
+++ b/Let_us_C/chapter-6.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the range of char'''\n",
"\n",
"#Variable declaration\n",
"ch = 291\n",
@@ -57,7 +56,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the range of an unsigned char'''\n",
"\n",
"for ch in range(0,256):\n",
" print \"%d %c\" %(ch, ch%128 )\n",
@@ -354,7 +352,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the scope and life of an automatic variable'''\n",
"\n",
"#Variable declaration\n",
"i = 1 #auto int\n",
@@ -401,7 +398,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the scope and life of an automatic variable'''\n",
"\n",
"#Variable declaration\n",
"i = 1 #auto int\n",
@@ -450,7 +446,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that puts to use all the data types'''\n",
"\n",
"#char\n",
"#c,d = raw_input(\"char: \").split()\n",
@@ -513,8 +508,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to understand the difference\n",
- "between the automatic and static storage classes.'''\n",
"\n",
"#function definition \n",
"def increment( ):\n",
@@ -553,8 +546,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to understand the difference\n",
- "between the automatic and static storage classes.'''\n",
"\n",
"#function definition \n",
"def increment(i = [1]): #static int \n",
@@ -592,7 +583,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the advantages of using static storage class'''\n",
"\n",
"\n",
"#function definition\n",
@@ -627,7 +617,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the extrnal storage class'''\n",
"\n",
"#Variable declaration \n",
"i = [0] # external variable\n",
diff --git a/Let_us_C/chapter-7.ipynb b/Let_us_C/chapter-7.ipynb
index 9024266b..960282bf 100644
--- a/Let_us_C/chapter-7.ipynb
+++ b/Let_us_C/chapter-7.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate macros'''\n",
"\n",
"#Macro declaration\n",
"UPPER = 25\n",
@@ -81,7 +80,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate macros'''\n",
"\n",
"#Macro declaration\n",
"PI = 3.1415\n",
@@ -119,7 +117,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate macros with arguments'''\n",
"\n",
"#Macro declaration\n",
"def AREA(x): #define AREA(x) ( 3.14 * x * x )\n",
@@ -166,7 +163,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate macros with arguments'''\n",
"\n",
"#Macro declaration\n",
"def ISDIGIT(y): #define ISDIGIT(y) ( y >= 48 && y <= 57 )\n",
diff --git a/Let_us_C/chapter-8.ipynb b/Let_us_C/chapter-8.ipynb
index 3c03d537..9467d28a 100644
--- a/Let_us_C/chapter-8.ipynb
+++ b/Let_us_C/chapter-8.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to find average marks obtained by a class of 30 students in a test'''\n",
"\n",
"#Variable declaration\n",
"s = 0\n",
@@ -102,8 +101,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate call by value by passing values of\n",
- "array elements to the function'''\n",
"\n",
"#Funcion definition\n",
"def display(m):\n",
@@ -145,8 +142,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate call by reference by passing values of\n",
- "array elements to the function'''\n",
"\n",
"#Funcion definition\n",
"def display(n):\n",
@@ -189,8 +184,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the relationship between\n",
- "pointers and arrays'''\n",
"\n",
"#Variable declaration\n",
"i = 3\n",
@@ -250,8 +243,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to calculate the number of bytes\n",
- "separating the corresponding array elements'''\n",
"\n",
"#Variable declaration\n",
"arr = [ 10, 20, 30, 45, 67, 56, 74 ]\n",
@@ -285,7 +276,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate comparison of 2 pointer variables'''\n",
"\n",
"#Variable declaration\n",
"arr = [ 10, 20, 36, 72, 45, 36 ]\n",
@@ -322,8 +312,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that prints out the memory locations\n",
- "in which the elements of the array are stored'''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17]\n",
@@ -368,7 +356,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program shows a way in which we can access the elements of an array.'''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17]\n",
@@ -413,8 +400,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program shows a way in which we can access the elements of an array using\n",
- "pointers'''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17]\n",
@@ -461,7 +446,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the of passing an entire array to a function'''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17 ]\n",
@@ -504,7 +488,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate accessing array elements in different ways '''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17]\n",
@@ -555,7 +538,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate two dimensional arrays'''\n",
"\n",
"#Variable declaration\n",
"stud = [] #array\n",
@@ -607,7 +589,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate that a 2-D array is an array of arrays '''\n",
"\n",
"#Variable declaration\n",
"s = [ [1234, 56 ], [ 1212, 33], [ 1434, 80 ], [ 1312, 78 ]]\n",
@@ -643,8 +624,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the use of pointer\n",
- "notation to access 2-D array elements'''\n",
"\n",
"#Variable declaration\n",
"s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ] ]\n",
@@ -684,7 +663,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of pointer to an array'''\n",
"\n",
"#Variable declaration\n",
"s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ]]\n",
@@ -736,7 +714,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate three ways of accessing a 2-D array'''\n",
"\n",
"#Variable declaration\n",
"a = [[1, 2, 3, 4] , [5, 6, 7, 8] , [9, 0, 1, 6 ]]\n",
@@ -853,7 +830,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate an array of pointers'''\n",
"\n",
"from ctypes import *\n",
"\n",
@@ -898,8 +874,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate that an array of pointers can even\n",
- "contain the addresses of other arrays'''\n",
"\n",
"#Variable declaration\n",
"a = [ 0, 1, 2, 3, 4 ]\n",
diff --git a/Let_us_C/chapter-9.ipynb b/Let_us_C/chapter-9.ipynb
index 1f588a47..e74e2dd8 100644
--- a/Let_us_C/chapter-9.ipynb
+++ b/Let_us_C/chapter-9.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing of a string'''\n",
"\n",
"#Variable declaration\n",
"name= \"Klinsman\" # character array or string\n",
@@ -67,7 +66,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing of a string'''\n",
"\n",
"#Variable declaration\n",
"name= \"Klinsman\\0\" # character array or string\n",
@@ -109,7 +107,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to print a string using a pointer to access the array elements'''\n",
"\n",
"#Variable declaration\n",
"name = \"Klinsman\\0\" # string or character array\n",
@@ -153,7 +150,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the 'strlen' function '''\n",
"\n",
"\n",
"#Variable declaration\n",
@@ -192,8 +188,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a function that\n",
- "counts the number of characters present in a string'''\n",
"\n",
"#Function definition\n",
"def xstrlen(s):\n",
@@ -238,7 +232,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the 'strcpy' function '''\n",
"\n",
"\n",
"#Variable declaration\n",
@@ -278,8 +271,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a function that\n",
- "copies the contents of one string into another'''\n",
"\n",
"#Function definition\n",
"def xstrcpy (t,s):\n",
@@ -324,7 +315,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the 'strcat' function'''\n",
"\n",
"#Variable declaration\n",
"source = \"Folks!\" \n",
@@ -360,7 +350,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the 'strcmp' function'''\n",
"\n",
"#Variable declaration\n",
"string1 = \"Jerry\\0\" \n",
@@ -414,9 +403,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program asks you to type your name. When you do so, it checks your\n",
"name against a master list to see if you are worthy of\n",
- "entry to the palace'''\n",
"\n",
"\n",
"#Function definition\n",
@@ -481,7 +468,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to exchange names using 2-D array of characters'''\n",
"\n",
"#Variable declaration\n",
"names = [\"akshay\\0\\0\\0\",\"parag\\0\\0\\0\\0\",\"raman\\0\\0\\0\\0\",\"srinivas\\0\",\"gopal\\0\\0\\0\\0\",\"rajesh\\0\\0\\0\"]\n",
@@ -524,7 +510,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to exchange names using 2-D array of characters'''\n",
"\n",
"#Variable declaration\n",
"names = [\"akshay\\0\\0\\0\",\"parag\\0\\0\\0\\0\",\"raman\\0\\0\\0\\0\",\"srinivas\\0\",\"gopal\\0\\0\\0\\0\",\"rajesh\\0\\0\\0\"]\n",
@@ -565,8 +550,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the solution to the problem of limitation\n",
- "of Array of Pointers to Strings'''\n",
"\n",
"import copy\n",
"\n",
diff --git a/Linear_Integrated_Circuits/Chapter_1.ipynb b/Linear_Integrated_Circuits/Chapter_1.ipynb
index b3bbe576..e8573149 100644
--- a/Linear_Integrated_Circuits/Chapter_1.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_1.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''sheet resistance of P-type diffusion'''",
"",
"#Variable Declaration:",
"Rs=200.0 #Sheet resistance of p-type diffusion in ohm/square",
@@ -59,7 +58,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''sheet resistance of polysilicon layer'''",
"",
"#Variable Declaration:",
"Rs=30.0 #Sheet resistance of p-type diffusion in ohm/square",
diff --git a/Linear_Integrated_Circuits/Chapter_10.ipynb b/Linear_Integrated_Circuits/Chapter_10.ipynb
index d9506c7e..9b461180 100644
--- a/Linear_Integrated_Circuits/Chapter_10.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_10.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''DC Control voltage'''",
"",
"#Variable Declaration:",
"fs=20000.0 #Signal frequency in hertz",
@@ -57,7 +56,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''VCO Circuit'''",
"",
"",
"#Part A",
@@ -127,7 +125,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''PLL565'''",
"",
"#Variable Declaration:",
"import math",
@@ -186,7 +183,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''IC565'''",
"",
"#Variable Declaration:",
"import math",
@@ -234,7 +230,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''IC565 Output frequency'''",
"",
"#Variable Declaration:",
"import math",
@@ -283,7 +278,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''PLL'''",
"",
"#Variable Declaration:",
"fr=300.0 #Free running frequency in hertz",
@@ -329,7 +323,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''IC565 as FM modulator'''",
"",
"#Variable Declaration:",
"import math",
diff --git a/Linear_Integrated_Circuits/Chapter_11.ipynb b/Linear_Integrated_Circuits/Chapter_11.ipynb
index 87c114d1..85490636 100644
--- a/Linear_Integrated_Circuits/Chapter_11.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_11.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Resolution'''",
"",
"#Variable Declaration:",
"import math",
@@ -67,7 +66,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''D/A converter resolution'''",
"",
"#Variable Declaration:",
"n=8.0 #Number of bits in word",
@@ -103,7 +101,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Ladder type D/A converter'''",
"",
"#Variable Declaration:",
"n=4.0 #Number of bits in word",
@@ -147,7 +144,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''8-bit D/A converter'''",
"",
"#Variable Declaration:",
"reso=10.0 #Resolution of D/A converter",
@@ -191,7 +187,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''4-bit converter'''",
"",
"#Part A",
"print('\\nPart A')",
@@ -286,7 +281,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Inverted R-2R ladder'''",
"",
"#Variable Declaration:",
"import math",
@@ -348,7 +342,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Output voltage for digital input'''",
"",
"#Variable Declaration:",
"lsb=8.0*10**-6 #Current for 1 LSB in ampere",
@@ -413,7 +406,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Resolution and dynamic range'''",
"",
"#Variable Declaration:",
"import math",
@@ -455,7 +447,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''8-bit A/D converter'''",
"",
"#Variable Declaration:",
"Vm=10.0 #Voltage in volt",
@@ -508,7 +499,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Successive approximation A/D converter'''",
"",
"#Variable declaration:",
"n=8.0 #Number of bits in word",
diff --git a/Linear_Integrated_Circuits/Chapter_2.ipynb b/Linear_Integrated_Circuits/Chapter_2.ipynb
index d8cc6868..2bd3dfb6 100644
--- a/Linear_Integrated_Circuits/Chapter_2.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_2.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''current source to proide output current'''",
"",
"#Variable Declaration:",
"Vcc=5.0 #voltage Vcc in volt",
@@ -65,7 +64,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' identical transistor circuit'''",
"",
"#Variable Declarations:",
"Vbe=0.7 #voltage Vbe in volt",
@@ -108,7 +106,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''output current of transistor'''",
"",
"#Variable Declaration",
"Vbe=0.6 #Voltage Vbe in volt",
@@ -146,7 +143,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''resistance required to produce a current'''",
"",
"#Variable Declaration:",
"import math",
@@ -192,7 +188,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''multiple current source'''",
"",
"#Variable Declaration:",
"Beta=100.0 #Gain for transistor",
@@ -240,7 +235,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''design current source using MOSFET'''",
"",
"#Variable Declaration:",
"Iref=0.25*10**-3 #Reference current in amperes",
@@ -297,7 +291,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''differential amplifier CMRR'''",
"",
"#Variable Declaration:",
"cmrra=1000.0 #common mode rejection ratio",
@@ -351,7 +344,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Q-point of differential amplifier'''",
"",
"#Variable Declaration:",
"Beta=100.0 #Gain",
@@ -424,7 +416,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Q-point for MOSFET of differential amplifier'''",
"",
"#Variable Declaration:",
"import math",
diff --git a/Linear_Integrated_Circuits/Chapter_3.ipynb b/Linear_Integrated_Circuits/Chapter_3.ipynb
index 92c89180..8906bf98 100644
--- a/Linear_Integrated_Circuits/Chapter_3.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_3.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''input stage with bias circuit'''",
"",
"#Variable Declaration:",
"Vp=15.0 #Volatge in volt",
@@ -61,7 +60,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''gain stage of op-amp'''",
"",
"#Variable Declaration:",
"Iref= 0.715*10**-3 #reference current in ampere",
@@ -103,7 +101,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''output stage of op-amp'''",
"",
"#Variable Declaration:",
"import math",
@@ -162,7 +159,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''average bias current'''",
"",
"#Variable Declaration:",
"Ib1=400.0*10**-9 #Current in ampere",
@@ -202,7 +198,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''maximum output offset voltage'''",
"",
"#Variable Declaration:",
"Ios=400.0*10**-9 #Current in ampere",
@@ -238,7 +233,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''bias current compensation'''",
"",
"#Variable Declaration:",
"Rf=10.0*10**3 #Resistance in ohm",
@@ -283,7 +277,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''op-amp drift specification'''",
"",
"#Part A",
"#Variable Declaration:",
@@ -336,7 +329,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''frequency response'''",
"f=1000.0 # frequency in hertz",
"#from graph",
"gain_db=60.0 # Gain in db",
@@ -367,7 +359,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''unity gain bandwidth'''",
"",
"#Variable Declaration:",
"riset=0.7*10**-6 #rise time in microsecond",
@@ -401,7 +392,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''open loop dc voltage gain'''",
"",
"#Variavle Declaration:",
"ugb=1.5*10**6 #Unity gain bandwidth in hertz",
@@ -435,7 +425,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''time taken to change output'''",
"",
"#Variable Declaration:",
"Voch=10.0 #Change of voltage in volt",
@@ -469,7 +458,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''undistorted sine wave'''",
"",
"import math",
"#Part A",
@@ -519,7 +507,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''max input signal for undistorted output'''",
"",
"#Variable Declaration:",
"import math",
@@ -555,7 +542,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''amplify square wave with rise time'''",
"",
"#Variable Declaration:",
"slew=0.5 #Slew rate in volt per microsecond",
@@ -595,7 +581,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''effect of output voltage change on slew rate'''",
"",
"#Variable Declaration:",
"Vch=20.0 #Change in voltage in volt",
@@ -630,7 +615,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''max input frequency for undistorted output'''",
"",
"#Variable Declaration:",
"import math",
@@ -669,7 +653,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''max input voltage for undistorted output'''",
"",
"#Variable Declaration:",
"import math",
@@ -708,7 +691,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''noise gain of circuit'''",
"",
"#Variable Declaration:",
"Rf=10.0*10**3 #Resistance in ohm",
@@ -745,7 +727,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''closed loop voltage gain'''",
"",
"#Variable Deeclaration:",
"Rf=10.0*10**3 #Feedback resistance in ohm",
@@ -779,7 +760,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''closed loop voltage gain and beta'''",
"",
"#Variable Declaration:",
"Rf=10.0*10**3 #Feedback resistance in ohm",
@@ -818,7 +798,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''non-inverting amplifier circuit'''",
"",
"#Variable Declaration:",
"R1=10.0*10**3 #Resistance in ohm",
@@ -856,7 +835,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''non-inverting amplifier with IL'''",
"",
"#Variable Declration:",
"Vi=0.6 #volatge in volt ",
@@ -911,7 +889,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''capacitor coupled voltage follower'''",
"",
"#Variable Declaration:",
"import math",
@@ -955,7 +932,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' high impedence capacitor coupled voltage follower'''",
"",
"#Variable Declaration:",
"import math",
@@ -1014,7 +990,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''high impedence capacitor coupled non-inverting amplifier'''",
"",
"#Variable Declaration:",
"import math",
@@ -1064,7 +1039,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''capacitor coupled inverting amplifier'''",
"",
"#Variable Declaration:",
"import math",
@@ -1118,7 +1092,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''capacitor coupled non-inverting amplifier'''",
"",
"#Variable Declaration:",
"import math",
@@ -1183,7 +1156,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''common mode gain Acm'''",
"",
"#Variable Declaration:",
"cmrr=10**5 #Common mode rejection ratio",
@@ -1217,7 +1189,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''differential amplifier with two op-amp'''",
"",
"#Variable Declaration:",
"R1=560.0 #Resistance value in ohm",
diff --git a/Linear_Integrated_Circuits/Chapter_4.ipynb b/Linear_Integrated_Circuits/Chapter_4.ipynb
index 7405dd82..cd759624 100644
--- a/Linear_Integrated_Circuits/Chapter_4.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_4.ipynb
@@ -52,7 +52,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''phase lag circuit'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -101,7 +100,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''output current'''\n",
"\n",
"#Variable Declaration:\n",
"Vee=12.0 #Volatge Vee in volt\n",
@@ -140,7 +138,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''determine the current'''\n",
"\n",
"#Variable Declaration:\n",
"V=5.0 #Voltage in volt\n",
@@ -177,7 +174,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''determine the current through RL'''\n",
"\n",
"#Variable Declaration:\n",
"Vcc=15.0 #Voltage in volt\n",
@@ -216,7 +212,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''determine load gain'''\n",
"\n",
"#Variable Declaration:\n",
"R1=22.0*10**3 #Resistance in ohm\n",
@@ -265,7 +260,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''voltage to current converter with floating load'''\n",
"\n",
"#Variable Declaration:\n",
"Rf=10.0*10**3 #Feedback resistance in ohm\n",
@@ -312,7 +306,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''summing amplifier'''\n",
"\n",
"#Variable Declaration:\n",
"V1=2.0 #Voltage in volt\n",
@@ -354,7 +347,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''practical integrator circuit'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -491,7 +483,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''design a differentiator'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -529,7 +520,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''design a differentiator using op-amp'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -681,7 +671,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''transfer function using op-amp'''\n",
"import sympy\n",
"from sympy import *\n",
"sympy.init_printing()\n",
diff --git a/Linear_Integrated_Circuits/Chapter_5.ipynb b/Linear_Integrated_Circuits/Chapter_5.ipynb
index c23dacd0..53ae3319 100644
--- a/Linear_Integrated_Circuits/Chapter_5.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_5.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' transfer characteristics of comparator'''",
"",
"#Variable Declaration:",
"Vz1=5.5 #Volatage in volt",
@@ -60,7 +59,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''inverting schmitt trigger'''",
"",
"#Variable Declaration:",
"R1=56.0*10**3 #Resistance value in ohm",
@@ -103,7 +101,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''clipper circuit'''",
"",
"#Variable Declaration:",
"Vclipl=0.35 #Voltage in volt",
@@ -150,7 +147,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''negative clamping circuit'''",
"",
"#Variable Declaration:",
"Vref=1.5 #Voltage in volt",
diff --git a/Linear_Integrated_Circuits/Chapter_6.ipynb b/Linear_Integrated_Circuits/Chapter_6.ipynb
index 002417d5..1e4a097d 100644
--- a/Linear_Integrated_Circuits/Chapter_6.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_6.ipynb
@@ -52,7 +52,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''first order low pass butterworth filter'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -91,7 +90,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''first order low pass filter'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -134,7 +132,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''second order low pass butterworth filter'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -179,7 +176,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''second order low pass butterworth filter with uppercutoff frequency'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -227,7 +223,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''third order low pass butterworth filter'''\n",
"\n",
"#Variable declaration:\n",
"import math\n",
@@ -281,7 +276,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''fourth order low pass butterworth filter'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -340,7 +334,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''first order high pass filter'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -386,7 +379,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''second order high pass butterworth filter variable gain'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -476,7 +468,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''fourth order high pass butterworth filter'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -539,7 +530,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''bandpass filter'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -587,7 +577,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''bandpass filter with resonant frequency'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -639,7 +628,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''narrowband bandpass filter'''\n",
"\n",
"#Variable Declaration:\n",
"import math\n",
@@ -685,7 +673,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''narrowband bandpass filter with resonant frequency'''\n",
"\n",
"#Variable Declaration:\n",
"fr=200.0 #Resonant frequency in hertz\n",
@@ -730,7 +717,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' clock frequency'''\n",
"\n",
"#Variable Declaration:\n",
"R=1.0*10**6 #Resistance in ohm\n",
diff --git a/Linear_Integrated_Circuits/Chapter_7.ipynb b/Linear_Integrated_Circuits/Chapter_7.ipynb
index 143b1a36..ff558ee5 100644
--- a/Linear_Integrated_Circuits/Chapter_7.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_7.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''RC Phase shift oscillator'''",
"",
"#Variable Declarartion:",
"import math",
@@ -68,7 +67,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Wien bridge oscillator'''",
"",
"#Variable Declaration:",
"import math",
@@ -117,7 +115,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Astable multivibrator'''",
"",
"#Variable Declaration:",
"R1=116.0*10**3 #Resistance in ohm",
@@ -172,7 +169,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Square wave oscillator'''",
"",
"#Variable Declaration:",
"fo=1000.0 #Frequency in hertz",
@@ -210,7 +206,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Triangular wave generator'''",
"",
"#Variable Declaration:",
"R1=100.0*10**3 #Resistance in ohm",
@@ -265,7 +260,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Sawtooth wave generator'''",
"",
"#Variable Declaration:",
"Ri=10.0*10**3 #Resitance in ohm",
@@ -304,7 +298,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Monostable multivibrator'''",
"# Answer in textbook is wrong",
"#Varible Declaration:",
"C=0.1*10**-6 #Capacitance in farad",
@@ -339,7 +332,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Frequency of oscillation'''",
"",
"#Variable Declaration:",
"D=20.0 # 20 percent #Duty cycle",
@@ -378,7 +370,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Astable multivibrator'''",
"",
"#Variable Declaration:",
"D=0.7 #Duty cycle ",
@@ -419,7 +410,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Teletypewrite'''",
"",
"#Variable Declaration:",
"f1=1070.0 #Frequency in hertz",
diff --git a/Linear_Integrated_Circuits/Chapter_8.ipynb b/Linear_Integrated_Circuits/Chapter_8.ipynb
index 09138a1f..b9f79a2c 100644
--- a/Linear_Integrated_Circuits/Chapter_8.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_8.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Linear Voltage Regulator'''",
"",
"#Variable Declaration:",
"Vo=15.0 #Output voltage in volt",
@@ -99,7 +98,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''7805 Voltage Regulator'''",
"",
"#Variable Declaration:",
"IL=0.25 #Current in ampere",
@@ -145,7 +143,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''7805 Regulator Circuit'''",
"",
"#Variable Declaration:",
"VL=5.0 #Voltage in volt",
@@ -224,7 +221,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''LM317 Regulator'''",
"",
"#Variable Declaration:",
"R1=240.0 #Resistance in ohm",
@@ -260,7 +256,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Voltage regulator using LM317'''",
"",
"#Variable Declaration:",
"Iadjmax=100.0*10**-6 #Current in ampere",
@@ -307,7 +302,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Current Limiting Circuit'''",
"",
"#Variable Declaration:",
"ILmax=0.5 #Current in ampere",
@@ -365,7 +359,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' LM723 Regulator'''",
"",
"#Variable Declaration:",
"R2=10000.0 #Resistance in ohm ",
@@ -402,7 +395,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Continuously adjustable power supply'''",
"",
"#Variable Declaration:",
"Vref=7.15 #Reference voltage in volt",
diff --git a/Linear_Integrated_Circuits/Chapter_9.ipynb b/Linear_Integrated_Circuits/Chapter_9.ipynb
index 3dc8e5f6..c60b9c67 100644
--- a/Linear_Integrated_Circuits/Chapter_9.ipynb
+++ b/Linear_Integrated_Circuits/Chapter_9.ipynb
@@ -22,7 +22,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''DC Component'''",
"",
"#Variable Declaration:",
"import math",
diff --git a/Materials_science_and_engineering_an_introduction/CH10.ipynb b/Materials_science_and_engineering_an_introduction/CH10.ipynb
index 2a7a789c..b7fb2351 100644
--- a/Materials_science_and_engineering_an_introduction/CH10.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH10.ipynb
@@ -27,27 +27,21 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#(a)Computation of Critical Nuclear Radius\n",
"\n",
- "#Given\n",
"Hf=-1.16*10**9 # in J/m**3 latent heat of fusion\n",
"Y=0.132 # in J/m**2 Surface energy\n",
"Tm=1064.0+273.0 # in K Melting point of gold\n",
"\n",
- "#calculation\n",
"import math\n",
"T=Tm-230.0 # in K 230 is supercooling value\n",
"r=-2*Y*Tm/(Hf*(Tm-T))\n",
"G=16*math.pi*Y**3*Tm**2/(3*Hf**2*(Tm-T)**2)\n",
"\n",
- "#part (b)\n",
"a=0.413*10**-9 # in m Unit Cell edge length\n",
- "#unit cells per paticle\n",
"u_c=4*math.pi*r**3/(3*a**3)\n",
"n=4 #In FCC . no of atoms in per unit cell\n",
"U_c=int(u_c)*n\n",
"\n",
- "#Result\n",
"print\"(a)Critical Radius is \",round(r/10**-9,2),\"nm\"\n",
"print\"Activation free energy is \",round(G,21),\"J\"\n",
"print\"(b)Total no. of atoms per critical nucleus are \",U_c\n",
@@ -80,19 +74,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determination the rate of recrystallization\n",
"\n",
- "#Given\n",
"n=5.0\n",
"y=0.3\n",
"t=100.0 #in min\n",
"\n",
- "#Calculation\n",
"k=-math.log(1-y)/t**n\n",
"thalf=(-math.log(1-0.5)/k)**(1/n)\n",
"rate=1/thalf\n",
"\n",
- "#Result\n",
"print\"Rate is \",rate,\"min**-1\"\n",
"\n"
],
diff --git a/Materials_science_and_engineering_an_introduction/CH12.ipynb b/Materials_science_and_engineering_an_introduction/CH12.ipynb
index ee793447..b2774698 100644
--- a/Materials_science_and_engineering_an_introduction/CH12.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH12.ipynb
@@ -27,16 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Computation of Minimum Caion-to-Anion Radius Ratio forCo-ordination No. of 3\n",
"\n",
- "#For equilateral triangle after joining centres of the atoms Angle = 30\n",
"a=30\n",
"\n",
- "#Calculation\n",
"import math\n",
"ratio=(1-math.cos(a*math.pi/180.0))/math.cos(a*math.pi/180.0)\n",
"\n",
- "#Result\n",
"print\"Cation to anion raio is \",round(ratio,3)\n",
"\n"
],
@@ -65,16 +61,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Ceramic Crystal structure prediction\n",
"\n",
- "#Given\n",
"r_Fe=0.077 # in nm Radius of iron cation Fe++\n",
"r_O=0.140 #in nm Radius of Oxygen anion O--\n",
"\n",
- "#Calculation\n",
"ratio=r_Fe/r_O\n",
"\n",
- "#Result\n",
"print\"Ratio is \",ratio\n",
"if 0.414<ratio<0.732: \n",
" print\"Co-ordinaton no. is 6\"\n",
@@ -110,22 +102,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Theoretical Density Determination for NaCl\n",
"\n",
- "#Given\n",
"A_Na=22.99 # in g/mol\n",
"A_Cl=35.45 #in g/mol\n",
"r_Na=0.102*10**-7 #in cm Radius of Na+ ion\n",
"r_Cl=0.181*10**-7 #in cm Radius of Cl- ion\n",
"Na=6.023*10**23 #Avogadro number\n",
"\n",
- "#Calculation\n",
"a=2*(r_Na+r_Cl)\n",
"V=a**3\n",
"n=4 #For FCC, no. of atoms are 4 per crystal\n",
"density=n*(A_Na+A_Cl)/(V*Na)\n",
"\n",
- "#Result\n",
"print\"Density is \",round(density,2),\"gm/cm**3\"\n",
"\n"
],
@@ -154,15 +142,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Computation of the No. of Schottky Defects in KCl\n",
"\n",
- "#Given\n",
"Na=6.023*10**23 #Avogadro number\n",
"density=1.955 #in g/cm**3\n",
"A_K=39.1 #in g/mol\n",
"A_Cl=35.45 #in g/mol\n",
"\n",
- "#calculation\n",
"import math\n",
"N=Na*density*10**6/(A_K+A_Cl)\n",
"Qs=2.6 # in eV\n",
@@ -170,7 +155,6 @@
"T=500.0+273.0 # in K\n",
"Ns=N*math.exp(-Qs/(2*k*T))\n",
"\n",
- "#result\n",
"print\"No. of Schottky Defects are \",round(Ns,-17),\"/m**3\"\n",
"\n"
],
diff --git a/Materials_science_and_engineering_an_introduction/CH14.ipynb b/Materials_science_and_engineering_an_introduction/CH14.ipynb
index 7ade4dbe..e860f213 100644
--- a/Materials_science_and_engineering_an_introduction/CH14.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH14.ipynb
@@ -27,11 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Computation of average Molecular wt and Degree of Polymerisation\n",
"\n",
- "#Given\n",
- "#For different molecular wt range ,\n",
- "#From Table 14.1 (a)\n",
"Mi1=7500 #g/mol , Molecular wt\n",
"Mi2=12500 \n",
"Mi3=17500\n",
@@ -47,7 +43,6 @@
"xi6=0.08\n",
"xi7=0.02\n",
"\n",
- "#Calculation\n",
"xM1=Mi1*xi1\n",
"xM2=Mi2*xi2\n",
"xM3=Mi3*xi3\n",
@@ -57,7 +52,6 @@
"xM7=Mi7*xi7\n",
"xM=xM1+xM2+xM3+xM4+xM5+xM6+xM7\n",
"\n",
- "#(b)\n",
"nC=2 #no of carbon atoms in repeat unit\n",
"nH=3 #no of hydrogen atoms in repeat unit\n",
"nCl=1 #no of chlorine atoms in repeat unit\n",
@@ -67,7 +61,6 @@
"m=nC*MwC+nH*MwH+nCl*MwCl #Total wt for PVC\n",
"DP=xM/m\n",
"\n",
- "#(c) from fig 14.3 (b)\n",
"wi1=0.02 #weight fraction\n",
"wi2=0.1\n",
"wi3=0.18\n",
@@ -76,7 +69,6 @@
"wi6=0.13\n",
"wi7=0.02\n",
"\n",
- "#Calculation\n",
"wM1=Mi1*wi1\n",
"wM2=Mi2*wi2\n",
"wM3=Mi3*wi3\n",
@@ -86,7 +78,6 @@
"wM7=Mi7*wi7\n",
"wM=wM1+wM2+wM3+wM4+wM5+wM6+wM7\n",
"\n",
- "#Result\n",
"print\"(a)The no Av Molecular wt is\",xM,\"g/mol\"\n",
"print\"(b)Degree of Polymerisation is\",round(DP,0)\n",
"print\"(c)The weight Av Molecular wt is\",wM,\"g/mol\"\n"
@@ -118,9 +109,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Computations of the Density\n",
"\n",
- "#Given\n",
"Ac=12.01 #in g/mol Molecular weight of Carbon\n",
"Ah=1.008 #in g/mol molecular weight of hydrogen\n",
"a=7.41*10**-8 #in cm\n",
@@ -128,18 +117,15 @@
"c=2.55*10**-8 #in cm\n",
"Na=6.023*10**23\n",
"\n",
- "#calculation\n",
"Vc=a*b*c\n",
"n=2\n",
"A=(2*Ac)+(4*Ah)\n",
"density_c=n*A/(Vc*Na)\n",
"\n",
- "#(b)Percent Crystallinity of Polyethylene\n",
"density_a=0.870 # in g/cm**3\n",
"density_s=0.925 # in g/cm**3\n",
"pc=density_c*(density_s-density_a)*100/(density_s*(density_c-density_a))\n",
"\n",
- "#Result\n",
"print\"(a)Density is\",round(density_c,3),\"g/cm**3\"\n",
"print\"(b)percentage crystallinity is\",round(pc,1),\"%\"\n",
"\n"
@@ -170,31 +156,21 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Computations of Diffusion Flux of Carbon dioxide through Plasic Beverage Container\n",
"\n",
- "#function[A]= approx(V,n)\n",
- "# A= round(V*10**n)/10**n\n",
- "# funcprot(0)\n",
- "#endfunction\n",
"\n",
- "#print\"\\tExample 14.3\\n\")\n",
"\n",
- "#a\n",
"P1=400000.0 # in Pa Pressure inside the bottle\n",
"P2=400.0 # in Pa Pressure outside the bottle\n",
"Pm=0.23*10**-13 #Solubility Coefficient\n",
"dx=0.05 # in cm Thickness of wall\n",
"\n",
- "#calculation\n",
"J=(-Pm*(P2-P1)/dx)\n",
- "#(b)Beverage Shell Life\n",
"\n",
"A=500 #surface area of bottle in cm**2\n",
"V_lose=750.0 #cm**3 STP\n",
"V=J*A\n",
"t=V_lose/round(V,5)\n",
"\n",
- "#Result\n",
"print\"Diffusion flux is \",round(J,9),\"cm**3 STP/cm**2-s\"\n",
"print\"Time to escape is \",round(t/(3600*24),1),\"days\"\n",
"\n"
diff --git a/Materials_science_and_engineering_an_introduction/CH16.ipynb b/Materials_science_and_engineering_an_introduction/CH16.ipynb
index c360c16f..02f6165f 100644
--- a/Materials_science_and_engineering_an_introduction/CH16.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH16.ipynb
@@ -27,17 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#(a) Compute the modulus of elasticity\n",
- "#(b) find Load carried by each of fiber and matrix phase\n",
- "#(c) Determine the strain\n",
"\n",
- "#Given\n",
"E_gf=69.0 # in GPa Elasticity of glass fibre\n",
"mf_gf=0.4 #Vol % of glass fibre\n",
"E_pr=3.4 # in GPa Elasticity of poyester resin\n",
"mf_pr=0.6 #Vol % of polyester resin\n",
"\n",
- "#Calculation\n",
"E_cl=(E_pr*mf_pr)+(E_gf*mf_gf)\n",
"Ac=250.0 #mm**2\n",
"sigma=50.0 #MPa\n",
@@ -52,7 +47,6 @@
"e_m=sigma_m/(E_pr*10**3) #Strain for matrix phase\n",
"e_f=sigma_f/(E_gf*10**3) #Strain for fiber phase\n",
"\n",
- "#Result\n",
"print\"(a)Modulus of elasticity of composite is \",round(E_cl,0),\"GPa\"\n",
"print\"(b)Load carried by each of fiber and matrix phase is \",round(Ff,0),\"N\"\n",
"print\"(c)Strain for matrix phase is \",round(e_m,4)\n",
@@ -87,18 +81,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Elastic Modulus Determination for a Glass Fiber-Reinforced Composite\u2014Transverse Direction\n",
"\n",
- "#Given\n",
"E_gf=69 # in GPa Elasticity of glass fibre\n",
"mf_gf=0.4 #Vol % of glass fibre\n",
"E_pr=3.4 # in GPa Elasticity of poyester resin\n",
"mf_pr=0.6 #Vol % of polyester resin\n",
"\n",
- "#Calculation\n",
"E_ct=E_pr*E_gf/((E_pr*mf_gf)+(E_gf*mf_pr)) #GPa\n",
"\n",
- "#Result\n",
"print\"In transverse direction, modulus of elaticity is \",round(E_ct,1),\"GPa\"\n",
"\n"
],
@@ -127,21 +117,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#A tubular composite shaft is to be designed.\n",
"\n",
- "#Given\n",
"Do=70*10**-3 #mm, outside diameter\n",
"Di=50*10**-3 #mm, inside diameter\n",
"L=1 #m Length\n",
"F=1000 #N load\n",
"dy=0.35*10**-3 #mm, deflection\n",
"\n",
- "#Calculation\n",
- "#Required longitudinal modulus of elasticity\n",
"E=(4*F*L**3)/(3*math.pi*dy*(Do**4-Di**4))\n",
"Vc=(math.pi*L*(Do**2-Di**2))/4.0\n",
"\n",
- "#Result\n",
"print\"(a)longitudinal modulus of elasticity is\",round(E/10**9,1),\"GPa\"\n",
"print\"(b)The total tube volume is\",round(Vc*10**6,0),\"cm**3\"\n"
],
diff --git a/Materials_science_and_engineering_an_introduction/CH17.ipynb b/Materials_science_and_engineering_an_introduction/CH17.ipynb
index 294f5ff9..889d524a 100644
--- a/Materials_science_and_engineering_an_introduction/CH17.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH17.ipynb
@@ -27,20 +27,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determination of Electrochemical Cell Characteristics\n",
"\n",
- "#Given\n",
"V_Cd=-0.403 #Half Cell Potential of Cd++|Cd\n",
"V_Ni=-0.250 #Half Cell Potential of Ni++|Ni\n",
"\n",
- "#calculation\n",
"dV=V_Ni-V_Cd\n",
"C_Ni=10**-3\n",
"C_Cd=0.5\n",
"n=2 #Net electron exchange in Redox reaction\n",
"V=-dV-(0.0592*math.log10(C_Ni/C_Cd)/n)\n",
"\n",
- "#Result\n",
"print\"Standard Cell potential is \",dV,\"V\"\n",
"print\"Net EMF is \",round(V,3),\"V\"\n",
"if V<0:\n",
@@ -77,28 +73,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Rate of Oxidation Computation\n",
"\n",
- "#Given\n",
- "#Activation polarisation data for Zn\n",
"VZn_Zn2=-0.763\n",
"iZn=10**-7\n",
"beta_Zn=0.09\n",
- "#For H2\n",
"iH2=10**-10\n",
"VH_H2=0\n",
"beta_H2=-0.08\n",
"\n",
- "#calculation\n",
- "#Part i\n",
"ic=10**((VH_H2-VZn_Zn2-(beta_H2*math.log10(iH2))+(beta_Zn*math.log10(iZn)))/(beta_Zn-beta_H2))\n",
"n=2 #Exchange of 2 electrons\n",
"F=96500 #Faradays constant\n",
"r=ic/(n*F)\n",
- "#Part ii\n",
"Vc=VH_H2+(beta_H2*log10(ic/iH2))\n",
"\n",
- "#Result\n",
"print\"i) Rate of oxiadation is\",round(r,12),\"mol/cm**2-s\"\n",
"print\"ii) Corrosion potential is\",round(Vc,3),\"V\"\n",
"\n"
diff --git a/Materials_science_and_engineering_an_introduction/CH18.ipynb b/Materials_science_and_engineering_an_introduction/CH18.ipynb
index 016bfd26..cae50c36 100644
--- a/Materials_science_and_engineering_an_introduction/CH18.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH18.ipynb
@@ -27,16 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Computation of the Room-Temperature Intrinsic Carrier Concentration for Gallium Arsenide\n",
"\n",
- "#Given\n",
"sigma=10**-6 # (Ohm-m)**-1 Electrical Conductivity\n",
"e=1.6*10**-19 #Coulomb Charge on electron\n",
"m_e=0.85 # m**2/V-s Mobility of electron\n",
"m_h=0.04 # m**2/V-s Mobility of holes\n",
"\n",
- "#Calculation\n",
- "#ni is Intrinsic carrier concentration\n",
"ni=sigma/(e*(m_e+m_h))\n",
"\n",
"print\"Intrinsic Carrier Concentration is\",round(ni,-11),\"m**-3\"\n",
@@ -67,20 +63,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Electrical Conductivity Determination for Intrinsic Silicon at 150\u00b0C\n",
"\n",
- "#Given\n",
"e=1.6*10**-19 #Coulomb Charge on electron\n",
"ni=4*10**19 #For Si at 423 K (m**-3)\n",
- "#Values of m_e and m_h are deduced from graphs at page No.689\n",
"m_e=0.06 #m**2/V-s Mobility of electron\n",
"m_h=0.022 #m**2/V-s Mobility of holes\n",
"\n",
- "#calculation\n",
- "#sigma is electrical conductivity\n",
"sigma=ni*e*(m_e+m_h)\n",
"\n",
- "#result\n",
"print\"Electrical Conductivity is \",round(sigma,2),\"(ohm-m)**-1\"\n",
"\n"
],
@@ -109,25 +99,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Room-Temperature for Extrinsic Silicon\n",
"\n",
- "#Given (b)\n",
"n=10**23 #m**-3 Carrier Concentration\n",
"e=1.6*10**-19 #Coulomb Charge on electron\n",
- "#From graph 18.18 m_e is calculated corresponding to n=10**23\n",
"m_e=0.07 #m**2/V-s Mobility of electron\n",
"\n",
- "#Calculation\n",
- "#For extrinsic n-type, the formula used is:\n",
"sigma=n*e*m_e\n",
"\n",
"\n",
- "#(c)Elevated-Temperature Electrical Conductivity Calculations for Extrinsic Silicon\n",
- "#From graph 18.19a m_e2 is calculated corresponding to 373 K\n",
"m_e2=0.04 #m**2/V-s Mobility of electron\n",
"sigma2=n*e*m_e2\n",
"\n",
- "#Result\n",
"print\"Conductivity at n=10**23 is \",sigma,\"(Ohm-m)**-1\"\n",
"print\"Conductivity at T=373 K becomes \",sigma2,\"(Ohm-m)**-1\"\n",
"\n"
@@ -158,30 +140,23 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Specify an impurity acceptor type\n",
"\n",
- "#Given\n",
"c=50 #ohm**-1, room temprature conductivity\n",
"Na1=10**22 #m**-3, assumed impurity content value\n",
"mu1=0.04 #m**2/Vs, assumed electrical mobility\n",
"e=1.6*10**-19 #Electronic charge\n",
"NA=6.023*10**23 #Avagadro no\n",
"\n",
- "#Calculation\n",
"C=Na1*e*mu1 #Conductivity\n",
- "#Decreasing an impurity content\n",
"Na2=10**21 #m**-3, \n",
"mu2=0.045 #m**2/Vs,\n",
"C=Na2*e*mu2\n",
- "#So we get conductivity = 50 at\n",
"Na=8*10**21 \n",
- "#For Silicon\n",
"rho=2.33 # g/cm**3\n",
"Asi=28.09 # g/mole\n",
"Nsi=(NA*rho*10**6)/(Asi)\n",
"Ca=(Na/(Na+Nsi))*100\n",
"\n",
- "#Result\n",
"print\"The concentration of acceptor impurities is\",round(Ca,7)\n",
"print\"Thus a Silicon material having conductivity 50 ohm**-1 \\nmust contain\",round(Ca,7),\"% boron,aluminium,Gallium or indium .\"\n"
],
@@ -212,9 +187,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Hall Voltage Computation\n",
"\n",
- "#Given\n",
"sigma=3.8*10**7 #(Ohm-m)**-1 Electrical Conductivity\n",
"m_e=0.0012 #m**2/V-s Mobility of electron\n",
"Rh=-m_e/sigma #Hall coefficient\n",
@@ -222,10 +195,8 @@
"d=15*10**-3 #m Thickness\n",
"Bz=0.6 #Tesla Magnetic field\n",
"\n",
- "#Calculation\n",
"Vh=Rh*Ix*Bz/d\n",
"\n",
- "#Result\n",
"print\"Hall coefficient is \",round(Rh,13),\"V-m/A-Tesla\"\n",
"print\"Hall Voltage is \",round(Vh,10),\"V\"\n",
"\n"
@@ -256,22 +227,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#find the Capacitance \n",
"\n",
- "#Given\n",
"A=6.45*10**-4 #m**2, area\n",
"d=2*10**-3 #m. Plate separation\n",
"V=10 #V Potential\n",
"Er=6 #Dielectric constant\n",
"Eo=8.85*10**-12 #F/m Constant dielectric constant\n",
- "#Calculation\n",
"E=Er*Eo\n",
"C=E*A/d\n",
"Q=C*V\n",
"D=E*V/d\n",
"P=D-Eo*V/d\n",
"\n",
- "#Result\n",
"print\"The Capacitance is\",round(C,13),\"F\"\n",
"print\"The magnitude of charge stored is \",round(Q,12),\"C\"\n",
"print\"The Dielectric displacement is is\",round(D,9),\"C/m**2\"\n",
diff --git a/Materials_science_and_engineering_an_introduction/CH19.ipynb b/Materials_science_and_engineering_an_introduction/CH19.ipynb
index 8464a899..1da6512a 100644
--- a/Materials_science_and_engineering_an_introduction/CH19.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH19.ipynb
@@ -27,15 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of maximum temperature\n",
"\n",
- "#Given\n",
"To=20 # Room Temperature (degree celsius)\n",
"sigma=-172 #Mpa Compressive stress\n",
"E=100*10**3 #Mpa Young's modulus\n",
"a=20*10**-6 #Celsius**-1 Coefficient of thermal expansion\n",
"\n",
- "#Calculation\n",
"Tf=To-(sigma/(E*a))\n",
"\n",
"print\"Final Temperature is \",Tf,\"C\"\n",
diff --git a/Materials_science_and_engineering_an_introduction/CH20.ipynb b/Materials_science_and_engineering_an_introduction/CH20.ipynb
index c410a6ac..b3d2e8d5 100644
--- a/Materials_science_and_engineering_an_introduction/CH20.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH20.ipynb
@@ -27,9 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of saturation magnetisation and flux density for Nickel\n",
"\n",
- "#Given\n",
"b_m=9.27*10**-24 #ampere*m**2 (Bohr Magneton)\n",
"Na=6.023*10**23 #atoms/mol (Avogadro's No.)\n",
"d=8.9*10**6 #g/m**3 (density)\n",
@@ -37,13 +35,9 @@
"A=58.71 #g/mol (Atomic weigth of Nickel)\n",
"N=d*Na/A #No. of atoms per cubic meter\n",
"\n",
- "#Calculation\n",
- "# M is saturation magnetisation\n",
"M=0.6*b_m*N #0.6= Bohr Magneton/atom\n",
- "#B = Saturation Flux Density\n",
"B=uo*M\n",
"\n",
- "#Result\n",
"print\"Saturation Magnetisation is \",M,\"A/m\"\n",
"print\"Saturation Flux Density is \",round(B,2),\"Tesla\"\n"
],
@@ -73,14 +67,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of saturation magnetisation of Fe3O4\n",
"\n",
- "#Given\n",
"a=0.839*10**-9 #a is edge length in m\n",
"b_m=9.27*10**-24 #ampere*m**2 (Bohr Magneton)\n",
"nb=8*4 #8 is no. of Fe++ ions per unit cell\n",
" #4 is Bohr magnetons per Fe++ ion\n",
- "#Calculation\n",
"M=nb*b_m/a**3 #M is Saturation magnetisation\n",
"\n",
"print\"Saturation Magnetisation is \",round(M,0),\"A/m\"\n",
@@ -111,21 +102,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Design Example 20.1: Designing a cubic mixed-ferrite magnetic material\n",
"\n",
- "#Given\n",
"Ms_Fe=5.25*10**5 #Required saturation Magnetisation\n",
"b_m=9.27*10**-24 #ampere*m**2 (Bohr Magneton)\n",
"a=0.839*10**-9 #a is edge length in m\n",
"M=5*10**5 #From previous question result\n",
"\n",
- "#Calculation\n",
"nb=Ms_Fe*a**3/b_m\n",
"i=8 # No of Divalent ions per unit cell\n",
"j=4 #4 is Bohr magnetons per Mn++ ion\n",
"n=nb/(i)-j \n",
" \n",
- "#Result\n",
"print\"Replacing percent of Fe++ with Mn++ would produce the required saturation magnetisation\",round(n*100,2)\n",
"\n"
],
diff --git a/Materials_science_and_engineering_an_introduction/CH21.ipynb b/Materials_science_and_engineering_an_introduction/CH21.ipynb
index bb8267f6..38c06f2e 100644
--- a/Materials_science_and_engineering_an_introduction/CH21.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH21.ipynb
@@ -27,20 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculation of absorption coefficient\n",
"\n",
- "#Given\n",
- "# x is thickness of glass(mm)\n",
"x=200\n",
- "#It is intensity of non-absorbed radiation\n",
- "#Io is intensity of non-relected radiation\n",
"f=0.98 #f=It/Io\n",
"\n",
- "#Calculation\n",
- "#b is absorption coefficient\n",
"b=-math.log(f)/x\n",
"\n",
- "#result\n",
"print\"Absorption coefficient is \",round(b,4),\"mm**-1\"\n",
"\n"
],
diff --git a/Materials_science_and_engineering_an_introduction/CH3.ipynb b/Materials_science_and_engineering_an_introduction/CH3.ipynb
index c521d51b..eeb7447f 100644
--- a/Materials_science_and_engineering_an_introduction/CH3.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH3.ipynb
@@ -27,20 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determination of FCC Unit Cell Volume\n",
"\n",
- "#Given\n",
- "#For FCC a=2*R*math.sqrt(2)\n",
"from sympy import Symbol\n",
"\n",
- "#Calculation \n",
"R=Symbol('R') \n",
- "#Edge Length\n",
"a=2*R*round(math.sqrt(2),2)\n",
- "#Volume determination\n",
"V=a**3\n",
"\n",
- "#result\n",
"print\"Volume is\",V,\" m**3\"\n",
"print\"which is also equal to 16*sqrt(2)*R**3\"\n",
"\n"
@@ -71,25 +64,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Computation of the Atomic Packing Factor for FCC\n",
"\n",
- "#Given\n",
- "#for FCC no. of atoms are 4\n",
"n=4\n",
- "#For FCC a=2*R*math.sqrt(2)\n",
"R=1 #say\n",
"\n",
- "#Calculation\n",
- "#Edge Length\n",
"a=2*R*math.sqrt(2)\n",
- "#Volume determination of cube\n",
"Vc=a**3\n",
- "#Volume of sphere\n",
"Vs=n*4*math.pi*R**3/3.0\n",
- "#Atomic packing Fraction\n",
"APF=Vs/Vc\n",
"\n",
- "#Result\n",
"print\"Atomic packing fraction is\",round(APF,2)\n",
"\n"
],
@@ -118,20 +101,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Theoretical Density Computation for Copper\n",
"\n",
- "#Given\n",
"R=1.28*10**-8 #Atomic radius in cm\n",
"A_Cu=63.5 #Atomic wt of copper\n",
"n=4 #For FCC\n",
"Na=6.023*10**23 #Avogadro no.\n",
"\n",
- "#Calculation\n",
"a=2*R*math.sqrt(2)\n",
"Vc=a**3\n",
"den=n*A_Cu/(Vc*Na)\n",
"\n",
- "#result\n",
"print\"Density is \",round(den,2),\"g/cm**3\"\n"
],
"language": "python",
@@ -159,17 +138,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determination of Directional Indices\n",
"\n",
- "#Given\n",
- "#Projection of given vector\n",
"a=1/2.0\n",
"b=1\n",
"c=0\n",
"\n",
"x=[2*a,2*b,2*c]\n",
"\n",
- "#Result\n",
"print\"The intercept for the given plane is\",x\n",
"\n"
],
@@ -198,16 +173,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determination of Directional Indices for a Hexagonal Unit Cell\n",
"\n",
- "#Given\n",
- "#Projection in terms of unit cell parameter\n",
"du=1\n",
"dv=1\n",
"dw=1\n",
"\n",
- "#Calculation\n",
- "#For hexagonal system\n",
"u=(2*du-dv)/3.0\n",
"v=(2*dv-du)/3.0\n",
"t=-(u+v)\n",
@@ -242,21 +212,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determination of Planar (Miller) Indices\n",
"\n",
- "#Given\n",
"a=-1\n",
"b=1/2.0\n",
"\n",
"\n",
- "#Calculation\n",
- "#Reciprocal\n",
"l=0 #Reciprocal of infinity\n",
"m=1/a\n",
"n=1/b\n",
"x=[l,m,n]\n",
"\n",
- "#Result\n",
"print\"The intercept for the given plane is\",x\n"
],
"language": "python",
@@ -284,18 +249,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Determination of Miller\u2013Bravais Indices for a Plane Within a Hexagonal Unit Cell\n",
"\n",
- "#Intersection in terms of lattics Parameters\n",
"h=1 #Reciprocal of intersection point\n",
"k=-1\n",
"l=1\n",
"i=-(h+k)\n",
"\n",
- "#Calculation\n",
"x=[h,k,i,l]\n",
"\n",
- "#Result\n",
"print\"The indices of plane are\",x\n",
"\n"
],
@@ -324,25 +285,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Interplanar Spacing\n",
"\n",
- "#Given\n",
"a=0.2866 #Lattice parameter in nm\n",
"h=2\n",
"k=2\n",
"l=0\n",
"\n",
- "#Calculation\n",
"import math\n",
- "#(a)\n",
"d_hkl=a/(math.sqrt(h**2+k**2+l**2))\n",
"\n",
- "#(b)Diffraction Angle Computations\n",
"lam=0.1790 #Wavelength in nm\n",
"n=1\n",
"theta=math.asin(n*lam/(2*d_hkl))\n",
"\n",
- "#Result\n",
"print\"(a)Interplanar spacing is \",round(d_hkl,4),\"nm\"\n",
"print\"(b)Diffraction angle is \",round(2*theta*(180/math.pi),1),\"degree\"\n",
"\n"
diff --git a/Materials_science_and_engineering_an_introduction/CH4.ipynb b/Materials_science_and_engineering_an_introduction/CH4.ipynb
index 93bc9a2e..253ffd46 100644
--- a/Materials_science_and_engineering_an_introduction/CH4.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH4.ipynb
@@ -27,23 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Number of Vacancies Computation at a Specified temperature\n",
"\n",
- "#Given\n",
"Na=6.023*10**23 #Avogadro No.\n",
"den=8.4*10**6 #Density of Copper\n",
"A=63.5 #Atomic weight of Copper\n",
"\n",
- "#Calculation\n",
- "#No. of atomic site per cubic meter\n",
"N=Na*den/A\n",
- "#No. of vacancies at 1000 C\n",
"Qv=0.9 #Activation energy in eV\n",
"k=8.62*10**-5 # Boltzmann Constatnt in eV/K\n",
"T=1000.0+273.0 #Temperature in K\n",
"Nv=N*exp(-Qv/(k*T))\n",
"\n",
- "#Result\n",
"print\"No.of vacancies are \",round(Nv,-24),\"/m**3\"\n",
"\n"
],
@@ -72,10 +66,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Composition Conversion- From weight percent to Atom percent\n",
"\n",
- "#Given\n",
- "#Conversion to Atom percent\n",
"C_Al=97.0 #Aluminium wt%\n",
"C_Cu=3.0 #Copper wt%\n",
"A_Al=26.98 #Atomic wt of Aluminium\n",
@@ -114,20 +105,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Computations of ASTM Grain Size Number\n",
"\n",
- "#Given\n",
"N=45.0 #No. of grains per square inch\n",
"\n",
- "#Calculation\n",
- "#Dterminin grain size no. N=2**(n-1)\n",
"n=(math.log(N)/math.log(2))+1\n",
"\n",
- "#Number of Grains Per Unit Area\n",
"M=85.0\n",
"Nm=(100/M)**2*2**(n-1)\n",
"\n",
- "#Result\n",
"print\"Grain size no. is \",round(n,1)\n",
"print\"No. of grains per inch square are \",round(Nm,1)\n",
"\n"
diff --git a/Materials_science_and_engineering_an_introduction/CH5.ipynb b/Materials_science_and_engineering_an_introduction/CH5.ipynb
index 5b193d64..caf36165 100644
--- a/Materials_science_and_engineering_an_introduction/CH5.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH5.ipynb
@@ -27,19 +27,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Diffusion Flux Computation\n",
"\n",
- "#Given\n",
"Ca=1.2 #Concentration at A in kg/m**3\n",
"Cb=0.8 #Concentration at B in kg/m**3\n",
"xa=5*10**-3 #Position 1 in m\n",
"xb=10*10**-3 #Position 2 in m\n",
"\n",
- "#Calculation\n",
"D=3*10**-11 #Diffusion coefficient in m**2/s\n",
"J=-D*(Ca-Cb)/(xa-xb)\n",
"\n",
- "#Result\n",
"print\"Diffusion flux is \",J,\"kg/m**2-s\"\n",
"\n"
],
@@ -68,16 +64,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Nonsteady-State Diffusion Time Computation I\n",
"from scipy.optimize import fsolve\n",
- "#Given\n",
"Co=0.25 #Initial Conc. in wt%\n",
"Cs=1.2 #Surface conc. in wt%\n",
"Cx=0.8 #Conc. at any x in wt%\n",
"x=5*10**-4 #Position in m\n",
"D=1.6*10**-11 #Diffusion coeff in m**2/s\n",
"\n",
- "#Calculation\n",
"import math\n",
"C=1-((Cx-Co)/(Cs-Co))\n",
"\n",
@@ -86,7 +79,6 @@
"z=fsolve(f,1)\n",
"t=x**2/(4.0*D*z**2.0)\n",
"\n",
- "#Result\n",
"print\"Time required is \",round(t/3600.0,1),\"h\"\n",
"\n"
],
@@ -115,17 +107,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Nonsteady-State Diffusion Time Computation II\n",
"\n",
- "#Given\n",
"D500=4.8*10**-14 #Diffusion coefficient at 500 C\n",
"D600=5.3*10**-13 #Diffusion coefficient at 600 C\n",
"t600=10 #Time in hours to diffuse\n",
"\n",
- "#Calcuation\n",
"t500=D600*t600/D500\n",
"\n",
- "#Result\n",
"print\"Time to diffuse at 500 C is \",round(t500,1),\"h\"\n",
"\n"
],
@@ -154,19 +142,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Diffusion Coefficient Determination\n",
"\n",
- "#Given\n",
"T=550+273 #in K\n",
"D0=1.2*10**-4 #Temperature independent preexponential in m**2/s\n",
"Qd=131000 #Activation energy in J/mol-K\n",
"R=8.31 #Universal Gas constt\n",
"\n",
- "#Calculation\n",
"import math\n",
"D=D0*math.exp(-Qd/(R*T))\n",
"\n",
- "#Result\n",
"print\"Diffusion coefficient is \",round(D,14),\"m**2/s\"\n",
"\n"
],
@@ -195,21 +179,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Diffusion Coefficient Activation Energy and Preexponential Calculations\n",
"\n",
- "#Given\n",
- "#From graph log D ad 1/T are deducted\n",
"inv_T1=0.8*10**-3 #Reciprocal of temp. in K**-1\n",
"inv_T2=1.1*10**-3 #Reciprocal of temp. in K**-1\n",
"logD1=-12.4\n",
"logD2=-15.45\n",
"R=8.31 #Gas law Constant in J/mol-K\n",
"\n",
- "#Calculation\n",
"Qd=-2.3*R*(logD1-logD2)/(inv_T1-inv_T2)\n",
"print\"Activation energy is\",round(Qd/1000,0),\"KJ\"\n",
"\n",
- "#For calculating Peexponential factor\n",
"D0=10**(logD2+(Qd*inv_T2/(2.3*R)))\n",
"print\"Preexponential factor is\",round(D0,6),\"m**2/s\"\n",
"\n"
@@ -240,9 +219,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Diffusion Temperature\u2013Time Heat Treatment Specification\n",
"\n",
- "#Given\n",
"C0=0.2 #Initial concentration in wt%\n",
"Cs=1 #Surface conc in wt%\n",
"Cx=0.6 #Conc at any position X in wt%\n",
@@ -255,10 +232,8 @@
"z=0.4747\n",
"Dt=(x/(2*z))**2\n",
"\n",
- "#Dt=D0*exp(-Qd/RT)*t = value of variable Dt\n",
"D=Dt/D0\n",
"\n",
- "#The tempratures are\n",
"T1=900.0\n",
"T2=950.0\n",
"T3=1000.0\n",
@@ -268,7 +243,6 @@
"t3=D/math.exp(-Qd/(R*(T3+273)))/3600.0\n",
"t4=D/math.exp(-Qd/(R*(T4+273)))/3600.0\n",
"\n",
- "#Result\n",
"print\"Temperature in Celcius are\",T1,T2,T3,T4\n",
"print\"Time is respectively \",round(t1,1),\"h,\",round(t2,1),\"h,\",round(t3,1),\"h,\",round(t4,1),\"h\"\n",
"\n"
diff --git a/Materials_science_and_engineering_an_introduction/CH6.ipynb b/Materials_science_and_engineering_an_introduction/CH6.ipynb
index e04ca9e8..490f5d5d 100644
--- a/Materials_science_and_engineering_an_introduction/CH6.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH6.ipynb
@@ -27,17 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Elongation (Elastic) Computation\n",
"\n",
"E=110*10**3 #Young's modulus of Copper in MPa\n",
"sigma=276.0 #Applied stress in MPa\n",
"lo=305.0 #Original length in mm\n",
"\n",
- "#Calculation\n",
- "#Deformation\n",
"dl=sigma*lo/E\n",
"\n",
- "#Result\n",
"print\"Elongation obtained is \",round(dl,2),\"mm\"\n",
"\n"
],
@@ -66,21 +62,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Computation of Load to Produce Specified Diameter Change\n",
"\n",
- "#Given\n",
"del_d=-2.5*10**-3 #Deformation in dia in mm\n",
"d0=10.0 #Initial dia in mm\n",
"v=0.34 #Poisson ratio for brass\n",
"\n",
- "#Calculation\n",
"ex=del_d/d0\n",
"ez=-ex/v\n",
"E=97*10**3 #Modulus of elasticity in MPa\n",
"sigma=ez*E\n",
"F=sigma*math.pi*(d0**2)/4.0\n",
"\n",
- "#Result\n",
"print\"Applied force is \",round(F,0),\"N\"\n",
"\n"
],
@@ -109,30 +101,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#From draph in the question\n",
- "#stress and strain can be obtained\n",
"\n",
- "#Given\n",
"si2=150 # in MPa\n",
"si1=0\n",
"e2=0.0016\n",
"e1=0\n",
"d0=12.8*10**-3 #Initial Diameter in m\n",
"\n",
- "#Calculation\n",
- "#(a)Young's Modulus = stress/strain\n",
"E=(si2-si1)/(e2-e1)\n",
"\n",
"A0=math.pi*d0**2/4.0\n",
"sig=450*10**6 #tensile strength in MPa\n",
"F=sig*A0\n",
- "#From stress-strain curve\n",
- "#Strain corresponding to stress of 345 MPa is 0.06\n",
"l0=250 #Initial lengt in mm\n",
"e=0.06 #strain\n",
"dl=e*l0\n",
"\n",
- "#Result\n",
"print\"Modulus of elasticity is \",round(E/10**3,1),\"GPa\"\n",
"print\"From the graph the Yield strength is\",l0,\"MPa\"\n",
"print\"Maximum load sustained is \",round(F,0),\"N/n\"\n",
@@ -168,17 +152,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Ductility\n",
"\n",
- "#Given\n",
"di=12.8 #Initial dia in mm\n",
"df=10.7 #Final dia in mm\n",
"\n",
- "#Calculation\n",
"import math\n",
- "#Ductility in terms of Reduction Area \n",
"RA = ((di**2-df**2)/di**2)*100\n",
- "#True-Stress-At-Fracture Computations\n",
"Ao=math.pi*di**2*10**-6/4.0\n",
"sig=460*10**6 #Tensile strength\n",
"\n",
@@ -187,7 +166,6 @@
"Af=math.pi*df**2/4.0\n",
"sig_t=F/Af\n",
"\n",
- "#Result\n",
"print\"percent reduction in area is \",round(RA,0),\"%\"\n",
"print\"True stress is \",round(sig_t,1),\"MPa\"\n",
"\n"
@@ -218,16 +196,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculation of Strain-Hardening Exponent\n",
"\n",
"sig_t=415 #True stress in MPa\n",
"et=0.1 #True strain\n",
"K=1035.0 # In MPa\n",
"\n",
- "#Calculation\n",
"n=(math.log(sig_t)-math.log(K))/math.log(et)\n",
"\n",
- "#Result\n",
"print\"Strain - hardening coefficient is \",round(n,2)\n",
"\n"
],
@@ -256,20 +231,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Average Computations\n",
"\n",
- "#Tensile strength at 4 points\n",
"n=4.0 #No of points\n",
"T1=520\n",
"T2=512\n",
"T3=515\n",
"T4=522\n",
"\n",
- "#Calculation\n",
"Tav=(T1+T2+T3+T4)/n\n",
"s=(((T1-Tav)**2+(T2-Tav)**2+(T3-Tav)**2+(T4-Tav)**2)/(n-1))**(0.5)\n",
"\n",
- "#Result\n",
"print\"The average Tensile strength is\",round(Tav,0),\"MPa\"\n",
"print\"The standard deviation is\",round(s,1),\"MPa\""
],
@@ -299,18 +270,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Specification of Support Post Diameter\n",
"\n",
- "#Given\n",
"sig_y=310.0 #Minimum yield strength in MPa\n",
"N=5.0 # Conservative factor of safety\n",
"\n",
- "#Calculation\n",
"F=220000/2.0 #Two rods must support half of the total force\n",
"sig_w=sig_y/N\n",
"d=2*math.sqrt(F/(math.pi*sig_w))\n",
"\n",
- "#Result\n",
"print\"Diameter of each of the two rods is \",round(d,1),\"mm\"\n",
"\n"
],
diff --git a/Materials_science_and_engineering_an_introduction/CH7.ipynb b/Materials_science_and_engineering_an_introduction/CH7.ipynb
index ffef5715..262231ec 100644
--- a/Materials_science_and_engineering_an_introduction/CH7.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH7.ipynb
@@ -27,21 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Resolved Shear Stress Computations\n",
"\n",
- "#Direction for given plane\n",
"u1=1\n",
"v1=1\n",
"w1=0\n",
"u2=0\n",
"v2=1\n",
"w2=0\n",
- "#For lamda\n",
"u3=-1\n",
"v3=1\n",
"w3=1\n",
"\n",
- "#Calculation\n",
"import math\n",
"phi=math.acos((u1*u2+v1*v2+w1*w2)/(math.sqrt((u1**2+v1**2+w1**2)*(u2**2+v2**2+w2**2))))\n",
"lam=math.acos((u3*u2+v3*v2+w3*w2)/(math.sqrt((u3**2+v3**2+w3**2)*(u2**2+v2**2+w2**2))))\n",
@@ -50,7 +46,6 @@
"trc=30 #in MPa Critical resolved shear stress\n",
"sy=trc/(math.cos(phi)*math.cos(lam))\n",
"\n",
- "#Result\n",
"print\"(a)The resolved shear stress is \",round(tr,2),\"MPa\"\n",
"print\"(b)Yield strength is\",round(sy,1),\"MPa\"\n",
"\n"
@@ -81,18 +76,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Tensile Strength and Ductility Determinations for Cold-Worked Copper\n",
"\n",
- "#Given\n",
"df=12.2 #Final dia in mm\n",
"di=15.2 #Initial dia in mm\n",
"\n",
- "#Calculation\n",
"CW = ((di**2-df**2)/di**2)*100\n",
"ts=340 #in Mpa tensile strength, from fig 7.19 (b)\n",
"duc=7 #in % Ductility from fig 7.19 (c)\n",
"\n",
- "#result\n",
"print\"Percent Cold Work is \",round(CW,1),\"%\"\n",
"print\"Tensile strength is\",ts,\"MPa\"\n",
"print\"Ductility is \",duc,\"%\"\n",
@@ -125,21 +116,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Description of Diameter Reduction Procedure\n",
"\n",
- "#Given\n",
"di=6.4 #Initial dia in mm\n",
"df=5.1 #Final dia in mm\n",
"\n",
- "#Calculation\n",
- "#Cold Work Computation\n",
"CW = ((di**2-df**2)/di**2)*100\n",
- "#From Figures 7.19a and 7.19c, \n",
- "#A yield strength of 410 MPa \n",
- "#And a ductility of 8% EL are attained from this deformation\n",
"dmid = math.sqrt(df**2/(1-0.215))\n",
"\n",
- "#Result\n",
"print\"Cold work is \",round(CW,1),\"%\"\n",
"print\"But required ductility and yield strength is not matched at this cold work\"\n",
"print\"Hence required Cold work is 21.5 %\"\n",
diff --git a/Materials_science_and_engineering_an_introduction/CH8.ipynb b/Materials_science_and_engineering_an_introduction/CH8.ipynb
index 682a584f..b5a32873 100644
--- a/Materials_science_and_engineering_an_introduction/CH8.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH8.ipynb
@@ -27,18 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Maximum Flaw Length Computation\n",
"\n",
- "#Given\n",
"sigma=40*10**6 # in Pa Tensile stress\n",
"E=69*10**9 #Modulus of elaticity in pa\n",
"Ys=0.3 #Specific surface energy in N/m**2\n",
"\n",
- "#Calculation\n",
- "#Maximum length of a surface flaw\n",
"a=2*E*Ys/(math.pi*sigma**2)\n",
"\n",
- "#Result\n",
"print\"Maximum lemgth of a surface flaw without fracture is \",round(a*10**6,1),\"micro m\"\n",
"\n"
],
@@ -67,19 +62,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Rupture Lifetime Prediction\n",
"\n",
- "#Given\n",
"T=800.0+273.0 # Temperature in K\n",
"\n",
- "#Calculation\n",
"import math\n",
- "#From Graph of Fig. 8.32 Larson-Miller Parameter is deduced\n",
"L_M=24*10**3\n",
- "#math.log(t)=((L_M/T)-20)\n",
"t=math.pow(10,(L_M/T)-20)\n",
" \n",
- "#result\n",
"print\"Time to rupture is \",round(t,0),\"h\"\n",
"\n"
],
diff --git a/Materials_science_and_engineering_an_introduction/CH9.ipynb b/Materials_science_and_engineering_an_introduction/CH9.ipynb
index 0953b608..0ddab2a7 100644
--- a/Materials_science_and_engineering_an_introduction/CH9.ipynb
+++ b/Materials_science_and_engineering_an_introduction/CH9.ipynb
@@ -27,15 +27,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#(a)Determination of Phases Present\n",
- "#(b)Computation of Phase Compositions\n",
"\n",
- "#Given\n",
"C1=40.0 # Overall alloy composition\n",
"Cb=98.0\n",
"Ca=10.0\n",
"\n",
- "#Calculation\n",
"Wa=(Cb-C1)/(Cb-Ca)\n",
"Wb=(C1-Ca)/(Cb-Ca)\n",
"d_Sn=7.24 # in g/cm**3 density of tin\n",
@@ -50,7 +46,6 @@
"Vb=Wb/(d_b*((Wa/d_a)+(Wb/d_b)))\n",
"\n",
"\n",
- "#Result\n",
"print\"Mass fractions for alpha and beta phases are respectively\",round(Wa,2),\"and\",round(Wb,2)\n",
"print\"Density of alpha phase is \",round(d_a,2),\"g/cm**3\"\n",
"print\"Density of beta phase is \",round(d_b,2),\"g/cm**3\"\n",
@@ -87,16 +82,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#(a)Determining ferrite and cementite phase\n",
- "#(b)Determining proeutectoid ferrite and pearlite\n",
- "#(c)Determining eutectoid ferrite\n",
"\n",
- "#Given\n",
"C0=0.35\n",
"Ca=0.022\n",
"C_Fe3C=6.7\n",
"\n",
- "#Calculation\n",
"Wa=(C_Fe3C-C0)/(C_Fe3C-Ca)\n",
"W_Fe3C=(C0-Ca)/(C_Fe3C-Ca)\n",
"C_p=0.76\n",
@@ -107,7 +97,6 @@
"Wa=(C_Fe3C-C0)/(C_Fe3C-Ca)\n",
"Wae=Wa-W_a\n",
"\n",
- "#result\n",
"print\"Mass fraction of total ferritic phase is\",round(Wa,2)\n",
"print\"Mass fraction of Fe3C is\",round(W_Fe3C,2)\n",
"print\"Mass fraction of Pearlite is\",round(Wp,2)\n",
diff --git a/Mechanics_of_Materials/chapter1.ipynb b/Mechanics_of_Materials/chapter1.ipynb
index cf45a409..ab371470 100644
--- a/Mechanics_of_Materials/chapter1.ipynb
+++ b/Mechanics_of_Materials/chapter1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:aea5bb987f3d9aa2243551894826c2910635d28d3bf3f202e7af5344bd9c9219"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Find compressive stress and strain in the post\n",
- "\"\"\"\n",
"\n",
"import math\n",
"\n",
@@ -77,9 +75,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "formula for maximum stress & calculating maximum stress\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -122,9 +118,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculating change in lenght of pipe, strain in pipe, increase in diameter & increase in wall thickness\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -189,9 +183,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate average shear stress and compressive stress\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -236,11 +228,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate bearing stress, shear stress in pin,\n",
- "bearing stress between pin and gussets,\n",
- "shear stress in anchor bolts\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -305,9 +293,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "determine stress at various parts\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -367,9 +353,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculating the cross sectional area \n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Mechanics_of_Materials/chapter11.ipynb b/Mechanics_of_Materials/chapter11.ipynb
index d51505cd..6c1963de 100644
--- a/Mechanics_of_Materials/chapter11.ipynb
+++ b/Mechanics_of_Materials/chapter11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:84b48278b7f3c96235822dbaf287a816273c08b171a3ad371f818f325de3125f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "allowable load Pallow using a factor of safety & with respect to Euler buckling of the column\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -76,9 +75,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate minimum required thickness t of the columns\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -122,9 +119,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "evaluate the longest permissible length of the bar\n",
- "\"\"\"\n",
+ "\n",
"\n",
"from sympy import *\n",
"\n",
@@ -167,9 +162,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "maximum compressive stress in the column & the factor of safety\n",
- "\"\"\"\n",
+ "\n",
"\n",
"from sympy import *\n",
"import math\n",
@@ -248,9 +241,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "the allowable axial load & max. permissible length\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"import numpy\n",
@@ -368,9 +359,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "max. require outer diameter\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
@@ -437,9 +425,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate various quantities\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Mechanics_of_Materials/chapter12.ipynb b/Mechanics_of_Materials/chapter12.ipynb
index b8be714d..461ae35c 100644
--- a/Mechanics_of_Materials/chapter12.ipynb
+++ b/Mechanics_of_Materials/chapter12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:28eceabccc986d95bd8fd4a32c3e228a185da4101f3a8dcc4e232e8945315e7d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "find centroid C of the cross-sectional area.\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
@@ -72,9 +70,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "evaluate moment of inertia Ic with respect to the horizontal axis C-C\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -126,10 +122,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate orientations of the principal centroidal axes and the magnitudes\n",
- "of the principal centroidal moments of inertia\n",
- "\"\"\"\n",
"\n",
"import math \n",
"import numpy\n",
diff --git a/Mechanics_of_Materials/chapter2.ipynb b/Mechanics_of_Materials/chapter2.ipynb
index c4e1ad0f..831eb87c 100644
--- a/Mechanics_of_Materials/chapter2.ipynb
+++ b/Mechanics_of_Materials/chapter2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:35167c2920a96b28d2f9772d7854ca2ec822d5efce1d68ac1a2ac93b9d95fe9f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculating the number of revolutions for the nut\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
@@ -74,9 +72,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "finding maximum allowable load\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"import numpy\n",
@@ -130,9 +126,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculation if vertical displacement\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -182,9 +176,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "obtaing formula and calculating allowable load\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -235,10 +227,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate stress acting on inclined section &\n",
- "the complete state of stress\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -285,9 +274,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Calculate the vertical displacement of the joint\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -340,9 +327,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Comparison of energy-absorbing capacity with different type of bolts\n",
- "\"\"\"\n",
"\n",
"import math \n",
"#Bolt with reduced shank diameter\n",
@@ -387,9 +371,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Determine the maximum elongation and tensile stress\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -440,9 +422,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "determine displacement at the lower end of bar in various conditions\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Mechanics_of_Materials/chapter3.ipynb b/Mechanics_of_Materials/chapter3.ipynb
index 8c724325..d7c23e2c 100644
--- a/Mechanics_of_Materials/chapter3.ipynb
+++ b/Mechanics_of_Materials/chapter3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:da6f3f49063c862fcfbad93321317f9b628a844507de164f29b9e55b975bec08"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculating maximum shear stress & torque\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -86,9 +85,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Calculation of required diameter, outer diameter & ratio of diameteres\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
@@ -146,9 +142,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "(a)Compare shear stresses, angles of twist and weights\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -199,9 +193,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "determining maximum shear stress in various parts of the shaft\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
@@ -257,10 +248,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Calculate maximum shear, tensile & compressive stress in the tube.\n",
- "Also, calculate coressponding strains in the tube\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -316,9 +304,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Required diameters of the shaft at various rpm\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -365,9 +351,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Find the maximum shear stress & angle of twist in the shaft\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -426,9 +410,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "for various loading cases, obtain formulae and calculate strain energy\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -476,9 +458,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate the strain energy for hollow shaft\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"t = 480.0 # Torque of consmath.tant intensity\n",
@@ -517,9 +497,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Ratio of Shear stress and angle of twist for circular & square tube\n",
- "\"\"\"\n",
+ "\n",
"import math\n",
"\n",
"#Variable declaration\n",
diff --git a/Mechanics_of_Materials/chapter4.ipynb b/Mechanics_of_Materials/chapter4.ipynb
index e9b7e3e0..deb5ebe3 100644
--- a/Mechanics_of_Materials/chapter4.ipynb
+++ b/Mechanics_of_Materials/chapter4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ff1027836ff09444a0f286e9b3a2446de80c3b84e271ae3db6a9354c2ea33b2b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Finding shear force V and bending movement M at cross section D located 115 ft from left-hand behind support\n",
- "\"\"\"\n",
"\n",
"import math\n",
"\n",
@@ -75,9 +73,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Shear force and bending moments\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
diff --git a/Mechanics_of_Materials/chapter5.ipynb b/Mechanics_of_Materials/chapter5.ipynb
index bd000d63..eded6995 100644
--- a/Mechanics_of_Materials/chapter5.ipynb
+++ b/Mechanics_of_Materials/chapter5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:b3fea044fb61246e436e589813425563571ae1bfc62fb47f12dd9ef378e27c6d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate radius of curvature, curvature & deflection of beam\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math\n",
"import numpy\n",
@@ -79,9 +78,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Evaluate bending moment & maximum bending stress in the wire\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -124,9 +121,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "find maximum tensile and compressive stress in the beam\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -175,9 +170,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "because of uniform load in the beam, calculate maximum tensile & compressive stress\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -254,9 +247,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "choose a suitable size for the beam\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -302,9 +293,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "find min. req. diameter of the woodpost & req. outer diameter of aluminum tube\n",
- "\"\"\"\n",
"\n",
"import math\n",
"\n",
@@ -352,9 +340,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "evaluate and select a structural steel beam of wide-flange shape to support the loads\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -405,9 +391,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "find min. req. dimension of the posts\n",
- "\"\"\"\n",
"\n",
"import math\n",
"\n",
@@ -448,9 +431,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "find normal & shear stress at point C\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -498,9 +479,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate max. permissible value\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -544,9 +523,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "evaluate max. shear stress in the pole & diameter of solid pole\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -592,9 +569,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "maximum shear stress, minimum shear stress, and total shear force in the web.\n",
- "\"\"\"\n",
"\n",
"import math\n",
"\n",
@@ -644,9 +618,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "find shear stress at top of the web\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -699,9 +671,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "maximum permissible longitudinal spacing of the screws\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
@@ -746,9 +715,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "maximum tensile and compressive stress in the beam\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
diff --git a/Mechanics_of_Materials/chapter6.ipynb b/Mechanics_of_Materials/chapter6.ipynb
index 344830c9..611851ab 100644
--- a/Mechanics_of_Materials/chapter6.ipynb
+++ b/Mechanics_of_Materials/chapter6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:19ad2940f302eb9e5e16b3155aded36e0654d4a04f790dfd2d797d83e5d7886f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "largest tensile and compressive stresses in the wood & the max. and min. tensile stresses in the steel\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
@@ -87,10 +85,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "maximum tensile and compressive stresses in the faces and the core using: general theory for composite beams and \n",
- "approximate theory for sandwich beams\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -156,10 +151,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate largest tensile & compressive stresses in the wood\n",
- "also, the maximum and minimum tensile stresses in the steel\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -223,9 +215,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "maximum tensile and compressive stresses in the beam\n",
- "\"\"\"\n",
"\n",
"import math\n",
"import numpy\n",
@@ -285,9 +274,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "maximum bending stresses in the beam for various conditions\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math\n",
"import numpy \n",
@@ -347,9 +334,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "the bending stresses at points A and B\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"import numpy\n",
@@ -405,9 +390,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate magnitude of the moment M\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Mechanics_of_Materials/chapter7.ipynb b/Mechanics_of_Materials/chapter7.ipynb
index 7d4a1be4..57556b9c 100644
--- a/Mechanics_of_Materials/chapter7.ipynb
+++ b/Mechanics_of_Materials/chapter7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:4b150feddb9dc8fb4618b52384e38cf0a1bb69c134a6face9686f115e6bbaa31"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate stresses acting on an element inclined at 45\u00b0\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -77,9 +76,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "stresses acting on an element that is oriented at a clockwise 15\u00b0 \n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -127,9 +124,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Calculate shear stress and principal stress\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -184,9 +179,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "stresses acting on an element inclined at 30\u00b0 \n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
@@ -240,9 +232,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "stresses acting on an element, principal stress, max. shear stress\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math\n",
"import numpy\n",
@@ -317,9 +307,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "use Mohr\u2019s circle, to calculate various quantities\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"import numpy\n",
@@ -398,9 +386,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate various quantities\n",
- "\"\"\"\n",
"\n",
"import math\n",
"import numpy\n",
diff --git a/Mechanics_of_Materials/chapter8.ipynb b/Mechanics_of_Materials/chapter8.ipynb
index 9dcf70eb..5e6a3e95 100644
--- a/Mechanics_of_Materials/chapter8.ipynb
+++ b/Mechanics_of_Materials/chapter8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:0d2067363679e9ceade333ea9bc4385c2fb9b29e28a336c6f2561c38a5e262ab"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "finding max. permissible pressures at various conditions\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -97,9 +96,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculating various quantities for cylindrical part of vessel\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -182,9 +179,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "principal stresses and maximum shear stresses at cross section\n",
- "\"\"\"\n",
+ "\n",
"\n",
"%pylab inline\n",
"from matplotlib import *\n",
@@ -259,9 +254,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "maximum tensile stress, maximum compressive stress, and maximum shear stress in the shaft.\n",
- "\"\"\"\n",
"\n",
"import math \n",
"\n",
@@ -311,9 +303,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "calculate maximum allowable internal pressure\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -357,9 +347,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "principal stresses and maximum shear stresses\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -439,9 +427,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "principal stresses and maximum shear stresses at points & at the base of the post\n",
- "\"\"\"\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Mechanics_of_Materials/chapter9.ipynb b/Mechanics_of_Materials/chapter9.ipynb
index 7ea9938e..ee48f481 100644
--- a/Mechanics_of_Materials/chapter9.ipynb
+++ b/Mechanics_of_Materials/chapter9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:688a5ddb04d5076a46d59fbb5d6dc8d907dec2ec735786354cef92d935d1ccd0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Determine the download deflection\n",
- "\"\"\"\n",
+ "\n",
"\n",
"#Variable declaration\n",
"P = 5 #load(k)\n",
@@ -69,9 +68,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\"\"\"\n",
- "Determine vertical deflections\n",
- "\"\"\"\n",
"\n",
"#Variable declaration\n",
"E = 30*10**6*144 #modulus of elasticity(lb/ft^2)\n",
diff --git a/Microwave_and_Radar_Engineering/Chapter_10.ipynb b/Microwave_and_Radar_Engineering/Chapter_10.ipynb
index e8ab31f7..406bdd3e 100644
--- a/Microwave_and_Radar_Engineering/Chapter_10.ipynb
+++ b/Microwave_and_Radar_Engineering/Chapter_10.ipynb
@@ -27,8 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find the maximum distance through which the TV signal could be received by space popagation and \n",
- "the raio horizon'''\n",
"\n",
"from math import sqrt\n",
"\n",
@@ -71,7 +69,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the value of the factor by which the horizon distance of the transmitter can be modified'''\n",
"\n",
"from fractions import Fraction\n",
"\n",
@@ -110,7 +107,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the carrier transmitter power required'''\n",
"\n",
"import math \n",
"#Variable declaration\n",
@@ -154,7 +150,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the received power at input of satellite receiver'''\n",
"\n",
"import math\n",
"\n",
@@ -202,7 +197,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the antenna beam angle'''\n",
"\n",
"import math\n",
"\n",
@@ -241,7 +235,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the round trip time between earth station and satellite. Find the same for vertical transmission'''\n",
"\n",
"import math\n",
"\n",
@@ -288,7 +281,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the figure of merit for an earth station'''\n",
"\n",
"import math\n",
"\n",
@@ -330,7 +322,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine carrier to noise ratio'''\n",
"\n",
"#Variable declaration\n",
"EIRP = 55.5 #satellite ESM(dBW)\n",
@@ -368,7 +359,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the system noise temperature'''\n",
"\n",
"import math\n",
"\n",
@@ -413,7 +403,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Find the diameter & half power beam width of paraboic antenna'''\n",
"\n",
"import math\n",
"\n",
@@ -456,17 +445,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate overall gain of the system'''\n",
"\n",
"import math\n",
"\n",
"#Variable declaration\n",
- "'''Let Gp1 be the gain and d1 be the diameter of the parabolic reflectors in the original system\n",
"then Gp1 = (6*D1**2)/(lamda**2)\n",
"If the gain and diameter of the antenna in the modified system is Gp2 and d2,\n",
"then Gp2 = (6*D2**2)/(lamda**2)\n",
"Gain = 10*log(Gp2/Gp1)\n",
- "Substituting D2=2D1 in Gp2, we get,'''\n",
"\n",
"#Calculations\n",
"G = 10*math.log10(2)\n",
@@ -500,10 +486,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate -\n",
"a)beamwidth between first nulls\n",
"b)beamwidth between half power points\n",
- "c)gain of antenna'''\n",
"\n",
"#Variable declaration\n",
"D = 3*10**2 #diameter of paraboloid(cm)\n",
@@ -548,11 +532,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate power gain of optimum horn antenna'''\n",
"\n",
"#Variable declaration\n",
- "'''A = 5*lamda #square aperture of a side dimension\n",
- "Gp = 4.5* A^2/lamda^2'''\n",
"A = 5\n",
"\n",
"#Calculation\n",
diff --git a/Microwave_and_Radar_Engineering/Chapter_11.ipynb b/Microwave_and_Radar_Engineering/Chapter_11.ipynb
index 8ad823b1..afe53dd6 100644
--- a/Microwave_and_Radar_Engineering/Chapter_11.ipynb
+++ b/Microwave_and_Radar_Engineering/Chapter_11.ipynb
@@ -1,308 +1,300 @@
-{
- "metadata": {
- "name": "Chapter 11"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 11: Radars"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 11.1, Page number 504"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''Calculate maximum range of radar system'''\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable declaraion\n",
- "lamda = 3.*10**-2#operating unit(cm)\n",
- "Pt = 600.*10**3 #peak pulse power(W)\n",
- "Smin = 10.**-13 #minimum detectable signal(W)\n",
- "Ae = 5. #m^2\n",
- "sigma = 20. #cross sectional area(m^2)\n",
- "\n",
- "#Calculations\n",
- "Rmax = ((Pt*Ae**2*sigma)/(4*math.pi*lamda**2*Smin))**0.25\n",
- "Rmax_nau = Rmax/1.853\n",
- "\n",
- "#Result\n",
- "print \"The maximum range of radar system is\",round((Rmax/1E+3),2),\"km\"\n",
- "print \"The maximum range of radar system in nautical miles is\",round((Rmax_nau/1E+3),2),\"nm\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The maximum range of radar system is 717.66 km\n",
- "The maximum range of radar system in nautical miles is 387.29 nm\n"
- ]
- }
- ],
- "prompt_number": 25
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 11.2, Page number 504"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''Find maximum range possible of an antenna'''\n",
- "\n",
- "#Variable declaration\n",
- "Pt = 250.*10**3 #peak pulse power(W)\n",
- "Smin = 10.**-14 #minimum detectable signal(W)\n",
- "Ae = 10. #m^2\n",
- "sigma = 2. #cross sectional area(m^2)\n",
- "f = 10*10**9 #frequency(Hz)\n",
- "c = 3*10**8 #velocity of propagation(m/s)\n",
- "G = 2500 #power gain of antenna\n",
- "\n",
- "#Calculations\n",
- "lamda = c/f\n",
- "Rmax = ((Pt*G*Ae*sigma)/((4*math.pi)**2*Smin))**0.25\n",
- "\n",
- "#Result\n",
- "print \"Maximum range possible of the antenna is\",round((Rmax/1E+3),2),\"km\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Maximum range possible of the antenna is 298.28 km\n"
- ]
- }
- ],
- "prompt_number": 30
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 11.3, Page number 504"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''Determine the cross section the radar can sight'''\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "Pt = 250.*10**3 #peak pulse power(W)\n",
- "f = 10.*10**9 #frequency(Hz)\n",
- "c = 3.*10**8 #velocity of propagation(m/s)\n",
- "G = 4000 #power gain of antenna\n",
- "R = 50*10**3 #range(m)\n",
- "Pr = 10**-11 #minimum detectable signal(W)\n",
- "\n",
- "#Calculations\n",
- "lamda = c/f\n",
- "Ae = (G*lamda**2)/(4*math.pi)\n",
- "sigma = (Pr*((4*math.pi*R**2)**2))/(Pt*G*Ae)\n",
- "\n",
- "#Result\n",
- "print \"The radar can sight cross section area of\",round(sigma,2),\"m^2\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The radar can sight cross section area of 34.45 m^2\n"
- ]
- }
- ],
- "prompt_number": 37
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 11.4, Page number 505"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''Determine - \n",
- "a)Unambigous range\n",
- "b)duy cycle\n",
- "c)average power\n",
- "d)bandwidth of radar'''\n",
- "\n",
- "#Variable declaration\n",
- "Pt = 400*10**3 #transmitted power(W)\n",
- "prf = 1500. #pulse repitiion frequency(pps)\n",
- "tw = 0.8*10**-6 #pulse width(sec)\n",
- "c = 3.*10**8 #velocity of propagation(m/s)\n",
- "\n",
- "#Calculations\n",
- "#Part a\n",
- "Run = c/(2*prf)\n",
- "\n",
- "#Part b\n",
- "dc = tw/(1/prf)\n",
- "\n",
- "#Part c\n",
- "Pav = Pt*dc\n",
- "\n",
- "#Part d\n",
- "n1 = 1\n",
- "BW1 = n1/tw\n",
- "\n",
- "n2 = 1.4\n",
- "BW2 = n2/tw\n",
- "\n",
- "#Results\n",
- "print \"The radar's unambiguous range is\",round((Run/1E+3),2),\"km\"\n",
- "print \"The duty cycle for radar is\",dc\n",
- "print \"The average power is\",round(Pav,2),\"W\"\n",
- "print \"Bandwidth range for radar is\",(BW1/1E+6),\"MHz and\",(BW2/1E+6),\"MHz\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The radar's unambiguous range is 100.0 km\n",
- "The duty cycle for radar is 0.0012\n",
- "The average power is 480.0 W\n",
- "Bandwidth range for radar is 1.25 MHz and 1.75 MHz\n"
- ]
- }
- ],
- "prompt_number": 47
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 11.5, Page number 505"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''Find the maximum detection range'''\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable declaration\n",
- "Pt = 2.5*10**6 #power output(W)\n",
- "D = 5 #antenna diameter(m)\n",
- "sigma = 1 #cross sectional area of target(m^2)\n",
- "B = 1.6*10**6 #receiver bandwidth(Hz)\n",
- "c = 3.*10**8 #velocity of propagation(m/s)\n",
- "Nf = 12. #noise figure(dB)\n",
- "f = 5*10**9 #frequency(Hz)\n",
- "\n",
- "#Calculations\n",
- "lamda = c/f\n",
- "F = 10**(Nf/10)\n",
- "Rmax = 48*(((Pt*D**4*sigma)/(B*lamda**2*(F-1)))**0.25)\n",
- "\n",
- "#Result\n",
- "print \"The maximum detection range is\",round(Rmax,2),\"km\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The maximum detection range is 558.04 km\n"
- ]
- }
- ],
- "prompt_number": 57
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 11.6, Page number 506"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''Find the maximum range and the effect of doubling the transmitter power'''\n",
- "\n",
- "import math \n",
- "\n",
- "#Variable declaration\n",
- "Rmax = 30 #maximum range of radar(km)\n",
- "n = 50 #no. of echos\n",
- "\n",
- "#Calculation\n",
- "R = Rmax*math.sqrt(math.sqrt(n))\n",
- "\n",
- "#After doubling the power\n",
- "R1 = math.sqrt(math.sqrt(2))\n",
- "\n",
- "#Results\n",
- "print \"Maximum range with echoing of 50 times is\",round(R,2),\"km\"\n",
- "print \"If transmitter power is doubled, range would increase by a factor of\",round(R1,2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Maximum range with echoing of 50 times is 79.77 km\n",
- "If transmitter power is doubled, range would increase by a factor of 1.19\n"
- ]
- }
- ],
- "prompt_number": 61
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:efd0e56c04d2245e98b2287a63fba67799b88e9847372ba4c5f3c4cf5de91c4c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 11: Radars"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.1, Page number 504"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaraion\n",
+ "lamda = 3.*10**-2#operating unit(cm)\n",
+ "Pt = 600.*10**3 #peak pulse power(W)\n",
+ "Smin = 10.**-13 #minimum detectable signal(W)\n",
+ "Ae = 5. #m^2\n",
+ "sigma = 20. #cross sectional area(m^2)\n",
+ "\n",
+ "#Calculations\n",
+ "Rmax = ((Pt*Ae**2*sigma)/(4*math.pi*lamda**2*Smin))**0.25\n",
+ "Rmax_nau = Rmax/1.853\n",
+ "\n",
+ "#Result\n",
+ "print \"The maximum range of radar system is\",round((Rmax/1E+3),2),\"km\"\n",
+ "print \"The maximum range of radar system in nautical miles is\",round((Rmax_nau/1E+3),2),\"nm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The maximum range of radar system is 717.66 km\n",
+ "The maximum range of radar system in nautical miles is 387.29 nm\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.2, Page number 504"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "Pt = 250.*10**3 #peak pulse power(W)\n",
+ "Smin = 10.**-14 #minimum detectable signal(W)\n",
+ "Ae = 10. #m^2\n",
+ "sigma = 2. #cross sectional area(m^2)\n",
+ "f = 10*10**9 #frequency(Hz)\n",
+ "c = 3*10**8 #velocity of propagation(m/s)\n",
+ "G = 2500 #power gain of antenna\n",
+ "\n",
+ "#Calculations\n",
+ "lamda = c/f\n",
+ "Rmax = ((Pt*G*Ae*sigma)/((4*math.pi)**2*Smin))**0.25\n",
+ "\n",
+ "#Result\n",
+ "print \"Maximum range possible of the antenna is\",round((Rmax/1E+3),2),\"km\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum range possible of the antenna is 298.28 km\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.3, Page number 504"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Pt = 250.*10**3 #peak pulse power(W)\n",
+ "f = 10.*10**9 #frequency(Hz)\n",
+ "c = 3.*10**8 #velocity of propagation(m/s)\n",
+ "G = 4000 #power gain of antenna\n",
+ "R = 50*10**3 #range(m)\n",
+ "Pr = 10**-11 #minimum detectable signal(W)\n",
+ "\n",
+ "#Calculations\n",
+ "lamda = c/f\n",
+ "Ae = (G*lamda**2)/(4*math.pi)\n",
+ "sigma = (Pr*((4*math.pi*R**2)**2))/(Pt*G*Ae)\n",
+ "\n",
+ "#Result\n",
+ "print \"The radar can sight cross section area of\",round(sigma,2),\"m^2\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The radar can sight cross section area of 34.45 m^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.4, Page number 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "Pt = 400*10**3 #transmitted power(W)\n",
+ "prf = 1500. #pulse repitiion frequency(pps)\n",
+ "tw = 0.8*10**-6 #pulse width(sec)\n",
+ "c = 3.*10**8 #velocity of propagation(m/s)\n",
+ "\n",
+ "#Calculations\n",
+ "#Part a\n",
+ "Run = c/(2*prf)\n",
+ "\n",
+ "#Part b\n",
+ "dc = tw/(1/prf)\n",
+ "\n",
+ "#Part c\n",
+ "Pav = Pt*dc\n",
+ "\n",
+ "#Part d\n",
+ "n1 = 1\n",
+ "BW1 = n1/tw\n",
+ "\n",
+ "n2 = 1.4\n",
+ "BW2 = n2/tw\n",
+ "\n",
+ "#Results\n",
+ "print \"The radar's unambiguous range is\",round((Run/1E+3),2),\"km\"\n",
+ "print \"The duty cycle for radar is\",dc\n",
+ "print \"The average power is\",round(Pav,2),\"W\"\n",
+ "print \"Bandwidth range for radar is\",(BW1/1E+6),\"MHz and\",(BW2/1E+6),\"MHz\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The radar's unambiguous range is 100.0 km\n",
+ "The duty cycle for radar is 0.0012\n",
+ "The average power is 480.0 W\n",
+ "Bandwidth range for radar is 1.25 MHz and 1.75 MHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 47
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.5, Page number 505"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Pt = 2.5*10**6 #power output(W)\n",
+ "D = 5 #antenna diameter(m)\n",
+ "sigma = 1 #cross sectional area of target(m^2)\n",
+ "B = 1.6*10**6 #receiver bandwidth(Hz)\n",
+ "c = 3.*10**8 #velocity of propagation(m/s)\n",
+ "Nf = 12. #noise figure(dB)\n",
+ "f = 5*10**9 #frequency(Hz)\n",
+ "\n",
+ "#Calculations\n",
+ "lamda = c/f\n",
+ "F = 10**(Nf/10)\n",
+ "Rmax = 48*(((Pt*D**4*sigma)/(B*lamda**2*(F-1)))**0.25)\n",
+ "\n",
+ "#Result\n",
+ "print \"The maximum detection range is\",round(Rmax,2),\"km\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The maximum detection range is 558.04 km\n"
+ ]
+ }
+ ],
+ "prompt_number": 57
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11.6, Page number 506"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math \n",
+ "\n",
+ "#Variable declaration\n",
+ "Rmax = 30 #maximum range of radar(km)\n",
+ "n = 50 #no. of echos\n",
+ "\n",
+ "#Calculation\n",
+ "R = Rmax*math.sqrt(math.sqrt(n))\n",
+ "\n",
+ "#After doubling the power\n",
+ "R1 = math.sqrt(math.sqrt(2))\n",
+ "\n",
+ "#Results\n",
+ "print \"Maximum range with echoing of 50 times is\",round(R,2),\"km\"\n",
+ "print \"If transmitter power is doubled, range would increase by a factor of\",round(R1,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum range with echoing of 50 times is 79.77 km\n",
+ "If transmitter power is doubled, range would increase by a factor of 1.19\n"
+ ]
+ }
+ ],
+ "prompt_number": 61
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Microwave_and_Radar_Engineering/Chapter_3.ipynb b/Microwave_and_Radar_Engineering/Chapter_3.ipynb
index a92941f8..033e0551 100644
--- a/Microwave_and_Radar_Engineering/Chapter_3.ipynb
+++ b/Microwave_and_Radar_Engineering/Chapter_3.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Finding the value of terminating impedance'''\n",
"\n",
"#Variable declaration\n",
"Zo = 100 #o/p impedance(Ohms)\n",
@@ -64,7 +63,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Calculate characterstic impedance, attenuation constant, phase constant and power delivered to the load'''\n",
"\n",
"import math\n",
"import cmath\n",
@@ -122,7 +120,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Obtain phase velocity of a wave that is propagated on the line'''\n",
"\n",
"import math\n",
"\n",
@@ -162,10 +159,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Calculate -\n",
"a) Current drawn from generator\n",
"b) Power delivered to the load\n",
- "c) Current flowing through the load'''\n",
"\n",
"import cmath\n",
"import math\n",
@@ -230,7 +225,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Calculate VSWR and reflection coefficient'''\n",
"\n",
"import cmath\n",
"import math\n",
@@ -277,7 +271,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Determine the point of attachment and length of stub'''\n",
"\n",
"import math\n",
"\n",
@@ -325,7 +318,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Calcultate the terminating impedance'''\n",
"\n",
"import cmath\n",
"import math\n",
@@ -372,11 +364,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine - \n",
"a)VSWR\n",
"b) Position of first Vmin and Vmax\n",
"c) Vmin and Vmax\n",
- "d) Impedance at Vmin and Vmax'''\n",
"\n",
"import math\n",
"\n",
@@ -441,10 +431,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Determine - \n",
"a)Transmission loss\n",
"b)Reflection loss\n",
- "c)Return loss'''\n",
"\n",
"import math\n",
"\n",
@@ -500,7 +488,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the characteristic impedance and phase velocity'''\n",
"\n",
"import cmath\n",
"import math\n",
diff --git a/Microwave_and_Radar_Engineering/Chapter_4.ipynb b/Microwave_and_Radar_Engineering/Chapter_4.ipynb
index c8b2fe93..24431e97 100644
--- a/Microwave_and_Radar_Engineering/Chapter_4.ipynb
+++ b/Microwave_and_Radar_Engineering/Chapter_4.ipynb
@@ -27,11 +27,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Calculate - \n",
"a)Inductance per unit length\n",
"b)Capacitance per unit lengh\n",
"c)Characteristic impedance\n",
- "d)velocity of propagation'''\n",
"\n",
"import math\n",
"\n",
@@ -81,7 +79,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate aatenuation constant, phase constant, phase velocity, relative permittivity and power loss'''\n",
"\n",
"import math\n",
"\n",
@@ -139,7 +136,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate breakdown power'''\n",
"\n",
"import math\n",
"\n",
@@ -184,7 +180,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine the characteristic impedance and velocity of propagation'''\n",
"\n",
"import math\n",
"\n",
@@ -228,10 +223,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Determine -\n",
"a)Characteristic impedance\n",
"b)Dielectric constant\n",
- "c)Velocity of propagation'''\n",
"\n",
"import math\n",
"\n",
@@ -300,9 +293,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Calculate ratio of circular waveguide cross-sectional area to the rectangular waveguide cross section when - \n",
"a) TE wave is propagated\n",
- "b) TM wave is propagated'''\n",
"\n",
"import math\n",
"\n",
@@ -358,7 +349,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate breadth of rectangular waveguide for dominant mode TE10'''\n",
"\n",
"import math\n",
"\n",
@@ -401,7 +391,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Determine the cut-off wavelength, guide wavelength, group and phase velocities'''\n",
"\n",
"#Variable declaration\n",
"a = 10 #breadth of waveguide(cms)\n",
@@ -450,10 +439,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Find the following - \n",
"a)possible modes\n",
"b)cut-off frequencies\n",
- "c)guide wavelength'''\n",
"\n",
"import math\n",
"\n",
@@ -517,9 +504,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find - \n",
"a)the required size of cross setional area of the guide\n",
- "b)the frequencies that can be used for this mode of propagation'''\n",
"\n",
"import math\n",
"\n",
@@ -563,7 +548,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Finding all the modes of propagation'''\n",
"\n",
"import math\n",
"\n",
@@ -618,10 +602,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Find - \n",
"a)cut-off wavelength\n",
"b)cut-off frequency\n",
- "c)wavelength in the guide'''\n",
"\n",
"import math\n",
"\n",
@@ -669,7 +651,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find the frequency of wave'''\n",
"\n",
"import math\n",
"\n",
@@ -714,7 +695,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine guide wavelength, phase constant and phase velocity'''\n",
"\n",
"import math\n",
"\n",
@@ -765,7 +745,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''What modes are propagated at free space wavelength of(i)10cm (ii)5cm'''\n",
"\n",
"#Variable declaration\n",
"lamda_o1 = 10 #cms\n",
@@ -826,7 +805,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine characteristic wave impedance'''\n",
"\n",
"import math\n",
"\n",
@@ -872,7 +850,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine diameter of waveguide and guide wavelength'''\n",
"\n",
"import math\n",
"\n",
@@ -917,7 +894,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Analysis of TE01 mode'''\n",
"\n",
"import math\n",
"\n",
@@ -967,7 +943,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the amount of attenuation'''\n",
"\n",
"import math\n",
"\n",
@@ -1016,7 +991,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the maximum power handling capacity of the waveguide'''\n",
"\n",
"#Variable declaration\n",
"a = 3\n",
@@ -1061,7 +1035,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate maximum power'''\n",
"\n",
"import math\n",
"\n",
@@ -1106,7 +1079,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find peak value of electric field occuring in the guide'''\n",
"\n",
"import math\n",
"\n",
@@ -1155,7 +1127,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the breakdown power of an airfilled rectangular waveguide'''\n",
"\n",
"import math\n",
"\n",
@@ -1198,7 +1169,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the breakdown power'''\n",
"\n",
"import math\n",
"\n",
diff --git a/Microwave_and_Radar_Engineering/Chapter_5.ipynb b/Microwave_and_Radar_Engineering/Chapter_5.ipynb
index b5542bc5..111d3a6e 100644
--- a/Microwave_and_Radar_Engineering/Chapter_5.ipynb
+++ b/Microwave_and_Radar_Engineering/Chapter_5.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate minimum distance between two plates'''\n",
"\n",
"import math\n",
"\n",
@@ -68,7 +67,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find out the lowest resonating frequency of a rectangular resonator'''\n",
"\n",
"#Variable declaration\n",
"#dimensions of resonator\n",
@@ -113,7 +111,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find the resonanat frequency of a circular resonator for the folowing specifications'''\n",
"\n",
"import math\n",
"\n",
@@ -160,7 +157,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find the resonanat frequency of a circular resonator for the folowing specifications'''\n",
"\n",
"#Variable declaration\n",
"#dimensions of resonator\n",
diff --git a/Microwave_and_Radar_Engineering/Chapter_6.ipynb b/Microwave_and_Radar_Engineering/Chapter_6.ipynb
index cd9f5cb9..28637666 100644
--- a/Microwave_and_Radar_Engineering/Chapter_6.ipynb
+++ b/Microwave_and_Radar_Engineering/Chapter_6.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculating the distance between S12 and S21'''\n",
"\n",
"from numpy import array\n",
"import cmath\n",
@@ -38,10 +37,8 @@
"B = 34.3 #rad/sec\n",
"\n",
"#Calculations\n",
- "'''Let port 1 be shifted by phi-1 gegrees to the lfet and port 2 remain unchanged\n",
"phi-1 = [[e^(-j*phi-1), 0]\n",
" [0 1]]\n",
- "Solving [S-dash]=[phi]*[S]*[phi], we get,'''\n",
"phi1 = 53.13\n",
"l = math.radians(phi1)/B\n",
"\n",
@@ -73,7 +70,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine the scattering parameters'''\n",
"\n",
"import math\n",
"\n",
@@ -143,7 +139,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determining the power in remaining ports when other ports are terminated'''\n",
"\n",
"import math\n",
"\n",
@@ -197,7 +192,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate power delivered to the loads connected to ports 1 & 2'''\n",
"\n",
"from numpy import array\n",
"\n",
@@ -245,7 +239,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine scattering matrix of the isolator'''\n",
"\n",
"from numpy import array\n",
"\n",
@@ -294,7 +287,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determining the [S] of a 3-port circulator'''\n",
"\n",
"from numpy import array\n",
"\n",
@@ -326,9 +318,7 @@
"S = array([[S11,S12,S13],[S21,S22,S23],[S31,S32,S33]])\n",
"print \"[S]=\\n\",S\n",
"#For a perfectly matched, non-reciprocal, lossless 3-port circulator, [s] is given by,\n",
- "''' [S] = [[0 0 S13]\n",
" [S21 0 0 ]\n",
- " [0 S32 0 ]]'''\n",
"#The terminal planes are such that phase angles of S13=S21=S32=1\n",
"S13_new=1\n",
"S21_new=1\n",
@@ -369,7 +359,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Finding the output power at the ports'''\n",
"\n",
"import math\n",
"\n",
@@ -416,17 +405,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Finding the directivity, coupling and islotaion for a directional coupler'''\n",
"\n",
"import math\n",
"\n",
"#Variable declaration\n",
- "'''\n",
"[S] = [[0.05/_30 0.96/_0 0.1/_90 0.05/_90]\n",
" [0.96/_0 0.05/_30 0.05/_90 0.1/_90 ]\n",
" [0.1/_90 0.05/_90 0.05/_30 0.96/_0 ]\n",
" [0.05/_90 0.1/_90 0.96/_0 0.05/_30]]\n",
- "'''\n",
"\n",
"#Calculations\n",
"#Coupling = C=10log(P1/P3)=-20log|S13|\n",
@@ -470,7 +456,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determining VSWR'''\n",
"\n",
"import math\n",
"\n",
@@ -510,7 +495,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determining the phase shift component in a phase shift measurement setup'''\n",
"\n",
"import math\n",
"\n",
diff --git a/Microwave_and_Radar_Engineering/Chapter_7.ipynb b/Microwave_and_Radar_Engineering/Chapter_7.ipynb
index 4220d38b..5b27b735 100644
--- a/Microwave_and_Radar_Engineering/Chapter_7.ipynb
+++ b/Microwave_and_Radar_Engineering/Chapter_7.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Calculating VSWR'''\n",
"\n",
"import math\n",
"\n",
@@ -72,7 +71,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find the value of reflected power nad VSWR'''\n",
"\n",
"import math\n",
"\n",
@@ -112,7 +110,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find value of VSWR'''\n",
"\n",
"import math\n",
"\n",
@@ -152,7 +149,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Find value of reflected power'''\n",
"\n",
"import math\n",
"\n",
diff --git a/Microwave_and_Radar_Engineering/Chapter_8.ipynb b/Microwave_and_Radar_Engineering/Chapter_8.ipynb
index d2c5bc27..ad0ccc9e 100644
--- a/Microwave_and_Radar_Engineering/Chapter_8.ipynb
+++ b/Microwave_and_Radar_Engineering/Chapter_8.ipynb
@@ -27,13 +27,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Compute -\n",
"a)dc electron velocity\n",
"b)dc phase constant\n",
"c)plasma frequency\n",
"d)reduced plasma frequency \n",
"e)dc beam current density\n",
- "f)instantaeneous beam current density'''\n",
"\n",
"import math\n",
"\n",
@@ -105,10 +103,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine -\n",
"a)input rms voltage\n",
"b)output rms voltage\n",
- "c)power delivered to the load'''\n",
"\n",
"import math\n",
"\n",
@@ -162,10 +158,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Dtermine -\n",
"a)input power\n",
"b)output power\n",
- "c)efficiency'''\n",
"\n",
"import math\n",
"\n",
@@ -218,11 +212,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine -\n",
"a)electron velocity \n",
"b)dc transit time of electrons\n",
"c)input voltage for maximum output voltage\n",
- "d)voltage gain in decibles'''\n",
"\n",
"import math\n",
"\n",
@@ -288,11 +280,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
"a)Find the input microwave voltage V1 in order to generate maximum output voltage\n",
"b)Determine the voltage gain (reflecting beam loading in the output cavity)\n",
"c)Calculate the efficiency of the amplifier neglecting beam loading\n",
- "d)Compute the beam loading conductance and show that one may neglect it in the preceeding calculations'''\n",
"\n",
"import math\n",
"\n",
@@ -364,10 +354,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
"a)Find the value of repeller voltage Vr\n",
"b)Find the dc necesaary to give the microwave gap of voltage of 200V\n",
- "c)Calculate the elctron efficiency'''\n",
"\n",
"import math\n",
"\n",
@@ -434,10 +422,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
"a)Determine the efficiency of the reflex klystron\n",
"b)Find the total power output in mW\n",
- "c)If 20% of the power delivered by the elctron beam is dissipated in the cavity walls find the power delivered to the load'''\n",
"\n",
"import math\n",
"\n",
@@ -488,10 +474,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine -\n",
"a)Hull cut-off voltage\n",
"b)Cut-off magnetic flux density\n",
- "c)Cyclotron frequency'''\n",
"\n",
"import math\n",
"\n",
@@ -548,7 +532,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate axial phase velocity and the anode voltage'''\n",
"\n",
"import math\n",
"\n",
@@ -596,11 +579,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine -\n",
"a)electron velocity\n",
"b)dc electronic transit time\n",
"c)input voltage for maximum output voltage\n",
- "d)voltage gain in decibles'''\n",
"\n",
"import math\n",
"\n",
@@ -666,13 +647,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine -\n",
"a)dc electron velocity\n",
"b)dc phase constant\n",
"c)plasma frequency\n",
"d)reduced plasma frequency\n",
"e)beam current density\n",
- "f)instantaneous bean current density'''\n",
"\n",
"import math\n",
"\n",
@@ -744,7 +723,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calclate the gap transit angle and optimum length of drift region'''\n",
"\n",
"import math\n",
"\n",
@@ -791,10 +769,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate -\n",
"a)input RF voltage\n",
"b)voltage gain\n",
- "c)efficiency'''\n",
"\n",
"import math\n",
"\n",
@@ -859,10 +835,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate -\n",
"a)cyclotron angular frequency\n",
"b)Hull cut-off voltage\n",
- "c)cut-off magnetic flux density'''\n",
"\n",
"import math\n",
"\n",
@@ -917,10 +891,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine - \n",
"a)input power\n",
"b)output power\n",
- "c)efficiency'''\n",
"\n",
"import math\n",
"\n",
@@ -973,9 +945,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find -\n",
"a)repeller voltage\n",
- "b)beam current'''\n",
"\n",
"import math\n",
"\n",
diff --git a/Microwave_and_Radar_Engineering/Chapter_9.ipynb b/Microwave_and_Radar_Engineering/Chapter_9.ipynb
index 4a94447f..99126c13 100644
--- a/Microwave_and_Radar_Engineering/Chapter_9.ipynb
+++ b/Microwave_and_Radar_Engineering/Chapter_9.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine operating frequency of an IMPATT diode'''\n",
"\n",
"#Variable declaration\n",
"L = 2*10**-6 #drift length(m)\n",
@@ -64,7 +63,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine the threshold electric field'''\n",
"\n",
"#Variable declaration\n",
"f = 10*10**9 #operating frequency(Hz)\n",
@@ -102,9 +100,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine - \n",
"a)power gain in dB\n",
- "b) power gain as USB converter'''\n",
"\n",
"import math\n",
"\n",
@@ -154,10 +150,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate -\n",
"a)critical voltage\n",
"b)breakdown voltage\n",
- "c)breakdown electric field'''\n",
"\n",
"#Variable declaration\n",
"Es = 12.5 #relative dielectric constant\n",
@@ -208,7 +202,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate the avalanche zone velocity'''\n",
"\n",
"#Variable declaration\n",
"Na = 2.5*10**16 #doping concentration(/cm**3)\n",
@@ -246,7 +239,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' Determine the power gain'''\n",
"\n",
"#Variable declaration\n",
"Rd = -25 #negative resistance(Ohms)\n",
@@ -283,7 +275,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Find the minimum voltage required to initiate Gunn effect'''\n",
"\n",
"#Variable declaration\n",
"L = 5.*10**-6 #drift length(m)\n",
@@ -320,7 +311,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate rational frequency and critical voltage of diode'''\n",
"\n",
"#Variable declaration\n",
"Vd = 2*10**7 #drift velocity(cm/s)\n",
@@ -364,7 +354,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine resonant frequency and efficiency'''\n",
"\n",
"from math import pi,sqrt\n",
"\n",
@@ -412,9 +401,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine -\n",
"a)drift time\n",
- "b)operating frequency of IMPATT diode'''\n",
"\n",
"#Variable declaration\n",
"Vd = 10**5 #carrier dirft velocity(cm/s)\n",
@@ -457,9 +444,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate -\n",
"a)breakdown voltage\n",
- "b)breakdown electric field'''\n",
"\n",
"#Variable declaration\n",
"Er = 11.8 #relative dielectric constant\n",
@@ -505,10 +490,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate -\n",
"a)Maximum power gain\n",
"b)Noise figure\n",
- "c)Bandwidth'''\n",
"\n",
"import math\n",
"\n",
@@ -564,11 +547,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculate -\n",
"a)Equivalent noise resistance\n",
"b)Gain\n",
"c)Noise figure\n",
- "d)Bandwidth'''\n",
"\n",
"import math\n",
"\n",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch1.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch1.ipynb
index 48ad85eb..23e275b1 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch1.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch1.ipynb
@@ -27,38 +27,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate Mass Fraction, Mole fraction, Molality and PPM.\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"m_i = 10. #[g]\n",
"m_w = 990. #[g]\n",
"M_i = 342.3 #[g]\n",
"M_w = 18. #[g]\n",
"\n",
- "# Calculations\n",
- "# The mass fraction is \n",
- "# ( mass fraction of sucrose ) = x_i (by mass) = m_i/(sum of all subsmath.tances)\n",
"\n",
"x_i = m_i/(m_i+m_w)\n",
"x_i = x_i*100. # [in percentage]\n",
"\n",
- "# This is also the weight fraction.\n",
- "# The mole fraction is\n",
- "# ( mole fraction of sucrose ) = x_j (by mole) = n_i/(sum of number moles of all the subsmath.tances)\n",
"n_i = m_i/M_i # number of moles of sucrose\n",
"n_w = m_w/M_w # number of moles of water\n",
"x_j = n_i/(n_i+n_w)\n",
"x_j = x_j*100 # [in percentage]\n",
"\n",
- "# The molality, a concentration unit is widely used in equilibrium calculations, is defined as \n",
- "# m (molality) = (moles of solute)/(kg of solvent)\n",
"m = n_i/m_w*1000 #[molal]\n",
- "# For solutions of solids and liquids (but not gases) ppm almost always means ppm by mass, so \n",
"x_ppm = x_i*10**(6)/100. #[ppm]\n",
"\n",
- "# Results\n",
"print \" sucrose concentration in terms of the mass fraction is %f%%\"%(x_i)\n",
"print \" sucrose concentration in terms of the mole fraction is %f%%\"%(x_j)\n",
"print \" sucrose concentration in terms of the molality is %f molal\"%(m)\n",
@@ -92,36 +80,25 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate Mass concentration , Mole concentration and Molarity\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 20. #[C]\n",
"d = 1.038143/1000*10.**(6) #[kg/m**(3)]\n",
"m_i = 10. #[g] mass of sucrose\n",
"M_i = 342.3 #[g/mol] molecular weight of sucrose\n",
"\n",
- "# Calculations\n",
- "# In the previous example i.e. example 1.1 the mass was chosen to be 1.00 kg, so that\n",
"m = 1.00 #[kg]\n",
"V = m/d*1000 #[L]\n",
"\n",
- "# The mass concentration is\n",
- "# m_1 ( mass concentration of sucrose ) = (mass of sucrose)/(volume of solution)\n",
"m_1 = m_i/V #[g/L]\n",
"\n",
- "# The mole concentration is \n",
- "# m_2 ( mole concentration of sucrose ) = (moles of sucrose)/(volume of solution)\n",
"\n",
"m_2 = (m_i/M_i)/V #[mol/L]\n",
"\n",
- "# Results\n",
"print \" Mass concentration of the solution is %f g/L\"%(m_1)\n",
"print \" Mole concentration of the solution is %f mol/L\"%(m_2)\n",
"\n",
- "# By the definition of the molarity, molarity is mole concentration of the solute\n",
- "# so molarity \n",
"print \" Molarity of the solution is %f mol/L\"%(m_2)\n"
],
"language": "python",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch10.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch10.ipynb
index 0a0c51e7..d814a959 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch10.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch10.ipynb
@@ -36,36 +36,25 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 100. #[psia] Bubble point pressure\n",
"x_ethane = 0.10 # Mole fraction of ethane in liquid phase\n",
"x_hepmath_tane = (1-x_ethane)\n",
"\n",
- "# a) From figure 10.7( page 260 ) given in the book\n",
- "# We read the chart to get the bubble-point temperature\n",
- "# The dew point curve for 100 psia crosses the 10 mol% ethane line at about temperature \n",
"T1 = 165. #[C]\n",
- "# Now, we horizontally from that intersection point to the dew-point curve, finding the vapor phase composition of ethane \n",
"y1_e = 0.92\n",
"y1_h = (1- y1_e)\n",
"\n",
- "# b) By Raoult's law, we use a trial and error procedureon the temperature\n",
- "# Antoine equation consmath.tants for ethanol are given \n",
"A_e = 6.80267\n",
"B_e = 656.4028\n",
"C_e = 255.99\n",
"\n",
- "# and that for n-hepmath_tane are\n",
"A_h = 6.9024\n",
"B_h = 1268.115\n",
"C_h = 216.9\n",
"\n",
- "# Antoine equation is given by\n",
- "# (math.log10p) = (A - B/(T+C))\n",
"T = 50. #[C]\n",
"err = 1.\n",
" \n",
- "# Calculations\n",
"while err > 10**(-4):\n",
" p1_e = (10**(A_e - B_e/(C_e + T)))*(14.7/760)\n",
" p1_h = (10**(A_h - B_h/(C_h + T)))*(14.7/760)\n",
@@ -74,18 +63,11 @@
" err = abs((y2_e + y2_h) - 1)\n",
" T = T + 0.0001\n",
"\n",
- "# Changing the temperature in deg F \n",
"T2 = T*9./5 + 32 #[F] Bubble-point temperature\n",
"\n",
- "# c) In this method, we use L-R rule, instead of simple Raoult's law\n",
- "# So,\n",
- "# y_i = (x_i*p_i)/(v_i*P)\n",
- "# Where calculated values of v_i from EOS are given in the table 10.A and are \n",
"v_e = 0.950 # For ethane\n",
"v_h = 0.459 # For n-hepmath_tane\n",
"\n",
- "# We again use trial and error on the temperature\n",
- "# Let us assume the initial temperature \n",
"Ti = 50. #[C]\n",
"err = 1\n",
" \n",
@@ -97,10 +79,8 @@
" err = abs((y3_e + y3_h) - 1)\n",
" Ti = Ti + 0.0001\n",
"\n",
- "# Changing the temperature in deg F \n",
"T3 = Ti*9./5 + 32 #[F] Bubble-point temperature\n",
"\n",
- "# Results\n",
"print \" The results are summarized in the following table:\"\n",
"print \" Variable \\t Values calculated from\\t Values calculated from \\t Values calculated \"\n",
"print \" \\t from figure 10.7 \\t Raoult''s law \\t\\t\\t from L-R rule\"\n",
@@ -150,39 +130,25 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 800. #[psia] Bubble point pressure\n",
"x_ethane = 0.60 # Mole fraction of ethane in liquid phase\n",
"x_hepmath_tane = (1-x_ethane)\n",
"\n",
- "# a) From figure 10.7( page 260 ) given in the book\n",
- "# We read the chart to get the bubble-point temperature\n",
- "# The dew point curve for 800 psia crosses the 60 mol% ethane line at about temperature \n",
- "# T1 = 165\n",
- "# Now, we horizontally from that intersection point to the dew-point curve, finding the vapor phase composition of ethane \n",
- "# y1_e = 0.95\n",
- "# But, by linear interpolation in the experimental data on which Figure 10.7 is based we make a slightly more reliable estimate and get \n",
"T1 = 209. #[F]\n",
"y1_e = 0.945\n",
"y1_h = (1- y1_e)\n",
"\n",
- "# b) By Raoult's law, we use a trial and error procedureon the temperature\n",
- "# Antoine equation consmath.tants for ethanol are given \n",
"A_e = 6.80267\n",
"B_e = 656.4028\n",
"C_e = 255.99\n",
"\n",
- "# and that for n-hepmath_tane are\n",
"A_h = 6.9024\n",
"B_h = 1268.115\n",
"C_h = 216.9\n",
"\n",
- "# Antoine equation is given by\n",
- "# (math.log10p) = (A - B/(T+C))\n",
"T = 50. #[C]\n",
"err = 1.\n",
" \n",
- "# Calculations\n",
"while err > 10**(-4):\n",
" p1_e = (10**(A_e - B_e/(C_e + T)))*(14.7/760)\n",
" p1_h = (10**(A_h - B_h/(C_h + T)))*(14.7/760)\n",
@@ -191,18 +157,11 @@
" err = abs((y2_e + y2_h) - 1)\n",
" T = T + 0.0001\n",
"\n",
- "# Changing the temperature in deg F \n",
"T2 = T*9./5 + 32 #[F] Bubble-point temperature\n",
"\n",
- "# c) In this method, we use L-R rule, instead of simple Raoult's law\n",
- "# So,\n",
- "# y_i = (x_i*p_i)/(v_i*P)\n",
- "# Where calculated values of v_i from EOS are given \n",
"v_e = 0.6290642 # For ethane\n",
"v_h = 0.0010113 # For n-hepmath_tane\n",
"\n",
- "# We again use trial and error on the temperature\n",
- "# Let us assume the initial temperature \n",
"Ti = 10. #[C]\n",
"err = 1.\n",
" \n",
@@ -214,10 +173,8 @@
" err = abs((y3_e + y3_h) - 1)\n",
" Ti = Ti + 0.0001\n",
"\n",
- "# Changing the temperature in deg F \n",
"T3 = Ti*9./5 + 32 #[F] Bubble-point temperature\n",
"\n",
- "# Results\n",
"print \" The results are summarized in the following table:\"\n",
"print \" \\t Variable \\t\\t Values calculated from\\t Values calculated from Values calculated\"\n",
"print \" \\t\\t\\t\\t from figure 10.7 \\t Raoult''s law \\t\\t from L-R rule\"\n",
@@ -269,46 +226,29 @@
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
- "# The initial data for this example is same as that of example 10.2, i.e.\n",
"P = 800. #[psia] Bubble point pressure\n",
"x_e = 0.60 # Mole fraction of ethane in liquid phase\n",
"x_h = (1-x_e) # Mole fraction of n-hepmath.tane in the liquid phase\n",
"R = 0.08314 #( L*bar/(mol*K)) Universal gas consmath.tant \n",
"\n",
- "# Changing the pressure in bar\n",
"Pb = (800/14.7)*(1.01325) #[bar]\n",
"\n",
- "# In this problem we will denote ethane by 'e' and that to n-hepmath.tane by 'h'\n",
- "# From table A.1 ( page 417 ) given in the book, critical temperatures of ethane and hepmath.tane are \n",
"T_c_e = 305.3 #[K]\n",
"T_c_h = 540.2 #[K]\n",
"\n",
- "# and critical pressures are\n",
"P_c_e = 48.72 #[bar]\n",
"P_c_h = 27.40 #[bar]\n",
"\n",
- "# also the accentric facors are \n",
"w_e = 0.1\n",
"w_h = 0.35\n",
"\n",
- "# Thus we have\n",
"P_r_e = Pb/P_c_e\n",
"P_r_h = Pb/P_c_h\n",
"\n",
- "# Now from equations (F.13) and (F.14) ( page 459 ) given in the book we have\n",
- "# A_e = 0.42747 + ( 1 + (0.480 + 1.574*w_e - 0.17*w_e**(2))*( 1 - T_r_e**(0.5)))**(2)*(P_r_e/T_r_e**(2))\n",
- "# A_h = 0.42747 + ( 1 + (0.480 + 1.574*w_h - 0.17*w_h**(2))*( 1 - T_r_h**(0.5)))**(2)*(P_r_h/T_r_h**(2))\n",
- "# and\n",
- "# B_e = 0.08664*(P_r_e/T_r_e)\n",
- "# B_h = 0.08664*(P_r_h/T_r_h)\n",
"\n",
- "# We will take the help trial and error method both on Temperature and the vapor phase composition of ethane\n",
- "# Let us assume the starting temperature 200 deg F. Changing this temperature in K\n",
"T = (200-32)*5./9 + 273.15 #[K]\n",
"err = 1\n",
"\n",
- "# Calculations\n",
"while err > 10**(-4):\n",
" T_r_e = T/T_c_e\n",
" T_r_h = T/T_c_h\n",
@@ -353,15 +293,12 @@
" T = T + 0.1\n",
"\n",
"\n",
- "# Changing the temperature in deg F, we have \n",
"Tf = ( T - 273.15)*9./5 + 32 #[F]\n",
"\n",
- "# Results\n",
"print \" Bubble point of the given ethanol and n-hepmath.tane mixture at 800 psia is %f deg F\"%(Tf)\n",
"print \" Amount of ethanol in the vapour phase of the mixture at the given condition is %f \"%(y_e1)\n",
"print \" Amount of n-heptane in the vapour phase of the mixture at the given condition is %f \"%(y_h1)\n",
"\n",
- "# Answers may vary because of rounding error."
],
"language": "python",
"metadata": {},
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb
index fff7b6e8..24212b64 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch11.ipynb
@@ -27,31 +27,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The total number of the drops of the benznene required to saturate the water\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"V_water = 1. #[L] volume of the water\n",
"Temp = 25. #[C]\n",
"d_benzene = 0.88 #[g/ml] density of the benzene \n",
"M_benzene = 78. #[g/mol] molecular weight of the benzene\n",
"M_water = 18. #[g/mol]\n",
- "# Typically a buret will deliver about 20 drops of lliquid per millimeter, so moles of benzene in one drop is\n",
"\n",
- "# Calculations\n",
"n_1drop = 1./20*(d_benzene/M_benzene) #[mol/drop] \n",
"\n",
- "# No of moles in 1 litre of the water is \n",
"n_water = 1000./M_water #[mol]\n",
- "# Because 1 litre = 1000 g\n",
- "# Now from the table 11.1 (page 273), at the saturated condition at the temperature 25C, solubility of benzene in the water is\n",
"s_benzene = 0.000405\n",
"n_benzene_saturate = s_benzene*n_water #[mol]\n",
- "# Thus no of the drops of the benzene is\n",
"N_benzene = n_benzene_saturate/n_1drop #[drops]\n",
"\n",
- "# Results\n",
"print \"The total number of the drops of the benznene required to saturate the water is %0.0f drops\"%(N_benzene)\n"
],
"language": "python",
@@ -79,29 +70,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The amount of the ground water \n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"m_benzene = 1000. #[lbm]\n",
"M_benzene = 78. #[lbm/lbmol]\n",
- "# The total moles benzene are \n",
"n_benzene = m_benzene/M_benzene #[lbmol]\n",
- "# To saturate the water with benzene \n",
- "# the mole fraction of the benzene in the water will be \n",
"x_benzene = 0.000405\n",
- "# and \n",
- "# n_benzene = x_benzene*n_T\n",
- "# in this case n_benzene << n_water, so n_T = n_water\n",
- "# Thus\n",
- "#n_benzene = x_benzene*n_water\n",
"\n",
- "# Calculations\n",
"n_water = n_benzene/x_benzene #[lbmol]\n",
"m_water = n_water*18 #[lbm] \n",
"\n",
- "# Results\n",
"print \"The amount of the ground water that will make a saturated solution will be %e lbm\"%(m_water)\n"
],
"language": "python",
@@ -137,32 +116,23 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 25. #[C]\n",
"n_water = 3.75 #[mol]\n",
"n_ethanol = 2.5 #[mol]\n",
"n_benzene = 3.75 #[mol]\n",
"\n",
- "# By the simple stoichiomtetry the overall mole fractions are \n",
"x_water = 0.375\n",
"x_ethanol = 0.250\n",
"x_benzene = 0.375\n",
"\n",
- "# Calculations\n",
- "# We locate the point corresponding to this concentration on the diagram 11.1 (page 277), by drawing any two of the three straight lines corresponding to those mole fractions.\n",
- "# We find that the point falls almost exactly on the fifth tie line from the top.\n",
- "#For this the end-point values are read from the table 11.4 ( page 276 ), which is fifth row from the bottom \n",
- "# Thus in water reach phase we have the composition as\n",
"x_water_w = 64.9 #[%]\n",
"x_ethanol_w = 31.75 #[%]\n",
"x_benzene_w = 3.37 #[%]\n",
"\n",
- "# and in the benzene reach phase composition is \n",
"x_water_b = 6.43 #[%]\n",
"x_ethanol_b = 18.94 #[%]\n",
"x_benzene_b = 74.62 #[%]\n",
"\n",
- "# Results\n",
"print \"The composition of the two equilibrium phases i.e. water-reach phase and benzene reach phase is as \"\n",
"print \"\\t\\t\\t\\tWater-reach phase\\t\\tbenzene-reach phase\"\n",
"print \"Mol water\\t\\t\\t%f\\t\\t\\t\\t%f\"%(x_water_w,x_water_b)\n",
@@ -205,34 +175,20 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 25. #[C]\n",
- "# Here we assume benzene to be component 1 and water to be componenet 2\n",
- "# From table 11.1 given in the book(page 273) \n",
- "# The mole fraction of benzene in water is\n",
"x_1in2 = 405. #[ppm]\n",
- "# and the mole fraction of water in benzene is \n",
"x_2in1 = 3000. #[ppm]\n",
"\n",
- "# Calculations\n",
- "# Thus mole fraction of water in water rich phase is\n",
"x_water_w = (10**(6)-405.)/(10**(6))\n",
"x_benzene_w = 1-x_water_w\n",
"\n",
- "# and mole fraction of the benzene in benzene rich phase is\n",
"x_benzene_b =(10.**(6.)-3000.)/(10**(6))\n",
"x_water_b = 1-x_benzene_b\n",
"\n",
- "# Here both x_water and x_benzene are nearly equal to 1\n",
- "# Thus assumption used for derivation of the equation 11.4(page 282) are suitable here and the equation is \n",
- "# x_i_1 = y_i_1 , where y_i_1 is activity coefficient\n",
"\n",
- "# So activity coefficient of benzene in water is\n",
"y_benzene = 1/(x_benzene_w)\n",
- "# and activty coefficient of the water in benzene is\n",
"y_water = 1/(x_water_b)\n",
"\n",
- "# Results\n",
"print \" Activity coefficient of benzene in water is %f\"%(y_benzene)\n",
"print \" Activity coefficient of water in benzene is %f\"%(y_water)\n"
],
@@ -262,7 +218,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Draw Gibb's free energy vs mole fractions\n",
"\n",
"import math \n",
"from numpy import * \n",
@@ -270,13 +225,11 @@
"\n",
"%pylab inline\n",
"\n",
- "# Variables\n",
"R = 8.314 #[J/(mol*K)] Universal gas consmath.tant\n",
"T = 298.15 #[K] Temperature\n",
"g_a_0 = 2. #[kj/mol] Gibb's free energy of the pure species 'a'\n",
"g_b_0 = 1. #[kj/mol] Gibb's free energy of the pure species 'b'\n",
"\n",
- "# Calculations\n",
"for a in range(4):\n",
" def f(x): \n",
" return x*g_a_0 + (1-x)*g_b_0 + (R*T)/1000*(x*log(x) + (1-x)*log(1-x) + x*a*(1-x)**(2) + (1-x)*a*(x)**(2))\n",
@@ -294,7 +247,6 @@
"suptitle(\"Calculated values of the molar Gibbs energy of a binary mixture at 25 \u0014 C, assuming \\\n",
"the symmetrical activity coefficient equation, with various values of A.\")\n",
"\n",
- "# Results\n",
"show()\n",
"print \" The plot is shown in the graphic window.\"\n"
],
@@ -346,30 +298,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Draw two liquid phase\n",
"\n",
"import math \n",
"from matplotlib.pyplot import *\n",
"from numpy import *\n",
"\n",
"\n",
- "# Variables\n",
"T = 92 + 273.15 #[K] Temperature of the system\n",
"R = 8.314 #[m**(3)*Pa/(mol*K)] universal gas consmath.tant\n",
"\n",
- "# Van Laar equation coefficients are given\n",
"A = 1.2739\n",
"B = 3.9771\n",
"\n",
- "# From van laar equation, for water, we have\n",
- "# lnY_a = B**(2)*A*(1-x_a)**(2)/(A*x_a + B*(1-x_a))**(2)\n",
- "# Similarily for n-bumath.tanol\n",
- "# lnY_b = A**(2)*B*x_a**(2)/(A*x_a + B*(1-x_a))**(2)\n",
"\n",
- "# Let us say, g = g_mix - sum(x_i*g_i_0)\n",
- "# So, plotting g vs x_i we have\n",
"\n",
- "# Calculations\n",
"def f(x_a): \n",
"\t return (R*T/1000)*( x_a*log(x_a) + (1-x_a)*log(1-x_a) + \\\n",
" x_a*(B**(2)*A*(1-x_a)**(2)/(A*x_a + B*(1-x_a))**(2)) + (1-x_a)* \\\n",
@@ -378,23 +320,15 @@
"x_a = linspace(0.000001,0.99999,100)\n",
"a = f(x_a)\n",
"plot(x_a,a)\n",
- "#xlabel(\" Mol fraction of species a, x_a\")\n",
- "#ylabel(\" g_mix - sum(x_i*g_i0)\")\n",
"\n",
- "# Now drawing math.tangent \n",
- "#x = linspace(0.000001,0.99999,100)\n",
"x = linspace(0.0,0.99999,100)\n",
"a = 1.2090312*x-1.251495764\n",
- "#plot(x,a)\n",
"plot(x,1.2090312*x-1.251495764)\n",
"xlabel(\" Mol fraction of species a, x_a\");\n",
"ylabel(\" g_mix - sum(x_i*g_i0)\");\n",
"\n",
"show()\n",
"\n",
- "# Results\n",
- "# Figure shows the results of the calculation of the whole range of x_a \n",
- "# Drawing the math.tangent to the curve, the line touches the curve at two points x_a = 0.47 and 0.97\n",
"print \"Thus based on the several assumptions that the Van Laar equation is an accurate representation of LLE\"\n",
"print \"we would conclude that at 92 deg C water-n-butanol does form two liquid phases.\"\n",
"\n"
@@ -440,26 +374,14 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"R = 8.314 #[J/(ml*K)]\n",
- "# We find that the water in benzene least squares fit line has the equation \n",
- "# math.log(x_water(benzene-reach phase)) = 4.175-2967.7/T\n",
"\n",
- "# equation 11.7 in the book (page 286) is \n",
- "# math.log(x_i_1) = (h_i_0-h_i_average)/(RT) + consmath.tant of integration\n",
"\n",
- "# Comparing the two equations term by term, we have\n",
"\n",
- "# Calculations\n",
- "# (h_i_0-h_i_average)/(RT) = -2967.7/T\n",
- "# let us say (h_i_0-h_i_average) = h_mix\n",
- "# So that \n",
"h_mix = -2967.7*R/1000 #[kJ/mol] Heat of mixing of water-in-benzene\n",
"\n",
- "# Now, for benzene-in-water the consmath.tant in the above equation is -522.9K, so\n",
"h_mix_1 = 522.9*R/1000 #[kJ/mol] Heat of mixing of benzene-in-water\n",
"\n",
- "# Results\n",
"print \" Heat of mixing of water-in-benzene is given as %f kJ/mol\"%(h_mix)\n",
"print \" Heat of mixing of benzene-in-water is given as %f kJ/mol\"%(h_mix_1)\n"
],
@@ -489,30 +411,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The amount of water that will come out of the solution in the gasoline\n",
"import math \n",
"\n",
- "# Variables\n",
"T_i = 50. #[F] Initial temperature of the system \n",
"T_f = 20. #[F] Final temperature of the system\n",
"M_gas = 115. #[g/mol] Molecular weight of gasoline at room temperature\n",
"M_water = 18. #[g/mol] Molecular weight of water at the room temperaature\n",
"d = 720. #[g/L] density of gasoline at the room temperature\n",
"\n",
- "# From Figure 11.10 ( page 288 ), solubility of the water in gasoline ( similar to solubility of water in cyclohexane ) at 50 deg F is given as \n",
"s_50 = 0.00026 #[mol fraction]\n",
"\n",
- "# And linearly extraploting the cyclohexane curve in figure 11.10 to 20 deg F, we get the solubility of water at 20deg F as \n",
"s_20 = 0.0001 #[mol fraction]\n",
"\n",
- "# Calculations\n",
- "# So, rejected water is\n",
"s_rej = s_50 - s_20 # mol of water per mole of gasoline \n",
"\n",
- "# In terms of weight, rejected water will be\n",
"w = (s_rej*d*M_water)/M_gas #[g water/L gasoline]\n",
"\n",
- "# Results\n",
"print \" The amount of water that will come out of the solution in the gasoline will be %f g water/L gasoline\"%(w)\n",
"print \" At 20 deg F we would expect this water to become solid ice, forming a piece large enough to plug the fuel line of a parked auto.\"\n"
],
@@ -552,47 +466,30 @@
"from matplotlib.pyplot import *\n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 25. #[C]\n",
"x_water = 5. #[mo]\n",
"x_benzene = 0.1 #[mol]\n",
"\n",
- "# The fugacity of the ethanol must be same in both phases so that we have distribution coefficient \n",
"\n",
- "# K = ( distribution coefficient ) = x_ethanol(water_rich phase)/x_ethanol(benzene-rich phase) = y_ethanol(benzene-rich phase)/y_ethanol(water-rich phase)\n",
- "# Here distribution coefficient is defined as rhe ratio of mole fractions of the distributed solute between the two phases.\n",
"\n",
- "# We observe that for the first experimental data set in table 11.4 in the book(page 276)\n",
"x_ethanol_water_rich = 3.817 #[%]\n",
"x_ethanol_benzene_rich = 1.010 #[%]\n",
"\n",
- "# So \n",
"K = x_ethanol_water_rich/x_ethanol_benzene_rich\n",
"\n",
- "# Calculations\n",
- "# Now for all the data set in the table 11.4 in the book(page 276), we wiil draw a plot \n",
"X = array([3.817,7.968,12.977,18.134,23.540,24.069,27.892,31.725,35.510,39.382,41.062,41.771])\n",
"Y = array([1.010,3.323,5.860,9.121,12.939,13.340,16.090,18.943,22.444,26.216,29.341,33.093])\n",
"Z = X/Y\n",
"\n",
- "# Plotting the graph between 'Z' and 'Y' \n",
"plot(Y,Z)\n",
"xlabel(\"Mol% ethanol in benzene-rich phase \");\n",
"ylabel(\"Distribution coefficient of ethanol, K_ethanol\");\n",
- "#xgrid()\n",
- "#xlabel(\"Mol% ethanol in benzene-rich phase \")\n",
- "#ylabel(\"Distribution coefficient of ethanol, K_ethanol\")\n",
"show()\n",
- "# We see from the plot that at the low mole percent of ethanol , the distribution coefficient is approximately \n",
"K_1 = 4\n",
"\n",
- "# Thus ratio of the amount of the ethanol distributed in the two phases will be 4\n",
- "#the amount in mol % is \n",
- "# for water rich phase \n",
"m_water_rich = 100*K_1/(K_1+1)\n",
"m_benzene_rich = 100/(K_1+1)\n",
"\n",
- "# Results\n",
"print \" Ethanol''s 0.1 mol distributed in the water rich phase will be %f mol%% of the total mol\"%(m_water_rich)\n",
"print \" Ethanol''s 0.1 mol distributed in the benzene rich phase will be %f mol%% of the total mol\"%(m_benzene_rich)\n"
],
@@ -638,25 +535,17 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 20. #[C]\n",
- "# At this temperature solubility of NaCl is \n",
"s = 36.0 #[g per 100 g of water]\n",
"M_NaCl = 58.5 #[g/mol] molecular weight of NaCl \n",
"M_water = 18. #[g/mol] molecular weight of water\n",
"\n",
- "# Calculations\n",
- "# weight fraction of NaCl\n",
"w = s/(s+100)\n",
- "# In weight percentage \n",
"w_percent = w*100 #[wt %]\n",
"\n",
- "# Mol fraction of the NaCl\n",
"x = (s/M_NaCl)/((s/M_NaCl)+(100/M_water))\n",
- "# In mol percentage\n",
"x_percent = x*100 #[mol %]\n",
"\n",
- "# Results\n",
"print \" Weight fraction of the NaCl in the saturated solution is %0.1f wt %%\"%(w_percent)\n",
"print \" Mol fraction of the NaCl in the saturated solution is %0.0f mol %%\"%(x_percent)\n",
"\n",
@@ -696,26 +585,19 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T_inlet = 68. #[F]\n",
"T_outlet = 110. #[F]\n",
"\n",
- "# from the figure 11.13 we read that at 68F the solubility of CaCO3 and CaSO4.2H2O are \n",
"s_inlet_carbonate = 60. #[ppm]\n",
"s_inlet_sulphate = 2020. #[ppm]\n",
"\n",
- "# At 110F the solubility of the CaCO3 is \n",
"s_outlet_carbonate = 30. #[ppm]\n",
- "# at 110F the least soluble form of the CaSO4 is anhydride with the solubility \n",
"s_outlet_sulphate = 2000. #[ppm]\n",
" # This is close enough to the solubility of the gypsum at 68F \n",
" # so we conclude that we would not expect either form of CaSO4 to prdcipitate\n",
" \n",
- "# Calculations\n",
- "# Thus total amount of the calcium carbonate which will cime out of the solution and will remain in the heater will be \n",
"w = s_inlet_carbonate - s_outlet_carbonate #[ppm]\n",
"\n",
- "# Results\n",
"print \" Total amount of the solid left behind in the heater will be %0.1f ppm\"%(w)\n",
"\n",
" # Now if a typical houshold water heater heats 100 gallons/per day , we would expect to deposite \n",
@@ -756,25 +638,14 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"x_2 = 0.1\n",
- "#y_i_1 = (x_i__ideal /x_i_1) , at consmath.tant temperature\n",
- "# From figures 11.15 and 11.16 given in the book (page 298-299) ( or the equations of the lines on those figures, presented in [14] ) we can compute the values in Table 11.6\n",
- "# We see that at x_solute = 10% \n",
- "# T_m/T for the solution in benzene at which math.log(x_experimental) = -1 is equal to 1.332\n",
- "# and that for the solution in CCl4 is equal to 1.288\n",
- "#Now at the that value of the T_m/T \n",
"x_ideal_benzene = 0.114\n",
"x_ideal_CCl4 = 0.152\n",
"\n",
- "# Calculations\n",
- "# In benzene the average these compounds is\n",
"y_i_1 = x_ideal_benzene/x_2# corresponding to practically ideal solution\n",
"\n",
- "# and in benzene the average of these compounds is \n",
"y_i_2 = x_ideal_CCl4/x_2# corresponding to mild type II behavior \n",
"\n",
- "# Results\n",
"print \" Activity coefficient in benzene corresponding to practically ideal solution is %0.2f\"%(y_i_1)\n",
"print \" Activity coefficient in CCl4 corresponding to mild type II behavior is %0.2f\"%(y_i_2)\n"
],
@@ -804,30 +675,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The solubility of the NaCl in water\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 273.15+20 #[K]\n",
"\n",
- "# The equation 11.15 (page 297) is given by \n",
- "# log(1/(x_i_1*y_i_1)) = math.log(p_i_solid_phase/p_i_subcooled_liquid) = delta_h_solid_to_liquid/(R*T_melting_point)*(T_melting_point/T-1)\n",
- "# Ignoring the moment the wild extraplation involved, we simply insert the appropriate values\n",
"T_m = 273.15+800 #[K]\n",
"delta_h_fusion = 30219. #[J/g]\n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# Calculations\n",
- "# Let log(1/(x_i_1*y_i_1)) = a\n",
"a = delta_h_fusion/(R*T)*(T_m/T-1)\n",
"\n",
- "# Now \n",
"x_NaCl_into_y_i_1 = 1/math.exp(a)\n",
"\n",
- "# If we make the plausible assumption that y_i_1 = 1.00, then\n",
"x_NaCl = 1/math.exp(a)*1\n",
"\n",
- "# Results\n",
"print \" The solubility of the NaCl in water at 20 deg C is %e \"%( x_NaCl)\n",
"print \" But the experimental value is 0.1 so Similar to the results in book our results are very far wrong\"\n"
],
@@ -857,24 +718,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Equilibrium concentration of water vapour\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 1*14.7 #[psia]\n",
"T = 30. #[F]\n",
- "#******#\n",
- "#The vapour pressure of ice at 30F is 0.0808 psia i.e.\n",
"p_ice = 0.0808 #[psia]\n",
- "# We may assume that the solubility of nitrogen and oxygen in solid ice is negligible\n",
- "#Thus\n",
"x_water_in_ice = 1.00\n",
- "#and thus use Raoult's law,finding\n",
"\n",
- "# Calculations\n",
"y_water_vapour = x_water_in_ice*p_ice/P\n",
"\n",
- "# Results\n",
"print \" Equilibrium concentration of water vapour in the air is %0.4f\"%(y_water_vapour)\n"
],
"language": "python",
@@ -902,35 +754,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Estimated solubility of naphthalene in CO2\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 273.15+35 #[K]\n",
"p_d = 100. #[atm]\n",
"R = 82.06 #[(cm**(3)*atm)/(mol*K)]\n",
"\n",
- "#The calculated vapour pressure of naphthalene at 35C is\n",
"p_naphthalene = 0.00065 #[atm]\n",
"\n",
- "#The solid is practically pure naphthalene\n",
"x_naphthalene = 1.00\n",
- "#Total pressure \n",
"P = p_d\n",
"\n",
- "# Calculations\n",
- "#By Raoult's law\n",
"y_naphthalene = x_naphthalene*p_naphthalene/P\n",
- "#At this high a pressure the volume of solid naphthalene is\n",
"v = 132. #[cm**(3)/mol]\n",
- "# We have equation math.log(f_d/f_c) = v/(R*T)*(p_d-p_c)\n",
"p_c = 1. #[atm]\n",
"f_d_by_f_c = math.exp(v/(R*T)*(p_d-p_c))\n",
- "#and the estimated\n",
"y_naphthalene = f_d_by_f_c*y_naphthalene\n",
"\n",
- "# Results\n",
"print \"Estimated solubility of naphthalene in CO2 is %e\"%(y_naphthalene)\n",
"\n"
],
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch12.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch12.ipynb
index 1f171743..dece46d0 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch12.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch12.ipynb
@@ -27,37 +27,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The chemical equilibrium composition of the gaseous mixture contains\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 298.15 #[K] temperature\n",
"P = 1. #[atm] pressure \n",
"R = 8.314*10**(-3) #[kJ/(mol*K)]\n",
"\n",
- "# Calculations\n",
- "# For an ideal binary solution the Gi# Calculationss free energy is given by\n",
- "# g_mix = summation(x_i*g_i_0) + R*T*summation(x_i*math.log(x_i))\n",
- "# Differentiating the above equation with respect to x_a , remembering that for a binary mixture dx_b = dx_a, finding\n",
"\n",
- "# dg_mix/dx_a = g_a_0-g_b_0+R*T*[math.log(x_a)+1-(math.log(x_b)+1)]\n",
- "# and x_a+x_b = 1\n",
- "# so\n",
- "# dg_mix/dx_a = g_a_0-g_b_0+R*T*[math.log(x_a/(1-x_a))]\n",
"\n",
- "# setting up this equal to zero ( to find the minimum on the g-x curve ) and solving gives\n",
- "# x_a/(1-x_a) = exp((g_b_0-g_a_0)/(R*T))\n",
"\n",
- "# From the table A.8 (page 427) reported in the book, pure component Gibbs free energies for isobumath.tane,a,and n-bumath.tane,b, we find\n",
"g_a_0 = -20.9 #[kJ/mol]\n",
"g_b_0 = -17.2 #[kJ/mol]\n",
"\n",
- "# Now solving the above equation for x_a, we have\n",
"x_a = math.exp((g_b_0-g_a_0)/(R*T))/(1+math.exp((g_b_0-g_a_0)/(R*T)))\n",
"x_b = 1-x_a\n",
"\n",
- "# Results\n",
"print \" The chemical equilibrium composition of the gaseous mixture contains %f mol fraction isobutane \\t\\t\\t\\t\\t\\t\\t\\tan %f mol fraction n-bumath.tane\"%(x_a,x_b)\n"
],
"language": "python",
@@ -94,57 +79,36 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 298.15 #[K] temperature\n",
"P = 0.987 #[atm] pressure\n",
"g_0_NO = 86.6 #[kJ/mol] Free energy of formation the NO from elements\n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# And the corresponding values for the elements N2 and O2 are\n",
"g_0_O2 = 0.00\n",
"g_0_N2 = 0.00\n",
"\n",
- "# The reaction of the nitrogen and oxygen to form nitric oxide at 298.15 K is\n",
- "# N2 + O2 = NO\n",
"\n",
- "# Calculations\n",
- "# Here \n",
"delta_g_0 = 2*g_0_NO - g_0_O2 - g_0_N2 #[kJ/mol]\n",
- "# Changing in the J/mol \n",
"delta_g_01 = delta_g_0*1000 #[J/mol]\n",
"\n",
- "# hence \n",
"K_298 = math.exp((-delta_g_01)/(R*T))\n",
"\n",
- "# The activities are all \n",
- "# a_i = f_i/f_i_0\n",
- "# f_i_0 correspond to the smath.radians(numpy.arcmath.tan(ard state, which for gas at idael gas state are \n",
"f_0_N2 = 1. #[bar]\n",
"f_0_O2 = 1. #[bar]\n",
"f_0_NO = 1. #[bar]\n",
"\n",
- "# If we make the most general statement of the activities (for gases ) we would have\n",
- "# a_i = y_i*v_i*Y_i*P/f_i_0 = y_i*phi*P/f_i_0\n",
"\n",
- "# At this low pressure we may safely asssume that the NO,O2 and N2 behave as ideal gases for which v_i*Y_i = phi = 1.00 and substituting these we find\n",
- "# K_298 = [a_NO]**(2)/([a_N2]*[a_O2]) = [y_NO]**(2)/([y_N2]*[y_O2])\n",
"\n",
- "# Now umath.sing this equilibrium consmath.tant we can calculare he equilibrium concentratin of NO in the air sample in which \n",
- "#oxygen = 21%, nitrogen = 78% and argon = 1% ,so\n",
"y_N2 = 0.78\n",
"y_O2 = 0.21\n",
"\n",
- "# Hence From above expression, we have\n",
"y_NO_298 = math.sqrt(K_298*y_N2*y_O2)\n",
"\n",
- "# Making the similar calculations for the temperature 2000 K, we have\n",
"T_1 = 2000 #[K]\n",
"K_2000 = 4.0*10**-4\n",
"\n",
- "# So,\n",
"y_NO_2000 = math.sqrt(K_2000*y_N2*y_O2)*10**(6) #[ppm]\n",
"\n",
- "# Results\n",
"print \" The equilibrium constant for the reaction at 298.15 K is \\t\\t\\t %.1e\"%(K_298)\n",
"print \" The concentration of NO at equilibrium at temperature 298.15 K is \\t\\t %.1e\"%(y_NO_298)\n",
"print \" The equilibrium consmath.tant for the reaction at 2000 K is \\t\\t\\t %.1e\"%(K_2000)\n",
@@ -178,39 +142,23 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The calculated NO cocentration\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 2000. #[K]\n",
"n_air = 1. #[mol] no of moles of the air\n",
"\n",
- "# Let the moless of the NO formed be 2*x\n",
- "# Then at equilibrium the unreacted moles of the N2 and O2 will be (0.78-x) and (0.21-x) respectively\n",
"\n",
- "# Calculations\n",
- "# from the previous example, we have \n",
- "# [y_NO]**(2) = K_298*[y_N2]*[y_O2]\n",
- "# here \n",
"K_2000 = 4*10**(-4)\n",
- "# Substituting all the values, we have \n",
- "# (2*x)**(2) = K_2000*(0.78-x)*(0.21-x)\n",
"\n",
- "#Now \n",
"def f(x): \n",
"\t return (2*x)**(2) - K_2000*(0.78-x)*(0.21-x)\n",
- "#def f(x): \n",
"\t #return (K_2000-2)*x**(2)-K_2000*(0.78+0.21)*x+K_2000*0.78*0.21\n",
"x = fsolve(f,0)\n",
- "# Here negative root is meaningless,so\n",
- "# concentration of NO\n",
"c_NO = 2*x*10**(6) #[ppm]\n",
- "# now\n",
"p = c_NO/8100.*100\n",
"\n",
- "# Results\n",
"print \" The calculated NO cocentration is %f ppm, which %f%% of the value computed in example 12.1\"%(c_NO,p)\n"
],
"language": "python",
@@ -248,7 +196,6 @@
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 298. #[K]\n",
"K = 29.6 # equilibrium consmath.tant at 298 K \n",
"P = 1. #[bar]\n",
@@ -256,23 +203,17 @@
"n_ethylene_0 = 1. #[mol]\n",
"n_ethanol_0 = 0. #[mol]\n",
"\n",
- "# Calculations\n",
"n_T_0 = (n_water_0+n_ethylene_0+n_ethanol_0) #[mol]\n",
"\n",
- "# From the previous example, we have \n",
- "# [(0+e)/(1.833-e)]/([(1-e)/(1.833-e)]*[(0.833-e)/(1.833-e)]) = K*P/(1 bar)\n",
- "# let y = [(0+e)/(1.833-e)]/([(1-e)/(1.833-e)]*[(0.833-e)/(1.833-e)])- K*P/(1 bar)\n",
"def f(e): \n",
"\t return ((0+e)/(1.833-e))/(((1-e)/(1.833-e))*((0.833-e)/(1.833-e)))-K*P/(1)\n",
"e_1 = fsolve(f,0)\n",
"e_2 = fsolve(f,0.5)\n",
"\n",
- "# Here the root 'e_2' is meaningless, Then \n",
"y_ethanol = ((0+e_2)/(1.833-e_2))\n",
"y_ethylene = ((1-e_2)/(1.833-e_2))\n",
"y_water = ((0.833-e_2)/(1.833-e_2))\n",
"\n",
- "# Results\n",
"print \"Concentration of the ethylene at the equilibrium is %f\"%(y_ethylene)\n",
"print \" Concentration of the water at the equilibrium is %f\"%(y_water)\n",
"print \" Concentration of the ethanol at the equilibrium is %f\"%(y_ethanol)\n"
@@ -313,55 +254,28 @@
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 273.15+25 #[C]\n",
"P = 1. #[bar]\n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# We have the reaction as \n",
- "# H2 + 0.5O2 = H2O\n",
- "# Using values of the Gibbs free energies of formation in the Table A.8(page 427) we have\n",
"g_H2O_0 = -237.1 #[kJ/mol]\n",
"g_O2_0 = 0 #[kJ/mol]\n",
"g_H2_0 = 0 #[kJ/mol]\n",
"\n",
- "# Calculations\n",
- "# now\n",
"delta_g_0 = g_H2O_0 - 0.5*g_O2_0-g_H2_0 #[kJ/mol]\n",
- "# expresmath.sing delta_g_0 in [J/mol] \n",
"delta_g_1 = delta_g_0*1000 #[J/mol]\n",
"\n",
- "# and \n",
"K = math.exp((-delta_g_1)/(R*Temp))\n",
- "# And we have \n",
- "# K = [a_H2O]/([a_H2]*[a_O2]**(0.5))\n",
- "# Here we will again assume as in the previous example that we have an ideal solution of the ideal gases for which in equation 12.18 (page 320),we have \n",
- "# v_i*Y_i = phi = 1.00 , and that for each reacmath.tant or product f_i_0 = 1 bar, putting all the values and simplifying \n",
- "\n",
- "# K = [y_H2O]/([y_H2]*[y_O2]**(0.5))*((1 bar)/P)**(0.5)\n",
- "# Choomath.sing oxygen as the selected reacmath.tant, and assuming that we begin with 0.5 mol of oxygen and 1 mol of hydrogen,\n",
- "# we have the stoichiometric coefficients of -1, -0.5 and +1 \n",
- "# and \n",
+ "\n",
"n_T_0 = 1.5#[mol]\n",
- "# Also summation(v_i) = -0.5\n",
"\n",
- "# Thus \n",
- "# K = [e/(1.5-0.5*e)]/([(1-e)/(1.5-0.5*e)]*[(0.5-0.5*e)/(1.5-0.5*e)]**(0.5))\n",
"\n",
- "# Now \n",
"def f(e): \n",
"\t return (e/(1.5-0.5*e))/(((1-e)/(1.5-0.5*e))*((0.5-0.5*e)/(1.5-0.5*e))**(0.5))\n",
- "# e = fsolve(f,.99999)\n",
- "# e = (1-2.4e-28)\n",
"\n",
- "# So the equilibrium concentration of the hydrogen and oxygen are as\n",
- "# y_H2 = [(1-e)/(1.5-0.5*e)]\n",
- "# y_O2 = [(0.5-0.5*e)/(1.5-0.5*e)]\n",
- "# These values are so less that scilab consol is print laying them zero, however we get\n",
"y_H2 = 2.4e-28\n",
"y_O2 = 0.5*y_H2\n",
"\n",
- "# Results\n",
"print \" The equilibrium mol fraction of the hydrogen is %0.3e\"%(y_H2)\n",
"print \" And the equilibrium mol fraction of the oxygen is %e \"%(y_O2)\n"
],
@@ -399,20 +313,14 @@
"import math \n",
"from scipy.integrate import quad \n",
"\n",
- "# Variables\n",
"Temp = 298.15 #[K]\n",
"Press = 1*10**(5) #[Pa]\n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# Calculations\n",
- "# We will calculate the free energy change from liquid to hypothetical gas in three steps\n",
- "# 1) The liquid is reduced in pressure from the smath.radians(numpy.arcmath.tan(ard pressure of 1 bar to its vapour pressure at 298.15K and for this cange in the state we have \n",
"v_liquid = 1.805*10**(-5) #[m**(3)/mol] this liquid specific volume and we will treat is as a consmath.tant\n",
"\n",
- "# The vapour preesure of the water 25C is given as\n",
"P_vapour_25 = 0.0317*10**(5) #[Pa]\n",
"\n",
- "# thus change in the Gibbs free energy is \n",
"\n",
"def f0(P): \n",
"\t return v_liquid*P**(0)\n",
@@ -420,12 +328,8 @@
"delta_g_0_1 = quad(f0,Press,P_vapour_25)[0]\n",
"\n",
"\n",
- "# 2) In the second step the liquid is vaporized at that pressure, for which\n",
"delta_g_0_2 = 0 #[J/mol]\n",
- "# because this is an equilibrium vaporization.\n",
"\n",
- "# 3) And in this last step the vapour is replaced by an ideal gas, which will not condence, and compressed from the vapour pressure at 298.15K to 1 bar\n",
- "# In this case the specific volume v_ideal of the ideal gas is replaced by the ideal gas law viz. (R*T)/P\n",
"\n",
"def f1(P): \n",
"\t return 1./P\n",
@@ -433,18 +337,13 @@
"delta_g_0_3 = (R*Temp)* quad(f1,P_vapour_25,Press)[0]\n",
"\n",
"\n",
- "# Thus total change in free energy is \n",
"delta_g_0 = delta_g_0_1+delta_g_0_2+delta_g_0_3 #[J/mol]\n",
- "#expresmath.sing the result in kJ/mol\n",
"delta_g_1 = delta_g_0/1000 #[kJ/mol]\n",
"\n",
- "# Results\n",
"print \" Total change in the free energy of water going under given conditions is %0.2f kJ/mol\"%(delta_g_1)\n",
"\n",
- "# From Table A.8 we find \n",
"delta_g_0_ideal_gas = -228.6 #[kJ/mol]\n",
"delta_g_0_liquid = -237.1 #[kJ/mol]\n",
- "# So \n",
"delta_g_o = delta_g_0_ideal_gas-delta_g_0_liquid #[kJ/mol]\n",
"\n",
"print \" From the values of Table A.8 given in the book the free energy change is %0.2f kJ/mol\"%(delta_g_o)\n"
@@ -475,40 +374,28 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Equilibrium constants for the formation of ammonia from hydrogen and nitrogen are\n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
- "# Variables\n",
"T1 = 273.15+25 #[K]\n",
"T2 = 273.15+400 #[K]\n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# Umath.sing the table A.8, we have\n",
- "# Gibb's free energy of the various species at 298.15 K are\n",
"g0_NH3 = -16.5 #[kJ/mol]\n",
"g0_N2 = 0 #[kJ/mol]\n",
"g0_H2 = 0 #[kJ/mol]\n",
"\n",
- "# We have the reaction as \n",
- "# 0.5N2 + 1.5H2 = NH3\n",
"\n",
- "# Calculations\n",
- "# So, Gibb's free energy change in the reaction is given as \n",
"delta_g_0 = g0_NH3 - 0.5*g0_N2 - 1.5*g0_H2 #[kJ/mol]\n",
"\n",
- "# and\n",
"K_1 = math.exp(-delta_g_0*1000/(R*T1)) # Equilibrium consmath.tant of the reaction at temperature 298.15 K\n",
"\n",
- "# Similarly enthalpy of the various species are \n",
"h0_NH3 = -46.1 #[kJ/mol]\n",
"h0_N2 = 0 #[kJ/mol]\n",
"h0_H2 = 0 #[kJ/mol]\n",
"\n",
- "# So, enthalpy change of the reaction is given as \n",
"del_h_1 = h0_NH3 - 0.5*h0_N2 - 1.5*h0_H2 #[kJ/mol]\n",
"\n",
- "# Now, from Table 12.3( page 332 )\n",
"a_NH3 = 3.578\n",
"a_H2 = 3.249\n",
"a_N2 = 3.280\n",
@@ -522,20 +409,13 @@
"d_H2 = 0.083*10**(5) #[K**(2)]\n",
"d_N2 = 0.040*10**(5) #[K**(2)]\n",
"\n",
- "# So,\n",
"del_a = a_NH3 - 0.5*a_N2 - 1.5*a_H2\n",
"del_b = b_NH3 - 0.5*b_N2 - 1.5*b_H2\n",
"del_c = c_NH3 - 0.5*c_N2 - 1.5*c_H2\n",
"del_d = d_NH3 - 0.5*d_N2 - 1.5*d_H2\n",
"\n",
- "# Now, enthalpy change of the reaction at any other temparature is given by\n",
- "# Integrating and putting the limits, we have\n",
- "# del_h = del_h_1 + R*( del_a*T + del_b*T**(2)/2 + del_c*T**(3)/3 - del_d/T) - R*( del_a*T_1 + del_b*T_1**(2)/2 + del_c*T_1**(3)/3 - del_d/T_1)\n",
- "# let\n",
"I = R*( del_a*T1 + del_b*T1**(2)/2 + del_c*T1**(3)/3 - del_d/T1) #[J/mol]\n",
"\n",
- "# From equation 12.28 and above relations we have\n",
- "# Let math.log(K_2/K_1) = X, So,\n",
"\n",
"def f5(T): \n",
"\t return (del_h_1*1000 - I + R*(del_a*T + del_b*T**(2)/2 + del_c*T**(3)/3 - del_d/T))/T**(2)\n",
@@ -543,10 +423,8 @@
"X = (1/R)* quad(f5,T1,T2)[0]\n",
"\n",
"\n",
- "# So, \n",
"K_2 = K_1*math.exp(X)\n",
"\n",
- "# Results\n",
"print \" Equilibrium consmath.tants for the formation of ammonia from hydrogen and nitrogen are \"\n",
"print \" K = %0.0f at temperature 25 deg C\"%(K_1)\n",
"print \" K = %f at temperature 400 deg C\"%(K_2)\n"
@@ -587,8 +465,6 @@
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
- "# Initial moles of the gases are \n",
"n_H2_0 = 1.5 #[mol]\n",
"n_N2_0 = 0.5 #[mol]\n",
"n_NH3_0 = 0 #[mol]\n",
@@ -596,38 +472,24 @@
"T_2 = 673.15 #[K]\n",
"P = 1. #[bar]\n",
"\n",
- "# We start with the equation as \n",
- "# [f_NH3/f_0_NH3]/([f_N2/f_0_N2]**(0.5)*[f_H2/f_0_H2]**(1.5)) = K\n",
"\n",
- "# For a pressure of 1 bar with the assumption of ideal solution of ideal gases and smath.radians(numpy.arcmath.tan(ard state fugacities of 1 bar,\n",
- "# a_i = [f_i/f_0_i] = [P*y_i/(1 bar)] = y_i \n",
- "# The equilibrium relation is given by \n",
- "# K = [y_NH3]/([y_N2]**(0.5)*[y_H2]**(1.5))\n",
"\n",
- "# We have the stoichiometric coefficient of N2, H2 and NH3 as -0.5, -1.5 and +1 respectively, so summation(v_i) = -1\n",
- "# Now umath.sing the equilibrium relations which are Equations 12.W, 12.X and 12.Y ( page 322 ), we have \n",
"\n",
- "# K = ((0+e)/(2-e))/(((0.5-0.5*e)/(2-e))**(0.5)*((1.5-1.5*e)/(2-e))**(1.5))\n",
- "# Form the example 12.8 of this book we know that \n",
"K_298 = 778. # at temperature 298.15K\n",
"K_673 = 0.013 # at temperature 673.15K\n",
"\n",
- "# Calculations\n",
- "# Solving for temperature 298.15\n",
"def g(e_1): \n",
"\t return ((0+e_1)/(2-e_1))/(((0.5-0.5*e_1)/(2-e_1))**(0.5)*((1.5-1.5*e_1)/(2-e_1))**(1.5))-K_298\n",
" \n",
"e_1 = fsolve(g,0.97)\n",
"y_NH3_298 = e_1/(2-e_1)\n",
"\n",
- "# Similarily solving for temperature 673.15K\n",
"def h(e_2): \n",
"\t return ((0+e_2)/(2-e_2))/(((0.5-0.5*e_2)/(2-e_2))**(0.5)*((1.5-1.5*e_2)/(2-e_2))**(1.5))-K_673\n",
"\n",
"e_2 = fsolve(h,0)\n",
"y_NH3_673 = e_2/(2-e_2)\n",
"\n",
- "# Results\n",
"print \" The mole fraction of NH3 in the equilibrium at the temperature 298.15K and 1 bar is %f\"%(y_NH3_298)\n",
"print \" The mole fraction of NH3 in the equilibrium at the temperature 673.15K and 1 bar is %f\"%(y_NH3_673)\n"
],
@@ -657,32 +519,23 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The mole fraction of the ammonia in the equilibrium\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 273.15+400 #[K]\n",
"P = 150*1.01325 #[bar]\n",
"\n",
- "# Comparing this with the example 12.9, we see that we can use the same equation , but K_673 is replaced by K_673*(P/(1bar))**(1.5+0.5-1)\n",
"K_673 = 0.013\n",
"\n",
- "# So \n",
"K = K_673*(P/1)**(1.5+0.5-1)\n",
"\n",
- "# Calculations\n",
- "# We have \n",
- "# K = ((0+e)/(2-e))/(((0.5-0.5*e)/(2-e))**(0.5)*((1.5-1.5*e)/(2-e))**(1.5))\n",
"def f(e): \n",
"\t return ((0+e)/(2-e))/(((0.5-0.5*e)/(2-e))**(0.5)*((1.5-1.5*e)/(2-e))**(1.5))-K\n",
"e=fsolve(f,0.5)\n",
"\n",
- "# Thus mole fraction of the ammonia in the gas is given by \n",
"y_NH3 = (0+e)/(2-e)\n",
"\n",
- "# Results\n",
"print \"The mole fraction of the ammonia in the equilibrium is %0.2f\"%(y_NH3)\n"
],
"language": "python",
@@ -710,39 +563,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The mole fraction of the ammonia in the equilibrium\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
- "# The data used in this example will e same as in the example 12.10\n",
"T = 273.15+400 #[K] given temperature\n",
"P = 150*1.01325 #[bar] given pressure\n",
"\n",
- "# Here again the equation will be same as in the example 12.9 like we used in the example 12.10 only K_673 is replaced by (K/K_v)*[P/(1 bar)]**(1.5+0.5-1)\n",
"K_673 = 0.013\n",
- "# The value of 'K_v' is calculated by the equation 12.BN, which is \n",
- "# log10(1/K_v) = (0.1191849/T + 91.87212/T**(2) + 25122730/T**(4))*P\n",
"\n",
- "# Calculations\n",
- "# So \n",
"K_v = (10**((0.1191849/T + 91.87212/T**(2) + 25122730/T**(4))*P))**(-1)\n",
"\n",
- "# Thus \n",
"K = (K_673/K_v)*(P/1)**(1.5+0.5-1)\n",
"\n",
- "# Now from the previous example we have\n",
- "# K = ((0+e)/(2-e))/(((0.5-0.5*e)/(2-e))**(0.5)*((1.5-1.5*e)/(2-e))**(1.5))\n",
"\n",
"def f(e): \n",
"\t return ((0+e)/(2-e))/(((0.5-0.5*e)/(2-e))**(0.5)*((1.5-1.5*e)/(2-e))**(1.5))-K\n",
"e = fsolve(f,0.2)\n",
"\n",
- "# Mol fraction of the ammonia in the gas phase in the equilibrium is given by\n",
"y_NH3 = (0+e)/(2-e)\n",
"\n",
- "# Results\n",
"print \" The mole fraction of the ammonia in the equilibrium is %0.2f\"%(y_NH3)\n"
],
"language": "python",
@@ -779,64 +619,37 @@
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"p_i = 1. #[atm] initial pressure \n",
"P = 150. #[atm] final pressure\n",
"T = 273+25. #[K] Given temperature\n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# Now ignoring the difference between 25C and 20C, we use the values given in the table A.8 (page 427) to get \n",
"delta_g_0 = 10.54*1000 #[J/mol]\n",
- "# And thus \n",
"\n",
- "# Calculations\n",
"K = math.exp((-delta_g_0)/(R*T))\n",
"\n",
- "# Now the chemical reaction is given by\n",
- "# C2H5OH + CH3COOH = C2H5OOC2H5 + H2O\n",
"\n",
- "# Let we start with 1 mol each of ethanol and acetic acid, and at equilibrium 'e' moles each of the reacmath.tants reacted, then\n",
- "# remaining amount of each of the two reacmath.tants will be (1-e) and that products formation will be 'e' mol each\n",
"\n",
- "# We have \n",
- "# K = (a_C2H5OOC2H5*a_H2O)/(a_C2H5OH*a_CH3COOH) = (x_C2H5OOC2H5*x_H2O)/(x_C2H5OH*x_CH3COOH) = (e*e)/((1-e)*(1-e))\n",
- "# Now solving for 'e'\n",
"def f(e): \n",
"\t return (e*e)/((1-e)*(1-e))-K\n",
"e = fsolve(f,0)\n",
"\n",
- "# To see the effect of changing the pressure we first compute the volume increase of the reaction \n",
- "# delta_v = v_C2H5OOC2H5 + v_H2O - v_C2H5OH - v_CH3COOH, where v_i is the molar volume of the ith component\n",
- "# From the Table 12.4(page 340), we have\n",
"v_C2H5OOC2H5 = 97.67 #[ml/mol]\n",
"v_H2O = 18.03 #[ml/mol]\n",
"v_C2H5OH = 58.30 #[ml/mol]\n",
"v_CH3COOH = 57.20 #[ml/mol]\n",
"\n",
- "# Thus volume increase of the reaction is\n",
"delta_v = v_C2H5OOC2H5 + v_H2O - v_C2H5OH - v_CH3COOH #[ml/mol]\n",
"\n",
- "# So, from Le Chatelier's principal, on increamath.sing the pressure , the reaction is forced in the direction of the reacmath.tant or away from the product \n",
- "# To calculate the extent of shifting we will take the help of the activity of each of the four component \n",
- "# a_i = (f_i/f_i_0) = (x_i*Y_i*p_i)/p_i*exp(v/(R*T)*(P-p_i))\n",
- "# we will assume that this is an ideal solution so that Y_i = 1.00, for every component\n",
"\n",
- "# Now substituting the activity of each component in the expression of the equilibrium consmath.tant given above, we have\n",
- "# K = (x_C2H5OOC2H5*x_H2O)/(x_C2H5OH*x_CH3COOH)*exp[(delta_v)/(R*T)*(P-p_i)]\n",
- "# or\n",
- "# K = (e_1*e_1)/((1-e_1)*(1-e_1))*exp[(delta_v)/(R*T)*(P-p_i)]\n",
"\n",
- "# Solving for 'e_1'\n",
"def g(e_1): \n",
"\t return (e_1*e_1)/((1-e_1)*(1-e_1))*math.exp((delta_v)/(R*T)*(P-p_i))-K\n",
"e_1 = fsolve(g,0.2)\n",
"\n",
- "# Now if we carry out the calculation to enough significant figures then\n",
"a = e_1/e\n",
"\n",
- "# It indicates that e_1 is 'a' times of that of the e\n",
"\n",
- "# Results\n",
"print \"On increamath.sing the pressure from 1 atm to 150 atm the reacted amount of the equimolar \\\n",
"reacmath.tants at equilibrium becomes %f times of initial\"%(a)\n"
],
@@ -865,25 +678,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Value of the K_p at the given condition\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 150. #[atm] given pressure\n",
"T = 400. #[C] temperature\n",
- "# Umath.sing the values from the example 12.11, we know that\n",
"K = 0.013\n",
"K_v = 0.84\n",
"delta_v = 1.5+0.5-1\n",
"\n",
- "# Calculations\n",
- "# so \n",
- "# K_p = (K/K_v)*[1/bar]**(-summation(v_i)) = (K/K_v)*[1/bar]**(delta_v)\n",
"\n",
"K_p = (K/K_v)*(1/1)**(delta_v) #[1/bar]\n",
"\n",
- "# Results\n",
"print \" Value of the K_p at the given condition is %f 1/bar)\"%(K_p)\n",
"print \" The basic K is dimensionless%( but K_p has the dimensions of pressure to the power.\"\n"
],
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch13.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch13.ipynb
index 6042a664..810ca173 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch13.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch13.ipynb
@@ -27,39 +27,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the equilibrium the product of the hydrogen ion and hydroxil ion\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T =273.15+25 #[K] given temperature\n",
"R = 8.314 #[J/(mol*K)] universal gas consmath.tant\n",
"\n",
- "# We have the reaction as follows\n",
- "# H2O = H+ + OH-\n",
"\n",
- "# Reading the free energy of species from the Table A.8 ( page 427), we have \n",
"g_0_H = 0 #[kJ/mol]\n",
"g_0_OH = -157.29 #[kJ/mol]\n",
"g_0_H2O = -237.1 #[kJ/mol]\n",
"\n",
- "# Calculations\n",
- "# Thus free enaergy change of the reaction is \n",
"delta_g_0 = g_0_H + g_0_OH - g_0_H2O #[kJ/mol]\n",
- "# Changing in J/mol we have \n",
"delta_g_1 = delta_g_0*1000 #[J/mol]\n",
"\n",
- "# Now equilibrium consmath.tant of the reaction is given by\n",
"K = math.exp((-delta_g_1)/(R*T))\n",
"\n",
- "# Also, in terms of activity\n",
- "# K = ([[H+]/(1 molal)]*[[OH-]/(1 molal)])/[a_water]\n",
- "# The activity of any pure liquid at its smath.radians(numpy.arcmath.tan(ard state is 1.00, and here water is practically pure, so\n",
- "# K_w = [[H+]/(1 molal)]*[[OH-]/(1 molal)] = K\n",
- "# or \n",
"K_w = K\n",
"\n",
- "# Results\n",
"print \"At the equilibrium the product of the hydrogen ion and hydroxil ion is %0.1e\"%(K_w)\n"
],
"language": "python",
@@ -99,78 +84,47 @@
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"n_H2SO4 = 1. #[mol] mole of the sulphuric acid\n",
"w_water = 1000. #[g] weight of the water \n",
"T =273.15+25 #[K] temperature\n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# We the two sequential reaction, in which the first reaction is\n",
- "# H2SO4 = HSO4- + H+\n",
"\n",
- "# From the Table A.8 (page 427) as given in the book, free energy of the above species are \n",
"g_0_H = 0 #[J/mol] free energy of the hydrogen ion\n",
"g_0_HSO4 = -756.01*1000 #[J/mol] free energy of the bisulphate ion\n",
"g_0_H2SO4 = -744.50*1000 #[J/mol] free enery of sulphuric acid\n",
"\n",
- "# Calculations\n",
- "# So \n",
"delta_g_0 = g_0_H + g_0_HSO4 - g_0_H2SO4 #[J/mol]\n",
"\n",
- "# So equilibrium consmath.tant of the reaction is given by\n",
"K_1 = math.exp((-delta_g_0)/(R*T))\n",
"\n",
- "# Now the second reaction is which is going on sequentialy is\n",
- "# HSO4- = SO4(-2) + H+\n",
"\n",
- "# Again from the Table A.8 reading the values of free energy of the species of the above reaction, we have\n",
"g_0_H = 0 #[J/mol] free energy of the hydrogen ion\n",
"g_0_SO4 = -744.62*1000 #[J/mol] free energy of sulphate ion\n",
"g_0_HSO4 = -756.01*1000 #[J/mol] free energy of the bisulphate ion\n",
"\n",
- "# So \n",
"delta_g_1 = g_0_H + g_0_SO4 - g_0_HSO4 #[J/mol]\n",
"\n",
- "# Equilibrium consmath.tant of thi reaction is \n",
"K_2 = math.exp((-delta_g_1)/(R*T))\n",
"\n",
- "# Now we have 1 mol of H2SO4 initially. Let e_1 mol of H2SO4 ionised at equilibrium\n",
- "# Then amount of the each of two product i.e. bisulphate and hydrogen ion will be e_1 mol\n",
- "# Now for the second reaction e_1 mol of the bisulphate ion will be treated as initial concentration.\n",
- "# If at equilibrium e_2 moles of bisulphate ion has ionised\n",
- "# In this case the amount of each of two product of this reaction will be e_2 mol\n",
- "# So final amount of each of the species (in moles) at equilibrium is given as \n",
- "# n_H2SO4 = (1-e_1)\n",
- "# n_HSO4 = (e_1-e_2)\n",
- "# n_SO4 = e_2\n",
- "# n_H = (e_1+e_2)\n",
- "\n",
- "# now\n",
- "# K_1 = ([HSO4]*[H])/[H2SO4] = ((e_1-e_2)*(e_1+e_2))/(1-e_1)...................(1)\n",
- "# and that for the second reaction \n",
- "# K_2 = ([SO4]*[H])/[HSO4] = ((e_2)*(e_1+e_2))/(e_1-e_2).......................(2)\n",
- "\n",
- "# e = [e_1 e_2]\n",
- "# Solving the two given simulmath.taneous equations,we have\n",
+ "\n",
+ "\n",
"def F(e):\n",
" f = [0,0]\n",
" f[0] = ((e[0]-e[1])*(e[0]+e[1]))/(1-e[0]) - K_1\n",
" f[1] = ((e[1])*(e[0]+e[1]))/(e[0]-e[1]) - K_2\n",
" return f\n",
"\n",
- "# Initial guess:\n",
"e = [0.8,0.1]\n",
"y = fsolve(F,e)\n",
"e_1 = y[0]\n",
"e_2 = y[1]\n",
"\n",
- "# So, concentration of the various species in equilibrium is given as \n",
"m_H2SO4 = 1-e_1 # [molal]\n",
"m_HSO4 = e_1 - e_2 #[molal]\n",
"m_SO4 = e_2 #[molal]\n",
"m_H = e_1 + e_2 #[molal]\n",
"\n",
- "# Results\n",
"print \" The equilibrium concentration of H2SO4 in terms of molality is %f molal\"%(m_H2SO4)\n",
"print \" The equilibrium concentration of HSO4- in terms of molality is %f molal\"%(m_HSO4)\n",
"print \" The equilibrium concentration of SO4-- in terms of molality is %f molal\"%(m_SO4)\n",
@@ -213,31 +167,21 @@
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"P = 10. #[MPa] given pressure\n",
"T = 250. #[C] Temperature\n",
- "# Let the total number of moles in the feed be one, then\n",
"n_T_0 = 1. #[mol]\n",
"n_CO = 0.15 #[mol]\n",
"n_CO2 = 0.08 #[mol]\n",
"n_H2 = 0.74 #[mol]\n",
"n_CH4 = 0.03 #[mol]\n",
"\n",
- "# The two simulmath.taneous reactions taking place are\n",
- "# CO + 2*H2 = CH3OH\n",
- "# CO2 + H2 = CO + H2O\n",
"\n",
- "# Let us denote the first reaction by 1 and the second reaction by 2\n",
- "# and K_i = (K/K_v)*[P/(1 atm)]**(-summation(v_i))\n",
- "# and that summation(v_i) = V_i\n",
"\n",
- "# Then from the table 13.C (page 353) as reported in the book, we have \n",
"V_1 = -2\n",
"V_2 = 0\n",
"K_1 = 49.9 # For the first reaction \n",
"K_2 = 0.032 # For the second reaction\n",
"\n",
- "# Now let v_i denotes the stoichiometric coefficient of species 'i', then\n",
"v_CO_1 = -1\n",
"v_H2_1 = -2\n",
"v_CH3OH_1 = +1\n",
@@ -246,28 +190,14 @@
"v_CO_2 = +1\n",
"v_H2O_2 = +1\n",
"\n",
- "# Let e_1 = the moles of CO reacted in reaction 1 and e_2 = the moles of CO2 reacted in reaction 2.\n",
- "# Now mol fractions of each of the species in the equilibrium is \n",
- "# y_CO = (n_CO+v_CO_1*e_1+v_CO_2*e_2)/(n_T_0+e_1*V_1+e_2*V_2) = (0.15-1*e_1+1*e_2)/(1+e_1*(-2)+e_2*(0)) = (0.15 - e_1 + e_2)/(1 - 2*e_1)\n",
"\n",
- "# similarily\n",
- "# y_H2 = (n_H2+v_H2_1*e_1+v_H2_2*e_2)/(n_T_0+e_1*V_1+e_2*V_2) = (0.74 - 2*e_1 - e_2)/(1 - 2*e_1)\n",
"\n",
- "# y_CH3OH = (n_CH3OH+v_CH3OH_1*e_1+v_CH3OH_2*e_2)/(n_T_0+e_1*V_1+e_2*V_2) = (0 + e_1)/(1 - 2*e_1)\n",
"\n",
- "# y_CO2 = (n_CO2+v_CO2_1*e_1+v_CO2_2*e_2)/(n_T_0+e_1*V_1+e_2*V_2) = (0.08 - e_2)/(1 - 2*e_1)\n",
"\n",
- "# y_H2O = (n_H2O+v_H2O_1*e_1+v_H2O_2*e_2)/(n_T_0+e_1*V_1+e_2*V_2) = (0 + e_2)/(1 - 2*e_1)\n",
"\n",
- "# Now putting the values in the expression of the equilibrium consmath.tant of the reactions, for the reaction 1 we have\n",
"\n",
- "# K_1 = ((0 + e_1)/(1 - 2*e_1))/(((0.15 - e_1 + e_2)/(1 - 2*e_1))*((0.74 - 2*e_1 - e_2)/(1 - 2*e_1))**(2))\n",
"\n",
- "# K_2 = (((0.15 - e_1 + e_2)/(1 - 2*e_1))*((0 + e_2)/(1 - 2*e_1)))/(((0.08 - e_2)/(1 - 2*e_1))*((0.74 - 2*e_1 - e_2)/(1 - 2*e_1)))\n",
"\n",
- "# Calculations\n",
- "# e = [e_1 e_2]\n",
- "# Solving the two given simulmath.taneous equations,we have\n",
"def F(e):\n",
" f = [0,0]\n",
" f[0] = ((0 + e[0])/(1 - 2*e[0]))/(((0.15 - e[0] + e[1])/(1 - 2*e[0]))*((0.74 - 2*e[0] - e[1])/(1 - 2*e[0]))**(2)) - K_1\n",
@@ -275,20 +205,14 @@
" return f\n",
"\n",
"\n",
- "# Initial guess:\n",
"e = [0.109, 0]\n",
"y = fsolve(F,e)\n",
"e_1 = y[0]\n",
"e_2 = y[1]\n",
"\n",
- "# So, percent conversion of CO2 is given as\n",
- "# (moles of CO2 reacted)/(moles of CO2 fed) i.e.\n",
"c_CO2 = e_2/(n_CO2)*100\n",
- "# Number of moles of CO Formed by the second reaction is 0.032\n",
- "# So, percent conversion of CO is given as\n",
"c_CO = e_1/(n_CO + 0.032)*100\n",
"\n",
- "# Results\n",
"print \" Percent conversion of CO is %f%%\"%(c_CO)\n",
"print \" Percent conversion of CO2 is %f%%\"%(c_CO2)\n"
],
@@ -318,37 +242,23 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The amount of solid dissolved in terms of solubility product\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 273.15+25 #[K] Temperature\n",
"R = 8.314 #[J/(mol*K)] universal gas consmath.tant\n",
"\n",
- "# Solubility of AgCl in water follows\n",
- "# AgCl = Ag+ + Cl-\n",
- "# From the Table A.8, free energy of above species are\n",
"g_0_Ag = 77.12*1000 #[J/mol]\n",
"g_0_Cl = -131.26*1000 #[J/mol]\n",
"g_0_AgCl = -109.8*1000 #[J/mol]\n",
"\n",
- "# Calculations\n",
- "# Free energy change of the reacton is given by \n",
"delta_g_0 = g_0_Ag + g_0_Cl - g_0_AgCl #[J/mol]\n",
"\n",
- "# Now equilbrium consmath.tant of the reaction is given by\n",
"K = math.exp((-delta_g_0)/(R*T))\n",
"\n",
- "# In terms of activity of the components, equilibrium consmath.tant is \n",
- "# K = [[Ag+]/(1 molal)*[Cl-]/(1 molal)]/[a_AgCl]\n",
"\n",
- "# For solids f_i_0 is normaly taken as the fugacity of the pure crystalline solid,and the activity of the pure crystalline solid is = 1.00, so\n",
"a_AgCl = 1.00\n",
"\n",
- "# Results\n",
- "# hence \n",
- "# [[Ag+]/(1 molal)*[Cl-]/(1 molal)]= K = K_sp , solubility product\n",
"print \"The amount of solid dissolved in terms of solubility product is %0.2e\"%(K)\n"
],
"language": "python",
@@ -385,63 +295,36 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 273.15+25 #[K] Given temperature of air\n",
"P = 1. #[atm] Pressure of the air\n",
"y_CO2 = 350.*10**(-6) # Amount of CO2 present in air at the given condition \n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# At equilibrium there are two ionisition reactions takin place sequentily\n",
- "# First ionisation reaction is \n",
- "# H2CO3 = H+ + HCO3-\n",
- "# Free energy of the species of the above reation is\n",
"g_0_H2CO3 = -623.1*1000 #[J/mol]\n",
"g_0_H = 0. #[J/mol]\n",
"g_0_HCO3 = -586.85*1000 #[J/mol]\n",
"\n",
- "# Calculations\n",
- "# So free energy change of the reaction is given by \n",
"delta_g_0 = g_0_H + g_0_HCO3 - g_0_H2CO3 #[J/mol]\n",
- "# Equilibrium consmath.tant of the reaction is given by\n",
"K_1 = math.exp((-delta_g_0)/(R*T)) \n",
"\n",
- "# And the second one is \n",
- "# HCO3- = H+ + CO3(-2)\n",
- "# Free energy of the species of the second reacion are\n",
"g_0_CO3 = -527.89*1000 #[J/mol]\n",
"\n",
- "# Free energy change of the second reacion is \n",
"delta_g_1 = g_0_H + g_0_CO3 - g_0_HCO3 #[J/mol]\n",
- "# So equilibrium consmath.tant of the reaction is given by\n",
"K_2 = math.exp((-delta_g_1)/(R*T))\n",
"\n",
- "# Now, writing the expression of the equilibrium consmath.tant of the first reaction, we have\n",
- "# K_1 = ([HCO3-]*[H+])/[H2CO3]\n",
- "# and that for the second reaction \n",
- "# K_2 = ([CO3]*[H+])/[CO3-]\n",
"\n",
- "# From the Table A.3 (page 419) as reported in the book, Henry's law consmath.tant is \n",
"H = 1480. #[atm]\n",
"\n",
- "# From Henry's law \n",
- "# P*y_CO2 = x_O2*H , so\n",
"x_CO2 = P*y_CO2/H\n",
"\n",
- "# This gives the mol fracion. The dissociation consmath.tant are based on molaities a smath.radians(numpy.arcmath.tan(ard states, so\n",
- "# Molality of the CO2 in the solution is \n",
- "# m_CO2 = x_CO2*n_water , where 'n_water' is number of moles of water in 1000g of water, so\n",
"n_water = 1000/18. #[mol]\n",
"m_CO2 = x_CO2*n_water #[molal]\n",
"\n",
- "# Then we assume that almost all the H+ comes from the dissociation of dissolved CO2, so \n",
- "# m_HCO3 = m_H, i.e. molality of bicarbonate is approximately equal to molality of hydrogen ion in the solution and hence \n",
"m_HCO3 = math.sqrt(K_1*m_CO2) #[molal]\n",
"m_H = m_HCO3 #[molal]\n",
"\n",
- "# Then we compute \n",
"m_CO3 = K_2*(m_HCO3/m_H) #[molal]\n",
"\n",
- "# Results\n",
"print \" Amount of the CO2 dissolved in water in equilibrium with air is \\t\\t\\t%0.2e molal\"%(m_CO2)\n",
"print \" Conentration of HCO3 ion and hydrogen ion H- in solution in equilibrium with air is %0.2e molal\"%(m_HCO3)\n",
"print \" And concentration of CO3 ion in the solution in equilibrium with air is\\t\\t%0.2e molal\"%(m_CO3)\n"
@@ -482,23 +365,15 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# All the data are taken from the previous example 13.5 \n",
"m_H = 10**(-10) #[molal] molality of hydrogen ion\n",
"K_1 = 4.5*10**(-7)\n",
"K_2 = 4.7*10**(-11)\n",
"\n",
- "# Calculations\n",
- "# Our Henry's law calculations are independent of the subsequent fate of the dissolved CO2.\n",
- "# The concentration of dissolved CO2 in equilibrium with atmosphere is \n",
"m_CO2 = 1.32*10**(-5) #[molal] from previous example\n",
- "# It is independent of that acidity or basicity of the water, and hence \n",
"m_HCO3 = K_1*(m_CO2/m_H) #[molal]\n",
"\n",
- "# and \n",
"m_CO3 = K_2*(m_HCO3/m_H) #[molal]\n",
"\n",
- "# Results\n",
"print \" Amount of the CO2 dissolved in water in equilibrium with air is \\t%0.2e molal\"%(m_CO2)\n",
"print \" Conentration of HCO3 ion in solution in equilibrium with air is \\t %0.2e molal\"%(m_HCO3)\n",
"print \" And concentration of CO3 ion in the solution in equilibrium with air is %0.2e molal\"%(m_CO3)\n"
@@ -530,35 +405,23 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Standard state cell voltage for the production of aluminium\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 298.15 #[K] Temperature\n",
"F = 96500. #[(coulomb)/(mole*electrons)] faraday consmath.tant\n",
"\n",
- "# The reaction is given as\n",
- "# Al2O3 + 1.5C = 2Al + 1.5CO2\n",
"\n",
- "# No of the electron being exchanged are \n",
"n_e = 6. #[electron]\n",
- "# All the reacmath.tants and products enter or leave the reactor as pure species in their smath.radians(numpy.arcmath.tan(ard states, so\n",
- "# delta_g_0 = delta_g_1 and E = E_0\n",
- "# Free energy of the species in the above equation as reported in the Table A.8 in the book is \n",
"g_0_CO2 = -394.4*1000 #[J/mol] \n",
"g_0_Al = 0 #[J/mol]\n",
"g_0_C = 0 #[J/mol]\n",
"g_0_Al2O3 = -1582.3*1000 #[J/mol]\n",
"\n",
- "# Calculations\n",
- "# Free energy change of the reaction is \n",
"delta_g_0 = 1.5*g_0_CO2 + 2*g_0_Al - 1.5*g_0_C - g_0_Al2O3 #[J/mol]\n",
"\n",
- "# So, smath.radians(numpy.arcmath.tan(ard state cell voltage is \n",
"E_0 = (-delta_g_0)/(n_e*F) #[V]\n",
"\n",
- "# Results\n",
"print \"Standard state cell voltage for the production of aluminium is %f Volt\"%(E_0)\n"
],
"language": "python",
@@ -586,24 +449,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The reversible voltage for given electrochemical device\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 298.15 #[K] Temperature\n",
"F = 96500. #[(coulomb)/(mole*electrons)] faraday consmath.tant\n",
"\n",
- "# The reaction taking place between lithium and florine is \n",
- "# Li + F = LiF\n",
- "# Calculations\n",
- "# From Table A.8 we find that \n",
"delta_g_0 = -587.7*1000 #[J/mol]\n",
- "# We also know that \n",
"n_e = 1 #[electron] no of electron transferred\n",
- "# That is because the valence Li and F change by 1, so one electron is transferred per molecule of LiF, thus\n",
"E_298_0 = (-delta_g_0)/(n_e*F) #[V]\n",
"\n",
- "# Results\n",
"print \"The reversible voltage for given electrochemical device is %f Volt\"%(E_298_0)\n"
],
"language": "python",
@@ -631,11 +485,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The equilibrium cell voltage of electrolytic cell\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 298.15 #[K] Temperature\n",
"P_0 = 1. #[atm]\n",
"P = 100. #[atm]\n",
@@ -643,26 +495,12 @@
"F = 96500. #[(coulomb)/(mole*electrons)] faraday consmath.tant\n",
"R = 8.314 #[J/(mol*K)] universal gas consmath.tant \n",
"\n",
- "# The reaction is \n",
- "# H2O(l) = H2(g) + 1/2O2(g)\n",
- "# number of the valence electrons transferred in this reaction is \n",
"n_e = 2. #[(mole electrons)/mole]\n",
"\n",
- "# Calculations\n",
- "# Gibb's free energy is given by\n",
- "# or\n",
- "# In the rightmost term we replace v_T by (R*T)/P, which is correct only for ideal gases, so\n",
- "# g = g_0 + (R*T)*math.log(P/P_0)\n",
"\n",
- "# According to the assumption ,we can ignore the change in Gibb's free energy with pressure of the liquid water, so that \n",
- "# delta_g = delta_g_0 + 1.5*(R*T)*math.log(P/P_0)\n",
"\n",
- "# and \n",
- "# E = (-delta_g)/(n_e*F) = -(delta_g_0 + 1.5*(R*T)*math.log(P/P_0))/(n_e*F)\n",
- "# So equilibrium cell voltage is given as \n",
"E = E_0 - 1.5*(R*T)*math.log(P/P_0)/(n_e*F)\n",
"\n",
- "# Results\n",
"print \"The equilibrium cell voltage of electrolytic cell if feed and product are at the pressure 100 atm is %f Volt\"%(E)\n"
],
"language": "python",
@@ -690,25 +528,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The value of the compressibility factor\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 273.15+25 #[K] Temperature\n",
"P = 11.38/760 #[atm] Pressure\n",
"R = 0.08206 #[(L*atm)/(mol*K)] Gas consmath.tant\n",
"v = 0.6525/0.04346 #[L/g] Specific volume \n",
"M = 60.05 #[g/mol] Molecular weight of HAc in the monomer form\n",
"\n",
- "# Calculations\n",
- "# So the specific volume in [L/mol] is\n",
"V = v*M #[L/mol]\n",
"\n",
- "# Compressibility factor is give by\n",
"z = (P*V)/(R*T)\n",
"\n",
- "# Results\n",
"print \"The value of the compressibility factor for HAc at given condition is %f\"%(z) \n"
],
"language": "python",
@@ -745,33 +577,18 @@
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"T = 273.15+25 #[K] Temperature\n",
"P = 11.38 #[torr] Pressure\n",
"\n",
- "# Formation of the dimer from monomer in the gas phase follows the reaction \n",
- "# 2*HAc = (HAc)2\n",
"\n",
- "# Calculations\n",
- "# From the equation 13.BF(page 366) given in the book\n",
- "# K = (P*y_HAc_2)/(P*y_HAc)**(2) , where 'y_HAc_2' is mol fraction of dimer and 'y_HAc' is mol fraction of monomer\n",
- "# and \n",
- "# math.log10(K) = -10.4184 + 3164/T , so \n",
"K = 10**(-10.4184 + 3164/T) #[1/torr]\n",
"\n",
- "# Thus \n",
- "# y_HAc_2 = K*(P*y_HAc)**(2)/P\n",
- "# Since, (y_HAc + y_HAc_2) = 1\n",
- "# y_HAc_2 = K*(P*(1-y_HAc))**(2)/P\n",
"\n",
- "# Solving for y_HAc_2\n",
"def f(y_HAc_2): \n",
"\t return K*(P*(1-y_HAc_2))**(2)/P-y_HAc_2\n",
"y_HAc_2 = fsolve(f,0)\n",
- "# So\n",
"y_HAc = 1-y_HAc_2\n",
"\n",
- "# Results\n",
"print \"Mole fraction of the monomer in the vapour phase is %f\"%(y_HAc)\n",
"print \"Mole fraction of the dimer in the vapour phase is %f\"%(y_HAc_2)\n",
"\n"
@@ -802,36 +619,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The compressibility factor z for the gaseous mixture\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# Getting the data from the example 13.10\n",
"T = 273.15+25 #[K] Temperature\n",
"P = 11.38/760 #[atm] Pressure\n",
"R = 0.08206 #[(L*atm)/(mol*K)] Gas consmath.tant\n",
"v = 0.6525/0.04346 #[L/g] Specific volume \n",
"\n",
- "# Now from the previous example ie example 13.11 the mole fractions of the monomer and dimer in the gas phase is \n",
"y_HAc = 0.211 # monomer \n",
"y_HAc_2 = 0.789 # dimer\n",
"\n",
- "# Molecular weights of the monomer and dimer forms are\n",
"M_HAc = 60.05 #[g/mol] monomer \n",
"M_HAc_2 = 120.10 #[g/mol] dimer\n",
"\n",
- "# Calculations\n",
- "# Now average molecular weight of the mixture is\n",
"M_avg = M_HAc*y_HAc + M_HAc_2*y_HAc_2 #[g/mol]\n",
"\n",
- "# So specific volume in [L/mol] is\n",
"V = v*M_avg #[L/mol]\n",
"\n",
- "# Now compressibility factor is\n",
"z = (P*V)/(R*T)\n",
"\n",
- "# Results\n",
"print \"The compressibility factor z for the gaseous mixture is %f\"%(z)\n"
],
"language": "python",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch14.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch14.ipynb
index d85f313f..335565d5 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch14.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:6d9acec694eaa6247956671e6c927c80e0d17b9873ff1364d6a6878fb63313c8"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,64 +28,38 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The mol fraction of the methane\n",
- "The mol fraction of the ethane\n",
- "The mol fraction of the propane \n",
- "'''\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 300. #[K] Temperature of the natural gas well\n",
"R = 8.314 #[J/(mol*K)] universal gas consmath.tant\n",
"z_1 = 0 #[m]\n",
- "# At the surface of the well mole fraction of the components are\n",
"y_methane_surf = 85./100 #[mol%]\n",
"y_ethane_surf = 10/100. #[mol%]\n",
"y_propane_surf = 5/100. #[mol%]\n",
"P = 2. #[MPa] Total equilibrium pressure \n",
"z_2 = 1000. #[m] Depth of the well \n",
"\n",
- "# Calculations\n",
- "# Molecular weights of the components are\n",
"M_methane = 16./1000 #[kg/mol]\n",
"M_ethane = 30./1000 #[kg/mol]\n",
"M_propane = 44./1000 #[kg/mol]\n",
"\n",
- "# Now, we have the relation between the fugacities of a component at z_1 and z_2 as\n",
- "# f_i_2/f_i_1 = exp((-M_i*g*(z_2-z_1))/(R*T)) , where g is gravitational accelaration and its value is\n",
"g = 9.81 #[m/s**(2)]\n",
"\n",
- "# Fugacities of the various components at the surface i.e. at z = z_1 is\n",
"f_methane_1 = y_methane_surf*P #[MPa]\n",
"f_ethane_1 = y_ethane_surf*P #[MPa]\n",
"f_propane_1 = y_propane_surf*P #[MPa]\n",
"\n",
- "# Now, fugacities at z = z_2 are\n",
"f_methane_2 = f_methane_1*math.exp((-M_methane*g*(z_1-z_2))/(R*T)) #[MPa]\n",
"f_ethane_2 = f_ethane_1*math.exp((-M_ethane*g*(z_1-z_2))/(R*T)) #[MPa]\n",
"f_propane_2 = f_propane_1*math.exp((-M_propane*g*(z_1-z_2))/(R*T)) #[MPa]\n",
"\n",
- "# Let at z = z_1 total pressure of the gases are P_2\n",
- "# Then, fugacities of the ith component is also given as \n",
- "# f_i_2 = y_i_2*P_2\n",
- "# Writing the expression for all the component ad adding them we get \n",
- "# (f_methane_2 + f_ethane_2 + f_propane_2 ) = y_methane_2*P_2 + y_ethane_2*P_2 + y_propane_2*P_2\n",
- "# or\n",
- "# (f_methane_2 + f_ethane_2 + f_propane_2 ) = P_2*(y_methane_2 + y_ethane_2 + y_propane_2)\n",
- "# and\n",
- "# (y_methane_2 + y_ethane_2 + y_propane_2) = 1 ,so\n",
"P_2 = (f_methane_2 + f_ethane_2 + f_propane_2 ) #[MPa]\n",
"\n",
- "# Now the mole fractions of the components are \n",
- "# y_i_2 = f_i_2/P_2 , so\n",
"y_methane_2 = f_methane_2/P_2\n",
"y_ethane_2 = f_ethane_2/P_2\n",
"y_propane_2 = f_propane_2/P_2\n",
"\n",
- "# Results\n",
"print \"The mol fraction of the methane at the depth 1000m is %f\"%(y_methane_2)\n",
"print \"The mol fraction of the ethane at the depth 1000m is %f\"%(y_ethane_2)\n",
"print \"The mol fraction of the propane at the depth 1000m is %f\"%(y_propane_2)\n"
@@ -116,37 +91,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find Concentration of the nitrogen at the top of atmosphere with respect to the concentration of nitrogen \n",
- "at the surface of the earth\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 288. #[K] Atmospheric temperature \n",
"R = 8.314 #[J/(mol*K)] universal gas consmath.tant\n",
"z_2 = 15000. #[m] Thickness of the atmosphere\n",
"z_1 = 0. #[m] Surface\n",
- "# At the surface, the mole fraction of nitrogen and oxygen are \n",
"y_N2_1 = 0.79\n",
"y_O2_1 = 0.21\n",
"M_N2 = 28./1000 #[kg/mol]\n",
"M_O2 = 32./1000 #[kg/mol]\n",
"\n",
- "# Calculations\n",
- "# For an ideal solution of ideal gases with only two species, we have \n",
- "# y_i_2/y_i_1 = 1/(y_i_1 + y_j_1/a) , and\n",
- "# a = exp(-(M_i-M_j)*g*(z_2-z_1)/(R*T))\n",
- "# where 'g' is accelaration due to gravity and its value is\n",
"g = 9.81 #[m/s**(2)]\n",
"\n",
- "# So\n",
"a = math.exp(-(M_N2-M_O2)*g*(z_2-z_1)/(R*T))\n",
- "# and\n",
"yi2_by_yi1 = 1/(y_N2_1 + y_O2_1/a)\n",
"\n",
- "# Results\n",
"print \" Concentration of the nitrogen at the top of atmosphere with respect to the concentration of nitrogen \\\n",
" at the surface of the earth is yi2_by_yi1 = %0.2f\"%(yi2_by_yi1)\n"
],
@@ -175,36 +137,23 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find \n",
- "Concentration of the nitrogen at the top of reactor with respect to the concentration of nitrogen \n",
- "at the bottom of reactor\n",
- "'''\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# For this problem all the data are same as in previous Example 14.2 except z_1 and z_2 \n",
- "# So\n",
"T = 288. #[K] Atmospheric temperature \n",
"R = 8.314 #[J/(mol*K)] Universal gas consmath.tant\n",
"z_2 = 10. #[m] Height of the reactor\n",
"z_1 = 0. #[m] Surface\n",
"g = 9.81 #[m/s**(2)] Accelaration due to gravity\n",
"\n",
- "# Calculations\n",
- "# At z = z_1, the mole fraction of nitrogen and oxygen are \n",
"y_N2_1 = 0.79\n",
"y_O2_1 = 0.21\n",
"M_N2 = 28./1000 #[kg/mol]\n",
"M_O2 = 32./1000 #[kg/mol]\n",
"\n",
- "# So\n",
"a = math.exp(-(M_N2-M_O2)*g*(z_2-z_1)/(R*T))\n",
- "# and\n",
"yi2_by_yi1 = 1/(y_N2_1 + y_O2_1/a)\n",
"\n",
- "# Results\n",
"print \" Concentration of the nitrogen at the top of reactor with respect to the concentration of nitrogen \\\n",
" at the bottom of reactor is yi2_by_yi1 = %f\"%(yi2_by_yi1)\n"
],
@@ -236,10 +185,8 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 300. #[K] Temperature of the centrifuge\n",
"R = 8.314 #[J/(mol*K)] Universal gas consmath.tant\n",
- "# Mole fractions of the two components are \n",
"y_UF6_238_1 = 0.993 # Mole fraction of UF6 with 238 isotope of uranium in feed\n",
"y_UF6_235_1 = 0.007 # Mole fraction of UF6 with 235 isotope of uranium in feed\n",
"M_UF6_238 = 352./1000 #[kg/mol] Molecular weight of UF6 with 238 isotope of uranium\n",
@@ -248,21 +195,12 @@
"r_out = 10./100 #[m] outer raddi of the centrifuge\n",
"f = 800. #[revolution/second] Rotational frequency of centrifuge\n",
"\n",
- "# Calculations\n",
- "# Here the accelaration will come due to centrifugal force and is \n",
- "# g = w**(2)*r , where 'w' is angular speed and its value is w = 2*pie*f and 'r' is radius \n",
- "# But in the present case 'r' is varies as we move away from the axis of centrifuge\n",
- "# After making integration by taking small elements at the dismath.tance 'r' we find the expression \n",
"a = math.exp((M_UF6_235-M_UF6_238)*(2*3.141592*f)**(2)*(r_out**(2)-r_in**(2))/(2*R*T))\n",
"\n",
- "# Now Let the ratio y_i_2/y_i_1 = A\n",
- "# Then we have \n",
"A = 1./(y_UF6_235_1 + y_UF6_238_1/a)\n",
"\n",
- "# Now say y_i_1/y_i_2 = 1/A = B , then\n",
"B = 1./A\n",
"\n",
- "# Results\n",
"print \"The ratio of the mole fraction of UF6 with uranium 235 isotope) at the 2 cm radius to\\\n",
" that at the 10 cm radius is %0.3f\"%(B)\n"
],
@@ -291,37 +229,21 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The pressure difference between the two phases\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# We have two phase system in this problem in which phase 1 is seawater and phase 2 is fresshwater \n",
- "# Seawater contains mostly NaCl, Na2SO4, MgCl2, KCl and if they completly ionised then\n",
"x_water_1 = 0.98 # mole fraction of water in phase 1 i.e. in seawater\n",
"x_water_2 = 1. # mole fraction of water in the phase 2 i.e. in water \n",
"R = 10.73 #[(psi*ft**(3))/(lbmol*R)] Universal gas consmath.tant\n",
"T = 500. #[R] temperature\n",
"v_water_1 = 18/62.4 # [ft**(3)/(lbmol)]\n",
"\n",
- "# The effect of the pressure on the fugacity of the liquid is given as\n",
"\n",
- "# Calculations\n",
- "# Writing this equation twice, oncce for pure water and once for the water in the ocean water, and equating the fugacities, we get \n",
"\n",
- "# For pure water, x_i and Y_i are unity, and for the water in the solution, with mole fraction 0.98, Raoult's law is certain to be practically obeyed\n",
- "# So that Y_i is certain to be practically unity.\n",
"\n",
- "# The partial molal volume of water in pure water is practically the same as that in dilute solutions,\n",
- "# Tkaing the math.logarithm of both sides and solving , we get \n",
"\n",
- "# Integrating with the limit P_purewater and P_seawater we have\n",
- "# -math.log(x_water_1) = (v_water_1/(R*T))*( P_seawater - P_purewater )\n",
- "# ( P_seawater - P_purewater ) = delta_P\n",
- "# So \n",
"delta_P = (-(R*T)*math.log(x_water_1))/v_water_1#[psi]\n",
"\n",
- "# Results\n",
"print \"The pressure difference between the two phases is %0.1f psi\"%(delta_P)\n"
],
"language": "python",
@@ -349,41 +271,25 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate Pressure difference with the change in radius of the drop of the water\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 100. #[C] Temperature of the outside\n",
"P_outside = 1. #[atm]\n",
- "# At 100 C, the surface tension between steam and water is \n",
"T = 0.05892 #[N/m] From metric steam table (7, page 267)\n",
"\n",
- "# Pressure difference between inside and outside of a drop is given by the expression \n",
- "# (P_inside - P_outside) = (4*T)/d_i\n",
"\n",
- "# Let (P_inside - P_outside) = delta_P , so\n",
- "#delta_P = (4*T)/d_i\n",
- "# For the drop of diameter\n",
"d_1 = 0.001 #[m]\n",
"\n",
- "# Calculations\n",
- "# So \n",
"delta_P_1 = (4*T)/d_1 #[Pa]\n",
"\n",
- "# Which is certainly negligible \n",
- "# If we reduce the diameter to \n",
"d_2 = 10**(-6) #[m]\n",
"\n",
- "# So \n",
"delta_P_2 = (4*T)/d_2 #[Pa]\n",
"\n",
- "# If we reduce it to diameter that is smallest sized drop likely to exist \n",
"d_3 = 0.01*10**(-6) #[m]\n",
- "# Then the calculated pressure difference is \n",
"delta_P_3 = (4*T)/d_3 #[Pa]\n",
"\n",
- "# Results\n",
"print \"Pressure difference with the change in radius of the drop of the water is given as in the following table\"\n",
"print \" Diameter of the droplet d_iin meter Pressure difference P_inside - P_outside in atm\"\n",
"print \" %0.2e %0.2e\"%(d_1,delta_P_1) \n",
@@ -419,53 +325,28 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The equilibrium pressure at which the steam begin to condence at this temperature on the nuclei \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P_NBP = 1. #[atm]\n",
"Temp =273.15+100 #[C] Temperature\n",
"D = 0.01*10**(-6) #[m] Diameter of the condensation nuclei( due to impurity )\n",
"T = 0.05892 #[N/m] Surface tension between water drops and gas\n",
"R = 8.314 #[J/(mol*K)]\n",
"\n",
- "# At equilibrium the Gibb's free energy per pound will be the same inside and outside the drops.\n",
- "# From the previous example 14.6, the pressure difference inside and outside of the drop is \n",
- "# delta_P = ( P_inside-P_outside) = 4*T/D = 233 atm = 235.7 bar\n",
"\n",
- "# Calculations\n",
- "# Taking the Gibb's free energy at the normal boiling point as g_NBP we have \n",
- "# also\n",
- "# and\n",
"v_water_liquid = 1/958.39*0.018 #[m**(3)/mol]\n",
"\n",
- "# If we assume that the specific volume of the liquid is a consmath.tant,and independent of pressure, and that the volume of the vapour is given by the gas law\n",
- "# then we can perform the integrations and cancel the g_NBP terms, finding the Kelvin equation \n",
"\n",
- "# (R*Temp)*math.log(P_gas/P_NBP) = v_water_liquid*(P_gas + 4*T/D - P_NBP)\n",
- "# For very small drops \n",
- "# (P_gas - P_NBP) << 4*T/D\n",
- "# So that we can write it approximately as \n",
"\n",
- "# P_gas/P_NBP = exp(v_water_liquid*(4*T/D)/(R*Temp)) = I\n",
- "# so\n",
"I = math.exp(v_water_liquid*(4*T/D)/(R*Temp))\n",
"\n",
- "# Substracting 1 from both sides in the above equation we have \n",
- "# (P_gas-P_NBP)/P_NBP = I-1\n",
- "# So \n",
"P_gas_minus_P_NBP = (I-1)*P_NBP #[atm]\n",
- "# Changing into the bar we have \n",
"delta_P = P_gas_minus_P_NBP*1.01325 #[bar]\n",
"\n",
- "# Now changing the unit to psi we have \n",
"delta_P_1 = delta_P*100*0.1450377 #[psi]\n",
"\n",
- "# Results\n",
"print \"The equilibrium pressure at which the steam begin to condence at this temperature on \\\n",
" the nuclei is %f psi above the normal boiling point.\"%(delta_P_1)\n"
],
@@ -494,31 +375,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The liquid can lower its free energy\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
- "# Variables\n",
"Temp = 273.15+100 #[K] Temperature of the water drop\n",
"R = 8.314 #[J/(mol*K)] Universal gas consmath.tant\n",
"D = 0.01*10**(-6) #[m] Diameter of the water drop\n",
"P_g = 0.15 #[bar] guage pressure\n",
"T = 0.05892 #[N/m] Surface tension between water drop and gas\n",
"\n",
- "# The calculation of the pressure difference from inside to outside is the same as done in the example 14.7\n",
"\n",
- "# Calculations\n",
- "# The specific Gibb's free energy of the liquid is thus given as\n",
- "# Where \n",
"v_water_liquid = 0.018/958.39 #[m**(3)/mol]\n",
"P_NBP = 1.013 #[bar]\n",
"P_gas = 1.013+0.15 #[bar]\n",
"\n",
- "# Say\n",
"P_1 = P_gas + 4*T/D #[bar]\n",
- "# and (g_water_liquid - g_NBP) = delta_g_1\n",
- "# So\n",
"\n",
"def f2(P): \n",
"\t return v_water_liquid*P**(0)\n",
@@ -526,11 +398,6 @@
"delta_g_1 = quad(f2,P_NBP,P_1)[0]\n",
"\n",
"\n",
- "# and for the gas, again umath.sing equation for Gibb's free energy, we have \n",
- "# Here assuming that the vapour follows the ideal gas law we have \n",
- "# v_water_gas = (R*Temp/P)\n",
- "# and also let (g_water_liquid- g_NBP) = delta_g_2\n",
- "# so\n",
"\n",
"def f3(P): \n",
"\t return (R*Temp)/P\n",
@@ -538,14 +405,9 @@
"delta_g_2 = quad(f3,P_NBP,P_gas)[0]\n",
"\n",
"\n",
- "# Now \n",
- "# (g_water_liquid - g_water_gas) = (g_water_liquid - g_NBP)-(g_water_gas - g_NBP) = delta_g\n",
- "# So\n",
"delta_g = (delta_g_1 - delta_g_2) \n",
"\n",
- "# We have got the value of the delta_g positive, so\n",
"\n",
- "# Results\n",
"print \"The liquid can lower its free energy %0.2f J/mol by Changing to gas,\"%(delta_g)\n",
"print \"So that even at 0.15 bar above the normal boiling point, a drop of this small size is unstable and will quickly evaporate.\"\n"
],
@@ -575,44 +437,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The liquid pressure at which these boiling nuclei will begin to grow and intiate boiling\n",
- "At this external pressure the pressure inside the bubble\n",
- "'''\n",
+ "\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 904.7 #[R] Temperature of the pure liquid water \n",
"P_NBP = 400. #[psia] Saturation pressure of the pure liquid water at the given temperature\n",
"T = 1.76*10**(-4) #[lbf/inch] Surface tension of water\n",
"R = 10.73 #[(psi*ft**(3))/(lbmol*R)]\n",
"\n",
- "# Calculations\n",
- "# In this problem the gas is inside the bubble, at a pressure much higher than that of the sorrounding liquid.\n",
- "# The criterion of equilibrium is that the Gibb's free energy of the gas inside the bubble must be the same as that of the liquid outside the bubble.\n",
- "# Thus we have \n",
- "# also\n",
- "# where\n",
"v_water_liquid = 18*0.01934 #[ft**(3)/lbmol]\n",
"D = 10**(-5.) #[inch]\n",
"\n",
- "# so \n",
- "# Here we assume that the liquid has practically consmath.tant density and that the gas behaves as an ideal gas and find \n",
- "# (R*Temp)*math.log((P_liquid+4*T/D)/P_NBP) = v_water_liquid*(P_liquid - P_NBP)\n",
- "# let P_liquid = p\n",
"\n",
- "# We will solve the above equation for p\n",
"def f(p): \n",
"\t return v_water_liquid*(p - P_NBP)-(R*Temp)*math.log((p+4*T/D)/P_NBP)\n",
"P_liquid = fsolve(f,300)\n",
"\n",
- "# At this external pressure the pressure inside the bubble is \n",
"P_inside = P_liquid + 4*T/D #[psia]\n",
"\n",
- "# Results\n",
"print \"The liquid pressure at which these boiling nuclei will begin to grow and intiate boiling is %0.1f psia\"%(P_liquid)\n",
"print \"At this external pressure the pressure inside the bubble is %0.1f psia\"%(P_inside)\n"
],
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch15.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch15.ipynb
index 3eab43ea..a8bdca38 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch15.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch15.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:e78a9af8f6b64f20f90bc773dd4c5b922ed19d33b6608600d787b8b7d2cf559b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,12 +28,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate independent relations among these four species\n",
"\n",
"import math \n",
"\n",
"\n",
- "# The system contains four species\n",
"print \" In this system there are four identifiable chemical species%(which are C,O2,CO2 and CO. The balanced equations we can write among them are\"\n",
"\n",
"print \" C + 0.5O2 = CO\"\n",
@@ -40,20 +39,11 @@
"print \" CO + 0.5O2 = CO2\"\n",
"print \" CO2 + C = 2CO\"\n",
"\n",
- "# Let we call these equations A, B, C and D respectively\n",
- "# These relations are not independent.\n",
- "# If we add A and C and cancel like terms, we obtain B.\n",
- "# So, If we want independent chemical equilibria we must remove equation C\n",
"\n",
- "# Now, if we reverse the direction of B and add it to A, we see that D is also not independent.\n",
- "# Thus, there are only two independent relations among these four species and \n",
"print \" There are only two independent relations among these four species and\"\n",
"\n",
- "# V = C + 2 - P\n",
- "# and we have\n",
"V = 2# No of the variable\n",
"P = 2# No of the phases\n",
- "# So\n",
"C = V + P - 2\n",
"print \" C = V + P - 2\"\n",
"print \" C = 4 - 2 = 2\"\n",
@@ -92,33 +82,21 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Define Phase rule\n",
"\n",
"import math \n",
"\n",
- "#***Data***#\n",
- "# This contains three species.\n",
"print \" The three species in this system are H2 N2 and NH3\"\n",
"N = 3\n",
"print \" There is only one balanced chemical reaction among these species\"\n",
"Q = 1\n",
"\n",
- "# 2NH3 = N2 + 3H2\n",
"C = N - Q\n",
"print \" C = N - Q = %0.0f\"%(C)\n",
- "# Now let us we made the system by starting with pure ammonia.\n",
- "# Assuming that all the species are in the gas phase, ammonia dissociates in H2 and N2 in the ratio of 3:1.\n",
"print \" Let we start with pure ammonia in the system then ammonia will dissociate in H2 and N2 in the ratio of 3:1.\"\n",
"\n",
- "# We can write an equation among their mole fractions, viz\n",
- "# y_H2 = 3*y_N2\n",
"print \" And the relation between their mole fraction is y_H2 = 3*y_N2\"\n",
"\n",
- "# We might modify the phase rule to put in another symbol for stoichiometric restrictions, but the common usage is to write that \n",
- "# Components = species - (independent reactions) - (stoichiometric restriction)\n",
- "# and stoichiometric restriction SR is \n",
"SR = 1\n",
- "# so\n",
"c = N-Q-SR\n",
"print \" We have the modified phase rule as Components = species - independent reactions - stoichiometric restriction\"\n",
"print \" C = N - Q - SR = %0.0f\"%(c)\n"
@@ -154,24 +132,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find number of the components present in the test tube\n",
"\n",
"import math \n",
"\n",
- "#***Data***#\n",
- "# We have been given the reaction \n",
- "# CaCO3(s) = CaO(s) + CO2(g)\n",
"\n",
- "# Here we have three species and one balanced chemical reaction between them\n",
- "# So\n",
"N = 3# No of species\n",
"Q = 1 # no of reaction\n",
"\n",
- "# Since CO2 will mostly be in the gas phase and CaCO3 and CaO will each form separate solid phases, \n",
- "# there is no equation we can write among the mole fractions in any of the phases.\n",
- "# Hence, there is no stoichiometric restriction i.e.\n",
"SR = 0\n",
- "# and the number of the components is\n",
"C = N - Q - SR\n",
"\n",
"print \"Number of the components presents in the test tube are %0.0f\"%(C)\n"
@@ -201,29 +169,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "(a) How many phases are present?\n",
- "(b) How many degrees of freedom are there?\n",
- "(c) If we place a sample of pure CaCO 3 in an evacuated container and heat it, will we find a unique P-T curve?\n",
- "'''\n",
+ "\n",
"import math \n",
"\n",
- "#***Data***#\n",
- "# We have been given the reaction \n",
- "# CaCO3(s) = CaO(s) + CO2(g)\n",
- "# The CaCO3 and CaO form separate solid phases, so we have three phases, two solid and one gas. \n",
- "# So\n",
"P = 3\n",
- "# This is a two component system, so\n",
"C = 2\n",
"\n",
- "# From the phase rule\n",
"V = C + 2 - P\n",
"\n",
- "# If there is only one degree of freedom, then the system should have a unique P-T curve.\n",
- "# Reference [ 2, page 214 ] as reported in the book, shows the data to draw such a curve, which can be well represented by\n",
- "# math.log(p/torr) = 23.6193 - 19827/T\n",
"\n",
"print \" The no. of phases present in the system are %0.0f \"%(P)\n",
"print \" Total no of degrees of freedom is %0.0f \"%(V)\n",
@@ -258,30 +211,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find number of components\n",
"\n",
"import math \n",
"\n",
- "#***Data***#\n",
- "# The system consists of five species.\n",
"print \" The five species present in the system are H2O%( HCl%( H+%( OH- and Cl-. \"\n",
- "# So\n",
"N = 5 # Number of the species \n",
"print \" Here we have two chemical relations:\"\n",
"print \" H2O = H+ + OH- \"\n",
"print \" HCl = H+ + Cl- \"\n",
"\n",
- "# so\n",
"Q = 2 # No of the reactions\n",
"\n",
- "# In addition we have electroneutrality, which says that at equilibrium the total no of positive ions in the solution must be the same as the total no of nagative ions,or\n",
- "# [H+] = [OH-] + [Cl-]\n",
- "# To maintain electroneutrality number of positive and negative ion should be same.\n",
- "# Here [H+] smath.radians(numpy.arcmath.tan(s for the molality of hydrogen ion. This is convertible to a relation among the 'mu's' hence,\n",
- "# it is an additional restriction, so\n",
"SR = 1 \n",
- "# So\n",
- "# The number of components is\n",
"C = N - Q - SR\n",
"\n",
"print \" Number of the components present in the system are C = N - Q - SR = %0.0f\"%(C)\n",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch2.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch2.ipynb
index 76efb50a..fc8059ee 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch2.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch2.ipynb
@@ -33,47 +33,31 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"m = 1. #[lbm] Mass of the steam\n",
"T_1 = 300. #[F] Initial temperature\n",
"P_1 = 14.7 #[psia] Initial pressure\n",
"P_sorronding = 14.7 #[psia]\n",
"Q = 50. #[Btu] Amount of the energy added to the system as heat\n",
"\n",
- "# This is a closed system and we can apply the following equations\n",
- "# delta_U_system = sum(dQ_in_minus_out) + sum(dW_in_minus_out) (A)\n",
- "# dS_system = (m*ds)_system = sum((dQ)/T)_in_minus_out + dS_reversible (B)\n",
"\n",
- "# From the steam tables, we look up the properties of steam at temperature 300F and pressure 14.7 psia and find \n",
"u_initial = 1109.6 #[Btu/lbm] Internal energy of the steam\n",
"h_initial = 1192.6 #[Btu/lbm] Enthalpy of the steam\n",
"s_initial = 1.8157 #[Btu/(lbm*R)] Entropy of the steam\n",
"\n",
- "# The work here is done by the system, equal to\n",
- "# -delta_w = P*A_piston*delta_x = P*m*delta_v\n",
"\n",
- "# Calculations\n",
- "# Substituting this in the equation (A) and rearranging, we have\n",
- "# m*delta_(u + P*v) = m*delta_h = delta_Q\n",
- "# From which we can solve for the final specific enthalpy\n",
"h_final = h_initial + Q #[Btu/lbm]\n",
"\n",
- "# Now, by the linear interpolation we find that at h = 1242.6 Btu/lbm and P = 1 atm, temperature of the steam is given \n",
"T_2 = 405.7 #[F] Final temperature\n",
"\n",
- "# At this final temperature and pressure we have the steam properties \n",
"u_final = 1147.7 #[Btu/lbm]\n",
"s_final = 1.8772 #[Btu/(lbm*R)]\n",
"\n",
- "# Thus, increase in the internal energy, enthalpy and entropy are \n",
"delta_u = u_final - u_initial #[Btu/lbm]\n",
"delta_s = s_final - s_initial #[Btu/(lbm*R)]\n",
"delta_h = Q #[Btu/lbm]\n",
"\n",
- "# The work done on the atmosphere is given by\n",
"w = delta_h - delta_u #[Btulbm]\n",
"\n",
- "# Results\n",
"print \"The increase in internal energy of the steam by adding the heat is %0.2f Btu/lbm\"%(delta_u)\n",
"print \"The increase in enthalpy of the steam by adding the heat is %0.2f Btu/lbm\"%(delta_h)\n",
"print \"The increase in entropy of the steam by adding the heat is %0.4f Btu/lbm\"%(delta_s)\n",
@@ -107,41 +91,25 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find Turbine of steam\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T_in = 600. #[F] Input steam temperature\n",
"P_in = 200. #[psia] Input steam pressure\n",
"P_exit = 50. #[psia]\n",
"\n",
- "# Because this is a steady-state, steady-flow process, we use \n",
- "# (work per pound) = W/m = -( h_in - h_out )\n",
"\n",
- "# From the steam table we can read the the inlet enthalpy and entropy as \n",
"h_in = 1322.1 #[Btu/lbm]\n",
"s_in = 1.6767 #[Btu/(lb*R)]\n",
"\n",
- "# Now, we need the value of h_out\n",
"\n",
- "# For a reversible adiabatic steady-state, steady-flow process, we have\n",
- "# sum(s*m_in_minus_out) = ( s_in - s_out ) = 0\n",
"\n",
- "# Which indicates that inlet and outlet entropies are same\n",
- "# We can find the outlet temperature by finding the value of the temperature in the steam table\n",
- "# For which the inlet entropy at 50 psia is the same as the inlet entropy, 1.6767 Btu/(lb*R). \n",
- "# By linear interpolation in the table we find \n",
"T_in = 307.1 #[R]\n",
"\n",
- "# and by the linear interpolation in the same table we find that\n",
"h_out = 1188.1 #[Btu/lb]\n",
"\n",
- "# Calculations\n",
- "# Thus, we find \n",
"W_per_pound = (h_in - h_out) #[Btu/lb]\n",
"\n",
- "# Results\n",
"print \" The work output of the turbine of steam is %0.1f Btu/lb\"%(-W_per_pound)\n"
],
"language": "python",
@@ -169,18 +137,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate compressibility factor of steam\n",
"\n",
"import math \n",
"\n",
"\n",
- "# Variables\n",
"T = 500. #[F]\n",
"P = 680. #[psi]\n",
"\n",
- "# Calculations\n",
- "# It is reported in the book in the table A.1(page 417) that for water \n",
- "# We know that T_r = T/T_c and P_r = P/P_c, so\n",
"T_c = 647.1*1.8 #[R]\n",
"P_c = 220.55*14.51 #[psia]\n",
"w = 0.345\n",
@@ -190,9 +153,7 @@
"z_1 = P_r/T_r*(0.139-0.172/T_r**(4.2))\n",
"z = z_0+w*z_1\n",
"\n",
- "# Results\n",
"print \"The compressibility factor of steam at the given state is %0.3f\"%(z)\n",
- "# Based on the steam table (which may be considered as reliable as the experimental data, the value of z is 0.804.\n"
],
"language": "python",
"metadata": {},
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb
index 84d35a73..c6d63f53 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:503de9d648d2755ec204b8822b124187c44f6b43ec4e442774530019aef1c520"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,27 +28,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate mole fraction of water vapour in air in equilibrium\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 20. #[C]\n",
"P = 1. #[atm]\n",
- "# From Raoult's law y_i*P = x_i*p_i\n",
- "# Rearranging\n",
- "#y_i = x_i*p_i/P\n",
"\n",
- "# Calculations\n",
"x_N2 = 0\n",
"x_O2 = 0\n",
"x_water = 1-x_N2-x_O2\n",
- "# From any steam table we may look up the value of the vapour pressure of water at 20C, finding\n",
"p_water = 0.023 #[atm]\n",
- "# So \n",
"y_water = x_water*p_water/P\n",
"\n",
- "# Results\n",
"print \"The mole fraction of water vapour in air in equilibrium with water is %f\"%(y_water)\n"
],
"language": "python",
@@ -75,44 +67,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate concentration of oxygen\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 20. #[C]\n",
"P = 1. #[atm]\n",
- "# From previous example i.e. example 3.1\n",
"y_water = 0.023\n",
- "#so that \n",
- "#y = y_N2+y_O2\n",
"y = 1-y_water\n",
- "# The oxygen is 0.21 mole fraction of this mix, so that\n",
"y_O2 = y*0.21\n",
- "# It is reported in the book in table A.3 (page 419) that Henry's law cinsmath.tant for oxygen in water at 20C is \n",
"H_O2 = 40100 #[atm]\n",
- "# From Henry's law, we have \n",
- "# y_i = x_i*H_i/P\n",
- "# rearranging\n",
- "# x_i = y_i*P/H_i\n",
- "# so \n",
"x_O2 = y_O2*P/H_O2\n",
- "# By the same math.logic we find that\n",
"y_N2 = y*0.79\n",
- "#and Henry's law consmath.tant for nitrogen in water at 20C is\n",
"H_N2 = 80400. #[atm]\n",
"\n",
- "# Calculations\n",
- "# hence \n",
"x_N2 = y_N2*P/H_N2\n",
- "# Now expresmath.sing the dissolved oxygen concentration in terms of the volume of the oxygen at STP viz. taken as 1 atm and 20C\n",
- "# c = (concentration of dissolved oxygen in equilibrium with air at 1 atm and 20C)\n",
"c = x_O2*998.2/18 #[(mole O2)/(L solution)]\n",
- "# V = (volume of O2, STP)/(L solution)\n",
"V = c*24.06 #[(L O2, STP)/(L solution)]\n",
"V = V*1000 #[(ml O2, STP)/(L solution)]\n",
"\n",
- "# Results\n",
"print \"Concentration of oxygen dissolved in water at equilibrium is %f mL O2, STP)/L solution)\"%(V)\n"
],
"language": "python",
@@ -140,43 +112,23 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate composition in liquied and vapor phase.\n",
"\n",
"import math \n",
"from numpy import *\n",
"\n",
- "# Variables\n",
"P = 1.0 #[atm]\n",
"p_w = 0.023 #[atm] Vapor pressure of pure water\n",
"H_o = 40100 #[atm] Vapor pressure of pure oxygen\n",
"H_n = 80400. #[atm] Vapor pressure of pure nitrogen\n",
"\n",
- "# From Raoult's law, we have\n",
- "# ( y_i*P ) = ( x_i*p_i )\n",
- "# So \n",
- "#For water\n",
- "# ( y_w*P ) = ( x_w*p_i )\n",
- "# For oxygen\n",
- "#( y_o*P ) = ( x_o*p_i )\n",
- "# And for nitrogen\n",
- "#( y_n*P ) = ( x_n*p_i )\n",
- "\n",
- "# Also\n",
- "# ( y_w + y_o + y_n ) = 1\n",
- "# ( x_w + x_o + x_n ) = 1\n",
- "\n",
- "# Calculations\n",
- "# In air, the mole fraction of nitrogen and oxygen are 0.79 and 0.21 respectively. So,\n",
- "# y_o/y_n = 0.21/0.79\n",
- "\n",
- "# We will take the help of matrix method to solve these six equations for six unknowns\n",
+ "\n",
+ "\n",
+ "\n",
"A = matrix([[0.023, 0, 0, -1, 0, 0],[0, 40100, 0, 0, -1, 0],[0, 0 ,80400, 0, 0, -1],[0, 0, 0, 1, 1 ,1],[1 ,1, 1, 0, 0 ,0],[0, 0, 0, 0, 0.79, -0.21]]);\n",
- "#A = matrix([[0.023, 0, 0, -1, 0, 0],[0, 40100, 0, 0, -1, 0],[0, 0, 80400, 0, 0, -1],[0, 0 ,0, 1, 1, 1],[1, 1, 1, 0, 0, 0],[0, 0, 0, 0, 0.79, -0.21]])\n",
"B = matrix([[0],[0],[0],[1],[1],[0]])\n",
"X = linalg.inv(A)\n",
"X = X * B\n",
"\n",
- "# Results\n",
"print \" The composition in liquid and vapor phase are summarized in the following table:\"\n",
"print \" y_water \\t %f\"%(X[3])\n",
"print \" y_oxygen \\t %f\"%(X[4])\n",
@@ -216,58 +168,29 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate\n",
- "Vapour pressure of mixture.\n",
- "Mole fraction of the benzene\n",
- "Mole fraction of the toluene\n",
- "'''\n",
+ "\n",
"import math \n",
"\n",
"\n",
- "# Variables\n",
"T = 20. #[C]\n",
"x_b = 0.80\n",
"x_t = 0.20\n",
- "# Here we calculate the vapour pressures of benzene and toluene at 20C umath.sing the Antoine equation\n",
- "# math.log10(p) = A-B/(T+C)\n",
- "# here pressure p is in torr and temperature T is in C\n",
- "# From the reported table A.2 (page 418) in the book, the consmath.tant A,B,C in the above equation for benzene have the vaues as\n",
"A_b = 6.90565\n",
"B_b = 1211.033\n",
"C_b = 220.79\n",
"\n",
- "# Calculations\n",
- "# So, for benzene\n",
"p_b = 10**(A_b-B_b/(T+C_b))\n",
- "# now from the reported table A.2 (page 418) in the book, the consmath.tant A,B,C in the above equation for toluene have the vaues as\n",
"A_t = 6.95334\n",
"B_t = 1343.943\n",
"C_t = 219.337\n",
- "# So, for toluene\n",
"p_t = 10**(A_t-B_t/(T+C_t))\n",
- "# Now we can compute that for benzene\n",
- "# y_b*P = x_b*p_b\n",
- "# let y_b*P = p_1 , so\n",
"p_1 = x_b*p_b\n",
- "# and correspondingly for toluene\n",
- "# y_t*P = x_t*p_t\n",
- "# let y_t*P = p_2 , so\n",
"p_2 = x_t*p_t\n",
- "# Now adding these two values of benzene and toluene, we have \n",
- "# y_b*P+y_t*P = (y_b+y_t)*P\n",
- "# i.e.\n",
- "# P = (p_1+p_2)/(y_b+y_t)\n",
- "# But we know that (y_b+y_t) must be equal to one i.e.\n",
"y = 1.00 # y =(y_b+y_t) sum of the mole fractions of the benzene and toluene in the gaseous phase\n",
- "# Hence total pressure is\n",
"P = (p_1+p_2)/y\n",
- "# Now the mole fraction of either species in the gaseous phase will be ratio of the partial pressure of the species to the total pressure\n",
- "# so\n",
"y_b = x_b*p_b/P\n",
"y_t = x_t*p_t/P\n",
"\n",
- "# Results\n",
"print \" Vapour pressure of the mixture in the gaseous phase is %f torr\"%(P)\n",
"print \" Mole fraction of the benzene in the vapour phase is %f\"%(y_b)\n",
"print \" Mole fraction of the toluene in the vapour phase is %f\"%(y_t)\n"
@@ -299,21 +222,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate mole fraction of the benzene in air.\n",
"\n",
"import math \n",
"\n",
"\n",
- "# Variables\n",
"T = 20. #[C]\n",
"x_benzene = 1.00\n",
"p_i = 75.2 #[torr] vapour pressure of the benzene\n",
"P = 760. #[torr] Pressure of the atmosphere\n",
"\n",
- "# Calculations\n",
"y_benzene = (x_benzene*p_i)/P\n",
"\n",
- "# Results\n",
"print \" Mole fraction of the benzene in air that is saturated with benzene is %0.1f\"%(y_benzene)\n"
],
"language": "python",
@@ -341,29 +260,23 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate temperature at which the given benzene-toluene mixture will have vapor pressure\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 760. #[mm Hg]\n",
"x_b = 0.8 # Mole fraction of benzene in liquid phase\n",
"x_t = 0.2 # Mole fraction of toluene in liquid phase\n",
"\n",
- "# We will take the help of trial and error method to solve this problem\n",
- "# From the table A.2 ( page 418 ), Antoine equation consmath.tants for benzene are\n",
"A_b = 6.90565\n",
"B_b = 1211.003\n",
"C_b = 220.79\n",
"\n",
- "# and that for the toluene are\n",
"A_t = 6.95334\n",
"B_t = 1343.943\n",
"C_t = 219.337\n",
"T = 82. #[C]\n",
"err = 1.\n",
"\n",
- "# Calculations\n",
"while err > 10**(-3):\n",
" p_b = 10**(6.90565 - 1211.003/(T + 220.79))\n",
" p_t = 10**(6.95334 - 1343.943/(T + 219.337))\n",
@@ -372,7 +285,6 @@
" err = abs((y_b + y_t) - 1)\n",
" T = T + 0.01\n",
"\n",
- "# Results\n",
"print \" The temperature at which the given benzene-toluene mixture will have vapor pressure of 1 atm is %0.3f deg C\"%(T)\n",
"\n",
"\n"
@@ -403,55 +315,37 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate\n",
- "At equilibrium at 20 deg C the rejected amount of oxygen \n",
- "At equilibrium at 20 deg C the rejected amount of nitrogen \n",
- "And total amount of the air rejected from the water\n",
- "'''\n",
+ "\n",
"\n",
"from numpy import *\n",
"import math \n",
"\n",
"\n",
- "# Variables\n",
"V = 0.25 #[L] Volume of water \n",
"T_1 = 0. #[C] Initial temperature of water\n",
"T_2 = 20. #[C] Final temperature of water\n",
"\n",
- "# Calculations\n",
- "# From the example 3.3 the mol fractions of oxygen and notrogen in water at temperature 20 deg C are\n",
"x_o = 5.12*10**(-6) # mole fraction of oxygen\n",
"x_n = 9.598*10**(-6) # mole fraction of nitrogen\n",
"\n",
"\n",
- "# Now we will calculate the mole fraction of oxygen and nitrogen in water at 0 deg C in the same manner as in example 3.3\n",
- "# From the table A.3( page 419), Henry's consmath.tant of oxygen and nitrogen are\n",
"H_o = 2.55*10**(4) #[atm]\n",
"H_n = 5.29*10**(4) #[atm]\n",
"\n",
- "# And vapor pressure of water at 0 deg C is \n",
"p_w = 0.006 #[atm]\n",
"\n",
- "# Now umath.sing the same set of equations as in example 3.3, by changing only H_o, H_n and p_w and solving by matrix method we have \n",
"\n",
"A = matrix([[0.006, 0, 0, -1, 0, 0],[0, 25500, 0, 0, -1, 0],[0, 0 ,52900, 0, 0, -1],[0, 0, 0, 1, 1, 1],[1, 1, 1, 0, 0, 0],[0, 0, 0, 0, 0.79, -0.21]])\n",
"B = matrix([[0],[0],[0],[1],[1],[0]])\n",
"X = linalg.inv(A)\n",
"X = X*B\n",
"\n",
- "# Here the mole fraction of oxygen and nitrogen in water will be X(2) and X(3) respectively\n",
- "# So oxygen rejected is\n",
"M_o_rej = V*( X[1] - x_o )/0.018 #[mole] oxygen\n",
- "# Now At STP volume of the rejected oxygen is given as \n",
"V_o = M_o_rej*24200 #[ml] oxygen\n",
"\n",
- "# And rejected nitrogen is\n",
"M_n_rej = V*( X[2] - x_n )/0.018 #[mole] nitrogen\n",
- "# In terms of volume \n",
"V_n = M_n_rej*24200 #[ml]\n",
"\n",
- "# Results\n",
"print \" At equilibrium at 20 deg C the rejected amount of oxygen will be %0.2f ml\"%(V_o)\n",
"print \" At equilibrium at 20 deg C the rejected amount of nitrogen will be %0.2f ml\"%(V_n)\n",
"print \" And total amount of the air rejected from the water will be %0.2f ml\"%(V_o + V_n)\n"
@@ -483,12 +377,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate amount of rejected nitrogen.\n",
"\n",
"import math \n",
"\n",
"\n",
- "# Variables\n",
"P_1 = 5. #[atm]\n",
"y_n = 0.79 # Mole fraction of nitrogen in atmosphere\n",
"P_2 = 1.0 #[atm]\n",
@@ -496,19 +388,12 @@
"x_w = 0.75 # Fraction of water in human body\n",
"T = 37 #[C] Body temperature of the diver\n",
"\n",
- "# Calculations\n",
- "# At 37 deg temperature, the Henry's consmath.tant for N2 from the table A.3 ( page 419 ) by the linear interpolation is \n",
"H_n = 10.05*10**(4) # [atm]\n",
"\n",
- "# Now, moles of nitrogen rejected will be\n",
- "# M_rej = (moles of body fluid)*( x_N2,5 atm - x_N2,1 atm)\n",
- "# So\n",
"M_rej = (M*1000*x_w/18)*( P_1*y_n/H_n - P_2*y_n/H_n) #[mol]\n",
"\n",
- "# At STP the volume of the rejected nitrogen will be\n",
"V_n = M_rej*24.2 #[L]\n",
"\n",
- "# Results\n",
"print \" Amount of rejected nitrogen will be %0.2f Litre\"%(V_n)\n"
],
"language": "python",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch4.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch4.ipynb
index a248aa47..9278e05d 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch4.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch4.ipynb
@@ -27,23 +27,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find free energy change of the steam\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 671.7 #[R] Equilibrium temperature\n",
"m_steam = 1. #[lbm] Condenmath.sing amount of the steam\n",
- "# Using values from the steam table [1], we find that\n",
"delta_h_condensation = -970.3 #[Btu/lbm] Enthalpy change of the steam\n",
"delta_s_condensation = -1.4446 #[Btu/(lbm*R)] Entropy change of the steam\n",
"\n",
- "# Calculations\n",
- "# Gibb's free energy change of the steam is\n",
"delta_g_condensation = delta_h_condensation - T*delta_s_condensation #[Btu/lbm]\n",
"\n",
"\n",
- "# Results\n",
"print \"Gibb''s free energy change of the steam is %0.1f Btu/lbm\"%(delta_g_condensation)\n"
],
"language": "python",
@@ -72,7 +66,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Gibb's free energy-pressure diagram for graphite-diamond system\n",
"\n",
"from numpy import *\n",
"from matplotlib.pyplot import *\n",
@@ -80,31 +73,16 @@
"\n",
"%pylab inline\n",
"\n",
- "# Variables\n",
- "# let we denote graphite by 'g' and diamond by 'd' \n",
- "# Gibb's free energies of graphite and diamond are given by\n",
"g_g = 0.00 #[kJ/mol] \n",
"g_d = 2.90 #[kJ/mol]\n",
"\n",
- "# Calculations\n",
- "# Specific volumes of graphite and diamond are given by\n",
"v_g = 5.31*10**(-1) #[kJ/(mol*kbar)]\n",
"v_d = 3.42*10**(-1) #[kJ/(mol*kbar)]\n",
"\n",
- "# Now from the equation 4.32 ( page 74) given in the book, we have\n",
- "# (dg/dP) = v , at consmath.tant temperature\n",
- "# where 'v' is specific volume\n",
- "# let us denote (dg/dP) by 'D' ,so\n",
"\n",
"D_g = v_g #[J/(mol*Pa)] For graphite\n",
"D_d = v_d #[J/(mol*Pa)] For diamond\n",
"\n",
- "# Now we can take our plot from P = 0( =1 ), however, total pressure is 1 atm. \n",
- "# If we consider specific volumes of the given species to be consmath.tant with changing the pressure then g-P curve will be a straight line\n",
- "# So the equation of the line for graphite is \n",
- "# g = D_g*P + g_g\n",
- "# and that for diamond\n",
- "# g = D_d*P + g_d\n",
"\n",
"P = linspace(0,30,30).T\n",
"\n",
@@ -115,7 +93,6 @@
"legend(['Diamond, slope = 0.342 (kJ/mol)/kbar','Graphite, slope = 0.532 (kJ/mol)/kbar']);\n",
"\n",
"show()\n",
- "# Results\n",
"print \" Gibb's free energy-pressure diagram for graphite-diamond system at 25 degC is as shown in the graphic window. \"\n",
"\n",
"\n"
@@ -168,31 +145,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find mole fraction of isobutane isomer in equilibrium\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
- "# We have the system which consists of isobumath.tane and normal bumath.tane and isomerisaation is taking place between them \n",
- "# The equilibrium consmath.tant for this reaction is given by\n",
- "# K = (mole fraction of isobumath.tane)/(mole fraction of n-bumath.tane) = x_iso/x_normal\n",
"\n",
- "# For this reaction, at 25C, \n",
"K = 4.52\n",
"\n",
- "# and\n",
- "# x_iso + x_normal = 1\n",
- "# so\n",
- "# K = x_iso/(1-x_iso)\n",
"\n",
- "# Calculations\n",
- "# solving for x_iso\n",
"def f(x_iso): \n",
"\t return x_iso/(1-x_iso)-K\n",
"x_iso = fsolve(f,0)\n",
"\n",
- "# Results\n",
"print \" Mole fraction of isobumath.tane isomer in equilibrium is %0.2f\"%(x_iso)\n"
],
"language": "python",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch5.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch5.ipynb
index 38473b93..259744fa 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch5.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch5.ipynb
@@ -27,33 +27,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the value of DP/DT.\n",
"\n",
"import math \n",
"\n",
"\n",
- "# Variables\n",
"T=212. # [F]\n",
"\n",
- "#**********#\n",
- "#From the steam table, we have \n",
"delta_h=970.3 #[Btu/lbm]\n",
"delta_v=26.78 #[ft**(3)/lbm] and\n",
"\n",
- "# Calculations\n",
- "# changing the units\n",
"delta_h1=delta_h*778 #[ft*lbf/lbm]\n",
"delta_v1=delta_v*144 #[ft*in**(2)/lbm]\n",
"T=671.7 #[R]\n",
"\n",
- "# We have dP/dT = delta_h/(T*delta_v)\n",
- "#Thus\n",
"dP_by_dT=delta_h1/(T*delta_v1) #[psi/R]\n",
"\n",
- "# Results\n",
"print \"The value of dP/dT is %f psi/R\"%(dP_by_dT)\n",
- "#Using the nearest adjacent steam table entries for vapour pressure, wee have \n",
- "#dP_by_dT = delta_P_by_delta_T=(15.291-14.125)/(214-210)=0.2915 psi/R\n"
],
"language": "python",
"metadata": {},
@@ -80,33 +69,21 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate temperature.\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"p_2=0.005 # [psia]\n",
"R=1.987/18. #[1/R]\n",
"\n",
- "#From the steam tables at the tripple point, we find \n",
"T_1=460+32.018 #[R]\n",
"p_1=0.0887 #[psia]\n",
"\n",
- "#delta_h(solid to gas) = delta_h(sublimation) = 1218.7#[Btu/lbm]\n",
"delta_H=1218.7 #[Btu/lbm]\n",
- "#Assuming that the enthalpy change of vaporization is independent of temperature (a fairly good approximation in this case)\n",
- "#we start with Eq. 5.10 and rearrange:\n",
- "#1/T_2 = 1/T_1-(math.log(p_2/p_1))*R/delta_H\n",
- "#So\n",
"\n",
- "# Calculations\n",
"T_2=1/(1/T_1-(math.log(p_2/p_1))*R/delta_H) #[R]\n",
- "#Changing the temperature in farenheit\n",
"T_2F=T_2-460 #[F]\n",
"\n",
- "# Results\n",
"print \"The temperature is %.2f F\"%(T_2F)\n",
- "#BY linear interpolation in the steam tables, one finds -23.8 F. Because of imprecision of linear interpolation, these values are approximately equal.\n"
],
"language": "python",
"metadata": {},
@@ -133,29 +110,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate vapuor pressure of water.\n",
"\n",
"\n",
"import math \n",
"from numpy import *\n",
"\n",
- "# Variables\n",
"T_3=1155.2 #[R]\n",
"T_2=652.9 #[R]\n",
"T_1=787.5 #[R]\n",
"p_2=10. #[psia]\n",
"p_1=100. #[psia]\n",
"\n",
- "# Calculations\n",
- "#******#\n",
- "#Here we can write Eq. 5.9 as reported in the book in the form most often seen.\n",
- "# math.log(p)=A-B/T\n",
- "#Where A and B are consmath.tants to be determined from the pair of T and p values above.\n",
"\n",
- "#we simply write \n",
- "#math.log(10)=A-B/652.9\n",
- "#math.log(100)=A-B/787.5\n",
- "# We have to solve the above two simulmath.taneous equations having two vaiables A and B.\n",
"\n",
"M = matrix([[1, -1/652.9],[1,-1/787.5]])\n",
"C = array([[math.log(10)],[math.log(100)]])\n",
@@ -164,14 +130,10 @@
"A=X[0]\n",
"B=X[1]\n",
"\n",
- "# By straightforward algebra we find the values of A and B. Thus, for 1155.2 R we have \n",
"p_3=math.exp(A-B/T_3)\n",
"\n",
- "# Results\n",
"print \"Vapuor pressure of water at given temperature is %f psia\"%(p_3)\n",
"\n",
- "# p_3=3499 psia. \n",
- "# Note : \"It has been reported in the book that from table 5.1 we see that the correct value is 3000 psia. Thus there is an error of 16% in the predicted pressure.\"\n",
"\n"
],
"language": "python",
@@ -199,21 +161,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find accentric factor.\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# At Tr = 0.7, we read \n",
"Pr=0.023\n",
- "# and thus accentric factor is given by\n",
"\n",
- "# Calculations\n",
"w=-math.log10(0.023)-1\n",
"\n",
- "# Results\n",
"print \"The accentric factor based on the given data is %f\"%(w)\n",
- "#It has been reported in the book that table A.1 shows that the value based on the best data is 0.645.\n"
],
"language": "python",
"metadata": {},
@@ -240,30 +195,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate NBP of water using antoine equation.\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "#From Antoine equation we have \n",
- "# math.log(p) = A-B/(T+C)\n",
- "#Solving above equation for T, we have\n",
- "# T = B/(A-math.log(p))-C\n",
- "#Inserting the values of the consmath.tants for the water which are reported in the given book in the table A.2 (page 419),\n",
- "# and the value of 1.00 atm expressed in torr, we find that \n",
"A=7.96681\n",
"B=1668.21\n",
"C=228.0\n",
"p=760. #[torr]\n",
"\n",
- "# Calculations\n",
- "#Thus\n",
"T=B/(A-math.log10(p))-C\n",
"\n",
- "# Results\n",
"print \"NBP of water umath.sing antoine equation and table A.2 is %f C\"%(T)\n",
"\n",
- "#This does not prove the overall accuracy of the Antoine equation, but does show that whoever fitted the consmath.tants to the experimental data for water made them represent the NBP (100C) very well. \n"
],
"language": "python",
"metadata": {},
@@ -290,44 +233,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate Freezing preesure of water\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T_2=-22. #[C]\n",
- "# converting temperature in farenheit\n",
"T_2F=T_2*9/5+32 #[F]\n",
- "#Expressing T_2 in Rankine\n",
"T_2R=460+T_2F #[R]\n",
- "#delta_h = delta_h(fusion)\n",
"delta_h=143.35*778. #[ft*lbf/lbm]\n",
- "#delta_v = v_water-v_ice\n",
"delta_v=0.01602-0.01747 #[ft**(3)/lbm]\n",
- "# changing the unit \n",
"delta_v1=delta_v*144 #[ft*in/lbm]\n",
"\n",
- "# Calculations\n",
- "#and\n",
"T_1=460+32. #[R]\n",
"dP_by_dT=delta_h/(T_1*delta_v1) #[psi/R] at 32F\n",
"delta_T=T_2R-T_1\n",
"\n",
- "#This gives the rigorously correct slope of the liquid-solid curve at 32F on a P-T diagram.\n",
- "#Here we use P instead of p because neither phase is a gas, so this is not a vapour pressure. \n",
- "#If we further assume that the solid-liquid curve is a straight line, which is equivalent to assuming that delta_h/(T*deta_v)is a consmath.tant over the region of interest, then we can estimate the pressure at -22C = -7.6F by\n",
- "#So\n",
"\n",
"delta_P=(dP_by_dT)*delta_T #[psi]\n",
"\n",
- "# From this we can estimate the final pressure as\n",
"delta_P=delta_P+0.09 #[psi]\n",
"\n",
- "# Results\n",
"print \"Freezing preesure of water at given temperature is %f psi\"%(delta_P)\n",
- "# In this case, the experimental pressure is well known, because this temperature corresponds to the tripple point between liquid and water, \n",
- "# ice I(the common variety), and ice III, a variety that does not exist at pressure below about 30000 psia (see figure 1.10 in the book). \n",
- "# The measured value is 30000 psia, which shows that our assumption of a straight line on a P-T plot (delta_h/(T*delta_v)=consmath.tant) is only approximately correct.\n",
"\n"
],
"language": "python",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb
index fb02a429..16c57280 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch6.ipynb
@@ -35,28 +35,17 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 20. #[C]\n",
"m_1 = 0. #[molal]\n",
"m_2 = 1. #[molal]\n",
"\n",
- "# Calculations\n",
- "# The data given in the figure 6.2 , as reported in book, can be repersented with excellent accuracy by a simple data fitting equation\n",
- "#V = 1.0019+0.054668*m-0.000418*m**(2)\n",
- "# Where 'V' is( solution volume, liters per 1000g of water ) and 'm' is the molality of ethanol in water\n",
- "#The partial molal volume is obtained by differentiating the expression of the 'V' with respect to 'm'\n",
- "# v_ethanol = dV/dm = 0.054668-2*0.000418*m\n",
- "# So that at zero molality \n",
"m = 0 #[molal]\n",
- "# the partial molal volume is \n",
"v_1 = 0.054668-2*0.000418*m #[L/mol]\n",
- "# and at\n",
"m = 1. #[molal]\n",
"v_2 = 0.054668-2*0.000418*m #[L/mol]\n",
"v_1 = v_1*1000 #[cm**(3)/mol]\n",
"v_2 = v_2*1000 #[cm**(3)/mol]\n",
"\n",
- "# Results\n",
"print \"Partial molal volume of ethanol in water at zero molality is %f cm**3/mol\"%(v_1)\n",
"print \" Partial molal volume of ethanol in water at unity molality is %f cm**3/mol\"%(v_2)\n"
],
@@ -86,35 +75,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate Volume change on mixing etanol and water\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"n_eth = 1. #[mol]\n",
"W_water = 1. #[kg]\n",
"Temp = 20. #[C]\n",
"\n",
- "# For pure ethanol at 20C\n",
"v_ethanol = 58.4 #[cm**(3)/mol]\n",
"v_ethanol = v_ethanol/1000 # [L/mol]\n",
"v_water = 1.0019 #[L/1000g]\n",
"\n",
- "# Calculations\n",
- "# Molality of ethanol in water is\n",
"m = n_eth/W_water #[molal]\n",
- "# We have the equation used in the previous example as\n",
"V_final_mix = 1.0019+0.054668*m-0.000418*m**(2)\n",
"\n",
- "# Where 'V' is( solution volume, liters per 1000g of water ) and 'm' is the molality of ethanol in water\n",
- "# V is the final volume of the solution \n",
- "# The volume expansion on moxing is \n",
"V_exp = V_final_mix-v_ethanol-v_water #[L]\n",
"V_exp = V_exp*1000 #[cm**(3)]\n",
"\n",
- "# Results\n",
"print \"Volume change on mixing emath.tanol and water is %0.3f cubic cm\"%(V_exp)\n",
- "# We see that there is a net contraction on mixing of the volume of the ethanol added.\n",
"\n"
],
"language": "python",
@@ -142,25 +120,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Volume change on mixing etanol and water \n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# All the data are same as in the previous example \n",
- "# The equation 6.5 reported in the book is \n",
"v_i_average = 0.05425 #[L/mol]\n",
- "# and\n",
"v_i_0 = 0.0584 #[L/mol]\n",
"delta_n = 1.00 #[mol]\n",
"\n",
- "# Calculations\n",
"delta_V_mixing = (v_i_average-v_i_0)*delta_n #[L]\n",
"delta_V_mixing = delta_V_mixing*1000 #[cm**(3)]\n",
"\n",
- "# Results\n",
"print \"Volume change on mixing etanol and water is %f cm**3\"%(delta_V_mixing)\n",
- "# Which is same as the solution in example 6.2\n"
],
"language": "python",
"metadata": {},
@@ -194,38 +164,22 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"m = 1. #[molal] Molality of the solution with respect to ethanol\n",
"M_water = 18. #[g/mol] molecular weight of water\n",
"\n",
- "# Calculations\n",
- "# First we convert molality to mole fraction\n",
"x_ethanol = m/(m + 1000/M_water)\n",
"\n",
- "# For the low range of data point on figure 6.5(page 112), we can fit an equation\n",
- "# (Specific volume ) = 0.018032 + 0.037002*x_ethanol - 0.039593*x_ethanol**(2) + 0.21787*x_ethanol**(3)\n",
- "# This is applicable for (0 < x_ethanol < 0.04 ), which is the case we have\n",
"\n",
- "# So\n",
"v_math_tan = 0.018032 + 0.037002*x_ethanol - \\\n",
"0.039593*x_ethanol**(2) + 0.21787*x_ethanol**(3) #[L/mol]\n",
"\n",
- "# Now we will find the derivative of the specific volume with respect to x_ethanol at the known point x_ethanol\n",
- "# (dv/dx_ethanol) = 0.037002 - 2*0.039593*x_ethanol + 3*0.21787*x_ethanol**(2)\n",
- "# Hence\n",
"v_derv_math_tan = 0.037002 - 2*0.039593*x_ethanol + 3*0.21787*x_ethanol**(2) #[L/mol]\n",
"\n",
- "# By simple geometry from the figure 6.6(page 113) of the book we find\n",
- "# a = v_math_tan + (1-x_math_tan)*(dv/dx_1)_math_tan\n",
- "# b = v_math_tan - x_math_tan*(dv/dx_1)_math_tan\n",
"\n",
- "# We have a = v_ethanol and b = v_water\n",
"x_math_tan = x_ethanol\n",
- "# So\n",
"v_ethanol = v_math_tan + (1-x_math_tan)*(v_derv_math_tan) #[L/mol]\n",
"v_water = v_math_tan - x_math_tan*(v_derv_math_tan) #[L/mol]\n",
"\n",
- "# Results\n",
"print \" Partial molar volume of the ethanol in the given solution is %f L/mol\"%(v_ethanol)\n",
"print \" Partial molar volume of the water in the given solution is %f L/mol\"%(v_water)\n"
],
@@ -263,23 +217,17 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"x_sulph = 0.6\n",
"x_water = 0.4\n",
"Temp = 200. #[F]\n",
- "# In the given figure 6.8 in the book, drawing the math.tangent to the 200F curve at 60 wt% H2SO4, we find that it intersects the 0%(pure water) axis at 25 Btu/lbm, and the 100% H2SO4 axis at -100Btu/lbm. i.e.\n",
"h_water_per_pound = 25. #[Btu/lbm]\n",
"h_sulph_per_pound = -100. #[Btu/lbm]\n",
- "# also molecular weight of water and sulphuric acid are\n",
"M_water = 18. #[lbm/lbmol]\n",
"M_sulph = 98. #[lbm/lbmol]\n",
"\n",
- "# Calculations\n",
- "# Using equation 6.20 given in the book we have\n",
"h_water = h_water_per_pound*M_water #[Btu/lbmol]\n",
"h_sulph = h_sulph_per_pound*M_sulph #[Btu/lbmol]\n",
"\n",
- "# Results\n",
"print \"Partial molar enthalpy of water in the mixture is %f Btu/lbmol\"%(h_water)\n",
"print \" Partial molar enthalpy of H2SO4 in the mixture is %f Btu/lbmol\"%(h_sulph)\n"
],
@@ -309,31 +257,20 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The amount of heat removed to keep the temperature constant\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"x_sulph = 0.6\n",
"x_water = 0.4\n",
"M_i = 18. #[lbm/lbmol]\n",
"Temp = 200. #[F]\n",
- "# From Equation 6.11 as given in the book, we have \n",
- "# dQ/dm_in = h_i-h_in\n",
- "# where h_i is partial molal enthalpy which is taken from the example 6.7 and h_in is the pure species molar enthalpy which is read from the figure 6.8.\n",
- "# So at 200F we have \n",
"h_i = 25. #[Btu/lbm]\n",
"h_in = 168. #[Btu/lbm]\n",
"\n",
- "# Calculations\n",
- "# hence\n",
"dQ_by_dm_in = h_i-h_in #[Btu/lbm]\n",
- "# Now \n",
"dQ_by_dn_in = M_i*dQ_by_dm_in #[Btu/lbmol]\n",
"\n",
- "# Results\n",
"print \"The amount of heat removed to keep the temperature consmath.tant is %f Btu/lbm of water added\"%(dQ_by_dm_in)\n",
- "# The negative sign shows that this mixing is exothermic we must remove 143 Btu/lbm of water added.\n"
],
"language": "python",
"metadata": {},
@@ -360,28 +297,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The amount of heat added or removed \n",
"import math \n",
"\n",
- "# Variables\n",
"m_sulph = 0.4\n",
"m_water = 0.6\n",
"m = m_sulph+m_water\n",
"Temp = 200. #[F]\n",
- "# Here at 200F we can read the solution enthalpy h_solution and pure H2SO4 enthalpy h_sulph such that\n",
"h_solution = -43. #[Btu/lbm]\n",
"h_sulph = 168. #[Btu/lbm]\n",
- "# By energy balance, umath.sing h_0_water from example 6.7 in the book i.e.\n",
"h_0_water = 53. #[Btu/lbm]\n",
"\n",
- "# We find \n",
- "# Calculations\n",
"delta_Q = m*h_solution-(m_sulph*h_sulph+m_water*h_0_water) #[Btu]\n",
"\n",
- "# Results\n",
"print \"The amount of heat added or removed is %f Btu\"%(delta_Q)\n",
- "# We must remove the given amount of to hold the temperature consmath.tant.\n",
- "# Note However the book has some mistake in calculation and reporting -172 Btu\n"
],
"language": "python",
"metadata": {},
@@ -408,23 +336,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate enthalpy of the solution\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"x_sulph = 0.6\n",
"x_water = 0.4\n",
"Temp = 200. #[F]\n",
- "# At the 200F we have\n",
"h_water = 25. #[Btu/lbm]\n",
"h_sulph = -100. #[Btu/lbm]\n",
"\n",
- "# Calculations\n",
- "# From equation 6.16 (as reporated in the book), rewritten for masses instead of moles we have \n",
"h_solution = h_water*x_water+h_sulph*x_sulph # [Btu/lbm]\n",
"\n",
- "# Results\n",
"print \"Enthalpy of the solution is %f Btu/lbm\"%(h_solution)\n"
],
"language": "python",
@@ -452,23 +374,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Value of the dv_b/dx_a at x_b =0\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"x_b = 0\n",
"x_a = 1\n",
- "# We have\n",
- "#dv_a/dx_a = 3*x_b**(2)+2*x_b\n",
- "# We have the equation \n",
- "# dv_b/dx_a = -(dv_a/dx_a)/(x_b/x_a)\n",
- "# So\n",
- "# dv_b/dx_a = -(x_a/x_b)*(3*x_b**(2)+2*x_b) \n",
- "# Calculations\n",
"dv_b_by_dx_a = x_a*(-3*x_b-2)\n",
"\n",
- "# Results\n",
"print \"Value of the dv_b/dx_a at x_b =0 is %0.0f\"%(dv_b_by_dx_a)\n"
],
"language": "python",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb
index 55160b19..7020eec3 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:1516bb23afc335a7092a1afab7991f3ed9c5be7c83937717220b23a740bce801"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,38 +28,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Fugacity of propane gas\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
"\n",
- "# Variables\n",
"T = 220+459.67 #[R] Temperature in Rankine\n",
"P = 500. #[psia] Pressure\n",
"R = 10.73 #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant\n",
"\n",
- "# We will follow the method 'a' as the book has given the multiple methods to solve this problem\n",
- "# From the equation 7.10 given in the book(page 132), we have \n",
- "# (f/P) = exp((-1/(R*T))*intgrate(a*dp)) , with intgration limits from zero to 'P'\n",
- "# Where 'a' is known as volume residual\n",
- "# Let us say , I = intgrate(a*dp)\n",
"\n",
- "# From the table 7.A(page 134) given in the book, the average value of alpha(a) is \n",
"a = 4.256 #[ft**(3)/lbmol]\n",
- "# so \n",
"\n",
- "# Calculations\n",
"def f6(p): \n",
"\t return a*p**(0)\n",
"\n",
"I = quad(f6,0,P)[0]\n",
"\n",
"\n",
- "# Now \n",
"f = P*math.exp((-1/(R*T))*I) #[psia]\n",
"\n",
- "# Results\n",
"print \"Fugacity of propane gas at the given condition is %.0f psia\"%(round(f,1))\n"
],
"language": "python",
@@ -86,28 +75,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate\n",
- "Compresssibility factor the liquid water\n",
- "Volume residual for the liquid water \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 100. + 460 #[R] Temperature of the system in Rankine\n",
"P = 1. # [psia]\n",
"R = 10.73 #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant\n",
"\n",
- "# Calculations\n",
- "# From the steam table, the specific volume of the water at 101.7 F, which is nearly equal to 100 F, and 1 psia is\n",
"v = 0.016136*18 #[ft**(3)/lbmol]\n",
"z = round((P*v)/(R*T),5)\n",
"\n",
- "# and volume residual is given by\n",
"a = int(((R*T)/P))*(1-z) #[ft**(3)/lbmol]\n",
"\n",
- "# Results\n",
"print \" Compresssibility factor the liquid water at the given condition is %.5f \"%(z)\n",
"print \"Volume residual for the liquid water at the given condition is %0.1f cubic feet/lbmol\"%(a)\n"
],
@@ -137,38 +117,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Fugacity of the pure liquid water\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
- "# Variables\n",
"T = 100+460. #[R] Temperature\n",
"P = 1000. #[psia] Pressure\n",
"R = 10.73 #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant\n",
"\n",
- "# From the figure 7.3(page 138) we see that as P tends to zero, (f/P) tends to 1, so f tends to 0. Therefore, f_a tends to zero also in the diagram\n",
- "# fugacity at point b is calculated by the equation\n",
- "# We have\n",
"f_b = 0.95 #[psia]\n",
- "# We also can write\n",
"f_c = f_b #[psia]\n",
- "# To find the value of f_d, we use the equation \n",
- "# here 'v' is practically consmath.tant(for a liquid), and\n",
"v = 0.016136*18 #[ft**(3)/lbmol]\n",
"\n",
- "# and from the figure 7.3, we have \n",
"P_d = 1000. #[psia]\n",
"P_c = 1. #[psia]\n",
"\n",
- "# Calculations\n",
- "# integrating the left hand side of the equation with the integration limits f_c and f_d and solving, we have\n",
"def f4(p): \n",
"\t return p**(0)\n",
"\n",
"f_d = f_c*math.exp((v/(R*T))* (quad(f4,P_c,P_d))[0])\n",
"\n",
- "# Results\n",
"print \"Fugacity of the pure liquid water at the given condition is %0.1f psia\"%(f_d)\n"
],
"language": "python",
@@ -196,63 +164,39 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate vapor and liquid \n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 78.15 #[C]\n",
"P = 1.0 #[atm]\n",
- "# Here we name ethanol as the species 'a', and water as the species 'b', and name the vapor as phase 1 and the liquid as the phase 2. \n",
- "# Thus vapor pressures of the pure species at the given temperature are\n",
"p_a_0 = 0.993 #[atm] Pure ethanol vapor pressure at 78.15C\n",
"p_b_0 = 0.434 #[atm] Pure water vapor pressure at 78.15C\n",
"\n",
- "# Also composition of the azeotrope is\n",
"x_a = 0.8943 # Amount of ethanol in the liquid phase \n",
"x_b = 0.1057 # Amount of water in liquid phase \n",
"\n",
- "# Also, for an azeotrope mixture\n",
"y_a = x_a # Amount of ethanol in vapor phase \n",
"y_b = x_b # Amount of water in the vapor phase \n",
"\n",
- "# For ideal gas , fugacity is equal to the total pressure of the system, i.e.\n",
- "# f_i_0 = P , (where P is the system pressure)\n",
- "# For pure liquid system, fugacity of a species is independent of the total pressure of the system and is equal to the pure species vapor pressure at this temprature, i.e.\n",
- "# f_i_0 = p_i\n",
"\n",
- "# Now, fugacity of each species in gaseous phase and liquid phase will be equal \n",
- "# so, writing the expression for both liquid and gas phase fugacity and equatinh them, we have\n",
- "# f_a_2 = f_a_1 = (y*Y*P)_a_1 = (x*Y*p)_a_2..........................................(1)\n",
- "# f_b_2 = f_b_1 = (y*Y*P)_b_1 = (x*Y*p)_b_2..........................................(2)\n",
"\n",
- "# We observe that this system has four values of 'Y', one for each of the two species in each of two phases.\n",
- "# Mixtures of the ideal gases are all ideal solutions and the value of 'Y' for all the species in ideal gas phase are unity, so for above two equations\n",
"Y_a_1 = 1.0\n",
"Y_b_1 = 1.0\n",
"\n",
- "# Calculations\n",
- "# Now putting the values these gaseous phase 'Y's in their respective equations 1 and 2, and solving for the liquid phase 'Y's, we have\n",
"Y_a_2 = ((y_a*P)/(x_a*p_a_0))\n",
"Y_b_2 = ((y_b*P)/(x_b*p_b_0))\n",
"\n",
- "# From equations 1 and 2, the fugacity of each species in each phase is given by\n",
"f_a_1 = (y_a*Y_a_1*P) #[atm]\n",
"f_b_1 = (y_b*Y_b_1*P) #[atm]\n",
- "# and from the definition we have \n",
"f_a_2 = f_a_1 #[atm]\n",
"f_b_2 = f_b_1 #[atm]\n",
"\n",
- "# As we have defined above about the pure species fugacity, so \n",
- "# For vapor phase\n",
"f_a_1_0 = P #[atm]\n",
"f_b_1_0 = P #[atm]\n",
"\n",
- "# For liquid phase\n",
"f_a_2_0 = p_a_0 #[atm]\n",
"f_b_2_0 = p_b_0 #[atm]\n",
"\n",
- "# Results\n",
"print \" The results are summarized in the following table: \\n\\tPhase\\t\\t\\t\\t Etahnol(i=a)\\t\\t\\t\\t Water,i=b\"\n",
"print \" \\tVAPOR PHASE 1\"\n",
"print \" \\t f_i_1 atm \\t\\t\\t %.4f \\t\\t\\t\\t %.4f\"%(f_a_1,f_b_1)\n",
@@ -297,46 +241,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Fugacity of the methane in the gaseous mixture \n",
- "Fugacity of the butane in the gaseous mixture\n",
- "'''\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 220+460. #[R] Temperature in rankine\n",
"P = 1000. #[psia] Pressure\n",
"y_methane = 0.784 # Mol fraction of methane in the given mixture\n",
"y_butane = (1-y_methane) # Mol fraction of n-bumath.tane in the given mixture\n",
"R = 10.73 #[(psia*ft**(3)/(lbmol*R))] gas consmath.tant\n",
"\n",
- "# In this problem, we need the partial molar volume residual.\n",
- "# We find its value at 100 psia by plotting the volume resduals at 100 psia as a function of mole fraction, as shown in figure 7.9( page 150 )\n",
- "# drawing the math.tangent to the data points at x_methane = 0.784 and reading its intercept on the 100 mol% methane axis as 0.6 ft**(3)/lbmol\n",
- "# similarily volume residual is determined for all other pressures and plot them vs pressure, as shown in Figure 7.10 (page 151). \n",
- "# From this plot we find the integral we need by numerical integration ( trapazoid rule ) as 290 ft **(3)/lbmol.\n",
"\n",
- "# Thus, for methane \n",
- "# Let I = intefrate(a_i*dp)) and J = f_i/(P*y_i) , so\n",
"Im = 290. #[ft**(3)/lbmol]\n",
"\n",
- "# Calculations\n",
- "# and\n",
"Jm = math.exp((-1/(R*T))*Im)\n",
"\n",
- "# hence \n",
"f_methane = Jm*P*y_methane #[psia] fugacity of methane\n",
"\n",
- "# doing the same process for bumath.tane, we find \n",
"Ib = 5859. #[ft**(3)/lbmol]\n",
- "# so, for bumath.tane we find\n",
"Jb = math.exp((-1/(R*T))*Ib)\n",
- "# hence \n",
"f_butane = Jb*P*y_butane #[psia] fugacity of bumath.tane\n",
"\n",
- "# Results\n",
"print \" Fugacity of the methane in the gaseous mixture is %0.0f psia\"%(f_methane)\n",
"print \" Fugacity of the butane in the gaseous mixture is %0.1f psia\"%(f_butane)\n"
],
@@ -366,35 +290,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The value of v_i\n",
- "The value of Y_i\n",
- "The value of phi_cap_i\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 220+460. #[R] Temperature in rankine\n",
"P = 1000. #[psia] Pressure\n",
"x_methane = 0.784 # Mol fraction of methane in the given mixture\n",
"x_bumath_tane = (1-x_methane) # Mol fraction of n-bumath_tane in the given mixture\n",
"\n",
- "# From the example 7.5, we found directly from the PvT data that for methane\n",
- "# (f_i/(P*x_i)) = 0.961 = (v_i*Y_i) = phi_cap_i\n",
- "# So, we can write that\n",
"v_i_into_Y_i = 0.961\n",
"phi_cap_i = 0.961\n",
"\n",
- "# Calculations\n",
- "# From Starling's tables of hydrocarbon properties we read that for pure methane at this T and P,\n",
- "# (F_i/P) = v_i = phi_i , from which it follows \n",
"v_i = 0.954\n",
"phi_i = v_i\n",
"Y_i = phi_cap_i/v_i\n",
"\n",
- "# Results\n",
"print \" The value of v_i is %f\"%(v_i)\n",
"print \" The value of Y_i is %f\"%(Y_i)\n",
"print \" The value of phi_cap_i is %f\"%(phi_cap_i)\n"
@@ -426,24 +337,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The value of v=phi\n",
"import math \n",
"\n",
- "# Variables\n",
"T_r = 0.889\n",
"P_r = 1.815\n",
"\n",
- "# Using the properties of n-bumath.tane from appendix A.1 and the equation 7.W, we find that\n",
- "# (f/P) = v = phi = exp((P_r/T_r)*f(T_r,w))\n",
- "# Say, f(T_r,w) = f_f\n",
"f_f = -0.48553\n",
"\n",
- "# Calculations\n",
- "# so\n",
"v = math.exp((P_r/T_r)*f_f)\n",
"phi = v\n",
"\n",
- "# Results\n",
"print \" The value of v=phi for n-bumath.tane at given condition is %f\"%(v)\n"
],
"language": "python",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch8.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch8.ipynb
index c8a2f991..494454b7 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch8.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:d221da8e75f5f6adc3adedef3c1ac8c09cdf0ffedf5eae70dc97519a155edf88"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,32 +28,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The K factor of acetone\n",
- "The K factor of water\n",
- "The relative volatility \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"x_acetone = 0.05 # Mole fraction of Acetone in liquid\n",
"x_water = (1-x_acetone)\n",
- "# Umath.sing the values from table 8.1(page 162) as reported in the book we have \n",
"y_acetone = 0.6381 # Mole fraction of Acetone in vapour\n",
"y_water = (1-y_acetone)\n",
- "# We know that\n",
- "# K_i = y_i/x_i\n",
"\n",
- "# Calculations\n",
- "# So 'K' factors are\n",
"K_acetone = y_acetone/x_acetone\n",
"K_water = y_water/x_water\n",
- "# and relative volatility is \n",
"a = K_acetone/K_water\n",
"\n",
- "# Results\n",
"print \"The K factor of acetone is %f\"%(K_acetone)\n",
"print \" The K factor of water is %f\"%(K_water)\n",
"print \" The relative volatility is %f\"%(a)\n"
@@ -84,48 +72,30 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Liquid-phase activity coefficient for acetone\n",
- "Liquid-phase activity coefficient for water\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 1. #[atm]\n",
"Temp = 74.8 #[C]\n",
- "# Here we need to know the vapour pressure p_i correspondding ti the temperatures of each of the values in the table.\n",
- "# We can estimate them umath.sing Antoine equation by the help of the values given in table A.2(page 418) in the book\n",
- "# math.log10(p_i) = A-B/(T+C)\n",
- "# for acetone the consmath.tants are given as\n",
"A_a = 7.02447\n",
"B_a = 1161\n",
"C_a = 224\n",
- "# So p_acetone is given by\n",
"p_acetone = 10**(A_a-B_a/(Temp+C_a)) #[mmHg]\n",
- "# similarily for water the consmath.tants are given as\n",
"A_w = 7.94917\n",
"B_w = 1657.462\n",
"C_w = 227.02\n",
"\n",
- "# Calculations\n",
- "# So p_water is given by\n",
"p_water = 10**(A_w-B_w/(Temp+C_w)) #[mmHg]\n",
- "# expresmath.sing the pressures in atm\n",
"p_acetone = p_acetone/760 #[atm]\n",
"p_water = p_water/760 #[atm]\n",
- "# Now from table 8.1 given the book\n",
"y_acetone = 0.6381\n",
"x_acetone = 0.05\n",
"y_water = (1-y_acetone)\n",
"x_water =(1-x_acetone)\n",
- "# Hence the liquid-phase activity coefficients for acetone and water are given as\n",
"Y_acetone = y_acetone*P/(x_acetone*p_acetone)\n",
- "#and\n",
"Y_water = y_water*P/(x_water*p_water)\n",
"\n",
- "# Results\n",
"print \"Liquid-phase activity coefficient for acetone is %f\"%(Y_acetone)\n",
"print \" Liquid-phase activity coefficient for water is %f\"%(Y_water)\n"
],
@@ -155,73 +125,42 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Comparison of experimental values to those computed by the ideal solution assumption\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"x_a = 0.05 # mole fraction of acetone in liquid phase\n",
"x_w = (1-x_a) # mole fraction of the water in the liquid phase\n",
"P = 1.00 #[atm] Total pressure in vapor phase\n",
"\n",
- "# Let us assume that the solution is ideal \n",
- "# We will take the help of trial and error methad and find a temperature at which sum of the computed ideal solution vapor phase mole fraction is 1.00\n",
- "# For our first try let the temperatute is \n",
"T_1 = 80. #[C]\n",
- "# Now from Table A.2( page 418), the Antoine equation consmath.tant for acetone are\n",
"A_a = 7.02447\n",
"B_a = 1161.\n",
"C_a = 224.\n",
- "# and that for water \n",
"A_w = 7.94917\n",
"B_w = 1657.462\n",
"C_w = 227.02\n",
"\n",
- "# Calculations\n",
- "# Now from Antoine equation \n",
- "# math.log10(p) = A - B/(T+C)\n",
- "# So, vapor pressure for pure acetone at 80 C (in atm)is\n",
"p_a_1 = (1./760)*10**(A_a - B_a/(T_1+C_a)) #[atm]\n",
- "# and that of water is\n",
"p_w_1 = (1./760)*10**(A_w - B_w/(T_1+C_w)) #[atm]\n",
"\n",
- "# Now from Raoult's law \n",
- "# y_i*P = x_i*p_i\n",
- "# so, vapor phase composition at this temperature is\n",
"y_a_1 = (x_a*p_a_1)/P\n",
"y_w_1 = (x_w*p_w_1)/P\n",
"\n",
- "# Sum of these two compostion is\n",
"y_1 = (y_a_1 + y_w_1)\n",
- "# Since, y_1 is not equal to 1.00, so assumed temperature is wrong\n",
"\n",
- "# Now we will assume our temperature as \n",
"T_2 = 96.4060 #[C]\n",
"\n",
- "# Again, from Antoine equation \n",
- "# math.log10(p) = A - B/(T+C)\n",
- "# So, vapor pressure for pure acetone at 80 C (in atm)is\n",
"p_a_2 = (1./760)*10**(A_a - B_a/(T_2+C_a)) #[atm]\n",
- "# and that of water is\n",
"p_w_2 = (1./760)*10**(A_w - B_w/(T_2+C_w)) #[atm]\n",
"\n",
- "# Now from Raoult's law \n",
- "# y_i*P = x_i*p_i\n",
- "# so, vapor phase composition at this temperature is\n",
"y_a_2 = (x_a*p_a_2)/P\n",
"y_w_2 = (x_w*p_w_2)/P\n",
"\n",
- "# Sum of these two compostion is\n",
"y_2 = (y_a_2 + y_w_2)\n",
- "# Value of y_2 is equal to 1.00, so our assumption is right\n",
- "# These are the values when the solution would behave as ideal, but this is not the actual scene\n",
- "# The experimental values of the boiling point and vapor phase composition are listed in the table 8.1(page 162) given in book, which are\n",
"T_e = 74.8 #[C] Boiling temperature\n",
"y_a_e = 0.6381 # vapor phase composition of acetone\n",
"\n",
- "# Results\n",
"print \" Comparison of experimental values to those computed by the ideal solution assumption x_acetone = 0.05 and P = 1.00 atm\"\n",
"print \" \\t\\t\\t Experimental Values from Table 8.1 \\t\\t\\t\\tValues calculated assuming idea solution\"\n",
"print \" Equilibriumboiling) \\t\\t%0.1f \\t\\t\\t\\t\\t\\t\\t\\t\\t %0.1f temperature T deg C\"%(T_e,T_2)\n",
@@ -255,42 +194,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate\n",
- "Total moles of water present in the first phase\n",
- "Total moles of water present in the second phase\n",
- "'''\n",
+ "\n",
"import math \n",
"\n",
- "# Variables\n",
"n_water = 80. #[mol]\n",
"n_bumath_tanol = 20. #[mol]\n",
"n_total = n_water+n_bumath_tanol #[mol]\n",
"\n",
- "# Here from the figure 8.12 given in the book we can find the mole fraction of the water in each phase \n",
- "# Let x_feed be the moles of water(species a) fed/total moles fed.\n",
"x_feed = 0.8\n",
"x_a_1 = 0.65\n",
"x_a_2 = 0.98\n",
"\n",
- "# Calculations\n",
- "# By material balence for water\n",
- "# n_total*x_feed = n_1*x_a_1+n_2*x_a_2, \n",
- "# here n_1 and n_2 are no. of mole in each phase \n",
- "# So (n_1+n_2) = n_total\n",
- "# Thus\n",
- "# n_total*x_feed = n_1*x_a_1+(n_total-n_1)*x_a_2\n",
- "# solving further\n",
- "# n_1/n_total = (x_feed-x_a_2)/(x_a_1-x_a_2)\n",
- "# and hence\n",
"n_1 = (x_feed-x_a_2)/(x_a_1-x_a_2)*n_total #[mol]\n",
"n_2 = (n_total-n_1) #[mol]\n",
- "# so\n",
"n_a_1 = 0.65*n_1 #[mol]\n",
- "# and\n",
"n_a_2 = 0.98*n_2 #[mol]\n",
"\n",
- "# Results\n",
"print \" Total moles of water present in the first phase is %f mol\"%(n_a_1)\n",
"print \" Total moles of water present in the second phase is %f mol\"%(n_a_2)\n"
],
@@ -320,33 +239,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The equilibrium amount of water in liquid at bubble-point\n",
- "The equilibrium amount of water in liquid at bubble-point\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# At equilibrium on dew-point the conditions are given as\n",
"P = 1. #[atm]\n",
"y_water = 0.60\n",
- "# From the figure 8.12d, if we start at 130C and 60 mol% water and cool.\n",
- "# We meet he dew-point line at 99C, and at the same temperature the bubble-point curve shows\n",
"x_water_1 = 0.22\n",
- "# Doing the same procedure with y_water = 0.90, we get the dew-point at the rightmost side at 98C \n",
- "# In this case, the bubble-point line is the steeply sloping one at hte right, from wich we read \n",
"x_water_2 = 0.99\n",
- "# Similarily with y_water = 0.73, we get that two dew-point meet at 92C.\n",
- "# Vapour of this composition is in equilibrium with both liquid phases, as sketched in hte figure 8.12d.\n",
- "# Vapour with any other composition is in equilibrium with only one liquid i.e.\n",
- "# if y_water < 0.73, then\n",
- "# x_water <0.65\n",
- "# and if y_water > 0.73, then\n",
- "# x_water >0.98\n",
- "\n",
- "# Results\n",
+ "\n",
"print \" The equilibrium amount of water in liquid at bubble-point for the dew-point composition y_water=60 mol%% is %f mol%% water\"%(x_water_1)\n",
"print \" The equilibrium amount of water in liquid at bubble-point for the dew-point composition y_water=90 mol%% is %f mol%% water\"%(x_water_2)\n"
],
@@ -376,15 +277,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Four activity coefficients and fufacities\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 1.00 #[atm] assumed total vapor pressure\n",
- "# In psia unit \n",
"P1 = 14.7 #[psia]\n",
- "# From the figure 8.12d ( page 176 ) in book, the mole fractions of water in all the three phases and temperature are known and given as\n",
"x_1_water = 0.65\n",
"x_1_bumath_tanol = (1-x_1_water)\n",
"x_2_water = 0.98\n",
@@ -393,41 +290,26 @@
"y_bumath_tanol = (1-y_water)\n",
"T = 92. #[C]\n",
"\n",
- "# At this temperature we have to estimate the vapor pressure of pure water and n-bumath_tanol with the help of Antoine equation \n",
- "# math.log10(p) = A - B/(T+C)\n",
- "# From Table A.2( page 418), the Antoine equation consmath.tants for water are\n",
"A_w = 7.94917\n",
"B_w = 1657.462\n",
"C_w = 227.02\n",
"\n",
- "# and that for n-bumath_tanol are\n",
"A_b = 7.838\n",
"B_b = 1558.190\n",
"C_b = 196.881\n",
"\n",
- "# Calculations\n",
- "# Thus vapor pressure of water and n-bumath_tanol are respectively\n",
"p_water = (14.7/760)*10**(A_w - B_w/(T+C_w))\n",
"p_bumath_tanol = (14.7/760)*10**(A_b - B_b/(T+C_b))\n",
"\n",
- "# fugacity of the water and n-bumath_tanol are given as\n",
- "# f_i = (y*Y*P)_i\n",
- "# Where Y is the gas phase activity coefficient and its value is 1.00 in ideal gas mixture, so\n",
"f_water = (y_water*P)\n",
"f_bumath_tanol = (y_bumath_tanol*P)\n",
- "# The fugacity will be same in both the phase 1 and 2\n",
"\n",
- "# Now, liquid-phase activity coefficients are given by\n",
- "# Y_i = (y_i*P)/(x_i*p_i)\n",
- "# so,\n",
"Y_water_1 = (y_water*P1)/(x_1_water*p_water)\n",
"Y_bumath_tanol_1 = (y_bumath_tanol*P1)/(x_1_bumath_tanol*p_bumath_tanol)\n",
"\n",
- "# For phase 2\n",
"Y_water_2 = (y_water*P1)/(x_2_water*p_water)\n",
"Y_bumath_tanol_2 = (y_bumath_tanol*P1)/(x_2_bumath_tanol*p_bumath_tanol)\n",
"\n",
- "# Results\n",
"print \" Four activity coefficients and fufacities are shown in the following table:\"\n",
"print \"Phase \\t x_water \\t f_wateratm \\t Y_water \\t x_butanol \\t f_butanolatm \\t\\t Y_butanol\"\n",
"print \" 1 \\t %f \\t %f \\t %f \\t %f \\t %f \\t\\t %f \"%(x_1_water,f_water,Y_water_1,x_1_bumath_tanol,f_bumath_tanol,Y_bumath_tanol_1)\n",
@@ -461,57 +343,29 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Boiling point of the two phase system\n",
- "In vapor phase mole fraction of the water\n",
- "'''\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 1. #[atm] Total pressure in the vapor phase\n",
"\n",
- "# Since the two liquids are not soluble in each other so Raoult's law will apply separately for these two phases.\n",
- "# From Raoult's law we have \n",
- "# (y_i*P) = (x_i*p_i)\n",
- "# Here two phases are in pure stages so x_i=1 for both phases\n",
- "# So\n",
- "# y_i = (p_i/P)\n",
- "# Writing this equation for each species, adding the equations, and solving for P, we find\n",
- "# P = summation( y_i*P ) = summation( p_i/P*P ) = summation(p_i)\n",
- "\n",
- "# The total pressure is the sum of the individual pure species vapor pressure\n",
- "# To find the boiling point temperature we perform a trial and error\n",
- "# Let us assume the boiling point temperature\n",
+ "\n",
"T = 89. #[C]\n",
- "# Antoine equation consmath.tants for water is given by\n",
"A_w = 7.94917\n",
"B_w = 1657.462\n",
"C_w = 227.02\n",
"\n",
- "# and that for n-bumath_tanol are\n",
"A_b = 7.838\n",
"B_b = 1558.190\n",
"C_b = 196.881\n",
"\n",
- "# Calculations\n",
- "# Antoine equation is given by\n",
- "# math.log10(p) = A - B/(T+C)\n",
- "# Thus vapor pressure of water and n-bumath_tanol are respectively\n",
"p_water = (1./760)*10**(A_w - B_w/(T+C_w))\n",
"p_bumath_tanol = (1./760)*10**(A_b - B_b/(T+C_b))\n",
"\n",
- "# Now, vapor phase composition are \n",
"y_water = p_water/P\n",
"y_bumath_tanol = p_bumath_tanol/P\n",
- "# summing these, we get \n",
"y = y_water + y_bumath_tanol\n",
"\n",
- "# Value of y is nearly equal to one so our assumption of the temperature is correct\n",
- "# So the boiling point of the mixture is 'T'\n",
"\n",
- "# Results\n",
"print \" Boiling point of the two phase system is %0.0f deg C\"%(T)\n",
"print \" In vapor phase mole fraction of the water is %0.2f\"%(y_water)\n"
],
@@ -541,36 +395,23 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The value of the f/P for water vapour in the hypothetical state\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"Temp = 68. #[F]\n",
"P = 1. #[atm]\n",
"\n",
- "# Calculations\n",
- "# Changing the temperature in 'K' and pressure in 'bar' we have\n",
"Temp = 273.15+(Temp-32)*5./9 #[K]\n",
"P = P*1.01325 #[bar]\n",
- "# For water from the table A.1(page 417)\n",
"T_c = 647.1 #[K]\n",
"P_c = 220.55 #[bar]\n",
- "# Now\n",
"T_r = Temp/T_c\n",
"P_r = P/P_c\n",
"w = 0.345\n",
- "#Now applying the result for the little EOS from the example 7.1(page 135 ), we have\n",
- "# f/P = exp(P_r/T_r*f(T_r))\n",
- "# From the chapter 2 of this book, we have \n",
"f_T_r = (0.083-0.422/T_r**(1.6))+w*(0.139-0.172/T_r**(4.2))\n",
- "# So\n",
"f_by_P = math.exp(P_r/T_r*f_T_r)\n",
"\n",
- "# Results\n",
"print \"The value of the f/P for water vapour in the hypothetical state is %0.2f\"%(f_by_P)\n"
],
"language": "python",
@@ -598,62 +439,37 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Boiling pressure of the liquid \n",
- "Mole fraction of ethanaol in vapor phase\n",
- "Mole fraction of water in the vapor phase\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# Here we will denote ethanol as species 'a' and water as the species 'b'\n",
"x_a = 0.1238\n",
"x_b = (1-x_a)\n",
"T = 85.3 #[C] Given boiling temperature\n",
"\n",
- "# We have\n",
- "# x_a + x_b = 1 and y_a + y_b = 1\n",
- "# The Antoine equation consmath.tants for ethanol from the table A.2(page 418) given in the book, are \n",
"A_a = 8.04494\n",
"B_a = 1554.3\n",
"C_a = 222.65\n",
"\n",
- "# and that for water \n",
"A_b = 7.96681\n",
"B_b = 1668.21\n",
"C_b = 228.0\n",
"\n",
- "# Calculations\n",
- "# Thus vapor pressure of ethanol and water are respectively\n",
"p_a = (1./760)*10**(A_a - B_a/(T+C_a))\n",
"p_b = (1./760)*10**(A_b - B_b/(T+C_b))\n",
"\n",
- "# Also the activity coefficients are given by\n",
- "# Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2)) and\n",
- "# Y_b = 10**((A**(2)*B*x_b**(2))/(A*x_a+B*x_b)**(2))\n",
- "# here A and B are Van Laar coefficients and their values for ethanol-water system is reported in the book at page 186 (last two lines), so\n",
"A = 0.7292\n",
"B = 0.4104\n",
"\n",
- "# hence\n",
"Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2))\n",
"Y_b = 10**((A**(2)*B*x_a**(2))/(A*x_a+B*x_b)**(2))\n",
"\n",
- "# Now taking into account of nonideality of the gaseous phase, the modified Raoult's law gives\n",
- "# (y_a/x_a) = (Y_a*p_a)/P and (y_b/x_b) = (Y_b*p_b)/P \n",
"\n",
- "# we will take a simple method \n",
- "# solving the above two equation for y_a and y_b and adding them, we get\n",
"P = (Y_a*p_a*x_a)+(Y_b*p_b*x_b) #[atm]\n",
"\n",
- "# So,\n",
"y_a = (Y_a*p_a*x_a)/P\n",
- "# and\n",
"y_b = (Y_b*p_b*x_b)/P\n",
"\n",
- "# Results\n",
"print \" Boiling pressure of the liquid at 85.3 deg C is %0.4f atm\"%(P)\n",
"print \" Mole fraction of ethanaol in vapor phase is %0.4f\"%(y_a)\n",
"print \" Mole fraction of water in the vapor phase is %0.4f\"%(y_b)\n"
@@ -685,55 +501,30 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Boiling temperature of the liquid at 1 atm pressure \n",
- "Mole fraction of ethanaol in vapor phase \n",
- "Mole fraction of water in the vapor phase\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# This problem is similar to the example 8.9 except that, we are provided pressure instead of temperature and different liquid composition\n",
- "# Here again, we will denote ethanol as species 'a' and water as the species 'b'\n",
"x_a = 0.2608\n",
"x_b = (1-x_a)\n",
"P = 1.00 #[atm] Given boiling pressure\n",
"\n",
- "# We have\n",
- "# x_a + x_b = 1 and y_a + y_b = 1\n",
"\n",
- "# The Antoine equation consmath.tants for ethanol from the table A.2(page 418) given in the book, are \n",
"A_a = 8.04494\n",
"B_a = 1554.3\n",
"C_a = 222.65\n",
"\n",
- "# and that for water \n",
"A_b = 7.96681\n",
"B_b = 1668.21\n",
"C_b = 228.0\n",
"\n",
- "# Thus vapor pressure of ethanol and water are respectively\n",
- "# p_a = (1/760)*10**(A_a - B_a/(T+C_a))\n",
- "# p_b = (1/760)*10**(A_b - B_b/(T+C_b))\n",
- "# Adding these two equation, we get \n",
- "# ( p_a + p_b ) = (1/760)*10**(A_a - B_a/(T+C_a)) + (1/760)*10**(A_b - B_b/(T+C_b))......................................(1)\n",
"\n",
- "# Also the activity coefficients are given by\n",
- "# Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2)) and\n",
- "# Y_b = 10**((A**(2)*B*x_b**(2))/(A*x_a+B*x_b)**(2))\n",
- "# here A and B are Van Laar coefficients and their values for ethanol-water system is reported in the book at page 186 (last two lines), so\n",
"A = 0.7292\n",
"B = 0.4104\n",
"\n",
- "# Calculations\n",
- "# hence\n",
"Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2))\n",
"Y_b = 10**((A**(2)*B*x_a**(2))/(A*x_a+B*x_b)**(2))\n",
"\n",
- "# Now we will solve for T running the loop \n",
- "# Let us assume the startup temperature\n",
"T = 80.\n",
"err = 1.\n",
"\n",
@@ -745,7 +536,6 @@
" err = abs((y_a + y_b) - 1)\n",
" T = T + 0.01\n",
"\n",
- "# Results\n",
"print \" Boiling temperature of the liquid at 1 atm pressure is %0.4f atm\"%(T)\n",
"print \" Mole fraction of ethanaol in vapor phase is \\t%0.4f\"%(y_a)\n",
"print \" Mole fraction of water in the vapor phase is \\t%0.4f\"%(y_b)\n"
@@ -777,52 +567,30 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Boiling pressure of the liquid at 80.7 deg C\n",
- "Mole fraction of ethanaol in liquid phase \n",
- "Mole fraction of water in the liquid phase \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# This problem is identical to that of the example 8.9 except difference in the boiling temperature and liquid composition\n",
- "# Here we will again denote ethanol as species 'a' and water as the species 'b'\n",
"y_a = 0.6122\n",
"y_b = (1-y_a)\n",
"T = 80.7 #[C] Given boiling temperature\n",
"\n",
- "# We have\n",
- "# x_a + x_b = 1 and y_a + y_b = 1\n",
"\n",
- "# The Antoine equation consmath.tants for ethanol from the table A.2(page 418) given in the book, are \n",
"A_a = 8.04494\n",
"B_a = 1554.3\n",
"C_a = 222.65\n",
"\n",
- "# and that for water \n",
"A_b = 7.96681\n",
"B_b = 1668.21\n",
"C_b = 228.0\n",
"\n",
- "# Calculations\n",
- "# Thus vapor pressure of ethanol and water are respectively\n",
"p_a = (1./760)*10**(A_a - B_a/(T+C_a))\n",
"p_b = (1./760)*10**(A_b - B_b/(T+C_b))\n",
"\n",
- "# Also the activity coefficients are given by\n",
- "# Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2)) and\n",
- "# Y_b = 10**((A**(2)*B*x_b**(2))/(A*x_a+B*x_b)**(2))\n",
- "# here A and B are Van Laar coefficients and their values for ethanol-water system is reported in the book at page 186 (last two lines), so\n",
"A = 0.7292\n",
"B = 0.4104\n",
"\n",
- "# Now taking into account of nonideality of the gaseous phase, the modified Raoult's law gives\n",
- "# (y_a/x_a) = (Y_a*p_a)/P and (y_b/x_b) = (Y_b*p_b)/P \n",
"\n",
- "# Now can take the help of trial and error method to solve the above equations\n",
- "# In this method, we will assume the different values of P and will calculate the values of x_a and x_b from the above two equations, till their sum comes to unity\n",
"x_a = 0.6122 # Initial assumption of liquid phase composition of ethanol\n",
"x_b = 0.3 # Initial assumption of liquid phase composition water\n",
"P = 0.80 #[atm]\n",
@@ -837,7 +605,6 @@
" x_a = y_a*P/(Y_a*p_a)\n",
" x_b = y_b*P/(Y_b*p_b)\n",
"\n",
- "# Results\n",
"print \" Boiling pressure of the liquid at 80.7 deg C is %0.4f atm\"%(P)\n",
"print \" Mole fraction of ethanaol in liquid phase is %0.4f\"%(x_a)\n",
"print \" Mole fraction of water in the liquid phase is %0.4f\"%(x_b)\n"
@@ -869,57 +636,33 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find\n",
- "Equilibrium Temperature of the system\n",
- "Mole fraction of ethanaol in liquid phase\n",
- "Mole fraction of water in the liquid phase \n",
- "'''\n",
+ "\n",
"import math \n",
"\n",
- "# Variables\n",
- "# This problem is similar to the example 8.10 except that, we are provided vapour phase composition\n",
- "# Here again, we will denote ethanol as species 'a' and water as the species 'b'\n",
"y_a = 0.1700\n",
"y_b = (1-y_a)\n",
"P = 1.00 #[atm] Given boiling pressure\n",
"\n",
- "# We have\n",
- "# x_a + x_b = 1 and y_a + y_b = 1\n",
"\n",
- "# The Antoine equation consmath.tants for ethanol from the table A.2(page 418) given in the book, are \n",
"A_a = 8.04494\n",
"B_a = 1554.3\n",
"C_a = 222.65\n",
"\n",
- "# and that for water \n",
"A_b = 7.96681\n",
"B_b = 1668.21\n",
"C_b = 228.0\n",
"\n",
- "# Thus vapor pressure of ethanol and water are respectively\n",
- "# p_a = (1/760)*10**(A_a - B_a/(T+C_a))\n",
- "# p_b = (1/760)*10**(A_b - B_b/(T+C_b))\n",
"\n",
- "# Also the activity coefficients are given by\n",
- "# Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2)) and\n",
- "# Y_b = 10**((A**(2)*B*x_b**(2))/(A*x_a+B*x_b)**(2))\n",
- "# here A and B are Van Laar coefficients and their values for ethanol-water system is reported in the book at page 186 (last two lines), so\n",
"A = 0.7292\n",
"B = 0.4104\n",
"\n",
- "# Now taking into account of nonideality of the gaseous phase, the modified Raoult's law gives\n",
- "# (y_a/x_a) = (Y_a*p_a)/P and (y_b/x_b) = (Y_b*p_b)/P \n",
"\n",
- "# Now we can take the help of trial and error method to solve the above equations\n",
- "# In this method, we will assume the different values of T and will calculate the values of x_a and x_b from the above two equations, till their sum comes to unity\n",
"\n",
"x_a = 0.0100 # Initial assumption of liquid phase composition of ethanol\n",
"x_b = 0.9 # Initial assumption of liquid phase composition water\n",
"T = 80. #[C] Initial guess of the temperature\n",
"err = 1\n",
"\n",
- "# Calculations\n",
"while err > 1./16*10**(-2):\n",
" P_a = (10**(8.04494 - 1554.3/(222.65 + T)))/760\n",
" P_b = (10**(7.96681 - 1668.21/(228 + T)))/760\n",
@@ -934,7 +677,6 @@
" T = T + 0.01\n",
"\n",
"\n",
- "# Results\n",
"print \" Equilibrium Temperature of the system at pressure 1 atm is %0.4f atm\"%(T)\n",
"print \" Mole fraction of ethanaol in liquid phase is %0.4f\"%(x_a)\n",
"print \" Mole fraction of water in the liquid phase is %0.4f\"%(x_b)\n"
@@ -966,41 +708,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Mole fraction of the ethanol in the liquid phase in equilibrium\n",
- "Mole fraction of the water in the liquid phase in equilibrium\n",
- "Mole fraction of the ethanol in the vapour phase in equilibrium\n",
- "Mole fraction of the water in the vapour phase in equilibrium\n",
- "Vapor fraction of the given water-ethanol mixture after the flash\n",
- "'''\n",
+ "\n",
"import math \n",
"\n",
- "# Variables\n",
- "# Here again, we will denote ethanol as species 'a' and water as the species 'b'\n",
"x_aF = 0.126\n",
"x_bF = (1-x_aF)\n",
"P = 1.00 #[atm] Given total pressure\n",
"T = 91.8 #[C]\n",
"\n",
- "# Calculations\n",
- "# We will go with graphical approach for solving this problem \n",
- "# This problem requires T - x_a diagram at the given pressure i.e. 1 atm \n",
- "# This diagram is provided on page 196( figure 8.19) in the book \n",
- "# We will draw horizontal and vertical lines corresponding to the specified T and x_a. \n",
- "# Drawing a horizontal line from temperature 91.8 degC and vertical line corresponding to the x_aF = 0.126, we see that these two intersect in the two phase region, which tells that our feed contains both liquid and vapour phase\n",
- "# Now liquid phase composition in equilibrium is found by reading the x-axis where the bubble-point vs x_a curve and horizontal line corresponding to T = 91.8 degC intersect and viz.\n",
"x_a = 0.0401\n",
"x_b = (1 - x_a)\n",
"\n",
- "# Similarily vapour phase composition in equilibrium is found by reading the x-axis where the dew-point vs y_a curve and horizontal line corresponding to T = 91.8 degC intersect and viz.\n",
"y_a = 0.2859\n",
"y_b = ( 1 - y_a)\n",
"\n",
- "# Now vapour fraction is given by\n",
"V_by_F = ( x_aF - x_a )/(y_a - x_a)\n",
"\n",
- "# Results\n",
"print \" Mole fraction of the ethanol in the liquid phase in equilibrium at the given condition is %f\"%(x_a)\n",
"print \" Mole fraction of the water in the liquid phase in equilibrium at the given condition is %f\"%(x_b)\n",
"print \" Mole fraction of the ethanol in the vapour phase in equilibrium at the given condition is %f\"%(y_a)\n",
@@ -1036,23 +759,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the various assumed temperatures\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 100. #[psia]\n",
- "# Composition in liquid phase is \n",
"x_a = 0.05 # Mole fraction of methane \n",
"x_b = 0.40 # Mole fraction of bumath.tane \n",
"x_c = 0.55 # mole fraction of penmath.tane\n",
"\n",
- "# We have to take the help of the following equations\n",
- "# ( x_a + x_b + x_c ) = 1 and ( y_a + y_b + y_c ) = 1\n",
- "# ( y_a/x_a ) = K_a ( y_b/x_b ) = K_b and ( y_c/x_c ) = K_c\n",
"\n",
- "# Calculations\n",
- "# We draw a straight line across figure 8.20 from 100psia to different temperatures like 0,5,10,15,20,25,30 degF and read the three K factors \n",
"T = [[15.8 ,0.087, 0.024],[16,0.105, 0.026],[16.2, 0.115, 0.03],[16.8 ,0.13, 0.035],[17.2 ,0.15, 0.04],[17.8, 0.17, 0.045],[18.2, 0.175, 0.0472727]]\n",
"print \" Calculations for the various assumed temperatures are given in the table below\"\n",
"print \" Temperature \\t\\t y_a \\t\\t y_b \\t\\t\\t y_c \\t\\t\\t y \"\n",
@@ -1067,7 +782,6 @@
" T_b = T_b + 5\n",
" print \" %f \\t\\t %f \\t\\t %f \\t\\t %f \\t\\t %f \"%(T_b,y_a,y_b,y_c,y)\n",
"\n",
- "# Results\n",
"print \" For the temperature 30 deg F the summation of the mole fractions in the vapor phase is close enough to unity so bubble point is 30 degF\"\n",
"print \" And compositions in the vapor phase are the values given in the above table corresonding to the temperature 30 deg F i.e.\"\n",
"print \" y_methane = %f y_bumath.tane = %f y_penmath.tane = %f\"%(y_a,y_b,y_c)\n",
@@ -1109,36 +823,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Vapour pressure\n",
- "The temperature\n",
- "'''\n",
+ "\n",
"import math \n",
"\n",
- "# Variables\n",
"n_sugar = 1. #[mol]\n",
"n_water = 1000/18. #[mol]\n",
"x_sugar = n_sugar/(n_sugar+n_water)\n",
"x_water = n_water/(n_sugar+n_water)\n",
- "# At 100C we have \n",
"p_water = 1. #[atm]\n",
"p_sugar = 0. #[atm]\n",
- "# and the relation\n",
"\n",
- "# Calculations\n",
"P = x_water*p_water+x_sugar*p_sugar #[atm]\n",
- "# The situation is sketched in the figure 8.21 in the book[page 199].\n",
- "# Now for the second part of the question\n",
- "# To find the temperature at which the solution will boil, we see on the figure that we must raise the temperature to increase p_i to a value high enough that the total pressure P_1 = 1atm, with x_water calculated above.\n",
"P_1 = 1. #[atm]\n",
"p_water = P_1/x_water #[atm]\n",
- "# Interpolating in the steam table[12] reported in the book, we find \n",
"T = 100.51 #[C]\n",
- "# We may restate this that the boiling-point elevation caused by this dissolved, nonvolatile solute is\n",
"T_eb = T-100 #[C]\n",
"\n",
- "# Results\n",
"print \"Vapour pressure of this solution at the 100C is %.3f atm\"%(P)\n",
"print \"The temperature at which this solution will boil at 1 atm is %.2f C\"%(T)\n"
],
@@ -1168,38 +868,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Freezing-point temperature\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
"\n",
- "# Variables\n",
"n_sugar = 1. #[mol]\n",
"n_water = 1000/18. #[mol]\n",
"x_sugar = n_sugar/(n_sugar+n_water)\n",
"x_water = n_water/(n_sugar+n_water)\n",
"\n",
- "# Here we can assert that for liquid solution and solid ice to be in equilibrium, the fugacity of water in the liquid must be same as that of water in the solid ice. \n",
- "# Crystalline solid formed from such a solution is nearly pure H2O, with no dissolved sugar.\n",
- "# At the low pressures involved here, these fugacities are practically equal to partial pressures, so that \n",
- "#P = x_water*p_water+x_sugar*p_sugar = p_ice\n",
"\n",
- "# but\n",
"p_sugar = 0\n",
- "# so\n",
"p_ice_by_p_water = x_water\n",
"\n",
- "# Figure 5.8 reported in the book (page 100) shows the vapour pressure of subcooled water and of ice. \n",
- "#The values in the given table from which that figure were made can be represented by the following totally empirical data-fitting equation.\n",
- "# p_ice/p_water = 1+0.0096686*T+4.0176*10**(-5)*T**(2)\n",
- "# We eliminate p_ice/p_water by x_water \n",
"\n",
- "# Calculations\n",
"def f(T): \n",
"\t return 1+0.0096686*T+4.0176*10**(-5)*T**(2)-p_ice_by_p_water\n",
"T = fsolve(f,0)\n",
"\n",
- "# Results\n",
"print \"Freezing-point temperature of the given solution is %f C\"%(T)\n"
],
"language": "python",
diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch9.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch9.ipynb
index 1e6bece8..cadd834d 100644
--- a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch9.ipynb
+++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/ch9.ipynb
@@ -35,22 +35,14 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"x_isopropanol = 0.4720\n",
"x_water = 0.5280\n",
- "# From the table A.7 (page 427) reported in the book the Van Laar coefficients for isopropanol-water system at 1atm are given by\n",
"A = 1.0728\n",
"B = 0.4750\n",
"\n",
- "# Calculations\n",
- "# Van Laar equations are given \n",
- "# math.log10(Y_a) = A*x_b**(2)/(A/B*x_a+x_b)**(2)\n",
- "# math.log10(Y_b) = B*x_a**(2)/(B/A*x_b+x_a)**(2)\n",
- "# We calculate Y_isopropanol and Y_water as\n",
"Y_isopropanol = 10**(A*x_water**(2)/(A/B*x_isopropanol+x_water)**(2))\n",
"Y_water = 10**(B*x_isopropanol**(2)/(B/A*x_water+x_isopropanol)**(2))\n",
"\n",
- "# Results\n",
"print \" Value of the liquid-phase activity coefficient for isopropanol is %f\"%(Y_isopropanol)\n",
"print \" And value of the liquid-phase activity coefficient for water is %f\"%(Y_water)\n"
],
@@ -87,23 +79,14 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
- "# Recieving the VLE data from the example 8.2, we have\n",
"x_acetone = 0.05\n",
"x_water = 0.95\n",
- "# And the activity coefficient is given by\n",
"y_acetone = 7.04\n",
"y_water = 1.01\n",
- "# we hve the relation g_E/RT = summation(x_i*math.log(y_i))\n",
- "# let C = g_E/RT , so\n",
"\n",
- "# Calculations\n",
"C = (x_acetone*math.log(y_acetone)+x_water*math.log(y_water))\n",
- "# Now let M = (g_E/RT )/(x_acetone*x_water)\n",
- "# So\n",
"M = C/(x_acetone*x_water)\n",
"\n",
- "# Results\n",
"print \"The value of g_E/RT for acetone-water solution at 1 atm pressure is %f\"%(C)\n",
"print \"The value of g_E/RT)/x_a*x_b) for acetone-water solution at 1 atm pressure is %f\"%(M)\n"
],
@@ -133,22 +116,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculate Values of the constants in Morgules equation for acetone-water\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"y_acetone_infinity = 10.\n",
"y_water_infinty = 5.\n",
"Pressure = 1. #[atm]\n",
"\n",
- "# Calculations\n",
- "# From equation 9.L and 9.M (page 224) as reported in the book, we have \n",
- "# Constants in morgules equation b and c as\n",
"b = math.log(y_acetone_infinity)\n",
"c = math.log(y_water_infinty)\n",
"\n",
- "# Results\n",
"print \"Values of the consmath.tants in Morgules equation for acetone-water at 1 atm are b = %f\"%(b)\n",
"print \" and c = %f\"%(c)\n"
],
@@ -178,52 +155,30 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The activity coefficient of ethanol\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"P_1 = 10. #[atm]\n",
"x_a_1 = 0.1238 # mole fraction of ethanol at 10 atm pressure\n",
"Temp = 273.15+85.3 # [K]\n",
"R = 0.08206 #[(L*atm)/(mol*K)]\n",
"P_0 = 1. #[atm]\n",
- "# so\n",
"delta_P = (P_1-P_0) #[atm]\n",
- "# Molecular weight of ethanol and water are respectively\n",
"M_ethanol = 46. #[g/mol]\n",
"M_water = 18. #[g/mol]\n",
"\n",
- "# Calculations\n",
- "# Now changing the mol fraction of ethanol in the wt fraction \n",
"m_a_1 = x_a_1*M_ethanol/(x_a_1*M_ethanol+(1-x_a_1)*M_water)\n",
- "# From example 8.9(page 188) we know that at this T and 1 atm and x_a_0, activity coefficient for ethanol \n",
"y_ethanol_0 = 2.9235\n",
- "# Now from figure 6.15(page 129), we read that at 20C and m_a_1 mass fraction ethanol ,\n",
"v_ethanol_1 = 1.16 #[cm**(3)/g]\n",
- "# Similarily for mass fraction corresponding to mole fraction x_a_1 \n",
"v_ethanol_0 = 1.27 #[cm**(3)/]\n",
- "# Difference of thes etwo values is \n",
"v = v_ethanol_1-v_ethanol_0 #[cm**(3)/g]\n",
"v = v*46. #[L/g]\n",
- "# If we assume that this value is more or less independent of temperature, we can use it as the corresponding value at 85.3C, and compute \n",
- "# From equation 7.31(page 225)\n",
- "# d(math.log(y_i))/dP = (v_1-v_0)/(R*T) at consmath.tant temperature and mole fraction \n",
- "# Let d(math.log(y_i))/dP = C, then\n",
"C = (v_ethanol_1-v_ethanol_0)/(R*Temp)\n",
"\n",
- "# Also we can have \n",
- "# delta_math.log(y_i) = (d(math.log(y_i))/dP)*delta_P\n",
- "# or \n",
- "# delta_math.log(y_i) = C*delta_P\n",
- "# and delta_math.log(y_i) = math.log(y_ehmath.tanol_1)-math.log(y_ethanol_0)\n",
- "# So\n",
"y_ethanol_1 = math.exp(math.log(y_ethanol_0)+C*delta_P)\n",
"\n",
- "# Results\n",
"print \"The activity coefficient of ethanol in the solution at 10 atm pressure is %f\"%(y_ethanol_1)\n",
"\n",
- "# Note : Answer is different because of rouding error. Please calculate manually.\n"
],
"language": "python",
"metadata": {},
@@ -250,39 +205,26 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The activity coefficient of ethanol\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
- "# Variables\n",
"x_ethanol = 0.1238\n",
"Temp_1 = 273.15+85.3 #[K]\n",
"P = 1. #[atm]\n",
"Temp_2 = 273.15+70 #[K]\n",
"R = 8.314 #[j/(mol*K)]\n",
- "# From example 8.9, at temperature 85.3C the activity coefficient is \n",
"y_ethanol_1 = 2.9235\n",
- "# From figure 9.5[4] (page 227) as reported in the book, we read the value of (h_i_average-h_i_0) at temperatures 90C and 70C for ethanol.\n",
- "# which are respectively\n",
"delta_h_2 = 0.2 #[kJ/mol]\n",
"delta_h_1 = 1.0 #[kJ/mol]\n",
"\n",
- "# Calculations\n",
- "# Taking the average of these two values we have \n",
"delta_h_average = (delta_h_1+delta_h_1)/2*1000. #[J/mol]\n",
- "# From the equation 7.32 (page 225) reported in the book \n",
- "# d(math.log(y_i))/dT = (h_i_average-h_i_0)/(R*T**(2)) at consmath.tant pressure and mole fraction\n",
- "# So\n",
- "# it can be taken approximately as \n",
- "# So\n",
"\n",
"def f7(T): \n",
"\t return (1/T**(2))\n",
"\n",
"y_ethanol_2 = y_ethanol_1*math.exp((delta_h_average/R)* (quad(f7,Temp_1,Temp_2))[0])\n",
"\n",
- "# Results\n",
"print \"The activity coefficient for ethanol in the solution at 70 deg C and 1 atm is %f\"%(y_ethanol_2)\n",
"\n"
],
@@ -311,54 +253,32 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find activity coefficient of acetone\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
- "# In this solution we will give the identity to the three species as\n",
- "# a- Acetone \n",
- "# b- Methanol\n",
- "# c- Water\n",
- "# Given\n",
"x_a = 0.1200\n",
"x_b = 0.1280\n",
"x_c = 0.7520\n",
"Temp = 66.70 #[C]\n",
"P = 1. #[atm] pressure\n",
- "# As reported in the book that from [5] we get the following values \n",
- "# acetone-methanol(a-b)\n",
"A_ab = 0.2634\n",
"A_ba = 0.2798\n",
- "# acetone-water(a-c)\n",
"A_ac = 0.9709\n",
"A_ca = 0.5579\n",
- "# methanol-water(b-c)\n",
"A_bc = 0.3794\n",
"A_cb = 0.2211\n",
"\n",
- "# Calculations\n",
- "# Now consider the equation 9.10 (page 228) \n",
- "# The first term on the right of the equation is\n",
"T_1 = round(x_b**(2)*(A_ab+2*x_a*(A_ba-A_ab)),5)\n",
- "# similarily the second and third terms are given respectively as \n",
"T_2 = round(x_c**(2)*(A_ac+2*x_a*(A_ca-A_ac)),3)\n",
"T_3 = 0.0550 #x_b*x_c*(0.5*(A_ba+A_ab+A_ac-A_bc-A_cb)+x_a*(A_bc-A_ab+A_ca-A_ac)+(x_b-x_c)*(A_bc-A_cb)-(1-2*x_a)*0.00)\n",
- "# thus whole term on the right hand side is\n",
"T = T_1+T_2+T_3\n",
- "# So \n",
"y_a = 10**(T)\n",
- "# for this temperature vapour pressure of the acetone is calculated as \n",
"p_acetone = 1.417 #[atm]\n",
- "# So that we estimate\n",
"y_acetone = x_a*y_a*p_acetone\n",
"\n",
- "# Results\n",
"print \" yacetone : %.3f\"%y_acetone\n",
"print \"The activity coefficient of acetone in the given mixture is %f\"%(y_a)\n",
- "# The experimental value is y_acetone = 0.698\n",
"\n",
- "# Answer is different because of rounding error."
],
"language": "python",
"metadata": {},
@@ -389,7 +309,6 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 85.3+273.15 #[K] Temperature\n",
"P = 1. #[atm] Pressure of the mixture\n",
"R = 8.314 #[(Pa*m(3)/(K*mol))]\n",
@@ -397,101 +316,74 @@
"y_i = 0.1238 # mole fraction of the ethanol in the vapor phase\n",
"y_j = (1-y_i) # mole fraction of the water vapor in the vapor phase\n",
"\n",
- "# From the table A.1( table 417), the properties of water and ethanol are given as \n",
- "# Critical temperatures are \n",
"T_c_ii = 513.9 #[K] Critical temperature of the ethanol\n",
"T_c_jj = 647.1 #[K] Criatical temperature of water\n",
"\n",
- "# Critical pressure are \n",
"P_c_ii = 61.48 #[bar] Critical pressure of ethanol \n",
"P_c_jj = 220.55 #[bar] Critical pressure of water\n",
"\n",
- "# A# Resultsentric factor\n",
"w_ii = 0.645 # accentric factor of the ethanol \n",
"w_jj = 0.345 # accentric factor of the water\n",
"\n",
- "# Compressibility factor are\n",
"z_c_ii = 0.24 # compressibility factor of ethanol\n",
"z_c_jj = 0.229 # compressibility factor of the water\n",
"\n",
- "# Calculations\n",
- "# Critical volume are given by \n",
"V_c_ii = z_c_ii*R*T_c_ii/(P_c_ii*100000)*10**(6) # critical volume the ethanol\n",
"V_c_jj = z_c_jj*R*T_c_jj/(P_c_jj*100000)*10**(6) # critical volume the ethanol\n",
"\n",
- "# Now\n",
- "# for k_ij = 0.0\n",
"T_c_ij_0 = (T_c_ii*T_c_jj)**(1./2) #[K]\n",
"w_ij = (w_ii + w_jj)/2.\n",
"z_c_ij = (z_c_ii + z_c_jj)/2.\n",
"V_c_ij = ( (V_c_ii**(1./3) + V_c_jj**(1./3))/2.)**(3)\n",
"P_c_ij_0 = (z_c_ij*R*T_c_ij_0)/(V_c_ij/10.**(6.))/10.**(5) #[bar]\n",
"\n",
- "# again for k_ij = 0.01\n",
"T_c_ij_1 = (T_c_ii*T_c_jj)**(1./2.)*(1-0.01) #[K]\n",
"P_c_ij_1 = (z_c_ij*R*T_c_ij_1)/(V_c_ij/10.**(6))/10**(5) #[bar]\n",
"\n",
- "# Now \n",
"T_r_ii = T/T_c_ii\n",
"T_r_jj = T/T_c_jj\n",
"T_r_ij_0 = T/T_c_ij_0\n",
"T_r_ij_1 = T/T_c_ij_1\n",
"\n",
- "# and\n",
"P_r_ii = P/P_c_ii\n",
"P_r_jj = P/P_c_jj\n",
"P_r_ij_0 = P/P_c_ij_0\n",
"P_r_ij_1 = P/P_c_ij_1\n",
"\n",
- "# Now we will calculate f(T_r) for each component and mixture\n",
"f_Tr_ii = ( 0.083 - 0.422/T_r_ii**(1.6) ) + w_ii*( 0.139 - 0.172/T_r_ii**(4.2))\n",
"f_Tr_jj = ( 0.083 - 0.422/T_r_jj**(1.6) ) + w_jj*( 0.139 - 0.172/T_r_jj**(4.2))\n",
"f_Tr_ij0 = ( 0.083 - 0.422/T_r_ij_0**(1.6) ) + w_ij*( 0.139 - 0.172/T_r_ij_0**(4.2))\n",
"f_Tr_ij1 = ( 0.083 - 0.422/T_r_ij_1**(1.6) ) + w_ij*( 0.139 - 0.172/T_r_ij_1**(4.2))\n",
"\n",
- "# Let us define A = (P_r*f(T_r)/T_r) , so\n",
"A_ii = P_r_ii*f_Tr_ii/T_r_ii\n",
"A_jj = P_r_jj*f_Tr_jj/T_r_jj\n",
"\n",
- "# We are given\n",
"v_ii = 0.975\n",
"v_jj = 0.986\n",
"\n",
- "# Now,\n",
"B_ii = ( f_Tr_ii*R*T_c_ii/P_c_ii)*(10.**(3)/10**(5)) #[L/mol]\n",
"B_jj = ( f_Tr_jj*R*T_c_jj/P_c_jj)*(10.**(3)/10**(5)) #[L/mol]\n",
"B_ij0 = ( f_Tr_ij0*R*T_c_ij_0/P_c_ij_0)*(10.**(3)/10**(5)) #[L/mol]\n",
"B_ij1 = ( f_Tr_ij1*R*T_c_ij_1/P_c_ij_1)*(10.**(3)/10**(5)) #[L/mol]\n",
"\n",
- "# now we will calculate 'delta'\n",
"delta_ij0 = 2*B_ij0 - B_ii - B_jj #[L/mol]\n",
"delta_ij1 = 2*B_ij1 - B_ii - B_jj #[L/mol]\n",
"\n",
- "# We have \n",
- "# b_a = B_aa + y_b**(2)*delta and b_b = B_bb + y_a**(2)*delta\n",
- "# so,\n",
"b_ethanol0 = B_ii + y_j**(2)*delta_ij0 #[L/mol]\n",
"b_water0 = B_jj + y_i**(2)*delta_ij0 #[L/mol]\n",
"b_ethanol1 = B_ii + y_j**(2)*delta_ij1 #[L/mol]\n",
"b_water1 = B_jj + y_i**(2)*delta_ij1 #[L/mol]\n",
"\n",
- "# Now \n",
- "# phi_i = exp(b_i*P/(R*T))\n",
- "# So,\n",
"phi_ethanol0 = math.exp((b_ethanol0*P)/(R_1*T))\n",
"phi_water0 = math.exp((b_water0*P)/(R_1*T))\n",
"phi_ethanol1 = math.exp((b_ethanol1*P)/(R_1*T))\n",
"phi_water1 = math.exp((b_water1*P)/(R_1*T))\n",
"\n",
- "# and\n",
- "# Y_i = phi_i/v_i\n",
- "# So,\n",
"Y_ethanol0 = phi_ethanol0/v_ii\n",
"Y_water0 = phi_water0/v_jj\n",
"Y_ethanol1 = phi_ethanol1/v_ii\n",
"Y_water1 = phi_water1/v_jj\n",
"\n",
- "# Results\n",
"print \" The results are summarize in the following table\"\n",
"print \" Property \\t\\t\\t Mix ij Assuming k_ij = 0.0 \\t\\t\\t Mix ij Assuming k_ij = 0.01\"\n",
"print \" phi_ethanol \\t\\t\\t\\t %f \\t\\t\\t\\t\\t %f \"%(phi_ethanol0,phi_ethanol1)\n",
@@ -541,25 +433,16 @@
"\n",
"import math \n",
"\n",
- "# Variables\n",
"T = 65+273.15 #[K] Temperature\n",
"R = 8.314 #[(m**(3)*Pa)/(mol*K)] Universal gas consmath.tant \n",
- "# From the table 9.C ( page 239 ) given in the book the molar volumes and solubility of n-hexane and diethylketone at 25 deg C are given as \n",
"v_hex = 131.6 #[ml/mol] Molar volume of n-Hexane\n",
"v_dketone = 106.4 #[ml/mol] Molar volume of diethylketone\n",
"s_hex = 14.9 #[MPa**(0.5)] Solubility of n-Hexane\n",
"s_dketone = 18.1 #[MPa**(0.5)] Solubility of diethylketone\n",
"\n",
- "# Calculations\n",
- "# Here we will use these values with the assumption that Y_i,65C = Y_i,25C\n",
- "# At infinite dilution, the volume fraction of the other species is 1.00, so, \n",
- "# math.logY_a = v_a*phi_b**(2)*(delta_a - delta_b)**(2)/(R*T)\n",
- "# so, for n-Hexane\n",
"Y_hex = math.exp(v_hex*1**(2)*(s_hex - s_dketone)**(2)/(R*T))\n",
- "# And that for diethylketone\n",
"Y_dketone = math.exp(v_dketone*1**(2)*( s_dketone - s_hex )**(2)/(R*T))\n",
"\n",
- "# Results\n",
"print \" The infinite dilution activity coefficient of n-Hexane is %f\"%(Y_hex)\n",
"print \" The infinite dilution activity coefficient of diethlyketone is %f\"%(Y_dketone)\n"
],
@@ -596,26 +479,18 @@
"'''\n",
"import math \n",
"\n",
- "# Variables\n",
"P = 1. #[atm]\n",
"T = 25. #[C]\n",
"y_i = 1.00 # amount of the oxygen in the vapour \n",
- "# Umath.sing the consmath.tants for O2 in table A.2 \n",
"A = 6.69147\n",
"B = 319.0117\n",
"C = 266.7\n",
"\n",
- "# Calculations\n",
- "# By Antoine equation \n",
- "# log10(P_i) = A-B/(T+C)\n",
"P_i = 10**(A-B/(T+C)) #[mmHg]\n",
"P_i = P_i/760. #[atm]\n",
- "# This is extrapolated vapour pressure of O2 at 25C\n",
- "# We will take this value as equal to the Henry's law consmath.tant\n",
"H_i = P_i\n",
"x_i = y_i*P/H_i\n",
"\n",
- "# Results\n",
"print \" Henry's law constant for O2 is %f atm\"%(P_i)\n",
"print \" solubility of O2 is %e\"%(x_i)\n"
],
@@ -645,22 +520,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The activity coefficient of the oxygen\n",
"\n",
"import math \n",
"\n",
- "# Variables\n",
"y_a = 1.00\n",
"P = 1.00 #[atm]\n",
"x_a = 0.231*10**(-4)\n",
- "# Using the constants for O2 in table A.2 in the Antoine equation , we find the vapour pressure of the oxygen at 25C viz.\n",
"p_a = 521.15 #[atm]\n",
- "# Thus activity coefficient is calculated by rewriting the equation 8.6 and umath.sing the above values \n",
"\n",
- "# Calculations\n",
"Y_O2 = (y_a*P)/(x_a*p_a)\n",
"\n",
- "# Results\n",
"print \"The activity coefficient of the oxygen in the water is %f\"%(Y_O2)\n"
],
"language": "python",
diff --git a/Practical_C_Programming/Chapter_10_1.ipynb b/Practical_C_Programming/Chapter_10_1.ipynb
index b3cda55e..56e12012 100644
--- a/Practical_C_Programming/Chapter_10_1.ipynb
+++ b/Practical_C_Programming/Chapter_10_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 10"
+ "name": "",
+ "signature": "sha256:55a41a15f53fea81d9fb349d875475d12f3934656e4b83a8ff10ced1f1672515"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,45 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 10: C Preprocessor"
+ "source": [
+ "Chapter 10: C Preprocessor"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.1, Page number: 172"
+ "source": [
+ "Example 10.1, Page number: 172"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.1.py\n# To print the contents of two arrays upto 10 indices\n\n\n# Variable declaration\ndata = []\ntwice = []\n\n# Calculation and result\nfor index in range (0, 10) :\n data.append(index)\n twice.append(2 * index)\n\nprint (data)\nprint (twice)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "data = []\n",
+ "twice = []\n",
+ "\n",
+ "# Calculation and result\n",
+ "for index in range (0, 10) :\n",
+ " data.append(index)\n",
+ " twice.append(2 * index)\n",
+ "\n",
+ "print (data)\n",
+ "print (twice)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]\n"
+ "text": [
+ "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
+ "[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +59,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.2, Page number: 173"
+ "source": [
+ "Example 10.2, Page number: 173"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.2.py\n# To print the contents of two arrays upto 20 indices \n\n\n# Variable declaration\ndata = []\ntwice = []\n\n# Calculation and result\nfor index in range (0, 20) :\n data.append(index)\n twice.append(2 * index)\n\nprint (data)\nprint (twice)",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "data = []\n",
+ "twice = []\n",
+ "\n",
+ "# Calculation and result\n",
+ "for index in range (0, 20) :\n",
+ " data.append(index)\n",
+ " twice.append(2 * index)\n",
+ "\n",
+ "print (data)\n",
+ "print (twice)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38]\n"
+ "text": [
+ "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n",
+ "[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38]\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +99,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.3, Page number: 175"
+ "source": [
+ "Example 10.3, Page number: 175"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.3.py\n# To print the value of variable 'index' \n\n\n# Variable declaration\nBIG_NUMBER = 10 * 10\nindex = 1\n\n# Calculation and result\nwhile (index < BIG_NUMBER) :\n index = index * 8\n print ('%d' % index)",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "BIG_NUMBER = 10 * 10\n",
+ "index = 1\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (index < BIG_NUMBER) :\n",
+ " index = index * 8\n",
+ " print ('%d' % index)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "8\n64\n512\n"
+ "text": [
+ "8\n",
+ "64\n",
+ "512\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +137,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.4, Page number: 176"
+ "source": [
+ "Example 10.4, Page number: 176"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.4.py\n# To determine the square of ALL_PARTS \n\n\n# Variable declaration\nFIRST_PART = 7\nLAST_PART = 5\nALL_PARTS = FIRST_PART + LAST_PART\n\n# Calculation and result\nprint ('The square of all the parts is %d' % (ALL_PARTS * ALL_PARTS))",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "FIRST_PART = 7\n",
+ "LAST_PART = 5\n",
+ "ALL_PARTS = FIRST_PART + LAST_PART\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('The square of all the parts is %d' % (ALL_PARTS * ALL_PARTS))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The square of all the parts is 144\n"
+ "text": [
+ "The square of all the parts is 144\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +172,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.5, Page number: 177"
+ "source": [
+ "Example 10.5, Page number: 177"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.5.py\n# To print 'Hi there' 10 times \n\n\n# Calculation and result\nfor i in reversed (range(10)) :\n print ('Hi there')",
+ "input": [
+ "\n",
+ "\n",
+ "# Calculation and result\n",
+ "for i in reversed (range(10)) :\n",
+ " print ('Hi there')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hi there\nHi there\nHi there\nHi there\nHi there\nHi there\nHi there\nHi there\nHi there\nHi there\n"
+ "text": [
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n"
+ ]
}
],
"prompt_number": 5
@@ -122,19 +212,32 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.6, Page number: 177"
+ "source": [
+ "Example 10.6, Page number: 177"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.6.py\n# To print the value of 'size' \n\n\n# Variable declaration\nsize = 10\nfudge = size - 2\n\n# Calculation and result\nsize = fudge\nprint ('Size is %d' % size)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "size = 10\n",
+ "fudge = size - 2\n",
+ "\n",
+ "# Calculation and result\n",
+ "size = fudge\n",
+ "print ('Size is %d' % size)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Size is 8\n"
+ "text": [
+ "Size is 8\n"
+ ]
}
],
"prompt_number": 6
@@ -143,19 +246,34 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.7, Page number: 178"
+ "source": [
+ "Example 10.7, Page number: 178"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.7.py\n# To exit the program based on a specific condition \n\n\n# Variable declaration\nimport sys\nvalue = 1\n\n# Calculation and result\nif (value < 0) :\n sys.exit()\n\nprint ('We did not die')",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "value = 1\n",
+ "\n",
+ "# Calculation and result\n",
+ "if (value < 0) :\n",
+ " sys.exit()\n",
+ "\n",
+ "print ('We did not die')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "We did not die\n"
+ "text": [
+ "We did not die\n"
+ ]
}
],
"prompt_number": 7
@@ -164,19 +282,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.8, Page number: 184"
+ "source": [
+ "Example 10.8, Page number: 184"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.8.py\n# To display the square of numbers from 1 to 5 \n\n\n# Function declaration, calculation and result\ndef SQR (x) :\n return x * x\n \nfor counter in range (0, 5) :\n print ('x %d, x squared %d\\n' % (counter + 1, SQR (counter + 1)))",
+ "input": [
+ "\n",
+ "\n",
+ "# Function declaration, calculation and result\n",
+ "def SQR (x) :\n",
+ " return x * x\n",
+ " \n",
+ "for counter in range (0, 5) :\n",
+ " print ('x %d, x squared %d\\n' % (counter + 1, SQR (counter + 1)))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x 1, x squared 1\n\nx 2, x squared 4\n\nx 3, x squared 9\n\nx 4, x squared 16\n\nx 5, x squared 25\n\n"
+ "text": [
+ "x 1, x squared 1\n",
+ "\n",
+ "x 2, x squared 4\n",
+ "\n",
+ "x 3, x squared 9\n",
+ "\n",
+ "x 4, x squared 16\n",
+ "\n",
+ "x 5, x squared 25\n",
+ "\n"
+ ]
}
],
"prompt_number": 8
@@ -185,19 +325,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.9, Page number: 184"
+ "source": [
+ "Example 10.9, Page number: 184"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.9.py\n# To display the square of numbers from 1 to 5 \n\n\n# Variable declaration\ncounter = 0\n\n# Function declaration, calculation and result\ndef SQR (x) :\n return x * x\n \nwhile (counter < 5) :\n print ('x %d square %d\\n' % (counter + 1, SQR (counter + 1)))\n counter += 1",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "counter = 0\n",
+ "\n",
+ "# Function declaration, calculation and result\n",
+ "def SQR (x) :\n",
+ " return x * x\n",
+ " \n",
+ "while (counter < 5) :\n",
+ " print ('x %d square %d\\n' % (counter + 1, SQR (counter + 1)))\n",
+ " counter += 1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x 1 square 1\n\nx 2 square 4\n\nx 3 square 9\n\nx 4 square 16\n\nx 5 square 25\n\n"
+ "text": [
+ "x 1 square 1\n",
+ "\n",
+ "x 2 square 4\n",
+ "\n",
+ "x 3 square 9\n",
+ "\n",
+ "x 4 square 16\n",
+ "\n",
+ "x 5 square 25\n",
+ "\n"
+ ]
}
],
"prompt_number": 9
@@ -206,19 +372,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 10.10, Page number: 185"
+ "source": [
+ "Example 10.10, Page number: 185"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 10.10.py\n# To calculate the reciprocal of numbers from 1 to 9\n\n\n# Function declaration, calculation and result\ndef reciprocal (number) :\n return 1 / number\n \nfor counter in range (1, 10) :\n print ('1/%f = %f\\n' % (counter, reciprocal (counter)))",
+ "input": [
+ "\n",
+ "# Function declaration, calculation and result\n",
+ "def reciprocal (number) :\n",
+ " return 1 / number\n",
+ " \n",
+ "for counter in range (1, 10) :\n",
+ " print ('1/%f = %f\\n' % (counter, reciprocal (counter)))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1/1.000000 = 1.000000\n\n1/2.000000 = 0.000000\n\n1/3.000000 = 0.000000\n\n1/4.000000 = 0.000000\n\n1/5.000000 = 0.000000\n\n1/6.000000 = 0.000000\n\n1/7.000000 = 0.000000\n\n1/8.000000 = 0.000000\n\n1/9.000000 = 0.000000\n\n"
+ "text": [
+ "1/1.000000 = 1.000000\n",
+ "\n",
+ "1/2.000000 = 0.000000\n",
+ "\n",
+ "1/3.000000 = 0.000000\n",
+ "\n",
+ "1/4.000000 = 0.000000\n",
+ "\n",
+ "1/5.000000 = 0.000000\n",
+ "\n",
+ "1/6.000000 = 0.000000\n",
+ "\n",
+ "1/7.000000 = 0.000000\n",
+ "\n",
+ "1/8.000000 = 0.000000\n",
+ "\n",
+ "1/9.000000 = 0.000000\n",
+ "\n"
+ ]
}
],
"prompt_number": 10
diff --git a/Practical_C_Programming/Chapter_11_1.ipynb b/Practical_C_Programming/Chapter_11_1.ipynb
index e3193adb..1dc24c59 100644
--- a/Practical_C_Programming/Chapter_11_1.ipynb
+++ b/Practical_C_Programming/Chapter_11_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 11"
+ "name": "",
+ "signature": "sha256:e68b678f99332c0d6ad607ce4c8f99007b9b612142be0ab04cb6c8b4b0cb5969"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,41 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 11: Bit operations"
+ "source": [
+ "Chapter 11: Bit operations"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 11.1, Page number: 193"
+ "source": [
+ "Example 11.1, Page number: 193"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 11.1.py\n# To check whether two numbers are equal to 0 or not\n\n\n# Variable declaration\ni1 = 4\ni2 = 2\n\n# Calculation and result\nif ((i1 != 0) and (i2 != 0)) :\n print ('Both are not zero\\n')",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "i1 = 4\n",
+ "i2 = 2\n",
+ "\n",
+ "# Calculation and result\n",
+ "if ((i1 != 0) and (i2 != 0)) :\n",
+ " print ('Both are not zero\\n')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Both are not zero\n\n"
+ "text": [
+ "Both are not zero\n",
+ "\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +55,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 11.2, Page number: 201"
+ "source": [
+ "Example 11.2, Page number: 201"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 11.2.py\n# To illustrate the use of bitwise and shift operators\n\n\n# Variable declaration\nHIGH_SPEED = 1 << 7\nDIRECT_CONNECT = 1 << 8\n\nflags = 0\nflags |= HIGH_SPEED\nflags |= DIRECT_CONNECT\n\n# Calculation and result\nif ((flags & HIGH_SPEED) != 0) :\n print ('High speed set\\n')\n\nif ((flags & DIRECT_CONNECT) != 0) :\n print ('Direct connect set\\n')",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "HIGH_SPEED = 1 << 7\n",
+ "DIRECT_CONNECT = 1 << 8\n",
+ "\n",
+ "flags = 0\n",
+ "flags |= HIGH_SPEED\n",
+ "flags |= DIRECT_CONNECT\n",
+ "\n",
+ "# Calculation and result\n",
+ "if ((flags & HIGH_SPEED) != 0) :\n",
+ " print ('High speed set\\n')\n",
+ "\n",
+ "if ((flags & DIRECT_CONNECT) != 0) :\n",
+ " print ('Direct connect set\\n')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "High speed set\n\nDirect connect set\n\n"
+ "text": [
+ "High speed set\n",
+ "\n",
+ "Direct connect set\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +99,34 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 11.4, Page number: 207"
+ "source": [
+ "Example 11.4, Page number: 207"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 11.4.py\n# To test a loop counter\n\n\n# Variable declaration\ni = 0x80\n\n# Calculation and result\nif (i != 0) :\n print ('i is %x (%d) \\n' % (i, i))\n i = i >> 1",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "i = 0x80\n",
+ "\n",
+ "# Calculation and result\n",
+ "if (i != 0) :\n",
+ " print ('i is %x (%d) \\n' % (i, i))\n",
+ " i = i >> 1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "i is 80 (128) \n\n"
+ "text": [
+ "i is 80 (128) \n",
+ "\n"
+ ]
}
],
"prompt_number": 3
diff --git a/Practical_C_Programming/Chapter_12_1.ipynb b/Practical_C_Programming/Chapter_12_1.ipynb
index b711a066..090a4ee1 100644
--- a/Practical_C_Programming/Chapter_12_1.ipynb
+++ b/Practical_C_Programming/Chapter_12_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 12"
+ "name": "",
+ "signature": "sha256:184261c50791da479b656a01719125426370a323ab51da034b4dc57d574572c3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,43 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 12: Advanced types"
+ "source": [
+ "Chapter 12: Advanced types"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 12.1, Page number: 212"
+ "source": [
+ "Example 12.1, Page number: 212"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 12.1.py\n# To illustrate the use of a 'union'\n\n\n# Union declaration\nfrom ctypes import *\nclass value (Union) :\n _fields_ = [(\"i_value\", c_int),\n (\"f_value\", c_float)]\n\n# Calculation and result\ndata = value (3, 5.0)\nprint (data.i_value, data.f_value)",
+ "input": [
+ "\n",
+ "\n",
+ "# Union declaration\n",
+ "from ctypes import *\n",
+ "class value (Union) :\n",
+ " _fields_ = [(\"i_value\", c_int),\n",
+ " (\"f_value\", c_float)]\n",
+ "\n",
+ "# Calculation and result\n",
+ "data = value (3, 5.0)\n",
+ "print (data.i_value, data.f_value)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "(1084227584, 5.0)\n"
+ "text": [
+ "(1084227584, 5.0)\n"
+ ]
}
],
"prompt_number": 1
diff --git a/Practical_C_Programming/Chapter_13_1.ipynb b/Practical_C_Programming/Chapter_13_1.ipynb
index 95603acb..e3f18fc3 100644
--- a/Practical_C_Programming/Chapter_13_1.ipynb
+++ b/Practical_C_Programming/Chapter_13_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 13"
+ "name": "",
+ "signature": "sha256:e550d25cd0a5a3cbfd731b0cd1d4a1ad11e5182b8955b4cee863068b4cfdaf40"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,43 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 13: Simple pointers"
+ "source": [
+ "Chapter 13: Simple pointers"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.1, Page number: 225"
+ "source": [
+ "Example 13.1, Page number: 225"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.1.py\n# To print the value of 'thing_var' and 'thing_ptr'\n\n\n# Variable declaration\nthing_var = 2\n\n# Calculation and result\nprint ('Thing %d' % thing_var)\n\nthing_ptr = thing_var\nthing_ptr = 3\nprint ('Thing %d' % thing_ptr)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "thing_var = 2\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Thing %d' % thing_var)\n",
+ "\n",
+ "thing_ptr = thing_var\n",
+ "thing_ptr = 3\n",
+ "print ('Thing %d' % thing_ptr)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Thing 2\nThing 3\n"
+ "text": [
+ "Thing 2\n",
+ "Thing 3\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +57,56 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.2, Page number: 227"
+ "source": [
+ "Example 13.2, Page number: 227"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.2.py\n# To loop through the value of 'count' from 1 to 10\n\n\n# Function declaration\ndef inc_count (count_ptr) :\n count_ptr += 1\n return count_ptr\n\n# Calculation and result\ncount = 0\n\nwhile (count < 10) :\n print ('Count %d\\n' % inc_count (count))\n count += 1",
+ "input": [
+ "\n",
+ "\n",
+ "# Function declaration\n",
+ "def inc_count (count_ptr) :\n",
+ " count_ptr += 1\n",
+ " return count_ptr\n",
+ "\n",
+ "# Calculation and result\n",
+ "count = 0\n",
+ "\n",
+ "while (count < 10) :\n",
+ " print ('Count %d\\n' % inc_count (count))\n",
+ " count += 1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Count 1\n\nCount 2\n\nCount 3\n\nCount 4\n\nCount 5\n\nCount 6\n\nCount 7\n\nCount 8\n\nCount 9\n\nCount 10\n\n"
+ "text": [
+ "Count 1\n",
+ "\n",
+ "Count 2\n",
+ "\n",
+ "Count 3\n",
+ "\n",
+ "Count 4\n",
+ "\n",
+ "Count 5\n",
+ "\n",
+ "Count 6\n",
+ "\n",
+ "Count 7\n",
+ "\n",
+ "Count 8\n",
+ "\n",
+ "Count 9\n",
+ "\n",
+ "Count 10\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +115,54 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.3, Page number: 230"
+ "source": [
+ "Example 13.3, Page number: 230"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.3.py\n# To print the addresses and elements of a character array\n\n\n# Variable declaration\narray = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n\n# Calculation and result\nprint ('&array[index] (array+index) array[index]\\n')\n\nfor index in range (0, 10) :\n print ('0x%s 0x%s 0x%s\\n' % (id (array[index]), id (array[index]), array[index]))",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "array = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('&array[index] (array+index) array[index]\\n')\n",
+ "\n",
+ "for index in range (0, 10) :\n",
+ " print ('0x%s 0x%s 0x%s\\n' % (id (array[index]), id (array[index]), array[index]))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "&array[index] (array+index) array[index]\n\n0x20916008 0x20916008 0x0\n\n0x20270280 0x20270280 0x1\n\n0x20733728 0x20733728 0x2\n\n0x20916464 0x20916464 0x3\n\n0x20270232 0x20270232 0x4\n\n0x20733560 0x20733560 0x5\n\n0x20270256 0x20270256 0x6\n\n0x20733752 0x20733752 0x7\n\n0x20916512 0x20916512 0x8\n\n0x20916032 0x20916032 0x9\n\n"
+ "text": [
+ "&array[index] (array+index) array[index]\n",
+ "\n",
+ "0x20916008 0x20916008 0x0\n",
+ "\n",
+ "0x20270280 0x20270280 0x1\n",
+ "\n",
+ "0x20733728 0x20733728 0x2\n",
+ "\n",
+ "0x20916464 0x20916464 0x3\n",
+ "\n",
+ "0x20270232 0x20270232 0x4\n",
+ "\n",
+ "0x20733560 0x20733560 0x5\n",
+ "\n",
+ "0x20270256 0x20270256 0x6\n",
+ "\n",
+ "0x20733752 0x20733752 0x7\n",
+ "\n",
+ "0x20916512 0x20916512 0x8\n",
+ "\n",
+ "0x20916032 0x20916032 0x9\n",
+ "\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +171,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.4, Page number: 232"
+ "source": [
+ "Example 13.4, Page number: 232"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.4.py\n# To count the number of elements before zero in an array\n\n\n# Variable declaration\narray = [4, 5, 8, 9, 8, 1, 0, 1, 9, 3]\nindex = 0\n\n# Calculation and result\nwhile (array[index] != 0) :\n index += 1\n\nprint ('Number of elements before zero %d\\n' % index)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "array = [4, 5, 8, 9, 8, 1, 0, 1, 9, 3]\n",
+ "index = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (array[index] != 0) :\n",
+ " index += 1\n",
+ "\n",
+ "print ('Number of elements before zero %d\\n' % index)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Number of elements before zero 6\n\n"
+ "text": [
+ "Number of elements before zero 6\n",
+ "\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +208,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.5, Page number: 232"
+ "source": [
+ "Example 13.5, Page number: 232"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.5.py\n# To count the number of elements before zero in an array\n\n\n# Variable declaration\narray = [4, 5, 8, 9, 8, 1, 0, 1, 9, 3]\nindex = 0\n\n# Calculation and result\nwhile (array[index] != 0) :\n index += 1\n\nprint ('Number of elements before zero %d\\n' % index)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "array = [4, 5, 8, 9, 8, 1, 0, 1, 9, 3]\n",
+ "index = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (array[index] != 0) :\n",
+ " index += 1\n",
+ "\n",
+ "print ('Number of elements before zero %d\\n' % index)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Number of elements before zero 6\n\n"
+ "text": [
+ "Number of elements before zero 6\n",
+ "\n"
+ ]
}
],
"prompt_number": 5
@@ -122,19 +245,32 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.6, Page number: 233"
+ "source": [
+ "Example 13.6, Page number: 233"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.6.py\n# To initialize the elements of an array to 0\n\n\n# Variable declaration\ndata = []\n\n# Calculation and result\nfor index in range (0, 10) :\n data.append(0)\nprint (data)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "data = []\n",
+ "\n",
+ "# Calculation and result\n",
+ "for index in range (0, 10) :\n",
+ " data.append(0)\n",
+ "print (data)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"
+ "text": [
+ "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"
+ ]
}
],
"prompt_number": 6
@@ -143,19 +279,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.10, Page number: 238"
+ "source": [
+ "Example 13.10, Page number: 238"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.10.py\n# To split a string of the form 'First/Last' into two strings\n\n\n# Variable declaration\nline = 'Steve/Oualline'\n\n# Calculation and result\nfirst_ptr, last_ptr = line.split('/')\nprint ('First: %s Last: %s\\n' % (first_ptr, last_ptr))",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "line = 'Steve/Oualline'\n",
+ "\n",
+ "# Calculation and result\n",
+ "first_ptr, last_ptr = line.split('/')\n",
+ "print ('First: %s Last: %s\\n' % (first_ptr, last_ptr))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "First: Steve Last: Oualline\n\n"
+ "text": [
+ "First: Steve Last: Oualline\n",
+ "\n"
+ ]
}
],
"prompt_number": 8
@@ -164,19 +314,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.11, Page number: 240"
+ "source": [
+ "Example 13.11, Page number: 240"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.11.py\n# To return a temporary filename\n\n\n# Function declaration\ndef tmp_name() :\n if not hasattr (tmp_name, 'sequence') :\n tmp_name.sequence = 0\n tmp_name.sequence += 1\n name = 'tmp'\n name += str (tmp_name.sequence)\n return name\n\n# Calculation and result\nprint ('Name: %s\\n' % tmp_name())",
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def tmp_name() :\n",
+ " if not hasattr (tmp_name, 'sequence') :\n",
+ " tmp_name.sequence = 0\n",
+ " tmp_name.sequence += 1\n",
+ " name = 'tmp'\n",
+ " name += str (tmp_name.sequence)\n",
+ " return name\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Name: %s\\n' % tmp_name())"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Name: tmp1\n\n"
+ "text": [
+ "Name: tmp1\n",
+ "\n"
+ ]
}
],
"prompt_number": 9
@@ -185,12 +353,87 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.12, Page number: 245"
+ "source": [
+ "Example 13.12, Page number: 245"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.12.py\n# To format files for printing\n\n\n# Variable and function declaration\nimport sys\nv_count = sys.argv\ncounter = len(sys.argv)\n\n# Produces verbose messages\nverbose = 0\n\n# Sends output to a file\nout_file = open ('print.out', 'w')\n\n# Sets the number of lines per page\nline_max = 66\n\ndef do_file (name) :\n print ('Verbose %d Lines %d Input %s Output %s\\n' % (verbose, line_max, name, out_file.name))\n\ndef usage() :\n print ('Usage is %s [options] [file-list]\\n' % program_name)\n print ('Options\\n')\n print (' -v verbose\\n')\n print (' -l<number> Number of lines\\n')\n print (' -o<name> Set output filename\\n')\n sys.exit(1)\n \n# Calculation and result\nprogram_name = str (sys.argv[0])\n\nwhile ((counter > 1) and (sys.argv[1][0] == '-')) :\n if (sys.argv[1][1] == 'v') :\n verbose = 1\n break\n\n elif (sys.argv[1][1] == 'o') :\n temp = str (sys.argv[1])\n out_file.write (temp)\n break\n\n elif (sys.argv[1][1] == 'l') :\n line_max = int (sys.argv[1][2])\n break\n\n else :\n print ('Bad option %s\\n' % sys.argv[1])\n usage()\n\n for index in range (0, counter) :\n if (index == counter - 1) :\n break\n else :\n v_count[index] = v_count[index + 1]\n\n counter -= 1\n\nif (counter == 1) :\n do_file ('print.in')\n\nelse :\n while (counter > 1) :\n do_file (sys.argv[1])\n\n for index in range (0, counter) :\n if (index == counter - 1) :\n break\n else :\n v_count[index] = v_count[index + 1]\n \n counter -= 1\n\nout_file.close()",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable and function declaration\n",
+ "import sys\n",
+ "v_count = sys.argv\n",
+ "counter = len(sys.argv)\n",
+ "\n",
+ "# Produces verbose messages\n",
+ "verbose = 0\n",
+ "\n",
+ "# Sends output to a file\n",
+ "out_file = open ('print.out', 'w')\n",
+ "\n",
+ "# Sets the number of lines per page\n",
+ "line_max = 66\n",
+ "\n",
+ "def do_file (name) :\n",
+ " print ('Verbose %d Lines %d Input %s Output %s\\n' % (verbose, line_max, name, out_file.name))\n",
+ "\n",
+ "def usage() :\n",
+ " print ('Usage is %s [options] [file-list]\\n' % program_name)\n",
+ " print ('Options\\n')\n",
+ " print (' -v verbose\\n')\n",
+ " print (' -l<number> Number of lines\\n')\n",
+ " print (' -o<name> Set output filename\\n')\n",
+ " sys.exit(1)\n",
+ " \n",
+ "# Calculation and result\n",
+ "program_name = str (sys.argv[0])\n",
+ "\n",
+ "while ((counter > 1) and (sys.argv[1][0] == '-')) :\n",
+ " if (sys.argv[1][1] == 'v') :\n",
+ " verbose = 1\n",
+ " break\n",
+ "\n",
+ " elif (sys.argv[1][1] == 'o') :\n",
+ " temp = str (sys.argv[1])\n",
+ " out_file.write (temp)\n",
+ " break\n",
+ "\n",
+ " elif (sys.argv[1][1] == 'l') :\n",
+ " line_max = int (sys.argv[1][2])\n",
+ " break\n",
+ "\n",
+ " else :\n",
+ " print ('Bad option %s\\n' % sys.argv[1])\n",
+ " usage()\n",
+ "\n",
+ " for index in range (0, counter) :\n",
+ " if (index == counter - 1) :\n",
+ " break\n",
+ " else :\n",
+ " v_count[index] = v_count[index + 1]\n",
+ "\n",
+ " counter -= 1\n",
+ "\n",
+ "if (counter == 1) :\n",
+ " do_file ('print.in')\n",
+ "\n",
+ "else :\n",
+ " while (counter > 1) :\n",
+ " do_file (sys.argv[1])\n",
+ "\n",
+ " for index in range (0, counter) :\n",
+ " if (index == counter - 1) :\n",
+ " break\n",
+ " else :\n",
+ " v_count[index] = v_count[index + 1]\n",
+ " \n",
+ " counter -= 1\n",
+ "\n",
+ "out_file.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -206,12 +449,27 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "Bad option -f\n\nUsage is -c [options] [file-list]\n\nOptions\n\n -v verbose\n\n -l<number> Number of lines\n\n -o<name> Set output filename\n\n"
+ "text": [
+ "Bad option -f\n",
+ "\n",
+ "Usage is -c [options] [file-list]\n",
+ "\n",
+ "Options\n",
+ "\n",
+ " -v verbose\n",
+ "\n",
+ " -l<number> Number of lines\n",
+ "\n",
+ " -o<name> Set output filename\n",
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stderr",
- "text": "To exit: use 'exit', 'quit', or Ctrl-D."
+ "text": [
+ "To exit: use 'exit', 'quit', or Ctrl-D."
+ ]
}
],
"prompt_number": 10
@@ -220,19 +478,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 13.13, Page number: 248"
+ "source": [
+ "Example 13.13, Page number: 248"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 13.13.py\n# To return a new temporary filename\n\n\n# Function declaration\ndef tmp_name() :\n if not hasattr (tmp_name, 'sequence') :\n tmp_name.sequence = 0\n tmp_name.sequence += 1\n name = 'tmp'\n name += str (tmp_name.sequence)\n return name\n\n# Calculation and result\nname1 = tmp_name()\nname2 = tmp_name()\nprint ('Name1: %s\\n' % name1)\nprint ('Name2: %s\\n' % name2)",
+ "input": [
+ "\n",
+ "\n",
+ "# Function declaration\n",
+ "def tmp_name() :\n",
+ " if not hasattr (tmp_name, 'sequence') :\n",
+ " tmp_name.sequence = 0\n",
+ " tmp_name.sequence += 1\n",
+ " name = 'tmp'\n",
+ " name += str (tmp_name.sequence)\n",
+ " return name\n",
+ "\n",
+ "# Calculation and result\n",
+ "name1 = tmp_name()\n",
+ "name2 = tmp_name()\n",
+ "print ('Name1: %s\\n' % name1)\n",
+ "print ('Name2: %s\\n' % name2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Name1: tmp1\n\nName2: tmp2\n\n"
+ "text": [
+ "Name1: tmp1\n",
+ "\n",
+ "Name2: tmp2\n",
+ "\n"
+ ]
}
],
"prompt_number": 11
diff --git a/Practical_C_Programming/Chapter_14_1.ipynb b/Practical_C_Programming/Chapter_14_1.ipynb
index b2876b44..6d3c736e 100644
--- a/Practical_C_Programming/Chapter_14_1.ipynb
+++ b/Practical_C_Programming/Chapter_14_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 14"
+ "name": "",
+ "signature": "sha256:aaf3603d1f605477459dd54990dcc4c8c154c9c808805468e92c30fde9487343"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,18 +12,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Chapter 14: File input/output"
+ "source": [
+ "Chapter 14: File input/output"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 14.1, Page number: 253"
+ "source": [
+ "Example 14.1, Page number: 253"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 14.1.py\n# To count the number of characters in the file 'input.txt'\n\n\n# Variable declaration\nimport os\ncount = 0\nin_file = open ('input.txt', 'r')\n \n# Calculation and result\nif not os.path.exists ('input.txt') :\n print ('Cannot open input.txt\\n')\n\nwhile (1) :\n ch = in_file.read(1)\n if not ch :\n break\n count += 1\n\nprint ('Number of characters in input.txt is %d\\n' % count)\n\nin_file.close()",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import os\n",
+ "count = 0\n",
+ "in_file = open ('input.txt', 'r')\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists ('input.txt') :\n",
+ " print ('Cannot open input.txt\\n')\n",
+ "\n",
+ "while (1) :\n",
+ " ch = in_file.read(1)\n",
+ " if not ch :\n",
+ " break\n",
+ " count += 1\n",
+ "\n",
+ "print ('Number of characters in input.txt is %d\\n' % count)\n",
+ "\n",
+ "in_file.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -43,12 +68,29 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 14.3, Page number: 257"
+ "source": [
+ "Example 14.3, Page number: 257"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 14.3.py\n# To check whether a file exists or not\n\n\n# Variable declaration\nimport sys\nimport os\nin_file = open ('input.txt', 'r')\n \n# Calculation and result\nif not os.path.exists (name) :\n print ('Could not open file\\n')\n sys.exit(1)\nprint ('File found\\n')\n\nin_file.close()",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "import os\n",
+ "in_file = open ('input.txt', 'r')\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists (name) :\n",
+ " print ('Could not open file\\n')\n",
+ " sys.exit(1)\n",
+ "print ('File found\\n')\n",
+ "\n",
+ "in_file.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -69,12 +111,31 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 14.4, Page number: 260"
+ "source": [
+ "Example 14.4, Page number: 260"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 14.4.py\n# To write to a file\n\n\n# Variable declaration\nimport sys\nimport os\nout_file = open ('test.out', 'w')\n \n# Calculation and result\nif not os.path.exists ('test.out') :\n print ('Cannot open output file\\n')\n sys.exit(1)\n\nfor cur_char in range (0, 128) :\n out_file.write(str (cur_char))\n out_file.write('\\n')\n\nout_file.close()",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "import os\n",
+ "out_file = open ('test.out', 'w')\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists ('test.out') :\n",
+ " print ('Cannot open output file\\n')\n",
+ " sys.exit(1)\n",
+ "\n",
+ "for cur_char in range (0, 128) :\n",
+ " out_file.write(str (cur_char))\n",
+ " out_file.write('\\n')\n",
+ "\n",
+ "out_file.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -84,12 +145,29 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 14.5, Page number: 267"
+ "source": [
+ "Example 14.5, Page number: 267"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 14.5.py\n# To copy the contents of a file to another file\n\n\n# Variable declaration\ntxt_file = open ('input.txt')\n\nsource_content = txt_file.read()\n\ntarget = open ('output.txt', 'w')\n\n# Calculation and result\ntarget.write(source_content)\nprint ('Content copied')\n\ntarget.close()",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "txt_file = open ('input.txt')\n",
+ "\n",
+ "source_content = txt_file.read()\n",
+ "\n",
+ "target = open ('output.txt', 'w')\n",
+ "\n",
+ "# Calculation and result\n",
+ "target.write(source_content)\n",
+ "print ('Content copied')\n",
+ "\n",
+ "target.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Practical_C_Programming/Chapter_15_1.ipynb b/Practical_C_Programming/Chapter_15_1.ipynb
index 72f7aaee..34a86a67 100644
--- a/Practical_C_Programming/Chapter_15_1.ipynb
+++ b/Practical_C_Programming/Chapter_15_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 15"
+ "name": "",
+ "signature": "sha256:23b3891085deb8af52412d44380b6187a4110d7e026531ec90b3b2ae79d61d0f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,53 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 15: Debugging and optimization"
+ "source": [
+ "Chapter 15: Debugging and optimization"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 15.1, Page number: 275"
+ "source": [
+ "Example 15.1, Page number: 275"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 15.1.py\n# A database program to look up names in a hardcoded list\n\n\n# Function declaration\ndef lookup (name) :\n lists = ['John', 'Jim', 'Jane', 'Clyde']\n result = 0\n\n for index in range (0, 4) :\n if (lists[index] == name) :\n result = 1\n break\n \n return result\n\n# Calculation and result\nname = 'John'\n\nif (lookup (name)) :\n print ('%s is in the list\\n' % name)\nelse :\n print ('%s is not in the list\\n' % name)",
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def lookup (name) :\n",
+ " lists = ['John', 'Jim', 'Jane', 'Clyde']\n",
+ " result = 0\n",
+ "\n",
+ " for index in range (0, 4) :\n",
+ " if (lists[index] == name) :\n",
+ " result = 1\n",
+ " break\n",
+ " \n",
+ " return result\n",
+ "\n",
+ "# Calculation and result\n",
+ "name = 'John'\n",
+ "\n",
+ "if (lookup (name)) :\n",
+ " print ('%s is in the list\\n' % name)\n",
+ "else :\n",
+ " print ('%s is not in the list\\n' % name)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "John is in the list\n\n"
+ "text": [
+ "John is in the list\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -38,19 +67,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 15.6, Page number: 288"
+ "source": [
+ "Example 15.6, Page number: 288"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 15.6.py\n# To count the number of 3's and 7's in an array\n\n\n# Variable and function declaration\nseven_count = 0\nthree_count = 0\ndata = []\n\ndef get_data (data) :\n for i in range (0, 5) :\n x = 3\n data.append(int(x))\n print (data)\n\n# Calculation\nget_data (data)\nfor index in range (0, 5) :\n if data[index] == 3 :\n three_count += 1\n\n if data[index] == 7 :\n seven_count += 1\n\n# Result\nprint ('Threes %d Sevens %d' % (three_count, seven_count))",
+ "input": [
+ "\n",
+ "# Variable and function declaration\n",
+ "seven_count = 0\n",
+ "three_count = 0\n",
+ "data = []\n",
+ "\n",
+ "def get_data (data) :\n",
+ " for i in range (0, 5) :\n",
+ " x = 3\n",
+ " data.append(int(x))\n",
+ " print (data)\n",
+ "\n",
+ "# Calculation\n",
+ "get_data (data)\n",
+ "for index in range (0, 5) :\n",
+ " if data[index] == 3 :\n",
+ " three_count += 1\n",
+ "\n",
+ " if data[index] == 7 :\n",
+ " seven_count += 1\n",
+ "\n",
+ "# Result\n",
+ "print ('Threes %d Sevens %d' % (three_count, seven_count))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[3, 3, 3, 3, 3]\nThrees 5 Sevens 0\n"
+ "text": [
+ "[3, 3, 3, 3, 3]\n",
+ "Threes 5 Sevens 0\n"
+ ]
}
],
"prompt_number": 4
@@ -59,12 +117,60 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 15.7, Page number: 292"
+ "source": [
+ "Example 15.7, Page number: 292"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 15.7.py\n# To perform binary search on a number in a file 'numbers.dat'\n\n\n# Variable declaration\nimport sys\nimport os\nin_file = open ('numbers.dat', 'r')\n\ndata = []\nmax_count = 0\n \n# Calculation and result\nif not os.path.exists ('numbers.dat') :\n print ('Error:Unable to open numbers.dat\\n')\n sys.exit(1)\n\nfor line in in_file :\n data.append(line)\n max_count += 1\n\nwhile (1) :\n search = 6\n \n if (search == -1) :\n break\n\n low = 0\n high = max_count\n\n while (1) :\n mid = (low + high) / 2\n middle = int (mid) \n\n if (int (data[middle]) == search) :\n print ('Found at index %d\\n' % (middle + 1))\n break\n\n if (low == high) :\n print ('Not found\\n')\n break\n\n if (int (data[middle]) < search) :\n low = middle\n else :\n high = middle \n\nin_file.close()",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "import os\n",
+ "in_file = open ('numbers.dat', 'r')\n",
+ "\n",
+ "data = []\n",
+ "max_count = 0\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists ('numbers.dat') :\n",
+ " print ('Error:Unable to open numbers.dat\\n')\n",
+ " sys.exit(1)\n",
+ "\n",
+ "for line in in_file :\n",
+ " data.append(line)\n",
+ " max_count += 1\n",
+ "\n",
+ "while (1) :\n",
+ " search = 6\n",
+ " \n",
+ " if (search == -1) :\n",
+ " break\n",
+ "\n",
+ " low = 0\n",
+ " high = max_count\n",
+ "\n",
+ " while (1) :\n",
+ " mid = (low + high) / 2\n",
+ " middle = int (mid) \n",
+ "\n",
+ " if (int (data[middle]) == search) :\n",
+ " print ('Found at index %d\\n' % (middle + 1))\n",
+ " break\n",
+ "\n",
+ " if (low == high) :\n",
+ " print ('Not found\\n')\n",
+ " break\n",
+ "\n",
+ " if (int (data[middle]) < search) :\n",
+ " low = middle\n",
+ " else :\n",
+ " high = middle \n",
+ "\n",
+ "in_file.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -85,12 +191,61 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 15.8, Page number: 300"
+ "source": [
+ "Example 15.8, Page number: 300"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 15.8.py\n# To perform binary search on a number in a file 'numbers.dat'\n\n\n# Variable declaration\nimport sys\nimport os\nin_file = open ('numbers.dat', 'r')\n\ndata = []\nmax_count = 0\n \n# Calculation and result\nif not os.path.exists ('numbers.dat') :\n print ('Error:Unable to open numbers.dat\\n')\n sys.exit(1)\n\nfor line in in_file :\n data.append(line)\n max_count += 1\n\nwhile (1) :\n search = 14\n \n if (search == -1) :\n break\n\n low = 0\n high = max_count\n\n while (1) :\n mid = (low + high) / 2\n middle = int (mid) \n\n if (int (data[middle]) == search) :\n print ('Found at index %d\\n' % (middle + 1))\n break\n\n if (low == high) :\n print ('Not found\\n')\n break\n\n if (int (data[middle]) < search) :\n low = middle\n else :\n high = middle \n\nin_file.close()",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "import os\n",
+ "in_file = open ('numbers.dat', 'r')\n",
+ "\n",
+ "data = []\n",
+ "max_count = 0\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists ('numbers.dat') :\n",
+ " print ('Error:Unable to open numbers.dat\\n')\n",
+ " sys.exit(1)\n",
+ "\n",
+ "for line in in_file :\n",
+ " data.append(line)\n",
+ " max_count += 1\n",
+ "\n",
+ "while (1) :\n",
+ " search = 14\n",
+ " \n",
+ " if (search == -1) :\n",
+ " break\n",
+ "\n",
+ " low = 0\n",
+ " high = max_count\n",
+ "\n",
+ " while (1) :\n",
+ " mid = (low + high) / 2\n",
+ " middle = int (mid) \n",
+ "\n",
+ " if (int (data[middle]) == search) :\n",
+ " print ('Found at index %d\\n' % (middle + 1))\n",
+ " break\n",
+ "\n",
+ " if (low == high) :\n",
+ " print ('Not found\\n')\n",
+ " break\n",
+ "\n",
+ " if (int (data[middle]) < search) :\n",
+ " low = middle\n",
+ " else :\n",
+ " high = middle \n",
+ "\n",
+ "in_file.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -111,12 +266,25 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 15.10, Page number: 304"
+ "source": [
+ "Example 15.10, Page number: 304"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 15.10.py\n# To illustrate divide by zero error\n\n\n# Variable declaration\ni = 1\nj = 0\n\n# Calculation and result\nprint ('Starting\\n')\nprint ('Before divide...')\ni = i / j\nprint ('After\\n')",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "i = 1\n",
+ "j = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Starting\\n')\n",
+ "print ('Before divide...')\n",
+ "i = i / j\n",
+ "print ('After\\n')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -133,7 +301,11 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "Starting\n\nBefore divide...\n"
+ "text": [
+ "Starting\n",
+ "\n",
+ "Before divide...\n"
+ ]
}
],
"prompt_number": 7
@@ -142,24 +314,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 15.11, Page number: 304"
+ "source": [
+ "Example 15.11, Page number: 304"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 15.11.py\n# To illustrate divide by zero error with flush() function\n\n\n# Variable declaration\nimport sys\ni = 1\nj = 0\n\n# Calculation and result\nprint ('Starting\\n')\nsys.stdout.flush()\nprint ('Before divide...')\nsys.stdout.flush()\ni = i / j\nprint ('After\\n')\nsys.stdout.flush()",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "i = 1\n",
+ "j = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Starting\\n')\n",
+ "sys.stdout.flush()\n",
+ "print ('Before divide...')\n",
+ "sys.stdout.flush()\n",
+ "i = i / j\n",
+ "print ('After\\n')\n",
+ "sys.stdout.flush()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Starting\n\n"
+ "text": [
+ "Starting\n",
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before divide...\n"
+ "text": [
+ "Before divide...\n"
+ ]
},
{
"ename": "ZeroDivisionError",
diff --git a/Practical_C_Programming/Chapter_16_1.ipynb b/Practical_C_Programming/Chapter_16_1.ipynb
index d1d60ff9..505718fd 100644
--- a/Practical_C_Programming/Chapter_16_1.ipynb
+++ b/Practical_C_Programming/Chapter_16_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 16"
+ "name": "",
+ "signature": "sha256:8846db95d13f18ddbaba03cb28aa141be8268e397ec14735e02a0f66209b0b25"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,57 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 16: Floating point"
+ "source": [
+ "Chapter 16: Floating point"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 16.1, Page number: 322"
+ "source": [
+ "Example 16.1, Page number: 322"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 16.1.py\n# To calculate the accuracy of calculations and storage\n\n\n# Variable declaration\nnumber1 = 1.0\nnumber2 = 1.0\ncounter = 0\n\n# Calculation and result\nwhile (number1 + number2 != number1) :\n counter += 1\n number2 = number2 / 10.0\n\nprint ('%2d digits accuracy in calculations\\n' % counter)\n\n\nnumber2 = 1.0\ncounter = 0\n\nresult = number1 + number2\ncounter += 1\nnumber2 = number2 / 10.0\n\nprint ('%2d digits accuracy in storage\\n' % counter)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "number1 = 1.0\n",
+ "number2 = 1.0\n",
+ "counter = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (number1 + number2 != number1) :\n",
+ " counter += 1\n",
+ " number2 = number2 / 10.0\n",
+ "\n",
+ "print ('%2d digits accuracy in calculations\\n' % counter)\n",
+ "\n",
+ "\n",
+ "number2 = 1.0\n",
+ "counter = 0\n",
+ "\n",
+ "result = number1 + number2\n",
+ "counter += 1\n",
+ "number2 = number2 / 10.0\n",
+ "\n",
+ "print ('%2d digits accuracy in storage\\n' % counter)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "16 digits accuracy in calculations\n\n 1 digits accuracy in storage\n\n"
+ "text": [
+ "16 digits accuracy in calculations\n",
+ "\n",
+ " 1 digits accuracy in storage\n",
+ "\n"
+ ]
}
],
"prompt_number": 1
diff --git a/Practical_C_Programming/Chapter_17_1.ipynb b/Practical_C_Programming/Chapter_17_1.ipynb
index c9e7bf83..3d179b54 100644
--- a/Practical_C_Programming/Chapter_17_1.ipynb
+++ b/Practical_C_Programming/Chapter_17_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 17"
+ "name": "",
+ "signature": "sha256:359ba0990b58235e80b2e0192de2b1c02844fb6d8275025bc2e3f3cf33cfcdf1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,18 +12,29 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 17: Advanced Pointers "
+ "source": [
+ "Chapter 17: Advanced Pointers "
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 17.1, Page number: 331"
+ "source": [
+ "Example 17.1, Page number: 331"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 17.1\n# To declare a structure\n\n\n# Structure declaration\nfrom ctypes import *\n\nclass person (Structure) :\n_fields_ = [(\"name\", c_wchar_p), (\"address\", c_wchar_p), (\"city_state_zip\", c_wchar_p), (\"age\", c_int), (\"height\", c_float)]",
+ "input": [
+ "\n",
+ "# Structure declaration\n",
+ "from ctypes import *\n",
+ "\n",
+ "class person (Structure) :\n",
+ "_fields_ = [(\"name\", c_wchar_p), (\"address\", c_wchar_p), (\"city_state_zip\", c_wchar_p), (\"age\", c_int), (\"height\", c_float)]"
+ ],
"language": "python",
"metadata": {},
"outputs": []
@@ -31,19 +43,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 17.2, Page number: 336"
+ "source": [
+ "Example 17.2, Page number: 336"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 17.2\n# To look for a data item in a list\n\n\n# Function declaration\ndef lookup (name) :\n lists = ['John', 'Jim', 'Jane', 'Clyde']\n result = 0\n\n for index in range (0, 4) :\n if (lists[index] == name) :\n result = 1\n break\n \n return result\n\n# Calculation and result\nname = 'Jane'\n\nif (lookup (name)) :\n print ('%s is in the list\\n' % name)\nelse :\n print ('%s is not in the list\\n' % name)",
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def lookup (name) :\n",
+ " lists = ['John', 'Jim', 'Jane', 'Clyde']\n",
+ " result = 0\n",
+ "\n",
+ " for index in range (0, 4) :\n",
+ " if (lists[index] == name) :\n",
+ " result = 1\n",
+ " break\n",
+ " \n",
+ " return result\n",
+ "\n",
+ "# Calculation and result\n",
+ "name = 'Jane'\n",
+ "\n",
+ "if (lookup (name)) :\n",
+ " print ('%s is in the list\\n' % name)\n",
+ "else :\n",
+ " print ('%s is not in the list\\n' % name)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Jane is in the list\n\n"
+ "text": [
+ "Jane is in the list\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -52,19 +90,31 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 17.3, Page number: 338"
+ "source": [
+ "Example 17.3, Page number: 338"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 17.3\n# To insert an element at an index in a list\n\n\n# Declaration and result\naList = [45, 89, 123]\n\naList.insert(1, 53)\n\nprint 'Final List : ', aList",
+ "input": [
+ "\n",
+ "# Declaration and result\n",
+ "aList = [45, 89, 123]\n",
+ "\n",
+ "aList.insert(1, 53)\n",
+ "\n",
+ "print 'Final List : ', aList"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Final List : [45, 53, 89, 123]\n"
+ "text": [
+ "Final List : [45, 53, 89, 123]\n"
+ ]
}
],
"prompt_number": 3
@@ -73,19 +123,71 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 17.4, Page number: 348"
+ "source": [
+ "Example 17.4, Page number: 348"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 17.4\n# To print the contents of a binary search tree in ASCII order\n\n\n# Class declaration\nclass Node:\n def __init__(self, val):\n self.l_child = None\n self.r_child = None\n self.data = val\n\ndef binary_insert(root, node):\n if root is None:\n root = node\n else:\n if root.data > node.data:\n if root.l_child == None:\n root.l_child = node\n else:\n binary_insert(root.l_child, node)\n else:\n if root.r_child == None:\n root.r_child = node\n else:\n binary_insert(root.r_child, node)\n\ndef in_order_print(root):\n if not root:\n return\n in_order_print(root.l_child)\n print root.data\n in_order_print(root.r_child)\n\nr = Node('Lemon')\nbinary_insert(r, Node('Plum'))\nbinary_insert(r, Node('Apple'))\nbinary_insert(r, Node('Orange'))\nbinary_insert(r, Node('Pear'))\nbinary_insert(r, Node('Grape'))\n\n\n# Result\nprint \"List of words in ASCII order:\"\nin_order_print(r)",
+ "input": [
+ "\n",
+ "# Class declaration\n",
+ "class Node:\n",
+ " def __init__(self, val):\n",
+ " self.l_child = None\n",
+ " self.r_child = None\n",
+ " self.data = val\n",
+ "\n",
+ "def binary_insert(root, node):\n",
+ " if root is None:\n",
+ " root = node\n",
+ " else:\n",
+ " if root.data > node.data:\n",
+ " if root.l_child == None:\n",
+ " root.l_child = node\n",
+ " else:\n",
+ " binary_insert(root.l_child, node)\n",
+ " else:\n",
+ " if root.r_child == None:\n",
+ " root.r_child = node\n",
+ " else:\n",
+ " binary_insert(root.r_child, node)\n",
+ "\n",
+ "def in_order_print(root):\n",
+ " if not root:\n",
+ " return\n",
+ " in_order_print(root.l_child)\n",
+ " print root.data\n",
+ " in_order_print(root.r_child)\n",
+ "\n",
+ "r = Node('Lemon')\n",
+ "binary_insert(r, Node('Plum'))\n",
+ "binary_insert(r, Node('Apple'))\n",
+ "binary_insert(r, Node('Orange'))\n",
+ "binary_insert(r, Node('Pear'))\n",
+ "binary_insert(r, Node('Grape'))\n",
+ "\n",
+ "\n",
+ "# Result\n",
+ "print \"List of words in ASCII order:\"\n",
+ "in_order_print(r)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "List of words in ASCII order:\nApple\nGrape\nLemon\nOrange\nPear\nPlum\n"
+ "text": [
+ "List of words in ASCII order:\n",
+ "Apple\n",
+ "Grape\n",
+ "Lemon\n",
+ "Orange\n",
+ "Pear\n",
+ "Plum\n"
+ ]
}
],
"prompt_number": 4
diff --git a/Practical_C_Programming/Chapter_18_1.ipynb b/Practical_C_Programming/Chapter_18_1.ipynb
index ac690274..0369d712 100644
--- a/Practical_C_Programming/Chapter_18_1.ipynb
+++ b/Practical_C_Programming/Chapter_18_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 18"
+ "name": "",
+ "signature": "sha256:2d44df2c3fb888f51302e9d5a213984c3dfb884f4d72dcb60cfc8091b69443e6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,46 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 18: Modular Programming"
+ "source": [
+ "Chapter 18: Modular Programming"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 18.2, Page number: 364"
+ "source": [
+ "Example 18.2, Page number: 364"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 18.2\n# To create an infinite array\n\n\n# Variable declaration\narray = [1, 2, 3, 4, 5]\narray_size = 10\nnum = 6\n\n# Calculation\nfor index in range (5, 10) :\n array.insert(index, num)\n num = num + 1\n\n# Result\nprint \"Contents of array of size 10 elements is\", array",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "array = [1, 2, 3, 4, 5]\n",
+ "array_size = 10\n",
+ "num = 6\n",
+ "\n",
+ "# Calculation\n",
+ "for index in range (5, 10) :\n",
+ " array.insert(index, num)\n",
+ " num = num + 1\n",
+ "\n",
+ "# Result\n",
+ "print \"Contents of array of size 10 elements is\", array"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Contents of array of size 10 elements is [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n"
+ "text": [
+ "Contents of array of size 10 elements is [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n"
+ ]
}
],
"prompt_number": 1
@@ -38,20 +60,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 18.3, Page number: 372"
+ "source": [
+ "Example 18.3, Page number: 372"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 18.3\n# To plot a histogram of an array of numbers\n\n\n# Calculation\nimport numpy as np \n\n# hist indicates that there are 0 items in bin #0, 2 in bin #1, 4 in bin #3, 1 in bin #4\n# bin_edges indicates that bin #0 is the interval [0,1), bin #1 is [1,2), ..., bin #3 is [3,4)\n\nhist, bin_edges = np.histogram([1, 1, 2, 2, 2, 2, 3], bins = range(5))\n\n\n# Result\nimport matplotlib.pyplot as plt\nplt.bar(bin_edges[:-1], hist, width=1) and plt.xlim(min(bin_edges), max(bin_edges))\nplt.savefig('histogram.png')\n\nfrom IPython.core.display import Image \nImage(filename='histogram.png')",
+ "input": [
+ "\n",
+ "\n",
+ "# Calculation\n",
+ "import numpy as np \n",
+ "\n",
+ "# hist indicates that there are 0 items in bin #0, 2 in bin #1, 4 in bin #3, 1 in bin #4\n",
+ "# bin_edges indicates that bin #0 is the interval [0,1), bin #1 is [1,2), ..., bin #3 is [3,4)\n",
+ "\n",
+ "hist, bin_edges = np.histogram([1, 1, 2, 2, 2, 2, 3], bins = range(5))\n",
+ "\n",
+ "\n",
+ "# Result\n",
+ "import matplotlib.pyplot as plt\n",
+ "plt.bar(bin_edges[:-1], hist, width=1) and plt.xlim(min(bin_edges), max(bin_edges))\n",
+ "plt.savefig('histogram.png')\n",
+ "\n",
+ "from IPython.core.display import Image \n",
+ "Image(filename='histogram.png')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
+ "metadata": {},
"output_type": "pyout",
"png": "iVBORw0KGgoAAAANSUhEUgAAAyAAAAJYCAYAAACadoJwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3X9s1fW9+PHXqSiwcgEHGFoJjivgNuaGJQirXgLu7gJy\n0Vy1rb3DKXHD5KoENeCPqcR03kzznXIJkUXurFQb7i4V55zkqmyaGS8ysWxuc1iZVq5SfhlxuFIG\n5Xz/4NLdrrS0QN9t6eORNJN3P5/j63zylvHkfM5pJpvNZgMAACCBnK4eAAAA6D0ECAAAkIwAAQAA\nkhEgAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABI\nRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoAAAADJCBAAACAZ\nAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQE\nCAAAkIwAAQAAkhEgAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEg\nAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgKkA+6///7I\nycmJ888/v13H79mzJ+bNmxfDhg2LAQMGxCWXXBKbNm3q5CkBAKD7ymSz2WxXD9ETfPDBB3HeeedF\nTk5OjBo1Kt588802jz906FD83d/9Xbz55puxaNGiGDJkSDzyyCPxP//zP/HGG2/E6NGjE00OAADd\nhwBpp6uvvjo++uijOHjwYOzevTt+85vftHn8f/7nf8bVV18dVVVVccUVV0RExO7du2Ps2LExc+bM\nqKysTDE2AAB0K27Baodf/OIX8dRTT8WSJUsim81GJpM55jlVVVUxfPjwpviIiBg6dGgUFxfHM888\nEwcOHOjMkQEAoFsSIMfQ2NgYN998c3z729+OcePGtfu8TZs2RUFBQYv1iRMnRn19fdTU1JzMMQEA\noEcQIMfwgx/8ILZu3RplZWUdOq+uri7y8vJarB9Z27Zt20mZDwAAepI+XT1Ad/bRRx/FvffeG/fe\ne28MGTKkQ+c2NDRE3759W6z369cvIiL27dvX4nu7d++O559/Pj73uc9F//79j29oAAA6zb59+6K2\ntjamT58eQ4cO7epxeiQB0oa77747hg4dGjfffHOHz+3fv3/s37+/xXpDQ0PT9//a888/H3PmzOn4\noAAAJPXkk0/GN77xja4eo0cSIK145513YsWKFbFkyZL44IMPmtYbGhriz3/+c7z//vsxcODAOPPM\nM496fl5e3lFvs6qrq4uIiPz8/BbfGzVqVEQc3tBf+MIXTsbT6DUWLFgQS5Ys6eoxehTX7Pi4bh2z\ndu3auOeeey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efLkOPvssyMiYvv27bF58+Y4ePBgs3N37NgRa9as\naVrbvXt3rF69OmbPnh2nn356uicCAADdSCabzWa7eojuqqSkJJ5++um45ZZb4txzz42VK1fGxo0b\n42c/+1lcfPHFEXH4p6VXVFREbW1tjBw5MiIO/yT0iy++OH7729/GwoULY8iQIfHII4/EBx98EK+/\n/nqMGTOmK58WAAB0GbdgtaGioiLuueeeeOKJJ+Ljjz+Or3zlK/HTn/60KT4iIjKZTLPbrCIicnJy\nYu3atbFw4cJYunRp7Nu3Ly688MKoqKgQHwAA9GpuwWpD375948EHH4xt27bFvn374rXXXouvf/3r\nzY4pLy+PxsbGplc/jhg8eHCsWLEidu3aFR999FFMnDgx/vEf/zE+85nPxOTJk2PdunXtmmHPnj0x\nb968GDZsWAwYMCAuueSS2LRp00l7jt3Z/v374/bbb4/8/PwOXbfHH388cnJyjvq1c+fOBJN3jT/9\n6U+xePHimDFjRnz2s5+NnJycWLlyZbvP76177USuW2/da6+//nrcdNNNMW7cuBgwYECcc845UVJS\nEu+88067zu+te+1Erltv3Wu/+93voqioKM4999zIzc2NIUOGRGFhYVRWtu8jY3vrXjuR69Zb99rR\n3H///ZGTkxPnn39+u47vrfvteHgFJIHrrrsunnrqqbjllltizJgxUV5eHpdeemm89NJLbX5826FD\nh2LWrFnx5ptvxqJFi5pu5Zo6dWq88cYbMXr06ITPIr3jvW5HlJWVxahRo5qtDRo0qLPG7XK7du2K\nsrKyOOecc2L8+PHx8ssvt3h1rjW9ea+dyHU7orfttQceeCDWr18fRUVF8eUvfznq6upi2bJlUVBQ\nEK+99lqMGzeu1XN78147ket2RG/ba1u3bo1PP/00rrvuusjPz4/6+vqoqqqKa665Jmpra+M73/lO\nq+f25r12ItftiN621/7aBx98EP/6r/8aubm57fr/hN68345Llk61YcOGbCaTyX7/+99vWmtoaMiO\nHj06W1hY2Oa5P/rRj7KZTCb71FNPNa3t2rUre+aZZ2b/+Z//udNm7g5O5LqVl5dnM5lM9o033ujs\nMbuV/fv3Z3fs2JHNZrPZjRs3ZjOZTHblypXtOrc377UTuW69da/993//d/bAgQPN1t55551sv379\nsnPmzGnz3N68107kuvXWvXY0jY2N2fHjx2dHjhzZ5nG9ea8dTXuvm712WElJSfbv//7vs1OnTs1+\n6UtfOubx9lvHuAWrk1VVVUWfPn1i3rx5TWt9+/aN66+/PtavXx8ffvhhm+cOHz48rrjiiqa1oUOH\nRnFxcTzzzDNx4MCBTp29K53IdTsim83G3r17o7GxsTNH7TbOOOOMOOussyLi8HPviN68107kuh3R\n2/baV7/61ejTp/kL6KNHj44vfvGLsXnz5jbP7c177USu2xG9ba8dTU5OTowYMeKYnyjZm/fa0bT3\nuh3Rm/faL37xi3jqqadiyZIlLX6kQmvst44RIJ1s06ZNMXbs2BgwYECz9YkTJ0ZExK9+9as2zy0o\nKGixPnHixKivr4+ampqTO2w3ciLX7Yhp06bFoEGDIjc3Ny6//PLYsmVLp8x6KujNe+1ksNcO/2Fl\nx44dMXTo0DaPs9eaa+91O6K37rX6+vrYvXt3/OEPf4iHH344nn/++Vi0aFGb59hrx3fdjuite62x\nsTFuvvnm+Pa3v92u2yKPsN86xntAOlldXV3k5eW1WD+ydrSfmP5/z506dWqb53bkP46e5ESuW25u\nbsydOzemTZsWAwcOjI0bN8ZDDz0UhYWFUV1dHSNGjOi0uXuq3rzXToS99heVlZWxbdu2+O53v9vm\ncfZac+29br19r916661NP5erT58+sXTp0mavkB+NvXZ8162377Uf/OAHsXXr1vj5z3/eofPst44R\nIJ1s37590bdv3xbr/fr1a/p+axoaGo773J7uRK5bUVFRFBUVNf36sssui+nTp8eUKVPi/vvvj+XL\nl5/8gXu43rzXToS9dtjmzZvjxhtvjMLCwrj22mvbPNZe+4uOXLfevtduueWWKC4ujm3btkVlZWXc\ndNNN0b9//zavm712fNetN++1jz76KO6999649957Y8iQIR06137rGAHSyfr37x/79+9vsd7Q0ND0\n/c44t6c72c/9oosuikmTJrX74497m96810623rbXtm/fHrNmzYozzzwzqqqqjnmvtL12WEev29H0\npr123nnnxXnnnRcREXPmzInp06fHggULori4uNU9Y68d33U7mt6y1+6+++4YOnRo3HzzzR0+137r\nGO8B6WR5eXlHvV2orq4uIiLy8/M75dyerjOe+4gRI+Ljjz8+4dlORb15r3WG3rLXPvnkk5g5c2b8\n8Y9/jP/6r/+K4cOHH/Mce+34rltreste+2tXXnllfPLJJ/H222+3eoy91lJ7rltrTvW99s4778SK\nFSvi5ptvjg8++CBqa2ujtrY2Ghoa4s9//nO8//77bT5/+61jBEgnu+CCC6Kmpib27t3bbH3Dhg0R\nETF+/PhWzx0/fnxUV1e3+GSeDRs2RG5ubowdO/bkD9xNnMh1a827774bw4YNOynznWp6817rDL1h\nrzU0NMTs2bNjy5Yt8dOf/jQ+//nPt+u83r7Xjve6taY37LWjOXI7S05O63+M6e177Wjac91ac6rv\ntQ8//DAOHToU8+fPj7/9279t+vrlL38ZNTU1MWrUqCgrK2v1fPutYwRIJ7vqqquisbGx6U1gEYd/\nwnd5eXlMnjw5zj777Ig4/HL85s2b4+DBg83O3bFjR6xZs6Zpbffu3bF69eqYPXt2uz9Kryc6keu2\na9euFo+3du3aqK6ujhkzZnT+8N2cvXZ87LW/aGxsjJKSktiwYUOsXr06Jk2adNTj7LXmTuS69da9\ndrTnfeDAgaioqIghQ4Y0vam3rq7OXvs/TuS69da9dv7558fTTz8dP/7xj5u+nn766Rg3blycc845\n8eMf/ziuv/76iLDfToZM9ng/+J52KykpiaeffjpuueWWOPfcc2PlypWxcePG+NnPfhYXX3xxRBz+\nqd8VFRVRW1sbI0eOjIjDP1Xz4osvjt/+9rexcOHCpp+q+cEHH8Trr78eY8aM6cqn1emO97qNGTMm\nCgoKYsKECTFo0KCorq6Oxx57LM4+++x4/fXXT+m/wVm2bFns2bMntm3bFj/4wQ/iiiuuaHq1aP78\n+TFw4EB77SiO97r11r22YMGCWLp0acyePbvZm1WPmDNnTkT4fe2vnch166177Z/+6Z9i7969MWXK\nlMjPz4/t27dHZWVl1NTURHl5eXzzm9+MCHvtr53Ideute601U6dOjY8++ih+85vfNK3ZbydB+p99\n2Ps0NDRkFy5cmM3Ly8v269cvO2nSpOwLL7zQ7Jjrrrsum5OTk33//febrX/88cfZb33rW9mhQ4dm\nc3Nzs9OmTes1P530eK/b3Xffnb3ggguygwcPzp5xxhnZz33uc9kbb7wxu3PnztRPIbnPfe5z2Uwm\nk81kMtmcnJxsTk5O0z8fuUb2WkvHe916616bOnVq0zX666+cnJym4+y15k7kuvXWvfYf//Ef2a9/\n/evZ4cOHZ08//fTskCFDspdeeml23bp1zY6z15o7kevWW/daa6ZOnZo9//zzm63ZbyfOKyAAAEAy\n3gMCAAAkI0AAAIBkBAgAAJCMAAEAAJIRIAAAQDICBAAASEaAAAAAyQgQAAAgGQECAAAkI0AAAIBk\nBAgAAJCMAAEAAJIRIAAAQDICBAAASEaAAAAAyQgQAAAgGQECAAAkI0AAAIBkBAgAAJCMAAEAAJIR\nIAAAQDICBAAASEaAAAAAyQgQAAAgGQECAAAkI0AAAIBkBAgAAJCMAAEAAJIRIAAAQDICBAAASEaA\nAAAAyQgQAAAgGQECAAAkI0AAAIBkBAgAAJCMAAEAAJIRIAAAQDICBAAASEaAAAAAyQgQAAAgmf8P\npDpIO5V4wm8AAAAASUVORK5CYII=\n",
"prompt_number": 5,
- "text": "<IPython.core.display.Image at 0x5a46130>"
+ "text": [
+ "<IPython.core.display.Image at 0x5a46130>"
+ ]
}
],
"prompt_number": 5
diff --git a/Practical_C_Programming/Chapter_19_1.ipynb b/Practical_C_Programming/Chapter_19_1.ipynb
index f02444d9..00ddd7e8 100644
--- a/Practical_C_Programming/Chapter_19_1.ipynb
+++ b/Practical_C_Programming/Chapter_19_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 19"
+ "name": "",
+ "signature": "sha256:4ee1b1671641fa0922389d9bf11b94f42d9755534b4f0476bbe2f9ceb3b1bc7e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,41 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 19: Ancient compilers"
+ "source": [
+ "Chapter 19: Ancient compilers"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 19.1, Page number: 385"
+ "source": [
+ "Example 19.1, Page number: 385"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 19.1.py\n# To calculate the area of a rectangle\n\n\n# Function declaration\ndef area (width, height) :\n return width * height\n\n# Calculation and result\nsize = area (3.0, 2)\nprint ('Area is %f\\n' % size)",
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def area (width, height) :\n",
+ " return width * height\n",
+ "\n",
+ "# Calculation and result\n",
+ "size = area (3.0, 2)\n",
+ "print ('Area is %f\\n' % size)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Area is 6.000000\n\n"
+ "text": [
+ "Area is 6.000000\n",
+ "\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +55,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 19.2, Page number: 386"
+ "source": [
+ "Example 19.2, Page number: 386"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 19.2.py\n# To calculate the square of a number\n\n\n# Function declaration\ndef square (s) :\n return s * s\n\n# Calculation and result\ni = square (5)\nprint ('i is %d\\n' % i)",
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def square (s) :\n",
+ " return s * s\n",
+ "\n",
+ "# Calculation and result\n",
+ "i = square (5)\n",
+ "print ('i is %d\\n' % i)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "i is 25\n\n"
+ "text": [
+ "i is 25\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +90,32 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 19.3, Page number: 386"
+ "source": [
+ "Example 19.3, Page number: 386"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 19.3.py\n# To calculate the sum of 3 numbers\n\n\n# Function declaration\ndef sum (i1, i2, i3) :\n return i1 + i2 + i3\n\n# Calculation and result\nprint ('Sum is %d\\n' % sum (1, 2, 3))",
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def sum (i1, i2, i3) :\n",
+ " return i1 + i2 + i3\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Sum is %d\\n' % sum (1, 2, 3))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Sum is 6\n\n"
+ "text": [
+ "Sum is 6\n",
+ "\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +124,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 19.4, Page number: 387"
+ "source": [
+ "Example 19.4, Page number: 387"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 19.4.py\n# To print the full name of a person\n\n\n# Variable declaration\nfirst = 'John'\nlast = 'Doe'\n\n# Calculation and result\nfull = first + ' ' + last\nprint ('The name is %s\\n' % full)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "first = 'John'\n",
+ "last = 'Doe'\n",
+ "\n",
+ "# Calculation and result\n",
+ "full = first + ' ' + last\n",
+ "print ('The name is %s\\n' % full)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The name is John Doe\n\n"
+ "text": [
+ "The name is John Doe\n",
+ "\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +159,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 19.5, Page number: 390"
+ "source": [
+ "Example 19.5, Page number: 390"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 19.5.py\n# To calculate the area of a rectangle\n\n\n# Function declaration\ndef area (width, height) :\n return width * height\n\n# Calculation and result\nsize = area (3.0, 2.0)\nprint ('Area is %f\\n' % size)",
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def area (width, height) :\n",
+ " return width * height\n",
+ "\n",
+ "# Calculation and result\n",
+ "size = area (3.0, 2.0)\n",
+ "print ('Area is %f\\n' % size)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Area is 6.000000\n\n"
+ "text": [
+ "Area is 6.000000\n",
+ "\n"
+ ]
}
],
"prompt_number": 5
diff --git a/Practical_C_Programming/Chapter_21_1.ipynb b/Practical_C_Programming/Chapter_21_1.ipynb
index 8d3e6b65..144ac453 100644
--- a/Practical_C_Programming/Chapter_21_1.ipynb
+++ b/Practical_C_Programming/Chapter_21_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 21"
+ "name": "",
+ "signature": "sha256:519d4be291344b242a6ae999f129aea597642f5315e1fe947ec2b9d627dcc018"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 21: C's dustier corners"
+ "source": [
+ "Chapter 21: C's dustier corners"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 21.1, Page number: 401"
+ "source": [
+ "Example 21.1, Page number: 401"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 21.1.py\n# To check whether the character input by the user is for 'add', 'delete' or 'quit'\n\n\n# Variable declaration\nimport sys\nline = 'a'\n\n# Calculation and result\nif (line == 'a') :\n print ('Add\\n')\nelif (line == 'd') :\n print ('Delete\\n')\nelif (line == 'q') :\n print ('Quit\\n')\n sys.exit(1) \nelse :\n print ('Error:Bad command %c\\n' % line)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "line = 'a'\n",
+ "\n",
+ "# Calculation and result\n",
+ "if (line == 'a') :\n",
+ " print ('Add\\n')\n",
+ "elif (line == 'd') :\n",
+ " print ('Delete\\n')\n",
+ "elif (line == 'q') :\n",
+ " print ('Quit\\n')\n",
+ " sys.exit(1) \n",
+ "else :\n",
+ " print ('Error:Bad command %c\\n' % line)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Add\n\n"
+ "text": [
+ "Add\n",
+ "\n"
+ ]
}
],
"prompt_number": 1
diff --git a/Practical_C_Programming/Chapter_23_1.ipynb b/Practical_C_Programming/Chapter_23_1.ipynb
index 065813d7..bde77ef6 100644
--- a/Practical_C_Programming/Chapter_23_1.ipynb
+++ b/Practical_C_Programming/Chapter_23_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 23"
+ "name": "",
+ "signature": "sha256:456077e76cba45d73549d009e1de5e86e8fe318cfd47c138325bf27f45638790"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,42 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 23: Programming adages"
+ "source": [
+ "Chapter 23: Programming adages"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 23.1, Page number: 447"
+ "source": [
+ "Example 23.1, Page number: 447"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 23.1.py\n# To check whether the number input by the user is 2 or not\n\n\n# Variable declaration\nnumber = 2\n\n# Calculation and result\nif (number != 2) :\n print ('Number is not two\\n')\nelse :\n print ('Number is two\\n')",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "number = 2\n",
+ "\n",
+ "# Calculation and result\n",
+ "if (number != 2) :\n",
+ " print ('Number is not two\\n')\n",
+ "else :\n",
+ " print ('Number is two\\n')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Number is two\n\n"
+ "text": [
+ "Number is two\n",
+ "\n"
+ ]
}
],
"prompt_number": 1
diff --git a/Practical_C_Programming/Chapter_2_3.ipynb b/Practical_C_Programming/Chapter_2_3.ipynb
index f981ce8e..36e059c9 100644
--- a/Practical_C_Programming/Chapter_2_3.ipynb
+++ b/Practical_C_Programming/Chapter_2_3.ipynb
@@ -1,1156 +1,1138 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 2:. Convective Mass Transfer"
- ]
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.1,Page number94"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Illustration 2.1\n",
- "#Mass-Transfer Coefficients in a Blood Oxygenator\n",
- "\n",
- "#Variable declaration\n",
- "\n",
- "\t# a-oxygen b-stagnant water\n",
- "T = 310 \t\t\t\t\t# [K]\n",
- "\t# Since the solubility of oxygen in water at 310 K is extremely low, we are dealing with \tdilute solutions\n",
- "k_L = 3.3*10**-5 \t\t\t\t# [coefficient based on the oxygen concentration \t\t\t\t\t\tdifference in the water, m/s]\n",
- "row = 993 \t\t\t\t\t# [kg/cubic m]\n",
- "M_b = 18 \t\t\t\t\t# [gram/mole]\n",
- "\n",
- "\n",
- "#Calculation\n",
- " \n",
- "\t# Since we are dealing with very dilute solutions\n",
- "\t# Therefore, c = (row/M_avg) = row/M_b\n",
- "c = row/M_b \t\t\t\t\t# [kmole/cubic m]\n",
- "\t# Using equation 2.10\n",
- "k_x = k_L*c \t\t\t\t\t# [kmole/square m.s]\n",
- "\n",
- "#Result\n",
- "\n",
- "print\"The mass-transfer coefficient based on the mole fraction of oxygen in the liquid is\",round(k_x,5),\" kmole/square m.s\" \n",
- "\n",
- " "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The mass-transfer coefficient based on the mole fraction of oxygen in the liquid is 0.00182 kmole/square m.s\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.2,Page number:95"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Illustration 2.2\n",
- "#Mass-Transfer Coefficient in a Gas Absorber\n",
- "\n",
- "#Variable declaration\n",
- "\n",
- "\t# a-ammonia b-air\n",
- "T = 300 \t\t\t\t\t# [K]\n",
- "P = 1 \t\t\t\t\t\t# [atm]\n",
- "y_a1 = 0.8 \t\t\t\t\t# [ammonia mole fraction in the bulk of the gas \t\t\t\t\t\t\tphase]\n",
- "y_a2 = 0.732 \t\t\t\t\t# [ammonia gas-phase mole fraction on interface]\n",
- "N_a = 4.3*10**-4 \t\t\t\t# [ammonia flux, kmole/square m.s]\n",
- "\n",
- "#Calculations\n",
- "\n",
- "import math\n",
- "\t# Using equation 2.2\n",
- "F_g = N_a/math.log10((1-y_a2)/(1-y_a1)) \t\t# [kmole/square m.s]\n",
- "\n",
- "#Result\n",
- "\n",
- "print\"The mass-transfer coefficient in the gas phase at that point where flux is 4.3*10**-4 is\",round(F_g,5),\" kmole/square m.s\"\n",
- "print\"\\n\\nNOTE:Calculation mistake in book:\\nAnswer written as 1.47*10^-4,Actually,,...it is 1.47*10^-3.Please REDO last calculation manually to check\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The mass-transfer coefficient in the gas phase at that point where flux is 4.3*10**-4 is 0.00338 kmole/square m.s\n",
- "\n",
- "\n",
- "NOTE:Calculation mistake in book:\n",
- "Answer written as 1.47*10^-4,Actually,,...it is 1.47*10^-3.Please REDO last calculation manually to check\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.3,Page number:96"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Illustration 2.3\n",
- "#Mass-Transfer Coefficient in a Packed-Bed Distillation Column\n",
- "\n",
- "#Variable declaration\n",
- "\n",
- "\t\t# a-methanol b-water\n",
- "P = 101.3 \t\t\t\t\t\t# [kPa]\n",
- "y_a1 = 0.707 \t\t\t\t\t\t# [mole fraction at interface]\n",
- "y_a2 = 0.656 \t\t\t\t\t\t# [mole fraction at bulk of the gas]\n",
- "k_g = 1.62*10**-5 \t\t\t\t\t# [mass-transfer coefficient at a point \t\t\t\t\t\t\t in the column, kmole/square m.s.kPa]\n",
- "#Calculations\n",
- "\n",
- "\t# Using equation 2.14\n",
- "k_y = k_g*P \t\t\t\t\t\t# [kmole/square m.s]\n",
- "\t# Using equation 2.12\n",
- "N_a = k_y*(y_a1-y_a2) \t\t\t\t\t# [kmole/square m.s]\n",
- "\n",
- "#Result\n",
- "\n",
- "print\"The methanol flux at the point of given mass transfer coefficient is\",round(N_a,7),\"kmole/square m.s\" \n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The methanol flux at the point of given mass transfer coefficient is 8.37e-05 kmole/square m.s\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.4,Page number:99"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Illustration 2.4\n",
- "# Mass Transfer into a Dilute Stream Flowing Under Forced Convection in a Circular Conduit\n",
- "\n",
- "n = 6 # [number of variables]\n",
- "\n",
- "#Calculations\n",
- "\n",
- "from scipy.optimize import fsolve\n",
- "from numpy import *\n",
- "import math\n",
- "# To determine the number of dimensionless parameters to be formed, we must know the rank, r, of the dimensional matrix.\n",
- "# The dimensional matrix is \n",
- "DM =matrix([[0,0,1,1,0,0],[1,1,-3,-1,2,1],[-1,-1,0,0,-1,-1]]) \n",
- "rk= linalg.matrix_rank(DM)\n",
- "print\"Rank of matrix is \",rk \n",
- "\n",
- "#The numbers in the table represent the exponent of M, L, and t in the dimensional expression of each of the six variables involved. For example, the dimensional expression of p is M/Lt hence the exponents are 1, -1, and -1\n",
- "\n",
- "# From equation 2.16\n",
- "i = n-rk # [number of dimensional groups]\n",
- "# Let the dimensional groups are pi1, pi2 and pi3\n",
- "# Therefore pi1 = (D_AB)**a*(row)**b*(D)**c*kc\n",
- "# pi2 = (D_AB)**d*(row)**e*(D)**f*v\n",
- "# pi3 = (D_AB)**g*(row)**h*(D)**i*u\n",
- "\n",
- "# Solving for pi1\n",
- "# M**0*L**0*t**0 = 1 = (L**2/t)**a*(M/L**3)**b*(L)**c*(L/t)\n",
- "\n",
- "# Solution of simultaneous equation\n",
- "def F(e):\n",
- " f1 = 2*e[0]-3*e[1]+e[2]+1 \n",
- " f2 = -e[0]-1 \n",
- " f3 = -e[1] \n",
- " return(f1,f2,f3)\n",
- "\n",
- "\n",
- "# Initial guess:\n",
- "e = [0.1,0.8,0.5] \n",
- "y = fsolve(F,e) \n",
- "a = y[0] \n",
- "b = y[1] \n",
- "c = y[2] \n",
- "print\"The coefficients of pi1 are\",a,round(b),c \n",
- "# Similarly the coefficients of pi2 and pi3 are calculated\n",
- "# Therefore we get pi1 = kc*D/D_AB = Sh i.e. Sherwood Number\n",
- "# pi2 = v*D/D_AB = P_ed i.e. Peclet Number\n",
- "# pi3 = u/(row*D_AB) = Sc i.e. Schmidt Number\n",
- "\n",
- "# Dividing pi2 by pi3 gives\n",
- "# pi2/pi3 = D*v*row/u = Re i.e. Renoylds number\n",
- "\n",
- "print\"The result of the dimensional analysis of forced-convection mass transfer in a circular conduit indicates that a correlating relation could be of the form\\n Sh = function(Re,Sc)\\n which is analogous to the heat transfer correlation \\n Nu = function(Re,Pr)\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Rank of matrix is 3\n",
- "The coefficients of pi1 are -1.0 0.0 1.0\n",
- "The result of the dimensional analysis of forced-convection mass transfer in a circular conduit indicates that a correlating relation could be of the form\n",
- " Sh = function(Re,Sc)\n",
- " which is analogous to the heat transfer correlation \n",
- " Nu = function(Re,Pr)\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.6,Page number:111"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Illustration 2.6\n",
- "#Mass Transfer to Fluid Flow Normal to a Cylinder\n",
- "\n",
- "#Variable declaration\n",
- "\t# a-UF6 b-air\n",
- "M_a = 352 \t\t\t\t\t# [molecular weight of UF6, gram/mole]\n",
- "M_b = 29 \t\t\t\t\t# [gram/mole]\n",
- "d = 0.01 \t\t\t\t\t# [diameter, m]\n",
- "x = 0.1 \t\t\t\t\t# [length exposed to air stream, m]\n",
- "v = 1 \t\t\t\t\t\t# [m/s]\n",
- "Ts = 303 \t\t\t\t\t# [surface temperature of solid, K]\n",
- "P_a = 27 \t\t\t\t\t# [vapor pressure of UF6, kPa]\n",
- "Tb = 325 \t\t\t\t\t# [bulk temperature of solid ,K]\n",
- "P = 101.3 \t\t\t\t\t# [kPa]\n",
- "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
- "import math\n",
- "\n",
- "y_a1 = P_a/P \t\t\t\t\t# [mole fraction at point 1]\n",
- "y_a2 = 0 \t\t\t\t\t# [mole fraction at point 2]\n",
- "\n",
- "\t# Along the mass-transfer path-cylinder surface (point 1) to bulk air (point 2)\n",
- "Tavg = (Ts+Tb)/2 \t\t\t\t# [K]\n",
- "\n",
- "\t# At point 1, the gas is saturated with UF6 vapor, while at point 2 the gas is virtually \tfree of UF6\n",
- "\t# Therefore\n",
- "Pavg = (P_a+0)/2 \t\t\t\t# [average partial pressure, kPa]\n",
- "y_a = Pavg/P \t\t\t\t\t# [mole fraction of UF6]\n",
- "\n",
- "Mavg = M_a*y_a+M_b*(1-y_a) \t\t\t# [gram/mole]\n",
- "row_avg = P*Mavg/(R*Tavg) \t\t\t# [kg/cubic m]\n",
- "\n",
- "\t# Parameter for c-O2, d-N2 and a-UF6\n",
- "yi_c = 0.182 \n",
- "yi_d = 0.685 \n",
- "yi_a = 0.133 \n",
- "Tc_c = 154.6 \t\t\t\t# [K]\n",
- "Tc_d = 126.2 \t\t\t\t\t# [K]\n",
- "Tc_a = 505.8 \t\t\t\t\t# [K]\n",
- "Pc_c = 50.4 \t\t\t\t\t# [bar]\n",
- "Pc_d = 33.9 \t\t\t\t\t# [bar] \n",
- "Pc_a = 46.6 \t\t\t\t\t# [bar]\n",
- "M_c = 32 \t\t\t\t# [gram/mole]\n",
- "M_d = 28 \t\t\t\t\t# [gram/mole] \n",
- "M_a = 352 \t\t\t\t\t# [gram/mole]\n",
- "V_c = 73.4 \t\t\t\t# [cubic cm/mole]\n",
- "V_d = 89.8 \t\t\t\t\t# [cubic cm/mole]\n",
- "V_a = 250 \t\t\t\t\t# [cubic cm/mole]\n",
- "Z_c = 0.288 \n",
- "Z_d = 0.290 \n",
- "Z_a = 0.277 \n",
- "\n",
- "#Calculations\n",
- "\n",
- "\n",
- "\t# From equation 2.52 and 2.53\n",
- "Tcm = yi_c*Tc_c+yi_d*Tc_d+yi_a*Tc_a \t\t# [K]\n",
- "Pcm = 10**6*R*Tcm*(yi_c*Z_c+yi_d*Z_d+yi_a*Z_a)/((yi_c*V_c+yi_d*V_d+yi_a*V_a)*100000) \t# [bar]\n",
- "M_avg = yi_c*M_c+yi_d*M_d+yi_a*M_a \t\t# [gram/mole]\n",
- "\n",
- "\t# From equation 2.50\n",
- "Em = 0.176*(Tcm/(M_avg**3*Pcm**4))**(1.0/6.0) \t# [uP]**-1\n",
- "\n",
- "\t# From equation 2.51\n",
- "Trm = Tavg/Tcm \n",
- "f_Trm = (0.807*Trm**0.618)-(0.357*math.exp(-0.449*Trm))+(0.340*math.exp(-4.058*Trm))+0.018 \n",
- "\t# From equation 2.49 \n",
- "u = f_Trm/Em \t\t\t\t\t\t# [uP]\n",
- "u = u*10**-7 \t\t\t\t\t\t# [viscosity, kg/m.s]\n",
- "\n",
- "Re = d*v*row_avg/u \t\t\t\t\t# [Renoylds number]\n",
- "\n",
- "\t\t# Diffusivity of UF6 vapors in air at 314 K and 1 atm from equation 1.49\n",
- "D_ab = 0.0904 \t\t\t\t\t\t# [square cm/s]\n",
- "\n",
- "Sc = u/(row_avg*D_ab*10**-4) \t\t\t\t# [Schmidt number]\n",
- "\n",
- "Sh_avg = 0.43 + 0.532*Re**0.5*Sc**0.31 \t\t# [Sherwood number]\n",
- "\t\t# From equation 1.7\n",
- "c = P/(R*Tavg) \t\t\t\t\t# [kmole/cubic m]\n",
- "\t\t# From Table 2.1 \n",
- "F_av = Sh_avg*D_ab*c*10**-4/d \t\t\t\t# [kmole/square m.s]\n",
- "\n",
- "\t\t# From equation 2.2\n",
- "N_avg = F_av*math.log((1-y_a2)/(1-y_a1)) \t\t# [kmole/square m.s]\n",
- "S = 2*math.pi*d**2/4 +math.pi*d*x \t\t\t# [total surface area of the cylinder, \t\t\t\t\t\t\tsquare m]\n",
- "\n",
- "w_a = N_avg*S*M_a \t\t\t\t\t# [rate of sublimation of the solid, \t\t\t\t\t\t\tkg/s] \n",
- "\n",
- "#Result\n",
- "print\"Rate of sublimation of a cylinder of UF6 is\",round(w_a,5),\"kg/s\\n\\n\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Rate of sublimation of a cylinder of UF6 is 0.00023 kg/s\n",
- "\n",
- "\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.7,Page number:116"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Illustration 2.7\n",
- "# The Chilton-Colburn Analogy\n",
- "import math\n",
- "#Variable declaration\n",
- "\n",
- "\t# a-benzene b-nitrogen\n",
- "T = 300 \t\t\t\t\t# [K]\n",
- "P = 101.3 \t\t\t\t\t# [kPa]\n",
- "v =10 \t\t\t\t\t\t# [m/s]\n",
- "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
- "\n",
- "\n",
- "n = -0.5 \n",
- "\t# Data on the properties of C02 at 300 K and 1 bar\n",
- "u = 1.5*10**-5 \t\t\t\t# [viscosity, P]\n",
- "Pr = 0.77 \t\t\t\t\t# [Prandtl number]\n",
- "Cp = 853 \t\t\t\t\t# [J/kg.K]\n",
- "\t# Therefore\n",
- "\t# b = 5.086*l**0.5\n",
- "\t# j_D = j_H = f(Re) = 5.086*(l**0.5)*Re**-0.5\n",
- "\t# From Table 2.1\n",
- "\t# F = j_D*c*v/Sc**(2/3) = 5.086*(l**0.5)*c*v/(Re**0.5*Sc**(2/3)) = \t\t5.086*(row*v*u)**0.5/(Mavg*Sc**(2.0/3.0))\n",
- "\n",
- "#Calculations\n",
- "\n",
- "\t# Vapor pressure of benzene\n",
- "P_a = math.exp(15.9008-(2788.51/(T-52.36))) \t# [mm of Hg]\n",
- "P_a = P_a*101.3/760 \t\t\t\t\t# [kPa]\n",
- "\n",
- "\t# Parameter for a-benzene, b-nitrogen \n",
- "yi_a = 0.07 \n",
- "yi_b = 0.93 \n",
- "Tc_a = 562.2 \n",
- "Tc_b = 126.2 \t\t\t\t\t\t# [K]\n",
- "Pc_a = 48.9 \n",
- "Pc_b = 33.9 \t\t\t\t\t\t# [bar]\n",
- "M_a = 78.1 \n",
- "M_b = 28 \t\t\t\t\t\t# [gram/mole]\n",
- "V_a = 259 \n",
- "V_b = 89.8 \t\t\t\t\t\t# [cubic cm/mole]\n",
- "Z_a = 0.271 \n",
- "Z_b = 0.290 \n",
- "sigma_a = 5.349 \n",
- "sigma_b = 3.798 \t\t\t\t\t# [Angstrom]\n",
- "ek_a = 412.3 \n",
- "ek_b = 71.4 \t\t\t\t\t\t# [E/k, K]\n",
- "\n",
- "\n",
- "\t# From equation 2.52 and 2.53\n",
- "Tcm = yi_b*Tc_b+yi_a*Tc_a \t\t\t\t# [K]\n",
- "Pcm = 10**6*R*Tcm*(yi_b*Z_b+yi_a*Z_a)/((yi_b*V_b+yi_a*V_a)*100000) \t # [bar]\n",
- "M_avg = yi_b*M_b+yi_a*M_a \t\t\t\t\t\t# [kg/kmole]\n",
- "\n",
- "#RESULT\n",
- "\n",
- "print\"Average molecular weight is\",round(M_avg,1),\"kg/kmole\" \n",
- "\n",
- "row = P*M_avg/(R*T) \t\t\t\t\t\t\t# [kg/cubic m]\n",
- "\n",
- "#RESULT\n",
- "\n",
- "print\"Density of mixture is\",round(row,2),\"kg/cubic\"\n",
- "\t# From equation 2.50\n",
- "Em = 0.176*(Tcm/(M_avg**3*Pcm**4))**(1.0/6.0) \t\t\t# [uP]**-1\n",
- "\n",
- "\t# From equation 2.51\n",
- "Trm = T/Tcm \n",
- "f_Trm = (0.807*Trm**0.618)-(0.357*math.exp(-0.449*Trm))+(0.340*math.exp(-4.058*Trm))+0.018 \n",
- "\t# From equation 2.49 \n",
- "u = f_Trm/Em \t\t\t\t\t\t\t\t# [uP]\n",
- "u = u*10**-7 \t\t\t\t\t\t\t\t# [viscosity, kg/m.s]\n",
- "print\"Average viscosity of mixture is \",round(u,7),\"kg/m.s\\n\\n\" \n",
- "\n",
- "\t# Calculating diffusivity of benzene using equation 1.49\n",
- "D_ab = 0.0986 \t\t\t\t\t\t\t\t# [square cm/s]\n",
- "Sc = u/(row*D_ab*10**-4) \t\t\t\t\t\t# [Schmidt number]\n",
- "\n",
- "F = 5.086*(row*v*u)**0.5/(M_avg*Sc**(2.0/3.0)) \t\t\t# [kmole/square m.s]\n",
- "\n",
- "\n",
- "#RESULT\n",
- "\n",
- "print\"The required mass transfer coefficient is\",round(F,5),\"kmole/square m.s\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Average molecular weight is 31.5 kg/kmole\n",
- "Density of mixture is 1.28 kg/cubic\n",
- "Average viscosity of mixture is 1.64e-05 kg/m.s\n",
- "\n",
- "\n",
- "The required mass transfer coefficient is 0.00196 kmole/square m.s\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.8,Page number:120"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Illustration 2.8\n",
- "#Benzene Evaporation Along a Vertical Flat Plate\n",
- "\n",
- "import math\n",
- "#Variable declaration\n",
- "\t# a-liquid benzene b-nitrogen\n",
- "T = 300 \t\t\t\t\t\t# [K]\n",
- "l = 3 \t\t\t\t\t\t\t# [length of vertical plate, m]\n",
- "b = 1.5 \t\t\t\t\t\t# [width of vertical plate, m]\n",
- "P = 101.3 \t\t\t\t\t\t# [kPa]\n",
- "v = 5 \t\t\t\t\t\t\t# [velocity across the width of plate, \t\t\t\t\t\t\tm/s]\n",
- "row_a = 0.88 \t\t\t\t\t\t# [gram/cubic cm]\n",
- "\n",
- "\n",
- "y_a1 = 0.139 \t\t\t\t\t\t# [mole fraction of benzene at inner \t\t\t\t\t\t\tedge]\n",
- "y_a2 = 0 \n",
- "\n",
- "\t# The film conditions, and average properties, are identical to those in Example 2.7, \tonly the geometry is different\n",
- "\t# Therefore\n",
- "M_avg = 31.4 \t\t\t\t\t\t# [kg/kmole]\n",
- "row = 1.2 \t\t\t\t\t\t# [kg/cubic m]\n",
- "u = 161*10**-7 \t\t\t\t\t# [kg/m.s]\n",
- "D_ab = 0.0986 \t\t \t\t\t\t# [square cm/s]\n",
- "Sc = 1.3 \t\t\t\t\t\t# [Schmidt Number]\n",
- "Re = row*v*b/u \t\t\t\t\t# [Renoylds Number]\n",
- "\n",
- "if Re > 4000:\n",
- " print\"The flow across the plate is turbulent\\n\" \n",
- "elif Re<2000:\n",
- " print\"The flow across the plate is laminar\\n\" \n",
- "\t#Using equation 2.57\n",
- "Sh_l = 0.036*Re**0.8*Sc**(1.0/3.0) \n",
- "\n",
- "\t# Nitrogen (component B) does not react with benzene (component A), neither dissolves in \t\tthe liquid therefore, NB = 0 and siA = 1. The F-form of the mass-transfer coefficient \t\t\tshould be used \n",
- "F = Sh_l*1.26*D_ab*10**-4/(M_avg*b) \t\t\t# [kmole/square m.s]\n",
- "N_a = F*math.log((1-y_a2)/(1-y_a1)) \t\t\t# [kmole/square m.s]\n",
- "\n",
- "\t# The total mass rate of evaporation over the surface of the plate\n",
- "S = 1.5*3 \t\t\t\t\t\t# [square m]\n",
- "M_a = 78.1 \t\t\t\t\t\t# [gram/mole]\n",
- "wa = N_a*S*M_a*60*1000 \t\t\t\t# [gram/min]\n",
- "\n",
- "V = wa/row_a \t\t\t\t\t\t# [volumetric flow rate, ml/min]\n",
- "\n",
- "print\"Liquid benzene should be supplied at the top of the plate at the rate \",round(V),\"ml/min\\nso that evaporation will just prevent it from reaching the bottom of the plate.\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The flow across the plate is turbulent\n",
- "\n",
- "Liquid benzene should be supplied at the top of the plate at the rate 1473.0 ml/min\n",
- "so that evaporation will just prevent it from reaching the bottom of the plate.\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.9,Page number:123"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Illustration 2.9\n",
- "#Evaporation of a Drop of Water Falling in Air\n",
- "\n",
- "#Variable declaration\n",
- "\t# a-water b-air\n",
- "dp1 = 10**-3 \t\t\t\t\t# [diameter of spherical drop of water, m]\n",
- "Tair = 323 \t\t\t\t\t# [K]\n",
- "P = 101.3 \t\t\t\t\t# [kPa]\n",
- "Twater = 293 \t\t\t\t\t# [K]\n",
- "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
- "M_a = 18.0 \t\t\t\t\t# [gram/mole]\n",
- "M_b = 29.0 \t\t\t\t\t# [gram/mole]\n",
- "import math\n",
- "\n",
- "\n",
- "#Calculation\n",
- "\n",
- "dp2 = (1.0/2.0)**(1.0/3.0)*dp1 \t\t# [m]\n",
- "dp = (dp1+dp2)/2 \t\t\t\t# [m]\n",
- "\n",
- "row_p = 995 \t\t\t\t\t# [density of water, kg/cubic m]\n",
- "row1b = 1.094 \t\t\t\t\t# [density of air, kg/cubic m]\n",
- "u = 1.95*10**-5 \t\t\t\t# [kg/m.s]\n",
- "row_pr = row_p-row1b \t\t\t\t# [kg/cubic m]\n",
- "g = 9.8 \t\t\t\t\t# [accleration due to gravity, square m/s]\n",
- "\t# Combining equation 2.68 and 2.69\n",
- "Ga = 4*dp**3*row1b*row_pr*g/(3*u**2) \t\t# [Galileo Number]\n",
- "\n",
- "\t# Relationship between Re and Cd\n",
- "\t# Re/Cd = Re**3/Ga = 3*row**2*vt**3/(4*g*u*row_pr)\n",
- "\n",
- "\t# The following correlation is used to relate Re/Cd, to Ga\n",
- "\t# ln(Re/Cd)**(1/3) = -3.194 + 2.153*ln(Ga)**(1/3) - 0.238*(ln(Ga)**(1/3))**2 + \t0.01068*(ln(Ga)**(1/3))**3\n",
- "\t# Therefore let A = (Re/Cd)\n",
- "A = math.exp(-3.194 + 2.153*math.log(Ga**(1.0/3.0)) - 0.238*(math.log(Ga**(1.0/3.0)))**2 + 0.01068*(math.log(Ga**(1.0/3.0)))**3) \n",
- "\n",
- "\t# Therefore 'vt' will be\n",
- "vt = A*(4*g*row_pr*u/(3*row1b**2))**(1.0/3.0) \t# [Terminal velocity of particle, m/s]\n",
- "\n",
- "#Result\n",
- "\n",
- "print\"Terminal velocity of particle is\",round(vt,2),\"m/s\" \n",
- "\n",
- "\n",
- "#Calculation\n",
- "\n",
- "P_w = 2.34 \t\t\t\t\t# [vapor pressure of water, kPa]\n",
- "y_w = P_w/P \t\t\t\t\t# [mole fraction of water at the inner edge of \t\t\t\t\t\tthe gas film]\n",
- "M_avg = 18*y_w+29*(1-y_w) \t\t\t# [gram/mole]\n",
- "\n",
- "row2b = P*M_avg/(R*Twater) \t\t\t# [kg/cubic.m]\n",
- "delta_row = row2b - row1b \t\t\t# [kg/cubic.m]\n",
- "\n",
- "Tavg = (Tair+Twater)/2 \t\t\t# [K]\n",
- "\t\t# At Temperature equal to Tavg density and viscosity are\n",
- "row3 = 1.14 \t\t\t\t\t# [kg/cubic.m]\n",
- "u1 = 1.92*10**-5 \t\t\t\t# [kg/m.s]\n",
- "\n",
- "Grd = g*row3*delta_row*(dp**3)/(u1**2) \n",
- "\n",
- "\t\t# Diffusivity of water at Tavg and 1 atm is\n",
- "D_ab = 0.242*10**-4 \t\t\t\t# [square m/s]\n",
- "Sc = u1/(row3*D_ab) \t\t\t\t# [Schmidt Number]\n",
- "Re = dp*row3*vt/u1 \t\t\t\t# [Renoylds Number]\n",
- "\t\n",
- "\t# From equation 2.65 Re is greater than 0.4*Grd**0.5*Sc**(-1/6)\n",
- "\t# Therfore equation 2.64 can be used to calculate mass transfer coefficient\n",
- "\n",
- "Sh = 2+0.552*(Re**0.5)*Sc**(1.0/3.0) \t\t# [Sherwood Number]\n",
- "\t# From Table 2.1\n",
- "\t# Sh = kc*P_bm*dp/(P*D_ab), since P_bm is almost equal to P\n",
- "\t# Therefore \n",
- "\t# Sh = kc*dp/D_ab \n",
- "kc = Sh*D_ab/dp \t\t\t\t# [m/s]\n",
- "\n",
- "ca2 = 0 \t\t\t\t\t# [dry air concentration]\n",
- "ca1 = P_w/(R*Twater) \t\t\t\t# [interface concentration, kmole/cubic.m]\n",
- "\t# Average rate of evaporation \n",
- "wa = math.pi*dp**2*M_a*kc*(ca1-ca2)*1000 \t# [g/s]\n",
- "\n",
- "\t# Amount of water evaporated\n",
- "m = row_p*math.pi*dp1**3/12*1000 \t\t# [g]\n",
- "\t# Time necessary to reduce the volume by 50%\n",
- "t = m/wa \t\t\t\t\t# [s]\n",
- "\n",
- "D = t*vt \t\t\t\t\t# [distance of fall, m]\n",
- "\n",
- "#Result\n",
- "\n",
- "print\"The distance of fall is\",round(D),\"m\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Terminal velocity of particle is 3.59 m/s\n",
- "The distance of fall is 90.0 m\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.10,Page number:127"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Illustration 2.10\n",
- "#Mass Transfer for a Single Cylinder\n",
- "\n",
- "#Variable declaratiopn\n",
- "\n",
- "\t# Example 2.6 using equation 2.73\n",
- "\t# Values of the dimensionless parameters calculated in Example 2.6\n",
- "Re = 1223 \t\t\t\t# [Renoylds Number]\n",
- "Sc = 0.905 \t\t\t\t# [Schmidt Number]\n",
- "c = 0.039 \t\t\t\t# [molar density, kg/cubic m]\n",
- "v = 1 \t\t\t\t\t# [gas velocity, m/s]\n",
- "\t# Therefore \n",
- "#Calculations\n",
- "\n",
- "Gm = c*v \t\t\t\t# [kmole/square m.s]\n",
- "\t# From equation 2.9 \n",
- "\t# Kg*P = ky\n",
- "\t# Therefore substituting in equation 2.73 we obtain\n",
- "ky = 0.281*Gm/(Re**0.4*Sc**0.56) \t# [kmole/square m.s]\n",
- "\t# Now equation 2.73 were obtained under very dilute concentrations\n",
- "\t# Therefore\n",
- "y_bm = 1 \n",
- "\t# From equation 2.6\n",
- "F = ky*y_bm \t\t\t\t# [kmole/square m.s]\n",
- "\n",
- "#Result\n",
- "\n",
- "print\"Mass transfer coefficient is \",round(F,6),\"kmol/m.^2-s\" \n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Mass transfer coefficient is 0.000675 kmol/m.^2-s\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.11,Page number:129"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Illustration 2.11\n",
- "#Simultaneous Heat and Mass Transfer in Pipe\n",
- "\n",
- "#Variable declaration\n",
- "\n",
- "# a-water b-air\n",
- "D = 25.4*10**-3 \t\t\t\t# [diameter of wetted wall tower, m]\n",
- "Gy = 10 \t\t\t\t\t# [mass velocity, kg/square m.s]\n",
- "T1 = 308 \t\t\t\t\t# [K]\n",
- "P = 101.3 \t\t\t\t\t# [kPa]\n",
- "p_a1 = 1.95 \t\t\t\t\t# [partial pressure of water vapor, kPa]\n",
- "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
- "M_a = 18 \t\t\t\t\t# [gram/mole]\n",
- "Cpa = 1.88 \t\t\t\t\t# [kJ/kg.K]\n",
- "\n",
- "\n",
- "# Properties of dry air at 308 K and 1 atm pressure are\n",
- "u = 1.92*10**-5 \t\t\t\t# [kg/m.s]\n",
- "row = 1.14 \t\t\t\t\t# [kg/cubic m]\n",
- "D_ab = 0.242*10**-4 \t\t\t\t# [square m/s]\n",
- "Sc = 0.696 \t\t\t\t\t# [Schmidt number]\n",
- "Cp = 1.007 \t\t\t\t\t# [kJ/kg.K]\n",
- "k = 0.027 \t\t\t\t\t# [W/m.K]\n",
- "Pr = 0.7 \t\t\t\t\t# [Prandtl number]\n",
- "\n",
- "\n",
- "#Calculations\n",
- "\n",
- "import math\n",
- "from scipy.optimize import fsolve\n",
- "from numpy import *\n",
- "\n",
- "Re = D*Gy/u \t\t\t\t\t# [Renoylds number]\n",
- "# From equation 2,74\n",
- "Sh = 0.023*Re**0.83*Sc**0.44 \t\t\t#[Sherwood number]\n",
- "# From Table 2.1\n",
- "kg = Sh*D_ab/(R*T1*D)*1000 \t\t\t# [mole/square m.s.kPa]\n",
- "\n",
- "# To estimate the heat-transfer coefficient, we use the Dittus-Boelter equation for cooling, equation 2.80\n",
- "Nu = 0.023*Re**0.8*Pr**0.3 \t\t\t# [Nusselt number]\n",
- "# From Table 2.1\n",
- "h = Nu*k/D \t\t\t\t\t# [W/square m.K]\n",
- "\n",
- "T =373.15 \t\t\t\t\t# [K]\n",
- "lambda_a = 40.63 \t\t\t\t# [kJ/mole]\n",
- "Tc = 647.1 \t\t\t\t\t# [K]\n",
- "\n",
- "# Solution of simultaneous equation 2.78 and 2.79\n",
- "def F(e): \n",
- " f1=kg*(p_a1 - math.exp(16.3872-(3885.7/(e[0]-42.98))))-e[1] \n",
- " f2=e[1]*M_a*Cpa*(T1-e[0])/(1-exp(-e[1]*M_a*Cpa/h)) + 1000*e[1]*lambda_a*((1-(e[0]/Tc))/(1-(T/Tc)))**0.38 \n",
- " return(f1,f2) \n",
- "\n",
- "\n",
- "# Initial guess\n",
- "e = [292,-0.003] \n",
- "y = fsolve(F,e) \n",
- "Ti = y[0] \n",
- "Na = y[1] \n",
- "\n",
- "print\"The temperature of the liquid water and the rate of water evaporation is\",round(Ti),\"K and\",round(Na,3),\" mole/square m.s respectively\""
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The temperature of the liquid water and the rate of water evaporation is 295.0 K and -0.013 mole/square m.s respectively\n"
- ]
- }
- ],
- "prompt_number": 17
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.12,Page number:131"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Illustration 2.12\n",
- "#Air Humidification in Wetted- Wall Column \n",
- "\n",
- "\n",
- "#Variable declaration\n",
- "\t# a-water b-dry air\n",
- "D = 25.4*10**-3 \t\t\t# [Internal diameter of tower, m]\n",
- "Z = 1.5 \t\t\t\t# [length of the wetted section, m]\n",
- "Gy = 10 \t\t\t\t# [mass velocity of air, kg/square m.s]\n",
- "Tair = 308 \t\t\t\t# [K]\n",
- "Twater = 295 \t\t\t\t# [K]\n",
- "P = 101.3 \t\t\t\t# [kPa]\n",
- "M_a = 18.0 \t\t\t\t# [gram/mole]\n",
- "M_b = 29.0 \t\t\t\t# [gram/mole]\n",
- "R = 8.314 \t\t\t\t# [cubic m.Pa/mole.K]\n",
- "\n",
- "#Calculations\n",
- "\n",
- "import math\n",
- "\n",
- "Pa = 2.64 # [kPa]\n",
- "\n",
- "Gm = Gy/M_b \t# [Assuming that gas phase is basically dry air, kmole/square m.s]\n",
- "\t\t# The properties of dry air at 308 K and 1 atm are (from example 2.9)\n",
- "row = 1.14 \t\t\t\t# [kg/cubic m]\n",
- "u = 1.92*10**-5 \t\t\t# [kg/m.s]\n",
- "D_ab = 0.242*10**-4 \t\t\t# [square m/s]\n",
- "Sc = 0.692 \t\t\t\t# [Schmidt number]\n",
- "\n",
- "Re = Gy*D/u \t\t\t\t# [Renoylds number]\n",
- "\n",
- "if Re<35000 and Re>2000:\n",
- " Sh = 0.023*Re**0.83*Sc**0.44 \t# [Sherwood number] \n",
- " print\"Sherwood number is\",round(Sh,1) \n",
- "else:\n",
- " print\"We cannot use equation 2.74\"\n",
- "\n",
- "c = P/(R*Tair) \t\t\t# [kmole/cubic m]\n",
- "\t# Now using equation 2.89\n",
- "Pa_out = Pa*(1-math.exp((-4*Sh*Z*c*D_ab)/(Gm*D**2))) \t\t# [kPa]\n",
- "\n",
- "#Result\n",
- "print\"The partial pressure of water in the air leaving the tower is\",round(Pa_out,2),\"kPa\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Sherwood number is 51.6\n",
- "The partial pressure of water in the air leaving the tower is 1.94 kPa\n"
- ]
- }
- ],
- "prompt_number": 18
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.13,Page number:134"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Illustration 2.13\n",
- "# Air Humidification in a Packed Bed\n",
- "\n",
- "#Variable declaration\n",
- "\t# a-water b-dry air\n",
- "Gy = 10.0 \t\t\t\t# [kg/square m.s]\n",
- "dp = 3.5*10**-3 \t\t\t# [diameter of spherical glass beads, m]\n",
- "D = 25.4*10**-3 \t\t\t# [Internal diameter of tower, m]\n",
- "Tair = 308 \t\t\t\t# [K]\n",
- "Twater = 295 \t\t\t\t# [K]\n",
- "P = 101.3 \t\t\t\t# [kPa]\n",
- "M_a = 18 \t\t\t\t# [gram/mole]\n",
- "M_b = 29 \t\t\t\t# [gram/mole]\n",
- "R = 8.314 \t\t\t\t# [cubic m.Pa/mole.K]\n",
- "\n",
- "#Calculation\n",
- "\n",
- "import math\n",
- "from scipy.optimize import fsolve\n",
- "\t# The properties of dry air at 308 K and 1 atm are (from example 2.12)\n",
- "row = 1.14 \t\t\t\t# [kg/cubic m]\n",
- "u = 1.92*10**-5 \t\t\t# [kg/m.s]\n",
- "D_ab = 0.242*10**-4 \t\t\t# [square m/s]\n",
- "Sc = 0.692 \t\t\t\t# [Schmidt number]\n",
- "c = 0.04 \t \t\t\t# [mole/cubic m]\n",
- "Gm = 0.345 \t\t\t\t# [kmole/square m.s]\n",
- "\n",
- "Re = Gy*dp/u \t\t\t\t# [Renoylds number]\n",
- "if Re<2500 and Re>10:\n",
- " \t\t\t\t\t# Subsituting in equation 2.90\n",
- " jd = 1.17*Re**-0.415 \n",
- " print\"Renoylds number is \",Re\n",
- "else:\n",
- " print \" \"\n",
- "Std = 0.052/(Sc**(2.0/3.0)) \n",
- "\t\t# From Table 2.1 \n",
- "Sh = Std*Re*Sc \t\t\t# [Sherwood number]\n",
- "\t\t# From equation 2.94\n",
- "e = 0.406+0.571*(dp/D) \t\t# [bed porosity]\n",
- "e=round(e,3)\n",
- "\t#Illustration 2.13(a) \n",
- "\t# Solution(a)\n",
- "\t# Now Paout = 0.99*Pa\n",
- "\t# Using equation 2.93 to calculate 'Z'\n",
- "def f12(Z):\n",
- " return(0.99 - 1 + math.exp(-6*(1-e)*Sh*c*Z*D_ab/(Gm*dp**2))) \n",
- "Z = fsolve(f12,0.06) \n",
- "\n",
- "#Result\n",
- "Z=round(Z[0],3)\n",
- "print\"The depth of packing required is\",Z,\"m=\",Z*100,\"cm\" \n",
- "\n",
- "\t#Illustration 2.13(b)\n",
- "\t# Solution(b)\n",
- "\t# From equation 2.95\n",
- "deltaP = (150*(1-e)/Re + 1.75)*((1-e)*(Gy**2)*Z)/(dp*row*e**3) \t# [Pa]\n",
- "\n",
- "#Result\n",
- "print\"The gas pressure drop through the bed is\",round(deltaP),\"Pa (Approx) \\nDUE TO LACK OF PRECISION IN CALCULATION IN BOOK.\\niF DONE MANUALLY,THIS ANSWER STANDS CORRECT\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Renoylds number is 1822.91666667\n",
- "The depth of packing required is 0.078 m= 7.8 cm\n",
- "The gas pressure drop through the bed is 15817.0 Pa (Approx) \n",
- "DUE TO LACK OF PRECISION IN CALCULATION IN BOOK.\n",
- "iF DONE MANUALLY,THIS ANSWER STANDS CORRECT\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.14,Page number:138"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Illustration 2.14\n",
- "#Design of a Hollow-Fiber Boiler Feed Water Deaerator\n",
- "\n",
- "#Variable declaration\n",
- "\t# a-oxygen b-water\n",
- "\t# To design the deaerator, We will use commercially available microporous polypropylene \thollow fibers in a module\n",
- "\n",
- "m = 40000.0 \t\t\t\t\t# [kg/hr]\n",
- "Twater = 298 \t\t\t\t\t# [K]\n",
- "v = 0.1 \t\t\t\t\t# [superficial velocity, m/s]\n",
- "P = 101.3 \t\t\t\t\t# [kPa]\n",
- "V = 40*10**-3 \t\t\t\t\t# [Flow rate of nitrogen, cubic m/min]\n",
- "d = 2.90*10**-4 \t\t\t\t# [Outside diameter of fibres, m]\n",
- "pf = 0.4 \t\t\t\t\t# [Packing factor]\n",
- "a = 46.84*100 \t\t\t\t\t# [surface area per unit volume, m**-1]\n",
- "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
- "\n",
- "#Calculation\n",
- "\n",
- "import math\n",
- "\n",
- "dw = 1000 \t\t\t\t\t# [density of water, kg/cubic m]\n",
- "Ql = m/(3600*1000) \t\t\t\t# [volumetric water flow rate, cubic m/s]\n",
- "\t# Shell diameter\n",
- "D = (4*Ql/(math.pi*v))**0.5 \t\t\t# [Shell diameter, m]\n",
- "\n",
- "\t# the properties of dilute mixtures of oxygen in water at 298 K\n",
- "u = 0.9 \t\t\t\t\t# [cP]\n",
- "\t# Diffusivity from equation 1.53\n",
- "D_ab = 1.93*10**-9 \t\t\t\t# [square m/s]\n",
- "Sc = 467 \t\t\t\t\t# [Schmidt number]\n",
- "\n",
- "Re = d*v*dw/(u*10**-3) \t\t\t# [Renoylds number]\n",
- "\n",
- "\t# Substituting in equation (2-97) gives\n",
- "Sh = 0.53*(1-1.1*pf)*((1-pf)/pf)**-0.47*(Re**0.53*Sc**0.33) \n",
- "\n",
- "kl = Sh*D_ab/d \t\t\t\t# [mass-transfer coefficient on the shell side, \t\t\t\t\t\tm/s]\n",
- "\n",
- "\t# From the specified BFW flow rate\n",
- "L = m/(3600*18) \t\t\t\t# [kmole/s]\n",
- "\t# From ideal gas law\n",
- "V1 = V*P/(Twater*R*60) \t\t\t# [kmole/s]\n",
- "\t# From the solubility of oxygen in water at 298 K,\n",
- "M = 4.5*10**4 \n",
- "A = L/(M*V1) \t\t\t\t\t# [Absorption factor]\n",
- "\n",
- "#Result\n",
- "\n",
- "print\"Absorption factor is\",round(A,3) \n",
- "\n",
- "#Calculation\n",
- "\n",
- "\t# For 99% removal of the dissolved oxygen\n",
- "\t# x_in/x_out = b = 100\n",
- "b = 100 \n",
- "c = 55.5 \t\t\t\t\t# [molar density, kmole/cubic m]\n",
- "\t# Substituting in equation 2.99 yields\n",
- "V_T = (L*math.log(b*(1-A)+A))/(kl*a*c*(1-A)) \t # [cubic m]\n",
- "\n",
- "\t# The module length, Z is\n",
- "Z = V_T/(math.pi*D**2.0/4.0) \n",
- "\n",
- "#Result\n",
- "print\"The shell diameter and module length is\",round(D,3),\"m and\",round(Z,2),\" m respectively\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Absorption factor is 0.503\n",
- "The shell diameter and module length is 0.376 m and 2.15 m respectively\n"
- ]
- }
- ],
- "prompt_number": 20
- },
- {
- "cell_type": "heading",
- "level": 3,
- "metadata": {},
- "source": [
- "Example 2.15,Page number:140"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Example 2.15\n",
- "\n",
- "#Variable declaration\n",
- "d=2.21/100\t\t\t#[m]\n",
- "mu=8.82*10**-6\t\t#[kg/m-s]\n",
- "rho=2.81\t\t#[kg/m**3]\n",
- "\n",
- "c=34.14\t\t\t#[mol/m**3]\n",
- "D=array([2.228/(10**6),2.065/(10**6),1.832/(10**6)]) #Velocities in [m**2/s]\n",
- "\n",
- "\n",
- "#Calculation\n",
- "#Gy=rho*v\t\t\n",
- "#Re=Gy*d/mu\t\t#Reynolds number\n",
- "Re=21750\n",
- "print \"Reynolds number=\",Re\n",
- "Sc=[]\n",
- "Sh=[]\n",
- "F=[]\n",
- "for i in range(0, 3):\n",
- " sc=mu/(rho*D[i]) #Schmidt number\n",
- " Sc.append(sc)\n",
- " sh=0.023*Re**(0.83)*sc**(0.44) #Sherwood number\n",
- " Sh.append(sh)\n",
- " f=sh*c*D[i]/d #Binary mass transfer coefficient in [mol/m^2-s]\n",
- " F.append(f)\n",
- "print \"Schmidt number are:\"\n",
- "for i in range(0,3):\n",
- " print round(Sc[i],3)\n",
- "print \"Sherwood number number are:\"\n",
- "for i in range(0,3):\n",
- " print round(Sh[i],1)\n",
- "print\"Binary mass transfer coefficients are:\"\n",
- "for i in range(0,3):\n",
- " print round(F[i],3)\n",
- "#After modifying mathcad program of example 1.17,we have\n",
- "N1=-0.0527 #[mol/m^2-s]\n",
- "N2=0.0395 #[mol/m^2-s]\n",
- "N3=0.0132 #[mol/m^2-s]\n",
- "print\"The program yields the following results:\"\n",
- "print \"N1=\",N1,\"mol/m**2-s\"\n",
- "print \"N2=\",N2,\"mol/m**2-s\"\n",
- "print \"N3=\",N3,\"mol/m**2-s\"\n",
- " "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Reynolds number= 21750\n",
- "Schmidt number are:\n",
- "1.409\n",
- "1.52\n",
- "1.713\n",
- "Sherwood number number are:\n",
- "106.5\n",
- "110.1\n",
- "116.1\n",
- "Binary mass transfer coefficients are:\n",
- "0.367\n",
- "0.351\n",
- "0.328\n",
- "The program yields the following results:\n",
- "N1= -0.0527 mol/m**2-s\n",
- "N2= 0.0395 mol/m**2-s\n",
- "N3= 0.0132 mol/m**2-s\n"
- ]
- }
- ],
- "prompt_number": 36
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:1bdbe534af4c41744d0b20620d61031047f924bf7d6e0c91a540c9ad26997cbe"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2:. Convective Mass Transfer"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.1,Page number94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "\t# a-oxygen b-stagnant water\n",
+ "T = 310 \t\t\t\t\t# [K]\n",
+ "\t# Since the solubility of oxygen in water at 310 K is extremely low, we are dealing with \tdilute solutions\n",
+ "k_L = 3.3*10**-5 \t\t\t\t# [coefficient based on the oxygen concentration \t\t\t\t\t\tdifference in the water, m/s]\n",
+ "row = 993 \t\t\t\t\t# [kg/cubic m]\n",
+ "M_b = 18 \t\t\t\t\t# [gram/mole]\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ " \n",
+ "\t# Since we are dealing with very dilute solutions\n",
+ "\t# Therefore, c = (row/M_avg) = row/M_b\n",
+ "c = row/M_b \t\t\t\t\t# [kmole/cubic m]\n",
+ "\t# Using equation 2.10\n",
+ "k_x = k_L*c \t\t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"The mass-transfer coefficient based on the mole fraction of oxygen in the liquid is\",round(k_x,5),\" kmole/square m.s\" \n",
+ "\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The mass-transfer coefficient based on the mole fraction of oxygen in the liquid is 0.00182 kmole/square m.s\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.2,Page number:95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "\n",
+ "\t# a-ammonia b-air\n",
+ "T = 300 \t\t\t\t\t# [K]\n",
+ "P = 1 \t\t\t\t\t\t# [atm]\n",
+ "y_a1 = 0.8 \t\t\t\t\t# [ammonia mole fraction in the bulk of the gas \t\t\t\t\t\t\tphase]\n",
+ "y_a2 = 0.732 \t\t\t\t\t# [ammonia gas-phase mole fraction on interface]\n",
+ "N_a = 4.3*10**-4 \t\t\t\t# [ammonia flux, kmole/square m.s]\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "import math\n",
+ "\t# Using equation 2.2\n",
+ "F_g = N_a/math.log10((1-y_a2)/(1-y_a1)) \t\t# [kmole/square m.s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"The mass-transfer coefficient in the gas phase at that point where flux is 4.3*10**-4 is\",round(F_g,5),\" kmole/square m.s\"\n",
+ "print\"\\n\\nNOTE:Calculation mistake in book:\\nAnswer written as 1.47*10^-4,Actually,,...it is 1.47*10^-3.Please REDO last calculation manually to check\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The mass-transfer coefficient in the gas phase at that point where flux is 4.3*10**-4 is 0.00338 kmole/square m.s\n",
+ "\n",
+ "\n",
+ "NOTE:Calculation mistake in book:\n",
+ "Answer written as 1.47*10^-4,Actually,,...it is 1.47*10^-3.Please REDO last calculation manually to check\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.3,Page number:96"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "\n",
+ "\t\t# a-methanol b-water\n",
+ "P = 101.3 \t\t\t\t\t\t# [kPa]\n",
+ "y_a1 = 0.707 \t\t\t\t\t\t# [mole fraction at interface]\n",
+ "y_a2 = 0.656 \t\t\t\t\t\t# [mole fraction at bulk of the gas]\n",
+ "k_g = 1.62*10**-5 \t\t\t\t\t# [mass-transfer coefficient at a point \t\t\t\t\t\t\t in the column, kmole/square m.s.kPa]\n",
+ "#Calculations\n",
+ "\n",
+ "\t# Using equation 2.14\n",
+ "k_y = k_g*P \t\t\t\t\t\t# [kmole/square m.s]\n",
+ "\t# Using equation 2.12\n",
+ "N_a = k_y*(y_a1-y_a2) \t\t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"The methanol flux at the point of given mass transfer coefficient is\",round(N_a,7),\"kmole/square m.s\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The methanol flux at the point of given mass transfer coefficient is 8.37e-05 kmole/square m.s\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.4,Page number:99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "n = 6 # [number of variables]\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "from scipy.optimize import fsolve\n",
+ "from numpy import *\n",
+ "import math\n",
+ "# To determine the number of dimensionless parameters to be formed, we must know the rank, r, of the dimensional matrix.\n",
+ "# The dimensional matrix is \n",
+ "DM =matrix([[0,0,1,1,0,0],[1,1,-3,-1,2,1],[-1,-1,0,0,-1,-1]]) \n",
+ "rk= linalg.matrix_rank(DM)\n",
+ "print\"Rank of matrix is \",rk \n",
+ "\n",
+ "#The numbers in the table represent the exponent of M, L, and t in the dimensional expression of each of the six variables involved. For example, the dimensional expression of p is M/Lt hence the exponents are 1, -1, and -1\n",
+ "\n",
+ "# From equation 2.16\n",
+ "i = n-rk # [number of dimensional groups]\n",
+ "# Let the dimensional groups are pi1, pi2 and pi3\n",
+ "# Therefore pi1 = (D_AB)**a*(row)**b*(D)**c*kc\n",
+ "# pi2 = (D_AB)**d*(row)**e*(D)**f*v\n",
+ "# pi3 = (D_AB)**g*(row)**h*(D)**i*u\n",
+ "\n",
+ "# Solving for pi1\n",
+ "# M**0*L**0*t**0 = 1 = (L**2/t)**a*(M/L**3)**b*(L)**c*(L/t)\n",
+ "\n",
+ "# Solution of simultaneous equation\n",
+ "def F(e):\n",
+ " f1 = 2*e[0]-3*e[1]+e[2]+1 \n",
+ " f2 = -e[0]-1 \n",
+ " f3 = -e[1] \n",
+ " return(f1,f2,f3)\n",
+ "\n",
+ "\n",
+ "# Initial guess:\n",
+ "e = [0.1,0.8,0.5] \n",
+ "y = fsolve(F,e) \n",
+ "a = y[0] \n",
+ "b = y[1] \n",
+ "c = y[2] \n",
+ "print\"The coefficients of pi1 are\",a,round(b),c \n",
+ "# Similarly the coefficients of pi2 and pi3 are calculated\n",
+ "# Therefore we get pi1 = kc*D/D_AB = Sh i.e. Sherwood Number\n",
+ "# pi2 = v*D/D_AB = P_ed i.e. Peclet Number\n",
+ "# pi3 = u/(row*D_AB) = Sc i.e. Schmidt Number\n",
+ "\n",
+ "# Dividing pi2 by pi3 gives\n",
+ "# pi2/pi3 = D*v*row/u = Re i.e. Renoylds number\n",
+ "\n",
+ "print\"The result of the dimensional analysis of forced-convection mass transfer in a circular conduit indicates that a correlating relation could be of the form\\n Sh = function(Re,Sc)\\n which is analogous to the heat transfer correlation \\n Nu = function(Re,Pr)\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rank of matrix is 3\n",
+ "The coefficients of pi1 are -1.0 0.0 1.0\n",
+ "The result of the dimensional analysis of forced-convection mass transfer in a circular conduit indicates that a correlating relation could be of the form\n",
+ " Sh = function(Re,Sc)\n",
+ " which is analogous to the heat transfer correlation \n",
+ " Nu = function(Re,Pr)\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.6,Page number:111"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "\t# a-UF6 b-air\n",
+ "M_a = 352 \t\t\t\t\t# [molecular weight of UF6, gram/mole]\n",
+ "M_b = 29 \t\t\t\t\t# [gram/mole]\n",
+ "d = 0.01 \t\t\t\t\t# [diameter, m]\n",
+ "x = 0.1 \t\t\t\t\t# [length exposed to air stream, m]\n",
+ "v = 1 \t\t\t\t\t\t# [m/s]\n",
+ "Ts = 303 \t\t\t\t\t# [surface temperature of solid, K]\n",
+ "P_a = 27 \t\t\t\t\t# [vapor pressure of UF6, kPa]\n",
+ "Tb = 325 \t\t\t\t\t# [bulk temperature of solid ,K]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "import math\n",
+ "\n",
+ "y_a1 = P_a/P \t\t\t\t\t# [mole fraction at point 1]\n",
+ "y_a2 = 0 \t\t\t\t\t# [mole fraction at point 2]\n",
+ "\n",
+ "\t# Along the mass-transfer path-cylinder surface (point 1) to bulk air (point 2)\n",
+ "Tavg = (Ts+Tb)/2 \t\t\t\t# [K]\n",
+ "\n",
+ "\t# At point 1, the gas is saturated with UF6 vapor, while at point 2 the gas is virtually \tfree of UF6\n",
+ "\t# Therefore\n",
+ "Pavg = (P_a+0)/2 \t\t\t\t# [average partial pressure, kPa]\n",
+ "y_a = Pavg/P \t\t\t\t\t# [mole fraction of UF6]\n",
+ "\n",
+ "Mavg = M_a*y_a+M_b*(1-y_a) \t\t\t# [gram/mole]\n",
+ "row_avg = P*Mavg/(R*Tavg) \t\t\t# [kg/cubic m]\n",
+ "\n",
+ "\t# Parameter for c-O2, d-N2 and a-UF6\n",
+ "yi_c = 0.182 \n",
+ "yi_d = 0.685 \n",
+ "yi_a = 0.133 \n",
+ "Tc_c = 154.6 \t\t\t\t# [K]\n",
+ "Tc_d = 126.2 \t\t\t\t\t# [K]\n",
+ "Tc_a = 505.8 \t\t\t\t\t# [K]\n",
+ "Pc_c = 50.4 \t\t\t\t\t# [bar]\n",
+ "Pc_d = 33.9 \t\t\t\t\t# [bar] \n",
+ "Pc_a = 46.6 \t\t\t\t\t# [bar]\n",
+ "M_c = 32 \t\t\t\t# [gram/mole]\n",
+ "M_d = 28 \t\t\t\t\t# [gram/mole] \n",
+ "M_a = 352 \t\t\t\t\t# [gram/mole]\n",
+ "V_c = 73.4 \t\t\t\t# [cubic cm/mole]\n",
+ "V_d = 89.8 \t\t\t\t\t# [cubic cm/mole]\n",
+ "V_a = 250 \t\t\t\t\t# [cubic cm/mole]\n",
+ "Z_c = 0.288 \n",
+ "Z_d = 0.290 \n",
+ "Z_a = 0.277 \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "\n",
+ "\t# From equation 2.52 and 2.53\n",
+ "Tcm = yi_c*Tc_c+yi_d*Tc_d+yi_a*Tc_a \t\t# [K]\n",
+ "Pcm = 10**6*R*Tcm*(yi_c*Z_c+yi_d*Z_d+yi_a*Z_a)/((yi_c*V_c+yi_d*V_d+yi_a*V_a)*100000) \t# [bar]\n",
+ "M_avg = yi_c*M_c+yi_d*M_d+yi_a*M_a \t\t# [gram/mole]\n",
+ "\n",
+ "\t# From equation 2.50\n",
+ "Em = 0.176*(Tcm/(M_avg**3*Pcm**4))**(1.0/6.0) \t# [uP]**-1\n",
+ "\n",
+ "\t# From equation 2.51\n",
+ "Trm = Tavg/Tcm \n",
+ "f_Trm = (0.807*Trm**0.618)-(0.357*math.exp(-0.449*Trm))+(0.340*math.exp(-4.058*Trm))+0.018 \n",
+ "\t# From equation 2.49 \n",
+ "u = f_Trm/Em \t\t\t\t\t\t# [uP]\n",
+ "u = u*10**-7 \t\t\t\t\t\t# [viscosity, kg/m.s]\n",
+ "\n",
+ "Re = d*v*row_avg/u \t\t\t\t\t# [Renoylds number]\n",
+ "\n",
+ "\t\t# Diffusivity of UF6 vapors in air at 314 K and 1 atm from equation 1.49\n",
+ "D_ab = 0.0904 \t\t\t\t\t\t# [square cm/s]\n",
+ "\n",
+ "Sc = u/(row_avg*D_ab*10**-4) \t\t\t\t# [Schmidt number]\n",
+ "\n",
+ "Sh_avg = 0.43 + 0.532*Re**0.5*Sc**0.31 \t\t# [Sherwood number]\n",
+ "\t\t# From equation 1.7\n",
+ "c = P/(R*Tavg) \t\t\t\t\t# [kmole/cubic m]\n",
+ "\t\t# From Table 2.1 \n",
+ "F_av = Sh_avg*D_ab*c*10**-4/d \t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "\t\t# From equation 2.2\n",
+ "N_avg = F_av*math.log((1-y_a2)/(1-y_a1)) \t\t# [kmole/square m.s]\n",
+ "S = 2*math.pi*d**2/4 +math.pi*d*x \t\t\t# [total surface area of the cylinder, \t\t\t\t\t\t\tsquare m]\n",
+ "\n",
+ "w_a = N_avg*S*M_a \t\t\t\t\t# [rate of sublimation of the solid, \t\t\t\t\t\t\tkg/s] \n",
+ "\n",
+ "#Result\n",
+ "print\"Rate of sublimation of a cylinder of UF6 is\",round(w_a,5),\"kg/s\\n\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate of sublimation of a cylinder of UF6 is 0.00023 kg/s\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.7,Page number:116"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "\n",
+ "\t# a-benzene b-nitrogen\n",
+ "T = 300 \t\t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "v =10 \t\t\t\t\t\t# [m/s]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "\n",
+ "\n",
+ "n = -0.5 \n",
+ "\t# Data on the properties of C02 at 300 K and 1 bar\n",
+ "u = 1.5*10**-5 \t\t\t\t# [viscosity, P]\n",
+ "Pr = 0.77 \t\t\t\t\t# [Prandtl number]\n",
+ "Cp = 853 \t\t\t\t\t# [J/kg.K]\n",
+ "\t# Therefore\n",
+ "\t# b = 5.086*l**0.5\n",
+ "\t# j_D = j_H = f(Re) = 5.086*(l**0.5)*Re**-0.5\n",
+ "\t# From Table 2.1\n",
+ "\t# F = j_D*c*v/Sc**(2/3) = 5.086*(l**0.5)*c*v/(Re**0.5*Sc**(2/3)) = \t\t5.086*(row*v*u)**0.5/(Mavg*Sc**(2.0/3.0))\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "\t# Vapor pressure of benzene\n",
+ "P_a = math.exp(15.9008-(2788.51/(T-52.36))) \t# [mm of Hg]\n",
+ "P_a = P_a*101.3/760 \t\t\t\t\t# [kPa]\n",
+ "\n",
+ "\t# Parameter for a-benzene, b-nitrogen \n",
+ "yi_a = 0.07 \n",
+ "yi_b = 0.93 \n",
+ "Tc_a = 562.2 \n",
+ "Tc_b = 126.2 \t\t\t\t\t\t# [K]\n",
+ "Pc_a = 48.9 \n",
+ "Pc_b = 33.9 \t\t\t\t\t\t# [bar]\n",
+ "M_a = 78.1 \n",
+ "M_b = 28 \t\t\t\t\t\t# [gram/mole]\n",
+ "V_a = 259 \n",
+ "V_b = 89.8 \t\t\t\t\t\t# [cubic cm/mole]\n",
+ "Z_a = 0.271 \n",
+ "Z_b = 0.290 \n",
+ "sigma_a = 5.349 \n",
+ "sigma_b = 3.798 \t\t\t\t\t# [Angstrom]\n",
+ "ek_a = 412.3 \n",
+ "ek_b = 71.4 \t\t\t\t\t\t# [E/k, K]\n",
+ "\n",
+ "\n",
+ "\t# From equation 2.52 and 2.53\n",
+ "Tcm = yi_b*Tc_b+yi_a*Tc_a \t\t\t\t# [K]\n",
+ "Pcm = 10**6*R*Tcm*(yi_b*Z_b+yi_a*Z_a)/((yi_b*V_b+yi_a*V_a)*100000) \t # [bar]\n",
+ "M_avg = yi_b*M_b+yi_a*M_a \t\t\t\t\t\t# [kg/kmole]\n",
+ "\n",
+ "#RESULT\n",
+ "\n",
+ "print\"Average molecular weight is\",round(M_avg,1),\"kg/kmole\" \n",
+ "\n",
+ "row = P*M_avg/(R*T) \t\t\t\t\t\t\t# [kg/cubic m]\n",
+ "\n",
+ "#RESULT\n",
+ "\n",
+ "print\"Density of mixture is\",round(row,2),\"kg/cubic\"\n",
+ "\t# From equation 2.50\n",
+ "Em = 0.176*(Tcm/(M_avg**3*Pcm**4))**(1.0/6.0) \t\t\t# [uP]**-1\n",
+ "\n",
+ "\t# From equation 2.51\n",
+ "Trm = T/Tcm \n",
+ "f_Trm = (0.807*Trm**0.618)-(0.357*math.exp(-0.449*Trm))+(0.340*math.exp(-4.058*Trm))+0.018 \n",
+ "\t# From equation 2.49 \n",
+ "u = f_Trm/Em \t\t\t\t\t\t\t\t# [uP]\n",
+ "u = u*10**-7 \t\t\t\t\t\t\t\t# [viscosity, kg/m.s]\n",
+ "print\"Average viscosity of mixture is \",round(u,7),\"kg/m.s\\n\\n\" \n",
+ "\n",
+ "\t# Calculating diffusivity of benzene using equation 1.49\n",
+ "D_ab = 0.0986 \t\t\t\t\t\t\t\t# [square cm/s]\n",
+ "Sc = u/(row*D_ab*10**-4) \t\t\t\t\t\t# [Schmidt number]\n",
+ "\n",
+ "F = 5.086*(row*v*u)**0.5/(M_avg*Sc**(2.0/3.0)) \t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "\n",
+ "#RESULT\n",
+ "\n",
+ "print\"The required mass transfer coefficient is\",round(F,5),\"kmole/square m.s\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Average molecular weight is 31.5 kg/kmole\n",
+ "Density of mixture is 1.28 kg/cubic\n",
+ "Average viscosity of mixture is 1.64e-05 kg/m.s\n",
+ "\n",
+ "\n",
+ "The required mass transfer coefficient is 0.00196 kmole/square m.s\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.8,Page number:120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "\t# a-liquid benzene b-nitrogen\n",
+ "T = 300 \t\t\t\t\t\t# [K]\n",
+ "l = 3 \t\t\t\t\t\t\t# [length of vertical plate, m]\n",
+ "b = 1.5 \t\t\t\t\t\t# [width of vertical plate, m]\n",
+ "P = 101.3 \t\t\t\t\t\t# [kPa]\n",
+ "v = 5 \t\t\t\t\t\t\t# [velocity across the width of plate, \t\t\t\t\t\t\tm/s]\n",
+ "row_a = 0.88 \t\t\t\t\t\t# [gram/cubic cm]\n",
+ "\n",
+ "\n",
+ "y_a1 = 0.139 \t\t\t\t\t\t# [mole fraction of benzene at inner \t\t\t\t\t\t\tedge]\n",
+ "y_a2 = 0 \n",
+ "\n",
+ "\t# The film conditions, and average properties, are identical to those in Example 2.7, \tonly the geometry is different\n",
+ "\t# Therefore\n",
+ "M_avg = 31.4 \t\t\t\t\t\t# [kg/kmole]\n",
+ "row = 1.2 \t\t\t\t\t\t# [kg/cubic m]\n",
+ "u = 161*10**-7 \t\t\t\t\t# [kg/m.s]\n",
+ "D_ab = 0.0986 \t\t \t\t\t\t# [square cm/s]\n",
+ "Sc = 1.3 \t\t\t\t\t\t# [Schmidt Number]\n",
+ "Re = row*v*b/u \t\t\t\t\t# [Renoylds Number]\n",
+ "\n",
+ "if Re > 4000:\n",
+ " print\"The flow across the plate is turbulent\\n\" \n",
+ "elif Re<2000:\n",
+ " print\"The flow across the plate is laminar\\n\" \n",
+ "\t#Using equation 2.57\n",
+ "Sh_l = 0.036*Re**0.8*Sc**(1.0/3.0) \n",
+ "\n",
+ "\t# Nitrogen (component B) does not react with benzene (component A), neither dissolves in \t\tthe liquid therefore, NB = 0 and siA = 1. The F-form of the mass-transfer coefficient \t\t\tshould be used \n",
+ "F = Sh_l*1.26*D_ab*10**-4/(M_avg*b) \t\t\t# [kmole/square m.s]\n",
+ "N_a = F*math.log((1-y_a2)/(1-y_a1)) \t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "\t# The total mass rate of evaporation over the surface of the plate\n",
+ "S = 1.5*3 \t\t\t\t\t\t# [square m]\n",
+ "M_a = 78.1 \t\t\t\t\t\t# [gram/mole]\n",
+ "wa = N_a*S*M_a*60*1000 \t\t\t\t# [gram/min]\n",
+ "\n",
+ "V = wa/row_a \t\t\t\t\t\t# [volumetric flow rate, ml/min]\n",
+ "\n",
+ "print\"Liquid benzene should be supplied at the top of the plate at the rate \",round(V),\"ml/min\\nso that evaporation will just prevent it from reaching the bottom of the plate.\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The flow across the plate is turbulent\n",
+ "\n",
+ "Liquid benzene should be supplied at the top of the plate at the rate 1473.0 ml/min\n",
+ "so that evaporation will just prevent it from reaching the bottom of the plate.\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.9,Page number:123"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "\t# a-water b-air\n",
+ "dp1 = 10**-3 \t\t\t\t\t# [diameter of spherical drop of water, m]\n",
+ "Tair = 323 \t\t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "Twater = 293 \t\t\t\t\t# [K]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "M_a = 18.0 \t\t\t\t\t# [gram/mole]\n",
+ "M_b = 29.0 \t\t\t\t\t# [gram/mole]\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "dp2 = (1.0/2.0)**(1.0/3.0)*dp1 \t\t# [m]\n",
+ "dp = (dp1+dp2)/2 \t\t\t\t# [m]\n",
+ "\n",
+ "row_p = 995 \t\t\t\t\t# [density of water, kg/cubic m]\n",
+ "row1b = 1.094 \t\t\t\t\t# [density of air, kg/cubic m]\n",
+ "u = 1.95*10**-5 \t\t\t\t# [kg/m.s]\n",
+ "row_pr = row_p-row1b \t\t\t\t# [kg/cubic m]\n",
+ "g = 9.8 \t\t\t\t\t# [accleration due to gravity, square m/s]\n",
+ "\t# Combining equation 2.68 and 2.69\n",
+ "Ga = 4*dp**3*row1b*row_pr*g/(3*u**2) \t\t# [Galileo Number]\n",
+ "\n",
+ "\t# Relationship between Re and Cd\n",
+ "\t# Re/Cd = Re**3/Ga = 3*row**2*vt**3/(4*g*u*row_pr)\n",
+ "\n",
+ "\t# The following correlation is used to relate Re/Cd, to Ga\n",
+ "\t# ln(Re/Cd)**(1/3) = -3.194 + 2.153*ln(Ga)**(1/3) - 0.238*(ln(Ga)**(1/3))**2 + \t0.01068*(ln(Ga)**(1/3))**3\n",
+ "\t# Therefore let A = (Re/Cd)\n",
+ "A = math.exp(-3.194 + 2.153*math.log(Ga**(1.0/3.0)) - 0.238*(math.log(Ga**(1.0/3.0)))**2 + 0.01068*(math.log(Ga**(1.0/3.0)))**3) \n",
+ "\n",
+ "\t# Therefore 'vt' will be\n",
+ "vt = A*(4*g*row_pr*u/(3*row1b**2))**(1.0/3.0) \t# [Terminal velocity of particle, m/s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"Terminal velocity of particle is\",round(vt,2),\"m/s\" \n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "P_w = 2.34 \t\t\t\t\t# [vapor pressure of water, kPa]\n",
+ "y_w = P_w/P \t\t\t\t\t# [mole fraction of water at the inner edge of \t\t\t\t\t\tthe gas film]\n",
+ "M_avg = 18*y_w+29*(1-y_w) \t\t\t# [gram/mole]\n",
+ "\n",
+ "row2b = P*M_avg/(R*Twater) \t\t\t# [kg/cubic.m]\n",
+ "delta_row = row2b - row1b \t\t\t# [kg/cubic.m]\n",
+ "\n",
+ "Tavg = (Tair+Twater)/2 \t\t\t# [K]\n",
+ "\t\t# At Temperature equal to Tavg density and viscosity are\n",
+ "row3 = 1.14 \t\t\t\t\t# [kg/cubic.m]\n",
+ "u1 = 1.92*10**-5 \t\t\t\t# [kg/m.s]\n",
+ "\n",
+ "Grd = g*row3*delta_row*(dp**3)/(u1**2) \n",
+ "\n",
+ "\t\t# Diffusivity of water at Tavg and 1 atm is\n",
+ "D_ab = 0.242*10**-4 \t\t\t\t# [square m/s]\n",
+ "Sc = u1/(row3*D_ab) \t\t\t\t# [Schmidt Number]\n",
+ "Re = dp*row3*vt/u1 \t\t\t\t# [Renoylds Number]\n",
+ "\t\n",
+ "\t# From equation 2.65 Re is greater than 0.4*Grd**0.5*Sc**(-1/6)\n",
+ "\t# Therfore equation 2.64 can be used to calculate mass transfer coefficient\n",
+ "\n",
+ "Sh = 2+0.552*(Re**0.5)*Sc**(1.0/3.0) \t\t# [Sherwood Number]\n",
+ "\t# From Table 2.1\n",
+ "\t# Sh = kc*P_bm*dp/(P*D_ab), since P_bm is almost equal to P\n",
+ "\t# Therefore \n",
+ "\t# Sh = kc*dp/D_ab \n",
+ "kc = Sh*D_ab/dp \t\t\t\t# [m/s]\n",
+ "\n",
+ "ca2 = 0 \t\t\t\t\t# [dry air concentration]\n",
+ "ca1 = P_w/(R*Twater) \t\t\t\t# [interface concentration, kmole/cubic.m]\n",
+ "\t# Average rate of evaporation \n",
+ "wa = math.pi*dp**2*M_a*kc*(ca1-ca2)*1000 \t# [g/s]\n",
+ "\n",
+ "\t# Amount of water evaporated\n",
+ "m = row_p*math.pi*dp1**3/12*1000 \t\t# [g]\n",
+ "\t# Time necessary to reduce the volume by 50%\n",
+ "t = m/wa \t\t\t\t\t# [s]\n",
+ "\n",
+ "D = t*vt \t\t\t\t\t# [distance of fall, m]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"The distance of fall is\",round(D),\"m\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Terminal velocity of particle is 3.59 m/s\n",
+ "The distance of fall is 90.0 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.10,Page number:127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaratiopn\n",
+ "\n",
+ "\t# Example 2.6 using equation 2.73\n",
+ "\t# Values of the dimensionless parameters calculated in Example 2.6\n",
+ "Re = 1223 \t\t\t\t# [Renoylds Number]\n",
+ "Sc = 0.905 \t\t\t\t# [Schmidt Number]\n",
+ "c = 0.039 \t\t\t\t# [molar density, kg/cubic m]\n",
+ "v = 1 \t\t\t\t\t# [gas velocity, m/s]\n",
+ "\t# Therefore \n",
+ "#Calculations\n",
+ "\n",
+ "Gm = c*v \t\t\t\t# [kmole/square m.s]\n",
+ "\t# From equation 2.9 \n",
+ "\t# Kg*P = ky\n",
+ "\t# Therefore substituting in equation 2.73 we obtain\n",
+ "ky = 0.281*Gm/(Re**0.4*Sc**0.56) \t# [kmole/square m.s]\n",
+ "\t# Now equation 2.73 were obtained under very dilute concentrations\n",
+ "\t# Therefore\n",
+ "y_bm = 1 \n",
+ "\t# From equation 2.6\n",
+ "F = ky*y_bm \t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"Mass transfer coefficient is \",round(F,6),\"kmol/m.^2-s\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass transfer coefficient is 0.000675 kmol/m.^2-s\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.11,Page number:129"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "\n",
+ "# a-water b-air\n",
+ "D = 25.4*10**-3 \t\t\t\t# [diameter of wetted wall tower, m]\n",
+ "Gy = 10 \t\t\t\t\t# [mass velocity, kg/square m.s]\n",
+ "T1 = 308 \t\t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "p_a1 = 1.95 \t\t\t\t\t# [partial pressure of water vapor, kPa]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "M_a = 18 \t\t\t\t\t# [gram/mole]\n",
+ "Cpa = 1.88 \t\t\t\t\t# [kJ/kg.K]\n",
+ "\n",
+ "\n",
+ "# Properties of dry air at 308 K and 1 atm pressure are\n",
+ "u = 1.92*10**-5 \t\t\t\t# [kg/m.s]\n",
+ "row = 1.14 \t\t\t\t\t# [kg/cubic m]\n",
+ "D_ab = 0.242*10**-4 \t\t\t\t# [square m/s]\n",
+ "Sc = 0.696 \t\t\t\t\t# [Schmidt number]\n",
+ "Cp = 1.007 \t\t\t\t\t# [kJ/kg.K]\n",
+ "k = 0.027 \t\t\t\t\t# [W/m.K]\n",
+ "Pr = 0.7 \t\t\t\t\t# [Prandtl number]\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "import math\n",
+ "from scipy.optimize import fsolve\n",
+ "from numpy import *\n",
+ "\n",
+ "Re = D*Gy/u \t\t\t\t\t# [Renoylds number]\n",
+ "# From equation 2,74\n",
+ "Sh = 0.023*Re**0.83*Sc**0.44 \t\t\t#[Sherwood number]\n",
+ "# From Table 2.1\n",
+ "kg = Sh*D_ab/(R*T1*D)*1000 \t\t\t# [mole/square m.s.kPa]\n",
+ "\n",
+ "# To estimate the heat-transfer coefficient, we use the Dittus-Boelter equation for cooling, equation 2.80\n",
+ "Nu = 0.023*Re**0.8*Pr**0.3 \t\t\t# [Nusselt number]\n",
+ "# From Table 2.1\n",
+ "h = Nu*k/D \t\t\t\t\t# [W/square m.K]\n",
+ "\n",
+ "T =373.15 \t\t\t\t\t# [K]\n",
+ "lambda_a = 40.63 \t\t\t\t# [kJ/mole]\n",
+ "Tc = 647.1 \t\t\t\t\t# [K]\n",
+ "\n",
+ "# Solution of simultaneous equation 2.78 and 2.79\n",
+ "def F(e): \n",
+ " f1=kg*(p_a1 - math.exp(16.3872-(3885.7/(e[0]-42.98))))-e[1] \n",
+ " f2=e[1]*M_a*Cpa*(T1-e[0])/(1-exp(-e[1]*M_a*Cpa/h)) + 1000*e[1]*lambda_a*((1-(e[0]/Tc))/(1-(T/Tc)))**0.38 \n",
+ " return(f1,f2) \n",
+ "\n",
+ "\n",
+ "# Initial guess\n",
+ "e = [292,-0.003] \n",
+ "y = fsolve(F,e) \n",
+ "Ti = y[0] \n",
+ "Na = y[1] \n",
+ "\n",
+ "print\"The temperature of the liquid water and the rate of water evaporation is\",round(Ti),\"K and\",round(Na,3),\" mole/square m.s respectively\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The temperature of the liquid water and the rate of water evaporation is 295.0 K and -0.013 mole/square m.s respectively\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.12,Page number:131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "\t# a-water b-dry air\n",
+ "D = 25.4*10**-3 \t\t\t# [Internal diameter of tower, m]\n",
+ "Z = 1.5 \t\t\t\t# [length of the wetted section, m]\n",
+ "Gy = 10 \t\t\t\t# [mass velocity of air, kg/square m.s]\n",
+ "Tair = 308 \t\t\t\t# [K]\n",
+ "Twater = 295 \t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t# [kPa]\n",
+ "M_a = 18.0 \t\t\t\t# [gram/mole]\n",
+ "M_b = 29.0 \t\t\t\t# [gram/mole]\n",
+ "R = 8.314 \t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "Pa = 2.64 # [kPa]\n",
+ "\n",
+ "Gm = Gy/M_b \t# [Assuming that gas phase is basically dry air, kmole/square m.s]\n",
+ "\t\t# The properties of dry air at 308 K and 1 atm are (from example 2.9)\n",
+ "row = 1.14 \t\t\t\t# [kg/cubic m]\n",
+ "u = 1.92*10**-5 \t\t\t# [kg/m.s]\n",
+ "D_ab = 0.242*10**-4 \t\t\t# [square m/s]\n",
+ "Sc = 0.692 \t\t\t\t# [Schmidt number]\n",
+ "\n",
+ "Re = Gy*D/u \t\t\t\t# [Renoylds number]\n",
+ "\n",
+ "if Re<35000 and Re>2000:\n",
+ " Sh = 0.023*Re**0.83*Sc**0.44 \t# [Sherwood number] \n",
+ " print\"Sherwood number is\",round(Sh,1) \n",
+ "else:\n",
+ " print\"We cannot use equation 2.74\"\n",
+ "\n",
+ "c = P/(R*Tair) \t\t\t# [kmole/cubic m]\n",
+ "\t# Now using equation 2.89\n",
+ "Pa_out = Pa*(1-math.exp((-4*Sh*Z*c*D_ab)/(Gm*D**2))) \t\t# [kPa]\n",
+ "\n",
+ "#Result\n",
+ "print\"The partial pressure of water in the air leaving the tower is\",round(Pa_out,2),\"kPa\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Sherwood number is 51.6\n",
+ "The partial pressure of water in the air leaving the tower is 1.94 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.13,Page number:134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "\t# a-water b-dry air\n",
+ "Gy = 10.0 \t\t\t\t# [kg/square m.s]\n",
+ "dp = 3.5*10**-3 \t\t\t# [diameter of spherical glass beads, m]\n",
+ "D = 25.4*10**-3 \t\t\t# [Internal diameter of tower, m]\n",
+ "Tair = 308 \t\t\t\t# [K]\n",
+ "Twater = 295 \t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t# [kPa]\n",
+ "M_a = 18 \t\t\t\t# [gram/mole]\n",
+ "M_b = 29 \t\t\t\t# [gram/mole]\n",
+ "R = 8.314 \t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "import math\n",
+ "from scipy.optimize import fsolve\n",
+ "\t# The properties of dry air at 308 K and 1 atm are (from example 2.12)\n",
+ "row = 1.14 \t\t\t\t# [kg/cubic m]\n",
+ "u = 1.92*10**-5 \t\t\t# [kg/m.s]\n",
+ "D_ab = 0.242*10**-4 \t\t\t# [square m/s]\n",
+ "Sc = 0.692 \t\t\t\t# [Schmidt number]\n",
+ "c = 0.04 \t \t\t\t# [mole/cubic m]\n",
+ "Gm = 0.345 \t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "Re = Gy*dp/u \t\t\t\t# [Renoylds number]\n",
+ "if Re<2500 and Re>10:\n",
+ " \t\t\t\t\t# Subsituting in equation 2.90\n",
+ " jd = 1.17*Re**-0.415 \n",
+ " print\"Renoylds number is \",Re\n",
+ "else:\n",
+ " print \" \"\n",
+ "Std = 0.052/(Sc**(2.0/3.0)) \n",
+ "\t\t# From Table 2.1 \n",
+ "Sh = Std*Re*Sc \t\t\t# [Sherwood number]\n",
+ "\t\t# From equation 2.94\n",
+ "e = 0.406+0.571*(dp/D) \t\t# [bed porosity]\n",
+ "e=round(e,3)\n",
+ "\t#Illustration 2.13(a) \n",
+ "\t# Solution(a)\n",
+ "\t# Now Paout = 0.99*Pa\n",
+ "\t# Using equation 2.93 to calculate 'Z'\n",
+ "def f12(Z):\n",
+ " return(0.99 - 1 + math.exp(-6*(1-e)*Sh*c*Z*D_ab/(Gm*dp**2))) \n",
+ "Z = fsolve(f12,0.06) \n",
+ "\n",
+ "#Result\n",
+ "Z=round(Z[0],3)\n",
+ "print\"The depth of packing required is\",Z,\"m=\",Z*100,\"cm\" \n",
+ "\n",
+ "\t#Illustration 2.13(b)\n",
+ "\t# Solution(b)\n",
+ "\t# From equation 2.95\n",
+ "deltaP = (150*(1-e)/Re + 1.75)*((1-e)*(Gy**2)*Z)/(dp*row*e**3) \t# [Pa]\n",
+ "\n",
+ "#Result\n",
+ "print\"The gas pressure drop through the bed is\",round(deltaP),\"Pa (Approx) \\nDUE TO LACK OF PRECISION IN CALCULATION IN BOOK.\\niF DONE MANUALLY,THIS ANSWER STANDS CORRECT\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Renoylds number is 1822.91666667\n",
+ "The depth of packing required is 0.078 m= 7.8 cm\n",
+ "The gas pressure drop through the bed is 15817.0 Pa (Approx) \n",
+ "DUE TO LACK OF PRECISION IN CALCULATION IN BOOK.\n",
+ "iF DONE MANUALLY,THIS ANSWER STANDS CORRECT\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.14,Page number:138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "\t# a-oxygen b-water\n",
+ "\t# To design the deaerator, We will use commercially available microporous polypropylene \thollow fibers in a module\n",
+ "\n",
+ "m = 40000.0 \t\t\t\t\t# [kg/hr]\n",
+ "Twater = 298 \t\t\t\t\t# [K]\n",
+ "v = 0.1 \t\t\t\t\t# [superficial velocity, m/s]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "V = 40*10**-3 \t\t\t\t\t# [Flow rate of nitrogen, cubic m/min]\n",
+ "d = 2.90*10**-4 \t\t\t\t# [Outside diameter of fibres, m]\n",
+ "pf = 0.4 \t\t\t\t\t# [Packing factor]\n",
+ "a = 46.84*100 \t\t\t\t\t# [surface area per unit volume, m**-1]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "dw = 1000 \t\t\t\t\t# [density of water, kg/cubic m]\n",
+ "Ql = m/(3600*1000) \t\t\t\t# [volumetric water flow rate, cubic m/s]\n",
+ "\t# Shell diameter\n",
+ "D = (4*Ql/(math.pi*v))**0.5 \t\t\t# [Shell diameter, m]\n",
+ "\n",
+ "\t# the properties of dilute mixtures of oxygen in water at 298 K\n",
+ "u = 0.9 \t\t\t\t\t# [cP]\n",
+ "\t# Diffusivity from equation 1.53\n",
+ "D_ab = 1.93*10**-9 \t\t\t\t# [square m/s]\n",
+ "Sc = 467 \t\t\t\t\t# [Schmidt number]\n",
+ "\n",
+ "Re = d*v*dw/(u*10**-3) \t\t\t# [Renoylds number]\n",
+ "\n",
+ "\t# Substituting in equation (2-97) gives\n",
+ "Sh = 0.53*(1-1.1*pf)*((1-pf)/pf)**-0.47*(Re**0.53*Sc**0.33) \n",
+ "\n",
+ "kl = Sh*D_ab/d \t\t\t\t# [mass-transfer coefficient on the shell side, \t\t\t\t\t\tm/s]\n",
+ "\n",
+ "\t# From the specified BFW flow rate\n",
+ "L = m/(3600*18) \t\t\t\t# [kmole/s]\n",
+ "\t# From ideal gas law\n",
+ "V1 = V*P/(Twater*R*60) \t\t\t# [kmole/s]\n",
+ "\t# From the solubility of oxygen in water at 298 K,\n",
+ "M = 4.5*10**4 \n",
+ "A = L/(M*V1) \t\t\t\t\t# [Absorption factor]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"Absorption factor is\",round(A,3) \n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "\t# For 99% removal of the dissolved oxygen\n",
+ "\t# x_in/x_out = b = 100\n",
+ "b = 100 \n",
+ "c = 55.5 \t\t\t\t\t# [molar density, kmole/cubic m]\n",
+ "\t# Substituting in equation 2.99 yields\n",
+ "V_T = (L*math.log(b*(1-A)+A))/(kl*a*c*(1-A)) \t # [cubic m]\n",
+ "\n",
+ "\t# The module length, Z is\n",
+ "Z = V_T/(math.pi*D**2.0/4.0) \n",
+ "\n",
+ "#Result\n",
+ "print\"The shell diameter and module length is\",round(D,3),\"m and\",round(Z,2),\" m respectively\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absorption factor is 0.503\n",
+ "The shell diameter and module length is 0.376 m and 2.15 m respectively\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.15,Page number:140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=2.21/100\t\t\t#[m]\n",
+ "mu=8.82*10**-6\t\t#[kg/m-s]\n",
+ "rho=2.81\t\t#[kg/m**3]\n",
+ "\n",
+ "c=34.14\t\t\t#[mol/m**3]\n",
+ "D=array([2.228/(10**6),2.065/(10**6),1.832/(10**6)]) #Velocities in [m**2/s]\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "#Gy=rho*v\t\t\n",
+ "#Re=Gy*d/mu\t\t#Reynolds number\n",
+ "Re=21750\n",
+ "print \"Reynolds number=\",Re\n",
+ "Sc=[]\n",
+ "Sh=[]\n",
+ "F=[]\n",
+ "for i in range(0, 3):\n",
+ " sc=mu/(rho*D[i]) #Schmidt number\n",
+ " Sc.append(sc)\n",
+ " sh=0.023*Re**(0.83)*sc**(0.44) #Sherwood number\n",
+ " Sh.append(sh)\n",
+ " f=sh*c*D[i]/d #Binary mass transfer coefficient in [mol/m^2-s]\n",
+ " F.append(f)\n",
+ "print \"Schmidt number are:\"\n",
+ "for i in range(0,3):\n",
+ " print round(Sc[i],3)\n",
+ "print \"Sherwood number number are:\"\n",
+ "for i in range(0,3):\n",
+ " print round(Sh[i],1)\n",
+ "print\"Binary mass transfer coefficients are:\"\n",
+ "for i in range(0,3):\n",
+ " print round(F[i],3)\n",
+ "#After modifying mathcad program of example 1.17,we have\n",
+ "N1=-0.0527 #[mol/m^2-s]\n",
+ "N2=0.0395 #[mol/m^2-s]\n",
+ "N3=0.0132 #[mol/m^2-s]\n",
+ "print\"The program yields the following results:\"\n",
+ "print \"N1=\",N1,\"mol/m**2-s\"\n",
+ "print \"N2=\",N2,\"mol/m**2-s\"\n",
+ "print \"N3=\",N3,\"mol/m**2-s\"\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reynolds number= 21750\n",
+ "Schmidt number are:\n",
+ "1.409\n",
+ "1.52\n",
+ "1.713\n",
+ "Sherwood number number are:\n",
+ "106.5\n",
+ "110.1\n",
+ "116.1\n",
+ "Binary mass transfer coefficients are:\n",
+ "0.367\n",
+ "0.351\n",
+ "0.328\n",
+ "The program yields the following results:\n",
+ "N1= -0.0527 mol/m**2-s\n",
+ "N2= 0.0395 mol/m**2-s\n",
+ "N3= 0.0132 mol/m**2-s\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/Practical_C_Programming/Chapter_3_4.ipynb b/Practical_C_Programming/Chapter_3_4.ipynb
index b0fd7f89..1a74741f 100644
--- a/Practical_C_Programming/Chapter_3_4.ipynb
+++ b/Practical_C_Programming/Chapter_3_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 3"
+ "name": "",
+ "signature": "sha256:0893bf0eb544a1587dd8191af7502dfb1634a7c77a30f208ad67851517e5431c"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,36 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 3: Style"
+ "source": [
+ "Chapter 3: Style"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 3.1, Page number: 57"
+ "source": [
+ "Example 3.1, Page number: 57"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 3.1.py\n# To print 'Hello World'\n\n\n# Result\nprint ('Hello World')",
+ "input": [
+ "\n",
+ "\n",
+ "# Result\n",
+ "print ('Hello World')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello World\n"
+ "text": [
+ "Hello World\n"
+ ]
}
],
"prompt_number": 1
diff --git a/Practical_C_Programming/Chapter_4_4.ipynb b/Practical_C_Programming/Chapter_4_4.ipynb
index bb8fdf51..8602f989 100644
--- a/Practical_C_Programming/Chapter_4_4.ipynb
+++ b/Practical_C_Programming/Chapter_4_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 4"
+ "name": "",
+ "signature": "sha256:785237ffc865ddc47952e10309b1bb53ee1543217e833069c02c2afb50bff287"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,38 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 4: Basic declarations and expressions"
+ "source": [
+ "Chapter 4: Basic declarations and expressions"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.1, Page number: 71"
+ "source": [
+ "Example 4.1, Page number: 71"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 4.1.py\n# To perform a simple calculation\n\n\n# Variable declaration\nx = (1 + 2) * 4\n\n# Result\nprint ('1 plus 2 multiplied by 4 gives %d' % x)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "x = (1 + 2) * 4\n",
+ "\n",
+ "# Result\n",
+ "print ('1 plus 2 multiplied by 4 gives %d' % x)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1 plus 2 multiplied by 4 gives 12\n"
+ "text": [
+ "1 plus 2 multiplied by 4 gives 12\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +52,34 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.2, Page number: 75"
+ "source": [
+ "Example 4.2, Page number: 75"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 4.2.py\n# To calculate the twice and thrice of 15\n\n\n# Variable declaration\nterm = 3 * 5\nterm_2 = 2 * term\nterm_3 = 3 * term\n\n# Result\nprint ('Twice %d is %d' % (term, term_2))\nprint ('Three times %d is %d' % (term, term_3))",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "term = 3 * 5\n",
+ "term_2 = 2 * term\n",
+ "term_3 = 3 * term\n",
+ "\n",
+ "# Result\n",
+ "print ('Twice %d is %d' % (term, term_2))\n",
+ "print ('Three times %d is %d' % (term, term_3))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Twice 15 is 30\nThree times 15 is 45\n"
+ "text": [
+ "Twice 15 is 30\n",
+ "Three times 15 is 45\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +88,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.3, Page number: 77"
+ "source": [
+ "Example 4.3, Page number: 77"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 4.3.py\n# To calculate the twice and thrice of 15\n\n\n# Variable declaration\nterm = 3 * 5\nterm_2 = 2 * term\nterm_3 = 3 * term\n\n# Result\nprint ('Twice %d is %d' % (term, term_2))\nprint ('Three times %d is %d' % (term, term_3))",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "term = 3 * 5\n",
+ "term_2 = 2 * term\n",
+ "term_3 = 3 * term\n",
+ "\n",
+ "# Result\n",
+ "print ('Twice %d is %d' % (term, term_2))\n",
+ "print ('Three times %d is %d' % (term, term_3))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Twice 15 is 30\nThree times 15 is 45\n"
+ "text": [
+ "Twice 15 is 30\n",
+ "Three times 15 is 45\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +125,30 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.4, Page number: 79"
+ "source": [
+ "Example 4.4, Page number: 79"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 4.4.py\n# To determine the value of 1/3\n\n\n# Variable declaration\nanswer = 1/3\n\n# Result\nprint ('The value of 1/3 is %f' % answer)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "answer = 1/3\n",
+ "\n",
+ "# Result\n",
+ "print ('The value of 1/3 is %f' % answer)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The value of 1/3 is 0.000000\n"
+ "text": [
+ "The value of 1/3 is 0.000000\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +157,29 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.5, Page number: 80"
+ "source": [
+ "Example 4.5, Page number: 80"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 4.5.py\n# To determine the value of 2 + 2\n\n\n# Variable declaration\nanswer = 2 + 2\n\n# Result\nprint ('The answer is %d' % answer)",
+ "input": [
+ "\n",
+ "answer = 2 + 2\n",
+ "\n",
+ "# Result\n",
+ "print ('The answer is %d' % answer)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The answer is 4\n"
+ "text": [
+ "The answer is 4\n"
+ ]
}
],
"prompt_number": 5
@@ -122,19 +188,31 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.6, Page number: 80"
+ "source": [
+ "Example 4.6, Page number: 80"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 4.6.py\n# To determine the integer equivalent of 7.0/22.0 \n\n\n# Variable declaration\nresult = 7.0/22.0\n\n# Result\nprint ('The result is %d' % result)",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "result = 7.0/22.0\n",
+ "\n",
+ "# Result\n",
+ "print ('The result is %d' % result)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The result is 0\n"
+ "text": [
+ "The result is 0\n"
+ ]
}
],
"prompt_number": 6
@@ -143,19 +221,32 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 4.7, Page number: 82"
+ "source": [
+ "Example 4.7, Page number: 82"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 4.7.py\n# To determine the reverse of 3 characters\n\n\n# Variable declaration\nchar1 = 'A'\nchar2 = 'B'\nchar3 = 'C'\n\n# Result\nprint ('%c%c%c reversed is %c%c%c' % (char1, char2, char3, char3, char2, char1))",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "char1 = 'A'\n",
+ "char2 = 'B'\n",
+ "char3 = 'C'\n",
+ "\n",
+ "# Result\n",
+ "print ('%c%c%c reversed is %c%c%c' % (char1, char2, char3, char3, char2, char1))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "ABC reversed is CBA\n"
+ "text": [
+ "ABC reversed is CBA\n"
+ ]
}
],
"prompt_number": 7
diff --git a/Practical_C_Programming/Chapter_5_4.ipynb b/Practical_C_Programming/Chapter_5_4.ipynb
index 37c16908..2d2abf16 100644
--- a/Practical_C_Programming/Chapter_5_4.ipynb
+++ b/Practical_C_Programming/Chapter_5_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 5"
+ "name": "",
+ "signature": "sha256:8925a816cb9ea05a6a48e6ec88b1e1778772a9e1e429803a5c922fb000f7f30d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,42 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 5: Arrays, qualifiers, and reading numbers"
+ "source": [
+ "Chapter 5: Arrays, qualifiers, and reading numbers"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.1, Page number: 84"
+ "source": [
+ "Example 5.1, Page number: 84"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.1.py\n# To print the total and average of five data items\n\n\n# Variable declaration\ndata = [ 34.0, 27.0, 45.0, 82.0, 22.0 ]\n\n# Calculation\ntotal = data[0] + data[1] + data[2] + data[3] + data[4]\naverage = total/5.0\n\n# Result\nprint ('Total %f Average %f' % (total, average))",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "data = [ 34.0, 27.0, 45.0, 82.0, 22.0 ]\n",
+ "\n",
+ "# Calculation\n",
+ "total = data[0] + data[1] + data[2] + data[3] + data[4]\n",
+ "average = total/5.0\n",
+ "\n",
+ "# Result\n",
+ "print ('Total %f Average %f' % (total, average))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Total 210.000000 Average 42.000000\n"
+ "text": [
+ "Total 210.000000 Average 42.000000\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +56,31 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.2, Page number: 87"
+ "source": [
+ "Example 5.2, Page number: 87"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.2.py\n# To print the name 'Sam'\n\n\n# Variable declaration\nname = 'Sam'\n\n# Result\nprint ('The name is %s' % name)",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "name = 'Sam'\n",
+ "\n",
+ "# Result\n",
+ "print ('The name is %s' % name)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The name is Sam\n"
+ "text": [
+ "The name is Sam\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +89,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.3, Page number: 88"
+ "source": [
+ "Example 5.3, Page number: 88"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.3.py\n# To print the full name of a person\n\n\n# Variable declaration\nfirst = 'Steve'\nlast = 'Oualline'\n\n# Calculation\nfull_name = first + ' ' + last\n\n# Result\nprint ('The full name is %s' % full_name)",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "first = 'Steve'\n",
+ "last = 'Oualline'\n",
+ "\n",
+ "# Calculation\n",
+ "full_name = first + ' ' + last\n",
+ "\n",
+ "# Result\n",
+ "print ('The full name is %s' % full_name)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The full name is Steve Oualline\n"
+ "text": [
+ "The full name is Steve Oualline\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +126,30 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.4, Page number: 89"
+ "source": [
+ "Example 5.4, Page number: 89"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.4.py\n# To calculate the length of a line\n\n\n# Variable declaration\nline = 'hello world'\n\n# Result\nprint ('The length of the line is %d' % len(line))",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "line = 'hello world'\n",
+ "\n",
+ "# Result\n",
+ "print ('The length of the line is %d' % len(line))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The length of the line is 11\n"
+ "text": [
+ "The length of the line is 11\n"
+ ]
}
],
"prompt_number": 6
@@ -101,19 +158,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.5, Page number: 90"
+ "source": [
+ "Example 5.5, Page number: 90"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.5.py\n# To display the first and last names of a person\n\n\n# Variable declaration\nfirst = 'Steve'\nlast = 'Oualline'\n\n# Calculation\nfull = first + ' ' + last\n\n# Result\nprint ('The name is %s' % full)",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "first = 'Steve'\n",
+ "last = 'Oualline'\n",
+ "\n",
+ "# Calculation\n",
+ "full = first + ' ' + last\n",
+ "\n",
+ "# Result\n",
+ "print ('The name is %s' % full)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The name is Steve Oualline\n"
+ "text": [
+ "The name is Steve Oualline\n"
+ ]
}
],
"prompt_number": 7
@@ -122,19 +195,34 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.6, Page number: 91"
+ "source": [
+ "Example 5.6, Page number: 91"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.6.py\n# To display the first and last names of a person\n\n\n# Variable declaration\nfirst = 'Steve'\nlast = 'Oualline'\n\n# Calculation\nfull = first + ' ' + last\n\n# Result\nprint ('The name is %s' % full)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "first = 'Steve'\n",
+ "last = 'Oualline'\n",
+ "\n",
+ "# Calculation\n",
+ "full = first + ' ' + last\n",
+ "\n",
+ "# Result\n",
+ "print ('The name is %s' % full)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The name is Steve Oualline\n"
+ "text": [
+ "The name is Steve Oualline\n"
+ ]
}
],
"prompt_number": 8
@@ -143,19 +231,64 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.7, Page number: 93"
+ "source": [
+ "Example 5.7, Page number: 93"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.7.py\n# To display the values of the elements of a 2-D array\n\n\n# Variable declaration\narray = [[0 for x in range(5)] for x in range(5)]\narray[0][0] = 0 * 10 + 0\narray[0][1] = 0 * 10 + 1\narray[1][0] = 1 * 10 + 0\narray[1][1] = 1 * 10 + 1\narray[2][0] = 2 * 10 + 0\narray[2][1] = 2 * 10 + 1\n\n# Result\nprint ('array[0]')\nprint (array[0][0])\nprint (array[0][1])\nprint ('\\n')\n\nprint ('array[1]')\nprint (array[1][0])\nprint (array[1][1])\nprint ('\\n')\n\nprint ('array[2]')\nprint (array[2][0])\nprint (array[2][1])\nprint ('\\n')",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "array = [[0 for x in range(5)] for x in range(5)]\n",
+ "array[0][0] = 0 * 10 + 0\n",
+ "array[0][1] = 0 * 10 + 1\n",
+ "array[1][0] = 1 * 10 + 0\n",
+ "array[1][1] = 1 * 10 + 1\n",
+ "array[2][0] = 2 * 10 + 0\n",
+ "array[2][1] = 2 * 10 + 1\n",
+ "\n",
+ "# Result\n",
+ "print ('array[0]')\n",
+ "print (array[0][0])\n",
+ "print (array[0][1])\n",
+ "print ('\\n')\n",
+ "\n",
+ "print ('array[1]')\n",
+ "print (array[1][0])\n",
+ "print (array[1][1])\n",
+ "print ('\\n')\n",
+ "\n",
+ "print ('array[2]')\n",
+ "print (array[2][0])\n",
+ "print (array[2][1])\n",
+ "print ('\\n')"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "array[0]\n0\n1\n\n\narray[1]\n10\n11\n\n\narray[2]\n20\n21\n\n\n"
+ "text": [
+ "array[0]\n",
+ "0\n",
+ "1\n",
+ "\n",
+ "\n",
+ "array[1]\n",
+ "10\n",
+ "11\n",
+ "\n",
+ "\n",
+ "array[2]\n",
+ "20\n",
+ "21\n",
+ "\n",
+ "\n"
+ ]
}
],
"prompt_number": 9
@@ -164,19 +297,30 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.8, Page number: 94"
+ "source": [
+ "Example 5.8, Page number: 94"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.8.py\n# To print the twice of a value\n\n\n# Variable declaration\nline = 4\n\n# Result\nprint ('Twice %d is %d' % (line, line * 2))",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "line = 4\n",
+ "\n",
+ "# Result\n",
+ "print ('Twice %d is %d' % (line, line * 2))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Twice 4 is 8\n"
+ "text": [
+ "Twice 4 is 8\n"
+ ]
}
],
"prompt_number": 10
@@ -185,19 +329,34 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.9, Page number: 95"
+ "source": [
+ "Example 5.9, Page number: 95"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.9.py\n# To calculate the area of a triangle\n\n\n# Variable declaration\nwidth = 12\nheight = 10\n\n# Calculation\narea = (width * height) / 2\n\n# Result\nprint ('The area is %d' % area)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "width = 12\n",
+ "height = 10\n",
+ "\n",
+ "# Calculation\n",
+ "area = (width * height) / 2\n",
+ "\n",
+ "# Result\n",
+ "print ('The area is %d' % area)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The area is 60\n"
+ "text": [
+ "The area is 60\n"
+ ]
}
],
"prompt_number": 12
@@ -206,19 +365,34 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 5.10, Page number: 107"
+ "source": [
+ "Example 5.10, Page number: 107"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 5.10.py\n# To calculate the area of a triangle\n\n\n# Variable declaration\nwidth = 4\nheight = 6\n\n# Calculation\narea = (width * height) / 2\n\n# Result\nprint ('The area is %d' % area)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "width = 4\n",
+ "height = 6\n",
+ "\n",
+ "# Calculation\n",
+ "area = (width * height) / 2\n",
+ "\n",
+ "# Result\n",
+ "print ('The area is %d' % area)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The area is 12\n"
+ "text": [
+ "The area is 12\n"
+ ]
}
],
"prompt_number": 13
diff --git a/Practical_C_Programming/Chapter_6_4.ipynb b/Practical_C_Programming/Chapter_6_4.ipynb
index 22907862..2769b901 100644
--- a/Practical_C_Programming/Chapter_6_4.ipynb
+++ b/Practical_C_Programming/Chapter_6_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 6"
+ "name": "",
+ "signature": "sha256:72c49f1aed7f4d43ac1084e67245cfba7b011cb43f84b1ab3ef13b081aec557f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,56 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 6: Decision and control statements"
+ "source": [
+ "Chapter 6: Decision and control statements"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.1, Page number: 114"
+ "source": [
+ "Example 6.1, Page number: 114"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 6.1.py\n# To print the Fibonacci series upto 100\n\n\n# Variable declaration\nold_number = 1\ncurrent_number = 1\n\nprint ('1')\n\n# Calculation and result\nwhile (current_number < 100) :\n print (current_number)\n next_number = current_number + old_number\n\n old_number = current_number\n current_number = next_number",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "old_number = 1\n",
+ "current_number = 1\n",
+ "\n",
+ "print ('1')\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (current_number < 100) :\n",
+ " print (current_number)\n",
+ " next_number = current_number + old_number\n",
+ "\n",
+ " old_number = current_number\n",
+ " current_number = next_number"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "1\n1\n2\n3\n5\n8\n13\n21\n34\n55\n89\n"
+ "text": [
+ "1\n",
+ "1\n",
+ "2\n",
+ "3\n",
+ "5\n",
+ "8\n",
+ "13\n",
+ "21\n",
+ "34\n",
+ "55\n",
+ "89\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +70,52 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.2, Page number: 115"
+ "source": [
+ "Example 6.2, Page number: 115"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 6.2.py\n# To calculate the number of items entered\n\n\n# Variable declaration\ntotal = 0\ni = 0\n\n# Calculation\nwhile (i < 10) :\n item = 1\n\n if item == 0 :\n break\n\n total += item\n print ('Total: %d' % total)\n i = i + 1\n \n# Result\nprint ('Final total: %d' % total)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "total = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation\n",
+ "while (i < 10) :\n",
+ " item = 1\n",
+ "\n",
+ " if item == 0 :\n",
+ " break\n",
+ "\n",
+ " total += item\n",
+ " print ('Total: %d' % total)\n",
+ " i = i + 1\n",
+ " \n",
+ "# Result\n",
+ "print ('Final total: %d' % total)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Total: 1\nTotal: 2\nTotal: 3\nTotal: 4\nTotal: 5\nTotal: 6\nTotal: 7\nTotal: 8\nTotal: 9\nTotal: 10\nFinal total: 10\n"
+ "text": [
+ "Total: 1\n",
+ "Total: 2\n",
+ "Total: 3\n",
+ "Total: 4\n",
+ "Total: 5\n",
+ "Total: 6\n",
+ "Total: 7\n",
+ "Total: 8\n",
+ "Total: 9\n",
+ "Total: 10\n",
+ "Final total: 10\n"
+ ]
}
],
"prompt_number": 1
@@ -59,19 +124,59 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.3, Page number: 116"
+ "source": [
+ "Example 6.3, Page number: 116"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 6.3.py\n# To calculate the total number of items entered and omit the negative items\n\n\n# Variable declaration\ntotal = 0\nminus_items = 0\ni = 0\n\n# Calculation\nwhile (i < 10) :\n item = 1\n \n if item == 0 :\n break\n\n if item < 0 :\n minus_items += 1\n continue\n\n total += item\n print ('Total: %d' % total)\n i = i + 1\n \n# Result\nprint ('Final total: %d' % total)\nprint ('with %d negative items omitted' % minus_items)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "total = 0\n",
+ "minus_items = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation\n",
+ "while (i < 10) :\n",
+ " item = 1\n",
+ " \n",
+ " if item == 0 :\n",
+ " break\n",
+ "\n",
+ " if item < 0 :\n",
+ " minus_items += 1\n",
+ " continue\n",
+ "\n",
+ " total += item\n",
+ " print ('Total: %d' % total)\n",
+ " i = i + 1\n",
+ " \n",
+ "# Result\n",
+ "print ('Final total: %d' % total)\n",
+ "print ('with %d negative items omitted' % minus_items)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Total: 1\nTotal: 2\nTotal: 3\nTotal: 4\nTotal: 5\nTotal: 6\nTotal: 7\nTotal: 8\nTotal: 9\nTotal: 10\nFinal total: 10\nwith 0 negative items omitted\n"
+ "text": [
+ "Total: 1\n",
+ "Total: 2\n",
+ "Total: 3\n",
+ "Total: 4\n",
+ "Total: 5\n",
+ "Total: 6\n",
+ "Total: 7\n",
+ "Total: 8\n",
+ "Total: 9\n",
+ "Total: 10\n",
+ "Final total: 10\n",
+ "with 0 negative items omitted\n"
+ ]
}
],
"prompt_number": 2
@@ -80,19 +185,34 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 6.4, Page number: 118"
+ "source": [
+ "Example 6.4, Page number: 118"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 6.4.py\n# To calculate the number of dollars owed\n\n\n# Variable declaration\nbalance_owed = 100\n\n# Calculation and result\nif balance_owed == 0 :\n print ('You owe nothing.')\nelse :\n print ('You owe %d dollars.' % balance_owed)",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "balance_owed = 100\n",
+ "\n",
+ "# Calculation and result\n",
+ "if balance_owed == 0 :\n",
+ " print ('You owe nothing.')\n",
+ "else :\n",
+ " print ('You owe %d dollars.' % balance_owed)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "You owe 100 dollars.\n"
+ "text": [
+ "You owe 100 dollars.\n"
+ ]
}
],
"prompt_number": 3
diff --git a/Practical_C_Programming/Chapter_7_4.ipynb b/Practical_C_Programming/Chapter_7_4.ipynb
index 51b18ca7..ad153ba6 100644
--- a/Practical_C_Programming/Chapter_7_4.ipynb
+++ b/Practical_C_Programming/Chapter_7_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 7"
+ "name": "",
+ "signature": "sha256:05d2b6828dd178069989841e00a87dd5090f48e199f3c803503e5017b744fb21"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,51 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 7: Programming process"
+ "source": [
+ "Chapter 7: Programming process"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 7.1, Page number: 126"
+ "source": [
+ "Example 7.1, Page number: 126"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 7.1.py\n# To perform an operation based on operator input by the user\n\n\n# Variable declaration\nresult = 0\ni = 0\n\n# Calculation and result\nwhile (i < 3) :\n print ('Result: %d' % result)\n operator = '+'\n value = 10\n\n if operator == '+' :\n result += value\n else :\n print ('Unknown operator %c' % operator)\n i = i + 1 ",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "result = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (i < 3) :\n",
+ " print ('Result: %d' % result)\n",
+ " operator = '+'\n",
+ " value = 10\n",
+ "\n",
+ " if operator == '+' :\n",
+ " result += value\n",
+ " else :\n",
+ " print ('Unknown operator %c' % operator)\n",
+ " i = i + 1 "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Result: 0\nResult: 10\nResult: 20\n"
+ "text": [
+ "Result: 0\n",
+ "Result: 10\n",
+ "Result: 20\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +65,57 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 7.2, Page number: 133"
+ "source": [
+ "Example 7.2, Page number: 133"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 7.2.py\n# To perform various arithmetic operations based on operator input by the user\n\n\n# Variable declaration\nresult = 0\ni = 0\n\n# Calculation and result\nwhile (i < 3) :\n print ('Result: %d' % result)\n operator = '+'\n value = 5\n\n if operator == 'q' or operator == 'Q' :\n break\n\n if operator == '+' :\n result += value\n\n if operator == '-' :\n result -= value\n\n if operator == '*' :\n result *= value\n\n if operator == '/' :\n if value == 0 :\n print ('Error: Divide by zero')\n print ('operation ignored') \n else :\n result /= value\n\n i = i + 1",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "result = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (i < 3) :\n",
+ " print ('Result: %d' % result)\n",
+ " operator = '+'\n",
+ " value = 5\n",
+ "\n",
+ " if operator == 'q' or operator == 'Q' :\n",
+ " break\n",
+ "\n",
+ " if operator == '+' :\n",
+ " result += value\n",
+ "\n",
+ " if operator == '-' :\n",
+ " result -= value\n",
+ "\n",
+ " if operator == '*' :\n",
+ " result *= value\n",
+ "\n",
+ " if operator == '/' :\n",
+ " if value == 0 :\n",
+ " print ('Error: Divide by zero')\n",
+ " print ('operation ignored') \n",
+ " else :\n",
+ " result /= value\n",
+ "\n",
+ " i = i + 1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Result: 0\nResult: 5\nResult: 10\n"
+ "text": [
+ "Result: 0\n",
+ "Result: 5\n",
+ "Result: 10\n"
+ ]
}
],
"prompt_number": 4
@@ -59,12 +124,56 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 7.3, Page number: 140"
+ "source": [
+ "Example 7.3, Page number: 140"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 7.3.py\n# Guess - A simple guessing game\n# A random number is chosen between 1 and 100. \n# The player is given a set of bounds and \n# must choose a number between them. \n# If the player chooses the correct number, he wins.\n# Otherwise, the bounds are adjusted to reflect\n# the player's guess and the game continues.\n\n# Variable declaration, calculation and result\nimport sys\nimport random\nwhile (1) :\n\n # random number to be guessed\n number_to_guess = random.randrange (1, 101, 1)\n\n # current lower limit of player's range\n low_limit = 0\n\n # current upper limit of player's range\n high_limit = 100\n \n # number of times player guessed\n guess_count = 0\n\n while (1) :\n \n # tell user what the bounds are and get his guess\n print ('Bounds %d - %d\\n' % (low_limit, high_limit))\n print ('Value[%d]?' % guess_count)\n \n guess_count += 1\n\n # number gotten from the player\n player_number = 50\n\n # did he guess right?\n if (player_number == number_to_guess) :\n break\n\n # adjust bounds for next guess\n if (player_number < number_to_guess) :\n low_limit = player_number\n \n else :\n high_limit = player_number\n\n print ('Bingo\\n')",
+ "input": [
+ "\n",
+ "# Variable declaration, calculation and result\n",
+ "import sys\n",
+ "import random\n",
+ "while (1) :\n",
+ "\n",
+ " # random number to be guessed\n",
+ " number_to_guess = random.randrange (1, 101, 1)\n",
+ "\n",
+ " # current lower limit of player's range\n",
+ " low_limit = 0\n",
+ "\n",
+ " # current upper limit of player's range\n",
+ " high_limit = 100\n",
+ " \n",
+ " # number of times player guessed\n",
+ " guess_count = 0\n",
+ "\n",
+ " while (1) :\n",
+ " \n",
+ " # tell user what the bounds are and get his guess\n",
+ " print ('Bounds %d - %d\\n' % (low_limit, high_limit))\n",
+ " print ('Value[%d]?' % guess_count)\n",
+ " \n",
+ " guess_count += 1\n",
+ "\n",
+ " # number gotten from the player\n",
+ " player_number = 50\n",
+ "\n",
+ " # did he guess right?\n",
+ " if (player_number == number_to_guess) :\n",
+ " break\n",
+ "\n",
+ " # adjust bounds for next guess\n",
+ " if (player_number < number_to_guess) :\n",
+ " low_limit = player_number\n",
+ " \n",
+ " else :\n",
+ " high_limit = player_number\n",
+ "\n",
+ " print ('Bingo\\n')"
+ ],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Practical_C_Programming/Chapter_8_4.ipynb b/Practical_C_Programming/Chapter_8_4.ipynb
index f7a42df6..24580c55 100644
--- a/Practical_C_Programming/Chapter_8_4.ipynb
+++ b/Practical_C_Programming/Chapter_8_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 8"
+ "name": "",
+ "signature": "sha256:10a432341f6033fcf678cc580d953b0c94ad7350aa1431ba3e0517904d3e90c8"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,46 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 8: More control statements"
+ "source": [
+ "Chapter 8: More control statements"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 8.1, Page number: 144"
+ "source": [
+ "Example 8.1, Page number: 144"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 8.1.py\n# To calculate the sum of numbers entered by the user\n\n\n# Variable declaration\ntotal = 0\ncounter = 0\n\n# Calculation\nwhile (counter < 5) :\n current = 3\n total += current\n counter += 1\n\n# Result\nprint ('The grand total is %d' % total)",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "total = 0\n",
+ "counter = 0\n",
+ "\n",
+ "# Calculation\n",
+ "while (counter < 5) :\n",
+ " current = 3\n",
+ " total += current\n",
+ " counter += 1\n",
+ "\n",
+ "# Result\n",
+ "print ('The grand total is %d' % total)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The grand total is 15\n"
+ "text": [
+ "The grand total is 15\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +60,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 8.2, Page number: 145"
+ "source": [
+ "Example 8.2, Page number: 145"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 8.2.py\n# To calculate the sum of numbers entered by the user using for loop\n\n\n# Variable declaration\ntotal = 0\n\n# Calculation\nfor counter in range (0, 5) :\n current = 5\n total += current\n\n# Result\nprint ('The grand total is %d' % total)",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "total = 0\n",
+ "\n",
+ "# Calculation\n",
+ "for counter in range (0, 5) :\n",
+ " current = 5\n",
+ " total += current\n",
+ "\n",
+ "# Result\n",
+ "print ('The grand total is %d' % total)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The grand total is 25\n"
+ "text": [
+ "The grand total is 25\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +97,129 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 8.3, Page number: 146"
+ "source": [
+ "Example 8.3, Page number: 146"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 8.3.py\n# To produce a Celsius to Fahrenheit conversion chart for the numbers 0 to 100\n\n\n# Variable declaration, calculation and result\nfor celsius in range (0, 101) :\n print ('Celsius: %d Fahrenheit: %d' % (celsius, (celsius * 9) / 5 +32))",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration, calculation and result\n",
+ "for celsius in range (0, 101) :\n",
+ " print ('Celsius: %d Fahrenheit: %d' % (celsius, (celsius * 9) / 5 +32))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Celsius: 0 Fahrenheit: 32\nCelsius: 1 Fahrenheit: 33\nCelsius: 2 Fahrenheit: 35\nCelsius: 3 Fahrenheit: 37\nCelsius: 4 Fahrenheit: 39\nCelsius: 5 Fahrenheit: 41\nCelsius: 6 Fahrenheit: 42\nCelsius: 7 Fahrenheit: 44\nCelsius: 8 Fahrenheit: 46\nCelsius: 9 Fahrenheit: 48\nCelsius: 10 Fahrenheit: 50\nCelsius: 11 Fahrenheit: 51\nCelsius: 12 Fahrenheit: 53\nCelsius: 13 Fahrenheit: 55\nCelsius: 14 Fahrenheit: 57\nCelsius: 15 Fahrenheit: 59\nCelsius: 16 Fahrenheit: 60\nCelsius: 17 Fahrenheit: 62\nCelsius: 18 Fahrenheit: 64\nCelsius: 19 Fahrenheit: 66\nCelsius: 20 Fahrenheit: 68\nCelsius: 21 Fahrenheit: 69\nCelsius: 22 Fahrenheit: 71\nCelsius: 23 Fahrenheit: 73\nCelsius: 24 Fahrenheit: 75\nCelsius: 25 Fahrenheit: 77\nCelsius: 26 Fahrenheit: 78\nCelsius: 27 Fahrenheit: 80\nCelsius: 28 Fahrenheit: 82\nCelsius: 29 Fahrenheit: 84\nCelsius: 30 Fahrenheit: 86\nCelsius: 31 Fahrenheit: 87\nCelsius: 32 Fahrenheit: 89\nCelsius: 33 Fahrenheit: 91\nCelsius: 34 Fahrenheit: 93\nCelsius: 35 Fahrenheit: 95\nCelsius: 36 Fahrenheit: 96\nCelsius: 37 Fahrenheit: 98\nCelsius: 38 Fahrenheit: 100\nCelsius: 39 Fahrenheit: 102\nCelsius: 40 Fahrenheit: 104\nCelsius: 41 Fahrenheit: 105\nCelsius: 42 Fahrenheit: 107\nCelsius: 43 Fahrenheit: 109\nCelsius: 44 Fahrenheit: 111\nCelsius: 45 Fahrenheit: 113\nCelsius: 46 Fahrenheit: 114\nCelsius: 47 Fahrenheit: 116\nCelsius: 48 Fahrenheit: 118\nCelsius: 49 Fahrenheit: 120\nCelsius: 50 Fahrenheit: 122\nCelsius: 51 Fahrenheit: 123\nCelsius: 52 Fahrenheit: 125\nCelsius: 53 Fahrenheit: 127\nCelsius: 54 Fahrenheit: 129\nCelsius: 55 Fahrenheit: 131\nCelsius: 56 Fahrenheit: 132\nCelsius: 57 Fahrenheit: 134\nCelsius: 58 Fahrenheit: 136\nCelsius: 59 Fahrenheit: 138\nCelsius: 60 Fahrenheit: 140\nCelsius: 61 Fahrenheit: 141\nCelsius: 62 Fahrenheit: 143\nCelsius: 63 Fahrenheit: 145\nCelsius: 64 Fahrenheit: 147\nCelsius: 65 Fahrenheit: 149\nCelsius: 66 Fahrenheit: 150\nCelsius: 67 Fahrenheit: 152\nCelsius: 68 Fahrenheit: 154\nCelsius: 69 Fahrenheit: 156\nCelsius: 70 Fahrenheit: 158\nCelsius: 71 Fahrenheit: 159\nCelsius: 72 Fahrenheit: 161\nCelsius: 73 Fahrenheit: 163\nCelsius: 74 Fahrenheit: 165\nCelsius: 75 Fahrenheit: 167\nCelsius: 76 Fahrenheit: 168\nCelsius: 77 Fahrenheit: 170\nCelsius: 78 Fahrenheit: 172\nCelsius: 79 Fahrenheit: 174\nCelsius: 80 Fahrenheit: 176\nCelsius: 81 Fahrenheit: 177\nCelsius: 82 Fahrenheit: 179\nCelsius: 83 Fahrenheit: 181\nCelsius: 84 Fahrenheit: 183\nCelsius: 85 Fahrenheit: 185\nCelsius: 86 Fahrenheit: 186\nCelsius: 87 Fahrenheit: 188\nCelsius: 88 Fahrenheit: 190\nCelsius: 89 Fahrenheit: 192\nCelsius: 90 Fahrenheit: 194\nCelsius: 91 Fahrenheit: 195\nCelsius: 92 Fahrenheit: 197\nCelsius: 93 Fahrenheit: 199\nCelsius: 94 Fahrenheit: 201\nCelsius: 95 Fahrenheit: 203\nCelsius: 96 Fahrenheit: 204\nCelsius: 97 Fahrenheit: 206\nCelsius: 98 Fahrenheit: 208\nCelsius: 99 Fahrenheit: 210\nCelsius: 100 Fahrenheit: 212\n"
+ "text": [
+ "Celsius: 0 Fahrenheit: 32\n",
+ "Celsius: 1 Fahrenheit: 33\n",
+ "Celsius: 2 Fahrenheit: 35\n",
+ "Celsius: 3 Fahrenheit: 37\n",
+ "Celsius: 4 Fahrenheit: 39\n",
+ "Celsius: 5 Fahrenheit: 41\n",
+ "Celsius: 6 Fahrenheit: 42\n",
+ "Celsius: 7 Fahrenheit: 44\n",
+ "Celsius: 8 Fahrenheit: 46\n",
+ "Celsius: 9 Fahrenheit: 48\n",
+ "Celsius: 10 Fahrenheit: 50\n",
+ "Celsius: 11 Fahrenheit: 51\n",
+ "Celsius: 12 Fahrenheit: 53\n",
+ "Celsius: 13 Fahrenheit: 55\n",
+ "Celsius: 14 Fahrenheit: 57\n",
+ "Celsius: 15 Fahrenheit: 59\n",
+ "Celsius: 16 Fahrenheit: 60\n",
+ "Celsius: 17 Fahrenheit: 62\n",
+ "Celsius: 18 Fahrenheit: 64\n",
+ "Celsius: 19 Fahrenheit: 66\n",
+ "Celsius: 20 Fahrenheit: 68\n",
+ "Celsius: 21 Fahrenheit: 69\n",
+ "Celsius: 22 Fahrenheit: 71\n",
+ "Celsius: 23 Fahrenheit: 73\n",
+ "Celsius: 24 Fahrenheit: 75\n",
+ "Celsius: 25 Fahrenheit: 77\n",
+ "Celsius: 26 Fahrenheit: 78\n",
+ "Celsius: 27 Fahrenheit: 80\n",
+ "Celsius: 28 Fahrenheit: 82\n",
+ "Celsius: 29 Fahrenheit: 84\n",
+ "Celsius: 30 Fahrenheit: 86\n",
+ "Celsius: 31 Fahrenheit: 87\n",
+ "Celsius: 32 Fahrenheit: 89\n",
+ "Celsius: 33 Fahrenheit: 91\n",
+ "Celsius: 34 Fahrenheit: 93\n",
+ "Celsius: 35 Fahrenheit: 95\n",
+ "Celsius: 36 Fahrenheit: 96\n",
+ "Celsius: 37 Fahrenheit: 98\n",
+ "Celsius: 38 Fahrenheit: 100\n",
+ "Celsius: 39 Fahrenheit: 102\n",
+ "Celsius: 40 Fahrenheit: 104\n",
+ "Celsius: 41 Fahrenheit: 105\n",
+ "Celsius: 42 Fahrenheit: 107\n",
+ "Celsius: 43 Fahrenheit: 109\n",
+ "Celsius: 44 Fahrenheit: 111\n",
+ "Celsius: 45 Fahrenheit: 113\n",
+ "Celsius: 46 Fahrenheit: 114\n",
+ "Celsius: 47 Fahrenheit: 116\n",
+ "Celsius: 48 Fahrenheit: 118\n",
+ "Celsius: 49 Fahrenheit: 120\n",
+ "Celsius: 50 Fahrenheit: 122\n",
+ "Celsius: 51 Fahrenheit: 123\n",
+ "Celsius: 52 Fahrenheit: 125\n",
+ "Celsius: 53 Fahrenheit: 127\n",
+ "Celsius: 54 Fahrenheit: 129\n",
+ "Celsius: 55 Fahrenheit: 131\n",
+ "Celsius: 56 Fahrenheit: 132\n",
+ "Celsius: 57 Fahrenheit: 134\n",
+ "Celsius: 58 Fahrenheit: 136\n",
+ "Celsius: 59 Fahrenheit: 138\n",
+ "Celsius: 60 Fahrenheit: 140\n",
+ "Celsius: 61 Fahrenheit: 141\n",
+ "Celsius: 62 Fahrenheit: 143\n",
+ "Celsius: 63 Fahrenheit: 145\n",
+ "Celsius: 64 Fahrenheit: 147\n",
+ "Celsius: 65 Fahrenheit: 149\n",
+ "Celsius: 66 Fahrenheit: 150\n",
+ "Celsius: 67 Fahrenheit: 152\n",
+ "Celsius: 68 Fahrenheit: 154\n",
+ "Celsius: 69 Fahrenheit: 156\n",
+ "Celsius: 70 Fahrenheit: 158\n",
+ "Celsius: 71 Fahrenheit: 159\n",
+ "Celsius: 72 Fahrenheit: 161\n",
+ "Celsius: 73 Fahrenheit: 163\n",
+ "Celsius: 74 Fahrenheit: 165\n",
+ "Celsius: 75 Fahrenheit: 167\n",
+ "Celsius: 76 Fahrenheit: 168\n",
+ "Celsius: 77 Fahrenheit: 170\n",
+ "Celsius: 78 Fahrenheit: 172\n",
+ "Celsius: 79 Fahrenheit: 174\n",
+ "Celsius: 80 Fahrenheit: 176\n",
+ "Celsius: 81 Fahrenheit: 177\n",
+ "Celsius: 82 Fahrenheit: 179\n",
+ "Celsius: 83 Fahrenheit: 181\n",
+ "Celsius: 84 Fahrenheit: 183\n",
+ "Celsius: 85 Fahrenheit: 185\n",
+ "Celsius: 86 Fahrenheit: 186\n",
+ "Celsius: 87 Fahrenheit: 188\n",
+ "Celsius: 88 Fahrenheit: 190\n",
+ "Celsius: 89 Fahrenheit: 192\n",
+ "Celsius: 90 Fahrenheit: 194\n",
+ "Celsius: 91 Fahrenheit: 195\n",
+ "Celsius: 92 Fahrenheit: 197\n",
+ "Celsius: 93 Fahrenheit: 199\n",
+ "Celsius: 94 Fahrenheit: 201\n",
+ "Celsius: 95 Fahrenheit: 203\n",
+ "Celsius: 96 Fahrenheit: 204\n",
+ "Celsius: 97 Fahrenheit: 206\n",
+ "Celsius: 98 Fahrenheit: 208\n",
+ "Celsius: 99 Fahrenheit: 210\n",
+ "Celsius: 100 Fahrenheit: 212\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +228,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 8.4, Page number: 147"
+ "source": [
+ "Example 8.4, Page number: 147"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 8.4.py\n# To count the number of 3's and 7's in an array\n\n\n# Variable declaration\nseven_count = 0\nthree_count = 0\ndata = []\n\n# Calculation\nfor i in range (0, 5) :\n x = 7\n data.append(int(x))\nprint (data)\n\nfor index in range (0, 5) :\n if data[index] == 3 :\n three_count += 1\n\n if data[index] == 7 :\n seven_count += 1\n\n# Result\nprint ('Threes %d Sevens %d' % (three_count, seven_count))",
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "seven_count = 0\n",
+ "three_count = 0\n",
+ "data = []\n",
+ "\n",
+ "# Calculation\n",
+ "for i in range (0, 5) :\n",
+ " x = 7\n",
+ " data.append(int(x))\n",
+ "print (data)\n",
+ "\n",
+ "for index in range (0, 5) :\n",
+ " if data[index] == 3 :\n",
+ " three_count += 1\n",
+ "\n",
+ " if data[index] == 7 :\n",
+ " seven_count += 1\n",
+ "\n",
+ "# Result\n",
+ "print ('Threes %d Sevens %d' % (three_count, seven_count))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[7, 7, 7, 7, 7]\nThrees 0 Sevens 5\n"
+ "text": [
+ "[7, 7, 7, 7, 7]\n",
+ "Threes 0 Sevens 5\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +276,60 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 8.6, Page number: 149"
+ "source": [
+ "Example 8.6, Page number: 149"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 8.6.py\n# To perform various arithmetic operations based on operator input by the user\n\n\n# Variable declaration\nresult = 0\ni = 0\n\n# Calculation and result\nwhile (i < 3) :\n print ('Result: %d' % result)\n operator = '-'\n value = 10\n\n if operator == 'q' or operator == 'Q' :\n break\n\n elif operator == '+' :\n result += value\n\n elif operator == '-' :\n result -= value\n\n elif operator == '*' :\n result *= value\n\n elif operator == '/' :\n if value == 0 :\n print ('Error: Divide by zero')\n print ('operation ignored') \n else :\n result /= value\n\n else :\n print ('Unknown operator %c' % operator)\n i = i + 1",
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "result = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (i < 3) :\n",
+ " print ('Result: %d' % result)\n",
+ " operator = '-'\n",
+ " value = 10\n",
+ "\n",
+ " if operator == 'q' or operator == 'Q' :\n",
+ " break\n",
+ "\n",
+ " elif operator == '+' :\n",
+ " result += value\n",
+ "\n",
+ " elif operator == '-' :\n",
+ " result -= value\n",
+ "\n",
+ " elif operator == '*' :\n",
+ " result *= value\n",
+ "\n",
+ " elif operator == '/' :\n",
+ " if value == 0 :\n",
+ " print ('Error: Divide by zero')\n",
+ " print ('operation ignored') \n",
+ " else :\n",
+ " result /= value\n",
+ "\n",
+ " else :\n",
+ " print ('Unknown operator %c' % operator)\n",
+ " i = i + 1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Result: 0\nResult: -10\nResult: -20\n"
+ "text": [
+ "Result: 0\n",
+ "Result: -10\n",
+ "Result: -20\n"
+ ]
}
],
"prompt_number": 5
@@ -121,7 +337,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Practical_C_Programming/Chapter_9_4.ipynb b/Practical_C_Programming/Chapter_9_4.ipynb
index 28d47037..8d18a77b 100644
--- a/Practical_C_Programming/Chapter_9_4.ipynb
+++ b/Practical_C_Programming/Chapter_9_4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 9"
+ "name": "",
+ "signature": "sha256:312f9e5b3211fd50ff3dd7c27b81824ed2a8d6172aff8fb27752ffb6ee205caa"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,47 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 9: Variable scope and functions"
+ "source": [
+ "Chapter 9: Variable scope and functions"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 9.1, Page number: 160"
+ "source": [
+ "Example 9.1, Page number: 160"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 9.1.py\n# To illustrate the difference between temporary and permanent variables\n\n\n# Function declaration, calculation and result\ndef func() :\n if not hasattr(func, \"permanent\") :\n func.permanent = 1\n result = func.permanent\n func.permanent += 1\n return result\n\nfor counter in range (0, 3) :\n temporary = 1\n print ('Temporary %d Permanent %d' % (temporary, func()))\n temporary += 1",
+ "input": [
+ "\n",
+ "# Function declaration, calculation and result\n",
+ "def func() :\n",
+ " if not hasattr(func, \"permanent\") :\n",
+ " func.permanent = 1\n",
+ " result = func.permanent\n",
+ " func.permanent += 1\n",
+ " return result\n",
+ "\n",
+ "for counter in range (0, 3) :\n",
+ " temporary = 1\n",
+ " print ('Temporary %d Permanent %d' % (temporary, func()))\n",
+ " temporary += 1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Temporary 1 Permanent 1\nTemporary 1 Permanent 2\nTemporary 1 Permanent 3\n"
+ "text": [
+ "Temporary 1 Permanent 1\n",
+ "Temporary 1 Permanent 2\n",
+ "Temporary 1 Permanent 3\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +61,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 9.3, Page number: 164"
+ "source": [
+ "Example 9.3, Page number: 164"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 9.3.py\n# To compute the area of a triangle\n\n\n# Function declaration, calculation and result\ndef triangle (width, height) :\n area = width * height / 2.0\n return area\n\nprint ('Triangle #1 %f' % (triangle (1.3, 8.3)))\nprint ('Triangle #2 %f' % (triangle (4.8, 9.8)))\nprint ('Triangle #3 %f' % (triangle (1.2, 2.0)))",
+ "input": [
+ "\n",
+ "\n",
+ "# Function declaration, calculation and result\n",
+ "def triangle (width, height) :\n",
+ " area = width * height / 2.0\n",
+ " return area\n",
+ "\n",
+ "print ('Triangle #1 %f' % (triangle (1.3, 8.3)))\n",
+ "print ('Triangle #2 %f' % (triangle (4.8, 9.8)))\n",
+ "print ('Triangle #3 %f' % (triangle (1.2, 2.0)))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Triangle #1 5.395000\nTriangle #2 23.520000\nTriangle #3 1.200000\n"
+ "text": [
+ "Triangle #1 5.395000\n",
+ "Triangle #2 23.520000\n",
+ "Triangle #3 1.200000\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +99,32 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 9.4, Page number: 166"
+ "source": [
+ "Example 9.4, Page number: 166"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 9.4.py\n# To compute the length of a string\n\n\n# Function declaration, calculation and result\ndef length (string) :\n return len(string)\n\nline = 'hello world' \n\nprint ('Length is: %d' % length(line))",
+ "input": [
+ "\n",
+ "# Function declaration, calculation and result\n",
+ "def length (string) :\n",
+ " return len(string)\n",
+ "\n",
+ "line = 'hello world' \n",
+ "\n",
+ "print ('Length is: %d' % length(line))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Length is: 11\n"
+ "text": [
+ "Length is: 11\n"
+ ]
}
],
"prompt_number": 4
@@ -80,19 +133,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 9.6, Page number: 170"
+ "source": [
+ "Example 9.6, Page number: 170"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 9.6.py\n# To compute the length of a string\n\n\n# Function declaration, calculation and result\ndef length (string) :\n return len(string)\n\nline = 'Steve Oualline'\n\nprint ('Length is: %d' % length(line))",
+ "input": [
+ "\n",
+ "\n",
+ "# Function declaration, calculation and result\n",
+ "def length (string) :\n",
+ " return len(string)\n",
+ "\n",
+ "line = 'Steve Oualline'\n",
+ "\n",
+ "print ('Length is: %d' % length(line))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Length is: 14\n"
+ "text": [
+ "Length is: 14\n"
+ ]
}
],
"prompt_number": 5
diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter1.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter1.ipynb
index 68dac58e..ed34729f 100644
--- a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter1.ipynb
+++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter1.ipynb
@@ -1,158 +1,165 @@
{
"metadata": {
- "name": "Chapter_1"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:9283b3273e4b25859b1f947b0b70d061842802ddcf82b087896def4a57fa123c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 1: Semiconductor Basics<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.1(a), Page Number:29<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Voltages of different models'''",
- "",
- "# variable declaration",
- "V_bias=10.0; #bias voltage in volt",
- "R_limit=1000; #limiting resistance in ohm",
- "r_d =10.0; #r_d value",
- "",
- "#calculation",
- "#IDEAL MODEL",
- "print \"IDEAL MODEL\"",
- "V_f=0; #voltage in volt",
- "I_f=V_bias/R_limit; #foward current",
- "V_R_limit=I_f*R_limit; #limiting voltage",
- "print \"forward voltage = %.2f volts\" %V_f",
- "print \"forward current = %.2f amperes\" %I_f",
- "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit",
- "",
- "#PRACTICAL MODEL",
- "print \"\\nPRACTICAL MODEL\"",
- "V_f=0.7; #voltage in volt",
- "I_f=(V_bias-V_f)/R_limit; #foward current",
- "V_R_limit=I_f*R_limit; #limiting voltage",
- "print \"forward voltage = %.2f volts\" %V_f",
- "print \"forward current = %.3f amperes\" %I_f",
- "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit",
- "",
- "#COMPLETE MODEL",
- "print \"\\nCOMPLETE MODEL\"",
- "I_f=(V_bias-0.7)/(R_limit+r_d); #foward current",
- "V_f=0.7+I_f*r_d; #forward voltage",
- "V_R_limit=I_f*R_limit; #limiting voltage",
- "print \"forward voltage = %.3f volts\" %V_f",
- "print \"forward current = %.3f amperes\" %I_f",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_bias=10.0; #bias voltage in volt\n",
+ "R_limit=1000; #limiting resistance in ohm\n",
+ "r_d =10.0; #r_d value\n",
+ "\n",
+ "#calculation\n",
+ "#IDEAL MODEL\n",
+ "print \"IDEAL MODEL\"\n",
+ "V_f=0; #voltage in volt\n",
+ "I_f=V_bias/R_limit; #foward current\n",
+ "V_R_limit=I_f*R_limit; #limiting voltage\n",
+ "print \"forward voltage = %.2f volts\" %V_f\n",
+ "print \"forward current = %.2f amperes\" %I_f\n",
+ "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit\n",
+ "\n",
+ "#PRACTICAL MODEL\n",
+ "print \"\\nPRACTICAL MODEL\"\n",
+ "V_f=0.7; #voltage in volt\n",
+ "I_f=(V_bias-V_f)/R_limit; #foward current\n",
+ "V_R_limit=I_f*R_limit; #limiting voltage\n",
+ "print \"forward voltage = %.2f volts\" %V_f\n",
+ "print \"forward current = %.3f amperes\" %I_f\n",
+ "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit\n",
+ "\n",
+ "#COMPLETE MODEL\n",
+ "print \"\\nCOMPLETE MODEL\"\n",
+ "I_f=(V_bias-0.7)/(R_limit+r_d); #foward current\n",
+ "V_f=0.7+I_f*r_d; #forward voltage\n",
+ "V_R_limit=I_f*R_limit; #limiting voltage\n",
+ "print \"forward voltage = %.3f volts\" %V_f\n",
+ "print \"forward current = %.3f amperes\" %I_f\n",
"print \"voltage across limiting resistor = %.2f volts\" %V_R_limit"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "IDEAL MODEL",
- "forward voltage = 0.00 volts",
- "forward current = 0.01 amperes",
- "voltage across limiting resistor = 10.00 volts",
- "",
- "PRACTICAL MODEL",
- "forward voltage = 0.70 volts",
- "forward current = 0.009 amperes",
- "voltage across limiting resistor = 9.30 volts",
- "",
- "COMPLETE MODEL",
- "forward voltage = 0.792 volts",
- "forward current = 0.009 amperes",
+ "IDEAL MODEL\n",
+ "forward voltage = 0.00 volts\n",
+ "forward current = 0.01 amperes\n",
+ "voltage across limiting resistor = 10.00 volts\n",
+ "\n",
+ "PRACTICAL MODEL\n",
+ "forward voltage = 0.70 volts\n",
+ "forward current = 0.009 amperes\n",
+ "voltage across limiting resistor = 9.30 volts\n",
+ "\n",
+ "COMPLETE MODEL\n",
+ "forward voltage = 0.792 volts\n",
+ "forward current = 0.009 amperes\n",
"voltage across limiting resistor = 9.21 volts"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 1.1(b), Page Number:29<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''voltages of different models'''",
- "",
- "# variable declaration",
- "V_bias=5; #bias voltage in volt",
- "I_R=1*10**-6; #current",
- "R_limit=1000 #in Ohm",
- "",
- "#calculation",
- "#IDEAL MODEL",
- "print \"IDEAL MODEL\"",
- "I_r=0.0; #current in ampere",
- "V_R=V_bias; #voltages are equal",
- "V_R_limit=I_r*R_limit; #limiting voltage",
- "print \"Reverse voltage across diode = %.2f volts\" %V_R",
- "print \"Reverse current through diode= %.2f amperes\" %I_r",
- "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit",
- "",
- "#PRACTICAL MODEL",
- "print \"\\nPRACTICAL MODEL\"",
- "I_r=0.0; #current in ampere",
- "V_R=V_bias; #voltages are equal",
- "V_R_limit=I_r*R_limit; #limiting voltage",
- "print \"Reverse voltage across diode= %.2f volts\" %V_R",
- "print \"Reverse current through diode = %.2f amperes\" %I_r",
- "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit",
- "",
- "#COMPLETE MODEL",
- "print \"\\nCOMPLETE MODEL\"",
- "I_r=I_R; #current in ampere",
- "V_R_limit=I_r*R_limit; #limiting voltage",
- "V_R=V_bias-V_R_limit; #voltage in volt",
- "print \"Reverse voltage across diode = %.3f volts\" %V_R",
- "print \"Reverse current through diode = %d micro Amp\" %(I_r*10**6)",
+ "\n",
+ "# variable declaration\n",
+ "V_bias=5; #bias voltage in volt\n",
+ "I_R=1*10**-6; #current\n",
+ "R_limit=1000 #in Ohm\n",
+ "\n",
+ "#calculation\n",
+ "#IDEAL MODEL\n",
+ "print \"IDEAL MODEL\"\n",
+ "I_r=0.0; #current in ampere\n",
+ "V_R=V_bias; #voltages are equal\n",
+ "V_R_limit=I_r*R_limit; #limiting voltage\n",
+ "print \"Reverse voltage across diode = %.2f volts\" %V_R\n",
+ "print \"Reverse current through diode= %.2f amperes\" %I_r\n",
+ "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit\n",
+ "\n",
+ "#PRACTICAL MODEL\n",
+ "print \"\\nPRACTICAL MODEL\"\n",
+ "I_r=0.0; #current in ampere\n",
+ "V_R=V_bias; #voltages are equal\n",
+ "V_R_limit=I_r*R_limit; #limiting voltage\n",
+ "print \"Reverse voltage across diode= %.2f volts\" %V_R\n",
+ "print \"Reverse current through diode = %.2f amperes\" %I_r\n",
+ "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit\n",
+ "\n",
+ "#COMPLETE MODEL\n",
+ "print \"\\nCOMPLETE MODEL\"\n",
+ "I_r=I_R; #current in ampere\n",
+ "V_R_limit=I_r*R_limit; #limiting voltage\n",
+ "V_R=V_bias-V_R_limit; #voltage in volt\n",
+ "print \"Reverse voltage across diode = %.3f volts\" %V_R\n",
+ "print \"Reverse current through diode = %d micro Amp\" %(I_r*10**6)\n",
"print \"voltage across limiting resistor = %d mV\" %(V_R_limit*1000)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "IDEAL MODEL",
- "Reverse voltage across diode = 5.00 volts",
- "Reverse current through diode= 0.00 amperes",
- "voltage across limiting resistor = 0.00 volts",
- "",
- "PRACTICAL MODEL",
- "Reverse voltage across diode= 5.00 volts",
- "Reverse current through diode = 0.00 amperes",
- "voltage across limiting resistor = 0.00 volts",
- "",
- "COMPLETE MODEL",
- "Reverse voltage across diode = 4.999 volts",
- "Reverse current through diode = 1 micro Amp",
+ "IDEAL MODEL\n",
+ "Reverse voltage across diode = 5.00 volts\n",
+ "Reverse current through diode= 0.00 amperes\n",
+ "voltage across limiting resistor = 0.00 volts\n",
+ "\n",
+ "PRACTICAL MODEL\n",
+ "Reverse voltage across diode= 5.00 volts\n",
+ "Reverse current through diode = 0.00 amperes\n",
+ "voltage across limiting resistor = 0.00 volts\n",
+ "\n",
+ "COMPLETE MODEL\n",
+ "Reverse voltage across diode = 4.999 volts\n",
+ "Reverse current through diode = 1 micro Amp\n",
"voltage across limiting resistor = 1 mV"
]
}
- ],
+ ],
"prompt_number": 2
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter2.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter2.ipynb
index 107fc334..29386b12 100644
--- a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter2.ipynb
+++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter2.ipynb
@@ -1,608 +1,640 @@
{
"metadata": {
- "name": "Chapter_2"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:07300ba6f8a24ba9874afd0fd84b4c250cf3010a844444236cfec215a9ae4d89"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 2: Diode Application<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.1, Page Number: 46<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
"%pylab inline"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "",
- "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].",
+ "\n",
+ "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
"For more information, type 'help(pylab)'."
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Average value of half wave rectifier'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "V_p=50; #Peak value is 50V",
- "",
- "#calculation",
- "V_avg=V_p/math.pi;",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "V_p=50; #Peak value is 50V\n",
+ "\n",
+ "#calculation\n",
+ "V_avg=V_p/math.pi;\n",
+ "\n",
+ "#result\n",
"print \"average value of half wave rectifier = %.2f volts\" %V_avg"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"average value of half wave rectifier = 15.92 volts"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.2(a), Page Number: 46<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' half wave rectifier output'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "#let V_in=5*sin(2*%pi*f.*t) be input wave ,hence frequency=1Hz",
- "f=1; #frequency",
- "V_p_in=5; #peak input",
- "",
- "#calculation",
- "V_pout=V_p_in-0.7; #output voltage",
- "t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f);",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "#let V_in=5*sin(2*%pi*f.*t) be input wave ,hence frequency=1Hz\n",
+ "f=1; #frequency\n",
+ "V_p_in=5; #peak input\n",
+ "\n",
+ "#calculation\n",
+ "V_pout=V_p_in-0.7; #output voltage\n",
+ "t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f);\n",
+ "\n",
+ "#result\n",
"print \"half wave rectifier output = %.2f volts\" %V_pout;"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"half wave rectifier output = 4.30 volts"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.2(b), Page Number: 46<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' half wave rectifier output'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "#let V_in=100*sin(2*%pi*f.*t) be input wave ,hence frequency=1Hz",
- "f=1; #frequency",
- "T=1/f; #time period",
- "V_p_in=100; #peak input voltage",
- "",
- "#calculation",
- "V_pout=(V_p_in-0.7); #peak output ",
- "t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f) ",
- "",
- "#result",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "#let V_in=100*sin(2*%pi*f.*t) be input wave ,hence frequency=1Hz\n",
+ "f=1; #frequency\n",
+ "T=1/f; #time period\n",
+ "V_p_in=100; #peak input voltage\n",
+ "\n",
+ "#calculation\n",
+ "V_pout=(V_p_in-0.7); #peak output \n",
+ "t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f) \n",
+ "\n",
+ "#result\n",
"print \"output of half wave rectifier = %.2f volts\" %V_pout"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"output of half wave rectifier = 99.30 volts"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.3, Page Number: 48<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Average value of half wave rectifier'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "V_p_in=156; #Peak input voltage",
- "V_p_pri=156; #Peak voltage of primary of transformer",
- "n=0.5; #Turn ratio is 2:1",
- "",
- "#calculation",
- "V_p_sec=n*V_p_pri;",
- "V_p_out=(V_p_sec-0.7); #Peak output voltage",
- "",
- "#result",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "V_p_in=156; #Peak input voltage\n",
+ "V_p_pri=156; #Peak voltage of primary of transformer\n",
+ "n=0.5; #Turn ratio is 2:1\n",
+ "\n",
+ "#calculation\n",
+ "V_p_sec=n*V_p_pri;\n",
+ "V_p_out=(V_p_sec-0.7); #Peak output voltage\n",
+ "\n",
+ "#result\n",
"print \"peak output voltage of half wave rectifier = %.1f volts\" %V_p_out"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"peak output voltage of half wave rectifier = 77.3 volts"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.4, Page Number: 49<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Average value of full wave rectifier'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "V_p=15; #Peak voltage in volt",
- "",
- "#calculation",
- "V_avg=(2*V_p)/math.pi;",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "V_p=15; #Peak voltage in volt\n",
+ "\n",
+ "#calculation\n",
+ "V_avg=(2*V_p)/math.pi;\n",
+ "\n",
+ "#result\n",
"print \"Average value of output of full wave rectifier = %.2f volts\" %V_avg"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Average value of output of full wave rectifier = 9.55 volts"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.5, Page Number: 52<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''PIV full wave'''",
- "",
- "V_p_pri=100.0; #Peak voltage across primary winding",
- "n=1.0/2; #tun ratio is 2:1",
- "V_p_sec=n*V_p_pri;",
- "V_sec=V_p_sec/2; #voltage across each secondary is half the total voltage",
- "V_pout=V_sec-0.7;",
- "",
- "print('full wave rectifier output voltage = %f V'%V_pout)",
- "PIV=2*V_pout+0.7;",
+ "\n",
+ "\n",
+ "V_p_pri=100.0; #Peak voltage across primary winding\n",
+ "n=1.0/2; #tun ratio is 2:1\n",
+ "V_p_sec=n*V_p_pri;\n",
+ "V_sec=V_p_sec/2; #voltage across each secondary is half the total voltage\n",
+ "V_pout=V_sec-0.7;\n",
+ "\n",
+ "print('full wave rectifier output voltage = %f V'%V_pout)\n",
+ "PIV=2*V_pout+0.7;\n",
"print('PIV = %fV'%PIV)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "full wave rectifier output voltage = 24.300000 V",
+ "full wave rectifier output voltage = 24.300000 V\n",
"PIV = 49.300000V"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.6, Page Number: 54<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Peak voltage of diode'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "V_rms=12.0; #rms secondary voltage",
- "",
- "#calculation",
- "V_p_sec=math.sqrt(2)*V_rms; #peak secondary voltage",
- "V_th=0.7; #knee voltage of diode",
- "V_p_out=V_p_sec-2*V_th; #in one cycle, 2 diodes conduct",
- "PIV=V_p_out+V_th; #applying KVL",
- "",
- "#result",
- "print \"Peak output voltage = %.2f volt\" %V_p_out",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "V_rms=12.0; #rms secondary voltage\n",
+ "\n",
+ "#calculation\n",
+ "V_p_sec=math.sqrt(2)*V_rms; #peak secondary voltage\n",
+ "V_th=0.7; #knee voltage of diode\n",
+ "V_p_out=V_p_sec-2*V_th; #in one cycle, 2 diodes conduct\n",
+ "PIV=V_p_out+V_th; #applying KVL\n",
+ "\n",
+ "#result\n",
+ "print \"Peak output voltage = %.2f volt\" %V_p_out\n",
"print \"PIV across each diode = %.2f volt\" %PIV"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Peak output voltage = 15.57 volt",
+ "Peak output voltage = 15.57 volt\n",
"PIV across each diode = 16.27 volt"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.7, Page Number: 58<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Ripple Factor'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "R_l=2200; #load resistance in Ohm",
- "C=50*10**-6; #capacitance in Farad",
- "V_rms=115; #rms of primary",
- "",
- "#calculation",
- "V_p_pri=math.sqrt(2)*V_rms; #peak voltage across primary",
- "n=0.1; #turn ratio is 10:1",
- "V_p_sec=n*V_p_pri; #primary voltage across secondary",
- "V_p_rect=V_p_sec-1.4 #unfiltered peak rectified voltage",
- "#we subtract 1.4 because in each cycle 2 diodes conduct & 2 do not",
- "f=120; #frequency of full wave rectified voltage",
- "V_r_pp=(1/(f*R_l*C))*V_p_rect; #peak to peak ripple voltage",
- "V_DC=(1-(1/(2*f*R_l*C)))*V_p_rect;",
- "r=V_r_pp/V_DC;",
- "",
- "#result",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "R_l=2200; #load resistance in Ohm\n",
+ "C=50*10**-6; #capacitance in Farad\n",
+ "V_rms=115; #rms of primary\n",
+ "\n",
+ "#calculation\n",
+ "V_p_pri=math.sqrt(2)*V_rms; #peak voltage across primary\n",
+ "n=0.1; #turn ratio is 10:1\n",
+ "V_p_sec=n*V_p_pri; #primary voltage across secondary\n",
+ "V_p_rect=V_p_sec-1.4 #unfiltered peak rectified voltage\n",
+ "#we subtract 1.4 because in each cycle 2 diodes conduct & 2 do not\n",
+ "f=120; #frequency of full wave rectified voltage\n",
+ "V_r_pp=(1/(f*R_l*C))*V_p_rect; #peak to peak ripple voltage\n",
+ "V_DC=(1-(1/(2*f*R_l*C)))*V_p_rect;\n",
+ "r=V_r_pp/V_DC;\n",
+ "\n",
+ "#result\n",
"print \"Ripple factor = %.3f \" %r"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Ripple factor = 0.079 "
]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.8, Page Number: 62<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Min & Max voltage'''",
- "",
- "import math",
- "",
- "# variable declaration",
- "V_REF=1.25; #in volts",
- "V_R1=V_REF; #voltage in volt",
- "R1=220.0; #in ohms",
- "I_ADJ=50*10**-6 #in amperes",
- "",
- "#calculation",
- "# MAX VALUE OF R2=5000 Ohms",
- "R2_min=0.0; #min resistance",
- "V_out_min=V_REF*(1+(R2_min/R1))+I_ADJ*R2_min;",
- "R2_max=5000.0; #max value of resistance",
- "V_out_max=V_REF*(1+(R2_max/R1))+I_ADJ*R2_max;",
- "",
- "#result",
- "print \"minimum output voltage = %.2f volt\" %V_out_min",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# variable declaration\n",
+ "V_REF=1.25; #in volts\n",
+ "V_R1=V_REF; #voltage in volt\n",
+ "R1=220.0; #in ohms\n",
+ "I_ADJ=50*10**-6 #in amperes\n",
+ "\n",
+ "#calculation\n",
+ "# MAX VALUE OF R2=5000 Ohms\n",
+ "R2_min=0.0; #min resistance\n",
+ "V_out_min=V_REF*(1+(R2_min/R1))+I_ADJ*R2_min;\n",
+ "R2_max=5000.0; #max value of resistance\n",
+ "V_out_max=V_REF*(1+(R2_max/R1))+I_ADJ*R2_max;\n",
+ "\n",
+ "#result\n",
+ "print \"minimum output voltage = %.2f volt\" %V_out_min\n",
"print \"maximum output voltage = %.2f volt\" %V_out_max"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "minimum output voltage = 1.25 volt",
+ "minimum output voltage = 1.25 volt\n",
"maximum output voltage = 29.91 volt"
]
}
- ],
+ ],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.9,Page Number: 64<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Load regulation percentage'''",
- "",
- "V_NL=5.18 #No load output voltage",
- "V_FL=5.15 #Full load output voltage",
- "load_reg=((V_NL-V_FL)/V_FL)*100 #In percentage",
+ "\n",
+ "\n",
+ "V_NL=5.18 #No load output voltage\n",
+ "V_FL=5.15 #Full load output voltage\n",
+ "load_reg=((V_NL-V_FL)/V_FL)*100 #In percentage\n",
"print('load regulation percent = %.2f%% '%load_reg)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"load regulation percent = 0.58% "
]
}
- ],
+ ],
"prompt_number": 11
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.10, Page Number: 66<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Negative diode limiter'''",
- "",
- "import pylab as py",
- "import numpy as np",
- "",
- "#let input wave be V_in=V_p_in*sin(2*%pi*f*t) ",
- "f=1.0; #Frequency is 1Hz",
- "T=1/f;",
- "R_1=100.0; #Resistances in ohms",
- "R_L=1000.0; #Load",
- "V_p_in=10.0; #Peak input voltage",
- "V_th=0.7; #knee voltage of diode",
- "",
- "V_p_out=V_p_in*(R_L/(R_L+R_1)); #peak output voltage",
- "print('peak output voltage = %.2f V'%V_p_out)",
- "",
- "t = np.arange(0, 3.5 , 0.0005)",
- "z=V_p_in*np.sin(2*np.pi*f*t)*(R_L/(R_L+R_1))",
- "",
- "subplot(211)",
- "plot(t,z)",
- "ylim(-9.09,9.09)",
- "title('Input Voltage Waveform')",
- "",
- "subplot(212)",
- "plot(t,z)",
- "ylim(-0.07,9.09)",
+ "\n",
+ "import pylab as py\n",
+ "import numpy as np\n",
+ "\n",
+ "#let input wave be V_in=V_p_in*sin(2*%pi*f*t) \n",
+ "f=1.0; #Frequency is 1Hz\n",
+ "T=1/f;\n",
+ "R_1=100.0; #Resistances in ohms\n",
+ "R_L=1000.0; #Load\n",
+ "V_p_in=10.0; #Peak input voltage\n",
+ "V_th=0.7; #knee voltage of diode\n",
+ "\n",
+ "V_p_out=V_p_in*(R_L/(R_L+R_1)); #peak output voltage\n",
+ "print('peak output voltage = %.2f V'%V_p_out)\n",
+ "\n",
+ "t = np.arange(0, 3.5 , 0.0005)\n",
+ "z=V_p_in*np.sin(2*np.pi*f*t)*(R_L/(R_L+R_1))\n",
+ "\n",
+ "subplot(211)\n",
+ "plot(t,z)\n",
+ "ylim(-9.09,9.09)\n",
+ "title('Input Voltage Waveform')\n",
+ "\n",
+ "subplot(212)\n",
+ "plot(t,z)\n",
+ "ylim(-0.07,9.09)\n",
"title('Output Voltage Waveform')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"peak output voltage = 9.09 V"
]
- },
+ },
{
- "output_type": "pyout",
- "prompt_number": 12,
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 12,
"text": [
"<matplotlib.text.Text at 0xa3bf44c>"
]
- },
+ },
{
- "output_type": "display_data",
+ "metadata": {},
+ "output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEICAYAAACgQWTXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXl4TNcbx78TiSWWiC1kIYgtliSEoEJCa21SlFoqYqvu\npTtKaavtT1vVhaou9tpVaZFaakpjJ4RErImEBIkQ2cgy5/fHa0YSk2Qy9965986cz/N4Hpm5c86b\nd06+973vOec9GsYYA4fD4XCsAju5DeBwOByOeHBR53A4HCuCizqHw+FYEVzUORwOx4rgos7hcDhW\nBBd1DofDsSK4qHMUj1arhYeHh9xmKIbc3FyEhISgdu3aGDFihNzmcBQGF3Urx9PTE3v37pW8nzlz\n5iAsLKzU9/v374/Zs2c/9vrWrVvRqFEj6HQ6k/vy9PTEP//8Y5adQli7di28vb2LvfbUU08ZfW3e\nvHmS2bFp0ybcunUL6enpWL9+vWT9cNQJF3UrR6PRQKPRyG0Gxo0bh9WrVz/2+qpVqzBmzBjY2Zk+\nFDUaDeTYM9ezZ0/ExcXh9u3bAICCggKcPn0a9+/fR1pamuG1w4cPo1evXpLZcfXqVbRs2bJCPtNT\nUFAggUUcRcE4Vo2npyfbu3cvY4yxZcuWsSeeeIK98847zNnZmTVt2pTt3LnTcG2vXr3YtGnTWJcu\nXVitWrXYM888w9LT0xljjO3bt4+5u7sXa7tJkyZsz549bOfOnaxy5crMwcGB1ahRg/n6+j5mR05O\nDnNycmL79+83vJaens6qVq3KoqOj2f3799mUKVOYq6src3V1ZVOnTmUPHjx4rO8xY8YwOzs7Vq1a\nNVajRg325ZdfMsYYGzZsGGvYsCFzcnJiPXv2ZDExMYZ+0tLS2NNPP81q1arFOnfuzD744APWo0cP\nw/vnzp1jTz75JKtTpw5r1aoV27BhQ6n+bN68Odu8eTNjjLEjR46w4OBgNm7cuGKvOTo6soKCAvbX\nX38xX19fVqtWLebh4cHmzJ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/fpBq9U+tmtdyb4vz35z/C84\nUjdlE1LJa65duwY3NzehXYuCKfbXrFnT8Jg0YMAA5OfnI10lRWGU7HtTUIPv8/Pz8eyzz2LMmDEY\nPHjwY+8r+Tsoz3Y1+B8AnJycMGjQIBw/frzY60r2fVFKs98c/wsWdVM2IYWGhmLlypUAgMOHD6N2\n7dpwcXER2rUomGL/zZs3DXf7o0ePgjFmNPelRJTse1NQuu8ZY5g4cSK8vb0xdepUo9co9TswxXYl\n+z8tLQ13794FAOTm5mL37t3w8/Mrdo1SfQ+YZr85/hecfiltE9KSJUsAAC+++CIGDhyIHTt2wMvL\nC9WrV8eyZcuEdisapti/adMmLF68GPb29nB0dMS6detktvoRo0aNwr///ou0tDR4eHjgo48+Qv7D\nE7OV7nugfPuV7HsAiIyMxOrVq9GhQwfDH+Rnn32GxMREAMr+DkyxXcn+T0lJQXh4OHQ6HXQ6HcLC\nwtCnTx/VaI8p9pvjf775iMPhcKwIyY+z43A4HI7l4KLO4XA4VgQXdQ6Hw7EiuKhzOByOFcFFncPh\ncKwILuocDodjRfwfUaYhEUjyJ+wAAAAASUVORK5CYII=\n"
}
- ],
+ ],
"prompt_number": 12
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.11, Page Number: 67<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Positive and negative Diode limiter'''",
- "",
- "#from pylab import figure, show",
- "#from numpy import arange, sin, pi,bool",
- "#import numpy as np",
- "import pylab as py",
- "import numpy as np",
- "#let input wave be V_in=V_p_in*sin(2*%pi*f*t) ",
- "f=1.0; #Frequency is 1Hz",
- "T=1/f;",
- "V_p_in=10; #Peak input voltage",
- "V_th=0.7; #knee voltage of diode",
- "print('max output voltage is 5.7V')",
- "print('min output voltage is -5.7V')",
- "",
- "###############GRAPH Plotting#################################",
- "t = arange(0.0,4.5,0.0005)",
- "V_in=V_p_in*sin(2*pi*f*t);",
- "",
- "Vout=V_in;",
- "#fig = figure(2)",
- "subplot(211)",
- "plot(t,V_in)",
- "#ax2.grid(True)",
- "ylim( (-10,10) )",
- "title('Input to the +ve and -ve diode limiter ')",
- "subplot(212)",
- "plot(t,V_in)",
- "#ax1.grid(True)",
- "ylim( (-5.7,5.7) )",
- "title('Output of +ve and -ve diode limiter')",
+ "\n",
+ "\n",
+ "#from pylab import figure, show\n",
+ "#from numpy import arange, sin, pi,bool\n",
+ "#import numpy as np\n",
+ "import pylab as py\n",
+ "import numpy as np\n",
+ "#let input wave be V_in=V_p_in*sin(2*%pi*f*t) \n",
+ "f=1.0; #Frequency is 1Hz\n",
+ "T=1/f;\n",
+ "V_p_in=10; #Peak input voltage\n",
+ "V_th=0.7; #knee voltage of diode\n",
+ "print('max output voltage is 5.7V')\n",
+ "print('min output voltage is -5.7V')\n",
+ "\n",
+ "###############GRAPH Plotting#################################\n",
+ "t = arange(0.0,4.5,0.0005)\n",
+ "V_in=V_p_in*sin(2*pi*f*t);\n",
+ "\n",
+ "Vout=V_in;\n",
+ "#fig = figure(2)\n",
+ "subplot(211)\n",
+ "plot(t,V_in)\n",
+ "#ax2.grid(True)\n",
+ "ylim( (-10,10) )\n",
+ "title('Input to the +ve and -ve diode limiter ')\n",
+ "subplot(212)\n",
+ "plot(t,V_in)\n",
+ "#ax1.grid(True)\n",
+ "ylim( (-5.7,5.7) )\n",
+ "title('Output of +ve and -ve diode limiter')\n",
" "
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "max output voltage is 5.7V",
+ "max output voltage is 5.7V\n",
"min output voltage is -5.7V"
]
- },
+ },
{
- "output_type": "pyout",
- "prompt_number": 13,
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 13,
"text": [
"<matplotlib.text.Text at 0xa6c976c>"
]
- },
+ },
{
- "output_type": "display_data",
+ "metadata": {},
+ "output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEICAYAAAC+iFRkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzsnXlYldX2x7+HQQFBZJBZZlBBRcxEUxI0BxxKsxRNzbK5\nvJm3uln5E7uledUGs8G6XdHMuUFTwhGcUKkky1lGmcUEZZLhnP37Y3eODOfAyznvsN/j+3keHuWc\n9+y9zmLt9a537b3XVhFCCBQUFBQUzBoLqQVQUFBQUBAexdkrKCgo3AUozl5BQUHhLkBx9goKCgp3\nAYqzV1BQULgLUJy9goKCwl2A4uwVOJOamooePXpILQYTzJkzB4sWLZJaDMTExODrr78GAHz77bcY\nM2aMUe0kJCRg1qxZRn3W398fhw4dAgAsXboUTz/9tFHtmCK/Qvsozp5n/P39cfDgQcH74TI4mw5C\nY7CwsEB2drbRnzdnVCoVVCqV1GI0k+Oxxx7D3r17jW7HFBm0vPnmm/jqq6+Maqel/Ir98Yvi7HmG\nFScAUFlM3TMn1p47Cwv5maKyH1F4jNVxY2Mjz5LIH/mNMBmRmJiIYcOG4bXXXoOzszMCAwORnJys\nez8mJgYLFy5EVFQUHB0dMWnSJJSXlwPQnzLRPjUkJydj2bJl2Lp1KxwcHBAZGdmq71mzZuHq1auY\nOHEiHBwcsHLlSgDArl27EB4eDicnJ8TGxuLixYt6Zb///vsBABEREXBwcMD27dt1733wwQdwd3eH\nl5cXEhMTda/X1dXh1VdfhZ+fHzw8PPD888/j9u3bxinv7/a6deuGc+fO6V4rKyuDnZ0drl+/DgDY\nvXs3+vfvDycnJwwdOhR//vmnwfZefvll+Pr6wtHREQMHDsSxY8d07yUkJGDq1Kl4/PHH0bVrV/Tp\n0we//fab7v2MjAwMGDAAXbt2RXx8POfvxfd32L9/P3r16oVu3bph3rx5zZxhYmIioqOjdb+npaXh\n3nvvRbdu3TBo0CCcOHFC915OTg6GDx+Orl27YvTo0TpZtJw8e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5+fBpcdBjy2sKCgrg7e0tqUwODg66x824uDg0NDTgxo0bgsnUHmLr\niCtS6amhoQFTpkzBzJkz9Rq5FPpqTyYpbcrR0RHjx4/Hr7/+2ux1Ke3KkExi6yktLQ27du1CQEAA\npk+fjkOHDmH27NnNrhFbT1xkMkpPxk8ftE9DQwMJDAwkOTk5pK6urt0J2hMnTgg++cFFppKSEqLR\naAghhJw6dYr4+fkJKhMhhOTk5HCaoBVDR1zlkkJPGo2GzJo1i8yfP9/gNWLri4tMYuuqrKyMlJeX\nE0IIqampIdHR0eTAgQPNrhFbT1xkksKmtKSmppIJEya0el3K8WdIJmP0JGi5BCsrK6xZswZjxoyB\nWq3G3Llz0bt3b6xduxYA8Oyzz2LcuHFISkpCcHAwunTpgnXr1gkpEieZduzYgc8//xxWVlaws7PD\nli1bBJVp+vTpOHz4MK5fv44ePXpgyZIlaGho0Mkjto64yiW2ngDg+PHj2LhxI/r164fIyEgAwNKl\nS3H16lWdXGLri4tMYuuquLgYj/9/O3dsAkAMQgHU3ZwjZP8l5KqDlOGKs/C9CUSSXwi6d1RVVFWs\ntSIzW//eTU0db+r0jmc6+3RT05c+tRxCA+BfNmgBBhD2AAMIe4ABhD3AAMIeYABhDzDAAwJBIdo4\nx/PeAAAAAElFTkSuQmCC\n"
}
- ],
+ ],
"prompt_number": 13
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.12, Page Number: 76<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Positive diode limiter'''",
- "",
- "#variable declaration",
- "V_p_in=18.0; #peak input voltage is 18V",
- "V_supply=12.0;",
- "R2=100.0;",
- "R3=220.0; #resistances in ohms",
- "#calculation",
- "V_bias=V_supply*(R3/(R2+R3));",
- "",
- "#result",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "V_p_in=18.0; #peak input voltage is 18V\n",
+ "V_supply=12.0;\n",
+ "R2=100.0;\n",
+ "R3=220.0; #resistances in ohms\n",
+ "#calculation\n",
+ "V_bias=V_supply*(R3/(R2+R3));\n",
+ "\n",
+ "#result\n",
"print('diode limiting the voltage at this voltage =%fV'%V_bias)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"diode limiting the voltage at this voltage =8.250000V"
]
}
- ],
+ ],
"prompt_number": 14
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 2.13, Page Number: 78<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Negative Clamping circuit'''",
- "",
- "V_p_in=24.0;",
- "V_DC=-(V_p_in-0.7); #DC level added to output",
+ "\n",
+ "\n",
+ "V_p_in=24.0;\n",
+ "V_DC=-(V_p_in-0.7); #DC level added to output\n",
"print('V_DC = %.1fV'%V_DC)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"V_DC = -23.3V"
]
}
- ],
+ ],
"prompt_number": 15
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter3.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter3.ipynb
index 41e63a83..c21cf09b 100644
--- a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter3.ipynb
+++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter3.ipynb
@@ -1,377 +1,396 @@
{
"metadata": {
- "name": "Chapter_3"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:7d54e3690fc412ff890e6ea2f39f46cb8c03d3ea660ea034447f2497647b95ed"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 3: Special-purpose Diodes<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.1, Page Number:88<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
"%pylab inline"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "",
- "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].",
+ "\n",
+ "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
"For more information, type 'help(pylab)'."
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find Zener Impedence'''",
- "",
- "# variable declaration",
- "delVZ=50*10**-3; #voltage in volts, from graph",
- "delIZ=5*10**-3; #current in amperes, from rgraph",
- "",
- "#calculation",
- "ZZ=delVZ/delIZ; #zener impedence",
- "",
- "# result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "delVZ=50*10**-3; #voltage in volts, from graph\n",
+ "delIZ=5*10**-3; #current in amperes, from rgraph\n",
+ "\n",
+ "#calculation\n",
+ "ZZ=delVZ/delIZ; #zener impedence\n",
+ "\n",
+ "# result\n",
"print \"zener impedance = %d ohm \" %ZZ"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"zener impedance = 10 ohm "
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.2, Page Number:89<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Voltage accross zener terminals'''",
- "",
- "# variable declaration",
- "I_ZT=37*10**-3; #IN AMPERES",
- "V_ZT=6.80; #IN VOLTS",
- "Z_ZT=3.50; #IN OHMS",
- "I_Z=50*10**-3; #IN AMPERES",
- "",
- "#calculation",
- "DEL_I_Z=I_Z-I_ZT; #change current",
- "DEL_V_Z=DEL_I_Z*Z_ZT; #change voltage",
- "V_Z=V_ZT+DEL_V_Z; #voltage across zener terminals",
- "print \"voltage across zener terminals when current is 50 mA = %.3f volts\" %V_Z",
- "I_Z=25*10**-3; #IN AMPERES",
- "DEL_I_Z=I_Z-I_ZT; #change current",
- "DEL_V_Z=DEL_I_Z*Z_ZT; #change voltage",
- "V_Z=V_ZT+DEL_V_Z; #voltage across zener terminals",
- "",
- "#result",
+ "\n",
+ "# variable declaration\n",
+ "I_ZT=37*10**-3; #IN AMPERES\n",
+ "V_ZT=6.80; #IN VOLTS\n",
+ "Z_ZT=3.50; #IN OHMS\n",
+ "I_Z=50*10**-3; #IN AMPERES\n",
+ "\n",
+ "#calculation\n",
+ "DEL_I_Z=I_Z-I_ZT; #change current\n",
+ "DEL_V_Z=DEL_I_Z*Z_ZT; #change voltage\n",
+ "V_Z=V_ZT+DEL_V_Z; #voltage across zener terminals\n",
+ "print \"voltage across zener terminals when current is 50 mA = %.3f volts\" %V_Z\n",
+ "I_Z=25*10**-3; #IN AMPERES\n",
+ "DEL_I_Z=I_Z-I_ZT; #change current\n",
+ "DEL_V_Z=DEL_I_Z*Z_ZT; #change voltage\n",
+ "V_Z=V_ZT+DEL_V_Z; #voltage across zener terminals\n",
+ "\n",
+ "#result\n",
"print \"voltage across zener terminals when current is 25 mA = %.3f volts\" %V_Z"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "voltage across zener terminals when current is 50 mA = 6.845 volts",
+ "voltage across zener terminals when current is 50 mA = 6.845 volts\n",
"voltage across zener terminals when current is 25 mA = 6.758 volts"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.3, Page Number:90<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Zener Voltage'''",
- "",
- "# variable declaration",
- "V_Z=8.2; #8.2 volt zener diode",
- "TC=0.0005; #Temperature coefficient (per degree celsius)",
- "T1=60; #Temperature 1 in celsius",
- "T2=25; #Temperature 2 in celsius",
- "",
- "#calculation",
- "DEL_T=T1-T2; #change in temp",
- "del_V_Z=V_Z*TC*DEL_T; #change in voltage",
- "voltage=V_Z+del_V_Z; #zener voltage",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_Z=8.2; #8.2 volt zener diode\n",
+ "TC=0.0005; #Temperature coefficient (per degree celsius)\n",
+ "T1=60; #Temperature 1 in celsius\n",
+ "T2=25; #Temperature 2 in celsius\n",
+ "\n",
+ "#calculation\n",
+ "DEL_T=T1-T2; #change in temp\n",
+ "del_V_Z=V_Z*TC*DEL_T; #change in voltage\n",
+ "voltage=V_Z+del_V_Z; #zener voltage\n",
+ "\n",
+ "#result\n",
"print \"zener voltage at 60 degree celsius = %.3f volt\" %voltage"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"zener voltage at 60 degree celsius = 8.343 volt"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.4, Page Number:90<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Power dissipation'''",
- "",
- "# variable declaration",
- "P_D_max=400*10**-3; #power in watts",
- "df=3.2*10**-3 #derating factor in watts per celsius",
- "del_T=(90-50); #in celsius, temperature difference",
- "",
- "#calculation",
- "P_D_deru=P_D_max-df*del_T; #power dissipated",
- "P_D_der=P_D_deru*1000;",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "P_D_max=400*10**-3; #power in watts\n",
+ "df=3.2*10**-3 #derating factor in watts per celsius\n",
+ "del_T=(90-50); #in celsius, temperature difference\n",
+ "\n",
+ "#calculation\n",
+ "P_D_deru=P_D_max-df*del_T; #power dissipated\n",
+ "P_D_der=P_D_deru*1000;\n",
+ "\n",
+ "#result\n",
"print \"maximum power dissipated at 90 degree celsius = %d mW\" %P_D_der"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"maximum power dissipated at 90 degree celsius = 272 mW"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.5, Page Number: 92<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Zener Diode voltage regulation'''",
- "",
- "# variable declaration",
- "V_Z=5.1;",
- "I_ZT=49*10**-3;",
- "I_ZK=1*10**-3;",
- "Z_Z=7;",
- "R=100;",
- "P_D_max=1;",
- "",
- "#calculation",
- "V_out=V_Z-(I_ZT-I_ZK)*Z_Z; #output voltage at I_ZK",
- "V_IN_min=I_ZK*R+V_out; #input voltage",
- "I_ZM=P_D_max/V_Z; #current",
- "V_out=V_Z+(I_ZM-I_ZT)*Z_Z; #output voltage at I_ZM",
- "V_IN_max=I_ZM*R+V_out; #max input voltage",
- "",
- "#result",
- "print \"maximum input voltage regulated by zener diode = %.3f volts\" %V_IN_max",
+ "\n",
+ "# variable declaration\n",
+ "V_Z=5.1;\n",
+ "I_ZT=49*10**-3;\n",
+ "I_ZK=1*10**-3;\n",
+ "Z_Z=7;\n",
+ "R=100;\n",
+ "P_D_max=1;\n",
+ "\n",
+ "#calculation\n",
+ "V_out=V_Z-(I_ZT-I_ZK)*Z_Z; #output voltage at I_ZK\n",
+ "V_IN_min=I_ZK*R+V_out; #input voltage\n",
+ "I_ZM=P_D_max/V_Z; #current\n",
+ "V_out=V_Z+(I_ZM-I_ZT)*Z_Z; #output voltage at I_ZM\n",
+ "V_IN_max=I_ZM*R+V_out; #max input voltage\n",
+ "\n",
+ "#result\n",
+ "print \"maximum input voltage regulated by zener diode = %.3f volts\" %V_IN_max\n",
"print \"minimum input voltage regulated by zener diode = %.3f volts\" %V_IN_min"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "maximum input voltage regulated by zener diode = 25.737 volts",
+ "maximum input voltage regulated by zener diode = 25.737 volts\n",
"minimum input voltage regulated by zener diode = 4.864 volts"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.6, Page Number: 93<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Min & Max current'''",
- "",
- "# variable declaration",
- "V_Z=12.0; #voltage in volt",
- "V_IN=24.0; #ip voltage in volt",
- "I_ZK=0.001; #current in ampere",
- "I_ZM=0.050; #current in ampere ",
- "Z_Z=0; #impedence",
- "R=470; #resistance in ohm",
- "",
- "#calculation",
- "#when I_L=0, I_Z is max and is equal to the total circuit current I_T",
- "I_T=(V_IN-V_Z)/R; #current",
- "I_Z_max=I_T; #max current",
- "if I_Z_max<I_ZM : # condition for min currert ",
- " I_L_min=0;",
- "",
- "I_L_max=I_T-I_ZK; #max current",
- "R_L_min=V_Z/I_L_max; #min resistance",
- "",
- "#result",
- "print \"minimum value of load resistance = %.2f ohm\" %R_L_min",
- "print \"minimum curent = %.3f ampere\" %I_L_min",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_Z=12.0; #voltage in volt\n",
+ "V_IN=24.0; #ip voltage in volt\n",
+ "I_ZK=0.001; #current in ampere\n",
+ "I_ZM=0.050; #current in ampere \n",
+ "Z_Z=0; #impedence\n",
+ "R=470; #resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "#when I_L=0, I_Z is max and is equal to the total circuit current I_T\n",
+ "I_T=(V_IN-V_Z)/R; #current\n",
+ "I_Z_max=I_T; #max current\n",
+ "if I_Z_max<I_ZM : # condition for min currert \n",
+ " I_L_min=0;\n",
+ "\n",
+ "I_L_max=I_T-I_ZK; #max current\n",
+ "R_L_min=V_Z/I_L_max; #min resistance\n",
+ "\n",
+ "#result\n",
+ "print \"minimum value of load resistance = %.2f ohm\" %R_L_min\n",
+ "print \"minimum curent = %.3f ampere\" %I_L_min\n",
"print \"maximum curent = %.3f ampere\" %I_L_max"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "minimum value of load resistance = 489.16 ohm",
- "minimum curent = 0.000 ampere",
+ "minimum value of load resistance = 489.16 ohm\n",
+ "minimum curent = 0.000 ampere\n",
"maximum curent = 0.025 ampere"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.7, Page Number: 94<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' to find load resistance'''",
- "",
- "# variable declaration",
- "V_IN=24.0; #voltage in volt",
- "V_Z=15.0; #voltage in volt",
- "I_ZK=0.25*10**-3; #current in ampere",
- "I_ZT=17*10**-3; #current in ampere",
- "Z_ZT=14.0; #impedence",
- "P_D_max=1.0; #max power dissipation",
- "",
- "#calculation",
- "V_out_1=V_Z-(I_ZT-I_ZK)*Z_ZT; #output voltage at I_ZK",
- "print \"output voltage at I_ZK = %.2f volt\" %V_out_1",
- "I_ZM=P_D_max/V_Z;",
- "",
- "V_out_2=V_Z+(I_ZM-I_ZT)*Z_ZT; #output voltage at I_ZM",
- "print \"output voltage a I_ZM = %.2f volt\" %V_out_2",
- "R=(V_IN-V_out_2)/I_ZM; #resistance",
- "print \"value of R for maximum zener current, no load = %.2f ohm\" %R",
- "print \"closest practical value is 130 ohms\"",
- "R=130.0;",
- "#for minimum load resistance(max load current) zener current is minimum (I_ZK)",
- "I_T=(V_IN-V_out_1)/R; #current",
- "I_L=I_T-I_ZK; #current",
- "R_L_min=V_out_1/I_L; #minimum load resistance",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_IN=24.0; #voltage in volt\n",
+ "V_Z=15.0; #voltage in volt\n",
+ "I_ZK=0.25*10**-3; #current in ampere\n",
+ "I_ZT=17*10**-3; #current in ampere\n",
+ "Z_ZT=14.0; #impedence\n",
+ "P_D_max=1.0; #max power dissipation\n",
+ "\n",
+ "#calculation\n",
+ "V_out_1=V_Z-(I_ZT-I_ZK)*Z_ZT; #output voltage at I_ZK\n",
+ "print \"output voltage at I_ZK = %.2f volt\" %V_out_1\n",
+ "I_ZM=P_D_max/V_Z;\n",
+ "\n",
+ "V_out_2=V_Z+(I_ZM-I_ZT)*Z_ZT; #output voltage at I_ZM\n",
+ "print \"output voltage a I_ZM = %.2f volt\" %V_out_2\n",
+ "R=(V_IN-V_out_2)/I_ZM; #resistance\n",
+ "print \"value of R for maximum zener current, no load = %.2f ohm\" %R\n",
+ "print \"closest practical value is 130 ohms\"\n",
+ "R=130.0;\n",
+ "#for minimum load resistance(max load current) zener current is minimum (I_ZK)\n",
+ "I_T=(V_IN-V_out_1)/R; #current\n",
+ "I_L=I_T-I_ZK; #current\n",
+ "R_L_min=V_out_1/I_L; #minimum load resistance\n",
+ "\n",
+ "#result\n",
"print \"minimum load resistance = %.2f ohm\" %R_L_min"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "output voltage at I_ZK = 14.77 volt",
- "output voltage a I_ZM = 15.70 volt",
- "value of R for maximum zener current, no load = 124.57 ohm",
- "closest practical value is 130 ohms",
+ "output voltage at I_ZK = 14.77 volt\n",
+ "output voltage a I_ZM = 15.70 volt\n",
+ "value of R for maximum zener current, no load = 124.57 ohm\n",
+ "closest practical value is 130 ohms\n",
"minimum load resistance = 208.60 ohm"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 3.8, Page Number: 96<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Zener limiting'''",
- "",
- "#variable declaration",
- "V_p_in=10.0; #Peak input voltage",
- "V_th=0.7; #forward biased zener",
- "V_Z1=5.1;",
- "V_Z2=3.3;",
- "",
- "V_p_in=20.0;",
- "V_Z1=6.2;",
- "V_Z2=15.0;",
- "",
- "#result",
- "print('max voltage = %.1f V'%(V_Z1+V_th))",
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "V_p_in=10.0; #Peak input voltage\n",
+ "V_th=0.7; #forward biased zener\n",
+ "V_Z1=5.1;\n",
+ "V_Z2=3.3;\n",
+ "\n",
+ "V_p_in=20.0;\n",
+ "V_Z1=6.2;\n",
+ "V_Z2=15.0;\n",
+ "\n",
+ "#result\n",
+ "print('max voltage = %.1f V'%(V_Z1+V_th))\n",
"print('min voltage = %.1f V'%(-(V_Z2+V_th)))"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "max voltage = 6.9 V",
+ "max voltage = 6.9 V\n",
"min voltage = -15.7 V"
]
}
- ],
+ ],
"prompt_number": 9
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter4.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter4.ipynb
index b76b7b18..7f91e8cf 100644
--- a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter4.ipynb
+++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter4.ipynb
@@ -1,455 +1,477 @@
{
"metadata": {
- "name": "Chapter_4"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:5816ca33fc73880418c1590a9abffc6f1191d50c49e2df9568303f79019acd1c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 4: Bipolar Junction Transistors (BJTs)<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.1, Page Number: 120 <h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
"%pylab inline"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "",
- "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].",
+ "\n",
+ "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
"For more information, type 'help(pylab)'."
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find Emitter current'''",
- "",
- "# variable declaration",
- "I_C=3.65*10**-3; #collector current in amperes",
- "I_B=50*10**-6; #base current in amperes",
- "",
- "#calculation",
- "B_DC=I_C/I_B; #B_DC value",
- "I_E=I_B+I_C; #current in ampere",
- "",
- "# result",
- "print \"B_DC = %d \" %B_DC",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "I_C=3.65*10**-3; #collector current in amperes\n",
+ "I_B=50*10**-6; #base current in amperes\n",
+ "\n",
+ "#calculation\n",
+ "B_DC=I_C/I_B; #B_DC value\n",
+ "I_E=I_B+I_C; #current in ampere\n",
+ "\n",
+ "# result\n",
+ "print \"B_DC = %d \" %B_DC\n",
"print \"Emitter current = %.4f ampere\" %I_E"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "B_DC = 73 ",
+ "B_DC = 73 \n",
"Emitter current = 0.0037 ampere"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.2, Page Number: 121<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Current and Voltage values'''",
- "",
- "# variable declaration",
- "V_BE=0.7; # voltage in volt",
- "B_DC=150; # voltage in volt",
- "V_BB=5; # voltage in volt",
- "V_CC=10; # voltage in volt",
- "R_B=10*10**3; # resistance in ohm",
- "R_C=100; # resistance in ohm",
- "",
- "#calculation",
- "I_B=(V_BB-V_BE)/R_B; #base current in amperes",
- "I_C=B_DC*I_B; #collector current in amperes",
- "I_E=I_C+I_B; #emitter current in amperes",
- "V_CE=V_CC-I_C*R_C; #collector to emitter voltage in volts",
- "V_CB=V_CE-V_BE; #collector to base voltage in volts",
- "",
- "# result",
- "print \"base current = %.5f amperes\" %I_B",
- "print \"collector current = %.4f amperes\" %I_C",
- "print \"emitter current = %.5f amperes\" %I_E",
- "print \"collector to emitter voltage =%.2f volts\" %V_CE",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_BE=0.7; # voltage in volt\n",
+ "B_DC=150; # voltage in volt\n",
+ "V_BB=5; # voltage in volt\n",
+ "V_CC=10; # voltage in volt\n",
+ "R_B=10*10**3; # resistance in ohm\n",
+ "R_C=100; # resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "I_B=(V_BB-V_BE)/R_B; #base current in amperes\n",
+ "I_C=B_DC*I_B; #collector current in amperes\n",
+ "I_E=I_C+I_B; #emitter current in amperes\n",
+ "V_CE=V_CC-I_C*R_C; #collector to emitter voltage in volts\n",
+ "V_CB=V_CE-V_BE; #collector to base voltage in volts\n",
+ "\n",
+ "# result\n",
+ "print \"base current = %.5f amperes\" %I_B\n",
+ "print \"collector current = %.4f amperes\" %I_C\n",
+ "print \"emitter current = %.5f amperes\" %I_E\n",
+ "print \"collector to emitter voltage =%.2f volts\" %V_CE\n",
"print \"collector to base voltage =%.2f volts\" %V_CB"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "base current = 0.00043 amperes",
- "collector current = 0.0645 amperes",
- "emitter current = 0.06493 amperes",
- "collector to emitter voltage =3.55 volts",
+ "base current = 0.00043 amperes\n",
+ "collector current = 0.0645 amperes\n",
+ "emitter current = 0.06493 amperes\n",
+ "collector to emitter voltage =3.55 volts\n",
"collector to base voltage =2.85 volts"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.3, Page Number: 123<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Ideal family of collector curve'''",
- "",
- "",
- "import pylab as py",
- "import numpy as np",
- "",
- "#variable declaration",
- "beta=100 # current gain",
- "print'Ideal family of collector curve'",
- "",
- "ic1 = arange(0.00001, 0.45, 0.0005)",
- "ic2 = arange(0.00001, 0.5, 0.0005)",
- "ic3 = arange(0.00001, 0.6, 0.0005)",
- "ic4 = arange(0.00001, 0.7, 0.0005)",
- "vcc1=ic1*0.5/0.7",
- "vcc2=ic2*1.35/0.7",
- "vcc3=ic3*2/0.7",
- "vcc4=ic4*2.5/0.7",
- "m1=arange(0.45,5.0,0.0005)",
- "m2=arange(0.5,5.0,0.0005)",
- "m3=arange(0.6,5.0,0.0005)",
- "m4=arange(0.7,5.0,0.0005)",
- "",
- "plot(ic1,vcc1,'b')",
- "plot(ic2,vcc2,'b')",
- "plot(ic3,vcc3,'b')",
- "plot(ic4,vcc4,'b')",
- "plot(m1,0.32*m1/m1,'b')",
- "plot(m2,0.96*m2/m2,'b')",
- "plot(m3,1.712*m3/m3,'b')",
- "plot(m4,2.5*m4/m4,'b')",
- "",
- "ylim( (0,3) )",
- "ylabel('Ic(mA)')",
- "xlabel('Vce(V)')",
+ "\n",
+ "\n",
+ "import pylab as py\n",
+ "import numpy as np\n",
+ "\n",
+ "#variable declaration\n",
+ "beta=100 # current gain\n",
+ "print'Ideal family of collector curve'\n",
+ "\n",
+ "ic1 = arange(0.00001, 0.45, 0.0005)\n",
+ "ic2 = arange(0.00001, 0.5, 0.0005)\n",
+ "ic3 = arange(0.00001, 0.6, 0.0005)\n",
+ "ic4 = arange(0.00001, 0.7, 0.0005)\n",
+ "vcc1=ic1*0.5/0.7\n",
+ "vcc2=ic2*1.35/0.7\n",
+ "vcc3=ic3*2/0.7\n",
+ "vcc4=ic4*2.5/0.7\n",
+ "m1=arange(0.45,5.0,0.0005)\n",
+ "m2=arange(0.5,5.0,0.0005)\n",
+ "m3=arange(0.6,5.0,0.0005)\n",
+ "m4=arange(0.7,5.0,0.0005)\n",
+ "\n",
+ "plot(ic1,vcc1,'b')\n",
+ "plot(ic2,vcc2,'b')\n",
+ "plot(ic3,vcc3,'b')\n",
+ "plot(ic4,vcc4,'b')\n",
+ "plot(m1,0.32*m1/m1,'b')\n",
+ "plot(m2,0.96*m2/m2,'b')\n",
+ "plot(m3,1.712*m3/m3,'b')\n",
+ "plot(m4,2.5*m4/m4,'b')\n",
+ "\n",
+ "ylim( (0,3) )\n",
+ "ylabel('Ic(mA)')\n",
+ "xlabel('Vce(V)')\n",
"title('Ideal family of collector curve')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Ideal family of collector curve"
]
- },
+ },
{
- "output_type": "pyout",
- "prompt_number": 4,
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 4,
"text": [
"<matplotlib.text.Text at 0xa11e74c>"
]
- },
+ },
{
- "output_type": "display_data",
+ "metadata": {},
+ "output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEXCAYAAABLZvh6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtYVPW6B/DvIHjhIkop4IBg4gVSAcVIQ0UNTVOizBQz\nUalQj6nVfmrno0dteyzTrWm2Pdb2caeluPV4QbnkJUa8czS8ZB4vKHIVREEhlevv/LFiYGCAQefC\nzPp+nocn1qzLvIy0XtbvXb93KYQQAkREJEtWpg6AiIhMh0mAiEjGmASIiGSMSYCISMaYBIiIZIxJ\ngIhIxpgEZCwtLQ1WVlaorKx86mN5enri8OHDWtc9evQIY8eORbt27TBhwoSnfq+a0tPT4eDggKo7\nnYODg7Fx40a9vgcA7N69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PjW77z3/+Ex9++KERoiJqHK8E\niIhkjFcCREQyxiRARCRjTAJERDLGJEBEJGNMAkREMsYkQEQkY/8PuzhceEoO66YAAAAASUVORK5C\nYII=\n"
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.4, Page Number: 125<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Transistor saturtion condition'''",
- "",
- "# variable declaration",
- "V_CE_sat=0.2; # voltage in volt",
- "V_BE=0.7; # voltage in volt",
- "V_BB=3; # voltage in volt",
- "V_CC=10; # voltage in volt",
- "B_DC=50; # voltage in volt",
- "R_B=10*10**3; # resistance in ohm",
- "R_C=1*10**3; # resistance in ohm",
- "",
- "#calculation",
- "I_C_sat=(V_CC-V_CE_sat)/R_C; # saturation current",
- "I_B=(V_BB-V_BE)/R_B; # base current",
- "I_C=B_DC*I_B; # current in ampere",
- "",
- "# result",
- "if I_C>I_C_sat:",
- " print \"transistor in saturation\"",
- "else:",
+ "\n",
+ "# variable declaration\n",
+ "V_CE_sat=0.2; # voltage in volt\n",
+ "V_BE=0.7; # voltage in volt\n",
+ "V_BB=3; # voltage in volt\n",
+ "V_CC=10; # voltage in volt\n",
+ "B_DC=50; # voltage in volt\n",
+ "R_B=10*10**3; # resistance in ohm\n",
+ "R_C=1*10**3; # resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "I_C_sat=(V_CC-V_CE_sat)/R_C; # saturation current\n",
+ "I_B=(V_BB-V_BE)/R_B; # base current\n",
+ "I_C=B_DC*I_B; # current in ampere\n",
+ "\n",
+ "# result\n",
+ "if I_C>I_C_sat:\n",
+ " print \"transistor in saturation\"\n",
+ "else:\n",
" print \"transistor not in saturation\""
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"transistor in saturation"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.5, Page Number: 127<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''maximum collector current'''",
- "",
- "#Variable declaration",
- "P_D_max=250*10**-3; #max power rating of transistor in watts",
- "V_CE=6; #voltage in volt",
- "",
- "#Calculation",
- "I_Cu=P_D_max/V_CE; #Current (Amp)",
- "I_C=I_Cu*1000;",
- "",
- "#Result",
- "print \"collector current that can be handled by the transistor = %.1f mA\" %I_C",
- "print \"\\nRemember that this is not necessarily the maximum IC. The transistor\"",
- "print \"can handle more collectore current if Vce is reduced as long as PDmax\"",
+ "\n",
+ "#Variable declaration\n",
+ "P_D_max=250*10**-3; #max power rating of transistor in watts\n",
+ "V_CE=6; #voltage in volt\n",
+ "\n",
+ "#Calculation\n",
+ "I_Cu=P_D_max/V_CE; #Current (Amp)\n",
+ "I_C=I_Cu*1000;\n",
+ "\n",
+ "#Result\n",
+ "print \"collector current that can be handled by the transistor = %.1f mA\" %I_C\n",
+ "print \"\\nRemember that this is not necessarily the maximum IC. The transistor\"\n",
+ "print \"can handle more collectore current if Vce is reduced as long as PDmax\"\n",
"print \"is not exceeded.\""
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "collector current that can be handled by the transistor = 41.7 mA",
- "",
- "Remember that this is not necessarily the maximum IC. The transistor",
- "can handle more collectore current if Vce is reduced as long as PDmax",
+ "collector current that can be handled by the transistor = 41.7 mA\n",
+ "\n",
+ "Remember that this is not necessarily the maximum IC. The transistor\n",
+ "can handle more collectore current if Vce is reduced as long as PDmax\n",
"is not exceeded."
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.6, Page Number: 127<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''voltage drop across transistor''' ",
- "",
- "#Variable declaration",
- "P_D_max=800*10**-3; #max power rating of transistor in watts",
- "V_BE=0.7; #voltage in volt",
- "V_CE_max=15; #voltage in volt",
- "I_C_max=100*10**-3; #Current (Amp)",
- "V_BB=5; #voltage in volt",
- "B_DC=100; #voltage in volt",
- "R_B=22*10**3; # resistance in ohm",
- "R_C=10**3; # resistance in ohm",
- "",
- "#Calculation",
- "I_B=(V_BB-V_BE)/R_B; # base current",
- "I_C=B_DC*I_B; #collector current ",
- "V_R_C=I_C*R_C; #voltage drop across R_C",
- "V_CC_max=V_CE_max+V_R_C; #Vcc max in volt",
- "P_D=I_C*V_CE_max; #max power rating",
- "",
- "#Result",
- "if P_D<P_D_max:",
- " print \"V_CC = %.2f volt\" %V_CC_max",
- " print \"V_CE_max will be exceeded first because entire supply voltage V_CC will be dropped across the transistor\"",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "P_D_max=800*10**-3; #max power rating of transistor in watts\n",
+ "V_BE=0.7; #voltage in volt\n",
+ "V_CE_max=15; #voltage in volt\n",
+ "I_C_max=100*10**-3; #Current (Amp)\n",
+ "V_BB=5; #voltage in volt\n",
+ "B_DC=100; #voltage in volt\n",
+ "R_B=22*10**3; # resistance in ohm\n",
+ "R_C=10**3; # resistance in ohm\n",
+ "\n",
+ "#Calculation\n",
+ "I_B=(V_BB-V_BE)/R_B; # base current\n",
+ "I_C=B_DC*I_B; #collector current \n",
+ "V_R_C=I_C*R_C; #voltage drop across R_C\n",
+ "V_CC_max=V_CE_max+V_R_C; #Vcc max in volt\n",
+ "P_D=I_C*V_CE_max; #max power rating\n",
+ "\n",
+ "#Result\n",
+ "if P_D<P_D_max:\n",
+ " print \"V_CC = %.2f volt\" %V_CC_max\n",
+ " print \"V_CE_max will be exceeded first because entire supply voltage V_CC will be dropped across the transistor\"\n",
" "
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "V_CC = 34.55 volt",
+ "V_CC = 34.55 volt\n",
"V_CE_max will be exceeded first because entire supply voltage V_CC will be dropped across the transistor"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.7, Page Number: 128<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Power dissipation'''",
- "",
- "#Variable declaration",
- "df=5*10**-3; #derating factor in watts per degree celsius",
- "T1=70; #temperature 1",
- "T2=25; #temperature 2",
- "P_D_max=1; #in watts",
- "",
- "#Calculation",
- "del_P_D=df*(T1-T2); #change due to temperature",
- "P_D=P_D_max-del_P_D; # power dissipation",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "df=5*10**-3; #derating factor in watts per degree celsius\n",
+ "T1=70; #temperature 1\n",
+ "T2=25; #temperature 2\n",
+ "P_D_max=1; #in watts\n",
+ "\n",
+ "#Calculation\n",
+ "del_P_D=df*(T1-T2); #change due to temperature\n",
+ "P_D=P_D_max-del_P_D; # power dissipation\n",
+ "\n",
+ "#Result\n",
"print \"Power dissipated max at a temperature of 70 degree celsius = %.3f watts\" %P_D"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Power dissipated max at a temperature of 70 degree celsius = 0.775 watts"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.8, Page Number: 130<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''voltage gain'''",
- "",
- "#Variable declaration",
- "R_C=1*10**3; #resistance in ohm",
- "r_e=50; #resistance in ohm",
- "V_b=100*10**-3; #voltage in volt",
- "",
- "#Calculation",
- "A_v=R_C/r_e; #voltage gain",
- "V_out=A_v*V_b; #voltage in volt",
- "",
- "#Result",
- "print \"voltage gain = %d \" %A_v",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "R_C=1*10**3; #resistance in ohm\n",
+ "r_e=50; #resistance in ohm\n",
+ "V_b=100*10**-3; #voltage in volt\n",
+ "\n",
+ "#Calculation\n",
+ "A_v=R_C/r_e; #voltage gain\n",
+ "V_out=A_v*V_b; #voltage in volt\n",
+ "\n",
+ "#Result\n",
+ "print \"voltage gain = %d \" %A_v\n",
"print \"AC output voltage = %d volt\" %V_out"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "voltage gain = 20 ",
+ "voltage gain = 20 \n",
"AC output voltage = 2 volt"
]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 4.9, Page Number: 132 <h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Power dissipation'''",
- "",
- "#Variable declaration",
- "V_CC=10.0; #voltage in volt",
- "B_DC=200.0; #voltage in volt",
- "R_C=1.0*10**3; #resistance in ohm",
- "V_IN=0.0; #voltage in volt",
- "",
- "#Calculation",
- "V_CE=V_CC; #equal voltage",
- "print \"when V_IN=0, transistor acts as open switch(cut-off) and collector emitter voltage = %.2f volt\" %V_CE",
- "#now when V_CE_sat is neglected",
- "I_C_sat=V_CC/R_C; #saturation current",
- "I_B_min=I_C_sat/B_DC; #minimum base current",
- "print \"\\nminimum value of base current to saturate transistor = %.5f ampere\" %I_B_min",
- "V_IN=5; #voltage in volt",
- "V_BE=0.7; #voltage in volt",
- "V_R_B=V_IN-V_BE; #voltage across base resiatance",
- "R_B_max=V_R_B/I_B_min;",
- "",
- "",
- "#Result",
- "kw=round (R_B_max)",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "V_CC=10.0; #voltage in volt\n",
+ "B_DC=200.0; #voltage in volt\n",
+ "R_C=1.0*10**3; #resistance in ohm\n",
+ "V_IN=0.0; #voltage in volt\n",
+ "\n",
+ "#Calculation\n",
+ "V_CE=V_CC; #equal voltage\n",
+ "print \"when V_IN=0, transistor acts as open switch(cut-off) and collector emitter voltage = %.2f volt\" %V_CE\n",
+ "#now when V_CE_sat is neglected\n",
+ "I_C_sat=V_CC/R_C; #saturation current\n",
+ "I_B_min=I_C_sat/B_DC; #minimum base current\n",
+ "print \"\\nminimum value of base current to saturate transistor = %.5f ampere\" %I_B_min\n",
+ "V_IN=5; #voltage in volt\n",
+ "V_BE=0.7; #voltage in volt\n",
+ "V_R_B=V_IN-V_BE; #voltage across base resiatance\n",
+ "R_B_max=V_R_B/I_B_min;\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "kw=round (R_B_max)\n",
"print \"\\nmaximum value of base resistance when input voltage is 5V = %d ohm\" %kw"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "when V_IN=0, transistor acts as open switch(cut-off) and collector emitter voltage = 10.00 volt",
- "",
- "minimum value of base current to saturate transistor = 0.00005 ampere",
- "",
+ "when V_IN=0, transistor acts as open switch(cut-off) and collector emitter voltage = 10.00 volt\n",
+ "\n",
+ "minimum value of base current to saturate transistor = 0.00005 ampere\n",
+ "\n",
"maximum value of base resistance when input voltage is 5V = 86000 ohm"
]
}
- ],
+ ],
"prompt_number": 10
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter5.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter5.ipynb
index 1b456628..a8015b6a 100644
--- a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter5.ipynb
+++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter5.ipynb
@@ -1,427 +1,447 @@
{
"metadata": {
- "name": "Chapter_5"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:c4c502bfd6580fd1868fbcea67aad93ec7389e68f949d2b682e69f6f1b08d677"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 5: Transistor Bias Circuits<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.1, Page Number: 146<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
"%pylab inline"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "",
- "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].",
+ "\n",
+ "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
"For more information, type 'help(pylab)'."
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Peak base current'''",
- "",
- "# variable declaration",
- "V_BB=10.0; #voltage in volt",
- "V_CC=20.0; #voltage in volt",
- "B_DC=200.0; #B_DC value",
- "R_B=47.0*10**3; #resistance in ohm",
- "R_C=330.0; #resistance in ohm",
- "V_BE=0.7; #voltage in volt",
- "",
- "#current",
- "I_B=(V_BB-V_BE)/R_B; #base current",
- "I_C=B_DC*I_B; #Q POINT",
- "V_CE=V_CC-I_C*R_C; #Q POINT",
- "I_C_sat=V_CC/R_C; #saturation current",
- "I_c_peak=I_C_sat-I_C; #peak current ",
- "I_b_peak=I_c_peak/B_DC; #peak current in ampere",
- "",
- "#result",
- "print \"Q point of I_C = %.3f amperes\" %I_C",
- "print \"Q point of V_CE = %.2f volts\" %V_CE",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_BB=10.0; #voltage in volt\n",
+ "V_CC=20.0; #voltage in volt\n",
+ "B_DC=200.0; #B_DC value\n",
+ "R_B=47.0*10**3; #resistance in ohm\n",
+ "R_C=330.0; #resistance in ohm\n",
+ "V_BE=0.7; #voltage in volt\n",
+ "\n",
+ "#current\n",
+ "I_B=(V_BB-V_BE)/R_B; #base current\n",
+ "I_C=B_DC*I_B; #Q POINT\n",
+ "V_CE=V_CC-I_C*R_C; #Q POINT\n",
+ "I_C_sat=V_CC/R_C; #saturation current\n",
+ "I_c_peak=I_C_sat-I_C; #peak current \n",
+ "I_b_peak=I_c_peak/B_DC; #peak current in ampere\n",
+ "\n",
+ "#result\n",
+ "print \"Q point of I_C = %.3f amperes\" %I_C\n",
+ "print \"Q point of V_CE = %.2f volts\" %V_CE\n",
"print \"peak base current = %.4f amperes\" %I_b_peak"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Q point of I_C = 0.040 amperes",
- "Q point of V_CE = 6.94 volts",
+ "Q point of I_C = 0.040 amperes\n",
+ "Q point of V_CE = 6.94 volts\n",
"peak base current = 0.0001 amperes"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.2, Page Number: 149<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' DC input resistance'''",
- "",
- "# variable declaration",
- "B_DC=125.0; #DC value",
- "R_E=10.0**3; #resistance in ohm",
- "",
- "#calculation",
- "R_IN_base=B_DC*R_E; #base resistance",
- "",
- "#Result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "B_DC=125.0; #DC value\n",
+ "R_E=10.0**3; #resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "R_IN_base=B_DC*R_E; #base resistance\n",
+ "\n",
+ "#Result\n",
"print \"DC input resistance, looking at base of transistor = %d ohm\" %R_IN_base"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"DC input resistance, looking at base of transistor = 125000 ohm"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.3, Page Number: 151<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Transistor saturation condition'''",
- "",
- "# variable declaration",
- "B_DC=100; #DC value",
- "R1=10*10**3; #resistance in ohm",
- "R2=5.6*10**3; #resistance in ohm",
- "R_C=1*10**3; #resistance in ohm",
- "R_E=560; #resistance in ohm",
- "V_CC=10; #voltage in volt",
- "V_BE=0.7 #voltage in volt",
- "",
- "#calculation",
- "R_IN_base=B_DC*R_E; #calculate base resistance",
- "#We can neglect R_IN_base as it is equal to 10*R2",
- "print \"input resistance seen from base = %d ohm\" %R_IN_base",
- "print \"which can be neglected as it is 10 times R2\"",
- "",
- "V_B=(R2/(R1+R2))*V_CC; #base voltage",
- "V_E=V_B-V_BE; #emitter voltage",
- "I_E=V_E/R_E; #emitter current",
- "I_C=I_E; #currents are equal",
- "V_CE=V_CC-I_C*(R_C+R_E); #voltage in volt",
- "",
- "#result",
- "print \"V_CE = %.2f volts\" %V_CE",
- "print \"I_C = %.3f amperes\" %I_C",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "B_DC=100; #DC value\n",
+ "R1=10*10**3; #resistance in ohm\n",
+ "R2=5.6*10**3; #resistance in ohm\n",
+ "R_C=1*10**3; #resistance in ohm\n",
+ "R_E=560; #resistance in ohm\n",
+ "V_CC=10; #voltage in volt\n",
+ "V_BE=0.7 #voltage in volt\n",
+ "\n",
+ "#calculation\n",
+ "R_IN_base=B_DC*R_E; #calculate base resistance\n",
+ "#We can neglect R_IN_base as it is equal to 10*R2\n",
+ "print \"input resistance seen from base = %d ohm\" %R_IN_base\n",
+ "print \"which can be neglected as it is 10 times R2\"\n",
+ "\n",
+ "V_B=(R2/(R1+R2))*V_CC; #base voltage\n",
+ "V_E=V_B-V_BE; #emitter voltage\n",
+ "I_E=V_E/R_E; #emitter current\n",
+ "I_C=I_E; #currents are equal\n",
+ "V_CE=V_CC-I_C*(R_C+R_E); #voltage in volt\n",
+ "\n",
+ "#result\n",
+ "print \"V_CE = %.2f volts\" %V_CE\n",
+ "print \"I_C = %.3f amperes\" %I_C\n",
"print \"Since V_CE>0V, transistor is not in saturation\""
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "input resistance seen from base = 56000 ohm",
- "which can be neglected as it is 10 times R2",
- "V_CE = 1.95 volts",
- "I_C = 0.005 amperes",
+ "input resistance seen from base = 56000 ohm\n",
+ "which can be neglected as it is 10 times R2\n",
+ "V_CE = 1.95 volts\n",
+ "I_C = 0.005 amperes\n",
"Since V_CE>0V, transistor is not in saturation"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.4, Page Number: 154<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Emitter-Collector Voltage'''",
- "",
- "# variable declaration",
- "V_EE=10.0; #voltage in volt",
- "V_BE=0.7; #voltage in volt",
- "B_DC=150.0; #DC value ",
- "R1=22.0*10**3; #resistance in ohm",
- "R2=10.0*10**3; #resistance in ohm",
- "R_C=2.2*10**3; #resistance in ohm",
- "R_E=1.0*10**3; #resistance in ohm",
- "",
- "#calculation",
- "R_IN_base=B_DC*R_E; #R_IN_base>10*R2,so it can be neglected",
- "print \"input resistance as seen from base = %d ohm\" %R_IN_base",
- "print \"it can be neglected as it is greater than 10 times R2\"",
- "V_B=(R1/(R1+R2))*V_EE; #base voltage",
- "V_E=V_B+V_BE; #emitter voltage",
- "I_E=(V_EE-V_E)/R_E; #emitter current",
- "I_C=I_E; #currents are equal",
- "V_C=I_C*R_C; #collector voltage",
- "V_EC=V_E-V_C; #emitter-collector voltage",
- "",
- "#result",
- "print \"I_C collector current = %.4f amperes\" %I_C",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_EE=10.0; #voltage in volt\n",
+ "V_BE=0.7; #voltage in volt\n",
+ "B_DC=150.0; #DC value \n",
+ "R1=22.0*10**3; #resistance in ohm\n",
+ "R2=10.0*10**3; #resistance in ohm\n",
+ "R_C=2.2*10**3; #resistance in ohm\n",
+ "R_E=1.0*10**3; #resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "R_IN_base=B_DC*R_E; #R_IN_base>10*R2,so it can be neglected\n",
+ "print \"input resistance as seen from base = %d ohm\" %R_IN_base\n",
+ "print \"it can be neglected as it is greater than 10 times R2\"\n",
+ "V_B=(R1/(R1+R2))*V_EE; #base voltage\n",
+ "V_E=V_B+V_BE; #emitter voltage\n",
+ "I_E=(V_EE-V_E)/R_E; #emitter current\n",
+ "I_C=I_E; #currents are equal\n",
+ "V_C=I_C*R_C; #collector voltage\n",
+ "V_EC=V_E-V_C; #emitter-collector voltage\n",
+ "\n",
+ "#result\n",
+ "print \"I_C collector current = %.4f amperes\" %I_C\n",
"print \"V_EC emitter-collector voltage = %.2f Volts\" %V_EC"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "input resistance as seen from base = 150000 ohm",
- "it can be neglected as it is greater than 10 times R2",
- "I_C collector current = 0.0024 amperes",
+ "input resistance as seen from base = 150000 ohm\n",
+ "it can be neglected as it is greater than 10 times R2\n",
+ "I_C collector current = 0.0024 amperes\n",
"V_EC emitter-collector voltage = 2.24 Volts"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.5, PAge Number: 154<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Collector-Emitter Voltage'''",
- "",
- "# variable declaration",
- "R1=68.0*10**3; #resistance in ohm",
- "R2=47.0*10**3; #resistance in ohm",
- "R_C=1.8*10**3; #resistance in ohm",
- "R_E=2.2*10**3; #resistance in ohm",
- "V_CC=-6.0; #voltage in volt",
- "V_BE=0.7; #voltage in volt",
- "B_DC=75.0; #DC value",
- "",
- "#calculation",
- "R_IN_base=B_DC*R_E;",
- "print \"input resistance as seen from base\"",
- "print \"is not greater than 10 times R2 so it should be taken into account\"",
- "#R_IN_base in parallel with R2",
- "V_B=((R2*R_IN_base)/(R2+R_IN_base)/(R1+(R2*R_IN_base)/(R2+R_IN_base)))*V_CC;",
- "V_E=V_B+V_BE; #emitter voltage",
- "I_E=V_E/R_E; #emitter current",
- "I_C=I_E; #currents are equal",
- "V_C=V_CC-I_C*R_C; #collector voltage",
- "V_CE=V_C-V_E; #collector-emitter voltage",
- "",
- "#result",
- "print \"collector current = %.4f amperes\" %I_C",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "R1=68.0*10**3; #resistance in ohm\n",
+ "R2=47.0*10**3; #resistance in ohm\n",
+ "R_C=1.8*10**3; #resistance in ohm\n",
+ "R_E=2.2*10**3; #resistance in ohm\n",
+ "V_CC=-6.0; #voltage in volt\n",
+ "V_BE=0.7; #voltage in volt\n",
+ "B_DC=75.0; #DC value\n",
+ "\n",
+ "#calculation\n",
+ "R_IN_base=B_DC*R_E;\n",
+ "print \"input resistance as seen from base\"\n",
+ "print \"is not greater than 10 times R2 so it should be taken into account\"\n",
+ "#R_IN_base in parallel with R2\n",
+ "V_B=((R2*R_IN_base)/(R2+R_IN_base)/(R1+(R2*R_IN_base)/(R2+R_IN_base)))*V_CC;\n",
+ "V_E=V_B+V_BE; #emitter voltage\n",
+ "I_E=V_E/R_E; #emitter current\n",
+ "I_C=I_E; #currents are equal\n",
+ "V_C=V_CC-I_C*R_C; #collector voltage\n",
+ "V_CE=V_C-V_E; #collector-emitter voltage\n",
+ "\n",
+ "#result\n",
+ "print \"collector current = %.4f amperes\" %I_C\n",
"print \"collector emitter voltage = %.2f volts\" %V_CE"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "input resistance as seen from base",
- "is not greater than 10 times R2 so it should be taken into account",
- "collector current = -0.0006 amperes",
+ "input resistance as seen from base\n",
+ "is not greater than 10 times R2 so it should be taken into account\n",
+ "collector current = -0.0006 amperes\n",
"collector emitter voltage = -3.46 volts"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.6, Page Number: 156<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' change in collector emitter voltage'''",
- "",
- "# variable declaration",
- "V_CC=12.0; #voltage in volt",
- "R_B=100.0*10**3; #resistance in ohm",
- "R_C=560.0; #resistance in ohm",
- "#FOR B_DC=85 AND V_BE=0.7V",
- "B_DC=85.0; #DC value",
- "V_BE=0.7; #base-emitter voltage",
- "",
- "#calculation",
- "I_C_1=B_DC*(V_CC-V_BE)/R_B; #collector current",
- "V_CE_1=V_CC-I_C_1*R_C; #collector-emittor voltage",
- "#FOR B_DC=100 AND V_BE=0.6V",
- "B_DC=100.0; #DC value ",
- "V_BE=0.6; #base emitter voltage",
- "I_C_2=B_DC*(V_CC-V_BE)/R_B; #collector current",
- "V_CE_2=V_CC-I_C_2*R_C; #voltage in volt",
- "p_del_I_C=((I_C_2-I_C_1)/I_C_1)*100; #percent change in collector current ",
- "p_del_V_CE=((V_CE_2-V_CE_1)/V_CE_1)*100; #percent change in C-E voltage",
- "",
- "#result",
- "print \"percent change in collector current = %.2f\" %p_del_I_C",
+ "\n",
+ "# variable declaration\n",
+ "V_CC=12.0; #voltage in volt\n",
+ "R_B=100.0*10**3; #resistance in ohm\n",
+ "R_C=560.0; #resistance in ohm\n",
+ "#FOR B_DC=85 AND V_BE=0.7V\n",
+ "B_DC=85.0; #DC value\n",
+ "V_BE=0.7; #base-emitter voltage\n",
+ "\n",
+ "#calculation\n",
+ "I_C_1=B_DC*(V_CC-V_BE)/R_B; #collector current\n",
+ "V_CE_1=V_CC-I_C_1*R_C; #collector-emittor voltage\n",
+ "#FOR B_DC=100 AND V_BE=0.6V\n",
+ "B_DC=100.0; #DC value \n",
+ "V_BE=0.6; #base emitter voltage\n",
+ "I_C_2=B_DC*(V_CC-V_BE)/R_B; #collector current\n",
+ "V_CE_2=V_CC-I_C_2*R_C; #voltage in volt\n",
+ "p_del_I_C=((I_C_2-I_C_1)/I_C_1)*100; #percent change in collector current \n",
+ "p_del_V_CE=((V_CE_2-V_CE_1)/V_CE_1)*100; #percent change in C-E voltage\n",
+ "\n",
+ "#result\n",
+ "print \"percent change in collector current = %.2f\" %p_del_I_C\n",
"print \"percent change in collector emitter voltage = %.2f\" %p_del_V_CE"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "percent change in collector current = 18.69",
+ "percent change in collector current = 18.69\n",
"percent change in collector emitter voltage = -15.18"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.7, Page Number: 159<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' percent change in collector emitter voltage'''",
- "",
- "# variable declaration",
- "V_CC=20.0; #voltage in volt",
- "R_C=4.7*10**3; #resistance in ohm",
- "R_E=10.0*10**3; #resistance in ohm",
- "V_EE=-20.0; #voltage in volt",
- "R_B=100*10**3; #resistance in ohm",
- "#FOR B_DC=85 AND V_BE=0.7V",
- "B_DC=85; #DC value",
- "V_BE=0.7; #base-emitter voltage",
- "I_C_1=(-V_EE-V_BE)/(R_E+(R_B/B_DC));",
- "V_C=V_CC-I_C_1*R_C; #colector voltage",
- "I_E=I_C_1; #emittor current",
- "V_E=V_EE+I_E*R_E; #emittor voltage",
- "V_CE_1=V_C-V_E; #CE voltage",
- "print \"I_C_1 = %.3f\" %I_C_1",
- "print \"V_CE_1 = %.2f\" %V_CE_1",
- "#FOR B_DC=100 AND V_BE=0.6V",
- "B_DC=100; #DC value ",
- "V_BE=0.6; #base-emitter voltage",
- "I_C_2=(-V_EE-V_BE)/(R_E+(R_B/B_DC));",
- "V_C=V_CC-I_C_2*R_C;#colector voltage",
- "I_E=I_C_2; #emittor current",
- "V_E=V_EE+I_E*R_E; #emittor voltage",
- "V_CE_2=V_C-V_E; #CE voltage",
- "print \"I_C_2 = %.3f\" %I_C_2",
- "print \"V_CE_2 = %.2f\" %V_CE_2",
- "",
- "p_del_I_C=((I_C_2-I_C_1)/I_C_1)*100;",
- "p_del_V_CE=((V_CE_2-V_CE_1)/V_CE_1)*100;",
- "print \"percent change in collector currrent = %.2f\" %p_del_I_C",
- "print \"percent change in collector emitter voltage = %.2f\" %p_del_V_CE",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_CC=20.0; #voltage in volt\n",
+ "R_C=4.7*10**3; #resistance in ohm\n",
+ "R_E=10.0*10**3; #resistance in ohm\n",
+ "V_EE=-20.0; #voltage in volt\n",
+ "R_B=100*10**3; #resistance in ohm\n",
+ "#FOR B_DC=85 AND V_BE=0.7V\n",
+ "B_DC=85; #DC value\n",
+ "V_BE=0.7; #base-emitter voltage\n",
+ "I_C_1=(-V_EE-V_BE)/(R_E+(R_B/B_DC));\n",
+ "V_C=V_CC-I_C_1*R_C; #colector voltage\n",
+ "I_E=I_C_1; #emittor current\n",
+ "V_E=V_EE+I_E*R_E; #emittor voltage\n",
+ "V_CE_1=V_C-V_E; #CE voltage\n",
+ "print \"I_C_1 = %.3f\" %I_C_1\n",
+ "print \"V_CE_1 = %.2f\" %V_CE_1\n",
+ "#FOR B_DC=100 AND V_BE=0.6V\n",
+ "B_DC=100; #DC value \n",
+ "V_BE=0.6; #base-emitter voltage\n",
+ "I_C_2=(-V_EE-V_BE)/(R_E+(R_B/B_DC));\n",
+ "V_C=V_CC-I_C_2*R_C;#colector voltage\n",
+ "I_E=I_C_2; #emittor current\n",
+ "V_E=V_EE+I_E*R_E; #emittor voltage\n",
+ "V_CE_2=V_C-V_E; #CE voltage\n",
+ "print \"I_C_2 = %.3f\" %I_C_2\n",
+ "print \"V_CE_2 = %.2f\" %V_CE_2\n",
+ "\n",
+ "p_del_I_C=((I_C_2-I_C_1)/I_C_1)*100;\n",
+ "p_del_V_CE=((V_CE_2-V_CE_1)/V_CE_1)*100;\n",
+ "print \"percent change in collector currrent = %.2f\" %p_del_I_C\n",
+ "print \"percent change in collector emitter voltage = %.2f\" %p_del_V_CE\n",
"print \"answers in book are approximated\""
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "I_C_1 = 0.002",
- "V_CE_1 = 14.61",
- "I_C_2 = 0.002",
- "V_CE_2 = 14.07",
- "percent change in collector currrent = 2.13",
- "percent change in collector emitter voltage = -3.69",
+ "I_C_1 = 0.002\n",
+ "V_CE_1 = 14.61\n",
+ "I_C_2 = 0.002\n",
+ "V_CE_2 = 14.07\n",
+ "percent change in collector currrent = 2.13\n",
+ "percent change in collector emitter voltage = -3.69\n",
"answers in book are approximated"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 5.8, Page Number: 161<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Q point current and voltage'''",
- "",
- "# variable declaratio",
- "V_CC=10.0; #voltage in volt",
- "B_DC=100.0; #Dc value",
- "R_C=10.0*10**3; #resistance in ohm",
- "R_B=100.0*10**3; #resistance in ohm",
- "V_BE=0.7; #base-emittor voltage",
- "",
- "#calculation",
- "I_C=(V_CC-V_BE)/(R_C+(R_B/B_DC)); #collector current",
- "V_CE=V_CC-I_C*R_C; #CE voltage",
- "",
- "#result",
- "print \"Q point of collector current %.4f amperes\" %I_C",
+ "\n",
+ "\n",
+ "# variable declaratio\n",
+ "V_CC=10.0; #voltage in volt\n",
+ "B_DC=100.0; #Dc value\n",
+ "R_C=10.0*10**3; #resistance in ohm\n",
+ "R_B=100.0*10**3; #resistance in ohm\n",
+ "V_BE=0.7; #base-emittor voltage\n",
+ "\n",
+ "#calculation\n",
+ "I_C=(V_CC-V_BE)/(R_C+(R_B/B_DC)); #collector current\n",
+ "V_CE=V_CC-I_C*R_C; #CE voltage\n",
+ "\n",
+ "#result\n",
+ "print \"Q point of collector current %.4f amperes\" %I_C\n",
"print \"Q point of collector-emitter voltage %.3f volts\" %V_CE"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Q point of collector current 0.0008 amperes",
+ "Q point of collector current 0.0008 amperes\n",
"Q point of collector-emitter voltage 1.545 volts"
]
}
- ],
+ ],
"prompt_number": 9
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter6.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter6.ipynb
index b4e7e58a..ff850644 100644
--- a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter6.ipynb
+++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter6.ipynb
@@ -1,603 +1,630 @@
{
"metadata": {
- "name": "Chapter_6"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:1e2443a67e2f318d256df68d49768eb2e6757f78c443329918d7f0edb5648c3b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 6: BJT Amplifiers<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.1, Page Number: 171<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
"%pylab inline"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "",
- "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].",
+ "\n",
+ "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
"For more information, type 'help(pylab)'."
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Q point'''",
- "# result",
- "",
+ "\n",
+ "# result\n",
+ "\n",
"print \"theoretical example\""
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"theoretical example"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.2, Page Number: 174<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' AC Emitter resistance'''",
- "",
- "# variable declaration",
- "I_E=2.0*10**-3; #emittor current",
- "",
- "#calculation",
- "r_e=25.0*10**-3/I_E; #ac emitter resistance",
- "",
- "#result",
+ "\n",
+ "# variable declaration\n",
+ "I_E=2.0*10**-3; #emittor current\n",
+ "\n",
+ "#calculation\n",
+ "r_e=25.0*10**-3/I_E; #ac emitter resistance\n",
+ "\n",
+ "#result\n",
"print \"ac emitter resistance = %.2f ohms\" %r_e "
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"ac emitter resistance = 12.50 ohms"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.3, Page Number: 178<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' voltage at base of transistor'''",
- "",
- "# variable declaration",
- "I_E=3.8*10**-3; #emittor current",
- "B_ac=160.0; #AC value",
- "R1=22*10**3; #resistance in ohm",
- "R2=6.8*10**3; #resistance in ohm",
- "R_s=300.0; #resistance in ohm",
- "V_s=10.0*10**-3; #voltage in volt",
- "r_e=25.0*10**-3/I_E; ",
- "",
- "#calculation",
- "R_in_base=B_ac*r_e; #base resistance",
- "R_in_tot=(R1*R2*R_in_base)/(R_in_base*R1+R_in_base*R2+R1*R2);",
- "V_b=(R_in_tot/(R_in_tot+R_s))*V_s; #base voltage",
- "",
- "#result",
+ "\n",
+ "# variable declaration\n",
+ "I_E=3.8*10**-3; #emittor current\n",
+ "B_ac=160.0; #AC value\n",
+ "R1=22*10**3; #resistance in ohm\n",
+ "R2=6.8*10**3; #resistance in ohm\n",
+ "R_s=300.0; #resistance in ohm\n",
+ "V_s=10.0*10**-3; #voltage in volt\n",
+ "r_e=25.0*10**-3/I_E; \n",
+ "\n",
+ "#calculation\n",
+ "R_in_base=B_ac*r_e; #base resistance\n",
+ "R_in_tot=(R1*R2*R_in_base)/(R_in_base*R1+R_in_base*R2+R1*R2);\n",
+ "V_b=(R_in_tot/(R_in_tot+R_s))*V_s; #base voltage\n",
+ "\n",
+ "#result\n",
"print \"voltage at the base of the transistor = %.3f volts\" %V_b"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"voltage at the base of the transistor = 0.007 volts"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.4, Page Number: 180<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' bypass capacitor'''",
- "",
- "import math",
- "# variable declaration",
- "R_E=560.0; #resistance in ohm",
- "f=2*10**3; #minimum value of frequency in hertz",
- "X_C=R_E/10.0; #minimum value of capacitive reactance",
- "",
- "#calculation",
- "C2=1.0/(2.0*math.pi*X_C*f); #capacitor ",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "# variable declaration\n",
+ "R_E=560.0; #resistance in ohm\n",
+ "f=2*10**3; #minimum value of frequency in hertz\n",
+ "X_C=R_E/10.0; #minimum value of capacitive reactance\n",
+ "\n",
+ "#calculation\n",
+ "C2=1.0/(2.0*math.pi*X_C*f); #capacitor \n",
+ "\n",
+ "#result\n",
"print \"value of bypass capacitor = %.7f farads\" %C2"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"value of bypass capacitor = 0.0000014 farads"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.5, Page Number: 181<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' bypass capacitor'''",
- "",
- "import math",
- "# variable declaration",
- "r_e=6.58; #from ex6.3",
- "R_C=1.0*10**3; #collector resistance",
- "R_E=560; #emittor resistance",
- "",
- "#calculation",
- "A_v=R_C/(R_E+r_e); #gain without bypass capacitor",
- "A_v1=R_C/r_e; #gain with bypass capacitor",
- "print \"gain without bypass capacitor = %.2f\" %A_v",
+ "\n",
+ "\n",
+ "import math\n",
+ "# variable declaration\n",
+ "r_e=6.58; #from ex6.3\n",
+ "R_C=1.0*10**3; #collector resistance\n",
+ "R_E=560; #emittor resistance\n",
+ "\n",
+ "#calculation\n",
+ "A_v=R_C/(R_E+r_e); #gain without bypass capacitor\n",
+ "A_v1=R_C/r_e; #gain with bypass capacitor\n",
+ "print \"gain without bypass capacitor = %.2f\" %A_v\n",
"print \"gain in the presence of bypass capacitor = %.2f\" %A_v1"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "gain without bypass capacitor = 1.76",
+ "gain without bypass capacitor = 1.76\n",
"gain in the presence of bypass capacitor = 151.98"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.6, Page Number: 182<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Gain with load'''",
- "",
- "# variable declaration",
- "R_C=10.0**3; #resistance in ohm",
- "R_L=5.0*10**3; #inductor resistance",
- "r_e=6.58; #r_e value",
- "",
- "#calculation",
- "R_c=(R_C*R_L)/(R_C+R_L); #collector resistor",
- "A_v=R_c/r_e; #gain with load",
- "",
- "#result",
- "print \"ac collector resistor = %.2f ohms\" %R_c",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "R_C=10.0**3; #resistance in ohm\n",
+ "R_L=5.0*10**3; #inductor resistance\n",
+ "r_e=6.58; #r_e value\n",
+ "\n",
+ "#calculation\n",
+ "R_c=(R_C*R_L)/(R_C+R_L); #collector resistor\n",
+ "A_v=R_c/r_e; #gain with load\n",
+ "\n",
+ "#result\n",
+ "print \"ac collector resistor = %.2f ohms\" %R_c\n",
"print \"gain with load = %.2f\" %A_v"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "ac collector resistor = 833.33 ohms",
+ "ac collector resistor = 833.33 ohms\n",
"gain with load = 126.65"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.7, Page Number: 184<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Voltage gain with bypass'''",
- "",
- "# variable declaration",
- "R_C=3.3*10**3; #resistance in ohm",
- "R_E1=330.0; #emitter resistance",
- "",
- "#calculation",
- "A_v=R_C/R_E1; #voltage gain",
- "",
- "#result",
+ "\n",
+ "# variable declaration\n",
+ "R_C=3.3*10**3; #resistance in ohm\n",
+ "R_E1=330.0; #emitter resistance\n",
+ "\n",
+ "#calculation\n",
+ "A_v=R_C/R_E1; #voltage gain\n",
+ "\n",
+ "#result\n",
"print \"approximate voltage gain as R_E2 is bypassed by C2 = %.2f\" %A_v"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"approximate voltage gain as R_E2 is bypassed by C2 = 10.00"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.8, Page Number: 184<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Common emitter amplifier'''",
- "",
- "import math",
- "B_DC=150.0;",
- "B_ac=175.0;",
- "V_CC=10.0;",
- "V_s=10.0*10**-3;",
- "R_s=600.0;",
- "R1=47.0*10**3;",
- "R2=10.0*10**3;",
- "R_E1=470.0;",
- "R_E2=470.0;",
- "R_C=4.7*10**3;",
- "R_L=47.00*10**3;",
- "R_IN_base=B_DC*(R_E1+R_E2);",
- "#since R_IN_base is ten times more than R2,it can be neglected in DC voltage calculation",
- "V_B=(R2/(R2+R1))*V_CC;",
- "V_E=V_B-0.7;",
- "I_E=V_E/(R_E1+R_E2);",
- "I_C=I_E;",
- "V_C=V_CC-I_C*R_C;",
- "print('dc collector voltage = %.3f volts'%V_C)",
- "r_e=25.0*10**-3/I_E;",
- "#base resistance",
- "R_in_base=B_ac*(r_e+R_E1);",
- "#total input resistance",
- "R_in_tot=(R1*R2*R_in_base)/(R1*R2+R_in_base*R1+R_in_base*R2);",
- "attenuation=R_in_tot/(R_s+R_in_tot);",
- "#ac collector resistance",
- "R_c=R_C*R_L/(R_C+R_L);",
- "#voltage gain from base to collector",
- "A_v=R_c/R_E1;",
- "#overall voltage gain A_V",
- "A_V=A_v*attenuation;",
- "#rms voltage at collector V_c",
- "V_c=A_V*V_s;",
- "V_out_p=math.sqrt(2)*V_c;",
- "print('V_out peak = %d mV'%(V_out_p*1000))",
- "",
- "################Waveform plotting##############################",
- "",
- "import pylab",
- "import numpy ",
- "",
- "t = arange(0.0, 4.0, 0.0005)",
- "",
- "",
- "subplot(121)",
- "plot(t, V_C+V_c*sin(2*pi*t))",
- "ylim( (4.63,4.82) )",
- "title('Collector Voltage')",
- "",
- "subplot(122)",
- "plot(t, -V_s*sin(2*pi*t))",
- "plot(t, V_out_p*sin(2*pi*t))",
- "ylim( (-0.15,0.15) )",
+ "\n",
+ "import math\n",
+ "B_DC=150.0;\n",
+ "B_ac=175.0;\n",
+ "V_CC=10.0;\n",
+ "V_s=10.0*10**-3;\n",
+ "R_s=600.0;\n",
+ "R1=47.0*10**3;\n",
+ "R2=10.0*10**3;\n",
+ "R_E1=470.0;\n",
+ "R_E2=470.0;\n",
+ "R_C=4.7*10**3;\n",
+ "R_L=47.00*10**3;\n",
+ "R_IN_base=B_DC*(R_E1+R_E2);\n",
+ "#since R_IN_base is ten times more than R2,it can be neglected in DC voltage calculation\n",
+ "V_B=(R2/(R2+R1))*V_CC;\n",
+ "V_E=V_B-0.7;\n",
+ "I_E=V_E/(R_E1+R_E2);\n",
+ "I_C=I_E;\n",
+ "V_C=V_CC-I_C*R_C;\n",
+ "print('dc collector voltage = %.3f volts'%V_C)\n",
+ "r_e=25.0*10**-3/I_E;\n",
+ "#base resistance\n",
+ "R_in_base=B_ac*(r_e+R_E1);\n",
+ "#total input resistance\n",
+ "R_in_tot=(R1*R2*R_in_base)/(R1*R2+R_in_base*R1+R_in_base*R2);\n",
+ "attenuation=R_in_tot/(R_s+R_in_tot);\n",
+ "#ac collector resistance\n",
+ "R_c=R_C*R_L/(R_C+R_L);\n",
+ "#voltage gain from base to collector\n",
+ "A_v=R_c/R_E1;\n",
+ "#overall voltage gain A_V\n",
+ "A_V=A_v*attenuation;\n",
+ "#rms voltage at collector V_c\n",
+ "V_c=A_V*V_s;\n",
+ "V_out_p=math.sqrt(2)*V_c;\n",
+ "print('V_out peak = %d mV'%(V_out_p*1000))\n",
+ "\n",
+ "################Waveform plotting##############################\n",
+ "\n",
+ "import pylab\n",
+ "import numpy \n",
+ "\n",
+ "t = arange(0.0, 4.0, 0.0005)\n",
+ "\n",
+ "\n",
+ "subplot(121)\n",
+ "plot(t, V_C+V_c*sin(2*pi*t))\n",
+ "ylim( (4.63,4.82) )\n",
+ "title('Collector Voltage')\n",
+ "\n",
+ "subplot(122)\n",
+ "plot(t, -V_s*sin(2*pi*t))\n",
+ "plot(t, V_out_p*sin(2*pi*t))\n",
+ "ylim( (-0.15,0.15) )\n",
"title('Source and output AC voltage')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "dc collector voltage = 4.728 volts",
+ "dc collector voltage = 4.728 volts\n",
"V_out peak = 119 mV"
]
- },
+ },
{
- "output_type": "pyout",
- "prompt_number": 9,
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 9,
"text": [
"<matplotlib.text.Text at 0xad2caac>"
]
- },
+ },
{
- "output_type": "display_data",
+ "metadata": {},
+ "output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEICAYAAABfz4NwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzsnXl8VNX5/z+TzCSZrDPZdxJ2AgipuOBXJahIUcGtKtiy\n1GrBpS4t35/W6he01g33Ulv61SqogE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+//XZAXcGe2bJly+i6\n666jBQsWUEJCAo0fP5727t3rf/3rr7+m4uJiSkhIoBtuuIHmzp1LDzzwgGyff8eOHbRt2zaKiooi\nk8lE8fHxNHnyZCIimjZtGt1333109tlnU2JiIl155ZX+31Q49wvEQw89RLNnz6ZHHnmErrjiCv9x\nIbaiJ19++SVlZmaS1+v1H3v33XfpjDPOICLhduUXv/gFRUREkNlspvj4eFqxYgUREf3sZz+jzMxM\nSkpKogsvvJAOHDjgf5+Ghga64oorKDExkc466yz6wx/+QOeff77/9UOHDtEll1xCycnJNGbMGHrr\nrbdCfp7TwiFs27aNjEYjeTyeAc958MEHaerUqVRfX0/19fV03nnn0YMPPkhEwR3Cc889R1OnTqWq\nqipyOp20ePFimjdvHhERlZeXU0JCAq1fv57cbjc1NjbSN998Q0REixYt8t+fiMjpdNKIESPoscce\nI5fLRTt37qSEhAQ6fPgwETGHkJSURJ9//jkRsS9aX/70pz/RJZdc4v97+/btlJaWRm63m15++WUa\nOXIklZWVkd1up2uuuYbmz59PRN0Owdc+JSUl9PLLL/e69+uvv05NTU3k8Xjo6aefpszMTP8X+957\n76WSkhJqbm6myspKmjhxIuXl5RERkcfjoZ/85Cf0xz/+kVwuFx07doyGDx9O77//fvCHxhGtra2U\nkpJCCxcupG3btvVy+EQUtG0DGbCe359ly5aRyWSijRs3EhGRw+Ggyy67jObOnUvNzc3kcrno008/\nJSJmpNPT02nPnj3k9Xpp9erVVFBQ4H8OfQn2zJYtW0YxMTG0bds28nq99Pvf/57OPfdcIiLq6uqi\n/Px8eu6558jtdtM777xDJpOp1/dVrs+/fPly/7k+pk2bRjk5OXTgwAFqb2/3O8xw7xeIESNG0Ouv\nv05Hjhwhk8lEdXV1RCTMVgS614cffuj/+2c/+xk98cQTRBS+XfHxyiuvkN1uJ6fTSXfffXcvJ3fD\nDTfQvHnzyOFw0MGDBykvL48uuOACIiKy2+2Um5tLr776Knk8Htq3bx+lpqbSwYMHg36W08IhvP76\n65SZmRn0nBEjRtC2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j4Lb67xavHmqqurQ1JSEgRB\nGPOV12Q9lnLvH859rSQX9bV2+zokAyE1NRUul2votsvlQlpa2pjbuN1upKamKqo1Y8aMobdthYWF\n8Hq9ePbs2YRzj5aJh9xMXq8XW7duxc6dO4M2jJxs49VSsr8SEhKwceNG3L9/X3Gu8Wrx5nI4HKit\nrcWCBQtQVlaGGzduoKKiYsK5xkN9LT8X9bXG+3pCRyA4eb1etnDhQuZ0OtmbN2/GPfh29+7dUQ+O\n8NTq6elhfr+fMcZYU1MTmzdv3qjZnE4n18G3sTLx1JKTye/3s/Lycnbw4MFRt+HNxlOLN1tvby97\n/vw5Y4wxj8fDbDYbu3btmqJcPLXk7LOA+vp6Vlxc/MHP5T6WPCKlr8erx5uL+lperneFqq/1ykcJ\nP71ej9OnT2P9+vXw+XzYvXs3MjIyUF1dDQDYt28fioqKYLfbkZ6ejri4OJw7d05xrYsXL+LMmTPQ\n6/WIjY1FTU1N0FplZWW4desWnj59CoPBgCNHjsDr9crOxFOLNxMA3LlzBxcuXEBWVhYEQQAAVFVV\n4fHjx7Kz8dTizdbd3Y3Kykr4/X74/X6Ul5dj7dq1ih5Hnlpy9tm7Am+ZleSSIxL6mqceby7qa+33\nNa1lRAghBAB9U5kQQsggGgiEEEIA0EAghBAyiAYCIYQQADQQCCGEDKKBQAghBADwfwJyXZ807NQ0\nAAAAAElFTkSuQmCC\n"
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.9,Page Number: 190<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Power gain delievered to load'''",
- "",
- "# variable declaration",
- "R_E=10.0**3; #emitter resistance",
- "R_L=10.0**3; #resistance in ohm",
- "R1=18.0*10**3; #R1 in ohm",
- "R2=18.0*10**3; #R2 in ohm",
- "B_ac=175.0; #AC value",
- "V_CC=10.0; #voltage in volt",
- "V_BE=0.7; #base-emitter voltage",
- "V_in=1.0; #input voltage in volt",
- "",
- "#calculation",
- "",
- "R_e=(R_E*R_L)/(R_E+R_L); #ac emitter resistance R_e",
- "R_in_base=B_ac*R_e; #resistance from base R_in_base",
- "",
- "#total input resiatance R_in_tot",
- "R_in_tot=(R1*R2*R_in_base)/(R1*R2+R1*R_in_base+R2*R_in_base);",
- "print \"total input resistance = %.2f ohms\" %R_in_tot",
- "V_E=((R2/(R1+R2))*V_CC)-V_BE; #emitter voltage",
- "I_E=V_E/R_E; #emitter current",
- "r_e=25.0*10**-3/I_E; #emitter resistance",
- "A_v=R_e/(r_e+R_e);",
- "print \"voltage gain = %.2f\" %A_v",
- "#ac emitter current I_e",
- "#V_e=A_v*V_b=1V",
- "V_e=1.0; #V_evoltage",
- "I_e=V_e/R_e; #emitter current",
- "I_in=V_in/R_in_tot; #input current in ampere",
- "A_i=I_e/I_in; #current gain",
- "print \"current gain = %.2f\" %A_i",
- "A_p=A_i; #power gain",
- "#since R_L=R_E, one half of the total power is disspated to R_L",
- "A_p_load=A_p/2.0; #power load",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "R_E=10.0**3; #emitter resistance\n",
+ "R_L=10.0**3; #resistance in ohm\n",
+ "R1=18.0*10**3; #R1 in ohm\n",
+ "R2=18.0*10**3; #R2 in ohm\n",
+ "B_ac=175.0; #AC value\n",
+ "V_CC=10.0; #voltage in volt\n",
+ "V_BE=0.7; #base-emitter voltage\n",
+ "V_in=1.0; #input voltage in volt\n",
+ "\n",
+ "#calculation\n",
+ "\n",
+ "R_e=(R_E*R_L)/(R_E+R_L); #ac emitter resistance R_e\n",
+ "R_in_base=B_ac*R_e; #resistance from base R_in_base\n",
+ "\n",
+ "#total input resiatance R_in_tot\n",
+ "R_in_tot=(R1*R2*R_in_base)/(R1*R2+R1*R_in_base+R2*R_in_base);\n",
+ "print \"total input resistance = %.2f ohms\" %R_in_tot\n",
+ "V_E=((R2/(R1+R2))*V_CC)-V_BE; #emitter voltage\n",
+ "I_E=V_E/R_E; #emitter current\n",
+ "r_e=25.0*10**-3/I_E; #emitter resistance\n",
+ "A_v=R_e/(r_e+R_e);\n",
+ "print \"voltage gain = %.2f\" %A_v\n",
+ "#ac emitter current I_e\n",
+ "#V_e=A_v*V_b=1V\n",
+ "V_e=1.0; #V_evoltage\n",
+ "I_e=V_e/R_e; #emitter current\n",
+ "I_in=V_in/R_in_tot; #input current in ampere\n",
+ "A_i=I_e/I_in; #current gain\n",
+ "print \"current gain = %.2f\" %A_i\n",
+ "A_p=A_i; #power gain\n",
+ "#since R_L=R_E, one half of the total power is disspated to R_L\n",
+ "A_p_load=A_p/2.0; #power load\n",
"print \"power gain delivered to load = %.2f\" %A_p_load"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "total input resistance = 8160.62 ohms",
- "voltage gain = 0.99",
- "current gain = 16.32",
+ "total input resistance = 8160.62 ohms\n",
+ "voltage gain = 0.99\n",
+ "current gain = 16.32\n",
"power gain delivered to load = 8.16"
]
}
- ],
+ ],
"prompt_number": 10
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.10, Page Number: 193<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Overall voltage gain'''",
- "",
- "# variable declaration",
- "V_CC=12.0; #source voltage in volt",
- "V_BE=0.7; #base-emitter volatge",
- "R_C=1.0*10**3; #resistance in ohm",
- "r_e_ce=5.0; #for common emitter amplifier",
- "R1=10.0*10**3; #resistance in ohm",
- "R2=22.0*10**3; #resistance in ohm ",
- "R_E=22.0; #emitter resistance in ohm",
- "R_L=8.0; #load resistance in ohm",
- "B_DC=100.0; #dc value",
- "B_ac=100.0; #ac value",
- "",
- "#calculation",
- "pt=R2+B_DC**2*R_E #temp variable",
- "V_B=((R2*B_DC**2*R_E/(pt))/(R1+(R2*B_DC**2*R_E/(pt))))*V_CC;",
- "V_E=V_B-2.0*V_BE; #emitter voltage",
- "I_E=V_E/R_E; #emitter current",
- "r_e=25.0*10**-3/I_E; #for darlington emitter-follower",
- "P_R_E=I_E**2*R_E; #power dissipated by R_E",
- "P_Q2=(V_CC-V_E)*I_E #power dissipated by transistor Q2",
- "R_e=R_E*R_L/(R_E+R_L); #ac emitter resi. of darlington emitter follower",
- "#total input resistance of darlington",
- "kt=R_e+r_e #temp varaible",
- "R_in_tot=R1*R2*B_ac**2*(kt)/(R1*R2+R1*B_ac**2*(kt)+R2*B_ac**2*(kt)); ",
- "R_c=R_C*R_in_tot/(R_C+R_in_tot); #effective ac resistance",
- "A_v_CE=R_c/r_e_ce; #voltage gain of common emitter",
- "A_v_EF=R_e/(r_e+R_e); #voltage gain of common emitter amplifier",
- "A_v=A_v_CE*A_v_EF; #overall voltage gain",
- "",
- "#result",
- "print \"voltage gain of common emitter amplifier= %.2f\" %A_v_CE",
- "print \"voltage gain of common emitter amplifier= %.2f\" %A_v_EF",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_CC=12.0; #source voltage in volt\n",
+ "V_BE=0.7; #base-emitter volatge\n",
+ "R_C=1.0*10**3; #resistance in ohm\n",
+ "r_e_ce=5.0; #for common emitter amplifier\n",
+ "R1=10.0*10**3; #resistance in ohm\n",
+ "R2=22.0*10**3; #resistance in ohm \n",
+ "R_E=22.0; #emitter resistance in ohm\n",
+ "R_L=8.0; #load resistance in ohm\n",
+ "B_DC=100.0; #dc value\n",
+ "B_ac=100.0; #ac value\n",
+ "\n",
+ "#calculation\n",
+ "pt=R2+B_DC**2*R_E #temp variable\n",
+ "V_B=((R2*B_DC**2*R_E/(pt))/(R1+(R2*B_DC**2*R_E/(pt))))*V_CC;\n",
+ "V_E=V_B-2.0*V_BE; #emitter voltage\n",
+ "I_E=V_E/R_E; #emitter current\n",
+ "r_e=25.0*10**-3/I_E; #for darlington emitter-follower\n",
+ "P_R_E=I_E**2*R_E; #power dissipated by R_E\n",
+ "P_Q2=(V_CC-V_E)*I_E #power dissipated by transistor Q2\n",
+ "R_e=R_E*R_L/(R_E+R_L); #ac emitter resi. of darlington emitter follower\n",
+ "#total input resistance of darlington\n",
+ "kt=R_e+r_e #temp varaible\n",
+ "R_in_tot=R1*R2*B_ac**2*(kt)/(R1*R2+R1*B_ac**2*(kt)+R2*B_ac**2*(kt)); \n",
+ "R_c=R_C*R_in_tot/(R_C+R_in_tot); #effective ac resistance\n",
+ "A_v_CE=R_c/r_e_ce; #voltage gain of common emitter\n",
+ "A_v_EF=R_e/(r_e+R_e); #voltage gain of common emitter amplifier\n",
+ "A_v=A_v_CE*A_v_EF; #overall voltage gain\n",
+ "\n",
+ "#result\n",
+ "print \"voltage gain of common emitter amplifier= %.2f\" %A_v_CE\n",
+ "print \"voltage gain of common emitter amplifier= %.2f\" %A_v_EF\n",
"print \"overall voltage gain = %.2f\" %A_v"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "voltage gain of common emitter amplifier= 172.08",
- "voltage gain of common emitter amplifier= 0.99",
+ "voltage gain of common emitter amplifier= 172.08\n",
+ "voltage gain of common emitter amplifier= 0.99\n",
"overall voltage gain = 169.67"
]
}
- ],
+ ],
"prompt_number": 11
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.11, Page Number: 196<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' voltage,current and power gain'''",
- "",
- "# variable declaration",
- "B_DC=250.0; #dc value",
- "R_C=2.2*10**3; #resistance in ohm",
- "R_E=1.0*10**3; #emitter resistance",
- "R_L=10.0*10**3;#load resistance",
- "R1=56.0*10**3; #resistance in ohm",
- "R2=12.0*10**3; #resistance in ohm",
- "V_BE=0.7; #base-emitter voltage in volt",
- "V_CC=10.0; #source voltage in volt",
- "",
- "#calculation",
- "#since B_DC*R_E>>R2",
- "V_B=(R2/(R1+R2))*V_CC;",
- "V_E=V_B-V_BE; #emiiter voltage",
- "I_E=V_E/R_E; #emitter current",
- "r_e=25.0*10**-3/I_E; #r_e value",
- "R_in=r_e; #input resistance",
- "R_c=R_C*R_L/(R_C+R_L); #ac collector resistance",
- "A_v=R_c/r_e; #current gain",
- "#current gain is almost 1",
- "#power gain is approximately equal to voltage gain",
- "A_p=A_v; #power gain",
- "A_i=1; #current gain",
- "",
- "#result",
- "print \"input resistance = %.2f ohms\" %R_in",
- "print \"voltage gain = %.2f\" %A_v",
- "print \"current gain = %.2f\" %A_i",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "B_DC=250.0; #dc value\n",
+ "R_C=2.2*10**3; #resistance in ohm\n",
+ "R_E=1.0*10**3; #emitter resistance\n",
+ "R_L=10.0*10**3;#load resistance\n",
+ "R1=56.0*10**3; #resistance in ohm\n",
+ "R2=12.0*10**3; #resistance in ohm\n",
+ "V_BE=0.7; #base-emitter voltage in volt\n",
+ "V_CC=10.0; #source voltage in volt\n",
+ "\n",
+ "#calculation\n",
+ "#since B_DC*R_E>>R2\n",
+ "V_B=(R2/(R1+R2))*V_CC;\n",
+ "V_E=V_B-V_BE; #emiiter voltage\n",
+ "I_E=V_E/R_E; #emitter current\n",
+ "r_e=25.0*10**-3/I_E; #r_e value\n",
+ "R_in=r_e; #input resistance\n",
+ "R_c=R_C*R_L/(R_C+R_L); #ac collector resistance\n",
+ "A_v=R_c/r_e; #current gain\n",
+ "#current gain is almost 1\n",
+ "#power gain is approximately equal to voltage gain\n",
+ "A_p=A_v; #power gain\n",
+ "A_i=1; #current gain\n",
+ "\n",
+ "#result\n",
+ "print \"input resistance = %.2f ohms\" %R_in\n",
+ "print \"voltage gain = %.2f\" %A_v\n",
+ "print \"current gain = %.2f\" %A_i\n",
"print \"power gain = %.2f\" %A_p"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "input resistance = 23.48 ohms",
- "voltage gain = 76.80",
- "current gain = 1.00",
+ "input resistance = 23.48 ohms\n",
+ "voltage gain = 76.80\n",
+ "current gain = 1.00\n",
"power gain = 76.80"
]
}
- ],
+ ],
"prompt_number": 12
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 6.12, Page Number: 197<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' total voltage gain in decibel'''",
- "",
- "import math",
- "# variable declaration",
- "A_v1=10.0;",
- "A_v2=15.0;",
- "A_v3=20.0;",
- "",
- "#calcultion",
- "A_v=A_v1*A_v2*A_v3; #overall voltage gain",
- "A_v1_dB=20.0*math.log10(A_v1); #gain in decibel",
- "A_v2_dB=20.0*math.log10(A_v2); #gain in decibel",
- "A_v3_dB=20.0*math.log10(A_v3); #gain in decibel",
- "A_v_dB=A_v1_dB+A_v2_dB+A_v3_dB; #total gain in decibel",
- "",
- "#result",
- "print \"overall voltage gain = %.1f\" %A_v",
- "print \"Av1 = %.1f dB\" %A_v1_dB",
- "print \"Av2 = %.1f dB\" %A_v2_dB",
- "print \"Av3 = %.1f dB\" %A_v3_dB",
+ "\n",
+ "\n",
+ "import math\n",
+ "# variable declaration\n",
+ "A_v1=10.0;\n",
+ "A_v2=15.0;\n",
+ "A_v3=20.0;\n",
+ "\n",
+ "#calcultion\n",
+ "A_v=A_v1*A_v2*A_v3; #overall voltage gain\n",
+ "A_v1_dB=20.0*math.log10(A_v1); #gain in decibel\n",
+ "A_v2_dB=20.0*math.log10(A_v2); #gain in decibel\n",
+ "A_v3_dB=20.0*math.log10(A_v3); #gain in decibel\n",
+ "A_v_dB=A_v1_dB+A_v2_dB+A_v3_dB; #total gain in decibel\n",
+ "\n",
+ "#result\n",
+ "print \"overall voltage gain = %.1f\" %A_v\n",
+ "print \"Av1 = %.1f dB\" %A_v1_dB\n",
+ "print \"Av2 = %.1f dB\" %A_v2_dB\n",
+ "print \"Av3 = %.1f dB\" %A_v3_dB\n",
"print \"total voltage gain =%.1f dB\" %A_v_dB"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "overall voltage gain = 3000.0",
- "Av1 = 20.0 dB",
- "Av2 = 23.5 dB",
- "Av3 = 26.0 dB",
+ "overall voltage gain = 3000.0\n",
+ "Av1 = 20.0 dB\n",
+ "Av2 = 23.5 dB\n",
+ "Av3 = 26.0 dB\n",
"total voltage gain =69.5 dB"
]
}
- ],
+ ],
"prompt_number": 13
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter7.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter7.ipynb
index c8920a17..f0b687da 100644
--- a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter7.ipynb
+++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter7.ipynb
@@ -1,727 +1,763 @@
{
"metadata": {
- "name": "Chapter_7"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:c434c0d6bd002c83e25d1e202a9fcaade1263c70fe4310df9047177e37999c7b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 7: Field-effect Transistors (FETs)<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.1, Page Number: 217<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
"%pylab inline"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "",
- "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].",
+ "\n",
+ "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n",
"For more information, type 'help(pylab)'."
]
}
- ],
+ ],
"prompt_number": 318
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Constant current area of operation of JFET'''",
- "",
- "# variable declaration",
- "V_GS_off=-4; # voltage in volt",
- "I_DSS=12*10**-3; # current in ampere",
- "R_D=560; # resistance in ohm",
- "",
- "#calculation",
- "V_P=-1*V_GS_off; # volt ",
- "V_DS=V_P; # Vds in volt",
- "I_D=I_DSS; # current accross resistor",
- "V_R_D=I_D*R_D; #voltage across resistor",
- "V_DD=V_DS+V_R_D; # Vdd in volt",
- "",
- "# result",
- "print \"The value of V_DD required to put the device in the constant\"",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_GS_off=-4; # voltage in volt\n",
+ "I_DSS=12*10**-3; # current in ampere\n",
+ "R_D=560; # resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "V_P=-1*V_GS_off; # volt \n",
+ "V_DS=V_P; # Vds in volt\n",
+ "I_D=I_DSS; # current accross resistor\n",
+ "V_R_D=I_D*R_D; #voltage across resistor\n",
+ "V_DD=V_DS+V_R_D; # Vdd in volt\n",
+ "\n",
+ "# result\n",
+ "print \"The value of V_DD required to put the device in the constant\"\n",
"print \" current area of operation of JFET = %.2f volt\" %V_DD"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "The value of V_DD required to put the device in the constant",
+ "The value of V_DD required to put the device in the constant\n",
" current area of operation of JFET = 10.72 volt"
]
}
- ],
+ ],
"prompt_number": 319
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.2, Page Number: 218<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Drain current'''",
- "",
- "print('The p-channel JFET requires a positive gate to source voltage.')",
- "print('The more positive the voltage, the lesser the drain current.')",
+ "\n",
+ "\n",
+ "print('The p-channel JFET requires a positive gate to source voltage.')\n",
+ "print('The more positive the voltage, the lesser the drain current.')\n",
"print('Any further increase in V_GS keeps the JFET cut off, so I_D remains 0')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "The p-channel JFET requires a positive gate to source voltage.",
- "The more positive the voltage, the lesser the drain current.",
+ "The p-channel JFET requires a positive gate to source voltage.\n",
+ "The more positive the voltage, the lesser the drain current.\n",
"Any further increase in V_GS keeps the JFET cut off, so I_D remains 0"
]
}
- ],
+ ],
"prompt_number": 320
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.3, Page number: 219<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''JFET current voltage'''",
- "",
- "I_DSS=9.0*10**-3;",
- "V_GS_off=-8.0;",
- "V_GS=0.0;",
- "I_D=9.0*10**-3",
- "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;",
- "print('Value of I_D for V_GS=0V is %f A '%I_D)",
- "V_GS=-1.0",
- "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;",
- "print('Value of I_D for V_GS=-1V is %f A'%I_D)",
- "V_GS= -4.0",
- "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;",
+ "\n",
+ "\n",
+ "I_DSS=9.0*10**-3;\n",
+ "V_GS_off=-8.0;\n",
+ "V_GS=0.0;\n",
+ "I_D=9.0*10**-3\n",
+ "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n",
+ "print('Value of I_D for V_GS=0V is %f A '%I_D)\n",
+ "V_GS=-1.0\n",
+ "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n",
+ "print('Value of I_D for V_GS=-1V is %f A'%I_D)\n",
+ "V_GS= -4.0\n",
+ "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n",
"print('Value of I_D for V_GS=-4V is %f A'%I_D)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Value of I_D for V_GS=0V is 0.009000 A ",
- "Value of I_D for V_GS=-1V is 0.006891 A",
+ "Value of I_D for V_GS=0V is 0.009000 A \n",
+ "Value of I_D for V_GS=-1V is 0.006891 A\n",
"Value of I_D for V_GS=-4V is 0.002250 A"
]
}
- ],
+ ],
"prompt_number": 321
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.4, Page Number: 220<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''JFET transconductance'''",
- "",
- "#Variable Declaration",
- "I_DSS=3.0*10**-3;",
- "V_GS_off=-6.0;",
- "y_fs_max=5000.0*10**-6;",
- "V_GS=-4.0;",
- "g_m0=y_fs_max;",
- "",
- "#Calculation",
- "g_m=g_m0*(1-(V_GS/V_GS_off));",
- "I_D=I_DSS*(1-(V_GS/V_GS_off))",
- "",
- "#Result",
- "print('forward transconductance = %f Siemens'%g_m)",
+ "\n",
+ "\n",
+ "#Variable Declaration\n",
+ "I_DSS=3.0*10**-3;\n",
+ "V_GS_off=-6.0;\n",
+ "y_fs_max=5000.0*10**-6;\n",
+ "V_GS=-4.0;\n",
+ "g_m0=y_fs_max;\n",
+ "\n",
+ "#Calculation\n",
+ "g_m=g_m0*(1-(V_GS/V_GS_off));\n",
+ "I_D=I_DSS*(1-(V_GS/V_GS_off))\n",
+ "\n",
+ "#Result\n",
+ "print('forward transconductance = %f Siemens'%g_m)\n",
"print('value of I D = %f A'%I_D)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "forward transconductance = 0.001667 Siemens",
+ "forward transconductance = 0.001667 Siemens\n",
"value of I D = 0.001000 A"
]
}
- ],
+ ],
"prompt_number": 322
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.5, Page Number: 221<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find input resistance'''",
- "",
- "# variable declaration",
- "V_GS=-20.0; # voltage in volt",
- "I_GSS=-2*10**-9; # current in ampere",
- "",
- "#calculation",
- "R_IN1=abs((-20/(2*10**-9))) # resistance in ohm",
- "R_IN=R_IN1/(10**9)",
- "",
- "# result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_GS=-20.0; # voltage in volt\n",
+ "I_GSS=-2*10**-9; # current in ampere\n",
+ "\n",
+ "#calculation\n",
+ "R_IN1=abs((-20/(2*10**-9))) # resistance in ohm\n",
+ "R_IN=R_IN1/(10**9)\n",
+ "\n",
+ "# result\n",
"print \"Input resistance = %d Giga ohm\" %R_IN"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Input resistance = 10 Giga ohm"
]
}
- ],
+ ],
"prompt_number": 323
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.6, Page Number: 223<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find gate to source voltage'''",
- "",
- "# variable declaration",
- "V_DD=15; # voltage in volt",
- "V_G=0; # voltage in volt",
- "I_D=5*10**-3; # current in ampere",
- "R_D=1*10**3; # resistance in ohm",
- "R_G=10*10**6; # resistance in ohm",
- "R_S=220; # resistance in ohm",
- "",
- "# calculation",
- "V_S=I_D*R_S; # source voltage in volt",
- "V_D=V_DD-I_D*R_D; # drain voltage in volt",
- "V_DS=V_D-V_S; # drain to source voltage in volt",
- "V_GS=V_G-V_S; # gate to source voltage in volt",
- "",
- "# result",
- "print \"Drain to source voltage = %.2f volts\" %V_DS",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_DD=15; # voltage in volt\n",
+ "V_G=0; # voltage in volt\n",
+ "I_D=5*10**-3; # current in ampere\n",
+ "R_D=1*10**3; # resistance in ohm\n",
+ "R_G=10*10**6; # resistance in ohm\n",
+ "R_S=220; # resistance in ohm\n",
+ "\n",
+ "# calculation\n",
+ "V_S=I_D*R_S; # source voltage in volt\n",
+ "V_D=V_DD-I_D*R_D; # drain voltage in volt\n",
+ "V_DS=V_D-V_S; # drain to source voltage in volt\n",
+ "V_GS=V_G-V_S; # gate to source voltage in volt\n",
+ "\n",
+ "# result\n",
+ "print \"Drain to source voltage = %.2f volts\" %V_DS\n",
"print \"Gate to source voltage = %.2f volts\" %V_GS"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Drain to source voltage = 8.90 volts",
+ "Drain to source voltage = 8.90 volts\n",
"Gate to source voltage = -1.10 volts"
]
}
- ],
+ ],
"prompt_number": 324
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.7, Page Number: 224<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find Gate resistance'''",
- "",
- "# variable declaration",
- "V_GS=-5.0; # voltage in volt",
- "I_D=6.25*10**-3; # current in ampere",
- "",
- "#calculation",
- "R_G=abs((V_GS/I_D)) # resistance in ohm",
- "",
- "# result",
+ "\n",
+ "# variable declaration\n",
+ "V_GS=-5.0; # voltage in volt\n",
+ "I_D=6.25*10**-3; # current in ampere\n",
+ "\n",
+ "#calculation\n",
+ "R_G=abs((V_GS/I_D)) # resistance in ohm\n",
+ "\n",
+ "# result\n",
"print \"Gate resistance = %d ohm\" %R_G"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Gate resistance = 800 ohm"
]
}
- ],
+ ],
"prompt_number": 325
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.8, Page Number: 224<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Self bias Q point'''",
- "",
- "I_DSS=25.0*10**-3;",
- "V_GS_off=15.0;",
- "V_GS=5.0;",
- "I_D=I_DSS*(1-(V_GS/V_GS_off))**2",
- "R_S=abs((V_GS/I_D))",
- "print('Drain current = %f Amperes'%I_D)",
+ "\n",
+ "\n",
+ "I_DSS=25.0*10**-3;\n",
+ "V_GS_off=15.0;\n",
+ "V_GS=5.0;\n",
+ "I_D=I_DSS*(1-(V_GS/V_GS_off))**2\n",
+ "R_S=abs((V_GS/I_D))\n",
+ "print('Drain current = %f Amperes'%I_D)\n",
"print('Source resistance = %.0f Ohms'%R_S)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Drain current = 0.011111 Amperes",
+ "Drain current = 0.011111 Amperes\n",
"Source resistance = 450 Ohms"
]
}
- ],
+ ],
"prompt_number": 326
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.9, Page Number: 225<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find Drain resistance'''",
- "",
- "# variable declaration",
- "V_D=6; # drain voltage in volt",
- "V_GS_off=-3; # off voltage in volt",
- "V_DD=12; # voltage in volt",
- "I_DSS=12*10**-3; # current in ampere",
- "",
- "#calculation",
- "I_D=I_DSS/2; #MIDPOINT BIAS",
- "V_GS=V_GS_off/3.4; #MIDPOINT BIAS",
- "R_S=abs((V_GS/I_D)) #resistance i voltage",
- "R_D=(V_DD-V_D)/I_D #resistance in voltage ",
- "",
- "# result",
- "print \"Source resistance = %.2f ohm\" %R_S",
+ "\n",
+ "# variable declaration\n",
+ "V_D=6; # drain voltage in volt\n",
+ "V_GS_off=-3; # off voltage in volt\n",
+ "V_DD=12; # voltage in volt\n",
+ "I_DSS=12*10**-3; # current in ampere\n",
+ "\n",
+ "#calculation\n",
+ "I_D=I_DSS/2; #MIDPOINT BIAS\n",
+ "V_GS=V_GS_off/3.4; #MIDPOINT BIAS\n",
+ "R_S=abs((V_GS/I_D)) #resistance i voltage\n",
+ "R_D=(V_DD-V_D)/I_D #resistance in voltage \n",
+ "\n",
+ "# result\n",
+ "print \"Source resistance = %.2f ohm\" %R_S\n",
"print \"Drain resistance = %d ohm\" %R_D"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Source resistance = 147.06 ohm",
+ "Source resistance = 147.06 ohm\n",
"Drain resistance = 1000 ohm"
]
}
- ],
+ ],
"prompt_number": 327
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.10, Page Number: 227<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find transfer characteristic'''",
- "",
- "import pylab",
- "import numpy",
- "",
- "# variable declaration",
- "R_S=680.0; # resistance in ohm",
- "I_D=0; # current in ampere",
- "",
- "#calculation",
- "V_GS=I_D*R_S; #FOR I_D=0A",
- "",
- "I_DSS=4*10**-3; # current in ampere",
- "I_D=I_DSS; # currents are equal",
- "V_GS1=-1*I_D*R_S; #FOR I_D=4mA",
- "",
- "# result",
- "print \"V_GS at I_D=0amp is %d volt\" %V_GS",
- "print \"V_GS at I_D=4mA is %.2f volt\" %V_GS1",
- "print \"Plotting load line using the values of V_GS at I_D=0 and 4mA,\"",
- "print \" we find the intersection of load line with transfer characteristic\"",
- "print \" to get Q-point values of V_GS=-1.5V and I_D=2.25mA\"",
- "",
- "#########PLOT######################",
- "idss=4",
- "vgsoff=-6",
- "vgs=arange(-6.0,0.0,0.0005)",
- "idk=arange(0.0,4.0,0.0005)",
- "ids=arange(0.0,2.25,0.0005)",
- "vgsk=-idk*0.68",
- "i_d=idss*(1-(vgs/vgsoff))**2",
- "text(-3.00,2.25,'Q Point',size=13)",
- "text(-3.25,2,'(-1.5V, 2.25mA)')",
- "plot(vgs,i_d)",
- "plot(vgsk,idk,'b')",
- "plot(-1.5,2.25,'o')",
- "ylim( (0,5) )",
- "title('Transfer characteristic curve')",
- "xlabel('Vgs')",
+ "\n",
+ "import pylab\n",
+ "import numpy\n",
+ "\n",
+ "# variable declaration\n",
+ "R_S=680.0; # resistance in ohm\n",
+ "I_D=0; # current in ampere\n",
+ "\n",
+ "#calculation\n",
+ "V_GS=I_D*R_S; #FOR I_D=0A\n",
+ "\n",
+ "I_DSS=4*10**-3; # current in ampere\n",
+ "I_D=I_DSS; # currents are equal\n",
+ "V_GS1=-1*I_D*R_S; #FOR I_D=4mA\n",
+ "\n",
+ "# result\n",
+ "print \"V_GS at I_D=0amp is %d volt\" %V_GS\n",
+ "print \"V_GS at I_D=4mA is %.2f volt\" %V_GS1\n",
+ "print \"Plotting load line using the values of V_GS at I_D=0 and 4mA,\"\n",
+ "print \" we find the intersection of load line with transfer characteristic\"\n",
+ "print \" to get Q-point values of V_GS=-1.5V and I_D=2.25mA\"\n",
+ "\n",
+ "#########PLOT######################\n",
+ "idss=4\n",
+ "vgsoff=-6\n",
+ "vgs=arange(-6.0,0.0,0.0005)\n",
+ "idk=arange(0.0,4.0,0.0005)\n",
+ "ids=arange(0.0,2.25,0.0005)\n",
+ "vgsk=-idk*0.68\n",
+ "i_d=idss*(1-(vgs/vgsoff))**2\n",
+ "text(-3.00,2.25,'Q Point',size=13)\n",
+ "text(-3.25,2,'(-1.5V, 2.25mA)')\n",
+ "plot(vgs,i_d)\n",
+ "plot(vgsk,idk,'b')\n",
+ "plot(-1.5,2.25,'o')\n",
+ "ylim( (0,5) )\n",
+ "title('Transfer characteristic curve')\n",
+ "xlabel('Vgs')\n",
"ylabel('Idss')"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "V_GS at I_D=0amp is 0 volt",
- "V_GS at I_D=4mA is -2.72 volt",
- "Plotting load line using the values of V_GS at I_D=0 and 4mA,",
- " we find the intersection of load line with transfer characteristic",
+ "V_GS at I_D=0amp is 0 volt\n",
+ "V_GS at I_D=4mA is -2.72 volt\n",
+ "Plotting load line using the values of V_GS at I_D=0 and 4mA,\n",
+ " we find the intersection of load line with transfer characteristic\n",
" to get Q-point values of V_GS=-1.5V and I_D=2.25mA"
]
- },
+ },
{
- "output_type": "pyout",
- "prompt_number": 328,
+ "metadata": {},
+ "output_type": "pyout",
+ "prompt_number": 328,
"text": [
"<matplotlib.text.Text at 0xd95b60c>"
]
- },
+ },
{
- "output_type": "display_data",
+ "metadata": {},
+ "output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEXCAYAAABSwdSZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8TNf7B/BPNqIVkVCxhSxoLGmEhqJqNPZ9J3ZCVVe6\nWaqkVW2/VBeKLr+gakmtRWypJagt9rWWZhNbkCCJJJLMnN8fp5kKWZmZO3Pn83695iVm7tz73Eue\nOXPuOeexEUIIEBGRKtgqHQARERkOkzoRkYowqRMRqQiTOhGRijCpExGpCJM6EZGKMKnTU0lMTMQr\nr7yCcuXK4cMPPzTqsTQaDUJDQ416DFP58ssvMXr06Cd6r5OTE+Li4gwbEKmGvdIB0JMrW7YsbGxs\nAAD379+Ho6Mj7OzsAAA///wzgoKCjB7Dzz//jEqVKiElJcXox7KxsdGfr5KGDx8Od3d3TJ8+/Yn3\nMWnSpGJtp9FoMGTIEAQHB+ufS01NfeLjkvoxqVuwtLQ0/c+enp4IDQ3Fq6+++th2OTk5sLc3zj91\nfHw86tat+0TvNWZcRdHpdLC1VeaLqlar1X/4FsUcPsQepuS/GRUPu19UKDIyEtWrV8fMmTNRpUoV\nBAcH4+7du+jSpQsqVaoEV1dXdO3aFVevXtW/R6PRYOrUqXj55ZdRrlw5tG/fHklJSQCAzMxMDB48\nGBUrVoSLiwuaNGmCmzdvYvjw4ViyZAlmzpwJJycn7Ny5E0IIfPXVV6hVqxYqVqyI/v37486dOwCA\nuLg42NraYuHChahZsybatGmTb/zr169Hw4YN4ezsjFq1aiEiIkL/WlxcXL4xAkDfvn1RpUoVlC9f\nHq1atcK5c+f0rw0fPhxjx45Fp06dULZsWURGRmLTpk3w9/eHs7MzatSogU8//TRPHH/99ReaN28O\nFxcX1KhRA7/++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fatWsRHx+Pv//+G4mJiahbty6Cg4ORlJSEP/74A+fPnwcApKSkKHwGREVjS52s\nysNdML///juCgoKwb98+9OvXDwDg5uaG1q1bAwDKly8PR0dHBAcHY926dShTpoxicRMVF5M6WZVu\n3bphx44dOH78ONLT0/XruuQ3sdrOzg5RUVHo06cPwsPD0aFDB1OHS1RiTOpkVcqWLYvWrVtjxIgR\n+hukLVq0wJo1ayCEQGJiIiIjIwEA9+/fx927d9GxY0d88803OHnypIKRExUP+9TJ6gQFBaFXr15Y\nuXIlAHkDdceOHahXrx7c3d3RqFEjODs7IzU1Fd27d0dmZiaEEPj2228VjpyoaFzQiwiyVf7ss88i\nKSkJTZs2xf79+1W1MiNZD7bUiQB06dIFd+/eRVZWFqZOncqEThaLLXUiIhXhjVIiIhVhUiciUhEm\ndSIiFWFSJyJSESZ1IiIVYVInIlKR/wdjx32hRVMVVQAAAABJRU5ErkJggg==\n"
}
- ],
+ ],
"prompt_number": 328
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.11, Page Number: 228<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find gate to source voltage'''",
- "",
- "# variable declaration",
- "V_DD=12; # voltage in volt",
- "V_D=7; # voltage in volt",
- "R_D=3.3*10**3; # resistance in ohm",
- "R_S=2.2*10**3; # resistance in ohm",
- "R_1=6.8*10**6; # resistance in ohm",
- "R_2=1*10**6; # resistance in ohm",
- "",
- "#calculation",
- "I_D=(V_DD-V_D)/R_D; # drain current in ampere",
- "V_S=I_D*R_S; # source voltage in volt",
- "V_G=(R_2/(R_1+R_2))*V_DD; # gate voltage in volt",
- "V_GS=V_G-V_S; # gate to source voltage in volt",
- "",
- "# result",
- "print \"Drain Current = %.4f Ampere\" %I_D",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_DD=12; # voltage in volt\n",
+ "V_D=7; # voltage in volt\n",
+ "R_D=3.3*10**3; # resistance in ohm\n",
+ "R_S=2.2*10**3; # resistance in ohm\n",
+ "R_1=6.8*10**6; # resistance in ohm\n",
+ "R_2=1*10**6; # resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "I_D=(V_DD-V_D)/R_D; # drain current in ampere\n",
+ "V_S=I_D*R_S; # source voltage in volt\n",
+ "V_G=(R_2/(R_1+R_2))*V_DD; # gate voltage in volt\n",
+ "V_GS=V_G-V_S; # gate to source voltage in volt\n",
+ "\n",
+ "# result\n",
+ "print \"Drain Current = %.4f Ampere\" %I_D\n",
"print \"Gate to source voltage = %.4f volts\" %V_GS"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Drain Current = 0.0015 Ampere",
+ "Drain Current = 0.0015 Ampere\n",
"Gate to source voltage = -1.7949 volts"
]
}
- ],
+ ],
"prompt_number": 329
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.12, Page Number: 229<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find transfer characteristic for Q-point'''",
- "",
- "# variable declaration",
- "R_1=2.2*10**6; # resistance in ohm ",
- "R_2=R_1; # resistance in ohm",
- "V_DD=8; # voltage in volt",
- "R_S=3.3*10**3; # resistance in ohm",
- "",
- "#calculation",
- "V_GS=(R_2/(R_1+R_2))*V_DD; #FOR I_D=0A",
- "V_G=V_GS; # voltage in volt",
- "I_D=(V_G-0)/R_S; #FOR V_GS=0V",
- "",
- "# result",
- "print \"V_GS = %d volt\" %V_GS",
- "print \"at V_GS=0V. I_D = %.4f ampere\" %I_D",
- "print \"Plotting load line using the value of V_GS=4V at I_D=0\"",
- "print \" and I_D=1.2mA at V_GS=0V, we find the intersection of\"",
- "print \" load line with transfer characteristic to get Q-point\"",
+ "\n",
+ "# variable declaration\n",
+ "R_1=2.2*10**6; # resistance in ohm \n",
+ "R_2=R_1; # resistance in ohm\n",
+ "V_DD=8; # voltage in volt\n",
+ "R_S=3.3*10**3; # resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "V_GS=(R_2/(R_1+R_2))*V_DD; #FOR I_D=0A\n",
+ "V_G=V_GS; # voltage in volt\n",
+ "I_D=(V_G-0)/R_S; #FOR V_GS=0V\n",
+ "\n",
+ "# result\n",
+ "print \"V_GS = %d volt\" %V_GS\n",
+ "print \"at V_GS=0V. I_D = %.4f ampere\" %I_D\n",
+ "print \"Plotting load line using the value of V_GS=4V at I_D=0\"\n",
+ "print \" and I_D=1.2mA at V_GS=0V, we find the intersection of\"\n",
+ "print \" load line with transfer characteristic to get Q-point\"\n",
"print \" values of V_GS=-1.8V and I_D=1.8mA\""
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "V_GS = 4 volt",
- "at V_GS=0V. I_D = 0.0012 ampere",
- "Plotting load line using the value of V_GS=4V at I_D=0",
- " and I_D=1.2mA at V_GS=0V, we find the intersection of",
- " load line with transfer characteristic to get Q-point",
+ "V_GS = 4 volt\n",
+ "at V_GS=0V. I_D = 0.0012 ampere\n",
+ "Plotting load line using the value of V_GS=4V at I_D=0\n",
+ " and I_D=1.2mA at V_GS=0V, we find the intersection of\n",
+ " load line with transfer characteristic to get Q-point\n",
" values of V_GS=-1.8V and I_D=1.8mA"
]
}
- ],
+ ],
"prompt_number": 330
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.13, Page Number: 235<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''DMOSFET'''",
- "",
- "I_DSS=10.0*10**-3;",
- "V_GS_off=-8.0;",
- "V_GS=-3.0;",
- "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;",
- "print('Drain current when V_GS=-3V is %f Amperes'%I_D)",
- "V_GS=3;",
- "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;",
+ "\n",
+ "\n",
+ "I_DSS=10.0*10**-3;\n",
+ "V_GS_off=-8.0;\n",
+ "V_GS=-3.0;\n",
+ "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n",
+ "print('Drain current when V_GS=-3V is %f Amperes'%I_D)\n",
+ "V_GS=3;\n",
+ "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n",
"print('Drain current when V_GS=3V is %f Amperes'%I_D)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Drain current when V_GS=-3V is 0.003906 Amperes",
+ "Drain current when V_GS=-3V is 0.003906 Amperes\n",
"Drain current when V_GS=3V is 0.018906 Amperes"
]
}
- ],
+ ],
"prompt_number": 331
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.14, Page Number: 236<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''EMOSFET'''",
- "",
- "#variable Declaration",
- "I_D_on=500.0*10**-3;",
- "V_GS=10.0;",
- "V_GS_th=1.0;",
- "K=I_D_on/((V_GS-V_GS_th)**2)",
- "V_GS=5.0;",
- "I_D=K*(V_GS-V_GS_th)**2;",
+ "\n",
+ "\n",
+ "#variable Declaration\n",
+ "I_D_on=500.0*10**-3;\n",
+ "V_GS=10.0;\n",
+ "V_GS_th=1.0;\n",
+ "K=I_D_on/((V_GS-V_GS_th)**2)\n",
+ "V_GS=5.0;\n",
+ "I_D=K*(V_GS-V_GS_th)**2;\n",
"print('Drain current = %f A'%I_D)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Drain current = 0.098765 A"
]
}
- ],
+ ],
"prompt_number": 332
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.15, Page Number: 237<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find drain to source voltage'''",
- "",
- "# variable declaration",
- "I_DSS=12*10**-3; # currenin ampere",
- "V_DD=18; # voltage in volt",
- "R_D=620; # resistance in oh",
- "",
- "#calculation",
- "I_D=I_DSS; # currents are equal",
- "V_DS=V_DD-I_D*R_D; # drain to source voltage",
- "",
- "# result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "I_DSS=12*10**-3; # currenin ampere\n",
+ "V_DD=18; # voltage in volt\n",
+ "R_D=620; # resistance in oh\n",
+ "\n",
+ "#calculation\n",
+ "I_D=I_DSS; # currents are equal\n",
+ "V_DS=V_DD-I_D*R_D; # drain to source voltage\n",
+ "\n",
+ "# result\n",
"print \"Drain to sorce voltage = %.2f volt\" %V_DS"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Drain to sorce voltage = 10.56 volt"
]
}
- ],
+ ],
"prompt_number": 333
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.16, Page Number: 238<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''EMOSFET bias'''",
- "",
- "#variable Declaration",
- "I_D_on=200.0*10**-3;",
- "V_DD=24.0;",
- "R_D=200.0;",
- "V_GS=4.0;",
- "V_GS_th=2.0;",
- "R_1=100.0*10**3;",
- "R_2=15.0*10**3;",
- "",
- "#Calculation ",
- "K=I_D_on/((V_GS-V_GS_th)**2)",
- "V_GS=(R_2/(R_1+R_2))*V_DD;",
- "I_D=K*(V_GS-V_GS_th)**2;",
- "V_DS=V_DD-I_D*R_D;",
- "",
- "#Result",
- "print('Drain to Source voltage = %f V'%V_DS)",
+ "\n",
+ "#variable Declaration\n",
+ "I_D_on=200.0*10**-3;\n",
+ "V_DD=24.0;\n",
+ "R_D=200.0;\n",
+ "V_GS=4.0;\n",
+ "V_GS_th=2.0;\n",
+ "R_1=100.0*10**3;\n",
+ "R_2=15.0*10**3;\n",
+ "\n",
+ "#Calculation \n",
+ "K=I_D_on/((V_GS-V_GS_th)**2)\n",
+ "V_GS=(R_2/(R_1+R_2))*V_DD;\n",
+ "I_D=K*(V_GS-V_GS_th)**2;\n",
+ "V_DS=V_DD-I_D*R_D;\n",
+ "\n",
+ "#Result\n",
+ "print('Drain to Source voltage = %f V'%V_DS)\n",
"print('Gate to Source voltage = %f V'%V_GS)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Drain to Source voltage = 11.221172 V",
+ "Drain to Source voltage = 11.221172 V\n",
"Gate to Source voltage = 3.130435 V"
]
}
- ],
+ ],
"prompt_number": 334
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 7.17, Page Number: 239<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find drain current'''",
- "",
- "# variable declaration",
- "V_GS_on=3; # voltage in volt",
- "V_GS=8.5 #voltage displayed on meter",
- "V_DS=V_GS; # voltages are equal ",
- "V_DD=15; # voltage in volt",
- "R_D=4.7*10**3; # resistance in ohm",
- "",
- "#calculation",
- "I_D=(V_DD-V_DS)/R_D; # drain current",
- "",
- "# result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_GS_on=3; # voltage in volt\n",
+ "V_GS=8.5 #voltage displayed on meter\n",
+ "V_DS=V_GS; # voltages are equal \n",
+ "V_DD=15; # voltage in volt\n",
+ "R_D=4.7*10**3; # resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "I_D=(V_DD-V_DS)/R_D; # drain current\n",
+ "\n",
+ "# result\n",
"print \"Drain current = %.4f ampere\" %I_D"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Drain current = 0.0014 ampere"
]
}
- ],
+ ],
"prompt_number": 335
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter8.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter8.ipynb
index 68824e84..88fe84eb 100644
--- a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter8.ipynb
+++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter8.ipynb
@@ -1,432 +1,453 @@
{
"metadata": {
- "name": "Chapter_8"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:1b9281c55596391056ad444a3bcc77ac238e8c52d286c4b6044d31a9fb1335cb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 8: FET Amplifiers<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.1, Page Number: 253<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Voltage gain'''",
- "",
- "# variable declaration",
- "g_m=4.0*10**-3; #gm value",
- "R_d=1.5*10**3; #resistance",
- "",
- "#calculation",
- "A_v=g_m*R_d; #voltage gain",
- "",
- "#result",
+ "\n",
+ "# variable declaration\n",
+ "g_m=4.0*10**-3; #gm value\n",
+ "R_d=1.5*10**3; #resistance\n",
+ "\n",
+ "#calculation\n",
+ "A_v=g_m*R_d; #voltage gain\n",
+ "\n",
+ "#result\n",
"print \"Voltage gain = %.2f\" %A_v"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Voltage gain = 6.00"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.2, Page Number: 253<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' The Voltage gain'''",
- "",
- "# variable declaration",
- "r_ds=10.0*10**3;",
- "R_d=1.5*10**3; #from previous question",
- "g_m=4.0*10**-3; #from previous question",
- "",
- "#calculation",
- "A_v=g_m*((R_d*r_ds)/(R_d+r_ds)); #voltage gain",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "r_ds=10.0*10**3;\n",
+ "R_d=1.5*10**3; #from previous question\n",
+ "g_m=4.0*10**-3; #from previous question\n",
+ "\n",
+ "#calculation\n",
+ "A_v=g_m*((R_d*r_ds)/(R_d+r_ds)); #voltage gain\n",
+ "\n",
+ "#result\n",
"print \"Voltage gain = %.2f\" %A_v"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Voltage gain = 5.22"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.3, Page Number:254<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find Voltage gain'''",
- "",
- "# variable declaration",
- "R_s=560; #resistance in ohm",
- "R_d=1.5*10**3; #resistance in ohm",
- "g_m=4*10**-3; #g_m value",
- "",
- "#calculation",
- "A_v=(g_m*R_d)/(1+(g_m*R_s)) #voltage gain",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "R_s=560; #resistance in ohm\n",
+ "R_d=1.5*10**3; #resistance in ohm\n",
+ "g_m=4*10**-3; #g_m value\n",
+ "\n",
+ "#calculation\n",
+ "A_v=(g_m*R_d)/(1+(g_m*R_s)) #voltage gain\n",
+ "\n",
+ "#result\n",
"print \"Voltage gain = %.2f\" %A_v"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Voltage gain = 1.85"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.4, Page Number: 257<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Unloaded amplifier'''",
- "",
- "#Variable declaration",
- "vdd=12.0 #volts",
- "Id=1.96*10**-3 #Amp",
- "Rd=3.3*10**3 #ohm",
- "Idss=12.0*10**-3 #Amp",
- "Rs=910 # Ohm",
- "vgsoff= 3 #v",
- "vin=0.1 #V",
- "",
- "#calculation",
- "vd=vdd-(Id*Rd)",
- "vgs=-Id*Rs",
- "gm0=2*Idss/(abs(vgsoff))",
- "gm=0.00325 #mS",
- "vout=gm*Rd*vin",
- "vout=vout*2*1.414",
- "#Result",
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "vdd=12.0 #volts\n",
+ "Id=1.96*10**-3 #Amp\n",
+ "Rd=3.3*10**3 #ohm\n",
+ "Idss=12.0*10**-3 #Amp\n",
+ "Rs=910 # Ohm\n",
+ "vgsoff= 3 #v\n",
+ "vin=0.1 #V\n",
+ "\n",
+ "#calculation\n",
+ "vd=vdd-(Id*Rd)\n",
+ "vgs=-Id*Rs\n",
+ "gm0=2*Idss/(abs(vgsoff))\n",
+ "gm=0.00325 #mS\n",
+ "vout=gm*Rd*vin\n",
+ "vout=vout*2*1.414\n",
+ "#Result\n",
"print\"Total output ac voltage(peak-to-peak) = %f V \\nridig on DC value of %fV \"%(vout,vd)"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Total output ac voltage(peak-to-peak) = 3.033030 V ",
+ "Total output ac voltage(peak-to-peak) = 3.033030 V \n",
"ridig on DC value of 5.532000V "
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.5, Page Number: 258<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' RMS voltage'''",
- "",
- "# variable declaration",
- "R_D=3.3*10**3; #resistance in ohm",
- "R_L=4.7*10**3; #load resistance in ohm",
- "g_m=3.25*10**-3; #from previous question",
- "V_in=100.0*10**-3; #previous question",
- "",
- "#calculation",
- "R_d=(R_D*R_L)/(R_D+R_L); #Equivalent drain resistance",
- "V_out=g_m*R_d*V_in; #output RMS voltage in volt",
- "",
- "#result",
+ "\n",
+ "# variable declaration\n",
+ "R_D=3.3*10**3; #resistance in ohm\n",
+ "R_L=4.7*10**3; #load resistance in ohm\n",
+ "g_m=3.25*10**-3; #from previous question\n",
+ "V_in=100.0*10**-3; #previous question\n",
+ "\n",
+ "#calculation\n",
+ "R_d=(R_D*R_L)/(R_D+R_L); #Equivalent drain resistance\n",
+ "V_out=g_m*R_d*V_in; #output RMS voltage in volt\n",
+ "\n",
+ "#result\n",
"print \"Output voltage rms value = %.2f Volts\" %V_out"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Output voltage rms value = 0.63 Volts"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.6, Page Number: 259<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Input resistance wrt signal source '''",
- "",
- "# variable declaration",
- "I_GSS=30.0*10**-9; #current in ampere",
- "V_GS=10.0; #ground-source voltage",
- "R_G=10.0*10**6; #resistance in ohm",
- "",
- "#calculation",
- "R_IN_gate=V_GS/I_GSS; #gate input resistance",
- "R_in=(R_IN_gate*R_G)/(R_IN_gate+R_G); #parallel combination",
- "",
- "#result",
+ "\n",
+ "# variable declaration\n",
+ "I_GSS=30.0*10**-9; #current in ampere\n",
+ "V_GS=10.0; #ground-source voltage\n",
+ "R_G=10.0*10**6; #resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "R_IN_gate=V_GS/I_GSS; #gate input resistance\n",
+ "R_in=(R_IN_gate*R_G)/(R_IN_gate+R_G); #parallel combination\n",
+ "\n",
+ "#result\n",
"print \"Input resistance as seen by signal source = %.2f ohm\" %R_in"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"Input resistance as seen by signal source = 9708737.86 ohm"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.7, Page Number: 260<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' AC and DC output voltage '''",
- "",
- "# variable declaration",
- "I_DSS=200.0*10**-3;",
- "g_m=200.0*10**-3;",
- "V_in=500.0*10**-3;",
- "V_DD=15.0;",
- "R_D=33.0;",
- "R_L=8.2*10**3;",
- "",
- "#calculation",
- "I_D=I_DSS; #Amplifier is zero biased",
- "V_D=V_DD-I_D*R_D;",
- "R_d=(R_D*R_L)/(R_D+R_L);",
- "V_out=g_m*R_d*V_in;",
- "",
- "#result",
- "print \"DC output voltage = %.2f Volts\" %V_D",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "I_DSS=200.0*10**-3;\n",
+ "g_m=200.0*10**-3;\n",
+ "V_in=500.0*10**-3;\n",
+ "V_DD=15.0;\n",
+ "R_D=33.0;\n",
+ "R_L=8.2*10**3;\n",
+ "\n",
+ "#calculation\n",
+ "I_D=I_DSS; #Amplifier is zero biased\n",
+ "V_D=V_DD-I_D*R_D;\n",
+ "R_d=(R_D*R_L)/(R_D+R_L);\n",
+ "V_out=g_m*R_d*V_in;\n",
+ "\n",
+ "#result\n",
+ "print \"DC output voltage = %.2f Volts\" %V_D\n",
"print \"AC output voltage = %.2f volts\" %V_out"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "DC output voltage = 8.40 Volts",
+ "DC output voltage = 8.40 Volts\n",
"AC output voltage = 3.29 volts"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.8, Page Number: 262<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' Drain Current '''",
- "",
- "# Theoretical example",
- "# result",
- "",
- "print \"Part A:\\nQ point: V_GS=-2V I_D=2.5mA. At V_GS=-1V, I_D=3.4mA,\"",
- "print \"At V_GS=-3V, I_D=1.8mA. So peak to peak drain current is\" ",
- "print \"the difference of the two drain currents=1.6mA\"",
- "print \"\\nPart B:\\nQ point: V_GS=0V I_D=4mA. At V_GS=1V, I_D=5.3mA,\"",
- "print \"At V_GS=-1V, I_D=2.5mA. So peak to peak drain current is\"",
- "print\" the difference of the two drain currents=2.8mA\"",
- "print \"\\nPart C:\\nQ point: V_GS=8V I_D=2.5mA. At V_GS=9V, I_D=3.9mA,\"",
- "print \" At V_GS=7V, I_D=1.7mA. So peak to peak drain current is\"",
+ "\n",
+ "\n",
+ "# Theoretical example\n",
+ "# result\n",
+ "\n",
+ "print \"Part A:\\nQ point: V_GS=-2V I_D=2.5mA. At V_GS=-1V, I_D=3.4mA,\"\n",
+ "print \"At V_GS=-3V, I_D=1.8mA. So peak to peak drain current is\" \n",
+ "print \"the difference of the two drain currents=1.6mA\"\n",
+ "print \"\\nPart B:\\nQ point: V_GS=0V I_D=4mA. At V_GS=1V, I_D=5.3mA,\"\n",
+ "print \"At V_GS=-1V, I_D=2.5mA. So peak to peak drain current is\"\n",
+ "print\" the difference of the two drain currents=2.8mA\"\n",
+ "print \"\\nPart C:\\nQ point: V_GS=8V I_D=2.5mA. At V_GS=9V, I_D=3.9mA,\"\n",
+ "print \" At V_GS=7V, I_D=1.7mA. So peak to peak drain current is\"\n",
"print \" the difference of the two drain currents=2.2mA\""
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Part A:",
- "Q point: V_GS=-2V I_D=2.5mA. At V_GS=-1V, I_D=3.4mA,",
- "At V_GS=-3V, I_D=1.8mA. So peak to peak drain current is",
- "the difference of the two drain currents=1.6mA",
- "",
- "Part B:",
- "Q point: V_GS=0V I_D=4mA. At V_GS=1V, I_D=5.3mA,",
- "At V_GS=-1V, I_D=2.5mA. So peak to peak drain current is",
- " the difference of the two drain currents=2.8mA",
- "",
- "Part C:",
- "Q point: V_GS=8V I_D=2.5mA. At V_GS=9V, I_D=3.9mA,",
- " At V_GS=7V, I_D=1.7mA. So peak to peak drain current is",
+ "Part A:\n",
+ "Q point: V_GS=-2V I_D=2.5mA. At V_GS=-1V, I_D=3.4mA,\n",
+ "At V_GS=-3V, I_D=1.8mA. So peak to peak drain current is\n",
+ "the difference of the two drain currents=1.6mA\n",
+ "\n",
+ "Part B:\n",
+ "Q point: V_GS=0V I_D=4mA. At V_GS=1V, I_D=5.3mA,\n",
+ "At V_GS=-1V, I_D=2.5mA. So peak to peak drain current is\n",
+ " the difference of the two drain currents=2.8mA\n",
+ "\n",
+ "Part C:\n",
+ "Q point: V_GS=8V I_D=2.5mA. At V_GS=9V, I_D=3.9mA,\n",
+ " At V_GS=7V, I_D=1.7mA. So peak to peak drain current is\n",
" the difference of the two drain currents=2.2mA"
]
}
- ],
+ ],
"prompt_number": 8
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.9, Page Number:263 <h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' To find Voltage gain'''",
- "",
- "# variable declaration",
- "R_1=47.0*10**3;",
- "R_2=8.2*10**3;",
- "R_D=3.3*10**3;",
- "R_L=33.0*10**3;",
- "I_D_on=200.0*10**-3;",
- "V_GS=4.0;",
- "V_GS_th=2.0;",
- "g_m=23*10**-3;",
- "V_in=25*10**-3;",
- "V_DD=15.0;",
- "",
- "#calculation",
- "V_GSnew=(R_2/(R_1+R_2))*V_DD;",
- "K=I_D_on/((V_GS-V_GS_th)**2)",
- "#K=value_of_K(200*10**-3,4,2);",
- "K=K*1000;",
- "I_D=K*((V_GSnew-V_GS_th)**2);",
- "V_DS=V_DD-I_D*R_D/1000;",
- "R_d=(R_D*R_L)/(R_D+R_L);",
- "V_out=g_m*V_in*R_d;",
- "",
- "#result",
- "print \"Drain to source voltage = %.2f volts\" %V_GSnew",
- "print \"Drain current = %.2f mA\" %I_D",
- "print \"Gate to source voltage = %.2f volts\" %V_DS",
- "print \"AC output voltage = %.2f volts\" %V_out",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "R_1=47.0*10**3;\n",
+ "R_2=8.2*10**3;\n",
+ "R_D=3.3*10**3;\n",
+ "R_L=33.0*10**3;\n",
+ "I_D_on=200.0*10**-3;\n",
+ "V_GS=4.0;\n",
+ "V_GS_th=2.0;\n",
+ "g_m=23*10**-3;\n",
+ "V_in=25*10**-3;\n",
+ "V_DD=15.0;\n",
+ "\n",
+ "#calculation\n",
+ "V_GSnew=(R_2/(R_1+R_2))*V_DD;\n",
+ "K=I_D_on/((V_GS-V_GS_th)**2)\n",
+ "#K=value_of_K(200*10**-3,4,2);\n",
+ "K=K*1000;\n",
+ "I_D=K*((V_GSnew-V_GS_th)**2);\n",
+ "V_DS=V_DD-I_D*R_D/1000;\n",
+ "R_d=(R_D*R_L)/(R_D+R_L);\n",
+ "V_out=g_m*V_in*R_d;\n",
+ "\n",
+ "#result\n",
+ "print \"Drain to source voltage = %.2f volts\" %V_GSnew\n",
+ "print \"Drain current = %.2f mA\" %I_D\n",
+ "print \"Gate to source voltage = %.2f volts\" %V_DS\n",
+ "print \"AC output voltage = %.2f volts\" %V_out\n",
"print \"Answer in textbook are approximated\""
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Drain to source voltage = 2.23 volts",
- "Drain current = 2.61 mA",
- "Gate to source voltage = 6.40 volts",
- "AC output voltage = 1.72 volts",
+ "Drain to source voltage = 2.23 volts\n",
+ "Drain current = 2.61 mA\n",
+ "Gate to source voltage = 6.40 volts\n",
+ "AC output voltage = 1.72 volts\n",
"Answer in textbook are approximated"
]
}
- ],
+ ],
"prompt_number": 9
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 8.10, Page Number: 266<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' AC and DC output voltage''' ",
- "",
- "# variable declaration",
- "V_DD=-15.0; #p=channel MOSFET",
- "g_m=2000.0*10**-6; #minimum value from datasheets",
- "R_D=10.0*10**3;",
- "R_L=10.0*10**3;",
- "R_S=4.7*10**3;",
- "",
- "#calculation",
- "R_d=(R_D*R_L)/(R_D+R_L); #effective drain resistance",
- "A_v=g_m*R_d;",
- "R_in_source=1.0/g_m;",
- "#signal souce sees R_S in parallel with ip rest at source terminal(R_in_source)",
- "R_in=(R_in_source*R_S)/(R_in_source+R_S); ",
- "",
- "#result ",
- "print \"minimum voltage gain = %.2f\" %A_v",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_DD=-15.0; #p=channel MOSFET\n",
+ "g_m=2000.0*10**-6; #minimum value from datasheets\n",
+ "R_D=10.0*10**3;\n",
+ "R_L=10.0*10**3;\n",
+ "R_S=4.7*10**3;\n",
+ "\n",
+ "#calculation\n",
+ "R_d=(R_D*R_L)/(R_D+R_L); #effective drain resistance\n",
+ "A_v=g_m*R_d;\n",
+ "R_in_source=1.0/g_m;\n",
+ "#signal souce sees R_S in parallel with ip rest at source terminal(R_in_source)\n",
+ "R_in=(R_in_source*R_S)/(R_in_source+R_S); \n",
+ "\n",
+ "#result \n",
+ "print \"minimum voltage gain = %.2f\" %A_v\n",
"print \"Input resistance seen from signal source = %.2f ohms\" %R_in"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "minimum voltage gain = 10.00",
+ "minimum voltage gain = 10.00\n",
"Input resistance seen from signal source = 451.92 ohms"
]
}
- ],
+ ],
"prompt_number": 10
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter9.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter9.ipynb
index a4cd060a..b8f59cd9 100644
--- a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter9.ipynb
+++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/Chapter9.ipynb
@@ -1,379 +1,397 @@
{
"metadata": {
- "name": "Chapter_9"
- },
- "nbformat": 2,
+ "name": "",
+ "signature": "sha256:bf976bdfa25f41760e88ac615da4c103297b4f982f43cc2fe70e30cc05e1865d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h1>Chapter 9: Power Amplifiers<h1>"
]
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 9.1, Page Number: 280<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "'''Voltage gain'''",
- "",
- "# variable declaration",
- "V_CC=15.0; #supply voltage",
- "R_C=1.0*10**3; #resistance in ohm",
- "R_1=20.0*10**3; #resistance in ohm",
- "R_2=5.1*10**3; #resistance in ohm",
- "R_3=5.1*10**3; #resistance in ohm",
- "R_4=15.0*10**3; #resistance in ohm",
- "R_E_1=47.0; #resistance in ohm",
- "R_E_2=330.0; #resistance in ohm",
- "R_E_3=16.0; #resistance in ohm",
- "R_L=16.0; #SPEAKER IS THE LOAD;",
- "B_ac_Q1=200.0; #B_ac value",
- "B_ac_Q2=B_ac_Q1; #B_ac value",
- "B_ac_Q3=50.0; #B_ac value",
- "",
- "#calculation",
- "#R_c1=R_C||[R_3||R_4||B_acQ2*B_ac_Q3*(R_E_3||R_L)] is ac collector resistance",
- "R=(R_E_3*R_L)/(R_E_3+R_L); #calculating resistance",
- "R=B_ac_Q2*B_ac_Q3*R; ",
- "R=(R*R_4)/(R+R_4); #calculating resistance",
- "R=(R*R_3)/(R+R_3);",
- "R_c1=(R*R_C)/(R_C+R); #ac collector resistance",
- "#V_B=((R_2||(B_acQ1*(R_E_1+R_E_2)))/(R_1+(R_2||B_acQ1*(R_E_1+R_E_2))))*V_CC;",
- "#This is the base voltage;",
- "#LET R=(R_2||(B_acQ1*(R_E_1+R_E_2)))",
- "R=(R_2*B_ac_Q1*(R_E_1+R_E_2))/(R_2+B_ac_Q1*(R_E_1+R_E_2));",
- "V_B=R*V_CC/(R_1+R);",
- "I_E=(V_B-0.7)/(R_E_1+R_E_2);",
- "r_e_Q1=25.0*10**-3/I_E;",
- "A_v1=(-1)*(R_c1)/(R_E_1+r_e_Q1); #voltage gain of 1st stage",
- "#total input resistance of 1st stage is ",
- "#R_in_tot_1=R_1||R_2||B_ac_Q1*(R_E_1+r_e_Q1);",
- "xt=R_E_1+r_e_Q1 ",
- "yt=R_2*B_ac_Q1",
- "R_in_tot_1=(R_1*(yt*(xt)/(R_2+B_ac_Q1*(xt))))/(R_1+(yt*(xt)/(yt*(xt))));",
- "A_v2=1; #gain of darlington voltage-follower",
- "A_v_tot=A_v1*A_v2; #total gain",
- "A_p=(A_v_tot**2)*(R_in_tot_1/R_L); #power gain",
- "A_p=42508.68",
- "",
- "#result",
- "print \"Voltage gain= %.2f\" %A_v_tot",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_CC=15.0; #supply voltage\n",
+ "R_C=1.0*10**3; #resistance in ohm\n",
+ "R_1=20.0*10**3; #resistance in ohm\n",
+ "R_2=5.1*10**3; #resistance in ohm\n",
+ "R_3=5.1*10**3; #resistance in ohm\n",
+ "R_4=15.0*10**3; #resistance in ohm\n",
+ "R_E_1=47.0; #resistance in ohm\n",
+ "R_E_2=330.0; #resistance in ohm\n",
+ "R_E_3=16.0; #resistance in ohm\n",
+ "R_L=16.0; #SPEAKER IS THE LOAD;\n",
+ "B_ac_Q1=200.0; #B_ac value\n",
+ "B_ac_Q2=B_ac_Q1; #B_ac value\n",
+ "B_ac_Q3=50.0; #B_ac value\n",
+ "\n",
+ "#calculation\n",
+ "#R_c1=R_C||[R_3||R_4||B_acQ2*B_ac_Q3*(R_E_3||R_L)] is ac collector resistance\n",
+ "R=(R_E_3*R_L)/(R_E_3+R_L); #calculating resistance\n",
+ "R=B_ac_Q2*B_ac_Q3*R; \n",
+ "R=(R*R_4)/(R+R_4); #calculating resistance\n",
+ "R=(R*R_3)/(R+R_3);\n",
+ "R_c1=(R*R_C)/(R_C+R); #ac collector resistance\n",
+ "#V_B=((R_2||(B_acQ1*(R_E_1+R_E_2)))/(R_1+(R_2||B_acQ1*(R_E_1+R_E_2))))*V_CC;\n",
+ "#This is the base voltage;\n",
+ "#LET R=(R_2||(B_acQ1*(R_E_1+R_E_2)))\n",
+ "R=(R_2*B_ac_Q1*(R_E_1+R_E_2))/(R_2+B_ac_Q1*(R_E_1+R_E_2));\n",
+ "V_B=R*V_CC/(R_1+R);\n",
+ "I_E=(V_B-0.7)/(R_E_1+R_E_2);\n",
+ "r_e_Q1=25.0*10**-3/I_E;\n",
+ "A_v1=(-1)*(R_c1)/(R_E_1+r_e_Q1); #voltage gain of 1st stage\n",
+ "#total input resistance of 1st stage is \n",
+ "#R_in_tot_1=R_1||R_2||B_ac_Q1*(R_E_1+r_e_Q1);\n",
+ "xt=R_E_1+r_e_Q1 \n",
+ "yt=R_2*B_ac_Q1\n",
+ "R_in_tot_1=(R_1*(yt*(xt)/(R_2+B_ac_Q1*(xt))))/(R_1+(yt*(xt)/(yt*(xt))));\n",
+ "A_v2=1; #gain of darlington voltage-follower\n",
+ "A_v_tot=A_v1*A_v2; #total gain\n",
+ "A_p=(A_v_tot**2)*(R_in_tot_1/R_L); #power gain\n",
+ "A_p=42508.68\n",
+ "\n",
+ "#result\n",
+ "print \"Voltage gain= %.2f\" %A_v_tot\n",
"print \"Power gain= %.2f\" %A_p"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "Voltage gain= -15.29",
+ "Voltage gain= -15.29\n",
"Power gain= 42508.68"
]
}
- ],
+ ],
"prompt_number": 1
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 9.2, Page Number: 281<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' efficiency'''",
- "",
- "# variable declaration",
- "V_in=176.0*10**-3;",
- "R_in=2.9*10**3; #total input resistance from previous question",
- "A_p=42429.0; #power gain from previous question",
- "V_CC=15.0;",
- "I_CC=0.6; #emitter current",
- "",
- "#calculation",
- "P_in=V_in**2/R_in; #input power",
- "P_out=P_in*A_p;",
- "P_DC=I_CC*V_CC;",
- "eff=P_out/P_DC; #efficiency",
- "",
- "#result",
+ "\n",
+ "\n",
+ "# variable declaration\n",
+ "V_in=176.0*10**-3;\n",
+ "R_in=2.9*10**3; #total input resistance from previous question\n",
+ "A_p=42429.0; #power gain from previous question\n",
+ "V_CC=15.0;\n",
+ "I_CC=0.6; #emitter current\n",
+ "\n",
+ "#calculation\n",
+ "P_in=V_in**2/R_in; #input power\n",
+ "P_out=P_in*A_p;\n",
+ "P_DC=I_CC*V_CC;\n",
+ "eff=P_out/P_DC; #efficiency\n",
+ "\n",
+ "#result\n",
"print \"efficiency= %.2f\" %eff"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"efficiency= 0.05"
]
}
- ],
+ ],
"prompt_number": 2
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 9.3, Page Number: 287<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' ideal maximum current'''",
- "",
- "# variable declaration",
- "V_CC=20.00; #supply voltage",
- "R_L=16.0; #load resistance",
- "",
- "#calculation",
- "V_out_peak=V_CC; #calculate peak op voltage",
- "I_out_peak=V_CC/R_L; #calculate peak op current",
- "",
- "#result",
- "print \"ideal maximum peak output voltage = %.2f volts\" %V_out_peak",
+ "\n",
+ "# variable declaration\n",
+ "V_CC=20.00; #supply voltage\n",
+ "R_L=16.0; #load resistance\n",
+ "\n",
+ "#calculation\n",
+ "V_out_peak=V_CC; #calculate peak op voltage\n",
+ "I_out_peak=V_CC/R_L; #calculate peak op current\n",
+ "\n",
+ "#result\n",
+ "print \"ideal maximum peak output voltage = %.2f volts\" %V_out_peak\n",
"print \"ideal maximum current =%.2f amperes\" %I_out_peak"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "ideal maximum peak output voltage = 20.00 volts",
+ "ideal maximum peak output voltage = 20.00 volts\n",
"ideal maximum current =1.25 amperes"
]
}
- ],
+ ],
"prompt_number": 3
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 9.4, Page Number: 288<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' ideal maximum current'''",
- "",
- "# variable declaration",
- "V_CC=20.0; #supply volatge",
- "R_L=16.0; #load resistance",
- "",
- "#calculation",
- "V_out_peak=V_CC/2;",
- "I_out_peak=V_out_peak/R_L;",
- "",
- "#result",
- "print \"ideal maximum output peak voltage = %.2f volts\" %V_out_peak",
+ "\n",
+ "# variable declaration\n",
+ "V_CC=20.0; #supply volatge\n",
+ "R_L=16.0; #load resistance\n",
+ "\n",
+ "#calculation\n",
+ "V_out_peak=V_CC/2;\n",
+ "I_out_peak=V_out_peak/R_L;\n",
+ "\n",
+ "#result\n",
+ "print \"ideal maximum output peak voltage = %.2f volts\" %V_out_peak\n",
"print \"ideal maximum current = %.2f amperes\" %I_out_peak"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "ideal maximum output peak voltage = 10.00 volts",
+ "ideal maximum output peak voltage = 10.00 volts\n",
"ideal maximum current = 0.62 amperes"
]
}
- ],
+ ],
"prompt_number": 4
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 9.5, Page Number: 290<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' ideal maximum current'''",
- "",
- "import math",
- "# variable declaration",
- "V_CC=20.0; #supply voltage",
- "R_L=8.0; #load resistance",
- "B_ac=50.0; #B_ac value",
- "r_e=6.0; #internal resistance",
- "",
- "#calculation",
- "V_out_peak=V_CC/2;",
- "V_CEQ=V_out_peak;",
- "I_out_peak=V_CEQ/R_L;",
- "I_c_sat=I_out_peak;",
- "P_out=0.25*I_c_sat*V_CC;",
- "P_DC=(I_c_sat*V_CC)/math.pi;",
- "R_in=B_ac*(r_e+R_L);",
- "",
- "#result",
- "print \"maximum ac output power = %.2f Watts\" %P_out",
- "print \"maximum DC output power = %.2f Watts\" %P_DC",
+ "\n",
+ "\n",
+ "import math\n",
+ "# variable declaration\n",
+ "V_CC=20.0; #supply voltage\n",
+ "R_L=8.0; #load resistance\n",
+ "B_ac=50.0; #B_ac value\n",
+ "r_e=6.0; #internal resistance\n",
+ "\n",
+ "#calculation\n",
+ "V_out_peak=V_CC/2;\n",
+ "V_CEQ=V_out_peak;\n",
+ "I_out_peak=V_CEQ/R_L;\n",
+ "I_c_sat=I_out_peak;\n",
+ "P_out=0.25*I_c_sat*V_CC;\n",
+ "P_DC=(I_c_sat*V_CC)/math.pi;\n",
+ "R_in=B_ac*(r_e+R_L);\n",
+ "\n",
+ "#result\n",
+ "print \"maximum ac output power = %.2f Watts\" %P_out\n",
+ "print \"maximum DC output power = %.2f Watts\" %P_DC\n",
"print \"input resistance = %.2f ohms\" %R_in"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "maximum ac output power = 6.25 Watts",
- "maximum DC output power = 7.96 Watts",
+ "maximum ac output power = 6.25 Watts\n",
+ "maximum DC output power = 7.96 Watts\n",
"input resistance = 700.00 ohms"
]
}
- ],
+ ],
"prompt_number": 5
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 9.6, Page Number: 292<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' power accross load'''",
- "",
- "import math",
- "# variable declaration",
- "V_DD=24.0;",
- "V_in=100*10**-3; #ip volatge",
- "R1=440.0; #resistance in ohm",
- "R2=5.1*10**3; #resistance in ohm",
- "R3=100*10**3; #resistance in ohm",
- "R4=10**3; #resistance in ohm",
- "R5=100.0; #resistance in ohm",
- "R7=15*10**3; #resistance in ohm",
- "R_L=33.0; #load resistance in ohm",
- "V_TH_Q1=2.0; # V-TH value",
- "V_TH_Q2=-2.0; ",
- "",
- "#calculation",
- "I_R1=(V_DD-(-V_DD))/(R1+R2+R3);",
- "V_B=V_DD-I_R1*(R1+R2); #BASE VOLTAGE",
- "V_E=V_B+0.7; #EMITTER VOLTAGE",
- "I_E=(V_DD-V_E)/(R4+R5); #EMITTER CURRENT",
- "V_R6=V_TH_Q1-V_TH_Q2; #VOLTAGE DROP ACROSS R6",
- "I_R6=I_E; ",
- "R6=V_R6/I_R6;",
- "r_e=25*10**-3/I_E; #UNBYPASSED EMITTER RESISTANCE",
- "A_v=R7/(R5+r_e); #VOLTAGE GAIN",
- "V_out=A_v*V_in;",
- "P_L=V_out**2/R_L;",
- "",
- "#result",
- "print \"value of resistance R6 = %.2d ohms for AB operation\" %R6",
+ "\n",
+ "\n",
+ "import math\n",
+ "# variable declaration\n",
+ "V_DD=24.0;\n",
+ "V_in=100*10**-3; #ip volatge\n",
+ "R1=440.0; #resistance in ohm\n",
+ "R2=5.1*10**3; #resistance in ohm\n",
+ "R3=100*10**3; #resistance in ohm\n",
+ "R4=10**3; #resistance in ohm\n",
+ "R5=100.0; #resistance in ohm\n",
+ "R7=15*10**3; #resistance in ohm\n",
+ "R_L=33.0; #load resistance in ohm\n",
+ "V_TH_Q1=2.0; # V-TH value\n",
+ "V_TH_Q2=-2.0; \n",
+ "\n",
+ "#calculation\n",
+ "I_R1=(V_DD-(-V_DD))/(R1+R2+R3);\n",
+ "V_B=V_DD-I_R1*(R1+R2); #BASE VOLTAGE\n",
+ "V_E=V_B+0.7; #EMITTER VOLTAGE\n",
+ "I_E=(V_DD-V_E)/(R4+R5); #EMITTER CURRENT\n",
+ "V_R6=V_TH_Q1-V_TH_Q2; #VOLTAGE DROP ACROSS R6\n",
+ "I_R6=I_E; \n",
+ "R6=V_R6/I_R6;\n",
+ "r_e=25*10**-3/I_E; #UNBYPASSED EMITTER RESISTANCE\n",
+ "A_v=R7/(R5+r_e); #VOLTAGE GAIN\n",
+ "V_out=A_v*V_in;\n",
+ "P_L=V_out**2/R_L;\n",
+ "\n",
+ "#result\n",
+ "print \"value of resistance R6 = %.2d ohms for AB operation\" %R6\n",
"print \"power across load = %.2f watts\"%P_L "
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
- "value of resistance R6 = 2418 ohms for AB operation",
+ "value of resistance R6 = 2418 ohms for AB operation\n",
"power across load = 5.15 watts"
]
}
- ],
+ ],
"prompt_number": 6
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 9.7, Page Number:295<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' average power dissipation'''",
- "",
- "import math",
- "# variable declaration",
- "f=200.0*10**3; #frequency in hertz",
- "I_c_sat=100.0*10**-3; #saturation current",
- "V_ce_sat=0.2; #sat voltage",
- "t_on=1.0*10**-6; #on time",
- "",
- "#calculation",
- "T=1/f; #time period of signal",
- "P_D_avg=(t_on/T)*I_c_sat*V_ce_sat; #power dissipation",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "# variable declaration\n",
+ "f=200.0*10**3; #frequency in hertz\n",
+ "I_c_sat=100.0*10**-3; #saturation current\n",
+ "V_ce_sat=0.2; #sat voltage\n",
+ "t_on=1.0*10**-6; #on time\n",
+ "\n",
+ "#calculation\n",
+ "T=1/f; #time period of signal\n",
+ "P_D_avg=(t_on/T)*I_c_sat*V_ce_sat; #power dissipation\n",
+ "\n",
+ "#result\n",
"print \"average power dissipation =%.3f Watts\" %P_D_avg"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"average power dissipation =0.004 Watts"
]
}
- ],
+ ],
"prompt_number": 7
- },
+ },
{
- "cell_type": "markdown",
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"<h3>Example 9.8, Page Number: 298<h3>"
]
- },
+ },
{
- "cell_type": "code",
- "collapsed": false,
+ "cell_type": "code",
+ "collapsed": false,
"input": [
- "''' efficiency'''",
- "",
- "import math",
- "# variable declaration",
- "P_D_avg=4.0*10**-3; #power dissipation",
- "V_CC=24.0; #supply voltage",
- "R_c=100.0; #resistance in ohm",
- "",
- "#calculation",
- "P_out=(0.5*V_CC**2)/R_c; #output power",
- "n=(P_out)/(P_out+P_D_avg); #n is efficiency",
- "",
- "#result",
+ "\n",
+ "\n",
+ "import math\n",
+ "# variable declaration\n",
+ "P_D_avg=4.0*10**-3; #power dissipation\n",
+ "V_CC=24.0; #supply voltage\n",
+ "R_c=100.0; #resistance in ohm\n",
+ "\n",
+ "#calculation\n",
+ "P_out=(0.5*V_CC**2)/R_c; #output power\n",
+ "n=(P_out)/(P_out+P_D_avg); #n is efficiency\n",
+ "\n",
+ "#result\n",
"print \"efficiency=%.4f\" %n"
- ],
- "language": "python",
+ ],
+ "language": "python",
+ "metadata": {},
"outputs": [
{
- "output_type": "stream",
- "stream": "stdout",
+ "output_type": "stream",
+ "stream": "stdout",
"text": [
"efficiency=0.9986"
]
}
- ],
+ ],
"prompt_number": 8
}
- ]
+ ],
+ "metadata": {}
}
]
} \ No newline at end of file
diff --git a/Problems_In_Fluid_Flow/ch1.ipynb b/Problems_In_Fluid_Flow/ch1.ipynb
index 060862e5..468c5738 100644
--- a/Problems_In_Fluid_Flow/ch1.ipynb
+++ b/Problems_In_Fluid_Flow/ch1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:0059190c3ee26fe93a1d293531a49cd3a6e92d5339c0638feafb8d9d1d250c2e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -28,11 +29,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find whether\n",
- "the system is in turbulent motion \n",
- "the system is in laminar motion \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -93,13 +90,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The Stanton-Pannel friction factor per unit of length\n",
- "shear stress exerted by liquid\n",
- "Total shear force exerted \n",
- "viscosity of liquid \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -155,7 +146,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the difference between the rise levels of manometer\n",
"\n",
"import math \n",
"\n",
@@ -203,7 +193,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The volume of pure material\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -243,12 +233,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The percent value of d for which where pitot tube is kept show average velocity in streamline flow\n",
- "The percent value of d for which where pitot tube is kept show average velocity in turbulent flow \n",
- "The error shown by pitot tube at new position \n",
- "'''\n",
+ "\n",
"import math \n",
"\n",
"\n",
@@ -302,13 +287,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The Power required to pump acid \n",
- "The gauge pressure at pump outlet \n",
- "The increase in power required to transfer\n",
- "The gauge pressure at pump outlet\n",
- "'''\n",
+ "\n",
"\n",
"# Initialization of Variable\n",
"rhon = 1068. #density of nitric acid\n",
@@ -382,11 +361,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "power required to drive pump \n",
- "The gauge pressure in (kPa)\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -452,11 +427,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Volumetric flow rate initial\n",
- "Volumetric flow rate final\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -520,7 +491,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Time required to water level to fall in the tank \n",
"\n",
"import math \n",
"from numpy import linspace\n",
@@ -580,7 +550,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find d\n",
"\n",
"import math \n",
"\n",
diff --git a/Problems_In_Fluid_Flow/ch10.ipynb b/Problems_In_Fluid_Flow/ch10.ipynb
index 6c990a70..b9f62b91 100644
--- a/Problems_In_Fluid_Flow/ch10.ipynb
+++ b/Problems_In_Fluid_Flow/ch10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:88dad4167b8ab13af93e66ad11725020c7f1ec6496fdf0f78d38810f6f3baf41"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Draw Concentration vs Settling veocity\n",
+ "\n",
"\n",
"%pylab inline\n",
"import math \n",
@@ -107,11 +108,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "the area for each settling velocity\n",
- "Volumetric flow rate of clarified water\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import linspace\n",
@@ -184,13 +181,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The fraction of heavy ore remained\n",
- "The percentage of heavy ore left \n",
- "the fraction of light ore in overhead product\n",
- "The minimum density required to seperate 2 ores\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import linspace\n",
@@ -280,7 +271,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the density of suspension\n",
+ "\n",
"\n",
"import math \n",
"from numpy import true_divide\n",
@@ -338,7 +329,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Draw undersize vs Particle Size(m)\n",
+ "\n",
"\n",
"\n",
"import math \n",
@@ -414,7 +405,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find mass and diameter\n",
+ "\n",
"\n",
"import math \n",
"from matplotlib.pyplot import *\n",
@@ -495,12 +486,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "fraction of particles separated \n",
- "total fraction of particles separated\n",
- "fraction of particles separated \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Problems_In_Fluid_Flow/ch11.ipynb b/Problems_In_Fluid_Flow/ch11.ipynb
index c36db144..a2484ed7 100644
--- a/Problems_In_Fluid_Flow/ch11.ipynb
+++ b/Problems_In_Fluid_Flow/ch11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:c23ae85b629821355f70fc5abaa38e7f6336abdb19ba09fa0e8e1a4bdcd9679f"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Bubbling fluidisation \n",
- "fluidisation \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -93,13 +90,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The superficial linear flow rate\n",
- "Terminal Settling Velocity\n",
- "Stoke law assumption\n",
- "Pressure drop across fluidised bed \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -157,11 +148,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "the linear air flow rate\n",
- "speed required for smallest particle\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -232,12 +219,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "the diameter of vessel\n",
- "depth of bed \n",
- "depth of fluidised bed under operating condition\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -312,7 +294,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find power supplies to the blower\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -368,11 +350,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "minimum fluidising velocity\n",
- "fluidising velocity\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -424,7 +402,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find ratio of terminal velocity\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Problems_In_Fluid_Flow/ch12.ipynb b/Problems_In_Fluid_Flow/ch12.ipynb
index c84580f4..7b9dbb44 100644
--- a/Problems_In_Fluid_Flow/ch12.ipynb
+++ b/Problems_In_Fluid_Flow/ch12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:8f1680a01385ff5949f5cb398f429f5e497854e1c9f1b526eeecdccb5f6a2e6a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -29,7 +30,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find actual linear flow rate through duct\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -83,7 +84,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find maximum carrying capacity of polythene particles\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -143,7 +144,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Pressure value in kN/m**2\n",
"\n",
"import math \n",
"\n",
@@ -212,7 +212,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The Pressure value in kN/m**2\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -280,11 +280,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The maximum pressure drop\n",
- "The minimum pressure drop\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Problems_In_Fluid_Flow/ch13.ipynb b/Problems_In_Fluid_Flow/ch13.ipynb
index 4422df84..3eb84b32 100644
--- a/Problems_In_Fluid_Flow/ch13.ipynb
+++ b/Problems_In_Fluid_Flow/ch13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:8de14a272a9bc06516758c82d47f7c6c131e878e1053a9679880c251e49e360a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "ratio of cetrifugal force & gravitational force\n",
- "equivalent to gravity settling tank of crossectional area\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -81,12 +78,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The maximum safe speed allowed in rpm\n",
- "the power in N/m**2\n",
- "pressure gradient in radial direction \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -150,7 +142,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find minimum diameter in organic pigment\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -193,7 +185,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find maximum volumetric flow rate\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -240,7 +232,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find distance of xis of rotation of cream milk interface\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -281,7 +273,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find volumetric flow rate\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -326,7 +318,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find overall efficiency of cyclone separator\n",
"\n",
"import math \n",
"from numpy import linspace\n",
diff --git a/Problems_In_Fluid_Flow/ch2.ipynb b/Problems_In_Fluid_Flow/ch2.ipynb
index b825a760..3ed00d28 100644
--- a/Problems_In_Fluid_Flow/ch2.ipynb
+++ b/Problems_In_Fluid_Flow/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:9728786ea75c57c39fe0761ee4fb63c15077dcd6bf03dc93443815257347de88"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find pressure maintained at compressor\n",
+ "\n",
"\n",
"from scipy.optimize import fsolve\n",
"from math import *\n",
@@ -90,17 +91,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "ratio of Pw/P1\n",
- "maximum velocity in (m/s)\n",
- "maximum mass flow rate in(kg/s)\n",
- "heat taken up to maintain isothermal codition(J/s)\n",
- "crtical pressure ratio in adiabatic condition\n",
- "velocity at adiabatic condition in (m/s)\n",
- "mass flow rate at adiabatic condition in (kg/s)\n",
- "temperature of discharging gas in (Celcius)\n",
- "'''\n",
+ "\n",
"\n",
"from math import *\n",
"from numpy import *\n",
@@ -221,13 +212,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "new estimate assumed\n",
- "mass flow rate of steam through pipe\n",
- "pressure of pipe at downstream end in\n",
- "temperature of steam emerging from pipe\n",
- "'''\n",
+ "\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
@@ -306,12 +291,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "pressure at nozzle throat\n",
- "diameter required at nozzle throat\n",
- "sonic velocity at throat\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -365,7 +345,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find height of manometer\n",
"\n",
"import math \n",
"\n",
@@ -409,11 +388,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "both liquid phase and solid phase \n",
- "required pressure drop per unit length\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Problems_In_Fluid_Flow/ch3.ipynb b/Problems_In_Fluid_Flow/ch3.ipynb
index 092a98ed..aae6f3e2 100644
--- a/Problems_In_Fluid_Flow/ch3.ipynb
+++ b/Problems_In_Fluid_Flow/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:8dba2b3d7cbaa7605bb6013111bd417249fb9e6e7f076f776b644ff232eb7675"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,16 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "fluid in boundary layer would be entirely\n",
- "reynolds \n",
- "boundary layer width\n",
- "velocity of water\n",
- "shear stress \n",
- "mean shear stress experienced\n",
- "total force experienced\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -108,17 +100,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "% of surface over which turbulent boundary layer \n",
- "thickness of boundary layer \n",
- "velocity of air at mid point \n",
- "thickness of laminar boundary layer\n",
- "velocity at outer edge of laminar sublayer\n",
- "shearforce expericienced\n",
- "mean shearforce \n",
- "total drag force expericienced by the plate \n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -204,21 +185,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "pipe flow reynolds\n",
- "Water will be in streamline motion in the pipe\n",
- "velocity gradient at the pipe wall\n",
- "Sherastress at pipe wall\n",
- "new av. fluid velocity \n",
- "thickness of laminar sublayer\n",
- "thickness of buffer layer \n",
- "percentage of pipe-s core occupied by turbulent core\n",
- "velocity where sublayer and buffer layer meet \n",
- "velocity where turbulent core and buffer layer meet\n",
- "fluid velocity \n",
- "shearstress \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Problems_In_Fluid_Flow/ch4.ipynb b/Problems_In_Fluid_Flow/ch4.ipynb
index cf855c54..5938d17b 100644
--- a/Problems_In_Fluid_Flow/ch4.ipynb
+++ b/Problems_In_Fluid_Flow/ch4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:ffc24e4736ce76886d42f423c1c0ec0d6d6df9d9e5919471cf9355fdd075f7c0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,17 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "maximum fluid velocity \n",
- "reynold no. \n",
- "mass flow rate \n",
- "Volumetric flow rate \n",
- "maximum fluid velocity\n",
- "reynold no. \n",
- "volumetric flow rate\n",
- "mass flow rate\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -120,11 +111,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "volumetric flow rate\n",
- "mass flow rate of chlorine gas\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"import numpy\n",
@@ -219,12 +206,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "mass flow rate\n",
- "pressuer differnce between tapping points \n",
- "difference in water levels in manometer\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -280,11 +262,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "diameter of orifice\n",
- "ratio of pressure drop \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -340,12 +318,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "pressure drop over the float\n",
- "mass flow rate\n",
- "Volumetric flow rate\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -405,7 +377,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find mass of float equired \n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Problems_In_Fluid_Flow/ch5.ipynb b/Problems_In_Fluid_Flow/ch5.ipynb
index 2f6c5b6c..9a1752c6 100644
--- a/Problems_In_Fluid_Flow/ch5.ipynb
+++ b/Problems_In_Fluid_Flow/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:f59ee9dc4c5262ffa9663e99f39b4e3b3c7c93a564a44e8c761f2c4379d0bbed"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,12 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "volumetric flow rate\n",
- "chezy coefficient\n",
- "velocity gradient in the channel\n",
- "'''\n",
+ "\n",
"import math \n",
"\n",
"# Initialization of Variable\n",
@@ -85,7 +81,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find depth of water\n",
+ "\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
@@ -134,7 +130,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find slope of channel\n",
+ "\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
@@ -181,13 +177,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "maximum velocity\n",
- "maximum volumetric flow \n",
- "maximum velocity of obtained fluid \n",
- "maximum flow rate obtained\n",
- "'''\n",
+ "\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
@@ -255,13 +245,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "velocity of fluid \n",
- "fluid depth over weir in (m)\n",
- "fluid depth over weir in if SI units \n",
- "base angle of the notch of weir\n",
- "'''\n",
+ "\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
@@ -330,14 +314,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "alternative depth \n",
- "maximum volumetric flow\n",
- "Froude no.\n",
- "% of kinetic energy in initial system\n",
- "% of kinetic energy in final system \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import poly1d\n",
@@ -399,12 +376,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "alternate depths \n",
- "slode when depth is 12.9cm\n",
- "slode when depth is 45.1cm \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -453,12 +425,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "critical depth\n",
- "critical velocity\n",
- "Critical volumetric flow\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -522,11 +489,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "volumetric flow rate over flat topped weir over rectangular section in non uniform width\n",
- "volumetric flow rate over flat topped weir over rectangular section in uniform width\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -577,12 +540,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Normal depth \n",
- "Critical depth \n",
- "distance in (m) from upstream to that place\n",
- "'''\n",
+ "\n",
"\n",
"from numpy import linspace\n",
"from scipy.optimize import fsolve \n",
@@ -648,17 +606,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "critical depth \n",
- "normal depth upstream\n",
- "normal depth downstream \n",
- "conjugate depth for upstream \n",
- "conjugate depth for downstream \n",
- "distance in (m) of occurence of jump by accurate method\n",
- "distance in (m) of occurence of jump by not so accurate method\n",
- "power loss in hydraulic jump per unit width\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import linspace\n",
diff --git a/Problems_In_Fluid_Flow/ch6.ipynb b/Problems_In_Fluid_Flow/ch6.ipynb
index d95ae4fb..3eb6270f 100644
--- a/Problems_In_Fluid_Flow/ch6.ipynb
+++ b/Problems_In_Fluid_Flow/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:0f5ebffba7421842791b4539c2f380869e20570438cc6f427747cc5e01bc6228"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,14 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Max. height of toluene supported by atm. pressure\n",
- "reynolds no \n",
- "the maximum height above toulene \n",
- "Maximum delivery rate \n",
- "minimum smooth diameter of suction pipe\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -121,11 +115,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "frequency of motor\n",
- "diametr of impeller\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"# Initialization of Variable\n",
@@ -170,7 +160,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Power required to pump fluid \n",
+ "\n",
"\n",
"from matplotlib.pyplot import *\n",
"import math \n",
@@ -276,7 +266,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the flow rate at which H_sys takes over HeffA\n",
"\n",
"import math \n",
"from matplotlib.pyplot import *\n",
@@ -354,11 +343,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "time t when the acceleration will be maximum\n",
- "Maximum frequency of oscillation\n",
- "'''\n",
+ "\n",
"\n",
"import math\n",
"from numpy import *\n",
@@ -438,12 +423,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "mass of air required to lift the sulphuric acid tank\n",
- "work done is magnitude of value in kg\n",
- "The mass of air required \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Problems_In_Fluid_Flow/ch7.ipynb b/Problems_In_Fluid_Flow/ch7.ipynb
index 2c61cecf..1cf884f4 100644
--- a/Problems_In_Fluid_Flow/ch7.ipynb
+++ b/Problems_In_Fluid_Flow/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:2221589d3a230bd5e1c3d095a5ede0c1e2f30a613887d893f353723197c86dd5"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -28,11 +29,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "average particle diameter\n",
- "surface area per gram of cement\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -88,7 +85,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find initial volumetric flow rate\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -142,7 +139,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find pressure drop in terms of (cm of H20)\n",
+ "\n",
"\n",
"import math \n",
"\n",
diff --git a/Problems_In_Fluid_Flow/ch8.ipynb b/Problems_In_Fluid_Flow/ch8.ipynb
index 97b6a74a..09ab4234 100644
--- a/Problems_In_Fluid_Flow/ch8.ipynb
+++ b/Problems_In_Fluid_Flow/ch8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:00c3b1a67f83ca35bc811927488fe197c5bf1eb682a1e6ea0657f01c6f0d77b3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,13 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "pressure drop at t = 30 min\n",
- "the thickness of filtercake formed\n",
- "thickness of cake required\n",
- "average particle diameter\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -103,13 +98,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "time at which the required pressure drop have taken place\n",
- "volume of filterate \n",
- "the time required to collect 750dm**3\n",
- "time required to pass 10dm**3 volume \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -175,7 +164,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the thickness of filter \n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -239,11 +228,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Volume at P = 90kPa \n",
- "Volume at p = 45kPa \n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from numpy import *\n",
@@ -319,12 +304,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "thickness of filter cake \n",
- "rate at which wet cake will be scrapped\n",
- "rate of which slurry is treated\n",
- "'''\n",
+ "\n",
"\n",
"from numpy import *\n",
"import math \n",
@@ -397,11 +377,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "time taken to collect sucrose crystal\n",
- "volume of liquid separated\n",
- "'''\n",
"\n",
"\n",
"import math \n",
diff --git a/Problems_In_Fluid_Flow/ch9.ipynb b/Problems_In_Fluid_Flow/ch9.ipynb
index 9644490f..8a82285f 100644
--- a/Problems_In_Fluid_Flow/ch9.ipynb
+++ b/Problems_In_Fluid_Flow/ch9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:f2115f2ad7692dfe801ea214554c915af4da1fd1ef8995d6587f66bc81d26a08"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "The drag force on sphere\n",
- "The drag force on cube\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -90,13 +87,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "Drag force in N\n",
- "The drag coefficient\n",
- "The lift force\n",
- "The coefficient of lift\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -155,7 +146,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Diameter of sphere\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -198,7 +189,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find The terminal velocity\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -242,11 +233,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find\n",
- "settling occurs in stoke-s law range\n",
- "settling velocity\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -313,7 +299,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find Time taken by particle to reach 80% of its velocity\n",
+ "\n",
"\n",
"import math \n",
"from numpy import linspace\n",
diff --git a/Programming_in_C/Chapter_03.ipynb b/Programming_in_C/Chapter_03.ipynb
index 0f1f4347..bbc7d9cf 100644
--- a/Programming_in_C/Chapter_03.ipynb
+++ b/Programming_in_C/Chapter_03.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter III"
+ "name": "",
+ "signature": "sha256:57f27b589000036417c51c927626e752909312f11d9fc5346eab037945b09afc"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,35 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 3: Compiling and running your first program"
+ "source": [
+ "Chapter 3: Compiling and running your first program"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.1, Page number: 11"
+ "source": [
+ "Program 3.1, Page number: 11"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.1.py\n#first Python Program\n\n#Print Statement\nprint(\"Programming is Fun.\")",
+ "input": [
+ "\n",
+ "#Print Statement\n",
+ "print(\"Programming is Fun.\")"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Programming is Fun.\n"
+ "text": [
+ "Programming is Fun.\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +49,30 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.2, Page number: 14"
+ "source": [
+ "Program 3.2, Page number: 14"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.2.py\n#Writing Your First C Program(Version2)\n\n#Print statement\nprint(\"Programming is Fun.\")\nprint(\"And Programming in Python is even more fun\")",
+ "input": [
+ "\n",
+ "\n",
+ "#Print statement\n",
+ "print(\"Programming is Fun.\")\n",
+ "print(\"And Programming in Python is even more fun\")"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Programming is Fun.\nAnd Programming in Python is even more fun\n"
+ "text": [
+ "Programming is Fun.\n",
+ "And Programming in Python is even more fun\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +81,33 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.3, Page number: 14"
+ "source": [
+ "Program 3.3, Page number: 14"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.3.py\n#Displaying multiple Lines of output\n\n#Print statements using escape sequence\nprint(\"Testing...\\n..1\\n...2\\n....3\\n\")",
+ "input": [
+ "#3.3.py\n",
+ "#Displaying multiple Lines of output\n",
+ "\n",
+ "#Print statements using escape sequence\n",
+ "print(\"Testing...\\n..1\\n...2\\n....3\\n\")"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Testing...\n..1\n...2\n....3\n\n"
+ "text": [
+ "Testing...\n",
+ "..1\n",
+ "...2\n",
+ "....3\n",
+ "\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +116,27 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.4, Page number: 15"
+ "source": [
+ "Program 3.4, Page number: 15"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.4.py\n#Displaying Variables\n \nsum=50+25\nprint(\"The sum of 50 & 25 is: {0} \".format(sum))",
+ "input": [
+ " \n",
+ "sum=50+25\n",
+ "print(\"The sum of 50 & 25 is: {0} \".format(sum))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of 50 & 25 is: 75 \n"
+ "text": [
+ "The sum of 50 & 25 is: 75 \n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +145,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.5, Page number: 16"
+ "source": [
+ "Program 3.5, Page number: 16"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.5.py\n#Displayig multiple values\n\n#Variable declaration\nvalue1=50\nvalue2=25\n\n#Calculation\nsum=value1+value2\n\n#Result\nprint(\"The sum of {0} & {1} is: {2}\".format(value1,value2,sum))",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "value1=50\n",
+ "value2=25\n",
+ "\n",
+ "#Calculation\n",
+ "sum=value1+value2\n",
+ "\n",
+ "#Result\n",
+ "print(\"The sum of {0} & {1} is: {2}\".format(value1,value2,sum))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of 50 & 25 is: 75\n"
+ "text": [
+ "The sum of 50 & 25 is: 75\n"
+ ]
}
],
"prompt_number": 5
@@ -122,19 +182,35 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Program 3.6, Page number: 17"
+ "source": [
+ "Program 3.6, Page number: 17"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#3.6.py\n#Using Comment in a program\n\n#'#(Hash/Pound)' is used to display a comment in python\n#This is a comment\n\n#Variable declarations\nvalue1=50\nvalue2=25\n\n#Calculation\nsum=value1+value2\n\n#Result\nprint(\"The sum of {0} & {1} is {2}\".format(value1,value2,sum))",
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declarations\n",
+ "value1=50\n",
+ "value2=25\n",
+ "\n",
+ "#Calculation\n",
+ "sum=value1+value2\n",
+ "\n",
+ "#Result\n",
+ "print(\"The sum of {0} & {1} is {2}\".format(value1,value2,sum))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of 50 & 25 is 75\n"
+ "text": [
+ "The sum of 50 & 25 is 75\n"
+ ]
}
],
"prompt_number": 6
diff --git a/Programming_in_C/Chapter_04.ipynb b/Programming_in_C/Chapter_04.ipynb
index f7f7405b..43a3ac6c 100644
--- a/Programming_in_C/Chapter_04.ipynb
+++ b/Programming_in_C/Chapter_04.ipynb
@@ -27,17 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#4.1.py\n",
- "#Using the Basic Data Types\n",
"\n",
- "#Variable Declarations\n",
"integerVar=100\n",
"floatingVar=331.79\n",
"doubleVar=8.44e+11\n",
"charVar='w'\n",
"boolVar=bool(0)\n",
"\n",
- "#Result\n",
"print(\"integerVar={0}\".format(integerVar))\n",
"print(\"floatingVar={0}\".format(floatingVar))\n",
"print(\"doubleVar={0}\".format(doubleVar))\n",
@@ -73,16 +69,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#4.2.py\n",
- "#Using the Arithmetic Operators\n",
"\n",
- "#Variable declarations\n",
"a=100\n",
"b=2\n",
"c=25\n",
"d=4\n",
"\n",
- "#Calculations/Results\n",
"result=a-b #subtraction\n",
"print(\"a-b={0}\".format(result)) #result\n",
"\n",
@@ -126,16 +118,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#4.3.py\n",
- "#More Examples with Arithmetic Operations\n",
"\n",
- "#Variable Declarations\n",
"a=25\n",
"b=2\n",
"c=25.0\n",
"d=2.0\n",
"\n",
- "#Calculations/Result\n",
"print(\"6 + a / 5 * b = {0}\".format(6+a/5*b))\n",
"print(\"a / b * b = {0}\".format(a/b*b))\n",
"print(\"c / d * d = {0}\".format(c/d*d))\n",
@@ -169,16 +157,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#4.4.py\n",
- "#Illustrating the Modulus Operator\n",
"\n",
- "#Variable Declarations\n",
"a=25\n",
"b=5\n",
"c=10\n",
"d=7\n",
"\n",
- "#Calculations/Result\n",
"print(\"a % b = {0}\".format(a%b))\n",
"print(\"a % c = {0}\".format(a%c))\n",
"print(\"a % d = {0}\".format(a%d))\n",
@@ -212,10 +196,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#4.5.py\n",
- "#Converting Between Integers and Floats\n",
"\n",
- "#Variable Declarations\n",
"f1=123.125\n",
"f2=1.0\n",
"i1=1\n",
diff --git a/Programming_in_C/Chapter_05.ipynb b/Programming_in_C/Chapter_05.ipynb
index 90be6c84..588cb6d1 100644
--- a/Programming_in_C/Chapter_05.ipynb
+++ b/Programming_in_C/Chapter_05.ipynb
@@ -27,13 +27,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#5.1.py\n",
- "#Calculating the Eighth Triangular Number\n",
"\n",
- "#Variable Declaration\n",
"triangularNumber = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8;\n",
"\n",
- "#Result\n",
"print(\"The eighth triangular number is {0}\".format(triangularNumber))"
],
"language": "python",
@@ -61,17 +57,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#5.2.py\n",
- "#Calculating the 200th Triangular Number\n",
"\n",
- "#Variable Declaration\n",
"triangularNumber=0\n",
"\n",
- "#Calculation\n",
"for i in range (201):\n",
" triangularNumber=triangularNumber+i \n",
"\n",
- "#Result\n",
"print(\"The 200th triangular number is {0}\".format(triangularNumber))"
],
"language": "python",
@@ -99,17 +90,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#5.3.py\n",
- "#Generating a Table of Triangular Numbers\n",
"\n",
"print(\"TABLE OF TRIANGULAR NUMBERS\\n\\n\")\n",
"print(\" n Sum from 1 to n\\n\")\n",
"print(\"--- -----------------\\n\")\n",
"\n",
- "#Variable Declarations\n",
"triangularNumber=0\n",
"\n",
- "#Calculation/Result\n",
"for i in range (1,11):\n",
" triangularNumber=triangularNumber+i\n",
" print(\" {0} {1}\\n\".format(i,triangularNumber))"
@@ -165,18 +152,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#5.4.py\n",
- "#Asking the User for Input\n",
"\n",
- "#Variable Declaration/User Input\n",
"triangularNumber=0\n",
"number=10 #number=input(\"What triangular number do you want?\")\n",
"\n",
- "#Calculations\n",
"for n in range (1,(number+1)):\n",
" triangularNumber+=n\n",
"\n",
- "#Result\n",
"print(\"triangular number {0} is {1}\".format(number,triangularNumber))"
],
"language": "python",
@@ -204,10 +186,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#5.5.py\n",
- "#Using Nested for Loops\n",
"\n",
- "#Calculations\n",
"for counter in range(1,6): #Outer Loop\n",
" number=12 #input(\"what triangular number do you want? \")\n",
"\n",
@@ -248,13 +227,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#5.6.py\n",
- "#Introducing the while Statement\n",
"\n",
- "#Variable Declaration\n",
"count=1\n",
"\n",
- "#Calculation/Iteration `\n",
"while (count<=5):\n",
" print(\"{0}\\n\".format(count)) #Result\n",
" count+=1"
@@ -293,21 +268,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#5.7.py\n",
- "#Finding the Greatest Common Divisor\n",
"\n",
"print(\"Please type in two nonnegative integers.\")\n",
- "#Variable Declaration/User Input\n",
"u=8 #u=input()\n",
"v=14 #v=input()\n",
"\n",
- "#Calculation\n",
"while(v!=0):\n",
" temp=u%v\n",
" u=v\n",
" v=temp\n",
"\n",
- "#Result\n",
"print(\"Their greatest common divisor is {0}\\n\".format(u))"
],
"language": "python",
@@ -337,16 +307,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#5.8.py\n",
- "#Reversing the Digits of a Number\n",
"\n",
- "#Import Library\n",
"import sys\n",
"\n",
- "#Variable declaration/User Input\n",
"number=113 #number=input(\"Enter your number.\\n\")\n",
"\n",
- "#Calculation/Result\n",
"while(number!=0):\n",
" right_digit=number%10\n",
" sys.stdout.write(\"{0}\".format(right_digit))\n",
@@ -380,17 +345,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#5.9.py\n",
- "#Implementing a Revised Program to Reverse the Digits of a Number\n",
- "#(do-while equivalent code)\n",
"\n",
- "#Import Library\n",
"import sys\n",
"\n",
- "#Variable Declaration/User Input\n",
"number=428 #number=input(\"Enter your number:\\n\")\n",
"\n",
- "#Calculation/Result\n",
"while True: #Enter loop instantly for the first time\n",
" right_digit=number%10\n",
" sys.stdout.write(\"{0}\".format(right_digit))\n",
diff --git a/Programming_in_C/Chapter_06.ipynb b/Programming_in_C/Chapter_06.ipynb
index a612ce70..ef1fef64 100644
--- a/Programming_in_C/Chapter_06.ipynb
+++ b/Programming_in_C/Chapter_06.ipynb
@@ -27,20 +27,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.1.py\n",
- "#Calculating the Absolute Value of an Integer\n",
"\n",
- "#Variable Declaration/User input\n",
"number=12 #number=int(raw_input(\"Type in your number: \"))\n",
"\n",
- "#Calculation\n",
"try:\n",
" if( number < 0 ):\n",
" number=-number #change sign,if number is negative\n",
"except: \n",
" print \"not a number\" #Invalid input/value error\n",
" \n",
- "#Result\n",
"print (\"The absolute Value is {0}\".format(number))"
],
"language": "python",
@@ -68,20 +63,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.2.py\n",
- "#Calculating average & counting the number\n",
- "#of failures from a set of grades\n",
"\n",
- "#Variable Declarations\n",
"gradeTotal=0\n",
"failureCount=0\n",
"i=0\n",
"\n",
- "#User Input\n",
"numberOfGrades=5 #numberOfGrades=int(raw_input(\"How many grades will you be entering? \"))\n",
"grade=[72,83,91,89,95]\n",
"\n",
- "#Calculation\n",
"while(i<numberOfGrades):\n",
" gradeTotal=gradeTotal+grade[i]\n",
" if(grade<65):\n",
@@ -90,7 +79,6 @@
"\n",
"average=float(gradeTotal/numberOfGrades)\n",
" \n",
- "#Result\n",
"print(\"Grade average= {0:.2f}\".format(average))\n",
"print(\"Number of failures= {0}\".format(failureCount))"
],
@@ -120,16 +108,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.3.py\n",
- "#Determining if a Number Is Even or Odd\n",
"\n",
- "#Variable declaration/User input\n",
"number_to_test=30 #number_to_test=int(raw_input(\"Enter your number to be tested: \"))\n",
"\n",
- "#Calculation\n",
"remainder=number_to_test%2\n",
"\n",
- "#Result\n",
"if(remainder==0):\n",
" print(\"The number is even\")\n",
"if(remainder!=0):\n",
@@ -160,16 +143,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.4.py\n",
- "#Program to determine if a number is even or odd (Ver. 2)\n",
"\n",
- "#Variable declaration/User input\n",
"number_to_test=45 #number_to_test=int(raw_input(\"Enter your Number to be tested: \"))\n",
"\n",
- "#Calculation\n",
"remainder=number_to_test%2\n",
"\n",
- "#Result\n",
"if(remainder==0):\n",
" print(\"The number is even.\\n\")\n",
"else: #using 'else' instead of second 'if'\n",
@@ -201,18 +179,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.5.py\n",
- "#Determining if a Year Is a Leap Year\n",
"\n",
- "#Variable declaration/User input\n",
"year=1900 #year=int(raw_input(\"Enter the year to be tested: \"))\n",
"\n",
- "#Calculations\n",
"rem_4=year%4\n",
"rem_100=year%100\n",
"rem_400=year%400\n",
"\n",
- "#Result\n",
"if((rem_4==0 and rem_100!=0)or rem_400==0):\n",
" print(\"It's a leap year.\")\n",
"else:\n",
@@ -244,13 +217,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.6.py\n",
- "#Implementing the Sign Function\n",
"\n",
- "#Variable declaration/User input\n",
"number=450 #number=int(raw_input(\"Please type in a number: \"))\n",
"\n",
- "#Calculations\n",
"try:\n",
" if(number<0): #Negative Number\n",
" sign=-1\n",
@@ -261,7 +230,6 @@
"except: #Value error\n",
" print(\"invalid input\")\n",
"\n",
- "#Result\n",
"print(\"Sign= {0}\".format(sign))"
],
"language": "python",
@@ -289,13 +257,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.7.py\n",
- "#Implementing the Sign Function\n",
"\n",
- "#variable declaration/User input\n",
"ch='z' #ch=raw_input(\"Enter a single character: \")\n",
"\n",
- "#Calculation/Result\n",
"if((ch>='a' and ch <='z') or (ch>='A' and ch<='Z')):\n",
" print(\"It's an alphabetic character.\")\n",
"elif(ch>='0'and ch<='9'):\n",
@@ -328,13 +292,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.8.py\n",
- "#evaluate simple expressions of the form\n",
- "#<number operator number>\n",
"\n",
"\n",
"try:\n",
- "#Variable declaration/User input\n",
" print(\"Type in your expression(with spaces inbetween): \")\n",
" value1, operator, value2=\"5 + 2\".split()\n",
" #value1, operator, value2=raw_input().split()\n",
@@ -343,10 +303,8 @@
" print(\"err.. follow the syntax <value operator value>\") \n",
" print(\"with spaces inbetween\\n\")\n",
"\n",
- "#Parsing\n",
"value1,value2=[float(value1),float(value2)]\n",
"\n",
- "#Calculation/Result\n",
"if(operator=='+'):\n",
" print(\"answer: {0:.2f}\".format(value1+value2))\n",
"elif(operator=='-'):\n",
@@ -382,13 +340,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.9.py\n",
- "#evaluate simple expressions of the form\n",
- "#<number operator number> (Version 2)\n",
"\n",
"\n",
"try:\n",
- "#Variable declaration/User input\n",
" print(\"Type in your expression(with spaces inbetween): \")\n",
" value1, operator, value2=\"3 * 5\".split()\n",
" #value1, operator, value2=raw_input().split()\n",
@@ -398,10 +352,8 @@
" print(\"err.. follow the syntax <value operator value>\") \n",
" print(\"with spaces inbetween\\n\")\n",
"\n",
- "#parsing\n",
"value1,value2=[float(value1), float(value2)]\n",
"\n",
- "#Calculation/Result\n",
"if(operator=='+'):\n",
" print(\"Answer= {0:.2f}\".format(value1+value2))\n",
"elif(operator=='-'):\n",
@@ -442,13 +394,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#6.10.py\n",
- "#Generating a Table of Prime Numbers\n",
"\n",
- "#Variable declarations\n",
"p=2\n",
"\n",
- "#Calculations\n",
"while(p<=50): #Outer loop\n",
" isPrime=1 #Variable declaration\n",
" d=2 \n",
@@ -458,7 +406,6 @@
" d=d+1 #End of inner loop\n",
" \n",
" if( isPrime!=0):\n",
- "#Print Result\n",
" print \" \",p \n",
" p=p+1 #End of outer loop"
],
diff --git a/Programming_in_C/Chapter_07.ipynb b/Programming_in_C/Chapter_07.ipynb
index de714e04..7c0f6329 100644
--- a/Programming_in_C/Chapter_07.ipynb
+++ b/Programming_in_C/Chapter_07.ipynb
@@ -27,13 +27,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#7.1.py\n",
- "#Working with an Array(or list in python)\n",
"\n",
- "#Variable/List declaration\n",
"values=[0]*10\n",
"\n",
- "#Initialisation/Calculation\n",
"values[0]=197\n",
"values[2]=-100\n",
"values[5]=350\n",
@@ -42,7 +38,6 @@
"values[2]-=1\n",
"i=0\n",
"\n",
- "#Iteration/Result\n",
"for index in values:\n",
" print(\"values[{0}] = {1}\".format(i,index))\n",
" i=i+1"
@@ -81,20 +76,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#7.2.py\n",
- "#Demonstrating an Array of Counters\n",
"\n",
- "#variable/List Declaration\n",
"ratingCounters=[0]*11\n",
"\n",
- "#Loop-1\n",
"for i in range(1,11):\n",
" ratingCounters[i]=0\n",
"\n",
"print(\"Enter your Responses:\")\n",
"\n",
- "#Loop-2\n",
- "#Clculation\n",
"for i in range (1,21):\n",
" response=5 #score=5 for all iterations\n",
" #response=input()\n",
@@ -104,11 +93,9 @@
" else:\n",
" ratingCounters[response]+=1\n",
"\n",
- "#Result\n",
"print(\"\\n\\n Rating | Number of Responses\\n\")\n",
"print(\" ----- -------------------\")\n",
"\n",
- "#Loop-3\n",
"for i in range(1,11):\n",
" print(\" {0} {1}\".format(i,ratingCounters[i]))"
],
@@ -152,20 +139,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#7.3.py\n",
- "#Generating Fibonacci Numbers\n",
"\n",
- "#Variable/List Declaration\n",
"Fibonacci=[0]*15\n",
"\n",
"Fibonacci[0]=0\n",
"Fibonacci[1]=1\n",
"\n",
- "#Loop-1\n",
"for i in range(2,15):\n",
" Fibonacci[i]=Fibonacci[i-2]+Fibonacci[i-1] #Calculation\n",
"\n",
- "#Loop-2\n",
"for i in range(15):\n",
" print(\"{0}\".format(Fibonacci[i])) #Print Result"
],
@@ -208,10 +190,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#7.4.py\n",
- "#Revising the Program to Generate Prime Numbers,Version 2\n",
"\n",
- "#Variable Declaration\n",
"primeIndex=2\n",
"primes=[0]*50\n",
"\n",
@@ -219,7 +198,6 @@
"primes[1]=3\n",
"p=5\n",
"\n",
- "#Calculations\n",
"while(p<=50): #Outer Loop-1\n",
" isPrime=True\n",
" \n",
@@ -235,7 +213,6 @@
" primeIndex+=1\n",
" p=p+2\n",
"\n",
- "#Results\n",
"for i in range (primeIndex): #Outer Loop-2\n",
" print(\"{0}\".format(primes[i]))"
],
@@ -278,18 +255,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#7.5.py\n",
- "#Initializing Arrays\n",
"\n",
- "#Variable/List Declarations\n",
"array_values=[0]*10\n",
"array_values[0:4]=[0,1,4,9,16]\n",
"\n",
- "#Calculations\n",
"for i in range(5,10):\n",
" array_values[i]=i*i\n",
"\n",
- "#Results\n",
"for i in range(10):\n",
" print(\"array values[{0}] = {1}\".format(i,array_values[i]))"
],
@@ -327,16 +299,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#7.6.py\n",
- "#Introducing Character Arrays\n",
"\n",
- "#Import Library\n",
"import sys #For sys.stdout.write()\n",
"\n",
- "#Variable/List Declaration\n",
"word=['H','e','l','l','o','!']\n",
"\n",
- "#Iterator/Result\n",
"for i in word:\n",
" sys.stdout.write(\"{0} \".format(i))\n",
"print(\"\\n\")"
@@ -367,13 +334,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#7.7.py\n",
- "#Converting a Positive Integer to Another Base\n",
"\n",
- "#import Library\n",
"import sys #for sys.stdout.write()\n",
"\n",
- "#Variable Declarations\n",
"baseDigits=['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']\n",
"convertedNumber=[0]*10\n",
"index=0\n",
@@ -381,7 +344,6 @@
"numberToConvert=234 #numberToConvert=input(\"Number to be converted?: \")\n",
"base=2 #base=input(\"Base?: \")\n",
"\n",
- "#Calculations\n",
"while True:\n",
" convertedNumber[index]=numberToConvert%base\n",
" index+=1\n",
@@ -389,7 +351,6 @@
" if(numberToConvert==0):\n",
" break\n",
"\n",
- "#Result\n",
"print(\"Converted Number= \")\n",
"index-=1\n",
"while(index>=0):\n",
@@ -426,29 +387,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#7.8.py\n",
- "#Generating Fibonacci Numbers Using Variable-Length Arrays\n",
"\n",
- "#import Libraries\n",
"import sys #For sys.exit() \n",
" \n",
- "#User Input \n",
"numFibs=18 #numFibs=input(\"How many Fibonacci numbers do you want (between 1 and 75)? \")\n",
"\n",
"if(numFibs<1 or numFibs>75):\n",
" print(\"bad number,sorry!\")\n",
" sys.exit()\n",
"\n",
- "#Variable Declarations \n",
"Fibonacci=[0]*numFibs\n",
"Fibonacci[0]=0\n",
"Fibonacci[1]=1\n",
"\n",
- "#Calculation\n",
"for i in range(2,numFibs):\n",
" Fibonacci[i]=Fibonacci[i-2]+Fibonacci[i-1] \n",
" \n",
- "#Result\n",
"for i in range(numFibs):\n",
" print(\"{0}\".format(Fibonacci[i]))"
],
diff --git a/Programming_in_C/Chapter_08.ipynb b/Programming_in_C/Chapter_08.ipynb
index a4113d97..f8d5211b 100644
--- a/Programming_in_C/Chapter_08.ipynb
+++ b/Programming_in_C/Chapter_08.ipynb
@@ -27,8 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.1.py\n",
- "#Writing a Function in python\n",
"\n",
"\n",
"def printMessage(): #Function to Print Message\n",
@@ -68,8 +66,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.2.py\n",
- "#Calling Functions\n",
"\n",
"\n",
"def printMessage(): #Function to Print Message\n",
@@ -111,8 +107,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.3.py\n",
- "#More on Calling Functions\n",
"\n",
"\n",
"def printMessage(): #Function to Print Message\n",
@@ -161,8 +155,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.4.py\n",
- "#Calculating the nth Triangular Number\n",
"\n",
"\n",
"def calculateTriangularNumber(n): #Function to calculate triangular number\n",
@@ -210,10 +202,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.5.py\n",
- "#Revising the Program to Find the Greatest Common Divisor\n",
"\n",
- "#Import Library \n",
"import sys \n",
"\n",
"def gcd(u,v): #Function to calculate gcd\n",
@@ -261,10 +250,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.6.py\n",
- "#Finding the Greatest Common Divisor and Returning the Results\n",
"\n",
- "#Import Library \n",
"import sys \n",
"\n",
"def gcd(u,v): #Function to calculate gcd\n",
@@ -313,12 +299,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.7.py\n",
- "#Calculating the Absolute Value\n",
"\n",
- "#yourstory.in\n",
"\n",
- "#Calculations\n",
"def absoluteValue(x): #Function to calculate & return absolute values\n",
" if(x<0):\n",
" x=-x\n",
@@ -330,7 +312,6 @@
" f2=20.0\n",
" f3=-5.0\n",
" il=-716\n",
- "#Result \n",
" result=absoluteValue(f1)\n",
" print(\"result= {0:.2f}\".format(result))\n",
" print(\"f1={0:.2f}\".format(f1))\n",
@@ -347,7 +328,6 @@
" print(\"{0:.2f}\".format(absoluteValue((-6.0)/4)))\n",
"\n",
"\n",
- "#End of Main()\n",
" \n",
"if __name__=='__main__': #Setting Top level conditional script\n",
" main()"
@@ -382,17 +362,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.8.py\n",
- "#Calculating the Square Root of a Number using Newton-Raphson Method \n",
"\n",
"\n",
- "#Function to return absolute value\n",
"def absoluteValue(x): \n",
" if(x<0):\n",
" x=-x\n",
" return x\n",
"\n",
- "#function to calculate square root\n",
"def squareRoot(x):\n",
" epsilon=0.0001\n",
" guess=1.0\n",
@@ -400,13 +376,11 @@
" guess=(x/guess+guess)/2.0\n",
" return guess\n",
"\n",
- "#Main()\n",
"def main():\n",
" print(\"squareRoot (2.0) = {0}\".format(squareRoot (2.0)));\n",
" print(\"squareRoot (144.0) = {0}\".format(squareRoot (144.0)));\n",
" print(\"squareRoot (17.5) = {0}\".format(squareRoot (17.5)));\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -437,10 +411,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.9.py\n",
- "#Finding the Minimum Value in an Array\n",
"\n",
- "#Function to return minimum value\n",
"def minimum(values):\n",
" minValue=values[0] #Variable Declaration\n",
" for i in range (1,10): #Calculation\n",
@@ -449,7 +420,6 @@
"\n",
" return minValue\n",
" \n",
- "#Main()\n",
"def main():\n",
" scores=[] #Variable Declaration\n",
" print(\"Enter 10 scores:\")\n",
@@ -460,7 +430,6 @@
" minScore=minimum(scores) #Function call & assignment\n",
" print(\"\\nMinimum score is {0}\\n\".format(minScore)) #Result\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -492,10 +461,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.10.py\n",
- "#Revising the Function to Find the Minimum Value in an Array\n",
"\n",
- "#Function to return minimum value\n",
"def minimum(values,numberOfElements): \n",
" minValue=values[0] #Variable Declaration\n",
" for i in range(1,numberOfElements): #Iteration/Calculations\n",
@@ -504,7 +470,6 @@
" \n",
" return minValue\n",
"\n",
- "#Main()\n",
"def main():\n",
" #List/Variable Delcaration\n",
" array1 = [ 157, -28, -37, 26, 10 ] \n",
@@ -514,7 +479,6 @@
" print(\"array1 minimum: {0}\".format(minimum (array1, 5)));\n",
" print(\"array2 minimum: {0}\".format(minimum (array2, 7)));\n",
"\n",
- "#Setting top level conditional script \n",
"if __name__=='__main__':\n",
" main()"
],
@@ -544,18 +508,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.11.py\n",
- "#Changing Array Elements in Functions\n",
"\n",
- "#Import System Library\n",
"import sys\n",
"\n",
- "#Function to multiply elements by 2\n",
"def multiplyBy2(array,n):\n",
" for i in range (0,n): #Iteration/Calculation\n",
" array[i]*=2\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List/Variable Declaration\n",
@@ -566,7 +525,6 @@
" sys.stdout.write(\"{0:.2f} \".format(floatVals[i])) #Result\n",
" print(\"\\n\")\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -596,13 +554,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.12.py\n",
- "#\n",
"\n",
- "#Import system Library \n",
"import sys\n",
"\n",
- "#Function to sort the array\n",
"def sort(a,n):\n",
"\n",
" for i in range (0,n-1): #Calculations\n",
@@ -612,7 +566,6 @@
" a[i]=a[j]\n",
" a[j]=temp\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List/Variable Declaration \n",
@@ -631,7 +584,6 @@
" print(\"\\n\")\n",
"\n",
"\n",
- "#Setting top level conditional script \n",
"if __name__=='__main__':\n",
" main()"
],
@@ -668,13 +620,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.13.py\n",
- "#Using Multidimensional Arrays and Functions\n",
"\n",
- "#Import system Library\n",
"import sys\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List/Variable Declaration\n",
@@ -696,14 +644,12 @@
" displayMatrix(sampleMatrix) #Function call-5\n",
"\n",
"\n",
- "#Function to multiply matrix by a scalar quantity \n",
"def scalarMultiply(matrix,scalar):\n",
" for row in range(0,3): #Calculation\n",
" for column in range(0,5):\n",
" matrix[row][column]*=scalar \n",
"\n",
"\n",
- "#Function to display the matrix\n",
"def displayMatrix(matrix):\n",
" for row in range(0,3): #Result\n",
" for column in range(0,5):\n",
@@ -711,7 +657,6 @@
" sys.stdout.write(\"\\n\")\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -756,13 +701,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.13A.py\n",
- "#Multidimensional Variable-Length Arrays\n",
"\n",
- "#Import system Library\n",
"import sys\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List/Variable Declaration\n",
@@ -784,14 +725,12 @@
" displayMatrix(3,5,sampleMatrix) #Function call-5\n",
"\n",
"\n",
- "#Function to multiply matrix by a scalar quantity \n",
"def scalarMultiply(nRows,nCols,matrix,scalar):\n",
" for row in range(0,nRows): #Calculation\n",
" for column in range(0,nCols):\n",
" matrix[row][column]*=scalar \n",
"\n",
"\n",
- "#Function to display the matrix\n",
"def displayMatrix(nRows,nCols,matrix):\n",
" for row in range(0,nRows): #Result\n",
" for column in range(0,nCols):\n",
@@ -799,7 +738,6 @@
" sys.stdout.write(\"\\n\")\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -844,13 +782,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.14.py\n",
- "#Converting a Positive Integer to Another Base\n",
"\n",
- "#Import system Libraries\n",
"import sys\n",
"\n",
- "#Function to get Number & Base\n",
"def getNumberAndBase():\n",
" \n",
" #Global Reference\n",
@@ -866,7 +800,6 @@
" print(\"Bad base - must be between 2 and 16\\n\");\n",
" base = 10;\n",
"\n",
- "#Conversion Function\n",
"def convertNumber():\n",
" \n",
" #Global Reference\n",
@@ -882,7 +815,6 @@
" numberToConvert/=base\n",
"\n",
"\n",
- "#Function to display\n",
"def displayConvertedNumber():\n",
"\n",
" #Global reference \n",
@@ -904,14 +836,12 @@
"\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
" getNumberAndBase() #Function call-1\n",
" convertNumber() #Function call-2\n",
" displayConvertedNumber() #Function call-3\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -940,11 +870,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.15.py\n",
- "#Illustrating Static and Automatic Variables\n",
"\n",
"\n",
- "#Function to display variables\n",
"def auto_static():\n",
" global staticVar #Global reference\n",
" autoVar=1 #variable Declaration\n",
@@ -954,14 +881,12 @@
" autoVar+=1\n",
" staticVar+=1\n",
"\n",
- "#Main()\n",
"def main():\n",
" global staticVar\n",
" staticVar=1 #Variable Declaration\n",
" for i in range(0,5):\n",
" auto_static()\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -999,10 +924,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#8.16.py\n",
- "#Calculating Factorials Recursively\n",
"\n",
- "#Function to calculate factorial\n",
"def factorial(n):\n",
" if( n == 0 ): #Calculation\n",
" result = 1\n",
@@ -1010,13 +932,11 @@
" result = n * factorial (n - 1)\n",
" return result;\n",
"\n",
- "#Main()\n",
"def main():\n",
" for j in range (0,11):\n",
" print(\"{0:3}! = {1}\\n\".format(j,factorial (j)))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
diff --git a/Programming_in_C/Chapter_09.ipynb b/Programming_in_C/Chapter_09.ipynb
index 684317a5..56b0b95f 100644
--- a/Programming_in_C/Chapter_09.ipynb
+++ b/Programming_in_C/Chapter_09.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#9.1.py\n",
- "#Illustrating a Structure/Class in python\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Class Declaration\n",
@@ -55,7 +52,6 @@
" print(\"Today's date is {0}/{1}/{2}\".format(today.month,today.day,today.year%100));\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -84,10 +80,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#9.2.py\n",
- "#Determining Tomorrows Date\n",
"\n",
- "#Main()\n",
"def main():\n",
" #Class Declaration\n",
" class date:\n",
@@ -125,7 +118,6 @@
" print(\"Tomorrow's date is {0}/{1}/{2}\\n\".format(tomorrow.month,tomorrow.day,tomorrow.year));\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -156,10 +148,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#9.3.py\n",
- "#Revising the Program to Determine Tomorrow's Date\n",
"\n",
- "#Class Declaration\n",
"class date:\n",
" def __init__(self): #Class Constructor\n",
" #Default values\n",
@@ -168,7 +157,6 @@
" year=0\n",
" \n",
"\n",
- "#Main()\n",
"def main():\n",
" #creating instances\n",
" today=date()\n",
@@ -196,7 +184,6 @@
" print(\"Tomorrow's date is {0}/{1}/{2}\\n\".format(tomorrow.month,tomorrow.day,tomorrow.year));\n",
"\n",
"\n",
- "#Function to find the number of days in a month \n",
"def numberOfDays(d):\n",
" \n",
" #List Declaration\n",
@@ -209,7 +196,6 @@
" return days\n",
"\n",
"\n",
- "#Function to determine if it's a leap year\n",
"def isLeapYear(d):\n",
" if ( (d.year % 4 == 0 and d.year % 100 != 0) or d.year % 400 == 0 ):\n",
" leapYearFlag = True # Its a leap year\n",
@@ -220,7 +206,6 @@
"\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -251,10 +236,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#9.4.py\n",
- "#Revising the Program to Determine Tomorrow's Date--Version 2\n",
"\n",
- "#Class Declaration\n",
"class date:\n",
" def __init__(self): #Class Constructor\n",
" #Default values\n",
@@ -282,7 +264,6 @@
"\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
" #creating instances\n",
" thisDay=date()\n",
@@ -299,7 +280,6 @@
"\n",
"\n",
"\n",
- "#Function to find the number of days in a month \n",
"def numberOfDays(d):\n",
" \n",
" #List Declaration\n",
@@ -313,7 +293,6 @@
"\n",
"\n",
"\n",
- "#Function to determine if it's a leap year\n",
"def isLeapYear(d):\n",
" if ( (d.year % 4 == 0 and d.year % 100 != 0) or d.year % 400 == 0 ):\n",
" leapYearFlag = True # Its a leap year\n",
@@ -324,7 +303,6 @@
"\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -355,10 +333,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#9.5.py\n",
- "#Updating the Time by One Second\n",
"\n",
- "#Class Declaration\n",
"class time:\n",
" def __init__(self):\n",
" hour=0\n",
@@ -379,7 +354,6 @@
"\n",
" return now\n",
"\n",
- "#Main()\n",
"def main():\n",
" #Creating instances\n",
" currentTime=time()\n",
@@ -396,7 +370,6 @@
"\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -427,13 +400,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#9.6.py\n",
- "#Illustrating Arrays of Structures\n",
"\n",
- "#Import sys Library\n",
"import sys\n",
"\n",
- "#Class Declaration\n",
"class time:\n",
" def __init__(self,h,m,s):\n",
" #Variable Declarations\n",
@@ -455,7 +424,6 @@
"\n",
" return now\n",
"\n",
- "#Main()\n",
"def main():\n",
" #Creating instances\n",
" testTimes = []\n",
@@ -477,7 +445,6 @@
"\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -510,11 +477,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#9.7.py\n",
- "#Illustrating Structures and Arrays\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
" #Class Declaration\n",
" class month:\n",
@@ -545,7 +509,6 @@
" print(\"{0}{1}{2} {3}\\n\".format(months[i].name[0],months[i].name[1],months[i].name[2], months[i].numberOfDays))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
diff --git a/Programming_in_C/Chapter_10.ipynb b/Programming_in_C/Chapter_10.ipynb
index 1ec5bf12..0486f4f9 100644
--- a/Programming_in_C/Chapter_10.ipynb
+++ b/Programming_in_C/Chapter_10.ipynb
@@ -27,13 +27,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.1.py\n",
- "#Concatenating Character Arrays\n",
"\n",
- "#Import system library\n",
"import sys\n",
"\n",
- "#Function to concatinate strings\n",
"def concat(result,str1,n1,str2,n2): #Calculations\n",
" \n",
" #copy str1 to result\n",
@@ -45,7 +41,6 @@
" result[n1+j]=str2[j]\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List Declaration\n",
@@ -61,7 +56,6 @@
" sys.stdout.write(\"\\n\")\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -90,18 +84,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.2.py\n",
- "#Counting the Characters in a String\n",
"\n",
"\n",
- "#FUnction to count number of characters ina string\n",
"def stringLength(string):\n",
" count = 0\n",
" while(string[count]!='\\0'): #Calculation\n",
" count+=1\n",
" return count\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List Declaration\n",
@@ -113,7 +103,6 @@
" print(\"{0} {1} {2}\\n\".format(stringLength (word1),stringLength (word2),stringLength (word3)))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -143,11 +132,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.3.py\n",
- "#Concatenating Character Strings\n",
"\n",
"\n",
- "#Function to concatinate strings\n",
"def concat(result,str1,str2): #Calculations\n",
" \n",
" #copy str1 to result\n",
@@ -159,7 +145,6 @@
" result.append(j)\n",
" \n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #String Declaration\n",
@@ -171,7 +156,6 @@
" print(''.join(s3)) #Result\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -200,10 +184,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.4.py\n",
- "#Testing Strings for Equality\n",
"\n",
- "#Function to compare 2 strings\n",
"def equalStrings(s1,s2):\n",
" \n",
" #Calculation\n",
@@ -227,7 +208,6 @@
" print(\"{0}\".format(equalStrings (strb, \"string\")))\n",
"\n",
"\n",
- "#Setting top level confditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -258,10 +238,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.5.py\n",
- "#Reading Strings\n",
"\n",
- "#Main()\n",
"def main():\n",
" print(\"Enter Text:\\n\")\n",
"\n",
@@ -274,7 +251,6 @@
" print(\"\\ns1={0}\\ns2={1}\\ns3={2}\\n\".format(s1,s2,s3))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -309,10 +285,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.6.py\n",
- "#Reading Lines of Data\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List declaration\n",
@@ -322,7 +295,6 @@
" print(\"{0}\\n\".format(''.join(line))) #Result\n",
"\n",
"\n",
- "#Function to read user input\n",
"def readLine(line):\n",
" \n",
" line.pop()\n",
@@ -330,7 +302,6 @@
" #line.append(raw_input()+\" \")\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -364,10 +335,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.7.py\n",
- "#Counting Words\n",
"\n",
- "#Function to determine if a character is alphabetic\n",
"def alphabetic(c):\n",
" if ( (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') ):\n",
" return True\n",
@@ -375,7 +343,6 @@
" return False\n",
"\n",
"\n",
- "#Function to count the number of words in a string\n",
"def countWords(string):\n",
" \n",
" #Variable Declaration\n",
@@ -393,7 +360,6 @@
" return wordCount\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #String Declaration\n",
@@ -405,7 +371,6 @@
" print(\"{0} - words = {1}\\n\".format(text2,countWords(text2)))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -437,11 +402,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.8.py\n",
- "#Counting Words in a Piece of Text\n",
"\n",
"\n",
- "#Function to read a piece of text\n",
"def readLine(line):\n",
" \n",
" line.pop()\n",
@@ -449,7 +411,6 @@
" #line.append(raw_input()+\" \")\n",
"\n",
"\n",
- "#Function to determine if a character is alphabetic\n",
"def alphabetic(c):\n",
" if ( (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') ):\n",
" return True\n",
@@ -457,7 +418,6 @@
" return False\n",
"\n",
"\n",
- "#Function to count the number of words in a string\n",
"def countWords(string):\n",
" \n",
" #Variable Declaration\n",
@@ -494,7 +454,6 @@
" print(\"\\nThere are {0} words in the above text.\\n\".format(totalWords))\n",
"\n",
"\n",
- "#Top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -530,31 +489,25 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.9.py\n",
- "#Using the Dictionary Lookup Program\n",
"\n",
- "#Class Declaration\n",
"class entry:\n",
" def __init__(self,w,d):\n",
" self.word=w\n",
" self.definition=d\n",
"\n",
"\n",
- "#Function to check equality of two strings\n",
"def equalStrings(str1,str2):\n",
" if(str1==str2):\n",
" return True\n",
" else:\n",
" return False\n",
"\n",
- "#Lookup function to return dictionary entry\n",
"def lookup(dictionary,search,entries):\n",
" for i in range(0,entries):\n",
" if ( equalStrings(search, dictionary[i].word) ):\n",
" return i;\n",
" return -1;\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" entries=10\n",
@@ -584,7 +537,6 @@
" print(\"Sorry, the word {0} is not in my dictionary.\\n\".format(word))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -614,17 +566,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.10.py\n",
- "#Modifying the Dictionary Lookup Using Binary Search\n",
"\n",
- "#Class Declaration\n",
"class entry:\n",
" def __init__(self,w,d): #Class constructor\n",
" self.word=w\n",
" self.definition=d\n",
"\n",
"\n",
- "#Function to compare two strings\n",
"def compareStrings(s1,s2):\n",
"\n",
" #Calculations\n",
@@ -639,7 +587,6 @@
"\n",
"\n",
"\n",
- "#Lookup function to return dictionary entry\n",
"def lookup(dictionary,search,entries):\n",
" \n",
" #Variable Declaration\n",
@@ -661,7 +608,6 @@
" return -1\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -691,7 +637,6 @@
" print(\"Sorry, the word {0} is not in my dictionary.\\n\".format(word))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -721,16 +666,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#10.11.py\n",
- "#Converting a String to its Integer Equivalent\n",
"\n",
"\n",
- "#Function to convert a string to an integer\n",
"def strToInt(string):\n",
" \n",
" return int(string)\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Result\n",
@@ -739,7 +680,6 @@
" print(\"{0}\\n\".format(strToInt(\"13\")))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
diff --git a/Programming_in_C/Chapter_11.ipynb b/Programming_in_C/Chapter_11.ipynb
index a010bcdb..76ced362 100644
--- a/Programming_in_C/Chapter_11.ipynb
+++ b/Programming_in_C/Chapter_11.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.1.py\n",
- "#Illustrating Pointers\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -42,7 +39,6 @@
" #Result\n",
" print(\"count={0} , x={1}\".format(count,x))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -71,10 +67,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.2.py\n",
- "#More Pointer Basics\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -92,7 +85,6 @@
"\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -123,10 +115,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.3\n",
- "#Using Pointers in Expressions\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -138,7 +127,6 @@
" #Result\n",
" print(\"i1 = {0}, i2 = {1}, p1 = {2}, p2 = {3}\\n\".format(i1, i2, p1, p2))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -168,10 +156,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.4.py\n",
- "#Using Pointers to classes\n",
"\n",
- "#Main()\n",
"def main():\n",
" class date:\n",
" def __init__(self): #Class constructor\n",
@@ -190,7 +175,6 @@
" #Result\n",
" print(\"Today's date is {0}/{1}/{2}\".format(datePtr.month, datePtr.day, datePtr.year))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -219,10 +203,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.5.py\n",
- "#Using classes Containing pointer variables\n",
"\n",
- "#Main()\n",
"def main():\n",
" class intPtrs:\n",
" def __init__(self): #Class constructor\n",
@@ -241,7 +222,6 @@
" print(\"i2 = {0}, pointers.p2 = {1}\\n\".format(i2, pointers.p2))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -273,11 +253,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.6.py\n",
- "#Using Linked Lists\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
" class entry:\n",
" def __init(self): #Class constructor\n",
@@ -303,7 +280,6 @@
"\n",
"\n",
"\n",
- "#setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -333,10 +309,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.7.py\n",
- "#Traversing a linked list\n",
"\n",
- "#Main()\n",
"def main():\n",
" class entry:\n",
" def __init__(self): #Class constructor\n",
@@ -362,7 +335,6 @@
" list_pointer = list_pointer.nxt;\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -396,15 +368,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.8.py\n",
- "#Using Pointers and Functions\n",
"\n",
- "#Function to change incoming varible\n",
"def test(int_pointer):\n",
" int_pointer=100\n",
" return int_pointer\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable declaration\n",
@@ -417,7 +385,6 @@
" print(\"After the call to test i = {0}\".format(p))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -447,10 +414,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.9.py\n",
- "#Using Pointers to Exchange Values\n",
"\n",
- "#Function to exchange & return values\n",
"def exchange(pint1,pint2):\n",
" temp=pint1\n",
" pint1=pint2\n",
@@ -458,7 +422,6 @@
" return pint1,pint2\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -478,7 +441,6 @@
" print(\"i1 ={0}, i2 ={1}\\n\".format(i1, i2))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -512,10 +474,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.10.py\n",
- "#Returning a Pointer from a Function\n",
"\n",
- "#Class Declaration\n",
"class entry:\n",
" def __init__(self): #Class constructor\n",
" self.value=0\n",
@@ -532,7 +491,6 @@
"\n",
" return 0\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Creating instance\n",
@@ -562,7 +520,6 @@
" print(\"Not found.\\n\")\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -593,10 +550,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.11.py\n",
- "#Working with Pointers to Arrays/Lists\n",
"\n",
- "#Function to evaluate sum of array elements\n",
"def arraySum (array,n):\n",
"\n",
" #Variable Declaration\n",
@@ -607,7 +561,6 @@
" sum += array[i]\n",
" return sum\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List Declaration\n",
@@ -615,7 +568,6 @@
" #Result\n",
" print(\"The sum is {0}\\n\".format(arraySum (values, 10)))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -645,10 +597,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.12.py\n",
- "#Summing the Elements of an Array--version 2\n",
"\n",
- "#Function to evaluate sum of array elements\n",
"def arraySum (array,n):\n",
" #Variable Declaration\n",
" sum = 0 \n",
@@ -657,7 +606,6 @@
" sum += i\n",
" return sum\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List Declaration\n",
@@ -665,7 +613,6 @@
" #Result\n",
" print(\"The sum is {0}\\n\".format(arraySum(values,10)))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -695,16 +642,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.13.py\n",
- "#Version of copyString\n",
"\n",
- "#Function to copy string from source to destinaton\n",
"def copyString(to, frm):\n",
" global string2\n",
" to=frm\n",
" string2=to\n",
"\n",
- "#Main()\n",
"def main():\n",
" \n",
" global string2\n",
@@ -717,7 +660,6 @@
" copyString (string2, \"So is this.\") #Function call\n",
" print(\"{0}\\n\".format(string2))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -749,16 +691,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.14.py\n",
- "#Revised version of copyString\n",
"\n",
- "#Function to copy string from source to destinaton\n",
"def copyString(to, frm):\n",
" global string2\n",
" to=frm\n",
" string2=to\n",
"\n",
- "#Main()\n",
"def main():\n",
" \n",
" global string2\n",
@@ -771,7 +709,6 @@
" copyString (string2, \"So is this.\") #Function call\n",
" print(\"{0}\\n\".format(string2))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -803,20 +740,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.15.PY\n",
- "#Find the Length of a String\n",
"\n",
- "#Function to return string length\n",
"def stringLength(string):\n",
" return len(string) #Calculation\n",
"\n",
- "#Main()\n",
"def main():\n",
" print(\"{0} \".format(stringLength (\"stringLength test\")))\n",
" print(\"{0} \".format(stringLength (\"\")))\n",
" print(\"{0}\".format(stringLength (\"complete\")))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
diff --git a/Programming_in_C/Chapter_12.ipynb b/Programming_in_C/Chapter_12.ipynb
index 7f498638..a19ac40d 100644
--- a/Programming_in_C/Chapter_12.ipynb
+++ b/Programming_in_C/Chapter_12.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#12.1.py\n",
- "#The bitwise AND operator\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -44,7 +41,6 @@
" print(word1&word2&word3)\n",
" print(word1&1)\n",
"\n",
- "#Setting top level conditioanl script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -76,10 +72,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#12.2.py\n",
- "#Illustrate Bitwise Opertors\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #variable Declarations\n",
@@ -100,7 +93,6 @@
" print(\"w1={0:3} w2={1:3}\".format(w1,w2))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -134,10 +126,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#12.3.py\n",
- "#Implementing a Shift Function\n",
"\n",
- "#Function to perform bitwise shift\n",
"def shift(value,n):\n",
" if(n>0):\n",
" value <<=n #Left shift\n",
@@ -146,7 +135,6 @@
"\n",
" return value\n",
"\n",
- "#Main()\n",
"def main():\n",
" #Variable Declaration\n",
" w1=177777\n",
@@ -158,7 +146,6 @@
" print(\"{0:7} {1:7}\".format(shift(w2,0),w2>>0))\n",
" print(\"{0:7} \".format(shift(shift(w1,-3),3)))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -190,10 +177,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#12.4.py\n",
- "#Implementing a Rotate Function\n",
"\n",
- "#Function to perform rotation\n",
"def rotate(value,n):\n",
"\n",
" #Calculation\n",
@@ -215,9 +199,7 @@
" return result\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
- "#Variable Declaration\n",
" w1=0xabcdef00\n",
" w2=0xffff1122\n",
"\n",
@@ -229,7 +211,6 @@
" print(\"%x\"%rotate(w1,44))\n",
" \n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
diff --git a/Programming_in_C/Chapter_13.ipynb b/Programming_in_C/Chapter_13.ipynb
index 0ccf61c4..6d75e6fa 100644
--- a/Programming_in_C/Chapter_13.ipynb
+++ b/Programming_in_C/Chapter_13.ipynb
@@ -27,17 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#13.1.py\n",
- "#defining constants\n",
"\n",
- "#Variable Decarations\n",
"global YES\n",
"global NO\n",
"YES=1\n",
"NO=0\n",
"\n",
"\n",
- "#Function to check if a number is even or odd\n",
"def isEven(number):\n",
" global YES\n",
" global NO\n",
@@ -49,7 +45,6 @@
"\n",
" return answer\n",
"\n",
- "#Main()\n",
"def main():\n",
" global YES\n",
" global NO\n",
@@ -67,7 +62,6 @@
" print(\"NO\")\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -97,36 +91,29 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#13.2.py\n",
- "#Working more with constants\n",
"\n",
"global PI\n",
"PI= 3.141592654\n",
"\n",
"\n",
- "#Function to calculate area\n",
"def area(r):\n",
" global PI\n",
" return (PI*r*r)\n",
"\n",
- "#Function to calculate circumference\n",
"def circumference(r):\n",
" global PI\n",
" return (2*PI*r)\n",
"\n",
- "#Function to calculate volume\n",
"def volume(r):\n",
" global PI\n",
" return (1.33 * PI*r*r*r)\n",
" \n",
"\n",
- "#Main()\n",
"def main():\n",
" print(\"radius=1 {0:5} {1:5} {2:5}\".format(area(1),circumference(1),volume(1)))\n",
" print(\"radius=4.98 {0:5} {1:5} {2:5}\".format(area(4.98),circumference(4.98),volume(4.98)))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -156,14 +143,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#13.3.py\n",
- "#Defining global constants--advance\n",
"\n",
- "#Variable Declaration\n",
"global QUARTS_PER_LITER\n",
"QUARTS_PER_LITER=1.05687\n",
"\n",
- "#Main()\n",
"def main():\n",
" global QUARTS_PER_LITER #Global Reference\n",
"\n",
@@ -175,7 +158,6 @@
"\n",
" print(\"{0} Liters = {1} gallons\".format(liters,gallons))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
diff --git a/Programming_in_C/Chapter_14.ipynb b/Programming_in_C/Chapter_14.ipynb
index 4b34f1d0..d67dd4c7 100644
--- a/Programming_in_C/Chapter_14.ipynb
+++ b/Programming_in_C/Chapter_14.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#14.1.py\n",
- "#Using Enumerated Data Type\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Declaring an Enumerator \n",
@@ -67,7 +64,6 @@
" print(\"...or 29 if it's a leap year\")\n",
"\n",
"\n",
- "#Top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
diff --git a/Programming_in_C/Chapter_16.ipynb b/Programming_in_C/Chapter_16.ipynb
index f6d06ea2..2b519af8 100644
--- a/Programming_in_C/Chapter_16.ipynb
+++ b/Programming_in_C/Chapter_16.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#16.1.py\n",
- "#Illustrating print function\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -89,7 +86,6 @@
" print(\"c1 = %i, c2 = %i\\n\"%(4, 12))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()\n",
"\n"
@@ -155,13 +151,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#16.2.py\n",
- "#Copying Characters from Standard Input to Standard Output\n",
"\n",
- "#Import system library\n",
"import sys\n",
"\n",
- "#Main()\n",
"def main():\n",
" \n",
" while (True):\n",
@@ -174,7 +166,6 @@
" sys.exit()\n",
" \n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()\n",
"\n"
@@ -220,10 +211,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#16.3.py\n",
- "#Program to copy one file to another\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration/ User Input\n",
@@ -236,14 +224,12 @@
" #outName=raw_input()\n",
"\n",
" \n",
- "#Try to open a file for reading\n",
" try:\n",
" inn=open(inName,\"r\") \n",
" except:# Exception:\n",
" print(\"cant open {0} for reading\".format(inName))\n",
" sys.exit()\n",
"\n",
- "#try to open a file for writing\n",
" try:\n",
" out=open(outName,\"w\") \n",
" except:# Exception:\n",
@@ -253,13 +239,11 @@
" string=inn.read() #Read content from File-1\n",
" out.write(string) #Write content to File-2\n",
"\n",
- "#Close Files\n",
" inn.close()\n",
" out.close()\n",
"\n",
" print(\"File has been copied.\\n\");\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()\n",
"\n"
diff --git a/Programming_in_C/Chapter_17.ipynb b/Programming_in_C/Chapter_17.ipynb
index 192aef85..c854a59b 100644
--- a/Programming_in_C/Chapter_17.ipynb
+++ b/Programming_in_C/Chapter_17.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#17.1.py\n",
- "#File Copy Program Using Command-Line Arguments\n",
"\n",
- "#Import Libraries\n",
"import sys\n",
"\n",
"def main():\n",
@@ -40,7 +37,6 @@
" #print(\"need two file names!\")\n",
" #sys.exit()\n",
" \n",
- "#Read Command Line Arguments\n",
" inName=\"source.txt\" #str(sys.argv[1])\n",
" outName=\"target.txt\" #str(sys.argv[2])\n",
"\n",
@@ -51,7 +47,6 @@
" print(\"cant open {0} for reading\".format(inName))\n",
" sys.exit()\n",
"\n",
- "#try to open a file for writing\n",
" try:\n",
" out=open(outName,\"w\") \n",
" except:# Exception:\n",
@@ -61,7 +56,6 @@
" string=inn.read() #Read content from File-1\n",
" out.write(string) #Write content to File-2\n",
"\n",
- "#Close Files\n",
" inn.close()\n",
" out.close()\n",
"\n",
@@ -69,7 +63,6 @@
" print(\"File has been copied.\\n\");\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()\n",
"\n"
diff --git a/Programming_in_C/Chapter_18.ipynb b/Programming_in_C/Chapter_18.ipynb
index 675ba691..86358365 100644
--- a/Programming_in_C/Chapter_18.ipynb
+++ b/Programming_in_C/Chapter_18.ipynb
@@ -27,19 +27,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#18.1.py\n",
- "#Adding Debug statements in program\n",
"\n",
- "#Program logs will be saved in file- 18.1_logFile.txt\n",
"\n",
- "#Import library\n",
"import logging\n",
"\n",
- "#Function to return sum of 3 numbers\n",
"def process(i,j,k):\n",
" return i+j+k\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" logger = logging.getLogger()\n",
@@ -66,7 +60,6 @@
" print(\"sum= %i\\n\"%process(arr[0],arr[1],arr[2]))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()\n",
"\n"
@@ -112,15 +105,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#18.2.py\n",
- "#Compiling in Debug \n",
"\n",
- "#Program logs will be saved in file- 18.2_logFile.txt\n",
"\n",
- "#Import Libraries\n",
"import logging,sys\n",
"\n",
- "#Function to return product of two numbers\n",
"def process(i1,i2):\n",
"\n",
" global logger \n",
@@ -130,7 +118,6 @@
" return val\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" global logger\n",
@@ -173,7 +160,6 @@
" #print(\"product = %i\\n\" %( process (arg1, arg2)))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()\n",
"\n"
@@ -236,23 +222,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#18.3.py\n",
- "#Compiling in Debug--version2\n",
"\n",
- "#Program logs will be saved in file- 18.3_logFile.txt\n",
"\n",
- "#Using different logging levels\n",
- "#DEBUG Detailed information, typically of interest only when diagnosing problems.\n",
- "#INFO Confirmation that things are working as expected.\n",
- "#WARNING An indication of some problem in the near future (e.g.'disk space low')\n",
- "#ERROR Due to a more serious problem, the software has not been able to perform some function.\n",
- "#CRITICAL A serious error, indicating that the program itself may be unable to continue running.\n",
"\n",
"\n",
- "#Import Libraries\n",
"import logging,sys\n",
"\n",
- "#Function to return product of two numbers\n",
"def process(i1,i2):\n",
"\n",
" global logger \n",
@@ -262,7 +237,6 @@
" return val\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" global logger\n",
@@ -305,7 +279,6 @@
" #print(\"product = %i\\n\" %( process (arg1, arg2)))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()\n",
"\n"
@@ -368,10 +341,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#18.4.py\n",
- "#A simple program for use with pdb(gdb like python debugger)\n",
"\n",
- "#Main()\n",
"def main():\n",
" \n",
" #Variable Declaration\n",
@@ -386,7 +356,6 @@
" print(\"sum = %i\\n\"%(sum))\n",
" \n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()\n",
"\n"
@@ -417,10 +386,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#18.5.py\n",
- "#Working more with pdb\n",
"\n",
- "#Class Declaration\n",
"class date:\n",
" def __init__(self,m,d,y): #Class constructor\n",
" self.month=m\n",
@@ -431,7 +397,6 @@
" x.day+=1\n",
" return x\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -446,7 +411,6 @@
" print(\"today= %d/%d/%d\"%(today.day,today.month,today.year))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()\n",
"\n",
diff --git a/Programming_in_C/Chapter_19.ipynb b/Programming_in_C/Chapter_19.ipynb
index d92a3f41..731d6d87 100644
--- a/Programming_in_C/Chapter_19.ipynb
+++ b/Programming_in_C/Chapter_19.ipynb
@@ -27,16 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#19.1.py\n",
- "#Working with fractions in python\n",
"\n",
- "#Class declaration\n",
"class Fraction:\n",
" def __init__(self): #Class constructor\n",
" self.numerator=0\n",
" self.denominator=0\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Creating instance\n",
@@ -46,7 +42,6 @@
"\n",
" print(\"The Fraction is {0}/{1}\".format(myFract.numerator,myFract.denominator))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
diff --git a/Satellite_Communication/chapter_2.ipynb b/Satellite_Communication/chapter_2.ipynb
index 233fcb29..62e9c6de 100644
--- a/Satellite_Communication/chapter_2.ipynb
+++ b/Satellite_Communication/chapter_2.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''satellite velocity'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -68,7 +67,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''orbit parameters'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -122,7 +120,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Orbit parameters'''\n",
"#Variable Declaration\n",
"ma=42000.0 # Major axis distance in Km\n",
"P=8000.0 # Perigee distance in Km\n",
@@ -161,7 +158,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Orbit parameters'''\n",
"\n",
"#Variable Declaration\n",
"e=0.6 #Eccentricity\n",
@@ -204,7 +200,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Orbit Eccentricity'''\n",
"#Variable Declaration\n",
"AP_diff=30000.0 #difference between apogee and perigee in km\n",
"AP_sum=62800.0 #Apogee+perigee\n",
@@ -242,7 +237,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Velocity of satellite at particular point '''\n",
"import math\n",
"#Variable Declaration\n",
"R=7000.0*10**3 # sattelite orbit in m\n",
@@ -287,7 +281,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Velocity of satellite at particular point '''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -330,7 +323,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Velocity of satellite at particular point '''\n",
"import math\n",
"#Variable Declaration\n",
"R=25000.0*10**3 #sattelite orbit in m\n",
@@ -373,7 +365,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Orbital time period'''\n",
"import math\n",
"#Variable Declaration\n",
"a=(50000.0/2)*10**3 #Semi-major axis in m\n",
@@ -417,7 +408,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Orbital time period'''\n",
"#Variable Declaration\n",
"a1=18000.0*10**3 #Semi-major axis for first satellite in m\n",
"a2=24000.0*10**3 #Semi-major axis f0r 2nd satellite in m\n",
@@ -453,7 +443,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Orbit parameters'''\n",
"import math\n",
"#Variable Declaration\n",
"a=25000.0*10**3 #appogee distance in m\n",
@@ -533,7 +522,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Velocity at apogee'''\n",
"#Variable Declaration\n",
"A=42000.0 # Apogee in km\n",
"P=8000.0 # Perigee in km\n",
@@ -572,7 +560,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''velocity of satellite at particular point'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -614,7 +601,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''New apogee distance'''\n",
"import math\n",
"#Variable Declaration\n",
"A1=12000.0 # first Apogee distance\n",
@@ -658,7 +644,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''satellite velocity'''\n",
"import math\n",
"#Variable Declaration\n",
"vp=8.0 # horizontal velocity of satellite in km/s\n",
@@ -700,7 +685,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Apogee distance'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -750,7 +734,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Height of satellite orbit above eart surface'''\n",
"\n",
"import math\n",
"#variable declaration\n",
@@ -792,7 +775,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Orbital time period'''\n",
"import math\n",
"#variable declaration\n",
"\n",
diff --git a/Satellite_Communication/chapter_3.ipynb b/Satellite_Communication/chapter_3.ipynb
index 376a12af..e87eed02 100644
--- a/Satellite_Communication/chapter_3.ipynb
+++ b/Satellite_Communication/chapter_3.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Inclination angle'''\n",
"import math\n",
"#Variable Declaration\n",
"Az=85 # Azimuth angle of injection point\n",
@@ -68,7 +67,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Velocity thrust'''\n",
"import math\n",
"#Variable Declaration\n",
"delta_i=7 #orbital plane inclination\n",
@@ -107,7 +105,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''velocity thrust'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -152,7 +149,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Thrust velocity'''\n",
"import math\n",
"#Variable Declaration\n",
"A=15000*10**3 #Original apogee distance\n",
@@ -195,7 +191,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Thrust velocity'''\n",
"import math\n",
"#Variable Declaration\n",
"A=15000.0*10**3 # Original apogee distance\n",
@@ -237,7 +232,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Thrust velocity '''\n",
"#Variable Declaration\n",
"A=15000.0*10**3 # Original apogee distance\n",
"A1=16000.0*10**3 # Raised opogee distance\n",
@@ -279,7 +273,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Thrust velocity'''\n",
"import math\n",
"#Variable Declaration\n",
"R=6378.0*10**3 # Radius of earth\n",
@@ -325,7 +318,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Maximum line-of-sight distance'''\n",
"import math\n",
"#Variable Declaration\n",
"H=36000.0 # Height of geostationary satellite from the surface of earth\n",
@@ -368,7 +360,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "''' line-of-sight distance'''\n",
"import math\n",
"#Variable Declaration\n",
"H=36000.0 # Height of geostationary satellite from the surface of earth\n",
@@ -410,7 +401,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Inter-satellite distance'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -456,7 +446,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Azimuth and elevation angle'''\n",
"import math\n",
"\n",
"theta_l=30.0 # earth station's location 30\u00b0W longitude\n",
@@ -501,7 +490,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Time Delay'''\n",
"import math\n",
"#Variable Declaration\n",
"theta_l=60.0 #earth station's location 60\u00b0W longitude\n",
@@ -610,7 +598,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Inter-satellite distance'''\n",
"import math\n",
"#Variable Declaration\n",
"da=38000.0 # slant range of satellite A\n",
@@ -657,7 +644,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''covered surface area'''\n",
"import math\n",
"#Variable Declaration\n",
"r=42164.0 # orbital radius of the satellite in km\n",
@@ -726,7 +712,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Area swept by ground track of sattelite'''\n",
"#variable declaration\n",
"theta=30 #satellite inclination to the equitorial plan\n",
"#the extreme latitudes covered in northern and southern hemisphere are the same as orbit inclination\n",
diff --git a/Satellite_Communication/chapter_4.ipynb b/Satellite_Communication/chapter_4.ipynb
index 85428bc4..ea3132bc 100644
--- a/Satellite_Communication/chapter_4.ipynb
+++ b/Satellite_Communication/chapter_4.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Ejection velocity of the propellant mass'''\n",
"\n",
"#Variable Declaration\n",
"I=250 #specific impulse of a propellant\n",
@@ -66,7 +65,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Mass of propellant'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -108,7 +106,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Mass of propellant'''\n",
"#Variable Declaration\n",
"m=2950.0 #initial mass of the satellite\n",
"F=450.0 #required thrust\n",
@@ -149,7 +146,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''solar cells'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -197,7 +193,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Battery System Requirement'''\n",
"#Variable Declaration\n",
"p=3600.0 #Power required\n",
"t=1.2 #worst case eclipse period\n",
@@ -245,7 +240,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Antenna Gain'''\n",
"import math\n",
"#Variable Declaration\n",
"theta=0.5 #azimuth beam width=Elevation beam width\n",
@@ -293,7 +287,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Aperture efficiency and Effective Aperture'''\n",
"#Variable Declaration\n",
"la=0.5 #length efficiency in azimuth direction\n",
"le=0.7 #length efficiency in elevation direction \n",
@@ -333,7 +326,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Directivity'''\n",
"import math\n",
"#Variable Declaration\n",
"p=100 #Antenna power in W\n",
@@ -374,7 +366,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''null-to-null beam width'''\n",
"#Variable Declaration\n",
"beam_w=0.4 #antenna's 3dB beam width\n",
"Ae=5 #Effective Aperture of Antenna\n",
@@ -409,7 +400,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Polarization loss and Received signal strength'''\n",
"import math\n",
"#Variable Declaration\n",
"d=20.0 #received signal strenth in dB\n",
@@ -475,7 +465,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Antenna Gain and beam width'''\n",
"import math\n",
"#Variable Declaration\n",
"Ea=1 #effective aperture\n",
@@ -517,7 +506,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Beam Width'''\n",
"import math\n",
"#Variable Declaration\n",
"f=2.0 # reflector focal length\n",
@@ -562,7 +550,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''phase angles'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -605,7 +592,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Earth station EIRP'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
diff --git a/Satellite_Communication/chapter_5.ipynb b/Satellite_Communication/chapter_5.ipynb
index 4834f8d0..7e2ed39c 100644
--- a/Satellite_Communication/chapter_5.ipynb
+++ b/Satellite_Communication/chapter_5.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Power Saving'''\n",
"\n",
"import math\n",
"\n",
@@ -93,7 +92,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Total power in modulated signal'''\n",
"#Variable Declaration\n",
"pc=500 #energy of carrier signal\n",
"m=0.6 #AM modulation index\n",
@@ -142,7 +140,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Percentage power saving'''\n",
"import math\n",
"#Variable Declaration\n",
"m=0.6 #60% modulation\n",
@@ -185,7 +182,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Carrier frequency in terms of modulating frequency'''\n",
"#Variable Declaration\n",
"#multiplication of two signals gives AM with frequency component(wc-wm) and (wc+wm) and its BW is 2wm\n",
"bw=0.5/100 #bw is 0.5% of carrier freq. \n",
@@ -222,7 +218,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Unmodulated carrier frequency, modulation index, Modulating frequency'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -267,7 +262,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''frequency deviation and Bandwidth'''\n",
"#Variable Declaration\n",
"#comparing given equation with stanard equation\n",
"mf=150 #modulation index\n",
@@ -344,7 +338,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''New modulation index and New bandwidth'''\n",
"#Variable Declaration\n",
"bw=20*10**3 #bandwidth in Hz\n",
"fm=1* 10**3 #modulating frequency in Hz\n",
@@ -386,7 +379,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Deviation Ratio and Bandwidth'''\n",
"\n",
"#Variable Declaration\n",
"fd=75.0 #Maximum allowed frequency deviation in kHz\n",
@@ -426,7 +418,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''no of bits,no of quantizing levels and samplinf frequecy''' \n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -468,7 +459,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Nyquist rate'''\n",
"#Variable Declaration\n",
"#re-arranging equation and comparing it with standard equation we have,\n",
"f=2500 #Highest frequency component in the signal in Hz\n",
@@ -502,7 +492,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Time duration of one bit'''\n",
"import math\n",
"#Variable Declaration\n",
"l=128 #no of Quantizing levels\n",
@@ -542,7 +531,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Sampling rate and Sampling interval of the composite signal'''\n",
"f1=2.4 #first signal frequency\n",
"f2=3.2 #2nd signal frequency\n",
"f3=3.4 #3rd signal frequency\n",
@@ -580,7 +568,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Number of bits in each frame, Bit duration, micro second, Transmission rate'''\n",
"import math\n",
"\n",
"bw=3.2 # voice channel band limited frequency in kHz\n",
diff --git a/Satellite_Communication/chapter_6.ipynb b/Satellite_Communication/chapter_6.ipynb
index f4e3eeff..22f229fb 100644
--- a/Satellite_Communication/chapter_6.ipynb
+++ b/Satellite_Communication/chapter_6.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''length of reference and traffic burst'''\n",
"#Variable Declaration\n",
"t=20 #TDMA frame length in ms\n",
"lc=352 #length of carrier and clock recovery frequency in bits\n",
@@ -80,7 +79,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Frame efficiency'''\n",
"import math\n",
"#Variable Declaration\n",
"t=20 # TDMA frame length in ms\n",
@@ -131,7 +129,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Maximum no of PCM voice channels'''\n",
"import math\n",
"#Variable Declaration\n",
"t=20 # TDMA frame length in ms\n",
@@ -189,7 +186,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Doppler Shift'''\n",
"import math\n",
"#Variable Declaration\n",
"R=42150.0 # orbital radius of satellite\n",
@@ -245,7 +241,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Chip Duration and maximum chip rate'''\n",
"#Variable Declaration\n",
"de=40.0 # Doppler effect variation due to station-keeping errors in ns/s\n",
"d=280.0 # Sttelite round trip delay in ms\n",
@@ -285,7 +280,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''maximum permissible Dopler effect variation'''\n",
"#Variable Declaration \n",
"cr=25.0 #Chip rate is 25 Mbps\n",
"c=20.0/100.0 # DS-CDMA signals should not exceed 20% of the chip duration\n",
@@ -326,7 +320,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Processing gain'''\n",
"import math\n",
"#Variable Declaration\n",
"cr=20.0*10**6 #chip rate in Mbps\n",
diff --git a/Satellite_Communication/chapter_7.ipynb b/Satellite_Communication/chapter_7.ipynb
index f48f0b36..1ed28d5b 100644
--- a/Satellite_Communication/chapter_7.ipynb
+++ b/Satellite_Communication/chapter_7.ipynb
@@ -27,7 +27,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Power received by the receiving antenna '''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -68,7 +67,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''free-space path loss'''\n",
"import math\n",
"#Variable Declaration\n",
"c=3*10**8 #speed of light \n",
@@ -124,7 +122,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Attenuation experienced by coplanar component'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -177,7 +174,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Effective noise temperature and System Noise Figure'''\n",
"#Variable Declaration\n",
"g1=30 #gain of RF stage in dB\n",
"t1=20 #Noise temperature in K\n",
@@ -226,7 +222,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''overall noise figure'''\n",
"#Variable Declaration\n",
"g1=30 #gain of RF stage in dB\n",
"t1=20 #Noise temperature in K\n",
@@ -281,7 +276,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Noise figure'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -341,7 +335,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Loss factor'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -382,7 +375,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''System noise temperature'''\n",
"import math\n",
"\n",
"\n",
@@ -436,7 +428,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''carrier-to-interface ratio'''\n",
"import math\n",
"\n",
"\n",
@@ -480,7 +471,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''carrier-to-interference ratio'''\n",
"import math\n",
"\n",
"\n",
@@ -527,7 +517,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Total carrier-to-interference ratio'''\n",
"import math\n",
"\n",
"\n",
@@ -572,7 +561,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Longitudinal separation between two satellites'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -615,7 +603,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Gain per degree Kelvin'''\n",
"import math\n",
"\n",
"\n",
@@ -665,7 +652,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''Gain per degree Kelvin'''\n",
"import math\n",
"\n",
"#Variable Declaration\n",
@@ -705,7 +691,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''link margin'''\n",
"import math\n",
"#Variable Declaration\n",
"f=6.0*10**9 # uplink frequency\n",
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch1.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch1.ipynb
index f6589ebe..7b82a76b 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch1.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch1"
+ "name": "",
+ "signature": "sha256:4e45f4199722574c1e72ad7420d88b009a90aed0de40180b69c61cfde130a1dd"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,20 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "\"\"\"\nExample 1.1\n\"\"\"\nprint \"Hello, World!\\n\"\n",
+ "input": [
+ "\n",
+ "print \"Hello, World!\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n\n"
+ "text": [
+ "Hello, World!\n",
+ "\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +32,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 1.2\nprints 'hello world' with comments.\n'''\n\n# prints \"Hello, World!\":\nprint \"Hello, World!\\n\"",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Hello, World!\\n\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n\n"
+ "text": [
+ "Hello, World!\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -40,14 +54,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 1.3\nanother version of hello world.\n'''\n\n# prints \"Hello, World!\":\nprint \"Hel\" + \"lo, Wo\" + \"rld!\" \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"Hello, World!\":\n",
+ "print \"Hel\" + \"lo, Wo\" + \"rld!\" \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n"
+ "text": [
+ "Hello, World!\n"
+ ]
}
],
"prompt_number": 3
@@ -55,14 +77,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "\"\"\"\nexample 1.4\nanother version of hello world.\n\"\"\"\n\n# prints \"Hello, World!\":\nprint \"Hello, W\" + 'o' + \"rld\" + '!' ",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"Hello, World!\":\n",
+ "print \"Hello, W\" + 'o' + \"rld\" + '!' "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n"
+ "text": [
+ "Hello, World!\n"
+ ]
}
],
"prompt_number": 4
@@ -70,14 +99,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.5 Inserting Numeric Literals into the Standard Output Stream\n'''\n\n# prints \"The Millennium ends Dec 31 2000.\":\nprint \"The Millennium ends Dec %d %d \" %(31,2000)",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"The Millennium ends Dec 31 2000.\":\n",
+ "print \"The Millennium ends Dec %d %d \" %(31,2000)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Millennium ends Dec 31 2000 \n"
+ "text": [
+ "The Millennium ends Dec 31 2000 \n"
+ ]
}
],
"prompt_number": 5
@@ -85,14 +121,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.6 Using Integer Variables\nIn this example, the integer 44 is assigned to the variable m, and the value of the expression m + 33\nis assigned to the variable n:\n'''\n# prints \"m = 44 and n = 77\":\n\nm = 44 # assigns the value 44 to the variable m\nprint \"m = %d \" % m,\nn = m + 33 # assigns the value 77 to the variable n\nprint \"and n = %d \" % n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"m = 44 and n = 77\":\n",
+ "\n",
+ "m = 44 # assigns the value 44 to the variable m\n",
+ "print \"m = %d \" % m,\n",
+ "n = m + 33 # assigns the value 77 to the variable n\n",
+ "print \"and n = %d \" % n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 44 and n = 77 \n"
+ "text": [
+ "m = 44 and n = 77 \n"
+ ]
}
],
"prompt_number": 6
@@ -100,14 +147,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.7 A Program's Tokens\n'''\n\n# prints \"n = 44:\nn=44\nprint \"n = %d\" % n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"n = 44:\n",
+ "n=44\n",
+ "print \"n = %d\" % n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n"
+ "text": [
+ "n = 44\n"
+ ]
}
],
"prompt_number": 7
@@ -115,14 +170,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.8 \n'''\n\n# Python does not have semicolons so wont give any errors.\nn=44\nprint \"n = %d\" % n ",
+ "input": [
+ "\n",
+ "\n",
+ "# Python does not have semicolons so wont give any errors.\n",
+ "n=44\n",
+ "print \"n = %d\" % n "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n"
+ "text": [
+ "n = 44\n"
+ ]
}
],
"prompt_number": 8
@@ -130,14 +193,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.9 Initializing Variables\nThis program contains one variable that is not initialized and one that is initialized.\nNote : This program would give you differ output then c gives.\n'''\n\n# prints \"m = ?? and n = 44\":\nm = 0 #In python we do not have declaration of variables, we just initialize it and use it.\nn=44\nprint \"m = %d and n = %d\" %(m,n)",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"m = ?? and n = 44\":\n",
+ "m = 0 #In python we do not have declaration of variables, we just initialize it and use it.\n",
+ "n=44\n",
+ "print \"m = %d and n = %d\" %(m,n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 0 and n = 44\n"
+ "text": [
+ "m = 0 and n = 44\n"
+ ]
}
],
"prompt_number": 9
@@ -145,7 +217,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.10 The const Specifier\nThis program illustrates constant definitions:\n'''\n\n# defines constants; has no output:\nBEEP = '\\b'\nMAXINT = 2147483647\nN = MAXINT/2\nKM_PER_MI = 1.60934\nPI = 3.14159265358979323846\n",
+ "input": [
+ "\n",
+ "# defines constants; has no output:\n",
+ "BEEP = '\\b'\n",
+ "MAXINT = 2147483647\n",
+ "N = MAXINT/2\n",
+ "KM_PER_MI = 1.60934\n",
+ "PI = 3.14159265358979323846\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -154,83 +234,132 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.11 Using the Input Operator\n'''\n\n# tests the input of integers, floats, and characters:\nprint \"Enter two integers: \"\nm = int(raw_input())\nn = int(raw_input())\nprint \"m = %d , n = %d \" %(m,n)\n\nprint \"Enter three decimal numbers: \"\nx = float(raw_input())\ny = float(raw_input())\nz = float(raw_input())\n\nprint \"x = %f , y = %f , z = %f\" %(x,y,z)\n\nprint \"Enter four characters: \";\nc1 = raw_input()\nc2 = raw_input()\nc3 = raw_input()\nc4 = raw_input()\nprint \"c1 = \" + c1 + \", c2 = \" + c2 + \", c3 = \" + c3 + \", c4 = \" + c4 ",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter two integers: \"\n",
+ "m = int(raw_input())\n",
+ "n = int(raw_input())\n",
+ "print \"m = %d , n = %d \" %(m,n)\n",
+ "\n",
+ "print \"Enter three decimal numbers: \"\n",
+ "x = float(raw_input())\n",
+ "y = float(raw_input())\n",
+ "z = float(raw_input())\n",
+ "\n",
+ "print \"x = %f , y = %f , z = %f\" %(x,y,z)\n",
+ "\n",
+ "print \"Enter four characters: \";\n",
+ "c1 = raw_input()\n",
+ "c2 = raw_input()\n",
+ "c3 = raw_input()\n",
+ "c4 = raw_input()\n",
+ "print \"c1 = \" + c1 + \", c2 = \" + c2 + \", c3 = \" + c3 + \", c4 = \" + c4 "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "22\n"
+ "text": [
+ "22\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 22 , n = 44 \nEnter three decimal numbers: \n"
+ "text": [
+ "m = 22 , n = 44 \n",
+ "Enter three decimal numbers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2.2\n"
+ "text": [
+ "2.2\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4.4\n"
+ "text": [
+ "4.4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "6.6\n"
+ "text": [
+ "6.6\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 2.200000 , y = 4.400000 , z = 6.600000\nEnter four characters: \n"
+ "text": [
+ "x = 2.200000 , y = 4.400000 , z = 6.600000\n",
+ "Enter four characters: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "A\n"
+ "text": [
+ "A\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "B\n"
+ "text": [
+ "B\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "C\n"
+ "text": [
+ "C\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "D\n"
+ "text": [
+ "D\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "c1 = A, c2 = B, c3 = C, c4 = D\n"
+ "text": [
+ "c1 = A, c2 = B, c3 = C, c4 = D\n"
+ ]
}
],
"prompt_number": 11
@@ -238,7 +367,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch10.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch10.ipynb
index 4b6ac8a8..febb60a4 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch10.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch10"
+ "name": "",
+ "signature": "sha256:bbd6687393c06a730c7f5060250758a1f9af1de5ce96291cc9b90cec582f1aa5"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.1 Implementing the Ratio Class\n'''\nclass Ratio:\n def __init__(self):\n self.num = 0\n self.den = 0\n def assign(self,n,d):\n self.num = n\n self.den = d\n def convert(self):\n return float(self.num)/self.den\n def invert(self):\n self.num,self.den = self.den,self.num\n def print_(self):\n print self.num , '/' , self.den ,\n \nx = Ratio()\nx.assign(22,7)\nprint \"x = \",\nx.print_()\nprint \" = \" , x.convert() \nx.invert()\nprint \"1/x = \",\nx.print_()\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self):\n",
+ " self.num = 0\n",
+ " self.den = 0\n",
+ " def assign(self,n,d):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def convert(self):\n",
+ " return float(self.num)/self.den\n",
+ " def invert(self):\n",
+ " self.num,self.den = self.den,self.num\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ " \n",
+ "x = Ratio()\n",
+ "x.assign(22,7)\n",
+ "print \"x = \",\n",
+ "x.print_()\n",
+ "print \" = \" , x.convert() \n",
+ "x.invert()\n",
+ "print \"1/x = \",\n",
+ "x.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 22 / 7 = 3.14285714286\n1/x = 7 / 22\n"
+ "text": [
+ "x = 22 / 7 = 3.14285714286\n",
+ "1/x = 7 / 22\n"
+ ]
}
],
"prompt_number": 1
@@ -25,7 +53,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.2 Class example\n'''\nclass Ratio:\n def __init__(self):\n self.num = 0\n self.den = 0\n def assign(self,n,d):\n self.num = n\n self.den = d\n def convert(self):\n return float(self.num)/self.den\n def invert(self):\n self.num,self.den = self.den,self.num\n def print_(self):\n print self.num , '/' , self.den ,\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self):\n",
+ " self.num = 0\n",
+ " self.den = 0\n",
+ " def assign(self,n,d):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def convert(self):\n",
+ " return float(self.num)/self.den\n",
+ " def invert(self):\n",
+ " self.num,self.den = self.den,self.num\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -34,14 +77,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.3\nA Constructor Function for the Ratio Class\n'''\nclass Ratio:\n def __init__(self,n,d):\n self.num = n\n self.den = d\n def print_(self):\n print self.num , '/' , self.den ,\n\nx = Ratio(-1,3)\ny = Ratio(22,7)\nprint \"x = \",\nx.print_()\nprint \" and y = \",\ny.print_()\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n,d):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ "x = Ratio(-1,3)\n",
+ "y = Ratio(22,7)\n",
+ "print \"x = \",\n",
+ "x.print_()\n",
+ "print \" and y = \",\n",
+ "y.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = -1 / 3 and y = 22 / 7\n"
+ "text": [
+ "x = -1 / 3 and y = 22 / 7\n"
+ ]
}
],
"prompt_number": 3
@@ -49,14 +109,43 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.4 Constructors to the Ratio Class\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n if n==None:\n self.num = 0\n self.den = 1\n elif d==None:\n self.num = n\n self.den = 1\n else:\n self.num = n\n self.den = d\n def print_(self):\n print self.num , '/' , self.den ,\n\nx = Ratio()\ny = Ratio(4)\nz = Ratio(22,7)\nprint \"x = \",\nx.print_()\nprint \"\\ny = \",\ny.print_()\nprint \"\\nz = \",\nz.print_()",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " if n==None:\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " elif d==None:\n",
+ " self.num = n\n",
+ " self.den = 1\n",
+ " else:\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ "x = Ratio()\n",
+ "y = Ratio(4)\n",
+ "z = Ratio(22,7)\n",
+ "print \"x = \",\n",
+ "x.print_()\n",
+ "print \"\\ny = \",\n",
+ "y.print_()\n",
+ "print \"\\nz = \",\n",
+ "z.print_()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 0 / 1 \ny = 4 / 1 \nz = 22 / 7\n"
+ "text": [
+ "x = 0 / 1 \n",
+ "y = 4 / 1 \n",
+ "z = 22 / 7\n"
+ ]
}
],
"prompt_number": 4
@@ -64,7 +153,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.5\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n if n==None:\n self.num = 0\n self.den = 1\n elif d==None:\n self.num = n\n self.den = 1\n else:\n self.num = n\n self.den = d\n def print_(self):\n print self.num , '/' , self.den ,\n\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " if n==None:\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " elif d==None:\n",
+ " self.num = n\n",
+ " self.den = 1\n",
+ " else:\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -73,7 +178,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.6 Using Default Parameter Values in the Ratio Class Constructor\n'''\n\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n def print_(self):\n print self.num , '/' , self.den ,\n\n\nx = Ratio()\ny = Ratio(4)\nz = Ratio(22,7)",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ "\n",
+ "x = Ratio()\n",
+ "y = Ratio(4)\n",
+ "z = Ratio(22,7)"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -82,14 +201,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.7 Access Functions in the Ratio Class\n'''\n\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n def numerator(self):\n return self.num\n def denominator(self):\n return self.den\n def print_(self):\n print self.num , '/' , self.den ,\n\n\nx = Ratio(22,7)\nprint x.numerator() , '/' , x.denominator() ",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def numerator(self):\n",
+ " return self.num\n",
+ " def denominator(self):\n",
+ " return self.den\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "print x.numerator() , '/' , x.denominator() "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "22 / 7\n"
+ "text": [
+ "22 / 7\n"
+ ]
}
],
"prompt_number": 7
@@ -97,14 +235,64 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.8\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def numerator(self):\n return self.num\n def denominator(self):\n return self.den\n def print_(self):\n print self.num , '/' , self.den ,\n\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(100,-360)\nx.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def numerator(self):\n",
+ " return self.num\n",
+ " def denominator(self):\n",
+ " return self.den\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(100,-360)\n",
+ "x.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "-5 / 18\n"
+ "text": [
+ "-5 / 18\n"
+ ]
}
],
"prompt_number": 8
@@ -112,14 +300,72 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.9 Adding a Copy Constructor to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\nclass Ratio:\n def __init__(self,n=0,d=None):\n if d == None:\n self.num = n.num\n self.den = n.den\n else: \n self.num = n\n self.den = d\n self.reduce()\n def numerator(self):\n return self.num\n def denominator(self):\n return self.den\n def print_(self):\n print self.num , '/' , self.den ,\n\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(100,360)\ny = Ratio(x)\nprint \"x = \",\nx.print_()\nprint \"y = \",\ny.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=None):\n",
+ " if d == None:\n",
+ " self.num = n.num\n",
+ " self.den = n.den\n",
+ " else: \n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def numerator(self):\n",
+ " return self.num\n",
+ " def denominator(self):\n",
+ " return self.den\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(100,360)\n",
+ "y = Ratio(x)\n",
+ "print \"x = \",\n",
+ "x.print_()\n",
+ "print \"y = \",\n",
+ "y.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 5 / 18 y = 5 / 18\n"
+ "text": [
+ "x = 5 / 18 y = 5 / 18\n"
+ ]
}
],
"prompt_number": 9
@@ -127,14 +373,74 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.10 Tracing Calls to the Copy Constructor\n'''\n'''\nEXAMPLE 10.9 Adding a Copy Constructor to the Ratio Class\n'''\n'''\nEXAMPLE 10.8\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\nclass Ratio:\n def __init__(self,n=0,d=None):\n if d == None:\n print \"COPY CONSTRUCTOR CALLED\"\n self.num = n.num\n self.den = n.den\n else: \n self.num = n\n self.den = d\n self.reduce()\n def numerator(self):\n return self.num\n def denominator(self):\n return self.den\n def print_(self):\n print self.num , '/' , self.den ,\n\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\ndef f(r):\n s = Ratio(r)\n\nx = Ratio(22,7)\ny = Ratio(x) #calls the copy constructor, copying x to y\nf(y)\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=None):\n",
+ " if d == None:\n",
+ " print \"COPY CONSTRUCTOR CALLED\"\n",
+ " self.num = n.num\n",
+ " self.den = n.den\n",
+ " else: \n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def numerator(self):\n",
+ " return self.num\n",
+ " def denominator(self):\n",
+ " return self.den\n",
+ " def print_(self):\n",
+ " print self.num , '/' , self.den ,\n",
+ "\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "def f(r):\n",
+ " s = Ratio(r)\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(x) #calls the copy constructor, copying x to y\n",
+ "f(y)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "COPY CONSTRUCTOR CALLED\nCOPY CONSTRUCTOR CALLED\n"
+ "text": [
+ "COPY CONSTRUCTOR CALLED\n",
+ "COPY CONSTRUCTOR CALLED\n"
+ ]
}
],
"prompt_number": 12
@@ -142,14 +448,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.11 Including a Destructor in the Ratio Class\nNote : Python objects die when program gets exit.\n'''\n\nclass Ratio:\n def __init__(self):\n print \"OBJECT IS BORN.\"\n def __del__(self):\n print \"OBJECT DIES.\"\n\nx = Ratio()\nprint \"Now x is alive.\"\nprint \"Now between blocks.\"\ny = Ratio()\nprint \"Now y is alive.\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self):\n",
+ " print \"OBJECT IS BORN.\"\n",
+ " def __del__(self):\n",
+ " print \"OBJECT DIES.\"\n",
+ "\n",
+ "x = Ratio()\n",
+ "print \"Now x is alive.\"\n",
+ "print \"Now between blocks.\"\n",
+ "y = Ratio()\n",
+ "print \"Now y is alive.\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "OBJECT IS BORN.\nNow x is alive.\nNow between blocks.\nOBJECT IS BORN.\nNow y is alive.\n"
+ "text": [
+ "OBJECT IS BORN.\n",
+ "Now x is alive.\n",
+ "Now between blocks.\n",
+ "OBJECT IS BORN.\n",
+ "Now y is alive.\n"
+ ]
}
],
"prompt_number": 13
@@ -157,14 +483,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.12\n'''\nclass X:\n def __init(self):\n data = 0\n\np = X()\np.data = 22\nprint \"p.data = \" , p.data , \" = \" , p.data\np.data = 44\nprint \" p.data = \" , p.data , \" = \" , p.data ",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def __init(self):\n",
+ " data = 0\n",
+ "\n",
+ "p = X()\n",
+ "p.data = 22\n",
+ "print \"p.data = \" , p.data , \" = \" , p.data\n",
+ "p.data = 44\n",
+ "print \" p.data = \" , p.data , \" = \" , p.data "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "p.data = 22 = 22\n p.data = 44 = 44\n"
+ "text": [
+ "p.data = 22 = 22\n",
+ " p.data = 44 = 44\n"
+ ]
}
],
"prompt_number": 14
@@ -172,7 +512,27 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.13 A Node Class for Linked Lists\n'''\nclass Node:\n def __init__(self,d,q=None):\n self.data = d\n self.next = q\n\nn = int(raw_input())\nq = Node(n)\nwhile True:\n n = int(raw_input())\n if n<=0:\n break\n p = Node(n, q)\n q = p\nk = p\nwhile k != None:\n print k.data , '->' , \n k = k.next\nprint '*'\n",
+ "input": [
+ "\n",
+ "class Node:\n",
+ " def __init__(self,d,q=None):\n",
+ " self.data = d\n",
+ " self.next = q\n",
+ "\n",
+ "n = int(raw_input())\n",
+ "q = Node(n)\n",
+ "while True:\n",
+ " n = int(raw_input())\n",
+ " if n<=0:\n",
+ " break\n",
+ " p = Node(n, q)\n",
+ " q = p\n",
+ "k = p\n",
+ "while k != None:\n",
+ " print k.data , '->' , \n",
+ " k = k.next\n",
+ "print '*'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -180,48 +540,64 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "22\n"
+ "text": [
+ "22\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "66\n"
+ "text": [
+ "66\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "77 -> 66 -> 55 -> 44 -> 33 -> 22 -> *\n"
+ "text": [
+ "77 -> 66 -> 55 -> 44 -> 33 -> 22 -> *\n"
+ ]
}
],
"prompt_number": 15
@@ -229,14 +605,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.14 \nPython does not support static data type.\nPython automatically handles local variable so we need not to delete it.\n'''\ncount = 0\nclass Widget:\n def __init__(self):\n global count\n count += 1\n \nw = Widget()\nx = Widget()\nprint \"Now there are \" , count , 'widgets'\nif True:\n w = Widget()\n x = Widget()\n y = Widget()\n z = Widget()\n print \"Now there are\" , count , 'widgets' \nprint \"Now there are \" , count , 'widgets'\ny = Widget()\nprint \"Now there are \" , count , 'widgets'\n",
+ "input": [
+ "\n",
+ "count = 0\n",
+ "class Widget:\n",
+ " def __init__(self):\n",
+ " global count\n",
+ " count += 1\n",
+ " \n",
+ "w = Widget()\n",
+ "x = Widget()\n",
+ "print \"Now there are \" , count , 'widgets'\n",
+ "if True:\n",
+ " w = Widget()\n",
+ " x = Widget()\n",
+ " y = Widget()\n",
+ " z = Widget()\n",
+ " print \"Now there are\" , count , 'widgets' \n",
+ "print \"Now there are \" , count , 'widgets'\n",
+ "y = Widget()\n",
+ "print \"Now there are \" , count , 'widgets'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "OBJECT DIES.\nNow there are 2 widgets\nOBJECT DIES.\nNow there are 6 widgets\nNow there are 6 widgets\nNow there are 7 widgets\n"
+ "text": [
+ "OBJECT DIES.\n",
+ "Now there are 2 widgets\n",
+ "OBJECT DIES.\n",
+ "Now there are 6 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 7 widgets\n"
+ ]
}
],
"prompt_number": 16
@@ -244,14 +647,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.15 \n'''\ncount = 0\nclass Widget:\n def __init__(self):\n global count\n count += 1\n def numWidgets(self):\n global count\n return count\n \nw = Widget()\nx = Widget()\nprint \"Now there are \" , w.numWidgets() , 'widgets'\nif True:\n w = Widget()\n x = Widget()\n y = Widget()\n z = Widget()\n print \"Now there are\" , w.numWidgets() , 'widgets' \nprint \"Now there are \" , w.numWidgets() , 'widgets'\ny = Widget()\nprint \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "input": [
+ "\n",
+ "count = 0\n",
+ "class Widget:\n",
+ " def __init__(self):\n",
+ " global count\n",
+ " count += 1\n",
+ " def numWidgets(self):\n",
+ " global count\n",
+ " return count\n",
+ " \n",
+ "w = Widget()\n",
+ "x = Widget()\n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "if True:\n",
+ " w = Widget()\n",
+ " x = Widget()\n",
+ " y = Widget()\n",
+ " z = Widget()\n",
+ " print \"Now there are\" , w.numWidgets() , 'widgets' \n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "y = Widget()\n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Now there are 2 widgets\nNow there are 6 widgets\nNow there are 6 widgets\nNow there are 7 widgets\n"
+ "text": [
+ "Now there are 2 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 7 widgets\n"
+ ]
}
],
"prompt_number": 17
@@ -259,14 +690,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 10.16\n'''\ncount = 0\nclass Widget:\n def __init__(self):\n global count\n count += 1\n def numWidgets(self):\n global count\n return count\n \nw = Widget()\nx = Widget()\nprint \"Now there are \" , w.numWidgets() , 'widgets'\nif True:\n w = Widget()\n x = Widget()\n y = Widget()\n z = Widget()\n print \"Now there are\" , w.numWidgets() , 'widgets' \nprint \"Now there are \" , w.numWidgets() , 'widgets'\ny = Widget()\nprint \"Now there are \" , w.numWidgets() , 'widgets'",
+ "input": [
+ "\n",
+ "count = 0\n",
+ "class Widget:\n",
+ " def __init__(self):\n",
+ " global count\n",
+ " count += 1\n",
+ " def numWidgets(self):\n",
+ " global count\n",
+ " return count\n",
+ " \n",
+ "w = Widget()\n",
+ "x = Widget()\n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "if True:\n",
+ " w = Widget()\n",
+ " x = Widget()\n",
+ " y = Widget()\n",
+ " z = Widget()\n",
+ " print \"Now there are\" , w.numWidgets() , 'widgets' \n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'\n",
+ "y = Widget()\n",
+ "print \"Now there are \" , w.numWidgets() , 'widgets'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Now there are 2 widgets\nNow there are 6 widgets\nNow there are 6 widgets\nNow there are 7 widgets\n"
+ "text": [
+ "Now there are 2 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 6 widgets\n",
+ "Now there are 7 widgets\n"
+ ]
}
],
"prompt_number": 18
@@ -274,7 +733,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch11.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch11.ipynb
index 3ddc5480..34fb61dc 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch11.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch11"
+ "name": "",
+ "signature": "sha256:bdd5f9e441ccb7e3a87f4d8c5492d0aa1d228caba299fc1b0c667abb12780a1e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,7 +11,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.1\nAdding an Assignment Operator to the Ratio Class\nHere is a class interface for the Ratio class, showing the default constructor, the copy constructor,\nand the assignment operator:\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n if d==None:\n self.num = n.num\n self.den = n.den\n elif n==None:\n self.num = 0\n self.den = 1\n else:\n self.num = n\n self.den = d\n \n def equals(self):\n return self # retuns calling object.",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " if d==None:\n",
+ " self.num = n.num\n",
+ " self.den = n.den\n",
+ " elif n==None:\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " else:\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " \n",
+ " def equals(self):\n",
+ " return self # retuns calling object."
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -19,7 +36,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.2 The Preferred Prototype for an Overloaded Assignment Operator\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n pass\n \n def equals(self):\n pass\n",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " pass\n",
+ " \n",
+ " def equals(self):\n",
+ " pass\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -28,7 +53,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.3 Implementation of the Assignment Operator for the Ratio Class\n'''\nclass Ratio:\n def __init__(self,n=None,d=None):\n if d==None:\n self.num = n.num\n self.den = n.den\n elif n==None:\n self.num = 0\n self.den = 1\n else:\n self.num = n\n self.den = d\n \n\nz = Ratio(22,7)\ny = z\nx = z\n\nx = Ratio(22,7)\ny = Ratio(x)\nz = x\nw = x",
+ "input": [
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " if d==None:\n",
+ " self.num = n.num\n",
+ " self.den = n.den\n",
+ " elif n==None:\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " else:\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " \n",
+ "\n",
+ "z = Ratio(22,7)\n",
+ "y = z\n",
+ "x = z\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(x)\n",
+ "z = x\n",
+ "w = x"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -37,7 +85,16 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.4\nmultiplication operator overload\n'''\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n def __mul__(self,y):\n pass\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def __mul__(self,y):\n",
+ " pass\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -46,14 +103,68 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.5 The Ratio Class with Assignment and Multiplication Operators\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\nx = Ratio(22,7)\ny = Ratio(-3,8)\nz = x\nz.print_()\nx = y*z\nx.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(-3,8)\n",
+ "z = x\n",
+ "z.print_()\n",
+ "x = y*z\n",
+ "x.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "22 / 7\n-33 / 28\n"
+ "text": [
+ "22 / 7\n",
+ "-33 / 28\n"
+ ]
}
],
"prompt_number": 5
@@ -61,7 +172,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.6 The Ratio Class with an Overloaded *= Operator\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\n\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n self.reduce()\n def __imul__(self,y):\n self.num = self.num * y.num\n self.den = self.den * y.den\n def print_(self):\n print self.num , '/', self.den",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __imul__(self,y):\n",
+ " self.num = self.num * y.num\n",
+ " self.den = self.den * y.den\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -70,7 +204,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.7 Overloading the Equality Operator == in the Ratio Class\n'''\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n self.reduce()\n def __imul__(self,y):\n self.num = self.num * y.num\n self.den = self.den * y.den\n def __eq__(self,y):\n return (x.num * y.den == y.num * x.den)\n def print_(self):\n print self.num , '/', self.den\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __imul__(self,y):\n",
+ " self.num = self.num * y.num\n",
+ " self.den = self.den * y.den\n",
+ " def __eq__(self,y):\n",
+ " return (x.num * y.den == y.num * x.den)\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -79,20 +229,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.8 \nPython does not use << operator for printing. So here we are just declaring function name as print_.\n'''\n\nclass Ratio:\n def __init__(self,n=None,d=None):\n self.num = n\n self.den = d\n def __imul__(self,y):\n self.num = self.num * y.num\n self.den = self.den * y.den\n def __eq__(self,y):\n return (x.num * y.den == y.num * x.den)\n def print_(self):\n print self.num , '/', self.den\n\n\nx = Ratio(22,7)\ny = Ratio(-3,8)\nx.print_() , y.print_()\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Ratio:\n",
+ " def __init__(self,n=None,d=None):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " def __imul__(self,y):\n",
+ " self.num = self.num * y.num\n",
+ " self.den = self.den * y.den\n",
+ " def __eq__(self,y):\n",
+ " return (x.num * y.den == y.num * x.den)\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ "\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(-3,8)\n",
+ "x.print_() , y.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "22 / 7\n-3 / 8\n"
+ "text": [
+ "22 / 7\n",
+ "-3 / 8\n"
+ ]
},
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
- "text": "(None, None)"
+ "text": [
+ "(None, None)"
+ ]
}
],
"prompt_number": 8
@@ -100,7 +274,62 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.9 \nPython does not have >> for input. so we will use input function.\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def input(self):\n self.num = int(raw_input('Numerator : '))\n self.den = int(raw_input('Denominator : '))\n self.reduce()\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\n\nx = Ratio()\ny = Ratio()\nx.input()\ny.input()\nx.print_()\ny.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def input(self):\n",
+ " self.num = int(raw_input('Numerator : '))\n",
+ " self.den = int(raw_input('Denominator : '))\n",
+ " self.reduce()\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "\n",
+ "x = Ratio()\n",
+ "y = Ratio()\n",
+ "x.input()\n",
+ "y.input()\n",
+ "x.print_()\n",
+ "y.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -108,30 +337,41 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Numerator : -10\n"
+ "text": [
+ "Numerator : -10\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Denominator : -24\n"
+ "text": [
+ "Denominator : -24\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Numerator : 36\n"
+ "text": [
+ "Numerator : 36\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Denominator : -20\n"
+ "text": [
+ "Denominator : -20\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "5 / 12\n-9 / 5\n"
+ "text": [
+ "5 / 12\n",
+ "-9 / 5\n"
+ ]
}
],
"prompt_number": 1
@@ -139,14 +379,78 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.10\nAdding a Conversion Operator to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def input(self):\n self.num = int(raw_input('Numerator : '))\n self.den = int(raw_input('Denominator : '))\n self.reduce()\n def __float__(self):\n return float(self.num)/self.den\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 15.py\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(-5,8)\nprint \"x = \" , \nx.print_() \nprint \", float(x) = \" , float(x) \nP = Ratio(22,7)\nPI = float(P)\nprint \"P = \" ,\nP.print_() \nprint \", PI = \" , PI\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def input(self):\n",
+ " self.num = int(raw_input('Numerator : '))\n",
+ " self.den = int(raw_input('Denominator : '))\n",
+ " self.reduce()\n",
+ " def __float__(self):\n",
+ " return float(self.num)/self.den\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 15.py\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(-5,8)\n",
+ "print \"x = \" , \n",
+ "x.print_() \n",
+ "print \", float(x) = \" , float(x) \n",
+ "P = Ratio(22,7)\n",
+ "PI = float(P)\n",
+ "print \"P = \" ,\n",
+ "P.print_() \n",
+ "print \", PI = \" , PI\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = -5 / 8\n, float(x) = -0.625\nP = 22 / 7\n, PI = 3.14285714286\n"
+ "text": [
+ "x = -5 / 8\n",
+ ", float(x) = -0.625\n",
+ "P = 22 / 7\n",
+ ", PI = 3.14285714286\n"
+ ]
}
],
"prompt_number": 3
@@ -154,14 +458,71 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.11 Adding a Pre-Increment Operator to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def __iadd__(self,n):\n self.num += self.den\n return self\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(22,7)\nx += 1\ny = x\nprint \"y = \" ,\ny.print_()\nprint \", x = \",\nx.print_()\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def __iadd__(self,n):\n",
+ " self.num += self.den\n",
+ " return self\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "x += 1\n",
+ "y = x\n",
+ "print \"y = \" ,\n",
+ "y.print_()\n",
+ "print \", x = \",\n",
+ "x.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "y = 29 / 7\n, x = 29 / 7\n"
+ "text": [
+ "y = 29 / 7\n",
+ ", x = 29 / 7\n"
+ ]
}
],
"prompt_number": 5
@@ -169,14 +530,72 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.12 Adding a Post-Increment Operator to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def __iadd__(self,n):\n self.num += self.den\n return self\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(22,7)\ny = Ratio(x.num,x.den)\nx += 1\nprint \"y = \" ,\ny.print_()\nprint \", x = \",\nx.print_()\n\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def __iadd__(self,n):\n",
+ " self.num += self.den\n",
+ " return self\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "y = Ratio(x.num,x.den)\n",
+ "x += 1\n",
+ "print \"y = \" ,\n",
+ "y.print_()\n",
+ "print \", x = \",\n",
+ "x.print_()\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "y = 22 / 7\n, x = 29 / 7\n"
+ "text": [
+ "y = 22 / 7\n",
+ ", x = 29 / 7\n"
+ ]
}
],
"prompt_number": 9
@@ -184,14 +603,70 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 11.13\nAdding a Subscript Operator to the Ratio Class\n'''\ndef gcd(m,n):\n # returns the greatest common divisor of m and n:\n if (m<n):\n m,n = n,m\n while (n>0):\n r = m % n\n m = n\n n = r\n return m\nclass Ratio:\n def __init__(self,n=0,d=1):\n self.num = n\n self.den = d\n self.reduce()\n def __mul__(self,y):\n z = Ratio(self.num * y.num, self.den * y.den)\n return z\n def print_(self):\n print self.num , '/', self.den\n \n def __getitem__(self,k):\n if k == 1:\n return self.num\n else:\n return self.den\n def reduce(self):\n # enforce invariant(den > 0):\n if (self.num == 0 or self.den == 0):\n self.num = 0\n self.den = 1\n return\n if (self.den < 0):\n self.den *= -1\n self.num *= -1\n # enforce invariant(gcd(num,den) == 1):\n if (self.den == 1):\n return\n # it's already reduced\n sgn = 0\n if self.num < 0:\n sgn = -1\n else:\n sgn = 1\n g = gcd(sgn*self.num,self.den)\n self.num /= g\n self.den /= g\n\nx = Ratio(22,7)\nprint \"x = \" ,\nx.print_()\nprint \"x[1] = \" , x[1] , \", x[2] = \" , x[2]\n",
+ "input": [
+ "\n",
+ "def gcd(m,n):\n",
+ " # returns the greatest common divisor of m and n:\n",
+ " if (m<n):\n",
+ " m,n = n,m\n",
+ " while (n>0):\n",
+ " r = m % n\n",
+ " m = n\n",
+ " n = r\n",
+ " return m\n",
+ "class Ratio:\n",
+ " def __init__(self,n=0,d=1):\n",
+ " self.num = n\n",
+ " self.den = d\n",
+ " self.reduce()\n",
+ " def __mul__(self,y):\n",
+ " z = Ratio(self.num * y.num, self.den * y.den)\n",
+ " return z\n",
+ " def print_(self):\n",
+ " print self.num , '/', self.den\n",
+ " \n",
+ " def __getitem__(self,k):\n",
+ " if k == 1:\n",
+ " return self.num\n",
+ " else:\n",
+ " return self.den\n",
+ " def reduce(self):\n",
+ " # enforce invariant(den > 0):\n",
+ " if (self.num == 0 or self.den == 0):\n",
+ " self.num = 0\n",
+ " self.den = 1\n",
+ " return\n",
+ " if (self.den < 0):\n",
+ " self.den *= -1\n",
+ " self.num *= -1\n",
+ " # enforce invariant(gcd(num,den) == 1):\n",
+ " if (self.den == 1):\n",
+ " return\n",
+ " # it's already reduced\n",
+ " sgn = 0\n",
+ " if self.num < 0:\n",
+ " sgn = -1\n",
+ " else:\n",
+ " sgn = 1\n",
+ " g = gcd(sgn*self.num,self.den)\n",
+ " self.num /= g\n",
+ " self.den /= g\n",
+ "\n",
+ "x = Ratio(22,7)\n",
+ "print \"x = \" ,\n",
+ "x.print_()\n",
+ "print \"x[1] = \" , x[1] , \", x[2] = \" , x[2]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 22 / 7\nx[1] = 22 , x[2] = 7\n"
+ "text": [
+ "x = 22 / 7\n",
+ "x[1] = 22 , x[2] = 7\n"
+ ]
}
],
"prompt_number": 7
@@ -199,7 +674,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch12.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch12.ipynb
index 304a3ccb..b4d91452 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch12.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch12"
+ "name": "",
+ "signature": "sha256:a8f901e98281d94f022e9d5e31af5e6f41fcc09b6b14713debbc4198e50f2d3e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,35 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.1 A Person Class\nHere is a simple definition for a class to represent people.\n'''\nclass Person:\n def __init__(self,n=\"\",nat=\"U.S.A.\",s=1):\n self.name = n\n self.nationality = nat\n self.sex = s\n\n def printName(self):\n print self.name,\n \n def printNationality(self):\n print self.nationality,\n\ncreator = Person(\"Bjarne Stroustrup\", \"Denmark\")\nprint \"The creator of C++ was \" ,\ncreator.printName() \nprint \", who was born in \" ,\ncreator.printNationality() \n",
+ "input": [
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n=\"\",nat=\"U.S.A.\",s=1):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ "\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " \n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ "\n",
+ "creator = Person(\"Bjarne Stroustrup\", \"Denmark\")\n",
+ "print \"The creator of C++ was \" ,\n",
+ "creator.printName() \n",
+ "print \", who was born in \" ,\n",
+ "creator.printNationality() \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The creator of C++ was Bjarne Stroustrup , who was born in Denmark\n"
+ "text": [
+ "The creator of C++ was Bjarne Stroustrup , who was born in Denmark\n"
+ ]
}
],
"prompt_number": 1
@@ -25,37 +47,86 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.2 A Date Class\n'''\n\nclass Date:\n def __init__(self,m=0,d=0,y=0):\n self.month = m\n self.day = d\n self.year = y\n \n def setDate(self,m,d,y):\n self.month = m\n self.day = d\n self.year = y\n # Python doesn't have >> operator for input so we are just using input function\n def input(self):\n self.month = int(raw_input()) \n self.day = int(raw_input())\n self.year = int(raw_input()) \n \n # Python doesn't have << operator for output so we are just using print function\n def print_(self):\n monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n \"July\", \"August\",\"September\", \"October\", \"November\",\\\n \"December\"]\n print monthName[self.month] , self.day , \",\" , self.year\n\npeace = Date(11,11,1918)\nprint \"World War I ended on \" ,\npeace.print_()\npeace.setDate(8,14,1945)\nprint \"World War II ended on \" ,\npeace.print_()\nprint \"Enter month, day, and year: \"\ndate = Date()\ndate.input()\nprint \"The date is \" , \ndate.print_()\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Date:\n",
+ " def __init__(self,m=0,d=0,y=0):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " \n",
+ " def setDate(self,m,d,y):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " # Python doesn't have >> operator for input so we are just using input function\n",
+ " def input(self):\n",
+ " self.month = int(raw_input()) \n",
+ " self.day = int(raw_input())\n",
+ " self.year = int(raw_input()) \n",
+ " \n",
+ " # Python doesn't have << operator for output so we are just using print function\n",
+ " def print_(self):\n",
+ " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n",
+ " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n",
+ " \"December\"]\n",
+ " print monthName[self.month] , self.day , \",\" , self.year\n",
+ "\n",
+ "peace = Date(11,11,1918)\n",
+ "print \"World War I ended on \" ,\n",
+ "peace.print_()\n",
+ "peace.setDate(8,14,1945)\n",
+ "print \"World War II ended on \" ,\n",
+ "peace.print_()\n",
+ "print \"Enter month, day, and year: \"\n",
+ "date = Date()\n",
+ "date.input()\n",
+ "print \"The date is \" , \n",
+ "date.print_()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "World War I ended on November 11 , 1918\nWorld War II ended on August 14 , 1945\nEnter month, day, and year: \n"
+ "text": [
+ "World War I ended on November 11 , 1918\n",
+ "World War II ended on August 14 , 1945\n",
+ "Enter month, day, and year: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1976\n"
+ "text": [
+ "1976\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The date is July 4 , 1976\n"
+ "text": [
+ "The date is July 4 , 1976\n"
+ ]
}
],
"prompt_number": 2
@@ -63,14 +134,73 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.3 Composing the Date Class with the Person Class\n'''\nclass Date:\n def __init__(self,m=0,d=0,y=0):\n self.month = m\n self.day = d\n self.year = y\n \n def setDate(self,m,d,y):\n self.month = m\n self.day = d\n self.year = y\n # Python doesn't have >> operator for input so we are just using input function\n def input(self):\n self.month = int(raw_input()) \n self.day = int(raw_input())\n self.year = int(raw_input()) \n \n # Python doesn't have << operator for output so we are just using print function\n def print_(self):\n monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n \"July\", \"August\",\"September\", \"October\", \"November\",\\\n \"December\"]\n print monthName[self.month] , self.day , \",\" , self.year\n\nclass Person:\n def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n self.name = n\n self.nationality = nat\n self.sex = s\n self.dob = Date()\n self.dod = Date()\n def setDOB(self,m,d,y):\n self.dob.setDate(m,d,y)\n def setDOD(self,m,d,y):\n self.dod.setDate(m,d,y)\n def printName(self):\n print self.name,\n def printNationality(self):\n print self.nationality,\n def printDOB(self):\n self.dob.print_()\n def printDOD(self):\n self.dod.print_()\n\nauthor = Person(\"Thomas Jefferson\", 1)\nauthor.setDOB(4,13,1743)\nauthor.setDOD(7,4,1826)\nprint \"The author of the Declaration of Independence was \",\nauthor.printName()\nprint \".\\nHe was born on \",\nauthor.printDOB()\nprint \" and died on \",\nauthor.printDOD()\n\n",
+ "input": [
+ "\n",
+ "class Date:\n",
+ " def __init__(self,m=0,d=0,y=0):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " \n",
+ " def setDate(self,m,d,y):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " # Python doesn't have >> operator for input so we are just using input function\n",
+ " def input(self):\n",
+ " self.month = int(raw_input()) \n",
+ " self.day = int(raw_input())\n",
+ " self.year = int(raw_input()) \n",
+ " \n",
+ " # Python doesn't have << operator for output so we are just using print function\n",
+ " def print_(self):\n",
+ " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n",
+ " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n",
+ " \"December\"]\n",
+ " print monthName[self.month] , self.day , \",\" , self.year\n",
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ " self.dob = Date()\n",
+ " self.dod = Date()\n",
+ " def setDOB(self,m,d,y):\n",
+ " self.dob.setDate(m,d,y)\n",
+ " def setDOD(self,m,d,y):\n",
+ " self.dod.setDate(m,d,y)\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ " def printDOB(self):\n",
+ " self.dob.print_()\n",
+ " def printDOD(self):\n",
+ " self.dod.print_()\n",
+ "\n",
+ "author = Person(\"Thomas Jefferson\", 1)\n",
+ "author.setDOB(4,13,1743)\n",
+ "author.setDOD(7,4,1826)\n",
+ "print \"The author of the Declaration of Independence was \",\n",
+ "author.printName()\n",
+ "print \".\\nHe was born on \",\n",
+ "author.printDOB()\n",
+ "print \" and died on \",\n",
+ "author.printDOD()\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The author of the Declaration of Independence was Thomas Jefferson .\nHe was born on April 13 , 1743\n and died on July 4 , 1826\n"
+ "text": [
+ "The author of the Declaration of Independence was Thomas Jefferson .\n",
+ "He was born on April 13 , 1743\n",
+ " and died on July 4 , 1826\n"
+ ]
}
],
"prompt_number": 3
@@ -78,14 +208,85 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.4 Deriving a Student Class from the Person Class\nStudents are people. So it is natural to use the Person class to derive a Student class\n'''\nclass Date:\n def __init__(self,m=0,d=0,y=0):\n self.month = m\n self.day = d\n self.year = y\n \n def setDate(self,m,d,y):\n self.month = m\n self.day = d\n self.year = y\n # Python doesn't have >> operator for input so we are just using input function\n def input(self):\n self.month = int(raw_input()) \n self.day = int(raw_input())\n self.year = int(raw_input()) \n \n # Python doesn't have << operator for output so we are just using print function\n def print_(self):\n monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n \"July\", \"August\",\"September\", \"October\", \"November\",\\\n \"December\"]\n print monthName[self.month] , self.day , \",\" , self.year\n\nclass Person:\n def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n self.name = n\n self.nationality = nat\n self.sex = s\n self.dob = Date()\n self.dod = Date()\n def setDOB(self,m,d,y):\n self.dob.setDate(m,d,y)\n def setDOD(self,m,d,y):\n self.dod.setDate(m,d,y)\n def printName(self):\n print self.name,\n def printNationality(self):\n print self.nationality,\n def printDOB(self):\n self.dob.print_()\n def printDOD(self):\n self.dod.print_()\n\nclass Student(Person):\n def __init__(self,n,s=0,i=\"\"):\n Person.__init__(self,n,s)\n self.id = i\n self.credits = 0\n self.gpa = 0\n self.dom = Date()\n\n def setDOM(self,m,d,y):\n self.dom.setDate(m, d, y)\n def printDOM(self):\n self.dom.print_()\n\nx = Student(\"Ann Jones\", 0, \"219360061\")\nx.setDOB(5, 13, 1977)\nx.setDOM(8, 29, 1995)\nx.printName()\nprint \"\\n\\t Born: \" ,\nx.printDOB()\nprint \"\\n\\tMatriculated: \",\nx.printDOM()\n",
+ "input": [
+ "\n",
+ "class Date:\n",
+ " def __init__(self,m=0,d=0,y=0):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " \n",
+ " def setDate(self,m,d,y):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " # Python doesn't have >> operator for input so we are just using input function\n",
+ " def input(self):\n",
+ " self.month = int(raw_input()) \n",
+ " self.day = int(raw_input())\n",
+ " self.year = int(raw_input()) \n",
+ " \n",
+ " # Python doesn't have << operator for output so we are just using print function\n",
+ " def print_(self):\n",
+ " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n",
+ " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n",
+ " \"December\"]\n",
+ " print monthName[self.month] , self.day , \",\" , self.year\n",
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ " self.dob = Date()\n",
+ " self.dod = Date()\n",
+ " def setDOB(self,m,d,y):\n",
+ " self.dob.setDate(m,d,y)\n",
+ " def setDOD(self,m,d,y):\n",
+ " self.dod.setDate(m,d,y)\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ " def printDOB(self):\n",
+ " self.dob.print_()\n",
+ " def printDOD(self):\n",
+ " self.dod.print_()\n",
+ "\n",
+ "class Student(Person):\n",
+ " def __init__(self,n,s=0,i=\"\"):\n",
+ " Person.__init__(self,n,s)\n",
+ " self.id = i\n",
+ " self.credits = 0\n",
+ " self.gpa = 0\n",
+ " self.dom = Date()\n",
+ "\n",
+ " def setDOM(self,m,d,y):\n",
+ " self.dom.setDate(m, d, y)\n",
+ " def printDOM(self):\n",
+ " self.dom.print_()\n",
+ "\n",
+ "x = Student(\"Ann Jones\", 0, \"219360061\")\n",
+ "x.setDOB(5, 13, 1977)\n",
+ "x.setDOM(8, 29, 1995)\n",
+ "x.printName()\n",
+ "print \"\\n\\t Born: \" ,\n",
+ "x.printDOB()\n",
+ "print \"\\n\\tMatriculated: \",\n",
+ "x.printDOM()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Ann Jones \n\t Born: May 13 , 1977\n\n\tMatriculated: August 29 , 1995\n"
+ "text": [
+ "Ann Jones \n",
+ "\t Born: May 13 , 1977\n",
+ "\n",
+ "\tMatriculated: August 29 , 1995\n"
+ ]
}
],
"prompt_number": 4
@@ -93,14 +294,95 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.5 The Person Class\n'''\nclass Date:\n def __init__(self,m=0,d=0,y=0):\n self.month = m\n self.day = d\n self.year = y\n \n def setDate(self,m,d,y):\n self.month = m\n self.day = d\n self.year = y\n # Python doesn't have >> operator for input so we are just using input function\n def input(self):\n self.month = int(raw_input()) \n self.day = int(raw_input())\n self.year = int(raw_input()) \n \n # Python doesn't have << operator for output so we are just using print function\n def print_(self):\n monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n \"July\", \"August\",\"September\", \"October\", \"November\",\\\n \"December\"]\n print monthName[self.month] , self.day , \",\" , self.year\n\nclass Person:\n def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n self.name = n\n self.nationality = nat\n self.sex = s\n self.dob = Date()\n self.dod = Date()\n def setDOB(self,m,d,y):\n self.dob.setDate(m,d,y)\n def setDOD(self,m,d,y):\n self.dod.setDate(m,d,y)\n def printName(self):\n print self.name,\n def printNationality(self):\n print self.nationality,\n def printDOB(self):\n self.dob.print_()\n def printDOD(self):\n self.dod.print_()\n\nclass Student(Person):\n def __init__(self,n,s=0,i=\"\"):\n Person.__init__(self,n,s)\n self.id = i\n self.credits = 0\n self.gpa = 0\n self.dom = Date()\n\n def setDOM(self,m,d,y):\n self.dom.setDate(m, d, y)\n def printDOM(self):\n self.dom.print_()\n def printSex(self):\n if self.sex == 1:\n print \"male\"\n else:\n print 'female'\n\nx = Student(\"Ann Jones\", 0, \"219360061\")\nx.setDOB(5, 13, 1977)\nx.setDOM(8, 29, 1995)\nx.setDOD(7,4,1826)\nx.printName()\nprint \"\\n\\t Born: \" , \nx.printDOB()\nprint \"\\n\\t Sex: \" ,\nx.printSex()\nprint \"\\n\\tMatriculated: \",\nx.printDOM()\n",
+ "input": [
+ "\n",
+ "class Date:\n",
+ " def __init__(self,m=0,d=0,y=0):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " \n",
+ " def setDate(self,m,d,y):\n",
+ " self.month = m\n",
+ " self.day = d\n",
+ " self.year = y\n",
+ " # Python doesn't have >> operator for input so we are just using input function\n",
+ " def input(self):\n",
+ " self.month = int(raw_input()) \n",
+ " self.day = int(raw_input())\n",
+ " self.year = int(raw_input()) \n",
+ " \n",
+ " # Python doesn't have << operator for output so we are just using print function\n",
+ " def print_(self):\n",
+ " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n",
+ " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n",
+ " \"December\"]\n",
+ " print monthName[self.month] , self.day , \",\" , self.year\n",
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ " self.dob = Date()\n",
+ " self.dod = Date()\n",
+ " def setDOB(self,m,d,y):\n",
+ " self.dob.setDate(m,d,y)\n",
+ " def setDOD(self,m,d,y):\n",
+ " self.dod.setDate(m,d,y)\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ " def printDOB(self):\n",
+ " self.dob.print_()\n",
+ " def printDOD(self):\n",
+ " self.dod.print_()\n",
+ "\n",
+ "class Student(Person):\n",
+ " def __init__(self,n,s=0,i=\"\"):\n",
+ " Person.__init__(self,n,s)\n",
+ " self.id = i\n",
+ " self.credits = 0\n",
+ " self.gpa = 0\n",
+ " self.dom = Date()\n",
+ "\n",
+ " def setDOM(self,m,d,y):\n",
+ " self.dom.setDate(m, d, y)\n",
+ " def printDOM(self):\n",
+ " self.dom.print_()\n",
+ " def printSex(self):\n",
+ " if self.sex == 1:\n",
+ " print \"male\"\n",
+ " else:\n",
+ " print 'female'\n",
+ "\n",
+ "x = Student(\"Ann Jones\", 0, \"219360061\")\n",
+ "x.setDOB(5, 13, 1977)\n",
+ "x.setDOM(8, 29, 1995)\n",
+ "x.setDOD(7,4,1826)\n",
+ "x.printName()\n",
+ "print \"\\n\\t Born: \" , \n",
+ "x.printDOB()\n",
+ "print \"\\n\\t Sex: \" ,\n",
+ "x.printSex()\n",
+ "print \"\\n\\tMatriculated: \",\n",
+ "x.printDOM()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Ann Jones \n\t Born: May 13 , 1977\n\n\t Sex: female\n\n\tMatriculated: August 29 , 1995\n"
+ "text": [
+ "Ann Jones \n",
+ "\t Born: May 13 , 1977\n",
+ "\n",
+ "\t Sex: female\n",
+ "\n",
+ "\tMatriculated: August 29 , 1995\n"
+ ]
}
],
"prompt_number": 5
@@ -108,14 +390,51 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.6 Dominating a Data Member and Overriding a Member Function\nHere are two classes, X and Y, with Y inheriting from X.\n'''\nclass X:\n def __init__(self):\n self.a = 0\n def f(self):\n print \"X::f() executing\"\nclass Y(X):\n def __init__(self):\n self.a = 0\n def f(self):\n print \"Y::f() executing\"\nx = X()\nx.a = 22\nx.f()\nprint \"x.a = \" , x.a\ny = Y()\ny.a = 44\n# assigns 44 to the a defined in Y\ny._X__a = 66\n# assigns 66 to the a defined in X\ny.f()\n# invokes the f() defined in Y\nX.f(x)\n# invokes the f() defined in X\nprint \"y.a = \" , y.a \nprint \"y._X__a = \" , y._X__a \nz = y\nprint \"z.a = \" , z._X__a \n",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def __init__(self):\n",
+ " self.a = 0\n",
+ " def f(self):\n",
+ " print \"X::f() executing\"\n",
+ "class Y(X):\n",
+ " def __init__(self):\n",
+ " self.a = 0\n",
+ " def f(self):\n",
+ " print \"Y::f() executing\"\n",
+ "x = X()\n",
+ "x.a = 22\n",
+ "x.f()\n",
+ "print \"x.a = \" , x.a\n",
+ "y = Y()\n",
+ "y.a = 44\n",
+ "# assigns 44 to the a defined in Y\n",
+ "y._X__a = 66\n",
+ "# assigns 66 to the a defined in X\n",
+ "y.f()\n",
+ "# invokes the f() defined in Y\n",
+ "X.f(x)\n",
+ "# invokes the f() defined in X\n",
+ "print \"y.a = \" , y.a \n",
+ "print \"y._X__a = \" , y._X__a \n",
+ "z = y\n",
+ "print \"z.a = \" , z._X__a \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "X::f() executing\nx.a = 22\nY::f() executing\nX::f() executing\ny.a = 44\ny._X__a = 66\nz.a = 66\n"
+ "text": [
+ "X::f() executing\n",
+ "x.a = 22\n",
+ "Y::f() executing\n",
+ "X::f() executing\n",
+ "y.a = 44\n",
+ "y._X__a = 66\n",
+ "z.a = 66\n"
+ ]
}
],
"prompt_number": 6
@@ -123,14 +442,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.7 Parent Constructors and Destructors\nNote : Python destuctor is called when program goes exit. So output may be differ than c.\n'''\nclass X:\n def __init__(self):\n print \"X::X() constructor executing \"\n def __del__(self):\n print \"X::X() destructor executing \"\n\nclass Y(X):\n def __init__(self):\n X.__init__(self)\n print \"Y::Y() constructor executing \"\n def __del__(self):\n print \"Y::Y() destructor executing \"\n\nclass Z(Y):\n def __init__(self,i):\n Y.__init__(self)\n print \"Z::Z(\" , i , \") constructor executing \"\n def __del__(self):\n print \"Z::Z() destructor executing \"\n \n\nZ = Z(44)\n",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def __init__(self):\n",
+ " print \"X::X() constructor executing \"\n",
+ " def __del__(self):\n",
+ " print \"X::X() destructor executing \"\n",
+ "\n",
+ "class Y(X):\n",
+ " def __init__(self):\n",
+ " X.__init__(self)\n",
+ " print \"Y::Y() constructor executing \"\n",
+ " def __del__(self):\n",
+ " print \"Y::Y() destructor executing \"\n",
+ "\n",
+ "class Z(Y):\n",
+ " def __init__(self,i):\n",
+ " Y.__init__(self)\n",
+ " print \"Z::Z(\" , i , \") constructor executing \"\n",
+ " def __del__(self):\n",
+ " print \"Z::Z() destructor executing \"\n",
+ " \n",
+ "\n",
+ "Z = Z(44)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "X::X() constructor executing \nY::Y() constructor executing \nZ::Z( 44 ) constructor executing \n"
+ "text": [
+ "X::X() constructor executing \n",
+ "Y::Y() constructor executing \n",
+ "Z::Z( 44 ) constructor executing \n"
+ ]
}
],
"prompt_number": 7
@@ -138,7 +485,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.8 Parent Constructors and Destructors\nHere is a demo program that uses a base class Person and a derived class Student:\nNote : Python destuctor is called when program goes exit. So output may be differ than c.\n'''\nclass Person:\n def __init__(self,s):\n self.name = s\n def __del__(self):\n pass\n\nclass Student(Person):\n def __init__(self,s,m):\n Person.__init__(self,s)\n self.major = m\n def __del__(self):\n pass\nx = Person(\"Bob\")\ny = Student(\"Sarah\", \"Biology\")\n",
+ "input": [
+ "\n",
+ "class Person:\n",
+ " def __init__(self,s):\n",
+ " self.name = s\n",
+ " def __del__(self):\n",
+ " pass\n",
+ "\n",
+ "class Student(Person):\n",
+ " def __init__(self,s,m):\n",
+ " Person.__init__(self,s)\n",
+ " self.major = m\n",
+ " def __del__(self):\n",
+ " pass\n",
+ "x = Person(\"Bob\")\n",
+ "y = Student(\"Sarah\", \"Biology\")\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -147,7 +510,32 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.9\n'''\nclass Person:\n def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n self.name = n\n self.nationality = nat\n self.sex = s\n self.dob = Date()\n self.dod = Date()\n def setDOB(self,m,d,y):\n self.dob.setDate(m,d,y)\n def setDOD(self,m,d,y):\n self.dod.setDate(m,d,y)\n def printName(self):\n print self.name,\n def printNationality(self):\n print self.nationality,\n def printDOB(self):\n self.dob.print_()\n def printDOD(self):\n self.dod.print_()\n def setHSgraduate(self,g):\n self.hs = g\n def isHSgraduate(self):\n return hs\n",
+ "input": [
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n",
+ " self.name = n\n",
+ " self.nationality = nat\n",
+ " self.sex = s\n",
+ " self.dob = Date()\n",
+ " self.dod = Date()\n",
+ " def setDOB(self,m,d,y):\n",
+ " self.dob.setDate(m,d,y)\n",
+ " def setDOD(self,m,d,y):\n",
+ " self.dod.setDate(m,d,y)\n",
+ " def printName(self):\n",
+ " print self.name,\n",
+ " def printNationality(self):\n",
+ " print self.nationality,\n",
+ " def printDOB(self):\n",
+ " self.dob.print_()\n",
+ " def printDOD(self):\n",
+ " self.dod.print_()\n",
+ " def setHSgraduate(self,g):\n",
+ " self.hs = g\n",
+ " def isHSgraduate(self):\n",
+ " return hs\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -156,14 +544,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.10 Using virtual Functions\nThis demo program declares p to be a pointer to objects of the base class X. First it assigns p to\npoint to an instance x of class X. Then it assigns p to point to an instance y of the derived class Y.\nNote : By default all methods in python are virtual. so output would be differ than c.\n'''\nclass X:\n def f(self):\n print \"X::f() executing\"\nclass Y(X):\n def f(self):\n print \"Y::f() executing\"\nx = X()\ny = Y()\np = x\np.f()\np = y\np.f()\n",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def f(self):\n",
+ " print \"X::f() executing\"\n",
+ "class Y(X):\n",
+ " def f(self):\n",
+ " print \"Y::f() executing\"\n",
+ "x = X()\n",
+ "y = Y()\n",
+ "p = x\n",
+ "p.f()\n",
+ "p = y\n",
+ "p.f()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "X::f() executing\nY::f() executing\n"
+ "text": [
+ "X::f() executing\n",
+ "Y::f() executing\n"
+ ]
}
],
"prompt_number": 10
@@ -171,14 +576,49 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.11 Polymorphism through virtual Functions\nHere is a Person class with a Student subclass and a Professor subclass:\n'''\nclass Person:\n def __init__(self,n):\n self.name = n\n def print_(self):\n print 'My name is' , self.name\n\nclass Student(Person):\n def __init__(self,s,g):\n Person.__init__(self,s)\n self.gpa = g\n def print_(self):\n print 'My name is ',self.name, ' and my G.P.A. is', self.gpa\n\nclass Professor(Person):\n def __init__(self,s,n):\n Person.__init__(self,s)\n self.publs = n\n def print_(self):\n print 'My name is ', self.name,' and i have ' , self.publs,' publications.'\n\nx = Person(\"Bob\")\np = x\np.print_()\ny = Student(\"Tom\", 3.47)\np = y\np.print_()\nz = Professor(\"Ann\", 7)\np = z\np.print_()",
+ "input": [
+ "\n",
+ "class Person:\n",
+ " def __init__(self,n):\n",
+ " self.name = n\n",
+ " def print_(self):\n",
+ " print 'My name is' , self.name\n",
+ "\n",
+ "class Student(Person):\n",
+ " def __init__(self,s,g):\n",
+ " Person.__init__(self,s)\n",
+ " self.gpa = g\n",
+ " def print_(self):\n",
+ " print 'My name is ',self.name, ' and my G.P.A. is', self.gpa\n",
+ "\n",
+ "class Professor(Person):\n",
+ " def __init__(self,s,n):\n",
+ " Person.__init__(self,s)\n",
+ " self.publs = n\n",
+ " def print_(self):\n",
+ " print 'My name is ', self.name,' and i have ' , self.publs,' publications.'\n",
+ "\n",
+ "x = Person(\"Bob\")\n",
+ "p = x\n",
+ "p.print_()\n",
+ "y = Student(\"Tom\", 3.47)\n",
+ "p = y\n",
+ "p.print_()\n",
+ "z = Professor(\"Ann\", 7)\n",
+ "p = z\n",
+ "p.print_()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "My name is Bob\nMy name is Tom and my G.P.A. is 3.47\nMy name is Ann and i have 7 publications.\n"
+ "text": [
+ "My name is Bob\n",
+ "My name is Tom and my G.P.A. is 3.47\n",
+ "My name is Ann and i have 7 publications.\n"
+ ]
}
],
"prompt_number": 11
@@ -186,14 +626,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.12 Memory Leaks\nThis program is similar to Example 12.6:\n'''\nclass X:\n def __init__(self):\n self.p = [0,0]\n print 'X().',\n def __del__(self):\n print '~X().'\n\nclass Y(X):\n def __init__(self):\n X.__init__(self)\n self.q = []\n for i in range(1023):\n self.q.append(0)\n print 'Y() : Y::q = ', hex(id(self.q)) ,'.',\n def __del__(self):\n print '~Y().'\n\nfor i in range(8):\n r = Y()",
+ "input": [
+ "\n",
+ "class X:\n",
+ " def __init__(self):\n",
+ " self.p = [0,0]\n",
+ " print 'X().',\n",
+ " def __del__(self):\n",
+ " print '~X().'\n",
+ "\n",
+ "class Y(X):\n",
+ " def __init__(self):\n",
+ " X.__init__(self)\n",
+ " self.q = []\n",
+ " for i in range(1023):\n",
+ " self.q.append(0)\n",
+ " print 'Y() : Y::q = ', hex(id(self.q)) ,'.',\n",
+ " def __del__(self):\n",
+ " print '~Y().'\n",
+ "\n",
+ "for i in range(8):\n",
+ " r = Y()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "X(). Y() : Y::q = 0x90d91cc . ~Y().\nX(). Y() : Y::q = 0x90c944c . ~Y().\nX(). Y() : Y::q = 0x90d91cc . ~Y().\nX(). Y() : Y::q = 0x90c944c . ~Y().\nX(). Y() : Y::q = 0x90d91cc . ~Y().\nX(). Y() : Y::q = 0x90c944c . ~Y().\nX(). Y() : Y::q = 0x90d91cc . ~Y().\nX(). Y() : Y::q = 0x90c944c . ~Y().\n"
+ "text": [
+ "X(). Y() : Y::q = 0x90d91cc . ~Y().\n",
+ "X(). Y() : Y::q = 0x90c944c . ~Y().\n",
+ "X(). Y() : Y::q = 0x90d91cc . ~Y().\n",
+ "X(). Y() : Y::q = 0x90c944c . ~Y().\n",
+ "X(). Y() : Y::q = 0x90d91cc . ~Y().\n",
+ "X(). Y() : Y::q = 0x90c944c . ~Y().\n",
+ "X(). Y() : Y::q = 0x90d91cc . ~Y().\n",
+ "X(). Y() : Y::q = 0x90c944c . ~Y().\n"
+ ]
}
],
"prompt_number": 13
@@ -201,14 +671,74 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 12.13 A Hierarchy of Media Classes\nHere is a hierarchy of classes to represent various media objects:\nMedia Audio Book Periodical CD Tape Record Magazine Newspaper Journal Newsletter\nThe primary ABC is the Media class:\n'''\nclass Media:\n def __init__(self):\n self.title = ''\n def print_(self):\n pass\n def id(self):\n pass\n\nclass Book(Media):\n def __init__(self,a='',t=\"\",p=\"\",i=\"\"):\n self.author = a\n self.publisher = p\n self.isbn = i\n self.title = t\n def print_(self):\n print self.title , \" by \" , self.author\n def id(self):\n return self.isbn\n\nclass CD(Media):\n def __init__(self,t=\"\",c=\"\",m=\"\",n=\"\"):\n self.composer = c\n self.make = m\n self.number = n\n self.title = t\n def print_(self):\n print self.title , \", \" , self.composer\n def id(self):\n s = str(self.make) + ' ' + str(self.number)\n return s\n\nclass Magazine(Media):\n def __init__(self,t=\"\",i=\"\",v=0, n=0):\n self.issn = i\n self.volume = v\n self.number = n\n self.title = t\n def print_(self):\n print self.title , \" Magazine, Vol. \", self.volume , \", No.\" , self.number\n def id(self):\n return self.issn\n\nbook = Book(\"Bjarne Stroustrup\", \"The C++ Programming Language\",\"Addison-Wesley\", \"0-201-53992-6\")\nmagazine = Magazine(\"TIME\", \"0040-781X\", 145, 23)\ncd = CD(\"BACH CANTATAS\", \"Johann Sebastian Bach\",\"ARCHIV\", \"D120541\")\nbook.print_()\nprint \"\\tid: \" , book.id() \nmagazine.print_()\nprint \"\\tid: \" , magazine.id() \ncd.print_()\nprint \"\\tid: \" , cd.id()",
+ "input": [
+ "\n",
+ "class Media:\n",
+ " def __init__(self):\n",
+ " self.title = ''\n",
+ " def print_(self):\n",
+ " pass\n",
+ " def id(self):\n",
+ " pass\n",
+ "\n",
+ "class Book(Media):\n",
+ " def __init__(self,a='',t=\"\",p=\"\",i=\"\"):\n",
+ " self.author = a\n",
+ " self.publisher = p\n",
+ " self.isbn = i\n",
+ " self.title = t\n",
+ " def print_(self):\n",
+ " print self.title , \" by \" , self.author\n",
+ " def id(self):\n",
+ " return self.isbn\n",
+ "\n",
+ "class CD(Media):\n",
+ " def __init__(self,t=\"\",c=\"\",m=\"\",n=\"\"):\n",
+ " self.composer = c\n",
+ " self.make = m\n",
+ " self.number = n\n",
+ " self.title = t\n",
+ " def print_(self):\n",
+ " print self.title , \", \" , self.composer\n",
+ " def id(self):\n",
+ " s = str(self.make) + ' ' + str(self.number)\n",
+ " return s\n",
+ "\n",
+ "class Magazine(Media):\n",
+ " def __init__(self,t=\"\",i=\"\",v=0, n=0):\n",
+ " self.issn = i\n",
+ " self.volume = v\n",
+ " self.number = n\n",
+ " self.title = t\n",
+ " def print_(self):\n",
+ " print self.title , \" Magazine, Vol. \", self.volume , \", No.\" , self.number\n",
+ " def id(self):\n",
+ " return self.issn\n",
+ "\n",
+ "book = Book(\"Bjarne Stroustrup\", \"The C++ Programming Language\",\"Addison-Wesley\", \"0-201-53992-6\")\n",
+ "magazine = Magazine(\"TIME\", \"0040-781X\", 145, 23)\n",
+ "cd = CD(\"BACH CANTATAS\", \"Johann Sebastian Bach\",\"ARCHIV\", \"D120541\")\n",
+ "book.print_()\n",
+ "print \"\\tid: \" , book.id() \n",
+ "magazine.print_()\n",
+ "print \"\\tid: \" , magazine.id() \n",
+ "cd.print_()\n",
+ "print \"\\tid: \" , cd.id()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The C++ Programming Language by Bjarne Stroustrup\n\tid: 0-201-53992-6\nTIME Magazine, Vol. 145 , No. 23\n\tid: 0040-781X\nBACH CANTATAS , Johann Sebastian Bach\n\tid: ARCHIV D120541\n"
+ "text": [
+ "The C++ Programming Language by Bjarne Stroustrup\n",
+ "\tid: 0-201-53992-6\n",
+ "TIME Magazine, Vol. 145 , No. 23\n",
+ "\tid: 0040-781X\n",
+ "BACH CANTATAS , Johann Sebastian Bach\n",
+ "\tid: ARCHIV D120541\n"
+ ]
}
],
"prompt_number": 14
@@ -216,7 +746,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch13.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch13.ipynb
index 827142fe..cfd875f2 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch13.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch13"
+ "name": "",
+ "signature": "sha256:cc39907a700b2b635fe495cd65c97f54d7249e166a21cea325643318306862ee"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,7 +11,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.1 The swap Function Template\n'''\ndef swap(x,y):\n x[0],y[0] = y[0],x[0]\n\nm = [22]\nn = [66]\nswap(m, n)\ns1 = [\"John Adams\"]\ns2 = [\"James Madison\"]\nswap(s1, s2)\nx = [22/7]\ny = [-3]\nswap(x, y)\n",
+ "input": [
+ "\n",
+ "def swap(x,y):\n",
+ " x[0],y[0] = y[0],x[0]\n",
+ "\n",
+ "m = [22]\n",
+ "n = [66]\n",
+ "swap(m, n)\n",
+ "s1 = [\"John Adams\"]\n",
+ "s2 = [\"James Madison\"]\n",
+ "swap(s1, s2)\n",
+ "x = [22/7]\n",
+ "y = [-3]\n",
+ "swap(x, y)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -19,14 +34,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.2 The Bubble Sort Template\n'''\n\ndef sort(v,n):\n for i in range(1,n):\n for j in range(n-i):\n if v[j] > v[j+1]:\n v[j],v[j+1] = v[j+1],v[j]\n\ndef print_( v,n):\n for i in range(n):\n print v[i],\n print \"\"\n \na = [55, 33, 88, 11, 44, 99, 77, 22, 66]\nprint_(a,9);\nsort(a,9)\nprint_(a,9)\ns = [\"Tom\", \"Hal\", \"Dan\", \"Bob\", \"Sue\", \"Ann\", \"Gus\"]\nprint_(s,7)\nsort(s,7)\nprint_(s,7)\n",
+ "input": [
+ "\n",
+ "def sort(v,n):\n",
+ " for i in range(1,n):\n",
+ " for j in range(n-i):\n",
+ " if v[j] > v[j+1]:\n",
+ " v[j],v[j+1] = v[j+1],v[j]\n",
+ "\n",
+ "def print_( v,n):\n",
+ " for i in range(n):\n",
+ " print v[i],\n",
+ " print \"\"\n",
+ " \n",
+ "a = [55, 33, 88, 11, 44, 99, 77, 22, 66]\n",
+ "print_(a,9);\n",
+ "sort(a,9)\n",
+ "print_(a,9)\n",
+ "s = [\"Tom\", \"Hal\", \"Dan\", \"Bob\", \"Sue\", \"Ann\", \"Gus\"]\n",
+ "print_(s,7)\n",
+ "sort(s,7)\n",
+ "print_(s,7)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "55 33 88 11 44 99 77 22 66 \n11 22 33 44 55 66 77 88 99 \nTom Hal Dan Bob Sue Ann Gus \nAnn Bob Dan Gus Hal Sue Tom \n"
+ "text": [
+ "55 33 88 11 44 99 77 22 66 \n",
+ "11 22 33 44 55 66 77 88 99 \n",
+ "Tom Hal Dan Bob Sue Ann Gus \n",
+ "Ann Bob Dan Gus Hal Sue Tom \n"
+ ]
}
],
"prompt_number": 2
@@ -34,14 +75,51 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.3 A Stack Class Template\n'''\nclass Stack:\n def __init__(self,s=100):\n self.size = s\n self.top = -1\n self.data = []\n def push(self,x):\n self.data.append( x)\n self.top += 1\n def pop(self):\n d = self.data[self.top]\n self.data.pop(self.top)\n self.top -= 1\n return d \n def isEmpty(self):\n return self.top == -1\n def isFull(self):\n return self.top==self.size-1\n \nintStack1 = Stack(5)\nintStack2 = Stack(10)\ncharStack = Stack(8)\nintStack1.push(77)\ncharStack.push('A')\nintStack2.push(22)\ncharStack.push('E')\ncharStack.push('K')\nintStack2.push(44)\nprint intStack2.pop() \nprint intStack2.pop() \nif (intStack2.isEmpty()):\n print \"intStack2 is empty.\"\n",
+ "input": [
+ "\n",
+ "class Stack:\n",
+ " def __init__(self,s=100):\n",
+ " self.size = s\n",
+ " self.top = -1\n",
+ " self.data = []\n",
+ " def push(self,x):\n",
+ " self.data.append( x)\n",
+ " self.top += 1\n",
+ " def pop(self):\n",
+ " d = self.data[self.top]\n",
+ " self.data.pop(self.top)\n",
+ " self.top -= 1\n",
+ " return d \n",
+ " def isEmpty(self):\n",
+ " return self.top == -1\n",
+ " def isFull(self):\n",
+ " return self.top==self.size-1\n",
+ " \n",
+ "intStack1 = Stack(5)\n",
+ "intStack2 = Stack(10)\n",
+ "charStack = Stack(8)\n",
+ "intStack1.push(77)\n",
+ "charStack.push('A')\n",
+ "intStack2.push(22)\n",
+ "charStack.push('E')\n",
+ "charStack.push('K')\n",
+ "intStack2.push(44)\n",
+ "print intStack2.pop() \n",
+ "print intStack2.pop() \n",
+ "if (intStack2.isEmpty()):\n",
+ " print \"intStack2 is empty.\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "44\n22\nintStack2 is empty.\n"
+ "text": [
+ "44\n",
+ "22\n",
+ "intStack2 is empty.\n"
+ ]
}
],
"prompt_number": 3
@@ -49,14 +127,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.4 A Vector Class Template\n= operator does work in python by defaultly.\n'''\nclass Vector:\n def __init__(self,n=None):\n if type(n) == int :\n self.size = n\n self.data = []\n else:\n self.size = 8\n self.data = []\n for i in range(self.size):\n self.data.append(0)\nv = Vector()\nv.data[5] = 127\nw = v\nx = Vector(3)\nprint w.size\n",
+ "input": [
+ "\n",
+ "class Vector:\n",
+ " def __init__(self,n=None):\n",
+ " if type(n) == int :\n",
+ " self.size = n\n",
+ " self.data = []\n",
+ " else:\n",
+ " self.size = 8\n",
+ " self.data = []\n",
+ " for i in range(self.size):\n",
+ " self.data.append(0)\n",
+ "v = Vector()\n",
+ "v.data[5] = 127\n",
+ "w = v\n",
+ "x = Vector(3)\n",
+ "print w.size\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
}
],
"prompt_number": 4
@@ -64,14 +161,56 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.5 A Subclass Template for Vectors\n'''\nclass Vector:\n def __init__(self,n=None):\n if type(n) == int :\n self.size = n\n self.data = []\n else:\n self.size = 8\n self.data = []\n for i in range(self.size):\n self.data.append(0)\n\nclass Array(Vector):\n def __init__(self,i,j):\n Vector.__init__(self,j-i+1)\n self.i0= i\n def __setitem__(self,k,v):\n self.data[k-self.i0] = v\n def __getitem__(self,i):\n return self.data[self.i0-i]\n def firstSubscript(self):\n return self.i0\n def lastSubscript(self):\n return self.i0+self.size-1\n\nx = Array(1,3)\nx.data[0] = 3.14159\nx.data[1] = 0.08516\nx.data[2] = 5041.92\nprint \"x.size() = \" , x.size \nprint \"x.firstSubscript() = \" , x.firstSubscript() \nprint \"x.lastSubscript() = \" , x.lastSubscript()\nfor i in range(0,3):\n print \"x[\" , i + 1 , \"] = \" , x.data[i]\n",
+ "input": [
+ "\n",
+ "class Vector:\n",
+ " def __init__(self,n=None):\n",
+ " if type(n) == int :\n",
+ " self.size = n\n",
+ " self.data = []\n",
+ " else:\n",
+ " self.size = 8\n",
+ " self.data = []\n",
+ " for i in range(self.size):\n",
+ " self.data.append(0)\n",
+ "\n",
+ "class Array(Vector):\n",
+ " def __init__(self,i,j):\n",
+ " Vector.__init__(self,j-i+1)\n",
+ " self.i0= i\n",
+ " def __setitem__(self,k,v):\n",
+ " self.data[k-self.i0] = v\n",
+ " def __getitem__(self,i):\n",
+ " return self.data[self.i0-i]\n",
+ " def firstSubscript(self):\n",
+ " return self.i0\n",
+ " def lastSubscript(self):\n",
+ " return self.i0+self.size-1\n",
+ "\n",
+ "x = Array(1,3)\n",
+ "x.data[0] = 3.14159\n",
+ "x.data[1] = 0.08516\n",
+ "x.data[2] = 5041.92\n",
+ "print \"x.size() = \" , x.size \n",
+ "print \"x.firstSubscript() = \" , x.firstSubscript() \n",
+ "print \"x.lastSubscript() = \" , x.lastSubscript()\n",
+ "for i in range(0,3):\n",
+ " print \"x[\" , i + 1 , \"] = \" , x.data[i]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x.size() = 3\nx.firstSubscript() = 1\nx.lastSubscript() = 3\nx[ 1 ] = 3.14159\nx[ 2 ] = 0.08516\nx[ 3 ] = 5041.92\n"
+ "text": [
+ "x.size() = 3\n",
+ "x.firstSubscript() = 1\n",
+ "x.lastSubscript() = 3\n",
+ "x[ 1 ] = 3.14159\n",
+ "x[ 2 ] = 0.08516\n",
+ "x[ 3 ] = 5041.92\n"
+ ]
}
],
"prompt_number": 5
@@ -79,14 +218,45 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.6 A Matrix Class Template\n'''\n\nclass Matrix:\n def __init__(self,r=1,c=1):\n self.rows = r\n self.columns = c\n self.vector = []\n for i in range(r):\n a = []\n for j in range(c):\n a.append(0)\n self.vector.append(a)\n\na = Matrix(2,3)\na.vector[0][0] = 0.0\na.vector[0][1] = 0.1\na.vector[0][2] = 0.2\na.vector[1][0] = 1.0\na.vector[1][1] = 1.1\na.vector[1][2] = 1.2\n\nprint \"The matrix a has \" , a.rows , \" rows and \", a.columns , \" columns:\"\nfor i in range(2):\n for j in range(3):\n print a.vector[i][j] ,\n print \"\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "class Matrix:\n",
+ " def __init__(self,r=1,c=1):\n",
+ " self.rows = r\n",
+ " self.columns = c\n",
+ " self.vector = []\n",
+ " for i in range(r):\n",
+ " a = []\n",
+ " for j in range(c):\n",
+ " a.append(0)\n",
+ " self.vector.append(a)\n",
+ "\n",
+ "a = Matrix(2,3)\n",
+ "a.vector[0][0] = 0.0\n",
+ "a.vector[0][1] = 0.1\n",
+ "a.vector[0][2] = 0.2\n",
+ "a.vector[1][0] = 1.0\n",
+ "a.vector[1][1] = 1.1\n",
+ "a.vector[1][2] = 1.2\n",
+ "\n",
+ "print \"The matrix a has \" , a.rows , \" rows and \", a.columns , \" columns:\"\n",
+ "for i in range(2):\n",
+ " for j in range(3):\n",
+ " print a.vector[i][j] ,\n",
+ " print \"\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The matrix a has 2 rows and 3 columns:\n0.0 0.1 0.2 \n1.0 1.1 1.2 \n"
+ "text": [
+ "The matrix a has 2 rows and 3 columns:\n",
+ "0.0 0.1 0.2 \n",
+ "1.0 1.1 1.2 \n"
+ ]
}
],
"prompt_number": 6
@@ -94,14 +264,37 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.7 A List Class Template\nA list consists of a linked sequence of nodes. Each node contains one data item and a link to the next\nnode. So we begin by defining a ListNode class template:\n'''\n\nfriends = []\n\n\nfriends.insert(0,\"Bowen, Van\")\nfriends.insert(0,\"Dixon, Tom\")\nfriends.insert(0,\"Mason, Joe\")\nfriends.insert(0,\"White, Ann\")\n\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\nfriends.remove('White, Ann')\nprint \"Removed: \" , 'White, Ann'\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\n\n",
+ "input": [
+ "\n",
+ "friends = []\n",
+ "\n",
+ "\n",
+ "friends.insert(0,\"Bowen, Van\")\n",
+ "friends.insert(0,\"Dixon, Tom\")\n",
+ "friends.insert(0,\"Mason, Joe\")\n",
+ "friends.insert(0,\"White, Ann\")\n",
+ "\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "friends.remove('White, Ann')\n",
+ "print \"Removed: \" , 'White, Ann'\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "White, Ann -> Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\nRemoved: White, Ann\nMason, Joe -> Dixon, Tom -> Bowen, Van -> *\n"
+ "text": [
+ "White, Ann -> Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\n",
+ "Removed: White, Ann\n",
+ "Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\n"
+ ]
}
],
"prompt_number": 7
@@ -109,14 +302,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 13.8\n'''\nfriends = []\nfriends.append(\"Bowen, Van\")\nfriends.append(\"Dixon, Tom\")\nfriends.append(\"Mason, Joe\")\nfriends.append(\"White, Ann\")\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\n\nfriends.remove(\"Mason, Joe\")\nfriends[1] = \"Davis, Jim\"\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\n\nfriends.insert(2,\"Morse, Sam\")\nfor i in range(len(friends)):\n print friends[i], '->' ,\nprint '*'\n\nfor i in range(len(friends)):\n print \"[\" ,friends[i] , \"]\" , '->' ,\nprint '*'\n",
+ "input": [
+ "\n",
+ "friends = []\n",
+ "friends.append(\"Bowen, Van\")\n",
+ "friends.append(\"Dixon, Tom\")\n",
+ "friends.append(\"Mason, Joe\")\n",
+ "friends.append(\"White, Ann\")\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "\n",
+ "friends.remove(\"Mason, Joe\")\n",
+ "friends[1] = \"Davis, Jim\"\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "\n",
+ "friends.insert(2,\"Morse, Sam\")\n",
+ "for i in range(len(friends)):\n",
+ " print friends[i], '->' ,\n",
+ "print '*'\n",
+ "\n",
+ "for i in range(len(friends)):\n",
+ " print \"[\" ,friends[i] , \"]\" , '->' ,\n",
+ "print '*'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Bowen, Van -> Dixon, Tom -> Mason, Joe -> White, Ann -> *\nBowen, Van -> Davis, Jim -> White, Ann -> *\nBowen, Van -> Davis, Jim -> Morse, Sam -> White, Ann -> *\n[ Bowen, Van ] -> [ Davis, Jim ] -> [ Morse, Sam ] -> [ White, Ann ] -> *\n"
+ "text": [
+ "Bowen, Van -> Dixon, Tom -> Mason, Joe -> White, Ann -> *\n",
+ "Bowen, Van -> Davis, Jim -> White, Ann -> *\n",
+ "Bowen, Van -> Davis, Jim -> Morse, Sam -> White, Ann -> *\n",
+ "[ Bowen, Van ] -> [ Davis, Jim ] -> [ Morse, Sam ] -> [ White, Ann ] -> *\n"
+ ]
}
],
"prompt_number": 8
@@ -124,7 +347,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch14.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch14.ipynb
index 1618010d..2b06bed6 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch14.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch14"
+ "name": "",
+ "signature": "sha256:a2642ced32385d2b1020b66a0cd2578b114803009d5270f03f2b2323505ad39e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.1 Using a vector of strings\n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nprint_(v)",
+ "input": [
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +54,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.2 \n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nprint_(v)",
+ "input": [
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n"
+ ]
}
],
"prompt_number": 2
@@ -40,14 +97,43 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.3 \n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in range(len(v)):\n print v[i]\n\nv = []\nload(v)\nprint_(v)",
+ "input": [
+ "\n",
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in range(len(v)):\n",
+ " print v[i]\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n"
+ ]
}
],
"prompt_number": 3
@@ -55,14 +141,45 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.4 Using the Generic sort() Algorithm\n'''\n\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nv.sort()\nprint_(v)\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "v.sort()\n",
+ "print_(v)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Chile\nEgypt\nItaly\nJapan\nKenya\nNepal\nSpain\nZaire\n"
+ "text": [
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Spain\n",
+ "Zaire\n"
+ ]
}
],
"prompt_number": 4
@@ -70,14 +187,52 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.5 Using the Assignment Operator to Duplicate a vector\n'''\n#This program demonstrates that one vector can be assigned to another.\n\n\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nw = v\nprint_(v)\nprint_(w)",
+ "input": [
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "w = v\n",
+ "print_(v)\n",
+ "print_(w)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\nJapan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n",
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n"
+ ]
}
],
"prompt_number": 5
@@ -85,14 +240,58 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.6 \n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nv.sort()\nprint_(v)\nprint \"v.front() = \" + v[0]\nprint \"v.back() = \" + v.pop(-1) \nprint \"v.back() = \" + v.pop(-1) \nprint \"v.back() = \" + v[-1] \nprint_(v)",
+ "input": [
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "v.sort()\n",
+ "print_(v)\n",
+ "print \"v.front() = \" + v[0]\n",
+ "print \"v.back() = \" + v.pop(-1) \n",
+ "print \"v.back() = \" + v.pop(-1) \n",
+ "print \"v.back() = \" + v[-1] \n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Chile\nEgypt\nItaly\nJapan\nKenya\nNepal\nSpain\nZaire\nv.front() = Chile\nv.back() = Zaire\nv.back() = Spain\nv.back() = Nepal\nChile\nEgypt\nItaly\nJapan\nKenya\nNepal\n"
+ "text": [
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Spain\n",
+ "Zaire\n",
+ "v.front() = Chile\n",
+ "v.back() = Zaire\n",
+ "v.back() = Spain\n",
+ "v.back() = Nepal\n",
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n"
+ ]
}
],
"prompt_number": 6
@@ -100,14 +299,52 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.7 Using the erase() Function\n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nv.sort()\nprint_(v)\nv.pop(2) # removes Italy\nv.pop(-2) # removes Spain\nprint_(v)",
+ "input": [
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "v.sort()\n",
+ "print_(v)\n",
+ "v.pop(2) # removes Italy\n",
+ "v.pop(-2) # removes Spain\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Chile\nEgypt\nItaly\nJapan\nKenya\nNepal\nSpain\nZaire\nChile\nEgypt\nJapan\nKenya\nNepal\nZaire\n"
+ "text": [
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Spain\n",
+ "Zaire\n",
+ "Chile\n",
+ "Egypt\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Zaire\n"
+ ]
}
],
"prompt_number": 7
@@ -115,14 +352,60 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.8 Using the insert() Function\n'''\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n\ndef print_(v):\n for i in v:\n print i\nv = []\nload(v)\nv.sort()\nprint_(v)\nr = []\nfor i in range(2,len(v)-2):\n r.append(v[i]) #removes the segment Italy..Nepal\n \nfor i in r:\n v.remove(i)\nprint_(v)\nv.insert(2,\"India\")\nprint_(v)",
+ "input": [
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "v = []\n",
+ "load(v)\n",
+ "v.sort()\n",
+ "print_(v)\n",
+ "r = []\n",
+ "for i in range(2,len(v)-2):\n",
+ " r.append(v[i]) #removes the segment Italy..Nepal\n",
+ " \n",
+ "for i in r:\n",
+ " v.remove(i)\n",
+ "print_(v)\n",
+ "v.insert(2,\"India\")\n",
+ "print_(v)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Chile\nEgypt\nItaly\nJapan\nKenya\nNepal\nSpain\nZaire\nChile\nEgypt\nSpain\nZaire\nChile\nEgypt\nIndia\nSpain\nZaire\n"
+ "text": [
+ "Chile\n",
+ "Egypt\n",
+ "Italy\n",
+ "Japan\n",
+ "Kenya\n",
+ "Nepal\n",
+ "Spain\n",
+ "Zaire\n",
+ "Chile\n",
+ "Egypt\n",
+ "Spain\n",
+ "Zaire\n",
+ "Chile\n",
+ "Egypt\n",
+ "India\n",
+ "Spain\n",
+ "Zaire\n"
+ ]
}
],
"prompt_number": 8
@@ -130,14 +413,64 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.9 Using the find() Function\n'''\n\ndef load(v):\n v.append(\"Japan\")\n v.append(\"Italy\")\n v.append(\"Spain\")\n v.append(\"Egypt\")\n v.append(\"Chile\")\n v.append(\"Zaire\")\n v.append(\"Nepal\")\n v.append(\"Kenya\")\n v.append(\"India\")\n v.append(\"China\")\n v.append(\"Malta\")\n v.append(\"Syria\")\n\ndef print_(v):\n for i in v:\n print i\n\nv = []\nload(v)\nprint_(v)\negypt = v.index('Egypt')\nmalta = v.index('Malta')\nw = v[egypt:malta+1]\nw.sort()\nprint_(w)",
+ "input": [
+ "\n",
+ "\n",
+ "def load(v):\n",
+ " v.append(\"Japan\")\n",
+ " v.append(\"Italy\")\n",
+ " v.append(\"Spain\")\n",
+ " v.append(\"Egypt\")\n",
+ " v.append(\"Chile\")\n",
+ " v.append(\"Zaire\")\n",
+ " v.append(\"Nepal\")\n",
+ " v.append(\"Kenya\")\n",
+ " v.append(\"India\")\n",
+ " v.append(\"China\")\n",
+ " v.append(\"Malta\")\n",
+ " v.append(\"Syria\")\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i\n",
+ "\n",
+ "v = []\n",
+ "load(v)\n",
+ "print_(v)\n",
+ "egypt = v.index('Egypt')\n",
+ "malta = v.index('Malta')\n",
+ "w = v[egypt:malta+1]\n",
+ "w.sort()\n",
+ "print_(w)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Japan\nItaly\nSpain\nEgypt\nChile\nZaire\nNepal\nKenya\nIndia\nChina\nMalta\nSyria\nChile\nChina\nEgypt\nIndia\nKenya\nMalta\nNepal\nZaire\n"
+ "text": [
+ "Japan\n",
+ "Italy\n",
+ "Spain\n",
+ "Egypt\n",
+ "Chile\n",
+ "Zaire\n",
+ "Nepal\n",
+ "Kenya\n",
+ "India\n",
+ "China\n",
+ "Malta\n",
+ "Syria\n",
+ "Chile\n",
+ "China\n",
+ "Egypt\n",
+ "India\n",
+ "Kenya\n",
+ "Malta\n",
+ "Nepal\n",
+ "Zaire\n"
+ ]
}
],
"prompt_number": 9
@@ -145,14 +478,45 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 14.10\n'''\ndef copy(v,x,n):\n for i in x:\n v.append(i)\n\ndef projection(v,b):\n v_size = len(v)\n w = []\n for i in range(0,v_size):\n if b[i]:\n w.append(v[i])\n return w\n\ndef print_(v):\n for i in v:\n print i,\n print ''\n\nx = [ 22.2, 33.3, 44.4, 55.5, 66.6, 77.7, 88.8, 99.9 ]\nv = []\ncopy(v, x, 8)\ny = [ False, True, False, True, True, True, False, True ]\nb = []\ncopy(b, y, 8)\nw = projection(v, b)\nprint_(v)\nprint_(w)",
+ "input": [
+ "\n",
+ "def copy(v,x,n):\n",
+ " for i in x:\n",
+ " v.append(i)\n",
+ "\n",
+ "def projection(v,b):\n",
+ " v_size = len(v)\n",
+ " w = []\n",
+ " for i in range(0,v_size):\n",
+ " if b[i]:\n",
+ " w.append(v[i])\n",
+ " return w\n",
+ "\n",
+ "def print_(v):\n",
+ " for i in v:\n",
+ " print i,\n",
+ " print ''\n",
+ "\n",
+ "x = [ 22.2, 33.3, 44.4, 55.5, 66.6, 77.7, 88.8, 99.9 ]\n",
+ "v = []\n",
+ "copy(v, x, 8)\n",
+ "y = [ False, True, False, True, True, True, False, True ]\n",
+ "b = []\n",
+ "copy(b, y, 8)\n",
+ "w = projection(v, b)\n",
+ "print_(v)\n",
+ "print_(w)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "22.2 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n33.3 55.5 66.6 77.7 99.9 \n"
+ "text": [
+ "22.2 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n",
+ "33.3 55.5 66.6 77.7 99.9 \n"
+ ]
}
],
"prompt_number": 10
@@ -160,7 +524,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch2.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch2.ipynb
index 606044d0..52984e73 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch2.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "CH2"
+ "name": "",
+ "signature": "sha256:43f850ff4e8965af5c5db1b79b7b4f60c3104eca56084bd90dc829928ca10593"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,24 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.1 Boolean Variables\n'''\n\n# prints the value of a boolean variable:\nflag=False\nprint \"flag = %r\" % flag\nflag = True\nprint \"flag = %r\" % flag",
+ "input": [
+ "\n",
+ "# prints the value of a boolean variable:\n",
+ "flag=False\n",
+ "print \"flag = %r\" % flag\n",
+ "flag = True\n",
+ "print \"flag = %r\" % flag"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "flag = False\nflag = True\n"
+ "text": [
+ "flag = False\n",
+ "flag = True\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +36,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.2 Character Variables\n'''\n\n# prints the character and its internally stored\nc='A'\nprint \"c = \" + c + \", int(c) = %d\" % ord(c)\nc='t'\nprint \"c = \" + c + \", int(c) = %d\" % ord(c)\nc='\\t' # the tab character\nprint \"c = \" + c + \", int(c) = %d\" % ord(c)\nc='!'\nprint \"c = \" + c + \", int(c) = %d\" % ord(c)\n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints the character and its internally stored\n",
+ "c='A'\n",
+ "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n",
+ "c='t'\n",
+ "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n",
+ "c='\\t' # the tab character\n",
+ "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n",
+ "c='!'\n",
+ "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "c = A, int(c) = 65\nc = t, int(c) = 116\nc = \t, int(c) = 9\nc = !, int(c) = 33\n"
+ "text": [
+ "c = A, int(c) = 65\n",
+ "c = t, int(c) = 116\n",
+ "c = \t, int(c) = 9\n",
+ "c = !, int(c) = 33\n"
+ ]
}
],
"prompt_number": 2
@@ -40,14 +68,26 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.3 Integer Type Ranges\nThis program prints the numeric ranges of the Python\n'''\nimport sys\n# defines the constants SHRT_MIN, etc.\nprint 'maximum limit int : ',\nprint sys.maxint\nprint 'float info'\nprint sys.float_info",
+ "input": [
+ "\n",
+ "import sys\n",
+ "# defines the constants SHRT_MIN, etc.\n",
+ "print 'maximum limit int : ',\n",
+ "print sys.maxint\n",
+ "print 'float info'\n",
+ "print sys.float_info"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "maximum limit int : 2147483647\nfloat info\nsys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)\n"
+ "text": [
+ "maximum limit int : 2147483647\n",
+ "float info\n",
+ "sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)\n"
+ ]
}
],
"prompt_number": 3
@@ -55,14 +95,32 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.4 Integer Arithmetic\nThis example illustrates how the arithmetic operators work.\n'''\n\n# tests operators +, -, *, /, and %:\nm=54\nn=20\nprint \"m = %d and n = %d\" %(m,n)\nprint \"m+n = %d\" % (m+n) # 54+20 = 74\nprint \"m-n = %d\" % (m-n) # 54-20 = 34\nprint \"m*n = %d\" % (m*n)# 54*20 = 1080\nprint \"m/n = %d\" % (m/n) # 54/20 = 2\nprint \"m modulo by n = %d\" % (m%n) # 54%20 = 14",
+ "input": [
+ "\n",
+ "# tests operators +, -, *, /, and %:\n",
+ "m=54\n",
+ "n=20\n",
+ "print \"m = %d and n = %d\" %(m,n)\n",
+ "print \"m+n = %d\" % (m+n) # 54+20 = 74\n",
+ "print \"m-n = %d\" % (m-n) # 54-20 = 34\n",
+ "print \"m*n = %d\" % (m*n)# 54*20 = 1080\n",
+ "print \"m/n = %d\" % (m/n) # 54/20 = 2\n",
+ "print \"m modulo by n = %d\" % (m%n) # 54%20 = 14"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 54 and n = 20\nm+n = 74\nm-n = 34\nm*n = 1080\nm/n = 2\nm modulo by n = 14\n"
+ "text": [
+ "m = 54 and n = 20\n",
+ "m+n = 74\n",
+ "m-n = 34\n",
+ "m*n = 1080\n",
+ "m/n = 2\n",
+ "m modulo by n = 14\n"
+ ]
}
],
"prompt_number": 4
@@ -70,14 +128,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.5 Applying the Pre-increment and Post-increment Operators\n'''\n\n# shows the difference between m++ and ++m:\nm = 44\nm += 1\nn = m\nprint \"m = %d , n = %d\" %(m,n)\nm = 44\nn = m # the post-increment operator is applied to m\nm += 1\nprint \"m = %d , n = %d\" %(m,n)\n",
+ "input": [
+ "\n",
+ "\n",
+ "# shows the difference between m++ and ++m:\n",
+ "m = 44\n",
+ "m += 1\n",
+ "n = m\n",
+ "print \"m = %d , n = %d\" %(m,n)\n",
+ "m = 44\n",
+ "n = m # the post-increment operator is applied to m\n",
+ "m += 1\n",
+ "print \"m = %d , n = %d\" %(m,n)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 45 , n = 45\nm = 45 , n = 44\n"
+ "text": [
+ "m = 45 , n = 45\n",
+ "m = 45 , n = 44\n"
+ ]
}
],
"prompt_number": 5
@@ -85,14 +158,37 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.6 Applying Composite Arithmetic Assignment Operators\n'''\n\n# tests arithmetic assignment operators:\nn=22\nprint \"n = %d\" % n\nn += 9 # adds 9 to n\nprint \"After n += 9, n = %d\" % n\nn -= 5 # subtracts 5 from n\nprint \"After n -= 5, n = %d\" % n\nn *= 2 # multiplies n by 3\nprint \"After n *= 2, n = %d\" % n \nn /= 3 # divides n by 9\nprint \"After n /= 3, n = %d\" % n \nn %= 7 # reduces n to the remainder from dividing by 4\nprint 'After n modulo by 7 n = %d' %n",
+ "input": [
+ "\n",
+ "\n",
+ "# tests arithmetic assignment operators:\n",
+ "n=22\n",
+ "print \"n = %d\" % n\n",
+ "n += 9 # adds 9 to n\n",
+ "print \"After n += 9, n = %d\" % n\n",
+ "n -= 5 # subtracts 5 from n\n",
+ "print \"After n -= 5, n = %d\" % n\n",
+ "n *= 2 # multiplies n by 3\n",
+ "print \"After n *= 2, n = %d\" % n \n",
+ "n /= 3 # divides n by 9\n",
+ "print \"After n /= 3, n = %d\" % n \n",
+ "n %= 7 # reduces n to the remainder from dividing by 4\n",
+ "print 'After n modulo by 7 n = %d' %n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 22\nAfter n += 9, n = 31\nAfter n -= 5, n = 26\nAfter n *= 2, n = 52\nAfter n /= 3, n = 17\nAfter n modulo by 7 n = 3\n"
+ "text": [
+ "n = 22\n",
+ "After n += 9, n = 31\n",
+ "After n -= 5, n = 26\n",
+ "After n *= 2, n = 52\n",
+ "After n /= 3, n = 17\n",
+ "After n modulo by 7 n = 3\n"
+ ]
}
],
"prompt_number": 6
@@ -100,14 +196,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.7 Floating-Point Arithmetic\nThis program is nearly the same as the one in Example 2.4. The important difference is that these\nvariables are declared to have the floating-point type double instead of the integer type int.\n'''\n\n# tests the floating-point operators +, -, *, and /:\nx=54.0\ny=20.0\nprint \"x = %f and y = %f\" %(x,y)\nprint \"x+y = %f\" %(x+y) # 54.0+20.0 = 74.0\nprint \"x-y = %f\" % (x-y) # 54.0-20.0 = 34.0\nprint \"x*y = %f\" %( x*y) # 54.0*20.0 = 1080.0\nprint \"x/y = %f\" % (x/y) # 54.0/20.0 = 2.7\n",
+ "input": [
+ "\n",
+ "# tests the floating-point operators +, -, *, and /:\n",
+ "x=54.0\n",
+ "y=20.0\n",
+ "print \"x = %f and y = %f\" %(x,y)\n",
+ "print \"x+y = %f\" %(x+y) # 54.0+20.0 = 74.0\n",
+ "print \"x-y = %f\" % (x-y) # 54.0-20.0 = 34.0\n",
+ "print \"x*y = %f\" %( x*y) # 54.0*20.0 = 1080.0\n",
+ "print \"x/y = %f\" % (x/y) # 54.0/20.0 = 2.7\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 54.000000 and y = 20.000000\nx+y = 74.000000\nx-y = 34.000000\nx*y = 1080.000000\nx/y = 2.700000\n"
+ "text": [
+ "x = 54.000000 and y = 20.000000\n",
+ "x+y = 74.000000\n",
+ "x-y = 34.000000\n",
+ "x*y = 1080.000000\n",
+ "x/y = 2.700000\n"
+ ]
}
],
"prompt_number": 7
@@ -115,14 +227,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.8 Using the sizeof Operator\nThis program tells you how much space each of the undamental types uses:\nNote : Python has few number of data types so output would be differ.\n'''\nimport sys\n# prints the storage sizes of the fundamental types:\nprint \"Number of bytes used:\\n\"\n\nprint \" char: %d \" % sys.getsizeof('a')\nprint \" int : %d \" % sys.getsizeof(int(1))\nprint \" string : %d \" % sys.getsizeof(str('hellololdei'))\nprint \"float : %d\" % sys.getsizeof(float(1.1))",
+ "input": [
+ "\n",
+ "import sys\n",
+ "# prints the storage sizes of the fundamental types:\n",
+ "print \"Number of bytes used:\\n\"\n",
+ "\n",
+ "print \" char: %d \" % sys.getsizeof('a')\n",
+ "print \" int : %d \" % sys.getsizeof(int(1))\n",
+ "print \" string : %d \" % sys.getsizeof(str('hellololdei'))\n",
+ "print \"float : %d\" % sys.getsizeof(float(1.1))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Number of bytes used:\n\n char: 22 \n int : 12 \n string : 32 \nfloat : 16\n"
+ "text": [
+ "Number of bytes used:\n",
+ "\n",
+ " char: 22 \n",
+ " int : 12 \n",
+ " string : 32 \n",
+ "float : 16\n"
+ ]
}
],
"prompt_number": 8
@@ -130,14 +259,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.9 Reading from the <cfloat> Header File\nThis program tells you the precision and magnitude range that the float type has on your system:\n'''\nimport sys\n# prints the storage sizes of the fundamental types:\nfbits = 8*sys.getsizeof(float(123))\n\n# each byte contains 8 bits\nprint \"float uses : %d bits:\\n\\t\" % fbits \n",
+ "input": [
+ "\n",
+ "import sys\n",
+ "# prints the storage sizes of the fundamental types:\n",
+ "fbits = 8*sys.getsizeof(float(123))\n",
+ "\n",
+ "# each byte contains 8 bits\n",
+ "print \"float uses : %d bits:\\n\\t\" % fbits \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "float uses : 128 bits:\n\t\n"
+ "text": [
+ "float uses : 128 bits:\n",
+ "\t\n"
+ ]
}
],
"prompt_number": 9
@@ -145,14 +285,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nThis program casts a double value into int value:\n'''\n\n# casts a double value as an int:\nv = 1234.56789\nn = int(v);\nprint \"v = %f, n = %d\" %(v,n)",
+ "input": [
+ "\n",
+ "# casts a double value as an int:\n",
+ "v = 1234.56789\n",
+ "n = int(v);\n",
+ "print \"v = %f, n = %d\" %(v,n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "v = 1234.567890, n = 1234\n"
+ "text": [
+ "v = 1234.567890, n = 1234\n"
+ ]
}
],
"prompt_number": 10
@@ -160,14 +308,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.11 Promotion of Types\nThis program promotes a char to a short to an int to a float to a double:\nNote : Python is type independent. So would give output differ.\n'''\n# prints promoted vales of 65 from char to double:\nc='A'\nprint \"char c = \" + c\nk=c;\nprint \"k = \" + k \nm=k;\nprint \"m = \" + m \nn=m\nprint \"n = \" + n\nx=m\nprint \"x = \" + x \ny=x\nprint \"y = \" + y",
+ "input": [
+ "\n",
+ "# prints promoted vales of 65 from char to double:\n",
+ "c='A'\n",
+ "print \"char c = \" + c\n",
+ "k=c;\n",
+ "print \"k = \" + k \n",
+ "m=k;\n",
+ "print \"m = \" + m \n",
+ "n=m\n",
+ "print \"n = \" + n\n",
+ "x=m\n",
+ "print \"x = \" + x \n",
+ "y=x\n",
+ "print \"y = \" + y"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "char c = A\nk = A\nm = A\nn = A\nx = A\ny = A\n"
+ "text": [
+ "char c = A\n",
+ "k = A\n",
+ "m = A\n",
+ "n = A\n",
+ "x = A\n",
+ "y = A\n"
+ ]
}
],
"prompt_number": 11
@@ -175,14 +345,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.12 Integer Overflow\nThis program repeatedly multiplies n by 1000 until it overflows.\n'''\n# prints n until it overflows:\nn=1000\nprint \"n = %d\" % n\nn *= 1000 # multiplies n by 1000\nprint \"n = %d\" % n\nn *= 1000 # multiplies n by 1000\nprint \"n = %d\" % n\nn *= 1000 # multiplies n by 1000\nprint \"n = %d\" % n\n",
+ "input": [
+ "\n",
+ "# prints n until it overflows:\n",
+ "n=1000\n",
+ "print \"n = %d\" % n\n",
+ "n *= 1000 # multiplies n by 1000\n",
+ "print \"n = %d\" % n\n",
+ "n *= 1000 # multiplies n by 1000\n",
+ "print \"n = %d\" % n\n",
+ "n *= 1000 # multiplies n by 1000\n",
+ "print \"n = %d\" % n\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 1000\nn = 1000000\nn = 1000000000\nn = 1000000000000\n"
+ "text": [
+ "n = 1000\n",
+ "n = 1000000\n",
+ "n = 1000000000\n",
+ "n = 1000000000000\n"
+ ]
}
],
"prompt_number": 12
@@ -190,14 +376,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.13 Floating-point Overflow\nThis program is similar to the one in Example 2.12. It repeatedly squares x until it overflows.\n'''\n\n# prints x until it overflows:\nx=1000.0\nprint \"x = %f\" % x\nx *= x # multiplies n by itself; i.e., it squares x\nprint \"x = %f\" % x\nx *= x # multiplies n by itself; i.e., it squares x\nprint \"x = %f\" % x\nx *= x # multiplies n by itself; i.e., it squares x\nprint \"x = %f\" % x\nx *= x # multiplies n by itself; i.e., it squares x\nprint \"x = %f\" % x\n",
+ "input": [
+ "\n",
+ "# prints x until it overflows:\n",
+ "x=1000.0\n",
+ "print \"x = %f\" % x\n",
+ "x *= x # multiplies n by itself; i.e., it squares x\n",
+ "print \"x = %f\" % x\n",
+ "x *= x # multiplies n by itself; i.e., it squares x\n",
+ "print \"x = %f\" % x\n",
+ "x *= x # multiplies n by itself; i.e., it squares x\n",
+ "print \"x = %f\" % x\n",
+ "x *= x # multiplies n by itself; i.e., it squares x\n",
+ "print \"x = %f\" % x\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 1000.000000\nx = 1000000.000000\nx = 1000000000000.000000\nx = 999999999999999983222784.000000\nx = 1000000000000000043845843045076197354634047651840.000000\n"
+ "text": [
+ "x = 1000.000000\n",
+ "x = 1000000.000000\n",
+ "x = 1000000000000.000000\n",
+ "x = 999999999999999983222784.000000\n",
+ "x = 1000000000000000043845843045076197354634047651840.000000\n"
+ ]
}
],
"prompt_number": 13
@@ -205,14 +410,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.14 Round-off Error\nThis program does some simple arithmetic to illustrate roundoff error:\n'''\n\n# illustrates round-off error::\nx = 1000/3.0\nprint \"x = %f\" %x # x = 1000/3\ny = x - 333.0\nprint \"y = %f\" % y # y = 1/3\nz = 3*y - 1.0\nprint \"z = %f\" %z # z = 3(1/3) - 1\nif (z == 0):\n print \"z == 0.\\n\"\nelse:\n print \"z does not equal 0.\\n\" # z != 0\n",
+ "input": [
+ "\n",
+ "# illustrates round-off error::\n",
+ "x = 1000/3.0\n",
+ "print \"x = %f\" %x # x = 1000/3\n",
+ "y = x - 333.0\n",
+ "print \"y = %f\" % y # y = 1/3\n",
+ "z = 3*y - 1.0\n",
+ "print \"z = %f\" %z # z = 3(1/3) - 1\n",
+ "if (z == 0):\n",
+ " print \"z == 0.\\n\"\n",
+ "else:\n",
+ " print \"z does not equal 0.\\n\" # z != 0\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 333.333333\ny = 0.333333\nz = -0.000000\nz does not equal 0.\n\n"
+ "text": [
+ "x = 333.333333\n",
+ "y = 0.333333\n",
+ "z = -0.000000\n",
+ "z does not equal 0.\n",
+ "\n"
+ ]
}
],
"prompt_number": 14
@@ -220,7 +444,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.15 Hidden Round-off Error\nThis program implements the quadratic formula to solve quadratic equations.\n'''\nimport math\n\n# implements the quadratic formula\na = float(raw_input(\"Enter the coefficients of a quadratic equation:\\n a : \"))\nb = float(raw_input('b : '))\nc = float(raw_input('c : '))\n\nprint \"The equation is: \",\nprint a,\nprint \"*x*x + \",\nprint b,\nprint \"*x + \" ,\nprint c,\nprint \" = 0\" \n\nd = b*b - 4*a*c # discriminant\nsqrtd = math.sqrt(d)\nx1 = (-b + sqrtd)/(2*a)\nx2 = (-b - sqrtd)/(2*a)\nprint \"The solutions are:\"\nprint \"\\tx1 = %f\" % x1\nprint \"\\tx2 = %f\" % x2\nprint \"Check:\" \nprint \"\\ta*x1*x1 + b*x1 + c = %f\" %( a*x1*x1 + b*x1 + c)\nprint \"\\ta*x2*x2 + b*x2 + c = %f\" %( a*x2*x2 + b*x2 + c)\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "# implements the quadratic formula\n",
+ "a = float(raw_input(\"Enter the coefficients of a quadratic equation:\\n a : \"))\n",
+ "b = float(raw_input('b : '))\n",
+ "c = float(raw_input('c : '))\n",
+ "\n",
+ "print \"The equation is: \",\n",
+ "print a,\n",
+ "print \"*x*x + \",\n",
+ "print b,\n",
+ "print \"*x + \" ,\n",
+ "print c,\n",
+ "print \" = 0\" \n",
+ "\n",
+ "d = b*b - 4*a*c # discriminant\n",
+ "sqrtd = math.sqrt(d)\n",
+ "x1 = (-b + sqrtd)/(2*a)\n",
+ "x2 = (-b - sqrtd)/(2*a)\n",
+ "print \"The solutions are:\"\n",
+ "print \"\\tx1 = %f\" % x1\n",
+ "print \"\\tx2 = %f\" % x2\n",
+ "print \"Check:\" \n",
+ "print \"\\ta*x1*x1 + b*x1 + c = %f\" %( a*x1*x1 + b*x1 + c)\n",
+ "print \"\\ta*x2*x2 + b*x2 + c = %f\" %( a*x2*x2 + b*x2 + c)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -228,24 +479,39 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter the coefficients of a quadratic equation:\n a : 2\n"
+ "text": [
+ "Enter the coefficients of a quadratic equation:\n",
+ " a : 2\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "b : 1\n"
+ "text": [
+ "b : 1\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "c : -3\n"
+ "text": [
+ "c : -3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The equation is: 2.0 *x*x + 1.0 *x + -3.0 = 0\nThe solutions are:\n\tx1 = 1.000000\n\tx2 = -1.500000\nCheck:\n\ta*x1*x1 + b*x1 + c = 0.000000\n\ta*x2*x2 + b*x2 + c = 0.000000\n"
+ "text": [
+ "The equation is: 2.0 *x*x + 1.0 *x + -3.0 = 0\n",
+ "The solutions are:\n",
+ "\tx1 = 1.000000\n",
+ "\tx2 = -1.500000\n",
+ "Check:\n",
+ "\ta*x1*x1 + b*x1 + c = 0.000000\n",
+ "\ta*x2*x2 + b*x2 + c = 0.000000\n"
+ ]
}
],
"prompt_number": 15
@@ -253,7 +519,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.17 Scientific Format\nThis program shows how floating-point values may be input in scientific format:\n'''\n\n# prints double values in scientific e-format:\nx = float(raw_input(\"Enter float: \"))\nprint \"Its reciprocal is: \",\nprint 1/x ",
+ "input": [
+ "\n",
+ "\n",
+ "# prints double values in scientific e-format:\n",
+ "x = float(raw_input(\"Enter float: \"))\n",
+ "print \"Its reciprocal is: \",\n",
+ "print 1/x "
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -261,12 +534,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter float: 234.567e89\n"
+ "text": [
+ "Enter float: 234.567e89\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Its reciprocal is: 4.2631742743e-92\n"
+ "text": [
+ "Its reciprocal is: 4.2631742743e-92\n"
+ ]
}
],
"prompt_number": 16
@@ -274,7 +551,19 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.18 Scope of Variables\nNOte : Python does not have variable scopes. Once variable is declared then it stays live until program gets exit.\nso it wont give any errors.\n\n'''\n# illustrates the scope of variables:\nx = 11\n# ERROR: this is not in the scope of x\nif True:\n x = 22 # OK: this is in the scope of x\n y = 33 # ERROR: this is not in the scope of y\n x = 44 # OK: this is in the scope of x\n y = 55 # OK: this is in the scope of y\nx = 66 # OK: this is in the scope of x\ny = 77 # ERROR: this is not in the scope of y\n",
+ "input": [
+ "\n",
+ "# illustrates the scope of variables:\n",
+ "x = 11\n",
+ "# ERROR: this is not in the scope of x\n",
+ "if True:\n",
+ " x = 22 # OK: this is in the scope of x\n",
+ " y = 33 # ERROR: this is not in the scope of y\n",
+ " x = 44 # OK: this is in the scope of x\n",
+ " y = 55 # OK: this is in the scope of y\n",
+ "x = 66 # OK: this is in the scope of x\n",
+ "y = 77 # ERROR: this is not in the scope of y\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -283,14 +572,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 2.19 Nested and Parallel Scopes\nNOte : Python does not have variable scopes. Once variable is declared then it stays live until program gets exit.\nso output would be differ.\n'''\n# this x is global\nx = 11\n\nif True:\n # illustrates the nested and parallel scopes:\n x = 22\n # begin scope of internal block\n if True:\n x = 33\n print \"In block inside main(): x = %d \" % x\n # end scope of internal block\nprint \"In main(): x = %d\" %x \nprint \"In main(): x = %d \"% x",
+ "input": [
+ "\n",
+ "# this x is global\n",
+ "x = 11\n",
+ "\n",
+ "if True:\n",
+ " # illustrates the nested and parallel scopes:\n",
+ " x = 22\n",
+ " # begin scope of internal block\n",
+ " if True:\n",
+ " x = 33\n",
+ " print \"In block inside main(): x = %d \" % x\n",
+ " # end scope of internal block\n",
+ "print \"In main(): x = %d\" %x \n",
+ "print \"In main(): x = %d \"% x"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "In block inside main(): x = 33 \nIn main(): x = 33\nIn main(): x = 33 \n"
+ "text": [
+ "In block inside main(): x = 33 \n",
+ "In main(): x = 33\n",
+ "In main(): x = 33 \n"
+ ]
}
],
"prompt_number": 18
@@ -298,7 +606,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch3.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch3.ipynb
index 8a41802e..9a59031c 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch3.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch3"
+ "name": "",
+ "signature": "sha256:11b7a1493680a6b7a0a36e37cb0fb0b3cfce2dde29e20a1b991383c6bbfc7afe"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,31 +11,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.1 Testing for Divisibility\nThis program tests if one positive integer is not divisible by another:\n'''\n\nprint \"Enter two positive integers: \";\nn = int(raw_input())\nd = int(raw_input())\nif (n%d):\n print \"%d is not divisible by %d\" %(n,d)",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter two positive integers: \";\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "if (n%d):\n",
+ " print \"%d is not divisible by %d\" %(n,d)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two positive integers: \n"
+ "text": [
+ "Enter two positive integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "66\n"
+ "text": [
+ "66\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "66 is not divisible by 7\n"
+ "text": [
+ "66 is not divisible by 7\n"
+ ]
}
],
"prompt_number": 1
@@ -42,31 +59,48 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.2 Testing for Divisibility Again\nThis program is the same as the program in Example 3.1 except that the if statement has been replaced\nby an if..else statement:\n'''\nprint \"Enter two positive integers: \";\nn = int(raw_input())\nd = int(raw_input())\nif (n%d):\n print \"%d is not divisible by %d\" %(n,d)\nelse:\n print \"%d is divisible by %d\" %(n,d)\n",
+ "input": [
+ "\n",
+ "print \"Enter two positive integers: \";\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "if (n%d):\n",
+ " print \"%d is not divisible by %d\" %(n,d)\n",
+ "else:\n",
+ " print \"%d is divisible by %d\" %(n,d)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two positive integers: \n"
+ "text": [
+ "Enter two positive integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "56\n"
+ "text": [
+ "56\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "56 is divisible by 7\n"
+ "text": [
+ "56 is divisible by 7\n"
+ ]
}
],
"prompt_number": 2
@@ -74,31 +108,51 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.3 The Minimum of Two Integers\nThis program prints the minimum of the two integers entered:\n'''\n\nprint \"Enter two integers: \"\nm = int(raw_input())\nn = int(raw_input())\n\nif (m < n):\n print \"%d is the minimum.\" %m\nelse:\n print \"%d is the minimum.\" %n\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter two integers: \"\n",
+ "m = int(raw_input())\n",
+ "n = int(raw_input())\n",
+ "\n",
+ "if (m < n):\n",
+ " print \"%d is the minimum.\" %m\n",
+ "else:\n",
+ " print \"%d is the minimum.\" %n\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "55 is the minimum.\n"
+ "text": [
+ "55 is the minimum.\n"
+ ]
}
],
"prompt_number": 3
@@ -106,7 +160,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.4 A Common Programming Error\nThis program is erroneous:\n'''\nprint \"Enter an integer: \"\nn = int(raw_input())\nif (n = 22):\n print \"%d = 22\" %n\nelse: \n print \"%d != 22\" %n",
+ "input": [
+ "\n",
+ "print \"Enter an integer: \"\n",
+ "n = int(raw_input())\n",
+ "if (n = 22):\n",
+ " print \"%d = 22\" %n\n",
+ "else: \n",
+ " print \"%d != 22\" %n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -124,37 +186,61 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.5 The Minimum of Three Integers\nThis program is similar to the one in Example 3.3 except that it applies to three integers:\n'''\nprint \"Enter three integers: \"\nn1 = int(raw_input())\nn2 = int(raw_input())\nn3 = int(raw_input())\n\nm=n1\n# now min <= n1\nif (n2 < m):\n m = n2 # now min <= n1 and min <= n2\nif (n3 < m):\n m = n3 # now min <= n1, min <= n2, and min <= n3\nprint \"Their minimum is %d\" % m",
+ "input": [
+ "\n",
+ "print \"Enter three integers: \"\n",
+ "n1 = int(raw_input())\n",
+ "n2 = int(raw_input())\n",
+ "n3 = int(raw_input())\n",
+ "\n",
+ "m=n1\n",
+ "# now min <= n1\n",
+ "if (n2 < m):\n",
+ " m = n2 # now min <= n1 and min <= n2\n",
+ "if (n3 < m):\n",
+ " m = n3 # now min <= n1, min <= n2, and min <= n3\n",
+ "print \"Their minimum is %d\" % m"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter three integers: \n"
+ "text": [
+ "Enter three integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Their minimum is 33\n"
+ "text": [
+ "Their minimum is 33\n"
+ ]
}
],
"prompt_number": 5
@@ -162,31 +248,53 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.6 A Statement Block within an if Statement\nThis program inputs two integers and then outputs them in increasing order:\n'''\n\nprint \"Enter two integers: \"\nx = int(raw_input())\ny = int(raw_input())\n\nif (x > y):\n temp=x\n x = y\n y = temp\n \n\nprint \"%d <= %d\" %(x,y)",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter two integers: \"\n",
+ "x = int(raw_input())\n",
+ "y = int(raw_input())\n",
+ "\n",
+ "if (x > y):\n",
+ " temp=x\n",
+ " x = y\n",
+ " y = temp\n",
+ " \n",
+ "\n",
+ "print \"%d <= %d\" %(x,y)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "66\n"
+ "text": [
+ "66\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "44 <= 66\n"
+ "text": [
+ "44 <= 66\n"
+ ]
}
],
"prompt_number": 6
@@ -194,25 +302,52 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.7 Using Blocks to Limit Scope\nThis program uses the same name n for three different variables:\n'''\nn=44\nprint \"n = %d\" % n \nif True:\n # scope extends over 4 lines\n print \"Enter an integer: \"\n n = int(raw_input())\n print \"n = %d\" % n \n\nif True:\n print \"n = %d\" % n \n # the n that was declared first\nif True:\n print \"n = %d\" % n \n\nprint \"n = %d\" % n ",
+ "input": [
+ "\n",
+ "n=44\n",
+ "print \"n = %d\" % n \n",
+ "if True:\n",
+ " # scope extends over 4 lines\n",
+ " print \"Enter an integer: \"\n",
+ " n = int(raw_input())\n",
+ " print \"n = %d\" % n \n",
+ "\n",
+ "if True:\n",
+ " print \"n = %d\" % n \n",
+ " # the n that was declared first\n",
+ "if True:\n",
+ " print \"n = %d\" % n \n",
+ "\n",
+ "print \"n = %d\" % n "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\nEnter an integer: \n"
+ "text": [
+ "n = 44\n",
+ "Enter an integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 77\nn = 77\nn = 77\nn = 77\n"
+ "text": [
+ "n = 77\n",
+ "n = 77\n",
+ "n = 77\n",
+ "n = 77\n"
+ ]
}
],
"prompt_number": 7
@@ -220,37 +355,60 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.8 Using Compound Conditions\nThis program has the same effect as the one in Example 3.5 on page 39. This version uses compound\nconditions to find the minimum of three integers:\n'''\nprint \"Enter three integers: \"\nn1 = int(raw_input())\nn2 = int(raw_input())\nn3 = int(raw_input())\nif (n1 <= n2 and n1 <= n3):\n print \"Their minimum is %d\" % n1\n \nif (n2 <= n1 and n2 <= n3):\n print \"Their minimum is %d \" % n2 \nif (n3 <= n1 and n3 <= n2):\n print \"Their minimum is %d\" % n3 \n",
+ "input": [
+ "\n",
+ "print \"Enter three integers: \"\n",
+ "n1 = int(raw_input())\n",
+ "n2 = int(raw_input())\n",
+ "n3 = int(raw_input())\n",
+ "if (n1 <= n2 and n1 <= n3):\n",
+ " print \"Their minimum is %d\" % n1\n",
+ " \n",
+ "if (n2 <= n1 and n2 <= n3):\n",
+ " print \"Their minimum is %d \" % n2 \n",
+ "if (n3 <= n1 and n3 <= n2):\n",
+ " print \"Their minimum is %d\" % n3 \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter three integers: \n"
+ "text": [
+ "Enter three integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Their minimum is 33 \n"
+ "text": [
+ "Their minimum is 33 \n"
+ ]
}
],
"prompt_number": 8
@@ -258,25 +416,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.9 User-Friendly Input\nThis program allows the user to input either a 'Y' or a 'y' for 'yes':\n'''\n\nprint \"Are you enrolled (y/n): \"\nans = raw_input()\nif (ans == 'Y' or ans == 'y'):\n print \"You are enrolled.\\n\"\nelse: \n print \"You are not enrolled.\\n\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Are you enrolled (y/n): \"\n",
+ "ans = raw_input()\n",
+ "if (ans == 'Y' or ans == 'y'):\n",
+ " print \"You are enrolled.\\n\"\n",
+ "else: \n",
+ " print \"You are not enrolled.\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Are you enrolled (y/n): \n"
+ "text": [
+ "Are you enrolled (y/n): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "y\n"
+ "text": [
+ "y\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "You are enrolled.\n\n"
+ "text": [
+ "You are enrolled.\n",
+ "\n"
+ ]
}
],
"prompt_number": 9
@@ -284,31 +458,50 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.10 Short-Circuiting\nThis program tests integer divisibility:\n'''\n\nprint \"Enter two positive integers: \";\nn = int(raw_input())\nd = int(raw_input())\n\nif (d != 0 and n%d == 0): \n print \"%d divides %d\" %(d,n)\nelse:\n print \"%d does not divide %d\"% (d,n)",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter two positive integers: \";\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "\n",
+ "if (d != 0 and n%d == 0): \n",
+ " print \"%d divides %d\" %(d,n)\n",
+ "else:\n",
+ " print \"%d does not divide %d\"% (d,n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two positive integers: \n"
+ "text": [
+ "Enter two positive integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "6\n"
+ "text": [
+ "6\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "6 does not divide 33\n"
+ "text": [
+ "6 does not divide 33\n"
+ ]
}
],
"prompt_number": 10
@@ -316,32 +509,49 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.11 Another Logical Error\nThis program is erroneous:\n'''\nprint \"Enter three integers: \"\nn1 = int(raw_input())\nn2 = int(raw_input())\nn3 = int(raw_input())\n\nif (n1 >= n2 >= n3):\n print \"max = x\"",
+ "input": [
+ "\n",
+ "print \"Enter three integers: \"\n",
+ "n1 = int(raw_input())\n",
+ "n2 = int(raw_input())\n",
+ "n3 = int(raw_input())\n",
+ "\n",
+ "if (n1 >= n2 >= n3):\n",
+ " print \"max = x\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter three integers: \n"
+ "text": [
+ "Enter three integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
}
],
"prompt_number": 11
@@ -349,31 +559,53 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.12 Nesting Selection Statements\nThis program has the same effect as the one in Example 3.10 on page 42:\n'''\nprint \"Enter two positive integers: \"\nn = int(raw_input())\nd = int(raw_input())\n\nif (d != 0):\n if (n%d == 0):\n print d,\n print \" divides %d\" % n \n else:\n print \"%d does not divide %d\" %(d,n)\nelse:\n print '%d does not divide %d '%(d,n)",
+ "input": [
+ "\n",
+ "print \"Enter two positive integers: \"\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "\n",
+ "if (d != 0):\n",
+ " if (n%d == 0):\n",
+ " print d,\n",
+ " print \" divides %d\" % n \n",
+ " else:\n",
+ " print \"%d does not divide %d\" %(d,n)\n",
+ "else:\n",
+ " print '%d does not divide %d '%(d,n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two positive integers: \n"
+ "text": [
+ "Enter two positive integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "44 does not divide 55\n"
+ "text": [
+ "44 does not divide 55\n"
+ ]
}
],
"prompt_number": 12
@@ -381,37 +613,63 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.13 Using Nested Selection Statements\nThis program has the same effect as those in Example 3.5 on page 39 and Example 3.8 on page 41.\nThis version uses nested if..else statements to find the minimum of three integers:\n'''\nprint \"Enter three integers: \"\nn1 = int(raw_input())\nn2 = int(raw_input())\nn3 = int(raw_input())\nif (n1 < n2):\n if (n1 < n3):\n print \"Their minimum is : %d\" % n1\n else:\n print \"Their minimum is : %d\" % n3\nelse: # n1 >= n2\n if (n2 < n3):\n print \"Their minimum is : %d\" % n2\n else:\n print \"Their minimum is %d\" % n3",
+ "input": [
+ "\n",
+ "print \"Enter three integers: \"\n",
+ "n1 = int(raw_input())\n",
+ "n2 = int(raw_input())\n",
+ "n3 = int(raw_input())\n",
+ "if (n1 < n2):\n",
+ " if (n1 < n3):\n",
+ " print \"Their minimum is : %d\" % n1\n",
+ " else:\n",
+ " print \"Their minimum is : %d\" % n3\n",
+ "else: # n1 >= n2\n",
+ " if (n2 < n3):\n",
+ " print \"Their minimum is : %d\" % n2\n",
+ " else:\n",
+ " print \"Their minimum is %d\" % n3"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter three integers: \n"
+ "text": [
+ "Enter three integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Their minimum is : 33\n"
+ "text": [
+ "Their minimum is : 33\n"
+ ]
}
],
"prompt_number": 13
@@ -419,58 +677,117 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.14 A Guessing Game\nThis program finds a number that the user selects from 1 to 8:\n'''\n\nprint \"Pick a number from 1 to 8.\" \nanswer = int(raw_input())\nprint \"Is it less than 5? (y|n): \"\nanswer = raw_input()\nif (answer == 'y'): # 1 <= n <= 4\n print \"Is it less than 3? (y|n): \"\n answer = raw_input() \n if (answer == 'y'): # 1 <= n <= 2\n print \"Is it less than 2? (y|n): \"\n answer = raw_input()\n if (answer == 'y'):\n print \"Your number is 1.\"\n else:\n print \"Your number is 2.\"\n else: # 3 <= n <= 4\n print \"Is it less than 4? (y|n): \"\n answer = raw_input()\n if (answer == 'y'):\n print \"Your number is 3.\"\n else:\n print \"Your number is 4.\"\nelse: # 5 <= n <= 8\n print \"Is it less than 7? (y|n): \"\n answer = raw_input()\n if (answer == 'y'): # 5 <= n <= 6\n print \"Is it less than 6? (y|n): \"\n answer = raw_input()\n if (answer == 'y'):\n print \"Your number is 5.\"\n else:\n print \"Your number is 6.\" \n else: # 7 <= n <= 8\n print \"Is it less than 8? (y|n): \"\n answer = raw_input()\n if (answer == 'y'):\n print \"Your number is 7.\" \n else:\n print \"Your number is 8.\"",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Pick a number from 1 to 8.\" \n",
+ "answer = int(raw_input())\n",
+ "print \"Is it less than 5? (y|n): \"\n",
+ "answer = raw_input()\n",
+ "if (answer == 'y'): # 1 <= n <= 4\n",
+ " print \"Is it less than 3? (y|n): \"\n",
+ " answer = raw_input() \n",
+ " if (answer == 'y'): # 1 <= n <= 2\n",
+ " print \"Is it less than 2? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'):\n",
+ " print \"Your number is 1.\"\n",
+ " else:\n",
+ " print \"Your number is 2.\"\n",
+ " else: # 3 <= n <= 4\n",
+ " print \"Is it less than 4? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'):\n",
+ " print \"Your number is 3.\"\n",
+ " else:\n",
+ " print \"Your number is 4.\"\n",
+ "else: # 5 <= n <= 8\n",
+ " print \"Is it less than 7? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'): # 5 <= n <= 6\n",
+ " print \"Is it less than 6? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'):\n",
+ " print \"Your number is 5.\"\n",
+ " else:\n",
+ " print \"Your number is 6.\" \n",
+ " else: # 7 <= n <= 8\n",
+ " print \"Is it less than 8? (y|n): \"\n",
+ " answer = raw_input()\n",
+ " if (answer == 'y'):\n",
+ " print \"Your number is 7.\" \n",
+ " else:\n",
+ " print \"Your number is 8.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Pick a number from 1 to 8.\n"
+ "text": [
+ "Pick a number from 1 to 8.\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "6\n"
+ "text": [
+ "6\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Is it less than 5? (y|n): \n"
+ "text": [
+ "Is it less than 5? (y|n): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "n\n"
+ "text": [
+ "n\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Is it less than 7? (y|n): \n"
+ "text": [
+ "Is it less than 7? (y|n): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "y\n"
+ "text": [
+ "y\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Is it less than 6? (y|n): \n"
+ "text": [
+ "Is it less than 6? (y|n): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "n\n"
+ "text": [
+ "n\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Your number is 6.\n"
+ "text": [
+ "Your number is 6.\n"
+ ]
}
],
"prompt_number": 14
@@ -478,7 +795,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.15 Using the else if Construct for Parallel Alternatives\nThis program requests the users language and then prints a greeting in that language:\n'''\nlanguage = raw_input(\"Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): \")\n\nif (language == 'e'): \n print \"Welcome to ProjectEuclid.\"\nelif (language == 'f'):\n print \"Bon jour, ProjectEuclid.\"\nelif (language == 'g'):\n print \"Guten tag, ProjectEuclid.\"\nelif (language == 'i'):\n print \"Bon giorno, ProjectEuclid.\"\nelif (language == 'r'):\n print \"Dobre utre, ProjectEuclid.\"\nelse:\n print \"Sorry; we don't speak your language.\"\n",
+ "input": [
+ "\n",
+ "language = raw_input(\"Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): \")\n",
+ "\n",
+ "if (language == 'e'): \n",
+ " print \"Welcome to ProjectEuclid.\"\n",
+ "elif (language == 'f'):\n",
+ " print \"Bon jour, ProjectEuclid.\"\n",
+ "elif (language == 'g'):\n",
+ " print \"Guten tag, ProjectEuclid.\"\n",
+ "elif (language == 'i'):\n",
+ " print \"Bon giorno, ProjectEuclid.\"\n",
+ "elif (language == 'r'):\n",
+ " print \"Dobre utre, ProjectEuclid.\"\n",
+ "else:\n",
+ " print \"Sorry; we don't speak your language.\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -486,12 +819,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): i\n"
+ "text": [
+ "Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): i\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Bon giorno, ProjectEuclid.\n"
+ "text": [
+ "Bon giorno, ProjectEuclid.\n"
+ ]
}
],
"prompt_number": 15
@@ -499,7 +836,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.16 Using the else if Construct to Select a Range of Scores\nThis program converts a test score into its equivalent letter grade:\n'''\nscore = int(raw_input(\"Enter your test score: \"))\na = int(score/10)\nif a == 10 or a == 9:\n print \"Your grade is an A.\"\nelif a == 8:\n print \"Your grade is a B.\" \nelif a == 7:\n print \"Your grade is a C.\" \nelif a == 6:\n print \"Your grade is a D.\"\nelif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n print \"Your grade is an F.\" \nelse:\n print \"Error: score is out of range.\\n\"\n",
+ "input": [
+ "\n",
+ "score = int(raw_input(\"Enter your test score: \"))\n",
+ "a = int(score/10)\n",
+ "if a == 10 or a == 9:\n",
+ " print \"Your grade is an A.\"\n",
+ "elif a == 8:\n",
+ " print \"Your grade is a B.\" \n",
+ "elif a == 7:\n",
+ " print \"Your grade is a C.\" \n",
+ "elif a == 6:\n",
+ " print \"Your grade is a D.\"\n",
+ "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n",
+ " print \"Your grade is an F.\" \n",
+ "else:\n",
+ " print \"Error: score is out of range.\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -507,12 +860,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your test score: 83\n"
+ "text": [
+ "Enter your test score: 83\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Your grade is a B.\n"
+ "text": [
+ "Your grade is a B.\n"
+ ]
}
],
"prompt_number": 16
@@ -520,7 +877,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.17 Using a switch Statement to Select a Range of Scores\nThis program has the same effect as the one in Example 3.16:\n'''\nscore = int(raw_input(\"Enter your test score: \"))\na = int(score/10)\nif a == 10 or a == 9:\n print \"Your grade is an A.\"\nelif a == 8:\n print \"Your grade is a B.\" \nelif a == 7:\n print \"Your grade is a C.\" \nelif a == 6:\n print \"Your grade is a D.\"\nelif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n print \"Your grade is an F.\" \nelse:\n print \"Error: score is out of range.\\n\"\n\nprint \"Goodbye.\"",
+ "input": [
+ "\n",
+ "score = int(raw_input(\"Enter your test score: \"))\n",
+ "a = int(score/10)\n",
+ "if a == 10 or a == 9:\n",
+ " print \"Your grade is an A.\"\n",
+ "elif a == 8:\n",
+ " print \"Your grade is a B.\" \n",
+ "elif a == 7:\n",
+ " print \"Your grade is a C.\" \n",
+ "elif a == 6:\n",
+ " print \"Your grade is a D.\"\n",
+ "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n",
+ " print \"Your grade is an F.\" \n",
+ "else:\n",
+ " print \"Error: score is out of range.\\n\"\n",
+ "\n",
+ "print \"Goodbye.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -528,12 +903,17 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your test score: 83\n"
+ "text": [
+ "Enter your test score: 83\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Your grade is a B.\nGoodbye.\n"
+ "text": [
+ "Your grade is a B.\n",
+ "Goodbye.\n"
+ ]
}
],
"prompt_number": 17
@@ -541,7 +921,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.18 An Erroneous Fall-through in a switch Statement\nThis program was intended to have the same effect as the one in Example 3.17. But with\nstatements, the program execution falls through all the case statements it encounters:\n'''\nscore = int(raw_input(\"Enter your test score: \"))\na = int(score/10)\nif a == 10 or a == 9:\n print \"Your grade is an A.\"\nelif a == 8:\n print \"Your grade is a B.\" \nelif a == 7:\n print \"Your grade is a C.\" \nelif a == 6:\n print \"Your grade is a D.\"\nelif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n print \"Your grade is an F.\" \nelse:\n print \"Error: score is out of range.\\n\"\n\nprint \"Goodbye.\"",
+ "input": [
+ "\n",
+ "score = int(raw_input(\"Enter your test score: \"))\n",
+ "a = int(score/10)\n",
+ "if a == 10 or a == 9:\n",
+ " print \"Your grade is an A.\"\n",
+ "elif a == 8:\n",
+ " print \"Your grade is a B.\" \n",
+ "elif a == 7:\n",
+ " print \"Your grade is a C.\" \n",
+ "elif a == 6:\n",
+ " print \"Your grade is a D.\"\n",
+ "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n",
+ " print \"Your grade is an F.\" \n",
+ "else:\n",
+ " print \"Error: score is out of range.\\n\"\n",
+ "\n",
+ "print \"Goodbye.\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -549,12 +947,17 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter your test score: 83\n"
+ "text": [
+ "Enter your test score: 83\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Your grade is a B.\nGoodbye.\n"
+ "text": [
+ "Your grade is a B.\n",
+ "Goodbye.\n"
+ ]
}
],
"prompt_number": 18
@@ -562,31 +965,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 3.19 Finding the Minimum Again\n'''\n\nprint \"Enter two integers: \"\nm = int(raw_input())\nn = int(raw_input())\nprint min(m,n),\nprint 'is the minimum'",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter two integers: \"\n",
+ "m = int(raw_input())\n",
+ "n = int(raw_input())\n",
+ "print min(m,n),\n",
+ "print 'is the minimum'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "33 is the minimum\n"
+ "text": [
+ "33 is the minimum\n"
+ ]
}
],
"prompt_number": 19
@@ -594,7 +1013,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch4.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch4.ipynb
index d137f53e..3c0afba2 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch4.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch4"
+ "name": "",
+ "signature": "sha256:f4ac3c8a3319ce3724a4367884b8f78c4152f64a5f7a4c1bcc6365ff895fb824"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,25 +11,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.1 Using a while Loop to Compute a Sum of Consecutive Integers\nThis program computes the sum 1 + 2 + 3 + + n for an input integer n:\n'''\ni=1\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0\nwhile (i <= n):\n s += i\n i += 1\nprint \"The sum of the first %d integers is %d\" %(i,s)",
+ "input": [
+ "\n",
+ "i=1\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "while (i <= n):\n",
+ " s += i\n",
+ " i += 1\n",
+ "print \"The sum of the first %d integers is %d\" %(i,s)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 6 integers is 15\n"
+ "text": [
+ "The sum of the first 6 integers is 15\n"
+ ]
}
],
"prompt_number": 1
@@ -36,25 +53,43 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.2 Using a while Loop to Compute a Sum of Reciprocals\nThis program computes the sum of reciprocals s = 1 + 1/2 + 1/3 + 1/n where n is\ninteger for which n is greater than s\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\ns=0.0\ni=0\nwhile (s < bound):\n i += 1\n s += 1.0/i\n\nprint \"The sum of the first %d reciprocals is %f\" %(i,s)",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "s=0.0\n",
+ "i=0\n",
+ "while (s < bound):\n",
+ " i += 1\n",
+ " s += 1.0/i\n",
+ "\n",
+ "print \"The sum of the first %d reciprocals is %f\" %(i,s)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 83 reciprocals is 5.002068\n"
+ "text": [
+ "The sum of the first 83 reciprocals is 5.002068\n"
+ ]
}
],
"prompt_number": 2
@@ -62,42 +97,65 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.3 Using a while Loop to Repeat a Computation\nThis program prints the square root of each number input by the user. It uses a while loop to allow any\nnumber of computations in a single run of the program:\n'''\nimport math\nprint \"Enter a positive number: \"\nx = float(raw_input())\nwhile (x > 0):\n print \"sqrt(%d) = %f \"%(x,math.sqrt(x))\n print \"Enter another positive number (or 0 to quit): \"\n x = float(raw_input())\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "print \"Enter a positive number: \"\n",
+ "x = float(raw_input())\n",
+ "while (x > 0):\n",
+ " print \"sqrt(%d) = %f \"%(x,math.sqrt(x))\n",
+ " print \"Enter another positive number (or 0 to quit): \"\n",
+ " x = float(raw_input())\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive number: \n"
+ "text": [
+ "Enter a positive number: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "sqrt(5) = 2.236068 \nEnter another positive number (or 0 to quit): \n"
+ "text": [
+ "sqrt(5) = 2.236068 \n",
+ "Enter another positive number (or 0 to quit): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "sqrt(3) = 1.732051 \nEnter another positive number (or 0 to quit): \n"
+ "text": [
+ "sqrt(3) = 1.732051 \n",
+ "Enter another positive number (or 0 to quit): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
}
],
"prompt_number": 3
@@ -105,25 +163,43 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.4 Using a break Statement to Terminate a Loop\nThis program has the same effect as the one in Example 4.1 on page 60:\n'''\ni=1\nprint \"Enter a positive integer: \";\nn = int(raw_input())\ns=0\nwhile(True):\n if (i > n):\n break # terminates the loop immediately\n s += i\n i += 1\nprint \"The sum of the first %d integers is %d\" %(n,s)",
+ "input": [
+ "\n",
+ "i=1\n",
+ "print \"Enter a positive integer: \";\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "while(True):\n",
+ " if (i > n):\n",
+ " break # terminates the loop immediately\n",
+ " s += i\n",
+ " i += 1\n",
+ "print \"The sum of the first %d integers is %d\" %(n,s)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 5 integers is 15\n"
+ "text": [
+ "The sum of the first 5 integers is 15\n"
+ ]
}
],
"prompt_number": 5
@@ -131,25 +207,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.5 The Fibonacci Numbers\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\nf0=0\nf1=1\nwhile (True):\n f2 = f0 + f1\n if (f2 > bound):\n break\n print \", %d\" % f2,\n f0 = f1\n f1 = f2\n ",
+ "input": [
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n",
+ "f0=0\n",
+ "f1=1\n",
+ "while (True):\n",
+ " f2 = f0 + f1\n",
+ " if (f2 > bound):\n",
+ " break\n",
+ " print \", %d\" % f2,\n",
+ " f0 = f1\n",
+ " f1 = f2\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Fibonacci numbers < 10:\n0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ "text": [
+ "Fibonacci numbers < 10:\n",
+ "0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ ]
}
],
"prompt_number": 6
@@ -157,20 +255,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.6 Using the exit(0) Function\nThe exit() function provides another way to terminate a loop. When it executes, it terminates the\nprogram itself:\n'''\nimport sys\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\nf0=0\nf1=1\nwhile (True):\n f2 = f0 + f1\n if (f2 > bound):\n sys.exit(0)\n print \", %d\" % f2,\n f0 = f1\n f1 = f2\n ",
+ "input": [
+ "\n",
+ "import sys\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n",
+ "f0=0\n",
+ "f1=1\n",
+ "while (True):\n",
+ " f2 = f0 + f1\n",
+ " if (f2 > bound):\n",
+ " sys.exit(0)\n",
+ " print \", %d\" % f2,\n",
+ " f0 = f1\n",
+ " f1 = f2\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"ename": "SystemExit",
@@ -184,12 +302,17 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "Fibonacci numbers < 10:\n0, 1 , 1 , 2 , 3 , 5 , 8"
+ "text": [
+ "Fibonacci numbers < 10:\n",
+ "0, 1 , 1 , 2 , 3 , 5 , 8"
+ ]
},
{
"output_type": "stream",
"stream": "stderr",
- "text": "To exit: use 'exit', 'quit', or Ctrl-D.\n"
+ "text": [
+ "To exit: use 'exit', 'quit', or Ctrl-D.\n"
+ ]
}
],
"prompt_number": 7
@@ -197,25 +320,49 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.7 Aborting Infinite Loop\nWithout some termination mechanism, the loop will run forever. To abort its execution after it starts,\npress <Ctrl>+C (i.e., hold the Ctrl key down and press the C key on your keyboard):\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\nf0=0\nf1=1\n# Error : infinite loop !\nwhile (True):\n f2 = f0 + f1\n # By commenting the below if statement, it goes to infinite.\n if (f2 > bound):\n break\n print \", %d\" % f2,\n f0 = f1\n f1 = f2",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n",
+ "f0=0\n",
+ "f1=1\n",
+ "# Error : infinite loop !\n",
+ "while (True):\n",
+ " f2 = f0 + f1\n",
+ " # By commenting the below if statement, it goes to infinite.\n",
+ " if (f2 > bound):\n",
+ " break\n",
+ " print \", %d\" % f2,\n",
+ " f0 = f1\n",
+ " f1 = f2"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Fibonacci numbers < 10:\n0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ "text": [
+ "Fibonacci numbers < 10:\n",
+ "0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ ]
}
],
"prompt_number": 2
@@ -223,14 +370,35 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.7 Aborting Infinite Loop\nWithout some termination mechanism, the loop will run forever. To abort its execution after it starts,\npress <Ctrl>+C (i.e., hold the Ctrl key down and press the C key on your keyboard):\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\nf0=0\nf1=1\n# Error : infinite loop !\nwhile (True):\n f2 = f0 + f1\n # By commenting the below if statement, it goes to infinite.\n if (f2 > bound):\n break\n print \", %d\" % f2,\n f0 = f1\n f1 = f2",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n",
+ "f0=0\n",
+ "f1=1\n",
+ "# Error : infinite loop !\n",
+ "while (True):\n",
+ " f2 = f0 + f1\n",
+ " # By commenting the below if statement, it goes to infinite.\n",
+ " if (f2 > bound):\n",
+ " break\n",
+ " print \", %d\" % f2,\n",
+ " f0 = f1\n",
+ " f1 = f2"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \nFibonacci numbers < 10:\n0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ "text": [
+ "Enter a positive integer: \n",
+ "Fibonacci numbers < 10:\n",
+ "0, 1 , 1 , 2 , 3 , 5 , 8\n"
+ ]
}
],
"prompt_number": 1
@@ -238,25 +406,41 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.8 Using a do..while Loop to Compute a Sum of Consecutive Integers\nThis program has the same effect as the one in Example 4.1 on page 60:\n'''\ni=0\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0\nwhile i<=n:\n s += i\n i += 1\nprint \"The sum of the first %d integers is %d\" %(n,s)\n",
+ "input": [
+ "\n",
+ "i=0\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "while i<=n:\n",
+ " s += i\n",
+ " i += 1\n",
+ "print \"The sum of the first %d integers is %d\" %(n,s)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 10 integers is 55\n"
+ "text": [
+ "The sum of the first 10 integers is 55\n"
+ ]
}
],
"prompt_number": 3
@@ -264,25 +448,43 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.9 The Factorial Numbers\n'''\n\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\nprint \"Factorial numbers < %d:\\n1, 1\" %bound,\nf=1\ni=1\nwhile f < bound:\n i += 1\n f *= i\n print \", %d\" %f,\n",
+ "input": [
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "print \"Factorial numbers < %d:\\n1, 1\" %bound,\n",
+ "f=1\n",
+ "i=1\n",
+ "while f < bound:\n",
+ " i += 1\n",
+ " f *= i\n",
+ " print \", %d\" %f,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Factorial numbers < 10:\n1, 1 , 2 , 6 , 24\n"
+ "text": [
+ "Factorial numbers < 10:\n",
+ "1, 1 , 2 , 6 , 24\n"
+ ]
}
],
"prompt_number": 4
@@ -290,25 +492,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.10 Using a for Loop to Compute a Sum of Consecutive Integers\nThis program has the same effect as the one in Example 4.1 on page 60:\n'''\n\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0;\nfor i in range(0,n+1):\n s += i\nprint \"The sum of the first %d integers is %d\" %(n,s)\n",
+ "input": [
+ "\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0;\n",
+ "for i in range(0,n+1):\n",
+ " s += i\n",
+ "print \"The sum of the first %d integers is %d\" %(n,s)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 10 integers is 55\n"
+ "text": [
+ "The sum of the first 10 integers is 55\n"
+ ]
}
],
"prompt_number": 5
@@ -316,25 +533,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.11 Reusing for Loop Control Variable Names\nThis program has the same effect as the one in Example 4.1 on page 60:\n'''\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0\nfor i in range(1,n/2): # the scope of this i is this loop\n s += i\n\nfor i in range(n/2,n+1): # the scope of this i is this loop\n s += i\nprint \"The sum of the first %d integers is %d\" % (n,s)\n",
+ "input": [
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "for i in range(1,n/2): # the scope of this i is this loop\n",
+ " s += i\n",
+ "\n",
+ "for i in range(n/2,n+1): # the scope of this i is this loop\n",
+ " s += i\n",
+ "print \"The sum of the first %d integers is %d\" % (n,s)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 10 integers is 55\n"
+ "text": [
+ "The sum of the first 10 integers is 55\n"
+ ]
}
],
"prompt_number": 6
@@ -342,25 +576,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.12 The Factorial Numbers Again\nThis program has the same effect as the one in Example 4.9 on page 65:\n'''\nprint \"Enter a positive integer: \"\nbound = int(raw_input())\n\nprint \"Factorial numbers that are <= %d:\\n1, 1\" %bound,\nf=1\nfor i in range(2,bound+1):\n f *= i\n print \", %d\" % f,\n",
+ "input": [
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "bound = int(raw_input())\n",
+ "\n",
+ "print \"Factorial numbers that are <= %d:\\n1, 1\" %bound,\n",
+ "f=1\n",
+ "for i in range(2,bound+1):\n",
+ " f *= i\n",
+ " print \", %d\" % f,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Factorial numbers that are <= 10:\n1, 1 , 2 , 6 , 24 , 120 , 720 , 5040 , 40320 , 362880 , 3628800\n"
+ "text": [
+ "Factorial numbers that are <= 10:\n",
+ "1, 1 , 2 , 6 , 24 , 120 , 720 , 5040 , 40320 , 362880 , 3628800\n"
+ ]
}
],
"prompt_number": 7
@@ -368,14 +619,20 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.13 Using a Descending for Loop\nThis program prints the first ten positive integers in reverse order:\n'''\n\nfor i in range(10,0,-1):\n print i,\n",
+ "input": [
+ "\n",
+ "for i in range(10,0,-1):\n",
+ " print i,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10 9 8 7 6 5 4 3 2 1\n"
+ "text": [
+ "10 9 8 7 6 5 4 3 2 1\n"
+ ]
}
],
"prompt_number": 8
@@ -383,25 +640,52 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.14 Using a for Loop with a Step Greater than One\nThis program determines whether an input number is prime:\n'''\nprime = True\nprint \"Enter a positive integer: \"\nn = int(raw_input())\nif (n < 2):\n print \"%d is not prime.\" %n\n prime = False\nelif (n < 4):\n print \"%d is prime.\" %n\n prime = False\nelif (n%2 == 0):\n print \"%d = 2* %d\" %(n,n/2)\n prime = False\nelse:\n for d in range(3,n/2+1):\n if (n%d == 0):\n print \"%d = %d * %d\" %(n,d,n/d)\n prime = False\nif prime: \n print \"%d is prime.\"%n\n",
+ "input": [
+ "\n",
+ "prime = True\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "if (n < 2):\n",
+ " print \"%d is not prime.\" %n\n",
+ " prime = False\n",
+ "elif (n < 4):\n",
+ " print \"%d is prime.\" %n\n",
+ " prime = False\n",
+ "elif (n%2 == 0):\n",
+ " print \"%d = 2* %d\" %(n,n/2)\n",
+ " prime = False\n",
+ "else:\n",
+ " for d in range(3,n/2+1):\n",
+ " if (n%d == 0):\n",
+ " print \"%d = %d * %d\" %(n,d,n/d)\n",
+ " prime = False\n",
+ "if prime: \n",
+ " print \"%d is prime.\"%n\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "11\n"
+ "text": [
+ "11\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "11 is prime.\n"
+ "text": [
+ "11 is prime.\n"
+ ]
}
],
"prompt_number": 9
@@ -409,49 +693,74 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.15 Using a Sentinel to Control a for Loop\nThis program finds the maximum of a sequence of input numbers:\n'''\nprint \"Enter positive integers (0 to quit): \";\nn = int(raw_input())\nm = n\nwhile n > 0:\n n = int(raw_input())\n if n > m :\n m = n\n\nprint \"max = %d\" % m",
+ "input": [
+ "\n",
+ "print \"Enter positive integers (0 to quit): \";\n",
+ "n = int(raw_input())\n",
+ "m = n\n",
+ "while n > 0:\n",
+ " n = int(raw_input())\n",
+ " if n > m :\n",
+ " m = n\n",
+ "\n",
+ "print \"max = %d\" % m"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter positive integers (0 to quit): \n"
+ "text": [
+ "Enter positive integers (0 to quit): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "19\n"
+ "text": [
+ "19\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "42\n"
+ "text": [
+ "42\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "max = 42\n"
+ "text": [
+ "max = 42\n"
+ ]
}
],
"prompt_number": 10
@@ -459,49 +768,75 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.16 Using a Loop Invariant to Prove that a for Loop is Correct\nThis program finds the minimum of a sequence of input numbers. It is similar to the program in\nExample 4.15:\n'''\n\nprint \"Enter positive integers (0 to quit): \";\nn = int(raw_input())\nm = n\nwhile n > 0: \n if n < m :\n m = n\n n = int(raw_input())\n\nprint \"min = %d\" % m\n\n",
+ "input": [
+ "\n",
+ "print \"Enter positive integers (0 to quit): \";\n",
+ "n = int(raw_input())\n",
+ "m = n\n",
+ "while n > 0: \n",
+ " if n < m :\n",
+ " m = n\n",
+ " n = int(raw_input())\n",
+ "\n",
+ "print \"min = %d\" % m\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter positive integers (0 to quit): \n"
+ "text": [
+ "Enter positive integers (0 to quit): \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "19\n"
+ "text": [
+ "19\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "42\n"
+ "text": [
+ "42\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "min = 1\n"
+ "text": [
+ "min = 1\n"
+ ]
}
],
"prompt_number": 11
@@ -509,14 +844,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.17\n'''\n\nm = 95\nn = 11\nwhile m%n > 0:\n print \"%d modulo %d = %d\" %(m,n,m%n)\n m -= 3\n n += 1\n",
+ "input": [
+ "\n",
+ "\n",
+ "m = 95\n",
+ "n = 11\n",
+ "while m%n > 0:\n",
+ " print \"%d modulo %d = %d\" %(m,n,m%n)\n",
+ " m -= 3\n",
+ " n += 1\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "95 modulo 11 = 7\n92 modulo 12 = 8\n89 modulo 13 = 11\n86 modulo 14 = 2\n83 modulo 15 = 8\n"
+ "text": [
+ "95 modulo 11 = 7\n",
+ "92 modulo 12 = 8\n",
+ "89 modulo 13 = 11\n",
+ "86 modulo 14 = 2\n",
+ "83 modulo 15 = 8\n"
+ ]
}
],
"prompt_number": 12
@@ -524,14 +874,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.18 Nesting for Loops\nThis program prints a multiplication table:\n'''\n\nfor x in range(1,13):\n for y in range(1,13):\n print \"%4d\" % (x*y),\n print \"\"\n",
+ "input": [
+ "\n",
+ "for x in range(1,13):\n",
+ " for y in range(1,13):\n",
+ " print \"%4d\" % (x*y),\n",
+ " print \"\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " 1 2 3 4 5 6 7 8 9 10 11 12 \n 2 4 6 8 10 12 14 16 18 20 22 24 \n 3 6 9 12 15 18 21 24 27 30 33 36 \n 4 8 12 16 20 24 28 32 36 40 44 48 \n 5 10 15 20 25 30 35 40 45 50 55 60 \n 6 12 18 24 30 36 42 48 54 60 66 72 \n 7 14 21 28 35 42 49 56 63 70 77 84 \n 8 16 24 32 40 48 56 64 72 80 88 96 \n 9 18 27 36 45 54 63 72 81 90 99 108 \n 10 20 30 40 50 60 70 80 90 100 110 120 \n 11 22 33 44 55 66 77 88 99 110 121 132 \n 12 24 36 48 60 72 84 96 108 120 132 144 \n"
+ "text": [
+ " 1 2 3 4 5 6 7 8 9 10 11 12 \n",
+ " 2 4 6 8 10 12 14 16 18 20 22 24 \n",
+ " 3 6 9 12 15 18 21 24 27 30 33 36 \n",
+ " 4 8 12 16 20 24 28 32 36 40 44 48 \n",
+ " 5 10 15 20 25 30 35 40 45 50 55 60 \n",
+ " 6 12 18 24 30 36 42 48 54 60 66 72 \n",
+ " 7 14 21 28 35 42 49 56 63 70 77 84 \n",
+ " 8 16 24 32 40 48 56 64 72 80 88 96 \n",
+ " 9 18 27 36 45 54 63 72 81 90 99 108 \n",
+ " 10 20 30 40 50 60 70 80 90 100 110 120 \n",
+ " 11 22 33 44 55 66 77 88 99 110 121 132 \n",
+ " 12 24 36 48 60 72 84 96 108 120 132 144 \n"
+ ]
}
],
"prompt_number": 13
@@ -539,25 +908,59 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.19 Testing a Loop Invariant\n'''\nimport math\n# defines pow() and log()\n\nprint \"Enter a positive integer: \"\nn = int(raw_input())\nd=0 # the discrete binary logarithm of n\np2d=1 # = 2^d\ni = n\nwhile i > 1:\n # INVARIANT: 2^d <= n/i < 2*2^d\n p2d=math.pow(2,d) # = 2^d\n print \"%2d <= %2d\" %(p2d,2*p2d)\n i /= 2\n d += 1\n\np2d=math.pow(2,d) # = 2^d\nprint \"%2d <= %2d < %2d\" %(p2d,n,2*p2d)\nprint \" The discrete binary logarithm of is %d\" % d \nlgn = math.log(n)/math.log(2) # base 2 logarithm\nprint \"The continuous binary logarithm of is %f\" % lgn",
+ "input": [
+ "\n",
+ "import math\n",
+ "# defines pow() and log()\n",
+ "\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "d=0 # the discrete binary logarithm of n\n",
+ "p2d=1 # = 2^d\n",
+ "i = n\n",
+ "while i > 1:\n",
+ " # INVARIANT: 2^d <= n/i < 2*2^d\n",
+ " p2d=math.pow(2,d) # = 2^d\n",
+ " print \"%2d <= %2d\" %(p2d,2*p2d)\n",
+ " i /= 2\n",
+ " d += 1\n",
+ "\n",
+ "p2d=math.pow(2,d) # = 2^d\n",
+ "print \"%2d <= %2d < %2d\" %(p2d,n,2*p2d)\n",
+ "print \" The discrete binary logarithm of is %d\" % d \n",
+ "lgn = math.log(n)/math.log(2) # base 2 logarithm\n",
+ "print \"The continuous binary logarithm of is %f\" % lgn"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "17\n"
+ "text": [
+ "17\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 1 <= 2\n 2 <= 4\n 4 <= 8\n 8 <= 16\n16 <= 17 < 32\n The discrete binary logarithm of is 4\nThe continuous binary logarithm of is 4.087463\n"
+ "text": [
+ " 1 <= 2\n",
+ " 2 <= 4\n",
+ " 4 <= 8\n",
+ " 8 <= 16\n",
+ "16 <= 17 < 32\n",
+ " The discrete binary logarithm of is 4\n",
+ "The continuous binary logarithm of is 4.087463\n"
+ ]
}
],
"prompt_number": 14
@@ -565,25 +968,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.20 Using a break Statement to Terminate a Loop\nThis program has the same effect as the one in Example 4.1 on page 60. It uses a break statement to\ncontrol the loop:\n'''\ni=1\nprint \"Enter a positive integer: \"\nn = int(raw_input())\ns=0\nwhile (True):\n if (i > n):\n break\n s += i\n i += 1\n\nprint \"The sum of the first %d integers is %d\" %(i,s)\n",
+ "input": [
+ "\n",
+ "i=1\n",
+ "print \"Enter a positive integer: \"\n",
+ "n = int(raw_input())\n",
+ "s=0\n",
+ "while (True):\n",
+ " if (i > n):\n",
+ " break\n",
+ " s += i\n",
+ " i += 1\n",
+ "\n",
+ "print \"The sum of the first %d integers is %d\" %(i,s)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter a positive integer: \n"
+ "text": [
+ "Enter a positive integer: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "10\n"
+ "text": [
+ "10\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The sum of the first 11 integers is 55\n"
+ "text": [
+ "The sum of the first 11 integers is 55\n"
+ ]
}
],
"prompt_number": 15
@@ -591,58 +1013,92 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.21 Controlling Input with a Sentinel\nThis program reads a sequence of positive integers, terminated by 0, and prints their average:\n'''\ncount=0\ns=0\nprint \"Enter positive integers (0 to quit):\" \nwhile True: # \"forever\"\n print \"\\t %d :\" %(count + 1),\n n = int(raw_input())\n if (n <= 0):\n break\n count += 1\n s += n\n\nprint \"The average of those %d positive numbers is \" %count,\nprint float(s)/count\n",
+ "input": [
+ "\n",
+ "count=0\n",
+ "s=0\n",
+ "print \"Enter positive integers (0 to quit):\" \n",
+ "while True: # \"forever\"\n",
+ " print \"\\t %d :\" %(count + 1),\n",
+ " n = int(raw_input())\n",
+ " if (n <= 0):\n",
+ " break\n",
+ " count += 1\n",
+ " s += n\n",
+ "\n",
+ "print \"The average of those %d positive numbers is \" %count,\n",
+ "print float(s)/count\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter positive integers (0 to quit):\n\t 1 :"
+ "text": [
+ "Enter positive integers (0 to quit):\n",
+ "\t 1 :"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "12\n"
+ "text": [
+ "12\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t 2 :"
+ "text": [
+ " \t 2 :"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "32\n"
+ "text": [
+ "32\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t 3 :"
+ "text": [
+ " \t 3 :"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "11\n"
+ "text": [
+ "11\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t 4 :"
+ "text": [
+ " \t 4 :"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " The average of those 3 positive numbers is 18.3333333333\n"
+ "text": [
+ " The average of those 3 positive numbers is 18.3333333333\n"
+ ]
}
],
"prompt_number": 16
@@ -650,14 +1106,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.22 Using a break Statement with Nested Loops\n'''\n\nfor x in range(1,13):\n for y in range(1,13):\n if y>x:\n break\n else:\n print '%4d' %(x*y),\n print ''\n",
+ "input": [
+ "\n",
+ "for x in range(1,13):\n",
+ " for y in range(1,13):\n",
+ " if y>x:\n",
+ " break\n",
+ " else:\n",
+ " print '%4d' %(x*y),\n",
+ " print ''\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " 1 \n 2 4 \n 3 6 9 \n 4 8 12 16 \n 5 10 15 20 25 \n 6 12 18 24 30 36 \n 7 14 21 28 35 42 49 \n 8 16 24 32 40 48 56 64 \n 9 18 27 36 45 54 63 72 81 \n 10 20 30 40 50 60 70 80 90 100 \n 11 22 33 44 55 66 77 88 99 110 121 \n 12 24 36 48 60 72 84 96 108 120 132 144 \n"
+ "text": [
+ " 1 \n",
+ " 2 4 \n",
+ " 3 6 9 \n",
+ " 4 8 12 16 \n",
+ " 5 10 15 20 25 \n",
+ " 6 12 18 24 30 36 \n",
+ " 7 14 21 28 35 42 49 \n",
+ " 8 16 24 32 40 48 56 64 \n",
+ " 9 18 27 36 45 54 63 72 81 \n",
+ " 10 20 30 40 50 60 70 80 90 100 \n",
+ " 11 22 33 44 55 66 77 88 99 110 121 \n",
+ " 12 24 36 48 60 72 84 96 108 120 132 144 \n"
+ ]
}
],
"prompt_number": 17
@@ -665,7 +1143,17 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.23 Using continue and break Statements\nThis little program illustrates the continue and break statements:\n'''\nwhile True:\n n = int(raw_input('Enter int : '))\n if (n%2 == 0):\n continue\n if (n%3 == 0):\n break\n print \"\\tBottom of loop.\\n\"\nprint \"\\tOutside of loop.\\n\"\n",
+ "input": [
+ "\n",
+ "while True:\n",
+ " n = int(raw_input('Enter int : '))\n",
+ " if (n%2 == 0):\n",
+ " continue\n",
+ " if (n%3 == 0):\n",
+ " break\n",
+ " print \"\\tBottom of loop.\\n\"\n",
+ "print \"\\tOutside of loop.\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -673,35 +1161,49 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter int : 5\n"
+ "text": [
+ "Enter int : 5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tBottom of loop.\n\n"
+ "text": [
+ "\tBottom of loop.\n",
+ "\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter int : 4\n"
+ "text": [
+ "Enter int : 4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter int : 6\n"
+ "text": [
+ "Enter int : 6\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Enter int : 9\n"
+ "text": [
+ "Enter int : 9\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tOutside of loop.\n\n"
+ "text": [
+ "\tOutside of loop.\n",
+ "\n"
+ ]
}
],
"prompt_number": 18
@@ -709,14 +1211,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.24 Using a goto Statement to Break Out of a Nest of Loops\nNote : Python has no goto facility.\n'''\nN=5\ndone=False\nfor i in range(N):\n for j in range(N):\n if done:\n break\n for k in range(N):\n if done:\n break\n if (i+j+k>N):\n done = True\n else:\n print i+j+k,\n print \" \",\n print \"* \"\n print \".\" \n done = False\n",
+ "input": [
+ "\n",
+ "N=5\n",
+ "done=False\n",
+ "for i in range(N):\n",
+ " for j in range(N):\n",
+ " if done:\n",
+ " break\n",
+ " for k in range(N):\n",
+ " if done:\n",
+ " break\n",
+ " if (i+j+k>N):\n",
+ " done = True\n",
+ " else:\n",
+ " print i+j+k,\n",
+ " print \" \",\n",
+ " print \"* \"\n",
+ " print \".\" \n",
+ " done = False\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 2 3 4 * \n1 2 3 4 5 * \n2 3 4 5 * \n.\n1 2 3 4 5 * \n2 3 4 5 * \n.\n2 3 4 5 * \n.\n3 4 5 * \n.\n4 5 * \n.\n"
+ "text": [
+ "0 1 2 3 4 * \n",
+ "1 2 3 4 5 * \n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "1 2 3 4 5 * \n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "3 4 5 * \n",
+ ".\n",
+ "4 5 * \n",
+ ".\n"
+ ]
}
],
"prompt_number": 19
@@ -724,14 +1259,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.25 Using a Flag to Break Out of a Nest of Loops\nThis program has the same output as that in Example 4.24:\n'''\nN=5\ndone=False\nfor i in range(N):\n for j in range(N):\n if done:\n break\n for k in range(N):\n if done:\n break\n if (i+j+k>N):\n done = True\n else:\n print i+j+k,\n print \" \",\n print \"* \"\n print \".\" \n done = False\n",
+ "input": [
+ "\n",
+ "N=5\n",
+ "done=False\n",
+ "for i in range(N):\n",
+ " for j in range(N):\n",
+ " if done:\n",
+ " break\n",
+ " for k in range(N):\n",
+ " if done:\n",
+ " break\n",
+ " if (i+j+k>N):\n",
+ " done = True\n",
+ " else:\n",
+ " print i+j+k,\n",
+ " print \" \",\n",
+ " print \"* \"\n",
+ " print \".\" \n",
+ " done = False\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 2 3 4 * \n1 2 3 4 5 * \n2 3 4 5 * \n.\n1 2 3 4 5 * \n2 3 4 5 * \n.\n2 3 4 5 * \n.\n3 4 5 * \n.\n4 5 * \n.\n"
+ "text": [
+ "0 1 2 3 4 * \n",
+ "1 2 3 4 5 * \n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "1 2 3 4 5 * \n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "2 3 4 5 * \n",
+ ".\n",
+ "3 4 5 * \n",
+ ".\n",
+ "4 5 * \n",
+ ".\n"
+ ]
}
],
"prompt_number": 20
@@ -739,14 +1307,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.26 Generating Pseudo-Random Numbers\nThis program uses the rand() function to generate pseudo-random numbers:\n'''\nimport random\n\n# prints pseudo-random numbers:\n\nfor i in range(0,8):\n print random.random()\n\n ",
+ "input": [
+ "\n",
+ "import random\n",
+ "\n",
+ "# prints pseudo-random numbers:\n",
+ "\n",
+ "for i in range(0,8):\n",
+ " print random.random()\n",
+ "\n",
+ " "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.702115758628\n0.969460447904\n0.409934401112\n0.700339443791\n0.093528851602\n0.132172955687\n0.0162887279366\n0.943010713478\n"
+ "text": [
+ "0.702115758628\n",
+ "0.969460447904\n",
+ "0.409934401112\n",
+ "0.700339443791\n",
+ "0.093528851602\n",
+ "0.132172955687\n",
+ "0.0162887279366\n",
+ "0.943010713478\n"
+ ]
}
],
"prompt_number": 21
@@ -754,25 +1341,47 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.27 Setting the Seed Interactively\nThis program is the same as the one in Example 4.26 except that it allows the pseudo-random number\ngenerator's seed to be set interactively:\n'''\nimport random\n# prints pseudo-random numbers:\nprint \"Enter seed: \"\nseed = int(raw_input())\nrandom.seed(seed);\nfor i in range(0,8):\n print random.random()\n",
+ "input": [
+ "\n",
+ "import random\n",
+ "# prints pseudo-random numbers:\n",
+ "print \"Enter seed: \"\n",
+ "seed = int(raw_input())\n",
+ "random.seed(seed);\n",
+ "for i in range(0,8):\n",
+ " print random.random()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter seed: \n"
+ "text": [
+ "Enter seed: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.62290169489\n0.741786989261\n0.795193565566\n0.942450283777\n0.73989857474\n0.922324996665\n0.0290052282836\n0.465622654378\n"
+ "text": [
+ "0.62290169489\n",
+ "0.741786989261\n",
+ "0.795193565566\n",
+ "0.942450283777\n",
+ "0.73989857474\n",
+ "0.922324996665\n",
+ "0.0290052282836\n",
+ "0.465622654378\n"
+ ]
}
],
"prompt_number": 22
@@ -780,14 +1389,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.28 Setting the Seed from the System Clock\nThis program is the same as the one in Example 4.27 except that it sets the pseudo-random number\ngenerator's seed from the system clock.\n'''\nimport random\nfor i in range(0,8):\n print random.random()\n",
+ "input": [
+ "\n",
+ "import random\n",
+ "for i in range(0,8):\n",
+ " print random.random()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.943356716998\n0.648974553137\n0.900900491751\n0.113205964653\n0.469069047782\n0.24657283262\n0.543760859236\n0.573941187928\n"
+ "text": [
+ "0.943356716998\n",
+ "0.648974553137\n",
+ "0.900900491751\n",
+ "0.113205964653\n",
+ "0.469069047782\n",
+ "0.24657283262\n",
+ "0.543760859236\n",
+ "0.573941187928\n"
+ ]
}
],
"prompt_number": 23
@@ -795,31 +1418,52 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 4.29 Generating Pseudo-Random Numbers in Given Range\nThis program is the same as the one in Example 4.28 except that the pseudo-random numbers that it\ngenerates are restricted to given range:\n'''\nimport random\nprint \"Enter minimum and maximum: \"\nm = int(raw_input())\nn = int(raw_input())\n# lowest and highest numbers\nr = n - m + 1\n# number of numbers in range\nfor i in range(0,20):\n j = int(random.random()*100 % r + m)\n print j,\n print \" \",\n",
+ "input": [
+ "\n",
+ "import random\n",
+ "print \"Enter minimum and maximum: \"\n",
+ "m = int(raw_input())\n",
+ "n = int(raw_input())\n",
+ "# lowest and highest numbers\n",
+ "r = n - m + 1\n",
+ "# number of numbers in range\n",
+ "for i in range(0,20):\n",
+ " j = int(random.random()*100 % r + m)\n",
+ " print j,\n",
+ " print \" \",\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter minimum and maximum: \n"
+ "text": [
+ "Enter minimum and maximum: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "15\n"
+ "text": [
+ "15\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "6 15 10 8 15 9 7 7 11 6 5 15 14 15 15 15 11 13 14 6 \n"
+ "text": [
+ "6 15 10 8 15 9 7 7 11 6 5 15 14 15 15 15 11 13 14 6 \n"
+ ]
}
],
"prompt_number": 24
@@ -827,7 +1471,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch5.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch5.ipynb
index 6ef37c88..e3de2713 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch5.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch5"
+ "name": "",
+ "signature": "sha256:24e76f61ba45b924df39848fa855d4479d9e602e3e0935f26f67699be40eb3ff"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.1 The Square Root Function sqrt()\n'''\nimport math\n\n# tests the sqrt() function:\nfor i in range(0,6):\n print \"\\t %d \\t %f\" %(i,math.sqrt(i))",
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "# tests the sqrt() function:\n",
+ "for i in range(0,6):\n",
+ " print \"\\t %d \\t %f\" %(i,math.sqrt(i))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t 0 \t 0.000000\n\t 1 \t 1.000000\n\t 2 \t 1.414214\n\t 3 \t 1.732051\n\t 4 \t 2.000000\n\t 5 \t 2.236068\n"
+ "text": [
+ "\t 0 \t 0.000000\n",
+ "\t 1 \t 1.000000\n",
+ "\t 2 \t 1.414214\n",
+ "\t 3 \t 1.732051\n",
+ "\t 4 \t 2.000000\n",
+ "\t 5 \t 2.236068\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +40,35 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.2 Testing a Trigonometry Identity\n'''\nimport math\n# tests the identity sin 2x = 2 sin x cos x:\nx = 0\nwhile x < 2:\n print \"%f \\t\\t %f \\t %f\" %(x,math.sin(2*x),2*math.sin(x)*math.cos(x))\n x += 0.2\n\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "# tests the identity sin 2x = 2 sin x cos x:\n",
+ "x = 0\n",
+ "while x < 2:\n",
+ " print \"%f \\t\\t %f \\t %f\" %(x,math.sin(2*x),2*math.sin(x)*math.cos(x))\n",
+ " x += 0.2\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.000000 \t\t 0.000000 \t 0.000000\n0.200000 \t\t 0.389418 \t 0.389418\n0.400000 \t\t 0.717356 \t 0.717356\n0.600000 \t\t 0.932039 \t 0.932039\n0.800000 \t\t 0.999574 \t 0.999574\n1.000000 \t\t 0.909297 \t 0.909297\n1.200000 \t\t 0.675463 \t 0.675463\n1.400000 \t\t 0.334988 \t 0.334988\n1.600000 \t\t -0.058374 \t -0.058374\n1.800000 \t\t -0.442520 \t -0.442520\n2.000000 \t\t -0.756802 \t -0.756802\n"
+ "text": [
+ "0.000000 \t\t 0.000000 \t 0.000000\n",
+ "0.200000 \t\t 0.389418 \t 0.389418\n",
+ "0.400000 \t\t 0.717356 \t 0.717356\n",
+ "0.600000 \t\t 0.932039 \t 0.932039\n",
+ "0.800000 \t\t 0.999574 \t 0.999574\n",
+ "1.000000 \t\t 0.909297 \t 0.909297\n",
+ "1.200000 \t\t 0.675463 \t 0.675463\n",
+ "1.400000 \t\t 0.334988 \t 0.334988\n",
+ "1.600000 \t\t -0.058374 \t -0.058374\n",
+ "1.800000 \t\t -0.442520 \t -0.442520\n",
+ "2.000000 \t\t -0.756802 \t -0.756802\n"
+ ]
}
],
"prompt_number": 2
@@ -40,7 +76,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.3 A cube() Function\nHere is a simple example of a user-defined function:\n'''\n\ndef cube(x):\n # returns cube of x:\n return x*x*x\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "def cube(x):\n",
+ " # returns cube of x:\n",
+ " return x*x*x\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -49,7 +92,19 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.4 A Test Driver for the cube() Function\nHere is a complete program that includes the definition of the cube() function from Example 5.4\ntogether with a test driver for it:\n'''\n\ndef cube(x):\n # returns cube of x:\n return x*x*x\n\n# tests the cube() function:\nn=1\nwhile (n != 0):\n n = int(raw_input())\n print \"\\tcube( %d ) = %d\" %(n,cube(n))",
+ "input": [
+ "\n",
+ "\n",
+ "def cube(x):\n",
+ " # returns cube of x:\n",
+ " return x*x*x\n",
+ "\n",
+ "# tests the cube() function:\n",
+ "n=1\n",
+ "while (n != 0):\n",
+ " n = int(raw_input())\n",
+ " print \"\\tcube( %d ) = %d\" %(n,cube(n))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -57,45 +112,61 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tcube( 4 ) = 64\n"
+ "text": [
+ "\tcube( 4 ) = 64\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tcube( 2 ) = 8\n"
+ "text": [
+ "\tcube( 2 ) = 8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tcube( 9 ) = 729\n"
+ "text": [
+ "\tcube( 9 ) = 729\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tcube( 0 ) = 0\n"
+ "text": [
+ "\tcube( 0 ) = 0\n"
+ ]
}
],
"prompt_number": 1
@@ -103,7 +174,24 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.5 A Test Driver for the max() Function\nHere is a function with two parameters. It returns the larger of the two values passed to it.\n'''\n\ndef maximum(x,y):\n # returns larger of the two given integers:\n if (x < y):\n return y\n else:\n return x\n\n# tests the max() function:\nm = 1\nn = 1\nwhile m != 0: \n m = int(raw_input())\n n = int(raw_input())\n print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n\n",
+ "input": [
+ "\n",
+ "def maximum(x,y):\n",
+ " # returns larger of the two given integers:\n",
+ " if (x < y):\n",
+ " return y\n",
+ " else:\n",
+ " return x\n",
+ "\n",
+ "# tests the max() function:\n",
+ "m = 1\n",
+ "n = 1\n",
+ "while m != 0: \n",
+ " m = int(raw_input())\n",
+ " n = int(raw_input())\n",
+ " print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -111,35 +199,47 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax( 5 , 2 ) = 5\n"
+ "text": [
+ "\tmax( 5 , 2 ) = 5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax( 0 , 3 ) = 3\n"
+ "text": [
+ "\tmax( 0 , 3 ) = 3\n"
+ ]
}
],
"prompt_number": 2
@@ -147,7 +247,24 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.6 The max() Function with Declaration Separate from Definition\n'''\n\ndef maximum(x,y):\n # returns larger of the two given integers:\n if (x < y):\n return y\n else:\n return x\n\n# tests the max() function:\nm = 1\nn = 1\nwhile m != 0: \n m = int(raw_input())\n n = int(raw_input())\n print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n\n",
+ "input": [
+ "\n",
+ "def maximum(x,y):\n",
+ " # returns larger of the two given integers:\n",
+ " if (x < y):\n",
+ " return y\n",
+ " else:\n",
+ " return x\n",
+ "\n",
+ "# tests the max() function:\n",
+ "m = 1\n",
+ "n = 1\n",
+ "while m != 0: \n",
+ " m = int(raw_input())\n",
+ " n = int(raw_input())\n",
+ " print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -155,35 +272,47 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax( 5 , 2 ) = 5\n"
+ "text": [
+ "\tmax( 5 , 2 ) = 5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax( 0 , 3 ) = 3\n"
+ "text": [
+ "\tmax( 0 , 3 ) = 3\n"
+ ]
}
],
"prompt_number": 3
@@ -191,7 +320,18 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.8 The max() Function Compiled Separately\n'''\n\n\n# returns larger of the two given integers:\n\nm = 1\nn = 1\nwhile m!=0:\n m = int(raw_input())\n n = int(raw_input())\n print \"\\tmax(%d,%d) = %d\" %(m,n, max(m,n))\n",
+ "input": [
+ "\n",
+ "\n",
+ "# returns larger of the two given integers:\n",
+ "\n",
+ "m = 1\n",
+ "n = 1\n",
+ "while m!=0:\n",
+ " m = int(raw_input())\n",
+ " n = int(raw_input())\n",
+ " print \"\\tmax(%d,%d) = %d\" %(m,n, max(m,n))\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -199,69 +339,93 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax(5,4) = 5\n"
+ "text": [
+ "\tmax(5,4) = 5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3\n"
+ "text": [
+ "3\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax(4,3) = 4\n"
+ "text": [
+ "\tmax(4,3) = 4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax(8,0) = 8\n"
+ "text": [
+ "\tmax(8,0) = 8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\tmax(0,5) = 5\n"
+ "text": [
+ "\tmax(0,5) = 5\n"
+ ]
}
],
"prompt_number": 4
@@ -269,14 +433,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.9 The Factorial Function\n'''\n\ndef fact(n):\n if (n < 0):\n return 0\n f = 1\n while (n > 1):\n f *= n\n n -= 1\n return f\n\nfor i in range(-1,6):\n print fact(i),\n",
+ "input": [
+ "\n",
+ "def fact(n):\n",
+ " if (n < 0):\n",
+ " return 0\n",
+ " f = 1\n",
+ " while (n > 1):\n",
+ " f *= n\n",
+ " n -= 1\n",
+ " return f\n",
+ "\n",
+ "for i in range(-1,6):\n",
+ " print fact(i),\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 1 1 2 6 24 120\n"
+ "text": [
+ "0 1 1 2 6 24 120\n"
+ ]
}
],
"prompt_number": 5
@@ -284,14 +463,46 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.10 The Permutation Function\n'''\ndef fact(n):\n if (n < 0):\n return 0\n f = 1\n while (n > 1):\n f *= n\n n -= 1\n return f\n\n\ndef perm(n,k):\n # returns P(n,k), the number of permutations of k from n:\n if (n < 0 or k < 0 or k > n):\n return 0\n return fact(n)/fact(n-k)\n\nfor i in range(-1,8):\n for j in range(-1,i+2):\n print perm(i,j),\n print ''\n",
+ "input": [
+ "\n",
+ "def fact(n):\n",
+ " if (n < 0):\n",
+ " return 0\n",
+ " f = 1\n",
+ " while (n > 1):\n",
+ " f *= n\n",
+ " n -= 1\n",
+ " return f\n",
+ "\n",
+ "\n",
+ "def perm(n,k):\n",
+ " # returns P(n,k), the number of permutations of k from n:\n",
+ " if (n < 0 or k < 0 or k > n):\n",
+ " return 0\n",
+ " return fact(n)/fact(n-k)\n",
+ "\n",
+ "for i in range(-1,8):\n",
+ " for j in range(-1,i+2):\n",
+ " print perm(i,j),\n",
+ " print ''\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 0 \n0 1 0 \n0 1 1 0 \n0 1 2 2 0 \n0 1 3 6 6 0 \n0 1 4 12 24 24 0 \n0 1 5 20 60 120 120 0 \n0 1 6 30 120 360 720 720 0 \n0 1 7 42 210 840 2520 5040 5040 0 \n"
+ "text": [
+ "0 0 \n",
+ "0 1 0 \n",
+ "0 1 1 0 \n",
+ "0 1 2 2 0 \n",
+ "0 1 3 6 6 0 \n",
+ "0 1 4 12 24 24 0 \n",
+ "0 1 5 20 60 120 120 0 \n",
+ "0 1 6 30 120 360 720 720 0 \n",
+ "0 1 7 42 210 840 2520 5040 5040 0 \n"
+ ]
}
],
"prompt_number": 6
@@ -299,7 +510,48 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.11 A Function that Prints Dates\n'''\n\ndef printDate(m,d,y):\n # prints the given date in literal form:\n if (m < 1 or m > 12 or d < 1 or d > 31 or y < 0):\n print \"Error: parameter out of range.\\n\"\n return\n if m == 1:\n print \"January \",\n elif m ==2:\n print \"February \",\n elif m==3 :\n print \"March \",\n elif m==4:\n print \"April \",\n elif m==5:\n print \"May \",\n elif m==6:\n print \"June \",\n elif m==7:\n print \"July \",\n elif m==8:\n print \"August \",\n elif m==9:\n print \"September \",\n elif m==10:\n print \"October \",\n elif m==1:\n print \"November \",\n else:\n print \"December \",\n print d , \", \", y \n\n# tests the printDate() function:\nmonth = 1\nwhile month > 0:\n month = int(raw_input())\n day = int(raw_input())\n year = int(raw_input())\n printDate(month,day,year)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def printDate(m,d,y):\n",
+ " # prints the given date in literal form:\n",
+ " if (m < 1 or m > 12 or d < 1 or d > 31 or y < 0):\n",
+ " print \"Error: parameter out of range.\\n\"\n",
+ " return\n",
+ " if m == 1:\n",
+ " print \"January \",\n",
+ " elif m ==2:\n",
+ " print \"February \",\n",
+ " elif m==3 :\n",
+ " print \"March \",\n",
+ " elif m==4:\n",
+ " print \"April \",\n",
+ " elif m==5:\n",
+ " print \"May \",\n",
+ " elif m==6:\n",
+ " print \"June \",\n",
+ " elif m==7:\n",
+ " print \"July \",\n",
+ " elif m==8:\n",
+ " print \"August \",\n",
+ " elif m==9:\n",
+ " print \"September \",\n",
+ " elif m==10:\n",
+ " print \"October \",\n",
+ " elif m==1:\n",
+ " print \"November \",\n",
+ " else:\n",
+ " print \"December \",\n",
+ " print d , \", \", y \n",
+ "\n",
+ "# tests the printDate() function:\n",
+ "month = 1\n",
+ "while month > 0:\n",
+ " month = int(raw_input())\n",
+ " day = int(raw_input())\n",
+ " year = int(raw_input())\n",
+ " printDate(month,day,year)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -307,47 +559,64 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "12\n"
+ "text": [
+ "12\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1989\n"
+ "text": [
+ "1989\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "September 12 , 1989\n"
+ "text": [
+ "September 12 , 1989\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2001\n"
+ "text": [
+ "2001\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Error: parameter out of range.\n\n"
+ "text": [
+ "Error: parameter out of range.\n",
+ "\n"
+ ]
}
],
"prompt_number": 8
@@ -355,14 +624,305 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.12 Classifying Characters\n'''\nimport string\ndef ispunct(s):\n return all(c in string.punctuation for c in s)\ndef printCharCategory(c):\n # prints the category to which the given character belongs:\n print \"The character [\" + c + \"] is a \",\n if(c.isdigit()):\n print \"digit.\\n\"\n elif (c.islower()):\n print \"lower-case letter.\\n\"\n elif (c.isupper()): \n print \"capital letter.\\n\"\n elif (c.isspace()):\n print \"white space character.\\n\"\n elif (ord(c) >= 10 and ord(c) <= 15 or ord(c) == 0):\n print \"control character.\\n\"\n elif (ispunct(c)):\n print \"punctuation mark.\\n\"\n else:\n print \"Error.\\n\"\n\n# prints the category to which the given character belongs;\n# tests the printCharCategory() function:\nfor c in range(128):\n printCharCategory(chr(c))\n",
+ "input": [
+ "\n",
+ "import string\n",
+ "def ispunct(s):\n",
+ " return all(c in string.punctuation for c in s)\n",
+ "def printCharCategory(c):\n",
+ " # prints the category to which the given character belongs:\n",
+ " print \"The character [\" + c + \"] is a \",\n",
+ " if(c.isdigit()):\n",
+ " print \"digit.\\n\"\n",
+ " elif (c.islower()):\n",
+ " print \"lower-case letter.\\n\"\n",
+ " elif (c.isupper()): \n",
+ " print \"capital letter.\\n\"\n",
+ " elif (c.isspace()):\n",
+ " print \"white space character.\\n\"\n",
+ " elif (ord(c) >= 10 and ord(c) <= 15 or ord(c) == 0):\n",
+ " print \"control character.\\n\"\n",
+ " elif (ispunct(c)):\n",
+ " print \"punctuation mark.\\n\"\n",
+ " else:\n",
+ " print \"Error.\\n\"\n",
+ "\n",
+ "# prints the category to which the given character belongs;\n",
+ "# tests the printCharCategory() function:\n",
+ "for c in range(128):\n",
+ " printCharCategory(chr(c))\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " The character [\u0000] is a control character.\n\nThe character [\u0001] is a Error.\n\nThe character [\u0002] is a Error.\n\nThe character [\u0003] is a Error.\n\nThe character [\u0004] is a Error.\n\nThe character [\u0005] is a Error.\n\nThe character [\u0006] is a Error.\n\nThe character [\u0007] is a Error.\n\nThe character [\b] is a Error.\n\nThe character [\t] is a white space character.\n\nThe character [\n] is a white space character.\n\nThe character [\u000b] is a white space character.\n\nThe character [\f] is a white space character.\n\nThe character [\r] is a white space character.\n\nThe character [\u000e] is a control character.\n\nThe character [\u000f] is a control character.\n\nThe character [\u0010] is a Error.\n\nThe character [\u0011] is a Error.\n\nThe character [\u0012] is a Error.\n\nThe character [\u0013] is a Error.\n\nThe character [\u0014] is a Error.\n\nThe character [\u0015] is a Error.\n\nThe character [\u0016] is a Error.\n\nThe character [\u0017] is a Error.\n\nThe character [\u0018] is a Error.\n\nThe character [\u0019] is a Error.\n\nThe character [\u001a] is a Error.\n\nThe character [\u001b] is a Error.\n\nThe character [\u001c] is a Error.\n\nThe character [\u001d] is a Error.\n\nThe character [\u001e] is a Error.\n\nThe character [\u001f] is a Error.\n\nThe character [ ] is a white space character.\n\nThe character [!] is a punctuation mark.\n\nThe character [\"] is a punctuation mark.\n\nThe character [#] is a punctuation mark.\n\nThe character [$] is a punctuation mark.\n\nThe character [%] is a punctuation mark.\n\nThe character [&] is a punctuation mark.\n\nThe character ['] is a punctuation mark.\n\nThe character [(] is a punctuation mark.\n\nThe character [)] is a punctuation mark.\n\nThe character [*] is a punctuation mark.\n\nThe character [+] is a punctuation mark.\n\nThe character [,] is a punctuation mark.\n\nThe character [-] is a punctuation mark.\n\nThe character [.] is a punctuation mark.\n\nThe character [/] is a punctuation mark.\n\nThe character [0] is a digit.\n\nThe character [1] is a digit.\n\nThe character [2] is a digit.\n\nThe character [3] is a digit.\n\nThe character [4] is a digit.\n\nThe character [5] is a digit.\n\nThe character [6] is a digit.\n\nThe character [7] is a digit.\n\nThe character [8] is a digit.\n\nThe character [9] is a digit.\n\nThe character [:] is a punctuation mark.\n\nThe character [;] is a punctuation mark.\n\nThe character [<] is a punctuation mark.\n\nThe character [=] is a punctuation mark.\n\nThe character [>] is a punctuation mark.\n\nThe character [?] is a punctuation mark.\n\nThe character [@] is a punctuation mark.\n\nThe character [A] is a capital letter.\n\nThe character [B] is a capital letter.\n\nThe character [C] is a capital letter.\n\nThe character [D] is a capital letter.\n\nThe character [E] is a capital letter.\n\nThe character [F] is a capital letter.\n\nThe character [G] is a capital letter.\n\nThe character [H] is a capital letter.\n\nThe character [I] is a capital letter.\n\nThe character [J] is a capital letter.\n\nThe character [K] is a capital letter.\n\nThe character [L] is a capital letter.\n\nThe character [M] is a capital letter.\n\nThe character [N] is a capital letter.\n\nThe character [O] is a capital letter.\n\nThe character [P] is a capital letter.\n\nThe character [Q] is a capital letter.\n\nThe character [R] is a capital letter.\n\nThe character [S] is a capital letter.\n\nThe character [T] is a capital letter.\n\nThe character [U] is a capital letter.\n\nThe character [V] is a capital letter.\n\nThe character [W] is a capital letter.\n\nThe character [X] is a capital letter.\n\nThe character [Y] is a capital letter.\n\nThe character [Z] is a capital letter.\n\nThe character [[] is a punctuation mark.\n\nThe character [\\] is a punctuation mark.\n\nThe character []] is a punctuation mark.\n\nThe character [^] is a punctuation mark.\n\nThe character [_] is a punctuation mark.\n\nThe character [`] is a punctuation mark.\n\nThe character [a] is a lower-case letter.\n\nThe character [b] is a lower-case letter.\n\nThe character [c] is a lower-case letter.\n\nThe character [d] is a lower-case letter.\n\nThe character [e] is a lower-case letter.\n\nThe character [f] is a lower-case letter.\n\nThe character [g] is a lower-case letter.\n\nThe character [h] is a lower-case letter.\n\nThe character [i] is a lower-case letter.\n\nThe character [j] is a lower-case letter.\n\nThe character [k] is a lower-case letter.\n\nThe character [l] is a lower-case letter.\n\nThe character [m] is a lower-case letter.\n\nThe character [n] is a lower-case letter.\n\nThe character [o] is a lower-case letter.\n\nThe character [p] is a lower-case letter.\n\nThe character [q] is a lower-case letter.\n\nThe character [r] is a lower-case letter.\n\nThe character [s] is a lower-case letter.\n\nThe character [t] is a lower-case letter.\n\nThe character [u] is a lower-case letter.\n\nThe character [v] is a lower-case letter.\n\nThe character [w] is a lower-case letter.\n\nThe character [x] is a lower-case letter.\n\nThe character [y] is a lower-case letter.\n\nThe character [z] is a lower-case letter.\n\nThe character [{] is a punctuation mark.\n\nThe character [|] is a punctuation mark.\n\nThe character [}] is a punctuation mark.\n\nThe character [~] is a punctuation mark.\n\nThe character [\u007f] is a Error.\n\n"
+ "text": [
+ " The character [\u0000] is a control character.\n",
+ "\n",
+ "The character [\u0001] is a Error.\n",
+ "\n",
+ "The character [\u0002] is a Error.\n",
+ "\n",
+ "The character [\u0003] is a Error.\n",
+ "\n",
+ "The character [\u0004] is a Error.\n",
+ "\n",
+ "The character [\u0005] is a Error.\n",
+ "\n",
+ "The character [\u0006] is a Error.\n",
+ "\n",
+ "The character [\u0007] is a Error.\n",
+ "\n",
+ "The character [\b] is a Error.\n",
+ "\n",
+ "The character [\t] is a white space character.\n",
+ "\n",
+ "The character [\n",
+ "] is a white space character.\n",
+ "\n",
+ "The character [\u000b",
+ "] is a white space character.\n",
+ "\n",
+ "The character [\f",
+ "] is a white space character.\n",
+ "\n",
+ "The character [\r",
+ "] is a white space character.\n",
+ "\n",
+ "The character [\u000e] is a control character.\n",
+ "\n",
+ "The character [\u000f] is a control character.\n",
+ "\n",
+ "The character [\u0010] is a Error.\n",
+ "\n",
+ "The character [\u0011] is a Error.\n",
+ "\n",
+ "The character [\u0012] is a Error.\n",
+ "\n",
+ "The character [\u0013] is a Error.\n",
+ "\n",
+ "The character [\u0014] is a Error.\n",
+ "\n",
+ "The character [\u0015] is a Error.\n",
+ "\n",
+ "The character [\u0016] is a Error.\n",
+ "\n",
+ "The character [\u0017] is a Error.\n",
+ "\n",
+ "The character [\u0018] is a Error.\n",
+ "\n",
+ "The character [\u0019] is a Error.\n",
+ "\n",
+ "The character [\u001a] is a Error.\n",
+ "\n",
+ "The character [\u001b] is a Error.\n",
+ "\n",
+ "The character [\u001c",
+ "] is a Error.\n",
+ "\n",
+ "The character [\u001d",
+ "] is a Error.\n",
+ "\n",
+ "The character [\u001e",
+ "] is a Error.\n",
+ "\n",
+ "The character [\u001f] is a Error.\n",
+ "\n",
+ "The character [ ] is a white space character.\n",
+ "\n",
+ "The character [!] is a punctuation mark.\n",
+ "\n",
+ "The character [\"] is a punctuation mark.\n",
+ "\n",
+ "The character [#] is a punctuation mark.\n",
+ "\n",
+ "The character [$] is a punctuation mark.\n",
+ "\n",
+ "The character [%] is a punctuation mark.\n",
+ "\n",
+ "The character [&] is a punctuation mark.\n",
+ "\n",
+ "The character ['] is a punctuation mark.\n",
+ "\n",
+ "The character [(] is a punctuation mark.\n",
+ "\n",
+ "The character [)] is a punctuation mark.\n",
+ "\n",
+ "The character [*] is a punctuation mark.\n",
+ "\n",
+ "The character [+] is a punctuation mark.\n",
+ "\n",
+ "The character [,] is a punctuation mark.\n",
+ "\n",
+ "The character [-] is a punctuation mark.\n",
+ "\n",
+ "The character [.] is a punctuation mark.\n",
+ "\n",
+ "The character [/] is a punctuation mark.\n",
+ "\n",
+ "The character [0] is a digit.\n",
+ "\n",
+ "The character [1] is a digit.\n",
+ "\n",
+ "The character [2] is a digit.\n",
+ "\n",
+ "The character [3] is a digit.\n",
+ "\n",
+ "The character [4] is a digit.\n",
+ "\n",
+ "The character [5] is a digit.\n",
+ "\n",
+ "The character [6] is a digit.\n",
+ "\n",
+ "The character [7] is a digit.\n",
+ "\n",
+ "The character [8] is a digit.\n",
+ "\n",
+ "The character [9] is a digit.\n",
+ "\n",
+ "The character [:] is a punctuation mark.\n",
+ "\n",
+ "The character [;] is a punctuation mark.\n",
+ "\n",
+ "The character [<] is a punctuation mark.\n",
+ "\n",
+ "The character [=] is a punctuation mark.\n",
+ "\n",
+ "The character [>] is a punctuation mark.\n",
+ "\n",
+ "The character [?] is a punctuation mark.\n",
+ "\n",
+ "The character [@] is a punctuation mark.\n",
+ "\n",
+ "The character [A] is a capital letter.\n",
+ "\n",
+ "The character [B] is a capital letter.\n",
+ "\n",
+ "The character [C] is a capital letter.\n",
+ "\n",
+ "The character [D] is a capital letter.\n",
+ "\n",
+ "The character [E] is a capital letter.\n",
+ "\n",
+ "The character [F] is a capital letter.\n",
+ "\n",
+ "The character [G] is a capital letter.\n",
+ "\n",
+ "The character [H] is a capital letter.\n",
+ "\n",
+ "The character [I] is a capital letter.\n",
+ "\n",
+ "The character [J] is a capital letter.\n",
+ "\n",
+ "The character [K] is a capital letter.\n",
+ "\n",
+ "The character [L] is a capital letter.\n",
+ "\n",
+ "The character [M] is a capital letter.\n",
+ "\n",
+ "The character [N] is a capital letter.\n",
+ "\n",
+ "The character [O] is a capital letter.\n",
+ "\n",
+ "The character [P] is a capital letter.\n",
+ "\n",
+ "The character [Q] is a capital letter.\n",
+ "\n",
+ "The character [R] is a capital letter.\n",
+ "\n",
+ "The character [S] is a capital letter.\n",
+ "\n",
+ "The character [T] is a capital letter.\n",
+ "\n",
+ "The character [U] is a capital letter.\n",
+ "\n",
+ "The character [V] is a capital letter.\n",
+ "\n",
+ "The character [W] is a capital letter.\n",
+ "\n",
+ "The character [X] is a capital letter.\n",
+ "\n",
+ "The character [Y] is a capital letter.\n",
+ "\n",
+ "The character [Z] is a capital letter.\n",
+ "\n",
+ "The character [[] is a punctuation mark.\n",
+ "\n",
+ "The character [\\] is a punctuation mark.\n",
+ "\n",
+ "The character []] is a punctuation mark.\n",
+ "\n",
+ "The character [^] is a punctuation mark.\n",
+ "\n",
+ "The character [_] is a punctuation mark.\n",
+ "\n",
+ "The character [`] is a punctuation mark.\n",
+ "\n",
+ "The character [a] is a lower-case letter.\n",
+ "\n",
+ "The character [b] is a lower-case letter.\n",
+ "\n",
+ "The character [c] is a lower-case letter.\n",
+ "\n",
+ "The character [d] is a lower-case letter.\n",
+ "\n",
+ "The character [e] is a lower-case letter.\n",
+ "\n",
+ "The character [f] is a lower-case letter.\n",
+ "\n",
+ "The character [g] is a lower-case letter.\n",
+ "\n",
+ "The character [h] is a lower-case letter.\n",
+ "\n",
+ "The character [i] is a lower-case letter.\n",
+ "\n",
+ "The character [j] is a lower-case letter.\n",
+ "\n",
+ "The character [k] is a lower-case letter.\n",
+ "\n",
+ "The character [l] is a lower-case letter.\n",
+ "\n",
+ "The character [m] is a lower-case letter.\n",
+ "\n",
+ "The character [n] is a lower-case letter.\n",
+ "\n",
+ "The character [o] is a lower-case letter.\n",
+ "\n",
+ "The character [p] is a lower-case letter.\n",
+ "\n",
+ "The character [q] is a lower-case letter.\n",
+ "\n",
+ "The character [r] is a lower-case letter.\n",
+ "\n",
+ "The character [s] is a lower-case letter.\n",
+ "\n",
+ "The character [t] is a lower-case letter.\n",
+ "\n",
+ "The character [u] is a lower-case letter.\n",
+ "\n",
+ "The character [v] is a lower-case letter.\n",
+ "\n",
+ "The character [w] is a lower-case letter.\n",
+ "\n",
+ "The character [x] is a lower-case letter.\n",
+ "\n",
+ "The character [y] is a lower-case letter.\n",
+ "\n",
+ "The character [z] is a lower-case letter.\n",
+ "\n",
+ "The character [{] is a punctuation mark.\n",
+ "\n",
+ "The character [|] is a punctuation mark.\n",
+ "\n",
+ "The character [}] is a punctuation mark.\n",
+ "\n",
+ "The character [~] is a punctuation mark.\n",
+ "\n",
+ "The character [\u007f] is a Error.\n",
+ "\n"
+ ]
}
],
"prompt_number": 4
@@ -370,14 +930,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.13 A Function that Tests Primality\n'''\nimport math\ndef isPrime(n):\n # returns True if n is prime, False otherwise:\n sqrtn = math.sqrt(n)\n if (n < 2):\n return False\n # 0 and 1 are not primes\n if (n < 4):\n return True\n # 2 and 3 are the first primes\n if (n%2 == 0):\n return False\n # 2 is the only even prime\n for d in range(3,int(sqrtn+1),2):\n if (n%d == 0):\n return False\n # n has a nontrivial divisor\n return True;\n\nfor n in range(0,80):\n if (isPrime(n)):\n print n,\n",
+ "input": [
+ "\n",
+ "import math\n",
+ "def isPrime(n):\n",
+ " # returns True if n is prime, False otherwise:\n",
+ " sqrtn = math.sqrt(n)\n",
+ " if (n < 2):\n",
+ " return False\n",
+ " # 0 and 1 are not primes\n",
+ " if (n < 4):\n",
+ " return True\n",
+ " # 2 and 3 are the first primes\n",
+ " if (n%2 == 0):\n",
+ " return False\n",
+ " # 2 is the only even prime\n",
+ " for d in range(3,int(sqrtn+1),2):\n",
+ " if (n%d == 0):\n",
+ " return False\n",
+ " # n has a nontrivial divisor\n",
+ " return True;\n",
+ "\n",
+ "for n in range(0,80):\n",
+ " if (isPrime(n)):\n",
+ " print n,\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79\n"
+ "text": [
+ "2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79\n"
+ ]
}
],
"prompt_number": 10
@@ -385,7 +971,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.14 A Leap Year Function\n'''\ndef isLeapYear(y):\n # returns true iff y is a leap year:\n return (y % 4 == 0 and y % 100 != 0 or y % 400 == 0)\n\n# tests the isLeapYear() function:\nn = 2\nwhile n > 1:\n n = int(raw_input())\n if (isLeapYear(n)):\n print \"%d is a leap year.\" % n\n else:\n print \"%d is not a leap year.\" %n\n",
+ "input": [
+ "\n",
+ "def isLeapYear(y):\n",
+ " # returns true iff y is a leap year:\n",
+ " return (y % 4 == 0 and y % 100 != 0 or y % 400 == 0)\n",
+ "\n",
+ "# tests the isLeapYear() function:\n",
+ "n = 2\n",
+ "while n > 1:\n",
+ " n = int(raw_input())\n",
+ " if (isLeapYear(n)):\n",
+ " print \"%d is a leap year.\" % n\n",
+ " else:\n",
+ " print \"%d is not a leap year.\" %n\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -393,45 +993,61 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2004\n"
+ "text": [
+ "2004\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "2004 is a leap year.\n"
+ "text": [
+ "2004 is a leap year.\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2006\n"
+ "text": [
+ "2006\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "2006 is not a leap year.\n"
+ "text": [
+ "2006 is not a leap year.\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2013\n"
+ "text": [
+ "2013\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "2013 is not a leap year.\n"
+ "text": [
+ "2013 is not a leap year.\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "0\n"
+ "text": [
+ "0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "0 is a leap year.\n"
+ "text": [
+ "0 is a leap year.\n"
+ ]
}
],
"prompt_number": 11
@@ -439,47 +1055,88 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.15 A Function for Reading the User's Age\n'''\n\ndef age():\n # prompts the user to input his/her age, and returns that value:\n while (True):\n print \"How old are you: \"\n n = int(raw_input())\n if (n < 0):\n print \"\\a\\tYour age could not be negative.\"\n elif (n > 120):\n print \"\\a\\tYou could not be over 120.\"\n else:\n return n\n print \"\\n\\tTry again.\\n\"\n\na = age();\nprint \"\\nYou are %d years old.\" %a\n",
+ "input": [
+ "\n",
+ "\n",
+ "def age():\n",
+ " # prompts the user to input his/her age, and returns that value:\n",
+ " while (True):\n",
+ " print \"How old are you: \"\n",
+ " n = int(raw_input())\n",
+ " if (n < 0):\n",
+ " print \"\\a\\tYour age could not be negative.\"\n",
+ " elif (n > 120):\n",
+ " print \"\\a\\tYou could not be over 120.\"\n",
+ " else:\n",
+ " return n\n",
+ " print \"\\n\\tTry again.\\n\"\n",
+ "\n",
+ "a = age();\n",
+ "print \"\\nYou are %d years old.\" %a\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "How old are you: \n"
+ "text": [
+ "How old are you: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "-12\n"
+ "text": [
+ "-12\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\u0007\tYour age could not be negative.\n\n\tTry again.\n\nHow old are you: \n"
+ "text": [
+ "\u0007\tYour age could not be negative.\n",
+ "\n",
+ "\tTry again.\n",
+ "\n",
+ "How old are you: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "125\n"
+ "text": [
+ "125\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\u0007\tYou could not be over 120.\n\n\tTry again.\n\nHow old are you: \n"
+ "text": [
+ "\u0007\tYou could not be over 120.\n",
+ "\n",
+ "\tTry again.\n",
+ "\n",
+ "How old are you: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "24\n"
+ "text": [
+ "24\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\nYou are 24 years old.\n"
+ "text": [
+ "\n",
+ "You are 24 years old.\n"
+ ]
}
],
"prompt_number": 14
@@ -487,14 +1144,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.16 The swap() Function\n'''\n\ndef swap(x,y):\n # exchanges the values of x and y:\n x[0],y[0] = y[0],x[0]\n\na = [22.2]\nb = [44.4]\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\nswap(a,b)\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "input": [
+ "\n",
+ "\n",
+ "def swap(x,y):\n",
+ " # exchanges the values of x and y:\n",
+ " x[0],y[0] = y[0],x[0]\n",
+ "\n",
+ "a = [22.2]\n",
+ "b = [44.4]\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "swap(a,b)\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 22.20 , b = 44.40 \na = 44.40 , b = 22.20 \n"
+ "text": [
+ "a = 22.20 , b = 44.40 \n",
+ "a = 44.40 , b = 22.20 \n"
+ ]
}
],
"prompt_number": 15
@@ -502,14 +1174,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.17 \nNote : Python doesn't support pass value by reference. but can be done by passing list.\n'''\n\ndef f(x,y):\n x[0]= 88\n y[0] = 99\n\n# tests the f() function:\na = [22]\nb = [44]\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\nf(a,b)\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\nf(2*a,b)\nprint \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "input": [
+ "\n",
+ "\n",
+ "def f(x,y):\n",
+ " x[0]= 88\n",
+ " y[0] = 99\n",
+ "\n",
+ "# tests the f() function:\n",
+ "a = [22]\n",
+ "b = [44]\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "f(a,b)\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n",
+ "f(2*a,b)\n",
+ "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 22.00 , b = 44.00 \na = 88.00 , b = 99.00 \na = 88.00 , b = 99.00 \n"
+ "text": [
+ "a = 22.00 , b = 44.00 \n",
+ "a = 88.00 , b = 99.00 \n",
+ "a = 88.00 , b = 99.00 \n"
+ ]
}
],
"prompt_number": 16
@@ -517,25 +1208,46 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.18 Returning More than One Value\n'''\n\ndef computeCircle(r):\n # returns the area and circumference of a circle with radius r:\n PI = 3.141592653589793\n area = PI*r*r\n circumference = 2*PI*r\n return area,circumference\n\n# tests the computeCircle() function:\nprint \"Enter radius: \"\nr = int(raw_input())\na,c = computeCircle(r)\nprint \"area = %.2f , circumference = %.2f\" %(a,c)",
+ "input": [
+ "\n",
+ "\n",
+ "def computeCircle(r):\n",
+ " # returns the area and circumference of a circle with radius r:\n",
+ " PI = 3.141592653589793\n",
+ " area = PI*r*r\n",
+ " circumference = 2*PI*r\n",
+ " return area,circumference\n",
+ "\n",
+ "# tests the computeCircle() function:\n",
+ "print \"Enter radius: \"\n",
+ "r = int(raw_input())\n",
+ "a,c = computeCircle(r)\n",
+ "print \"area = %.2f , circumference = %.2f\" %(a,c)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter radius: \n"
+ "text": [
+ "Enter radius: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "area = 78.54 , circumference = 31.42\n"
+ "text": [
+ "area = 78.54 , circumference = 31.42\n"
+ ]
}
],
"prompt_number": 17
@@ -543,14 +1255,37 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.19\nNote : Python passes variable by value and not by reference. So output would be differ.\n'''\n\n\ndef f(x,y,z):\n x[0] += z[0]\n y[0] += z[0]\n print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n\nx = [22]\ny = [33]\nz = [44]\n\nprint \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\nf(x,y,z)\nprint \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\nx[0] = 2*x[0] - 3\nf(x,y,z)\nprint \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n",
+ "input": [
+ "\n",
+ "def f(x,y,z):\n",
+ " x[0] += z[0]\n",
+ " y[0] += z[0]\n",
+ " print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n",
+ "\n",
+ "x = [22]\n",
+ "y = [33]\n",
+ "z = [44]\n",
+ "\n",
+ "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n",
+ "f(x,y,z)\n",
+ "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n",
+ "x[0] = 2*x[0] - 3\n",
+ "f(x,y,z)\n",
+ "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 22 , y = 33 , z = 44\nx = 66 , y = 77 , z = 44\nx = 66 , y = 77 , z = 44\nx = 173 , y = 121 , z = 44\nx = 173 , y = 121 , z = 44\n"
+ "text": [
+ "x = 22 , y = 33 , z = 44\n",
+ "x = 66 , y = 77 , z = 44\n",
+ "x = 66 , y = 77 , z = 44\n",
+ "x = 173 , y = 121 , z = 44\n",
+ "x = 173 , y = 121 , z = 44\n"
+ ]
}
],
"prompt_number": 5
@@ -558,25 +1293,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.20\n'''\ndef cube(x):\n # returns cube of x:\n return x*x*x\n\n# tests the cube() function:\nprint cube(4)\nx = int(raw_input())\ny = cube(2*x-3)\nprint y\n",
+ "input": [
+ "\n",
+ "def cube(x):\n",
+ " # returns cube of x:\n",
+ " return x*x*x\n",
+ "\n",
+ "# tests the cube() function:\n",
+ "print cube(4)\n",
+ "x = int(raw_input())\n",
+ "y = cube(2*x-3)\n",
+ "print y\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "64\n"
+ "text": [
+ "64\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "343\n"
+ "text": [
+ "343\n"
+ ]
}
],
"prompt_number": 19
@@ -584,14 +1336,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.21 Nested and Parallel Scopes\nPython has it's own scope so output would be differ.\n'''\nx = 11\n\ndef f():\n x = 44\n print \"In f(): x = %d\" % x \n\ndef g():\n print \"In g(): x = %d\" % x \n\nx = 22\nx = 33\nprint \"In block inside main(): x = %d\" % x\n\n\nprint \"In main(): x = %d\" % x \nprint \"In main(): ::x = %d\" % x \nf()\ng()\n",
+ "input": [
+ "\n",
+ "x = 11\n",
+ "\n",
+ "def f():\n",
+ " x = 44\n",
+ " print \"In f(): x = %d\" % x \n",
+ "\n",
+ "def g():\n",
+ " print \"In g(): x = %d\" % x \n",
+ "\n",
+ "x = 22\n",
+ "x = 33\n",
+ "print \"In block inside main(): x = %d\" % x\n",
+ "\n",
+ "\n",
+ "print \"In main(): x = %d\" % x \n",
+ "print \"In main(): ::x = %d\" % x \n",
+ "f()\n",
+ "g()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "In block inside main(): x = 33\nIn main(): x = 33\nIn main(): ::x = 33\nIn f(): x = 44\nIn g(): x = 33\n"
+ "text": [
+ "In block inside main(): x = 33\n",
+ "In main(): x = 33\n",
+ "In main(): ::x = 33\n",
+ "In f(): x = 44\n",
+ "In g(): x = 33\n"
+ ]
}
],
"prompt_number": 20
@@ -599,14 +1377,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.22 \n'''\n\ndef max_(x, y,z=0):\n if x > y and x > y:\n return x\n elif y > x and y > z:\n return y\n else:\n return z\n \n \nprint max(99,77), \" \" , max(55,66,33)\n",
+ "input": [
+ "\n",
+ "def max_(x, y,z=0):\n",
+ " if x > y and x > y:\n",
+ " return x\n",
+ " elif y > x and y > z:\n",
+ " return y\n",
+ " else:\n",
+ " return z\n",
+ " \n",
+ " \n",
+ "print max(99,77), \" \" , max(55,66,33)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "99 66\n"
+ "text": [
+ "99 66\n"
+ ]
}
],
"prompt_number": 21
@@ -614,31 +1406,51 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.23 Using the return Statement to Terminate a Program\n'''\n\n# prints the quotient of two input integers:\nprint \"Enter two integers: \"\nn = int(raw_input())\nd = int(raw_input())\nif (d == 0):\n import sys\n sys.exit(0)\nprint n , \"/\" , d , \" = \" , n/d \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints the quotient of two input integers:\n",
+ "print \"Enter two integers: \"\n",
+ "n = int(raw_input())\n",
+ "d = int(raw_input())\n",
+ "if (d == 0):\n",
+ " import sys\n",
+ " sys.exit(0)\n",
+ "print n , \"/\" , d , \" = \" , n/d \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "8 / 2 = 4\n"
+ "text": [
+ "8 / 2 = 4\n"
+ ]
}
],
"prompt_number": 22
@@ -646,7 +1458,18 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.24 Using the exit() Function to Terminate a Program\n'''\n\ndef reciprocal(x):\n #returns the reciprocal of x:\n if (x == 0):\n import sys\n sys.exit(1); # terminate the program\n return 1.0/x\n\nx = float(raw_input())\nprint reciprocal(x)\n",
+ "input": [
+ "\n",
+ "def reciprocal(x):\n",
+ " #returns the reciprocal of x:\n",
+ " if (x == 0):\n",
+ " import sys\n",
+ " sys.exit(1); # terminate the program\n",
+ " return 1.0/x\n",
+ "\n",
+ "x = float(raw_input())\n",
+ "print reciprocal(x)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -654,12 +1477,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "25\n"
+ "text": [
+ "25\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "0.04\n"
+ "text": [
+ "0.04\n"
+ ]
}
],
"prompt_number": 23
@@ -667,14 +1494,32 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 5.25 Default Parameters\nThis function evaluates the third degree polynomial a0 + a1x + a2x2 + a3x3. \n'''\ndef p(x,a0,a1=0,a2=0,a3=0):\n # returns a0 + a1*x + a2*x^2 + a3*x^3:\n return (a0 + (a1 + (a2 + a3*x)*x)*x)\n\n\n# tests the p() function:\nx = 2.0003\nprint \"p(x,7) = %f\" % p(x,7)\nprint \"p(x,7,6) = %f\" % p(x,7,6)\nprint \"p(x,7,6,5) = %f\" % p(x,7,6,5)\nprint \"p(x,7,6,5,4) = %f\" % p(x,7,6,5,4)\n",
+ "input": [
+ "\n",
+ "def p(x,a0,a1=0,a2=0,a3=0):\n",
+ " # returns a0 + a1*x + a2*x^2 + a3*x^3:\n",
+ " return (a0 + (a1 + (a2 + a3*x)*x)*x)\n",
+ "\n",
+ "\n",
+ "# tests the p() function:\n",
+ "x = 2.0003\n",
+ "print \"p(x,7) = %f\" % p(x,7)\n",
+ "print \"p(x,7,6) = %f\" % p(x,7,6)\n",
+ "print \"p(x,7,6,5) = %f\" % p(x,7,6,5)\n",
+ "print \"p(x,7,6,5,4) = %f\" % p(x,7,6,5,4)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "p(x,7) = 7.000000\np(x,7,6) = 19.001800\np(x,7,6,5) = 39.007800\np(x,7,6,5,4) = 71.022203\n"
+ "text": [
+ "p(x,7) = 7.000000\n",
+ "p(x,7,6) = 19.001800\n",
+ "p(x,7,6,5) = 39.007800\n",
+ "p(x,7,6,5,4) = 71.022203\n"
+ ]
}
],
"prompt_number": 24
@@ -682,7 +1527,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch6.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch6.ipynb
index a355a8d2..191b1c78 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch6.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch6"
+ "name": "",
+ "signature": "sha256:002670bb2c70e6ed5cc1d52c3936c4a90e901b6c8d78abcf5af4402c27118a1a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.1 Using Direct Access on Arrays\n'''\n\na = [0, 0, 0]\na[2] = 55.55\na[0] = 11.11\na[1] = 33.33\nprint \"a[0] = \" , a[0] \nprint \"a[1] = \" , a[1] \nprint \"a[2] = \" , a[2] \n",
+ "input": [
+ "\n",
+ "\n",
+ "a = [0, 0, 0]\n",
+ "a[2] = 55.55\n",
+ "a[0] = 11.11\n",
+ "a[1] = 33.33\n",
+ "print \"a[0] = \" , a[0] \n",
+ "print \"a[1] = \" , a[1] \n",
+ "print \"a[2] = \" , a[2] \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a[0] = 11.11\na[1] = 33.33\na[2] = 55.55\n"
+ "text": [
+ "a[0] = 11.11\n",
+ "a[1] = 33.33\n",
+ "a[2] = 55.55\n"
+ ]
}
],
"prompt_number": 1
@@ -25,49 +40,82 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.2 Printing a Sequence in Order\n'''\n\nSIZE=5 # defines the size N for 5 elements\na = []\n# declares the array's elements as type double\nprint \"Enter \" , SIZE , \" numbers:\\t\"\nfor i in range(SIZE):\n a.append(float(raw_input()))\n \nprint \"In reverse order: \"\nfor i in range(SIZE-1,-1,-1):\n print \"\\t\" , a[i]\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "SIZE=5 # defines the size N for 5 elements\n",
+ "a = []\n",
+ "# declares the array's elements as type double\n",
+ "print \"Enter \" , SIZE , \" numbers:\\t\"\n",
+ "for i in range(SIZE):\n",
+ " a.append(float(raw_input()))\n",
+ " \n",
+ "print \"In reverse order: \"\n",
+ "for i in range(SIZE-1,-1,-1):\n",
+ " print \"\\t\" , a[i]\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 5 numbers:\t\n"
+ "text": [
+ "Enter 5 numbers:\t\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "1\n"
+ "text": [
+ "1\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3.3\n"
+ "text": [
+ "3.3\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4.4\n"
+ "text": [
+ "4.4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5.5\n"
+ "text": [
+ "5.5\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "In reverse order: \n\t5.5\n\t4.4\n\t3.3\n\t2.0\n\t1.0\n"
+ "text": [
+ "In reverse order: \n",
+ "\t5.5\n",
+ "\t4.4\n",
+ "\t3.3\n",
+ "\t2.0\n",
+ "\t1.0\n"
+ ]
}
],
"prompt_number": 2
@@ -75,14 +123,27 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.3 Initializing an Array\nThis program initializes the array a and then prints its values:\n'''\n\na = [ 22.2, 44.4, 66.6 ]\n\nsize = len(a)\nfor i in range(size):\n print \"\\ta[\" , i , \"] = \" , a[i]\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "a = [ 22.2, 44.4, 66.6 ]\n",
+ "\n",
+ "size = len(a)\n",
+ "for i in range(size):\n",
+ " print \"\\ta[\" , i , \"] = \" , a[i]\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ta[ 0 ] = 22.2\n\ta[ 1 ] = 44.4\n\ta[ 2 ] = 66.6\n"
+ "text": [
+ "\ta[ 0 ] = 22.2\n",
+ "\ta[ 1 ] = 44.4\n",
+ "\ta[ 2 ] = 66.6\n"
+ ]
}
],
"prompt_number": 3
@@ -90,14 +151,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.4 Initializing an Array with Trailing Zeros\n'''\n\na = [ 22.2, 44.4, 66.6 , 0 ,0,0,0]\nsize = len(a)\nfor i in range(size):\n print \"\\ta[\" , i , \"] = \" , a[i] \n",
+ "input": [
+ "\n",
+ "\n",
+ "a = [ 22.2, 44.4, 66.6 , 0 ,0,0,0]\n",
+ "size = len(a)\n",
+ "for i in range(size):\n",
+ " print \"\\ta[\" , i , \"] = \" , a[i] \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ta[ 0 ] = 22.2\n\ta[ 1 ] = 44.4\n\ta[ 2 ] = 66.6\n\ta[ 3 ] = 0\n\ta[ 4 ] = 0\n\ta[ 5 ] = 0\n\ta[ 6 ] = 0\n"
+ "text": [
+ "\ta[ 0 ] = 22.2\n",
+ "\ta[ 1 ] = 44.4\n",
+ "\ta[ 2 ] = 66.6\n",
+ "\ta[ 3 ] = 0\n",
+ "\ta[ 4 ] = 0\n",
+ "\ta[ 5 ] = 0\n",
+ "\ta[ 6 ] = 0\n"
+ ]
}
],
"prompt_number": 4
@@ -105,14 +181,27 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.5 An Uninitialized Array\nNOte : In PYthon , we have to initialize array. Without initializing it, it doesn't work.\nArray size is automatically incremented when we push data into it.\n'''\nimport numpy\nSIZE = 4\na = numpy.zeros(4)\n# declares the array's elements as type float\nfor i in range(SIZE):\n print \"\\ta[\" , i , \"] = \" , a[i]\n",
+ "input": [
+ "\n",
+ "import numpy\n",
+ "SIZE = 4\n",
+ "a = numpy.zeros(4)\n",
+ "# declares the array's elements as type float\n",
+ "for i in range(SIZE):\n",
+ " print \"\\ta[\" , i , \"] = \" , a[i]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ta[ 0 ] = 0.0\n\ta[ 1 ] = 0.0\n\ta[ 2 ] = 0.0\n\ta[ 3 ] = 0.0\n"
+ "text": [
+ "\ta[ 0 ] = 0.0\n",
+ "\ta[ 1 ] = 0.0\n",
+ "\ta[ 2 ] = 0.0\n",
+ "\ta[ 3 ] = 0.0\n"
+ ]
}
],
"prompt_number": 5
@@ -120,7 +209,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.6 Allowing an Array Index to Exceed its Bounds\nNOte : Python gives error when this kind of error occurs. so It wont print garbage values after bound exceeds.\n'''\nSIZE=4\na = [ 33.3, 44.4, 55.5, 66.6 ]\nfor i in range(7): # ERROR: index is out of bounds!\n print \"\\ta[\" , i , \"] = \" , a[i] \n\n",
+ "input": [
+ "\n",
+ "SIZE=4\n",
+ "a = [ 33.3, 44.4, 55.5, 66.6 ]\n",
+ "for i in range(7): # ERROR: index is out of bounds!\n",
+ " print \"\\ta[\" , i , \"] = \" , a[i] \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -137,7 +233,13 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ta[ 0 ] = 33.3\n\ta[ 1 ] = 44.4\n\ta[ 2 ] = 55.5\n\ta[ 3 ] = 66.6\n\ta[ 4 ] = "
+ "text": [
+ "\ta[ 0 ] = 33.3\n",
+ "\ta[ 1 ] = 44.4\n",
+ "\ta[ 2 ] = 55.5\n",
+ "\ta[ 3 ] = 66.6\n",
+ "\ta[ 4 ] = "
+ ]
}
],
"prompt_number": 6
@@ -145,14 +247,25 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.7 Causing Side Effects\nThis program inadvertently changes the value of a variable when it accesses a nonexistent element of\nan array:\nNote : Python automatically increase size of array/list. so it wont give error and output would be differ than c gives.\n'''\n\na = [ 22.2, 44.4, 66.6 ]\nx=11.1\nprint \"x = \" , x \na.append(88.8) # ERROR: index is out of bounds!\nprint \"x = \" , x \n",
+ "input": [
+ "\n",
+ "\n",
+ "a = [ 22.2, 44.4, 66.6 ]\n",
+ "x=11.1\n",
+ "print \"x = \" , x \n",
+ "a.append(88.8) # ERROR: index is out of bounds!\n",
+ "print \"x = \" , x \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " x = 11.1\nx = 11.1\n"
+ "text": [
+ " x = 11.1\n",
+ "x = 11.1\n"
+ ]
}
],
"prompt_number": 7
@@ -160,7 +273,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.8 Causing Unhandled Exceptions\nThis program crashes because the array index gets too big:\n'''\na = [ 22.2, 44.4, 66.6 ]\nx=11.1\nprint \"x = \" , x \na[3333] = 88.8 # ERROR: index is out of bounds!\nprint \"x = \" , x \n",
+ "input": [
+ "\n",
+ "a = [ 22.2, 44.4, 66.6 ]\n",
+ "x=11.1\n",
+ "print \"x = \" , x \n",
+ "a[3333] = 88.8 # ERROR: index is out of bounds!\n",
+ "print \"x = \" , x \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -177,7 +297,9 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 11.1\n"
+ "text": [
+ "x = 11.1\n"
+ ]
}
],
"prompt_number": 8
@@ -185,14 +307,27 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.9 Passing an Array to a Function that Returns its Sum\n'''\n\ndef sum_(a):\n s = 0\n for i in a:\n s += i\n return s\n \na = [ 11, 33, 55, 77 ]\nprint \"sum(a) = \" , sum_(a) \n",
+ "input": [
+ "\n",
+ "\n",
+ "def sum_(a):\n",
+ " s = 0\n",
+ " for i in a:\n",
+ " s += i\n",
+ " return s\n",
+ " \n",
+ "a = [ 11, 33, 55, 77 ]\n",
+ "print \"sum(a) = \" , sum_(a) \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "sum(a) = 176\n"
+ "text": [
+ "sum(a) = 176\n"
+ ]
}
],
"prompt_number": 10
@@ -200,49 +335,86 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.10 Input and Output Functions for an Array\nThis program uses a read() function to input values into the array a interactively. Then it uses a\nprint() function to print the array:\n'''\ndef read(a):\n print \"Enter integers. Terminate with 0:\\n\"\n n = 1\n while True:\n n = int(raw_input(\"a[\" + str(len(a)) + \"]: \"))\n if n == 0:\n break\n a.append(n)\n \n\ndef print_(a):\n for i in a:\n print i ,\n\n\na = []\nread(a)\nprint \"The array has \" , len(a) , \" elements: \"\nprint_(a)\n",
+ "input": [
+ "\n",
+ "def read(a):\n",
+ " print \"Enter integers. Terminate with 0:\\n\"\n",
+ " n = 1\n",
+ " while True:\n",
+ " n = int(raw_input(\"a[\" + str(len(a)) + \"]: \"))\n",
+ " if n == 0:\n",
+ " break\n",
+ " a.append(n)\n",
+ " \n",
+ "\n",
+ "def print_(a):\n",
+ " for i in a:\n",
+ " print i ,\n",
+ "\n",
+ "\n",
+ "a = []\n",
+ "read(a)\n",
+ "print \"The array has \" , len(a) , \" elements: \"\n",
+ "print_(a)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter integers. Terminate with 0:\n\n"
+ "text": [
+ "Enter integers. Terminate with 0:\n",
+ "\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[0]: 11\n"
+ "text": [
+ "a[0]: 11\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[1]: 22\n"
+ "text": [
+ "a[1]: 22\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[2]: 33\n"
+ "text": [
+ "a[2]: 33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[3]: 44\n"
+ "text": [
+ "a[3]: 44\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "a[4]: 0\n"
+ "text": [
+ "a[4]: 0\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The array has 4 elements: \n11 22 33 44\n"
+ "text": [
+ "The array has 4 elements: \n",
+ "11 22 33 44\n"
+ ]
}
],
"prompt_number": 12
@@ -250,14 +422,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.11 Printing the Memory Location of an Array\nThis program prints the value of the address stored in an array name.\n'''\nimport sys\na = [ 22, 44, 66, 88 ]\nprint \"a = \" , id(a) # the address of a[0]\n\n",
+ "input": [
+ "\n",
+ "import sys\n",
+ "a = [ 22, 44, 66, 88 ]\n",
+ "print \"a = \" , id(a) # the address of a[0]\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 169156908\n"
+ "text": [
+ "a = 169156908\n"
+ ]
}
],
"prompt_number": 13
@@ -265,14 +445,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.12 The Linear Search\nThis program tests a function that implements the Linear Search algorithm:\n'''\ndef index(x,a,n):\n for i in range(len(a)):\n if (a[i] == x):\n return i\n return n # x not found\n\na = [ 22, 44, 66, 88, 44, 66, 55 ]\nprint \"index(44,a,7) = \" , index(44,a,7)\nprint \"index(50,a,7) = \" , index(50,a,7) \n\n\n",
+ "input": [
+ "\n",
+ "def index(x,a,n):\n",
+ " for i in range(len(a)):\n",
+ " if (a[i] == x):\n",
+ " return i\n",
+ " return n # x not found\n",
+ "\n",
+ "a = [ 22, 44, 66, 88, 44, 66, 55 ]\n",
+ "print \"index(44,a,7) = \" , index(44,a,7)\n",
+ "print \"index(50,a,7) = \" , index(50,a,7) \n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "index(44,a,7) = 1\nindex(50,a,7) = 7\n"
+ "text": [
+ "index(44,a,7) = 1\n",
+ "index(50,a,7) = 7\n"
+ ]
}
],
"prompt_number": 14
@@ -280,14 +476,38 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.13 The Bubble Sort\nThis program tests a function that implements the Bubble Sort algorithm.\n'''\ndef sort(a,n):\n # bubble sort:\n n = len(a)\n for i in range(n):\n # bubble up max{a[0..n-i]}:\n for j in range(n-i-1):\n if (a[j] > a[j+1]):\n a[j],a[j+1] = a[j+1],a[j]\n\ndef print_(a):\n for i in range(len(a)):\n print a[i],\n print ''\n \na = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n\nprint_(a)\nsort(a,8)\nprint_(a)\n",
+ "input": [
+ "\n",
+ "def sort(a,n):\n",
+ " # bubble sort:\n",
+ " n = len(a)\n",
+ " for i in range(n):\n",
+ " # bubble up max{a[0..n-i]}:\n",
+ " for j in range(n-i-1):\n",
+ " if (a[j] > a[j+1]):\n",
+ " a[j],a[j+1] = a[j+1],a[j]\n",
+ "\n",
+ "def print_(a):\n",
+ " for i in range(len(a)):\n",
+ " print a[i],\n",
+ " print ''\n",
+ " \n",
+ "a = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n",
+ "\n",
+ "print_(a)\n",
+ "sort(a,8)\n",
+ "print_(a)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n"
+ "text": [
+ "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n",
+ "22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n"
+ ]
}
],
"prompt_number": 15
@@ -295,14 +515,39 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.14 The Binary Search Algorithm\n'''\n\ndef index(x,a,n):\n # PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\n # binary search:\n lo=0\n hi=n-1\n while (lo <= hi):\n i = (lo + hi)/2 # the average of lo and hi\n if (a[i] == x):\n return i\n if (a[i] < x):\n lo = i+1 # continue search in a[i+1..hi]\n else:\n hi = i-1 # continue search in a[lo..i-1]\n return n # x was not found in a[0..n-1]\n\na = [ 22, 33, 44, 55, 66, 77, 88 ]\nprint \"index(44,a,7) = \" , index(44,a,7)\nprint \"index(60,a,7) = \" , index(60,a,7) \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "def index(x,a,n):\n",
+ " # PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\n",
+ " # binary search:\n",
+ " lo=0\n",
+ " hi=n-1\n",
+ " while (lo <= hi):\n",
+ " i = (lo + hi)/2 # the average of lo and hi\n",
+ " if (a[i] == x):\n",
+ " return i\n",
+ " if (a[i] < x):\n",
+ " lo = i+1 # continue search in a[i+1..hi]\n",
+ " else:\n",
+ " hi = i-1 # continue search in a[lo..i-1]\n",
+ " return n # x was not found in a[0..n-1]\n",
+ "\n",
+ "a = [ 22, 33, 44, 55, 66, 77, 88 ]\n",
+ "print \"index(44,a,7) = \" , index(44,a,7)\n",
+ "print \"index(60,a,7) = \" , index(60,a,7) \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "index(44,a,7) = 2\nindex(60,a,7) = 7\n"
+ "text": [
+ "index(44,a,7) = 2\n",
+ "index(60,a,7) = 7\n"
+ ]
}
],
"prompt_number": 16
@@ -310,14 +555,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.15 Determining whether an Array is Sorted\nThis program tests a boolean function that determines whether a given array is nondecreasing.\n'''\n\ndef isNondecreasing(a,n):\n # returns true iff a[0] <= a[1] <= ... <= a[n-1]:\n for i in range(1,n):\n if (a[i]<a[i-1]):\n return False\n return True\n\na = [ 22, 44, 66, 88, 44, 66, 55 ]\nprint \"isNondecreasing(a,4) = \" , isNondecreasing(a,4)\nprint \"isNondecreasing(a,7) = \" , isNondecreasing(a,7)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def isNondecreasing(a,n):\n",
+ " # returns true iff a[0] <= a[1] <= ... <= a[n-1]:\n",
+ " for i in range(1,n):\n",
+ " if (a[i]<a[i-1]):\n",
+ " return False\n",
+ " return True\n",
+ "\n",
+ "a = [ 22, 44, 66, 88, 44, 66, 55 ]\n",
+ "print \"isNondecreasing(a,4) = \" , isNondecreasing(a,4)\n",
+ "print \"isNondecreasing(a,7) = \" , isNondecreasing(a,7)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "isNondecreasing(a,4) = True\nisNondecreasing(a,7) = False\n"
+ "text": [
+ "isNondecreasing(a,4) = True\n",
+ "isNondecreasing(a,7) = False\n"
+ ]
}
],
"prompt_number": 17
@@ -325,7 +586,39 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.16 Using the assert() Function to Enforce a Precondition\nThis program tests an improved version of the search() function from Example 6.14. This version\nuses the isNondecreasing() function from Example 6.15 to determine whether the array is sorted. It\npasses the resulting boolean return value to the assert() function so that the search will not be carried\nout if the array is not sorted:\n'''\n\ndef isNondecreasing(a,n):\n # returns true iff a[0] <= a[1] <= ... <= a[n-1]:\n for i in range(1,n):\n if (a[i]<a[i-1]):\n return False\n return True\n\n\ndef index(x,a,n):\n # PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\n # binary search:\n assert(isNondecreasing(a,n)) \n \n lo=0\n hi=n-1\n while (lo <= hi):\n i = (lo + hi)/2\n if (a[i] == x):\n return i\n if (a[i] < x):\n lo = i+1 # continue search in a[i+1..hi]\n else:\n hi = i-1 # continue search in a[lo..i-1]\n return n # x was not found in a[0..n-1]\n\na = [ 22, 33, 44, 55, 66, 77, 88, 60 ]\nprint \"index(44,a,7) = \" , index(44,a,7) \nprint \"index(44,a,8.py) = \" , index(44,a,8) \nprint \"index(60,a,7) = \" , index(60,a,8)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def isNondecreasing(a,n):\n",
+ " # returns true iff a[0] <= a[1] <= ... <= a[n-1]:\n",
+ " for i in range(1,n):\n",
+ " if (a[i]<a[i-1]):\n",
+ " return False\n",
+ " return True\n",
+ "\n",
+ "\n",
+ "def index(x,a,n):\n",
+ " # PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\n",
+ " # binary search:\n",
+ " assert(isNondecreasing(a,n)) \n",
+ " \n",
+ " lo=0\n",
+ " hi=n-1\n",
+ " while (lo <= hi):\n",
+ " i = (lo + hi)/2\n",
+ " if (a[i] == x):\n",
+ " return i\n",
+ " if (a[i] < x):\n",
+ " lo = i+1 # continue search in a[i+1..hi]\n",
+ " else:\n",
+ " hi = i-1 # continue search in a[lo..i-1]\n",
+ " return n # x was not found in a[0..n-1]\n",
+ "\n",
+ "a = [ 22, 33, 44, 55, 66, 77, 88, 60 ]\n",
+ "print \"index(44,a,7) = \" , index(44,a,7) \n",
+ "print \"index(44,a,8.py) = \" , index(44,a,8) \n",
+ "print \"index(60,a,7) = \" , index(60,a,8)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -343,7 +636,10 @@
{
"output_type": "stream",
"stream": "stdout",
- "text": "index(44,a,7) = 2\nindex(44,a,7) = "
+ "text": [
+ "index(44,a,7) = 2\n",
+ "index(44,a,7) = "
+ ]
}
],
"prompt_number": 18
@@ -351,14 +647,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.17 Enumerating the Days of the Week\nThis program defines an array high[] of seven floats, representing the high temperatures for\nthe seven days of a week: 138\n'''\nDay = [ 0, 1, 2, 3, 4, 5, 6 ]\nhigh = [ 88.3, 95.0, 91.2, 89.9, 91.4, 92.5, 86.7]\n\nfor i in Day:\n print \"The high temperature for day \" , i , \" was \" , high[i] \n\n",
+ "input": [
+ "\n",
+ "Day = [ 0, 1, 2, 3, 4, 5, 6 ]\n",
+ "high = [ 88.3, 95.0, 91.2, 89.9, 91.4, 92.5, 86.7]\n",
+ "\n",
+ "for i in Day:\n",
+ " print \"The high temperature for day \" , i , \" was \" , high[i] \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " The high temperature for day 0 was 88.3\nThe high temperature for day 1 was 95.0\nThe high temperature for day 2 was 91.2\nThe high temperature for day 3 was 89.9\nThe high temperature for day 4 was 91.4\nThe high temperature for day 5 was 92.5\nThe high temperature for day 6 was 86.7\n"
+ "text": [
+ " The high temperature for day 0 was 88.3\n",
+ "The high temperature for day 1 was 95.0\n",
+ "The high temperature for day 2 was 91.2\n",
+ "The high temperature for day 3 was 89.9\n",
+ "The high temperature for day 4 was 91.4\n",
+ "The high temperature for day 5 was 92.5\n",
+ "The high temperature for day 6 was 86.7\n"
+ ]
}
],
"prompt_number": 19
@@ -366,14 +678,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.18 The Bubble Sort Again\n'''\n\ndef sort(a,n):\n a.sort()\n\ndef print_(a,n):\n for i in a:\n print i,\n print ''\na = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\nprint_(a,8);\nsort(a,8)\nprint_(a,8)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def sort(a,n):\n",
+ " a.sort()\n",
+ "\n",
+ "def print_(a,n):\n",
+ " for i in a:\n",
+ " print i,\n",
+ " print ''\n",
+ "a = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n",
+ "print_(a,8);\n",
+ "sort(a,8)\n",
+ "print_(a,8)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n"
+ "text": [
+ "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n",
+ "22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n"
+ ]
}
],
"prompt_number": 20
@@ -381,119 +710,180 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.19 Reading and Printing a Two-Dimensional Array\nThis program shows how a two-dimensional array can be processed:\n'''\n\ndef read(a):\n print \"Enter 15 integers, 5 per row:\\n\"\n for i in range(3):\n ar = []\n print \"Row \" , i , \": \",\n for j in range(5):\n ar.append(int(raw_input()))\n a.append(ar)\n\ndef print_(a):\n for i in range(3):\n for j in range(5):\n print a[i][j],\n print ''\na = []\nread(a)\nprint_(a)\n",
+ "input": [
+ "\n",
+ "def read(a):\n",
+ " print \"Enter 15 integers, 5 per row:\\n\"\n",
+ " for i in range(3):\n",
+ " ar = []\n",
+ " print \"Row \" , i , \": \",\n",
+ " for j in range(5):\n",
+ " ar.append(int(raw_input()))\n",
+ " a.append(ar)\n",
+ "\n",
+ "def print_(a):\n",
+ " for i in range(3):\n",
+ " for j in range(5):\n",
+ " print a[i][j],\n",
+ " print ''\n",
+ "a = []\n",
+ "read(a)\n",
+ "print_(a)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 15 integers, 5 per row:\n\nRow 0 : "
+ "text": [
+ "Enter 15 integers, 5 per row:\n",
+ "\n",
+ "Row 0 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77\n"
+ "text": [
+ "77\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33\n"
+ "text": [
+ "33\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "11\n"
+ "text": [
+ "11\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Row 1 : "
+ "text": [
+ " Row 1 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "60\n"
+ "text": [
+ "60\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "50\n"
+ "text": [
+ "50\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "30\n"
+ "text": [
+ "30\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "90\n"
+ "text": [
+ "90\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "70\n"
+ "text": [
+ "70\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Row 2 : "
+ "text": [
+ " Row 2 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "85\n"
+ "text": [
+ "85\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "25\n"
+ "text": [
+ "25\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "45\n"
+ "text": [
+ "45\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "45\n"
+ "text": [
+ "45\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "55\n"
+ "text": [
+ "55\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 44 77 33 11 44 \n60 50 30 90 70 \n85 25 45 45 55 \n"
+ "text": [
+ " 44 77 33 11 44 \n",
+ "60 50 30 90 70 \n",
+ "85 25 45 45 55 \n"
+ ]
}
],
"prompt_number": 21
@@ -501,119 +891,204 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.20 Processing a Two-Dimensional Array of Quiz Scores\n'''\ndef read(score):\n for s in range(3):\n print \"Student \" , s , \": \",\n st = []\n for q in range(5):\n st.append(int(raw_input()))\n score.append(st)\n\ndef printQuizAverages(score):\n for s in range(3):\n sm = 0\n for q in range(5):\n sm += score[s][q]\n print \"\\tStudent \" , s , \": \" , sm/5.0\n\ndef printClassAverages(score):\n for q in range(5):\n sm = 0\n for s in range(3):\n sm += score[s][q]\n print \"\\tQuiz \" , q , \": \" , sm/3.0\n\n\n\nNUM_STUDENTS = 3\nNUM_QUIZZES = 5\n\n\nscore = []\nprint \"Enter \" , NUM_QUIZZES , \" scores for each student: \"\nread(score)\nprint \"The quiz averages are:\"\nprintQuizAverages(score)\nprint \"The class averages are: \"\nprintClassAverages(score)\n",
+ "input": [
+ "\n",
+ "def read(score):\n",
+ " for s in range(3):\n",
+ " print \"Student \" , s , \": \",\n",
+ " st = []\n",
+ " for q in range(5):\n",
+ " st.append(int(raw_input()))\n",
+ " score.append(st)\n",
+ "\n",
+ "def printQuizAverages(score):\n",
+ " for s in range(3):\n",
+ " sm = 0\n",
+ " for q in range(5):\n",
+ " sm += score[s][q]\n",
+ " print \"\\tStudent \" , s , \": \" , sm/5.0\n",
+ "\n",
+ "def printClassAverages(score):\n",
+ " for q in range(5):\n",
+ " sm = 0\n",
+ " for s in range(3):\n",
+ " sm += score[s][q]\n",
+ " print \"\\tQuiz \" , q , \": \" , sm/3.0\n",
+ "\n",
+ "\n",
+ "\n",
+ "NUM_STUDENTS = 3\n",
+ "NUM_QUIZZES = 5\n",
+ "\n",
+ "\n",
+ "score = []\n",
+ "print \"Enter \" , NUM_QUIZZES , \" scores for each student: \"\n",
+ "read(score)\n",
+ "print \"The quiz averages are:\"\n",
+ "printQuizAverages(score)\n",
+ "print \"The class averages are: \"\n",
+ "printClassAverages(score)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 5 scores for each student: \nStudent 0 : "
+ "text": [
+ "Enter 5 scores for each student: \n",
+ "Student 0 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Student 1 : "
+ "text": [
+ " Student 1 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " Student 2 : "
+ "text": [
+ " Student 2 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "5\n"
+ "text": [
+ "5\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "6\n"
+ "text": [
+ "6\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "7\n"
+ "text": [
+ "7\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "8\n"
+ "text": [
+ "8\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9\n"
+ "text": [
+ "9\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " The quiz averages are:\n\tStudent 0 : 8.2\n\tStudent 1 : 8.8\n\tStudent 2 : 7.0\nThe class averages are: \n\tQuiz 0 : 7.33333333333\n\tQuiz 1 : 7.33333333333\n\tQuiz 2 : 8.33333333333\n\tQuiz 3 : 8.33333333333\n\tQuiz 4 : 8.66666666667\n"
+ "text": [
+ " The quiz averages are:\n",
+ "\tStudent 0 : 8.2\n",
+ "\tStudent 1 : 8.8\n",
+ "\tStudent 2 : 7.0\n",
+ "The class averages are: \n",
+ "\tQuiz 0 : 7.33333333333\n",
+ "\tQuiz 1 : 7.33333333333\n",
+ "\tQuiz 2 : 8.33333333333\n",
+ "\tQuiz 3 : 8.33333333333\n",
+ "\tQuiz 4 : 8.66666666667\n"
+ ]
}
],
"prompt_number": 24
@@ -621,14 +1096,31 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 6.21 Processing a Three-Dimensional Array\nThis program simply counts the number of zeros in a three-dimensional array:\n'''\n\ndef numZeros(a,n1,n2,n3):\n count = 0\n for i in range(n1):\n for j in range(n2):\n for k in range(n3):\n if (a[i][j][k] == 0):\n count += 1\n return count\n\n\na = [ [ [5,0,2], [0,0,9], [4,1,0], [7,7,7] ],[ [3,0,0], [8,5,0], [0,0,0], [2,0,9] ]]\nprint \"This array has \" , numZeros(a,2,4,3) , \" zeros\"\n\n",
+ "input": [
+ "\n",
+ "def numZeros(a,n1,n2,n3):\n",
+ " count = 0\n",
+ " for i in range(n1):\n",
+ " for j in range(n2):\n",
+ " for k in range(n3):\n",
+ " if (a[i][j][k] == 0):\n",
+ " count += 1\n",
+ " return count\n",
+ "\n",
+ "\n",
+ "a = [ [ [5,0,2], [0,0,9], [4,1,0], [7,7,7] ],[ [3,0,0], [8,5,0], [0,0,0], [2,0,9] ]]\n",
+ "print \"This array has \" , numZeros(a,2,4,3) , \" zeros\"\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "This array has 11 zeros\n"
+ "text": [
+ "This array has 11 zeros\n"
+ ]
}
],
"prompt_number": 25
@@ -636,7 +1128,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch7.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch7.ipynb
index f480fc86..ddb6c93a 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch7.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch7"
+ "name": "",
+ "signature": "sha256:377256b0fa2c7d29cc10649b14b8b11810b96406c47eeeedd29df767b23be14b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,24 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.1 Printing Pointer Values\n'''\n\nn=44\nprint \"n = \" , n \n# prints the value of n\nprint \"&n = \" , hex(id(n)) # prints the address of n\n",
+ "input": [
+ "\n",
+ "\n",
+ "n=44\n",
+ "print \"n = \" , n \n",
+ "# prints the value of n\n",
+ "print \"&n = \" , hex(id(n)) # prints the address of n\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n&n = 0x8fc0eec\n"
+ "text": [
+ "n = 44\n",
+ "&n = 0x8fc0eec\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +36,30 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.2\nNote : Python doesn't support reference/pointer variable. But can be achieved by using mutable datatypes i.e. list.\n'''\n\n\nn = [44]\nrn=n # r is a synonym for n\nprint \"n = \" , n , \", rn = \" , rn \nn[0] -= 1\nprint \"n = \" , n , \", rn = \" , rn \nrn[0] *= 2\nprint \"n = \" , n , \", rn = \" , rn \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "n = [44]\n",
+ "rn=n # r is a synonym for n\n",
+ "print \"n = \" , n , \", rn = \" , rn \n",
+ "n[0] -= 1\n",
+ "print \"n = \" , n , \", rn = \" , rn \n",
+ "rn[0] *= 2\n",
+ "print \"n = \" , n , \", rn = \" , rn \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] , rn = [44]\nn = [43] , rn = [43]\nn = [86] , rn = [86]\n"
+ "text": [
+ "n = [44] , rn = [44]\n",
+ "n = [43] , rn = [43]\n",
+ "n = [86] , rn = [86]\n"
+ ]
}
],
"prompt_number": 2
@@ -40,14 +67,26 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.3 References Are Not Separate Variables\n'''\n\n\nn = [44]\nrn=n # r is a synonym for n\nprint \"&n = \" , hex(id(n)) , \", rn = \" , hex(id(rn ))\nrn2 = n\nrn3 = rn\nprint \"&rn2 = \" , hex(id(rn2)) , \", rn = \" , hex(id(rn ))\n",
+ "input": [
+ "\n",
+ "\n",
+ "n = [44]\n",
+ "rn=n # r is a synonym for n\n",
+ "print \"&n = \" , hex(id(n)) , \", rn = \" , hex(id(rn ))\n",
+ "rn2 = n\n",
+ "rn3 = rn\n",
+ "print \"&rn2 = \" , hex(id(rn2)) , \", rn = \" , hex(id(rn ))\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "&n = 0x9c6228c , rn = 0x9c6228c\n&rn2 = 0x9c6228c , rn = 0x9c6228c\n"
+ "text": [
+ "&n = 0x9c6228c , rn = 0x9c6228c\n",
+ "&rn2 = 0x9c6228c , rn = 0x9c6228c\n"
+ ]
}
],
"prompt_number": 3
@@ -55,14 +94,26 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.4 Using Pointer Variables\n\n'''\n\nn = [44]\nprint \"n = \" , n , \", &n = \" , hex(id(n))\npn = n\nprint \"pn = \" , hex(id(pn)) , \", &pn = \" , hex(id(hex(id(pn))))\n\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "n = [44]\n",
+ "print \"n = \" , n , \", &n = \" , hex(id(n))\n",
+ "pn = n\n",
+ "print \"pn = \" , hex(id(pn)) , \", &pn = \" , hex(id(hex(id(pn))))\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] , &n = 0x9c624ec\npn = 0x9c624ec , &pn = 0x9c6aa60\n"
+ "text": [
+ "n = [44] , &n = 0x9c624ec\n",
+ "pn = 0x9c624ec , &pn = 0x9c6aa60\n"
+ ]
}
],
"prompt_number": 4
@@ -70,14 +121,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.5\n'''\n\nn = [44]\nprint \"n = \" , n , \", &n = \" , hex(id(n))\npn = n\nprint \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\nprint \"*pn = \" , pn\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "n = [44]\n",
+ "print \"n = \" , n , \", &n = \" , hex(id(n))\n",
+ "pn = n\n",
+ "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"*pn = \" , pn\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] , &n = 0x9c58d6c\n\tpn = 0x9c58d6c ,\n &pn = 0x9c6ab20\n*pn = [44]\n"
+ "text": [
+ "n = [44] , &n = 0x9c58d6c\n",
+ "\tpn = 0x9c58d6c ,\n",
+ " &pn = 0x9c6ab20\n",
+ "*pn = [44]\n"
+ ]
}
],
"prompt_number": 5
@@ -85,14 +150,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.6 \n'''\n\nn = [44]\nprint \"n = \" , n , \", &n = \" , hex(id(n))\npn = n\nprint \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\nprint \"*pn = \" , pn\nppn = pn\n\nprint \" ppn = \" , hex(id(hex(id(ppn)))) \nprint \" &ppn = \" , hex(id(hex(id(hex(id(ppn))))))\nprint \" *ppn = \" , hex(id(ppn)) \nprint \"**ppn = \" , ppn \n",
+ "input": [
+ "\n",
+ "n = [44]\n",
+ "print \"n = \" , n , \", &n = \" , hex(id(n))\n",
+ "pn = n\n",
+ "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"*pn = \" , pn\n",
+ "ppn = pn\n",
+ "\n",
+ "print \" ppn = \" , hex(id(hex(id(ppn)))) \n",
+ "print \" &ppn = \" , hex(id(hex(id(hex(id(ppn))))))\n",
+ "print \" *ppn = \" , hex(id(ppn)) \n",
+ "print \"**ppn = \" , ppn \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] , &n = 0x9bf05ac\n\tpn = 0x9bf05ac ,\n &pn = 0x9c58160\n*pn = [44]\n ppn = 0x9c58680\n &ppn = 0x9c58160\n *ppn = 0x9bf05ac\n**ppn = [44]\n"
+ "text": [
+ "n = [44] , &n = 0x9bf05ac\n",
+ "\tpn = 0x9bf05ac ,\n",
+ " &pn = 0x9c58160\n",
+ "*pn = [44]\n",
+ " ppn = 0x9c58680\n",
+ " &ppn = 0x9c58160\n",
+ " *ppn = 0x9bf05ac\n",
+ "**ppn = [44]\n"
+ ]
}
],
"prompt_number": 6
@@ -100,14 +187,39 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.7\n'''\n\nn = [44]\nprint \"n = \" , n , \"\\n &n = \" , hex(id(n))\npn = n\nprint \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\nprint \"*pn = \" , pn\nnn = pn\nprint \" ppn = \" , hex(id(nn))\nprint \" &ppn = \" , hex(id(hex(id(nn))))\nrpn = pn\nprint \" ppn = \" , hex(id(rpn))\nprint \" &ppn = \" , hex(id(hex(id(rpn))))\n\n\n",
+ "input": [
+ "\n",
+ "n = [44]\n",
+ "print \"n = \" , n , \"\\n &n = \" , hex(id(n))\n",
+ "pn = n\n",
+ "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"*pn = \" , pn\n",
+ "nn = pn\n",
+ "print \" ppn = \" , hex(id(nn))\n",
+ "print \" &ppn = \" , hex(id(hex(id(nn))))\n",
+ "rpn = pn\n",
+ "print \" ppn = \" , hex(id(rpn))\n",
+ "print \" &ppn = \" , hex(id(hex(id(rpn))))\n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = [44] \n &n = 0x9bf60ec\n\tpn = 0x9bf60ec ,\n &pn = 0x9bf0e40\n*pn = [44]\n ppn = 0x9bf60ec\n &ppn = 0x9bf0e40\n ppn = 0x9bf60ec\n &ppn = 0x9bf0f20\n"
+ "text": [
+ "n = [44] \n",
+ " &n = 0x9bf60ec\n",
+ "\tpn = 0x9bf60ec ,\n",
+ " &pn = 0x9bf0e40\n",
+ "*pn = [44]\n",
+ " ppn = 0x9bf60ec\n",
+ " &ppn = 0x9bf0e40\n",
+ " ppn = 0x9bf60ec\n",
+ " &ppn = 0x9bf0f20\n"
+ ]
}
],
"prompt_number": 7
@@ -115,14 +227,32 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.8\n'''\n\ndef max_(m,n):\n if m>n:\n return m\n else:\n return n\n\nm = 44\nn = 22\nprint m , \", \" , n , \", \" , max_(m,n)\nm = max_(m,n) \nm = 55\n# changes the value of m from 44 to 55\nprint m , \", \" , n , \", \" , max_(m,n) \n",
+ "input": [
+ "\n",
+ "def max_(m,n):\n",
+ " if m>n:\n",
+ " return m\n",
+ " else:\n",
+ " return n\n",
+ "\n",
+ "m = 44\n",
+ "n = 22\n",
+ "print m , \", \" , n , \", \" , max_(m,n)\n",
+ "m = max_(m,n) \n",
+ "m = 55\n",
+ "# changes the value of m from 44 to 55\n",
+ "print m , \", \" , n , \", \" , max_(m,n) \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "44 , 22 , 44\n55 , 22 , 55\n"
+ "text": [
+ "44 , 22 , 44\n",
+ "55 , 22 , 55\n"
+ ]
}
],
"prompt_number": 8
@@ -130,14 +260,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.9 \n'''\n\nv = []\nfor k in range(1,5):\n v.append(1.0/k)\n\nfor i in range(4):\n print \"v[\" , i , \"] = \" , v[i]\n",
+ "input": [
+ "\n",
+ "\n",
+ "v = []\n",
+ "for k in range(1,5):\n",
+ " v.append(1.0/k)\n",
+ "\n",
+ "for i in range(4):\n",
+ " print \"v[\" , i , \"] = \" , v[i]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "v[ 0 ] = 1.0\nv[ 1 ] = 0.5\nv[ 2 ] = 0.333333333333\nv[ 3 ] = 0.25\n"
+ "text": [
+ "v[ 0 ] = 1.0\n",
+ "v[ 1 ] = 0.5\n",
+ "v[ 2 ] = 0.333333333333\n",
+ "v[ 3 ] = 0.25\n"
+ ]
}
],
"prompt_number": 9
@@ -145,14 +289,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.10 \n'''\nimport sys\na = [22, 33, 44]\n\nprint \"a = \" , hex(id(a))\nprint \"sizeof(int) = \" , sys.getsizeof(1) \ns = 0\nfor i in a:\n s += i\n print \"\\t i = \" , hex(id(i)),\n print \"\\t *i = \" , i,\n print \"\\t sum = \" , s\n\n",
+ "input": [
+ "\n",
+ "import sys\n",
+ "a = [22, 33, 44]\n",
+ "\n",
+ "print \"a = \" , hex(id(a))\n",
+ "print \"sizeof(int) = \" , sys.getsizeof(1) \n",
+ "s = 0\n",
+ "for i in a:\n",
+ " s += i\n",
+ " print \"\\t i = \" , hex(id(i)),\n",
+ " print \"\\t *i = \" , i,\n",
+ " print \"\\t sum = \" , s\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 0x9bf688c\nsizeof(int) = 12\n\t i = 0x8fc0ff4 \t *i = 22 \t sum = 22\n\t i = 0x8fc0f70 \t *i = 33 \t sum = 55\n\t i = 0x8fc0eec \t *i = 44 \t sum = 99\n"
+ "text": [
+ "a = 0x9bf688c\n",
+ "sizeof(int) = 12\n",
+ "\t i = 0x8fc0ff4 \t *i = 22 \t sum = 22\n",
+ "\t i = 0x8fc0f70 \t *i = 33 \t sum = 55\n",
+ "\t i = 0x8fc0eec \t *i = 44 \t sum = 99\n"
+ ]
}
],
"prompt_number": 10
@@ -160,14 +324,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.11 Examining the Addresses of Array Elements\n'''\n\na = [22, 33, 44, 55, 66]\nprint \"a = \" , hex(id(a)) , \", *a = \" , a[0] \nfor p in a:\n print \"p = \" , hex(id(p)) , \", *p = \" , p \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "a = [22, 33, 44, 55, 66]\n",
+ "print \"a = \" , hex(id(a)) , \", *a = \" , a[0] \n",
+ "for p in a:\n",
+ " print \"p = \" , hex(id(p)) , \", *p = \" , p \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "a = 0x9c6526c , *a = 22\np = 0x8fc0ff4 , *p = 22\np = 0x8fc0f70 , *p = 33\np = 0x8fc0eec , *p = 44\np = 0x8fc0e68 , *p = 55\np = 0x8fc0de4 , *p = 66\n"
+ "text": [
+ "a = 0x9c6526c , *a = 22\n",
+ "p = 0x8fc0ff4 , *p = 22\n",
+ "p = 0x8fc0f70 , *p = 33\n",
+ "p = 0x8fc0eec , *p = 44\n",
+ "p = 0x8fc0e68 , *p = 55\n",
+ "p = 0x8fc0de4 , *p = 66\n"
+ ]
}
],
"prompt_number": 11
@@ -175,14 +354,44 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.12 Pattern Matching\n'''\n\ndef loc(a1,a2,n1,n2):\n p = []\n for element in a2:\n if element in a1:\n p.append(element)\n return p\n\na1 = [11, 11, 11, 11, 11, 22, 33, 44, 55]\na2 = [11, 11, 11, 22, 33]\nprint \"Array a1 begins at location\\t\" , hex(id(a1 ))\nprint \"Array a2 begins at location\\t\" , hex(id(a2)) \np = loc(a1, a2, 9, 5)\nif (p):\n print \"Array a2 found at location\\t\" , hex(id(p))\n for i in range(len(p)):\n print \"\\t\" , hex(id(p[i])) , \": \" , p[i], \"\\t\" , hex(id(a2[i])) , \": \" , a2[i] \nelse:\n print \"Not found.\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "def loc(a1,a2,n1,n2):\n",
+ " p = []\n",
+ " for element in a2:\n",
+ " if element in a1:\n",
+ " p.append(element)\n",
+ " return p\n",
+ "\n",
+ "a1 = [11, 11, 11, 11, 11, 22, 33, 44, 55]\n",
+ "a2 = [11, 11, 11, 22, 33]\n",
+ "print \"Array a1 begins at location\\t\" , hex(id(a1 ))\n",
+ "print \"Array a2 begins at location\\t\" , hex(id(a2)) \n",
+ "p = loc(a1, a2, 9, 5)\n",
+ "if (p):\n",
+ " print \"Array a2 found at location\\t\" , hex(id(p))\n",
+ " for i in range(len(p)):\n",
+ " print \"\\t\" , hex(id(p[i])) , \": \" , p[i], \"\\t\" , hex(id(a2[i])) , \": \" , a2[i] \n",
+ "else:\n",
+ " print \"Not found.\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Array a1 begins at location\t0x9bea56c\nArray a2 begins at location\t0x9bea62c\nArray a2 found at location\t0x9bea6cc\n\t0x8fc1078 : 11 \t0x8fc1078 : 11\n\t0x8fc1078 : 11 \t0x8fc1078 : 11\n\t0x8fc1078 : 11 \t0x8fc1078 : 11\n\t0x8fc0ff4 : 22 \t0x8fc0ff4 : 22\n\t0x8fc0f70 : 33 \t0x8fc0f70 : 33\n"
+ "text": [
+ "Array a1 begins at location\t0x9bea56c\n",
+ "Array a2 begins at location\t0x9bea62c\n",
+ "Array a2 found at location\t0x9bea6cc\n",
+ "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n",
+ "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n",
+ "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n",
+ "\t0x8fc0ff4 : 22 \t0x8fc0ff4 : 22\n",
+ "\t0x8fc0f70 : 33 \t0x8fc0f70 : 33\n"
+ ]
}
],
"prompt_number": 12
@@ -190,102 +399,161 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.15 Using Dynamic Arrays\n'''\n\ndef get(a):\n print \"Enter number of items: \"\n n = int(raw_input())\n print \"Enter \" , n , \" items, one per line:\"\n for i in range(n):\n print \"\\t\" , i+1 , \": \",\n a.append(float(raw_input()))\n\ndef print_(a):\n for i in range(len(a)):\n print a[i] ,\n print ''\n\na = []\nget(a)\nprint_(a)\na = []\nget(a)\nprint_(a)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def get(a):\n",
+ " print \"Enter number of items: \"\n",
+ " n = int(raw_input())\n",
+ " print \"Enter \" , n , \" items, one per line:\"\n",
+ " for i in range(n):\n",
+ " print \"\\t\" , i+1 , \": \",\n",
+ " a.append(float(raw_input()))\n",
+ "\n",
+ "def print_(a):\n",
+ " for i in range(len(a)):\n",
+ " print a[i] ,\n",
+ " print ''\n",
+ "\n",
+ "a = []\n",
+ "get(a)\n",
+ "print_(a)\n",
+ "a = []\n",
+ "get(a)\n",
+ "print_(a)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter number of items: \n"
+ "text": [
+ "Enter number of items: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4\n"
+ "text": [
+ "4\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 4 items, one per line:\n\t1 : "
+ "text": [
+ "Enter 4 items, one per line:\n",
+ "\t1 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44.4\n"
+ "text": [
+ "44.4\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t2 : "
+ "text": [
+ " \t2 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "77.7\n"
+ "text": [
+ "77.7\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t3 : "
+ "text": [
+ " \t3 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "22.2\n"
+ "text": [
+ "22.2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t4 : "
+ "text": [
+ " \t4 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "88.8\n"
+ "text": [
+ "88.8\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 44.4 77.7 22.2 88.8 \nEnter number of items: \n"
+ "text": [
+ " 44.4 77.7 22.2 88.8 \n",
+ "Enter number of items: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2\n"
+ "text": [
+ "2\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter 2 items, one per line:\n\t1 : "
+ "text": [
+ "Enter 2 items, one per line:\n",
+ "\t1 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "3.33\n"
+ "text": [
+ "3.33\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " \t2 : "
+ "text": [
+ " \t2 : "
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "9.99\n"
+ "text": [
+ "9.99\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": " 3.33 9.99 \n"
+ "text": [
+ " 3.33 9.99 \n"
+ ]
}
],
"prompt_number": 13
@@ -293,7 +561,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.17 Indirect Bubble Sort\n'''\n\ndef sort(p, n):\n for i in range(1,n):\n for j in range(n-i):\n if (p[j] > p[j+1]):\n p[j],p[j+1] = p[j+1],p[j]\n",
+ "input": [
+ "\n",
+ "\n",
+ "def sort(p, n):\n",
+ " for i in range(1,n):\n",
+ " for j in range(n-i):\n",
+ " if (p[j] > p[j+1]):\n",
+ " p[j],p[j+1] = p[j+1],p[j]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -302,14 +578,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 7.18 The Sum of a Function\n'''\n\ndef sum_(k,n):\n # returns the sum f(0) + f(1) + f(2) + . . . + f(n-1):\n s = 0\n for i in range(1,n+1):\n s += k(i)\n return s\n\ndef square(k):\n return k*k\n\ndef cube(k):\n return k*k*k\n\n\nprint sum_(square,4) # 1 + 4 + 9 + 16\nprint sum_(cube,4) # 1 + 8 + 27 + 64\n\n",
+ "input": [
+ "\n",
+ "def sum_(k,n):\n",
+ " # returns the sum f(0) + f(1) + f(2) + . . . + f(n-1):\n",
+ " s = 0\n",
+ " for i in range(1,n+1):\n",
+ " s += k(i)\n",
+ " return s\n",
+ "\n",
+ "def square(k):\n",
+ " return k*k\n",
+ "\n",
+ "def cube(k):\n",
+ " return k*k*k\n",
+ "\n",
+ "\n",
+ "print sum_(square,4) # 1 + 4 + 9 + 16\n",
+ "print sum_(cube,4) # 1 + 8 + 27 + 64\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "30\n100\n"
+ "text": [
+ "30\n",
+ "100\n"
+ ]
}
],
"prompt_number": 15
@@ -317,7 +615,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch8.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch8.ipynb
index 033f6e3f..8240c86e 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch8.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch8.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch8"
+ "name": "",
+ "signature": "sha256:b1974020eda324caef25f3f8ac3993a694e8efd28b1849e70acd6d105ee7a937"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,76 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "\"\"\"\nEXAMPLE 8.1\n\"\"\"\n\nn= [44] # n holds the int 44\nprint \"int n=44; // n holds the int 44:\\n\";\nprint \"\\t\\t n = \" , n \nprint \"\\t\\t &n = \" , hex(id(n))\npn = n \nprint \"int* pn=&n; // pn holds the address of n:\\n\";\nprint \"\\t\\t n = \" , n \nprint \"\\t\\t &n = \" , hex(id(n))\nprint \"\\t\\t pn = \" , hex(id(pn)) \nprint \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\nprint \"\\t\\t *pn = \" , pn\n\npn[0] = 77 # changes the value of n to 77\nprint \"*pn = 77; // changes the value of n to 77:\\n\";\nprint \"\\t\\t n = \" , n \nprint \"\\t\\t &n = \" , hex(id(n))\nprint \"\\t\\t pn = \" , hex(id(pn)) \nprint \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\nprint \"\\t\\t *pn = \" , pn\n\nq = n \nprint \"int* q=&n; // q also holds the address of n:\\n\";\nprint \"\\t\\t n = \" , n \nprint \"\\t\\t &n = \" , hex(id(n))\nprint \"\\t\\t pn = \" , hex(id(pn)) \nprint \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\nprint \"\\t\\t *pn = \" , pn\nprint \"\\t\\t q = \" , hex(id(q))\nprint \"\\t\\t &q = \" , hex(id(hex(id(hex(id(pn))))))\nprint \"\\t\\t *q = \" , q \n\n",
+ "input": [
+ "\n",
+ "n= [44] # n holds the int 44\n",
+ "print \"int n=44; // n holds the int 44:\\n\";\n",
+ "print \"\\t\\t n = \" , n \n",
+ "print \"\\t\\t &n = \" , hex(id(n))\n",
+ "pn = n \n",
+ "print \"int* pn=&n; // pn holds the address of n:\\n\";\n",
+ "print \"\\t\\t n = \" , n \n",
+ "print \"\\t\\t &n = \" , hex(id(n))\n",
+ "print \"\\t\\t pn = \" , hex(id(pn)) \n",
+ "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"\\t\\t *pn = \" , pn\n",
+ "\n",
+ "pn[0] = 77 # changes the value of n to 77\n",
+ "print \"*pn = 77; // changes the value of n to 77:\\n\";\n",
+ "print \"\\t\\t n = \" , n \n",
+ "print \"\\t\\t &n = \" , hex(id(n))\n",
+ "print \"\\t\\t pn = \" , hex(id(pn)) \n",
+ "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"\\t\\t *pn = \" , pn\n",
+ "\n",
+ "q = n \n",
+ "print \"int* q=&n; // q also holds the address of n:\\n\";\n",
+ "print \"\\t\\t n = \" , n \n",
+ "print \"\\t\\t &n = \" , hex(id(n))\n",
+ "print \"\\t\\t pn = \" , hex(id(pn)) \n",
+ "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n",
+ "print \"\\t\\t *pn = \" , pn\n",
+ "print \"\\t\\t q = \" , hex(id(q))\n",
+ "print \"\\t\\t &q = \" , hex(id(hex(id(hex(id(pn))))))\n",
+ "print \"\\t\\t *q = \" , q \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "int n=44; // n holds the int 44:\n\n\t\t n = [44]\n\t\t &n = 0x9bfb92c\nint* pn=&n; // pn holds the address of n:\n\n\t\t n = [44]\n\t\t &n = 0x9bfb92c\n\t\t pn = 0x9bfb92c\n\t\t &pn = 0x9bf5aa0\n\t\t *pn = [44]\n*pn = 77; // changes the value of n to 77:\n\n\t\t n = [77]\n\t\t &n = 0x9bfb92c\n\t\t pn = 0x9bfb92c\n\t\t &pn = 0x9c6a760\n\t\t *pn = [77]\nint* q=&n; // q also holds the address of n:\n\n\t\t n = [77]\n\t\t &n = 0x9bfb92c\n\t\t pn = 0x9bfb92c\n\t\t &pn = 0x9bf5c80\n\t\t *pn = [77]\n\t\t q = 0x9bfb92c\n\t\t &q = 0x9c6a760\n\t\t *q = [77]\n"
+ "text": [
+ "int n=44; // n holds the int 44:\n",
+ "\n",
+ "\t\t n = [44]\n",
+ "\t\t &n = 0x9bfb92c\n",
+ "int* pn=&n; // pn holds the address of n:\n",
+ "\n",
+ "\t\t n = [44]\n",
+ "\t\t &n = 0x9bfb92c\n",
+ "\t\t pn = 0x9bfb92c\n",
+ "\t\t &pn = 0x9bf5aa0\n",
+ "\t\t *pn = [44]\n",
+ "*pn = 77; // changes the value of n to 77:\n",
+ "\n",
+ "\t\t n = [77]\n",
+ "\t\t &n = 0x9bfb92c\n",
+ "\t\t pn = 0x9bfb92c\n",
+ "\t\t &pn = 0x9c6a760\n",
+ "\t\t *pn = [77]\n",
+ "int* q=&n; // q also holds the address of n:\n",
+ "\n",
+ "\t\t n = [77]\n",
+ "\t\t &n = 0x9bfb92c\n",
+ "\t\t pn = 0x9bfb92c\n",
+ "\t\t &pn = 0x9bf5c80\n",
+ "\t\t *pn = [77]\n",
+ "\t\t q = 0x9bfb92c\n",
+ "\t\t &q = 0x9c6a760\n",
+ "\t\t *q = [77]\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +88,29 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.2\nNote : Python does not append '\\0' at the end of string.\n'''\n\ns = \"ABCD\"\nfor i in range(4):\n print \"s[\" , i , \"] = '\" , s[i] , \"'\\n\";\n",
+ "input": [
+ "\n",
+ "\n",
+ "s = \"ABCD\"\n",
+ "for i in range(4):\n",
+ " print \"s[\" , i , \"] = '\" , s[i] , \"'\\n\";\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "s[ 0 ] = ' A '\n\ns[ 1 ] = ' B '\n\ns[ 2 ] = ' C '\n\ns[ 3 ] = ' D '\n\n"
+ "text": [
+ "s[ 0 ] = ' A '\n",
+ "\n",
+ "s[ 1 ] = ' B '\n",
+ "\n",
+ "s[ 2 ] = ' C '\n",
+ "\n",
+ "s[ 3 ] = ' D '\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -40,7 +118,17 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.3\n'''\n\nwhile True:\n word = raw_input()\n if len(word) < 2:\n break\n l = word.split(' ')\n for i in l:\n print '\\t\"' , i , '\"'\n",
+ "input": [
+ "\n",
+ "\n",
+ "while True:\n",
+ " word = raw_input()\n",
+ " if len(word) < 2:\n",
+ " break\n",
+ " l = word.split(' ')\n",
+ " for i in l:\n",
+ " print '\\t\"' , i , '\"'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -48,29 +136,46 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Today's date is March 12, 2000.\n"
+ "text": [
+ "Today's date is March 12, 2000.\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t\" Today's \"\n\t\" date \"\n\t\" is \"\n\t\" March \"\n\t\" 12, \"\n\t\" 2000. \"\n"
+ "text": [
+ "\t\" Today's \"\n",
+ "\t\" date \"\n",
+ "\t\" is \"\n",
+ "\t\" March \"\n",
+ "\t\" 12, \"\n",
+ "\t\" 2000. \"\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Tomorrow is Monday.\n"
+ "text": [
+ "Tomorrow is Monday.\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t\" Tomorrow \"\n\t\" is \"\n\t\" Monday. \"\n"
+ "text": [
+ "\t\" Tomorrow \"\n",
+ "\t\" is \"\n",
+ "\t\" Monday. \"\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 6
@@ -78,7 +183,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.4\nThis program echoes the input, line by line:\n'''\n\nwhile True:\n line = raw_input()\n if len(line) < 2:\n break\n print \"\\t[\" , line , \"]\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "while True:\n",
+ " line = raw_input()\n",
+ " if len(line) < 2:\n",
+ " break\n",
+ " print \"\\t[\" , line , \"]\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -86,29 +199,39 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ "text": [
+ "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t[ Once upon a midnight dreary, while I pondered, weak and weary, ]\n"
+ "text": [
+ "\t[ Once upon a midnight dreary, while I pondered, weak and weary, ]\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Over a many quaint and curious volume of forgotten lore,\n"
+ "text": [
+ "Over a many quaint and curious volume of forgotten lore,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t[ Over a many quaint and curious volume of forgotten lore, ]\n"
+ "text": [
+ "\t[ Over a many quaint and curious volume of forgotten lore, ]\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 7
@@ -116,7 +239,18 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.5\n'''\n\n\nwhile True:\n word = raw_input()\n if len(word) < 2:\n break\n l = word.split(',')\n for i in range(len(l)-1):\n print '\\t[' , l[i] , ']'\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "while True:\n",
+ " word = raw_input()\n",
+ " if len(word) < 2:\n",
+ " break\n",
+ " l = word.split(',')\n",
+ " for i in range(len(l)-1):\n",
+ " print '\\t[' , l[i] , ']'\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -124,29 +258,41 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ "text": [
+ "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t[ Once upon a midnight dreary ]\n\t[ while I pondered ]\n\t[ weak and weary ]\n"
+ "text": [
+ "\t[ Once upon a midnight dreary ]\n",
+ "\t[ while I pondered ]\n",
+ "\t[ weak and weary ]\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Over a many quaint and curious volume of forgotten lore,\n"
+ "text": [
+ "Over a many quaint and curious volume of forgotten lore,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t[ Over a many quaint and curious volume of forgotten lore ]\n"
+ "text": [
+ "\t[ Over a many quaint and curious volume of forgotten lore ]\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 8
@@ -154,7 +300,19 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.6 \nThis program counts the number of occurrences of the letter 'e' in the input stream. \n'''\n\ncount = 0\nwhile True:\n a = raw_input()\n if len(a) < 1:\n break\n for ch in a:\n if (ch == 'e'): count+=1\n \nprint count , \" e's were counted.\\n\"\n",
+ "input": [
+ "\n",
+ "\n",
+ "count = 0\n",
+ "while True:\n",
+ " a = raw_input()\n",
+ " if len(a) < 1:\n",
+ " break\n",
+ " for ch in a:\n",
+ " if (ch == 'e'): count+=1\n",
+ " \n",
+ "print count , \" e's were counted.\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -162,24 +320,33 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ "text": [
+ "Once upon a midnight dreary, while I pondered, weak and weary,\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Over many a quaint and curious volume of forgotten lore,\n"
+ "text": [
+ "Over many a quaint and curious volume of forgotten lore,\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "11 e's were counted.\n\n"
+ "text": [
+ "11 e's were counted.\n",
+ "\n"
+ ]
}
],
"prompt_number": 9
@@ -187,7 +354,14 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.7 \nThis program echoes the input stream, capitalizing each word:\n'''\n\nwhile True:\n a = raw_input()\n if len(a) < 1:\n break\n print a.title()\n",
+ "input": [
+ "\n",
+ "while True:\n",
+ " a = raw_input()\n",
+ " if len(a) < 1:\n",
+ " break\n",
+ " print a.title()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -195,29 +369,39 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Fourscore and seven years ago our fathers\n"
+ "text": [
+ "Fourscore and seven years ago our fathers\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Fourscore And Seven Years Ago Our Fathers\n"
+ "text": [
+ "Fourscore And Seven Years Ago Our Fathers\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "brought forth upon this continent a new nation,\n"
+ "text": [
+ "brought forth upon this continent a new nation,\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "Brought Forth Upon This Continent A New Nation,\n"
+ "text": [
+ "Brought Forth Upon This Continent A New Nation,\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
}
],
"prompt_number": 10
@@ -225,7 +409,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.8\nThis tests a function that extracts the integers from the input stream:\n'''\n\na = raw_input()\nl = a.split(' ')\nnos = []\nfor i in l:\n try:\n i = int(i)\n nos.append(i)\n except:\n continue\nm = nos[0]\nn = nos[1] \nprint m , \" + \" , n , \" = \" , m+n",
+ "input": [
+ "\n",
+ "\n",
+ "a = raw_input()\n",
+ "l = a.split(' ')\n",
+ "nos = []\n",
+ "for i in l:\n",
+ " try:\n",
+ " i = int(i)\n",
+ " nos.append(i)\n",
+ " except:\n",
+ " continue\n",
+ "m = nos[0]\n",
+ "n = nos[1] \n",
+ "print m , \" + \" , n , \" = \" , m+n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -233,12 +432,16 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "what is 305 plus 9416 ?\n"
+ "text": [
+ "what is 305 plus 9416 ?\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "305 + 9416 = 9721\n"
+ "text": [
+ "305 + 9416 = 9721\n"
+ ]
}
],
"prompt_number": 11
@@ -246,43 +449,76 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.10 An Array of Strings\n'''\n\nname = []\ncount=0\n\nprint \"Enter at most 4 names with at most 19 characters:\\n\";\nwhile (True):\n n = raw_input()\n if len(n) < 1:\n break\n name.append(n)\n count += 1\n \nprint \"The names are:\\n\"\nfor i in range(count):\n print \"\\t\" , i , \". [\" , name[i] , \"]\" \n",
+ "input": [
+ "\n",
+ "name = []\n",
+ "count=0\n",
+ "\n",
+ "print \"Enter at most 4 names with at most 19 characters:\\n\";\n",
+ "while (True):\n",
+ " n = raw_input()\n",
+ " if len(n) < 1:\n",
+ " break\n",
+ " name.append(n)\n",
+ " count += 1\n",
+ " \n",
+ "print \"The names are:\\n\"\n",
+ "for i in range(count):\n",
+ " print \"\\t\" , i , \". [\" , name[i] , \"]\" \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter at most 4 names with at most 19 characters:\n\n"
+ "text": [
+ "Enter at most 4 names with at most 19 characters:\n",
+ "\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "George Washington\n"
+ "text": [
+ "George Washington\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "John Adams\n"
+ "text": [
+ "John Adams\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Thomas Jefferson\n"
+ "text": [
+ "Thomas Jefferson\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The names are:\n\n\t0 . [ George Washington ]\n\t1 . [ John Adams ]\n\t2 . [ Thomas Jefferson ]\n"
+ "text": [
+ "The names are:\n",
+ "\n",
+ "\t0 . [ George Washington ]\n",
+ "\t1 . [ John Adams ]\n",
+ "\t2 . [ Thomas Jefferson ]\n"
+ ]
}
],
"prompt_number": 12
@@ -290,43 +526,76 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.11 A String Array\n'''\n\nname = []\ncount=0\n\nprint \"Enter at most 4 names with at most 19 characters:\\n\";\nwhile (True):\n n = raw_input()\n if len(n) < 1:\n break\n name.append(n)\n count += 1\n \nprint \"The names are:\\n\"\nfor i in range(count):\n print \"\\t\" , i , \". [\" , name[i] , \"]\" ",
+ "input": [
+ "\n",
+ "name = []\n",
+ "count=0\n",
+ "\n",
+ "print \"Enter at most 4 names with at most 19 characters:\\n\";\n",
+ "while (True):\n",
+ " n = raw_input()\n",
+ " if len(n) < 1:\n",
+ " break\n",
+ " name.append(n)\n",
+ " count += 1\n",
+ " \n",
+ "print \"The names are:\\n\"\n",
+ "for i in range(count):\n",
+ " print \"\\t\" , i , \". [\" , name[i] , \"]\" "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter at most 4 names with at most 19 characters:\n\n"
+ "text": [
+ "Enter at most 4 names with at most 19 characters:\n",
+ "\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "George Washington\n"
+ "text": [
+ "George Washington\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "John Adams\n"
+ "text": [
+ "John Adams\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Thomas Jefferson\n"
+ "text": [
+ "Thomas Jefferson\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "The names are:\n\n\t0 . [ George Washington ]\n\t1 . [ John Adams ]\n\t2 . [ Thomas Jefferson ]\n"
+ "text": [
+ "The names are:\n",
+ "\n",
+ "\t0 . [ George Washington ]\n",
+ "\t1 . [ John Adams ]\n",
+ "\t2 . [ Thomas Jefferson ]\n"
+ ]
}
],
"prompt_number": 13
@@ -334,14 +603,28 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.12 Initializing a String Array\nThis program is nearly equivalent to those in the previous two examples. It initializes the array/list\nname and then prints its contents:\n'''\n\nname = [ \"George Washington\", \"John Adams\", \"Thomas Jefferson\"]\nprint \"The names are:\\n\"\nfor i in range(3):\n print \"\\t\" , i , \". [\" , name[i] , \"]\"\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "name = [ \"George Washington\", \"John Adams\", \"Thomas Jefferson\"]\n",
+ "print \"The names are:\\n\"\n",
+ "for i in range(3):\n",
+ " print \"\\t\" , i , \". [\" , name[i] , \"]\"\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The names are:\n\n\t0 . [ George Washington ]\n\t1 . [ John Adams ]\n\t2 . [ Thomas Jefferson ]\n"
+ "text": [
+ "The names are:\n",
+ "\n",
+ "\t0 . [ George Washington ]\n",
+ "\t1 . [ John Adams ]\n",
+ "\t2 . [ Thomas Jefferson ]\n"
+ ]
}
],
"prompt_number": 14
@@ -349,25 +632,42 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.13 The len() Function\n'''\n\ns = \"ABCDEFG\"\nprint \"len(\" , s , \") = \" , len(s) \nprint \"len(\\\"\\\") = \" , len(\"\")\nprint \"Enter string: \"\nb = raw_input()\nprint \"len(\" , b , \") = \" , len(b)",
+ "input": [
+ "\n",
+ "\n",
+ "s = \"ABCDEFG\"\n",
+ "print \"len(\" , s , \") = \" , len(s) \n",
+ "print \"len(\\\"\\\") = \" , len(\"\")\n",
+ "print \"Enter string: \"\n",
+ "b = raw_input()\n",
+ "print \"len(\" , b , \") = \" , len(b)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "len( ABCDEFG ) = 7\nlen(\"\") = 0\nEnter string: \n"
+ "text": [
+ "len( ABCDEFG ) = 7\n",
+ "len(\"\") = 0\n",
+ "Enter string: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "hello how are you !!!\n"
+ "text": [
+ "hello how are you !!!\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "len( hello how are you !!! ) = 21\n"
+ "text": [
+ "len( hello how are you !!! ) = 21\n"
+ ]
}
],
"prompt_number": 15
@@ -375,14 +675,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.14 \ngives index of substring.\n'''\ns = \"The Mississippi is a long river.\"\nprint 's = \"' , s , '\"'\np = s.find(' ')\nprint \"find(s, ' ') points to s[\" , p , \"].\"\np = s.find('s')\nprint \"find(s, 's') points to s[\" , p , \"].\"\np = s.rfind('s')\nprint \"reverse find(s, 's') points to s[\" , p , \"].\"\np = s.find(\"is\")\nprint \"strstr(s, \\\"is\\\") points to s[\" , p , \"].\"\np = s.find(\"isi\")\nif p== -1:\n print 's.find(\"isi\") returns NULL'\n",
+ "input": [
+ "\n",
+ "s = \"The Mississippi is a long river.\"\n",
+ "print 's = \"' , s , '\"'\n",
+ "p = s.find(' ')\n",
+ "print \"find(s, ' ') points to s[\" , p , \"].\"\n",
+ "p = s.find('s')\n",
+ "print \"find(s, 's') points to s[\" , p , \"].\"\n",
+ "p = s.rfind('s')\n",
+ "print \"reverse find(s, 's') points to s[\" , p , \"].\"\n",
+ "p = s.find(\"is\")\n",
+ "print \"strstr(s, \\\"is\\\") points to s[\" , p , \"].\"\n",
+ "p = s.find(\"isi\")\n",
+ "if p== -1:\n",
+ " print 's.find(\"isi\") returns NULL'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "s = \" The Mississippi is a long river. \"\nfind(s, ' ') points to s[ 3 ].\nfind(s, 's') points to s[ 6 ].\nreverse find(s, 's') points to s[ 17 ].\nstrstr(s, \"is\") points to s[ 5 ].\ns.find(\"isi\") returns NULL\n"
+ "text": [
+ "s = \" The Mississippi is a long river. \"\n",
+ "find(s, ' ') points to s[ 3 ].\n",
+ "find(s, 's') points to s[ 6 ].\n",
+ "reverse find(s, 's') points to s[ 17 ].\n",
+ "strstr(s, \"is\") points to s[ 5 ].\n",
+ "s.find(\"isi\") returns NULL\n"
+ ]
}
],
"prompt_number": 16
@@ -390,14 +712,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.15 string copy\n'''\ns1 = \"ABCDEFG\"\ns2 = \"XYZ\" \nprint \"Before strcpy(s1,s2):\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \ns1 = s2\nprint \"After strcpy(s1,s2):\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "input": [
+ "\n",
+ "s1 = \"ABCDEFG\"\n",
+ "s2 = \"XYZ\" \n",
+ "print \"Before strcpy(s1,s2):\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "s1 = s2\n",
+ "print \"After strcpy(s1,s2):\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before strcpy(s1,s2):\n\n\ts1 = [ ABCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\nAfter strcpy(s1,s2):\n\n\ts1 = [ XYZ ], length = 3\n\ts2 = [ XYZ ], length = 3\n"
+ "text": [
+ "Before strcpy(s1,s2):\n",
+ "\n",
+ "\ts1 = [ ABCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n",
+ "After strcpy(s1,s2):\n",
+ "\n",
+ "\ts1 = [ XYZ ], length = 3\n",
+ "\ts2 = [ XYZ ], length = 3\n"
+ ]
}
],
"prompt_number": 17
@@ -405,14 +747,36 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.16 string copy\n'''\n\ns1 = \"ABCDEFG\"\ns2 = \"XYZ\" \nprint \"Before strcpy(s1,s2,2):\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \ns1 = s2[:2] + s1[2:]\nprint \"After strcpy(s1,s2,2):\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n\n\n",
+ "input": [
+ "\n",
+ "s1 = \"ABCDEFG\"\n",
+ "s2 = \"XYZ\" \n",
+ "print \"Before strcpy(s1,s2,2):\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "s1 = s2[:2] + s1[2:]\n",
+ "print \"After strcpy(s1,s2,2):\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before strcpy(s1,s2,2):\n\n\ts1 = [ ABCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\nAfter strcpy(s1,s2,2):\n\n\ts1 = [ XYCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\n"
+ "text": [
+ "Before strcpy(s1,s2,2):\n",
+ "\n",
+ "\ts1 = [ ABCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n",
+ "After strcpy(s1,s2,2):\n",
+ "\n",
+ "\ts1 = [ XYCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n"
+ ]
}
],
"prompt_number": 18
@@ -420,14 +784,34 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.17 The String Concatenation\n'''\n\ns1 = \"ABCDEFG\"\ns2 = \"XYZ\" \nprint \"Before string concatination :\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \ns1 += s2\nprint \"After string concatination :\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) ",
+ "input": [
+ "\n",
+ "\n",
+ "s1 = \"ABCDEFG\"\n",
+ "s2 = \"XYZ\" \n",
+ "print \"Before string concatination :\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "s1 += s2\n",
+ "print \"After string concatination :\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before string concatination :\n\n\ts1 = [ ABCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\nAfter string concatination :\n\ts1 = [ ABCDEFGXYZ ], length = 10\n\ts2 = [ XYZ ], length = 3\n"
+ "text": [
+ "Before string concatination :\n",
+ "\n",
+ "\ts1 = [ ABCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n",
+ "After string concatination :\n",
+ "\ts1 = [ ABCDEFGXYZ ], length = 10\n",
+ "\ts2 = [ XYZ ], length = 3\n"
+ ]
}
],
"prompt_number": 19
@@ -435,14 +819,33 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.18 The Second String Concatenation (no. of characters)\n'''\n\ns1 = \"ABCDEFG\"\ns2 = \"XYZ\" \nprint \"Before string concatination :\\n\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \ns1 += s2[:2]\nprint \"After string concatination :\" \nprint \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \nprint \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) ",
+ "input": [
+ "\n",
+ "s1 = \"ABCDEFG\"\n",
+ "s2 = \"XYZ\" \n",
+ "print \"Before string concatination :\\n\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n",
+ "s1 += s2[:2]\n",
+ "print \"After string concatination :\" \n",
+ "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n",
+ "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before string concatination :\n\n\ts1 = [ ABCDEFG ], length = 7\n\ts2 = [ XYZ ], length = 3\nAfter string concatination :\n\ts1 = [ ABCDEFGXY ], length = 9\n\ts2 = [ XYZ ], length = 3\n"
+ "text": [
+ "Before string concatination :\n",
+ "\n",
+ "\ts1 = [ ABCDEFG ], length = 7\n",
+ "\ts2 = [ XYZ ], length = 3\n",
+ "After string concatination :\n",
+ "\ts1 = [ ABCDEFGXY ], length = 9\n",
+ "\ts2 = [ XYZ ], length = 3\n"
+ ]
}
],
"prompt_number": 20
@@ -450,14 +853,35 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.19 The String Tokenize \n'''\ns = \"Today's date is March 12, 2000.\"\n\nprint \"The string is: [\" , s , \"] \\nIts tokens are: \"\np = s.split(\" \")\n\nfor i in p:\n print \"\\t[\" , i , \"] \"\n\nprint \"Now the string is: [\" , p[0] , \"] \";\n",
+ "input": [
+ "\n",
+ "s = \"Today's date is March 12, 2000.\"\n",
+ "\n",
+ "print \"The string is: [\" , s , \"] \\nIts tokens are: \"\n",
+ "p = s.split(\" \")\n",
+ "\n",
+ "for i in p:\n",
+ " print \"\\t[\" , i , \"] \"\n",
+ "\n",
+ "print \"Now the string is: [\" , p[0] , \"] \";\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The string is: [ Today's date is March 12, 2000. ] \nIts tokens are: \n\t[ Today's ] \n\t[ date ] \n\t[ is ] \n\t[ March ] \n\t[ 12, ] \n\t[ 2000. ] \nNow the string is: [ Today's ] \n"
+ "text": [
+ "The string is: [ Today's date is March 12, 2000. ] \n",
+ "Its tokens are: \n",
+ "\t[ Today's ] \n",
+ "\t[ date ] \n",
+ "\t[ is ] \n",
+ "\t[ March ] \n",
+ "\t[ 12, ] \n",
+ "\t[ 2000. ] \n",
+ "Now the string is: [ Today's ] \n"
+ ]
}
],
"prompt_number": 21
@@ -465,14 +889,40 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 8.20 The strpbrk() Function\nC provides inbuilt strpbrk(), Here i have written mine.\n'''\n\ndef strpbrk(s,s1):\n found = []\n for i in range(len(s1)):\n if s1[i] in s:\n index = s.find(s1[i])\n found.append(index)\n if found:\n return min(found)\n return None\n \n\ns = \"The Mississippi is a long river.\"\nprint 's = \"' , s , '\"'\np = strpbrk(s, \"nopqr\")\nprint 'strpbrk(s, \"nopqr\") points to s[' , p , \"].\"\np = strpbrk(s, \"NOPQR\")\nif (p == None):\n print 'strpbrk(s, \"NOPQR\") returns NULL.\\n'",
+ "input": [
+ "\n",
+ "\n",
+ "def strpbrk(s,s1):\n",
+ " found = []\n",
+ " for i in range(len(s1)):\n",
+ " if s1[i] in s:\n",
+ " index = s.find(s1[i])\n",
+ " found.append(index)\n",
+ " if found:\n",
+ " return min(found)\n",
+ " return None\n",
+ " \n",
+ "\n",
+ "s = \"The Mississippi is a long river.\"\n",
+ "print 's = \"' , s , '\"'\n",
+ "p = strpbrk(s, \"nopqr\")\n",
+ "print 'strpbrk(s, \"nopqr\") points to s[' , p , \"].\"\n",
+ "p = strpbrk(s, \"NOPQR\")\n",
+ "if (p == None):\n",
+ " print 'strpbrk(s, \"NOPQR\") returns NULL.\\n'"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "s = \" The Mississippi is a long river. \"\nstrpbrk(s, \"nopqr\") points to s[ 12 ].\nstrpbrk(s, \"NOPQR\") returns NULL.\n\n"
+ "text": [
+ "s = \" The Mississippi is a long river. \"\n",
+ "strpbrk(s, \"nopqr\") points to s[ 12 ].\n",
+ "strpbrk(s, \"NOPQR\") returns NULL.\n",
+ "\n"
+ ]
}
],
"prompt_number": 22
@@ -480,7 +930,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch9.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch9.ipynb
index fabb9a56..d8825dca 100644
--- a/Schaum's_Outlines_-_Programming_with_C++/ch9.ipynb
+++ b/Schaum's_Outlines_-_Programming_with_C++/ch9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch9"
+ "name": "",
+ "signature": "sha256:3d283266e7082a716b1a943d213d074680f7742450c9d72e3e7e5a73a1856d5b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,7 +11,15 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.2 Using the Extraction Operation to Control a Loop\n'''\n\n\nwhile True:\n try:\n n = int(raw_input())\n print \"n = \" , n \n except:\n break",
+ "input": [
+ "\n",
+ "while True:\n",
+ " try:\n",
+ " n = int(raw_input())\n",
+ " print \"n = \" , n \n",
+ " except:\n",
+ " break"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -18,62 +27,84 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "46\n"
+ "text": [
+ "46\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 46\n"
+ "text": [
+ "n = 46\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "22\n"
+ "text": [
+ "22\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 22\n"
+ "text": [
+ "n = 22\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n"
+ "text": [
+ "n = 44\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "66\n"
+ "text": [
+ "66\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 66\n"
+ "text": [
+ "n = 66\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "88\n"
+ "text": [
+ "88\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 88\n"
+ "text": [
+ "n = 88\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "33,\n"
+ "text": [
+ "33,\n"
+ ]
}
],
"prompt_number": 1
@@ -81,7 +112,20 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.4 Inputting Strings with the raw_input() Function\nThis program shows how to read text data line-by-line into an array \n'''\n\nking = [] # defines king to be an array \nn=0\nwhile True:\n name = raw_input()\n if len(name) < 1:\n break\n king.append(name)\n n += 1\n# now n == the number of names read\nfor i in range(n):\n print '\\t' , i+1 , \". \" , king[i] ",
+ "input": [
+ "\n",
+ "king = [] # defines king to be an array \n",
+ "n=0\n",
+ "while True:\n",
+ " name = raw_input()\n",
+ " if len(name) < 1:\n",
+ " break\n",
+ " king.append(name)\n",
+ " n += 1\n",
+ "# now n == the number of names read\n",
+ "for i in range(n):\n",
+ " print '\\t' , i+1 , \". \" , king[i] "
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -89,60 +133,87 @@
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Kenneth II (971-995)\n"
+ "text": [
+ "Kenneth II (971-995)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Constantine III (995-997)\n"
+ "text": [
+ "Constantine III (995-997)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Kenneth III (997-1005)\n"
+ "text": [
+ "Kenneth III (997-1005)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Malcolm II (1005-1034)\n"
+ "text": [
+ "Malcolm II (1005-1034)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Duncan I (1034-1040)\n"
+ "text": [
+ "Duncan I (1034-1040)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Macbeth (1040-1057)\n"
+ "text": [
+ "Macbeth (1040-1057)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Lulach (1057-1058)\n"
+ "text": [
+ "Lulach (1057-1058)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "Malcolm III (1058-1093)\n"
+ "text": [
+ "Malcolm III (1058-1093)\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "\n"
+ "text": [
+ "\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "\t1 . Kenneth II (971-995)\n\t2 . Constantine III (995-997)\n\t3 . Kenneth III (997-1005)\n\t4 . Malcolm II (1005-1034)\n\t5 . Duncan I (1034-1040)\n\t6 . Macbeth (1040-1057)\n\t7 . Lulach (1057-1058)\n\t8 . Malcolm III (1058-1093)\n"
+ "text": [
+ "\t1 . Kenneth II (971-995)\n",
+ "\t2 . Constantine III (995-997)\n",
+ "\t3 . Kenneth III (997-1005)\n",
+ "\t4 . Malcolm II (1005-1034)\n",
+ "\t5 . Duncan I (1034-1040)\n",
+ "\t6 . Macbeth (1040-1057)\n",
+ "\t7 . Lulach (1057-1058)\n",
+ "\t8 . Malcolm III (1058-1093)\n"
+ ]
}
],
"prompt_number": 2
@@ -150,7 +221,18 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.6 Capitalizing All the Words in a Text File\nHere is a complete program that reads words from the external file named input.txt, capitalizes\nthem, and then writes them to the external file named output.txt:\nNote : Working good , you need input.txt in same directory.\n'''\n\ninfile = open(\"input.txt\",\"r\")\noutfile = open(\"output.txt\",\"w\")\n\nfor i in infile:\n s = i.title()\n outfile.write(s)\n\ninfile.close()\noutfile.close()",
+ "input": [
+ "\n",
+ "infile = open(\"input.txt\",\"r\")\n",
+ "outfile = open(\"output.txt\",\"w\")\n",
+ "\n",
+ "for i in infile:\n",
+ " s = i.title()\n",
+ " outfile.write(s)\n",
+ "\n",
+ "infile.close()\n",
+ "outfile.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -170,7 +252,38 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.7 Merging Two Sorted Data Files\n'''\n\nfin1 = open(\"north.dat\",\"r\")\nfin2 = open(\"south.dat\",\"r\")\nfout = open(\"combined.dat\",\"w\")\n\nfile1 = []\nfile2 = []\nfor i in fin1:\n try:\n s = i.split(\" \")\n for j in s:\n file1.append(int(j))\n except:\n continue\n \nfor i in fin2:\n try:\n s = i.split(\" \")\n for j in s:\n file2.append(int(j))\n except:\n continue\n\n\nfor i in sorted(file1 + file2):\n fout.write(str(i) + \" \")\n\nfin1.close()\nfin2.close()\nfout.close()",
+ "input": [
+ "\n",
+ "fin1 = open(\"north.dat\",\"r\")\n",
+ "fin2 = open(\"south.dat\",\"r\")\n",
+ "fout = open(\"combined.dat\",\"w\")\n",
+ "\n",
+ "file1 = []\n",
+ "file2 = []\n",
+ "for i in fin1:\n",
+ " try:\n",
+ " s = i.split(\" \")\n",
+ " for j in s:\n",
+ " file1.append(int(j))\n",
+ " except:\n",
+ " continue\n",
+ " \n",
+ "for i in fin2:\n",
+ " try:\n",
+ " s = i.split(\" \")\n",
+ " for j in s:\n",
+ " file2.append(int(j))\n",
+ " except:\n",
+ " continue\n",
+ "\n",
+ "\n",
+ "for i in sorted(file1 + file2):\n",
+ " fout.write(str(i) + \" \")\n",
+ "\n",
+ "fin1.close()\n",
+ "fin2.close()\n",
+ "fout.close()"
+ ],
"language": "python",
"metadata": {},
"outputs": [
@@ -190,14 +303,35 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.8 Using an Output String Stream\nThis program creates four objects: a character string s,\nan integer n, a floating-point number x, and an output string stream oss:\n'''\n\ndef print_(oss):\n print 'oss.str() = \"' , str(oss) , '\"'\n\ns=\"ABCDEFG\"\nn=33\nx=2.718\nl = ''\nprint_(l)\nl += s\nprint_(l)\nl += ( \" \" + str(n) )\nprint_(l)\nl += ( \" \" + str(x) )\nprint_(l)",
+ "input": [
+ "\n",
+ "def print_(oss):\n",
+ " print 'oss.str() = \"' , str(oss) , '\"'\n",
+ "\n",
+ "s=\"ABCDEFG\"\n",
+ "n=33\n",
+ "x=2.718\n",
+ "l = ''\n",
+ "print_(l)\n",
+ "l += s\n",
+ "print_(l)\n",
+ "l += ( \" \" + str(n) )\n",
+ "print_(l)\n",
+ "l += ( \" \" + str(x) )\n",
+ "print_(l)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "oss.str() = \" \"\noss.str() = \" ABCDEFG \"\noss.str() = \" ABCDEFG 33 \"\noss.str() = \" ABCDEFG 33 2.718 \"\n"
+ "text": [
+ "oss.str() = \" \"\n",
+ "oss.str() = \" ABCDEFG \"\n",
+ "oss.str() = \" ABCDEFG 33 \"\n",
+ "oss.str() = \" ABCDEFG 33 2.718 \"\n"
+ ]
}
],
"prompt_number": 5
@@ -205,14 +339,38 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 9.9 Using an Input String Stream iss ABCDEFG 44 3.14 istringstream\nThis program is similar to the one in Example 9.8 \nexcept that it reads from an input string stream iss\ninstead of writing to an output string stream.:\n'''\n'''\nEXAMPLE 9.8 Using an Output String Stream\nThis program creates four objects: a character string s,\nan integer n, a floating-point number x, and an output string stream oss:\n'''\n\ndef print_(iss,s='',n=0,x=0.0):\n print 's = \"' , s , '\", n = ' , n , \", x = \" , x, ', iss.str() = \"' \\\n , iss , '\"' \n\ns=\"\"\nn=0\nx=0.0\nl = ''\niss = \"ABCDEFG 44 3.14\"\nprint_(iss)\ns = \"ABCDEFG\"\nprint_(iss,s)\nn = 44\nprint_(iss,s,n)\nx = 3.14\nprint_(iss,s,n,x)",
+ "input": [
+ "\n",
+ "\n",
+ "def print_(iss,s='',n=0,x=0.0):\n",
+ " print 's = \"' , s , '\", n = ' , n , \", x = \" , x, ', iss.str() = \"' \\\n",
+ " , iss , '\"' \n",
+ "\n",
+ "s=\"\"\n",
+ "n=0\n",
+ "x=0.0\n",
+ "l = ''\n",
+ "iss = \"ABCDEFG 44 3.14\"\n",
+ "print_(iss)\n",
+ "s = \"ABCDEFG\"\n",
+ "print_(iss,s)\n",
+ "n = 44\n",
+ "print_(iss,s,n)\n",
+ "x = 3.14\n",
+ "print_(iss,s,n,x)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "s = \" \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\ns = \" ABCDEFG \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\ns = \" ABCDEFG \", n = 44 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\ns = \" ABCDEFG \", n = 44 , x = 3.14 , iss.str() = \" ABCDEFG 44 3.14 \"\n"
+ "text": [
+ "s = \" \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n",
+ "s = \" ABCDEFG \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n",
+ "s = \" ABCDEFG \", n = 44 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n",
+ "s = \" ABCDEFG \", n = 44 , x = 3.14 , iss.str() = \" ABCDEFG 44 3.14 \"\n"
+ ]
}
],
"prompt_number": 6
@@ -220,7 +378,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Surveying_Volume_3/Chapter_1_.ipynb b/Surveying_Volume_3/Chapter_1_.ipynb
index 3327643c..863599de 100644
--- a/Surveying_Volume_3/Chapter_1_.ipynb
+++ b/Surveying_Volume_3/Chapter_1_.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 1"
+ "name": "",
+ "signature": "sha256:34f1fb57a7660b9339f74e6fbb3f9bfcb7a1b64529d9da2cc37598b495c31a85"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,78 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "FIELD ASTRONOMY"
+ "source": [
+ "FIELD ASTRONOMY"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.1, Page 30"
+ "source": [
+ "Example 1.1, Page 30"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding difference of longitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\n#part1\na =40; # longitude of A\nb =73; # longitude of B\n\n#calculation\ndol =b-a; # difference of longitude\n\n#result\nprint \" difference of longitude is in degrees\",round(dol);\n\n#part2\na =20; # longitude of A\nb =150; # longitude of B\n\n#calculation\ndol =b-a; # difference of longitude\n\n#result\nprint \" difference of longitude is in degrees \",round(dol);\n\n#part3\na =-20; # longitude of A\nb =50; # longitude of B\n\n#calculation\ndol =b-a; # difference of longitude\n\n#result\nprint \" difference of longitude is in degrees\",round(dol);\n\n#part4\na =-40; # longitude of A\nb =150; # longitude of B\n\n#calculation\ndol =360-(b-a); # difference of longitude\n\n#result\nprint \" difference of longitude is in degrees\",round(dol);",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "#part1\n",
+ "a =40; # longitude of A\n",
+ "b =73; # longitude of B\n",
+ "\n",
+ "#calculation\n",
+ "dol =b-a; # difference of longitude\n",
+ "\n",
+ "#result\n",
+ "print \" difference of longitude is in degrees\",round(dol);\n",
+ "\n",
+ "#part2\n",
+ "a =20; # longitude of A\n",
+ "b =150; # longitude of B\n",
+ "\n",
+ "#calculation\n",
+ "dol =b-a; # difference of longitude\n",
+ "\n",
+ "#result\n",
+ "print \" difference of longitude is in degrees \",round(dol);\n",
+ "\n",
+ "#part3\n",
+ "a =-20; # longitude of A\n",
+ "b =50; # longitude of B\n",
+ "\n",
+ "#calculation\n",
+ "dol =b-a; # difference of longitude\n",
+ "\n",
+ "#result\n",
+ "print \" difference of longitude is in degrees\",round(dol);\n",
+ "\n",
+ "#part4\n",
+ "a =-40; # longitude of A\n",
+ "b =150; # longitude of B\n",
+ "\n",
+ "#calculation\n",
+ "dol =360-(b-a); # difference of longitude\n",
+ "\n",
+ "#result\n",
+ "print \" difference of longitude is in degrees\",round(dol);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " difference of longitude is 33.0\n difference of longitude is 130.0\n difference of longitude is 70.0\n difference of longitude is 170.0\n"
+ "text": [
+ " difference of longitude is 33.0\n",
+ " difference of longitude is 130.0\n",
+ " difference of longitude is 70.0\n",
+ " difference of longitude is 170.0\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +92,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.2.1,Page 31"
+ "source": [
+ "Example 1.2.1,Page 31"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding distance between two points\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos\nlatA =28.0+42.0/60.0; # latitude of A\nlonA =31.0*60.0+12.0; # longitude of A\nlatB =28.0+42.0/60.0; # latitude of B\nlonB =47.0*60.0+24.0; # longitude of B\n\n#calculation\nd=( lonB - lonA )*cos( latA /180* pi);\n\n#result\nprint \" distance between A & B in (km) \",round(d *1.852,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos\n",
+ "latA =28.0+42.0/60.0; # latitude of A\n",
+ "lonA =31.0*60.0+12.0; # longitude of A\n",
+ "latB =28.0+42.0/60.0; # latitude of B\n",
+ "lonB =47.0*60.0+24.0; # longitude of B\n",
+ "\n",
+ "#calculation\n",
+ "d=( lonB - lonA )*cos( latA /180* pi);\n",
+ "\n",
+ "#result\n",
+ "print \" distance between A & B in (km) \",round(d *1.852,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " distance between A & B in (km) 1578.989\n"
+ "text": [
+ " distance between A & B in (km) 1578.989\n"
+ ]
}
],
"prompt_number": 3
@@ -59,19 +132,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.2.2,Page 31"
+ "source": [
+ "Example 1.2.2,Page 31"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding distance between two points\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos\nlatA =12.0+36.0/60.0; # latitude of A\nlonA =115.0*60.0+6.0; # longitude of A\nlatB =12.0+36.0/60.0; # latitude of B\nlonB =-150.0*60.0-24.0; # longitude of B\n\n#calculation\nd=( 360*60+lonB - lonA )*cos( latA /180* pi);\n\n#result\nprint \" distance between A & B in (km) \",round(d *1.852,3) ",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos\n",
+ "latA =12.0+36.0/60.0; # latitude of A\n",
+ "lonA =115.0*60.0+6.0; # longitude of A\n",
+ "latB =12.0+36.0/60.0; # latitude of B\n",
+ "lonB =-150.0*60.0-24.0; # longitude of B\n",
+ "\n",
+ "#calculation\n",
+ "d=( 360*60+lonB - lonA )*cos( latA /180* pi);\n",
+ "\n",
+ "#result\n",
+ "print \" distance between A & B in (km) \",round(d *1.852,3) "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " distance between A & B in (km) 10247.946\n"
+ "text": [
+ " distance between A & B in (km) 10247.946\n"
+ ]
}
],
"prompt_number": 2
@@ -80,19 +171,52 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.3,Page 31"
+ "source": [
+ "Example 1.3,Page 31"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding distance between two points\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\nlatA =15;\nlatB =12.0+6.0/60.0;\nlonA =50.0+12.0/60.0;\nlonB =54.0;\nRe =6370.0; # radius of earth\n\n#calculation\nb=(90 - latA )*pi /180;\na=(90 - latB )*pi /180;\nP=( lonB - lonA )*pi /180;\np= acos ( cos (P)*sin(a)* sin (b)+ cos (a)*cos(b)); #spherical triangle law\nx= atan ( cos (a/2-b/2)/ cos (a/2+b /2) * tan (pi /2-P /2) );#spherical triangle law \ny= atan ( sin (a/2-b/2)/ sin (a/2+b /2) * tan (pi /2-P /2) ); #spherical triangle law\ndol =pi -x-y;\ndol=dol*180/pi;\na= dol *3600 %60;\nb= ((dol *3600 -a)%3600) /60;\nc=( dol *3600 - b*60 -a) /3600;\n\n#result\nprint \" distance from A to B in (km) \",round(p*Re,3);\nprint \" direction of B from A towards east of south \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "latA =15;\n",
+ "latB =12.0+6.0/60.0;\n",
+ "lonA =50.0+12.0/60.0;\n",
+ "lonB =54.0;\n",
+ "Re =6370.0; # radius of earth\n",
+ "\n",
+ "#calculation\n",
+ "b=(90 - latA )*pi /180;\n",
+ "a=(90 - latB )*pi /180;\n",
+ "P=( lonB - lonA )*pi /180;\n",
+ "p= acos ( cos (P)*sin(a)* sin (b)+ cos (a)*cos(b)); #spherical triangle law\n",
+ "x= atan ( cos (a/2-b/2)/ cos (a/2+b /2) * tan (pi /2-P /2) );#spherical triangle law \n",
+ "y= atan ( sin (a/2-b/2)/ sin (a/2+b /2) * tan (pi /2-P /2) ); #spherical triangle law\n",
+ "dol =pi -x-y;\n",
+ "dol=dol*180/pi;\n",
+ "a= dol *3600 %60;\n",
+ "b= ((dol *3600 -a)%3600) /60;\n",
+ "c=( dol *3600 - b*60 -a) /3600;\n",
+ "\n",
+ "#result\n",
+ "print \" distance from A to B in (km) \",round(p*Re,3);\n",
+ "print \" direction of B from A towards east of south \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " distance from A to B in (km) 522.104\n direction of B from A towards east of south 35.16 seconds 19.0 minutes 52.0 degrees\n"
+ "text": [
+ " distance from A to B in (km) 522.104\n",
+ " direction of B from A towards east of south 35.16 seconds 19.0 minutes 52.0 degrees\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +225,52 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.4,Page 33"
+ "source": [
+ "Example 1.4,Page 33"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding distance between two points\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = (md - m) * 60\n sd=round(sd,2)\n return [d, m, sd]\nlatA =45.0;\na1=45.0+13.108/60;\np =(300.0/60.0) *pi /180; # side AB\nb=(90 - latA )*pi /180; # side PA\n\n# calculation\na= acos ( cos (p)*cos(b)); # side BP\nBC=a *180/ pi - latA ;\nd=BC *1.852*60;\nB=asin(sin(latA*pi/180)/sin(a1*pi/180));\nB=deg_to_dms(B*180/pi);\n\n\n#result\nprint \" distance of BC in (km)\",round(d,3)\nprint \"the angle in deg,min,sec is\",B",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = (md - m) * 60\n",
+ " sd=round(sd,2)\n",
+ " return [d, m, sd]\n",
+ "latA =45.0;\n",
+ "a1=45.0+13.108/60;\n",
+ "p =(300.0/60.0) *pi /180; # side AB\n",
+ "b=(90 - latA )*pi /180; # side PA\n",
+ "\n",
+ "# calculation\n",
+ "a= acos ( cos (p)*cos(b)); # side BP\n",
+ "BC=a *180/ pi - latA ;\n",
+ "d=BC *1.852*60;\n",
+ "B=asin(sin(latA*pi/180)/sin(a1*pi/180));\n",
+ "B=deg_to_dms(B*180/pi);\n",
+ "\n",
+ "\n",
+ "#result\n",
+ "print \" distance of BC in (km)\",round(d,3)\n",
+ "print \"the angle in deg,min,sec is\",B"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " distance of BC in (km) 24.181\nthe angle in deg,min,sce is [85, 0, 33.27]\n"
+ "text": [
+ " distance of BC in (km) 24.181\n",
+ "the angle in deg,min,sce is [85, 0, 33.27]\n"
+ ]
}
],
"prompt_number": 27
@@ -122,19 +279,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.6.1,Page 37"
+ "source": [
+ "Example 1.6.1,Page 37"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding altitude and zenith distance of star\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndelta =42+15.0/60; # declination of star\ntheta =26+40.0/60; # lattude of star\n\n#caculation\nzend =90.0 - theta -90+ delta ;\nalt =90.0 - zend ;\n\n#for zenith distance\n#a= zend *3600 %60;\nb= ((zend *3600 )%3600) /60;\nc=( zend *3600 - b*60 -a) /3600;\nprint \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n#for altitude\na= alt *3600 %60;\nb= ((alt *3600 -a)%3600) /60;\nc=( alt *3600 - b*60 -a) /3600;\nprint \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "delta =42+15.0/60; # declination of star\n",
+ "theta =26+40.0/60; # lattude of star\n",
+ "\n",
+ "#caculation\n",
+ "zend =90.0 - theta -90+ delta ;\n",
+ "alt =90.0 - zend ;\n",
+ "\n",
+ "#for zenith distance\n",
+ "#a= zend *3600 %60;\n",
+ "b= ((zend *3600 )%3600) /60;\n",
+ "c=( zend *3600 - b*60 -a) /3600;\n",
+ "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n",
+ "#for altitude\n",
+ "a= alt *3600 %60;\n",
+ "b= ((alt *3600 -a)%3600) /60;\n",
+ "c=( alt *3600 - b*60 -a) /3600;\n",
+ "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " zenith distance 0.0 seconds 35.0 minutes 15.0 degrees\n altitude of star 0.0 seconds 25.0 minutes 74.0 degrees\n"
+ "text": [
+ " zenith distance 0.0 seconds 35.0 minutes 15.0 degrees\n",
+ " altitude of star 0.0 seconds 25.0 minutes 74.0 degrees\n"
+ ]
}
],
"prompt_number": 13
@@ -143,19 +329,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.6.2,Page 36"
+ "source": [
+ "Example 1.6.2,Page 36"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding altitude and zenith distance of star\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndelta =23+20.0/60; # declination of star\ntheta =26+40.0/60; # lattude of star\n\n#caculation\nzend =90.0 + theta -90- delta ;\nalt =90.0 - zend ;\n\n#for zenith distance\na= zend *3600 %60;\nb= ((zend *3600 -a)%3600) /60;\nc=( zend *3600 - b*60 -a) /3600;\nprint \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n#for altitude\n\nb= ((alt *3600 )%3600) /60;\nc=( alt *3600 - b*60 -a) /3600;\nprint \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "delta =23+20.0/60; # declination of star\n",
+ "theta =26+40.0/60; # lattude of star\n",
+ "\n",
+ "#caculation\n",
+ "zend =90.0 + theta -90- delta ;\n",
+ "alt =90.0 - zend ;\n",
+ "\n",
+ "#for zenith distance\n",
+ "a= zend *3600 %60;\n",
+ "b= ((zend *3600 -a)%3600) /60;\n",
+ "c=( zend *3600 - b*60 -a) /3600;\n",
+ "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n",
+ "#for altitude\n",
+ "\n",
+ "b= ((alt *3600 )%3600) /60;\n",
+ "c=( alt *3600 - b*60 -a) /3600;\n",
+ "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " zenith distance 0.0 seconds 20.0 minutes 3.0 degrees\n altitude of star 0.0 seconds 40.0 minutes 86.0 degrees\n"
+ "text": [
+ " zenith distance 0.0 seconds 20.0 minutes 3.0 degrees\n",
+ " altitude of star 0.0 seconds 40.0 minutes 86.0 degrees\n"
+ ]
}
],
"prompt_number": 12
@@ -164,19 +378,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.6.3,Page 37"
+ "source": [
+ "Example 1.6.3,Page 37"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding altitude and zenith distance of star\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndelta =65+40.0/60; # declination of star\ntheta =26+40.0/60; # lattude of star\n\n#caculation\nzend =90.0 - theta -90+ delta ;\nalt =90.0 - zend ;\n\n#for zenith distance\na= zend *3600 %60;\nb= ((zend *3600 -a)%3600) /60;\nc=( zend *3600 - b*60 -a) /3600;\nprint \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n#for altitude\na= alt *3600 %60;\nb= ((alt *3600 -a)%3600) /60;\nc=( alt *3600 - b*60 -a) /3600;\nprint \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "delta =65+40.0/60; # declination of star\n",
+ "theta =26+40.0/60; # lattude of star\n",
+ "\n",
+ "#caculation\n",
+ "zend =90.0 - theta -90+ delta ;\n",
+ "alt =90.0 - zend ;\n",
+ "\n",
+ "#for zenith distance\n",
+ "a= zend *3600 %60;\n",
+ "b= ((zend *3600 -a)%3600) /60;\n",
+ "c=( zend *3600 - b*60 -a) /3600;\n",
+ "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n",
+ "#for altitude\n",
+ "a= alt *3600 %60;\n",
+ "b= ((alt *3600 -a)%3600) /60;\n",
+ "c=( alt *3600 - b*60 -a) /3600;\n",
+ "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " zenith distance 0.0 seconds 0.0 minutes 39.0 degrees\n altitude of star 0.0 seconds 0.0 minutes 51.0 degrees\n"
+ "text": [
+ " zenith distance 0.0 seconds 0.0 minutes 39.0 degrees\n",
+ " altitude of star 0.0 seconds 0.0 minutes 51.0 degrees\n"
+ ]
}
],
"prompt_number": 5
@@ -185,19 +427,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.7,Page 37"
+ "source": [
+ "Example 1.7,Page 37"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding altitude and zenith distance of star\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndelta =85+20.0/60; # declination of star\ntheta =46+50.0/60; # lattude of star\n\n#caculation\nzend =90.0 - theta +90- delta ;\nalt =90.0 - zend ;\n\n#for zenith distance\n\nb= ((zend *3600 )%3600) /60;\nc=( zend *3600 - b*60 -a) /3600;\nprint \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n#for altitude\na= alt *3600 %60;\nb= ((alt *3600 -a)%3600) /60;\nc=( alt *3600 - b*60 -a) /3600;\nprint \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "delta =85+20.0/60; # declination of star\n",
+ "theta =46+50.0/60; # lattude of star\n",
+ "\n",
+ "#caculation\n",
+ "zend =90.0 - theta +90- delta ;\n",
+ "alt =90.0 - zend ;\n",
+ "\n",
+ "#for zenith distance\n",
+ "\n",
+ "b= ((zend *3600 )%3600) /60;\n",
+ "c=( zend *3600 - b*60 -a) /3600;\n",
+ "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n",
+ "#for altitude\n",
+ "a= alt *3600 %60;\n",
+ "b= ((alt *3600 -a)%3600) /60;\n",
+ "c=( alt *3600 - b*60 -a) /3600;\n",
+ "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " zenith distance 0.0 seconds 50.0 minutes 47.0 degrees\n altitude of star 0.0 seconds 10.0 minutes 42.0 degrees\n"
+ "text": [
+ " zenith distance 0.0 seconds 50.0 minutes 47.0 degrees\n",
+ " altitude of star 0.0 seconds 10.0 minutes 42.0 degrees\n"
+ ]
}
],
"prompt_number": 10
@@ -206,19 +476,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.8,Page 38"
+ "source": [
+ "Example 1.8,Page 38"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding altitude and zenith distance of star\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndelta =56+10.0/60; # declination of star\ntheta =56+10.0/60; # lattude of star\n\n#caculation\nzend =90.0 - theta +90- delta ;\nalt =90.0 - zend ;\n\n#for zenith distance\na= zend *3600 %60;\nb= ((zend *3600-a )%3600) /60;\nc=( zend *3600 - b*60 -a) /3600;\nprint \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n#for altitude\n#a= alt *3600 %60;\nb= ((alt *3600 )%3600) /60;\nc=( alt *3600 - b*60 -a) /3600;\nprint \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "delta =56+10.0/60; # declination of star\n",
+ "theta =56+10.0/60; # lattude of star\n",
+ "\n",
+ "#caculation\n",
+ "zend =90.0 - theta +90- delta ;\n",
+ "alt =90.0 - zend ;\n",
+ "\n",
+ "#for zenith distance\n",
+ "a= zend *3600 %60;\n",
+ "b= ((zend *3600-a )%3600) /60;\n",
+ "c=( zend *3600 - b*60 -a) /3600;\n",
+ "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n",
+ "#for altitude\n",
+ "#a= alt *3600 %60;\n",
+ "b= ((alt *3600 )%3600) /60;\n",
+ "c=( alt *3600 - b*60 -a) /3600;\n",
+ "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " zenith distance 0.0 seconds 40.0 minutes 67.0 degrees\n altitude of star 0.0 seconds 20.0 minutes 22.0 degrees\n"
+ "text": [
+ " zenith distance 0.0 seconds 40.0 minutes 67.0 degrees\n",
+ " altitude of star 0.0 seconds 20.0 minutes 22.0 degrees\n"
+ ]
}
],
"prompt_number": 15
@@ -227,19 +525,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.9,Page 38"
+ "source": [
+ "Example 1.9,Page 38"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude and declination \n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\nimport numpy as np\na=np.array([[1.0,-1.0],[1.0,1.0]])\nb=np.array([59.0/3,332.0/3])\n\n#calculation\nx=np.linalg.solve(a,b);\n\n#result\nprint\"declination of star in (degrees)\",round(x[0],3);\nprint\"latitude of the place of observation (degrees)\",x[1];",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "import numpy as np\n",
+ "a=np.array([[1.0,-1.0],[1.0,1.0]])\n",
+ "b=np.array([59.0/3,332.0/3])\n",
+ "\n",
+ "#calculation\n",
+ "x=np.linalg.solve(a,b);\n",
+ "\n",
+ "#result\n",
+ "print\"declination of star in (degrees)\",round(x[0],3);\n",
+ "print\"latitude of the place of observation (degrees)\",x[1];"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "declination of star in (degrees) 65.167\nlatitude of the place of observation (degrees) 45.5\n"
+ "text": [
+ "declination of star in (degrees) 65.167\n",
+ "latitude of the place of observation (degrees) 45.5\n"
+ ]
}
],
"prompt_number": 22
@@ -248,19 +565,64 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.10,Page 39"
+ "source": [
+ "Example 1.10,Page 39"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding azimuth and altitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ntheta =20+30.0/60;\nH =42+6.0/60; # hour angle\ndelta =50.0;\n\n\n# in triangle ZPM\n\n#calculation\nPZ =(90 - delta )*pi /180;\nH=H*pi /180;\nPM =(90 - theta )*pi /180;\nZM= acos (( cos (PZ)* cos (PM)+sin(PM)*sin(PZ)* cos (H)));\nalpha =pi /2- ZM;\nalpha = alpha *180/ pi;\nA =(( cos(PM)-cos (PZ)* cos (ZM))/ sin (PZ)/sin(ZM));\n\nif A <0:\n A=-A;\n A=acos(A)\n A=180-A*180/pi;\n \n\n#for altitude\nalt=alpha;\na= alt *3600 %60;\nb=((alt *3600-a )%3600) /60;\nc=( alt *3600 - b*60 -a) /3600;\nprint \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n\n#for azimuth \na= A *3600 %60;\nb= ((A *3600-a )%3600) /60;\nc=( A *3600 - b*60 -a) /3600;\nprint\" azimuth of star in (degrees ) westwards \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "theta =20+30.0/60;\n",
+ "H =42+6.0/60; # hour angle\n",
+ "delta =50.0;\n",
+ "\n",
+ "\n",
+ "# in triangle ZPM\n",
+ "\n",
+ "#calculation\n",
+ "PZ =(90 - delta )*pi /180;\n",
+ "H=H*pi /180;\n",
+ "PM =(90 - theta )*pi /180;\n",
+ "ZM= acos (( cos (PZ)* cos (PM)+sin(PM)*sin(PZ)* cos (H)));\n",
+ "alpha =pi /2- ZM;\n",
+ "alpha = alpha *180/ pi;\n",
+ "A =(( cos(PM)-cos (PZ)* cos (ZM))/ sin (PZ)/sin(ZM));\n",
+ "\n",
+ "if A <0:\n",
+ " A=-A;\n",
+ " A=acos(A)\n",
+ " A=180-A*180/pi;\n",
+ " \n",
+ "\n",
+ "#for altitude\n",
+ "alt=alpha;\n",
+ "a= alt *3600 %60;\n",
+ "b=((alt *3600-a )%3600) /60;\n",
+ "c=( alt *3600 - b*60 -a) /3600;\n",
+ "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n",
+ "\n",
+ "#for azimuth \n",
+ "a= A *3600 %60;\n",
+ "b= ((A *3600-a )%3600) /60;\n",
+ "c=( A *3600 - b*60 -a) /3600;\n",
+ "print\" azimuth of star in (degrees ) westwards \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " altitude of star 36.75 seconds 38.0 minutes 45.0 degrees\n azimuth of star in (degrees ) westwards 25.551 seconds 4.0 minutes 116.0 degrees\n"
+ "text": [
+ " altitude of star 36.75 seconds 38.0 minutes 45.0 degrees\n",
+ " azimuth of star in (degrees ) westwards 25.551 seconds 4.0 minutes 116.0 degrees\n"
+ ]
}
],
"prompt_number": 32
@@ -269,19 +631,64 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.11,Page 40"
+ "source": [
+ "Example 1.11,Page 40"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding azimuth and altitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ntheta = -8 -30.0/60;\nH =322.0; # hour angle\ndelta =50;\n\n\n# in triangle ZPM\n\n#calculation\nPZ =(90 - delta )*pi /180;\nH =2* pi -H*pi /180;\nPM =(90 - theta )*pi /180;\nZM= acos (( cos (PZ)* cos (PM)+sin(PM)*sin(PZ)* cos (H)));\nalpha =pi /2- ZM;\nalpha=alpha*180/pi;\nA =(( cos(PM)-cos (PZ)* cos (ZM))/ sin (PZ)/sin(ZM));\n\nif A <0:\n A=-A;\n A=acos(A)\n A=180-A*180/pi;\n \n#result\n#for altitude\nalt=alpha;\na= alt *3600 %60;\nb=((alt *3600-a )%3600) /60;\nc=( alt *3600 - b*60 -a) /3600;\nprint \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n\n#for azimuth \na= A *3600 %60;\nb= ((A *3600-a )%3600) /60;\nc=( A *3600 - b*60 -a) /3600;\nprint\" azimuth of star in (degrees ) eastwards \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "theta = -8 -30.0/60;\n",
+ "H =322.0; # hour angle\n",
+ "delta =50;\n",
+ "\n",
+ "\n",
+ "# in triangle ZPM\n",
+ "\n",
+ "#calculation\n",
+ "PZ =(90 - delta )*pi /180;\n",
+ "H =2* pi -H*pi /180;\n",
+ "PM =(90 - theta )*pi /180;\n",
+ "ZM= acos (( cos (PZ)* cos (PM)+sin(PM)*sin(PZ)* cos (H)));\n",
+ "alpha =pi /2- ZM;\n",
+ "alpha=alpha*180/pi;\n",
+ "A =(( cos(PM)-cos (PZ)* cos (ZM))/ sin (PZ)/sin(ZM));\n",
+ "\n",
+ "if A <0:\n",
+ " A=-A;\n",
+ " A=acos(A)\n",
+ " A=180-A*180/pi;\n",
+ " \n",
+ "#result\n",
+ "#for altitude\n",
+ "alt=alpha;\n",
+ "a= alt *3600 %60;\n",
+ "b=((alt *3600-a )%3600) /60;\n",
+ "c=( alt *3600 - b*60 -a) /3600;\n",
+ "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n",
+ "\n",
+ "#for azimuth \n",
+ "a= A *3600 %60;\n",
+ "b= ((A *3600-a )%3600) /60;\n",
+ "c=( A *3600 - b*60 -a) /3600;\n",
+ "print\" azimuth of star in (degrees ) eastwards \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " altitude of star 48.256 seconds 48.0 minutes 22.0 degrees\n azimuth of star in (degrees ) eastwards 22.798 seconds 39.0 minutes 138.0 degrees\n"
+ "text": [
+ " altitude of star 48.256 seconds 48.0 minutes 22.0 degrees\n",
+ " azimuth of star in (degrees ) eastwards 22.798 seconds 39.0 minutes 138.0 degrees\n"
+ ]
}
],
"prompt_number": 31
@@ -290,19 +697,61 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.12,Page 42"
+ "source": [
+ "Example 1.12,Page 42"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding hour angle\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\nalpha =22+36.0/60; # altitude of star\nA =42.0 # azimuth angle\ndelta =40.0; # latitude of observer\n\n# in triangle ZPM\n\n#calculation\nPZ =(90 - delta )*pi /180;\nA=A*pi /180;\nZM =(90 - alpha )*pi /180;\nPM= acos (( cos (PZ)* cos (ZM)+sin(ZM)*sin(PZ)* cos (A)));\ntheta =pi /2- PM\ntheta=theta*180/pi;\nH =(( cos(ZM)-cos (PZ)* cos (PM))/ sin (PZ)/sin(PM));\nif H <0:\n H=-H;\n H=acos(H)\n H=180-H*180/pi;\n \n\n#result\n#for declination \nalt=theta;\na= alt *3600 %60;\nb=((alt *3600-a )%3600) /60;\nc=( alt *3600 - b*60 -a) /3600;\nprint \" declination of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n#for hour angle\na= H *3600 %60;\nb= ((H *3600-a )%3600) /60;\nc=( H *3600 - b*60 -a) /3600;\nprint\" hour angle of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "alpha =22+36.0/60; # altitude of star\n",
+ "A =42.0 # azimuth angle\n",
+ "delta =40.0; # latitude of observer\n",
+ "\n",
+ "# in triangle ZPM\n",
+ "\n",
+ "#calculation\n",
+ "PZ =(90 - delta )*pi /180;\n",
+ "A=A*pi /180;\n",
+ "ZM =(90 - alpha )*pi /180;\n",
+ "PM= acos (( cos (PZ)* cos (ZM)+sin(ZM)*sin(PZ)* cos (A)));\n",
+ "theta =pi /2- PM\n",
+ "theta=theta*180/pi;\n",
+ "H =(( cos(ZM)-cos (PZ)* cos (PM))/ sin (PZ)/sin(PM));\n",
+ "if H <0:\n",
+ " H=-H;\n",
+ " H=acos(H)\n",
+ " H=180-H*180/pi;\n",
+ " \n",
+ "\n",
+ "#result\n",
+ "#for declination \n",
+ "alt=theta;\n",
+ "a= alt *3600 %60;\n",
+ "b=((alt *3600-a )%3600) /60;\n",
+ "c=( alt *3600 - b*60 -a) /3600;\n",
+ "print \" declination of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n",
+ "#for hour angle\n",
+ "a= H *3600 %60;\n",
+ "b= ((H *3600-a )%3600) /60;\n",
+ "c=( H *3600 - b*60 -a) /3600;\n",
+ "print\" hour angle of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " declination of star 12.44 seconds 35.0 minutes 50.0 degrees\n hour angle of star 5.342 seconds 21.0 minutes 103.0 degrees\n"
+ "text": [
+ " declination of star 12.44 seconds 35.0 minutes 50.0 degrees\n",
+ " hour angle of star 5.342 seconds 21.0 minutes 103.0 degrees\n"
+ ]
}
],
"prompt_number": 34
@@ -311,19 +760,61 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.13,Page 42"
+ "source": [
+ "Example 1.13,Page 42"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding hour angle\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\nalpha =21+30.0/60; # a l t i t u d e o f s t a r\nA =140.0 # azimuth a n g l e\ndelta =48.0; # l a t i t u d e o f o b s e r v e r\n\n#calculation\nPZ =(90 - delta )*pi /180;\nA=A*pi /180;\nZM =(90 - alpha )*pi /180;\nPM =( cos(PZ)*cos(ZM)+ sin (ZM)* sin (PZ)* cos (A));\n\nif PM <0:\n PM=-PM\n PM=acos(PM)\n PM=180-PM*180/pi;\n\nH= acos (( cos (ZM)-cos(PZ)*cos(PM*pi /180) )/ sin (PZ)/sin (PM*pi /180) );\nH =2* pi -H;\nH=H*180/pi;\n\n#result\n#for declination \nalt=PM-90;\na= alt *3600 %60;\nb=((alt *3600-a )%3600) /60;\nc=( alt *3600 - b*60 -a) /3600;\nprint \" declination of star southwards \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n\n#for hour angle\na= H *3600 %60;\nb= ((H *3600-a )%3600) /60;\nc=( H *3600 - b*60 -a) /3600;\nprint\" hour angle of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "alpha =21+30.0/60; # a l t i t u d e o f s t a r\n",
+ "A =140.0 # azimuth a n g l e\n",
+ "delta =48.0; # l a t i t u d e o f o b s e r v e r\n",
+ "\n",
+ "#calculation\n",
+ "PZ =(90 - delta )*pi /180;\n",
+ "A=A*pi /180;\n",
+ "ZM =(90 - alpha )*pi /180;\n",
+ "PM =( cos(PZ)*cos(ZM)+ sin (ZM)* sin (PZ)* cos (A));\n",
+ "\n",
+ "if PM <0:\n",
+ " PM=-PM\n",
+ " PM=acos(PM)\n",
+ " PM=180-PM*180/pi;\n",
+ "\n",
+ "H= acos (( cos (ZM)-cos(PZ)*cos(PM*pi /180) )/ sin (PZ)/sin (PM*pi /180) );\n",
+ "H =2* pi -H;\n",
+ "H=H*180/pi;\n",
+ "\n",
+ "#result\n",
+ "#for declination \n",
+ "alt=PM-90;\n",
+ "a= alt *3600 %60;\n",
+ "b=((alt *3600-a )%3600) /60;\n",
+ "c=( alt *3600 - b*60 -a) /3600;\n",
+ "print \" declination of star southwards \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n",
+ "\n",
+ "#for hour angle\n",
+ "a= H *3600 %60;\n",
+ "b= ((H *3600-a )%3600) /60;\n",
+ "c=( H *3600 - b*60 -a) /3600;\n",
+ "print\" hour angle of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " declination of star southwards 12.098 seconds 48.0 minutes 11.0 degrees\n hour angle of star 22.619 seconds 20.0 minutes 322.0 degrees\n"
+ "text": [
+ " declination of star southwards 12.098 seconds 48.0 minutes 11.0 degrees\n",
+ " hour angle of star 22.619 seconds 20.0 minutes 322.0 degrees\n"
+ ]
}
],
"prompt_number": 44
@@ -332,19 +823,68 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.14,Page 43"
+ "source": [
+ "Example 1.14,Page 43"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding hour angle\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = (md - m) * 60\n sd=round(sd,2)\n return [d, m, sd]\n# part 1\ndelta =22+12.0/60;\ntheta =42+30.0/60;\n\n#calculation\nZP =(90 - theta )*pi /180;\nPM =(90 - delta )*pi /180;\nA= acos ( cos (PM)/sin(ZP));\nH=180 - acos ( tan (pi /2- ZP)*tan(pi /2- PM)) *180/ pi\nA=deg_to_dms(A*180/ pi);\nH=deg_to_dms(H/15);\n\n#result\nprint \" azimuth of setting sun in ( degrees,min,second) \",A\nprint \" suns hour angle in ( hr,min,second ) : \",H\n\n#part 2\ndelta = -22 -12/60;\ntheta =42+30.0/60;\n\n#calculation\nZP =(90 - theta )*pi /180;\nPM =(90 - delta )*pi /180;\nA= acos ( cos (PM)/sin(ZP));\nH=180 - acos ( tan (pi /2- ZP)*tan(pi /2- PM)) *180/ pi\nA=deg_to_dms(A*180/ pi);\nH=deg_to_dms(H/15);\n\n#result\nprint \" azimuth of setting sun in ( degrees,min,second) \",A\nprint \" suns hour angle in ( hr,min,second ) : \",H",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = (md - m) * 60\n",
+ " sd=round(sd,2)\n",
+ " return [d, m, sd]\n",
+ "# part 1\n",
+ "delta =22+12.0/60;\n",
+ "theta =42+30.0/60;\n",
+ "\n",
+ "#calculation\n",
+ "ZP =(90 - theta )*pi /180;\n",
+ "PM =(90 - delta )*pi /180;\n",
+ "A= acos ( cos (PM)/sin(ZP));\n",
+ "H=180 - acos ( tan (pi /2- ZP)*tan(pi /2- PM)) *180/ pi\n",
+ "A=deg_to_dms(A*180/ pi);\n",
+ "H=deg_to_dms(H/15);\n",
+ "\n",
+ "#result\n",
+ "print \" azimuth of setting sun in ( degrees,min,second) \",A\n",
+ "print \" suns hour angle in ( hr,min,second ) : \",H\n",
+ "\n",
+ "#part 2\n",
+ "delta = -22 -12/60;\n",
+ "theta =42+30.0/60;\n",
+ "\n",
+ "#calculation\n",
+ "ZP =(90 - theta )*pi /180;\n",
+ "PM =(90 - delta )*pi /180;\n",
+ "A= acos ( cos (PM)/sin(ZP));\n",
+ "H=180 - acos ( tan (pi /2- ZP)*tan(pi /2- PM)) *180/ pi\n",
+ "A=deg_to_dms(A*180/ pi);\n",
+ "H=deg_to_dms(H/15);\n",
+ "\n",
+ "#result\n",
+ "print \" azimuth of setting sun in ( degrees,min,second) \",A\n",
+ "print \" suns hour angle in ( hr,min,second ) : \",H"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " azimuth of setting sun in ( degrees,min,second) [59, 10, 14.72]\n suns hour angle in ( hr,min,second ) : [7, 27, 50.23]\n azimuth of setting sun in ( degrees,min,second) [120, 32, 13.17]\n suns hour angle in ( hr,min,second ) : [4, 33, 4.97]\n"
+ "text": [
+ " azimuth of setting sun in ( degrees,min,second) [59, 10, 14.72]\n",
+ " suns hour angle in ( hr,min,second ) : [7, 27, 50.23]\n",
+ " azimuth of setting sun in ( degrees,min,second) [120, 32, 13.17]\n",
+ " suns hour angle in ( hr,min,second ) : [4, 33, 4.97]\n"
+ ]
}
],
"prompt_number": 10
@@ -353,19 +893,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.15,Page 44"
+ "source": [
+ "Example 1.15,Page 44"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding hour angle\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndelta =22+12.0/60;\ntheta =42+30.0/60;\nef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = (md - m) * 60\n sd=round(sd,2)\n return [d, m, sd]\n\n#calculation\nZP =(90 - theta )*pi /180;\nPM =(90 - delta )*pi /180;\nA= acos ( cos (PM)/sin(ZP));\nH=180 - acos ( tan (pi /2- ZP)*tan(pi /2- PM)) *180/ pi\nA=deg_to_dms(180-A*180/ pi);\nH=deg_to_dms(H/15);\n\n#result\nprint \" azimuth of setting sun in ( degrees,min,second) \",A\nprint \" suns hour angle in ( hr,min,second ) : \",H\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "delta =22+12.0/60;\n",
+ "theta =42+30.0/60;\n",
+ "ef deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = (md - m) * 60\n",
+ " sd=round(sd,2)\n",
+ " return [d, m, sd]\n",
+ "\n",
+ "#calculation\n",
+ "ZP =(90 - theta )*pi /180;\n",
+ "PM =(90 - delta )*pi /180;\n",
+ "A= acos ( cos (PM)/sin(ZP));\n",
+ "H=180 - acos ( tan (pi /2- ZP)*tan(pi /2- PM)) *180/ pi\n",
+ "A=deg_to_dms(180-A*180/ pi);\n",
+ "H=deg_to_dms(H/15);\n",
+ "\n",
+ "#result\n",
+ "print \" azimuth of setting sun in ( degrees,min,second) \",A\n",
+ "print \" suns hour angle in ( hr,min,second ) : \",H\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " azimuth of setting sun in ( degrees,min,second) [120, 49, 45.28]\n suns hour angle in ( hr,min,second ) : [7, 27, 50.23]\n"
+ "text": [
+ " azimuth of setting sun in ( degrees,min,second) [120, 49, 45.28]\n",
+ " suns hour angle in ( hr,min,second ) : [7, 27, 50.23]\n"
+ ]
}
],
"prompt_number": 11
@@ -374,19 +945,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.16,Page 61"
+ "source": [
+ "Example 1.16,Page 61"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding error in time\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ntime = -3 -28.41/60; # greenwich time at july 1 1951\nchange = -11.82/60;\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = (md - m) * 60\n sd=round(sd,2)\n return [d, m, sd]\n\n#calculation\nc12 = change/24*12 # change of time in 12 hours\ntch =time +c12;\ntch=deg_to_dms(tch/60);\n\n#result\nprint \" greenwich mean time error in 12 th hour(-ve) in( deg,min,sec) \",tch\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "time = -3 -28.41/60; # greenwich time at july 1 1951\n",
+ "change = -11.82/60;\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = (md - m) * 60\n",
+ " sd=round(sd,2)\n",
+ " return [d, m, sd]\n",
+ "\n",
+ "#calculation\n",
+ "c12 = change/24*12 # change of time in 12 hours\n",
+ "tch =time +c12;\n",
+ "tch=deg_to_dms(tch/60);\n",
+ "\n",
+ "#result\n",
+ "print \" greenwich mean time error in 12 th hour(-ve) in( deg,min,sec) \",tch\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " greenwich mean time error in 12 th hour(-ve) in( deg,min,sec) [0, 3, 34.32]\n"
+ "text": [
+ " greenwich mean time error in 12 th hour(-ve) in( deg,min,sec) [0, 3, 34.32]\n"
+ ]
}
],
"prompt_number": 1
@@ -395,19 +992,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.17,Page 61"
+ "source": [
+ "Example 1.17,Page 61"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding GAT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = (md - m) * 60\n return [d, m, sd]\n#printing result in degree minute and seconds respectively \nGMN = -14*60 -10;\nchangeET =1*1.5;\n\n#calculation\nneterr =GMN+ changeET ;\nGAT = time + neterr ;\nGAT=GAT+10*3600+30*60;\nhr= round ( GAT /3600) ;\nb=GAT -hr *3600;\nmi= round (b /60 -1);\nc=GAT -hr *3600 - mi *60;\n\n#result\nprint hr,\"hour\",mi,\"minutes\",c,\"seconds of GAT\"",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = (md - m) * 60\n",
+ " return [d, m, sd]\n",
+ "#printing result in degree minute and seconds respectively \n",
+ "GMN = -14*60 -10;\n",
+ "changeET =1*1.5;\n",
+ "\n",
+ "#calculation\n",
+ "neterr =GMN+ changeET ;\n",
+ "GAT = time + neterr ;\n",
+ "GAT=GAT+10*3600+30*60;\n",
+ "hr= round ( GAT /3600) ;\n",
+ "b=GAT -hr *3600;\n",
+ "mi= round (b /60 -1);\n",
+ "c=GAT -hr *3600 - mi *60;\n",
+ "\n",
+ "#result\n",
+ "print hr,\"hour\",mi,\"minutes\",c,\"seconds of GAT\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "10.0 hour 15.0 minutes 48.0265 seconds of GAT\n"
+ "text": [
+ "10.0 hour 15.0 minutes 48.0265 seconds of GAT\n"
+ ]
}
],
"prompt_number": 5
@@ -416,19 +1043,75 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.18,Page 62"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "#finding time\n\n#part1\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = (md - m) * 60\n return [d, m, sd]\nA =50+12.0/60+48.0/3600;\ntime =A /15*3600\n\n#calculation\nhr= round ( time /3600) ;\nb=time -hr *3600;\nmi= round (b /60 -1);\nc=time -hr *3600 - mi *60;\n\n#result\nprint hr,\"hour\",mi,\"minutes\",c,\"seconds of angles\"\n\n#part 2\n#initialisation of variable\nA =8+18.0/60+6.0/3600;\ntime =A /15*3600\n\n#calculation\nhr= round ( time /3600-1) ;\nb=time -hr *3600;\nmi= round (b /60 );\nc=time -hr *3600 - mi *60;\n\n#result\nprint hr,\"hour\",mi,\"minutes\",c,\"seconds of angles\"\n\n#part 3\n#initialisation of variable\nA =258+36.0/60+30.0/3600;\ntime =A /15*3600\n\n#calculation\nhr= round ( time /3600) ;\nb=time -hr *3600;\nmi= round (b /60 );\nc=time -hr *3600 - mi *60;\n\n#result\nprint hr,\"hour\",mi,\"minutes\",c,\"seconds of angles\"",
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": "3.0 hour 20.0 minutes 51.2 seconds of angles\n-0.0 hour 33.0 minutes 12.4 seconds of angles\n17.0 hour 14.0 minutes 26.0 seconds of angles\n"
+ "source": [
+ "Example 1.18,Page 62"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#part1\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = (md - m) * 60\n",
+ " return [d, m, sd]\n",
+ "A =50+12.0/60+48.0/3600;\n",
+ "time =A /15*3600\n",
+ "\n",
+ "#calculation\n",
+ "hr= round ( time /3600) ;\n",
+ "b=time -hr *3600;\n",
+ "mi= round (b /60 -1);\n",
+ "c=time -hr *3600 - mi *60;\n",
+ "\n",
+ "#result\n",
+ "print hr,\"hour\",mi,\"minutes\",c,\"seconds of angles\"\n",
+ "\n",
+ "#part 2\n",
+ "#initialisation of variable\n",
+ "A =8+18.0/60+6.0/3600;\n",
+ "time =A /15*3600\n",
+ "\n",
+ "#calculation\n",
+ "hr= round ( time /3600-1) ;\n",
+ "b=time -hr *3600;\n",
+ "mi= round (b /60 );\n",
+ "c=time -hr *3600 - mi *60;\n",
+ "\n",
+ "#result\n",
+ "print hr,\"hour\",mi,\"minutes\",c,\"seconds of angles\"\n",
+ "\n",
+ "#part 3\n",
+ "#initialisation of variable\n",
+ "A =258+36.0/60+30.0/3600;\n",
+ "time =A /15*3600\n",
+ "\n",
+ "#calculation\n",
+ "hr= round ( time /3600) ;\n",
+ "b=time -hr *3600;\n",
+ "mi= round (b /60 );\n",
+ "c=time -hr *3600 - mi *60;\n",
+ "\n",
+ "#result\n",
+ "print hr,\"hour\",mi,\"minutes\",c,\"seconds of angles\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3.0 hour 20.0 minutes 51.2 seconds of angles\n",
+ "-0.0 hour 33.0 minutes 12.4 seconds of angles\n",
+ "17.0 hour 14.0 minutes 26.0 seconds of angles\n"
+ ]
}
],
"prompt_number": 21
@@ -437,19 +1120,55 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.19,Page 62"
+ "source": [
+ "Example 1.19,Page 62"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding angle\n\n#part1\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nA =4+34.0/60+13.0/3600;\n\n#calculation\nangle =A *15;\nangle=deg_to_dms(angle);\n\n#result\nprint \"angle in degree,minute,second respectively\",angle\n\n#part 2\n#initialisation of variable\nA =18+11.0/60+38.0/3600;\n\n#calculation\nangle =A *15;\nangle=deg_to_dms(angle);\n\n#result\nprint \"angle in degree,minute,second respectively\",angle\n",
+ "input": [
+ "\n",
+ "\n",
+ "#part1\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "A =4+34.0/60+13.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "angle =A *15;\n",
+ "angle=deg_to_dms(angle);\n",
+ "\n",
+ "#result\n",
+ "print \"angle in degree,minute,second respectively\",angle\n",
+ "\n",
+ "#part 2\n",
+ "#initialisation of variable\n",
+ "A =18+11.0/60+38.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "angle =A *15;\n",
+ "angle=deg_to_dms(angle);\n",
+ "\n",
+ "#result\n",
+ "print \"angle in degree,minute,second respectively\",angle\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "angle in degree,minute,second respectively [68, 33, 15.0]\nangle in degree,minute,second respectively [272, 54, 30.0]\n"
+ "text": [
+ "angle in degree,minute,second respectively [68, 33, 15.0]\n",
+ "angle in degree,minute,second respectively [272, 54, 30.0]\n"
+ ]
}
],
"prompt_number": 15
@@ -458,19 +1177,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.20.a,Page 64"
+ "source": [
+ "Example 1.20.a,Page 64"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding local mean time\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP =20 # longitude of the place\nlongSM =82+30.0/60; # longitude of standard meridion\n\n#calculation\ndolong =longSM - longP ; # difference in longitude\ndot = dolong /15.0; # difference in time\nLMT =20+24.0/60+6.0/3600 - dot ;\nLMT=deg_to_dms(LMT)\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP =20 # longitude of the place\n",
+ "longSM =82+30.0/60; # longitude of standard meridion\n",
+ "\n",
+ "#calculation\n",
+ "dolong =longSM - longP ; # difference in longitude\n",
+ "dot = dolong /15.0; # difference in time\n",
+ "LMT =20+24.0/60+6.0/3600 - dot ;\n",
+ "LMT=deg_to_dms(LMT)\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[16, 14, 6.0] Local mean time in hours,minute,second respectively\n"
+ "text": [
+ "[16, 14, 6.0] Local mean time in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 10
@@ -479,19 +1224,45 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.20.b,Page 64"
+ "source": [
+ "Example 1.20.b,Page 64"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding local mean time\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP =-20 # longitude of the place\nlongSM =82+30.0/60; # longitude of standard meridion\n\n#calculation\ndolong =longSM - longP ; # difference in longitude\ndot = dolong /15.0; # difference in time\nLMT =20+24.0/60+6.0/3600 - dot ;\nLMT=deg_to_dms(LMT)\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP =-20 # longitude of the place\n",
+ "longSM =82+30.0/60; # longitude of standard meridion\n",
+ "\n",
+ "#calculation\n",
+ "dolong =longSM - longP ; # difference in longitude\n",
+ "dot = dolong /15.0; # difference in time\n",
+ "LMT =20+24.0/60+6.0/3600 - dot ;\n",
+ "LMT=deg_to_dms(LMT)\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[13, 34, 6.0] Local mean time in hours,minute,second respectively\n"
+ "text": [
+ "[13, 34, 6.0] Local mean time in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 11
@@ -500,19 +1271,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.21.a,Page 64"
+ "source": [
+ "Example 1.21.a,Page 64"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding GMT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nLMT =9+40.0/60+12.0/3600;\nlongP = -42 -36.0/60;\n\n#calculation\ndot = longP /15;\nGMT =LMT -dot;\nGMT=deg_to_dms(GMT);\n\n#result\nprint \"GMT in hours,minute,second respectively\",GMT",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "LMT =9+40.0/60+12.0/3600;\n",
+ "longP = -42 -36.0/60;\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15;\n",
+ "GMT =LMT -dot;\n",
+ "GMT=deg_to_dms(GMT);\n",
+ "\n",
+ "#result\n",
+ "print \"GMT in hours,minute,second respectively\",GMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[12, 30, 36.0] GMT in hours,minute,second respectively\n"
+ "text": [
+ "[12, 30, 36.0] GMT in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 12
@@ -521,19 +1317,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.21.b,Page 64"
+ "source": [
+ "Example 1.21.b,Page 64"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding GMT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nLMT =4+32.0/60+10.0/3600;\nlongP = -56 -32.0/60;\n\n#calculation\ndot = longP /15;\nGMT =LMT +dot;\nGMT=deg_to_dms(GMT);\n\n#result\nprint \"GMT in hours,minute,second respectively\",GMT",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "LMT =4+32.0/60+10.0/3600;\n",
+ "longP = -56 -32.0/60;\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15;\n",
+ "GMT =LMT +dot;\n",
+ "GMT=deg_to_dms(GMT);\n",
+ "\n",
+ "#result\n",
+ "print \"GMT in hours,minute,second respectively\",GMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[0, 46, 2.0] GMT in hours,minute,second respectively\n"
+ "text": [
+ "[0, 46, 2.0] GMT in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 14
@@ -542,19 +1363,79 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.22,Page 65"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "#finding LMT\n\n#initialisation of variable\n#part1\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nGCT =18+40.0/60+12.0/3600; # greenwich civil time\nlongP =72+30.0/60; # longitude of the place\n\n#calculation\ndot = longP /15.0;\nLMT = GCT +dot;\nLMT=deg_to_dms(LMT);\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT\n\n#part 2\n#initiallisation of variable\nGCT =18+40.0/60+12.0/3600; # greenwich civil time\nlongP =-72-30.0/60; # longitude of the place\n\n#calculation\ndot = longP /15.0;\nLMT = GCT +dot;\nLMT=deg_to_dms(LMT);\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT\n\n#part 3\n#initialisation of variable\ndef deg_to_dms(deg):\n d = int(deg);\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d-24, m, sd]\nGCT =18+40.0/60+12.0/3600; # greenwich civil time\nlongP =110+32.0/60; # longitude of the place\n\n#calculation\ndot = longP /15.0;\nLMT = GCT +dot;\nLMT=deg_to_dms(LMT);\n\n#result\nprint \"LMT of next day in hours,minute,second respectively\",LMT",
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": "LMT in hours,minute,second respectively [23, 30, 12.0]\nLMT in hours,minute,second respectively [13, 50, 12.0]\nLMT of next day in hours,minute,second respectively [2, 2, 20.0]\n"
+ "source": [
+ "Example 1.22,Page 65"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "#part1\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "GCT =18+40.0/60+12.0/3600; # greenwich civil time\n",
+ "longP =72+30.0/60; # longitude of the place\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15.0;\n",
+ "LMT = GCT +dot;\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT\n",
+ "\n",
+ "#part 2\n",
+ "#initiallisation of variable\n",
+ "GCT =18+40.0/60+12.0/3600; # greenwich civil time\n",
+ "longP =-72-30.0/60; # longitude of the place\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15.0;\n",
+ "LMT = GCT +dot;\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT\n",
+ "\n",
+ "#part 3\n",
+ "#initialisation of variable\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg);\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d-24, m, sd]\n",
+ "GCT =18+40.0/60+12.0/3600; # greenwich civil time\n",
+ "longP =110+32.0/60; # longitude of the place\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15.0;\n",
+ "LMT = GCT +dot;\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT of next day in hours,minute,second respectively\",LMT"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "LMT in hours,minute,second respectively [23, 30, 12.0]\n",
+ "LMT in hours,minute,second respectively [13, 50, 12.0]\n",
+ "LMT of next day in hours,minute,second respectively [2, 2, 20.0]\n"
+ ]
}
],
"prompt_number": 1
@@ -563,19 +1444,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.23,Page 66"
+ "source": [
+ "Example 1.23,Page 66"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LMT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nLMT =10+20.0/60+30.0/3600; # local mean time\nlongP =102+30.0/60; # longitude of the place\n\n#calculation\ndot = longP /15;\nGMT =LMT -dot;\nmGMN =12 - GMT ; #mean time interval\ni= mGMN *0.32/3600; # increase in mGMN\nETGMN =5.0/60+4.35/3600;\nch=i+ ETGMN ; # change in GMT\nGMT =ch+GMT;\nLMT = GMT +dot;\nLMT=deg_to_dms(LMT);\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "LMT =10+20.0/60+30.0/3600; # local mean time\n",
+ "longP =102+30.0/60; # longitude of the place\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15;\n",
+ "GMT =LMT -dot;\n",
+ "mGMN =12 - GMT ; #mean time interval\n",
+ "i= mGMN *0.32/3600; # increase in mGMN\n",
+ "ETGMN =5.0/60+4.35/3600;\n",
+ "ch=i+ ETGMN ; # change in GMT\n",
+ "GMT =ch+GMT;\n",
+ "LMT = GMT +dot;\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[10, 25, 37.07] LMT in hours,minute,second respectively\n"
+ "text": [
+ "[10, 25, 37.07] LMT in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 27
@@ -584,19 +1496,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.24,Page 67"
+ "source": [
+ "Example 1.24,Page 67"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LMT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nLMT =15+12.0/60+40.0/3600; # local mean time\nlongP = -20 -30.0/60; # longitude of the place\n\n#calculation\ndot = longP /15;\nGMT =LMT -dot;\nmGMN =12 - GMT ; #mean time interval\ni= mGMN *0.32/3600; # increase in mGMN\nETGMN =5.0/60+4.35/3600;\nch=i+ ETGMN ; # change in GMT\nGMT =ch+GMT;\nLMT = GMT +dot;\nLMT=deg_to_dms(LMT);\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "LMT =15+12.0/60+40.0/3600; # local mean time\n",
+ "longP = -20 -30.0/60; # longitude of the place\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15;\n",
+ "GMT =LMT -dot;\n",
+ "mGMN =12 - GMT ; #mean time interval\n",
+ "i= mGMN *0.32/3600; # increase in mGMN\n",
+ "ETGMN =5.0/60+4.35/3600;\n",
+ "ch=i+ ETGMN ; # change in GMT\n",
+ "GMT =ch+GMT;\n",
+ "LMT = GMT +dot;\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[15, 17, 42.89] LMT in hours,minute,second respectively\n"
+ "text": [
+ "[15, 17, 42.89] LMT in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 29
@@ -605,19 +1548,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.25,Page 70"
+ "source": [
+ "Example 1.25,Page 70"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding sidereal time\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\ntime =4+20.0/60+30.0/3600;\n\n#calculation\naccn = time *9.8565/3600; # acceleration\nstime = time + accn ; # sidereal time\nstime=deg_to_dms(stime);\n\n#result\nprint \"sidereal time in hours,minute,second respectively\",stime",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "time =4+20.0/60+30.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "accn = time *9.8565/3600; # acceleration\n",
+ "stime = time + accn ; # sidereal time\n",
+ "stime=deg_to_dms(stime);\n",
+ "\n",
+ "#result\n",
+ "print \"sidereal time in hours,minute,second respectively\",stime"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[4, 21, 12.79] sidereal time in hours,minute,second respectively\n"
+ "text": [
+ "[4, 21, 12.79] sidereal time in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 30
@@ -626,19 +1593,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.26,Page 71"
+ "source": [
+ "Example 1.26,Page 71"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding mean time\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nstime =8+40.0/60+50.0/3600;\n\n#calcculation\naccn =-time *9.8565/3600; # acceleration\nmtime = stime + accn ; # mean time\nmtime=deg_to_dms(mtime);\n\n#result\nprint \"mean time in hours,minute,second respectively\",mtime",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "stime =8+40.0/60+50.0/3600;\n",
+ "\n",
+ "#calcculation\n",
+ "accn =-time *9.8565/3600; # acceleration\n",
+ "mtime = stime + accn ; # mean time\n",
+ "mtime=deg_to_dms(mtime);\n",
+ "\n",
+ "#result\n",
+ "print \"mean time in hours,minute,second respectively\",mtime"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[8, 40, 7.21] mean time in hours,minute,second respectively\n"
+ "text": [
+ "[8, 40, 7.21] mean time in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 32
@@ -647,19 +1638,68 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.27,Page 72"
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": "#finding LST on LMM\n\n#part 1\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP = -160 -30.0/60 -30.0/3600; # longitude of the place\nGST =16+30.0/60+12.0/3600; # standard time\n\n#calculation\ndot = longP /15; # difference in time\ni= dot *9.8565/3600; # error\nLST =GST -i;\nLST=deg_to_dms(LST);\n\n#result\nprint \"LST of LMM in hours,minute,second respectively\",LST\n\n#part 2\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP = 160 +30.0/60 +30.0/3600; # longitude of the place\nGST =16+30.0/60+12.0/3600; # standard time\n\n#calculation\ndot = longP /15; # difference in time\ni= dot *9.8565/3600; # error\nLST =GST -i;\nLST=deg_to_dms(LST);\n\n#result\nprint \"LST of LMM in hours,minute,second respectively\",LST\n",
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": "[16, 31, 57.47] LST of LMM in hours,minute,second respectively\n[16, 28, 26.53] LST of LMM in hours,minute,second respectively\n"
+ "source": [
+ "Example 1.27,Page 72"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#part 1\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP = -160 -30.0/60 -30.0/3600; # longitude of the place\n",
+ "GST =16+30.0/60+12.0/3600; # standard time\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15; # difference in time\n",
+ "i= dot *9.8565/3600; # error\n",
+ "LST =GST -i;\n",
+ "LST=deg_to_dms(LST);\n",
+ "\n",
+ "#result\n",
+ "print \"LST of LMM in hours,minute,second respectively\",LST\n",
+ "\n",
+ "#part 2\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP = 160 +30.0/60 +30.0/3600; # longitude of the place\n",
+ "GST =16+30.0/60+12.0/3600; # standard time\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15; # difference in time\n",
+ "i= dot *9.8565/3600; # error\n",
+ "LST =GST -i;\n",
+ "LST=deg_to_dms(LST);\n",
+ "\n",
+ "#result\n",
+ "print \"LST of LMM in hours,minute,second respectively\",LST\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[16, 31, 57.47] LST of LMM in hours,minute,second respectively\n",
+ "[16, 28, 26.53] LST of LMM in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 34
@@ -668,19 +1708,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.28,Page 73"
+ "source": [
+ "Example 1.28,Page 73"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LST \n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP =85+20.0/60; # longitude of the place\nGST =6+30.0/60; # standard time\nGMN =6+32.0/60+12.0/3600;\n\n#calculation\ndot = longP /15; # difference in time\ni= dot *9.8565/3600; # error\nLST =GMN -i; #LST at L .M.N\ni2=GST *9.8565/3600; # error in GST\nLST2 =GST+i2;\nLST = LST + LST2 # lst at L .M.N\nLST=deg_to_dms(LST);\n\n#result\nprint \"LST in hours,minute,second respectively\",LST",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP =85+20.0/60; # longitude of the place\n",
+ "GST =6+30.0/60; # standard time\n",
+ "GMN =6+32.0/60+12.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15; # difference in time\n",
+ "i= dot *9.8565/3600; # error\n",
+ "LST =GMN -i; #LST at L .M.N\n",
+ "i2=GST *9.8565/3600; # error in GST\n",
+ "LST2 =GST+i2;\n",
+ "LST = LST + LST2 # lst at L .M.N\n",
+ "LST=deg_to_dms(LST);\n",
+ "\n",
+ "#result\n",
+ "print \"LST in hours,minute,second respectively\",LST"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[13, 2, 19.99] LST in hours,minute,second respectively\n"
+ "text": [
+ "[13, 2, 19.99] LST in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 38
@@ -689,19 +1759,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.29,Page 75"
+ "source": [
+ "Example 1.29,Page 75"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LMT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP =112+20.0/60+15.0/3600; # longitude of the place\nGST =8+10.0/60+28.0/3600; #GST at GMM\nlst =18+28.0/60+12.0/3600; \n\n#calculation\ndot = longP /15; \ni= dot *9.8565/3600; # error\nLST = GST +i; #LST at L .M.N\nLMM =lst -LST;\ni2=LMM *9.8565/3600; # error in LMM\nLMT =LMM -i2; # local mean time\nLMT=deg_to_dms(LMT);\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP =112+20.0/60+15.0/3600; # longitude of the place\n",
+ "GST =8+10.0/60+28.0/3600; #GST at GMM\n",
+ "lst =18+28.0/60+12.0/3600; \n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15; \n",
+ "i= dot *9.8565/3600; # error\n",
+ "LST = GST +i; #LST at L .M.N\n",
+ "LMM =lst -LST;\n",
+ "i2=LMM *9.8565/3600; # error in LMM\n",
+ "LMT =LMM -i2; # local mean time\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[10, 14, 48.91] LMT in hours,minute,second respectively\n"
+ "text": [
+ "[10, 14, 48.91] LMT in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 40
@@ -710,19 +1809,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.30,Page 76"
+ "source": [
+ "Example 1.30,Page 76"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LST\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP =85+20.0/60; # longitude of the place\nGST =18+30.0/60; # standard time\ngst =6+32.0/60+12.0/3600; #GST at GMN\n\n#calculation\ndot = longP /15; \nGMT =GST -dot -12;\ni= GMT *9.8565/3600; # error\nGMT = GMT +i; # SI time\nLST = GMT +dot+ gst ; #LST at LMT\nLST=deg_to_dms(LST);\n\n#result\nprint \"LST in hours,minute,second respectively\",LST",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP =85+20.0/60; # longitude of the place\n",
+ "GST =18+30.0/60; # standard time\n",
+ "gst =6+32.0/60+12.0/3600; #GST at GMN\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15; \n",
+ "GMT =GST -dot -12;\n",
+ "i= GMT *9.8565/3600; # error\n",
+ "GMT = GMT +i; # SI time\n",
+ "LST = GMT +dot+ gst ; #LST at LMT\n",
+ "LST=deg_to_dms(LST);\n",
+ "\n",
+ "#result\n",
+ "print \"LST in hours,minute,second respectively\",LST"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[13, 2, 19.99] LST in hours,minute,second respectively\n"
+ "text": [
+ "[13, 2, 19.99] LST in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 42
@@ -731,19 +1858,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.31,Page 78"
+ "source": [
+ "Example 1.31,Page 78"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LMT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP =112+20.0/60+15.0/3600; # longitude of the place\nGST =8+10.0/60+28.0/3600; #GST at GMM\nlst =18+28.0/60+12.0/3600; # local sidereal time\n\n#clculation\ndot = longP /15; \ngmm = lst +dot - GST ; # SI at GMM\ni= gmm *9.8565/3600; # error\ngmm =gmm -i; #LST at L .M.N\nLMT =gmm -dot; # local mean time\nLMT=deg_to_dms(LMT);\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP =112+20.0/60+15.0/3600; # longitude of the place\n",
+ "GST =8+10.0/60+28.0/3600; #GST at GMM\n",
+ "lst =18+28.0/60+12.0/3600; # local sidereal time\n",
+ "\n",
+ "#clculation\n",
+ "dot = longP /15; \n",
+ "gmm = lst +dot - GST ; # SI at GMM\n",
+ "i= gmm *9.8565/3600; # error\n",
+ "gmm =gmm -i; #LST at L .M.N\n",
+ "LMT =gmm -dot; # local mean time\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[10, 14, 48.7] LMT in hours,minute,second respectively\n"
+ "text": [
+ "[10, 14, 48.7] LMT in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 44
@@ -752,19 +1908,62 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.32,Page 79"
+ "source": [
+ "Example 1.32,Page 79"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LMT\n\n#part 1\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP =162+30.0/60+15.0/3600; # longitude of the place\nGST =10+30.0/60+15.0/3600; #GST at GMM\nRA =22+11.0/60+30.0/3600; # local sidereal time\n\n#calculation\ndot = longP /15; \ni= dot *9.8565/3600; # e r r o r\ngmm = GST +i; #LST at L .M.N\nlmn =RA -gmm; # SI o f LMN\ni2=lmn *9.8565/3600; # error 2\nLMT =lmn -i2;\nLMT1=deg_to_dms(LMT);\n\n#result\nprint \"LMT observed at upper transit in hours,minute,second respectively\",LMT1\n\n#part 2\n#initialisation of variable\ni3 =12*9.8565/3600; # retardation\n\n#calculation\nLMT = LMT +12 - i3;\nLMT=deg_to_dms(LMT);\n\n#result\nprint \"LMT observed at lower transit in hours,minute,second respectively\",LMT",
+ "input": [
+ "\n",
+ "\n",
+ "#part 1\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP =162+30.0/60+15.0/3600; # longitude of the place\n",
+ "GST =10+30.0/60+15.0/3600; #GST at GMM\n",
+ "RA =22+11.0/60+30.0/3600; # local sidereal time\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15; \n",
+ "i= dot *9.8565/3600; # e r r o r\n",
+ "gmm = GST +i; #LST at L .M.N\n",
+ "lmn =RA -gmm; # SI o f LMN\n",
+ "i2=lmn *9.8565/3600; # error 2\n",
+ "LMT =lmn -i2;\n",
+ "LMT1=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT observed at upper transit in hours,minute,second respectively\",LMT1\n",
+ "\n",
+ "#part 2\n",
+ "#initialisation of variable\n",
+ "i3 =12*9.8565/3600; # retardation\n",
+ "\n",
+ "#calculation\n",
+ "LMT = LMT +12 - i3;\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT observed at lower transit in hours,minute,second respectively\",LMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "LMT observed at upper transit in hours,minute,second respectively [11, 37, 33.31]\nLMT observed at lower transit in hours,minute,second respectively [23, 35, 35.04]\n"
+ "text": [
+ "LMT observed at upper transit in hours,minute,second respectively [11, 37, 33.31]\n",
+ "LMT observed at lower transit in hours,minute,second respectively [23, 35, 35.04]\n"
+ ]
}
],
"prompt_number": 16
@@ -773,19 +1972,52 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.33,Page 80"
+ "source": [
+ "Example 1.33,Page 80"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LMT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP =60+30.0/60; # longitude of the place\nGST =7+30.0/60+48.6/3600; #GST at GMM\nRA =17+28.0/60 +40.0/1600;\n\n#calculation\ndot = longP /15; \ni= dot *9.8565/3600; # error\ngmm =GST -i; #LST at L .M.N\nLMT =RA -gmm; # local mean time\ni2=LMT*9.8296/3600;\nGMT=LMT-i2-longP/15;\nLMT=deg_to_dms(LMT);\nGMT=deg_to_dms(GMT);\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT\nprint \"GMT in hours,minute,second respectively\",GMT",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP =60+30.0/60; # longitude of the place\n",
+ "GST =7+30.0/60+48.6/3600; #GST at GMM\n",
+ "RA =17+28.0/60 +40.0/1600;\n",
+ "\n",
+ "#calculation\n",
+ "dot = longP /15; \n",
+ "i= dot *9.8565/3600; # error\n",
+ "gmm =GST -i; #LST at L .M.N\n",
+ "LMT =RA -gmm; # local mean time\n",
+ "i2=LMT*9.8296/3600;\n",
+ "GMT=LMT-i2-longP/15;\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "GMT=deg_to_dms(GMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT\n",
+ "print \"GMT in hours,minute,second respectively\",GMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "LMT in hours,minute,second respectively [9, 59, 21.15]\nGMT in hours,minute,second respectively [5, 55, 42.96]\n"
+ "text": [
+ "LMT in hours,minute,second respectively [9, 59, 21.15]\n",
+ "GMT in hours,minute,second respectively [5, 55, 42.96]\n"
+ ]
}
],
"prompt_number": 42
@@ -794,19 +2026,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.34,Page 82"
+ "source": [
+ "Example 1.34,Page 82"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding correct time\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nGMT=13+21.0/60+54.0/3600; #GMT of the place\nLongA=40+30.0/60; #longitude of A\nLongB=-40-30.0/60; #longitude of B\n\n#calculation\ndelA=LongA/15.0*9.8296/3600;#error\ndelB=LongB/15.0*9.8296/3600;#error\nGA=GMT+delA;\nGA=deg_to_dms(GA);\nGB=GMT+delB;\nGB=deg_to_dms(GB);\n\n#result\nprint \"corected time of A in hours,minute,second respectively\",GA\nprint \"corected time of B in hours,minute,second respectively\",GB",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "GMT=13+21.0/60+54.0/3600; #GMT of the place\n",
+ "LongA=40+30.0/60; #longitude of A\n",
+ "LongB=-40-30.0/60; #longitude of B\n",
+ "\n",
+ "#calculation\n",
+ "delA=LongA/15.0*9.8296/3600;#error\n",
+ "delB=LongB/15.0*9.8296/3600;#error\n",
+ "GA=GMT+delA;\n",
+ "GA=deg_to_dms(GA);\n",
+ "GB=GMT+delB;\n",
+ "GB=deg_to_dms(GB);\n",
+ "\n",
+ "#result\n",
+ "print \"corected time of A in hours,minute,second respectively\",GA\n",
+ "print \"corected time of B in hours,minute,second respectively\",GB"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "corected time of A in hours,minute,second respectively [13, 22, 20.54]\ncorected time of B in hours,minute,second respectively [13, 21, 27.46]\n"
+ "text": [
+ "corected time of A in hours,minute,second respectively [13, 22, 20.54]\n",
+ "corected time of B in hours,minute,second respectively [13, 21, 27.46]\n"
+ ]
}
],
"prompt_number": 17
@@ -815,19 +2078,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.35,Page 83"
+ "source": [
+ "Example 1.35,Page 83"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LMT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nGMT=7+12.0/60+28.0/3600; #GMT of the place\nLong=50+30.0/60; #longitude \nLMT=11+30.0/60+12.0/3600; \n\n#calculation\ndelA=LongA/15.0*9.8296/3600;#error\ndelB=LMT*9.8296/3600;#error\nLA=GMT+delA; #LMT at transit\nLMT=LMT-delB;\nLMT=LMT+LA;\nLMT=deg_to_dms(LMT);\n\n#result\nprint \"LMT in hours,minute,second respectively\",LMT",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "GMT=7+12.0/60+28.0/3600; #GMT of the place\n",
+ "Long=50+30.0/60; #longitude \n",
+ "LMT=11+30.0/60+12.0/3600; \n",
+ "\n",
+ "#calculation\n",
+ "delA=LongA/15.0*9.8296/3600;#error\n",
+ "delB=LMT*9.8296/3600;#error\n",
+ "LA=GMT+delA; #LMT at transit\n",
+ "LMT=LMT-delB;\n",
+ "LMT=LMT+LA;\n",
+ "LMT=deg_to_dms(LMT);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT in hours,minute,second respectively\",LMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "LMT in hours,minute,second respectively [18, 41, 13.47]\n"
+ "text": [
+ "LMT in hours,minute,second respectively [18, 41, 13.47]\n"
+ ]
}
],
"prompt_number": 41
@@ -836,19 +2128,44 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.36,Page 84"
+ "source": [
+ "Example 1.36,Page 84"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LMT\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nGST=8+25.0/60+25.0/3600;\n\n#calculation\nGMT=24-GST;\ni=GMT*9.8296/3600;\nGMT=GMT-i;\nGMT=deg_to_dms(GMT);\n\n#result\nprint \"GMT in hours,minute,second respectively\",GMT",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "GST=8+25.0/60+25.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "GMT=24-GST;\n",
+ "i=GMT*9.8296/3600;\n",
+ "GMT=GMT-i;\n",
+ "GMT=deg_to_dms(GMT);\n",
+ "\n",
+ "#result\n",
+ "print \"GMT in hours,minute,second respectively\",GMT"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "GMT in hours,minute,second respectively [15, 32, 1.89]\n"
+ "text": [
+ "GMT in hours,minute,second respectively [15, 32, 1.89]\n"
+ ]
}
],
"prompt_number": 43
@@ -857,19 +2174,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.37,Page 85"
+ "source": [
+ "Example 1.37,Page 85"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LMT on July 2\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nGMT=12+03.0/60+46.09/3600; #GMT of the place\nLongA=-130.0; #longitude of A\nLongB=49.0; #longitude of B\n\n#calculation\ndelA=LongA/15.0*11.71/24/3600;\ndelB=LongB/15.0*11.71/24/3600;\nLMTA=GMT+delA;\nLMTA=deg_to_dms(LMTA);\nLMTB=GMT+delB;\nLMTB=deg_to_dms(LMTB);\n\n#result\nprint \"LMT at A on July 2 in hours,minute,second respectively\",LMTA\nprint \"LMT at B on July 2 in hours,minute,second respectively\",LMTB",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "GMT=12+03.0/60+46.09/3600; #GMT of the place\n",
+ "LongA=-130.0; #longitude of A\n",
+ "LongB=49.0; #longitude of B\n",
+ "\n",
+ "#calculation\n",
+ "delA=LongA/15.0*11.71/24/3600;\n",
+ "delB=LongB/15.0*11.71/24/3600;\n",
+ "LMTA=GMT+delA;\n",
+ "LMTA=deg_to_dms(LMTA);\n",
+ "LMTB=GMT+delB;\n",
+ "LMTB=deg_to_dms(LMTB);\n",
+ "\n",
+ "#result\n",
+ "print \"LMT at A on July 2 in hours,minute,second respectively\",LMTA\n",
+ "print \"LMT at B on July 2 in hours,minute,second respectively\",LMTB"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[12, 3, 41.86] LMT at A in hours,minute,second respectively\n[12, 3, 47.68] LMT at B in hours,minute,second respectively\n"
+ "text": [
+ "[12, 3, 41.86] LMT at A in hours,minute,second respectively\n",
+ "[12, 3, 47.68] LMT at B in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 17
@@ -878,19 +2226,47 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.38,Page 86"
+ "source": [
+ "Example 1.38,Page 86"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding LST\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nLat=50+30.0/60; # latitude of place\nDec=74+22/60; #declination of place\nRA=14+50.0/60+52.0/3600;\n\n#calculation\nH=acos(tan(Lat*pi/180)/tan(Dec*pi/180));\nH=H*180/pi;\nH=H/15.0;\nLST=H+RA;\nLST=deg_to_dms(LST);\n\n#result \nprint \"LST in hours,minute,second respectively\",LST",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "Lat=50+30.0/60; # latitude of place\n",
+ "Dec=74+22/60; #declination of place\n",
+ "RA=14+50.0/60+52.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "H=acos(tan(Lat*pi/180)/tan(Dec*pi/180));\n",
+ "H=H*180/pi;\n",
+ "H=H/15.0;\n",
+ "LST=H+RA;\n",
+ "LST=deg_to_dms(LST);\n",
+ "\n",
+ "#result \n",
+ "print \"LST in hours,minute,second respectively\",LST"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[19, 29, 26.59] LST in hours,minute,second respectively\n"
+ "text": [
+ "[19, 29, 26.59] LST in hours,minute,second respectively\n"
+ ]
}
],
"prompt_number": 20
@@ -899,19 +2275,54 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.39,Page 87"
+ "source": [
+ "Example 1.39,Page 87"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding HA\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nLong=120+30.0/60; #langitude\nGST=14+30.0/60+28.25/3600;\nGMT=2+5.0/60;\nLMN=12.0;\nLST=14+31.0/60+47.43/3600;\nRA=23+20.0/60+20.0/3600;\n\n#calculation\ne1=Long*15.0*9.8565/3600;\nGST=GST+e1;\nLMT=GMT+24-8-2.0/60;\nLMM=LMN+24-LMT; #mean LMN\ne2=LMM*9.8565/3600;\nLMM=LMM+e2;\nLST=LST+24-LMM;\nHA=LST-RA+24;\nHA=deg_to_dms(HA);\n\n#result\nprint \"HA in hours,minutes,seconds respectively\",HA",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "Long=120+30.0/60; #langitude\n",
+ "GST=14+30.0/60+28.25/3600;\n",
+ "GMT=2+5.0/60;\n",
+ "LMN=12.0;\n",
+ "LST=14+31.0/60+47.43/3600;\n",
+ "RA=23+20.0/60+20.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "e1=Long*15.0*9.8565/3600;\n",
+ "GST=GST+e1;\n",
+ "LMT=GMT+24-8-2.0/60;\n",
+ "LMM=LMN+24-LMT; #mean LMN\n",
+ "e2=LMM*9.8565/3600;\n",
+ "LMM=LMM+e2;\n",
+ "LST=LST+24-LMM;\n",
+ "HA=LST-RA+24;\n",
+ "HA=deg_to_dms(HA);\n",
+ "\n",
+ "#result\n",
+ "print \"HA in hours,minutes,seconds respectively\",HA"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[21, 11, 30.51] HA in hours,minutes,seconds respectively\n"
+ "text": [
+ "[21, 11, 30.51] HA in hours,minutes,seconds respectively\n"
+ ]
}
],
"prompt_number": 21
@@ -920,19 +2331,52 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.40,Page 86"
+ "source": [
+ "Example 1.40,Page 86"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding HA\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nLong=75+28.0/60; #langitude\nLMT=5+30.0/60;\nGST=20+15.0/60+32.58/3600;\n\n#calculation\ne1=Long/15.0*9.8565/3600;\nGST=GST+e1;\ne2=LMT*9.8565/3600;\nLMT=LMT+e2;\nHA=GST+LMT;\nHAMS=HA-LMT-12+e2;\nHA=deg_to_dms(HA);\nHAMS=deg_to_dms(HAMS);\n\n#result\nprint \"HA in hours,minutes,seconds respectively\",HA\nprint \"HAMS in hours,minutes,seconds respectively\",HAMS\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "Long=75+28.0/60; #langitude\n",
+ "LMT=5+30.0/60;\n",
+ "GST=20+15.0/60+32.58/3600;\n",
+ "\n",
+ "#calculation\n",
+ "e1=Long/15.0*9.8565/3600;\n",
+ "GST=GST+e1;\n",
+ "e2=LMT*9.8565/3600;\n",
+ "LMT=LMT+e2;\n",
+ "HA=GST+LMT;\n",
+ "HAMS=HA-LMT-12+e2;\n",
+ "HA=deg_to_dms(HA);\n",
+ "HAMS=deg_to_dms(HAMS);\n",
+ "\n",
+ "#result\n",
+ "print \"HA in hours,minutes,seconds respectively\",HA\n",
+ "print \"HAMS in hours,minutes,seconds respectively\",HAMS\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "HA in hours,minutes,seconds respectively [25, 47, 16.38]\nHAMS in hours,minutes,seconds respectively [8, 17, 16.38]\n"
+ "text": [
+ "HA in hours,minutes,seconds respectively [25, 47, 16.38]\n",
+ "HAMS in hours,minutes,seconds respectively [8, 17, 16.38]\n"
+ ]
}
],
"prompt_number": 40
@@ -941,19 +2385,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.41,Page 90"
+ "source": [
+ "Example 1.41,Page 90"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding sun's declination\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nLong=45.0; #langitude\ndel1=1067.2/3600;\ndel2=1083.9/3600;\ndel3=1100.3/3600;\nf0=-16-14.0/60-24.0/3600;\n\n#calculation\nn=(10-Long/15)/24.0;\nDel0=del2-del1;\nDel1=del3-del2;\nfn=-f0+n*del2+n*(n-1)/4*(Del0+Del1)\nfn=deg_to_dms(fn);\n\n#result\nprint \"sun's declination in hours,minutes,seconds respectively\",fn",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "Long=45.0; #langitude\n",
+ "del1=1067.2/3600;\n",
+ "del2=1083.9/3600;\n",
+ "del3=1100.3/3600;\n",
+ "f0=-16-14.0/60-24.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "n=(10-Long/15)/24.0;\n",
+ "Del0=del2-del1;\n",
+ "Del1=del3-del2;\n",
+ "fn=-f0+n*del2+n*(n-1)/4*(Del0+Del1)\n",
+ "fn=deg_to_dms(fn);\n",
+ "\n",
+ "#result\n",
+ "print \"sun's declination in hours,minutes,seconds respectively\",fn"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "sun's declination in hours,minutes,seconds respectively [16, 19, 38.43]\n"
+ "text": [
+ "sun's declination in hours,minutes,seconds respectively [16, 19, 38.43]\n"
+ ]
}
],
"prompt_number": 39
@@ -962,19 +2436,72 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.42,Page 101"
+ "source": [
+ "Example 1.42,Page 101"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding azimuth of A & B and vertical difference\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\naziA =32+41.0/60+30.0/3600; # azimuth o f A\naziB =110+28.0/60+42.0/3600; # azimuth o f B\nvaA =10+21.0/60+12.0/3600; # vertical angle of A\nvaB = -2 -18.0/60 -30.0/3600; # vertical angle o f B\nlA1 =11;\nlB1 =11.5;\nrA1 =7.5;\nrB1 =7;\nlB2 =10;\nlA2 =10.5;\nrB2 =7.5;\nrA2 =8;\nd =20;\n# partA\n#calculation\nsigl =lA1+ lA2 ;\nsigr =rA1+ rA2 ;\nb= sigl /4*d- sigr /4*d;\ni= tan( vaA );\ncaziA = aziA +i *29.95/3600;\ncaziA1=deg_to_dms(caziA);\n\n#result\nprint \"corrected azimuth of A in (degrees,minutes,seconds)\",caziA1\n\n#part2 \n#calculation\ni= tan( vaB );\ncaziB = aziB +i*b /3600;\nha=caziB - caziA;\ncaziB=deg_to_dms(caziB);\nha=deg_to_dms(ha);\n\n#result\nprint \"corrected azimuth of B in (degrees,minutes,seconds)\",caziB\nprint \"horizontal difference of angle between A & B in (degrees,minutes,seconds)\",ha\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "aziA =32+41.0/60+30.0/3600; # azimuth o f A\n",
+ "aziB =110+28.0/60+42.0/3600; # azimuth o f B\n",
+ "vaA =10+21.0/60+12.0/3600; # vertical angle of A\n",
+ "vaB = -2 -18.0/60 -30.0/3600; # vertical angle o f B\n",
+ "lA1 =11;\n",
+ "lB1 =11.5;\n",
+ "rA1 =7.5;\n",
+ "rB1 =7;\n",
+ "lB2 =10;\n",
+ "lA2 =10.5;\n",
+ "rB2 =7.5;\n",
+ "rA2 =8;\n",
+ "d =20;\n",
+ "# partA\n",
+ "#calculation\n",
+ "sigl =lA1+ lA2 ;\n",
+ "sigr =rA1+ rA2 ;\n",
+ "b= sigl /4*d- sigr /4*d;\n",
+ "i= tan( vaA );\n",
+ "caziA = aziA +i *29.95/3600;\n",
+ "caziA1=deg_to_dms(caziA);\n",
+ "\n",
+ "#result\n",
+ "print \"corrected azimuth of A in (degrees,minutes,seconds)\",caziA1\n",
+ "\n",
+ "#part2 \n",
+ "#calculation\n",
+ "i= tan( vaB );\n",
+ "caziB = aziB +i*b /3600;\n",
+ "ha=caziB - caziA;\n",
+ "caziB=deg_to_dms(caziB);\n",
+ "ha=deg_to_dms(ha);\n",
+ "\n",
+ "#result\n",
+ "print \"corrected azimuth of B in (degrees,minutes,seconds)\",caziB\n",
+ "print \"horizontal difference of angle between A & B in (degrees,minutes,seconds)\",ha\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "corrected azimuth of A in (degrees,minutes,seconds) [32, 42, 10.04]\ncorrected azimuth of B in (degrees,minutes,seconds) [110, 29, 15.02]\nhorizontal difference of angle between A & B in (degrees,minutes,seconds) [77, 47, 4.98]\n"
+ "text": [
+ "corrected azimuth of A in (degrees,minutes,seconds) [32, 42, 10.04]\n",
+ "corrected azimuth of B in (degrees,minutes,seconds) [110, 29, 15.02]\n",
+ "horizontal difference of angle between A & B in (degrees,minutes,seconds) [77, 47, 4.98]\n"
+ ]
}
],
"prompt_number": 38
@@ -983,19 +2510,52 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.43,Page 102"
+ "source": [
+ "Example 1.43,Page 102"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding altitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nv1 =18+36.0/60+48.0/3600; # vertical angle 1\nv2 =18+35.0/60+56.0/3600; # vertical angle 2\nslm =28+36.0/60+20.0/3600; # altitude of sun measured\nds =15.0/60+59.35/3600; # dia of sun\n\n#calculation\nmv =( v1+v2) /2; #mean vertical angle\ni=v1 -v2; # error\nsl=slm+i; #new altitude of sun\nsl=sl+ds;\nir = -57.0/3600/( tan( slm *pi /180+26* pi /180/3600) );#error due to refraction\nsl=sl+ir;\nip =8.8/3600* cos( slm *pi /180+26* pi /180/3600);# error due to parallex\nsl=sl+ip;\nsl=deg_to_dms(sl);\n\n#result\nprint \"corrected altitude in (deg,min,sec) respectively\",sl",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "v1 =18+36.0/60+48.0/3600; # vertical angle 1\n",
+ "v2 =18+35.0/60+56.0/3600; # vertical angle 2\n",
+ "slm =28+36.0/60+20.0/3600; # altitude of sun measured\n",
+ "ds =15.0/60+59.35/3600; # dia of sun\n",
+ "\n",
+ "#calculation\n",
+ "mv =( v1+v2) /2; #mean vertical angle\n",
+ "i=v1 -v2; # error\n",
+ "sl=slm+i; #new altitude of sun\n",
+ "sl=sl+ds;\n",
+ "ir = -57.0/3600/( tan( slm *pi /180+26* pi /180/3600) );#error due to refraction\n",
+ "sl=sl+ir;\n",
+ "ip =8.8/3600* cos( slm *pi /180+26* pi /180/3600);# error due to parallex\n",
+ "sl=sl+ip;\n",
+ "sl=deg_to_dms(sl);\n",
+ "\n",
+ "#result\n",
+ "print \"corrected altitude in (deg,min,sec) respectively\",sl"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[28, 51, 34.59] corrected altitude in (deg,min,sec) respectively\n"
+ "text": [
+ "[28, 51, 34.59] corrected altitude in (deg,min,sec) respectively\n"
+ ]
}
],
"prompt_number": 12
@@ -1004,19 +2564,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.44,Page 115"
+ "source": [
+ "Example 1.44,Page 115"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding chronometer error\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlong =4+30.0/60;\ni= long *9.8565/3600; # longitude\ngst =14+38.0/60+12.0/3600; #GST on GMM\nlst =gst -i; #LST on LMM\nRA =7+36.0/60+21.24/3600;\n\n#calculation\nLST =RA;\nSI=LST - lst +24;\nLCT =17+56.0/60+8.86/3600 -1; # local chronometer time\ni2=SI *9.8296/3600;\nLMM =SI -i2;\nce=LCT - LMM ;\n\n#result\nprint \" chronometer error in (s)\",round(ce *3600,2)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "long =4+30.0/60;\n",
+ "i= long *9.8565/3600; # longitude\n",
+ "gst =14+38.0/60+12.0/3600; #GST on GMM\n",
+ "lst =gst -i; #LST on LMM\n",
+ "RA =7+36.0/60+21.24/3600;\n",
+ "\n",
+ "#calculation\n",
+ "LST =RA;\n",
+ "SI=LST - lst +24;\n",
+ "LCT =17+56.0/60+8.86/3600 -1; # local chronometer time\n",
+ "i2=SI *9.8296/3600;\n",
+ "LMM =SI -i2;\n",
+ "ce=LCT - LMM ;\n",
+ "\n",
+ "#result\n",
+ "print \" chronometer error in (s)\",round(ce *3600,2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "2.19 chronometer error in (s)\n"
+ "text": [
+ "2.19 chronometer error in (s)\n"
+ ]
}
],
"prompt_number": 17
@@ -1025,19 +2616,51 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Exampe 1.45,Page 116"
+ "source": [
+ "Exampe 1.45,Page 116"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding chronometer error\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nc =90 -36 -30.0/60 -30.0/3600; # co latitude\np =90 -16 -12.0/60 -18.4/3600; # co declination\nz =90 -30 -12.0/60 -30.0/3600; # co altitude\ns=(p+z+c) /2;\n\n#calculation\ns1=s-c;\ns2=s-p;\ns3=s-z;\nH =2* atan ( sqrt (sin(s1*pi /180) * sin (s2*pi /180) / sin (s*pi/180) / sin (s3*pi /180) ));\nH=H *180/ pi;\nH=24 -H /15;\nLST =H +5+18.0/60+12.45/3600 -24;\nce =1+2.0/60+5.25/3600 - LST ;\n\n#result\nprint \" chronometer error in (s)\",round (ce *3600+2,2)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "c =90 -36 -30.0/60 -30.0/3600; # co latitude\n",
+ "p =90 -16 -12.0/60 -18.4/3600; # co declination\n",
+ "z =90 -30 -12.0/60 -30.0/3600; # co altitude\n",
+ "s=(p+z+c) /2;\n",
+ "\n",
+ "#calculation\n",
+ "s1=s-c;\n",
+ "s2=s-p;\n",
+ "s3=s-z;\n",
+ "H =2* atan ( sqrt (sin(s1*pi /180) * sin (s2*pi /180) / sin (s*pi/180) / sin (s3*pi /180) ));\n",
+ "H=H *180/ pi;\n",
+ "H=24 -H /15;\n",
+ "LST =H +5+18.0/60+12.45/3600 -24;\n",
+ "ce =1+2.0/60+5.25/3600 - LST ;\n",
+ "\n",
+ "#result\n",
+ "print \" chronometer error in (s)\",round (ce *3600+2,2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "19.34 chronometer error in (s)\n"
+ "text": [
+ "19.34 chronometer error in (s)\n"
+ ]
}
],
"prompt_number": 21
@@ -1046,19 +2669,56 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "Example 1.46,Page 118"
+ "source": [
+ "Example 1.46,Page 118"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding chronometer error\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nc =90 -36 -40.0/60 -30.0/3600; # co latitude\np =90 -17 -26.0/60 -42.1/3600; # co declination\nz =90 -36 -14.0/60 -16.8/3600; # co altitude\n\n#calculation\ns=(p+z+c) /2;\ns1=s-c;\ns2=s-p;\ns3=s-z;\nH =2* atan ( sqrt (sin(s1*pi /180) * sin (s2*pi /180) / sin(s*pi/180) / sin (s3*pi /180) ));\nH=H *180/ pi;\nH=H /15;\ni =12 -11 -56.0/60 -22.8/3600; # error in time\nLAT =15+49.0/60+40.6/3600; # local actual time\nGAT =LAT -H;\nGMT =GAT -i;\nLMT = GMT +H;\nce =15+49.0/60+12.6/3600 - LMT;\nce=deg_to_dms(ce)\n\n#result\nprint \" chronometer error in (s)\",ce",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "c =90 -36 -40.0/60 -30.0/3600; # co latitude\n",
+ "p =90 -17 -26.0/60 -42.1/3600; # co declination\n",
+ "z =90 -36 -14.0/60 -16.8/3600; # co altitude\n",
+ "\n",
+ "#calculation\n",
+ "s=(p+z+c) /2;\n",
+ "s1=s-c;\n",
+ "s2=s-p;\n",
+ "s3=s-z;\n",
+ "H =2* atan ( sqrt (sin(s1*pi /180) * sin (s2*pi /180) / sin(s*pi/180) / sin (s3*pi /180) ));\n",
+ "H=H *180/ pi;\n",
+ "H=H /15;\n",
+ "i =12 -11 -56.0/60 -22.8/3600; # error in time\n",
+ "LAT =15+49.0/60+40.6/3600; # local actual time\n",
+ "GAT =LAT -H;\n",
+ "GMT =GAT -i;\n",
+ "LMT = GMT +H;\n",
+ "ce =15+49.0/60+12.6/3600 - LMT;\n",
+ "ce=deg_to_dms(ce)\n",
+ "\n",
+ "#result\n",
+ "print \" chronometer error in (s)\",ce"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " chronometer error in (s) [0, 3, 9.2]\n"
+ "text": [
+ " chronometer error in (s) [0, 3, 9.2]\n"
+ ]
}
],
"prompt_number": 2
@@ -1067,19 +2727,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.47,Page 119"
+ "source": [
+ "Example 1.47,Page 119"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding chronometer error\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nRA =17+12.0/60+48.0/3600;\ngst =9+26.0/60+12.0/3600; #GST on GMN\nlong =138.0/15+45.0/15/60; # l o n g i t u d e\nlst =- long *9.85645/3600+9+26.0/60+12.0/3600; #LST on LMN\nLST =17+12.0/60+48.0/3600; # local sidereal time\n\n#calculation\nSI=LST - lst ;\nMI=-SI *9.8296/3600+ SI;\nLCT =7+47.0/60+2.0/3600; # local chronometer time\nce=LCT -MI;\n\n#result\nprint \" chronometer error in (s)\",round(ce *3600,2) ",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "RA =17+12.0/60+48.0/3600;\n",
+ "gst =9+26.0/60+12.0/3600; #GST on GMN\n",
+ "long =138.0/15+45.0/15/60; # l o n g i t u d e\n",
+ "lst =- long *9.85645/3600+9+26.0/60+12.0/3600; #LST on LMN\n",
+ "LST =17+12.0/60+48.0/3600; # local sidereal time\n",
+ "\n",
+ "#calculation\n",
+ "SI=LST - lst ;\n",
+ "MI=-SI *9.8296/3600+ SI;\n",
+ "LCT =7+47.0/60+2.0/3600; # local chronometer time\n",
+ "ce=LCT -MI;\n",
+ "\n",
+ "#result\n",
+ "print \" chronometer error in (s)\",round(ce *3600,2) "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " chronometer error in (s) 11.52\n"
+ "text": [
+ " chronometer error in (s) 11.52\n"
+ ]
}
],
"prompt_number": 3
@@ -1088,19 +2777,74 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.48,Page 145"
+ "source": [
+ "Example 1.48,Page 145"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding azimuth,latitude,LMT\n\n#part 1\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\ntheta =54+30.0/60; # l o g i t u d e\ndelta =62+12.0/60+21.0/3600; # d e c l i n a t i o n\n\n#calculation\nlat = asin (sin( theta *pi /180) /sin( delta *pi /180) );\nlat = lat *180/ pi;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat;\n\n#part 2\n#initialisation of variable\nA =53+25.0/60; # azimuth of star\nh =65+18.0/60+42.0/3600; # horizontal angle\n\n#calculation\nA=A+h;\nA=360-A;\nA=deg_to_dms(A);\n\n#result\nprint \"Azimuth in (deg,min,sec)\",A;\n\n#part 3 \n#initialisation of variable\nlst =4+39.0/60+6.5/3600; #LST o f LMN\nLST =10+58.0/60+38.0/3600+2+49.0/60+25.3/3600; #LST of observation\n\n#calculation\nLMN =LST -lst;\ni= LMN *9.8565/3600; # e r r o r\nLMT =LMN -i;\nLMT=deg_to_dms(LMT)\n\n#results\nprint \"LMT in (hr,min,sec)\",LMT;",
+ "input": [
+ "\n",
+ "\n",
+ "#part 1\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "theta =54+30.0/60; # l o g i t u d e\n",
+ "delta =62+12.0/60+21.0/3600; # d e c l i n a t i o n\n",
+ "\n",
+ "#calculation\n",
+ "lat = asin (sin( theta *pi /180) /sin( delta *pi /180) );\n",
+ "lat = lat *180/ pi;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat;\n",
+ "\n",
+ "#part 2\n",
+ "#initialisation of variable\n",
+ "A =53+25.0/60; # azimuth of star\n",
+ "h =65+18.0/60+42.0/3600; # horizontal angle\n",
+ "\n",
+ "#calculation\n",
+ "A=A+h;\n",
+ "A=360-A;\n",
+ "A=deg_to_dms(A);\n",
+ "\n",
+ "#result\n",
+ "print \"Azimuth in (deg,min,sec)\",A;\n",
+ "\n",
+ "#part 3 \n",
+ "#initialisation of variable\n",
+ "lst =4+39.0/60+6.5/3600; #LST o f LMN\n",
+ "LST =10+58.0/60+38.0/3600+2+49.0/60+25.3/3600; #LST of observation\n",
+ "\n",
+ "#calculation\n",
+ "LMN =LST -lst;\n",
+ "i= LMN *9.8565/3600; # e r r o r\n",
+ "LMT =LMN -i;\n",
+ "LMT=deg_to_dms(LMT)\n",
+ "\n",
+ "#results\n",
+ "print \"LMT in (hr,min,sec)\",LMT;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[66, 58, 7.13] Latitude in (deg,min,sec)\n[241, 16, 18.0] Azimuth in (deg,min,sec)\n[9, 7, 26.62] LMT in (hr,min,sec)\n"
+ "text": [
+ "[66, 58, 7.13] Latitude in (deg,min,sec)\n",
+ "[241, 16, 18.0] Azimuth in (deg,min,sec)\n",
+ "[9, 7, 26.62] LMT in (hr,min,sec)\n"
+ ]
}
],
"prompt_number": 34
@@ -1109,19 +2853,74 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.49,Page 148"
+ "source": [
+ "Example 1.49,Page 148"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding azimuth,latitude,LMT\n\n#part 1\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\ntheta =53+32.0/60; # logitude\ndelta =56+42.0/60+53.2/3600; # declination\nlat = asin (sin ( theta *pi /180) /sin( delta *pi /180) );\nlat = lat *180/ pi;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat;\n\n#part 2\n#initialisation of variable\nAs= asin ( cos ( delta *pi /180) /cos ( theta *pi /180) ); #azimuth of star\nh =75+18.0/60+20.0/3600; # angle between line and star\n\n#calculation\nA=h-As *180/ pi;\nA=360 -A;\nA=deg_to_dms(A);\n\n#result\nprint \"Azimuth in (deg,min,sec)\",A;\n\n#part 3\n#initialisation of variable\nLST =10+58.0/60+3.9/3600+22+10.0/60+38.5/3600 -24; #LST of observation\nlong =5+40.0/60+18.0/3600; # longitude\n\n#calculation\ni= long *9.8565/3600; # error\nlst =4+58.0/60+23.84/3600+ i; #LST on LMN\nLMM =LST -lst;\ni2=LMM *9.8565/3600; # error in LMM\nLMT =LMM -i2;\nLMT=deg_to_dms(LMT)\n\n#results\nprint \"LMT in (hr,min,sec)\",LMT;\n",
+ "input": [
+ "\n",
+ "\n",
+ "#part 1\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "theta =53+32.0/60; # logitude\n",
+ "delta =56+42.0/60+53.2/3600; # declination\n",
+ "lat = asin (sin ( theta *pi /180) /sin( delta *pi /180) );\n",
+ "lat = lat *180/ pi;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat;\n",
+ "\n",
+ "#part 2\n",
+ "#initialisation of variable\n",
+ "As= asin ( cos ( delta *pi /180) /cos ( theta *pi /180) ); #azimuth of star\n",
+ "h =75+18.0/60+20.0/3600; # angle between line and star\n",
+ "\n",
+ "#calculation\n",
+ "A=h-As *180/ pi;\n",
+ "A=360 -A;\n",
+ "A=deg_to_dms(A);\n",
+ "\n",
+ "#result\n",
+ "print \"Azimuth in (deg,min,sec)\",A;\n",
+ "\n",
+ "#part 3\n",
+ "#initialisation of variable\n",
+ "LST =10+58.0/60+3.9/3600+22+10.0/60+38.5/3600 -24; #LST of observation\n",
+ "long =5+40.0/60+18.0/3600; # longitude\n",
+ "\n",
+ "#calculation\n",
+ "i= long *9.8565/3600; # error\n",
+ "lst =4+58.0/60+23.84/3600+ i; #LST on LMN\n",
+ "LMM =LST -lst;\n",
+ "i2=LMM *9.8565/3600; # error in LMM\n",
+ "LMT =LMM -i2;\n",
+ "LMT=deg_to_dms(LMT)\n",
+ "\n",
+ "#results\n",
+ "print \"LMT in (hr,min,sec)\",LMT;\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Latitude in (deg,min,sec) [74, 9, 33.08]\nAzimuth in (deg,min,sec) [352, 7, 3.66]\nLMT in (hr,min,sec) [4, 8, 41.69]\n"
+ "text": [
+ "Latitude in (deg,min,sec) [74, 9, 33.08]\n",
+ "Azimuth in (deg,min,sec) [352, 7, 3.66]\n",
+ "LMT in (hr,min,sec) [4, 8, 41.69]\n"
+ ]
}
],
"prompt_number": 6
@@ -1130,19 +2929,63 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.50,Page 151"
+ "source": [
+ "Example 1.50,Page 151"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding azimuth\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nLong =(15.0+30.0/60); \nGMT =19+12.0/60+28.6/3600;\nGST=10+12.0/60+36.2/3600;\nRA=10 +12.0/60 +6.3/3600;\ntheta=35.0;\ndelta=20+6.0/60+48.4/3600;\n\n#calculation\ni= Long/15.0 *9.8656/3600; \nLSTofLMM=GST-i;\nLMT = GMT + Long/15.0 ;\ni2=LMT *9.8656/3600; # error in LMT\nSI = LMT +i2;\nLST =LSTofLMM+ SI ;\nH=LST-RA ; # hour angle\nH=H *15;\nH=360 -H;\nB=atan(tan(delta*pi/180)/cos(H*pi/180));\nB=B*180/pi;\nx=B-theta; #defined as 'B-theta'\nAs= atan ( tan ((H) *pi /180) * cos((B) *pi /180) / sin ((x)*pi /180) );#calculating azimuth \nh =36+28.0/60+18.0/3600; # angle between line and star\nA =180+ As *180/ pi -h; #azimuth\nA=deg_to_dms(A);\n\n#result\nprint \"Azimuth in (deg,min,sec)\",A;\nprint \"there is a miscalculation in the step of calculating As thus resulted in change in answer\"",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "Long =(15.0+30.0/60); \n",
+ "GMT =19+12.0/60+28.6/3600;\n",
+ "GST=10+12.0/60+36.2/3600;\n",
+ "RA=10 +12.0/60 +6.3/3600;\n",
+ "theta=35.0;\n",
+ "delta=20+6.0/60+48.4/3600;\n",
+ "\n",
+ "#calculation\n",
+ "i= Long/15.0 *9.8656/3600; \n",
+ "LSTofLMM=GST-i;\n",
+ "LMT = GMT + Long/15.0 ;\n",
+ "i2=LMT *9.8656/3600; # error in LMT\n",
+ "SI = LMT +i2;\n",
+ "LST =LSTofLMM+ SI ;\n",
+ "H=LST-RA ; # hour angle\n",
+ "H=H *15;\n",
+ "H=360 -H;\n",
+ "B=atan(tan(delta*pi/180)/cos(H*pi/180));\n",
+ "B=B*180/pi;\n",
+ "x=B-theta; #defined as 'B-theta'\n",
+ "As= atan ( tan ((H) *pi /180) * cos((B) *pi /180) / sin ((x)*pi /180) );#calculating azimuth \n",
+ "h =36+28.0/60+18.0/3600; # angle between line and star\n",
+ "A =180+ As *180/ pi -h; #azimuth\n",
+ "A=deg_to_dms(A);\n",
+ "\n",
+ "#result\n",
+ "print \"Azimuth in (deg,min,sec)\",A;\n",
+ "print \"there is a miscalculation in the step of calculating As thus resulted in change in answer\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Azimuth in (deg,min,sec) [55, 16, 8.27]\nthere is a miscalculation in the step of calculating As thus resulted in change in answer\n"
+ "text": [
+ "Azimuth in (deg,min,sec) [55, 16, 8.27]\n",
+ "there is a miscalculation in the step of calculating As thus resulted in change in answer\n"
+ ]
}
],
"prompt_number": 3
@@ -1151,19 +2994,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.51,Page 153 "
+ "source": [
+ "Example 1.51,Page 153 "
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding azimuth\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nalpha =33+35.0/60+10.0/3600; # altitude\nZM =90 - alpha ;\ndelta =22+5.0/60+35.0/3600; # declination\nPM =90 - delta ;\ntheta =52+30.0/60+20.0/3600; # latitude\nZP =90 - theta ;\n\n#calculation\nAs= acos (( cos (PM*pi /180) -cos(ZP*pi /180) * cos (ZM*pi/180) )/( sin (ZP*pi /180) *sin(ZM*pi /180) ));\nh =18+20.0/60+30.0/3600; # angle between line and star\nA=As *180/ pi+h;\nA=deg_to_dms(A);\n\n#result\nprint \"Azimuth in (deg,min,sec)\",A;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "alpha =33+35.0/60+10.0/3600; # altitude\n",
+ "ZM =90 - alpha ;\n",
+ "delta =22+5.0/60+35.0/3600; # declination\n",
+ "PM =90 - delta ;\n",
+ "theta =52+30.0/60+20.0/3600; # latitude\n",
+ "ZP =90 - theta ;\n",
+ "\n",
+ "#calculation\n",
+ "As= acos (( cos (PM*pi /180) -cos(ZP*pi /180) * cos (ZM*pi/180) )/( sin (ZP*pi /180) *sin(ZM*pi /180) ));\n",
+ "h =18+20.0/60+30.0/3600; # angle between line and star\n",
+ "A=As *180/ pi+h;\n",
+ "A=deg_to_dms(A);\n",
+ "\n",
+ "#result\n",
+ "print \"Azimuth in (deg,min,sec)\",A;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Azimuth in (deg,min,sec) [115, 27, 19.68]\n"
+ "text": [
+ "Azimuth in (deg,min,sec) [115, 27, 19.68]\n"
+ ]
}
],
"prompt_number": 35
@@ -1172,19 +3045,68 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.52,Page 154"
+ "source": [
+ "Example 1.52,Page 154"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding declination,altitude\n\n#part 1\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nGAT =5+17.0/60+6.0/60; #GAT \ndelta =17+46.0/60+52.0/3600; # declination\n\n#calculation\ni =37.0/3600* GAT ;\ndelta =delta -i;\ndelta1=deg_to_dms(delta);\n\n#result\nprint \"Declination in (deg,min,sec)\",delta1;\n\n#part 2\n#initialisation of variable\np=90 - delta ; # co declination\naltitude =23+15.0/60+20.0/3600; # altitude of sun\ni2 =2.0/60+12.0/3600; # error due to refraction\ni3 =8.0/3600; # error due to parallax\n\n#calculation\naltitude = altitude -i2+i3;\nc =90 -55 -46.0/60 -12.0/3600; # colatitude\nz=90 - altitude ; # co altitude\ns=(p+z+c) /2;\ns1=s-c;\ns2=s-p;\ns3=s-z;\nA =2* atan ( sqrt (sin(s3*pi /180) * sin (s1*pi /180) / sin (s*pi/180) / sin (s2*pi /180) ));\nA=A *180/ pi;\nA=deg_to_dms(A);\n\n#result\nprint \"Altitude in (deg,min,sec)\",A;",
+ "input": [
+ "\n",
+ "\n",
+ "#part 1\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "GAT =5+17.0/60+6.0/60; #GAT \n",
+ "delta =17+46.0/60+52.0/3600; # declination\n",
+ "\n",
+ "#calculation\n",
+ "i =37.0/3600* GAT ;\n",
+ "delta =delta -i;\n",
+ "delta1=deg_to_dms(delta);\n",
+ "\n",
+ "#result\n",
+ "print \"Declination in (deg,min,sec)\",delta1;\n",
+ "\n",
+ "#part 2\n",
+ "#initialisation of variable\n",
+ "p=90 - delta ; # co declination\n",
+ "altitude =23+15.0/60+20.0/3600; # altitude of sun\n",
+ "i2 =2.0/60+12.0/3600; # error due to refraction\n",
+ "i3 =8.0/3600; # error due to parallax\n",
+ "\n",
+ "#calculation\n",
+ "altitude = altitude -i2+i3;\n",
+ "c =90 -55 -46.0/60 -12.0/3600; # colatitude\n",
+ "z=90 - altitude ; # co altitude\n",
+ "s=(p+z+c) /2;\n",
+ "s1=s-c;\n",
+ "s2=s-p;\n",
+ "s3=s-z;\n",
+ "A =2* atan ( sqrt (sin(s3*pi /180) * sin (s1*pi /180) / sin (s*pi/180) / sin (s2*pi /180) ));\n",
+ "A=A *180/ pi;\n",
+ "A=deg_to_dms(A);\n",
+ "\n",
+ "#result\n",
+ "print \"Altitude in (deg,min,sec)\",A;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Declination in (deg,min,sec) [17, 43, 32.82]\nAltitude in (deg,min,sec) [92, 23, 10.67]\n"
+ "text": [
+ "Declination in (deg,min,sec) [17, 43, 32.82]\n",
+ "Altitude in (deg,min,sec) [92, 23, 10.67]\n"
+ ]
}
],
"prompt_number": 34
@@ -1193,19 +3115,51 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.53,Page 156"
+ "source": [
+ "Example 1.53,Page 156"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding azimuth\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nGMT =17+5.0/60+2.0/3600; \ni =9.8565/3600* GMT;\nGST =3+12.0/60+12.0/3600;\nwl =1+18.0/60; # west longitude\nRA =16+23.0/60+30.0/3600;\n\n#calculation\nH= GMT +i+ GST +wl -RA; # hour angle\nH=H *15;\np =90 -29 -52.0/60;\nc =90 -52 -8.0/60;\nz= acos ( cos (H*pi /180) * sin (p*pi /180) *sin(c*pi /180) + cos(p*pi /180) * cos (c*pi /180) );\nA= asin ( sin (p*pi /180) * sin (H*pi /180) /sin(z));\nA=A *180/ pi\nA=deg_to_dms(A);\n\n#result\nprint \"Azimuth in (deg,min,sec)\",A;",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "GMT =17+5.0/60+2.0/3600; \n",
+ "i =9.8565/3600* GMT;\n",
+ "GST =3+12.0/60+12.0/3600;\n",
+ "wl =1+18.0/60; # west longitude\n",
+ "RA =16+23.0/60+30.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "H= GMT +i+ GST +wl -RA; # hour angle\n",
+ "H=H *15;\n",
+ "p =90 -29 -52.0/60;\n",
+ "c =90 -52 -8.0/60;\n",
+ "z= acos ( cos (H*pi /180) * sin (p*pi /180) *sin(c*pi /180) + cos(p*pi /180) * cos (c*pi /180) );\n",
+ "A= asin ( sin (p*pi /180) * sin (H*pi /180) /sin(z));\n",
+ "A=A *180/ pi\n",
+ "A=deg_to_dms(A);\n",
+ "\n",
+ "#result\n",
+ "print \"Azimuth in (deg,min,sec)\",A;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Azimuth in (deg,min,sec) [78, 38, 33.24]\n"
+ "text": [
+ "Azimuth in (deg,min,sec) [78, 38, 33.24]\n"
+ ]
}
],
"prompt_number": 33
@@ -1214,19 +3168,63 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.54,Page 157"
+ "source": [
+ "Example 1.54,Page 157"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding azimuth\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nc2 =24+30.0/60+20.0/3600;\nd2 =24+30.0/60+40.0/3600;\nc3 =25;\nd3 =25+1.0/60;\n\n#calculation\nalt =( c2+c3+d3+d2)/4;#mean observed altitude\nil =(10.6 -9.4) /4*15.0/3600; # error \nalt = alt +il;\nir = -57.0/3600/ tan (( alt *pi /180) ); # correction of refraction\nip =8.0/3600* cos (alt*pi /180) ; # correction of parallax\nalt =alt -ir+ip;#altitude corrected\nz=90 - alt;#ZM\ndelta =1+32.0/60+16.8/3600 -56.2/3600*(3.0/60+1.86/3600) ;#declination of sun\np=90 - delta ;#PM\nc =90 -36 -48.0/60 -30.0/3600;#ZP\ns=(p+z+c) /2;\ns1=s-c;\ns2=s-p;\ns3=s-z;\nA =2* atan ( sqrt (sin(s3*pi /180) * sin (s1*pi /180) / sin (s*pi/180) / sin (s2*pi /180) ));#azimuth calculation\nA=A *180/ pi;\nA=A +81+59.0/60+10.0/3600;\nA=360 -A;\nA=deg_to_dms(A);\n\n#result\nprint \"Azimuth in (deg,min,sec)\",A;\nprint \"there is a miscalculation in the step of calculating Azimuth and error due to refrection thus resulted in change in answer\"",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "c2 =24+30.0/60+20.0/3600;\n",
+ "d2 =24+30.0/60+40.0/3600;\n",
+ "c3 =25;\n",
+ "d3 =25+1.0/60;\n",
+ "\n",
+ "#calculation\n",
+ "alt =( c2+c3+d3+d2)/4;#mean observed altitude\n",
+ "il =(10.6 -9.4) /4*15.0/3600; # error \n",
+ "alt = alt +il;\n",
+ "ir = -57.0/3600/ tan (( alt *pi /180) ); # correction of refraction\n",
+ "ip =8.0/3600* cos (alt*pi /180) ; # correction of parallax\n",
+ "alt =alt -ir+ip;#altitude corrected\n",
+ "z=90 - alt;#ZM\n",
+ "delta =1+32.0/60+16.8/3600 -56.2/3600*(3.0/60+1.86/3600) ;#declination of sun\n",
+ "p=90 - delta ;#PM\n",
+ "c =90 -36 -48.0/60 -30.0/3600;#ZP\n",
+ "s=(p+z+c) /2;\n",
+ "s1=s-c;\n",
+ "s2=s-p;\n",
+ "s3=s-z;\n",
+ "A =2* atan ( sqrt (sin(s3*pi /180) * sin (s1*pi /180) / sin (s*pi/180) / sin (s2*pi /180) ));#azimuth calculation\n",
+ "A=A *180/ pi;\n",
+ "A=A +81+59.0/60+10.0/3600;\n",
+ "A=360 -A;\n",
+ "A=deg_to_dms(A);\n",
+ "\n",
+ "#result\n",
+ "print \"Azimuth in (deg,min,sec)\",A;\n",
+ "print \"there is a miscalculation in the step of calculating Azimuth and error due to refrection thus resulted in change in answer\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Azimuth in (deg,min,sec) [170, 1, 36.93]\nthere is a miscalculation in the step of calculating Azimuth and error due to refrection thus resulted in change in answer\n"
+ "text": [
+ "Azimuth in (deg,min,sec) [170, 1, 36.93]\n",
+ "there is a miscalculation in the step of calculating Azimuth and error due to refrection thus resulted in change in answer\n"
+ ]
}
],
"prompt_number": 5
@@ -1235,19 +3233,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.55,Page 178"
+ "source": [
+ "Example 1.55,Page 178"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nalpha =65+40.0/60+18.0/3600; # altitude\ndelta =53+12.0/60+10.0/3600; # declination\n\n#calculation\ni =57.0/3600*1/ tan ( alpha *pi /180) ; \nalpha =alpha -i;\nz=90 - alpha ; # zenith distance\nlat =delta -z;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "alpha =65+40.0/60+18.0/3600; # altitude\n",
+ "delta =53+12.0/60+10.0/3600; # declination\n",
+ "\n",
+ "#calculation\n",
+ "i =57.0/3600*1/ tan ( alpha *pi /180) ; \n",
+ "alpha =alpha -i;\n",
+ "z=90 - alpha ; # zenith distance\n",
+ "lat =delta -z;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[28, 52, 2.23] Latitude in (deg,min,sec)\n"
+ "text": [
+ "[28, 52, 2.23] Latitude in (deg,min,sec)\n"
+ ]
}
],
"prompt_number": 58
@@ -1256,19 +3281,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.56,Page 178"
+ "source": [
+ "Example 1.56,Page 178"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nalpha =64+36.0/60+20.0/3600; # altitude\ndelta =26+12.0/60+10.0/3600; # declination\n\n#calculation\ni =57.0/3600*1/ tan ( alpha *pi /180) ; # error\nalpha =alpha -i;\nz=90 - alpha ; # zenith distance\nlat = delta +z;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "alpha =64+36.0/60+20.0/3600; # altitude\n",
+ "delta =26+12.0/60+10.0/3600; # declination\n",
+ "\n",
+ "#calculation\n",
+ "i =57.0/3600*1/ tan ( alpha *pi /180) ; # error\n",
+ "alpha =alpha -i;\n",
+ "z=90 - alpha ; # zenith distance\n",
+ "lat = delta +z;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Latitude in (deg,min,sec) [51, 36, 17.06]\n"
+ "text": [
+ "Latitude in (deg,min,sec) [51, 36, 17.06]\n"
+ ]
}
],
"prompt_number": 31
@@ -1277,19 +3329,52 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.57,Page 178"
+ "source": [
+ "Example 1.57,Page 178"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nalpha =44+12.0/60+30.0/3600; # altitude\nlongP =75+20.0/60+15.0/3600; # longitude of place\ndelta =22+18.0/60+12.8/3600; # declination of sun\n\n#calculation\ni =57.0/3600*1/ tan ( alpha *pi /180) ; # error\ni2 =8.78/3600* cos( alpha ); #error due to parallax\ni3 =15.0/60+45.86/3600; #error due to semi diameter\nalpha =alpha -i+i2+i3;\nz=90 - alpha ; # zenith distance\ndelT = longP /15;\ni4 =6.82/3600* delT ; # error in time\ndelta =i4+ delta ;\nlat = delta +z;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "alpha =44+12.0/60+30.0/3600; # altitude\n",
+ "longP =75+20.0/60+15.0/3600; # longitude of place\n",
+ "delta =22+18.0/60+12.8/3600; # declination of sun\n",
+ "\n",
+ "#calculation\n",
+ "i =57.0/3600*1/ tan ( alpha *pi /180) ; # error\n",
+ "i2 =8.78/3600* cos( alpha ); #error due to parallax\n",
+ "i3 =15.0/60+45.86/3600; #error due to semi diameter\n",
+ "alpha =alpha -i+i2+i3;\n",
+ "z=90 - alpha ; # zenith distance\n",
+ "delT = longP /15;\n",
+ "i4 =6.82/3600* delT ; # error in time\n",
+ "delta =i4+ delta ;\n",
+ "lat = delta +z;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[67, 51, 21.23] Latitude in (deg,min,sec)\n"
+ "text": [
+ "[67, 51, 21.23] Latitude in (deg,min,sec)\n"
+ ]
}
],
"prompt_number": 62
@@ -1298,19 +3383,53 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.58,Page 180"
+ "source": [
+ "Example 1.58,Page 180"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding alpha1,alpha2\n\n#for alpha 1\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\ntheta =80;\ndelta =46+45.0/60+30.0/3600;\n\n#calculation\nalpha1 =90 - theta + delta ;\nalpha1=deg_to_dms(alpha1);\n\n#result\nprint \"alpha1 to the north in (deg,min,sec)\",alpha1\n\n#for alpha2\n#calculation\nalpha2 = theta +delta -90;\nalpha2=deg_to_dms(alpha2)\n\n#result\nprint \"alpha2 to the south(deg,min,sec)\",alpha2",
+ "input": [
+ "\n",
+ "\n",
+ "#for alpha 1\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "theta =80;\n",
+ "delta =46+45.0/60+30.0/3600;\n",
+ "\n",
+ "#calculation\n",
+ "alpha1 =90 - theta + delta ;\n",
+ "alpha1=deg_to_dms(alpha1);\n",
+ "\n",
+ "#result\n",
+ "print \"alpha1 to the north in (deg,min,sec)\",alpha1\n",
+ "\n",
+ "#for alpha2\n",
+ "#calculation\n",
+ "alpha2 = theta +delta -90;\n",
+ "alpha2=deg_to_dms(alpha2)\n",
+ "\n",
+ "#result\n",
+ "print \"alpha2 to the south(deg,min,sec)\",alpha2"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[56, 45, 30.0] alpha1 to the north in (deg,min,sec)\n[36, 45, 30.0] lpha1 to the south(deg,min,sec)\n"
+ "text": [
+ "[56, 45, 30.0] alpha1 to the north in (deg,min,sec)\n",
+ "[36, 45, 30.0] lpha1 to the south(deg,min,sec)\n"
+ ]
}
],
"prompt_number": 69
@@ -1319,19 +3438,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.59,Page 181"
+ "source": [
+ "Example 1.59,Page 181"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\ndelta1 =20+25.0/60+48.0/3600; # declination of star 1\ndelta2 =79+30.0/60+52.0/3600; # declination of star 2\nalpha1 =48+18.0/60+12.0/3600; #altitude of star 1\nalpha2 =47+54.0/60+6.0/3600; #altitude of star 2\n\n#calculation\nr1 =58.0/3600/ tan( alpha1 *pi /180) # error 1\nr2 =58.0/3600/ tan( alpha2 *pi /180) # error 2\nlat =90 -( alpha1 - alpha2 ) /2+( delta1 - delta2 ) /2+( r1 -r2)/2;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat;\nprint \" there is a miscalculation in the step of calculating (delta1-delta2)/2 so there is a difference in the answer\"",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "delta1 =20+25.0/60+48.0/3600; # declination of star 1\n",
+ "delta2 =79+30.0/60+52.0/3600; # declination of star 2\n",
+ "alpha1 =48+18.0/60+12.0/3600; #altitude of star 1\n",
+ "alpha2 =47+54.0/60+6.0/3600; #altitude of star 2\n",
+ "\n",
+ "#calculation\n",
+ "r1 =58.0/3600/ tan( alpha1 *pi /180) # error 1\n",
+ "r2 =58.0/3600/ tan( alpha2 *pi /180) # error 2\n",
+ "lat =90 -( alpha1 - alpha2 ) /2+( delta1 - delta2 ) /2+( r1 -r2)/2;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat;\n",
+ "print \" there is a miscalculation in the step of calculating (delta1-delta2)/2 so there is a difference in the answer\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Latitude in (deg,min,sec) [60, 15, 24.63]\n there is a miscalculation in the step of calculating (delta1-delta2)/2 so there is a difference in the answer\n"
+ "text": [
+ "Latitude in (deg,min,sec) [60, 15, 24.63]\n",
+ " there is a miscalculation in the step of calculating (delta1-delta2)/2 so there is a difference in the answer\n"
+ ]
}
],
"prompt_number": 8
@@ -1340,19 +3489,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.60,Page 182"
+ "source": [
+ "Example 1.60,Page 182"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude,declination\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nalphal =18+36.0/60+40.0/3600; #altitude at lower culmination\nalphau =59+48.0/60+20.0/3600; #altitude at upper culmination\nlat =( alphal + alphau )/2;\nlat1=deg_to_dms(lat);\ndelta =90+ lat - alphau ;\ndelta1=deg_to_dms(delta);\n\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat1;\nprint \"Declination of star in (deg,min,sec)\",delta1",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "alphal =18+36.0/60+40.0/3600; #altitude at lower culmination\n",
+ "alphau =59+48.0/60+20.0/3600; #altitude at upper culmination\n",
+ "lat =( alphal + alphau )/2;\n",
+ "lat1=deg_to_dms(lat);\n",
+ "delta =90+ lat - alphau ;\n",
+ "delta1=deg_to_dms(delta);\n",
+ "\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat1;\n",
+ "print \"Declination of star in (deg,min,sec)\",delta1"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[39, 12, 30.0] Latitude of star in (deg,min,sec)\n[69, 24, 10.0] Declination of star in (deg,min,sec)\n"
+ "text": [
+ "[39, 12, 30.0] Latitude of star in (deg,min,sec)\n",
+ "[69, 24, 10.0] Declination of star in (deg,min,sec)\n"
+ ]
}
],
"prompt_number": 74
@@ -1361,19 +3537,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.61,Page 183"
+ "source": [
+ "Example 1.61,Page 183"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nalpha =40+36.0/60+30.0/3600; # altitude of star\ndelta =10+36.0/60+40.0/3600; # declination of star\nH =46+36.0/60+20.0/3600; # hour angle of star\n\n#calculation\nn= atan ( tan ( delta *pi /180) /cos(H*pi /180) );\nlat =n+ acos ( sin ( alpha *pi /180) *sin(n)/ sin ( delta *pi/180) );\nlat = lat *180/ pi;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "alpha =40+36.0/60+30.0/3600; # altitude of star\n",
+ "delta =10+36.0/60+40.0/3600; # declination of star\n",
+ "H =46+36.0/60+20.0/3600; # hour angle of star\n",
+ "\n",
+ "#calculation\n",
+ "n= atan ( tan ( delta *pi /180) /cos(H*pi /180) );\n",
+ "lat =n+ acos ( sin ( alpha *pi /180) *sin(n)/ sin ( delta *pi/180) );\n",
+ "lat = lat *180/ pi;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[36, 49, 43.99] Latitude in (deg,min,sec)\n"
+ "text": [
+ "[36, 49, 43.99] Latitude in (deg,min,sec)\n"
+ ]
}
],
"prompt_number": 75
@@ -1382,19 +3585,61 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.62,Page 183"
+ "source": [
+ "Example 1.62,Page 183"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nalpha =42+10.0/60+40.0/3600; # altitude o f sun\ndelta =23+12.0/60+18.6/3600; # declination of sun ' s angle\nLMT =14+50.0/60;\n\n#calculation\ni =57.0/3600*1/ tan ( alpha *pi /180) ; # error\ni2 =8.78/3600* cos( alpha ); # correction due to parallax\ni3 =15.0/60+45.86/3600; # coreection due to semi diamter\nlongP =108+30.0/60; # longitude of place\nalpha =alpha -i+i2+i3;\ndelT = longP /15; # change in time\nGMT = LMT + delT ;\ni4 =1.2/3600* GMT; # error in time\nH=( GMT -12+ i4 - delT ) *15; # hour angle\ni5 =10.6/3600* GMT; # error in declination\ndelta = delta +i5;\nZM =(90 - alpha )*pi /180;\nPM =(90+ delta )*pi /180;\nA= asin ( sin (PM)/sin(ZM)* sin (H*pi /180) );\nA=pi -A;\nZP =2* atan ( sin (A/2+ H*pi /360) / sin (A/2-H*pi /360) *tan(PM/2- ZM /2) );\nlat =pi /2- ZP;\nlat = lat *180/ pi +1+6.0/60;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "alpha =42+10.0/60+40.0/3600; # altitude o f sun\n",
+ "delta =23+12.0/60+18.6/3600; # declination of sun ' s angle\n",
+ "LMT =14+50.0/60;\n",
+ "\n",
+ "#calculation\n",
+ "i =57.0/3600*1/ tan ( alpha *pi /180) ; # error\n",
+ "i2 =8.78/3600* cos( alpha ); # correction due to parallax\n",
+ "i3 =15.0/60+45.86/3600; # coreection due to semi diamter\n",
+ "longP =108+30.0/60; # longitude of place\n",
+ "alpha =alpha -i+i2+i3;\n",
+ "delT = longP /15; # change in time\n",
+ "GMT = LMT + delT ;\n",
+ "i4 =1.2/3600* GMT; # error in time\n",
+ "H=( GMT -12+ i4 - delT ) *15; # hour angle\n",
+ "i5 =10.6/3600* GMT; # error in declination\n",
+ "delta = delta +i5;\n",
+ "ZM =(90 - alpha )*pi /180;\n",
+ "PM =(90+ delta )*pi /180;\n",
+ "A= asin ( sin (PM)/sin(ZM)* sin (H*pi /180) );\n",
+ "A=pi -A;\n",
+ "ZP =2* atan ( sin (A/2+ H*pi /360) / sin (A/2-H*pi /360) *tan(PM/2- ZM /2) );\n",
+ "lat =pi /2- ZP;\n",
+ "lat = lat *180/ pi +1+6.0/60;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[1, 19, 7.46] Latitude in (deg,min,sec)\n"
+ "text": [
+ "[1, 19, 7.46] Latitude in (deg,min,sec)\n"
+ ]
}
],
"prompt_number": 78
@@ -1403,19 +3648,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.63,Page 185"
+ "source": [
+ "Example 1.63,Page 185"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\ndelta =15+20.0/60+48.0/3600; # declination of star\nInt =9+22.0/60+6.0/3600; # interval\n\n#calculation\ndint =Int *9.8565/3600; # change in interval\nH=( Int+ dint ) *15/2; # hour angle\nlat = atan (tan( delta *pi /180) /cos(H*pi /180) );\nlat = lat *180/ pi +5.0/6*16.0/3600;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "delta =15+20.0/60+48.0/3600; # declination of star\n",
+ "Int =9+22.0/60+6.0/3600; # interval\n",
+ "\n",
+ "#calculation\n",
+ "dint =Int *9.8565/3600; # change in interval\n",
+ "H=( Int+ dint ) *15/2; # hour angle\n",
+ "lat = atan (tan( delta *pi /180) /cos(H*pi /180) );\n",
+ "lat = lat *180/ pi +5.0/6*16.0/3600;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[39, 22, 1.79] Latitude in (deg,min,sec)\n"
+ "text": [
+ "[39, 22, 1.79] Latitude in (deg,min,sec)\n"
+ ]
}
],
"prompt_number": 79
@@ -1424,19 +3696,58 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.64,Page 186"
+ "source": [
+ "Example 1.64,Page 186"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nRA =1+41.0/60+48.64/3600;\nlat =48+36.0/60+40/3600; # latitude\ndelta =88+58.0/60+28.26/3600; # declination of polaris\nGMM =16+48.0/60+20.86/3600;\nlongP =7+20.0/60; # longitude of place P\ni1 =51.0/3600; # error due to barometer\ni2 =1.0/3600; # error due to barometer\ni3 = -1.0/3600; # error due to temp\n\n#calculation\nlat =lat -i1+i2+i3;\ndelT = longP /15;\ni4= delT *9.8565/3600;\nlst = GMM +i4;\nLMT =20+24.0/60+50.0/3600;\ni6 =9.8565/3600* LMT ; # e r r o r i n LMT\nLST = LMT +i6+lst -24;\nH=LST -RA; # hour a n g l e\nH=H *15;\nlat =lat -(90 - delta )*cos(H*pi /180) +.5* sin (1/3600* pi/180) *(90 - delta ) **2*( sin (H*pi /180) )**2* tan ( lat *pi/180) ;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "RA =1+41.0/60+48.64/3600;\n",
+ "lat =48+36.0/60+40/3600; # latitude\n",
+ "delta =88+58.0/60+28.26/3600; # declination of polaris\n",
+ "GMM =16+48.0/60+20.86/3600;\n",
+ "longP =7+20.0/60; # longitude of place P\n",
+ "i1 =51.0/3600; # error due to barometer\n",
+ "i2 =1.0/3600; # error due to barometer\n",
+ "i3 = -1.0/3600; # error due to temp\n",
+ "\n",
+ "#calculation\n",
+ "lat =lat -i1+i2+i3;\n",
+ "delT = longP /15;\n",
+ "i4= delT *9.8565/3600;\n",
+ "lst = GMM +i4;\n",
+ "LMT =20+24.0/60+50.0/3600;\n",
+ "i6 =9.8565/3600* LMT ; # e r r o r i n LMT\n",
+ "LST = LMT +i6+lst -24;\n",
+ "H=LST -RA; # hour a n g l e\n",
+ "H=H *15;\n",
+ "lat =lat -(90 - delta )*cos(H*pi /180) +.5* sin (1/3600* pi/180) *(90 - delta ) **2*( sin (H*pi /180) )**2* tan ( lat *pi/180) ;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[49, 36, 18.45] Latitude in (deg,min,sec)\n"
+ "text": [
+ "[49, 36, 18.45] Latitude in (deg,min,sec)\n"
+ ]
}
],
"prompt_number": 81
@@ -1445,19 +3756,65 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 1.65,Page 187"
+ "source": [
+ "Example 1.65,Page 187"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding latitude\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin,cos,acos,atan,asin\ndef deg_to_dms(deg):\n d = int(deg)\n md = abs(deg - d) * 60\n m = int(md)\n sd = round((md - m) * 60,2)\n return [d, m, sd]\nlongP =120 -4 -20.0/60; # longitude of point\nGST =8+30.0/60+20.0/3600; #GST on GMM\ndelta =6+15.0/60+2.0/3600; # deflection\nalpha =39+20.0/60+30.0/3600; # altitude\ntheta =56+54.0/60+30.0/3600; # longitude\n\n#calculation\ndelT = longP /15;\ni= delT *9.8565/3600; # error in time\nlst = GST +i; #LST on LMM\nLST =19+52.0/60+16.0/3600;\nRA=LST;\nLMN =LST -lst;\ni2=LMN *9.8565/3600; # error in LMN\nLMN =LMN -i2;\nOSM =10+55.0/60+30.0/3600; #Observed mean time\ni3 =1.0/60+25.0/3600; # e r r o r i n obs e r v ed t ime\nOSM =OSM -i3;\nLMT = OSM +4.0/15+21.0/60.0/15;\nI=LMN - LMT ; # interval\ni4 =1.21/3600; # error in interval\nI=I+i4;\nH=I; # hour angle\nB= cos ( delta *pi /180) * cos ( theta *pi /180) / cos ( alpha *pi/180) ;\nm =225* H **2*3600**2/2.0/206265.0;\nlat = alpha +m*B /3600;\nlat =90 - lat +6+15.0/60+2.0/3600;\nlat=deg_to_dms(lat);\n\n#result\nprint \"Latitude in (deg,min,sec)\",lat;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n",
+ "def deg_to_dms(deg):\n",
+ " d = int(deg)\n",
+ " md = abs(deg - d) * 60\n",
+ " m = int(md)\n",
+ " sd = round((md - m) * 60,2)\n",
+ " return [d, m, sd]\n",
+ "longP =120 -4 -20.0/60; # longitude of point\n",
+ "GST =8+30.0/60+20.0/3600; #GST on GMM\n",
+ "delta =6+15.0/60+2.0/3600; # deflection\n",
+ "alpha =39+20.0/60+30.0/3600; # altitude\n",
+ "theta =56+54.0/60+30.0/3600; # longitude\n",
+ "\n",
+ "#calculation\n",
+ "delT = longP /15;\n",
+ "i= delT *9.8565/3600; # error in time\n",
+ "lst = GST +i; #LST on LMM\n",
+ "LST =19+52.0/60+16.0/3600;\n",
+ "RA=LST;\n",
+ "LMN =LST -lst;\n",
+ "i2=LMN *9.8565/3600; # error in LMN\n",
+ "LMN =LMN -i2;\n",
+ "OSM =10+55.0/60+30.0/3600; #Observed mean time\n",
+ "i3 =1.0/60+25.0/3600; # e r r o r i n obs e r v ed t ime\n",
+ "OSM =OSM -i3;\n",
+ "LMT = OSM +4.0/15+21.0/60.0/15;\n",
+ "I=LMN - LMT ; # interval\n",
+ "i4 =1.21/3600; # error in interval\n",
+ "I=I+i4;\n",
+ "H=I; # hour angle\n",
+ "B= cos ( delta *pi /180) * cos ( theta *pi /180) / cos ( alpha *pi/180) ;\n",
+ "m =225* H **2*3600**2/2.0/206265.0;\n",
+ "lat = alpha +m*B /3600;\n",
+ "lat =90 - lat +6+15.0/60+2.0/3600;\n",
+ "lat=deg_to_dms(lat);\n",
+ "\n",
+ "#result\n",
+ "print \"Latitude in (deg,min,sec)\",lat;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "[56, 53, 17.77] Latitude in (deg,min,sec)\n"
+ "text": [
+ "[56, 53, 17.77] Latitude in (deg,min,sec)\n"
+ ]
}
],
"prompt_number": 85
@@ -1465,7 +3822,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Surveying_Volume_3/Chapter_2.ipynb b/Surveying_Volume_3/Chapter_2.ipynb
index 4be4bac6..f9526973 100644
--- a/Surveying_Volume_3/Chapter_2.ipynb
+++ b/Surveying_Volume_3/Chapter_2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 2"
+ "name": "",
+ "signature": "sha256:ca6f7f2cf84d957176ecf14fb0c306b69df620b66b59adb595e323ae5d6031bb"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,57 @@
"cell_type": "heading",
"level": 2,
"metadata": {},
- "source": "PHOTOGRAPHIC SURVEYING"
+ "source": [
+ "PHOTOGRAPHIC SURVEYING"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.1, Page 215"
+ "source": [
+ "Example 2.1, Page 215"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding azimuth of a,b,c\n\n# Initialization of Variable\nfrom math import pi\nfrom math import atan\nf =120.80 # focal length\na = -35.52 # elevation of A\nb =8.48 # elevation of B\nc =48.26 # elevation of C\n\n#calculation\nalphaa = atan (a/f);\nalphab = atan (b/f);\nalphac = atan (c/f);\nphi =(354+30/60) *pi /180; # azimuth o f camera\nphia =phi - alphaa -360* pi /180; # azimuth o f a\nphib = phia + alphab; # azimuth o f b\nphic = phia + alphac ; # azimuth o f c\n\n#result\nprint \" azimuth of a in ( degrees ) \",round(phia /pi *180,2)\nprint \" azimuth of b in ( degrees ) \",round(phib /pi *180,2)\nprint \" azimuth of c in ( degrees ) \",round(phic /pi *180,2)",
+ "input": [
+ "\n",
+ "\n",
+ "# Initialization of Variable\n",
+ "from math import pi\n",
+ "from math import atan\n",
+ "f =120.80 # focal length\n",
+ "a = -35.52 # elevation of A\n",
+ "b =8.48 # elevation of B\n",
+ "c =48.26 # elevation of C\n",
+ "\n",
+ "#calculation\n",
+ "alphaa = atan (a/f);\n",
+ "alphab = atan (b/f);\n",
+ "alphac = atan (c/f);\n",
+ "phi =(354+30/60) *pi /180; # azimuth o f camera\n",
+ "phia =phi - alphaa -360* pi /180; # azimuth o f a\n",
+ "phib = phia + alphab; # azimuth o f b\n",
+ "phic = phia + alphac ; # azimuth o f c\n",
+ "\n",
+ "#result\n",
+ "print \" azimuth of a in ( degrees ) \",round(phia /pi *180,2)\n",
+ "print \" azimuth of b in ( degrees ) \",round(phib /pi *180,2)\n",
+ "print \" azimuth of c in ( degrees ) \",round(phic /pi *180,2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " azimuth of a in ( degrees ) 10.39\n azimuth of b in ( degrees ) 14.4\n azimuth of c in ( degrees ) 32.16\n"
+ "text": [
+ " azimuth of a in ( degrees ) 10.39\n",
+ " azimuth of b in ( degrees ) 14.4\n",
+ " azimuth of c in ( degrees ) 32.16\n"
+ ]
}
],
"prompt_number": 1
@@ -38,19 +71,54 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.2,Page 216"
+ "source": [
+ "Example 2.2,Page 216"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#Finding distance AP and AQ and reduced elevation of A\n\n#initialisation of variable\nfrom math import pi\nfrom math import atan,sin,sqrt\nf =150.0; # focal length of camera\nap =20.2 # elevation of a from p\naa1 =16.4; # distace to the right\naq =35.2 # elevation of a from q\nPQ =100.0; # distace of PQ\nRL =126.845; # r educed level of instrument\n\n#calculation\nalphap = atan (ap/f);\nalphaq = atan (aq/f);\nP=pi /3- alphap ; # angle P\nQ =40* pi /180 - alphaq ; # angle Q\nA=pi -P-Q; # angle A;\nAP=PQ* sin (Q)/sin(A);\nAQ=PQ* sin (P)/sin(A);\nPa1 = sqrt (ap **2+ f **2) ;\nAA1 = aa1 *AP/ Pa1 ;\nRLa =RL+AA1; # reduced level of A\n\n#result\nprint \" distance of AP (m) \",round(AP,2);\nprint \"distance of AQ (m) \",round(AQ,2);\nprint \" reduced level of A in (M) \",round(RLa,2)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi\n",
+ "from math import atan,sin,sqrt\n",
+ "f =150.0; # focal length of camera\n",
+ "ap =20.2 # elevation of a from p\n",
+ "aa1 =16.4; # distace to the right\n",
+ "aq =35.2 # elevation of a from q\n",
+ "PQ =100.0; # distace of PQ\n",
+ "RL =126.845; # r educed level of instrument\n",
+ "\n",
+ "#calculation\n",
+ "alphap = atan (ap/f);\n",
+ "alphaq = atan (aq/f);\n",
+ "P=pi /3- alphap ; # angle P\n",
+ "Q =40* pi /180 - alphaq ; # angle Q\n",
+ "A=pi -P-Q; # angle A;\n",
+ "AP=PQ* sin (Q)/sin(A);\n",
+ "AQ=PQ* sin (P)/sin(A);\n",
+ "Pa1 = sqrt (ap **2+ f **2) ;\n",
+ "AA1 = aa1 *AP/ Pa1 ;\n",
+ "RLa =RL+AA1; # reduced level of A\n",
+ "\n",
+ "#result\n",
+ "print \" distance of AP (m) \",round(AP,2);\n",
+ "print \"distance of AQ (m) \",round(AQ,2);\n",
+ "print \" reduced level of A in (M) \",round(RLa,2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " distance of AP (m) 45.9\ndistance of AQ (m) 80.6\n reduced level of A in (M) 131.82\n"
+ "text": [
+ " distance of AP (m) 45.9\n",
+ "distance of AQ (m) 80.6\n",
+ " reduced level of A in (M) 131.82\n"
+ ]
}
],
"prompt_number": 2
@@ -59,19 +127,38 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.3,Page 218"
+ "source": [
+ "Example 2.3,Page 218"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding focal length\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\ntheta =(44+30/60) *pi /180; # angle b/w two points\nx1 =68.24; #distance of 1st point\nx2 =58.48; #distance of 2nd point\n\n#calculation\nf=( x1+x2)/ tan ( theta ) /2+ sqrt (( x1+x2) **2/4/( tan ( theta ))\n**2+ x1*x2);\n\n#result\nprint \" focal length of lens in (mm) \",round(f,2);",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "theta =(44+30/60) *pi /180; # angle b/w two points\n",
+ "x1 =68.24; #distance of 1st point\n",
+ "x2 =58.48; #distance of 2nd point\n",
+ "\n",
+ "#calculation\n",
+ "f=( x1+x2)/ tan ( theta ) /2+ sqrt (( x1+x2) **2/4/( tan ( theta ))\n",
+ "**2+ x1*x2);\n",
+ "\n",
+ "#result\n",
+ "print \" focal length of lens in (mm) \",round(f,2);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " focal length of lens in (mm) 156.69\n"
+ "text": [
+ " focal length of lens in (mm) 156.69\n"
+ ]
}
],
"prompt_number": 3
@@ -80,19 +167,48 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.4, Page 240"
+ "source": [
+ "Example 2.4, Page 240"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding representative fraction\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\n# part 1\n\nH =1200.0;#altitude\nh =80.0; #elevation of hill\nf =15.0/100.0;\n\n#calculation\nR80 =f/(H-h);\nprint \" representative fraction of hill is ( time s) \",round(R80,5);\n\n# part 2\n#initialisation of variable\nh =300.0; #elevation of hill\n\n#calculation\nR300 =f/(H-h);\n\n#result\nprint \" representative fraction of hill is ( time s) \",round(R300,5) ;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "# part 1\n",
+ "\n",
+ "H =1200.0;#altitude\n",
+ "h =80.0; #elevation of hill\n",
+ "f =15.0/100.0;\n",
+ "\n",
+ "#calculation\n",
+ "R80 =f/(H-h);\n",
+ "print \" representative fraction of hill is ( time s) \",round(R80,5);\n",
+ "\n",
+ "# part 2\n",
+ "#initialisation of variable\n",
+ "h =300.0; #elevation of hill\n",
+ "\n",
+ "#calculation\n",
+ "R300 =f/(H-h);\n",
+ "\n",
+ "#result\n",
+ "print \" representative fraction of hill is ( time s) \",round(R300,5) ;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " representative fraction of hill is ( time s) 0.00013\n representative fraction of hill is ( time s) 0.00017\n"
+ "text": [
+ " representative fraction of hill is ( time s) 0.00013\n",
+ " representative fraction of hill is ( time s) 0.00017\n"
+ ]
}
],
"prompt_number": 4
@@ -101,19 +217,36 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.5,Page 240"
+ "source": [
+ "Example 2.5,Page 240"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding height above sea level\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nR =1.0/8000.0;\nh =1500.0;\nf =20.0/100.0;\n\n#calculation\nH=h+f/R;\n\n#result\nprint \" height above sea level in (m) \",round(H,3);",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "R =1.0/8000.0;\n",
+ "h =1500.0;\n",
+ "f =20.0/100.0;\n",
+ "\n",
+ "#calculation\n",
+ "H=h+f/R;\n",
+ "\n",
+ "#result\n",
+ "print \" height above sea level in (m) \",round(H,3);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " height above sea level in (m) 3100.0\n"
+ "text": [
+ " height above sea level in (m) 3100.0\n"
+ ]
}
],
"prompt_number": 5
@@ -122,19 +255,41 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.6,Page 241"
+ "source": [
+ "Example 2.6,Page 241"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding height above sea level\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nh =500.0; #elevation of point\nf =20.0/100.0; # focal length\nv =8.65/100.0; # vertical distance of photograph\nho =2000.0; # horizontal distance of photograph\nR=v/ho; # representative fraction\nh1 =800;\n\n#calculation\nH=h+f/R;\nS=(H-h1)/f /100; # scale of photograph\n\nprint \" height above sea level in (m) \",round(H,2);\nprint \" 1cm in photograph represents centimetres \",round(S,3)",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "h =500.0; #elevation of point\n",
+ "f =20.0/100.0; # focal length\n",
+ "v =8.65/100.0; # vertical distance of photograph\n",
+ "ho =2000.0; # horizontal distance of photograph\n",
+ "R=v/ho; # representative fraction\n",
+ "h1 =800;\n",
+ "\n",
+ "#calculation\n",
+ "H=h+f/R;\n",
+ "S=(H-h1)/f /100; # scale of photograph\n",
+ "\n",
+ "print \" height above sea level in (m) \",round(H,2);\n",
+ "print \" 1cm in photograph represents centimetres \",round(S,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " height above sea level in (m) 5124.28\n 1cm in photograph represents centimetres 216.214\n"
+ "text": [
+ " height above sea level in (m) 5124.28\n",
+ " 1cm in photograph represents centimetres 216.214\n"
+ ]
}
],
"prompt_number": 6
@@ -143,19 +298,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.7, Page 241"
+ "source": [
+ "Example 2.7, Page 241"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding height above sea level\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nm =1.0/50000.0; #map scale\npd =10.16; # photo distance\nmd =2.54; #map distance\nf =16.0/100.0;\nh =200;\n\n#calculation\nR=pd/md*m; # representative fraction\nH=h+f/R;\n\n#result\nprint \" height above sea level in (m) \",round(H,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "m =1.0/50000.0; #map scale\n",
+ "pd =10.16; # photo distance\n",
+ "md =2.54; #map distance\n",
+ "f =16.0/100.0;\n",
+ "h =200;\n",
+ "\n",
+ "#calculation\n",
+ "R=pd/md*m; # representative fraction\n",
+ "H=h+f/R;\n",
+ "\n",
+ "#result\n",
+ "print \" height above sea level in (m) \",round(H,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " height above sea level in (m) 2200.0\n"
+ "text": [
+ " height above sea level in (m) 2200.0\n"
+ ]
}
],
"prompt_number": 7
@@ -164,19 +340,46 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.8,Page 242"
+ "source": [
+ "Example 2.8,Page 242"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding distance between A and B\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nf =20 # f o c a l l e n g t h\nxa =2.65; # x coordinate of a\nxb = -1.92; # x coordinate of b\nya =1.36; # x coordinate of a\nyb =3.65; # y coordinate of b\nH =2500.0;\nha =500.0; # elevation of a\nhb =300.0; # elevation of b\n\n#calculation\nXa =(H-ha)/f*xa;\nXb =(H-hb)/f*xb;\nYa =(H-ha)/f*ya;\nYb =(H-hb)/f*yb;\nAB= sqrt ((Xa -Xb) **2+( Ya -Yb)**2);\n\n#result\nprint \" distance between A & B in (m) \",round(AB,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "f =20 # f o c a l l e n g t h\n",
+ "xa =2.65; # x coordinate of a\n",
+ "xb = -1.92; # x coordinate of b\n",
+ "ya =1.36; # x coordinate of a\n",
+ "yb =3.65; # y coordinate of b\n",
+ "H =2500.0;\n",
+ "ha =500.0; # elevation of a\n",
+ "hb =300.0; # elevation of b\n",
+ "\n",
+ "#calculation\n",
+ "Xa =(H-ha)/f*xa;\n",
+ "Xb =(H-hb)/f*xb;\n",
+ "Ya =(H-ha)/f*ya;\n",
+ "Yb =(H-hb)/f*yb;\n",
+ "AB= sqrt ((Xa -Xb) **2+( Ya -Yb)**2);\n",
+ "\n",
+ "#result\n",
+ "print \" distance between A & B in (m) \",round(AB,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " distance between A & B in (m) 545.213\n"
+ "text": [
+ " distance between A & B in (m) 545.213\n"
+ ]
}
],
"prompt_number": 8
@@ -185,19 +388,50 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.9,Page 243"
+ "source": [
+ "Example 2.9,Page 243"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding flying distance between A and B\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nf =20.0 # focal length\nxa =2.65; # x coordinate of a\nxb = -1.92; # x coordinate of b\nya =1.36; # y coordinate of a\nyb =3.65; # y coordinate of b\nha =500.0; # elevation of a\nhb =300.0; # elevation of b\nABg =545.0;\nab =5.112;\n\n#calculation\nhab =ha /2+ hb /2;\nHapp =hab+ ABg *f/ab\nXa =( Happ -ha)/f*xa;\nXb =( Happ -hb)/f*xb;\nYa =( Happ -ha)/f*ya;\nYb =( Happ -hb)/f*yb;\nAB= sqrt ((Xa -Xb) **2+( Ya -Yb)**2);\nHact =ABg/AB *( Happ - hab )+ hab ;\n\n#result\nprint \" actual flying height of A & B in (m) \",round(Hact,3);",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "f =20.0 # focal length\n",
+ "xa =2.65; # x coordinate of a\n",
+ "xb = -1.92; # x coordinate of b\n",
+ "ya =1.36; # y coordinate of a\n",
+ "yb =3.65; # y coordinate of b\n",
+ "ha =500.0; # elevation of a\n",
+ "hb =300.0; # elevation of b\n",
+ "ABg =545.0;\n",
+ "ab =5.112;\n",
+ "\n",
+ "#calculation\n",
+ "hab =ha /2+ hb /2;\n",
+ "Happ =hab+ ABg *f/ab\n",
+ "Xa =( Happ -ha)/f*xa;\n",
+ "Xb =( Happ -hb)/f*xb;\n",
+ "Ya =( Happ -ha)/f*ya;\n",
+ "Yb =( Happ -hb)/f*yb;\n",
+ "AB= sqrt ((Xa -Xb) **2+( Ya -Yb)**2);\n",
+ "Hact =ABg/AB *( Happ - hab )+ hab ;\n",
+ "\n",
+ "#result\n",
+ "print \" actual flying height of A & B in (m) \",round(Hact,3);"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " actual flying height of A & B in (m) 2499.706\n"
+ "text": [
+ " actual flying height of A & B in (m) 2499.706\n"
+ ]
}
],
"prompt_number": 9
@@ -206,19 +440,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.10,Page 243"
+ "source": [
+ "Example 2.10,Page 243"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding relief displacement\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\n\nf =20.0/100.0;\nSd =1.0/10000.0;\nh =250.0; # elevation\nr =6.44;\n\n#calculation\nH=f/Sd;\nd=r*h/H;\n\n#result\nprint \"relief displacement of the point in ( cm) \",round(d,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "\n",
+ "f =20.0/100.0;\n",
+ "Sd =1.0/10000.0;\n",
+ "h =250.0; # elevation\n",
+ "r =6.44;\n",
+ "\n",
+ "#calculation\n",
+ "H=f/Sd;\n",
+ "d=r*h/H;\n",
+ "\n",
+ "#result\n",
+ "print \"relief displacement of the point in ( cm) \",round(d,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "relief displacement of the point in ( cm) 0.805\n"
+ "text": [
+ "relief displacement of the point in ( cm) 0.805\n"
+ ]
}
],
"prompt_number": 10
@@ -227,19 +482,37 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.11,Page 244"
+ "source": [
+ "Example 2.11,Page 244"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding relief distance\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nh =50.0; # elevation\nH =2500.0 -1250.0;\nr =6.35;\n\n#calculation\nd=r*h/H;\n\n#result\nprint \"releif displacement of the point in ( cm) \",round(d,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "h =50.0; # elevation\n",
+ "H =2500.0 -1250.0;\n",
+ "r =6.35;\n",
+ "\n",
+ "#calculation\n",
+ "d=r*h/H;\n",
+ "\n",
+ "#result\n",
+ "print \"releif displacement of the point in ( cm) \",round(d,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "releif displacement of the point in ( cm) 0.254\n"
+ "text": [
+ "releif displacement of the point in ( cm) 0.254\n"
+ ]
}
],
"prompt_number": 11
@@ -248,19 +521,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.12,Page 244"
+ "source": [
+ "Example 2.12,Page 244"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding height of tower\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nf =20.0/100.0; # focal length\nl =250; #length of line\nlp =8.5/100.0; #length of line in photograph\n\n#calculation\nH=l*f/lp; # height of camera above datum\nr =6.46; # distace of image of top o f the towe r\nd =0.46; # releif displacement\nh=d*H/r;\n\n#result\nprint \" height of tower above its base in (m) \",round(h,2)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "f =20.0/100.0; # focal length\n",
+ "l =250; #length of line\n",
+ "lp =8.5/100.0; #length of line in photograph\n",
+ "\n",
+ "#calculation\n",
+ "H=l*f/lp; # height of camera above datum\n",
+ "r =6.46; # distace of image of top o f the towe r\n",
+ "d =0.46; # releif displacement\n",
+ "h=d*H/r;\n",
+ "\n",
+ "#result\n",
+ "print \" height of tower above its base in (m) \",round(h,2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "41.89 height of tower above its base in (m) \n"
+ "text": [
+ "41.89 height of tower above its base in (m) \n"
+ ]
}
],
"prompt_number": 28
@@ -269,19 +563,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.13,Page 267"
+ "source": [
+ "Example 2.13,Page 267"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding no. of photographs\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nl =20/100; # length of photograph\nw =20/100; # breadth of photograph\nPl =0.6; # longitudinal lap\nPw =0.3; # side lap\ns =100*20;\n\n#calculation\nL=(1 - Pl)*s;\nW=(1 - Pw)*s;\nAr=L*W /1000/1000;\nN =100/ Ar;\nA= round (N);\n\n#result\nprint \"no . o f photographs to be taken \",A+1;\n",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "l =20/100; # length of photograph\n",
+ "w =20/100; # breadth of photograph\n",
+ "Pl =0.6; # longitudinal lap\n",
+ "Pw =0.3; # side lap\n",
+ "s =100*20;\n",
+ "\n",
+ "#calculation\n",
+ "L=(1 - Pl)*s;\n",
+ "W=(1 - Pw)*s;\n",
+ "Ar=L*W /1000/1000;\n",
+ "N =100/ Ar;\n",
+ "A= round (N);\n",
+ "\n",
+ "#result\n",
+ "print \"no . o f photographs to be taken \",A+1;\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "no . o f photographs to be taken 90.0\n"
+ "text": [
+ "no . o f photographs to be taken 90.0\n"
+ ]
}
],
"prompt_number": 12
@@ -290,19 +608,53 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.14,Page 267"
+ "source": [
+ "Example 2.14,Page 267"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding no. of photographs\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nPl =0.6; # longitudinal lap\nPw =0.3; # side lap\nL1 =10000.0;\ns =100.0*20.0;\n\n#calculation\nL2=L1;\nN1=L1 /((1 - Pl)*s) +1;\nA1= round (N1);\nif N1 -A1 <0:\n N1=A1;\nelse :\n N1=A1+1;\n\nN2=L2 /((1 - Pw)*s) +1;\nA2= round (N2);\nif N2 -A2 <0:\n N2=A2\nelse :\n N2=A2+1;\n\nN=N1*N2;\n\n#result\nprint \"no . of photographs to be taken \",N;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "Pl =0.6; # longitudinal lap\n",
+ "Pw =0.3; # side lap\n",
+ "L1 =10000.0;\n",
+ "s =100.0*20.0;\n",
+ "\n",
+ "#calculation\n",
+ "L2=L1;\n",
+ "N1=L1 /((1 - Pl)*s) +1;\n",
+ "A1= round (N1);\n",
+ "if N1 -A1 <0:\n",
+ " N1=A1;\n",
+ "else :\n",
+ " N1=A1+1;\n",
+ "\n",
+ "N2=L2 /((1 - Pw)*s) +1;\n",
+ "A2= round (N2);\n",
+ "if N2 -A2 <0:\n",
+ " N2=A2\n",
+ "else :\n",
+ " N2=A2+1;\n",
+ "\n",
+ "N=N1*N2;\n",
+ "\n",
+ "#result\n",
+ "print \"no . of photographs to be taken \",N;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "no . of photographs to be taken 126.0\n"
+ "text": [
+ "no . of photographs to be taken 126.0\n"
+ ]
}
],
"prompt_number": 13
@@ -311,19 +663,53 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.15,Page 268"
+ "source": [
+ "Example 2.15,Page 268"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding no. of photographs\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nPl =0.6; # longitudinal lap\nPw =0.3; # side lap\nL1 =12500.0;\ns =100.0*20.0;\nL2 =8000.0;\n\n#calculation\nN1=L1 /((1 - Pl)*s) +1;\nA1= round (N1);\nif N1 -A1 <0:\n N1=A1;\nelse :\n N1=A1+1;\n\nN2=L2 /((1 - Pw)*s) +1;\nA2= round (N2);\nif N2 -A2 <0:\n N2=A2\nelse :\n N2=A2+1;\n\nN=N1*N2;\n\n#result\nprint \"no . of photographs to be taken \",N;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "Pl =0.6; # longitudinal lap\n",
+ "Pw =0.3; # side lap\n",
+ "L1 =12500.0;\n",
+ "s =100.0*20.0;\n",
+ "L2 =8000.0;\n",
+ "\n",
+ "#calculation\n",
+ "N1=L1 /((1 - Pl)*s) +1;\n",
+ "A1= round (N1);\n",
+ "if N1 -A1 <0:\n",
+ " N1=A1;\n",
+ "else :\n",
+ " N1=A1+1;\n",
+ "\n",
+ "N2=L2 /((1 - Pw)*s) +1;\n",
+ "A2= round (N2);\n",
+ "if N2 -A2 <0:\n",
+ " N2=A2\n",
+ "else :\n",
+ " N2=A2+1;\n",
+ "\n",
+ "N=N1*N2;\n",
+ "\n",
+ "#result\n",
+ "print \"no . of photographs to be taken \",N;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "no . of photographs to be taken 119.0\n"
+ "text": [
+ "no . of photographs to be taken 119.0\n"
+ ]
}
],
"prompt_number": 14
@@ -332,19 +718,93 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.16,Page 268"
+ "source": [
+ "Example 2.16,Page 268"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding no. of photographs,height of datum\n\n#initialisation of variable\n#part1\nfrom math import pi,tan,sqrt,sin\nf =30.0/100.0; # focal length\nh =400.0; #elevation of datum\nr =12000.0; # ratio\ns =120.0*20.0;\nL2 =24000.0;\nL1 =30000.0;\nPl =0.6; # longitudinal lap\nPw =0.3; # side lap\n\n#calculation\nH=h+r*f;\n\n#result\nprint \" height above datum in (m) \",round(H,2);\n\n# part 2\n#calculation\nW=(1 - Pw)*s;\n\n#result\nprint \" ground width covered in each photograph (m) \",round(W,2);\n\n# part 3\nN2=L2 /((1 - Pw)*s) +1;\nA2= round (N2);\nif N2 -A2 <0:\n N2=A2\nelse :\n N2=A2+1;\n\n#result\nprint \"no . of flights required \",N2;\n\n#part 4-9\n#calculation\nAsf =L2 /(N2 -1) ; # actual spacing between flights\nSfl = Asf /600; # spacing of flight lines\ngd =(1 - Pl)*s; # ground distance\nEi=gd /55.5; # exposure interval\nEi= round (Ei);\nAgs =55.56* Ei;# adgusted ground distance\nN1=L1/ Ags +1;\nA1= round (N1);\nif N1 -A1 <0:\n N1=A1;\nelse :\n N1=A1+1;\nN=N1*N2;\n\n#result\nprint \"actual spacing in m\",Asf\nprint \"spacing of flight lines in cm\",round(Sfl,2)\nprint \"exposure interval in s\",Ei\nprint \"adjusted ground distance in m\",round(Ags)\nprint \"no . of photographs to be taken per flight line\",N1\nprint \"no . of photographs to be taken \",N;",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "#part1\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "f =30.0/100.0; # focal length\n",
+ "h =400.0; #elevation of datum\n",
+ "r =12000.0; # ratio\n",
+ "s =120.0*20.0;\n",
+ "L2 =24000.0;\n",
+ "L1 =30000.0;\n",
+ "Pl =0.6; # longitudinal lap\n",
+ "Pw =0.3; # side lap\n",
+ "\n",
+ "#calculation\n",
+ "H=h+r*f;\n",
+ "\n",
+ "#result\n",
+ "print \" height above datum in (m) \",round(H,2);\n",
+ "\n",
+ "# part 2\n",
+ "#calculation\n",
+ "W=(1 - Pw)*s;\n",
+ "\n",
+ "#result\n",
+ "print \" ground width covered in each photograph (m) \",round(W,2);\n",
+ "\n",
+ "# part 3\n",
+ "N2=L2 /((1 - Pw)*s) +1;\n",
+ "A2= round (N2);\n",
+ "if N2 -A2 <0:\n",
+ " N2=A2\n",
+ "else :\n",
+ " N2=A2+1;\n",
+ "\n",
+ "#result\n",
+ "print \"no . of flights required \",N2;\n",
+ "\n",
+ "#part 4-9\n",
+ "#calculation\n",
+ "Asf =L2 /(N2 -1) ; # actual spacing between flights\n",
+ "Sfl = Asf /600; # spacing of flight lines\n",
+ "gd =(1 - Pl)*s; # ground distance\n",
+ "Ei=gd /55.5; # exposure interval\n",
+ "Ei= round (Ei);\n",
+ "Ags =55.56* Ei;# adgusted ground distance\n",
+ "N1=L1/ Ags +1;\n",
+ "A1= round (N1);\n",
+ "if N1 -A1 <0:\n",
+ " N1=A1;\n",
+ "else :\n",
+ " N1=A1+1;\n",
+ "N=N1*N2;\n",
+ "\n",
+ "#result\n",
+ "print \"actual spacing in m\",Asf\n",
+ "print \"spacing of flight lines in cm\",round(Sfl,2)\n",
+ "print \"exposure interval in s\",Ei\n",
+ "print \"adjusted ground distance in m\",round(Ags)\n",
+ "print \"no . of photographs to be taken per flight line\",N1\n",
+ "print \"no . of photographs to be taken \",N;"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " height above datum in (m) 4000.0\n ground width covered in each photograph (m) 1680.0\nno . of flights required 16.0\nactual spacing in m 1600.0\nspacing of flight lines in cm 2.67\nexposure interval in s 17.0\nadjusted ground distance in m 945.0\nno . of photographs to be taken per flight line 33.0\nno . of photographs to be taken 528.0\n"
+ "text": [
+ " height above datum in (m) 4000.0\n",
+ " ground width covered in each photograph (m) 1680.0\n",
+ "no . of flights required 16.0\n",
+ "actual spacing in m 1600.0\n",
+ "spacing of flight lines in cm 2.67\n",
+ "exposure interval in s 17.0\n",
+ "adjusted ground distance in m 945.0\n",
+ "no . of photographs to be taken per flight line 33.0\n",
+ "no . of photographs to be taken 528.0\n"
+ ]
}
],
"prompt_number": 15
@@ -353,19 +813,42 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.17,Page 301"
+ "source": [
+ "Example 2.17,Page 301"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding error in height \n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nf =150.0/1000.0; # focal length\nr =20000.0; #ratio\nPl =0.6; # longitudinal lap\nl =23.0/100.0; # l e n g t h\nw =23.0/100.0; # width\n\n#calculation\nB=(1 - Pl)*l*r; # base length\nH=f*r;\nh =0;\ndh =(H-h) **2/ B/f *0.1/1000;\n\n#result\nprint \" error in height in (m) \",round(dh,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "f =150.0/1000.0; # focal length\n",
+ "r =20000.0; #ratio\n",
+ "Pl =0.6; # longitudinal lap\n",
+ "l =23.0/100.0; # l e n g t h\n",
+ "w =23.0/100.0; # width\n",
+ "\n",
+ "#calculation\n",
+ "B=(1 - Pl)*l*r; # base length\n",
+ "H=f*r;\n",
+ "h =0;\n",
+ "dh =(H-h) **2/ B/f *0.1/1000;\n",
+ "\n",
+ "#result\n",
+ "print \" error in height in (m) \",round(dh,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " error in height in (m) 3.261\n"
+ "text": [
+ " error in height in (m) 3.261\n"
+ ]
}
],
"prompt_number": 16
@@ -374,19 +857,43 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.18,Page 302"
+ "source": [
+ "Example 2.18,Page 302"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding parallax height of the chimney\n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nH =600.0;\nf =150.0/1000.0;\nb =6.375/100.0;\nh1 =0.0;\nh2 =120.0; # height of chimney\n\n#calculation\ns=H/f;\nB=s*b; # datum elevation\np1=B*f *1000/(H-h1);\np2=B*f *1000/(H-h2);\ndelp =p2 -p1;\ndelh =H* delp /1000/( b+ delp /1000) ;\n\n#result\nprint \" parallax height of the chimney in (m)\",round(delh,3)",
+ "input": [
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "H =600.0;\n",
+ "f =150.0/1000.0;\n",
+ "b =6.375/100.0;\n",
+ "h1 =0.0;\n",
+ "h2 =120.0; # height of chimney\n",
+ "\n",
+ "#calculation\n",
+ "s=H/f;\n",
+ "B=s*b; # datum elevation\n",
+ "p1=B*f *1000/(H-h1);\n",
+ "p2=B*f *1000/(H-h2);\n",
+ "delp =p2 -p1;\n",
+ "delh =H* delp /1000/( b+ delp /1000) ;\n",
+ "\n",
+ "#result\n",
+ "print \" parallax height of the chimney in (m)\",round(delh,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " parallax height of the chimney in (m) 120.0\n"
+ "text": [
+ " parallax height of the chimney in (m) 120.0\n"
+ ]
}
],
"prompt_number": 17
@@ -395,19 +902,40 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.19,Page 303"
+ "source": [
+ "Example 2.19,Page 303"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding difference in elevation \n\n#initialisation of variable\nfrom math import pi,tan,sqrt,sin\nB =200.0;\nf =120.0;\np2 =52.52; # parallax for top pole\np1 =48.27; # parallax for bottom pole\n\n#calculation\ndelh =(p2 -p1)/p2/p1*B*f;\n\n#result\nprint \" difference in elevation of two points in (m) \",round(delh,3)\nprint \"there is again a miscalculation in the step of calculating elevation thus there is a change in the answer\"",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "from math import pi,tan,sqrt,sin\n",
+ "B =200.0;\n",
+ "f =120.0;\n",
+ "p2 =52.52; # parallax for top pole\n",
+ "p1 =48.27; # parallax for bottom pole\n",
+ "\n",
+ "#calculation\n",
+ "delh =(p2 -p1)/p2/p1*B*f;\n",
+ "\n",
+ "#result\n",
+ "print \" difference in elevation of two points in (m) \",round(delh,3)\n",
+ "print \"there is again a miscalculation in the step of calculating elevation thus there is a change in the answer\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " difference in elevation of two points in (m) 40.234\nthere is again a miscalculation in the step of calculating elevation thus there is a change in the answer\n"
+ "text": [
+ " difference in elevation of two points in (m) 40.234\n",
+ "there is again a miscalculation in the step of calculating elevation thus there is a change in the answer\n"
+ ]
}
],
"prompt_number": 1
@@ -416,19 +944,49 @@
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 2.20,Page 303"
+ "source": [
+ "Example 2.20,Page 303"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#finding difference in elevation \n\n#initialisation of variable\n# part 1\ndelp =1.48/1000.0;\nH =5000.0;\nh =500.0;\nb =90.0/1000.0; #mean principal base\n\n#calculation\ndh =(H-h) **2* delp /((H-h)* delp +b*H);\n\n#result\nprint \" difference in height between two points in(m) \",round(dh,3)\n\n# part 2\n#variable decleration\ndelp =15.5/1000.0;\n\n#calculation\ndh =(H-h) **2* delp /((H-h)* delp +b*H);\n\n#result\nprint \" difference in height between two points in(m) \",round(dh,3)",
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variable\n",
+ "# part 1\n",
+ "delp =1.48/1000.0;\n",
+ "H =5000.0;\n",
+ "h =500.0;\n",
+ "b =90.0/1000.0; #mean principal base\n",
+ "\n",
+ "#calculation\n",
+ "dh =(H-h) **2* delp /((H-h)* delp +b*H);\n",
+ "\n",
+ "#result\n",
+ "print \" difference in height between two points in(m) \",round(dh,3)\n",
+ "\n",
+ "# part 2\n",
+ "#variable decleration\n",
+ "delp =15.5/1000.0;\n",
+ "\n",
+ "#calculation\n",
+ "dh =(H-h) **2* delp /((H-h)* delp +b*H);\n",
+ "\n",
+ "#result\n",
+ "print \" difference in height between two points in(m) \",round(dh,3)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": " difference in height between two points in(m) 65.629\n difference in height between two points in(m) 603.896\n"
+ "text": [
+ " difference in height between two points in(m) 65.629\n",
+ " difference in height between two points in(m) 603.896\n"
+ ]
}
],
"prompt_number": 14
@@ -436,7 +994,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []
diff --git a/Thermodynamics:_A_Core_Course/CH2.ipynb b/Thermodynamics:_A_Core_Course/CH2.ipynb
index 981cbdd9..1adc4757 100644
--- a/Thermodynamics:_A_Core_Course/CH2.ipynb
+++ b/Thermodynamics:_A_Core_Course/CH2.ipynb
@@ -27,21 +27,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 2.1\n",
- "#Find out molar constant pressure heat capacity\n",
- "#Variable Declaration\n",
"m=25.0 \t\t\t\t#weight of water vapour [grams]\n",
"w=18.0 \t\t\t\t#molecular weight of water vapour [grams/mol]\n",
"T=9.69 \t\t\t\t#increase in temperature [K]\n",
"Qp=0.45 \t\t\t#heat supplied at constant pressure[KJ]\n",
- "#To find the molar constant pressure specific heat\n",
"\n",
- "#Calculation\n",
"n=m/w \t\t\t\t#no. of moles of water vapour\n",
"Cp=Qp/(n*T) \t\t\t#specific heat capacity at constant pressure[KJ]\n",
"Cp=Cp*1000\t\t\t#specific heat capacity at constant pressure[J]\n",
"\n",
- "#Result\n",
"print\"The specific heat capacity at constant pressure =\",round(Cp,2),\"J K^-1 mol^-1\""
],
"language": "python",
@@ -69,20 +63,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 2.2\n",
- "#To find the minimum work of compression \n",
"import math\n",
- "#Variable declaration\n",
"m=16.0 \t\t\t\t#weight of oxygen [grams]\n",
"w=32.0 \t\t\t\t#molecular weight of oxygen [grams/mol]\n",
"T=300.0 \t\t\t\t#Temperature during compression [K]\n",
"P1=1.0 \t\t\t\t#initial pressure of process [atm]\n",
"P2=100.0 \t\t\t\t#final pressure of process[atm]\n",
"R=8.314 \t\t\t#Universal gas constant [J/K/mol]\n",
- "#Calculation\t\n",
"n=m/w \t\t\t\t#no. of moles of oxygen\n",
"W=-n*R*T*math.log(P1/P2) \n",
- "#Result\n",
"print\"Mininmum work done to compress oxygen =\",round(W),\"J(approx)\""
],
"language": "python",
diff --git a/Thermodynamics:_A_Core_Course/CH3.ipynb b/Thermodynamics:_A_Core_Course/CH3.ipynb
index b72e6afa..fa64788f 100644
--- a/Thermodynamics:_A_Core_Course/CH3.ipynb
+++ b/Thermodynamics:_A_Core_Course/CH3.ipynb
@@ -27,17 +27,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.1\n",
- "#to find energy transfered in form of heat:\n",
- "#Variable declaration\n",
"V1=14 \t\t\t\t#initial volume of cylinder in m3\n",
"V2=9 \t\t\t\t#final volume of cylinder in m3\n",
"P=2000 \t\t\t\t#pressure during the operation in N/m2\n",
"U=(-6000) \t\t\t#internal energy of the system in J\n",
- "#Calculation\t\n",
"W=-P*(V2-V1) \t\t\t#work done during the operation in J\n",
"Q=U-W \t\t\t\t#energy tranfered in form of heat in J\n",
- "#Result\n",
"print\"energy tranfered in form of heat is\",Q,\"J\"\n",
" "
],
@@ -66,19 +61,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.2\n",
- "#to find the heat lost or gained by the system:\n",
- "#Variable declaration\n",
"R=8.314 \t\t\t\t#universal gas constant [J/K/mol]\n",
"T=300\t\t\t\t\t#temperture for the process [K]\n",
"U=0 \t\t\t\t\t#change in internal energy [J]\n",
"V1=2.28 \t\t\t\t#initial volume [m3]\n",
"V2=4.56 \t\t\t\t#final volume[m3]\n",
- "#Calculation\n",
"import math\n",
"W=2.303*R*T*math.log10(V2/V1) \t\t#work done during the process[J]\n",
"Q=W \t\t\t\t\t#heat lost or gained by the system[J]\n",
- "#Result\n",
"print\"The heat gained by the system is\",round(Q),\"J mol^-1\""
],
"language": "python",
@@ -106,19 +96,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.3\n",
"\n",
- "#to find Q,W,U for 1 mole of bromine vaporizes\n",
- "#Variable declaration\n",
- "#given:\n",
"H=29.2 \t\t\t\t\t#latent heat of vaporisation[KJ/mol]\n",
"T=332 \t\t\t\t\t#temperature of the system[K]\n",
"R=8.314 \t\t\t\t#universal gas constant [J/K/mol]\n",
- "#Calculation\n",
"Qp=H \t\t\t\t\t#at constant pressure [KJ]\n",
"W=-R*0.001*T \t\t\t\t#workdone [KJ]\n",
"U=Qp+W \t\t\t\t\t#change in internal energy[KJ]\n",
- "#Result\n",
"print\"Heat absorbed by the bromine vapours is\",Qp,\"KJ\"\n",
"print\"\\nWorkdone during the process is\",round(W,2),\"KJ\"\n",
"print\"\\nChange in internal energy of the system is\",round(U,2),\"KJ\"\n"
@@ -152,19 +136,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.4\n",
- "#to find change in enthalpy of the process:\n",
"\n",
- "#variable declaration\n",
"print\"C7H16(l) + 11O2(g) -> 7CO2(g) + 8H2O(l)\" \n",
"n=-4 \t\t\t\t#change in no. of moles when reaction proceeds from reactants to \t\t\t\tproducts\n",
"T=298 \t\t\t\t#temperature of the process [K]\n",
"R=8.314 \t\t\t#universal gas constant [J/K/mol]\n",
"Qv=-4800 \t\t\t#heat energy at constant volume [KJ]\n",
- "#Calculation\t\n",
"U=Qv \t\t\t\t#change in internal energy of system [KJ]\n",
"H=U+n*R*0.001*T \t\t#change in enthalpy of the system[KJ]\n",
- "#Result\n",
"print\"the change in enthalpy of system is\",round(H,2),\"kJ\"\n"
],
"language": "python",
@@ -193,19 +172,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.5\n",
- "#to find the Q,W,H\n",
- "#Variable declaration\n",
"n=1 \t\t\t\t#number of moles of an given ideal gas\n",
"T=298 \t\t\t\t#temperature for the process[K]\n",
"V1=8.3 \t\t\t\t#initial volume of the ideal gas[m3]\n",
"V2=16.8 \t\t\t#final volume of the ideal gas[m3]\n",
"R=8.314 \t\t\t#universal gas constant[J#K#mol]\n",
"import math\n",
- "#Calculation\n",
"W=-2.303*R*T*math.log10(V2/V1) #[J]\n",
"Q=-W \t\t\t\t#[J]\n",
- "#Result\n",
"print\"H=U+PV ,where U is change in internal energy which is zero due to isothermal process\" \n",
"print\"PV where V is change in volume of system ,PV=RT & RT==0 since T i.e change in temp is zero for system\" \n",
"print\"Therefore,the change in enthalpy is 0J\" \n",
@@ -242,19 +216,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.6\n",
"\n",
- "##to find the change in enthalpy(H) of water \n",
- "#Variable declaration\n",
"T1=323 \t\t\t#intial temperature of water[K]\n",
"T2=373 \t\t\t#final temperature of water[K]\n",
"Cp=75.29 \t\t#specific heat of water[J/K/mol]\n",
"w=100.0 \t\t\t#weight of water[g]\n",
"mol_wt=18.0 \t\t#molecular weight of water[g/mol]\n",
- "#Calculation\t\n",
"n=w/mol_wt \t\t#no. of moles of water[moles]\n",
"H=(n*Cp*(T2-T1))*0.001 \t#change in enthalpy of water[J]\n",
- "#Result\n",
"print\"The change in enthalpy of water is\",round(H,2),\"kJ\"\n"
],
"language": "python",
@@ -282,17 +251,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.7\n",
- "#to find the change in enthalpy of \treaction(H)\n",
"print\"SO2 + 0.5O2 -> SO3\"\n",
- "#Variable declaration\n",
"U=-97030 \t\t\t#heat of reaction[J]\n",
"n=1-(1+0.5) \t\t\t#change in no. of moles \n",
"R=8.314 \t\t\t#universal gas constant[J/K/mol]\n",
"T=298 \t\t\t\t#temperature during the reaction[K]\n",
- "#Calculation\t\n",
"H=U+n*R*T \t\t\t#change inenthalpy of reaction[J]\n",
- "#result\n",
"print\"The change in enthalpy of reaction is\",round(H),\"J(approx)\"\n"
],
"language": "python",
@@ -321,30 +285,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.8\n",
- "#to find the change in internal energy (U) of given reaction\n",
"print\"i.C(s) + O2(g) -> CO2(g)\"\n",
- "#Variable declaration\n",
"H1=-393.5 \t\t#change in enthalpy [KJ/mol]\n",
"T1=298 \t\t\t#temperature [K]\n",
"n1=0 \t\t\t#change in no. of moles in reaction moving in forward direction\n",
"R=0.008314 \t\t#universal gas constant [KJ/K/mol]\n",
"\n",
- "#Calculation\t\n",
"U1=H1-n1*R*T1 \t\t#change in internal energy [KJ]\n",
"print\"The change in internal energy is\",round(U1,1),\"KJ/mol\"\n",
"\n",
- "#to find the change in internal energy (U) of given reaction\n",
"print\"ii.C(s) + 0.5O2 -> CO(g)\" \n",
- "#Variable declaration\n",
"H2=-110.5 \t\t#change in enthalpy[KJ/mol]\n",
"T2=298 \t\t\t#temperature[K]\n",
"n2=1-0.5 \t\t#change in no. of moles in reaction moving in forward direction\n",
"R=0.008314 \t\t#universal gas constant [KJ/K/mol]\n",
"\n",
- "#Calculation\n",
"U2=H2-n2*R*T2 \t\t#change in internal energy [KJ]\n",
- "#result\n",
"print\"The change in internal energy is\",round(U2,3),\"KJ/mol\""
],
"language": "python",
@@ -375,17 +331,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.9\n",
- "#to find the standard heat of rxn for combustion of 1 mole of C6H6\n",
"print\"The standard heat of combustion of\"\n",
"print\"2C6H6(l)+ 15O2(g)-> 12 CO2(g)+ 6 H2O(l)\" \n",
"print\"H1(standard heat of combustion)=-6536 KJ/mol\" \n",
- "#Variable declaration\n",
"H1=-6536 \t\t\t#standard heat of combustion [KJ/mol]\n",
- "#Calculation\t\n",
"print\"C6H6(l)+ 7.5 O2(g)-> 6 CO2(g)+ 6 H2O(l)\" \n",
"H2=H1/2 \t\t\t#standard heat of combustion[KJ/mol]\n",
- "#Result\n",
"print\"H2(standard heat of combustion for 1 mole of C6H6)=\",H2,\"kJ/mol\"\n"
],
"language": "python",
@@ -417,14 +368,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.10\n",
- "#to find the standard heat of formation of one mole of product\n",
"print\"N2(g)+3H2(g)-> 2NH3(g)\" \n",
- "#Variable declaration\n",
"H=-92.22 \t\t\t#standard heat of reaction [KJ/mol]\n",
- "#Calculation\n",
"H1=H/2 \t\t\t\t#standard heat of formation of 1 mole [KJ/mol]\n",
- "#Result\n",
"print\"H(heat of formation of 1 mole of product)=\",H1,\"kJ mol^-1\"\n"
],
"language": "python",
@@ -453,19 +399,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.11\n",
"\n",
- "#to find the standard heat of reaction\n",
"print\"C2H5OH(l)+3O2(g)->2CO2(g)+3H2O(l)\" \n",
- "#Variable declaration\n",
"T=298 \t\t\t\t#temperature during the reaction[K]\n",
"Hw=-285.83 \t\t\t#standard heat of formation of liquid water [KJ/mol]\n",
"He=-277.69 \t\t\t#standard heat of formation of liquid ethanol[KJ/mol]\n",
"Hco2=-393.51 \t\t\t#standard heat of formation of carbon dioxide[KJ/mol]\n",
"Ho2=0 \t\t\t\t#standard heat of formation of oxygen gas[KJ/mol]\n",
- "#Calculation\t\n",
"H=2*Hco2+3*Hw-He-3*Ho2 \t\t#standard heat of reaction\n",
- "#Result\n",
"print\"H(standard heat of reaction)=\",H,\"kJ\"\n"
],
"language": "python",
@@ -494,19 +435,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.12\n",
"\n",
- "#to find the value of standard heat of formation of CO\n",
"print\"CO(g)+NO(g)->0.5N2(g)+CO2(g)\" \n",
- "#Variable declaration\n",
"Hrxn=-374 \t\t#standard heat of reaction[KJ/mol]\n",
"Hno=90.25 \t\t#standard heat of formation of NO[KJ/mol]\n",
"Hco2=-393.51 \t\t#standard heat of formation of CO2[KJ/mol]\n",
"Hn2=0 \t\t\t#standard heat of formation of N2[KJ/mol]\n",
"T=298 \t\t\t#temperature of reaction [K]\n",
- "#Calculation\n",
"Hco=0.5*Hn2+Hco2-Hno-Hrxn \t#standard heat of formation of CO[KJ/mol]\n",
- "#result\n",
"print\"Hco(standard heat of formation)=\",Hco,\"kJ mol^-1\""
],
"language": "python",
@@ -535,24 +471,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.13\n",
- "#to find the heat of combustion and formation of propylene\n",
"\n",
- "#Variable declaration\n",
- "#(\"C3H6(g)+H2(g)->C3H8(g) H1=-29.6 Kcal\") \n",
- "#(\"C3H8(g)+5O2(g)->3CO2(g)+4H2O(l) H2=-530.6 Kcal\") \n",
- "#(\"C(s)+O2(g)->CO2(g) H3=-94.0 Kcal\") \n",
- "#(\"H2(g)+0.5O2(g)->H2O(l) H4=-68.3 Kcal. \") \n",
"H1=-29.6 \t\t#the standard heat of hydrogenation of gaseous propylene to propane[Kcal]\n",
"H2=-530.6 \t\t#the heat of combustion of propane[Kcal] \n",
"H3=-94.0 \t\t#the heat of formation of carbon dioxide[Kcal]\n",
"H4=-68.3 \t\t#the heat of formation of liquid water[Kcal]\n",
"\n",
- "#Calculation\n",
"\n",
"print\"C3H6(g)+4.5O2(g)->3CO2(g)+3H2O(l)\" \n",
"H5=(3*H3+4*H4)-(H1+H2)#[Kcal]\n",
- "#Result\n",
"print\"\\n H(standard heat of combustion)=\",H5,\"Kcal\"\n",
"print\"3C(s)+3H2(g)->C3H6(g)\" \n",
"H6=-H5+3*H3+3*H4 #[Kcal]\n",
@@ -588,18 +515,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.14\n",
"\n",
- "#to find the heat of formation of N2O5\n",
- "#Variable declaration\n",
"H1=-114.1 \t\t\t#standard heat of reaction:2NO(g)+O2(g)->2NO2(g) [KJ/mol]\n",
"H2=-110.2 \t\t\t#standard heat of reaction:4NO2(g)+O2(g)->2N2O5(g) [KJ/mol]\n",
"H3=180.5 \t\t\t#standard heat of reaction:N2(g)+O2(g)->2NO(g) [KJ/mol]\n",
"\n",
"\t#reacton:N2(g)+2.5O2(g)->N2O5(g)\n",
- "#Calculation\n",
"H4=(2*H1+H2+2*H3)/2 \t\t#standard heat of formation of N2O5[KJ/mol]\n",
- "#Result\n",
"print\"H(standard heat of formation of N2O5)=\",H4,\"kJ/mol\" "
],
"language": "python",
@@ -627,17 +549,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.15\n",
- "#to find the standard heat of formaton of solid sucrose\n",
- "#Variable declaration\n",
"Hc=-5645 \t\t#standard enthalpy of combustion of \t\t\treaction:C12H22O11(s)+12O2(g)->12CO2(g)+11H2O(l) [KJ/mol]\n",
"Hf1=-393.51 \t\t#standard heat of formation of CO2: C(s)+O2(g)->CO2(g) [KJ/mol]\n",
"Hf2=-285.83 \t\t#standard heat of formation of H2O: H2(g)+0.5O2(g)->H2O(l) [KJ/mol]\n",
"\n",
- "#Calculation\n",
"\t#reaction:12C(s)+11H2(g)+5.5O2(g)->C12H22O11(s)\n",
"Hf=12*Hf1+11*Hf2-Hc \t#[KJ/mol]\n",
- "#Result\n",
"print\"Hf(standard heat of formation of solid sucrose)=\",Hf,\"KJ/mol(approx)\""
],
"language": "python",
@@ -665,10 +582,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.16\n",
"\n",
- "#to find the standard heat of formation of NH3 at 400K for same reaction\n",
- "#Variable declaration\n",
"Hf1=-46.11 \t\t\t#standard heat of formation of NH3 at 298K \t\t\t\t#reaction:0.5N2(g)+1.5H2(g)->NH3(g) [KJ/mol]\n",
"Cp1=29.125 \t\t\t#molar heat capacity at constant pressure for N2(g)[J/K/mol]\n",
"Cp2=28.824 \t\t\t#molar heat capacity at constant pressure for H2(g)[J/K/mol]\n",
@@ -676,12 +590,10 @@
"T1=298 \t\t\t\t#initial temperature[K]\n",
"T2=400 \t\t\t\t#final temperature[K]\n",
"\n",
- "#Calculation\n",
"\t\n",
"Cp=Cp3-0.5*Cp1-1.5*Cp2 \t\t#[J/K/mol]\n",
"T=T2-T1 \t\t\t#[K]\n",
"Hf2=Hf1+Cp*0.001*T \t\t#standard heat of formation for NH3 at 400K[KJ/mol]\n",
- "#result\n",
"print\"\\n Hf2(standard heat of formation for NH3 at 400K =\",round(Hf2,3),\"kJ/mol\""
],
"language": "python",
@@ -710,11 +622,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculate heat of formation of H2O\n",
"\n",
"from scipy.optimize import fsolve\n",
"from scipy import integrate\n",
- "#Variable declaration\n",
"dH_298=-241.82 #Std Heat of formation at 298 K [kJ mol^-1]\n",
"dH_298=dH_298*1000 # in [J mol^-1]\n",
"T1=298 #[K]\n",
@@ -732,7 +642,6 @@
"dH_1273=dH_1273/1000\n",
"print\"Heat of formation of H2O(g) at 1000 C=\",round(dH_1273,1),\"kJ mol^-1 (APPROXIMATE)\"\n",
"\n",
- "#NOTE\n",
"print\"NOTE:\"\n",
"print\"Slight variation in answer,because integration is not done precisely in the book\"\n",
"print\"In the book,it is written as:-7497.46 instead of -7504.3\""
@@ -765,16 +674,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.18\n",
- "#to find the C-H bond energy of CH4 from the above bond energies\n",
- "#Variable declaration\n",
"H1=435.0 \t\t\t#bond dissociation energy for: CH4->CH3+H [KJ/mol]\n",
"H2=364.0 \t\t\t#bond dissociation energy for:CH3->CH2+H [KJ/mol]\n",
"H3=385.0 \t\t\t#bond dissociation energy for:CH2->CH+H [KJ/mol] \n",
"H4=335.0 \t\t\t#bond dissociation energy for:CH->C+H [KJ/mol]\n",
- "#Calculation\t\n",
"H=(H1+H2+H3+H4)/4 \t#the bond energy for C-H bond in CH4 [KJ/mol]\n",
- "#Result\n",
"print\"\\n H(the C-H bond energy in CH4)=\",round(H,1),\"kJ/mol\"\n"
],
"language": "python",
@@ -803,20 +707,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.19\n",
"\n",
- "#to find the C-C bond energy in ethane bond\n",
- "#Variable declaration\n",
"H1=-84.68 \t\t\t#heat of formation : 2C(s)+3H2(g)->C2H6(g) [KJ/mol]\n",
"H2=2*716.68 \t\t\t#heat of formation : 2C(s)->2C(g) [KJ]\n",
"H3=3*436 \t\t\t#heat of formation : 3H2(g)->6H(g) [KJ]\n",
"H4=412 \t\t\t\t#taking it as bond energy for one C-H bond[KJ/mol]\n",
"\n",
- "#Calculation\n",
"\n",
"H=H2+H3-H1 \t\t\t#heat of reaction : C2H6(g)->2C(g)+6H(g) [KJ/mol]\n",
"H5=H-6*H4 \t\t\t#bond energy for one C-C bond in ethane bond [KJ/mol]\n",
- "#Result\n",
"print\"\\n Hc-c(bond energy for one C-C bond in ethane bond)=\",H5,\"kJ/mol\"\n"
],
"language": "python",
@@ -845,9 +744,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 3.20\n",
- "#to find the lattice enthalpy of magnesium bromide\n",
- "#Variable declaration\n",
"\t#MgBr2(s)-->Mg(s)+Br2(l)-->Mg(g)+Br2(l)-->Mg(g)+Br2(g)-->Mg(g)+2Br(g)-->Mg+2(g) + 2e(g) + \t2Br(g)-->Mg+2(g) + 2Br-(g)\n",
"H1=-524 \t\t#enthalpy of formation of MgBr2(s) from its element [KJ/mol]\n",
"H2=148 \t\t\t#enthalpy of sublimation of Mg(s) [KJ/mol]\n",
@@ -856,9 +752,7 @@
"H5=2187 \t\t#enthalpy of ionization of Mg(g) to Mg+2(g) [KJ/mol]\n",
"H6=-650 \t\t#enthalpy of formation of Br-(g) [KJ/mol]\n",
"\n",
- "#calculation\n",
"H=-H1+H2+H3+H4+H5+H6 \t#lattice enthalpy [KJ/mol]\n",
- "#Result\n",
"print\"\\n H(lattice enthalpy of magnesium bromide)=\",H,\"kJ/mol\"\n"
],
"language": "python",
@@ -887,24 +781,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculate maximum flame temperature\n",
"\n",
"from scipy.optimize import fsolve\n",
"from scipy import integrate\n",
"\n",
- "#Variable declaration\n",
"\n",
- "#CH4(g)+2*O2(g)--->CO2(g)+2*H2O(l)\n",
"dH1_298=-881.25 #[kJ/mol]\n",
- "#H2O(l)-->H2O(g)\n",
"dH2_298=43.60 #[kJ/mol]\n",
- "#2H2O(l)-->2*H2O(g)\n",
"dH3_298=2*dH2_298 #[kJ/mol]\n",
- "#Adding (1) and (3)\n",
"dH4_298=dH1_298+dH3_298 #[kJ/mol]\n",
"dH_heat=-dH4_298*1000 #[J/mol]\n",
"\n",
- "#CALCULATION\n",
"\n",
"def f(T2):\n",
" def g(T):\n",
diff --git a/Thermodynamics:_A_Core_Course/CH4.ipynb b/Thermodynamics:_A_Core_Course/CH4.ipynb
index f0aec688..faa2aabc 100644
--- a/Thermodynamics:_A_Core_Course/CH4.ipynb
+++ b/Thermodynamics:_A_Core_Course/CH4.ipynb
@@ -27,19 +27,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 4.1\n",
"\n",
- "#to find the mass of substance present in liquid and vapour phase \n",
- "#Variable declaration\n",
"M=2.5 \t\t\t\t#mass of the substance[Kg]\n",
"x=0.6 \t\t\t\t#mass fraction for vapour phase \n",
"P=7 \t\t\t\t#pressure [atm]\n",
"T=438 \t\t\t\t#temperature[K]\n",
"\n",
- "#Calculation\n",
"Ml=(1-x)*M \t\t\t#mass fraction of liquid phase[Kg]\n",
"Mg=x*M \t\t\t\t#mass fraction of vapour phase[Kg]\n",
- "#Result\n",
"print\"M(liquid phase)=\",Ml,\"Kg\\nM(vapour phase)=\",Mg,\"Kg\""
],
"language": "python",
@@ -68,10 +63,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 4.2\n",
"\n",
- "#to find the total volume occupied by the mixture \n",
- "#Variable declaration\n",
"Vl=0.0177 \t\t\t#specific volume of saturated liquid[m3/Kg]\n",
"Vg=4.43 \t\t\t#specific volume of saturated vapour[m3/Kg]\n",
"P=7 \t\t\t\t#pressure[atm]\n",
@@ -79,9 +71,7 @@
"x=0.6 \t\t\t\t#fraction of vapour phase\n",
"M=2.5 \t\t\t\t#mass of the substance[Kg]\n",
"\n",
- "#Calculation\n",
"V=((1-x)*Vl+x*Vg)*M \t\t#total volume occupied [m3]\n",
- "#result\n",
"print\"Total volume occupied =\",round(V,2),\"m^3\"\n"
],
"language": "python",
@@ -109,17 +99,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 4.3\n",
"\n",
- "#to find the total internal energy of the mixture\n",
- "#Variable declaration\n",
"M=2.5 \t\t\t\t#mass of a substance[Kg]\n",
"x=0.6 \t\t\t\t#fraction of vapour phase \n",
"Ug=1105.0 \t\t\t#specific internal energy of saturated vapour[J/Kg]\n",
"Ul=298.0 \t\t\t\t#specific internal energy of saturated liquid[J/Kg] \n",
- "#Calculation\n",
"U=M*((1-x)*Ul+x*Ug) \n",
- "#Result\n",
"print\"The total internal energy of the mixture =\",U,\"J\"\n",
"print\"\\nNOTE:In textbook,it is wrongly calculated as 1950 J\"\n",
" "
diff --git a/Thermodynamics:_A_Core_Course/CH5.ipynb b/Thermodynamics:_A_Core_Course/CH5.ipynb
index 865af391..2b811195 100644
--- a/Thermodynamics:_A_Core_Course/CH5.ipynb
+++ b/Thermodynamics:_A_Core_Course/CH5.ipynb
@@ -27,19 +27,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.1\n",
"\n",
- "#to find the workdone , heat rejected , and efficiency of the engine\n",
- "#Variable declaration\n",
"T1=373.0 \t\t\t\t#initial temperature [K]\n",
"T2=573.0 \t\t\t\t#final temperature [K]\n",
"Q2=750.0 \t\t\t\t#Heat absorbed by carnot engine[J]\n",
"\n",
- "#Calculation\n",
"e=(T2-T1)/T2 \t\t\t#efficiency of the engine\n",
"W=e*Q2 \t\t\t\t#Workdone by the engine[J]\n",
"Q1=T1*Q2/T2 \t\t\t#Heat rejected by the engine[J]\n",
- "#Result\n",
"print\"Efficiency of the engine =\",round(e,3) \n",
"print\"\\n Workdone by the engine =\",round(W),\"J\"\n",
"print\"\\n Heat rejected by the engine =\",round(Q1),\"J\"\n"
@@ -73,15 +68,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.2\n",
- "#to analyse the efficiency of the engine \n",
"\n",
- "#Variable declaration\n",
"T1=250.0 #temperature of heat rejection[K]\n",
"T2=1000.0 #temperature of heat absorption[K]\n",
- "#Calculation\n",
"e=1-(T1/T2) \n",
- "#Result\n",
"print\"Efficiency of the corresponding carnot engine =\",e,\"or\",e*100,\"%\"\n",
"print\" Therefore , the inventors claim of 80% efficiency is absurd.The patent application should be rejected\" \n"
],
@@ -111,16 +101,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.3\n",
- "#To find the minimum heat required from heat source to yield the above work\n",
- "#Variable declaration\n",
"T1=323.0 \t\t\t\t#temperature [K]\n",
"T2=423.0 \t\t\t\t#temperature [K]\n",
"W=1.3 \t\t\t\t#work [KJ]\n",
- "#Calculation\n",
"e=(T2-T1)/T2 \t\t\t#efficiency\n",
"Q2=W/e \t\t\t\t#minimum heat withdrawal from heat source[KJ]\n",
- "#Result\n",
"print\"Minimum heat withdrawal from heat source=\",round(Q2,2),\"kJ\""
],
"language": "python",
@@ -148,18 +133,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.5\n",
- "#to find the molar entropy change \n",
- "#Variable declaration\n",
"T=298 \t\t\t#Temperature [K]\n",
"n=1 \t\t\t#no. of moles\n",
"V1=500 \t\t\t#initial volume [cm3]\n",
"V2=1000 \t\t#final volume [cm3]\n",
"R=8.314 \t\t#Universal gas constant [J/mol/K]\n",
"import math\n",
- "#Calculation\n",
"S=R*math.log(V2/V1)\t\t#molar entropy change at constant temperature[J/K]\n",
- "#Result\n",
"print\"Molar entropy change of argon =\",round(S,1),\"J/K\"\n"
],
"language": "python",
@@ -187,16 +167,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.6 \n",
"\n",
- "#to find the change in molar entropy when the gas expands isothermally and reversibly\n",
- "#Variable declaration\n",
"W=1728.0 \t\t\t#Isothermal and reversible work done[J/mol]\n",
"T=298.0 \t\t\t#Isothermal temperature[K]\n",
- "#Calculation\n",
"\n",
"S=W/T \t\t\t#change in molar entropy for isothermal and reversible process\n",
- "#result\n",
"print\"The change in molar entropy =\",round(S,1),\"JK^-1mol^-1\"\n"
],
"language": "python",
@@ -224,17 +199,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.7\n",
"\n",
- "#To find the change in entropy of the surroundings at 298K\n",
- "#Variable declaration\n",
"H=-92.22 \t\t\t#Standard reaction enthalpy[KJ]\n",
"T=298 \t\t\t\t#Temperature [K]\n",
"\n",
- "#Calculation\t\n",
"\t#standard reaction enthalpy is H.Therefore, heat gained by the surroundings at 298K is -H\n",
"S=-H*1000/T \t\t\t#Change in entropy[J/K]\n",
- "#Result\n",
"print\"Change in entropy of the surroundings at 298k =\",round(S,1),\"J/K\"\n"
],
"language": "python",
@@ -262,19 +232,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.8\n",
"\n",
- "#To find the change in entropy for argon gas\n",
- "#Variable declaration\n",
"T1=298.0 \t\t\t\t#Initial Temperature[K]\n",
"T2=573.0 \t\t\t\t#Final Temperature[K]\n",
"Cv=29.1 \t\t\t#Specific Heat capacity of argon gas [J/K/mol]\n",
"n=1 \t\t\t\t#no. of moles\n",
"\n",
"import math\n",
- "#calculation\n",
"S=n*Cv*math.log(T2/T1) \t\t#Change in entropy [J/K]\n",
- "#Result\n",
"print\"The change in entropy of the argon gas is\",round(S,2),\"J/K\"\n",
"\n"
],
@@ -303,10 +268,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.9\n",
"\n",
- "#To find the total entropy change of solid\n",
- "#Variable declaration\n",
"T1=276.0 \t\t\t\t#Initial temperature[K]\n",
"Tf=278.7 \t\t\t#Freezing point temperature[K]\n",
"Tb=353.3 \t\t\t#Boiling point temperature[K]\n",
@@ -318,7 +280,6 @@
"mass=200.0\t\t\t#weight of solid benzene[g]\n",
"print\"Cp doesnot change within this temp limit\" \n",
"import math\n",
- "#calculation\n",
"n=mass/mol_wt \t\t\t#no. of moles\n",
"\n",
"S1=n*Cp*math.log(Tf/T1) \t#entropy change in heating [J/K]\n",
@@ -327,7 +288,6 @@
"S4=n*Hv/Tb \t\t\t#entropy change in vaporization[J/K]\n",
"S5=n*Cp*math.log(T2/Tb) \t#entropy change in heating[J/K]\n",
"S=S1+S2+S3+S4+S5 \t\t#total entropy change in heating from 276 to 373K\n",
- "#Result\n",
"print\"Total entropy change in heating 200g benzene from 3 to 100`C is\",round(S,1),\"J/K or\",round(S/1000,3),\"KJ/K\"\n",
"print\"\\nNOTE:In textbook the value of 'n' is wrongly calculated as 25.64 instead of 2.564,SO there is a error in answer shown in book\" "
],
@@ -359,22 +319,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.10\n",
- "#To find the change in entropy of the gas\n",
- "#Isothermal process\n",
- "#Variable declaration\n",
"mass=32 \t\t\t#weight of methane gas[gm]\n",
"P1=6*10**5 \t\t\t#Initial temperature[N/m2]\n",
"P2=3*10**5 \t\t\t#Final pressure[N/m2]\n",
"mol_wt=16 \t\t\t#molecular weight of methane gas[g/mol]\n",
"T=298 \t\t\t\t#Temperature[K]\n",
- "#calculation\t\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
"import math\t\n",
"n=mass/mol_wt \t\t\t#no. of moles\n",
"S=n*R*math.log(P1/P2) \t\t#change in entropy of gas[J/K]\n",
"\n",
- "#Result\n",
"print\"The change in entropy of the gas is\",round(S,2),\"J/K\""
],
"language": "python",
@@ -402,37 +356,25 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Calculate:\n",
- "#1.Total no. og possible configuration\n",
- "#2.Probability of getting a configuration\n",
- "#3.Total energy and average energy of the system\n",
- "#4.Change in energy of the system\n",
"\n",
"import math\n",
- "#Variable declaration\n",
"black=2 #No. of black balls\n",
"white=1 #No. of white ball\n",
"\n",
- "#CALCULATION\n",
"\n",
- "#Total no. of config\n",
"W=math.factorial(black+white)/(math.factorial(black)*math.factorial(white))\n",
- "#Probability of getting a config\n",
"P=1.0/W\n",
- "#Total and Average energy of system\n",
"E1=0+1+2\n",
"E2=E1\n",
"E3=E2\n",
"E=E1+E2+E3\n",
"E_av=E/3\n",
- "#Change in total energy of system\n",
"E1_dash=1+2+3\n",
"E2_dash=E1_dash\n",
"E3_dash=E2_dash\n",
"E_dash=E1_dash+E2_dash+E3_dash\n",
"change=E_dash-E\n",
"\n",
- "#RESULT\n",
"print\"1.Total No. of possible configuration:\",W\n",
"print\"2.Probability of getting a configuration=\",P,\"or 1/3\"\n",
"print\"3.Total energy of system=\",E\n",
@@ -470,20 +412,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.12\n",
"\n",
- "#To find the relative number of distinguishable quantum states in 1 mole of water and ice at 273K \n",
- "#Variable declaration\n",
"n=1.0 \t\t\t#no. of moles\n",
"T=273.0 \t\t\t#temperature [K]\n",
"Hf=6000.0 \t\t#enthalpy of fusion at 273K [J/mol]\n",
"k=1.38*(10**-23) \t#boltzmann constant[J/K]\n",
"\n",
- "#calculation\n",
"p=Hf/(k*T)/2.303 \n",
"print\"\\nTHE RESULT IS 10^24,which is too large to be displayed by ipython \"\n",
- "#w=10**(p) \t\t#w is the relative no. of distinguishable quantum states\n",
- "#Result\n",
"print\"This value of w is very large to calculate for python,because it's in the range of 10^24\"\n",
"print\"The relative no. of distinguishable quantum states in 1 mole of water and ice at 273K is 10^24\" \n",
"print\"\\nTHE RESULT IS 10^24,which is too large to be displayed by ipython \"\n",
@@ -519,19 +455,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.13\n",
"\n",
- "#To find the total entropy change of solid\n",
- "#Variable declaration\n",
"T=300 \t\t\t#temperature[K]\n",
"n=4 \t\t\t#no. of moles of an ideal gas\n",
"P1=2.02*10**5 \t\t#initial pressure[N/m2]\n",
"P2=4.04*10**5 \t\t#final pressure[N/m2]\n",
"R=8.314 \t\t#Universal gas constant[J/K/mol]\n",
"import math\n",
- "#calculation\n",
"G=n*R*T*2.303*math.log10(P2/P1) \t#[J]\n",
- "#Result\n",
"print\" The change in Gibbs free energy is\",round(G,1),\"J\"\n"
],
"language": "python",
@@ -559,20 +490,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.14\n",
"\n",
- "#To find the work function or Helmholts free energy\n",
- "##Variable declaration\n",
"n=1 \t\t\t#no. of moles\n",
"T=300 \t\t\t#temperature[K]\n",
"V1=2 \t\t\t#initial volume[m3]\n",
"V2=20 \t\t\t#final volume[m3]\n",
"R=8.314 \t\t#Universal gas constant[J/K/mol]\n",
"import math\n",
- "#calculation\n",
"\t\n",
"A=-n*R*T*2.303*math.log10(V2/V1) \t#Change in work function[J/mol]\n",
- "#Result\n",
"print\"The change in Helmholts free energy is\",round(A),\"J/mol\""
],
"language": "python",
@@ -600,23 +526,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.15\n",
- "#To find the energy change that can be extracted as heat and work \n",
"print\"C6H12O6(s) + 6O2(g) --> 6CO2(g) + 6H2O(l)\"\n",
- "#Variable declaration\n",
"T=298 \t\t\t\t#Temperature[k]\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
"S=182.45 \t\t\t#standard entropy change at 298K [J/K]\n",
"U=-2808 \t\t\t#change in internal energy at 298K[KJ/mol]\n",
"\t#reaction is taking place in bomb calorimeter so no volume change \n",
"\t#therefore U=Q at constant volume\n",
- "#calculation\n",
"\t\n",
"A=U-T*S*0.001 \t\t\t#Energy extracted as heat[KJ/mol]\n",
"Wmax=A \t\t\t\t#work done [KJ/mol]\n",
"dn=6-6 \t\t\t\t#change in no. of moles\n",
"H=U+dn*R*T \t\t\t#Change in enthalpy of the bomb calorimeter[KJ]\n",
- "#Result\n",
"print\"The energy change that can be extracted as heat is\",round(A),\"KJ/mol\"\n",
"print\"\\nThe energy change that can be extracted as work is\",round(-A),\"KJ/mol\"\n",
"print\"\\nThe change in enthalpy of bomb calorimeter is\",round(H),\"KJ/mol\"\n"
@@ -651,10 +572,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.16\n",
"\n",
- "#To find the helmholts free energy and Gibbs free energy\n",
- "#Variable declaration\n",
"print\"C8H18(g)+12.5O2(g)-->8CO2(g)+9H2O(l)\" \n",
"\n",
"T=298.0 \t\t\t\t#temperature[K]\n",
@@ -662,12 +580,10 @@
"H=-5109000.0 \t\t\t#Heat of reaction[J]\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
"dn=8-(1+12.5) \t\t\t#change in no. of moles\n",
- "#calculation\n",
"\n",
"U=H \t\t\t\t#[J]\n",
"A=U-T*S \t\t\t#Change in helmholts free energy[J]\n",
"G=A+dn*R*T \t\t\t#Change in Gibbs free energy[J]\n",
- "#Result\n",
"print\"The change in Helmholts free energy is\",round(A),\"J\"\n",
"print\"\\nThe change in Gibbs free energy is\",round(G),\"J\"\n",
"print\"The calculation is not precise in book,that's why a slight change in answer\""
@@ -701,10 +617,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.17\n",
- "#To find the Helmholts free energy and Gibbs free energy\n",
"print\"C3H6(g)+4.5O2(g)-->3CO2(g)+3H2O(l)\" \n",
- "##Variable declaration\n",
"S=-339.23 \t\t\t#standard change in entropy [J/K]\n",
"T=298 \t\t\t\t#temperature[K]\n",
"Hf1=20.42 \t\t\t#enthalpy of formation of C3H6(g)[J]\n",
@@ -712,13 +625,11 @@
"Hf3=-285.83 \t\t\t#enthalpy of formation of H2O(l)[J]\n",
"dn=3-4.5-1 \t\t\t#change in no. of moles\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
- "#calculation\n",
"\n",
"H=3*Hf2+3*Hf3-Hf1 \t\t#Enthalpy of the reaction[J]\n",
"U=H-dn*R*0.001*T \t\t#Change in internal energy of the reaction[J]\n",
"A=U-T*S*0.001 \t\t\t#Helmholts free energy change[J]\n",
"G=A+dn*R*0.001*T \t\t#Gibbs free energy change[J]\n",
- "#Result\n",
"print\"The change in Helmholts free energy is\",round(A,2),\"kJ\"\n",
"print\"\\nThe change in Gibbs free energy is\",round(G,2),\"kJ\""
],
@@ -750,22 +661,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.19\n",
- "#To find the total entropy change\n",
"print\"CH4(g)+2O2(g)-->CO2(g)+2H2O(l)\"\n",
"\n",
- "#Variable declaration\n",
"S1=-242.98 \t\t\t\t#standard entropy change for the combustion reaction[J/K]\n",
"Hf1=-74.81 \t\t\t\t#Enthalpy of formation of CH4(g)[KJ/mol]\n",
"Hf2=-393.51 \t\t\t\t#Enthalpy of formation of CO2(g)[KJ/mol]\n",
"Hf3=-285.83 \t\t\t\t#Enthalpy of formation of H2O(l)[KJ/mol]\n",
"T=298 \t\t\t\t\t#temperature[K]\n",
- "#calculation\n",
"\t \n",
"H=Hf2+2*Hf3-Hf1 \t\t\t#Change in enthalpy of reaction[KJ]\n",
"S2=-H*1000/T \t\t\t\t#Change in entropy of the surrounding[J/K]\n",
"Stotal=(S1+S2)*0.001 \t\t\t#Total entropy change \n",
- "#Result\n",
"print\"The total change in entropy is\",round(Stotal,2),\"KJ/K\"\n"
],
"language": "python",
@@ -794,19 +700,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.20\n",
- "#To find the spontanity of the reaction\n",
"print\"2H2(g)+O2(g)-->2H2O(l)\" \n",
- "##Variable declaration\n",
"Hf1=-285.83 \t\t\t\t#standard enthalpy of formation of H2O(l)[KJ/mol]\n",
"S=-327 \t\t\t\t\t#Standard entropy change for the same reaction[J/K]\n",
"T=298 \t\t\t\t\t#temperature[K]\n",
"\n",
- "#calculation\n",
"\t\n",
"H=2*Hf1-0-0 \t\t\t\t#Enthalpy of the reaction[KJ/mol]\n",
"G=H-T*S*0.001 \t\t\t\t#Change in Gibbs free energy[KJ]\n",
- "#Result\n",
"print\"The change in Gibbs free energy is\",round(G,2),\"KJ\\n \"\n",
"print\"As change in Gibbs free energy is negative.Therefore,the reaction is spontaneous\"\n"
],
@@ -838,22 +739,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.21\n",
"\n",
"\n",
- "#To find the standard enthalpy of reaction \n",
"print\"CH4(g)+2O2(g)-->CO2(g)+2H2O(l)\" \n",
- "#Variable declaration\n",
"S=-242.98 \t\t\t#standard entropy change for reaction [J/K]\n",
"T=298 \t\t\t\t#temperature[K]\n",
"Gf1=-50.72 \t\t\t#standard Gibbs free energy of formation for CH4(g)[KJ/mol]\n",
"Gf2=-394.36 \t\t\t#standard Gibbs free energy of formation for CO2(g)[KJ/mol]\n",
"Gf3=-237.13 \t\t\t#standard Gibbs free energy of formation for H2O(l)[KJ/mol]\n",
- "#calculation\n",
"\n",
"G=Gf2+2*Gf3-Gf1 \t\t#Standard Gibbs free energy for reaction[KJ/mol]\n",
"H=G+T*S*0.001 \t\t\t#Standard enthalpy of reaction [KJ]\n",
- "#Result\n",
"print\"The standard enthalpy of reaction is\",round(H,2),\"kJ\"\n"
],
"language": "python",
@@ -882,22 +778,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.22\n",
- "#To find the maximum energy that can be extracted as non-expansion work is equal to the change in free energy of the system\n",
"print\"C6H12O6(s)+6O2(g)-->6CO2(g)+6H2O(l)\"\n",
- "#Variable declaration\n",
"mass=25.0 \t\t\t#mass of glucose for combustion under standard condition[gm]\n",
"T=298 \t\t\t\t#temperature[K]\n",
"Gf1=-910 \t\t\t#Standard Gibbs free energy of formation for C6H12O6[KJ/mol]\n",
"Gf2=-394.4 \t\t\t#Standard Gibbs free energy of formation for CO2(g)[KJ/mol]\n",
"Gf3=-237.13 \t\t\t#Standard Gibbs free energy of formation for H2O(l)[KJ/mol]\n",
"mol_wt=180.0 \t\t\t#molecular weight of glucose[gm/mol]\n",
- "#calculation\n",
"\t\n",
"G=6*Gf2+6*Gf3-Gf1\n",
"n=mass/mol_wt \t\t\t#no. of moles\n",
"Gactual=G*n \t\t\t#Gibbs free energy for the combustion of 0.139mol of glucose \n",
- "#Result\n",
"print\"The energy that can be extracted as non-expansion work is\",round(-Gactual),\"KJ\" \n"
],
"language": "python",
@@ -926,16 +817,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.23\n",
- "#To find the value of the inversion temperature for the gas\n",
- "#Variable declaration\n",
"a=1.39*10**-2 \t\t#constant for a vanderwaal's gas[lit2.atm/mol2]\n",
"b=3.92*10**-2 \t\t#constant for a vanderwaal's gas[lit2.atm/mol2]\n",
"R=0.082 \t\t#Universal gas constant[lit.atm/deg/mol]\n",
- "#calculation\n",
"\t\n",
"Ti=(2*a)/(R*b) \t\t#inversion temperature [K]\n",
- "#Result\n",
"print\"The inversion temperature for the gas is\",round(Ti,3),\" K\"\n"
],
"language": "python",
@@ -963,19 +849,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.26\n",
- "#To find the Enthalpy of vaporization of ethylene\n",
- "#Variable declaration\n",
"T=169.25 \t\t\t#Boiling point[K]\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
"print\"dlnP/dT=He/R*T**2\" \n",
"print\"dlnP/dT=(2.303*834.13/T**2)+(1.75/T)-(2.30*8.375*10**-3)\" \n",
"print\"Therefore using these two equations we calculate the He(enthalpy) of ethylene\" \n",
- "#calculation\n",
"\n",
"x=(2.303*834.13/T**2)+(1.75/T)-(2.30*8.375*10**-3) #it is dlnP/dT\n",
"He=R*0.001*T**2*x #Enthalpy of vaporization[J/mol]\n",
- "#Result\n",
"print\"\\n\\nThe Enthalpy of vaporization of ethylene at its boiling point is\",round(He,3),\"KJ/mol\"\n",
"\n"
],
@@ -1009,21 +890,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.27\n",
- "#To find the boiling point of b/enzene at 60KPa\n",
"\n",
- "#Variable declaration\n",
"P1=101.3 \t\t\t#Initial Pressure[KPa]\n",
"P2=60 \t\t\t\t#Final Pressure[KPa]\n",
"He=31.8 \t\t\t#Enthalpy of vaporization[KJ/mol]\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
"T1=353.2 \t\t\t#boiling point of benzene at 101.3KPa[K]\n",
"import math\n",
- "#calculation\n",
"\n",
"x=(T1**-1)-(R*0.001*math.log(P2/P1)/He) \n",
"T2=x**-1 \t\t\t#Boiling point of benzene at 60KPa\n",
- "#Result\n",
"print\"The boiling point of benzene at 60KPa is\",round(T2,1),\"K\""
],
"language": "python",
@@ -1051,24 +927,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.28\n",
"\n",
- "#To find the molar enthalpy of vapourization\n",
- "##Variable declaration\n",
"P1=0.016 \t\t\t#Vapour pressure of pure ethanol at 273K[bar]\n",
"P2=0.470 \t\t\t#Vapour pressure of pure ethanol at 333K[bar]\n",
"T1=273 \t\t\t\t#initial temperature [K]\n",
"T2=333 \t\t\t\t#final temperature[K]\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
"P=1.01 \t\t\t\t#vapour pressure at normal boiling point[bar]\n",
- "#calculation\n",
"import math\n",
"\t\n",
"x=(T2**-1)-(T1**-1) \n",
"He=-R*0.001*math.log(P2/P1)/x \t#molar enthalpy of vaporization[J/mol]\n",
"t=(T2**-1)-(R*0.001*math.log(P/P2)/He) \n",
"T=(t**-1)-273 \t\t\t#normal boiling point [C]\n",
- "#Result\n",
"print\"\\n\\nThe normal boiling point for pure ethanol is \",round(T,1),\"C\"\n",
"print\"The molar enthalpy of vapourization is\",round(He,2),\"J/mol\""
],
@@ -1100,10 +971,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.29\n",
"\n",
- "#To find the vapour pressure of benzene at 298K\n",
- "#Variable declaration\n",
"T2=353.2 \t\t\t#normal boiling point of benzene at 1.01325bar[K]\n",
"T1=298\t \t\t\t#temperature [K]\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
@@ -1112,13 +980,11 @@
"\t#benzene obey's Trouton's rule\n",
"print\" from Troutons rule , \" \n",
"print\" He/Tb=85J/K/mol\" \n",
- "#calculation\n",
"\n",
"He=85*T2 \t\t\t#molar enthalpy of vapourization[J/K/mol]\n",
"x=(T2**-1)-(T1**-1) \n",
"t=-He*x/R \n",
"P1=P2/math.exp(t) \n",
- "#Result\n",
"print\"\\nThe vapour pressure of benzene at 298K is\",round(P1,3),\" bar\"\n"
],
"language": "python",
@@ -1149,15 +1015,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.30\n",
- "#To find the degrees of freedom \n",
- "#Variable declaration\n",
"c=1 \t\t\t#no. of components(only CO2)\n",
"p=2 \t\t\t#no. of phases(liquid + gas)\n",
- "#calculation\n",
"\n",
"F=c-p+2 \t\t#degree of freedom\n",
- "#Result\n",
"print\"Degrees of freedom is\",F \n",
"print\"Degrees of freedom 1 means that either pressure or temperature can be varied independently,i.e.when temperature is fixed,pressure is automatically fixed\" "
],
@@ -1187,16 +1048,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.31\n",
"\n",
- "#To find the values of degrees of freedom\n",
- "#Variable declaration\n",
"c=1 \t\t\t#no. of components\n",
"p=1 \t\t\t#no. of phases\n",
- "#calculation\n",
"\n",
"F=c-p+2 \t\t#Degrees of freedom\n",
- "#Result\n",
"print\"Degrees of freedom,F is\",F \n",
"print\"Degrees of freedom 2 means both the pressure and temperature can be varied independently\" \n",
"\n",
@@ -1228,16 +1084,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.32\n",
"\n",
- "#To find the mole fraction of sucrose,so that the vapour pressure of water will be lowered by dP\n",
- "#Variable declaration\n",
"P=1.75*10**-5 \t\t\t#Vapour pressure of pure water at 293K[torr]\n",
"dP=1.1*10**-7 \t\t\t#Lowering in vapour pressure of water\n",
- "#calculation\n",
"\n",
"x=dP/P \t\t\t\t#mole fraction of sucrose\n",
- "#Result\n",
"print\"The mole fraction of sucrose is\",round(x,6) \n",
"\n",
"\n"
@@ -1267,18 +1118,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.33\n",
"\n",
- "#To find the partial vapour pressure of benzene over the solution\n",
- "#Variable declaration\n",
"P=94.6 \t\t\t\t#The vapour pressure of pure benzene at 298K[torr]\n",
"n1=20.0 \t\t\t\t#no. of moles of pure benzene\n",
"n2=5.0 \t\t\t\t#no. of moles of pure naphthalene\n",
- "#calculation\n",
"\n",
"x=n1/(n1+n2) \t\t\t#(mole fraction of benzene)\n",
"p=x*P \t\t\t\t#the partial vapour pressure of benzene[torr]\n",
- "#Result\n",
"print\"The partial vapour pressure of benzene is\",p,\"torr\""
],
"language": "python",
@@ -1306,17 +1152,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.34\n",
- "#To find the reduction in chemical potential\n",
- "#Variable declaration\n",
"x=0.28 \t\t\t\t#mole fraction of solute\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
"T=298 \t\t\t\t#temperature[K]\n",
"import math\n",
- "#calculation\n",
"\n",
"du=R*T*math.log(1-x) \t\t#reduction in chemical potential[J/mol]\n",
- "#Result\n",
"print\"The reduction in chemical potential is\",round(-du,1),\"J/mol\"\n"
],
"language": "python",
@@ -1344,17 +1185,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.35\n",
- "#To find the boiling point of the solution which is made by dissolving 155g of glucose in 1000g of water\n",
- "#Variable declaration\n",
"Kb=0.51 \t\t\t#ebullioscopic constant of water [K*Kg/mol]\n",
"n=155.0/180.0 \t\t\t#no. of moles of glucose\n",
"m=n/1 \t\t\t\t#[mol/Kg]\n",
"Ti=373.0 \t\t\t\t#Boiling point temperature of water[K]\n",
- "#calculation\n",
"\n",
"Tf=(Ti+Kb*m)-273 \t\t#boiling point temperature of the solution[C]\n",
- "#Result\n",
"print\"The boiling point of the solution is\",round(Tf,2),\"degree C\""
],
"language": "python",
@@ -1382,20 +1218,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.36\n",
"\n",
- "#To find the molar mass of solute(M2)\n",
- "#Variable declaration\n",
"Ti=5.44 #freezing point of pure benzene[K]\n",
"Tf=4.63 #freezing point of solution[K]\n",
"m1=2.12 #mass of the solute[gm]\n",
"m2=125.0 #mass of the benzene[gm]\n",
"Kf=5.12 #cryoscopic constant of pure benzene[K*Kg/mol]\n",
- "#calculation\n",
"\n",
"dTf=Ti-Tf \t#depression in freezing point[K]\n",
"M2=(m1*1000*Kf)/(m2*dTf) #molar mass of solute\n",
- "#Result\n",
"print\"The molar mass of solute is\",round(M2),\"(approx)\"\n"
],
"language": "python",
@@ -1423,20 +1254,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.38\n",
- "#To find the Kp value of the above reaction\n",
"print\"N2(g)+3H2(g)<=>2NH3(g)\"\n",
- "#Variable declaration\n",
"T=298 \t\t\t#Temperature[K]\n",
"Gf1=-16450 \t\t#Gibb's free energy of formation for NH3(g)[J/mol]\n",
"R=8.314 \t\t#Universal gas constant[J/K/mol]\n",
"import math\t\n",
- "#calculation\n",
"\t\n",
"Gf=2*Gf1\t\t\t#Gibb's free energy for the reaction[KJ]\n",
"x=Gf/R/T\n",
"Kp=math.exp(-x) \n",
- "#Result\n",
"print\"The Kp for above reaction is\",round(Kp),\"or 5.85*10^5,in scientific notation(APPROX)\" "
],
"language": "python",
@@ -1465,10 +1291,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.39\n",
- "#To find the reaction Gibb's energy\n",
"print\"0.5N2(g)+1.5H2(g)<=>NH3(g)\" \n",
- "#Variable declaration\n",
"T=298 #Temperature[K]\n",
"Kp=900 #Equilibrium constant for above reaction\n",
"P1=0.32 #partial pressure of N2(g)[bar]\n",
@@ -1476,13 +1299,11 @@
"P3=0.98 #partial pressure of NH3(g)[bar]\n",
"R=8.314 #Universal gas constant[J/K/mol]\n",
"import math\n",
- "#calculation\n",
"\n",
"G=-R*T*math.log(Kp) \n",
"x=(P1**0.5)*(P2**1.5) \n",
"p=P3/x \n",
"Gr=(G+R*T*math.log(p))*0.001 \n",
- "#Result\n",
"print\"The reaction Gibbs free energy is\",round(Gr*1000),\"J/mol \""
],
"language": "python",
@@ -1511,24 +1332,19 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.40\n",
- "#To find the Kp at 423K temperature\n",
"print\"N2(g)+3H2(g)<=>2NH3(g)\"\n",
"\n",
- "#Variable declaration\n",
"Kp1=5.85*10**5 #equilibrium constant at 298K\n",
"H1=-46.11 #standard enthalpy of formation of NH3(g)[KJ/mol]\n",
"T1=298 #Initial temperature[K]\n",
"T2=423 #Final temperature[K]\n",
"R=8.314 #Universal gas constant[J/K/mol]\n",
- "#calculation\n",
"import math\n",
"\n",
"H=2*H1 #enthalpy for reaction [KJ]\n",
"t=(T1**-1)-(T2**-1) \n",
"x=-H*t/(R*0.001) \n",
"Kp2=Kp1*math.exp(x) \n",
- "#Result\n",
"print\"The Equilibrium constant for reaction at 423K is\",round(Kp2) \n"
],
"language": "python",
@@ -1557,11 +1373,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.41\n",
- "#To find the Standard Free energy and equilibrium constant \n",
"print\"Zn(s)|ZnCl2(aq)||CdSO4(aq)|Cd(s)\"\n",
- "#For Zn(s)|ZnCl2(aq)||CdSO4(aq)|Cd(s)\n",
- "#Variable declaration\n",
"T=298.0 \t\t\t#Temperature[K]\n",
"R=8.314 \t\t#Universal gas constant[J/K/mol]\n",
"E1=-0.7618 \t\t#Standard electrode potential for Zn2+/Zn [volts]\n",
@@ -1570,25 +1382,18 @@
"n=2.0 \t\t\t#no. of electrons balancing\n",
"\n",
"Ei=E2-E1 \t\t#Standard potential for the reaction[volts]\n",
- "#calculation\n",
"import math\n",
"Gi=-n*F*Ei \t\t#Standard Gibb's Free Energy [KJ/mol] \n",
"Ki=math.exp(-Gi/R/T) \t#Equilibrium constant\n",
- "#Result\n",
"print\"The Free energy for the rection is\",Gi*0.001,\"KJ/mol\"\n",
"print\"The value of equilibrium constant is\",Ki \n",
"\n",
- "#To find the standard free energy and equilibrium constant\n",
- "#Variable declaration\n",
"print\"Cd(s)|CdSO4(aq),Hg2SO4(s)|Hg(l)\" \n",
- "#For Cd(s)|CdSO4(aq),Hg2SO4(s)|Hg(l)\n",
"E3=0.6141 \t\t#Standard electrode potential for Hg2SO4(s),SO4^2-/Hg(l) [volts]\n",
- "#calculation\n",
"\n",
"Eii=E3-E2 \t\t#Standard potantial for the reaction[volts]\n",
"Gii=-n*F*Eii \t\t#Standard Gibb's free energy[KJ/mol]\n",
"Kii=math.exp(-Gii/R/T) \t#Equilibrium constant\n",
- "#Result\n",
"print\"The Free energy for the rection is\",round(Gii*0.001,1),\"KJ/mol\"\n",
"print\"The value of equilibrium constant is\",Kii\n",
"print\"PLEASE REDO the last line calculation,It is showing wrong result in my PC\"\n"
@@ -1624,9 +1429,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.42\n",
- "#To find the overall e.m.f of the above cell\n",
- "#Variable declaration\n",
"print\"Zn(s)|ZnCl2(soln)||AgCl(s)|Ag-Ag|AgCl(s)|ZnCl2(soln)|Zn(s)\" \n",
"\n",
"m1=0.02 \t\t\t#concentration[M]\n",
@@ -1637,10 +1439,8 @@
"T=298 \t\t\t\t#Temperature [K]\n",
"F=96500 \t\t\t#Faraday's constant[coulomb/mol]\n",
"import math\n",
- "#calculation\n",
"\t\n",
"E=R*T*(math.log(m2*Y2/m1/Y1))*3/2/F \t#[volts]\n",
- "#Result\n",
"print\"The overall e.m.f of the cell is\",round(E,4),\"volt\""
],
"language": "python",
@@ -1669,9 +1469,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.43\n",
- "#To find the e.m.f of the cell\n",
- "#Variable declaration\n",
"print\"H2(g,1atm)|HCl(aq)|HCl(aq)|H2(g,1atm)\" \n",
"m1=0.02 \t\t\t#concentration[M]\n",
"Y1=0.88 \t\t\t#mean ionic activity coefficient\n",
@@ -1682,10 +1479,8 @@
"F=96487 \t\t\t#Faraday's constant[coulombs/mol]\n",
"t=0.178 \t\t\t#Tranference number of Cl-1\n",
"import math\n",
- "#calculation\n",
"\n",
"E=-2*t*R*T*(math.log(m1*Y1/m2/Y2))/F \t#e.m.f of the cell[volts]\n",
- "#Result\n",
"print\"The e.m.f of the cell is\",round(E,3),\" volts\" \n",
"print\"\\nWrongly calculated in book as 0.351 volt\""
],
@@ -1717,22 +1512,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.44\n",
"\n",
- "#To find the values of dG,dS and dH\n",
"print\"The values for reaction that goes on within the cadmium cell\" \n",
- "#Variable declaration\n",
"n=2 \t\t\t#no. of moles\n",
"E=1.01463 \t\t#standard cadmium cell potential[volts]\n",
"d=-5*10**-5 \t\t#i.e d=dE/dT[V/K]\n",
"F=96500 \t\t#[coulomb/mol]\n",
"T=298 \t\t\t#Temperature [K]\n",
- "#calculation\n",
"\n",
"dG=-n*E*F \t\t#Change in Gibb's free energy[J]\n",
"dS=n*F*d \t\t#Change in entropy [J/K]\n",
"dH=dG+T*dS \t\t#change in enthalpy[J]\n",
- "#Result\n",
"print\" dG=\",dG,\"J\\nWrongly calculated in book as -195815 J\"\n",
"print\"\\n dS=\",dS,\"J/K\"\n",
"print\"\\n dH=\",dH,\"J\""
diff --git a/Thermodynamics:_A_Core_Course/CH6.ipynb b/Thermodynamics:_A_Core_Course/CH6.ipynb
index b2d73f0e..4326009b 100644
--- a/Thermodynamics:_A_Core_Course/CH6.ipynb
+++ b/Thermodynamics:_A_Core_Course/CH6.ipynb
@@ -27,25 +27,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Find molar volume of CO2\n",
"\n",
"from scipy.optimize import fsolve\n",
"\n",
- "#Variable declaration:\n",
- "#For CO2:\n",
"a=3.61 #atm L**2 mol**-2\n",
"b=4.29*10**-2 #L mol**-1\n",
"R=0.082 #L atm K**-1 mol**-1\n",
"T=500 #K\n",
"P=100 #atm\n",
"\n",
- "#CALCULATION\n",
"\n",
- "#(P+a/Vm^2)(Vm-b)=RT\n",
- "#or Vm^2(P+a/Vm^2)(Vm-b)=RTVm^2\n",
- "#or P*Vm**3+a*Vm-Pb*Vm**2-a*b=Rt*Vm**2\n",
- "#or Vm^^3-(b+RT/P)Vm**2+a/P*Vm-(a*b)/P=0\n",
- "#Let\n",
"C1=b+(R*T/P) #L mol**-1 [aSsume]\n",
"C2=a/P #L^2 mol^-2 [assume]\n",
"C3=C2*b #L^3mol**-3\n",
@@ -53,7 +44,6 @@
" return(x**3-C1*x**2+C2*x-C3)\n",
"x=fsolve(f,0.3)\n",
"\n",
- "#RESULT\n",
"\n",
"print \"x=\",round(x,3)\n",
"Vm=round(x,3)\n",
@@ -85,23 +75,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.5\n",
- "#To find the fugacity and fugacity coefficient\n",
- "#Variable declaration\n",
"b=0.0391 \t\t\t#Van der waals constant[dm3/mol]\n",
"R=0.082 \t\t\t#Universal gas constant[dm3*atm/mol]\n",
"P2=1000 \t\t\t#pressure [atm]\n",
"P1=0 \t\t\t\t#pressure [atm]\n",
"T=1273\t\t \t\t#Temperature [K]\n",
"import math\n",
- "#Calculation\n",
"\n",
"x=b*(P2-P1) \n",
"y=R*T \n",
"fc=math.exp(x/y) \t\t#fugacity coefficient\n",
"\n",
"f=P2*fc #fugacity[atm]\n",
- "#Result\n",
"print\"The fugacity coefficient is\",round(fc,3) \n",
"print\"The fugacity is\",round(f),\"atm\"\n"
],
@@ -131,22 +116,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.10\n",
- "#To find the partial pressure of CO2 gas \n",
- "#Variable declaration\n",
"m1=0.03 #mass of CO2(g)[gm]\n",
"w1=44.01 #molecular weight of CO2(g)[gm/mol]\n",
"m2=250 #mass of water[gm]\n",
"w2=18.02 #molecular weight of water[gm/mol]\n",
"k=1.25*10**6 #Henry's law constant[Torr]\n",
"T=298 #Temperature[K]\n",
- "#Calculation\n",
"\n",
"n1=m1/w1 #no. of moles of CO2\n",
"n2=m2/w2 #no. of moles of water\n",
"x1=n1/(n1+n2) #mole fraction of CO2\n",
"Pco2=k*x1 #Partial pressure of CO2[Torr]\n",
- "#Result\n",
"print\"The partial pressure of CO2 gas is\",round(Pco2,2),\"Torr\""
],
"language": "python",
@@ -174,10 +154,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.11\n",
"\n",
- "#To find the Volume of the solution\n",
- "#Variable declaration\n",
"W=1000 \t\t\t#Total mass of a solution[gm]\n",
"x1=0.5 \t\t\t#mole fraction of Chloroform\n",
"x2=0.5 \t\t\t#mole fraction of Acetone\n",
@@ -185,11 +162,9 @@
"V2m=74.166 \t\t#Partial molar volume of Acetone[cm3/mol]\n",
"M1=119.59 \t\t#molecular weight of chloroform[gm/mol]\n",
"M2=58 \t\t\t#molecular weight of Acetone[gm/mol]\n",
- "#Calculation\n",
"\n",
"nT=W/(x1*M1+x2*M2) \t#Total no. of moles\n",
"V=nT*(x1*V1m+x2*V2m) \t#Total volume[cm3]\n",
- "#Result\n",
"print\"The volume of the solution is\",round(V,1),\"cm^3 (approx)\""
],
"language": "python",
@@ -217,16 +192,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.12\n",
- "#to find the excess volume \n",
- "#Variable declaration\n",
"x1=0.5 #mole fraction of chloroform\n",
"x2=0.5 #mole fraction of p-xylene\n",
"T=298 #Temperature[K]\n",
- "#Calculation\n",
"\n",
"Ve=x1*x2*(0.585+0.085*(x1-x2)-0.165*(x1-x2)**2) #Excess volume measured by using a dilatometer\n",
- "#Result\n",
"print\"Ve/(cm3.mol**-1) = \",round(Ve,3) "
],
"language": "python",
@@ -254,10 +224,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.14\n",
"\n",
- "#To find the activity , molality of the electrolytes\n",
- "#Variable declaration\n",
"m1=0.01 \t\t#molality[m]\n",
"v11=1.0 \n",
"v12=2.0 \n",
@@ -267,7 +234,6 @@
"v22=1.0 \n",
"Y2=0.53 \n",
"\n",
- "#Calculation\n",
"\n",
"v1=(v11)+(v12) \n",
"v2=(v21)+(v22) \n",
@@ -279,12 +245,9 @@
"y=1.0/v2 \n",
"m2m=m2*(v21*v21*v22**v22)**y #molality[m]\n",
"a2m=a2**y \n",
- "#Result\n",
"print\"The activity of the electrolyte ZnCl2 is\",round(a1,8)\n",
"print\"The activity of the electrolyte CuSO4 is\",round(a2,8)\n",
- "#print\"The mean activity of ZnCl2 is\",a1m\n",
"print\"The mean molality of ZnCl2 in [m]\",round(m1m,4)\n",
- "#print\"The mean activity of CuSO4 is\",a2m \n",
"print\"The mean molality of CuSO4 in [m]\",m2m \n"
],
"language": "python",
@@ -315,20 +278,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.15\n",
"\n",
- "#To find the molecular weight of sucrose\n",
- "#Variable declaration\n",
"m2=3 \t\t\t#mass of the sucrose[gm]\n",
"m1=0.1 \t\t\t#mass of water [Kg]\n",
"Kf=1.86 \t\t#cryoscopic constant of water[K*Kg/mol]\n",
"dTf=0.16 \t\t#Lowering in freezing point[K]\n",
- "#Calculation\n",
"\t\n",
"a=m1*dTf \n",
"b=Kf*m2 \n",
"M2=b/a \t\t\t#molecular weight\n",
- "#Result\n",
"print\"M2=molecular weight , then M2=\",M2 "
],
"language": "python",
@@ -356,20 +314,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 5.16\n",
"\n",
- "#To find the molecular formula of sulphur\n",
- "#Variable declaration\n",
"dTf=0.088 \t\t\t#Lowering in freezing point[K]\n",
"m2=0.45 \t\t\t#mass of sulphur[gm]\n",
"m1=0.09955 \t\t\t#mass of benzene[gm]\n",
"Kf=5.07 \t\t\t#cryoscopic constant for benzene[K*Kg/mol]\n",
- "#Calculation\n",
"\n",
"a=m1*dTf \n",
"b=Kf*m2 \n",
"M2=b/a \t\t\t\t#molecular weight of sulphur\n",
- "#Result\n",
"print\"The molecular weight of sulphur is\",round(M2,1) \n",
"x=M2/32 \t\t\t#no. of sulphur atoms\n",
"print\"\\n The molecular formula of sulphur is S\",round(x) "
@@ -401,9 +354,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.17\n",
- "#To find the molar mass of macromolecule\n",
- "#Variable declaration\n",
"m2=1.35 \t\t\t#mass of a macromolecule[gm]\n",
"V=100\t \t\t\t#volume of solution[cm^3]\n",
"R=82 \t\t\t\t#Universal gas constant[atm.cm^3.K^-1]\n",
@@ -412,13 +362,11 @@
"d=1 \t\t\t\t#density\n",
"p=1013250 \t\t\t#Atmospheric pressure\n",
"g=980.67 \t\t\t#gravitational field\n",
- "#Calculation\n",
"\n",
"\n",
"a=m2*R*T*p \n",
"b=V*9.9*d*g \n",
"M2=a/b #molar mass of macromolecule\n",
- "#Result\n",
"print\" M2 = molar mass of macromolecule , therefore M2 = \",round(M2),\"g.mol^-1\""
],
"language": "python",
@@ -446,21 +394,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.18\n",
"\n",
- "#To find the osmotic pressure of a solution\n",
- "#Variable declaration\n",
"R=82 \t\t\t#Universal gas constant[atm.ml.K^-1.mol^-1]\n",
"T=298 \t\t\t#Temperature[K]\n",
"V=250 \t\t\t#volume of water[ml]\n",
"m2=2.6 \t\t\t#mass of the protein\n",
"M2=85000 \t\t#molar mass of protein[g.mol^-1]\n",
"\n",
- "#Calculation\n",
"\t\n",
"n2=m2/M2 \t\t\t#no. of moles of protein\n",
"II=(n2*R*T)/V \t\t\t#Osmotic pressure of a solution[atm]\n",
- "#Result\n",
"print\"The osmotic pressure is\",round(II,5),\"atm \"\n"
],
"language": "python",
@@ -488,19 +431,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.19\n",
- "#To find the Ebullioscopic constant of water\n",
- "#Variable declaration\n",
"R=8.314 \t\t\t#Universal gas constant[J.K**-1.mol**-1]\n",
"Tb=373.15 \t\t\t#Boiling point temperature[K]\n",
"M1=0.018 \t\t\t# mass of water[kg]\n",
"Hvap=40.7 \t\t\t#Enthalpy of vaporization[KJ.mol**-1]\n",
- "#Calculation\n",
"\n",
"a=R*0.001*Tb**2*M1 \n",
"b=Hvap \n",
"Kb=a/b \t\t\t\t#Ebullioscopic constant of water[K.Kg.mol**-1]\n",
- "#Result\n",
"print\"The Ebullioscopic constant of water is\",round(Kb,2),\"K.Kg.mol-1\""
],
"language": "python",
@@ -528,19 +466,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.20\n",
- "#To find the value of activity coefficient\n",
"print\"CaF2(s)<=>CaF2(aq)<=>Ca+2(aq) + 2F-(aq)\"\n",
"\n",
- "#Variable declaration\n",
"Ksp=4.0*(10**-11) \t#Solubility product of sparingly soluble salt CaF2\n",
- "#Calculation\n",
"\n",
"x=Ksp/4.0 \n",
"Cs=x**(1.0/3.0) \t\t#Solubility \n",
"y=Cs**2 \n",
"Y=(x/y)**(1.0/3.0) \t\t#activity coefficient\n",
- "#Result\n",
"print\"The activity coefficient is\",Y \n",
"print\"NOTE:please note that the value of Cs is wrongly calculated as 4.64*10^-11 in book\""
],
@@ -571,10 +504,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.21\n",
"\n",
- "#To find the mean activity coefficient of ZnCl2 solution\n",
- "#Variable declaration\n",
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
"T=298 \t\t\t\t#Temperature[K]\n",
"F=96500 \t\t\t#Faraday's constant\n",
@@ -582,13 +512,11 @@
"E=1.16 \t\t\t\t#e.m.f of the cell[Volts]\n",
"m=0.01 \n",
"import math\n",
- "#Calculation\n",
"\n",
"a=R*T \n",
"b=2*F \n",
"x=a/b \n",
"Y=math.exp((Eo-E-(x*math.log(4*m*m*m)))/(3*x)) #mean activity coefficient\n",
- "#Result\n",
"print\"The mean activity coefficient is\",round(Y,2) "
],
"language": "python",
@@ -616,9 +544,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.22\n",
- "#To find the ionic strength in a solution\n",
- "#Variable declaration\n",
"M1=0.01 \t\t\t#no. of moles of KCl\n",
"M2=0.005 \t\t\t#no. of moles of MgCl2\n",
"M3=0.002 \t\t\t#no. of moles of MgSO4\n",
@@ -629,14 +554,12 @@
"z22=1 \n",
"z31=2 \n",
"z32=2 \n",
- "#Calculation\n",
"\t\n",
"m1=M1/M \t\t\t#molality of KCL[m]\n",
"m2=M2/M \t\t\t#molality of MgCl2[m]\n",
"m3=M3/M \t\t\t#molality of MgSO4[m]\n",
"\n",
"I=0.5*((m1*z11**2+m1*z12**2+m2*z21**2+2*m2*z22**2+m3*z31**2+m3*z32**2)) #[mol/Kg]\n",
- "#Result\n",
"print\"The Ionic strength of a solution is\",I,\"mol/Kg\""
],
"language": "python",
@@ -664,22 +587,17 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 6.23\n",
- "#To find the mean activity coefficient\n",
- "#Variable declaration\n",
"T=298 \t\t\t\t#Temperature[K]\n",
"P=1 \t\t\t\t#pressure [atm]\n",
"m=0.02\t \t\t\t#Ionic strength of HCl solution in CH3OH[mol/Kg]\n",
"E=32.6 \t\t\t\t#Di-electric constant\n",
"d=0.787 \t\t\t#Density[gm/cm3]\n",
- "#Calculation\n",
"\t\n",
"I=0.5*(0.02*1*1+0.02*1*1) \t#Ionic strength of HCl solution[mol/Kg]\n",
"a=I*d \n",
"b=(E**3)*(298**3) \n",
"x=(a/b)**0.5 \n",
"Y=10**(-1.825*1000000*1*1*x) \t#mean activity coefficient\n",
- "#Result\n",
"print\"The mean activity coefficient is\",round(Y,2) "
],
"language": "python",
diff --git a/Thermodynamics:_A_Core_Course/CH7.ipynb b/Thermodynamics:_A_Core_Course/CH7.ipynb
index 71226c1e..fdea70a8 100644
--- a/Thermodynamics:_A_Core_Course/CH7.ipynb
+++ b/Thermodynamics:_A_Core_Course/CH7.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.1\n",
"\n",
- "#To find the number of ways of distributing N particles\n",
- "#Variable declaration\n",
"N=20 \t\t\t\t#no, of particles\n",
"N1=4 \t\t\t\t#no. of particles in E1 energy level\n",
"N2=4 \t\t\t\t#no. of particles in E2 energy level\n",
@@ -38,7 +35,6 @@
"N4=3 \t\t\t\t#no. of particles in E4 energy level\n",
"N5=3 \t\t\t\t#no. of particles in E5 energy level\n",
"import math\n",
- "#Calculation\n",
"\t\n",
"Nf=math.factorial(N) \n",
"N1f=math.factorial(N1) \n",
@@ -48,7 +44,6 @@
"N5f=math.factorial(N5) \n",
"n=N1f*N2f*N3f*N4f*N5f \n",
"W=Nf/n \t\t\t#no. of ways of distributing\n",
- "#Result\n",
"print\"The no. of ways of distributing the particles is\",W"
],
"language": "python",
@@ -76,16 +71,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.2\n",
- "#To find the fraction of molecules present in vibrational level\n",
- "#Variable declaration\n",
"T=298.0 \t\t\t#Temperature [K]\n",
"v=6.5*10**13 \t\t#Frequency in [sec-1]\n",
"\t#Consider zero point energy = 0.\n",
"h=6.627*10**-34 \t#planck's constant[J.s]\n",
"k=1.381*10**-23 \t#Boltzmann constant \n",
"N=1.0 \t\t\t#Since N=summation(gj*exp(-Ej/kT))\n",
- "#Calculation\n",
"\n",
"E1=h*v \t\t\t#for energy level 1[J]\n",
"E2=2*h*v \t\t#for energy level 2[J]\n",
@@ -97,7 +88,6 @@
"N2=(g2*math.exp(-E2/x)) #molecules present in energy level 2\n",
"n1=N1/N \t\t#fraction of molecules present in energy level 1\n",
"n2=N2/N \t\t#fraction of molecules present in energy level 2\n",
- "#Result\n",
"print\"The fraction of molecule s present in energy level 1 is\",'{0:.7f}'.format(round(n1,7)) \n",
"\n",
"\n",
@@ -129,21 +119,16 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.3\n",
- "#To find the ratio of no. of particle per state for two states separated by an energy dE\n",
- "#Variable declaration\n",
"dE=4.3*10**-20 \t\t\t#difference in energy levels[J]\n",
"T1=0.000001 \t\t\t#Initial Temperature[K](approximately zero , needed for \t\t\t\texecution)\n",
"T2=300 \t\t\t\t#Final Temperature[K]\n",
"k=1.381*10**-23 \t\t#Boltzmann constant [J/K]\n",
"import math\n",
- "#Calculation\n",
"\t\n",
"x1=k*T1 \n",
"r1=math.exp(-dE/x1) \n",
"x2=k*T2 \n",
"r2=math.exp(-dE/x2) \n",
- "#Result\n",
"print\"The ratio of no. of particles per state at 0K is\",r1 \n",
"print\"The ratio of no. of particles per state at 300K is\",round(r2,6) "
],
@@ -173,16 +158,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.4\n",
- "#To find the no. of atoms in first-excited singlet state\n",
- "#Variable declaration\n",
"T1=273.0 \t\t\t\t#[K]\n",
"T2=14273.0 \t\t\t#[K]\n",
"E1=-13.6 \t\t\t#Energy of ground state [eV]\n",
"k=8.617*10.0**-5.0 \t\t\t#Boltzmann constant[eV/K]\n",
"g2=8.0 \t\t\t\t#total no. of states with energy E2\n",
"g1=2.0 \t\t\t\t#total no. of states with energy E1\n",
- "#Calculation\n",
"import math\n",
"\t\n",
"E2=E1/(2.0**2) \t\t#Energy for n=2 (i.e.E2=E1/n2)\n",
@@ -190,7 +171,6 @@
"r1=(g2/g1)*math.exp(-(E2-E1)/x1) \n",
"x2=k*T2 \n",
"r2=(g2/g1)*math.exp(-(E2-E1)/x2) \n",
- "#Result\n",
"print\"The fraction of atoms present in level n=2 at 273K is\", round(r1,190) \n",
"print\"Therefore total 3*10**25 atoms we say that all are present at ground state\" \n",
"print\"\\n\\nThe fraction of atoms present in level n=2 at 14273 is\",round(r2,3) \n",
@@ -228,19 +208,14 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.5\n",
- "#To find the Temperature at this condition \n",
"\n",
- "#Variable declaration\n",
"r1=0.001 \t\t\t#the population of the states at a higher energy to that at a \t\t\t\tlower energy \n",
"dE=8*10**-20 \t\t\t#The difference in energy[J]\n",
"k=1.381*10**-23 \t\t\t#Boltzmann constant [J/K]\n",
"\n",
- "#Calculation\n",
"\n",
"x=k*math.log(r1) \n",
"T=-dE/x #[K]\n",
- "#Result\n",
"print\"The Temperature at this condition is\",round(T,1),\"K\""
],
"language": "python",
@@ -268,29 +243,18 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.6\n",
- "#To find the entropy of the system\n",
"\n",
- "#section(1)\n",
- "#Variable declaration\n",
- "#The energy levels are not degenerate \n",
"w=1 \t\t\t#no. of ways of distributing the molecules\n",
"k=1.381*10**-23 \t#Boltzmann constant[J/K]\n",
- "#Calculation\n",
"import math\n",
"\t\n",
"S1=k*math.log(w) \t\t#Entropy of system at 0K\n",
"print\"The Entropy of System at 0K and non-degenerate eng level is\",S1,\"J/K/mol\"\n",
"\n",
- "#section(2)\n",
- "#Here the energy levels are degenerate\n",
"n=2 \n",
"R=8.314 #Universal gas constant[J/K/mol]\n",
"\n",
- "#To find the entropy of the system\n",
- "#S=kmath.log(n**N)=>S=R*math.log(n)\n",
"S2=R*math.log(n) #Entropy of the system[J/K/mol]\n",
- "#Result\n",
"print\"\\nThe Entropy of system at 0K and degenerete eng level is\",round(S2,2),\"J/K/mol\""
],
"language": "python",
@@ -320,10 +284,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.9\n",
"\n",
- "#To find the Transitional partition function of an oxygen molecule confined in a 1-litre \tvessel at 300K\n",
- "#Variable declaration\n",
"V=0.001 \t\t\t#Volume of vessel[m3]\n",
"T=300 \t\t\t\t#Temperature [K]\n",
"k=1.381*10**-23 \t\t#Boltzmann constant[J/K]\n",
@@ -331,13 +292,11 @@
"h=6.626*10**-34 \t\t#planck's constant[J.s}\n",
"\n",
"\n",
- "#Calculation\n",
"\t\n",
"m=32*1.66*(10**-27) \t\t#mass of oxygen molecule[Kg]\n",
"x=((2*3.14*m*k*T)**(3.0/2.0))*V \n",
"y=h**3 \n",
"zt=x/y \t\t\t\t#Transitional partition function of an oxygen molecule\n",
- "#Result\n",
"print\"The Transitional partition function of an oxygen molecule confined in a 1-litre vessel at 300K is\",zt\n",
"print\"Wrongly calculated in book as 5.328*10^33\""
],
@@ -367,9 +326,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.12\n",
- "#To find the Entropy of argon at 273K and 1 atmospheric pressure\n",
- "#Variable declaration\n",
"R=1.99 \t\t\t#Universal gas constant [cal/K]\n",
"e=2.718 \n",
"V=22414 \t\t#volume[cm3]\n",
@@ -379,13 +335,11 @@
"k=1.381*10**-16 \t#Boltzmann constant[erg/K]\n",
"T=273.2 \t\t#Temperature[K]\n",
"import math\n",
- "#Calculation\n",
"\t\n",
"x=V*(e**2.5) \n",
"y=L*(h**3) \n",
"z=(2*3.14*m*k*T)**1.5 \n",
"S=R*math.log(x*z/y) #Entropy [cal/degree/mol]\n",
- "#Result\n",
"print\"The Entropy of argon at 273K and 1 atm is\",round(S,1),\"cal/degree/mol\""
],
"language": "python",
@@ -413,10 +367,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.14\n",
"\n",
- "#To find the rotational entropy and free energy for O2 gas\n",
- "#Variable declaration\n",
"T=298 \t\t\t\t#Temperature[K]\n",
"I=1.9373*10**-46 \t\t#moment of inertia of O2 gas [Kg/m2]\n",
"h=6.626*10**-34 \t\t\t#Planck's constant[J.s]\n",
@@ -424,11 +375,9 @@
"R=8.314 \t\t\t#Universal gas constant[J/K/mol]\n",
"u=2 \t\t\t\t#Homonuclear diatomic molecule\n",
"import math\n",
- "#Calculation\n",
"\t\n",
"Sr=R+R*math.log(8*3.14*3.14*I*k*T/(u*h*h)) #[J/K/mol]\n",
"Gr=-R*0.001*T*math.log(8*3.14*3.14*I*k*T/(u*h*h)) #[KJ/mol]\n",
- "#Result\n",
"print\"The rotational entropy for O2 gas is\",round(Sr,3),\"J/K/mol\"\n",
"print\"The rotational free energy for O2 gas is\",round(Gr,3),\"KJ/mol\"\n"
],
@@ -458,9 +407,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.15\n",
- "#To find the vibrational contribution to the entropy of F2 at 298K\n",
- "#Variable declaration\n",
"T=298 \t\t\t\t#Temperature[K]\n",
"v=892.1*3*10**10 \t\t#frequency[sec-1]\n",
"h=6.626*10**-27 \t\t#Planck's constant [J.s]\n",
@@ -468,13 +414,11 @@
"e=2.718 \n",
"R=1.998 \t\t\t#Universal gas constant[cal/K]\n",
"\t\n",
- "#Calculation\n",
"import math\n",
"x=h*v/(k*T) \n",
"a=R*x*e**-x/(1-e**-x) \t\t#a=E-Eo/T\n",
"b=R*math.log(1-e**-x) \t\t#b=G-Eo/T\n",
"S=a-b \t\t\t\t#[cal/deg]\n",
- "#Result\n",
"print\"The vibrational contribution to the entropy of F2 is\",round(S,4),\"cal/deg APPROX\""
],
"language": "python",
@@ -502,9 +446,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.16\n",
- "#To find the equilibrium constant\n",
- "#Variable declaration\n",
"T=1273 \t\t\t\t#Temperature[K]\n",
"h=6.26*10**-27 \t\t\t#Planck's constant[J.s]\n",
"k=1.381*10**-16 \t\t\t#Boltzmann constant[erg/K]\n",
@@ -517,14 +458,12 @@
"u=2 \t\t\t\t\t#symmetry number\n",
"L=6.023*10**23 \t\t\t\t#avogadro's number\n",
"import math\n",
- "#Calculation\n",
"\t\n",
"p=((3.14*m*k*T)**1.5)/h/h/h \n",
"s=R*u*h*h/L/8/3.14/3.14/I/k \n",
"q=1-(math.exp(-h*v/k/T)) \n",
"r=math.exp(-dE/k/T) \n",
"Kp=p*s*q*r \t\t\t\t#Equilibrium constant \n",
- "#Result\n",
"print\"The equilibrium constant is\",round(Kp,3) "
],
"language": "python",
@@ -552,9 +491,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#example 7.17\n",
- "#To find the equilibrium constant for isotopic exchange reaction\n",
- "#Variable declaration\n",
"T=298.0 #Temperature[K]\n",
"m1=32.0 \n",
"m2=36.0 \n",
@@ -573,14 +509,12 @@
"vo3=1490.0 #vibration frequency of 18O2 [cm-1]\n",
"dE=0.5*h*c*(2*vo1-vo2-vo3) #[erg]\n",
"r=dE/k/T \n",
- "#Calculation\n",
"import math\n",
"\n",
"a=m3**3/m2**1.5/m1**1.5 \n",
"b=(u3**2)*4/u2/u1 \n",
"c=z3**2/z2/z1 \n",
"Kp=a*b*c*math.exp(-r) \n",
- "#Result\n",
"print\"The value of equilibrium constant for isotopic exchange reaction is\",round(Kp,3) "
],
"language": "python",
diff --git a/Transport_Phenomena/ch1.ipynb b/Transport_Phenomena/ch1.ipynb
index 0a893e9a..70dd9d5b 100644
--- a/Transport_Phenomena/ch1.ipynb
+++ b/Transport_Phenomena/ch1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:6878a09d345c6e36356d1de04735bdf1caaedc539dfc6eb9c2d7616f776f15b1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the concentration of nitrogen in the tank in\n",
+ "\n",
"\n",
"# Variables\n",
"v=0.01283; \t\t\t #[m**3] - volume of tank in m**3\n",
@@ -74,7 +75,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the mass of each concentrated solution to be added.\n",
+ "\n",
"\n",
"from numpy import *\n",
"\n",
diff --git a/Transport_Phenomena/ch10.ipynb b/Transport_Phenomena/ch10.ipynb
index 4df43e2b..46cf9990 100644
--- a/Transport_Phenomena/ch10.ipynb
+++ b/Transport_Phenomena/ch10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:d6e9db7edbf67f47d9db227a91c9a3e69bd0ea385086a570b1e5ec45fa366eb2"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Compute the viscosity in CP.\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -82,7 +83,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Compute the pressure drop for the same 0.032%in \n",
"\n",
"# Variables\n",
"Nreold = 1214.;\n",
@@ -135,7 +135,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the pressure drop in a pipe of 6-cm inside diameter for water flowing\n",
+ "\n",
"\n",
"# Variables\n",
"u = 1./60; \t\t\t #[m/sec] - velocity\n",
@@ -182,10 +182,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Repeat the previous example for Reynolds numbers of 10 000 and\n",
- "100 000. Contrast smooth pipe with commercial steel pipe and cast iron pipe.\n",
- "'''\n",
+ "\n",
"\n",
"from numpy import *\n",
"\n",
@@ -276,7 +273,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find, the maximum flow velocity by trial and error.\n",
"\n",
"# Variables\n",
"L = 300.; \t\t\t #[m] - length of pipe\n",
@@ -337,7 +333,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Repeat Example 10.5 using the von Karman plot, Fig. 10.5.\n",
"\n",
"# Variables\n",
"L = 300.; \t\t\t #[m] - length of pipe\n",
@@ -385,7 +380,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# estimate the pressure drop in a 0.06-m ID commercial steel pipe at Reynolds numbers of 104 and 16\n",
"\n",
"# Variables\n",
"L = 300.; \t\t\t #[m] - length of pipe\n",
@@ -436,7 +430,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Compute p, by (a) the equivalent length method and (b) the loss coefficient method.\n",
"\n",
"# Variables\n",
"mu = 6.72*10**-4; \t\t #[lb/ft*sec] - vismath.cosity\n",
@@ -510,7 +503,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the total flow rate of water through the pipe system.\n",
"\n",
"# Variables\n",
"L1 = 50.; \t\t\t #[m] - length of first pipe\n",
@@ -578,7 +570,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find flow rate\n",
"\n",
"import math\n",
"\n",
@@ -631,10 +622,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the pump size necessary to maintain a spray\n",
- "velocity of 15 ft s-\u2019 and a flow rate of 400 gpm if the pump is 60 percent efficient.\n",
- "'''\n",
"\n",
"# Variables\n",
"sp = 1.1;\n",
@@ -741,7 +728,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimate the power required in the previous problem by using the velocity head approximation\n",
"\n",
"# Variables\n",
"kexit = 1.;\n",
@@ -819,8 +805,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the pressure drop over a length of 300 m if the flow velocity is 1.667 m\n",
- "\n",
"\n",
"# Variables\n",
"l = 0.09238;\n",
@@ -864,10 +848,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Size a sharp-edged, corner-tap orifice meter for the 4-in. leg in\n",
- "Fig. 10.17 if the flow rate and fluid are unchanged from Example 10.11.\n",
- "'''\n",
"\n",
"# Variables\n",
"Q = 400.; \t\t\t #[gpm]\n",
@@ -934,7 +914,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Size a venturi meter for the application cited in Example 10.15\n",
"\n",
"# Variables\n",
"Q = 400.; \t \t\t #[gpm]\n",
@@ -992,7 +971,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Then compute the average velocity by Eq. (10.88) and compare with the 2.778 ft s-l as given.\n",
"\n",
"# Variables\n",
"Uzmax = 3.455; \t\t\t #[ft/sec]\n",
diff --git a/Transport_Phenomena/ch11.ipynb b/Transport_Phenomena/ch11.ipynb
index dff34285..aae61613 100644
--- a/Transport_Phenomena/ch11.ipynb
+++ b/Transport_Phenomena/ch11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:085ad0ec85734bdfb705abcbca08635352c78385ff9e20ea7cd21f4d0ccfee40"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Compute and plot the temperature profile.\n",
"\n",
"import math \n",
"\n",
@@ -98,7 +98,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the heat loss and compute the temperature at the steel-magnesia interface.\n",
"\n",
"# Variables\n",
"r1 = (2.067/2.)/(12); \t\t #[ft]\n",
@@ -148,7 +147,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimate the heat loss for 500 ft of pipe\n",
"\n",
"# Variables\n",
"Ra = 8.502*10**-4; \t\t\t #[h*degF*Btu**-1]\n",
@@ -201,7 +199,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimate the heat transfer coefficient\n",
+ "\n",
"\n",
"# Variables\n",
"Nre = 50000.;\n",
@@ -309,7 +307,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the Nusselt number if the fluid temperature is 640 K and the wall temperature is 680 K.\n",
"\n",
"# Variables\n",
"# given\n",
@@ -363,12 +360,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Estimate \n",
- "(a) the duty of the exchanger, \n",
- "(b) the number of pounds per hour of steam required, and \n",
- "(c) the length of a double-pipe heat exchanger to perform this task.\n",
- "'''\n",
"\n",
"# Variables\n",
"di = 0.620; \t\t\t #[inch] - internal diameter\n",
@@ -425,7 +416,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# estimate the outlet temperature of the water.\n",
"\n",
"# Variables\n",
"L = 30.; \t\t\t #[ft] - length\n",
@@ -477,7 +467,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Repeat Example 11.8 if the water side fouling factor is 0.002 h ft\u2019\u201cF Btu\u2019.\n",
"\n",
"# Variables\n",
"Ai = 4.869;\n",
@@ -521,11 +510,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the hydrocarbon flow rate and\n",
- "the heat exchanger area for the following heat exchangers: (a) parallel double-\n",
- "pipe; (b) counterflow double-pipe; (c) 1-2 shell-and-tube; and (d) 2-4 shell-tube.\n",
- "'''\n",
"\n",
"# Variables\n",
"Ui = 325.; \t\t\t #[W/m**2*K] - overall heat transfer coefficient\n",
diff --git a/Transport_Phenomena/ch12.ipynb b/Transport_Phenomena/ch12.ipynb
index fc6fa80b..b890667e 100644
--- a/Transport_Phenomena/ch12.ipynb
+++ b/Transport_Phenomena/ch12.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:cf1ae634b67dbf9ac3cc91134d4c30acd13efd02af03447d121a71d1c5277a05"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Estimate the boundary layer thickness and the local drag coefficient at the trailing \n",
- "edge of the test section. Also estimate the force (drag) on the test section.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -81,10 +78,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "calculate the shear stress\n",
- "at the wall (in units of N m-*) at a distance of 1 m from the leading edge of the plate.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -145,13 +138,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find (a) the length of the laminar boundary layer, (b) the thickness of the\n",
- "momentum boundary layer and the thermal boundary layer at the transition\n",
- "point, (c) the local heat transfer coefficient at the transition point, and (d) the\n",
- "mean heat transfer coefficient between the leading edge of the plate and the\n",
- "transition point.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables \n",
"T = 290.; \t\t\t #[K] - temperature of flowing water\n",
@@ -216,10 +203,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the terminal velocity and drag force when a spherical water\n",
- "drop, 5 pm in diameter, falls through air at 20\u00b0C. Let g = 9.80 m s-\n",
- "'''\n",
"\n",
"# Variables\n",
"T = 293.15; \t\t\t #[K]\n",
@@ -263,10 +246,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the time for the drop of water in Example 12.10 to\n",
- "accelerate from an initial velocity of zero to 0.9!XJ,.\n",
- "'''\n",
"\n",
"# Variables\n",
"T = 293.15; \t\t\t #[K]\n",
@@ -314,7 +293,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine its terminal velocity.\n",
"\n",
"# Variables\n",
"pp = 1.13*10**4; \t\t\t #[kg/m**3] - density of lead particle\n",
@@ -364,10 +342,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Determine the appropriate diameter of the sphere to achieve\n",
- "the design criteria, if g = 32 ft s-*.\n",
- "'''\n",
"\n",
"# Variables\n",
"distance = 1./12; \t #[ft]\n",
@@ -414,13 +388,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Compute (a) the static void fraction, (b) the minimum void fraction and\n",
- "bed height for fluidization, (c) the settling velocity for a single particle in a static\n",
- "fluid, (d) the minimum pressure drop for fluidization, (e) the minimum velocity\n",
- "for entrainment, and (f) the heat transfer coefficient at the wall for a superficial\n",
- "velocity 2.5 times U,,.\n",
- "'''\n",
"\n",
"# Variables\n",
"T = 842.; \t\t\t #[degF] - temperature\n",
@@ -516,10 +483,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the\n",
- "pressure drop in psi and the superficial velocity (ft s-l) at the point of incipient\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"pp = 249.6; \t\t #[lb/ft**3] - density of catalyst\n",
@@ -568,7 +532,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# estimate the velocity in m s-i.\n",
"\n",
"# Variables\n",
"d = 24.*10**-6; \t\t\t #[m] - diameter of wire\n",
@@ -627,9 +590,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the exit temperature of the air if its properties can be estimated from the following correlations\n",
"\n",
- "# Variables\n",
"dt = 0.75;\n",
"St = 1.5*dt;\n",
"Sl = 3.*dt;\n",
diff --git a/Transport_Phenomena/ch13.ipynb b/Transport_Phenomena/ch13.ipynb
index 760170dd..54f84e7f 100644
--- a/Transport_Phenomena/ch13.ipynb
+++ b/Transport_Phenomena/ch13.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:855f448243394a83380cc86f4309c883de0251b8f54f502d859f2d887a1b20dc"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,12 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the Biot number for: (a) a copper sphere\n",
- "of radius 5 cm; (b) a copper cylinder of radius 5 cm and length 30 cm; and (c) a\n",
- "square copper rod of length 40 cm and cross sectional area the same as the\n",
- "cylinder of radius 5 cm.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -90,10 +86,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the temperature at the center after\n",
- "1.2s if the heat transfer coefficient is 20 W m-*K-l\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"# given\n",
@@ -154,10 +147,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Consider the agitation vessel in Example 13.5. Divide the\n",
- "thickness into 10 increments and perform two iterations of the explicit method.\n",
- "'''\n",
"\n",
"from numpy import *\n",
"# Variables\n",
@@ -224,10 +213,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Estimate the depth that corresponds to a\n",
- "temperature of -5\u00b0C if it is assumed that the period of time is 4 months.\n",
- "'''\n",
"\n",
"# Variables\n",
"p = 2050.; \t\t\t #[kg/m**3] - density of soil\n",
@@ -274,7 +259,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the concentration of KC1 at the center after 60min.\n",
"\n",
"# Variables\n",
"d = 0.01; \t\t\t #[m] - diameter of cyclindrical porous plug\n",
diff --git a/Transport_Phenomena/ch14.ipynb b/Transport_Phenomena/ch14.ipynb
index 942ef967..b34c829a 100644
--- a/Transport_Phenomena/ch14.ipynb
+++ b/Transport_Phenomena/ch14.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:55e856a8d3dddf57f1710469be28c47075de957bf6a386a984d244b3f06340ab"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimate the viscosity of air at 40\u00b0C (313.15 K) and atmospheric pressure;\n",
"\n",
"import math \n",
"\n",
@@ -81,10 +81,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the thermal conductivity of air and of argon at 40\u00b0C and\n",
- "1 atm using the Chapman-Enskog equation.\n",
- "'''\n",
"\n",
"# Variables\n",
"T = 40+273.15; \t\t\t #[K] - temperature\n",
@@ -159,10 +155,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the thermal conductivity of air at 40\u00b0C and 1 atm, given\n",
- "that the heat capacity cp is 1005 J kg\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"T = 40+273.15; \t\t\t #[K] - temperature\n",
@@ -216,14 +209,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(a) Use the Chapman-Enskog equation to find the diffusion coefficient at 413 K,\n",
- "6OOK, 9OOK, and 12OOK.\n",
- "(b) Use. the experimental diffusion coefficient and the Chapman-Enskog equa-\n",
- "tion to estimate the diffusion coefficients in part (a).\n",
- "(c) Use Eq. (2.50).\n",
- "(d) Compare all answers with experimental results\n",
- "'''\n",
+ "\n",
"\n",
"from numpy import *\n",
"import math \n",
@@ -325,7 +311,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Compare this result with that predicted by the Chapman-Enskog theory.\n",
"\n",
"# Variables\n",
"T = 323.; \t\t\t #[K] - temperature\n",
@@ -387,10 +372,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find the diffusion coefficient of the helium-1-propanol system at\n",
- "423.2 K and 5 atm using the FSG correlation\n",
- "'''\n",
"\n",
"# Variables\n",
"T = 423.2; \t\t\t #[K] - temperature\n",
@@ -441,7 +422,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Prepare a plot of viscosity of water between 273 K and 373 K;\n",
+ "\n",
"\n",
"%pylab inline\n",
"\n",
@@ -520,11 +501,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Estimate the thermal conductivity of tetrachloromethane\n",
- "'''\n",
"\n",
- "# Variables\n",
+ "# Variable\n",
"M = 153.82; \t\t\t #[kg/mole] - molecular weight of ccl4\n",
"T1 = 349.90; \t\t\t #[K] - temperature1\n",
"T2 = 293.15; \t\t\t #[K] - temperature 2\n",
@@ -573,7 +551,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Compare the diffusion coefficient of water drffusing\n",
+ "\n",
"\n",
"# Variables\n",
"T = 288.; \t\t\t #[K] - temperature\n",
diff --git a/Transport_Phenomena/ch15.ipynb b/Transport_Phenomena/ch15.ipynb
index 78d0dbbd..7fa822a9 100644
--- a/Transport_Phenomena/ch15.ipynb
+++ b/Transport_Phenomena/ch15.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:485afd35a0311c543b8ae80fa257d28da81c47bde4dc247fa4b0bb496f195ee1"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the power law parameters\n",
+ "\n",
"\n",
"%pylab inline\n",
"\n",
@@ -102,7 +103,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the parameters in Eq. (10.5). The literature value of n\u2019 using 25 points is 0.887\n",
+ "\n",
"\n",
"# Variables\n",
"a = array([651, 1361, 2086, 5089, 7575, 11140, 19270, 25030])\n",
@@ -157,7 +158,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the power-law parameters for the data of Example 15.2 (Table 15.2).\n",
"\n",
"# Variables\n",
"# from Example 15.2 \n",
@@ -199,7 +199,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Obtain the basic shear diagram.\n",
"\n",
"# Variables\n",
"a = array([10, 20, 50, 100, 200, 400, 600, 1000, 2000])\n",
diff --git a/Transport_Phenomena/ch2.ipynb b/Transport_Phenomena/ch2.ipynb
index a2d46e38..6416458f 100644
--- a/Transport_Phenomena/ch2.ipynb
+++ b/Transport_Phenomena/ch2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:0e7d45d0646cb2f7a3667939e0b33f1faee777b6256363462737ae361a311b4b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the steady-state heat flux across a copper block\n",
+ "\n",
"\n",
"# Variables\n",
"deltax = 0.1; \t\t\t #[m] - thickness of copper block\n",
@@ -70,7 +71,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the momentum flux and force per unit area necessary to maintain a plate in motion\n",
"\n",
"# Variables\n",
"dely = 0.1; \t\t\t #[m] - distance between two parralel plates\n",
@@ -112,7 +112,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the new velocity of the top plate\n",
"\n",
"# Variables\n",
"tauyx = -0.003; \t\t #[N/m**2] - momentum flux\n",
@@ -151,11 +150,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Find:\n",
- "(a) the amount of heat transferred in joules per second;\n",
- "(b) the number of grams of ice that melt in 30 minutes.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"\n",
@@ -205,11 +200,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(a) Find the molar flux of CO,.\n",
- "(b) Find the number of pounds of CO, that pass through the hole in the iron in\n",
- "one hour.\n",
- "'''\n",
"\n",
"import math \n",
"from scipy.integrate import quad \n",
@@ -271,12 +261,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(a) Calculate the concentration of CO1 entering in kg me3.\n",
- "(b) Calculate the concentration of NZ entering in the air stream in lb mol fim3.\n",
- "(c) Calculate the concentration of CO, exiting in mol cmm3.\n",
- "(d) Calculate the concentration of Oz exiting in kmol me3.\n",
- "'''\n",
+ "\n",
"\n",
"# Variables\n",
"T = 30+273.15; \t\t\t #[K] temperature\n",
@@ -344,7 +329,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the initial rate of mass transfer of the CO,. Is the air transferred?\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -398,7 +383,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the viscosity of toluene in centipoise.\n",
"\n",
"# Variables\n",
"# given\n",
@@ -445,7 +429,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Predict the diffusion coefficient of water vapor\n",
+ "\n",
"\n",
"# Variables\n",
"po = 1.; \t\t\t #[atm] - pressure\n",
@@ -489,7 +473,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimate the viscosity of air and of water\n",
"\n",
"from scipy.optimize import fsolve \n",
"import math \n",
diff --git a/Transport_Phenomena/ch3.ipynb b/Transport_Phenomena/ch3.ipynb
index a369004a..a18887b2 100644
--- a/Transport_Phenomena/ch3.ipynb
+++ b/Transport_Phenomena/ch3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:918b451a759f37d8f1e9ab3a52dd145676f732e5de5664d665d95504d9bce12d"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(a) Find the heat flux if face 1 is maintained at 0\u00b0C.\n",
- "(b) If the same flux as in part (a) enters at face 2, find the flux at face 1 if there is\n",
- "now a uniform generation within the volume of 1.5 X lo6 J mm3 s-l.\n",
- "'''\n",
"\n",
"# Variables\n",
"a = 0.0006; \t\t #[m**2] - area\n",
@@ -86,7 +82,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the temperature profile \n",
+ "\n",
"\n",
"from sympy import *\n",
"\n",
@@ -144,11 +140,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "(a) Find the rate of accumulation.\n",
- "(b) Find the equation for the temperature profile, and determine the temperature\n",
- "at face 1 after 1 min, if at the start face 2 is at 100\u00b0C.\n",
- "'''\n",
+ "\n",
"\n",
"import math \n",
"from sympy import *\n",
diff --git a/Transport_Phenomena/ch4.ipynb b/Transport_Phenomena/ch4.ipynb
index 21c74139..2114f1f2 100644
--- a/Transport_Phenomena/ch4.ipynb
+++ b/Transport_Phenomena/ch4.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:64b2bde681c49f44be3d13a15f35c64ef003a99e40d1652062b755d6b3ba1ad3"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the thermal conductivity. \n",
"\n",
"import math\n",
"\n",
@@ -81,7 +81,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the heat loss from a 2-inch\n",
"\n",
"import math \n",
"\n",
@@ -130,7 +129,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Solve Example 4.2 by the log-mean area concept.\n",
+ "\n",
"\n",
"# Variables\n",
"# given\n",
@@ -193,7 +192,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Determine the mass transfer rate for the conical section\n",
"\n",
"from scipy.integrate import quad \n",
"\n",
@@ -249,7 +247,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the temperature distribution in the steel wire\n",
"\n",
"from sympy import *\n",
"\n",
@@ -305,7 +302,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the viscosity of the fluid.\n",
"\n",
"import math\n",
"\n",
diff --git a/Transport_Phenomena/ch5.ipynb b/Transport_Phenomena/ch5.ipynb
index 7ab9219f..aa62bb82 100644
--- a/Transport_Phenomena/ch5.ipynb
+++ b/Transport_Phenomena/ch5.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:846eb301f0ca3fa07d598406cf96d8fa3abf5c03a27e59bd7b72da3b6c324d13"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,10 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find Uz, and Uz*\n",
"\n",
- "# Variables\n",
- "# given\n",
"v = 1.; \t\t\t #[cm/sec] - volume velocity or bulk velocity\n",
"vol = 1.; \t\t\t #[cm**3] - volume\n",
"na = 2.; \t\t\t # moles of a\n",
@@ -107,10 +105,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the fluxes for the problem of Example 5.9.\n",
"\n",
- "# Variables\n",
- "# given (from Example 5.9)\n",
"na = 2.; \t\t\t # moles of a\n",
"nb = 3.; \t\t\t # moles of b\n",
"nc = 4.; \t\t\t # moles of c\n",
@@ -218,11 +213,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "find the rate of diffusion for \n",
- "(a) steady-state equimolar counter diffusion and \n",
- "(b) steady-state diffusion of CO, through stagnant HZ.\n",
- "'''\n",
"\n",
"import math\n",
"# Variables\n",
@@ -281,7 +271,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Repeat Example 5.11, this time assuming that Nr, is 0.75N, in magnitude \n",
+ "\n",
"\n",
"# Variables\n",
"# given\n",
@@ -337,7 +327,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the pressure in the other end\n",
+ "\n",
"\n",
"# Variables\n",
"# given\n",
diff --git a/Transport_Phenomena/ch6.ipynb b/Transport_Phenomena/ch6.ipynb
index 0a721fc2..1d8101cc 100644
--- a/Transport_Phenomena/ch6.ipynb
+++ b/Transport_Phenomena/ch6.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:d94dd77653a1dc6cef649df91fc864517d196845530100e7dee278dbacfebc8a"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,11 +28,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "determine\n",
- "whether the flow is laminar, turbulent, or transitional. At M\u2019F, the viscosity of\n",
- "water is 0.8007 cP, and the density of water is 0.99568 g cmm3.\n",
- "'''\n",
"\n",
"import math \n",
"\n",
@@ -79,11 +75,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Calculate the location along a flat plate (Fig. 6.2) where transition\n",
- "would be expected to occur for a free stream velocity of 4.78fts-\u2019 for water at\n",
- "86\u00b0F.\n",
- "'''\n",
+ "\n",
"# Variables\n",
"# given\n",
"p = 0.99568*62.43; \t\t\t #[lb/ft**3] - density of water at 86degF\n",
@@ -128,7 +120,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the mean velocity for the flow data in Table 6.2.\n",
"\n",
"# Variables\n",
"# given\n",
@@ -188,7 +179,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Express the cross term as a ratio to the r.m.s. values\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -251,7 +242,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# prepare a graph of E./v versus (1 - r/To).\n",
"\n",
"%pylab inline\n",
"\n",
@@ -318,8 +308,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the velocity distribution by the various methods available\n",
- "# for the flow of cyclohexane at 2.778 ft s- \u2019 (0.8467 m s-\u2018) and 25\u00b0C in a 2-inch I.D.\n",
"\n",
"import math\n",
"\n",
@@ -380,7 +368,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Estimate the temperature distribution in water\n",
"\n",
"import math\n",
"\n",
@@ -433,7 +420,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Compute the Fanning friction factor.\n",
"\n",
"# Variables\n",
"p = 0.84*62.4; \t\t\t #[lbf/ft**3] - density\n",
diff --git a/Transport_Phenomena/ch7.ipynb b/Transport_Phenomena/ch7.ipynb
index 917619d0..22fcb9f1 100644
--- a/Transport_Phenomena/ch7.ipynb
+++ b/Transport_Phenomena/ch7.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:e57625380c3ea6b7f8400e3a53dcc1fb5baa99ca292bbffb9fd53f96e3df830e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,9 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "How long will it take to remove one-half of the contents? How long will it take to empty the tank?\n",
- "'''\n",
+ "\n",
"import math \n",
"from scipy.integrate import quad \n",
"\n",
@@ -90,7 +89,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the flue (exit) gas composition.\n",
+ "\n",
"\n",
"# Variables\n",
"# composition of fuel gas\n",
@@ -156,7 +155,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the force exerted by the elbow on the fluid.\n",
+ "\n",
"import math\n",
"# Variables\n",
"# given\n",
@@ -228,7 +227,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Repeat Example 7.4 using the force balance concept\n",
"\n",
"import numpy\n",
"import math\n",
@@ -293,7 +291,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the force exerted by the bolts on the flanges.\n",
"\n",
"# Variables\n",
"id_ = 6.; \t\t\t #[inch] - inlet diameter\n",
@@ -359,7 +356,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the kinetic energy correction term\n",
"\n",
"from scipy.integrate import quad \n",
"# Variables\n",
@@ -416,7 +412,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the duty (heat load) needed to accomplish the heat exchange.\n",
+ "\n",
"\n",
"# Variables\n",
"Q = 0.03; \t\t\t #[m**3/sec] - volumetric flow rate\n",
@@ -463,7 +459,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# estimate the mass flow rate in kg s,\n",
+ "\n",
"\n",
"# Variables\n",
"d = 0.03; \t\t\t #[m] - diameter\n",
@@ -526,7 +522,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the flow rate in kg s\n",
+ "\n",
"\n",
"# Variables\n",
"sp = 1.45; \t\t\t # specific gravity of trichloroethylene\n",
@@ -575,7 +571,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the temperature rise for the water\n",
"\n",
"# Variables\n",
"Q = 50/(7.48*60); \t #[ft/sec] - volumetric flow rate of water\n",
@@ -624,7 +619,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the horsepower required if the centrifugal pump is 77 percent efficient and if fluid friction is negligible\n",
"\n",
"# Variables\n",
"deltaz = 30.; \t\t #[ft] - distance between process and the holding math.tank\n",
@@ -677,7 +671,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the shaft work done by the system \n",
+ "\n",
"\n",
"# Variables\n",
"p1 = 5.; \t\t\t #[atm] - initial pressure\n",
@@ -721,7 +715,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Find the pressure drop across the venturi.\n",
"\n",
"# Variables\n",
"T = 273.15+25; \t\t #[K] - temperature\n",
@@ -768,7 +761,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Rework Example 7.15, this time using engineering units.\n",
+ "\n",
"\n",
"# Variables\n",
"T = 536.67; \t\t\t #[degR]; - temperature\n",
@@ -814,7 +807,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#find the pressure at the vessel pressure tap.\n",
"\n",
"# Variables\n",
"at = 0.049; \t\t\t #[in**2] - cross sectional area of the manometer tubing\n",
@@ -865,7 +857,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Is the coin gold?\n",
+ "\n",
"\n",
"# Variables\n",
"p = 749./760; \t\t\t #[atm]\n",
@@ -913,7 +905,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# find the true mass of the wood if the temperature is 21\u00b0C and the barometer reads 749 Totr.\n",
"\n",
"# Variables\n",
"P = 749./760; \t\t\t #[atm] - pressure\n",
@@ -955,7 +946,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the pressure 50ft above a beach in Fort Lauderdale\n",
+ "\n",
"\n",
"# Variables\n",
"T = 545.67; \t\t\t #[degR] - temperature\n",
@@ -999,7 +990,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the pressure and temperature\n",
"\n",
"# Variables\n",
"To = 545.67; \t\t\t #[degR] - air temperature at beach level\n",
diff --git a/Transport_Phenomena/ch9.ipynb b/Transport_Phenomena/ch9.ipynb
index 21d56f19..c5809f8d 100644
--- a/Transport_Phenomena/ch9.ipynb
+++ b/Transport_Phenomena/ch9.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:f3b360b427025d8d371cabebea260210aa53947251b74238c4e0eff08e556049"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -27,7 +28,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculate the power per unit volume and the torque per unit volume\n",
+ "\n",
"\n",
"import math\n",
"\n",
@@ -94,7 +95,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# designing a reactor of capacity\n",
"\n",
"# Variables\n",
"Tpilot = 30.;\n",
@@ -154,10 +154,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "'''\n",
- "Suppose the pilot plant data in Table 9.8 never existed. Use the\n",
- "laboratory data only from Example 9.4 to design the 12 000-gal reactor.\n",
- "'''\n",
+ "\n",
"\n",
"from numpy import *\n",
"\n",
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_10.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_10.ipynb
index ee6dfbfb..83a710ec 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_10.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_10.ipynb
@@ -1,66 +1,67 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1> Chapter 10 : Valves <h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 10.1 Page No 225 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Flow coefficient and Pressure drop\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "Q=30.0 #gpm flow rate\n",
- "dp=300.0 #pressure drop lbf/in^2\n",
- "Sg=0.85 #density\n",
- "Cv=5.41 #Flow coefficient\n",
- "\n",
- "#CALCULATIONS\n",
- "Cv1=Q/(math.sqrt(dp/Sg)) \n",
- "dp1=Sg*Q**2/Cv**2\n",
- "\n",
- "#RESULTS\n",
- "print('\\n Flow coefficient = %.3f gpm ' %Cv1)\n",
- "print('\\n Pressure drop = %.3f psi ' %dp1)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " Flow coefficient = 1.597 gpm \n",
- "\n",
- " Pressure drop = 26.138 psi \n"
- ]
- }
- ],
- "prompt_number": 1
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:3d71fc1cf7c62e68f0f9134ed53e2d1461bd07ccc001344fd0d06803f2676584"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1> Chapter 10 : Valves <h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 10.1 Page No 225 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "Q=30.0 #gpm flow rate\n",
+ "dp=300.0 #pressure drop lbf/in^2\n",
+ "Sg=0.85 #density\n",
+ "Cv=5.41 #Flow coefficient\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Cv1=Q/(math.sqrt(dp/Sg)) \n",
+ "dp1=Sg*Q**2/Cv**2\n",
+ "\n",
+ "#RESULTS\n",
+ "print('\\n Flow coefficient = %.3f gpm ' %Cv1)\n",
+ "print('\\n Pressure drop = %.3f psi ' %dp1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Flow coefficient = 1.597 gpm \n",
+ "\n",
+ " Pressure drop = 26.138 psi \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_11.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_11.ipynb
index 81b29992..1d8b9368 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_11.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_11.ipynb
@@ -1,145 +1,146 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1> Chapter No 11: Seals and packings <h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 11.1, Page No 269 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Groove diameter width\n",
- "\n",
- "#Variable initialization\n",
- "d=4.0 #in diameter\n",
- "p=20.0 #percent\n",
- "d1=0.140 #in cross section\n",
- "\n",
- "#CALCULATIONS\n",
- "Gd=d-2.0*((100.0 -20.0)*d1 /100.0)\n",
- "Gw=d1+2.0*(p*d1/100.0)\n",
- "\n",
- "#RESULTS\n",
- "print(' Groove diameter = %.3f in ' %Gd)\n",
- "print(' \\n Groove width = %.3f in ' %Gw)\n",
- "print('\\n outside diameter = %.3f in ' %d)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Groove diameter = 3.776 in \n",
- " \n",
- " Groove width = 0.196 in \n",
- "\n",
- " outside diameter = 4.000 in "
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 11.2 Page NO 272 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find final thickness\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "D=2.0 #in diameter\n",
- "S=10.0 #in stroke\n",
- "s=10000.0 #stroke in\n",
- "V=231.0 #in^3 volume\n",
- "\n",
- "#CALCULATIONS\n",
- "di=(V/(S*s*D* math.pi))\n",
- "\n",
- "#RESULTS\n",
- "print(' Thickness= %.6f in ' %di)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Thickness= 0.000368 in \n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 11.3 Page No 277 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find final available squeeze\n",
- "\n",
- "#Variable initialization\n",
- "d=0.275 #in diameter\n",
- "p=15.0 #initial squeeze percent\n",
- "p1=20.0 #increase in squeeze percent\n",
- "p3=8.0 #reduction in squeeze percent\n",
- "\n",
- "#CALCULATIONS\n",
- "Fs=(d*p/100.0)+(d*p1/100.0)-(d*p3 /100.0)\n",
- "Fs1= Fs *100.0/ d\n",
- "\n",
- "#RESULTS\n",
- "print('\\n final available squeeze = %.3f percent' %Fs1 )"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " final available squeeze = 27.000 percent"
- ]
- }
- ],
- "prompt_number": 3
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:61d4ab1a97743a659c566a2eb33a4c42c8a0663679f30d0a243310539a4ede57"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1> Chapter No 11: Seals and packings <h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 11.1, Page No 269 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable initialization\n",
+ "d=4.0 #in diameter\n",
+ "p=20.0 #percent\n",
+ "d1=0.140 #in cross section\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Gd=d-2.0*((100.0 -20.0)*d1 /100.0)\n",
+ "Gw=d1+2.0*(p*d1/100.0)\n",
+ "\n",
+ "#RESULTS\n",
+ "print(' Groove diameter = %.3f in ' %Gd)\n",
+ "print(' \\n Groove width = %.3f in ' %Gw)\n",
+ "print('\\n outside diameter = %.3f in ' %d)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Groove diameter = 3.776 in \n",
+ " \n",
+ " Groove width = 0.196 in \n",
+ "\n",
+ " outside diameter = 4.000 in "
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 11.2 Page NO 272 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "D=2.0 #in diameter\n",
+ "S=10.0 #in stroke\n",
+ "s=10000.0 #stroke in\n",
+ "V=231.0 #in^3 volume\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "di=(V/(S*s*D* math.pi))\n",
+ "\n",
+ "#RESULTS\n",
+ "print(' Thickness= %.6f in ' %di)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Thickness= 0.000368 in \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 11.3 Page No 277 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable initialization\n",
+ "d=0.275 #in diameter\n",
+ "p=15.0 #initial squeeze percent\n",
+ "p1=20.0 #increase in squeeze percent\n",
+ "p3=8.0 #reduction in squeeze percent\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Fs=(d*p/100.0)+(d*p1/100.0)-(d*p3 /100.0)\n",
+ "Fs1= Fs *100.0/ d\n",
+ "\n",
+ "#RESULTS\n",
+ "print('\\n final available squeeze = %.3f percent' %Fs1 )"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " final available squeeze = 27.000 percent"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_12.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_12.ipynb
index 05fb97c3..4ba37f47 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_12.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_12.ipynb
@@ -1,281 +1,281 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 12 : System components <h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 12.1 Page No 290 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Total Btu heat loss over a period of 4 hr\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "t=4.0 #hr time\n",
- "Ihp=8.0 #ihp power\n",
- "Ohp=5.0 #hp power\n",
- "\n",
- "#CALCULATIONS\n",
- "Hl=t*2544.0*(Ihp-Ohp)\n",
- "\n",
- "#RESULT\n",
- "print(' Total Btu heat loss over a period of 4 hr = %.3f Btu ' %Hl)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Total Btu heat loss over a period of 4 hr = 30528.000 Btu "
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 12.2 Page No 292 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Rise in temperature of the fluid\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "t=1.0 #sec time\n",
- "P=1000.0 #lbf/in^2 pressure \n",
- "Q=3.0 #gpm flow rate\n",
- "Sg=0.85 # density\n",
- "s=0.42\n",
- "\n",
- "#CALCULATIONS\n",
- "H=42.4*((P*Q)/1714) #Heat Generation Rate\n",
- "m=8.34*Q*Sg #mass flow Rate\n",
- "Tr=H/(m*s)\n",
- "\n",
- "#RESULTS\n",
- "print(' Rise in temperature of the fluid = %.2f F' %Tr)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Rise in temperature of the fluid = 8.31 F\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 12.3 Page No 296 <h3> "
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Weight and Stroke length\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "P=1500.0 #lbf/in^2 pressure\n",
- "d=12.0 #in diameter\n",
- "V=50.0 #gal volume\n",
- "\n",
- "#CALCULATIONS\n",
- "F=P*(math.pi*d**2/4)\n",
- "S=V*231.0*4.0/(math.pi*d**2)\n",
- "\n",
- "#RESULTS\n",
- "print('Weight = %.3f lbf ' %F)\n",
- "print('\\n Stroke length = %.3f in ' %S)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Weight = 169646.003 lb \n",
- "\n",
- " Stroke length = 102.124 in "
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 12.4 Page No 298 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Size of accumulator\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "P=1500.0 #lbf/in^2 pressure\n",
- "V=5.0 #gal volume\n",
- "P1=3000.0 #lbf/in^2 pressure\n",
- "P2=2000.0 #lbf/in^2 pressure\n",
- "\n",
- "#CALCULATIONS\n",
- "V2=V*231.0*(P2+14.7)/(P1-P2)\n",
- "V1=V2*(P1+14.7)/((P+14.7)*231.0)\n",
- "\n",
- "#RESULT\n",
- "print('\\n Size of accumulator = %.3f gal ' %V1)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " Size of accumulator = 20.049 gal "
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 12.5 Page No 300 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Percentage difference in volume\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "beta=1.4\n",
- "p3=2000.0+14.7 #non guage presure\n",
- "p2=3000.0+14.7 #non guage presure\n",
- "p1=1500.0+14.7 #non guage presure\n",
- "deltav=1155.0\n",
- "\n",
- "#Calculations\n",
- "v2=(p3/p2)**(1/beta)*(deltav)/(1-(p3/p2)**(1/beta))\n",
- "v1=v2*(p2/p1)**(1/beta)\n",
- "perdiff=(v1-4627.25)*100.0/v1\n",
- "\n",
- "#Results\n",
- "print(' Volume 2 = %.3f in^3' %v2)\n",
- "print(' \\n Volume 1 = %.3f in^3' %v1)\n",
- "print(' \\n Percentage difference in volume = %.3f percent' %perdiff )"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Volume 2 = 3462.278 in^3\n",
- " \n",
- " Volume 1 = 5660.756 in^3\n",
- " \n",
- " Percentage difference in volume = 18.257 percent\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 12.6 Page No 305 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Wall thcikness\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "Fr=20.0 #gpm flowrate\n",
- "P=2500.0 #lbf/in^2 pressure\n",
- "sf=4.0 #safety factor\n",
- "Ts=55000.0 #lbf/in^2 pressure\n",
- "V=15.0 #ft/s velocity\n",
- "\n",
- "#CALCULATIONS\n",
- "A=Fr*0.3208/V\n",
- "ID=2.0*math.sqrt(A/math.pi)\n",
- "Wt=P*ID/(2*(Ts-P))\n",
- "Wt1=Wt*sf\n",
- "\n",
- "#RESULT\n",
- "print('Wall thcikness = %.3f in ' %Wt1)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Wall thcikness = 0.070 in "
- ]
- }
- ],
- "prompt_number": 6
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e47b17659a986113237b599864f0f5038d52353b8973503557033e3de92c3ae9"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 12 : System components <h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 12.1 Page No 290 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "t=4.0 #hr time\n",
+ "Ihp=8.0 #ihp power\n",
+ "Ohp=5.0 #hp power\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Hl=t*2544.0*(Ihp-Ohp)\n",
+ "\n",
+ "#RESULT\n",
+ "print(' Total Btu heat loss over a period of 4 hr = %.3f Btu ' %Hl)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Total Btu heat loss over a period of 4 hr = 30528.000 Btu "
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 12.2 Page No 292 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "t=1.0 #sec time\n",
+ "P=1000.0 #lbf/in^2 pressure \n",
+ "Q=3.0 #gpm flow rate\n",
+ "Sg=0.85 # density\n",
+ "s=0.42\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "H=42.4*((P*Q)/1714) #Heat Generation Rate\n",
+ "m=8.34*Q*Sg #mass flow Rate\n",
+ "Tr=H/(m*s)\n",
+ "\n",
+ "#RESULTS\n",
+ "print(' Rise in temperature of the fluid = %.2f F' %Tr)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Rise in temperature of the fluid = 8.31 F\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 12.3 Page No 296 <h3> "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "P=1500.0 #lbf/in^2 pressure\n",
+ "d=12.0 #in diameter\n",
+ "V=50.0 #gal volume\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "F=P*(math.pi*d**2/4)\n",
+ "S=V*231.0*4.0/(math.pi*d**2)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('Weight = %.3f lbf ' %F)\n",
+ "print('\\n Stroke length = %.3f in ' %S)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Weight = 169646.003 lb \n",
+ "\n",
+ " Stroke length = 102.124 in "
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 12.4 Page No 298 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "P=1500.0 #lbf/in^2 pressure\n",
+ "V=5.0 #gal volume\n",
+ "P1=3000.0 #lbf/in^2 pressure\n",
+ "P2=2000.0 #lbf/in^2 pressure\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "V2=V*231.0*(P2+14.7)/(P1-P2)\n",
+ "V1=V2*(P1+14.7)/((P+14.7)*231.0)\n",
+ "\n",
+ "#RESULT\n",
+ "print('\\n Size of accumulator = %.3f gal ' %V1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Size of accumulator = 20.049 gal "
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 12.5 Page No 300 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "beta=1.4\n",
+ "p3=2000.0+14.7 #non guage presure\n",
+ "p2=3000.0+14.7 #non guage presure\n",
+ "p1=1500.0+14.7 #non guage presure\n",
+ "deltav=1155.0\n",
+ "\n",
+ "#Calculations\n",
+ "v2=(p3/p2)**(1/beta)*(deltav)/(1-(p3/p2)**(1/beta))\n",
+ "v1=v2*(p2/p1)**(1/beta)\n",
+ "perdiff=(v1-4627.25)*100.0/v1\n",
+ "\n",
+ "#Results\n",
+ "print(' Volume 2 = %.3f in^3' %v2)\n",
+ "print(' \\n Volume 1 = %.3f in^3' %v1)\n",
+ "print(' \\n Percentage difference in volume = %.3f percent' %perdiff )"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Volume 2 = 3462.278 in^3\n",
+ " \n",
+ " Volume 1 = 5660.756 in^3\n",
+ " \n",
+ " Percentage difference in volume = 18.257 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 12.6 Page No 305 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "Fr=20.0 #gpm flowrate\n",
+ "P=2500.0 #lbf/in^2 pressure\n",
+ "sf=4.0 #safety factor\n",
+ "Ts=55000.0 #lbf/in^2 pressure\n",
+ "V=15.0 #ft/s velocity\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "A=Fr*0.3208/V\n",
+ "ID=2.0*math.sqrt(A/math.pi)\n",
+ "Wt=P*ID/(2*(Ts-P))\n",
+ "Wt1=Wt*sf\n",
+ "\n",
+ "#RESULT\n",
+ "print('Wall thcikness = %.3f in ' %Wt1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Wall thcikness = 0.070 in "
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_14.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_14.ipynb
index 6092f622..6909d7dd 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_14.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_14.ipynb
@@ -1,287 +1,285 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1> Chapter No 14 :Troubleshooting Hydraulic systems<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.1 Page No 386 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find breakway torque\n",
- "\n",
- "#initialisation of variables\n",
- "p=1800 #lbf/in^2 pressure\n",
- "Vd=1.5 #in^3/rev displacement\n",
- "\n",
- "#CALCULATIONS\n",
- "T=0.013*p*Vd\n",
- "\n",
- "#RESULTS\n",
- "print('The breakway torque = %.2f lbf-ft' %T)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The breakway torque = 35.10 percent\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.2, Page No 386 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find min pressure\n",
- "\n",
- "#initialisation of variables\n",
- "T=80 #lbf-ft torque\n",
- "Vd=3.5 #in^3/rev displacement\n",
- "\n",
- "#CALCULATIONS\n",
- "P=(T/(0.013*Vd))*(1/0.75)\n",
- "\n",
- "#RESULTS\n",
- "print('The min pressure = %.2f lbf/in^2' %P)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The min pressure = 2344.32 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.3, Page No 389 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find a)flow from the pump b)Volumetric efficiency of the system\n",
- "\n",
- "#initialisation of variables\n",
- "N=1200 #rev/min theotrical power\n",
- "Vd=0.75 #in^3/rev displacement\n",
- "Vd2=0.57\n",
- "#CALCULATIONS\n",
- "# part a\n",
- "Q=(Vd*N)/231\n",
- "# part b\n",
- "Qa=Q-0.50\n",
- "N2=(231*Qa)/Vd2\n",
- "ev=(Qa/Q)*100\n",
- "#RESULTS\n",
- "print('The flow from the pump = %.2f lbf/in^2' %Qa)\n",
- "print('The actual speed of the motor = %.2f rev/min' %N2)\n",
- "print('The Volumetric efficiency of the system = %.2f percent' %ev)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The flow from the pump = 3.40 lbf/in^2\n",
- "The actual speed of the motor = 1376.32 rev/min\n",
- "The Volumetric efficiency of the system = 87.17 percent\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.4, Page No 390 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the Velocity\n",
- "\n",
- "#initialisation of variables\n",
- "Q=3.9 #gal/min flow rate\n",
- "Sg=0.87 # density\n",
- "Ac=4.9 #in^2 area\n",
- "\n",
- "#CALCULATIONS\n",
- "Qa=0.872*Q\n",
- "Vrod=Qa/(0.26*Ac)\n",
- "\n",
- "#RESULTS\n",
- "print('The Velocity = %.2f in/sec' %Vrod)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Velocity = 2.67 in/sec\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.5, Page No 390 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the area\n",
- "\n",
- "#initialisation of variables\n",
- "Q=10.0 #gal/min flow rate\n",
- "P=1500 #lbf/in^2 pressure\n",
- "\n",
- "#CALCULATIONS\n",
- "Fhp=((P*Q)/1714)*0.25\n",
- "A=Fhp/(0.001*75)\n",
- "\n",
- "#RESULTS\n",
- "print('The area is = %.2f ft^2' %A)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The area is = 29.17 ft^2\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.6, Page No 391<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Find the temparature\n",
- "\n",
- "#initialisation of variables\n",
- "A=15.0 #ft^2 area\n",
- "HP=0.25*5 # power\n",
- "\n",
- "#CALCULATIONS\n",
- "T=(HP/(0.001*A))+75\n",
- "\n",
- "#RESULTS\n",
- "print('The temparature is = %.2f F' %T)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The temparature is = 158.33 F\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 14.7, Page No 392 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the heat that should be dissipated\n",
- "\n",
- "#initialisation of variables\n",
- "A=100 #ft^2 area\n",
- "T=40 #F temperature \n",
- "\n",
- "#CALCULATIONS\n",
- "q=2.545*A*T\n",
- "\n",
- "#RESULTS\n",
- "print('The heat that should be dissipated is = %.2f Btu/hr' %q)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The heat that should be dissipated is = 10180.00 Btu/hr\n"
- ]
- }
- ],
- "prompt_number": 7
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:251fa751d76e0f33020a23b4f02af4b2cc97d384648ba729ca3ce134685988be"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1> Chapter No 14 :Troubleshooting Hydraulic systems<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.1 Page No 386 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "p=1800 #lbf/in^2 pressure\n",
+ "Vd=1.5 #in^3/rev displacement\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "T=0.013*p*Vd\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The breakway torque = %.2f lbf-ft' %T)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The breakway torque = 35.10 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.2, Page No 386 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "T=80 #lbf-ft torque\n",
+ "Vd=3.5 #in^3/rev displacement\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "P=(T/(0.013*Vd))*(1/0.75)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The min pressure = %.2f lbf/in^2' %P)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The min pressure = 2344.32 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.3, Page No 389 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "N=1200 #rev/min theotrical power\n",
+ "Vd=0.75 #in^3/rev displacement\n",
+ "Vd2=0.57\n",
+ "#CALCULATIONS\n",
+ "# part a\n",
+ "Q=(Vd*N)/231\n",
+ "# part b\n",
+ "Qa=Q-0.50\n",
+ "N2=(231*Qa)/Vd2\n",
+ "ev=(Qa/Q)*100\n",
+ "#RESULTS\n",
+ "print('The flow from the pump = %.2f lbf/in^2' %Qa)\n",
+ "print('The actual speed of the motor = %.2f rev/min' %N2)\n",
+ "print('The Volumetric efficiency of the system = %.2f percent' %ev)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The flow from the pump = 3.40 lbf/in^2\n",
+ "The actual speed of the motor = 1376.32 rev/min\n",
+ "The Volumetric efficiency of the system = 87.17 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.4, Page No 390 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialisation of variables\n",
+ "Q=3.9 #gal/min flow rate\n",
+ "Sg=0.87 # density\n",
+ "Ac=4.9 #in^2 area\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Qa=0.872*Q\n",
+ "Vrod=Qa/(0.26*Ac)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The Velocity = %.2f in/sec' %Vrod)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Velocity = 2.67 in/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.5, Page No 390 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialisation of variables\n",
+ "Q=10.0 #gal/min flow rate\n",
+ "P=1500 #lbf/in^2 pressure\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Fhp=((P*Q)/1714)*0.25\n",
+ "A=Fhp/(0.001*75)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The area is = %.2f ft^2' %A)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The area is = 29.17 ft^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.6, Page No 391<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialisation of variables\n",
+ "A=15.0 #ft^2 area\n",
+ "HP=0.25*5 # power\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "T=(HP/(0.001*A))+75\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The temparature is = %.2f F' %T)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The temparature is = 158.33 F\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 14.7, Page No 392 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "A=100 #ft^2 area\n",
+ "T=40 #F temperature \n",
+ "\n",
+ "#CALCULATIONS\n",
+ "q=2.545*A*T\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The heat that should be dissipated is = %.2f Btu/hr' %q)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The heat that should be dissipated is = 10180.00 Btu/hr\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_15.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_15.ipynb
index dcfeae0d..06bfac96 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_15.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_15.ipynb
@@ -1,229 +1,229 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 15 : Basics of Pneumatics <h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 15.1 Page No 405 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Guage pressure\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "V1=20.0 #gal volume\n",
- "P1=20.0 #lbf/in^2 pressure\n",
- "n=2.0\n",
- "\n",
- "#CALCULATIONS\n",
- "V2=V1/n\n",
- "P2=(P1+14.7)*V1*231.0/(V2*231.0)\n",
- "P3=P2-14.7\n",
- "\n",
- "#RESULT\n",
- "print('Guage pressure = %.3f psi ' %P3)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Guage pressure = 54.700 psi \n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 15.2 Page No 406 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Volume the heated gas will occupy\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "V1=1500.0 #in^3 volume\n",
- "T=80.0 #F temperature\n",
- "T1=200.0 #F temperature\n",
- "\n",
- "#CALCULATIONS\n",
- "V2=V1*(460.0+T1)/(T+460.0)\n",
- "\n",
- "#RESULT\n",
- "print('Volume the heated gas will occupy = %.3f in ^3 ' %V2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Volume the heated gas will occupy = 1833.333 in ^3 "
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 15.3 Page No 406 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the Guage pressure\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "P1=2000.0 #in^3\n",
- "T=80.0 #F temperature\n",
- "T1=250.0 #F temperature\n",
- "\n",
- "#CALCULATIONS\n",
- "P2=(P1+14.7)*(460.0+T1)/(T+460.0)\n",
- "P3=P2-14.7\n",
- "\n",
- "#RESULT\n",
- "print(' Guage pressure = %.3f psi ' %P3)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Guage pressure = 2634.257 psi "
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 15.4 Page No 407 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the Guage pressure\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "P1=2000.0 #lbf/in^2 pressure\n",
- "V1=1500.0 #in^3 volume\n",
- "T2=250.0 #F temperature\n",
- "T1=75.0 #F temperature\n",
- "V2=1000.0 #in^3 volume\n",
- "\n",
- "#CALCULATIONS\n",
- "P2=(P1+14.7)*V1*(T2+460.0)/((T1+460.0)*V2)\n",
- "P3=P2-14.7\n",
- "#RESULT\n",
- "print('\\n Guage pressure = %.3f psi ' %P3)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " Guage pressure = 3995.871 psi \n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 15.5 Page No 409 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Air consumption in cfm of free air\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "s=10.0 #stroke in\n",
- "d=2.0 #in diameter\n",
- "r=40.0 #cpm cycles per rate\n",
- "P1=80.0 #lbf/in^2 pressure\n",
- "Ps1=552+101 #kN/m^2 pressure\n",
- "Ps2=101 #kN/m^2 pressure\n",
- "#CALCULATIONS\n",
- "V1=math.pi*d**2*s*r/(4*1728.0)\n",
- "V2=(P1+14.7)*V1/14.7\n",
- "# In SI units\n",
- "Vs1=(20.3*25.4*r)/(1000000)\n",
- "Vs2=(Ps1*Vs1)/Ps2\n",
- "#RESULT\n",
- "print(' Air consumption in cfm of free air = %.3f cfm free air ' %V2)\n",
- "print(' In SI units Air consumption in cfm of free air = %.3f m^3/min free air ' %Vs2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Air consumption in cfm of free air = 4.685 cfm free air \n",
- " Air consumption in cfm of free air = 0.133 cfm free air \n"
- ]
- }
- ],
- "prompt_number": 5
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:218eef76eba5bc112a5af1f09e9dfcdb3c88be276a9fda8b85e2aab7235b5119"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 15 : Basics of Pneumatics <h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 15.1 Page No 405 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "V1=20.0 #gal volume\n",
+ "P1=20.0 #lbf/in^2 pressure\n",
+ "n=2.0\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "V2=V1/n\n",
+ "P2=(P1+14.7)*V1*231.0/(V2*231.0)\n",
+ "P3=P2-14.7\n",
+ "\n",
+ "#RESULT\n",
+ "print('Guage pressure = %.3f psi ' %P3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Guage pressure = 54.700 psi \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 15.2 Page No 406 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "V1=1500.0 #in^3 volume\n",
+ "T=80.0 #F temperature\n",
+ "T1=200.0 #F temperature\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "V2=V1*(460.0+T1)/(T+460.0)\n",
+ "\n",
+ "#RESULT\n",
+ "print('Volume the heated gas will occupy = %.3f in ^3 ' %V2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Volume the heated gas will occupy = 1833.333 in ^3 "
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 15.3 Page No 406 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "P1=2000.0 #in^3\n",
+ "T=80.0 #F temperature\n",
+ "T1=250.0 #F temperature\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "P2=(P1+14.7)*(460.0+T1)/(T+460.0)\n",
+ "P3=P2-14.7\n",
+ "\n",
+ "#RESULT\n",
+ "print(' Guage pressure = %.3f psi ' %P3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Guage pressure = 2634.257 psi "
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 15.4 Page No 407 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "P1=2000.0 #lbf/in^2 pressure\n",
+ "V1=1500.0 #in^3 volume\n",
+ "T2=250.0 #F temperature\n",
+ "T1=75.0 #F temperature\n",
+ "V2=1000.0 #in^3 volume\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "P2=(P1+14.7)*V1*(T2+460.0)/((T1+460.0)*V2)\n",
+ "P3=P2-14.7\n",
+ "#RESULT\n",
+ "print('\\n Guage pressure = %.3f psi ' %P3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Guage pressure = 3995.871 psi \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 15.5 Page No 409 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "s=10.0 #stroke in\n",
+ "d=2.0 #in diameter\n",
+ "r=40.0 #cpm cycles per rate\n",
+ "P1=80.0 #lbf/in^2 pressure\n",
+ "Ps1=552+101 #kN/m^2 pressure\n",
+ "Ps2=101 #kN/m^2 pressure\n",
+ "#CALCULATIONS\n",
+ "V1=math.pi*d**2*s*r/(4*1728.0)\n",
+ "V2=(P1+14.7)*V1/14.7\n",
+ "# In SI units\n",
+ "Vs1=(20.3*25.4*r)/(1000000)\n",
+ "Vs2=(Ps1*Vs1)/Ps2\n",
+ "#RESULT\n",
+ "print(' Air consumption in cfm of free air = %.3f cfm free air ' %V2)\n",
+ "print(' In SI units Air consumption in cfm of free air = %.3f m^3/min free air ' %Vs2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Air consumption in cfm of free air = 4.685 cfm free air \n",
+ " Air consumption in cfm of free air = 0.133 cfm free air \n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_16.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_16.ipynb
index 2a26087d..990ae2bf 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_16.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_16.ipynb
@@ -1,290 +1,290 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter No 16 : Sizing Pneumatic systems <h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 16.1, Page No 422<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the pressure drop\n",
- "\n",
- "#initialisation of variables\n",
- "L=500 #ft length\n",
- "d=47.2561 #diameter in\n",
- "Q=650 # ft^3/min\n",
- "T=40 #F Temperature \n",
- "\n",
- "#CALCULATIONS\n",
- "CR=(250+14.7)/14.7\n",
- "Pf=(0.1025*L*(Q*1/60)*(Q*1/60))/(CR*d)\n",
- "\n",
- "#RESULTS\n",
- "print('The the pressure drop is = %.2f lbf/in^2' %Pf)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The the pressure drop is = 6.02 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 16.2, Page No 423<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the pressure drop\n",
- "\n",
- "#initialisation of variables\n",
- "L=(8*5.2)+(2*59)+(1*10.3) #ft length\n",
- "C=0.1025 # Experimental coefficient\n",
- "d=47.2561 # internal diameter\n",
- "Q=500.0 # ft^3/min free air \n",
- "CR=4.4 # ratio of compression of pipe\n",
- "\n",
- "\n",
- "#CALCULATIONS\n",
- "\n",
- "Pf=(C*L*((Q*1/60)*(Q*1/60)))/(CR*d)\n",
- "\n",
- "#RESULTS\n",
- "print('The the pressure drop is = %.2f lbf/in^2' %Pf)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The the pressure drop is = 5.82 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 16.3, Page No 433 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the total air consumption\n",
- "\n",
- "#initialisation of variables\n",
- "#CALCULATIONS\n",
- "T=60+(0.25*60) #total air consumption ft^3/min\n",
- "\n",
- "#RESULTS\n",
- "print('The total air consumption = %.2f ft^3/min' %T)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The total air consumption = 75.00 ft^3/min\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 16.4, Page No 434 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the size of the receiver\n",
- "\n",
- "#initialisation of variables\n",
- "Qr=10 #ft^3/min consumption rate\n",
- "t=5 #time min\n",
- "p1=125 #lbf/in^2 pressure\n",
- "p2=100 #lbf/in^2 pressure\n",
- "\n",
- "#CALCULATIONS\n",
- "Vr=(14.7*Q*t)/(p1-p2)\n",
- "\n",
- "#RESULTS\n",
- "print('The size of the receiver = %.2f ft^3' %Vr)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The size of the receiver = 29.40 ft^3\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 16.5, Page No 444 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the size of the air valve\n",
- "\n",
- "#initialisation of variables\n",
- "Q=35 #ft^3/min consumption rate\n",
- "t=540 #time min\n",
- "p1=90+14.7 #presure lbf/in^2\n",
- "p2=80+14.7 # pressure lbf/in^2\n",
- "\n",
- "#CALCULATIONS\n",
- "K=(p1+p2)/2\n",
- "Cv=(Q/22.67)*(math.sqrt(t/((p1-p2)*K)))\n",
- "\n",
- "#RESULTS\n",
- "print('The size of the air valve = %.2f ' %Cv)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The size of the air valve = 1.14 \n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 16.7, Page No 448 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the free air consumption\n",
- "\n",
- "#initialisation of variables\n",
- "Q=35 #ft^3/min consumption rate\n",
- "V1=0.327 #volume ft^3/min\n",
- "p1=104.7 #presure lbf/in^2\n",
- "p2=14.7 #pressure lbf/in^2\n",
- "d=3 #in diameter\n",
- "#CALCULATIONS\n",
- "A=(3.14*(d*d)/4\n",
- "Q=((A*4)/1728)*20\n",
- "V2=p1*V1/p2\n",
- "\n",
- "#RESULTS\n",
- "print('The free air consumption = %.2f ft^3/min' %V2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The free air consumption = 2.33 ft^3/min\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 16.8, Page No 451 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the free air consumption\n",
- "\n",
- "#initialisation of variables\n",
- "Fa=0.065 # free air ft^3/in\n",
- "d=4 # stroke in\n",
- "c=20 # cycle rate cycles/min\n",
- "#CALCULATIONS\n",
- "Qv=(Fa*d*c)/2\n",
- "\n",
- "#RESULTS\n",
- "print('The free air consumption = %.2f ft^3/min' %Qv)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The free air consumption = 2.60 ft^3/min\n"
- ]
- }
- ],
- "prompt_number": 2
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:1752ce8abd4db43dc9301d3a391f312646e1e708eed7ee0a80cbc87acc9e9b2d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter No 16 : Sizing Pneumatic systems <h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 16.1, Page No 422<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "L=500 #ft length\n",
+ "d=47.2561 #diameter in\n",
+ "Q=650 # ft^3/min\n",
+ "T=40 #F Temperature \n",
+ "\n",
+ "#CALCULATIONS\n",
+ "CR=(250+14.7)/14.7\n",
+ "Pf=(0.1025*L*(Q*1/60)*(Q*1/60))/(CR*d)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The the pressure drop is = %.2f lbf/in^2' %Pf)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The the pressure drop is = 6.02 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 16.2, Page No 423<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialisation of variables\n",
+ "L=(8*5.2)+(2*59)+(1*10.3) #ft length\n",
+ "C=0.1025 # Experimental coefficient\n",
+ "d=47.2561 # internal diameter\n",
+ "Q=500.0 # ft^3/min free air \n",
+ "CR=4.4 # ratio of compression of pipe\n",
+ "\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "\n",
+ "Pf=(C*L*((Q*1/60)*(Q*1/60)))/(CR*d)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The the pressure drop is = %.2f lbf/in^2' %Pf)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The the pressure drop is = 5.82 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 16.3, Page No 433 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "#CALCULATIONS\n",
+ "T=60+(0.25*60) #total air consumption ft^3/min\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The total air consumption = %.2f ft^3/min' %T)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total air consumption = 75.00 ft^3/min\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 16.4, Page No 434 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Qr=10 #ft^3/min consumption rate\n",
+ "t=5 #time min\n",
+ "p1=125 #lbf/in^2 pressure\n",
+ "p2=100 #lbf/in^2 pressure\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Vr=(14.7*Q*t)/(p1-p2)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The size of the receiver = %.2f ft^3' %Vr)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The size of the receiver = 29.40 ft^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 16.5, Page No 444 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Q=35 #ft^3/min consumption rate\n",
+ "t=540 #time min\n",
+ "p1=90+14.7 #presure lbf/in^2\n",
+ "p2=80+14.7 # pressure lbf/in^2\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "K=(p1+p2)/2\n",
+ "Cv=(Q/22.67)*(math.sqrt(t/((p1-p2)*K)))\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The size of the air valve = %.2f ' %Cv)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The size of the air valve = 1.14 \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 16.7, Page No 448 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Q=35 #ft^3/min consumption rate\n",
+ "V1=0.327 #volume ft^3/min\n",
+ "p1=104.7 #presure lbf/in^2\n",
+ "p2=14.7 #pressure lbf/in^2\n",
+ "d=3 #in diameter\n",
+ "#CALCULATIONS\n",
+ "A=(3.14*(d*d)/4\n",
+ "Q=((A*4)/1728)*20\n",
+ "V2=p1*V1/p2\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The free air consumption = %.2f ft^3/min' %V2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The free air consumption = 2.33 ft^3/min\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 16.8, Page No 451 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Fa=0.065 # free air ft^3/in\n",
+ "d=4 # stroke in\n",
+ "c=20 # cycle rate cycles/min\n",
+ "#CALCULATIONS\n",
+ "Qv=(Fa*d*c)/2\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The free air consumption = %.2f ft^3/min' %Qv)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The free air consumption = 2.60 ft^3/min\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_2.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_2.ipynb
index 19492cdb..0861593c 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_2.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_2.ipynb
@@ -1,429 +1,428 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1> Chpater No 2: Basics of Hydraulics<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.1, Page No 23 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the work from the system\n",
- "\n",
- "#initialisation of variables\n",
- "W=1000.0 #weight lbf\n",
- "D=1.25 #distance ft\n",
- "\n",
- "#CALCULATIONS\n",
- "Work=W*D\n",
- "#IN SI unit\n",
- "W=4448 #weight N\n",
- "D=0.381 #distance m\n",
- "Work1=W*D\n",
- "\n",
- "#RESULTS\n",
- "print('The work from the system would be = %.2f ft-lbf' %Work)\n",
- "print('The work from the system in SI unit would be = %.2f m-N' %Work1)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The work from the system would be = 1250.00 ft-lbf\n",
- "The work from the system in SI unit would be = 1694.69 m-N\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.2, Page No 24 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find distance pump piston have to travel\n",
- "\n",
- "#initialisation of variables\n",
- "F1=100.0 #Force lbf\n",
- "F2=2000.0 #Force lbf\n",
- "L2=12 #in\n",
- "\n",
- "#CALCULATIONS\n",
- "L11=L2*(F2/F1)\n",
- "#IN SI unit\n",
- "F1=444.8 #Force N\n",
- "F2=8896.0 #Force N\n",
- "L2=0.3048 #Force m\n",
- "L12=L2*(F2/F1)\n",
- "\n",
- "#RESULTS\n",
- "print('The pump piston have to travel = %.2f in' %L11)\n",
- "print('The pump piston have to travel = %.2f m' %L12)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The pump piston have to travel = 240.00 in\n",
- "The pump piston have to travel = 6.10 m\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.3, Page No 25 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find how much weight lifted by a downward force\n",
- "\n",
- "#initialisation of variables\n",
- "F1=150.0 #lbf Force\n",
- "A1=0.049 #in^2 area\n",
- "A2=0.785 #in^2 area\n",
- "\n",
- "#CALCULATIONS\n",
- "F21=F1*(A2/A1)\n",
- "#IN SI unit\n",
- "F1=667.2 #N(Force)\n",
- "A1=31.7 #mm^2(Area)\n",
- "A2=506.7 #mm^2(Area)\n",
- "F22=F1*(A2/A1)\n",
- "\n",
- "#RESULTS\n",
- "print('The weight lifted by a downward force = %.2f lbf' %F21)\n",
- "print('weight lifted by a downward force in SI unit = %.2f N' %F22)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The weight lifted by a downward force = 2403.06 lbf\n",
- "weight lifted by a downward force in SI unit = 10664.68 N\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.4, Page No 27 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the horsepower\n",
- "\n",
- "#initialisation of variables\n",
- "F =800.0 #lbf Force\n",
- "D=20 #ft distance\n",
- "t=20 #sec time\n",
- "C=550 #ft-lbf/sec\n",
- "\n",
- "#CALCULATIONS\n",
- "HP=(F*D)/(t*C)\n",
- "\n",
- "#RESULTS\n",
- "print('The Horse powe required is = %.2f HP' %HP)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Horse powe required is = 1.45 HP\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.5, Page No 27 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the horsepower\n",
- "\n",
- "#initialisation of variables\n",
- "V1=2000.0 #watts voltage\n",
- "V2=746.0 #watts voltage\n",
- "\n",
- "#CALCULATIONS\n",
- "HP=V1/V2\n",
- "\n",
- "#RESULTS\n",
- "print('The Horse powe required is = %.2f HP' %HP)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Horse powe required is = 2.68 HP\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.6, Page No 28 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the Displacement and flow rate\n",
- "\n",
- "#initialisation of variables\n",
- "N=1200 #rev/min speed\n",
- "A=(3.14*((1.125*1.125)*5))/4 #Cross section of the bore in in^2\n",
- "L=1 # cylinder stroke (inch)\n",
- "#CALCULATIONS\n",
- "V=A*L\n",
- "Q=V*N/231\n",
- "\n",
- "#RESULTS\n",
- "print('The displacement would be = %.2f in^3/rev' %V)\n",
- "print('The flow rate would be = %.2f gal/min' %Q)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The displacement would be = 4.97 in^3/rev\n",
- "The flow rate would be = 25.81 gal/min\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.7, Page No 31 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the horsepower transmitted by system\n",
- "\n",
- "#initialisation of variables\n",
- "P1=2000.0 #lbf/in^2 pressure\n",
- "Q1=5 #gal/min flow rate\n",
- "P3=13793.0 #kPa pressure\n",
- "Q3=18.9 #liters/min flow rate\n",
- "\n",
- "#CALCULATIONS\n",
- "Fhp1=P1*Q1/1714 #In English units\n",
- "Fhp2=(P1*4.448*1550*Q1*3.7851*0.001)/44760 #In SI unit\n",
- "Fhp3=P3*Q3/44760 #with technique 3\n",
- "\n",
- "\n",
- "#RESULTS\n",
- "print('Using technique 1 the horsepower transmitted by system would be = %.2f hp' %Fhp1)\n",
- "print('Using technique 1 the horsepower transmitted by system would be = %.2f hp' %Fhp2)\n",
- "print('Using technique 1 the horsepower transmitted by system would be = %.2f hp' %Fhp3)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Using technique 1 the horsepower transmitted by system would be = 5.83 hp\n",
- "Using technique 1 the horsepower transmitted by system would be = 5.83 hp\n",
- "Using technique 1 the horsepower transmitted by system would be = 5.82 hp\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.8, Page No 35 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the torque\n",
- "\n",
- "#initialisation of variables\n",
- "THP=5.83 # Horse power \n",
- "pi=3.14 #Pi value\n",
- "N=500 #rev/min speed\n",
- "\n",
- "#CALCULATIONS\n",
- "T=(THP*33000)/(2*pi*N)\n",
- "\n",
- "#RESULTS\n",
- "print('The torque would be = %.2f lbf-ft' %T)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The torque would be = 61.27 lbf-ft\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.9, Page No 35 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the flow rate and Horsepower\n",
- "\n",
- "#initialisation of variables\n",
- "T=2000.0 #lbf-ft torque\n",
- "N=20.0 #rev/min speed\n",
- "P=2000 #lbf/in^2 pressure \n",
- "\n",
- "#CALCULATIONS\n",
- "Q1=(1714*N*T)/(5252*P)\n",
- "Fhp1=(P1*Q1)/1714\n",
- "Q2=(44760*N*2712)/(7122*13793)\n",
- "Fhp2=(13793*Q2)/44760\n",
- "\n",
- "#RESULTS\n",
- "print('In English units the flow rate would be = %.2f gal/min' %Q1)\n",
- "print('In English units the Horsepower would be = %.2f hp' %Fhp1)\n",
- "print('In SI units the flow rate would be = %.2f lit/min' %Q2)\n",
- "print('In SI units the Horsepower would be = %.2f hp' %Fhp2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The flow rate would be = 6.53 gal/min\n",
- "The Horsepower would be = 7.62 hp\n",
- "The flow rate would be = 24.71 gal/min\n",
- "The Horsepower would be = 7.62 hp\n"
- ]
- }
- ],
- "prompt_number": 17
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 2.10, Page No 36 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the expected torque\n",
- "\n",
- "#initialisation of variables\n",
- "N=750.0 #rev/min speed\n",
- "Q=5 #gal/min flow rate\n",
- "P=1000 #lbf/in^2 pressure\n",
- "\n",
- "#CALCULATIONS\n",
- "T=(5252*P*Q)/(1714*N)\n",
- "\n",
- "#RESULTS\n",
- "print('The expected torque would be = %.2f lbf-ft' %T)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The expected torque would be = 20.43 lbf-ft\n"
- ]
- }
- ],
- "prompt_number": 10
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:27338db4766b4c1985ad23f02bae5de155caa330da171300335b58c2d2835845"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1> Chpater No 2: Basics of Hydraulics<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.1, Page No 23 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "W=1000.0 #weight lbf\n",
+ "D=1.25 #distance ft\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Work=W*D\n",
+ "#IN SI unit\n",
+ "W=4448 #weight N\n",
+ "D=0.381 #distance m\n",
+ "Work1=W*D\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The work from the system would be = %.2f ft-lbf' %Work)\n",
+ "print('The work from the system in SI unit would be = %.2f m-N' %Work1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The work from the system would be = 1250.00 ft-lbf\n",
+ "The work from the system in SI unit would be = 1694.69 m-N\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.2, Page No 24 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "F1=100.0 #Force lbf\n",
+ "F2=2000.0 #Force lbf\n",
+ "L2=12 #in\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "L11=L2*(F2/F1)\n",
+ "#IN SI unit\n",
+ "F1=444.8 #Force N\n",
+ "F2=8896.0 #Force N\n",
+ "L2=0.3048 #Force m\n",
+ "L12=L2*(F2/F1)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The pump piston have to travel = %.2f in' %L11)\n",
+ "print('The pump piston have to travel = %.2f m' %L12)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pump piston have to travel = 240.00 in\n",
+ "The pump piston have to travel = 6.10 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.3, Page No 25 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialisation of variables\n",
+ "F1=150.0 #lbf Force\n",
+ "A1=0.049 #in^2 area\n",
+ "A2=0.785 #in^2 area\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "F21=F1*(A2/A1)\n",
+ "#IN SI unit\n",
+ "F1=667.2 #N(Force)\n",
+ "A1=31.7 #mm^2(Area)\n",
+ "A2=506.7 #mm^2(Area)\n",
+ "F22=F1*(A2/A1)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The weight lifted by a downward force = %.2f lbf' %F21)\n",
+ "print('weight lifted by a downward force in SI unit = %.2f N' %F22)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The weight lifted by a downward force = 2403.06 lbf\n",
+ "weight lifted by a downward force in SI unit = 10664.68 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.4, Page No 27 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "F =800.0 #lbf Force\n",
+ "D=20 #ft distance\n",
+ "t=20 #sec time\n",
+ "C=550 #ft-lbf/sec\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "HP=(F*D)/(t*C)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The Horse powe required is = %.2f HP' %HP)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Horse powe required is = 1.45 HP\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.5, Page No 27 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialisation of variables\n",
+ "V1=2000.0 #watts voltage\n",
+ "V2=746.0 #watts voltage\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "HP=V1/V2\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The Horse powe required is = %.2f HP' %HP)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Horse powe required is = 2.68 HP\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.6, Page No 28 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "N=1200 #rev/min speed\n",
+ "A=(3.14*((1.125*1.125)*5))/4 #Cross section of the bore in in^2\n",
+ "L=1 # cylinder stroke (inch)\n",
+ "#CALCULATIONS\n",
+ "V=A*L\n",
+ "Q=V*N/231\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The displacement would be = %.2f in^3/rev' %V)\n",
+ "print('The flow rate would be = %.2f gal/min' %Q)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The displacement would be = 4.97 in^3/rev\n",
+ "The flow rate would be = 25.81 gal/min\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.7, Page No 31 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "P1=2000.0 #lbf/in^2 pressure\n",
+ "Q1=5 #gal/min flow rate\n",
+ "P3=13793.0 #kPa pressure\n",
+ "Q3=18.9 #liters/min flow rate\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Fhp1=P1*Q1/1714 #In English units\n",
+ "Fhp2=(P1*4.448*1550*Q1*3.7851*0.001)/44760 #In SI unit\n",
+ "Fhp3=P3*Q3/44760 #with technique 3\n",
+ "\n",
+ "\n",
+ "#RESULTS\n",
+ "print('Using technique 1 the horsepower transmitted by system would be = %.2f hp' %Fhp1)\n",
+ "print('Using technique 1 the horsepower transmitted by system would be = %.2f hp' %Fhp2)\n",
+ "print('Using technique 1 the horsepower transmitted by system would be = %.2f hp' %Fhp3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Using technique 1 the horsepower transmitted by system would be = 5.83 hp\n",
+ "Using technique 1 the horsepower transmitted by system would be = 5.83 hp\n",
+ "Using technique 1 the horsepower transmitted by system would be = 5.82 hp\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.8, Page No 35 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "THP=5.83 # Horse power \n",
+ "pi=3.14 #Pi value\n",
+ "N=500 #rev/min speed\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "T=(THP*33000)/(2*pi*N)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The torque would be = %.2f lbf-ft' %T)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The torque would be = 61.27 lbf-ft\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.9, Page No 35 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "T=2000.0 #lbf-ft torque\n",
+ "N=20.0 #rev/min speed\n",
+ "P=2000 #lbf/in^2 pressure \n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Q1=(1714*N*T)/(5252*P)\n",
+ "Fhp1=(P1*Q1)/1714\n",
+ "Q2=(44760*N*2712)/(7122*13793)\n",
+ "Fhp2=(13793*Q2)/44760\n",
+ "\n",
+ "#RESULTS\n",
+ "print('In English units the flow rate would be = %.2f gal/min' %Q1)\n",
+ "print('In English units the Horsepower would be = %.2f hp' %Fhp1)\n",
+ "print('In SI units the flow rate would be = %.2f lit/min' %Q2)\n",
+ "print('In SI units the Horsepower would be = %.2f hp' %Fhp2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The flow rate would be = 6.53 gal/min\n",
+ "The Horsepower would be = 7.62 hp\n",
+ "The flow rate would be = 24.71 gal/min\n",
+ "The Horsepower would be = 7.62 hp\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.10, Page No 36 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "N=750.0 #rev/min speed\n",
+ "Q=5 #gal/min flow rate\n",
+ "P=1000 #lbf/in^2 pressure\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "T=(5252*P*Q)/(1714*N)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The expected torque would be = %.2f lbf-ft' %T)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The expected torque would be = 20.43 lbf-ft\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_3.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_3.ipynb
index 4122fcfc..08a4040d 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_3.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_3.ipynb
@@ -1,449 +1,448 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter No 3: Energy in Hydraulic systems<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.1, Page No 44 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find pressure\n",
- "\n",
- "#initialisation of variables\n",
- "h=50.0 #ft height\n",
- "sg=1.0 #Density \n",
- "\n",
- "#CALCULATIONS\n",
- "p=sg*h*0.433 # pressure\n",
- "\n",
- "#RESULTS\n",
- "print('Pressure is = %.2f lbf/in^2' %p)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Pressure is = 21.65 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.2, Page No 44<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Head height\n",
- "\n",
- "#initialisation of variables\n",
- "p=1500.0 #lbf/in^2 pressure\n",
- "Sg=0.78 #Density \n",
- "p2=p*6895 #lbf/in^2 pressure\n",
- "#CALCULATIONS\n",
- "h=(p*2.31)/Sg\n",
- "h2=(p2*1.02)/(10000*Sg) #In metric units\n",
- "\n",
- "#RESULTS\n",
- "print('Head in ft = %.2f ft' %h)\n",
- "print('In metric units Head in ft = %.2f ft' %h2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Head in ft = 4442.31 ft\n",
- "Head in ft = 1352.48 ft\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.3, Page No 45 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Convert Hydralic reading to head meters\n",
- "\n",
- "#initialisation of variables\n",
- "p=13790000 #N/m^2 pressure\n",
- "Sg=0.83 #Density \n",
- "\n",
- "#CALCULATIONS\n",
- "h=(p*1.02)/(Sg*10000)\n",
- "\n",
- "#RESULTS\n",
- "print('Head in ft = %.2f m' %h)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Head in ft = 1694.67 m\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.4, Page No 46 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the velocity\n",
- "\n",
- "#initialisation of variables\n",
- "Q=40 #Gal/min flow rate\n",
- "a1=3.14 #in^2 area\n",
- "a2=12.56 #in^2 area \n",
- "#CALCULATIONS\n",
- "#Part a\n",
- "v1=Q/(a1*3.12) #fluid velocity in 2 in diameter\n",
- "#Part b\n",
- "v2=(a1*v1)/a2 #Fluid Velocity in 4 in diameter\n",
- "#RESULTS\n",
- "print('Fluid Velocity in 2 in diameter pipe is = %.2f ft/sec' %v1)\n",
- "print('Fluid Velocity in 4 in diameter pipe is = %.2f ft/sec' %v2)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Fluid Velocity is = 4.08 ft/sec\n",
- "Fluid Velocity is = 1.02 ft/sec\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.5, Page No 47 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the min Diameter of the pipe\n",
- "\n",
- "#initialisation of variables\n",
- "Q=18 #Gal/min flow rate\n",
- "a=3.14 #in^2 area \n",
- "v2=10 #ft/sec velocity\n",
- "#CALCULATIONS\n",
- "v=Q/(a*3.12) \n",
- "D=math.sqrt((4*Q)/(math.pi*v2*3.12))\n",
- "\n",
- "#RESULTS\n",
- "print('Velocity is = %.2f in' %D)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Velocity is = 0.86 in\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.6, Page No 51 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the energy of elevation\n",
- "\n",
- "#initialisation of variables\n",
- "p=10.0 #lbf/in^2 pressure\n",
- "Sg=0.87 #Density\n",
- "\n",
- "#CALCULATIONS\n",
- "h=p*2.31/Sg\n",
- "#The value of h is actualy 26.55 but in book they have rounded off to 26.6 \n",
- "EPE=200*Sg*8.34*h #Elevation energy\n",
- "#RESULTS\n",
- "print('The height = %.1f ft' %h)\n",
- "print('The energy of elevation = %.2f ft-lbf' %EPE)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The height = 26.6 ft\n",
- "The energy of elevation = 38530.80 ft-lbf\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.7, Page No 53 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the pressure\n",
- "\n",
- "#initialisation of variables\n",
- "F=1000 #lbf force\n",
- "A=3.14 #in^2 area\n",
- "pe=10.0 #lbf/in^2 (Pressure of elevation)\n",
- "\n",
- "#CALCULATIONS\n",
- "p=F/A #Total pressure\n",
- "P=p-pe\n",
- "\n",
- "#RESULTS\n",
- "print('The pressure is = %.2f lbf/in^2' %P)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The pressure is = 308.47 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.8, Page No 53 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the Kinetic enegry\n",
- "\n",
- "#initialisation of variables\n",
- "Sg=0.87 #Density\n",
- "a=0.785 #in^2 area \n",
- "g=32.2 #ft/sec^2\n",
- "\n",
- "#CALCULATIONS\n",
- "w=25*Sg*231*62.4*1/1738\n",
- "Q=25*231*1/12*1/60\n",
- "v=Q/a\n",
- "KE=(w*v*v)/(2*g)\n",
- "\n",
- "#RESULTS\n",
- "print('The Kinetic enegry is = %.2f ft-lbf' %KE)\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The Kinetic enegry is = 290.91 ft\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.9, Page No 55 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the pressure\n",
- "\n",
- "#initialisation of variables\n",
- "A1=7.065 #area in^2\n",
- "A2=0.785 #area in^2\n",
- "p1=1000 #pressure lbf/in^2\n",
- "Q=500 #flow rate gal/min\n",
- "g=32.2 #ft/sec^2\n",
- "Sg=0.91 #density\n",
- "\n",
- "#CALCULATIONS\n",
- "v1=Q/(A1*3.12) #Velocity\n",
- "v2=Q/(A2*3.12) #Velocity\n",
- "temp1=(p1*2.31)/Sg\n",
- "temp2=(v1*v1)/ (2*g)\n",
- "temp3=(v2*v2)/(2*g)\n",
- "p2=(temp1+temp2-temp3)*Sg/2.31\n",
- "\n",
- "#RESULTS\n",
- "print('The pressure is = %.2f lbf/in^2' %p2)\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The pressure is = 748.21 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.10, Page No 55 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find the energy extracted from the fluid\n",
- "\n",
- "#initialisation of variables\n",
- "p=1000 #pressure lbf/in^2\n",
- "p1=350 #pressure lbf/in^2\n",
- "Sg=0.85 #Specific gravity\n",
- "\n",
- "#CALCULATIONS\n",
- "Ha=p*2.31/Sg\n",
- "H1=p1*2.31/Sg\n",
- "He=Ha-H1-679.41\n",
- "\n",
- "#RESULTS\n",
- "print('The energy extracted from the fluid = %.2f lbf/in^2' %He)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The energy extracted from the fluid = 1087.06 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 16
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 3.11, Page No 55 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the Velocity of fluid\n",
- "#initialisation of variables\n",
- "h=40 #height ft\n",
- "g=32.2 #ft/sec^2\n",
- "#CALCULATIONS\n",
- "v=math.sqrt(2*g*h) #velocity\n",
- "#RESULTS\n",
- "print('The energy extracted from the fluid = %.2f lbf/in^2' %v)\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The energy extracted from the fluid = 50.75 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 17
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:41e08ad2cbd71b375b8fca4d52dca8e12f0a2ed40aa710b7f9246d1cab354954"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter No 3: Energy in Hydraulic systems<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.1, Page No 44 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "h=50.0 #ft height\n",
+ "sg=1.0 #Density \n",
+ "\n",
+ "#CALCULATIONS\n",
+ "p=sg*h*0.433 # pressure\n",
+ "\n",
+ "#RESULTS\n",
+ "print('Pressure is = %.2f lbf/in^2' %p)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pressure is = 21.65 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.2, Page No 44<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "p=1500.0 #lbf/in^2 pressure\n",
+ "Sg=0.78 #Density \n",
+ "p2=p*6895 #lbf/in^2 pressure\n",
+ "#CALCULATIONS\n",
+ "h=(p*2.31)/Sg\n",
+ "h2=(p2*1.02)/(10000*Sg) #In metric units\n",
+ "\n",
+ "#RESULTS\n",
+ "print('Head in ft = %.2f ft' %h)\n",
+ "print('In metric units Head in ft = %.2f ft' %h2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Head in ft = 4442.31 ft\n",
+ "Head in ft = 1352.48 ft\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.3, Page No 45 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "p=13790000 #N/m^2 pressure\n",
+ "Sg=0.83 #Density \n",
+ "\n",
+ "#CALCULATIONS\n",
+ "h=(p*1.02)/(Sg*10000)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('Head in ft = %.2f m' %h)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Head in ft = 1694.67 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.4, Page No 46 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Q=40 #Gal/min flow rate\n",
+ "a1=3.14 #in^2 area\n",
+ "a2=12.56 #in^2 area \n",
+ "#CALCULATIONS\n",
+ "#Part a\n",
+ "v1=Q/(a1*3.12) #fluid velocity in 2 in diameter\n",
+ "#Part b\n",
+ "v2=(a1*v1)/a2 #Fluid Velocity in 4 in diameter\n",
+ "#RESULTS\n",
+ "print('Fluid Velocity in 2 in diameter pipe is = %.2f ft/sec' %v1)\n",
+ "print('Fluid Velocity in 4 in diameter pipe is = %.2f ft/sec' %v2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Fluid Velocity is = 4.08 ft/sec\n",
+ "Fluid Velocity is = 1.02 ft/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.5, Page No 47 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Q=18 #Gal/min flow rate\n",
+ "a=3.14 #in^2 area \n",
+ "v2=10 #ft/sec velocity\n",
+ "#CALCULATIONS\n",
+ "v=Q/(a*3.12) \n",
+ "D=math.sqrt((4*Q)/(math.pi*v2*3.12))\n",
+ "\n",
+ "#RESULTS\n",
+ "print('Velocity is = %.2f in' %D)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Velocity is = 0.86 in\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.6, Page No 51 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialisation of variables\n",
+ "p=10.0 #lbf/in^2 pressure\n",
+ "Sg=0.87 #Density\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "h=p*2.31/Sg\n",
+ "#The value of h is actualy 26.55 but in book they have rounded off to 26.6 \n",
+ "EPE=200*Sg*8.34*h #Elevation energy\n",
+ "#RESULTS\n",
+ "print('The height = %.1f ft' %h)\n",
+ "print('The energy of elevation = %.2f ft-lbf' %EPE)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The height = 26.6 ft\n",
+ "The energy of elevation = 38530.80 ft-lbf\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.7, Page No 53 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "F=1000 #lbf force\n",
+ "A=3.14 #in^2 area\n",
+ "pe=10.0 #lbf/in^2 (Pressure of elevation)\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "p=F/A #Total pressure\n",
+ "P=p-pe\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The pressure is = %.2f lbf/in^2' %P)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure is = 308.47 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.8, Page No 53 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Sg=0.87 #Density\n",
+ "a=0.785 #in^2 area \n",
+ "g=32.2 #ft/sec^2\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "w=25*Sg*231*62.4*1/1738\n",
+ "Q=25*231*1/12*1/60\n",
+ "v=Q/a\n",
+ "KE=(w*v*v)/(2*g)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The Kinetic enegry is = %.2f ft-lbf' %KE)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Kinetic enegry is = 290.91 ft\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.9, Page No 55 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "A1=7.065 #area in^2\n",
+ "A2=0.785 #area in^2\n",
+ "p1=1000 #pressure lbf/in^2\n",
+ "Q=500 #flow rate gal/min\n",
+ "g=32.2 #ft/sec^2\n",
+ "Sg=0.91 #density\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "v1=Q/(A1*3.12) #Velocity\n",
+ "v2=Q/(A2*3.12) #Velocity\n",
+ "temp1=(p1*2.31)/Sg\n",
+ "temp2=(v1*v1)/ (2*g)\n",
+ "temp3=(v2*v2)/(2*g)\n",
+ "p2=(temp1+temp2-temp3)*Sg/2.31\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The pressure is = %.2f lbf/in^2' %p2)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure is = 748.21 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.10, Page No 55 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "p=1000 #pressure lbf/in^2\n",
+ "p1=350 #pressure lbf/in^2\n",
+ "Sg=0.85 #Specific gravity\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Ha=p*2.31/Sg\n",
+ "H1=p1*2.31/Sg\n",
+ "He=Ha-H1-679.41\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The energy extracted from the fluid = %.2f lbf/in^2' %He)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The energy extracted from the fluid = 1087.06 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 3.11, Page No 55 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "h=40 #height ft\n",
+ "g=32.2 #ft/sec^2\n",
+ "#CALCULATIONS\n",
+ "v=math.sqrt(2*g*h) #velocity\n",
+ "#RESULTS\n",
+ "print('The energy extracted from the fluid = %.2f lbf/in^2' %v)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The energy extracted from the fluid = 50.75 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_4.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_4.ipynb
index 40e87503..fa4223d9 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_4.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_4.ipynb
@@ -1,158 +1,157 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter no 4: How Fluids flow<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.1, Page No 64 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find displacement of the cylinder\n",
- "\n",
- "#initialisation of variables\n",
- "a1=12.56 #Area(in^2)\n",
- "s1=24 #stroke(in^3)\n",
- "a2=3.14 #Area(in^2) displacement of ram\n",
- "s2=24 #stroke in^3\n",
- "Ve=0.785 #Extension volume in^3\n",
- "\n",
- "\n",
- "#CALCULATIONS\n",
- "Ve=a1*s1 #extension volume\n",
- "Vs=a2*s2 \n",
- "Vr=Ve-Vs #Retraction volume\n",
- "Vt=Ve+Vr #Total volume\n",
- "\n",
- "#RESULTS\n",
- "print('Displacement of the cylinder would be = %.2f in^3' %Vt)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Displacement of the cylinder would be = 527.52 in^3\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.4, Page No 75 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find whther the flow laminar or tubulent\n",
- "\n",
- "#initialisation of variables\n",
- "A=0.785 #area\n",
- "Q=100 #gal/min flow rate\n",
- "D=1 #in diameter\n",
- "v=0.05 #viscocity Newts\n",
- "\n",
- "#CALCULATIONS\n",
- "V=Q/(A*3.12) #velocity\n",
- "Nr=(12*V*D)/v #reynolds number\n",
- "\n",
- "#RESULTS\n",
- "print('The velocity would be = %.2f lbf-ft' %V)\n",
- "print('The Reynolds number would be = %.2f Hence the flow is turbulent' %Nr)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The velocity would be = 40.83 lbf-ft\n",
- "The Reynolds number would be = 9799.12 Hence the flow is turbulent\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 4.5, Page No 76 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find range of critical velocities\n",
- "\n",
- "#initialisation of variables\n",
- "Nr=4000 #reynolds number\n",
- "Nr2=2000 #reynolds number\n",
- "m=0.27 #P viscocity\n",
- "D=2.54 #cm diameter\n",
- "p=0.85 #pressure gm/cm^3\n",
- "m2=27 #cP viscocity\n",
- "D2=1 #in diameter\n",
- "#CALCULATIONS\n",
- "V=(Nr*m)/(D*p) #velocity\n",
- "\n",
- "# for lower critical velocity\n",
- "V2=(Nr2*m)/(D*p)\n",
- "v=m2/p\n",
- "vn=0.001552*v\n",
- "vh=(Nr*vn)/(12*D2)\n",
- "vl=(Nr2*vn)/(12*D2)\n",
- "\n",
- "#RESULTS\n",
- "print('The velocity would be = %.2f cm/sec' %V)\n",
- "print('The lower velocity would be = %.2f cm/sec' %V2)\n",
- "print('Using reynolds formula the velocity would be = %.2f ft/sec' %vh)\n",
- "print('Using reynolds formula the lower velocity would be = %.2f ft/sec' %vl)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The velocity would be = 500.23 cm/sec\n",
- "The lower velocity would be = 250.12 cm/sec\n",
- "using reynolds formula the velocity would be = 16.43 newts\n",
- "using reynolds formula the lower velocity would be = 8.22 cm/sec\n"
- ]
- }
- ],
- "prompt_number": 7
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:ef80559993f5ef663679dee68ecb16be7277adf553aef3de2eb86d71037aadc3"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter no 4: How Fluids flow<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.1, Page No 64 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialisation of variables\n",
+ "a1=12.56 #Area(in^2)\n",
+ "s1=24 #stroke(in^3)\n",
+ "a2=3.14 #Area(in^2) displacement of ram\n",
+ "s2=24 #stroke in^3\n",
+ "Ve=0.785 #Extension volume in^3\n",
+ "\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Ve=a1*s1 #extension volume\n",
+ "Vs=a2*s2 \n",
+ "Vr=Ve-Vs #Retraction volume\n",
+ "Vt=Ve+Vr #Total volume\n",
+ "\n",
+ "#RESULTS\n",
+ "print('Displacement of the cylinder would be = %.2f in^3' %Vt)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Displacement of the cylinder would be = 527.52 in^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.4, Page No 75 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#initialisation of variables\n",
+ "A=0.785 #area\n",
+ "Q=100 #gal/min flow rate\n",
+ "D=1 #in diameter\n",
+ "v=0.05 #viscocity Newts\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "V=Q/(A*3.12) #velocity\n",
+ "Nr=(12*V*D)/v #reynolds number\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The velocity would be = %.2f lbf-ft' %V)\n",
+ "print('The Reynolds number would be = %.2f Hence the flow is turbulent' %Nr)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity would be = 40.83 lbf-ft\n",
+ "The Reynolds number would be = 9799.12 Hence the flow is turbulent\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 4.5, Page No 76 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Nr=4000 #reynolds number\n",
+ "Nr2=2000 #reynolds number\n",
+ "m=0.27 #P viscocity\n",
+ "D=2.54 #cm diameter\n",
+ "p=0.85 #pressure gm/cm^3\n",
+ "m2=27 #cP viscocity\n",
+ "D2=1 #in diameter\n",
+ "#CALCULATIONS\n",
+ "V=(Nr*m)/(D*p) #velocity\n",
+ "\n",
+ "# for lower critical velocity\n",
+ "V2=(Nr2*m)/(D*p)\n",
+ "v=m2/p\n",
+ "vn=0.001552*v\n",
+ "vh=(Nr*vn)/(12*D2)\n",
+ "vl=(Nr2*vn)/(12*D2)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The velocity would be = %.2f cm/sec' %V)\n",
+ "print('The lower velocity would be = %.2f cm/sec' %V2)\n",
+ "print('Using reynolds formula the velocity would be = %.2f ft/sec' %vh)\n",
+ "print('Using reynolds formula the lower velocity would be = %.2f ft/sec' %vl)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity would be = 500.23 cm/sec\n",
+ "The lower velocity would be = 250.12 cm/sec\n",
+ "using reynolds formula the velocity would be = 16.43 newts\n",
+ "using reynolds formula the lower velocity would be = 8.22 cm/sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_5.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_5.ipynb
index e8924ee8..dfa30c9f 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_5.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_5.ipynb
@@ -1,349 +1,347 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.1, Page No 82 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the pressure drop\n",
- "\n",
- "#initialisation of variables\n",
- "Q=200 #gal/min flow rate\n",
- "A=3.14 #area in^2\n",
- "f=0.05 #friction factor\n",
- "g=32.2 #ft/sec^2\n",
- "L=800 #ft length\n",
- "Sg=0.91 #density\n",
- "\n",
- "#CALCULATIONS\n",
- "v=Q/(A*3.12) #velocity of fluid\n",
- "D=(2*1.0)/12 #in\n",
- "hf=f*(L/D)*((v*v)/(2*g)) #head loss\n",
- "hps=0.433*Sg*hf\n",
- "\n",
- "#RESULTS\n",
- "print('The pressure drop is = %.2f lbf/in^2' %hps)\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The pressure drop is = 611.99 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.2, Page No 84 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the pressure drop\n",
- "#initialisation of variables\n",
- "Q=15 #gal/min\n",
- "A=0.785 #area\n",
- "D=1 #diameter in\n",
- "v1=0.08 #Viscocity Newts\n",
- "L=400 #Length ft\n",
- "g=32.2 #ft/sec^2\n",
- "Sg=0.85 #density\n",
- "\n",
- "#CALCULATIONS\n",
- "v=Q/(A*3.12)\n",
- "Nr=(12*v*D)/v1 #reynolds number\n",
- "hf=(32*v1*L*v)/(D*D*g) #head drop\n",
- "hps=0.433*Sg*hf\n",
- "\n",
- "#RESULTS\n",
- "print('The pressure drop is = %.2f lbf/in^2' %hps)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The pressure drop is = 71.68 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.3, Page No 87 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the pressure drop\n",
- "\n",
- "#initialisation of variables\n",
- "Q=600 #gal/min flow rate\n",
- "A=3.14 #area in^2\n",
- "f=0.040 #force in^2\n",
- "D=2 #diameter in\n",
- "v1=0.30 #Viscocity in^2sec\n",
- "L=500 #length ft\n",
- "g=32.2 #ft/sec^2\n",
- "Sg=0.85 #density\n",
- "\n",
- "#CALCULATIONS\n",
- "v=Q/(A*3.12)\n",
- "Nr=(12*v*D)/v1 #reynolds number\n",
- "D=(2*1.0)/12\n",
- "hf=f*(L/D)*((v*v)/(2*g))\n",
- "hps=0.433*Sg*hf #Pressure drop\n",
- "\n",
- "#RESULTS\n",
- "print('The pressure drop is = %.2f lbf/in^2' %hps)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The pressure drop is = 2572.39 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.4, Page No 90 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the discharge coefficient\n",
- "\n",
- "#initialisation of variables\n",
- "p=120 #pressure drop lbf/in^2\n",
- "Sg=0.85 #density\n",
- "Q=1000 #gal/min flow rate\n",
- "A=3.14 #area \n",
- "\n",
- "#CALCULATIONS\n",
- "Cd=(1/38.06)*(Q/A)*(math.sqrt(Sg/p)) #discharge coefficient\n",
- "\n",
- "#RESULTS\n",
- "print('The discharge coefficient is = %.2f ' %Cd)\n",
- "\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The discharge coefficient is = 0.70 \n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.5, Page No 94 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the total pressure loss\n",
- "\n",
- "#initialisation of variables\n",
- "Q=50 #gal/min flow rate\n",
- "A=0.785 #area\n",
- "D=1 #diameter in\n",
- "f=1 #\n",
- "v1=0.05 #Viscocity Newts\n",
- "L=500 #length ft\n",
- "g=32.2 #ft/sec^2\n",
- "Sg=0.91 #Density\n",
- "\n",
- "#CALCULATIONS\n",
- "v=Q/(A*3.12) #velocity\n",
- "Nr=(12*v*D)/v1 #Reynolds\n",
- "temp=((v*v)/(2*g))\n",
- "hi=0.78*temp #inward projection\n",
- "ho=1.0*temp #Outward projection\n",
- "hg=10.0*temp #Globe Valve\n",
- "he=4*0.90*temp # 4 std 90 degree elbow\n",
- "hn=(3.0/4)*temp #sudden enlargement\n",
- "hc=0.5*3.0/4*temp #Sudden contraction\n",
- "hff=hi+ho+hg++he+hn+hc #Total head loss\n",
- "hps=0.433*Sg*hff\n",
- "\n",
- "#RESULTS\n",
- "print('The pressure drop is = %.2f lbf/in^2' %hps)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The pressure drop is = 42.09 lbf/in^2\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.6, Page No 96 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find the length of the valve\n",
- "\n",
- "#initialisation of variables\n",
- "Q=150 #gal/min flow rate\n",
- "A=0.785 #area in^2\n",
- "D=1 #diameter in\n",
- "f=0.045 #\n",
- "v1=0.10 #Viscocity newts\n",
- "Sg=0.91 #density\n",
- "K=2.5\n",
- "\n",
- "#CALCULATIONS\n",
- "v=Q/(A*3.12)\n",
- "Nr=(12*v*D)/v1 # Reynolds number\n",
- "Le=(D*K)/(12*f) #length\n",
- "\n",
- "#RESULTS\n",
- "print('The equivalent length is = %.2f ft' %Le)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The equivalent length is = 4.63 ft\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.7, Page No 97 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find total pressure drop and fluid horsepwer\n",
- "\n",
- "#initialisation of variables\n",
- "Q=100 #gal/min flow rate\n",
- "A1=3.14 #area in^2\n",
- "A2=0.785 #area in^2\n",
- "D=2 #Diameter in \n",
- "k=12.4 #K-factor\n",
- "g=32.2 #ft/sec^2\n",
- "L=134.58 #Length ft\n",
- "p=224.7 #Total pressure drop lbf/in^2\n",
- "Q=100 #gal/min flow rate\n",
- "L2=35.33 #ft length\n",
- "#CALCULATIONS\n",
- "v1=Q/(A1*3.12) #velocity\n",
- "v2=Q/(A2*3.12) #velocity\n",
- "v=0.001552*80 # kinematic viscosity from cSt to newts \n",
- "Nr=(12*v1*D)/v #Reynold number\n",
- "D1=1\n",
- "D2=1\n",
- "k2=20\n",
- "f2=0.05\n",
- "Nr2=(12*v2*D1)/v #Reynold number\n",
- "f1=64/Nr\n",
- "Le=(D*k)/(12*f1) #length\n",
- "hf=f1*((L*(v1*v1))/((2.0/12.0)*(2*g)))\n",
- "hsif=0.433*0.88*hf #pressure loss\n",
- "Le2=(D2*k2)/(12*f2)\n",
- "hf2=f2*((L2*(v2*v2))/((1.0/12.0)*(2*g)))\n",
- "hsif2=0.433*0.88*hf2 #pressure loss\n",
- "pd=hsif+hsif2\n",
- "Fhp=(pd*Q)/1714\n",
- "#RESULTS\n",
- "print('The pressure drop is = %.2f lbf/in' %pd)\n",
- "print('The fluid horsepwer is = %.2f hp' %Fhp)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The pressure drop is = 225.24 lbf/in\n",
- "The fluid horsepwer is = 13.14 hp\n"
- ]
- }
- ],
- "prompt_number": 1
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:4f7ceb1a02c4aed051683602c2032c5c01a494cc7ebde0035eb0f03a6d976611"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.1, Page No 82 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Q=200 #gal/min flow rate\n",
+ "A=3.14 #area in^2\n",
+ "f=0.05 #friction factor\n",
+ "g=32.2 #ft/sec^2\n",
+ "L=800 #ft length\n",
+ "Sg=0.91 #density\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "v=Q/(A*3.12) #velocity of fluid\n",
+ "D=(2*1.0)/12 #in\n",
+ "hf=f*(L/D)*((v*v)/(2*g)) #head loss\n",
+ "hps=0.433*Sg*hf\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The pressure drop is = %.2f lbf/in^2' %hps)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure drop is = 611.99 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.2, Page No 84 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "Q=15 #gal/min\n",
+ "A=0.785 #area\n",
+ "D=1 #diameter in\n",
+ "v1=0.08 #Viscocity Newts\n",
+ "L=400 #Length ft\n",
+ "g=32.2 #ft/sec^2\n",
+ "Sg=0.85 #density\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "v=Q/(A*3.12)\n",
+ "Nr=(12*v*D)/v1 #reynolds number\n",
+ "hf=(32*v1*L*v)/(D*D*g) #head drop\n",
+ "hps=0.433*Sg*hf\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The pressure drop is = %.2f lbf/in^2' %hps)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure drop is = 71.68 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.3, Page No 87 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Q=600 #gal/min flow rate\n",
+ "A=3.14 #area in^2\n",
+ "f=0.040 #force in^2\n",
+ "D=2 #diameter in\n",
+ "v1=0.30 #Viscocity in^2sec\n",
+ "L=500 #length ft\n",
+ "g=32.2 #ft/sec^2\n",
+ "Sg=0.85 #density\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "v=Q/(A*3.12)\n",
+ "Nr=(12*v*D)/v1 #reynolds number\n",
+ "D=(2*1.0)/12\n",
+ "hf=f*(L/D)*((v*v)/(2*g))\n",
+ "hps=0.433*Sg*hf #Pressure drop\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The pressure drop is = %.2f lbf/in^2' %hps)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure drop is = 2572.39 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.4, Page No 90 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "p=120 #pressure drop lbf/in^2\n",
+ "Sg=0.85 #density\n",
+ "Q=1000 #gal/min flow rate\n",
+ "A=3.14 #area \n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Cd=(1/38.06)*(Q/A)*(math.sqrt(Sg/p)) #discharge coefficient\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The discharge coefficient is = %.2f ' %Cd)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The discharge coefficient is = 0.70 \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.5, Page No 94 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Q=50 #gal/min flow rate\n",
+ "A=0.785 #area\n",
+ "D=1 #diameter in\n",
+ "f=1 #\n",
+ "v1=0.05 #Viscocity Newts\n",
+ "L=500 #length ft\n",
+ "g=32.2 #ft/sec^2\n",
+ "Sg=0.91 #Density\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "v=Q/(A*3.12) #velocity\n",
+ "Nr=(12*v*D)/v1 #Reynolds\n",
+ "temp=((v*v)/(2*g))\n",
+ "hi=0.78*temp #inward projection\n",
+ "ho=1.0*temp #Outward projection\n",
+ "hg=10.0*temp #Globe Valve\n",
+ "he=4*0.90*temp # 4 std 90 degree elbow\n",
+ "hn=(3.0/4)*temp #sudden enlargement\n",
+ "hc=0.5*3.0/4*temp #Sudden contraction\n",
+ "hff=hi+ho+hg++he+hn+hc #Total head loss\n",
+ "hps=0.433*Sg*hff\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The pressure drop is = %.2f lbf/in^2' %hps)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure drop is = 42.09 lbf/in^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.6, Page No 96 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Q=150 #gal/min flow rate\n",
+ "A=0.785 #area in^2\n",
+ "D=1 #diameter in\n",
+ "f=0.045 #\n",
+ "v1=0.10 #Viscocity newts\n",
+ "Sg=0.91 #density\n",
+ "K=2.5\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "v=Q/(A*3.12)\n",
+ "Nr=(12*v*D)/v1 # Reynolds number\n",
+ "Le=(D*K)/(12*f) #length\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The equivalent length is = %.2f ft' %Le)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The equivalent length is = 4.63 ft\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 5.7, Page No 97 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Q=100 #gal/min flow rate\n",
+ "A1=3.14 #area in^2\n",
+ "A2=0.785 #area in^2\n",
+ "D=2 #Diameter in \n",
+ "k=12.4 #K-factor\n",
+ "g=32.2 #ft/sec^2\n",
+ "L=134.58 #Length ft\n",
+ "p=224.7 #Total pressure drop lbf/in^2\n",
+ "Q=100 #gal/min flow rate\n",
+ "L2=35.33 #ft length\n",
+ "#CALCULATIONS\n",
+ "v1=Q/(A1*3.12) #velocity\n",
+ "v2=Q/(A2*3.12) #velocity\n",
+ "v=0.001552*80 # kinematic viscosity from cSt to newts \n",
+ "Nr=(12*v1*D)/v #Reynold number\n",
+ "D1=1\n",
+ "D2=1\n",
+ "k2=20\n",
+ "f2=0.05\n",
+ "Nr2=(12*v2*D1)/v #Reynold number\n",
+ "f1=64/Nr\n",
+ "Le=(D*k)/(12*f1) #length\n",
+ "hf=f1*((L*(v1*v1))/((2.0/12.0)*(2*g)))\n",
+ "hsif=0.433*0.88*hf #pressure loss\n",
+ "Le2=(D2*k2)/(12*f2)\n",
+ "hf2=f2*((L2*(v2*v2))/((1.0/12.0)*(2*g)))\n",
+ "hsif2=0.433*0.88*hf2 #pressure loss\n",
+ "pd=hsif+hsif2\n",
+ "Fhp=(pd*Q)/1714\n",
+ "#RESULTS\n",
+ "print('The pressure drop is = %.2f lbf/in' %pd)\n",
+ "print('The fluid horsepwer is = %.2f hp' %Fhp)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure drop is = 225.24 lbf/in\n",
+ "The fluid horsepwer is = 13.14 hp\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_6.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_6.ipynb
index 3b00bf86..789b362e 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_6.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_6.ipynb
@@ -1,130 +1,130 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter No 6 :Hydraulic Fluids <h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 6.2, Page No 115 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find how much fluid be expected compress\n",
- "\n",
- "#initialisation of variables\n",
- "V1=1.0 #volume\n",
- "p2=2000 #pressure lbf/in^2\n",
- "p1=1000 #pressure lbf/in^2\n",
- "K=350000 #k factor lbf/in^2\n",
- "\n",
- "#CALCULATIONS\n",
- "dV=V1*(p2-p1)/K\n",
- "\n",
- "#RESULTS\n",
- "print('The fluid be expected compress is = %.4f ' %dV)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The fluid be expected compress is = 0.0029 \n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 6.3, Page No 127 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "# Find Beta Ratio\n",
- "\n",
- "#CALCULATIONS\n",
- "m1=36815.0 #Particles count upstream\n",
- "m2=6347 #Particles count downstream\n",
- "b=m1/m2 #beta ratio\n",
- "\n",
- "#RESULTS\n",
- "print('The beta ratio = %.1f ' %b)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The beta ratio = 5.8 \n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 6.4, Page No 127 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "import math\n",
- "#Find Beta Efficiency\n",
- "\n",
- "#CALCULATIONS\n",
- "m1=36815.0 # Particles count upstream\n",
- "m2=6347 #Particles count downstream\n",
- "b=((m1-m2)/m1)*100 # Beta efficiency\n",
- "\n",
- "#RESULTS\n",
- "print('The beta efficiency = %.2f percent' %b)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The beta efficiency = 82.76 percent\n"
- ]
- }
- ],
- "prompt_number": 2
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2a45c36aaa47c05012e31744a57dc2decac5ab57032d2c7729bcf9fae98dd916"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter No 6 :Hydraulic Fluids <h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 6.2, Page No 115 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "V1=1.0 #volume\n",
+ "p2=2000 #pressure lbf/in^2\n",
+ "p1=1000 #pressure lbf/in^2\n",
+ "K=350000 #k factor lbf/in^2\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "dV=V1*(p2-p1)/K\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The fluid be expected compress is = %.4f ' %dV)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The fluid be expected compress is = 0.0029 \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 6.3, Page No 127 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "m1=36815.0 #Particles count upstream\n",
+ "m2=6347 #Particles count downstream\n",
+ "b=m1/m2 #beta ratio\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The beta ratio = %.1f ' %b)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The beta ratio = 5.8 \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 6.4, Page No 127 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "m1=36815.0 # Particles count upstream\n",
+ "m2=6347 #Particles count downstream\n",
+ "b=((m1-m2)/m1)*100 # Beta efficiency\n",
+ "\n",
+ "#RESULTS\n",
+ "print('The beta efficiency = %.2f percent' %b)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The beta efficiency = 82.76 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_7.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_7.ipynb
index 430ffa25..c35b63d7 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_7.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_7.ipynb
@@ -1,227 +1,226 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1> Chapter No 7 : Pumps <h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 7.1, Page No 135 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Input torque\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "P=2500.0 #pressure lbf/in^3\n",
- "Q=3.0 #gpm flow rate\n",
- "p=5.0 #Bhp power\n",
- "N=1725.0 #rpm speed\n",
- "\n",
- "#CALCULATIONS\n",
- "eo=P*Q*100.0/(1714.0*p) # pump efficiency\n",
- "To=p*5250.0/ N # torque Input\n",
- "\n",
- "#RESULTS\n",
- "print('\\n Input torque = %.3f lb-ft ' %To)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " Input torque = 15.217 lb-ft "
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 7.2 Page No 137 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Volumetric efficiency\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "Q=52.0 #gpm flow rate\n",
- "v=3.75 #in^3 positive displacement\n",
- "N=3300.0 #rpm speed\n",
- "\n",
- "#CALCULATIONS\n",
- "ev=231.0*Q*100.0/(v*N) #Volumetric efficiency\n",
- "\n",
- "#RESULT\n",
- "print('\\n Volumetric efficiency = %.3f percent ' %ev)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " Volumetric efficiency = 97.067 percent "
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 7.3, Page No 137 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Mechanical efficiency and Frictional horsepower \n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "eo=87.0 #percent overall efficiency\n",
- "ev=94.0 #percent volumetric efficiency\n",
- "p=10.0 #bhpi\n",
- "\n",
- "#CALCULATIONS\n",
- "em=eo/ev # Mechanical efficiency\n",
- "em1=em*100.0\n",
- "Fhp=p*(1.0-em)\n",
- "\n",
- "#RESULTS\n",
- "print(' \\n Frictional horsepower = %.3f hp ' %Fhp)\n",
- "print('\\n Mechanical efficiency = %.2f percent ' %em1 )"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " \n",
- " Frictional horsepower = 0.745 hp \n",
- "\n",
- " Mechanical efficiency = 92.55 percent \n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 7.4 Page No 150 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Volume flow rate\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "n=9.0 #no of cycles\n",
- "N=3000.0 #rpm speed\n",
- "s=0.75 #inch stroke\n",
- "d=0.5 #inch diameter\n",
- "\n",
- "#CALCULATIONS\n",
- "Q=n*N*s*math.pi*d**2/(4.0*231.0)\n",
- "\n",
- "#RESULTS\n",
- "print(' Volume flow rate = %.3f gpm ' %Q)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Volume flow rate = 17.212 gpm "
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 7.5 Page No 162 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Minimum size of the reservoir\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "d=6.0 #in diameter\n",
- "S=120.0 #in stroke\n",
- "Q=5.0 #gpm flow rate\n",
- "\n",
- "#CALCULATIONS\n",
- "Vc=math.pi*d**2*S/(4.0*231.0)\n",
- "\n",
- "#RESULTS\n",
- "print('Minimum size of the reservoir = %.3f gpm ' %Vc)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Minimum size of the reservoir = 14.688 gpm \n"
- ]
- }
- ],
- "prompt_number": 2
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:7f3e7af3a7770bd6065b2ca329fec5074b9d86ea22aa36dc09cc71c375000d3b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1> Chapter No 7 : Pumps <h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 7.1, Page No 135 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "P=2500.0 #pressure lbf/in^3\n",
+ "Q=3.0 #gpm flow rate\n",
+ "p=5.0 #Bhp power\n",
+ "N=1725.0 #rpm speed\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "eo=P*Q*100.0/(1714.0*p) # pump efficiency\n",
+ "To=p*5250.0/ N # torque Input\n",
+ "\n",
+ "#RESULTS\n",
+ "print('\\n Input torque = %.3f lb-ft ' %To)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Input torque = 15.217 lb-ft "
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 7.2 Page No 137 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "Q=52.0 #gpm flow rate\n",
+ "v=3.75 #in^3 positive displacement\n",
+ "N=3300.0 #rpm speed\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "ev=231.0*Q*100.0/(v*N) #Volumetric efficiency\n",
+ "\n",
+ "#RESULT\n",
+ "print('\\n Volumetric efficiency = %.3f percent ' %ev)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Volumetric efficiency = 97.067 percent "
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 7.3, Page No 137 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "eo=87.0 #percent overall efficiency\n",
+ "ev=94.0 #percent volumetric efficiency\n",
+ "p=10.0 #bhpi\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "em=eo/ev # Mechanical efficiency\n",
+ "em1=em*100.0\n",
+ "Fhp=p*(1.0-em)\n",
+ "\n",
+ "#RESULTS\n",
+ "print(' \\n Frictional horsepower = %.3f hp ' %Fhp)\n",
+ "print('\\n Mechanical efficiency = %.2f percent ' %em1 )"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " \n",
+ " Frictional horsepower = 0.745 hp \n",
+ "\n",
+ " Mechanical efficiency = 92.55 percent \n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 7.4 Page No 150 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "n=9.0 #no of cycles\n",
+ "N=3000.0 #rpm speed\n",
+ "s=0.75 #inch stroke\n",
+ "d=0.5 #inch diameter\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Q=n*N*s*math.pi*d**2/(4.0*231.0)\n",
+ "\n",
+ "#RESULTS\n",
+ "print(' Volume flow rate = %.3f gpm ' %Q)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Volume flow rate = 17.212 gpm "
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 7.5 Page No 162 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "d=6.0 #in diameter\n",
+ "S=120.0 #in stroke\n",
+ "Q=5.0 #gpm flow rate\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Vc=math.pi*d**2*S/(4.0*231.0)\n",
+ "\n",
+ "#RESULTS\n",
+ "print('Minimum size of the reservoir = %.3f gpm ' %Vc)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Minimum size of the reservoir = 14.688 gpm \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_8.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_8.ipynb
index 3c51c45a..f2ea6a6f 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_8.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_8.ipynb
@@ -1,283 +1,282 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1> Chapter 8 : Hydraulic Cylinders and Cushioning Devices <h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 8.1 Page No 172 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Size of the cylinder postion\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "F=80000.0 #lbs Force\n",
- "F2=355800.0 #N Force\n",
- "P=1600.0 #lbf/in^2 Pressure\n",
- "P2=11.03*(1000000) #N/m^2 Pressure\n",
- "\n",
- "#CALCULATIONS\n",
- "db=math.sqrt(4.0*F/(math.pi*P))\n",
- "#In SI units\n",
- "db2=math.sqrt((4.0*F2)/(math.pi*P2))\n",
- "db2=db2*100 # To convert it into cm\n",
- "#RESULTS\n",
- "print('\\n Size of the cylinder postion = %.3f in ' %db)\n",
- "print('\\n Using SI units size of the cylinder postion = %.1f cm ' %db2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " Size of the cylinder postion = 7.979 in \n",
- "\n",
- " Size of the cylinder postion = 20.266 in \n",
- "\n",
- " Size of the cylinder postion = 11030000.000 in \n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 8.2 Page No 173 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Fluid velocity and Cylinder velocity\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "Q=25.0 #gpm flow rate\n",
- "A=0.533 #in^2 area\n",
- "\n",
- "#Calculations\n",
- "nu=Q*19.25/(A*60.0) #Fluid velocity\n",
- "nucylinder =Q*19.25/12.56 #Cylinder velocity\n",
- "\n",
- "#Results\n",
- "print('\\n Fluid velocity = %.3f ft/sec' %nu)\n",
- "print('\\n Cylinder velocity = %.3f ft/min' %nucylinder )"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " Fluid velocity = 15.048 ft/sec\n",
- "\n",
- " Cylinder velocity = 38.316 ft/min\n"
- ]
- }
- ],
- "prompt_number": 14
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 8.3 Page No 178 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Length of the stop tube\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "d=3.0 #in diameter\n",
- "P=2000.0 #lbf/in^2 pressure\n",
- "s=20.0 #stroke in\n",
- "\n",
- "#CALCULATIONS\n",
- "Cl=s*d/2.0 #corrected length\n",
- "F=P*math.pi*d**2/4.0 #thrust\n",
- "stl=(Cl-40.0)/10.0 #stop tube length\n",
- " \n",
- "#RESULTS\n",
- "print('\\n Length of the stop tube= %.3f in ' %Cl)\n",
- "F=F+3\n",
- "print('\\n Thrust on the rod= %.3f lb ' %F)\n",
- "print('\\n Stop Tube length= %.3f stl ' %stl)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " Length of the stop tube= 30.000 in \n",
- "\n",
- " Thrust on the rod= 14140.167 lb \n",
- "\n",
- " Stop Tube length= -1.000 stl "
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 8.4 Page No 182 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Total force decessary to decelarate the load\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "v=120.0 #ft/min velocity\n",
- "S=1.5 #in distance\n",
- "w=8000.0 #lb wight\n",
- "\n",
- "#CALCULATIONS\n",
- "ga=v**2*0.0000517/S\n",
- "F=w*ga\n",
- "#RESULTS\n",
- "print(' Total force decessary to decelarate the load= %.3f lb ' %F)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Total force decessary to decelarate the load= 3970.560 lb \n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 8.5 Page No 184 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Total force decessary to decelarate the load\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "P=750.0 #lbf/in^2 pressure\n",
- "d=3.0 #in distance\n",
- "w=1500.0 #lb weight\n",
- "ga=0.172 #Acceleration factor\n",
- "f=0.12 #Coefficient of fraction\n",
- "v=50 #ft/min velocity\n",
- "s=0.75 #in stroke\n",
- "\n",
- "#CALCULATIONS\n",
- "Fa=P*math.pi*d**2/4.0\n",
- "F=w*(ga-f)+Fa\n",
- "#RESULT\n",
- "print('\\n Total force decessary to decelarate the load= %.3f lb ' %F)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "\n",
- " Total force decessary to decelarate the load= 5379.438 lb \n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 8.6 Page No 186 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Pressure in the cylinder\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "d=3.0 #in diameter\n",
- "d1=1.5 #in diameter\n",
- "F=7500.0 #lb force\n",
- "\n",
- "#CALCULATIONS\n",
- "A1=(math.pi/4.0)*(d**2-d1**2)\n",
- "P=F/A1\n",
- "#RESULT\n",
- "print(' Pressure in the cylinder = %.3f psi' %P)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Pressure in the cylinder = 1413.711 psi"
- ]
- }
- ],
- "prompt_number": 6
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:17c640dd0a4a95ba945b4c3f11eeafabec4d7eceacb7724326f3938cd4b8f643"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1> Chapter 8 : Hydraulic Cylinders and Cushioning Devices <h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 8.1 Page No 172 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "F=80000.0 #lbs Force\n",
+ "F2=355800.0 #N Force\n",
+ "P=1600.0 #lbf/in^2 Pressure\n",
+ "P2=11.03*(1000000) #N/m^2 Pressure\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "db=math.sqrt(4.0*F/(math.pi*P))\n",
+ "#In SI units\n",
+ "db2=math.sqrt((4.0*F2)/(math.pi*P2))\n",
+ "db2=db2*100 # To convert it into cm\n",
+ "#RESULTS\n",
+ "print('\\n Size of the cylinder postion = %.3f in ' %db)\n",
+ "print('\\n Using SI units size of the cylinder postion = %.1f cm ' %db2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Size of the cylinder postion = 7.979 in \n",
+ "\n",
+ " Size of the cylinder postion = 20.266 in \n",
+ "\n",
+ " Size of the cylinder postion = 11030000.000 in \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 8.2 Page No 173 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "Q=25.0 #gpm flow rate\n",
+ "A=0.533 #in^2 area\n",
+ "\n",
+ "#Calculations\n",
+ "nu=Q*19.25/(A*60.0) #Fluid velocity\n",
+ "nucylinder =Q*19.25/12.56 #Cylinder velocity\n",
+ "\n",
+ "#Results\n",
+ "print('\\n Fluid velocity = %.3f ft/sec' %nu)\n",
+ "print('\\n Cylinder velocity = %.3f ft/min' %nucylinder )"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Fluid velocity = 15.048 ft/sec\n",
+ "\n",
+ " Cylinder velocity = 38.316 ft/min\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 8.3 Page No 178 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "d=3.0 #in diameter\n",
+ "P=2000.0 #lbf/in^2 pressure\n",
+ "s=20.0 #stroke in\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Cl=s*d/2.0 #corrected length\n",
+ "F=P*math.pi*d**2/4.0 #thrust\n",
+ "stl=(Cl-40.0)/10.0 #stop tube length\n",
+ " \n",
+ "#RESULTS\n",
+ "print('\\n Length of the stop tube= %.3f in ' %Cl)\n",
+ "F=F+3\n",
+ "print('\\n Thrust on the rod= %.3f lb ' %F)\n",
+ "print('\\n Stop Tube length= %.3f stl ' %stl)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Length of the stop tube= 30.000 in \n",
+ "\n",
+ " Thrust on the rod= 14140.167 lb \n",
+ "\n",
+ " Stop Tube length= -1.000 stl "
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 8.4 Page No 182 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "v=120.0 #ft/min velocity\n",
+ "S=1.5 #in distance\n",
+ "w=8000.0 #lb wight\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "ga=v**2*0.0000517/S\n",
+ "F=w*ga\n",
+ "#RESULTS\n",
+ "print(' Total force decessary to decelarate the load= %.3f lb ' %F)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Total force decessary to decelarate the load= 3970.560 lb \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 8.5 Page No 184 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "P=750.0 #lbf/in^2 pressure\n",
+ "d=3.0 #in distance\n",
+ "w=1500.0 #lb weight\n",
+ "ga=0.172 #Acceleration factor\n",
+ "f=0.12 #Coefficient of fraction\n",
+ "v=50 #ft/min velocity\n",
+ "s=0.75 #in stroke\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Fa=P*math.pi*d**2/4.0\n",
+ "F=w*(ga-f)+Fa\n",
+ "#RESULT\n",
+ "print('\\n Total force decessary to decelarate the load= %.3f lb ' %F)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Total force decessary to decelarate the load= 5379.438 lb \n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 8.6 Page No 186 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "d=3.0 #in diameter\n",
+ "d1=1.5 #in diameter\n",
+ "F=7500.0 #lb force\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "A1=(math.pi/4.0)*(d**2-d1**2)\n",
+ "P=F/A1\n",
+ "#RESULT\n",
+ "print(' Pressure in the cylinder = %.3f psi' %P)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Pressure in the cylinder = 1413.711 psi"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_9.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_9.ipynb
index a9d6cb72..ddb6d25f 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_9.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_No_9.ipynb
@@ -1,271 +1,271 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter No 9 : Hydraulic motors<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example9.1 Page No 194 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Theotrical torque\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "P=2000.0 #lbf/in^3 pressure\n",
- "Vm=0.5 #in^3 displacement\n",
- "\n",
- "#CALCULATONS\n",
- "T=P*Vm*0.16\n",
- "\n",
- "#RESULTS\n",
- "print('\\n Theotrical torque = %.3f lb-in ' %T)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Groove diameter = 3.776 in \n",
- " \n",
- " Groove width = 0.196 in \n",
- "\n",
- " outside diameter = 4.000 in "
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 9.2 Page No 194 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Theotrical speed of fluid power\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "Q=7.5 #gpm flow rate\n",
- "Q2=28.39 #l/min f;ow rate\n",
- "Vm=2 #in^3 displacement\n",
- "Vm2=0.03281 #l/rev displacement\n",
- "\n",
- "#CALCULATIONS\n",
- "N=231.0*Q/Vm # Theotrical speed\n",
- "#SI units\n",
- "N2=(Q2/Vm2) # in SI units Theotrical speed\n",
- "\n",
- "#RESULT\n",
- "print(' Theotrical speed of fluid power = %.3f rpm ' %N)\n",
- "print(' Using SI units Theotrical speed of fluid power = %.3f rev/min ' %N2)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Theotrical speed of fluid power = 866.250 rpm \n",
- " Using SI units Theotrical speed of fluid power = 865.285 rev/min \n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 9.3 Page No 195 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Effective flow rate\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "Vm=0.55 #in^3 displacement\n",
- "N=3400.0 #rpm Theotrical speed\n",
- "\n",
- "#CALCULATIONS\n",
- "Q=Vm*N/231.0\n",
- "\n",
- "#RESULT\n",
- "print(' Effective flow rate = %.3f gpm ' %Q)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Effective flow rate = 8.095 gpm \n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 9.4 Page No 195 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Overall efficiency\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "T=32.0 #lb_ft torque\n",
- "N=1200.0 #rpm Theotrical speed\n",
- "P=2000.0 #psi pressure lbf/in^2\n",
- "Q=7.5 #gpm flow rate\n",
- "\n",
- "#CALCULATIONS\n",
- "eo=T*N*100.0/(P*Q*3.06)\n",
- "\n",
- "#RESULT\n",
- "print(' Overall efficiency = %.3f percent ' %eo)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Overall efficiency = 83.660 percent \n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 9.5 Page No 196 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find Volumetric efficiency\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "Vm=0.6 #in^3 displacement\n",
- "N=2400 #rpm theotrical speed\n",
- "Qa=6.5 #gal/min flow rate\n",
- "Vm1=0.00981 #l/rev displacement\n",
- "#CALCULATIONS\n",
- "ev=((Vm*N)/(Qa*231))*100\n",
- "#in SI units\n",
- "ev1=((Vm1*N)/(24.611))*100\n",
- "TFL=0.041*Qa # total fluid loss\n",
- "CDL=0.50*TFL #Case drain loss\n",
- "\n",
- "#RESULT\n",
- "print(' Total fluid loss = %.2f gal/min ' %TFL)\n",
- "print(' Case drain loss = %.2f gal/min ' %CDL)\n",
- "print(' Volumetric efficiency = %.2f percent ' %ev)\n",
- "print(' Volumetric efficiency in SI units = %.2f percent ' %ev1)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Total fluid loss = 0.27 gal/min \n",
- " Case drain loss = 0.13 gal/min \n",
- " Volumetric efficiency = 95.90 percent \n",
- " Volumetric efficiency in SI units = 95.66 percent \n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3> Example 9.6 Page No 197 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find mechnical efficiency efficiency\n",
- "\n",
- "import math\n",
- "\n",
- "#Variable initialization\n",
- "eo=88.0 # Overall efficiency (%)\n",
- "ev=97 # Volumetric efficiency(%)\n",
- "\n",
- "#CALCULATIONS\n",
- "em=(eo/ev)*100\n",
- "\n",
- "#RESULT\n",
- "print(' Mechnical efficiency efficiency = %.3f percent ' %em)"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- " Mechnical efficiency efficiency = 90.722 percent \n"
- ]
- }
- ],
- "prompt_number": 2
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:fa3b77fb957b6452bc46163f22ab8db8630dd903dfdd45f948929785db1004f9"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter No 9 : Hydraulic motors<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example9.1 Page No 194 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "P=2000.0 #lbf/in^3 pressure\n",
+ "Vm=0.5 #in^3 displacement\n",
+ "\n",
+ "#CALCULATONS\n",
+ "T=P*Vm*0.16\n",
+ "\n",
+ "#RESULTS\n",
+ "print('\\n Theotrical torque = %.3f lb-in ' %T)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Groove diameter = 3.776 in \n",
+ " \n",
+ " Groove width = 0.196 in \n",
+ "\n",
+ " outside diameter = 4.000 in "
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 9.2 Page No 194 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "Q=7.5 #gpm flow rate\n",
+ "Q2=28.39 #l/min f;ow rate\n",
+ "Vm=2 #in^3 displacement\n",
+ "Vm2=0.03281 #l/rev displacement\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "N=231.0*Q/Vm # Theotrical speed\n",
+ "#SI units\n",
+ "N2=(Q2/Vm2) # in SI units Theotrical speed\n",
+ "\n",
+ "#RESULT\n",
+ "print(' Theotrical speed of fluid power = %.3f rpm ' %N)\n",
+ "print(' Using SI units Theotrical speed of fluid power = %.3f rev/min ' %N2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Theotrical speed of fluid power = 866.250 rpm \n",
+ " Using SI units Theotrical speed of fluid power = 865.285 rev/min \n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 9.3 Page No 195 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "Vm=0.55 #in^3 displacement\n",
+ "N=3400.0 #rpm Theotrical speed\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Q=Vm*N/231.0\n",
+ "\n",
+ "#RESULT\n",
+ "print(' Effective flow rate = %.3f gpm ' %Q)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Effective flow rate = 8.095 gpm \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 9.4 Page No 195 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "T=32.0 #lb_ft torque\n",
+ "N=1200.0 #rpm Theotrical speed\n",
+ "P=2000.0 #psi pressure lbf/in^2\n",
+ "Q=7.5 #gpm flow rate\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "eo=T*N*100.0/(P*Q*3.06)\n",
+ "\n",
+ "#RESULT\n",
+ "print(' Overall efficiency = %.3f percent ' %eo)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Overall efficiency = 83.660 percent \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 9.5 Page No 196 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "Vm=0.6 #in^3 displacement\n",
+ "N=2400 #rpm theotrical speed\n",
+ "Qa=6.5 #gal/min flow rate\n",
+ "Vm1=0.00981 #l/rev displacement\n",
+ "#CALCULATIONS\n",
+ "ev=((Vm*N)/(Qa*231))*100\n",
+ "#in SI units\n",
+ "ev1=((Vm1*N)/(24.611))*100\n",
+ "TFL=0.041*Qa # total fluid loss\n",
+ "CDL=0.50*TFL #Case drain loss\n",
+ "\n",
+ "#RESULT\n",
+ "print(' Total fluid loss = %.2f gal/min ' %TFL)\n",
+ "print(' Case drain loss = %.2f gal/min ' %CDL)\n",
+ "print(' Volumetric efficiency = %.2f percent ' %ev)\n",
+ "print(' Volumetric efficiency in SI units = %.2f percent ' %ev1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Total fluid loss = 0.27 gal/min \n",
+ " Case drain loss = 0.13 gal/min \n",
+ " Volumetric efficiency = 95.90 percent \n",
+ " Volumetric efficiency in SI units = 95.66 percent \n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3> Example 9.6 Page No 197 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable initialization\n",
+ "eo=88.0 # Overall efficiency (%)\n",
+ "ev=97 # Volumetric efficiency(%)\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "em=(eo/ev)*100\n",
+ "\n",
+ "#RESULT\n",
+ "print(' Mechnical efficiency efficiency = %.3f percent ' %em)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Mechnical efficiency efficiency = 90.722 percent \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_no_1.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_no_1.ipynb
index b36c2082..1c23b49f 100644
--- a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_no_1.ipynb
+++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/Chapter_no_1.ipynb
@@ -1,57 +1,58 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter No 1: Introduction<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 1.1, Page No 17 <h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Find force\n",
- "\n",
- "#initialisation of variables\n",
- "Pressure=1500.0 #lbf\n",
- "Area=12.57 #in^2\n",
- "\n",
- "#CALCULATIONS\n",
- "Force=Pressure*Area\n",
- "\n",
- "#RESULTS\n",
- "print('Force is = %.2f lbf' %Force)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Force is = 18855.00 lbf\n"
- ]
- }
- ],
- "prompt_number": 1
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:33757e16bbf0642b0e875c402b38109f03d490b4828afe5b522fd4980c273e77"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter No 1: Introduction<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1.1, Page No 17 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#initialisation of variables\n",
+ "Pressure=1500.0 #lbf\n",
+ "Area=12.57 #in^2\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "Force=Pressure*Area\n",
+ "\n",
+ "#RESULTS\n",
+ "print('Force is = %.2f lbf' %Force)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Force is = 18855.00 lbf\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Programming_With_C/chapter1.ipynb b/_Programming_With_C/chapter1.ipynb
index 599cad41..c1eb1997 100644
--- a/_Programming_With_C/chapter1.ipynb
+++ b/_Programming_With_C/chapter1.ipynb
@@ -1,61 +1,62 @@
-{
- "metadata": {
- "name": ""
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 1: Introductory Concepts <h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 1.6, Page number: 1.19<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "# Area of a Circle\n",
- "\n",
- "import math\n",
- "\n",
- "radius=5\n",
- "area=math.pi*radius*radius\n",
- "print \"Area = \",area\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Area = 78.5398163397\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [],
- "language": "python",
- "metadata": {},
- "outputs": []
- }
- ],
- "metadata": {}
- }
- ]
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:be853ba23904264307d7e754c6f226daff90dc0e3bd2eca38f5b65419e2b80bc"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 1: Introductory Concepts <h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 1.6, Page number: 1.19<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "radius=5\n",
+ "area=math.pi*radius*radius\n",
+ "print \"Area = \",area\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area = 78.5398163397\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
} \ No newline at end of file
diff --git a/_Programming_With_C/chapter10.ipynb b/_Programming_With_C/chapter10.ipynb
index 083baffa..ea2e1985 100644
--- a/_Programming_With_C/chapter10.ipynb
+++ b/_Programming_With_C/chapter10.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter10"
+ "name": "",
+ "signature": "sha256:3323f7a9a077b84fffdd30478d4b0d0b7f4032b86670a58b5b333d42bee04f15"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,33 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 10: Strings<h1> "
+ "source": [
+ "<h1>Chapter 10: Strings<h1> "
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.3, Page Number: 10.3<h3>"
+ "source": [
+ "<h3>Example 10.3, Page Number: 10.3<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "st='Programming'\nprint 'The string is %s' %st",
+ "input": [
+ "st='Programming'\n",
+ "print 'The string is %s' %st"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The string is Programming\n"
+ "text": [
+ "The string is Programming\n"
+ ]
}
],
"prompt_number": 4
@@ -35,19 +45,28 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.4, Page Number: 10.4<h3>"
+ "source": [
+ "<h3>Example 10.4, Page Number: 10.4<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "st='Hello World'\nprint 'The line is :'\nprint st",
+ "input": [
+ "st='Hello World'\n",
+ "print 'The line is :'\n",
+ "print st"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The line is :\nHello World\n"
+ "text": [
+ "The line is :\n",
+ "Hello World\n"
+ ]
}
],
"prompt_number": 5
@@ -55,19 +74,29 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.6, Page Number: 10.5<h3>"
+ "source": [
+ "<h3>Example 10.6, Page Number: 10.5<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "#display the string character by character\n\nstrin='Welcome to python'\nfor i in strin:\n print i,",
+ "input": [
+ "\n",
+ "\n",
+ "strin='Welcome to python'\n",
+ "for i in strin:\n",
+ " print i,"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "W e l c o m e t o p y t h o n\n"
+ "text": [
+ "W e l c o m e t o p y t h o n\n"
+ ]
}
],
"prompt_number": 6
@@ -75,19 +104,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.7, Page Number: 10.6<h3>"
+ "source": [
+ "<h3>Example 10.7, Page Number: 10.6<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# to demonstrate the use of operators related function\n\nstr1='Programming'\nlen1=len(str1)\nprint 'The length of the string is ',len1\n\nstr2=str1\nprint 'First string is %s and copied string is %s' %(str1,str2)\n\nstr3='Computer'\n\nif str1==str3:\n print 'Both strings are equal'\nelif str1<str2:\n print 'First string is lesser than second string'\nelse:\n print 'First string is greater than second string'\n \ntempstr=' with C'\nstr1=str1+tempstr\nprint 'The concated string is ',str1\n",
+ "input": [
+ "\n",
+ "\n",
+ "str1='Programming'\n",
+ "len1=len(str1)\n",
+ "print 'The length of the string is ',len1\n",
+ "\n",
+ "str2=str1\n",
+ "print 'First string is %s and copied string is %s' %(str1,str2)\n",
+ "\n",
+ "str3='Computer'\n",
+ "\n",
+ "if str1==str3:\n",
+ " print 'Both strings are equal'\n",
+ "elif str1<str2:\n",
+ " print 'First string is lesser than second string'\n",
+ "else:\n",
+ " print 'First string is greater than second string'\n",
+ " \n",
+ "tempstr=' with C'\n",
+ "str1=str1+tempstr\n",
+ "print 'The concated string is ',str1\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The length of the string is 11\nFirst string is Programming and copied string is Programming\nFirst string is greater than second string\nThe concated string is Programming with C\n"
+ "text": [
+ "The length of the string is 11\n",
+ "First string is Programming and copied string is Programming\n",
+ "First string is greater than second string\n",
+ "The concated string is Programming with C\n"
+ ]
}
],
"prompt_number": 7
@@ -95,19 +153,48 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.8,Page Number: 10.7<h3>"
+ "source": [
+ "<h3>Example 10.8,Page Number: 10.7<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# user defined function for string length and string copy\n\ndef strlength(str1):\n count=0\n for i in str1:\n count+=1\n \n return count\ndef strcopy(src):\n dst=[]\n for i in src:\n dst.append(i)\n \n dst=''.join(dst)\n \n return dst\n\n\nstr1='New Delhi'\nlen1=strlength(str1)\nprint 'The length of the string is ',len1\n\nstr2=strcopy(str1)\nprint 'First string is %s and copied string is %s' %(str1,str2)\n",
+ "input": [
+ "\n",
+ "def strlength(str1):\n",
+ " count=0\n",
+ " for i in str1:\n",
+ " count+=1\n",
+ " \n",
+ " return count\n",
+ "def strcopy(src):\n",
+ " dst=[]\n",
+ " for i in src:\n",
+ " dst.append(i)\n",
+ " \n",
+ " dst=''.join(dst)\n",
+ " \n",
+ " return dst\n",
+ "\n",
+ "\n",
+ "str1='New Delhi'\n",
+ "len1=strlength(str1)\n",
+ "print 'The length of the string is ',len1\n",
+ "\n",
+ "str2=strcopy(str1)\n",
+ "print 'First string is %s and copied string is %s' %(str1,str2)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The length of the string is 9\nFirst string is New Delhi and copied string is New Delhi\n"
+ "text": [
+ "The length of the string is 9\n",
+ "First string is New Delhi and copied string is New Delhi\n"
+ ]
}
],
"prompt_number": 8
@@ -115,19 +202,53 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.9,Page Number: 10.9<h3>"
+ "source": [
+ "<h3>Example 10.9,Page Number: 10.9<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# A user defined implementation of comparison of two strings\n\ndef strcompare(str1,str2):\n \n len1=len(str1)\n len2=len(str2)\n \n if len1<len2:\n length=len1\n else:\n length=len2\n \n for i in xrange(0,length):\n if str1[i]<str2[i]:\n return -1\n elif str1[i]>str2[i]:\n return 1\n \n return 0\n\nstr1='Programming'\nstr2='Computer'\nstatus=strcompare(str1,str2)\nif status==-1:\n print 'First string is lesser than second string'\nelif status==1:\n print 'First string is greater than second string'\nelse:\n print 'Both strings ae equal'\n",
+ "input": [
+ "\n",
+ "\n",
+ "def strcompare(str1,str2):\n",
+ " \n",
+ " len1=len(str1)\n",
+ " len2=len(str2)\n",
+ " \n",
+ " if len1<len2:\n",
+ " length=len1\n",
+ " else:\n",
+ " length=len2\n",
+ " \n",
+ " for i in xrange(0,length):\n",
+ " if str1[i]<str2[i]:\n",
+ " return -1\n",
+ " elif str1[i]>str2[i]:\n",
+ " return 1\n",
+ " \n",
+ " return 0\n",
+ "\n",
+ "str1='Programming'\n",
+ "str2='Computer'\n",
+ "status=strcompare(str1,str2)\n",
+ "if status==-1:\n",
+ " print 'First string is lesser than second string'\n",
+ "elif status==1:\n",
+ " print 'First string is greater than second string'\n",
+ "else:\n",
+ " print 'Both strings ae equal'\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "First string is greater than second string\n"
+ "text": [
+ "First string is greater than second string\n"
+ ]
}
],
"prompt_number": 9
@@ -135,19 +256,42 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.10, Page Number: 10.10<h3>"
+ "source": [
+ "<h3>Example 10.10, Page Number: 10.10<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Left as well as right concatenation of two strings\n\ndef leftconcat(dst,src):\n dst=src+dst\n return dst\n\ndef rightconcat(dst,src):\n dst=dst+src\n return dst\n\nstr1='Hello'\nstr2='Friends'\n\ntempstr=leftconcat(str2,str1)\nprint 'The first string after left concatenation becomes ', tempstr\n\ntempstr=rightconcat(str2,str1)\nprint 'The first string after right concatenation becomes', tempstr\n",
+ "input": [
+ "\n",
+ "def leftconcat(dst,src):\n",
+ " dst=src+dst\n",
+ " return dst\n",
+ "\n",
+ "def rightconcat(dst,src):\n",
+ " dst=dst+src\n",
+ " return dst\n",
+ "\n",
+ "str1='Hello'\n",
+ "str2='Friends'\n",
+ "\n",
+ "tempstr=leftconcat(str2,str1)\n",
+ "print 'The first string after left concatenation becomes ', tempstr\n",
+ "\n",
+ "tempstr=rightconcat(str2,str1)\n",
+ "print 'The first string after right concatenation becomes', tempstr\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The first string after left concatenation becomes HelloFriends\nThe first string after right concatenation becomes FriendsHello\n"
+ "text": [
+ "The first string after left concatenation becomes HelloFriends\n",
+ "The first string after right concatenation becomes FriendsHello\n"
+ ]
}
],
"prompt_number": 10
@@ -155,19 +299,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.11,Page Numbr: 10.12<h3>"
+ "source": [
+ "<h3>Example 10.11,Page Numbr: 10.12<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# program to count total number of vowel in a given text\n\nstr1='All good boys have bread'\ncount=0\n\nfor i in str1:\n if i=='a' or i=='e'or i=='i' or i=='o' or i=='u' or i=='A' or i=='E' or i=='I' or i=='O' or i=='U' :\n count+=1\n \nprint 'Total number of vowels in a given text are ',count",
+ "input": [
+ "\n",
+ "\n",
+ "str1='All good boys have bread'\n",
+ "count=0\n",
+ "\n",
+ "for i in str1:\n",
+ " if i=='a' or i=='e'or i=='i' or i=='o' or i=='u' or i=='A' or i=='E' or i=='I' or i=='O' or i=='U' :\n",
+ " count+=1\n",
+ " \n",
+ "print 'Total number of vowels in a given text are ',count"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Total number of vowels in a given text are 8\n"
+ "text": [
+ "Total number of vowels in a given text are 8\n"
+ ]
}
],
"prompt_number": 11
@@ -175,19 +334,44 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.12, Page Number: 10.13<h3>"
+ "source": [
+ "<h3>Example 10.12, Page Number: 10.13<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Character arithmetic examples\n\nch1='A'\nch2=ord(ch1)+3\nprint chr(ch2)\n\nch1=chr(ord(ch1)+1)\nprint ch1\n\nprint ord('a')\nprint ord('l')\n\nval=ord(ch1)*ch2\nprint val\n\nprint chr(100)",
+ "input": [
+ "\n",
+ "ch1='A'\n",
+ "ch2=ord(ch1)+3\n",
+ "print chr(ch2)\n",
+ "\n",
+ "ch1=chr(ord(ch1)+1)\n",
+ "print ch1\n",
+ "\n",
+ "print ord('a')\n",
+ "print ord('l')\n",
+ "\n",
+ "val=ord(ch1)*ch2\n",
+ "print val\n",
+ "\n",
+ "print chr(100)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "D\nB\n97\n108\n4488\nd\n"
+ "text": [
+ "D\n",
+ "B\n",
+ "97\n",
+ "108\n",
+ "4488\n",
+ "d\n"
+ ]
}
],
"prompt_number": 12
@@ -195,19 +379,39 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.13, Page Number: 10.13<h3>"
+ "source": [
+ "<h3>Example 10.13, Page Number: 10.13<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Program to convert lowercase alphabets to uppercase in a given text\n\ntext='I am studying 6 Theory Papers & 4 practicals'\n\nlen1=len(text)\ntext=list(text)\nfor i in xrange(0,len1):\n if text[i]>='a' and text[i]<='z':\n text[i]=chr(ord(text[i])+ord('A')-ord('a'))\n \n \ntext=''.join(text)\n\nprint 'The text after converting lowercase alphabets to uppercase is '\nprint text",
+ "input": [
+ "\n",
+ "text='I am studying 6 Theory Papers & 4 practicals'\n",
+ "\n",
+ "len1=len(text)\n",
+ "text=list(text)\n",
+ "for i in xrange(0,len1):\n",
+ " if text[i]>='a' and text[i]<='z':\n",
+ " text[i]=chr(ord(text[i])+ord('A')-ord('a'))\n",
+ " \n",
+ " \n",
+ "text=''.join(text)\n",
+ "\n",
+ "print 'The text after converting lowercase alphabets to uppercase is '\n",
+ "print text"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The text after converting lowercase alphabets to uppercase is \nI AM STUDYING 6 THEORY PAPERS & 4 PRACTICALS\n"
+ "text": [
+ "The text after converting lowercase alphabets to uppercase is \n",
+ "I AM STUDYING 6 THEORY PAPERS & 4 PRACTICALS\n"
+ ]
}
],
"prompt_number": 13
@@ -215,19 +419,45 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.14, Page Number: 10.14<h3>"
+ "source": [
+ "<h3>Example 10.14, Page Number: 10.14<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Program to search for a substring in a given string\n\ntext='The programming is a systematic process'\nsubstr='pro'\ntext_len=len(text)\nsub_len=len(substr)\ntext=list(text)\nsubstr=list(substr)\n\nfor i in xrange(0,text_len-sub_len+1):\n \n for j in xrange(0,sub_len):\n \n if text[i+j]==substr[j]:\n continue\n else:\n break\n \n if j==sub_len-1:\n print 'The substring is present from subscript %d onwards' %i\n \n",
+ "input": [
+ "\n",
+ "text='The programming is a systematic process'\n",
+ "substr='pro'\n",
+ "text_len=len(text)\n",
+ "sub_len=len(substr)\n",
+ "text=list(text)\n",
+ "substr=list(substr)\n",
+ "\n",
+ "for i in xrange(0,text_len-sub_len+1):\n",
+ " \n",
+ " for j in xrange(0,sub_len):\n",
+ " \n",
+ " if text[i+j]==substr[j]:\n",
+ " continue\n",
+ " else:\n",
+ " break\n",
+ " \n",
+ " if j==sub_len-1:\n",
+ " print 'The substring is present from subscript %d onwards' %i\n",
+ " \n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The substring is present from subscript 4 onwards\nThe substring is present from subscript 32 onwards\n"
+ "text": [
+ "The substring is present from subscript 4 onwards\n",
+ "The substring is present from subscript 32 onwards\n"
+ ]
}
],
"prompt_number": 14
@@ -235,19 +465,77 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 10.15,Page number: 10.15<h3>"
+ "source": [
+ "<h3>Example 10.15,Page number: 10.15<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Reordering a list of strings\n\n\ndef reorder(x):\n\n n=len(x)\n for item in range(0,n-1):\n for i in range(item+1,n):\n if x[item]>x[i]:\n temp=x[item]\n x[item]=x[i]\n x[i]=temp\n\n\n return\n\nx=['PACIFIC','ATLANTIC','INDIAN','CARIBBEAN','BERING','BLACK','RED','NORTH','BALTIC','CASPIAN']\nprint 'Original list of strings :\\n\\n'\n\nfor i in x:\n print \"String : \",i\n\nreorder(x)\n\nprint \"\\nReodered list of strings : \\n\\n\"\n\nfor i in x:\n print \"String : \",i\n",
+ "input": [
+ "\n",
+ "\n",
+ "def reorder(x):\n",
+ "\n",
+ " n=len(x)\n",
+ " for item in range(0,n-1):\n",
+ " for i in range(item+1,n):\n",
+ " if x[item]>x[i]:\n",
+ " temp=x[item]\n",
+ " x[item]=x[i]\n",
+ " x[i]=temp\n",
+ "\n",
+ "\n",
+ " return\n",
+ "\n",
+ "x=['PACIFIC','ATLANTIC','INDIAN','CARIBBEAN','BERING','BLACK','RED','NORTH','BALTIC','CASPIAN']\n",
+ "print 'Original list of strings :\\n\\n'\n",
+ "\n",
+ "for i in x:\n",
+ " print \"String : \",i\n",
+ "\n",
+ "reorder(x)\n",
+ "\n",
+ "print \"\\nReodered list of strings : \\n\\n\"\n",
+ "\n",
+ "for i in x:\n",
+ " print \"String : \",i\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original list of strings :\n\n\nString : PACIFIC\nString : ATLANTIC\nString : INDIAN\nString : CARIBBEAN\nString : BERING\nString : BLACK\nString : RED\nString : NORTH\nString : BALTIC\nString : CASPIAN\n\nReodered list of strings : \n\n\nString : ATLANTIC\nString : BALTIC\nString : BERING\nString : BLACK\nString : CARIBBEAN\nString : CASPIAN\nString : INDIAN\nString : NORTH\nString : PACIFIC\nString : RED\n"
+ "text": [
+ "Original list of strings :\n",
+ "\n",
+ "\n",
+ "String : PACIFIC\n",
+ "String : ATLANTIC\n",
+ "String : INDIAN\n",
+ "String : CARIBBEAN\n",
+ "String : BERING\n",
+ "String : BLACK\n",
+ "String : RED\n",
+ "String : NORTH\n",
+ "String : BALTIC\n",
+ "String : CASPIAN\n",
+ "\n",
+ "Reodered list of strings : \n",
+ "\n",
+ "\n",
+ "String : ATLANTIC\n",
+ "String : BALTIC\n",
+ "String : BERING\n",
+ "String : BLACK\n",
+ "String : CARIBBEAN\n",
+ "String : CASPIAN\n",
+ "String : INDIAN\n",
+ "String : NORTH\n",
+ "String : PACIFIC\n",
+ "String : RED\n"
+ ]
}
],
"prompt_number": 15
@@ -255,7 +543,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": [],
diff --git a/_Programming_With_C/chapter11.ipynb b/_Programming_With_C/chapter11.ipynb
index 1f4127e4..d858cd07 100644
--- a/_Programming_With_C/chapter11.ipynb
+++ b/_Programming_With_C/chapter11.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "chapter11"
+ "name": "",
+ "signature": "sha256:81f953770b0acac35782d6d61b5968cf0c7681b2e047ca75cfe8abd7244d5bab"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,24 +11,49 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h1>Chapter 11: Pointers<h1>"
+ "source": [
+ "<h1>Chapter 11: Pointers<h1>"
+ ]
},
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.1, Page 11.2<h3>"
+ "source": [
+ "<h3>Example 11.1, Page 11.2<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# realtionship between two variables, their address and associated pointers\n\n\nu,v=[3],[]\npu=u\nv=pu\npv=v\n\nprint \"u=\",u[0],\nprint \"&u=\",id(u),\nprint \"pu=\",id(u),\nprint \"*pu\",pu[0]\n\nprint \"v=\",v[0],\nprint \"&v=\",id(v),\nprint \"pv=\",id(v),\nprint \"*pv\",pv[0]\n",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "u,v=[3],[]\n",
+ "pu=u\n",
+ "v=pu\n",
+ "pv=v\n",
+ "\n",
+ "print \"u=\",u[0],\n",
+ "print \"&u=\",id(u),\n",
+ "print \"pu=\",id(u),\n",
+ "print \"*pu\",pu[0]\n",
+ "\n",
+ "print \"v=\",v[0],\n",
+ "print \"&v=\",id(v),\n",
+ "print \"pv=\",id(v),\n",
+ "print \"*pv\",pv[0]\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "u= 3 &u= 56575840 pu= 56575840 *pu 3\nv= 3 &v= 56575840 pv= 56575840 *pv 3\n"
+ "text": [
+ "u= 3 &u= 56575840 pu= 56575840 *pu 3\n",
+ "v= 3 &v= 56575840 pv= 56575840 *pv 3\n"
+ ]
}
],
"prompt_number": 11
@@ -35,19 +61,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.2, Page number: 11.3<h3>"
+ "source": [
+ "<h3>Example 11.2, Page number: 11.3<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# a simple program using pointers\n\n\nv=[3]\nu1=2*(v[0]+5)\npv=v\nu2=2*(pv[0]+5)\n\nprint \"u1=%d u2=%d\" %(u1,u2)",
+ "input": [
+ "\n",
+ "\n",
+ "v=[3]\n",
+ "u1=2*(v[0]+5)\n",
+ "pv=v\n",
+ "u2=2*(pv[0]+5)\n",
+ "\n",
+ "print \"u1=%d u2=%d\" %(u1,u2)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "u1=16 u2=16\n"
+ "text": [
+ "u1=16 u2=16\n"
+ ]
}
],
"prompt_number": 12
@@ -55,19 +94,32 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.3, Page munber: 11.4<h3>"
+ "source": [
+ "<h3>Example 11.3, Page munber: 11.4<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# a simple programme using pointers\n\nv=[3]\npv=v\nprint \"*pv=%d v=%d\" %(pv[0],v[0])\n\npv[0]=0\nprint \"*pv=%d v=%d\" %(pv[0],v[0])",
+ "input": [
+ "\n",
+ "v=[3]\n",
+ "pv=v\n",
+ "print \"*pv=%d v=%d\" %(pv[0],v[0])\n",
+ "\n",
+ "pv[0]=0\n",
+ "print \"*pv=%d v=%d\" %(pv[0],v[0])"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "*pv=3 v=3\n*pv=0 v=0\n"
+ "text": [
+ "*pv=3 v=3\n",
+ "*pv=0 v=0\n"
+ ]
}
],
"prompt_number": 13
@@ -75,19 +127,53 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.7, Page number: 11.6<h3>"
+ "source": [
+ "<h3>Example 11.7, Page number: 11.6<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# difference between by pass by reference and pass by value\n\n\ndef funct1(u,v):\n u=0\n v=0\n print \"Within funct1 : u=%d v=%d\" %(u,v)\n return\n\ndef funct2(u,v):\n u[0]=0\n v[0]=0\n print \"Within funct2 : *pu=%d *pv=%d\" %(u[0],v[0])\n return\n\nu=[1]\nv=[3]\n\nprint \"Before calling funct1: u=%d v=%d\" %(u[0],v[0])\nfunct1(u[0],v[0])\nprint \"After calling funct1 : u=%d v=%d\" %(u[0],v[0])\n\nprint \"Before calling funct2: u=%d v=%d\" %(u[0],v[0])\nfunct2(u,v)\nprint \"After calling funct2 : u=%d v=%d\" %(u[0],v[0])",
+ "input": [
+ "\n",
+ "\n",
+ "def funct1(u,v):\n",
+ " u=0\n",
+ " v=0\n",
+ " print \"Within funct1 : u=%d v=%d\" %(u,v)\n",
+ " return\n",
+ "\n",
+ "def funct2(u,v):\n",
+ " u[0]=0\n",
+ " v[0]=0\n",
+ " print \"Within funct2 : *pu=%d *pv=%d\" %(u[0],v[0])\n",
+ " return\n",
+ "\n",
+ "u=[1]\n",
+ "v=[3]\n",
+ "\n",
+ "print \"Before calling funct1: u=%d v=%d\" %(u[0],v[0])\n",
+ "funct1(u[0],v[0])\n",
+ "print \"After calling funct1 : u=%d v=%d\" %(u[0],v[0])\n",
+ "\n",
+ "print \"Before calling funct2: u=%d v=%d\" %(u[0],v[0])\n",
+ "funct2(u,v)\n",
+ "print \"After calling funct2 : u=%d v=%d\" %(u[0],v[0])"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Before calling funct1: u=1 v=3\nWithin funct1 : u=0 v=0\nAfter calling funct1 : u=1 v=3\nBefore calling funct2: u=1 v=3\nWithin funct2 : *pu=0 *pv=0\nAfter calling funct2 : u=0 v=0\n"
+ "text": [
+ "Before calling funct1: u=1 v=3\n",
+ "Within funct1 : u=0 v=0\n",
+ "After calling funct1 : u=1 v=3\n",
+ "Before calling funct2: u=1 v=3\n",
+ "Within funct2 : *pu=0 *pv=0\n",
+ "After calling funct2 : u=0 v=0\n"
+ ]
}
],
"prompt_number": 14
@@ -95,19 +181,62 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.8, Page number: 11.8<h3>"
+ "source": [
+ "<h3>Example 11.8, Page number: 11.8<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Analyzing a line of text\n\n\n\ndef scan_line(line,pv,pc,pd,pw,po):\n\n for c in line:\n\n if c=='A' or c=='E' or c=='I' or c=='O' or c=='U':\n pv[0]+=1\n elif c>='A' and c<='Z':\n pc[0]+=1\n elif c>='0' and c<='9':\n pd[0]+=1\n elif c==' ' or c=='\\t':\n pw[0]+=1\n else:\n po[0]+=1\n\n return\n\n\nvowel,consonants,digits,whitespc,other=[0],[0],[0],[0],[0]\nline=\"Personal computers with memories in excess of 4096 KB are now quite common.\"\nline=line.upper()\nscan_line(line,vowel,consonants,digits,whitespc,other)\nprint \"\\n\\n\"\nprint \"No. of vowels : \",vowel[0]\nprint \"No. of consonants : \",consonants[0]\nprint \"No. of digits : \",digits[0]\nprint \"No. of whitespace characters : \",whitespc[0]\nprint \"No. of other characters : \",other[0]",
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "def scan_line(line,pv,pc,pd,pw,po):\n",
+ "\n",
+ " for c in line:\n",
+ "\n",
+ " if c=='A' or c=='E' or c=='I' or c=='O' or c=='U':\n",
+ " pv[0]+=1\n",
+ " elif c>='A' and c<='Z':\n",
+ " pc[0]+=1\n",
+ " elif c>='0' and c<='9':\n",
+ " pd[0]+=1\n",
+ " elif c==' ' or c=='\\t':\n",
+ " pw[0]+=1\n",
+ " else:\n",
+ " po[0]+=1\n",
+ "\n",
+ " return\n",
+ "\n",
+ "\n",
+ "vowel,consonants,digits,whitespc,other=[0],[0],[0],[0],[0]\n",
+ "line=\"Personal computers with memories in excess of 4096 KB are now quite common.\"\n",
+ "line=line.upper()\n",
+ "scan_line(line,vowel,consonants,digits,whitespc,other)\n",
+ "print \"\\n\\n\"\n",
+ "print \"No. of vowels : \",vowel[0]\n",
+ "print \"No. of consonants : \",consonants[0]\n",
+ "print \"No. of digits : \",digits[0]\n",
+ "print \"No. of whitespace characters : \",whitespc[0]\n",
+ "print \"No. of other characters : \",other[0]"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n\n\nNo. of vowels : 23\nNo. of consonants : 35\nNo. of digits : 4\nNo. of whitespace characters : 12\nNo. of other characters : 1\n"
+ "text": [
+ "\n",
+ "\n",
+ "\n",
+ "No. of vowels : 23\n",
+ "No. of consonants : 35\n",
+ "No. of digits : 4\n",
+ "No. of whitespace characters : 12\n",
+ "No. of other characters : 1\n"
+ ]
}
],
"prompt_number": 15
@@ -115,19 +244,40 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.12, Page number: 11.15<h3>"
+ "source": [
+ "<h3>Example 11.12, Page number: 11.15<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# unlike C in python the elements of a list are not arranged in memory uniformly\n\nx=[10,11,12,13,14,15,16,17,18,19]\n\nfor i in range(0,10):\n print \"i=%d x[i]=%d *(x+1)=%d\" %(i,x[i],x[i]),\n print \" &x[i]=\",id(x[i]),\n print \" x+i=\",id(x[i])",
+ "input": [
+ "\n",
+ "x=[10,11,12,13,14,15,16,17,18,19]\n",
+ "\n",
+ "for i in range(0,10):\n",
+ " print \"i=%d x[i]=%d *(x+1)=%d\" %(i,x[i],x[i]),\n",
+ " print \" &x[i]=\",id(x[i]),\n",
+ " print \" x+i=\",id(x[i])"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "i=0 x[i]=10 *(x+1)=10 &x[i]= 30696620 x+i= 30696620\ni=1 x[i]=11 *(x+1)=11 &x[i]= 30696608 x+i= 30696608\ni=2 x[i]=12 *(x+1)=12 &x[i]= 30696596 x+i= 30696596\ni=3 x[i]=13 *(x+1)=13 &x[i]= 30696584 x+i= 30696584\ni=4 x[i]=14 *(x+1)=14 &x[i]= 30696572 x+i= 30696572\ni=5 x[i]=15 *(x+1)=15 &x[i]= 30696560 x+i= 30696560\ni=6 x[i]=16 *(x+1)=16 &x[i]= 30696548 x+i= 30696548\ni=7 x[i]=17 *(x+1)=17 &x[i]= 30696536 x+i= 30696536\ni=8 x[i]=18 *(x+1)=18 &x[i]= 30696524 x+i= 30696524\ni=9 x[i]=19 *(x+1)=19 &x[i]= 30696512 x+i= 30696512\n"
+ "text": [
+ "i=0 x[i]=10 *(x+1)=10 &x[i]= 30696620 x+i= 30696620\n",
+ "i=1 x[i]=11 *(x+1)=11 &x[i]= 30696608 x+i= 30696608\n",
+ "i=2 x[i]=12 *(x+1)=12 &x[i]= 30696596 x+i= 30696596\n",
+ "i=3 x[i]=13 *(x+1)=13 &x[i]= 30696584 x+i= 30696584\n",
+ "i=4 x[i]=14 *(x+1)=14 &x[i]= 30696572 x+i= 30696572\n",
+ "i=5 x[i]=15 *(x+1)=15 &x[i]= 30696560 x+i= 30696560\n",
+ "i=6 x[i]=16 *(x+1)=16 &x[i]= 30696548 x+i= 30696548\n",
+ "i=7 x[i]=17 *(x+1)=17 &x[i]= 30696536 x+i= 30696536\n",
+ "i=8 x[i]=18 *(x+1)=18 &x[i]= 30696524 x+i= 30696524\n",
+ "i=9 x[i]=19 *(x+1)=19 &x[i]= 30696512 x+i= 30696512\n"
+ ]
}
],
"prompt_number": 16
@@ -135,19 +285,38 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.14, Page number: 11.17<h3>"
+ "source": [
+ "<h3>Example 11.14, Page number: 11.17<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# string as one dimensional character array\n\ndef main():\n global x\n y=\"This string is declared within main\"\n y=list(y)\n x=list(x)\n print x\n print y\n\n return\n\nx=\"This string is declared externally\"\nmain()\n",
+ "input": [
+ "\n",
+ "def main():\n",
+ " global x\n",
+ " y=\"This string is declared within main\"\n",
+ " y=list(y)\n",
+ " x=list(x)\n",
+ " print x\n",
+ " print y\n",
+ "\n",
+ " return\n",
+ "\n",
+ "x=\"This string is declared externally\"\n",
+ "main()\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "['T', 'h', 'i', 's', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'i', 's', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e', 'd', ' ', 'e', 'x', 't', 'e', 'r', 'n', 'a', 'l', 'l', 'y']\n['T', 'h', 'i', 's', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'i', 's', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e', 'd', ' ', 'w', 'i', 't', 'h', 'i', 'n', ' ', 'm', 'a', 'i', 'n']\n"
+ "text": [
+ "['T', 'h', 'i', 's', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'i', 's', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e', 'd', ' ', 'e', 'x', 't', 'e', 'r', 'n', 'a', 'l', 'l', 'y']\n",
+ "['T', 'h', 'i', 's', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'i', 's', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e', 'd', ' ', 'w', 'i', 't', 'h', 'i', 'n', ' ', 'm', 'a', 'i', 'n']\n"
+ ]
}
],
"prompt_number": 17
@@ -155,19 +324,71 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.16, Page number: 11.19<h3>"
+ "source": [
+ "<h3>Example 11.16, Page number: 11.19<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Reoedering a list of numbers\n\n\ndef reorder(x):\n n=len(x)\n for item in range(0,n-1):\n for i in range(item+1,n):\n if x[i]<x[item]:\n temp=x[item]\n x[item]=x[i]\n x[i]=temp\n\n return\n\nn=10\nx=[]\n\nfor i in range(0,n):\n inp=i+1\n print \"\\ni=%d x=%d\" %(i+1,inp),\n x.append(inp)\n\nreorder(x)\n\nprint \"\\n\"\nfor i in range(0,n):\n print \"i=%d x=%d\" %(i+1,x[i])\n",
+ "input": [
+ "\n",
+ "\n",
+ "def reorder(x):\n",
+ " n=len(x)\n",
+ " for item in range(0,n-1):\n",
+ " for i in range(item+1,n):\n",
+ " if x[i]<x[item]:\n",
+ " temp=x[item]\n",
+ " x[item]=x[i]\n",
+ " x[i]=temp\n",
+ "\n",
+ " return\n",
+ "\n",
+ "n=10\n",
+ "x=[]\n",
+ "\n",
+ "for i in range(0,n):\n",
+ " inp=i+1\n",
+ " print \"\\ni=%d x=%d\" %(i+1,inp),\n",
+ " x.append(inp)\n",
+ "\n",
+ "reorder(x)\n",
+ "\n",
+ "print \"\\n\"\n",
+ "for i in range(0,n):\n",
+ " print \"i=%d x=%d\" %(i+1,x[i])\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\ni=1 x=1 \ni=2 x=2 \ni=3 x=3 \ni=4 x=4 \ni=5 x=5 \ni=6 x=6 \ni=7 x=7 \ni=8 x=8 \ni=9 x=9 \ni=10 x=10 \n\ni=1 x=1\ni=2 x=2\ni=3 x=3\ni=4 x=4\ni=5 x=5\ni=6 x=6\ni=7 x=7\ni=8 x=8\ni=9 x=9\ni=10 x=10\n"
+ "text": [
+ "\n",
+ "i=1 x=1 \n",
+ "i=2 x=2 \n",
+ "i=3 x=3 \n",
+ "i=4 x=4 \n",
+ "i=5 x=5 \n",
+ "i=6 x=6 \n",
+ "i=7 x=7 \n",
+ "i=8 x=8 \n",
+ "i=9 x=9 \n",
+ "i=10 x=10 \n",
+ "\n",
+ "i=1 x=1\n",
+ "i=2 x=2\n",
+ "i=3 x=3\n",
+ "i=4 x=4\n",
+ "i=5 x=5\n",
+ "i=6 x=6\n",
+ "i=7 x=7\n",
+ "i=8 x=8\n",
+ "i=9 x=9\n",
+ "i=10 x=10\n"
+ ]
}
],
"prompt_number": 18
@@ -175,19 +396,40 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.17, Page number: 11.21<h3>"
+ "source": [
+ "<h3>Example 11.17, Page number: 11.21<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Pointer arithmetic doesnt exixt in python\n\ni=[4]\ni[0]=1\nf=0.3\nd=0.005\nc='*'\n\npx=i\nprint 'Values: i=%d f=%f d=%f c=%c \\n' %(i[0],f,d,c)\nprint 'Addresses: &i=%X &f=%X &d=%X &c=%X \\n' %(id(i[0]),id(f),id(d),id(c))\nprint 'Pointer Values: px=%X px+1=%X px+2=%X px+3=%X' %(id(px[0]),id(px[0]+1),id(px[0]+2),id(px[0]+3))\n\n",
+ "input": [
+ "\n",
+ "i=[4]\n",
+ "i[0]=1\n",
+ "f=0.3\n",
+ "d=0.005\n",
+ "c='*'\n",
+ "\n",
+ "px=i\n",
+ "print 'Values: i=%d f=%f d=%f c=%c \\n' %(i[0],f,d,c)\n",
+ "print 'Addresses: &i=%X &f=%X &d=%X &c=%X \\n' %(id(i[0]),id(f),id(d),id(c))\n",
+ "print 'Pointer Values: px=%X px+1=%X px+2=%X px+3=%X' %(id(px[0]),id(px[0]+1),id(px[0]+2),id(px[0]+3))\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Values: i=1 f=0.300000 d=0.005000 c=* \n\nAddresses: &i=1D46518 &f=32BD940 &d=32BD950 &c=1D9F158 \n\nPointer Values: px=1D46518 px+1=1D4650C px+2=1D46500 px+3=1D464F4\n"
+ "text": [
+ "Values: i=1 f=0.300000 d=0.005000 c=* \n",
+ "\n",
+ "Addresses: &i=1D46518 &f=32BD940 &d=32BD950 &c=1D9F158 \n",
+ "\n",
+ "Pointer Values: px=1D46518 px+1=1D4650C px+2=1D46500 px+3=1D464F4\n"
+ ]
}
],
"prompt_number": 19
@@ -195,19 +437,34 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.18, Page number: 11.22<h3>"
+ "source": [
+ "<h3>Example 11.18, Page number: 11.22<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# two different pointer variable points to the first and last element of an integer array\n\na=[1,2,3,4,5,6]\n\npx=a[0]\npy=a[5]\n\nprint 'px=%X py=%X \\n' %(id(px),id(py))\nprint 'py - px = %X' %(id(py)-id(px))",
+ "input": [
+ "\n",
+ "a=[1,2,3,4,5,6]\n",
+ "\n",
+ "px=a[0]\n",
+ "py=a[5]\n",
+ "\n",
+ "print 'px=%X py=%X \\n' %(id(px),id(py))\n",
+ "print 'py - px = %X' %(id(py)-id(px))"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "px=1D46518 py=1D464DC \n\npy - px = -3C\n"
+ "text": [
+ "px=1D46518 py=1D464DC \n",
+ "\n",
+ "py - px = -3C\n"
+ ]
}
],
"prompt_number": 20
@@ -215,19 +472,96 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.22, Page number: 11.26<h3>"
+ "source": [
+ "<h3>Example 11.22, Page number: 11.26<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# adding two tables of numbers\n\ndef readinput(m,n,i=0):\n\n at=[]\n for row in range(0,m):\n temp=[]\n for col in range(0,n):\n t=i\n i+=2\n temp.append(t)\n at.append(temp)\n\n\n return at\n \ndef computesum(a,b,m,n):\n\n c=[]\n\n for row in range(0,m):\n temp=[]\n for col in range(0,n):\n t=a[row][col]+b[row][col]\n temp.append(t)\n c.append(temp)\n\n return c\n\ndef writeoutput(c,m,n):\n\n for row in range(0,m):\n for col in range(0,n):\n print \"%4d\" %(c[row][col]),\n print\n\n return\n\n\n\nprint \"\\n FIRST TABLE : \\n\"\na=readinput(5,5,1)\nwriteoutput(a,5,5)\n\nprint \"\\n SECOND TABLE : \\n\"\nb=readinput(5,5,50)\nwriteoutput(b,5,5)\n\nc=computesum(a,b,5,5)\nprint \"Sums of the elements : \\n\"\nwriteoutput(c,5,5)\n",
+ "input": [
+ "\n",
+ "def readinput(m,n,i=0):\n",
+ "\n",
+ " at=[]\n",
+ " for row in range(0,m):\n",
+ " temp=[]\n",
+ " for col in range(0,n):\n",
+ " t=i\n",
+ " i+=2\n",
+ " temp.append(t)\n",
+ " at.append(temp)\n",
+ "\n",
+ "\n",
+ " return at\n",
+ " \n",
+ "def computesum(a,b,m,n):\n",
+ "\n",
+ " c=[]\n",
+ "\n",
+ " for row in range(0,m):\n",
+ " temp=[]\n",
+ " for col in range(0,n):\n",
+ " t=a[row][col]+b[row][col]\n",
+ " temp.append(t)\n",
+ " c.append(temp)\n",
+ "\n",
+ " return c\n",
+ "\n",
+ "def writeoutput(c,m,n):\n",
+ "\n",
+ " for row in range(0,m):\n",
+ " for col in range(0,n):\n",
+ " print \"%4d\" %(c[row][col]),\n",
+ " print\n",
+ "\n",
+ " return\n",
+ "\n",
+ "\n",
+ "\n",
+ "print \"\\n FIRST TABLE : \\n\"\n",
+ "a=readinput(5,5,1)\n",
+ "writeoutput(a,5,5)\n",
+ "\n",
+ "print \"\\n SECOND TABLE : \\n\"\n",
+ "b=readinput(5,5,50)\n",
+ "writeoutput(b,5,5)\n",
+ "\n",
+ "c=computesum(a,b,5,5)\n",
+ "print \"Sums of the elements : \\n\"\n",
+ "writeoutput(c,5,5)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n FIRST TABLE : \n\n 1 3 5 7 9\n 11 13 15 17 19\n 21 23 25 27 29\n 31 33 35 37 39\n 41 43 45 47 49\n\n SECOND TABLE : \n\n 50 52 54 56 58\n 60 62 64 66 68\n 70 72 74 76 78\n 80 82 84 86 88\n 90 92 94 96 98\nSums of the elements : \n\n 51 55 59 63 67\n 71 75 79 83 87\n 91 95 99 103 107\n 111 115 119 123 127\n 131 135 139 143 147\n"
+ "text": [
+ "\n",
+ " FIRST TABLE : \n",
+ "\n",
+ " 1 3 5 7 9\n",
+ " 11 13 15 17 19\n",
+ " 21 23 25 27 29\n",
+ " 31 33 35 37 39\n",
+ " 41 43 45 47 49\n",
+ "\n",
+ " SECOND TABLE : \n",
+ "\n",
+ " 50 52 54 56 58\n",
+ " 60 62 64 66 68\n",
+ " 70 72 74 76 78\n",
+ " 80 82 84 86 88\n",
+ " 90 92 94 96 98\n",
+ "Sums of the elements : \n",
+ "\n",
+ " 51 55 59 63 67\n",
+ " 71 75 79 83 87\n",
+ " 91 95 99 103 107\n",
+ " 111 115 119 123 127\n",
+ " 131 135 139 143 147\n"
+ ]
}
],
"prompt_number": 21
@@ -235,19 +569,96 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.24, Page number: 11.31<h3>"
+ "source": [
+ "<h3>Example 11.24, Page number: 11.31<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# adding two tables of numbers\n\ndef readinput(m,n,i=0):\n\n at=[]\n for row in range(0,m):\n temp=[]\n for col in range(0,n):\n t=i\n i+=2\n temp.append(t)\n at.append(temp)\n\n\n return at\n \ndef computesum(a,b,m,n):\n\n c=[]\n\n for row in range(0,m):\n temp=[]\n for col in range(0,n):\n t=a[row][col]+b[row][col]\n temp.append(t)\n c.append(temp)\n\n return c\n\ndef writeoutput(c,m,n):\n\n for row in range(0,m):\n for col in range(0,n):\n print \"%4d\" %(c[row][col]),\n print\n\n return\n\n\n\nprint \"\\n FIRST TABLE : \\n\"\na=readinput(5,5,1)\nwriteoutput(a,5,5)\n\nprint \"\\n SECOND TABLE : \\n\"\nb=readinput(5,5,50)\nwriteoutput(b,5,5)\n\nc=computesum(a,b,5,5)\nprint \"Sums of the elements : \\n\"\nwriteoutput(c,5,5)\n",
+ "input": [
+ "\n",
+ "def readinput(m,n,i=0):\n",
+ "\n",
+ " at=[]\n",
+ " for row in range(0,m):\n",
+ " temp=[]\n",
+ " for col in range(0,n):\n",
+ " t=i\n",
+ " i+=2\n",
+ " temp.append(t)\n",
+ " at.append(temp)\n",
+ "\n",
+ "\n",
+ " return at\n",
+ " \n",
+ "def computesum(a,b,m,n):\n",
+ "\n",
+ " c=[]\n",
+ "\n",
+ " for row in range(0,m):\n",
+ " temp=[]\n",
+ " for col in range(0,n):\n",
+ " t=a[row][col]+b[row][col]\n",
+ " temp.append(t)\n",
+ " c.append(temp)\n",
+ "\n",
+ " return c\n",
+ "\n",
+ "def writeoutput(c,m,n):\n",
+ "\n",
+ " for row in range(0,m):\n",
+ " for col in range(0,n):\n",
+ " print \"%4d\" %(c[row][col]),\n",
+ " print\n",
+ "\n",
+ " return\n",
+ "\n",
+ "\n",
+ "\n",
+ "print \"\\n FIRST TABLE : \\n\"\n",
+ "a=readinput(5,5,1)\n",
+ "writeoutput(a,5,5)\n",
+ "\n",
+ "print \"\\n SECOND TABLE : \\n\"\n",
+ "b=readinput(5,5,50)\n",
+ "writeoutput(b,5,5)\n",
+ "\n",
+ "c=computesum(a,b,5,5)\n",
+ "print \"Sums of the elements : \\n\"\n",
+ "writeoutput(c,5,5)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "\n FIRST TABLE : \n\n 1 3 5 7 9\n 11 13 15 17 19\n 21 23 25 27 29\n 31 33 35 37 39\n 41 43 45 47 49\n\n SECOND TABLE : \n\n 50 52 54 56 58\n 60 62 64 66 68\n 70 72 74 76 78\n 80 82 84 86 88\n 90 92 94 96 98\nSums of the elements : \n\n 51 55 59 63 67\n 71 75 79 83 87\n 91 95 99 103 107\n 111 115 119 123 127\n 131 135 139 143 147\n"
+ "text": [
+ "\n",
+ " FIRST TABLE : \n",
+ "\n",
+ " 1 3 5 7 9\n",
+ " 11 13 15 17 19\n",
+ " 21 23 25 27 29\n",
+ " 31 33 35 37 39\n",
+ " 41 43 45 47 49\n",
+ "\n",
+ " SECOND TABLE : \n",
+ "\n",
+ " 50 52 54 56 58\n",
+ " 60 62 64 66 68\n",
+ " 70 72 74 76 78\n",
+ " 80 82 84 86 88\n",
+ " 90 92 94 96 98\n",
+ "Sums of the elements : \n",
+ "\n",
+ " 51 55 59 63 67\n",
+ " 71 75 79 83 87\n",
+ " 91 95 99 103 107\n",
+ " 111 115 119 123 127\n",
+ " 131 135 139 143 147\n"
+ ]
}
],
"prompt_number": 22
@@ -255,19 +666,77 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.26, Page number: 11.34<h3>"
+ "source": [
+ "<h3>Example 11.26, Page number: 11.34<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Reordering a list of strings\n\n\ndef reorder(x):\n\n n=len(x)\n for item in range(0,n-1):\n for i in range(item+1,n):\n if x[item]>x[i]:\n temp=x[item]\n x[item]=x[i]\n x[i]=temp\n\n\n return\n\nx=['PACIFIC','ATLANTIC','INDIAN','CARIBBEAN','BERING','BLACK','RED','NORTH','BALTIC','CASPIAN']\nprint 'Original list of strings :\\n\\n'\n\nfor i in x:\n print \"String : \",i\n\nreorder(x)\n\nprint \"\\nReodered list of strings : \\n\\n\"\n\nfor i in x:\n print \"String : \",i",
+ "input": [
+ "\n",
+ "\n",
+ "def reorder(x):\n",
+ "\n",
+ " n=len(x)\n",
+ " for item in range(0,n-1):\n",
+ " for i in range(item+1,n):\n",
+ " if x[item]>x[i]:\n",
+ " temp=x[item]\n",
+ " x[item]=x[i]\n",
+ " x[i]=temp\n",
+ "\n",
+ "\n",
+ " return\n",
+ "\n",
+ "x=['PACIFIC','ATLANTIC','INDIAN','CARIBBEAN','BERING','BLACK','RED','NORTH','BALTIC','CASPIAN']\n",
+ "print 'Original list of strings :\\n\\n'\n",
+ "\n",
+ "for i in x:\n",
+ " print \"String : \",i\n",
+ "\n",
+ "reorder(x)\n",
+ "\n",
+ "print \"\\nReodered list of strings : \\n\\n\"\n",
+ "\n",
+ "for i in x:\n",
+ " print \"String : \",i"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Original list of strings :\n\n\nString : PACIFIC\nString : ATLANTIC\nString : INDIAN\nString : CARIBBEAN\nString : BERING\nString : BLACK\nString : RED\nString : NORTH\nString : BALTIC\nString : CASPIAN\n\nReodered list of strings : \n\n\nString : ATLANTIC\nString : BALTIC\nString : BERING\nString : BLACK\nString : CARIBBEAN\nString : CASPIAN\nString : INDIAN\nString : NORTH\nString : PACIFIC\nString : RED\n"
+ "text": [
+ "Original list of strings :\n",
+ "\n",
+ "\n",
+ "String : PACIFIC\n",
+ "String : ATLANTIC\n",
+ "String : INDIAN\n",
+ "String : CARIBBEAN\n",
+ "String : BERING\n",
+ "String : BLACK\n",
+ "String : RED\n",
+ "String : NORTH\n",
+ "String : BALTIC\n",
+ "String : CASPIAN\n",
+ "\n",
+ "Reodered list of strings : \n",
+ "\n",
+ "\n",
+ "String : ATLANTIC\n",
+ "String : BALTIC\n",
+ "String : BERING\n",
+ "String : BLACK\n",
+ "String : CARIBBEAN\n",
+ "String : CASPIAN\n",
+ "String : INDIAN\n",
+ "String : NORTH\n",
+ "String : PACIFIC\n",
+ "String : RED\n"
+ ]
}
],
"prompt_number": 23
@@ -275,19 +744,79 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.28, Page number: 11.37<h3>"
+ "source": [
+ "<h3>Example 11.28, Page number: 11.37<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Display the day of the year\n\n\ndef convert(mm,dd,yy):\n yy-=1900\n ndays=long(30.42*(mm-1)+dd)\n if mm==2:\n ndays+=1\n if mm>2 and mm<8:\n ndays-=1\n if yy%4==0 and mm<2:\n ndays+=1\n\n ncycles=yy/4\n ndays+=ncycles*1461\n\n nyears=yy%4\n if nyears>0:\n ndays+=365*nyears+1\n if ndays>59:\n ndays-=1\n\n day=ndays%7\n\n return day\n\ndef main(mm,dd,yy):\n day_of_week=convert(mm,dd,yy)\n print \"%s, %s %d %d\" %(weekday[day_of_week],month[mm-1],dd,yy)\n return\n \nweekday=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']\nmonth=['January','February','March','April','May','June','July','August',\\\n 'September','October','November','December']\n\nmain(10,29,1929)\nprint\nmain(8,15,1945)\nprint\nmain(7,20,1969)\nprint\nmain(5,24,1997)\nprint\nmain(8,30,2010)\nprint\nmain(4,12,2069)\n",
+ "input": [
+ "\n",
+ "\n",
+ "def convert(mm,dd,yy):\n",
+ " yy-=1900\n",
+ " ndays=long(30.42*(mm-1)+dd)\n",
+ " if mm==2:\n",
+ " ndays+=1\n",
+ " if mm>2 and mm<8:\n",
+ " ndays-=1\n",
+ " if yy%4==0 and mm<2:\n",
+ " ndays+=1\n",
+ "\n",
+ " ncycles=yy/4\n",
+ " ndays+=ncycles*1461\n",
+ "\n",
+ " nyears=yy%4\n",
+ " if nyears>0:\n",
+ " ndays+=365*nyears+1\n",
+ " if ndays>59:\n",
+ " ndays-=1\n",
+ "\n",
+ " day=ndays%7\n",
+ "\n",
+ " return day\n",
+ "\n",
+ "def main(mm,dd,yy):\n",
+ " day_of_week=convert(mm,dd,yy)\n",
+ " print \"%s, %s %d %d\" %(weekday[day_of_week],month[mm-1],dd,yy)\n",
+ " return\n",
+ " \n",
+ "weekday=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']\n",
+ "month=['January','February','March','April','May','June','July','August',\\\n",
+ " 'September','October','November','December']\n",
+ "\n",
+ "main(10,29,1929)\n",
+ "print\n",
+ "main(8,15,1945)\n",
+ "print\n",
+ "main(7,20,1969)\n",
+ "print\n",
+ "main(5,24,1997)\n",
+ "print\n",
+ "main(8,30,2010)\n",
+ "print\n",
+ "main(4,12,2069)\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Tuesday, October 29 1929\n\nWednesday, August 15 1945\n\nSunday, July 20 1969\n\nSaturday, May 24 1997\n\nMonday, August 30 2010\n\nFriday, April 12 2069\n"
+ "text": [
+ "Tuesday, October 29 1929\n",
+ "\n",
+ "Wednesday, August 15 1945\n",
+ "\n",
+ "Sunday, July 20 1969\n",
+ "\n",
+ "Saturday, May 24 1997\n",
+ "\n",
+ "Monday, August 30 2010\n",
+ "\n",
+ "Friday, April 12 2069\n"
+ ]
}
],
"prompt_number": 24
@@ -295,19 +824,139 @@
{
"cell_type": "markdown",
"metadata": {},
- "source": "<h3>Example 11.30, Page number: 11.44<h3>"
+ "source": [
+ "<h3>Example 11.30, Page number: 11.44<h3>"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Future value of monthly deposits (compound interest calculations)\n\n\ndef ratio_choose(freq,a,m,n):\n\n if freq=='C':\n ratio=md3(a,m,n)\n elif freq=='D':\n ratio=md2(a,m,n)\n else:\n ratio=md1(a,m,n)\n\n return ratio\n\n\ndef table(freq,a,m,n):\n\n\n print \"Interest Rate Future Amount\\n\\n\"\n for count in range(1,21):\n i=0.01*count\n f=a*ratio_choose(freq,i,m,n)\n print \" %2d %.2f\" %(count,f)\n\n return\n\ndef md1(i,m,n):\n \n factor=1+i/m\n ratio=12*(factor**(m*n)-1)/i\n return ratio\n\ndef md2(i,m,n):\n\n factor=1+i/m\n ratio=(factor**(m*n)-1)/(factor**(m/12)-1)\n return ratio\n\ndef md3(i,dummy,n):\n ratio=(10**(i*n)-1)/(10**(i/12)-1)\n return ratio\n\ndef main(freq):\n m=0\n freq=freq.upper()\n if freq=='A':\n m=1\n print \"\\nAnual Compounding\\n\"\n \n elif freq=='S':\n m=2\n print \"\\nSemiannual Compounding\\n\"\n \n elif freq=='Q':\n print \"\\nQuaterly Compounding\\n\"\n m=4\n \n elif freq=='M':\n m=12\n print \"\\nMonthly Compounding\\n\"\n \n elif freq=='D':\n m=360\n print \"\\nDaily Compounding\\n\"\n\n elif freq=='C':\n m=0\n print \"\\nContinuous Compounding\\n\"\n \n else:\n print \"\\nERROR!!! Please Repeat\\n\\n\"\n return\n \n return m\n\n\na,n,freq=100,3,'m'\nprint \"FUTURE VALUE OF A SERIES OF MONTHLY DEPOSITS\\n\\n\"\nprint \"Frequency of Compunding (A,S,Q,M,D,C): \",freq\nprint \"Amount of Each Monthly Payement : \",a\nprint \"Number of years: \",n\nm=main(freq)\n\ntable(freq,a,m,n)\n\n",
+ "input": [
+ "\n",
+ "\n",
+ "def ratio_choose(freq,a,m,n):\n",
+ "\n",
+ " if freq=='C':\n",
+ " ratio=md3(a,m,n)\n",
+ " elif freq=='D':\n",
+ " ratio=md2(a,m,n)\n",
+ " else:\n",
+ " ratio=md1(a,m,n)\n",
+ "\n",
+ " return ratio\n",
+ "\n",
+ "\n",
+ "def table(freq,a,m,n):\n",
+ "\n",
+ "\n",
+ " print \"Interest Rate Future Amount\\n\\n\"\n",
+ " for count in range(1,21):\n",
+ " i=0.01*count\n",
+ " f=a*ratio_choose(freq,i,m,n)\n",
+ " print \" %2d %.2f\" %(count,f)\n",
+ "\n",
+ " return\n",
+ "\n",
+ "def md1(i,m,n):\n",
+ " \n",
+ " factor=1+i/m\n",
+ " ratio=12*(factor**(m*n)-1)/i\n",
+ " return ratio\n",
+ "\n",
+ "def md2(i,m,n):\n",
+ "\n",
+ " factor=1+i/m\n",
+ " ratio=(factor**(m*n)-1)/(factor**(m/12)-1)\n",
+ " return ratio\n",
+ "\n",
+ "def md3(i,dummy,n):\n",
+ " ratio=(10**(i*n)-1)/(10**(i/12)-1)\n",
+ " return ratio\n",
+ "\n",
+ "def main(freq):\n",
+ " m=0\n",
+ " freq=freq.upper()\n",
+ " if freq=='A':\n",
+ " m=1\n",
+ " print \"\\nAnual Compounding\\n\"\n",
+ " \n",
+ " elif freq=='S':\n",
+ " m=2\n",
+ " print \"\\nSemiannual Compounding\\n\"\n",
+ " \n",
+ " elif freq=='Q':\n",
+ " print \"\\nQuaterly Compounding\\n\"\n",
+ " m=4\n",
+ " \n",
+ " elif freq=='M':\n",
+ " m=12\n",
+ " print \"\\nMonthly Compounding\\n\"\n",
+ " \n",
+ " elif freq=='D':\n",
+ " m=360\n",
+ " print \"\\nDaily Compounding\\n\"\n",
+ "\n",
+ " elif freq=='C':\n",
+ " m=0\n",
+ " print \"\\nContinuous Compounding\\n\"\n",
+ " \n",
+ " else:\n",
+ " print \"\\nERROR!!! Please Repeat\\n\\n\"\n",
+ " return\n",
+ " \n",
+ " return m\n",
+ "\n",
+ "\n",
+ "a,n,freq=100,3,'m'\n",
+ "print \"FUTURE VALUE OF A SERIES OF MONTHLY DEPOSITS\\n\\n\"\n",
+ "print \"Frequency of Compunding (A,S,Q,M,D,C): \",freq\n",
+ "print \"Amount of Each Monthly Payement : \",a\n",
+ "print \"Number of years: \",n\n",
+ "m=main(freq)\n",
+ "\n",
+ "table(freq,a,m,n)\n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "FUTURE VALUE OF A SERIES OF MONTHLY DEPOSITS\n\n\nFrequency of Compunding (A,S,Q,M,D,C): m\nAmount of Each Monthly Payement : 100\nNumber of years: 3\n\nMonthly Compounding\n\nInterest Rate Future Amount\n\n\n 1 3653.00\n 2 3707.01\n 3 3762.06\n 4 3818.16\n 5 3875.33\n 6 3933.61\n 7 3993.01\n 8 4053.56\n 9 4115.27\n 10 4178.18\n 11 4242.31\n 12 4307.69\n 13 4374.33\n 14 4442.28\n 15 4511.55\n 16 4582.17\n 17 4654.18\n 18 4727.60\n 19 4802.45\n 20 4878.78\n"
+ "text": [
+ "FUTURE VALUE OF A SERIES OF MONTHLY DEPOSITS\n",
+ "\n",
+ "\n",
+ "Frequency of Compunding (A,S,Q,M,D,C): m\n",
+ "Amount of Each Monthly Payement : 100\n",
+ "Number of years: 3\n",
+ "\n",
+ "Monthly Compounding\n",
+ "\n",
+ "Interest Rate Future Amount\n",
+ "\n",
+ "\n",
+ " 1 3653.00\n",
+ " 2 3707.01\n",
+ " 3 3762.06\n",
+ " 4 3818.16\n",
+ " 5 3875.33\n",
+ " 6 3933.61\n",
+ " 7 3993.01\n",
+ " 8 4053.56\n",
+ " 9 4115.27\n",
+ " 10 4178.18\n",
+ " 11 4242.31\n",
+ " 12 4307.69\n",
+ " 13 4374.33\n",
+ " 14 4442.28\n",
+ " 15 4511.55\n",
+ " 16 4582.17\n",
+ " 17 4654.18\n",
+ " 18 4727.60\n",
+ " 19 4802.45\n",
+ " 20 4878.78\n"
+ ]
}
],
"prompt_number": 25
@@ -315,7 +964,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": [],
diff --git a/_Programming_With_C/chapter12.ipynb b/_Programming_With_C/chapter12.ipynb
index 8cde425c..09e4c7e9 100644
--- a/_Programming_With_C/chapter12.ipynb
+++ b/_Programming_With_C/chapter12.ipynb
@@ -115,7 +115,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Updating Costumer Records\n",
"from ctypes import *\n",
"\n",
"string=c_char*50\n",
@@ -315,7 +314,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# To process a linked List of strings\n",
"\n",
"class node():\n",
"\t\n",
@@ -457,7 +455,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Raising a number to a power\n",
"\n",
"from ctypes import *\n",
"import math\n",
diff --git a/_Programming_With_C/chapter13.ipynb b/_Programming_With_C/chapter13.ipynb
index fca3666f..fe4b86df 100644
--- a/_Programming_With_C/chapter13.ipynb
+++ b/_Programming_With_C/chapter13.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Writing to a data file\n",
"\n",
"fp=open(\"output.txt\",'w')\n",
"for k in range(65,91):\n",
@@ -50,7 +49,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Creating a file containing customer records\n",
"\n",
"from ctypes import *\n",
"\n",
@@ -154,7 +152,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# concept of binary files\n",
"\n",
"fp=open('binval.txt','wb')\n",
"\n",
diff --git a/_Programming_With_C/chapter14.ipynb b/_Programming_With_C/chapter14.ipynb
index 325040e9..d89e7c72 100644
--- a/_Programming_With_C/chapter14.ipynb
+++ b/_Programming_With_C/chapter14.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# illustrates the use of right shift operator\n",
"\n",
"a=0xf05a\n",
"\n",
@@ -57,7 +56,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# displaying bit patterns\n",
"\n",
"\n",
"a=1\n",
@@ -129,7 +127,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Storing Names and Birthdays\n",
"\n",
"from ctypes import *\n",
"\n",
diff --git a/_Programming_With_C/chapter2.ipynb b/_Programming_With_C/chapter2.ipynb
index 8b81d936..178b56ae 100644
--- a/_Programming_With_C/chapter2.ipynb
+++ b/_Programming_With_C/chapter2.ipynb
@@ -52,7 +52,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# for adding two numbers\n",
"\n",
"\n",
"sum=10+20\n",
@@ -83,7 +82,6 @@
"collapsed": false,
"input": [
"\n",
- "# to find the sum. numbers taken as input\n",
"\n",
"\n",
"num1,num2=50,25\n",
diff --git a/_Programming_With_C/chapter3.ipynb b/_Programming_With_C/chapter3.ipynb
index b9600cd8..fbf10f10 100644
--- a/_Programming_With_C/chapter3.ipynb
+++ b/_Programming_With_C/chapter3.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#illustrates the size of respective data type (in C)\n",
"\n",
"import ctypes as ct\n",
"\n",
@@ -62,7 +61,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# to calculate the roots of quadratic equation\n",
"\n",
"\n",
"print \"for the equation ax^2+bx+c \\n\"\n",
@@ -106,7 +104,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# to convert a lower case char to upper case\n",
"\n",
"\n",
"\n",
diff --git a/_Programming_With_C/chapter4.ipynb b/_Programming_With_C/chapter4.ipynb
index 1f1dcee7..21edac6f 100644
--- a/_Programming_With_C/chapter4.ipynb
+++ b/_Programming_With_C/chapter4.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# lowercase to uppercase conversion\n",
"\n",
"\n",
"ch='a'\n",
@@ -55,7 +54,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# shows the use of print function\n",
"\n",
"import math\n",
"\n",
@@ -87,7 +85,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# generates the same floating point output in 2 different ways\n",
"\n",
"x,y=5000.0,0.0025\n",
"\n",
@@ -122,7 +119,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# reading and writing a line of text\n",
"\n",
"line=\"The PITTSBURG STEELERS is one of America's favorite football teams!\"\n",
"print \"%s\" %(line)\n",
@@ -152,7 +148,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# illustrates the use of the minimum field width feature\n",
"\n",
"i=12345\n",
"x=345.678\n",
@@ -190,7 +185,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# makes use of g-type conversion\n",
"\n",
"i=12345\n",
"x=345.678\n",
@@ -230,7 +224,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# illustrates the use of precision feature with floating points\n",
"\n",
"x=123.456\n",
"\n",
@@ -265,7 +258,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# displays floating points numbers with only precision specification\n",
"\n",
"\n",
"x=123.456\n",
@@ -301,7 +293,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# illustrates the use of field width and precision specifications with string\n",
"\n",
"line=\"hexadecimal\"\n",
"\n",
@@ -333,7 +324,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# illustrates the use of upper case conversion characters\n",
"\n",
"a=0x80ec\n",
"b=0.3e-12\n",
@@ -370,7 +360,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# illustrates the use of flags with integers and floating point quantities\n",
"\n",
"i,x,y=123,12.0,-3.3\n",
"\n",
@@ -378,7 +367,6 @@
"print \":%-6d %-7.0f %-10.1e: \\n\" %(i,x,y)\n",
"print \":%+6d %+7.0f %+10.1e: \\n\" %(i,x,y)\n",
"print \":%-+6d %-+7.0f %-+10.1e: \\n\" %(i,x,y)\n",
- "print \":%7.0f %#7.0f %7g %#7g: \\n\" %(x,x,y,y)\n",
"\n",
"\n"
],
@@ -415,13 +403,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# use of flags with unsigned decimal octal and hexadecimal numbers\n",
"\n",
"i,j,k=1234,01777,0xa08c\n",
"\n",
"print \":%8u %8o %8x:\\n\" %(i,j,k)\n",
"print \":%-8u %-8o %-8x:\\n\" %(i,j,k)\n",
- "print \":%#8u %#8o %#8x:\\n\" %(i,j,k)\n",
"print \":%08u %08o %08x:\\n\" %(i,j,k)\n",
"\n",
"\n",
@@ -458,7 +444,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# illustrates the use flags with strings\n",
"\n",
"line=\"lower-case\"\n",
"\n",
@@ -494,7 +479,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# illustrates how printed ouput can be labeled\n",
"\n",
"a,b,x1,x2=2.2,-6.2,0.005,-12.88\n",
"\n",
@@ -529,7 +513,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# averaging student exam scores\n",
"\n",
"\n",
"name=\"Robert Smith\"\n",
diff --git a/_Programming_With_C/chapter5.ipynb b/_Programming_With_C/chapter5.ipynb
index b76ef801..ea09f2bd 100644
--- a/_Programming_With_C/chapter5.ipynb
+++ b/_Programming_With_C/chapter5.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Compound Interest\n",
"\n",
"import math\n",
"\n",
@@ -59,7 +58,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Real Rppts of a Quadratic Equation\n",
"\n",
"import math\n",
"\n",
diff --git a/_Programming_With_C/chapter6.ipynb b/_Programming_With_C/chapter6.ipynb
index 9e6277c3..5da628a1 100644
--- a/_Programming_With_C/chapter6.ipynb
+++ b/_Programming_With_C/chapter6.ipynb
@@ -66,7 +66,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# understanding basic if statement\n",
"\n",
"\n",
"def main(first,second):\n",
@@ -110,7 +109,6 @@
"collapsed": false,
"input": [
"\n",
- "# to understand the use of if else\n",
"\n",
"def main(time):\n",
"\n",
@@ -157,7 +155,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# consecutive integer quantities using WHILE loop\n",
"\n",
"\n",
"digit=0\n",
@@ -199,7 +196,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# lowercase to uppercase text conversion using WHILE loop\n",
"\n",
"\n",
"\n",
@@ -239,7 +235,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# averaging a list of numbers using while loop equivalent\n",
"\n",
"Sum,count=0,0\n",
"\n",
@@ -299,7 +294,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# consecutive integer quantities using an equivalent to DO-WHILE loop\n",
"\n",
"\n",
"digit=0\n",
@@ -343,7 +337,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# lowercase to uppercase text conversion using equivalent to DO-WHILE loop\n",
"\n",
"\n",
"letter=\"Fourscore and seven years ago aou fathers brought forth...\"\n",
@@ -386,7 +379,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# averaging a list of numbers using do whileloop equivalent\n",
"\n",
"Sum,count=0,0\n",
"\n",
@@ -435,7 +427,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# consecutive integer quantities using FOR loop\n",
"\n",
"for digit in range(0,10):\n",
" print digit\n",
@@ -475,7 +466,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# lowercase to uppercase text conversion using FOR loop\n",
"\n",
"\n",
"letter=\"Fourscore and seven years ago aou fathers brought forth...\"\n",
@@ -515,7 +505,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Averaging a List of Numbers using an FOR loop\n",
"\n",
"\n",
"n=6\n",
@@ -552,7 +541,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Repeated averaging of a list of numbers\n",
"\n",
"\n",
"\n",
@@ -611,7 +599,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# coverting several lines of text to upper case\n",
"\n",
"text=['Now is the time for all good men to come to aid..','Fourscore and seven years ago our fathers brought forth...','*']\n",
"\n",
@@ -669,7 +656,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Encoding a string of characters\n",
"\n",
"line=\"The White House. 1600 Pennsylvania Avenue. Washington. DC\"\n",
"line=list(line)\n",
@@ -718,7 +704,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Repeated Compund Interest Calculations with Error Tapping\n",
"\n",
"\n",
"def main(p,r,n):\n",
@@ -764,7 +749,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Solution of an algebraic equation : x^5+3x^2-10=0\n",
"\n",
"import math\n",
"\n",
@@ -850,7 +834,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# to show equivalent of switch case in python\n",
"\n",
"def main(ch):\n",
"\n",
@@ -896,7 +879,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# a small variation to the previous example\n",
"\n",
"def main(ch):\n",
" ch=ch.upper()\n",
@@ -948,7 +930,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# another example to show th equivalent of switch case in python\n",
"\n",
"\n",
"import math\n",
@@ -1007,7 +988,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Calculating Depreciation\n",
"\n",
"choice=0\n",
"\n",
@@ -1145,7 +1125,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Averaging list of Nonnegative Numbers\n",
"\n",
"navg=0\n",
"Sum=0.0\n",
@@ -1187,7 +1166,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Searching for Palindromes\n",
"\n",
"\n",
"\n",
@@ -1250,7 +1228,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# coverting several lines of text to upper case\n",
"\n",
"text=['Now is the time for all good men to come to aid..','Fourscore and seven years ago our fathers brought forth.$$..','*']\n",
"\n",
diff --git a/_Programming_With_C/chapter7.ipynb b/_Programming_With_C/chapter7.ipynb
index e33dc0cb..89247348 100644
--- a/_Programming_With_C/chapter7.ipynb
+++ b/_Programming_With_C/chapter7.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# lowercase to uppercase character conversion\n",
"\n",
"\n",
"def lower_to_upper(c1):\n",
@@ -67,7 +66,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# a variation to the function appeared in example 7.1\n",
"\n",
"\n",
"def lower_to_upper(c1):\n",
@@ -107,7 +105,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# determine the larger of the two integer quantities\n",
"\n",
"\n",
"def maximum(x,y):\n",
@@ -151,7 +148,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculates the factorial of n\n",
"\n",
"\n",
"def factorial(n):\n",
@@ -190,7 +186,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# finds max\n",
"\n",
"\n",
"def maximum(x,y):\n",
@@ -231,7 +226,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Largest of the three quantities\n",
"\n",
"\n",
"def maximum(x,y):\n",
@@ -275,7 +269,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculates the factorial of n\n",
"\n",
"\n",
"def factorial(n):\n",
@@ -315,7 +308,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Simulation of a game of chance (shooting craps)\n",
"\n",
"\n",
"\n",
@@ -397,7 +389,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# function that alters the value of the argument\n",
"\n",
"\n",
"def modify(a):\n",
@@ -438,7 +429,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculating depreciation\n",
"\n",
"\n",
"def sl(val,n):\n",
@@ -596,7 +586,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# calculating factorials in recursive way\n",
"\n",
"\n",
"def factorial(n):\n",
@@ -636,7 +625,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Printing Backwards: (recrsive)\n",
"\n",
"def reverse(text,n):\n",
"\n",
@@ -677,7 +665,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# the Towers of Hanoi - using recursion\n",
"\n",
"\n",
"def transfer(n,From,to,temp):\n",
diff --git a/_Programming_With_C/chapter8.ipynb b/_Programming_With_C/chapter8.ipynb
index 398a8b23..e9a55558 100644
--- a/_Programming_With_C/chapter8.ipynb
+++ b/_Programming_With_C/chapter8.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#calculating factorials\n",
"\n",
"def factorial(n):\n",
"\t\n",
@@ -68,7 +67,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Average Length of Several Lines of Text\n",
"\n",
"def linecount(text):\n",
"\t\n",
@@ -111,7 +109,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Search for a Maximum\n",
"\n",
"import math\n",
"\n",
@@ -178,7 +175,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Average Length of Several Lines of Text\n",
"\n",
"\n",
"def linecount(text):\n",
@@ -223,7 +219,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Generating Fibonacci Numbers\n",
"\n",
"def fibonacci(count):\n",
"\t\n",
@@ -295,7 +290,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Simulation of a game of chance (shooting craps)\n",
"\n",
"\n",
"\n",
@@ -378,7 +372,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Search for a Maximum\n",
"\n",
"import math\n",
"\n",
@@ -444,7 +437,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Generating Fibonacci Numbers\n",
"\n",
"def fibonacci(count):\n",
"\t\n",
@@ -526,7 +518,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#Compound Interest\n",
"\n",
"import math\n",
"\n",
diff --git a/_Programming_With_C/chapter9.ipynb b/_Programming_With_C/chapter9.ipynb
index 4fbffbe5..00db2e74 100644
--- a/_Programming_With_C/chapter9.ipynb
+++ b/_Programming_With_C/chapter9.ipynb
@@ -25,7 +25,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Lowercase to uppercase text conversion\n",
"\n",
"letter='heavenly feeling'\n",
"letter=list(letter)\n",
@@ -57,7 +56,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Deviations about an average\n",
"\n",
"\n",
"Sum=0.0\n",
@@ -113,7 +111,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Deviations about an average revisited\n",
"\n",
"\n",
"n=5\n",
@@ -168,7 +165,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# passing a three element array to a function where array elements are altered\n",
"\n",
"def modify(a):\n",
" print \"From the function after modifying the values: \"\n",
@@ -226,7 +222,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# use of global variable and transfer of of local and an array to a function\n",
"\n",
"\n",
"a=1\n",
@@ -302,7 +297,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# Reordering a list of numbers\n",
"\n",
"\n",
"def reorder(n,x):\n",
@@ -379,7 +373,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# a piglatin generator\n",
"\n",
"def countwords(english):\n",
" words=1\n",
@@ -467,7 +460,6 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "# adding two tables of numbers\n",
"\n",
"\n",
"\n",